Skip to content

refactor(fault-proof): use forge-generated bindings as ABI source of truth#809

Open
fakedev9999 wants to merge 1 commit into
mainfrom
test/contract-enum-coverage
Open

refactor(fault-proof): use forge-generated bindings as ABI source of truth#809
fakedev9999 wants to merge 1 commit into
mainfrom
test/contract-enum-coverage

Conversation

@fakedev9999
Copy link
Copy Markdown
Member

@fakedev9999 fakedev9999 commented Feb 18, 2026

Summary

  • Replace hand-written sol! ABI definitions with forge-generated bindings from op-succinct-bindings for contract types used in fault-proof and host
  • Keep hand-written sol! only for enums (GameStatus, ProposalStatus) that need custom derives and proper Rust enum variants
  • Move shared L2Output struct to bindings crate, eliminating duplication between fault-proof and host-utils
  • Commit generated codegen to git so forge-less environments (Docker builds, CI jobs without Foundry) can compile against the bindings
  • Restore graceful forge fallback in build.rs: skip regeneration when forge is not in PATH, bail only if forge is present but broken
  • Add --skip-extra-derives to forge bind: removes unused serde/Debug/Default derives from codegen, reducing compile time
  • Add .gitattributes to collapse generated code in GitHub PR diffs
  • Hoist ProposalStatus::try_from before match block in proposer.rs, eliminating 3 duplicate conversions

Test plan

  • cargo fmt --all -- --check — no diffs
  • cargo test -p op-succinct-fp — 12 tests pass
  • cargo check -p op-succinct-bindings — compiles without serde dep
  • grep -r "serde::Serialize" bindings/src/codegen/ — 0 matches (extra derives removed)
  • git ls-files bindings/src/codegen/ — 16 tracked files
  • Forge-less cargo check -p op-succinct-fp — compiles using committed codegen

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Feb 18, 2026

Metric Value
Batch Start 14,243,529
Batch End 14,243,534
Witness Generation (seconds) 0
Execution Duration (seconds) 22
Total Instruction Count 528,845,504
Oracle Verify Cycles 61,762,867
Derivation Cycles 381,913,473
Block Execution Cycles 7,058,708
Blob Verification Cycles 23,426,261
Total SP1 Gas 804,812,968
Number of Blocks 5
Number of Transactions 5
Ethereum Gas Used 242,290
Cycles per Block 105,769,100
Cycles per Transaction 105,769,100
Transactions per Block 1
Gas Used per Block 48,458
Gas Used per Transaction 48,458
BN Pair Cycles 0
BN Add Cycles 0
BN Mul Cycles 0
KZG Eval Cycles 0
EC Recover Cycles 0
P256 Verify Cycles 0

@fakedev9999 fakedev9999 force-pushed the test/contract-enum-coverage branch 2 times, most recently from ccff389 to 34deffe Compare February 18, 2026 13:23
@fakedev9999 fakedev9999 changed the title test(fault-proof): add unit tests for GameStatus and ProposalStatus enums refactor(fault-proof): use forge-generated bindings as ABI source of truth Feb 18, 2026
fakedev9999

This comment was marked as resolved.

…truth

- Replace hand-written sol! ABI definitions with forge-generated bindings
  from op-succinct-bindings for contract types used in fault-proof and host
- Keep hand-written sol! only for enums (GameStatus, ProposalStatus) that
  need custom derives and proper Rust enum variants
- Move shared L2Output struct to bindings crate, re-export from consumers
- Commit generated codegen to git so forge-less environments (Docker, CI
  jobs without Foundry) can compile against the bindings
- Restore graceful forge fallback in build.rs: skip regeneration when forge
  is not in PATH, bail only if forge is present but broken
- Add --skip-extra-derives to forge bind: removes unused serde/Debug/Default
  derives from codegen, reducing compile time
- Add .gitattributes to collapse generated code in GitHub PR diffs
- Hoist ProposalStatus::try_from before match block in proposer.rs
@fakedev9999 fakedev9999 force-pushed the test/contract-enum-coverage branch from 34deffe to 52dc0db Compare February 18, 2026 14:49
fakedev9999 added a commit that referenced this pull request Apr 28, 2026
…891)

The Solidity source returns Duration (= uint64) for both
maxChallengeDuration() and maxProveDuration(), but the hand-written
sol! binding declared uint256 for the former. The wire ABI was
unaffected (32-byte word either way), and the call site narrowed
the result back to u64 with .to::<u64>(), so no production behavior
changes — but the type-level binding now matches the contract.

Reported by Kien Nguyen.

PR #809 supersedes this fix by replacing all hand-written sol!
bindings with forge-generated ones, eliminating this class of drift.
fakedev9999 added a commit that referenced this pull request Apr 28, 2026
…891) (#893)

The Solidity source returns Duration (= uint64) for both
maxChallengeDuration() and maxProveDuration(), but the hand-written
sol! binding declared uint256 for the former. The wire ABI was
unaffected (32-byte word either way), and the call site narrowed
the result back to u64 with .to::<u64>(), so no production behavior
changes — but the type-level binding now matches the contract.

Reported by Kien Nguyen.

PR #809 supersedes this fix by replacing all hand-written sol!
bindings with forge-generated ones, eliminating this class of drift.
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