services

package
v0.0.0-...-4547e52 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2023 License: GPL-3.0, Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CmdlineFlagName = "rollup.l1.endpoint"
)

Variables

This section is empty.

Functions

func CLIFlags

func CLIFlags() []cli.Flag

Returns all supported flags.

Types

type BaseConfig

type BaseConfig interface {
	GetRollupGenesisBlock() uint64
	GetAccountAddr() common.Address
}

type BaseService

type BaseService struct {
	Config BaseConfig

	Eth          api.ExecutionBackend
	ProofBackend proof.Backend
	L1Client     client.L1BridgeClient
	L1Syncer     *eth.EthSyncer

	Cancel context.CancelFunc
	Wg     sync.WaitGroup
}

TODO: delete.

func NewBaseService

func NewBaseService(execBackend api.ExecutionBackend, proofBackend proof.Backend, l1Client client.L1BridgeClient, cfg BaseConfig) (*BaseService, error)

func (*BaseService) Chain

func (b *BaseService) Chain() *core.BlockChain

func (*BaseService) Start

func (b *BaseService) Start(ctx context.Context, eg api.ErrGroup) error

Starts the rollup service.

func (*BaseService) SyncL2ChainToL1Head

func (b *BaseService) SyncL2ChainToL1Head(ctx context.Context, start uint64) (uint64, error)

Sync to current L1 block head and commit blocks. `start` is the block number to start syncing from. Returns the last synced block number (inclusive).

func (*BaseService) SyncLoop

func (b *BaseService) SyncLoop(ctx context.Context, start uint64, newBatchCh chan<- struct{})

type L1Config

type L1Config struct {
	Endpoint           string         `toml:"endpoint,omitempty"`             // L1 API endpoint
	ChainID            uint64         `toml:"chainid,omitempty"`              // L1 chain ID
	RollupGenesisBlock uint64         `toml:"rollup_genesis,omitempty"`       // L1 Rollup genesis block
	SequencerInboxAddr common.Address `toml:"sequencer_inbox_addr,omitempty"` // L1 SequencerInbox contract address
	RollupAddr         common.Address `toml:"rollup_addr,omitempty"`          // L1 Rollup contract address
}

L1 configuration

func (L1Config) GetChainID

func (c L1Config) GetChainID() uint64

func (L1Config) GetEndpoint

func (c L1Config) GetEndpoint() string

func (L1Config) GetRollupAddr

func (c L1Config) GetRollupAddr() common.Address

func (L1Config) GetRollupGenesisBlock

func (c L1Config) GetRollupGenesisBlock() uint64

func (L1Config) GetSequencerInboxAddr

func (c L1Config) GetSequencerInboxAddr() common.Address

type L2Config

type L2Config struct {
	Endpoint            string         `toml:"endpoint,omitempty"`                // L2 API endpoint
	ChainID             uint64         `toml:"chainid,omitempty"`                 // L2 chain ID
	L1FeeOverhead       int64          `toml:"l1_fee_overhead,omitempty"`         // Gas cost of sequencing a tx
	L1FeeMultiplier     float64        `toml:"l1_fee_multiplier,omitempty"`       // Scalar value to increase L1 fee
	L1OracleAddress     common.Address `toml:"l1_oracle_address,omitempty"`       // L2 Address of the L1Oracle
	L1OracleBaseFeeSlot common.Hash    `toml:"l1_oracle_base_fee_slot,omitempty"` // L1 basefee storage slot of the L1Oracle
}

L2 configuration

func (L2Config) GetChainID

func (c L2Config) GetChainID() uint64

func (L2Config) GetEndpoint

func (c L2Config) GetEndpoint() string

func (L2Config) GetL1FeeMultiplier

func (c L2Config) GetL1FeeMultiplier() float64

func (L2Config) GetL1FeeOverhead

func (c L2Config) GetL1FeeOverhead() int64

func (L2Config) GetL1OracleAddress

func (c L2Config) GetL1OracleAddress() common.Address

func (L2Config) GetL1OracleBaseFeeSlot

func (c L2Config) GetL1OracleBaseFeeSlot() common.Hash

type SequencerConfig

type SequencerConfig 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 Clef Endpoint used for signing txs
	ClefEndpoint string `toml:"clef_endpoint,omitempty"`
	// The passphrase of the sequencer account
	Passphrase string `toml:"passphrase,omitempty"`
	// Time between batch dissemination (DA) steps
	DisseminationInterval time.Duration `toml:"dissemination_interval,omitempty"`
	// Transaction manager configuration
	TxMgrCfg txmgr.Config `toml:"txmgr,omitempty"`
}

Sequencer node configuration

func (SequencerConfig) GetAccountAddr

func (c SequencerConfig) GetAccountAddr() common.Address

func (SequencerConfig) GetClefEndpoint

func (c SequencerConfig) GetClefEndpoint() string

func (SequencerConfig) GetDisseminationInterval

func (c SequencerConfig) GetDisseminationInterval() time.Duration

func (SequencerConfig) GetIsEnabled

func (c SequencerConfig) GetIsEnabled() bool

func (SequencerConfig) GetPassphrase

func (c SequencerConfig) GetPassphrase() string

func (SequencerConfig) GetTxMgrCfg

func (c SequencerConfig) GetTxMgrCfg() txmgr.Config

type SystemConfig

type SystemConfig struct {
	L1Config        `toml:"l1,omitempty"`
	L2Config        `toml:"l2,omitempty"`
	SequencerConfig `toml:"sequencer,omitempty"`
	ValidatorConfig `toml:"validator,omitempty"`
}

func ParseSystemConfig

func ParseSystemConfig(cliCtx *cli.Context) (*SystemConfig, error)

Parses all CLI flags and returns a full system config.

func (*SystemConfig) L1

func (c *SystemConfig) L1() L1Config

func (*SystemConfig) L2

func (c *SystemConfig) L2() L2Config

func (*SystemConfig) Sequencer

func (c *SystemConfig) Sequencer() SequencerConfig

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 Clef Endpoint used for signing txs
	ClefEndpoint string `toml:"clef_endpoint,omitempty"`
	// The passphrase of the validator account
	Passphrase string `toml:"passphrase,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) GetPassphrase

func (c ValidatorConfig) GetPassphrase() string

func (ValidatorConfig) GetTxMgrCfg

func (c ValidatorConfig) GetTxMgrCfg() txmgr.Config

func (ValidatorConfig) GetValidationInterval

func (c ValidatorConfig) GetValidationInterval() time.Duration

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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