Skip to content

opgeth-decoupling: embed both chain configs in the genesis config codec after the cutover #23200

Closed

Description

@sebastianst

op-core/params.ChainConfig's JSON codec encodes a genesis config object through an unexported chainConfigJSON struct that embeds go-ethereum's params.ChainConfig (for the Ethereum fork schedule) and declares the OP Stack fields directly: op-core/params/chain_config_json.go.

The direct field list exists only because op-geth's params.ChainConfig still carries the same OP keys (bedrockBlock, regolithTime, …, optimism): encoding/json drops both fields when two embedded structs define the same key at the same depth, while a direct field dominates an embedded one.

Once go.mod points at upstream go-ethereum, no competing fields remain, so:

  • chainConfigJSON can become struct { *gethparams.ChainConfig; *ChainConfig } (both embedded), removing the duplicated OP field list;
  • the reflection test that keeps that list in sync with ChainConfig goes with it;
  • the decode-time check that the Ethereum schedule keys agree with the one derived from the OP schedule stays as is (it compares schedules, not keys).

Part of the cutover; depends on #23194.

🤖 Co-created with Claude Fable 5.1

Metadata

Metadata

Assignees

No one assigned

    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