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

fix(cheatcodes): reset interpreter gas to the value of gas spent #8481

Merged
merged 6 commits into from
Jul 20, 2024

Conversation

grandizzy
Copy link
Collaborator

@grandizzy grandizzy commented Jul 19, 2024

Motivation

Closes #8383

Solution

  • when ending execution frame, reset interpreter gas to the value of gas spent during frame

@grandizzy grandizzy changed the title fix(cheatcodes): do not record gas changes if exec frame not started [WIP] fix(cheatcodes): do not record gas changes if exec frame not started Jul 19, 2024
@grandizzy grandizzy force-pushed the fix-8383 branch 2 times, most recently from ce91c7a to 7850720 Compare July 20, 2024 08:21
@grandizzy grandizzy changed the title [WIP] fix(cheatcodes): do not record gas changes if exec frame not started fix(cheatcodes): reset interpreter gas to the value of gas spent during frame Jul 20, 2024
@grandizzy grandizzy changed the title fix(cheatcodes): reset interpreter gas to the value of gas spent during frame fix(cheatcodes): reset interpreter gas to the value of gas spent Jul 20, 2024
@grandizzy grandizzy marked this pull request as ready for review July 20, 2024 09:01
// It would be nice if we had access to the interpreter in
// `call_end`, as we could just do this there instead.
interpreter.gas =
Gas::new(interpreter.gas.limit() - interpreter.gas.remaining());
Copy link
Member

Choose a reason for hiding this comment

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

'gas.spent()' ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

thanks, missed that, updated in 2d3788d

@grandizzy grandizzy merged commit fc807df into foundry-rs:master Jul 20, 2024
20 checks passed
@grandizzy grandizzy deleted the fix-8383 branch July 20, 2024 13:52
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.

bug: vm.pauseGasMetering causes MemoryOOG with certain inline-assembly
3 participants