feat(contracts): Add DelegatedDisputeGame for per-chain withdrawal proving#16
Closed
opsuperchain wants to merge 9 commits intodevelopfrom
Closed
feat(contracts): Add DelegatedDisputeGame for per-chain withdrawal proving#16opsuperchain wants to merge 9 commits intodevelopfrom
opsuperchain wants to merge 9 commits intodevelopfrom
Conversation
0da0c6b to
df8d2c0
Compare
…oving Introduces DelegatedDisputeGame, a minimal dispute game that delegates verification to a SuperFaultDisputeGame. This enables per-chain dispute games that share economic security through a single super game. Key features: - Works with standard DisputeGameFactory.create() - no factory changes needed - Delegates status() and resolvedAt() to the linked SuperGame - Block number verified against output root proof and header RLP - l2SequenceNumber() provides viem-compatible block number access - No bonds required - all economic security comes from the SuperGame CWIA Layout uses extended extraData format containing: - l2BlockNumber, superGameAddress, chainId, OutputRootProof, headerRLP Security: - CEI pattern: initialized flag set before external calls - RLP bounds checking for header decoding - SuperGame address validation Includes 43 passing tests covering: - Game creation via standard factory - Status/resolvedAt delegation to SuperGame - AnchorStateRegistry validation - Resolution flow and edge cases 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
df8d2c0 to
001fa1c
Compare
…isputeGame When a SuperGame is blacklisted or retired in the superchain AnchorStateRegistry, all DelegatedDisputeGames that reference it are now automatically invalidated. Changes: - Add IDelegatedDisputeGame interface for SuperGame detection - Add try/catch in AnchorStateRegistry.isGameProper() to check SuperGame validity - Remove registry mismatch check from DelegatedDisputeGame (registries will differ) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
No special IAnchorRegistryConfig interface needed. Just deploy a standard SystemConfig with zero/minimal values for the superchain-level AnchorStateRegistry. This matches the existing pattern used by SuperFaultDisputeGame tests. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
… level" This reverts commit a25f829.
Add isGameRegistered() check for the SuperGame in isGameProper(). This prevents fake SuperGames from being used - the SuperGame must be created by the legitimate superchain DisputeGameFactory. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add SUPERCHAIN_REGISTRY immutable to DelegatedDisputeGame that holds a trusted reference to the superchain-level AnchorStateRegistry. This is used in initialize() to verify the SuperGame is actually registered in the legitimate superchain factory, preventing fake SuperGames. Changes: - Add SUPERCHAIN_REGISTRY immutable to DelegatedDisputeGame - Add SuperGameNotRegistered error - Check isGameRegistered on superchain registry in initialize() - Add superchainRegistry() getter - Update IDelegatedDisputeGame interface 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1b49ddc to
8201c72
Compare
Add check in initialize() to ensure the SuperGame's anchorStateRegistry() matches the SUPERCHAIN_REGISTRY passed to constructor. This ensures consistency between validation in initialize() and isGameProper(). Without this check, an attacker could deploy a DelegatedDisputeGame with a fake SUPERCHAIN_REGISTRY that validates any SuperGame, while the real SuperGame uses a different registry. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add validation that the chain ID in extraData matches the per-chain factory's L2 chain ID from SystemConfig. This prevents creating delegated games for the wrong chain on a given factory. Also updates tests to: - Mock l2ChainId() to return 5 for testing - Use existing delegatedGameProxy instead of creating duplicates - Set respected game type in setUp for AnchorRegistry tests - Simplify tests that previously tried to create multiple games 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Remove vm.mockCall for l2ChainId and instead use the actual chain ID (901) from the deploy config. This makes tests more realistic by using actual contract values rather than mocks. Changes: - Replace chain 5/6 with chain 901/902 throughout tests - Remove ISystemConfig import (no longer needed) - Update all proof generation to use 901/902 storage roots - Update helper functions and assertions to use correct chain IDs 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
63279d9 to
a3f280b
Compare
karlfloersch
pushed a commit
that referenced
this pull request
Mar 4, 2026
…16 (ethereum-optimism#19271) Add missing @param blueprint NatSpec to OpcmContractRef struct (#2). Add comments about pause blocking interop upgrades (#3). Document migrate() scope limitations and re-migration risks (#7, #15). Update PERMIT_ALL_CONTRACTS_INSTRUCTION comment (#12). Document intentional use of chainSystemConfigs[0] for shared contracts (#16). Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
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.
Summary
Introduces DelegatedDisputeGame, a lightweight dispute game that enables per-chain withdrawals by delegating dispute resolution to a shared SuperFaultDisputeGame.
How It Works
status()andresolvedAt()delegate directly to SuperGameChanges
src/dispute/DelegatedDisputeGame.sol- New contract implementing delegation patterninterfaces/dispute/IDelegatedDisputeGame.sol- Interfacesrc/dispute/AnchorStateRegistry.sol- Added SuperGame validation inisGameProper()test/dispute/DelegatedDisputeGame.t.sol- 43 testsFuture Work
🤖 Generated with Claude Code