Skip to content

feat(budgets): contract size, gas and calldata budget gate (PREWAVE-SC-009) - #854

Open
gbolly122 wants to merge 1 commit into
DigiNodes:mainfrom
gbolly122:feat/contract-budget-gate-684
Open

gbolly122 wants to merge 1 commit into
DigiNodes:mainfrom
gbolly122:feat/contract-budget-gate-684

Conversation

@gbolly122

Copy link
Copy Markdown
Contributor

Summary

Adds a fail-closed budget gate for the canonical V2 operations: claim, commit, reveal, dispute, appeal, settlement, rewards, governance and pause.

  • config/contract-budgets.json: reviewed per-operation gas ceiling, ABI calldata model, worst-case scenario, Optimism fee context (no price promises) and reviewed overrides.
  • config/contract-budget-baseline.json: last reviewed values. Any increase needs a matching override with rationale and reviewer; stale overrides fail.
  • scripts/check-contract-budgets.mjs: enforces gas ceilings against gas-budgets.json, derives worst-case calldata from the declared bounds (oversized-calldata boundary and policy cap), checks size budgets stay within EIP-170, and writes evidence (commit, input SHA-256, toolchain pins) to deployments/releases/contract-budget-evidence.json.
  • CI step plus evidence artifact upload; docs/CONTRACT_BUDGETS.md documents the process.

No storage layout, role, pause, upgrade or economic behavior is changed.

Testing

node --test test/scripts/check-contract-budgets.test.mjs (11 tests: missing operation, gas over budget, oversized calldata, unknown bound, size over network limit, unexplained regression, explicit budget override, stale override, missing baseline) and node scripts/check-contract-budgets.mjs both pass locally.

Not covered

I did not run Foundry or Hardhat locally. Measured gas per operation still comes from the existing Foundry scenario snapshots (check:gas:sc064); this gate checks the reviewed budgets and derived bounds offline.

Closes #684

🤖 Generated with Claude Code

@gbolly122
gbolly122 requested a review from dDevAhmed as a code owner October 23, 2026 16:28
@coderabbitai

coderabbitai Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

…VE-SC-009)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@gbolly122
gbolly122 force-pushed the feat/contract-budget-gate-684 branch from 255284a to 81ced40 Compare October 23, 2026 17:37
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.

PREWAVE-SC-009 — Establish Contract Size, Gas, and Calldata Budgets

2 participants