`GethPOAMiddleware` is not correctly applied to Polygon POS mainnet and Polygon Amoy testnet
zomglings opened this issue · comments
Environment information
brownie
Version:1.20.2
- Python Version:
3.12.3
- OS: osx
What was wrong?
The GethPOAMiddleware.get_layer
method runs w3.eth.get_block(0)
, which doesn't error out on Polygon mainnet and the Amoy testnet.
How can it be fixed?
Changing the check to w3.eth.get_block("latest")
resulted in the error being fixed.
There were previously issues with people using Ganache forks of these networks, though, which added blocks that didn't cause errors, which seems to be why the code was changed to look up 0, and which is why I haven't made a PR: #1217
Maybe switching to some other block would work?
Perhaps use "latest"
when connected to a live network, and use 0
when on a development network.