Skip to content

op-deployer: add computation of output root to prepare stage - #21963

Merged
maurelian merged 20 commits into
developfrom
feat/pcd-finalize-prepare
Jul 30, 2026
Merged

op-deployer: add computation of output root to prepare stage#21963
maurelian merged 20 commits into
developfrom
feat/pcd-finalize-prepare

Conversation

@0xiamflux

@0xiamflux 0xiamflux commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Context

The final step of the PCD prepare stage produces the genesis output root for every chain being
prepared. To get there we need to build each chain's L2 genesis from the L1 addresses returned by
the OPCM.deploy dry run. This step also has to support Super Dispute Games, and because a super
root is computed cluster wide, wrapping the v0 output root of every chain in the deployment, the
anchor can only be derived once every chain's own root exists.

Later stages still rely on op-deployer inspect to render the genesis.json and rollup.json
files, which is why the rendering path needs to know how to read a prepared (not yet applied)
state.

Changes

  • op-deployer/pkg/deployer/pipeline/env.go: adds ResolveRenderIntent, which picks the intent to
    render genesis.json and rollup.json from, for both applied and prepared deployments, and fails
    when the state has been through neither pipeline.
  • op-deployer/pkg/deployer/inspect/genesis.go and inspect/rollup.go: resolve the intent through
    the helper before rendering their artifact.
  • op-deployer/pkg/deployer/pipeline/opchain.go: adds helpers that decide whether a deployment uses
    super roots, by resolving each chain's proof params and checking its dispute game type.
  • op-deployer/pkg/deployer/pipeline/output_root.go: new file with the output root computation. It
    works in two passes. The first computes each chain's own v0 output root, the second decides what
    the AnchorStateRegistry is seeded with, wrapping the v0 roots into a cluster wide SuperV1 root when
    super games are used. Note that while super roots are supported, no shared AnchorStateRegistry is
    produced
    : every chain gets its own ASR contract, seeded with the same startingAnchorRoot.
  • op-deployer/pkg/deployer/state/state.go: records GenesisBlockHash per chain, so post-deploy
    validation can confirm the on-chain seeding matches the predicted genesis.
  • op-deployer/pkg/deployer/pipeline/interop_depset.go: extends the depset mismatch error to say
    that the prepared chain set also determines every chain's starting anchor under super-root games.
  • op-deployer/pkg/deployer/prepare.go: wires up the L2 allocs generation and the output root
    computation.

Tests

  • Output root computation: generated allocs, a pinned anchor and genesis time,
    Isthmus active at genesis, the per-chain v0 root and its persistence, already deployed chains
    being left alone, and the super root path.
  • Game type detection: the super game type and the deployment level super root check over
    mixed and single family intents.
  • Artifact rendering: render intent resolution for prepared, applied, and neither state, the genesis
    block hash cross-check, the missing start block case, and inspect genesis / inspect rollup
    writing their files after a prepare run.
  • Prepare stage: genesis built from the predicted addresses and the pinned genesis time,
    regeneration after an intent edit, and the full path from a prepared state to a computed anchor
    without sending an L1 transaction.

Closes #20909
Closes #20910

Comment thread op-deployer/pkg/deployer/pipeline/env.go Outdated
Comment thread op-deployer/pkg/deployer/pipeline/output_root.go Outdated
Comment thread op-deployer/pkg/deployer/pipeline/output_root.go Outdated
Comment thread op-deployer/pkg/deployer/pipeline/env.go
Calculation of the roots will happen in two passes, the first one calculates each of the chain's v0 root first and temporary stores them for computation of the v1 Super root only if it's needed.
Comment thread op-deployer/pkg/deployer/prepare.go
@0xiamflux
0xiamflux marked this pull request as ready for review July 27, 2026 21:12
@0xiamflux
0xiamflux requested review from a team as code owners July 27, 2026 21:12
Comment thread op-deployer/pkg/deployer/prepare.go
Comment thread op-deployer/pkg/deployer/inspect/fixture_test.go Outdated
Comment thread op-deployer/pkg/deployer/pipeline/opchain.go
Comment thread op-deployer/pkg/deployer/pipeline/output_root.go
Comment thread op-deployer/pkg/deployer/pipeline/output_root.go
@maurelian
maurelian enabled auto-merge July 30, 2026 19:38
@maurelian
maurelian added this pull request to the merge queue Jul 30, 2026
Merged via the queue into develop with commit 35a3666 Jul 30, 2026
60 checks passed
@maurelian
maurelian deleted the feat/pcd-finalize-prepare branch July 30, 2026 20:51
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.

[PCD] Compute genesis output root [PCD] Build L2 genesis against predicted addresses

3 participants