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

feat(cli): replace gas report #1049

Merged
merged 11 commits into from
Jun 20, 2023
Merged

feat(cli): replace gas report #1049

merged 11 commits into from
Jun 20, 2023

Conversation

holic
Copy link
Member

@holic holic commented Jun 19, 2023

Replaces our slow and error prone approach of generating new test files from magic comments with a Solidity-native approach, inspired by the approach in nomoixyz/vulcan#104.

This hopefully means we can re-open #771 and easier to do #667 (since gas report is now ~just a test output parser)

@changeset-bot
Copy link

changeset-bot bot commented Jun 19, 2023

⚠️ No Changeset found

Latest commit: 20b2285

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@holic holic force-pushed the holic/gas-report branch from bb3a3aa to 20b2285 Compare June 19, 2023 14:08
@holic holic changed the title wip gas report feat(cli): replace gas report Jun 19, 2023
@@ -23,6 +23,12 @@ jobs:
- name: Run tests
run: pnpm test

- name: Generate gas reports
run: pnpm gas-report
Copy link
Member Author

Choose a reason for hiding this comment

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

This is moved here since the gas report runs best if the tests are already compiled/cached.

@holic holic marked this pull request as ready for review June 19, 2023 14:12
@holic holic requested a review from alvrs as a code owner June 19, 2023 14:12
Copy link
Member

@alvrs alvrs left a comment

Choose a reason for hiding this comment

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

lgtm! We should add a note about this being a breaking change for existing users of the gas-report cli to the commit message. Something like:

BREAKING CHANGE:
- make your test files extend `GasReporter` (imported from `@latticexyz/std-contracts/src/test/GasReporter.sol`)
- replace `!gasreport <message>` with `startGasReport(<message>);` and add `endGasReport()` at the end of the code block to be measured 

@holic holic merged commit 93f2851 into main Jun 20, 2023
@holic holic deleted the holic/gas-report branch June 20, 2023 11:58
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.

2 participants