-
Notifications
You must be signed in to change notification settings - Fork 2k
feat(forge): add gas reports for tests #637
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great!
note: we dont current include calldata costs in this snapshot - we could change how we calculate gas in call traces to include calldata costs to make it more realistic for an EOA to call a function |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
very nice
Awesome. I think it may be useful to also include the name of the test that caused the |
ye just keep parent CallArenaTrace decoded function name in the |
Adds
--gas-report
flag toforge test
.Adds
gas_reports
intofoundry.toml
which lets the user specify which contracts they want gas reports for, i.e:or to produce a report for everything:
then if the user does

forge test --gas-report
they will get an output like:Note: the colors you see here are a bit different than what may show up for you. My terminal theme is a bit off and it shows green as yellow and yellow as green.
Partially addresses #137