Skip to content

opgeth-decoupling: migrate L2 genesis readers and carriers to op-core/genesis.Genesis #23217

Closed

Description

@sebastianst

Part of #20257. #23194 adds op-core/genesis.Genesis, the OP genesis JSON encoding whose config is an op-core/params.ChainConfig, and #21281 moves the writer (op-chain-ops/genesis) onto it. The readers and carriers of the L2 genesis are not covered yet. They hold the L2 genesis as go-ethereum's core.Genesis; after the cutover (#20266) its Config is upstream's params.ChainConfig, so a decoded genesis.json silently loses the OP fork fields and anything re-serialising it for an execution layer hands out a genesis without the OP schedule.

Consumers to migrate to genesis.Genesis

  • op-deployer: inspect/genesis.go (GenesisAndRollup), pipeline/env.go (RenderGenesisAndRollup), state/state.go (L1DevGenesis; the L1 genesis can stay upstream), and the integration-test CLI readers.
  • op-devstack/sysgo: deployer.go keeps map[eth.ChainID]*core.Genesis for the L2s and hands them to the ELs; shared/challenger passes genesis to the proof programs.
  • op-e2e: e2eutils.Setup, system/e2esys, the dispute-game and challenger helpers, e2eutils/reth and the actions helpers (l2_engine_reth.go marshals the *core.Genesis from Setup for op-reth-test-engine).
  • op-chain-ops/interopgen and genesis/beacondeposit.
  • op-wheel: commands.go decodes the EL's debug_chainConfig into a geth ChainConfig and builds a rollup config from its OP fork times (an upstream decode drops them silently), and engine/engine.go sets CanyonTime on a geth ChainConfig to pick the payload's withdrawals encoding. They need the op-core config: decode into opparams.ChainConfig, and pass eth.BlockAsPayloadEnv a local eth.HardforkConfig.

For each: decode genesis.json into genesis.Genesis, read OP forks from its Config (opparams.ChainConfig), and use GethGenesis() only where upstream go-ethereum types are needed (state root, ToBlock, an upstream EL).

op-core/superchain

Chain.GenesisData() returns the registry's genesis JSON as raw bytes (today only byte-compared by check-prestate), and LoadOpChainConfig builds an opparams.ChainConfig from the registry TOML. A typed Chain.Genesis() (*genesis.Genesis, error) would give consumers the registry genesis with its OP config, and a test that every embedded registry genesis decodes with the strict codec is a cheap conformance check for the encoding. Dependency note: op-core/genesis imports go-ethereum/core for GethGenesis(), and op-core/superchain sits under op-node, so check what that adds to op-node's dependency closure before wiring it in.

Related: #23194, #21281, #21744, #23200.

🤖 Co-created with Claude Fable 5.1

Activity

  1. sebastianst commented on Oct 14, 2026

    @sebastianst
    MemberAuthor

    🤖 Opus 5.5 says: Scope note from the opgeth-ratchet audit (#21748). The L1 dev genesis can stay upstream, but not as-is: it sets the fork-only core.Genesis.StateHash field, in op-deployer's seal_l1_dev_genesis.go (plus its test) and sysgo's deployer.go. Upstream core.Genesis has no precomputed-root field, so the sealed L1 genesis needs another carrier for its state root. sysgo also reads the fork-only LagoonTime off the L2 genesis config (interop_helpers.go), which goes with the op-core genesis migration here.

  2. self-assigned this
    on Oct 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions