ApeWorX / ape-foundry

Foundry network provider for the Ape Framework
https://www.apeworx.io/
Apache License 2.0
32 stars 13 forks source link

bug: max fee per gas less than block base fee #81

Closed mikeshultz closed 7 months ago

mikeshultz commented 8 months ago

Environment information

$ ape --version
0.7.2.dev5+g553523a6.d20240108

$ ape plugins list
Installed Plugins
  alchemy       0.7.0
  arbitrum      0.7.0
  etherscan     0.7.0
  foundry       0.7.2
  optimism      0.7.0
  solidity      0.7.1
  tokens        0.7.0
  vyper         0.7.0

What went wrong?

Not entirely sure this is the correct repo, but I do keep getting a race with foundry anvil causing this.

Traceback (most recent call last):
  File "/home/mike/.venvs/unified/lib/python3.10/site-packages/ape_foundry/provider.py", line 518, in send_transaction
    txn_hash = self.web3.eth.send_raw_transaction(txn.serialize_transaction())
  File "/home/mike/.venvs/unified/lib/python3.10/site-packages/web3/eth/eth.py", line 390, in send_raw_transaction
    return self._send_raw_transaction(transaction)
  File "/home/mike/.venvs/unified/lib/python3.10/site-packages/web3/module.py", line 75, in caller
    result = w3.manager.request_blocking(
  File "/home/mike/.venvs/unified/lib/python3.10/site-packages/web3/manager.py", line 325, in request_blocking
    return self.formatted_response(
  File "/home/mike/.venvs/unified/lib/python3.10/site-packages/web3/manager.py", line 288, in formatted_response
    raise ValueError(error)
ValueError: {'code': -32003, 'message': 'max fee per gas less than block base fee'}

How can it be fixed?

I wasn't immediately able to nail down where the max fee per gas value was coming (web3.py's web3.eth.estimate_gas?) from so I'm not sure where it should be fixed. I'm guessing this may be unique to anvil, however.

linear[bot] commented 8 months ago

APE-1641 bug: max fee per gas less than block base fee

mikeshultz commented 8 months ago

Explicitly setting max_fee_per_gas to something high on these transactions works.