Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GethPOAMiddleware is not correctly applied to Polygon POS mainnet and Polygon Amoy testnet #1762

Closed
zomglings opened this issue Apr 12, 2024 · 1 comment · Fixed by #1769
Closed

Comments

@zomglings
Copy link
Contributor

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.

image

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?

@iamdefinitelyahuman
Copy link
Member

Perhaps use "latest" when connected to a live network, and use 0 when on a development network.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants