Skip to content

feat: add contract-size and settlement guardrails - #4

Merged
dirtybits merged 2 commits into
mainfrom
feat/contract-size-protocol-guardrails
Jul 11, 2026
Merged

feat: add contract-size and settlement guardrails#4
dirtybits merged 2 commits into
mainfrom
feat/contract-size-protocol-guardrails

Conversation

@dirtybits

@dirtybits dirtybits commented Jul 10, 2026

Copy link
Copy Markdown
Owner

Summary

  • Upgrade ethereum-development to v2.1.0 with deployed-runtime budgeting as an architecture, testing, and deployment gate.
  • Add a contract-size reference covering EIP-170, ABI encoder costs, linked libraries, separate contracts, viaIR, delegate modules, facets, proxies, and required verification.
  • Add a CI-friendly runtime-size checker with hard-limit, soft-limit, baseline-delta, maximum-growth, and JSON output.
  • Add complex-settlement guardrails to web3-protocol-design, plus a detailed reference for economic-ledger decomposition, penalty proportionality, claimant models, staged settlement, liabilities, and cross-chain resource budgets.

Why

A real EVM port passed its existing behavioral suite but produced 27,931 bytes of deployed runtime—3,355 bytes above EIP-170—with a 7,268-byte feature delta. The reusable failure was broader than one contract: runtime-size feasibility was checked too late, and one slashing feature had accumulated restitution, reporter incentives, treasury routing, expiry, and multi-transaction settlement.

These changes make deployability and mechanism complexity explicit before implementation is substantially complete, while avoiding project-specific economic prescriptions.

Validation

  • npm run kb:format
  • npm run validate — 17 skills validated
  • python3 skills/ethereum-development/scripts/validate.py
  • git diff --check
  • Runtime checker pass case: 163-byte proxy artifact
  • Runtime checker expected failure case: 27,931-byte runtime, 3,355 bytes over EIP-170, 7,268-byte delta
  • Fresh-context forward-test of the Ethereum skill against an oversized immutable monolith
  • Fresh-context forward-test of the protocol-design skill against an over-scoped dispute settlement

Impact

Documentation and reusable validation tooling only. No production deployment, wallet, protocol, or published marketplace state changes are included.


Note

Low Risk
Documentation and a stdlib Python validation script only; no on-chain or production runtime changes.

Overview
Adds deployed-runtime budgeting to ethereum-development (v2.2.0): discovery, testing, deployment runbook, and config validation now treat EIP-170 runtime size as a deployability gate, with a new Runtime Size And Architecture section and references/CONTRACT_SIZE.md (measurement workflow, remediation matrix, CI checker usage).

Introduces scripts/check_runtime_size.py for artifact-based hard/soft limits, baseline delta, and JSON output; wires it into validate.py and GUIDE.md/PATTERNS.md. Tooling blocks move from SKILL.md to GUIDE.md; frontmatter is simplified; EIP-7702, EIP-1153, ABI-encoder size notes, and cast run (no --trace) fixes are included.

web3-protocol-design gains Complex Settlement Guardrails and references/slashing-and-dispute-settlement.md (economic ledgers, penalty proportionality, staged settlement, liabilities, cross-chain resource budgets), plus spec/review checklist updates and a references link in index.md.

Reviewed by Cursor Bugbot for commit 5d53ccd. Bugbot is set up for automated code reviews on this repo. Configure here.

dirtybits and others added 2 commits July 9, 2026 20:17
- Replace invalid 'cast run --trace' with 'cast run' (traces print by
  default; verified against Foundry) in SKILL.md, GUIDE.md, PATTERNS.md.
- Add type-4 EIP-7702 set-code transactions and EIP-1153 transient
  storage guidance to EVM/transaction sections.
- Move Foundry/Hardhat/viem command recipes from SKILL.md into
  references/GUIDE.md so references extend rather than duplicate the
  entrypoint; SKILL.md drops from 578 to 474 lines.
- Remove frontmatter keys no tooling consumes (sasmp_version, atomic,
  single_responsibility, parameters, retry_config, metadata); keep all
  OKF convention fields required by validate-skills.mjs.
- Bump ethereum-development to 2.2.0 and record changes in log.md.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@dirtybits
dirtybits marked this pull request as ready for review July 11, 2026 09:21
@dirtybits
dirtybits merged commit 2d5ac12 into main Jul 11, 2026
2 checks passed
@dirtybits
dirtybits deleted the feat/contract-size-protocol-guardrails branch July 11, 2026 09:22
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.

1 participant