eth-brownie / brownie

A Python-based development and testing framework for smart contracts targeting the Ethereum Virtual Machine.

Home Page:https://eth-brownie.readthedocs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

basefee OPCODE support in london fork and Awaiting transaction in the mempool error

penandlim opened this issue · comments

Environment information

  • brownie Version: 1.19.2
  • ganache-cli Version: 7.7.3
  • solc Version: 0.8.18
  • Python Version: 3.9.9
  • OS: osx M1

What was wrong?

Contracts that use block.basefee cannot be fetched from explorer due to VirtualMachineError: invalid opcode
When instantiated with ABI, still fails in istanbul hardfork network at the time of simulation.

Trying to use london as fork setting will accept the opcode but then get stuck with Awaiting transaction in the mempool

This can be replicated via this repo
https://github.com/penandlim/brownie-base-fee-test

Replicating basefee fails using ape-safe and eth-brownie

After applying the network-config.yaml, runing the below script fails due to invalid opcode

brownie run --network goerli-fork scripts/basefee_simulation_get_from_explorer.py
Using the hardfork london setting still fails with same error

brownie run --network goerli-fork-london scripts/basefee_simulation_get_from_explorer.py
If we try bypassing compiling by providing the ABI, we encounter a new error. The transaction gets stuck with Awaiting transaction in the mempool and does not proceed.

brownie run --network goerli-fork-london scripts/basefee_simulation_from_abi.py

How can it be fixed?

Allow compiling with london evm_version when contracts are fetched from explorer.
Allow using 0 gwei for gas to prevent tx from getting stuck .

Bumping this, this is an extremely necessary change

@penandlim can you please tell, have you found a workaround for this?

@Shchepetov Unforuntately no :(

Using ganache v7 + brownie 1.19.2 with impartial support for forking seems at best right now. (workaround for waiting in mempool but the new opcodes still doesnt work)

Unfortunately we aren't able to fork and test all contracts using brownie so we have moved to using foundry and hardhat more when we can with tenderly as another supportive tool.

@Shchepetov

Apeworkx/ape package might be able to be used as an alternative. I havent tried it yet but looks like a successor of the brownie project.