Skip to content

Add local gas snapshot baseline#147

Merged
punk6529 merged 4 commits into
mainfrom
codex/local-gas-snapshot-baseline
Jun 12, 2026
Merged

Add local gas snapshot baseline#147
punk6529 merged 4 commits into
mainfrom
codex/local-gas-snapshot-baseline

Conversation

@punk6529

@punk6529 punk6529 commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add focused Foundry gas snapshot scenarios for fixed-price minting, auction bidding/settlement, curator reward claims, final on-chain tokenURI rendering, and dependency script reads
  • commit the v0.1.0 local gas snapshot baseline and wire drift checks into Makefile, Linux/Windows wrappers, and CI
  • include the gas snapshot baseline in release manifest/checksum evidence and update tooling, release, status, test, roadmap, and run-state docs

Closes #146

Validation

  • forge fmt test\StreamGasSnapshot.t.sol test\helpers\CharacterizationTestBase.sol
  • forge test --match-path test\StreamGasSnapshot.t.sol -vvv
  • forge snapshot --match-path test\StreamGasSnapshot.t.sol --snap release-artifacts\baselines\v0.1.0\gas-snapshot.snap
  • forge snapshot --match-path test\StreamGasSnapshot.t.sol --check release-artifacts\baselines\v0.1.0\gas-snapshot.snap
  • python scripts\test_release_manifest.py
  • python scripts\test_release_checksums.py
  • python scripts\generate_release_manifest.py --check
  • python scripts\generate_release_checksums.py --check
  • python scripts\test_changelog_check.py
  • python scripts\check_changelog.py
  • python -m py_compile scripts\generate_release_manifest.py scripts\test_release_manifest.py scripts\generate_release_checksums.py scripts\test_release_checksums.py
  • bash -n scripts/check.sh scripts/bootstrap-ec2.sh
  • PowerShell parser checks for scripts\check.ps1 and scripts\bootstrap-windows.ps1
  • make check
  • powershell -NoProfile -ExecutionPolicy Bypass -File scripts\check.ps1
  • git diff --check

Summary by CodeRabbit

  • Tests

    • Added a gas-snapshot test that benchmarks core flows: fixed-price mint, auction bid/settlement, curator reward claim, on-chain tokenURI, and dependency reads.
  • Documentation

    • Updated release, tooling, status, roadmap, ops, and test docs to describe the committed local gas snapshot baseline and exact verification steps.
  • Chores

    • CI, local check scripts, Make targets, release manifest, and checksum/catalog outputs updated to include and validate the committed gas snapshot on PRs and releases.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.

Tip: disable this comment in your organization's Code Review settings.

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 12, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai

coderabbitai Bot commented Jun 12, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 444bfd14-1699-4257-b4c4-bdde87669e6b

📥 Commits

Reviewing files that changed from the base of the PR and between e6c0469 and 407e79e.

📒 Files selected for processing (3)
  • ops/AUTONOMOUS_RUN.md
  • scripts/generate_release_manifest.py
  • scripts/test_release_manifest.py
✅ Files skipped from review due to trivial changes (1)
  • ops/AUTONOMOUS_RUN.md
🚧 Files skipped from review as they are similar to previous changes (2)
  • scripts/test_release_manifest.py
  • scripts/generate_release_manifest.py

📝 Walkthrough

Walkthrough

Adds a deterministic local Foundry gas snapshot test and committed baseline for core Stream operations; wires snapshot checks into Makefile/CI/check scripts; extends manifest generation and tests to include the baseline; updates release artifacts/checksums, docs, and ops state.

Changes

Local gas snapshot baseline

Layer / File(s) Summary
Gas snapshot test contract and VM interface
test/StreamGasSnapshot.t.sol, test/helpers/CharacterizationTestBase.sol
New StreamGasSnapshotTest with gas-metered tests and a GasSnapshotDelegation stub; Vm interface extended with pauseGasMetering() and resumeGasMetering() cheatcodes.
Build system and CI integration
Makefile, .github/workflows/ci.yml, scripts/check.sh, scripts/check.ps1
Added gas-snapshot and gas-snapshot-check Makefile targets; check target now depends on gas-snapshot-check; CI workflow includes a "Gas snapshot" step; shell and PowerShell check scripts run forge snapshot --check against the committed baseline and log output.
Release manifest generator
scripts/generate_release_manifest.py
Introduces baseline constants and filename, helpers to resolve/validate protocol-versioned gas snapshot paths, optional gas_snapshot_path parameter threaded through manifest build/check/write helpers, and a --gas-snapshot CLI option; generator writes gas_snapshot_baseline into manifest.
Manifest generator tests and fixtures
scripts/test_release_manifest.py
Seed fixtures include a gas-snapshot.snap baseline; tests pass paths['gas_snapshot'] into generator calls; deterministic manifest tests assert release_artifacts.gas_snapshot_baseline and add resolution/mismatch tests.
Release checksums tests
scripts/test_release_checksums.py
Tests write the baseline snapshot fixture, include release-artifacts/baselines in covered paths, and assert the baseline is present in expected checksum lists.
Release artifact manifests and checksums
release-artifacts/latest/release-manifest.json, release-artifacts/latest/SHA256SUMS, release-artifacts/latest/release-checksums.json
Adds gas_snapshot_baseline entry (path, SHA-256, size) to release-manifest.json; inserts baseline into SHA256SUMS and release-checksums.json; updates checksums for changed docs.
Documentation and operational updates
CHANGELOG.md, docs/*.md, release-artifacts/README.md, test/README.md, ops/*.md
CHANGELOG includes baseline entry; release-policy, tooling, status, known-blockers, and README docs add concrete forge snapshot commands and baseline path; ops/ROADMAP and AUTONOMOUS_RUN are updated with Gate D evidence and PR worklog/decision log entries.

Sequence Diagram

sequenceDiagram
  participant StreamGasSnapshotTest
  participant Foundry
  participant CI_Run
  participant ReleaseManifestGenerator
  StreamGasSnapshotTest->>Foundry: run `forge snapshot --match-path test/StreamGasSnapshot.t.sol`
  Foundry->>ReleaseManifestGenerator: produce/compare gas-snapshot against `release-artifacts/baselines/v0.1.0/gas-snapshot.snap`
  CI_Run->>Foundry: CI step runs `forge snapshot --check`
  Foundry-->>CI_Run: logs result to `ci-logs/forge-gas-snapshot.log`
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • 6529-Collections/6529Stream#145: Modifies scripts/generate_release_manifest.py manifest pipeline and adds related generator inputs, overlapping the same generator functions.

Poem

🐰 A rabbit hopped through code at night,

I snapped the gas — a steady light,
Six small flows, a baseline kept,
CI checks wake while others slept,
🥕

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Add local gas snapshot baseline' accurately captures the primary change in the PR: adding a committed gas snapshot file and integrating drift checks throughout the codebase.
Linked Issues check ✅ Passed The PR fully satisfies issue #146 requirements: adds focused gas snapshot scenarios [fixed-price mint, auction bid/settlement, curator claim, tokenURI, dependency reads], commits deterministic baseline to release-artifacts/baselines/v0.1.0/gas-snapshot.snap, wires checks into Makefile/scripts/CI, and updates all required documentation.
Out of Scope Changes check ✅ Passed All changes align with #146 scope: gas snapshot test contract, baseline file, check infrastructure, and documentation updates. No fork/testnet/mainnet measurements, hard budgets, or unrelated refactoring detected.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/local-gas-snapshot-baseline

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
docs/tooling.md (1)

24-52: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Add gas snapshot check to the Local Checks command sequence.

The Makefile's check target includes gas-snapshot-check as a dependency (see relevant code snippet: check: build test gas-snapshot-check size ...), but the bash command sequence documenting what make check runs does not list the gas snapshot check command. Users reading the "Local Checks" section will not see that gas-snapshot-check executes when they run make check.

Add the command between the forge test and forge build --sizes lines:

forge snapshot --match-path test/StreamGasSnapshot.t.sol --check release-artifacts/baselines/v0.1.0/gas-snapshot.snap

This ensures the documentation accurately reflects the complete set of checks integrated into make check.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/tooling.md` around lines 24 - 52, The docs miss the gas snapshot check
listed in the Local Checks sequence; add the missing command invoked by the
Makefile target gas-snapshot-check into the bash snippet shown in tooling.md
between the existing forge test -vvv and forge build --sizes lines: insert the
forge snapshot --match-path test/StreamGasSnapshot.t.sol --check
release-artifacts/baselines/v0.1.0/gas-snapshot.snap command so the documented
sequence matches what the Makefile's check target actually runs.
🧹 Nitpick comments (1)
scripts/test_release_manifest.py (1)

250-253: ⚡ Quick win

Assert the gas snapshot digest, not just its path.

Right now this new coverage only proves the manifest points at the expected filename. A regression that keeps the path but records the wrong sha256 or size_bytes would still pass, which weakens the evidence this PR is adding. Please assert those fields against generator.file_sha256(paths["gas_snapshot"]) and paths["gas_snapshot"].stat().st_size as well.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/test_release_manifest.py` around lines 250 - 253, The test currently
only asserts the gas snapshot path; extend it to also assert the snapshot's
sha256 and size_bytes match the actual file: call
generator.file_sha256(paths["gas_snapshot"]) and compare to
manifest["release_artifacts"]["gas_snapshot_baseline"]["sha256"], and get
paths["gas_snapshot"].stat().st_size and compare to
manifest["release_artifacts"]["gas_snapshot_baseline"]["size_bytes"]; keep the
existing path assert and add these two assertions near the same block in
scripts/test_release_manifest.py.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@scripts/generate_release_manifest.py`:
- Line 22: DEFAULT_GAS_SNAPSHOT currently hard-codes "v0.1.0" which will
silently pin all manifests to that snapshot; change DEFAULT_GAS_SNAPSHOT to be
derived from the release/protocol version used to build the manifest (e.g.,
compose the Path using the release/version variable used elsewhere in the script
or the parsed --version/--release arg) or, if a user supplies --gas-snapshot,
validate that the snapshot path's version component matches the discovered
protocol/release version(s) and raise an error if it does not; update references
to DEFAULT_GAS_SNAPSHOT and the --gas-snapshot handling so the default is
dynamic and a mismatch fails fast.

---

Outside diff comments:
In `@docs/tooling.md`:
- Around line 24-52: The docs miss the gas snapshot check listed in the Local
Checks sequence; add the missing command invoked by the Makefile target
gas-snapshot-check into the bash snippet shown in tooling.md between the
existing forge test -vvv and forge build --sizes lines: insert the forge
snapshot --match-path test/StreamGasSnapshot.t.sol --check
release-artifacts/baselines/v0.1.0/gas-snapshot.snap command so the documented
sequence matches what the Makefile's check target actually runs.

---

Nitpick comments:
In `@scripts/test_release_manifest.py`:
- Around line 250-253: The test currently only asserts the gas snapshot path;
extend it to also assert the snapshot's sha256 and size_bytes match the actual
file: call generator.file_sha256(paths["gas_snapshot"]) and compare to
manifest["release_artifacts"]["gas_snapshot_baseline"]["sha256"], and get
paths["gas_snapshot"].stat().st_size and compare to
manifest["release_artifacts"]["gas_snapshot_baseline"]["size_bytes"]; keep the
existing path assert and add these two assertions near the same block in
scripts/test_release_manifest.py.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 32e2f305-d00d-46fd-87ab-5882d3b159eb

📥 Commits

Reviewing files that changed from the base of the PR and between 9f1c257 and 4739d04.

⛔ Files ignored due to path filters (1)
  • release-artifacts/baselines/v0.1.0/gas-snapshot.snap is excluded by !**/*.snap
