Documentation ¶
Index ¶
- Constants
- Variables
- func ComputeL2OutputRoot(proofElements *bindings.TypesOutputRootProof) (eth.Bytes32, error)
- func ComputeL2OutputRootV0(block eth.BlockInfo, storageRoot [32]byte) (eth.Bytes32, error)
- type ChainSpec
- func (s *ChainSpec) ChannelTimeout() uint64
- func (s *ChainSpec) CheckForkActivation(log log.Logger, block eth.L2BlockRef)
- func (s *ChainSpec) IsCanyon(t uint64) bool
- func (s *ChainSpec) IsFeatMaxSequencerDriftConstant(t uint64) bool
- func (s *ChainSpec) MaxChannelBankSize(t uint64) uint64
- func (s *ChainSpec) MaxRLPBytesPerChannel(t uint64) uint64
- func (s *ChainSpec) MaxSequencerDrift(t uint64) uint64
- type Config
- func (cfg *Config) Check() error
- func (cfg *Config) CheckL1ChainID(ctx context.Context, client L1Client) error
- func (cfg *Config) CheckL1GenesisBlockHash(ctx context.Context, client L1Client) error
- func (cfg *Config) CheckL2ChainID(ctx context.Context, client L2Client) error
- func (cfg *Config) CheckL2GenesisBlockHash(ctx context.Context, client L2Client) error
- func (c *Config) Description(l2Chains map[string]string) string
- func (c *Config) ForkchoiceUpdatedVersion(attr *eth.PayloadAttributes) eth.EngineAPIMethod
- func (c *Config) GetOPPlasmaConfig() (plasma.Config, error)
- func (c *Config) GetPayloadVersion(timestamp uint64) eth.EngineAPIMethod
- func (c *Config) IsCanyon(timestamp uint64) bool
- func (c *Config) IsCanyonActivationBlock(l2BlockTime uint64) bool
- func (c *Config) IsDelta(timestamp uint64) bool
- func (c *Config) IsDeltaActivationBlock(l2BlockTime uint64) bool
- func (c *Config) IsEcotone(timestamp uint64) bool
- func (c *Config) IsEcotoneActivationBlock(l2BlockTime uint64) bool
- func (c *Config) IsFjord(timestamp uint64) bool
- func (c *Config) IsFjordActivationBlock(l2BlockTime uint64) bool
- func (c *Config) IsInterop(timestamp uint64) bool
- func (c *Config) IsInteropActivationBlock(l2BlockTime uint64) bool
- func (c *Config) IsRegolith(timestamp uint64) bool
- func (c *Config) IsRegolithActivationBlock(l2BlockTime uint64) bool
- func (c *Config) L1Signer() types.Signer
- func (c *Config) LogDescription(log log.Logger, l2Chains map[string]string)
- func (c *Config) NewPayloadVersion(timestamp uint64) eth.EngineAPIMethod
- func (c *Config) PlasmaEnabled() bool
- func (c *Config) SyncLookback() uint64
- func (cfg *Config) TargetBlockNumber(timestamp uint64) (num uint64, err error)
- func (cfg *Config) TimestampForBlock(blockNumber uint64) uint64
- func (cfg *Config) ValidateL1Config(ctx context.Context, client L1Client) error
- func (cfg *Config) ValidateL2Config(ctx context.Context, client L2Client, skipL2GenesisBlockHash bool) error
- type Epoch
- type ForkName
- type Genesis
- type L1Client
- type L2Client
- type PlasmaConfig
Constants ¶
const SafeMaxRLPBytesPerChannel = maxRLPBytesPerChannelBedrock
SafeMaxRLPBytesPerChannel is a limit of RLP Bytes per channel that is valid across every OP Stack chain. The limit on certain chains at certain times may be higher TODO(#10428) Remove this parameter
Variables ¶
var ( ErrBlockTimeZero = errors.New("block time cannot be 0") ErrMissingChannelTimeout = errors.New("channel timeout must be set, this should cover at least a L1 block time") ErrInvalidSeqWindowSize = errors.New("sequencing window size must at least be 2") ErrMissingGenesisL1Hash = errors.New("genesis L1 hash cannot be empty") ErrMissingGenesisL2Hash = errors.New("genesis L2 hash cannot be empty") ErrGenesisHashesSame = errors.New("achievement get! rollup inception: L1 and L2 genesis cannot be the same") ErrMissingGenesisL2Time = errors.New("missing L2 genesis time") ErrMissingBatcherAddr = errors.New("missing genesis system config batcher address") ErrMissingScalar = errors.New("missing genesis system config scalar") ErrMissingGasLimit = errors.New("missing genesis system config gas limit") ErrMissingBatchInboxAddress = errors.New("missing batch inbox address") ErrMissingDepositContractAddress = errors.New("missing deposit contract address") ErrMissingL1ChainID = errors.New("L1 chain ID must not be nil") ErrMissingL2ChainID = errors.New("L2 chain ID must not be nil") ErrChainIDsSame = errors.New("L1 and L2 chain IDs must be different") ErrL1ChainIDNotPositive = errors.New("L1 chain ID must be non-zero and positive") ErrL2ChainIDNotPositive = errors.New("L2 chain ID must be non-zero and positive") )
var ErrNilProof = errors.New("output root proof is nil")
var OPStackSupport = params.ProtocolVersionV0{Build: [8]byte{}, Major: 7, Minor: 0, Patch: 0, PreRelease: 0}.Encode()
Functions ¶
func ComputeL2OutputRoot ¶
func ComputeL2OutputRoot(proofElements *bindings.TypesOutputRootProof) (eth.Bytes32, error)
ComputeL2OutputRoot computes the L2 output root by hashing an output root proof.
Types ¶
type ChainSpec ¶
type ChainSpec struct {
// contains filtered or unexported fields
}
func NewChainSpec ¶
func (*ChainSpec) ChannelTimeout ¶
ChannelTimeout returns the channel timeout constant.
func (*ChainSpec) CheckForkActivation ¶
func (s *ChainSpec) CheckForkActivation(log log.Logger, block eth.L2BlockRef)
func (*ChainSpec) IsFeatMaxSequencerDriftConstant ¶
IsFeatMaxSequencerDriftConstant specifies in which fork the max sequencer drift change to a constant will be performed.
func (*ChainSpec) MaxChannelBankSize ¶
MaxChannelBankSize returns the maximum number of bytes the can allocated inside the channel bank before pruning occurs at the given timestamp.
func (*ChainSpec) MaxRLPBytesPerChannel ¶
MaxRLPBytesPerChannel returns the maximum amount of bytes that will be read from a channel at a given timestamp.
func (*ChainSpec) MaxSequencerDrift ¶
MaxSequencerDrift returns the maximum sequencer drift for the given block timestamp. Until Fjord, this was a rollup configuration parameter. Since Fjord, it is a constant, so its effective value should always be queried via the ChainSpec.
type Config ¶
type Config struct { // Genesis anchor point of the rollup Genesis Genesis `json:"genesis"` // Seconds per L2 block BlockTime uint64 `json:"block_time"` // Sequencer batches may not be more than MaxSequencerDrift seconds after // the L1 timestamp of the sequencing window end. // // Note: When L1 has many 1 second consecutive blocks, and L2 grows at fixed 2 seconds, // the L2 time may still grow beyond this difference. // // With Fjord, the MaxSequencerDrift becomes a constant. Use the ChainSpec // instead of reading this rollup configuration field directly to determine // the max sequencer drift for a given block based on the block's L1 origin. // Chains that activate Fjord at genesis may leave this field empty. MaxSequencerDrift uint64 `json:"max_sequencer_drift,omitempty"` // Number of epochs (L1 blocks) per sequencing window, including the epoch L1 origin block itself SeqWindowSize uint64 `json:"seq_window_size"` // Number of L1 blocks between when a channel can be opened and when it must be closed by. ChannelTimeout uint64 `json:"channel_timeout"` // Required to verify L1 signatures L1ChainID *big.Int `json:"l1_chain_id"` // Required to identify the L2 network and create p2p signatures unique for this chain. L2ChainID *big.Int `json:"l2_chain_id"` // RegolithTime sets the activation time of the Regolith network-upgrade: // a pre-mainnet Bedrock change that addresses findings of the Sherlock contest related to deposit attributes. // "Regolith" is the loose deposited rock that sits on top of Bedrock. // Active if RegolithTime != nil && L2 block timestamp >= *RegolithTime, inactive otherwise. RegolithTime *uint64 `json:"regolith_time,omitempty"` // CanyonTime sets the activation time of the Canyon network upgrade. // Active if CanyonTime != nil && L2 block timestamp >= *CanyonTime, inactive otherwise. CanyonTime *uint64 `json:"canyon_time,omitempty"` // DeltaTime sets the activation time of the Delta network upgrade. // Active if DeltaTime != nil && L2 block timestamp >= *DeltaTime, inactive otherwise. DeltaTime *uint64 `json:"delta_time,omitempty"` // EcotoneTime sets the activation time of the Ecotone network upgrade. // Active if EcotoneTime != nil && L2 block timestamp >= *EcotoneTime, inactive otherwise. EcotoneTime *uint64 `json:"ecotone_time,omitempty"` // FjordTime sets the activation time of the Fjord network upgrade. // Active if FjordTime != nil && L2 block timestamp >= *FjordTime, inactive otherwise. FjordTime *uint64 `json:"fjord_time,omitempty"` // InteropTime sets the activation time for an experimental feature-set, activated like a hardfork. // Active if InteropTime != nil && L2 block timestamp >= *InteropTime, inactive otherwise. InteropTime *uint64 `json:"interop_time,omitempty"` // L1 address that batches are sent to. BatchInboxAddress common.Address `json:"batch_inbox_address"` // L1 Deposit Contract Address DepositContractAddress common.Address `json:"deposit_contract_address"` // L1 System Config Address L1SystemConfigAddress common.Address `json:"l1_system_config_address"` // L1 address that declares the protocol versions, optional (Beta feature) ProtocolVersionsAddress common.Address `json:"protocol_versions_address,omitempty"` // Plasma Config. We are in the process of migrating to the PlasmaConfig from these legacy top level values PlasmaConfig *PlasmaConfig `json:"plasma_config,omitempty"` LegacyDAChallengeAddress common.Address `json:"da_challenge_contract_address,omitempty"` // DA challenge window value set on the DAC contract. Used in plasma mode // to compute when a commitment can no longer be challenged. LegacyDAChallengeWindow uint64 `json:"da_challenge_window,omitempty"` // DA resolve window value set on the DAC contract. Used in plasma mode // to compute when a challenge expires and trigger a reorg if needed. LegacyDAResolveWindow uint64 `json:"da_resolve_window,omitempty"` // LegacyUsePlasma is activated when the chain is in plasma mode. LegacyUsePlasma bool `json:"use_plasma,omitempty"` IsForkPublicNetwork bool }
func LoadOPStackRollupConfig ¶
LoadOPStackRollupConfig loads the rollup configuration of the requested chain ID from the superchain-registry. Some chains may require a SystemConfigProvider to retrieve any values not part of the registry.
func (*Config) CheckL1ChainID ¶
CheckL1ChainID checks that the configured L1 chain ID matches the client's chain ID.
func (*Config) CheckL1GenesisBlockHash ¶
CheckL1GenesisBlockHash checks that the configured L1 genesis block hash is valid for the given client.
func (*Config) CheckL2ChainID ¶
CheckL2ChainID checks that the configured L2 chain ID matches the client's chain ID.
func (*Config) CheckL2GenesisBlockHash ¶
CheckL2GenesisBlockHash checks that the configured L2 genesis block hash is valid for the given client.
func (*Config) Description ¶
Description outputs a banner describing the important parts of rollup configuration in a human-readable form. Optionally provide a mapping of L2 chain IDs to network names to label the L2 chain with if not unknown. The config should be config.Check()-ed before creating a description.
func (*Config) ForkchoiceUpdatedVersion ¶
func (c *Config) ForkchoiceUpdatedVersion(attr *eth.PayloadAttributes) eth.EngineAPIMethod
ForkchoiceUpdatedVersion returns the EngineAPIMethod suitable for the chain hard fork version.
func (*Config) GetOPPlasmaConfig ¶
GetOPPlasmaConfig validates and returns the plasma config from the rollup config.
func (*Config) GetPayloadVersion ¶
func (c *Config) GetPayloadVersion(timestamp uint64) eth.EngineAPIMethod
GetPayloadVersion returns the EngineAPIMethod suitable for the chain hard fork version.
func (*Config) IsCanyon ¶
IsCanyon returns true if the Canyon hardfork is active at or past the given timestamp.
func (*Config) IsCanyonActivationBlock ¶
func (*Config) IsDelta ¶
IsDelta returns true if the Delta hardfork is active at or past the given timestamp.
func (*Config) IsDeltaActivationBlock ¶
func (*Config) IsEcotone ¶
IsEcotone returns true if the Ecotone hardfork is active at or past the given timestamp.
func (*Config) IsEcotoneActivationBlock ¶
IsEcotoneActivationBlock returns whether the specified block is the first block subject to the Ecotone upgrade. Ecotone activation at genesis does not count.
func (*Config) IsFjord ¶
IsFjord returns true if the Fjord hardfork is active at or past the given timestamp.
func (*Config) IsFjordActivationBlock ¶
IsFjordActivationBlock returns whether the specified block is the first block subject to the Fjord upgrade.
func (*Config) IsInterop ¶
IsInterop returns true if the Interop hardfork is active at or past the given timestamp.
func (*Config) IsInteropActivationBlock ¶
func (*Config) IsRegolith ¶
IsRegolith returns true if the Regolith hardfork is active at or past the given timestamp.
func (*Config) IsRegolithActivationBlock ¶
func (*Config) LogDescription ¶
LogDescription outputs a banner describing the important parts of rollup configuration in a log format. Optionally provide a mapping of L2 chain IDs to network names to label the L2 chain with if not unknown. The config should be config.Check()-ed before creating a description.
func (*Config) NewPayloadVersion ¶
func (c *Config) NewPayloadVersion(timestamp uint64) eth.EngineAPIMethod
NewPayloadVersion returns the EngineAPIMethod suitable for the chain hard fork version.
func (*Config) PlasmaEnabled ¶
func (*Config) SyncLookback ¶
SyncLookback computes the number of blocks to walk back in order to find the correct L1 origin. In plasma mode longest possible window is challenge + resolve windows.
func (*Config) TargetBlockNumber ¶
func (*Config) TimestampForBlock ¶
func (*Config) ValidateL1Config ¶
ValidateL1Config checks L1 config variables for errors.
type Genesis ¶
type Genesis struct { // The L1 block that the rollup starts *after* (no derived transactions) L1 eth.BlockID `json:"l1"` // The L2 block the rollup starts from (no transactions, pre-configured state) L2 eth.BlockID `json:"l2"` // Timestamp of L2 block L2Time uint64 `json:"l2_time"` // Initial system configuration values. // The L2 genesis block may not include transactions, and thus cannot encode the config values, // unlike later L2 blocks. SystemConfig eth.SystemConfig `json:"system_config"` }
type PlasmaConfig ¶
type PlasmaConfig struct { // L1 DataAvailabilityChallenge contract proxy address DAChallengeAddress common.Address `json:"da_challenge_contract_address,omitempty"` // CommitmentType specifies which commitment type can be used. Defaults to Keccak (type 0) if not present CommitmentType string `json:"da_commitment_type"` // DA challenge window value set on the DAC contract. Used in plasma mode // to compute when a commitment can no longer be challenged. DAChallengeWindow uint64 `json:"da_challenge_window"` // DA resolve window value set on the DAC contract. Used in plasma mode // to compute when a challenge expires and trigger a reorg if needed. DAResolveWindow uint64 `json:"da_resolve_window"` }
Directories ¶
Path | Synopsis |
---|---|
Package derive provides the data transformation functions that take L1 data and turn it into L2 blocks and results.
|
Package derive provides the data transformation functions that take L1 data and turn it into L2 blocks and results. |
Package sync is responsible for reconciling L1 and L2.
|
Package sync is responsible for reconciling L1 and L2. |