-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Hardcoded priority fee causes txs on Polygon to fail #3370
Comments
In case it is helpful for investigation, foundry-rs/foundry#3368 is not merged yet, but it fixes the issue in Foundry/ethers-rs by handling Polygon separately. |
any update on this issue @ricmoo? It impacts the users for my hardhat plugin |
This is a known issue with BSC/Polygon, since they do not correctly implement the EIP-1559 standard. Unfortunately for those networks, it is necessary to use a gas station (much like Ethereum did prior to EIP-1559). There isn't really a way to get good data (especially during times of congestion) from the blockchain directly. My best advice would be that someone creates a sub-class of Signer, and overrides the If someone creates a sub-class of Signer, let me know and I'll link to it from the docs. But I don't know there is much that ethers can do directly. Closing for now, but please feel free to continue commenting. I monitor closed issues. :) |
What do you think of this approach: Synthetixio/js-monorepo#915 Uses a Moving Avg. for deriving priority fee. Not sure how good the rest of the implementation is for gas pricing though the approach for deriving a priority fee using only block information is portable across chains (YMMV). Thanks @ricmoo |
So, I think you need to use a gas station to get accurate pricing information. If there is an official gas station or you can get polygon in touch with me, I’ve considered making a custom Network for Polygon, which would support a gas station for gas pricing. :) |
(Oh, and it only affects networks like Polygon and BNB; other networks which capitalize on EIP-1559 economic incentives already work out of the box ;)) |
@wschwab is from Polygon ;) |
@ricmoo I'd be happy to help however I can |
Ethers Version
5.7.1
Search Terms
priority fee, polygon, gas estimation
Describe the Problem
Ethers currently hardcodes the priority fee, where applicable, at 1.5 gwei: source
This creates a quandary on Polygon's main chain, since there is an enforced minimum 30 gwei priority fee there. (I'm looking for a source I can link, though I have confirmed this with Polygon. Update: I still don't have a link to docs or something like this, but here is an announcement on an official forum.) This is probably why users are experiencing issues submitting txs on Polygon: issue
I wasn't sure if this should be called a feature request or a bug, and opted for bug, since the functionality of gas estimation isn't working as expected on a major chain.
fwiw, hardcoding 30 gwei priority is way too high for Ethereum, but would it possible to make a ternary that checks if
network.chainId
is 137 (Polygon main), and if not, use 1.5, and if yes, 30? Something like:(I mean that more for illustrative purposes than as actual code.)
Thanks for reading!
Code Snippet
Contract ABI
No response
Errors
Environment
Polygon
Environment (Other)
n/a
The text was updated successfully, but these errors were encountered: