-
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
Deploy to Optimism via script fails after incorrect gas estimation #4903
Comments
I am experiencing something similar, deploying to mainnet. Wallet has triple the ETH in it relative to the estimate
Command: macOS (Apple Silicon)
|
I also had this issue. Given that the majority of the gas consumed by a L2 transaction on Optimism (at this stage) is in the L1 gas component, the gas estimation functionality is fairly useless on Optimism. I have also noticed that it overestimates the gas price unless you use --legacy (perhaps related to this issue #4547). Optimism has described here how the L1 fee could be estimated, by reading from the gas oracle contract, so perhaps that could be a way foundry could address this issue. |
Just bumped into this issue as well, but when trying to deploy to Arbitrum. My account is funded with 0.04 ETH, but the gas estimation reports (incorrectly) that I need ~0.0821 ETH instead:
This estimation is wrong. I deployed bigger contracts yesterday and they cost much less than that. |
I ended up having to deploy via Remix + MetaMask because of this bug 😬 |
I’m having the same issue mentioned here via Arbitrum |
@ctate see a neat workaround on Twitter: Is it possible to send CREATE transactions via MetaMask (without using Remix)?. |
@PaulRBerg your issue is likely that the L1 basefee increased since your previous contract deployments. On Arbitrum gas estimation fluctuates with the L1 basefee, since you pay for the cost of posting calldata to L1 with L2 gas. Contract deployments use a lot of calldata so estimates are especially sensitive to changes. Your best bet is to estimate right before deployment. |
I'm quite sure that that was not the issue. I ended up deploying my contract with MetaMask using the trick described here and the gas paid was way, way, way less than what was estimated by Forge.
That's what |
FIxed by #7106 |
Component
Forge
Have you ensured that all of these are up to date?
What version of Foundry are you on?
forge 0.2.0 (8adf428 2023-05-08T00:04:45.691256000Z)
What command(s) is the bug in?
forge script script/MyScript.s.sol -f optimism --broadcast --verify
Operating System
macOS (Apple Silicon)
Describe the bug
I have a script that deploys an implementation contract and a clone factory. I'm currently attempting to run the script to deploy to Optimism. Simulation run works just fine, but when broadcasting I end up with a
code -32000 [...] insufficient funds for gas * price + value
error.I have confirmed that all my wallet and rpc configs are correct (I'm able to broadcast a simple eth transfer on optimism, for example).
As you can see in the screenshot below, the deployer balance exceeds the estimated amount required value, but the broadcast is still failing. It appears that the cost estimation is way too low, likely because it excludes the L1 gas component that is part of an L2 transaction.
The text was updated successfully, but these errors were encountered: