Documentation ¶
Index ¶
- Variables
- func CanonicalizeSemver(version string) string
- func LoadContractBytecode(codeHash Hash) ([]byte, error)
- func MustBeValidSuperchainLevel(chainConfig ChainConfig)
- type Address
- type AddressList
- type AddressSet
- type AltDAConfig
- type BlockID
- type ChainConfig
- type ChainGenesis
- type ContractBytecodeHashes
- type ContractVersions
- type DataAvailability
- type Genesis
- type GenesisAccount
- type HardForkConfiguration
- type Hash
- type HexBig
- type HexBytes
- type MappedContractProperties
- type OptimismConfig
- type Roles
- type Superchain
- type SuperchainConfig
- type SuperchainL1Info
- type SuperchainLevel
- type SystemConfig
- type VersionedContract
Constants ¶
This section is empty.
Variables ¶
var Addresses = map[uint64]*AddressList{}
var ErrEmptyVersion = errors.New("empty version")
var GenesisSystemConfigs = map[uint64]*SystemConfig{}
var OPChains = map[uint64]*ChainConfig{}
var SuperchainSemver map[string]ContractVersions
SuperchainSemver maps superchain name to a contract name : approved semver version structure.
var Superchains = map[string]*Superchain{}
Functions ¶
func CanonicalizeSemver ¶
CanonicalizeSemver will ensure that the version string has a "v" prefix. This is because the semver library being used requires the "v" prefix, even though
func LoadContractBytecode ¶
func MustBeValidSuperchainLevel ¶
func MustBeValidSuperchainLevel(chainConfig ChainConfig)
Types ¶
type Address ¶
type Address [addressLen]byte
func MustHexToAddress ¶
func (Address) MarshalText ¶
func (*Address) UnmarshalText ¶
type AddressList ¶
type AddressList struct { Roles `json:",inline" toml:",inline"` AddressManager Address `json:"AddressManager" toml:"AddressManager"` L1CrossDomainMessengerProxy Address `json:"L1CrossDomainMessengerProxy" toml:"L1CrossDomainMessengerProxy"` L1ERC721BridgeProxy Address `json:"L1ERC721BridgeProxy" toml:"L1ERC721BridgeProxy"` L1StandardBridgeProxy Address `json:"L1StandardBridgeProxy" toml:"L1StandardBridgeProxy"` L2OutputOracleProxy Address `json:"L2OutputOracleProxy" toml:"L2OutputOracleProxy,omitempty"` OptimismMintableERC20FactoryProxy Address `json:"OptimismMintableERC20FactoryProxy" toml:"OptimismMintableERC20FactoryProxy"` OptimismPortalProxy Address `json:"OptimismPortalProxy,omitempty" toml:"OptimismPortalProxy,omitempty"` SystemConfigProxy Address `json:"SystemConfigProxy" toml:"SystemConfigProxy"` ProxyAdmin Address `json:"ProxyAdmin" toml:"ProxyAdmin"` SuperchainConfig Address `json:"SuperchainConfig,omitempty" toml:"SuperchainConfig,omitempty"` // Fault Proof contracts: AnchorStateRegistryProxy Address `json:"AnchorStateRegistryProxy,omitempty" toml:"AnchorStateRegistryProxy,omitempty"` DelayedWETHProxy Address `json:"DelayedWETHProxy,omitempty" toml:"DelayedWETHProxy,omitempty"` DisputeGameFactoryProxy Address `json:"DisputeGameFactoryProxy,omitempty" toml:"DisputeGameFactoryProxy,omitempty"` FaultDisputeGame Address `json:"FaultDisputeGame,omitempty" toml:"FaultDisputeGame,omitempty"` MIPS Address `json:"MIPS,omitempty" toml:"MIPS,omitempty"` PermissionedDisputeGame Address `json:"PermissionedDisputeGame,omitempty" toml:"PermissionedDisputeGame,omitempty"` PreimageOracle Address `json:"PreimageOracle,omitempty" toml:"PreimageOracle,omitempty"` // AltDA contracts: DAChallengeAddress Address `json:"DAChallengeAddress,omitempty" toml:"DAChallengeAddress,omitempty"` }
AddressList represents the set of network specific contracts and roles for a given network.
func (AddressList) AddressFor ¶
func (a AddressList) AddressFor(name string) (Address, error)
AddressFor returns a nonzero address for the supplied name, if it has been specified (and an error otherwise).
func (AddressList) MarshalJSON ¶
func (a AddressList) MarshalJSON() ([]byte, error)
MarshalJSON excludes any addresses set to 0x000...000
type AddressSet ¶
AddressSet represents a set of addresses for a given contract. They are keyed by the semantic version.
type AltDAConfig ¶
type AltDAConfig struct { DAChallengeAddress *Address `json:"da_challenge_contract_address" toml:"da_challenge_contract_address"` // DA challenge window value set on the DAC contract. Used in altDA mode // to compute when a commitment can no longer be challenged. DAChallengeWindow *uint64 `json:"da_challenge_window" toml:"da_challenge_window"` // DA resolve window value set on the DAC contract. Used in altDA mode // to compute when a challenge expires and trigger a reorg if needed. DAResolveWindow *uint64 `json:"da_resolve_window" toml:"da_resolve_window"` DACommitmentType *string `json:"da_commitment_type" toml:"da_commitment_type"` }
type ChainConfig ¶
type ChainConfig struct { Name string `toml:"name"` ChainID uint64 `toml:"chain_id" json:"l2_chain_id"` PublicRPC string `toml:"public_rpc"` SequencerRPC string `toml:"sequencer_rpc"` Explorer string `toml:"explorer"` SuperchainLevel SuperchainLevel `toml:"superchain_level"` // If StandardChainCandidate is true, standard chain validation checks will // run on this chain even if it is a frontier chain. StandardChainCandidate bool `toml:"standard_chain_candidate,omitempty"` // If SuperchainTime is set, hardforks times after SuperchainTime // will be inherited from the superchain-wide config. SuperchainTime *uint64 `toml:"superchain_time"` BatchInboxAddr Address `toml:"batch_inbox_addr" json:"batch_inbox_address"` // Superchain is a simple string to identify the superchain. // This is implied by directory structure, and not encoded in the config file itself. Superchain string `toml:"-"` // Chain is a simple string to identify the chain, within its superchain context. // This matches the resource filename, it is not encoded in the config file itself. Chain string `toml:"-"` // Hardfork Configuration Overrides HardForkConfiguration `toml:",inline"` BlockTime uint64 `toml:"block_time" json:"block_time"` SequencerWindowSize uint64 `toml:"seq_window_size" json:"seq_window_size"` MaxSequencerDrift uint64 `toml:"max_sequencer_drift" json:"max_sequencer_drift"` DataAvailabilityType DataAvailability `toml:"data_availability_type"` Optimism *OptimismConfig `toml:"optimism,omitempty" json:"optimism,omitempty"` // Optional feature AltDA *AltDAConfig `toml:"alt_da,omitempty" json:"alt_da,omitempty"` GasPayingToken *Address `toml:"gas_paying_token,omitempty"` // Just metadata, not consumed by downstream OPStack software Genesis ChainGenesis `toml:"genesis" json:"genesis"` Addresses AddressList `toml:"addresses"` }
func (*ChainConfig) CheckDataAvailability ¶
func (c *ChainConfig) CheckDataAvailability() error
func (*ChainConfig) GenerateTOMLComments ¶
func (ChainConfig) Identifier ¶
func (c ChainConfig) Identifier() string
func (*ChainConfig) IsEcotone ¶
func (c *ChainConfig) IsEcotone() bool
IsEcotone returns true if the EcotoneTime for this chain in the past.
func (*ChainConfig) PromoteToStandard ¶
func (c *ChainConfig) PromoteToStandard() (*ChainConfig, error)
Returns a shallow copy of the chain config with some fields mutated to declare the chain a standard chain. No fields on the receiver are mutated.
type ChainGenesis ¶
type ChainGenesis struct { L1 BlockID `json:"l1" toml:"l1"` L2 BlockID `json:"l2" toml:"l2"` L2Time uint64 `json:"l2_time" toml:"l2_time"` ExtraData *HexBytes `json:"extra_data,omitempty" toml:"extra_data,omitempty"` SystemConfig SystemConfig `json:"system_config" toml:"system_config"` }
type ContractBytecodeHashes ¶
type ContractBytecodeHashes MappedContractProperties[string]
ContractBytecodeHashes stores a bytecode hash against each contract
type ContractVersions ¶
type ContractVersions MappedContractProperties[VersionedContract]
ContractVersions represents the desired semantic version of the contracts in the superchain. This currently only supports L1 contracts but could represent L2 predeploys in the future.
func (ContractVersions) Check ¶
func (c ContractVersions) Check(allowEmptyVersions bool) error
Check will sanity check the validity of the semantic version strings in the ContractVersions struct. If allowEmptyVersions is true, empty version errors will be ignored.
func (ContractVersions) GetNonEmpty ¶
func (c ContractVersions) GetNonEmpty() []string
GetNonEmpty returns a slice of contract names, with an entry for each contract in the receiver with a non empty Version property.
func (ContractVersions) VersionFor ¶
func (c ContractVersions) VersionFor(contractName string) (string, error)
VersionFor returns the version for the supplied contract name, if it exits (and an error otherwise). Useful for slicing into the struct using a string.
type DataAvailability ¶
type DataAvailability string
const ( EthDA DataAvailability = "eth-da" AltDA DataAvailability = "alt-da" )
type Genesis ¶
type Genesis struct { // Block properties Nonce uint64 `json:"nonce"` Timestamp uint64 `json:"timestamp"` ExtraData []byte `json:"extraData"` GasLimit uint64 `json:"gasLimit"` Difficulty *HexBig `json:"difficulty"` Mixhash Hash `json:"mixHash"` Coinbase Address `json:"coinbase"` Number uint64 `json:"number"` GasUsed uint64 `json:"gasUsed"` ParentHash Hash `json:"parentHash"` BaseFee *HexBig `json:"baseFeePerGas"` ExcessBlobGas *uint64 `json:"excessBlobGas"` // EIP-4844 BlobGasUsed *uint64 `json:"blobGasUsed"` // EIP-4844 // State data Alloc map[Address]GenesisAccount `json:"alloc"` // StateHash substitutes for a full embedded state allocation, // for instantiating states with the genesis block only, to be state-synced before operation. // Archive nodes should use a full external genesis.json or datadir. StateHash *Hash `json:"stateHash,omitempty"` }
func LoadGenesis ¶
type GenesisAccount ¶
type HardForkConfiguration ¶
type HardForkConfiguration struct { CanyonTime *uint64 `json:"canyon_time,omitempty" toml:"canyon_time,omitempty"` DeltaTime *uint64 `json:"delta_time,omitempty" toml:"delta_time,omitempty"` EcotoneTime *uint64 `json:"ecotone_time,omitempty" toml:"ecotone_time,omitempty"` FjordTime *uint64 `json:"fjord_time,omitempty" toml:"fjord_time,omitempty"` GraniteTime *uint64 `json:"granite_time,omitempty" toml:"granite_time,omitempty"` HoloceneTime *uint64 `json:"holocene_time,omitempty" toml:"holocene_time,omitempty"` IsthmusTime *uint64 `json:"isthmus_time,omitempty" toml:"isthmus_time,omitempty"` }
type MappedContractProperties ¶
type MappedContractProperties[T string | VersionedContract] struct { L1CrossDomainMessenger T `toml:"l1_cross_domain_messenger,omitempty"` L1ERC721Bridge T `toml:"l1_erc721_bridge,omitempty"` L1StandardBridge T `toml:"l1_standard_bridge,omitempty"` L2OutputOracle T `toml:"l2_output_oracle,omitempty"` OptimismMintableERC20Factory T `toml:"optimism_mintable_erc20_factory,omitempty"` OptimismPortal T `toml:"optimism_portal,omitempty"` OptimismPortal2 T `toml:"optimism_portal2,omitempty"` SystemConfig T `toml:"system_config,omitempty"` // Superchain-wide contracts: ProtocolVersions T `toml:"protocol_versions,omitempty"` SuperchainConfig T `toml:"superchain_config,omitempty"` // Fault Proof contracts: AnchorStateRegistry T `toml:"anchor_state_registry,omitempty"` DelayedWETH T `toml:"delayed_weth,omitempty"` DisputeGameFactory T `toml:"dispute_game_factory,omitempty"` FaultDisputeGame T `toml:"fault_dispute_game,omitempty"` MIPS T `toml:"mips,omitempty"` PermissionedDisputeGame T `toml:"permissioned_dispute_game,omitempty"` PreimageOracle T `toml:"preimage_oracle,omitempty"` CannonFaultDisputeGame T `toml:"cannon_fault_dispute_game,omitempty"` }
type OptimismConfig ¶
type OptimismConfig struct { EIP1559Elasticity uint64 `toml:"eip1559_elasticity" json:"eip1559Elasticity"` EIP1559Denominator uint64 `toml:"eip1559_denominator" json:"eip1559Denominator"` EIP1559DenominatorCanyon *uint64 `toml:"eip1559_denominator_canyon,omitempty" json:"eip1559DenominatorCanyon,omitempty"` }
type Roles ¶
type Roles struct { SystemConfigOwner Address `json:"SystemConfigOwner" toml:"SystemConfigOwner"` ProxyAdminOwner Address `json:"ProxyAdminOwner" toml:"ProxyAdminOwner"` Guardian Address `json:"Guardian" toml:"Guardian"` Challenger Address `json:"Challenger" toml:"Challenger"` Proposer Address `json:"Proposer" toml:"Proposer"` UnsafeBlockSigner Address `json:"UnsafeBlockSigner" toml:"UnsafeBlockSigner"` BatchSubmitter Address `json:"BatchSubmitter" toml:"BatchSubmitter"` }
type Superchain ¶
type Superchain struct { Config SuperchainConfig // Chains that are part of this superchain ChainIDs []uint64 // Superchain identifier, without capitalization or display changes. Superchain string }
type SuperchainConfig ¶
type SuperchainConfig struct { Name string `toml:"name"` L1 SuperchainL1Info `toml:"l1"` ProtocolVersionsAddr *Address `toml:"protocol_versions_addr,omitempty"` SuperchainConfigAddr *Address `toml:"superchain_config_addr,omitempty"` OPContractsManagerProxyAddr *Address `toml:"op_contracts_manager_proxy_addr,omitempty"` // contains filtered or unexported fields }
type SuperchainL1Info ¶
type SuperchainLevel ¶
type SuperchainLevel uint
const ( Standard SuperchainLevel = 1 Frontier SuperchainLevel = 0 )
type SystemConfig ¶
type SystemConfig struct { BatcherAddr Address `json:"batcherAddr" toml:"batcherAddress"` Overhead Hash `json:"overhead" toml:"overhead"` Scalar 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"` }
type VersionedContract ¶
type VersionedContract struct { Version string `toml:"version"` // If the contract is a superchain singleton, it will have a static address Address *Address `toml:"implementation_address,omitempty"` // If the contract is proxied, the implementation will have a static address ImplementationAddress *Address `toml:"address,omitempty"` }
VersionedContract represents a contract that has a semantic version.