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

Ethereum - incorrect gas estimation for certain input #1180

Closed
Dinonard opened this issue Feb 20, 2024 · 1 comment
Closed

Ethereum - incorrect gas estimation for certain input #1180

Dinonard opened this issue Feb 20, 2024 · 1 comment
Labels
project Issue is part of an ongoing project

Comments

@Dinonard
Copy link
Member

Dinonard commented Feb 20, 2024

Overview

It has been observed that gas estimation will return incorrect value when provided with certain inputs.
Once transaction is submitted with the estimated value, it will fail with OutOfGas error.

Details

  • smart contract interface can be found here
  • contract is deployed on Astar Network, on address 0xc6bf0C5C78686f1D0E2E54b97D6de6e2cEFAe9fD
  • at least 1 ASTR should be provided as value with the call

The function of interest is the following one:

  /// Minted vNative assets such as vASTR, vGLMR, vMOVR
  function mintVNativeAsset(
      address receiver,
      string memory remark
  ) external payable;

The received address isn't important, but depending on the string remark value, the gas estimate will be correct or incorrect.
It's worth mentioning that remark is only emitted as part of an event, and put inside another subcall's blob (precompile call to XCM transact), and has no effect on logic execution.

When Hello is used as remark value, the gas estimate will be around 167k.
When Hell is used, the gas estimate will be around 180k.

For some reason, adding an 'o' will cause the estimate to drop significantly.
And if call is submitted, as mentioned before, it will fail with OutOfGas error.

The following example can be replicated on any Astar node (current version is astar-80) by using eth.gasEstimate call.

One example of the data for the call:

  • Hello - 0x62c64fe10000000000000000000000004597c97a43dfbb4a398e2b16aa9ce61f90d801dd0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000548656c6c6f000000000000000000000000000000000000000000000000000000
  • Hell - 0x62c64fe10000000000000000000000004597c97a43dfbb4a398e2b16aa9ce61f90d801dd0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000448656c6c00000000000000000000000000000000000000000000000000000000
@Dinonard
Copy link
Member Author

Issue no longer exists.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
project Issue is part of an ongoing project
Projects
None yet
Development

No branches or pull requests

1 participant