hardhat ignition shows too high gas fees for L2s
Version of Hardhat
2.22.1
What happened?
npx hardhat ignition deploy ignition/modules/mymodule.ts --parameters ignition/parameters.json --network optimism ✔ Confirm deploy to network optimism (10)? … yes Hardhat Ignition 🚀
Resuming existing deployment from ./ignition/deployments/chain-10
Deploying [ mymoduleModule ]
Batch NomicFoundation/hardhat#1 Executing mymoduleModule#NFT...
An unexpected error occurred:
ProviderError: err: insufficient funds for gas * price + value: address 0x.. have .. want 50626937000000000 (supplied gas 50000000) at HttpProvider.request (/../node_modules/hardhat/src/internal/core/providers/http.ts:90:21)
The "want" is more in line with L1 gas fees ( > $100 ). Same with arbitrum main net. Strangely with Optimism Sepolia it worked, gas fees were more or less as expected ( i think Sepolia test nets don't show post Decun gas fee calculations )
Minimal reproduction steps
i assume it would happen with any other contract, nothing special here an extension of openzeppelin ERC721.
Note: with the old ethers script based deployment ( which is as-is much more simple btw especially regarding parameters which don't require a separate json file ) the issue wasn't observed, gas fees as expected even though the L1 gas was much higher at this point in time.
Search terms
ignition
Any update on this? I tried putting gas in hardhat config but it doesn't work.
We have started taking a look at this and will update here as we make progress.
Hi, I've tested deploying on both Optimism and Arbitrum and have not been able to reproduce this issue.
@glbkst can you provide any more info on this issue? Things like what contracts you were trying to deploy, how much ETH was in your account when you tried to deploy, what blockchain node provider you were using, etc. would be really helpful.
Hi,
i used the project rpc e.g. : https://arb1.arbitrum.io/rpc
Contracts were extended NFT contracts it's verified e.g.: https://arbiscan.io/address/0x65d3642e7481fdded0280d67537a5564d251680a#code and i only can tell what the output of the hardhat tools themselves was, which at least seems to be wrong gas estimates, because the deployment with ethers scripts in hardhat hadn't this error. So i don't know if there is a gas estimation check in the ignition implemenation which (sporadically) has wrong estimates or if at the time of deployment, the fees would have been really this high, which is a bit unlikely though given the numbers in this case. While i think there are some gas limit options i would not know how to set it or which values would be useful. At least i assume that it's not uncommon that one wants to set a limit, would be a very useful feature.
Obviously i put only as much ETH into deployment wallets as seems necessary. But i only did or do a few experiments and don't deploy contracts every week, i don't know why the ignition feature was implemented.
best regards
From: Zoey @.> Sent: Thursday, April 18, 2024 8:09 AM To: NomicFoundation/hardhat-ignition @.> Cc: glbkst @.>; Mention @.> Subject: Re: [NomicFoundation/hardhat-ignition] hardhat ignition shows too high gas fees for L2s (Issue #724)
Hi, I've tested deploying on both Optimism and Arbitrum and have not been able to reproduce this issue.
@glbksthttps://github.com/glbkst can you provide any more info on this issue? Things like what contracts you were trying to deploy, how much ETH was in your account when you tried to deploy, what blockchain node provider you were using, etc. would be really helpful.
— Reply to this email directly, view it on GitHubhttps://github.com/NomicFoundation/hardhat-ignition/issues/724#issuecomment-2063073086, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BGCFN5JDCTIKOAME6JEKGT3Y55PSTAVCNFSM6AAAAABFNDZWZGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANRTGA3TGMBYGY. You are receiving this because you were mentioned.Message ID: @.***>
Hardhat keeps trying to do it (or simulate) with 50M gas, and complains for insufficient funds. But I do not need it to use 50M, I only need 3M and I have enough for that.
For Arbitrum and Optimism it was complaining for insufficient funds, and for Polygon it was trying to send a tx with 1 gwei gas starting gas price, while the one reported by eth_gasPrice was 30 gwei. And my transactions were m.call. Ended up hardcoding the valid values in the ignition source code for my modules to execute.
I can confirm the same is happening on polygon amoy. The cost is way too high https://amoy.polygonscan.com/tx/0x75e99e0739bc3e9595da05b8e2178dfc43c7fcddd3e1411bed64e6016704398e and the setting in hardhat.config was ignored. hardhat v2.22.4 ignition 0.15.5
A fix or workaround would be highly appreciated as i don't have enough funds to deploy our framework on testnet this way. :-(
I didn't observed this issue myself again, maybe Hardhat version 2.22.5 doesn't have it ?
Same issues :(
Same issues :(
Hey @csurbier, could you give us more details of the chain you are deploying to, what you see in terms of gas fees and what you expect?
Hi,
i'm deploying on Polygon Amoy using hardhat-ignition. Didn't try since two months and at that time it was working. Now trying to deploy again same contracts (no change) and i have error : Batch #1 Executing Factories#EventContractFactory... Executing Factories#TicketContractFactory... Executing Factories#TicketReservationContractFactory... Executing Factories#TicketTypeContractFactory... Executing Factories#TokenPaymentSplitter...
An unexpected error occurred:
ProviderError: err: insufficient funds for gas * price + value: address 0x169A3AF28ed1C191E273de870003493e6102f138 have 183887700227272522 want 260406579229180065 (supplied gas 5038671)
You can see in my transaction history it was working fine (73 days ago) for few gas fees : https://amoy.polygonscan.com/txs?a=0x169A3AF28ed1C191E273de870003493e6102f138 This transaction for example : https://amoy.polygonscan.com/tx/0x2112efc2316fb849af5900b3f252af030baa3dfd25edab665b5cf2c13bd687c8
i succeed to deploy few contracts this morning, such as : https://amoy.polygonscan.com/tx/0xb431bbc22037e1603bc71a2f2bbd90f7f3a11cc7b5918901651afb7ad9357f5b but gas fees are way too high ! so it can't deploy all my contracts because it can't be possible to have lot of matic with Amoy Faucet. So i'm stuck and can't deploy anymore my contracts :(
For your information, i have re-install hardhat, hardhat-ignition... in a new fresh clean project but still same issue. Thanks for your help.
My packages.json: { "name": "hardhat-project", "devDependencies": { "@nomicfoundation/hardhat-ignition-ethers": "^0.15.5", "@nomicfoundation/hardhat-toolbox": "^5.0.0", "hardhat": "^2.22.7" }, "dependencies": { "@chainlink/contracts": "^1.2.0", "@nomicfoundation/hardhat-verify": "^2.0.9", "@openzeppelin/contracts": "^5.0.2", "@typechain/ethers-v6": "^0.5.1", "@types/chai": "^4.3.17", "@types/mocha": "^10.0.7", "abdk-libraries-solidity": "^3.2.0", "dotenv": "^16.4.5", "hardhat-contract-sizer": "^2.10.0", "hardhat-gas-reporter": "^2.2.0" } }
and found this issue : https://github.com/maticnetwork/bor/issues/1213
Hi,
Try again same smart contracts, same ignition command to deploy but on SEPOLIA network. No gas fees issues, deployed with few gas fees: https://sepolia.etherscan.io/address/0x169A3AF28ed1C191E273de870003493e6102f138
Issue is specific to deploying on Amoy. And it's quite new because i was able to deploy exactly same things two month ago as you can see in my Amoy transaction history. On mumbai network never had this issue.
Thanks
Hi,
Try again same smart contracts, same ignition command to deploy but on SEPOLIA network. No gas fees issues, deployed with few gas fees: https://sepolia.etherscan.io/address/0x169A3AF28ed1C191E273de870003493e6102f138
Issue is specific to deploying on Amoy. And it's quite new because i was able to deploy exactly same things two month ago as you can see in my Amoy transaction history. On mumbai network never had this issue.
Thanks
Thanks for the information, we will look at what our implementation is doing different from ethers (which is what is used in your successful deploy scripts) when targeting Amoy.
Hi,
May be i could have an explanation. Since MATIC value has decreased a lot (around 0.36 €) , gas fees are the same but it's required more MATIC to pay and since it's on Amoy , we can't get much more token (only 0.2 per wallet/day) because it's a faucet...
Ignition takes responsibility for calculating gas fees, the logic was developed with a focus on L1, we are seeing issues when targeted against Polygon as it uses different logic to determine gas. We are currently working through upgrading our gas fee logic to work more consistently across the alternate L1s and the L2s that are proving most popular.
+1 here, on SEPOLIA. Very poor developer experience ever. Very frustrating.
+1 here, on SEPOLIA. Very poor developer experience ever. Very frustrating.
Same with sepolia. Have you got any solution?
Hi @andersoncampolina @Tronglx
I've been unable to reproduce any issues with deployments to Sepolia. Double check what account you're using and that it has Sepolia ETH in it. Also, ensure that you're using the most recent version of Hardhat Ignition (v0.15.6 as of the time of this comment).
If you're still having problems, I'd recommend opening a new issue with as much info as you can provide; at the bare minimum, listing the Hardhat Ignition version you're using as well as reproduction steps would be helpful.