rollup

package
v0.10.14 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2023 License: MIT Imports: 9 Imported by: 51

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ComputeL2OutputRoot

func ComputeL2OutputRoot(l2OutputRootVersion eth.Bytes32, blockHash common.Hash, blockRoot common.Hash, storageRoot common.Hash) eth.Bytes32

ComputeL2OutputRoot computes the L2 output root

func HashOutputRootProof added in v0.10.7

func HashOutputRootProof(proof *bindings.TypesOutputRootProof) eth.Bytes32

HashOutputRootProof computes the hash of the output root proof

Types

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.
	MaxSequencerDrift uint64 `json:"max_sequencer_drift"`
	// 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"`

	// 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"`
}

func (*Config) Check

func (cfg *Config) Check() error

Check verifies that the given configuration makes sense

func (*Config) CheckL1ChainID added in v0.10.11

func (cfg *Config) CheckL1ChainID(ctx context.Context, client L1Client) error

CheckL1ChainID checks that the configured L1 chain ID matches the client's chain ID.

func (*Config) CheckL1GenesisBlockHash added in v0.10.11

func (cfg *Config) CheckL1GenesisBlockHash(ctx context.Context, client L1Client) error

CheckL1GenesisBlockHash checks that the configured L1 genesis block hash is valid for the given client.

func (*Config) CheckL2ChainID added in v0.10.11

func (cfg *Config) CheckL2ChainID(ctx context.Context, client L2Client) error

CheckL2ChainID checks that the configured L2 chain ID matches the client's chain ID.

func (*Config) CheckL2GenesisBlockHash added in v0.10.11

func (cfg *Config) CheckL2GenesisBlockHash(ctx context.Context, client L2Client) error

CheckL2GenesisBlockHash checks that the configured L2 genesis block hash is valid for the given client.

func (*Config) L1Signer

func (c *Config) L1Signer() types.Signer

func (*Config) ValidateL1Config added in v0.10.11

func (cfg *Config) ValidateL1Config(ctx context.Context, client L1Client) error

ValidateL1Config checks L1 config variables for errors.

func (*Config) ValidateL2Config added in v0.10.11

func (cfg *Config) ValidateL2Config(ctx context.Context, client L2Client) error

ValidateL2Config checks L2 config variables for errors.

type Epoch

type Epoch uint64

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 L1Client added in v0.10.11

type L1Client interface {
	ChainID(context.Context) (*big.Int, error)
	L1BlockRefByNumber(context.Context, uint64) (eth.L1BlockRef, error)
}

type L2Client added in v0.10.11

type L2Client interface {
	ChainID(context.Context) (*big.Int, error)
	L2BlockRefByNumber(context.Context, uint64) (eth.L2BlockRef, error)
}

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.

Jump to

Keyboard shortcuts

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