Documentation ¶
Index ¶
- func NewConfDepth(depth uint64, l1Head func() eth.L1BlockRef, fetcher derive.L1Fetcher) *confDepth
- type Config
- type DerivationPipeline
- type Downloader
- type Driver
- func (s *Driver) BlockRefWithStatus(ctx context.Context, num uint64) (eth.L2BlockRef, *eth.SyncStatus, error)
- func (s *Driver) Close() error
- func (s *Driver) OnL1Finalized(ctx context.Context, finalized eth.L1BlockRef) error
- func (s *Driver) OnL1Head(ctx context.Context, unsafe eth.L1BlockRef) error
- func (s *Driver) OnL1Safe(ctx context.Context, safe eth.L1BlockRef) error
- func (s *Driver) OnUnsafeL2Payload(ctx context.Context, payload *eth.ExecutionPayload) error
- func (s *Driver) ResetDerivationPipeline(ctx context.Context) error
- func (s *Driver) Start() error
- func (s *Driver) StartSequencer(ctx context.Context, blockHash common.Hash) error
- func (s *Driver) StopSequencer(ctx context.Context) (common.Hash, error)
- func (s *Driver) SyncStatus(ctx context.Context) (*eth.SyncStatus, error)
- type EngineMetrics
- type L1Blocks
- type L1Chain
- type L1Metrics
- type L1OriginSelector
- type L1OriginSelectorIface
- type L1State
- func (s *L1State) HandleNewL1FinalizedBlock(finalized eth.L1BlockRef)
- func (s *L1State) HandleNewL1HeadBlock(head eth.L1BlockRef)
- func (s *L1State) HandleNewL1SafeBlock(safe eth.L1BlockRef)
- func (s *L1State) L1Finalized() eth.L1BlockRef
- func (s *L1State) L1Head() eth.L1BlockRef
- func (s *L1State) L1Safe() eth.L1BlockRef
- type L1StateIface
- type L2Chain
- type MeteredEngine
- func (m *MeteredEngine) BuildingPayload() (onto eth.L2BlockRef, id eth.PayloadID, safe bool)
- func (m *MeteredEngine) CancelPayload(ctx context.Context, force bool) error
- func (m *MeteredEngine) ConfirmPayload(ctx context.Context) (out *eth.ExecutionPayload, errTyp derive.BlockInsertionErrType, err error)
- func (m *MeteredEngine) Finalized() eth.L2BlockRef
- func (m *MeteredEngine) SafeL2Head() eth.L2BlockRef
- func (m *MeteredEngine) StartPayload(ctx context.Context, parent eth.L2BlockRef, attrs *eth.PayloadAttributes, ...) (errType derive.BlockInsertionErrType, err error)
- func (m *MeteredEngine) UnsafeL2Head() eth.L2BlockRef
- type Metrics
- type Network
- type Sequencer
- func (d *Sequencer) BuildingOnto() eth.L2BlockRef
- func (d *Sequencer) CancelBuildingBlock(ctx context.Context)
- func (d *Sequencer) CompleteBuildingBlock(ctx context.Context) (*eth.ExecutionPayload, error)
- func (d *Sequencer) PlanNextSequencerAction() time.Duration
- func (d *Sequencer) RunNextSequencerAction(ctx context.Context) *eth.ExecutionPayload
- func (d *Sequencer) StartBuildingBlock(ctx context.Context) error
- type SequencerIface
- type SyncStatusdeprecated
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewConfDepth ¶
func NewConfDepth(depth uint64, l1Head func() eth.L1BlockRef, fetcher derive.L1Fetcher) *confDepth
Types ¶
type Config ¶
type Config struct { // VerifierConfDepth is the distance to keep from the L1 head when reading L1 data for L2 derivation. VerifierConfDepth uint64 `json:"verifier_conf_depth"` // SequencerConfDepth is the distance to keep from the L1 head as origin when sequencing new L2 blocks. // If this distance is too large, the sequencer may: // - not adopt a L1 origin within the allowed time (rollup.Config.MaxSequencerDrift) // - not adopt a L1 origin that can be included on L1 within the allowed range (rollup.Config.SeqWindowSize) // and thus fail to produce a block with anything more than deposits. SequencerConfDepth uint64 `json:"sequencer_conf_depth"` // SequencerEnabled is true when the driver should sequence new blocks. SequencerEnabled bool `json:"sequencer_enabled"` // SequencerStopped is false when the driver should sequence new blocks. SequencerStopped bool `json:"sequencer_stopped"` }
type DerivationPipeline ¶
type DerivationPipeline interface { Reset() Step(ctx context.Context) error AddUnsafePayload(payload *eth.ExecutionPayload) Finalize(ref eth.L1BlockRef) FinalizedL1() eth.L1BlockRef Finalized() eth.L2BlockRef SafeL2Head() eth.L2BlockRef UnsafeL2Head() eth.L2BlockRef Origin() eth.L1BlockRef }
type Downloader ¶
type Driver ¶
type Driver struct {
// contains filtered or unexported fields
}
func NewDriver ¶
func NewDriver(driverCfg *Config, cfg *rollup.Config, l2 L2Chain, l1 L1Chain, network Network, log log.Logger, snapshotLog log.Logger, metrics Metrics) *Driver
NewDriver composes an events handler that tracks L1 state, triggers L2 derivation, and optionally sequences new L2 blocks.
func (*Driver) BlockRefWithStatus ¶
func (s *Driver) BlockRefWithStatus(ctx context.Context, num uint64) (eth.L2BlockRef, *eth.SyncStatus, error)
BlockRefWithStatus blocks the driver event loop and captures the syncing status, along with an L2 block reference by number consistent with that same status. If the event loop is too busy and the context expires, a context error is returned.
func (*Driver) OnL1Finalized ¶
func (*Driver) OnL1Head ¶
OnL1Head signals the driver that the L1 chain changed the "unsafe" block, also known as head of the chain, or "latest".
func (*Driver) OnL1Safe ¶
OnL1Safe signals the driver that the L1 chain changed the "safe", also known as the justified checkpoint (as seen on L1 beacon-chain).
func (*Driver) OnUnsafeL2Payload ¶
func (*Driver) ResetDerivationPipeline ¶
ResetDerivationPipeline forces a reset of the derivation pipeline. It waits for the reset to occur. It simply unblocks the caller rather than fully cancelling the reset request upon a context cancellation.
func (*Driver) Start ¶
Start starts up the state loop. The loop will have been started iff err is not nil.
func (*Driver) StartSequencer ¶ added in v0.10.11
func (*Driver) StopSequencer ¶ added in v0.10.11
func (*Driver) SyncStatus ¶
SyncStatus blocks the driver event loop and captures the syncing status. If the event loop is too busy and the context expires, a context error is returned.
type EngineMetrics ¶ added in v0.10.12
type L1Blocks ¶
type L1Blocks interface { derive.L1BlockRefByHashFetcher derive.L1BlockRefByNumberFetcher }
type L1Chain ¶
type L1Chain interface { derive.L1Fetcher L1BlockRefByLabel(context.Context, eth.BlockLabel) (eth.L1BlockRef, error) }
type L1Metrics ¶
type L1Metrics interface { RecordL1ReorgDepth(d uint64) RecordL1Ref(name string, ref eth.L1BlockRef) }
type L1OriginSelector ¶
type L1OriginSelector struct {
// contains filtered or unexported fields
}
func NewL1OriginSelector ¶
func (*L1OriginSelector) FindL1Origin ¶
func (los *L1OriginSelector) FindL1Origin(ctx context.Context, l2Head eth.L2BlockRef) (eth.L1BlockRef, error)
FindL1Origin determines what the next L1 Origin should be. The L1 Origin is either the L2 Head's Origin, or the following L1 block if the next L2 block's time is greater than or equal to the L2 Head's Origin.
type L1OriginSelectorIface ¶
type L1OriginSelectorIface interface {
FindL1Origin(ctx context.Context, l2Head eth.L2BlockRef) (eth.L1BlockRef, error)
}
type L1State ¶
type L1State struct {
// contains filtered or unexported fields
}
L1State tracks L1 head, safe and finalized blocks. It is not safe to write and read concurrently.
func (*L1State) HandleNewL1FinalizedBlock ¶
func (s *L1State) HandleNewL1FinalizedBlock(finalized eth.L1BlockRef)
func (*L1State) HandleNewL1HeadBlock ¶
func (s *L1State) HandleNewL1HeadBlock(head eth.L1BlockRef)
func (*L1State) HandleNewL1SafeBlock ¶
func (s *L1State) HandleNewL1SafeBlock(safe eth.L1BlockRef)
func (*L1State) L1Finalized ¶
func (s *L1State) L1Finalized() eth.L1BlockRef
L1Finalized returns either the stored L1 finalized block or an empty block reference if the L1 finalized block has not been initialized yet.
func (*L1State) L1Head ¶
func (s *L1State) L1Head() eth.L1BlockRef
L1Head returns either the stored L1 head or an empty block reference if the L1 Head has not been initialized yet.
func (*L1State) L1Safe ¶
func (s *L1State) L1Safe() eth.L1BlockRef
L1Safe returns either the stored L1 safe block or an empty block reference if the L1 safe block has not been initialized yet.
type L1StateIface ¶
type L1StateIface interface { HandleNewL1HeadBlock(head eth.L1BlockRef) HandleNewL1SafeBlock(safe eth.L1BlockRef) HandleNewL1FinalizedBlock(finalized eth.L1BlockRef) L1Head() eth.L1BlockRef L1Safe() eth.L1BlockRef L1Finalized() eth.L1BlockRef }
type MeteredEngine ¶ added in v0.10.12
type MeteredEngine struct {
// contains filtered or unexported fields
}
MeteredEngine wraps an EngineControl and adds metrics such as block building time diff and sealing time
func NewMeteredEngine ¶ added in v0.10.12
func NewMeteredEngine(cfg *rollup.Config, inner derive.EngineControl, metrics EngineMetrics, log log.Logger) *MeteredEngine
func (*MeteredEngine) BuildingPayload ¶ added in v0.10.12
func (m *MeteredEngine) BuildingPayload() (onto eth.L2BlockRef, id eth.PayloadID, safe bool)
func (*MeteredEngine) CancelPayload ¶ added in v0.10.12
func (m *MeteredEngine) CancelPayload(ctx context.Context, force bool) error
func (*MeteredEngine) ConfirmPayload ¶ added in v0.10.12
func (m *MeteredEngine) ConfirmPayload(ctx context.Context) (out *eth.ExecutionPayload, errTyp derive.BlockInsertionErrType, err error)
func (*MeteredEngine) Finalized ¶ added in v0.10.12
func (m *MeteredEngine) Finalized() eth.L2BlockRef
func (*MeteredEngine) SafeL2Head ¶ added in v0.10.12
func (m *MeteredEngine) SafeL2Head() eth.L2BlockRef
func (*MeteredEngine) StartPayload ¶ added in v0.10.12
func (m *MeteredEngine) StartPayload(ctx context.Context, parent eth.L2BlockRef, attrs *eth.PayloadAttributes, updateSafe bool) (errType derive.BlockInsertionErrType, err error)
func (*MeteredEngine) UnsafeL2Head ¶ added in v0.10.12
func (m *MeteredEngine) UnsafeL2Head() eth.L2BlockRef
type Metrics ¶
type Metrics interface { RecordPipelineReset() RecordPublishingError() RecordDerivationError() RecordReceivedUnsafePayload(payload *eth.ExecutionPayload) RecordL1Ref(name string, ref eth.L1BlockRef) RecordL2Ref(name string, ref eth.L2BlockRef) RecordUnsafePayloadsBuffer(length uint64, memSize uint64, next eth.BlockID) SetDerivationIdle(idle bool) RecordL1ReorgDepth(d uint64) EngineMetrics }
type Network ¶
type Network interface { // PublishL2Payload is called by the driver whenever there is a new payload to publish, synchronously with the driver main loop. PublishL2Payload(ctx context.Context, payload *eth.ExecutionPayload) error }
type Sequencer ¶
type Sequencer struct {
// contains filtered or unexported fields
}
Sequencer implements the sequencing interface of the driver: it starts and completes block building jobs.
func NewSequencer ¶
func NewSequencer(log log.Logger, cfg *rollup.Config, engine derive.EngineControl, attributesBuilder derive.AttributesBuilder, l1OriginSelector L1OriginSelectorIface) *Sequencer
func (*Sequencer) BuildingOnto ¶ added in v0.10.12
func (d *Sequencer) BuildingOnto() eth.L2BlockRef
BuildingOnto returns the L2 head reference that the latest block is or was being built on top of.
func (*Sequencer) CancelBuildingBlock ¶ added in v0.10.12
CancelBuildingBlock cancels the current open block building job. This sequencer only maintains one block building job at a time.
func (*Sequencer) CompleteBuildingBlock ¶
CompleteBuildingBlock takes the current block that is being built, and asks the engine to complete the building, seal the block, and persist it as canonical. Warning: the safe and finalized L2 blocks as viewed during the initiation of the block building are reused for completion of the block building. The Execution engine should not change the safe and finalized blocks between start and completion of block building.
func (*Sequencer) PlanNextSequencerAction ¶ added in v0.10.4
PlanNextSequencerAction returns a desired delay till the RunNextSequencerAction call.
func (*Sequencer) RunNextSequencerAction ¶ added in v0.10.12
func (d *Sequencer) RunNextSequencerAction(ctx context.Context) *eth.ExecutionPayload
RunNextSequencerAction starts new block building work, or seals existing work, and is best timed by first awaiting the delay returned by PlanNextSequencerAction. If a new block is successfully sealed, it will be returned for publishing, nil otherwise.
type SequencerIface ¶
type SyncStatus
deprecated
type SyncStatus = eth.SyncStatus
Deprecated: use eth.SyncStatus instead.