Skip to content

feat(op-devstack): add withdrawal test support with OptimismPortalProxyAddr and setRespectedGameType#337

Merged
fakedev9999 merged 8 commits into
op-succinct-sysgofrom
fakedev9999/expose-optimism-portal-proxy-addr
Jan 29, 2026
Merged

feat(op-devstack): add withdrawal test support with OptimismPortalProxyAddr and setRespectedGameType#337
fakedev9999 merged 8 commits into
op-succinct-sysgofrom
fakedev9999/expose-optimism-portal-proxy-addr

Conversation

@fakedev9999
Copy link
Copy Markdown
Member

@fakedev9999 fakedev9999 commented Jan 27, 2026

Summary

Add infrastructure required for op-succinct withdrawal e2e tests to work with the standard OptimismPortal2 and AnchorStateRegistry.

Changes

1. Expose OptimismPortalProxyAddr in L2Deployment interface

  • Add OptimismPortalProxyAddr() method to L2Deployment interface in stack/l2_network.go
  • Add implementation in sysext/addrbook.go and sysgo/deployer.go
  • Required for tests to access OptimismPortal2 for withdrawal lifecycle testing

2. Add setStandardPortalRespectedGameType function

  • Sets respectedGameType on the standard devstack's AnchorStateRegistry to 42 (OPSuccinct game type)
  • Required because StandardBridge DSL reads respectedGameType from the standard portal's ASR, which must match the game type created by OPSuccinct

3. Support using existing DGF and ASR

  • Pass EXISTING_DISPUTE_GAME_FACTORY_PROXY to register game type 42 in the standard DGF instead of creating a new one
  • Pass EXISTING_ANCHOR_STATE_REGISTRY to use the standard ASR instead of deploying a new one
  • Required for OptimismPortal2's isGameProper() check to pass (games must reference the same ASR/DGF that the portal uses)

Why These Changes Are Needed

The withdrawal test flow requires:

  1. Same DGF: OptimismPortal2 must use the same DisputeGameFactory where games are created
  2. Same ASR: Games must reference the same AnchorStateRegistry that OptimismPortal2 uses for isGameProper() validation
  3. Correct respectedGameType: StandardBridge DSL filters games by respectedGameType (must be 42, not default 1)

Without these changes, the withdrawal test fails with:

  • "out-of-bounds access" (wrong DGF)
  • "OptimismPortal_ImproperDisputeGame" (wrong ASR)
  • "no game found" (wrong respectedGameType)

Files Changed

File Change
stack/l2_network.go Add OptimismPortalProxyAddr() to interface
sysext/addrbook.go Add constant and getter for portal address
sysgo/deployer.go Add field and getter for portal address
sysgo/deployer_succinct.go Add setStandardPortalRespectedGameType, pass existing DGF/ASR to deployment

Related

…erface

Add OptimismPortalProxyAddr() method to the L2Deployment interface to
allow tests to access the OptimismPortal2 proxy address for withdrawal
lifecycle testing.

Changes:
- Add OptimismPortalProxyAddr() to L2Deployment interface in stack/l2_network.go
- Add implementation in sysext/addrbook.go with constant and getter
- Add implementation in sysgo/deployer.go with field and getter

This enables op-succinct to write e2e tests that validate the full
withdrawal lifecycle through OptimismPortal2.
Add setRespectedGameType call after deploying OPSuccinct fault dispute
game contracts. This sets the portal's respectedGameType to 42 (OPSuccinct
game type), which is required for the StandardBridge DSL to find games
of the correct type during withdrawal proving.

Without this fix, the StandardBridge DSL fails to find any games because
it filters by respectedGameType (default 1) while OPSuccinct creates
games of type 42.
The setRespectedGameType function requires the guardian role, which
in the devstack is mapped to SuperchainConfigGuardianKey (a SuperchainOperatorRole),
not L1ProxyAdminOwnerRole (a ChainOperatorRole).

Additionally, in recent Optimism contract versions, setRespectedGameType
is on AnchorStateRegistry (not OptimismPortal2). Updated to:
- Call AnchorStateRegistry instead of OptimismPortal2
- Use raw transaction since there's no AnchorStateRegistry binding
- Use the correct SuperchainConfigGuardianKey for authorization
…eType

The OPSuccinct FDG deployment creates a MockSystemConfig with the
deployer (L1ProxyAdminOwnerRole) as the guardian, not the standard
SuperchainConfigGuardianKey. This caused setRespectedGameType to fail
with AnchorStateRegistry_Unauthorized error.

Fixed by using ChainOperatorKeys(L1ProxyAdminOwnerRole) instead of
SuperchainOperatorKeys(SuperchainConfigGuardianKey).
The StandardBridge DSL reads respectedGameType from the standard
devstack's OptimismPortal2, which delegates to the standard
AnchorStateRegistry. Previously we only set respectedGameType on
the OPSuccinct-deployed AnchorStateRegistry, causing the DSL to
look for game type 1 when OPSuccinct creates games of type 42.

This fix:
1. Adds setStandardPortalRespectedGameType() to read the standard
   portal's AnchorStateRegistry and set its respectedGameType
2. Calls this function after OPSuccinct FDG deployment to ensure
   both AnchorStateRegistries have respectedGameType=42

The standard AnchorStateRegistry uses SuperchainConfigGuardianKey
as its guardian (vs L1ProxyAdminOwnerRole for the OPSuccinct one).
Register game type 42 in the STANDARD DisputeGameFactory instead of
creating a separate OPSuccinct DGF. This ensures OptimismPortal2 uses
the same DGF that games are created in, fixing the withdrawal test's
"out-of-bounds access" error when proveWithdrawalTransaction tried to
look up a game index in the wrong DGF.

Changes:
- Pass EXISTING_DISPUTE_GAME_FACTORY_PROXY env var to forge deployment
- Remove overwrite of l2Net.deployment.disputeGameFactoryProxy
…hdrawal test

The withdrawal test was failing with OptimismPortal_ImproperDisputeGame error
because games were referencing a different AnchorStateRegistry than the one
OptimismPortal2 uses for isGameProper() checks.

Changes:
- Read standard ASR address from OptimismPortal2 via anchorStateRegistry() call
- Pass EXISTING_ANCHOR_STATE_REGISTRY to deployment script
- Remove redundant setRespectedGameType call on OPSuccinct ASR (now using standard)

This ensures the isGameProper() check passes:
  return address(factoryRegisteredGame) == address(_game) && asr == address(this);
@fakedev9999 fakedev9999 changed the title feat(op-devstack): expose OptimismPortalProxyAddr in L2Deployment interface feat(op-devstack): add withdrawal test support with OptimismPortalProxyAddr and setRespectedGameType Jan 29, 2026
Remove the dead setRespectedGameType function that was intended for setting
respectedGameType on OPSuccinct's own AnchorStateRegistry. This function
became obsolete when we switched to using the standard AnchorStateRegistry
(via setStandardPortalRespectedGameType) to ensure isGameProper() checks pass.

The function was never called after the architecture change to use the
standard DGF and ASR instead of deploying separate OPSuccinct ones.
@fakedev9999 fakedev9999 merged commit 3ec65a1 into op-succinct-sysgo Jan 29, 2026
@fakedev9999 fakedev9999 deleted the fakedev9999/expose-optimism-portal-proxy-addr branch January 29, 2026 02:57
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