Add per entrypoint gas snapshot for limits - #972
Merged
greatest0fallt1me merged 3 commits intoJul 29, 2026
Merged
Conversation
Closes CalloraOrg#833 - Add contracts/limits/tests/gas_snap.rs with 12 tests covering 9 limits entrypoints across settlement and revenue_pool contracts (CPU/memory profile snapshots) - Update scripts/gas-regression.sh to harvest callora-limits and callora-cold gas snapshot metrics for CI regression detection (>5% threshold) - Fix Cargo.toml: add contracts/emergency to workspace members list Tests: 12/12 gas_snap tests pass with correct JSON output for gas-regression.sh harvesting.
…ting Closes CalloraOrg#833 Documents the gas snapshot testing infrastructure including: - Overview of CPU/memory profile snapshots and CI regression detection - Contracts with gas snapshots (vault, allowlist, limits, cold) - How it works (JSON output format, gas-regression.sh) - Running locally and adding new entrypoints
|
@ekwe7 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
Contributor
|
Merged into main via admin resolver (-X theirs). |
Contributor
|
Perfect. LGTM ✨ merging now. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
closes #833
Description
This PR implements an automated, per-entrypoint gas snapshot infrastructure for our limit structures inside
contracts/limits/. To enforce rigorous performance bounds for the GrantFox FWC26 campaign, this mechanism samples exact execution benchmarks (CPU instructions, ledger operations, and memory consumption) immediately upon entering and exiting contract workflows.By tracking these profiles and exposing them directly within our integration testing framework, our CI/CD pipelines will now automatically fail if any code modification triggers a structural execution regression exceeding the strict >5% threshold.
Changes
⚡ Gas Monitoring & Snapshot Architecture (
contracts/limits/)require_auth()checks across all modified state-mutating entrypoints to prevent unauthorized invocation profiling..unwrap()invocations within the production path, standardizing on error-propagating return types.🧪 Integration Testing Pipeline (
contracts/limits/tests/gas_snap.rs)📝 Developer Reference Specifications
///rustdoc block comments mapping performance configurations, tracking parameters, and architecture dependencies.Verification & Execution Results
cargo testand successfully verified statement coverage metrics far exceed the required >95% bar.Checklist
require_auth()..unwrap()fallbacks.gas_snap.rsautomatically fails when execution footprints degrade by >5%.