-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(forge): add
vm.lastCallGas
cheatcode (#7573)
* add `gasUsed and lastGasUsed methods to Vm * reorder * basic sketching of idea, planning to use Gas struct to deliver as much gas related information rather than a uint256 * add transformation * to prevent recording gas by default, only enable after recordGas is enabled * update struct layout, implementation builds, now connecting to cheatcodes * fix cheatcodes * refactor to use simple u64 as Gas struct doesnt have a default * change from Gas struct to simple u64 as I ran into issues with cache being reset to 0 * it appears cheatcodes are resolved before the actual function calls are therefore it doesnt actually remember the correct value from the previous execution but only of the previous executed cheatcode * still not working * finally works, stupid me didnt realize i had to cross call frames * emit gas record * test convenient single field access * add gas record struct back * pass down isolate bool, only enable gas tracing if enabled * raise error if cheatcode is used outside of isolation mode * mark as view * show gas refund and memory expansion * improve example * add isolation test, currently does not run as expected * fix fmt * avoid formatting changes * avoid commiting formatting changes, editor now configured correctly * lastGasUsed -> lastCallGas * small name fix * remove separate isolation profile, just configure on the runner * fix forge fmt * note on why path should never happen * remove separate isolated param, inherit from config * add support for non-isolation mode * remove isolate standalone, create additional entry in cheats and document subset of cheats that require to be tested in isolation mode as well * improve tests, use asserts and add option to exclude contracts from test filter, not just individual tests or paths * typo, no need to define path exclusion of forks in isolated tests as it is not relevant
- Loading branch information
1 parent
04e2263
commit b88d167
Showing
10 changed files
with
293 additions
and
21 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.