Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidChannelTimeout = errors.New("channel timeout is less than the safety margin") ErrInputTargetReached = errors.New("target amount of input data reached") ErrMaxFrameIndex = errors.New("max frame index reached (uint16)") ErrMaxDurationReached = errors.New("max channel duration reached") ErrChannelTimeoutClose = errors.New("close to channel timeout") ErrSeqWindowClose = errors.New("close to sequencer window timeout") )
var ErrReorg = errors.New("block does not extend existing chain")
Functions ¶
func Main ¶
Main is the entrypoint into the Batch Submitter. This method returns a closure that executes the service and blocks until the service exits. The use of a closure allows the parameters bound to the top-level main package, e.g. GitVersion, to be captured and used once the function is executed.
func NewChannelManager ¶
func NewChannelManager(log log.Logger, metr metrics.Metricer, cfg ChannelConfig) *channelManager
Types ¶
type BatchSubmitter ¶
type BatchSubmitter struct { Config // directly embed the config + sources // contains filtered or unexported fields }
BatchSubmitter encapsulates a service responsible for submitting L2 tx batches to L1 for availability.
func NewBatchSubmitter ¶
func NewBatchSubmitter(ctx context.Context, cfg Config, l log.Logger, m metrics.Metricer) (*BatchSubmitter, error)
NewBatchSubmitter initializes the BatchSubmitter, gathering any resources that will be needed during operation.
func NewBatchSubmitterFromCLIConfig ¶
func NewBatchSubmitterFromCLIConfig(cfg CLIConfig, l log.Logger, m metrics.Metricer) (*BatchSubmitter, error)
NewBatchSubmitterFromCLIConfig initializes the BatchSubmitter, gathering any resources that will be needed during operation.
func (*BatchSubmitter) Start ¶
func (l *BatchSubmitter) Start() error
func (*BatchSubmitter) Stop ¶
func (l *BatchSubmitter) Stop() error
func (*BatchSubmitter) StopIfRunning ¶
func (l *BatchSubmitter) StopIfRunning()
type CLIConfig ¶
type CLIConfig struct { // L1EthRpc is the HTTP provider URL for L1. L1EthRpc string // L2EthRpc is the HTTP provider URL for the L2 execution engine. L2EthRpc string // RollupRpc is the HTTP provider URL for the L2 rollup node. RollupRpc string // MaxChannelDuration is the maximum duration (in #L1-blocks) to keep a // channel open. This allows to more eagerly send batcher transactions // during times of low L2 transaction volume. Note that the effective // L1-block distance between batcher transactions is then MaxChannelDuration // + NumConfirmations because the batcher waits for NumConfirmations blocks // after sending a batcher tx and only then starts a new channel. // // If 0, duration checks are disabled. MaxChannelDuration uint64 // The batcher tx submission safety margin (in #L1-blocks) to subtract from // a channel's timeout and sequencing window, to guarantee safe inclusion of // a channel on L1. SubSafetyMargin uint64 // PollInterval is the delay between querying L2 for more transaction // and creating a new batch. PollInterval time.Duration // NumConfirmations is the number of confirmations which we will wait after // appending new batches. NumConfirmations uint64 // SafeAbortNonceTooLowCount is the number of ErrNonceTooLowObservations // required to give up on a tx at a particular nonce without receiving // confirmation. SafeAbortNonceTooLowCount uint64 // ResubmissionTimeout is time we will wait before resubmitting a // transaction. ResubmissionTimeout time.Duration // Mnemonic is the HD seed used to derive the wallet private keys for both // the sequence and proposer. Must be used in conjunction with // SequencerHDPath and ProposerHDPath. Mnemonic string // SequencerHDPath is the derivation path used to obtain the private key for // batched submission of sequencer transactions. SequencerHDPath string // PrivateKey is the private key used to submit sequencer transactions. PrivateKey string RPCConfig rpc.CLIConfig // TxManagerTimeout is the max amount of time to wait for the [txmgr]. // This will default to: 10 * time.Minute. TxManagerTimeout time.Duration // OfflineGasEstimation specifies whether the batcher should calculate // gas estimations offline using the [core.IntrinsicGas] function. OfflineGasEstimation bool // MaxL1TxSize is the maximum size of a batch tx submitted to L1. MaxL1TxSize uint64 // TargetL1TxSize is the target size of a batch tx submitted to L1. TargetL1TxSize uint64 // TargetNumFrames is the target number of frames per channel. TargetNumFrames int // ApproxComprRatio is the approximate compression ratio (<= 1.0) of the used // compression algorithm. ApproxComprRatio float64 Stopped bool LogConfig oplog.CLIConfig MetricsConfig opmetrics.CLIConfig PprofConfig oppprof.CLIConfig // SignerConfig contains the client config for op-signer service SignerConfig opsigner.CLIConfig }
type ChannelConfig ¶
type ChannelConfig struct { // Number of epochs (L1 blocks) per sequencing window, including the epoch // L1 origin block itself SeqWindowSize uint64 // The maximum number of L1 blocks that the inclusion transactions of a // channel's frames can span. ChannelTimeout uint64 // MaxChannelDuration is the maximum duration (in #L1-blocks) to keep the // channel open. This allows control over how long a channel is kept open // during times of low transaction volume. // // If 0, duration checks are disabled. MaxChannelDuration uint64 // The batcher tx submission safety margin (in #L1-blocks) to subtract from // a channel's timeout and sequencing window, to guarantee safe inclusion of // a channel on L1. SubSafetyMargin uint64 // The maximum byte-size a frame can have. MaxFrameSize uint64 // The target number of frames to create per channel. Note that if the // realized compression ratio is worse than the approximate, more frames may // actually be created. This also depends on how close TargetFrameSize is to // MaxFrameSize. TargetFrameSize uint64 // The target number of frames to create in this channel. If the realized // compression ratio is worse than approxComprRatio, additional leftover // frame(s) might get created. TargetNumFrames int // Approximated compression ratio to assume. Should be slightly smaller than // average from experiments to avoid the chances of creating a small // additional leftover frame. ApproxComprRatio float64 }
func (*ChannelConfig) Check ¶
func (cc *ChannelConfig) Check() error
Check validates the ChannelConfig parameters.
func (ChannelConfig) InputThreshold ¶
func (c ChannelConfig) InputThreshold() uint64
InputThreshold calculates the input data threshold in bytes from the given parameters.
type ChannelFullError ¶
type ChannelFullError struct {
Err error
}
func (*ChannelFullError) Error ¶
func (e *ChannelFullError) Error() string
func (*ChannelFullError) Unwrap ¶
func (e *ChannelFullError) Unwrap() error
type Config ¶
type Config struct { L1Client *ethclient.Client L2Client *ethclient.Client RollupNode *sources.RollupClient PollInterval time.Duration From common.Address TxManagerConfig txmgr.Config // RollupConfig is queried at startup Rollup *rollup.Config // Channel builder parameters Channel ChannelConfig // contains filtered or unexported fields }