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 gas tracking #128

Open
wants to merge 31 commits into
base: develop
Choose a base branch
from
Open

Add gas tracking #128

wants to merge 31 commits into from

Conversation

gvladika
Copy link
Contributor

@gvladika gvladika commented Jan 30, 2024

Adds gas tracking actions

yarn run gas:snapshotgenerates the referent snapshot
CI runs yarn run gas:check to test there is any diffs compared to referent values
yarn run gas:report prints out a gas report for contract function

Add a special version of gas benchmarker which prints out the gas diff per function call, for current implementation vs. the deployed version of the code. This reported can be used like this:

❯ yarn run gas:report:benchmark
$ ts-node test/gas-reporter/gasReportChecker.ts
Gas diff compared to referent report:
depositEth: -216 (-0.34%)
withdrawEth_executeTransaction: -21173 (-30.14%)
withdrawToken_executeTransaction: -21379 (-16.42%)

It is also possible to run benchmarker against any referent code.
First generate referent report by running:
yarn run gas:report:gen-referent - this will store output to .referentGasReport
Then checkout the other version of code and run benchmark action:
yarn run gas:report:benchmark - since there is existing .referentGasReport, that will be used as referent report instead of the production code one

@cla-bot cla-bot bot added the s label Jan 30, 2024
@gvladika gvladika marked this pull request as ready for review February 9, 2024 17:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant