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

Gas misscalculations #203

Open
MarcosNicolau opened this issue Aug 16, 2024 · 0 comments
Open

Gas misscalculations #203

MarcosNicolau opened this issue Aug 16, 2024 · 0 comments

Comments

@MarcosNicolau
Copy link
Contributor

MarcosNicolau commented Aug 16, 2024

When comparing our vm with the vm1, there are several differences in the remaining gas, here are some of the places we are missing:

  • Heap growth: the heap starts with a free size of u32::MAX, so we should start charging gas if the bound to grow is higher than that number.
  • Stipend gas: when pushing a new far_call frame if the bytecode was for the evm interpreter, we add a stipend gas, but on ret, we should not be adding that gas back to the new frame.
  • Inexplicit panics: this functions behaves like a typical instruction and so we should be also spending the usual static gas, with the only exception we fell in there because we actually ran out of gas, in that case, the inexplicit panic is free of cost.
  • Invalid opcode: should burn all frame gas.
  • We should burn all gas in heap write last address check(see here).

To test the differences in gas, this pr might be useful.

Btw, some fixes have been addressed in this pr, but it might got old since the newer changes so it might be better to just re-implement them.

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

No branches or pull requests

1 participant