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

Overestimated gas prices for cheap chains #7089

Closed
klkvr opened this issue Feb 12, 2024 · 1 comment · Fixed by #7106
Closed

Overestimated gas prices for cheap chains #7089

klkvr opened this issue Feb 12, 2024 · 1 comment · Fixed by #7106
Labels
T-bug Type: bug

Comments

@klkvr
Copy link
Member

klkvr commented Feb 12, 2024

Component

Forge

Describe the bug

Mentioned in #6503 (comment) and #4903 (comment).

Currently, due to ethers internals being oriented on Mainnet, gas prices for scripts are often over-estimated to be around 3 gwei when the actually needed gas price might be less than 1 gwei.

It can be reproduced by dry-running any script on any L2 via forge script <SCRIPT_CONTRACT> --rpc-url <RPC_OF_L2>

For Arbitrum the output will include

Estimated gas price: 3.2 gwei

And the estimation of required funds for execution will be calculated considering gas price being 3.2 as well, which is much higher than is actually needed and can result in script failing due to sender not having enough funds.

This is reproducible on Optimism, Base, Arbitrum and any other cheap chain I believe. Currently common workaround is to add --legacy flag to the command which helps avoiding priority fee calculation.

I am not sure what's the best way to fix this as it is possible that we might break some scenarios as for some L2s this overestimation helped avoiding situations when script sender does not have enough funds to cover additional L2 fees. For example, the actuall gas price on Base is around 0.000000315, but usually most of tx cost is coming from L1 fees which are not included in the estimation currently

@klkvr klkvr added the T-bug Type: bug label Feb 12, 2024
@gakonst gakonst added this to Foundry Feb 12, 2024
@github-project-automation github-project-automation bot moved this to Todo in Foundry Feb 12, 2024
@simplyoptimistic
Copy link

This is a duplicate of this issue: #5709, I believe. The discussion there explains why it is currently unfixed.

@jenpaff jenpaff moved this from Todo to Completed in Foundry Sep 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-bug Type: bug
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants