-
Notifications
You must be signed in to change notification settings - Fork 486
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
Incorrect gas estimation causing OutOfGas
error
#1500
Comments
This has also become an issue for On older version it was working just fine, so this bug was introduced with one of the reworks for gas estimation that I see happened. |
This PR fixes some issues with |
@zjb0807 but this PR is included on the |
This issue seems to have a major impact. Basic user interactions (e.g. sending ERC20 tokens through Metamask) are mostly non-operational. From a user perspective, the tokens will seem locked and unusable, and this definitely requires an escalation. Apart from an (urgent) fix to this, I suggest an e2e test be created with at least one major wallet which is added into the CI/CD pipeline. |
@zjb0807 I have upgraded to Any idea what is going on here? cc @boundless-forest might have some hint, as he was involved in the previously mentioned fixes. |
Sorry for the delayed response. I've been a bit busy lately. I believe the issue you're encountering is due to missing something in the runtime during the upgrade. I took a quick look at your repo, https://github.com/freeverseio/laos/blob/main/runtime/laos/src/apis.rs, and noticed that the EVM call and create differ from the Frontier template node. You can check it here: https://github.com/polkadot-evm/frontier/blob/stable2407/template/runtime/src/lib.rs#L786-L864. You can revise them and then give it another attempt. Tips: While upgrading the polkadot-sdk, you need to review all the changes that occur instead of relying solely on the compile results. |
@boundless-forest that was exactly the problem. It is working now, even with the |
Overview
When sending transactions for the precompile
pallet-parachain-staking
, gas estimation is not working for some calls. We also realized that gas estimation is incorrect for other pallets as well, as described here.Details
When sending the
delegate
action using Remix + Metamask, thepallet-evm
raises anOutOfGas
error, as shown in the PolkadotJS UI:However, when performing the same action using web3 libraries, the issue does not occur. Setting a fixed amount of gas allows the process to work fine. The problem is that Metamask sets the gas amount by retrieving the value from a previous call to
eth_estimateGas
. The estimation returned for the delegation call is101433
, but the actual gas consumption for delegation is220440
. As a result, when using Metamask, the gas value is lower than the actual gas used, causing the call to run out of gas and resulting in theOutOfGas
error frompallet-evm
.The workaround is to set a sufficiently high fixed gas amount to ensure the transaction does not run out of gas during execution.
A brief investigation revealed that Moonbeam forked all EVM-related projects and introduced the concept of storage growth related to gas, as described here. Further investigation is needed to determine whether the discrepancies in estimation are due to this.
Other calls that ran out of gas:
Environment
polkadot-v1.11.0
Expected Behavior
As a Metamask (or any web3 tool) user, I want to perform all EVM actions using the gas value obtained from estimation, without needing to set a fixed value to prevent running out of gas. Standard online tools should work out of the box.
The text was updated successfully, but these errors were encountered: