fix(multiproof): add anchorGame getter to MockAnchorStateRegistry - #398
Merged
Conversation
The offchain proposer's anchor recovery calls both getAnchorRoot() and anchorGame() on the registry. The mock lacked anchorGame(), so the call reverted with empty data and the proposer failed at anchor_snapshot. Store the last game passed to setAnchorState(IDisputeGame) and expose it via a public anchorGame getter (zero address on a fresh mock). Amp-Thread-ID: https://ampcode.com/threads/T-019fd8d9-b542-73ce-8bdd-6022afc4e14b Co-authored-by: Amp <amp@ampcode.com>
Collaborator
✅ Heimdall Review Status
|
jackchuma
approved these changes
Aug 11, 2026
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.
fix(multiproof): add
anchorGamegetter toMockAnchorStateRegistryMotivation
The offchain proposer's anchor recovery reads two things from the registry in one snapshot:
getAnchorRoot()andanchorGame()(pinned to the same block via a joined call). The realAnchorStateRegistryexposesanchorGame, but the dev mock did not — so onDeployDevNoNitrodeployments theanchorGame()staticcall reverted with empty data and the proposer failed at anchor-snapshot fetch, before it could propose anything.Changes
IDisputeGame public anchorGame;toMockAnchorStateRegistry, giving the mock the sameanchorGame()view the real registry has.setAnchorState(IDisputeGame _game)now records the game, so after the first anchor update the getter returns the finalized game that became the anchor.Semantics
anchorGame()returnsaddress(0). This matches the real registry's pre-first-anchor-update state, and the offchain proposer/challenger explicitly handle the zero address as "genesis-anchored, no parent game".setAnchorState(game),anchorGame()returns that game, which anchor recovery uses as the parent for the next proposal.Scope / limitations
This mock's
setAnchorState(IDisputeGame)intentionally stays minimal: it records the anchor game but does not copy the game's root/block intoanchorRoot/anchorL2BlockNumberthe way the real registry does. Dev flows that need the root updated use the explicitsetAnchorState(Hash,uint256)overload.Testing
Exercised end-to-end by the base/base
anvil-no-nitrodev stack (just anvil-no-nitro up), which deploysDeployDevNoNitro.s.solagainst Anvil and runs the offchain proposer's anchor recovery against this mock; recovery previously failed at the snapshot call and now proceeds.