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

Add a buffer gas of "all but one 64th" for gas used on EVM.dryRun #6136

Merged
merged 2 commits into from
Jun 21, 2024

Conversation

m-Peter
Copy link
Contributor

@m-Peter m-Peter commented Jun 20, 2024

Closes: #6135

Addresses the case from EIP-150

  • 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.

Copy link
Member

@ramtinms ramtinms left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wow, one of those things that I would have never guessed it exists :D

Thanks for debugging and adding this

Copy link
Member

@turbolent turbolent left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work!

fvm/evm/emulator/emulator.go Outdated Show resolved Hide resolved
@janezpodhostnik janezpodhostnik added this pull request to the merge queue Jun 21, 2024
Merged via the queue into onflow:master with commit 2a589d8 Jun 21, 2024
55 checks passed
@m-Peter m-Peter deleted the evm-dry-run-create2-bug branch June 21, 2024 17:02
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 this pull request may close these issues.

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