Documentation ¶
Index ¶
- Variables
- func CLIFlags() []cli.Flag
- type Bytes32
- type DisseminatorConfig
- func (c DisseminatorConfig) GetAccountAddr() common.Address
- func (c DisseminatorConfig) GetClefEndpoint() string
- func (c DisseminatorConfig) GetDisseminationInterval() time.Duration
- func (c DisseminatorConfig) GetIsEnabled() bool
- func (c DisseminatorConfig) GetPrivateKey() *ecdsa.PrivateKey
- func (c DisseminatorConfig) GetSubSafetyMargin() uint64
- func (c DisseminatorConfig) GetTargetBatchSize() uint64
- func (c DisseminatorConfig) GetTxMgrCfg() txmgr.Config
- type Genesis
- type L1Client
- type L1Config
- type L2Client
- type L2Config
- type ProtocolConfig
- func (c ProtocolConfig) GetL1ChainID() uint64
- func (c ProtocolConfig) GetL1OracleAddr() common.Address
- func (c ProtocolConfig) GetL2ChainID() uint64
- func (c ProtocolConfig) GetRollup() RollupConfig
- func (c ProtocolConfig) GetRollupAddr() common.Address
- func (c ProtocolConfig) GetSeqWindowSize() uint64
- func (c ProtocolConfig) GetSequencerInboxAddr() common.Address
- type RollupConfig
- func (cfg *RollupConfig) Check() error
- func (cfg *RollupConfig) CheckL1ChainID(ctx context.Context, client L1Client) error
- func (cfg *RollupConfig) CheckL1GenesisBlockHash(ctx context.Context, client L1Client) error
- func (cfg *RollupConfig) CheckL2ChainID(ctx context.Context, client L2Client) error
- func (cfg *RollupConfig) CheckL2GenesisBlockHash(ctx context.Context, client L2Client) error
- func (cfg *RollupConfig) TargetBlockNumber(timestamp uint64) (num uint64, err error)
- func (cfg *RollupConfig) ValidateL1Config(ctx context.Context, client L1Client) error
- func (cfg *RollupConfig) ValidateL2Config(ctx context.Context, client L2Client) error
- type SystemConfig
- type ValidatorConfig
- func (c ValidatorConfig) GetAccountAddr() common.Address
- func (c ValidatorConfig) GetClefEndpoint() string
- func (c ValidatorConfig) GetIsEnabled() bool
- func (c ValidatorConfig) GetPrivateKey() *ecdsa.PrivateKey
- func (c ValidatorConfig) GetTxMgrCfg() txmgr.Config
- func (c ValidatorConfig) GetValidationInterval() time.Duration
Constants ¶
This section is empty.
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") ErrMissingOverhead = errors.New("missing genesis system config overhead") 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 ( VerbosityFlag = &cli.IntFlag{ Name: "verbosity", Usage: "Set the log verbosity level. 0 = silent, 1 = error, 2 = warn, 3 = info, 4 = debug, 5 = trace", Value: int(log.LvlInfo), } )
These are all the command line flags we support. If you add to this list, please remember to include the flag in the appropriate command definition.
Functions ¶
Types ¶
type Bytes32 ¶
type Bytes32 [32]byte
func (Bytes32) MarshalText ¶
func (Bytes32) TerminalString ¶
func (*Bytes32) UnmarshalJSON ¶
func (*Bytes32) UnmarshalText ¶
type DisseminatorConfig ¶
type DisseminatorConfig struct { // Whether this node is a sequencer IsEnabled bool `toml:"enabled,omitempty"` // The address of this sequencer AccountAddr common.Address `toml:"account_addr,omitempty"` // The private key for AccountAddr PrivateKey *ecdsa.PrivateKey // The Clef Endpoint used for signing txs ClefEndpoint string `toml:"clef_endpoint,omitempty"` // Time between batch dissemination (DA) steps DisseminationInterval time.Duration `toml:"dissemination_interval,omitempty"` // The safety margin for batch tx submission (in # of L1 blocks) SubSafetyMargin uint64 `toml:"sub_safety_margin,omitempty"` // The target size of a batch tx submitted to L1 (bytes). TargetBatchSize uint64 `toml:"max_l1_tx_size,omitempty"` // Transaction manager configuration TxMgrCfg txmgr.Config `toml:"txmgr,omitempty"` }
Sequencer node configuration
func (DisseminatorConfig) GetAccountAddr ¶
func (c DisseminatorConfig) GetAccountAddr() common.Address
func (DisseminatorConfig) GetClefEndpoint ¶
func (c DisseminatorConfig) GetClefEndpoint() string
func (DisseminatorConfig) GetDisseminationInterval ¶
func (c DisseminatorConfig) GetDisseminationInterval() time.Duration
func (DisseminatorConfig) GetIsEnabled ¶
func (c DisseminatorConfig) GetIsEnabled() bool
func (DisseminatorConfig) GetPrivateKey ¶
func (c DisseminatorConfig) GetPrivateKey() *ecdsa.PrivateKey
func (DisseminatorConfig) GetSubSafetyMargin ¶
func (c DisseminatorConfig) GetSubSafetyMargin() uint64
func (DisseminatorConfig) GetTargetBatchSize ¶
func (c DisseminatorConfig) GetTargetBatchSize() uint64
func (DisseminatorConfig) GetTxMgrCfg ¶
func (c DisseminatorConfig) GetTxMgrCfg() txmgr.Config
type Genesis ¶
type Genesis struct { // The L1 block that the rollup starts *after* (no derived transactions) L1 spTypes.BlockID `json:"l1"` // The L2 block the rollup starts from (no transactions, pre-configured state) L2 spTypes.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 systemConfig `json:"system_config"` }
type L1Config ¶
type L1Config struct {
Endpoint string `toml:"endpoint,omitempty"` // L1 API endpoint
}
L1 configuration
func (L1Config) GetEndpoint ¶
type L2Config ¶
type L2Config struct { Endpoint string `toml:"endpoint,omitempty"` // L2 API endpoint ChainID uint64 `toml:"chainid,omitempty"` // L2 chain ID }
L2 configuration
func (L2Config) GetEndpoint ¶
type ProtocolConfig ¶
type ProtocolConfig struct { Rollup RollupConfig `toml:"rollup,omitempty"` RollupAddr common.Address `toml:"rollup_addr,omitempty"` // L1 Rollup contract address L1OracleAddr common.Address `toml:"l1_oracle_addr,omitempty"` // L2 Address of the L1Oracle }
Protocol configuration Basically: fields from `rollup.json` + additional protocol fields
func (ProtocolConfig) GetL1ChainID ¶
func (c ProtocolConfig) GetL1ChainID() uint64
func (ProtocolConfig) GetL1OracleAddr ¶
func (c ProtocolConfig) GetL1OracleAddr() common.Address
func (ProtocolConfig) GetL2ChainID ¶
func (c ProtocolConfig) GetL2ChainID() uint64
func (ProtocolConfig) GetRollup ¶
func (c ProtocolConfig) GetRollup() RollupConfig
func (ProtocolConfig) GetRollupAddr ¶
func (c ProtocolConfig) GetRollupAddr() common.Address
func (ProtocolConfig) GetSeqWindowSize ¶
func (c ProtocolConfig) GetSeqWindowSize() uint64
TODO: cleanup (consider: exposing parameters via getters in `c.Rollup` directly).
func (ProtocolConfig) GetSequencerInboxAddr ¶
func (c ProtocolConfig) GetSequencerInboxAddr() common.Address
type RollupConfig ¶
type RollupConfig 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"` // 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"` // Note: below addresses are part of the block-derivation process, // and required to be the same network-wide to stay in consensus. // L1 address that batches are sent to. BatchInboxAddress common.Address `json:"batch_inbox_address"` }
func NewRollupConfig ¶
func NewRollupConfig(path string) (*RollupConfig, error)
NewDeployConfig reads a config file given a path on the filesystem.
func (*RollupConfig) Check ¶
func (cfg *RollupConfig) Check() error
Check verifies that the given configuration makes sense
func (*RollupConfig) CheckL1ChainID ¶
func (cfg *RollupConfig) CheckL1ChainID(ctx context.Context, client L1Client) error
CheckL1ChainID checks that the configured L1 chain ID matches the client's chain ID.
func (*RollupConfig) CheckL1GenesisBlockHash ¶
func (cfg *RollupConfig) CheckL1GenesisBlockHash(ctx context.Context, client L1Client) error
CheckL1GenesisBlockHash checks that the configured L1 genesis block hash is valid for the given client.
func (*RollupConfig) CheckL2ChainID ¶
func (cfg *RollupConfig) CheckL2ChainID(ctx context.Context, client L2Client) error
CheckL2ChainID checks that the configured L2 chain ID matches the client's chain ID.
func (*RollupConfig) CheckL2GenesisBlockHash ¶
func (cfg *RollupConfig) CheckL2GenesisBlockHash(ctx context.Context, client L2Client) error
CheckL2GenesisBlockHash checks that the configured L2 genesis block hash is valid for the given client.
func (*RollupConfig) TargetBlockNumber ¶
func (cfg *RollupConfig) TargetBlockNumber(timestamp uint64) (num uint64, err error)
func (*RollupConfig) ValidateL1Config ¶
func (cfg *RollupConfig) ValidateL1Config(ctx context.Context, client L1Client) error
ValidateL1Config checks L1 config variables for errors.
func (*RollupConfig) ValidateL2Config ¶
func (cfg *RollupConfig) ValidateL2Config(ctx context.Context, client L2Client) error
ValidateL2Config checks L2 config variables for errors.
type SystemConfig ¶
type SystemConfig struct { ProtocolConfig `toml:"protocol,omitempty"` L1Config `toml:"l1,omitempty"` L2Config `toml:"l2,omitempty"` DisseminatorConfig `toml:"disseminator,omitempty"` ValidatorConfig `toml:"validator,omitempty"` }
TODO: rename due to naming conflict
func ParseSystemConfig ¶
func ParseSystemConfig(cliCtx *cli.Context) (*SystemConfig, error)
Parses all CLI flags and returns a full system config.
func (*SystemConfig) Disseminator ¶
func (c *SystemConfig) Disseminator() DisseminatorConfig
func (*SystemConfig) L1 ¶
func (c *SystemConfig) L1() L1Config
func (*SystemConfig) L2 ¶
func (c *SystemConfig) L2() L2Config
func (*SystemConfig) Protocol ¶
func (c *SystemConfig) Protocol() ProtocolConfig
func (*SystemConfig) Validator ¶
func (c *SystemConfig) Validator() ValidatorConfig
type ValidatorConfig ¶
type ValidatorConfig struct { // Whether this node is a validator IsEnabled bool `toml:"enabled,omitempty"` // The address of this validator AccountAddr common.Address `toml:"account_addr,omitempty"` // The private key for AccountAddr PrivateKey *ecdsa.PrivateKey // The Clef Endpoint used for signing txs ClefEndpoint string `toml:"clef_endpoint,omitempty"` // Time between validation steps ValidationInterval time.Duration `toml:"validation_interval,omitempty"` // Transaction manager configuration TxMgrCfg txmgr.Config `toml:"txmgr,omitempty"` }
func (ValidatorConfig) GetAccountAddr ¶
func (c ValidatorConfig) GetAccountAddr() common.Address
func (ValidatorConfig) GetClefEndpoint ¶
func (c ValidatorConfig) GetClefEndpoint() string
func (ValidatorConfig) GetIsEnabled ¶
func (c ValidatorConfig) GetIsEnabled() bool
func (ValidatorConfig) GetPrivateKey ¶
func (c ValidatorConfig) GetPrivateKey() *ecdsa.PrivateKey
func (ValidatorConfig) GetTxMgrCfg ¶
func (c ValidatorConfig) GetTxMgrCfg() txmgr.Config
func (ValidatorConfig) GetValidationInterval ¶
func (c ValidatorConfig) GetValidationInterval() time.Duration