superchain

package
v1.19.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 1, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Chains map[uint64]*Chain
View Source
var ErrUnknownChain = errors.New("unknown chain")

Functions

func ChainIDByName

func ChainIDByName(name string) (uint64, error)

func ChainNames

func ChainNames() []string

func GetDepset

func GetDepset(chainID uint64) (map[string]Dependency, error)

func LoadChainConfigFromChainID

func LoadChainConfigFromChainID(chainID uint64) (*params.ChainConfig, error)

LoadChainConfigFromChainID loads the OP-Stack params.ChainConfig for the given L2 chain ID from the superchain registry.

TODO(20271): once the params.ChainConfig type and the params.LoadOPStackChainConfig function have been migrated into this repository, this wrapper should use the local ChainConfig loader instead of the op-geth one.

func VerifyEmbeddedCommit

func VerifyEmbeddedCommit() error

VerifyEmbeddedCommit asserts the embedded bundle is consistent with what was approved in review. Both init() and TestSyncSuperchain call this so the same check runs at process startup and in CI tests.

Three checks, ordered most-strict first:

  1. SHA256 of the embedded zip matches superchain-configs.zip.sha256 — catches any drift (commit bump without sync, non-deterministic build, tampering).
  2. COMMIT entry inside the zip matches superchain-registry-commit.txt — kept for clearer diagnostics in the most common failure mode (bumped txt without re-running sync).
  3. op-geth bundles the same SR commit (until the registry is decoupled from op-geth, both copies must agree).

A missing zip is caught at compile time by //go:embed, not here.

Types

type AddressesConfig

type AddressesConfig struct {
	AddressManager                    *common.Address `toml:"AddressManager,omitempty" json:"AddressManager,omitempty"`
	L1CrossDomainMessengerProxy       *common.Address `toml:"L1CrossDomainMessengerProxy,omitempty" json:"L1CrossDomainMessengerProxy,omitempty"`
	L1ERC721BridgeProxy               *common.Address `toml:"L1ERC721BridgeProxy,omitempty" json:"L1ERC721BridgeProxy,omitempty"`
	L1StandardBridgeProxy             *common.Address `toml:"L1StandardBridgeProxy,omitempty" json:"L1StandardBridgeProxy,omitempty"`
	L2OutputOracleProxy               *common.Address `toml:"L2OutputOracleProxy,omitempty" json:"L2OutputOracleProxy,omitempty"`
	OptimismMintableERC20FactoryProxy *common.Address `toml:"OptimismMintableERC20FactoryProxy,omitempty" json:"OptimismMintableERC20FactoryProxy,omitempty"`
	OptimismPortalProxy               *common.Address `toml:"OptimismPortalProxy,omitempty" json:"OptimismPortalProxy,omitempty"`
	SystemConfigProxy                 *common.Address `toml:"SystemConfigProxy,omitempty" json:"SystemConfigProxy,omitempty"`
	ProxyAdmin                        *common.Address `toml:"ProxyAdmin,omitempty" json:"ProxyAdmin,omitempty"`
	SuperchainConfig                  *common.Address `toml:"SuperchainConfig,omitempty" json:"SuperchainConfig,omitempty"`
	AnchorStateRegistryProxy          *common.Address `toml:"AnchorStateRegistryProxy,omitempty" json:"AnchorStateRegistryProxy,omitempty"`
	DelayedWETHProxy                  *common.Address `toml:"DelayedWETHProxy,omitempty" json:"DelayedWETHProxy,omitempty"`
	DisputeGameFactoryProxy           *common.Address `toml:"DisputeGameFactoryProxy,omitempty" json:"DisputeGameFactoryProxy,omitempty"`
	FaultDisputeGame                  *common.Address `toml:"FaultDisputeGame,omitempty" json:"FaultDisputeGame,omitempty"`
	MIPS                              *common.Address `toml:"MIPS,omitempty" json:"MIPS,omitempty"`
	PermissionedDisputeGame           *common.Address `toml:"PermissionedDisputeGame,omitempty" json:"PermissionedDisputeGame,omitempty"`
	PreimageOracle                    *common.Address `toml:"PreimageOracle,omitempty" json:"PreimageOracle,omitempty"`
	DAChallengeAddress                *common.Address `toml:"DAChallengeAddress,omitempty" json:"DAChallengeAddress,omitempty"`
}

type AltDAConfig

type AltDAConfig struct {
	DaChallengeContractAddress common.Address `toml:"da_challenge_contract_address"`
	DaChallengeWindow          uint64         `toml:"da_challenge_window"`
	DaResolveWindow            uint64         `toml:"da_resolve_window"`
	DaCommitmentType           string         `toml:"da_commitment_type"`
}

type Chain

type Chain struct {
	Name    string `json:"name"`
	Network string `json:"network"`
	// contains filtered or unexported fields
}

func GetChain

func GetChain(chainID uint64) (*Chain, error)

func (*Chain) Config

func (c *Chain) Config() (*ChainConfig, error)

func (*Chain) GenesisData

func (c *Chain) GenesisData() ([]byte, error)

type ChainConfig

type ChainConfig struct {
	Name                 string       `toml:"name"`
	PublicRPC            string       `toml:"public_rpc"`
	SequencerRPC         string       `toml:"sequencer_rpc"`
	Explorer             string       `toml:"explorer"`
	SuperchainLevel      int          `toml:"superchain_level"`
	GovernedByOptimism   bool         `toml:"governed_by_optimism"`
	SuperchainTime       *uint64      `toml:"superchain_time"`
	DataAvailabilityType string       `toml:"data_availability_type"`
	DeploymentTxHash     *common.Hash `toml:"deployment_tx_hash"`

	ChainID           uint64          `toml:"chain_id"`
	BatchInboxAddr    common.Address  `toml:"batch_inbox_addr"`
	BlockTime         uint64          `toml:"block_time"`
	SeqWindowSize     uint64          `toml:"seq_window_size"`
	MaxSequencerDrift uint64          `toml:"max_sequencer_drift"`
	GasPayingToken    *common.Address `toml:"gas_paying_token"`
	Hardforks         HardforkConfig  `toml:"hardforks"`
	Interop           *Interop        `toml:"interop,omitempty"`
	Optimism          *OptimismConfig `toml:"optimism,omitempty"`

	AltDA *AltDAConfig `toml:"alt_da,omitempty"`

	Genesis GenesisConfig `toml:"genesis"`

	Roles RolesConfig `toml:"roles"`

	Addresses AddressesConfig `toml:"addresses"`
}

type ChainConfigLoader

type ChainConfigLoader struct {
	Chains map[uint64]*Chain
	// contains filtered or unexported fields
}
var BuiltInConfigs *ChainConfigLoader

func NewChainConfigLoader

func NewChainConfigLoader(configData []byte) (*ChainConfigLoader, error)

func (*ChainConfigLoader) ChainIDByName

func (c *ChainConfigLoader) ChainIDByName(name string) (uint64, error)

func (*ChainConfigLoader) ChainNames

func (c *ChainConfigLoader) ChainNames() []string

func (*ChainConfigLoader) GetChain

func (c *ChainConfigLoader) GetChain(chainID uint64) (*Chain, error)

func (*ChainConfigLoader) GetSuperchain

func (c *ChainConfigLoader) GetSuperchain(network string) (Superchain, error)

type Dependency

type Dependency struct{}

type GenesisConfig

type GenesisConfig struct {
	L2Time       uint64       `toml:"l2_time"`
	L1           GenesisRef   `toml:"l1"`
	L2           GenesisRef   `toml:"l2"`
	SystemConfig SystemConfig `toml:"system_config"`
}

type GenesisRef

type GenesisRef struct {
	Hash   common.Hash `toml:"hash"`
	Number uint64      `toml:"number"`
}

type HardforkConfig

type HardforkConfig struct {
	CanyonTime   *uint64 `toml:"canyon_time"`
	DeltaTime    *uint64 `toml:"delta_time"`
	EcotoneTime  *uint64 `toml:"ecotone_time"`
	FjordTime    *uint64 `toml:"fjord_time"`
	GraniteTime  *uint64 `toml:"granite_time"`
	HoloceneTime *uint64 `toml:"holocene_time"`
	IsthmusTime  *uint64 `toml:"isthmus_time"`
	JovianTime   *uint64 `toml:"jovian_time"`
	KarstTime    *uint64 `toml:"karst_time"`
	InteropTime  *uint64 `toml:"interop_time"`
	// Optional Forks
	PectraBlobScheduleTime *uint64 `toml:"pectra_blob_schedule_time,omitempty"`
}

type Interop

type Interop struct {
	Dependencies map[string]Dependency `json:"dependencies" toml:"dependencies"`
}

type L1Config

type L1Config struct {
	ChainID   uint64 `toml:"chain_id"`
	PublicRPC string `toml:"public_rpc"`
	Explorer  string `toml:"explorer"`
}

type OptimismConfig

type OptimismConfig struct {
	EIP1559Elasticity        uint64  `toml:"eip1559_elasticity"`
	EIP1559Denominator       uint64  `toml:"eip1559_denominator"`
	EIP1559DenominatorCanyon *uint64 `toml:"eip1559_denominator_canyon"`
}

type RolesConfig

type RolesConfig struct {
	SystemConfigOwner *common.Address `json:"SystemConfigOwner" toml:"SystemConfigOwner"`
	ProxyAdminOwner   *common.Address `json:"ProxyAdminOwner" toml:"ProxyAdminOwner"`
	Guardian          *common.Address `json:"Guardian" toml:"Guardian"`
	Challenger        *common.Address `json:"Challenger" toml:"Challenger"`
	Proposer          *common.Address `json:"Proposer,omitempty" toml:"Proposer,omitempty"`
	UnsafeBlockSigner *common.Address `json:"UnsafeBlockSigner,omitempty" toml:"UnsafeBlockSigner,omitempty"`
	BatchSubmitter    *common.Address `json:"BatchSubmitter" toml:"BatchSubmitter"`
}

type Superchain

type Superchain struct {
	Name                   string         `toml:"name"`
	SuperchainConfigAddr   common.Address `toml:"superchain_config_addr"`
	OpContractsManagerAddr common.Address `toml:"op_contracts_manager_addr"`
	SaferSafesAddr         common.Address `toml:"safer_safes_addr"`
	Hardforks              HardforkConfig
	L1                     L1Config
}

func GetSuperchain

func GetSuperchain(network string) (Superchain, error)

type SystemConfig

type SystemConfig struct {
	BatcherAddr       common.Address `json:"batcherAddr" toml:"batcherAddress"`
	Overhead          common.Hash    `json:"overhead" toml:"overhead"`
	Scalar            common.Hash    `json:"scalar" toml:"scalar"`
	GasLimit          uint64         `json:"gasLimit" toml:"gasLimit"`
	BaseFeeScalar     *uint64        `json:"baseFeeScalar,omitempty" toml:"baseFeeScalar,omitempty"`
	BlobBaseFeeScalar *uint64        `json:"blobBaseFeeScalar,omitempty" toml:"blobBaseFeeScalar,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL