Skip to content

fix(multiproof): add anchorGame getter to MockAnchorStateRegistry - #398

Merged
PelleKrab merged 1 commit into
mainfrom
fix/mock-asr-anchor-game
Aug 11, 2026
Merged

fix(multiproof): add anchorGame getter to MockAnchorStateRegistry#398
PelleKrab merged 1 commit into
mainfrom
fix/mock-asr-anchor-game

Conversation

@PelleKrab

Copy link
Copy Markdown
Contributor

fix(multiproof): add anchorGame getter to MockAnchorStateRegistry

Motivation

The offchain proposer's anchor recovery reads two things from the registry in one snapshot: getAnchorRoot() and anchorGame() (pinned to the same block via a joined call). The real AnchorStateRegistry exposes anchorGame, but the dev mock did not — so on DeployDevNoNitro deployments the anchorGame() staticcall reverted with empty data and the proposer failed at anchor-snapshot fetch, before it could propose anything.

Changes

  • Add IDisputeGame public anchorGame; to MockAnchorStateRegistry, giving the mock the same anchorGame() 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

  • On a fresh deployment anchorGame() returns address(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".
  • After 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 into anchorRoot/anchorL2BlockNumber the way the real registry does. Dev flows that need the root updated use the explicit setAnchorState(Hash,uint256) overload.

Testing

Exercised end-to-end by the base/base anvil-no-nitro dev stack (just anvil-no-nitro up), which deploys DeployDevNoNitro.s.sol against Anvil and runs the offchain proposer's anchor recovery against this mock; recovery previously failed at the snapshot call and now proceeds.

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>
@cb-heimdall

cb-heimdall commented Aug 10, 2026

Copy link
Copy Markdown
Collaborator

✅ Heimdall Review Status

Requirement Status More Info
Reviews 1/1
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
2 if repo is sensitive 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 0
Global minimum 0
Max 1
1
1 if commit is unverified 1
Sum 2

@PelleKrab
PelleKrab requested a review from jackchuma August 10, 2026 22:33
@PelleKrab
PelleKrab merged commit 0bcfdd4 into main Aug 11, 2026
6 checks passed
@PelleKrab
PelleKrab deleted the fix/mock-asr-anchor-game branch August 11, 2026 17:09
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.

3 participants