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

[Flow EVM] EVM.dryRun should report sufficient gas estimation for CREATE / CREATE2 opcodes #6135

Closed
m-Peter opened this issue Jun 20, 2024 · 0 comments · Fixed by #6136
Closed

Comments

@m-Peter
Copy link
Contributor

m-Peter commented Jun 20, 2024

Currently, the gasUsed field return from EVM.dryRun, returns the correct gas usage, after the transaction execution. However, since most users will pass this value as the gas limit to eth_call or eth_sendRawTransaction, we need to add some buffer gas. We already do that, but there's a case for CREATE / CREATE2 opcodes, which we didn't handle. Relevant EIP: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-150.md#specification

  • Define "all but one 64th" of N as N - floor(N / 64).
  • If a call asks for more gas than the maximum allowed amount (i.e. the total amount of gas remaining in the parent after subtracting the gas cost of the call and memory expansion), do not return an OOG error; instead, if a call asks for more gas than all but one 64th of the maximum allowed amount, call with all but one 64th of the maximum allowed amount of gas (this is equivalent to a version of EIP-90Send all gas in call ethereum/EIPs#90 plus EIP-114Substitute call stack limit with child gas restriction ethereum/EIPs#114). CREATE only provides all but one 64th of the parent gas to the child call.

Relevant Discord Thread

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant