foundry
foundry copied to clipboard
Failed to estimate gas for CREATE2 deployment on Arbitrum
Component
Forge
Have you ensured that all of these are up to date?
- [X] Foundry
- [X] Foundryup
What version of Foundry are you on?
forge 0.2.0 (5910e7b 2022-08-25T00:04:03.61597382Z)
What command(s) is the bug in?
forge script
Operating System
Linux
Describe the bug
Running this script using this command:
forge script script/LlamaPayBotDeploy.sol --private-key "${PRIVATE_KEY}" --rpc-url "${ARBITRUM_RPC}" --verify --broadcast --etherscan-api-key "${ARBISCAN_API_KEY}"
results in forge not being able to estimate gas for tx.
I have also tried trying multiple Arbitrum RPCs and it yields the same result.
Seems like the CREATE2 deployer we use 0x4e59b44847b379578588920ca78fbf26c0b4956c
is not deployed on arbitrum.
It is deployed on mainnet and rinkeby arbitrum but it may not be deployed on the new nitro goerli deploy if that's what you're testing
$ cast code 0x4e59b44847b379578588920ca78fbf26c0b4956c --rpc-url $ARBITRUM_RPC_URL
0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe03601600081602082378035828234f58015156039578182fd5b8082525050506014600cf3
It is deployed on mainnet and rinkeby arbitrum but it may not be deployed on the new nitro goerli deploy if that's what you're testing
Am trying to deploy on mainnet
I'm experiencing the same issue but not related to CREATE2
. When I try to deploy something to arbitrum I get the failed to extimate gas for tx
error, but when I try to deploy the same contract to mainnet it works with no issues. I tried with alchemy private endpoints and also anker public endpoints and I'm getting the same behavior with both
UPDATE: I can confirm this happens only when using scripts, deploying through forge create
works just fine
running into this as well atm -- anyone look into it yet or have a work around (short of deploying w create
which doesn't have deterministic deploys)?
fwiw
forge 0.2.0 (83a9dc7 2022-10-05T00:15:21.378381Z)
@joshieDo have you noticed any issues testing w arb mainnet on https://github.com/foundry-rs/foundry/pull/2541 ?
hey guys, any update by chance? having the same issue for arbitrum mainnet, can't call a write function on a deployed contract with forge scripts, the exact same set up works with arbitrum goerli. command looked like this:
forge script script/MyContract.s.sol:MyScript --rpc-url https://rpc.ankr.com/arbitrum --broadcast
ususally get a message like this:
Script ran successfully. Error: Failed to estimate gas for tx: 0x513b…88e4
Occasionally ill get this message:
` The application panicked (crashed). Message: Could not instantiate forked environment: Could not instantiate forked environment with fork url: https://arb1.arbitrum.io/rpc
Context:
- Failed to get block for block number: 29225231 latest block number: 29225231 Location: C:\Users\13018.cargo\git\checkouts\foundry-f7cca724e93059b0\3a462eb\evm\src\executor\opts.rs:56
This is a bug. Consider reporting it at https://github.com/foundry-rs/foundry `
I've tried several different rpc urls found on https://chainlist.org/ please let me know if i did something wrong! Thanks!
just ran into this on arbitrum-goerli
as well (can recreate via https://github.com/0xSplits/splits-liquid script simulation)
hmm @wminshew what's the forge script command that results in an error here? will debug.
hmm @wminshew what's the forge script command that results in an error here? will debug.
in https://github.com/0xSplits/splits-liquid you can run
forge script script/LiquidSplitFactory.s.sol:LiquidSplitFactoryScript --rpc-url $ARB_RPC_URL -vvvv
forge script script/LiquidSplitFactory.s.sol:LiquidSplitFactoryScript --rpc-url $ARB_GOERLI_RPC_URL -vvvv
in https://github.com/0xSplits/splits-waterfall you can run
forge script script/WaterfallModuleFactory.s.sol:WaterfallModuleFactoryScript --rpc-url $ARB_RPC_URL -vvvv
(interestingly enough 20 days ago arb-goerli worked in the waterfall repo although on the latest foundryup I don't think it's working anymore)
@wminshew found a but with gas estimation for chains that have different calc, with #3549 I was able to deploy succesfully.
@wminshew found a but with gas estimation for chains that have different calc, with #3549 I was able to deploy succesfully.
thanks for the quick turn around. Confirmed to work on arb mainnet w waterfall repo & on arb mainnet & goerli w liquid repo
looks like the ordering of contracts in verification has changed (for the worse), but will open a separate issue for that
thank you!
I'm still encountering this error as well, on all Arbitrum networks - One, Nova, and Goerli.
Hello, same here, I'm still getting the error while deploying on an Arbitrum fork in script with forge version 0.2.0 (15c0226 2022-11-18T00:11:16.546830339Z)
.
Are people still seeing this error now that arbitrum has upgraded to nitro on mainnet/testnets?
Yup, I see this regularly while trying to deploy to Arbitrum Goerli (at times there is also the RPC error of max fee per gas less than block base fee
)
Saw this error while trying to deploy on Arbitrum today, and it seems to be due to a gas estimation error (tried multiple RPCs to be sure)
.
Actual deployment cost was 0.0039331355 ETH. I had to top up my deployer with excess ETH for this deployment to succeed.
Saw this error while trying to deploy on Arbitrum today, and it seems to be due to a gas estimation error (tried multiple RPCs to be sure)
.
Actual deployment cost was 0.0039331355 ETH. I had to top up my deployer with excess ETH for this deployment to succeed.
Bumping for visibility, we cannot deploy to arbitrum mainnet with most recent foundry
`Failed to estimate gas for tx: 0xc0dfd71034b0e538500086df53633683f769e6365db61fc579f6473933053560´
Also, estimated total cost for all transactions is a whopping 6.22 ETH. Something wrong is going on
foundryup: installed - forge 0.2.0 (0e33b3e 2023-07-28T00:23:39.362605000Z) foundryup: installed - cast 0.2.0 (0e33b3e 2023-07-28T00:23:39.362605000Z) foundryup: installed - anvil 0.1.0 (0e33b3e 2023-07-28T00:23:55.455062000Z) foundryup: installed - chisel 0.1.0 (0e33b3e 2023-07-28T00:23:55.584471000Z)
tagging @gakonst @Evalir
I am also experiencing a similar problem when attempting to deploy to arbitrum.
We recently introduce a flag to script --priority-gas-price
(#5585, see docs)—This should help alleviate the high cost issue by letting y'all set the price manually. Please try it and let us know 🙏
Will give that a try, FWIW I was receiving this error while using forge create
. Adding the --legacy
flag seemed to alleviate the issue.
Makes sense! we should prob replicate this for create
if it's not there already
Any updates here? I have the same error when deploying to an Arbitrum One fork.
--priority-gas-price
flag does not alleviate the issue.
Any updates here? I have the same error when deploying to an Arbitrum One fork.
--priority-gas-price
flag does not alleviate the issue.
Seems like this is because of the push0
opcode not supported on Arbitrum.
Dropping to 0.8.19 pragma allowed deployment.
0.8.19 did not help, issue still valid,
used --legacy option for workaround on Arbitrum Sepolia
Also had to use --with-gas-price 100000000
once.
Cannot deploy towards Tenderly devnet (Arbitrum):
Chain 421611
Estimated gas price: 0.1 gwei
Estimated total gas used for script: 50945202
Estimated amount required: 0.0050945202 ETH
==========================
###
Finding wallets for all the necessary addresses...
##
Sending transactions [0 - 1].
Error:
Failed to estimate gas for tx: 0xfec8e1a395163625e93b680a4ed4f3bf2a...
Context:
- (code: 3, message: insufficient funds for gas * price + value, data: None)
Still valid issue with latest foundryup.
Failed to estimate gas for tx: 0x2abb866e7fbd57919ac30c1a9867f6bf16446c911f5e229406ac5fb7e374e2ba
Tested towards latest fork of Arbitrum Sepolia (by Tenderly testnets) with:
💤 forge script script/DeployArbitrum.s.sol -vvvv --rpc-url $RPC --trezor --hd-paths "m/44'/60'/0'/0/xx" --sender 0x... --legacy --with-gas-price 100000000 --slow --broadcast
where I checked up front the sender has enough funds.
Interestingly it was deployed without error towards latest Arbitrum production fork.
I had to use the --legacy
flag to deploy to Arbitrum One, no other options of setting a fixed gas price worked until I used a legacy flag.