-
Notifications
You must be signed in to change notification settings - Fork 1.7k
feat: setup basic snapshot test for gas stats #7499
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
base: main
Are you sure you want to change the base?
Conversation
|
d6d0d2e to
1ae0771
Compare
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.
Pull Request Overview
This PR implements basic snapshot testing for gas usage statistics to track and validate gas consumption in smart contract tests. The author chose a custom implementation to avoid adding external dependencies due to security concerns, with plans to revisit for Solidity tests.
- Adds a custom snapshot testing system that captures gas statistics from Hardhat test runs
- Creates comprehensive test suites for Counter and Calculator contracts to generate gas usage data
- Integrates snapshot testing into the project's test workflow
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| v-next/example-project/test/snapshot-test.js | Implements custom snapshot testing functionality for gas statistics |
| v-next/example-project/test/node/counter.ts | Adds Node.js test suite for Counter contract with various gas-consuming operations |
| v-next/example-project/test/node/calculator.ts | Adds Node.js test suite for Calculator contract with comprehensive operation coverage |
| v-next/example-project/package.json | Updates test scripts to include snapshot testing commands |
| v-next/example-project/contracts/Counter.sol | Enhances Counter contract with additional functions for comprehensive gas testing |
| v-next/example-project/contracts/Calculator.sol | Adds new Calculator contract with arithmetic operations for gas testing |
| v-next/example-project/.snapshots/gas-stats | Creates initial gas statistics snapshot file |
| v-next/config/.prettierignore | Excludes snapshot directory from Prettier formatting |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
417938e to
f04e695
Compare
1ae0771 to
56aeef9
Compare
12c84f6 to
98a4d52
Compare
This PR adds basic snapshot testing for gas statistics. Ideally we'd use something like Jest snapshots, but I avoided adding dependencies due to recent npm security issues. I'll revisit this approach when we implement
gas stats for Solidity tests, since we'll need snapshot testing there as well.the combined gas statistics table.