📒 Files selected for processing (21)
  • .github/workflows/ci.yml
  • CHANGELOG.md
  • Makefile
  • docs/known-blockers.md
  • docs/release-policy.md
  • docs/status.md
  • docs/tooling.md
  • ops/AUTONOMOUS_RUN.md
  • ops/ROADMAP.md
  • release-artifacts/README.md
  • release-artifacts/latest/SHA256SUMS
  • release-artifacts/latest/release-checksums.json
  • release-artifacts/latest/release-manifest.json
  • scripts/check.ps1
  • scripts/check.sh
  • scripts/generate_release_manifest.py
  • scripts/test_release_checksums.py
  • scripts/test_release_manifest.py
  • test/README.md
  • test/StreamGasSnapshot.t.sol
  • test/helpers/CharacterizationTestBase.sol

Comment thread scripts/generate_release_manifest.py Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@scripts/generate_release_manifest.py`:
- Around line 276-285: The current validation only checks gas_snapshot_path.name
and gas_snapshot_path.parent.name; change it to compare the full normalized path
against the canonical baseline path (BASELINE_DIR / f"v{protocol_versions[0]}" /
GAS_SNAPSHOT_FILENAME) and raise ReleaseManifestError if they differ so only
files under the release-artifacts/baselines/<version>/gas-snapshot.snap are
allowed; update the check around gas_snapshot_path (and related variables
GAS_SNAPSHOT_FILENAME, expected_path) to resolve/absolute both sides before
comparing to prevent accepting paths like /tmp/v0.1.0/gas-snapshot.snap.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ac8cd6f9-de17-4411-b1ca-c342c10c2e90

📥 Commits

Reviewing files that changed from the base of the PR and between 4739d04 and e6c0469.

📒 Files selected for processing (7)
  • docs/tooling.md
  • ops/AUTONOMOUS_RUN.md
  • release-artifacts/latest/SHA256SUMS
  • release-artifacts/latest/release-checksums.json
  • release-artifacts/latest/release-manifest.json
  • scripts/generate_release_manifest.py
  • scripts/test_release_manifest.py
✅ Files skipped from review due to trivial changes (5)
  • release-artifacts/latest/SHA256SUMS
  • release-artifacts/latest/release-checksums.json
  • docs/tooling.md
  • ops/AUTONOMOUS_RUN.md
  • release-artifacts/latest/release-manifest.json

Comment thread scripts/generate_release_manifest.py Outdated
@punk6529 punk6529 merged commit a907219 into main Jun 12, 2026
2 checks passed
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.

Add local gas snapshot baseline

1 participant