Skip to content

Conversation

@schaable
Copy link
Member

Closes #7770

@schaable schaable self-assigned this Dec 12, 2025
@changeset-bot
Copy link

changeset-bot bot commented Dec 12, 2025

⚠️ No Changeset found

Latest commit: 82a9492

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.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

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

@schaable schaable requested a review from Copilot December 12, 2025 21:55
Copy link
Contributor

Copilot AI left a 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 gas snapshot functionality for Solidity tests by adding a --snapshot flag that writes gas consumption data to a .gas-snapshot file. The implementation extracts gas usage from test results (both standard and fuzz tests), formats them in a human-readable format, and persists them to disk.

Key changes:

  • Added gas snapshot extraction, stringification, and file I/O functions
  • Implemented --snapshot flag for the test task that triggers snapshot generation
  • Refactored plugin dependencies to ensure gas-analytics loads after solidity-test

Reviewed changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
gas-snapshots.ts (test) Comprehensive test coverage for snapshot extraction, formatting, and file operations
task-action.ts (test) Modified to forward additional arguments to subtasks
task-action.ts (solidity-test) Updated to collect and return suite results for downstream processing
runner.ts Renamed parameter from configArgs to testRunnerConfig for clarity
index.ts (solidity-test) Removed gas-analytics dependency (moved to gas-analytics plugin)
helpers.ts Refactored hex string to bytes conversion using inline helper function
index.ts (builtin-plugins) Reordered plugin initialization to load gas-analytics after solidity-test
task-action.ts (gas-analytics) New task override that generates snapshots when --snapshot flag is present
index.ts (gas-analytics) Added --snapshot flag and task overrides, plus dependencies on test plugins
gas-snapshots.ts Core implementation for extracting, stringifying, and saving gas snapshots
gas-analytics-manager.ts Fixed min/max calculation to handle edge cases with reduce
Calculator.t.sol New comprehensive test file with various test types and gas snapshots
hardhat.config.ts Removed solidity test timeout configuration
Counter.t.sol Enhanced with invariant tests and gas snapshot tests
Calculator.sol New Calculator contract for demonstration/testing
.gas-snapshot Generated snapshot file with gas consumption data

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@schaable schaable requested a review from fvictorio December 12, 2025 22:05
@schaable schaable force-pushed the gas-analytics/gas-snapshots branch from 3e32473 to a82ec50 Compare December 15, 2025 13:20
@schaable schaable added the no docs needed This PR doesn't require links to documentation label Dec 15, 2025
@schaable schaable changed the base branch from main to feat/gas-snapshots December 15, 2025 15:44
@schaable schaable added the no changeset needed This PR doesn't require a changeset label Dec 15, 2025
@schaable schaable requested review from kanej and removed request for fvictorio December 16, 2025 17:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no changeset needed This PR doesn't require a changeset no docs needed This PR doesn't require links to documentation

2 participants