Documentation
¶
Index ¶
- Variables
- type AltDAIface
- type AltSync
- type AttributesHandler
- type CLSync
- type Config
- type DerivationPipeline
- type Drain
- type Driver
- func (s *Driver) BlockRefWithStatus(ctx context.Context, num uint64) (eth.L2BlockRef, *eth.SyncStatus, error)
- func (s *Driver) Close() error
- func (s *Driver) ConductorEnabled(ctx context.Context) (bool, 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, envelope *eth.ExecutionPayloadEnvelope) error
- func (s *Driver) OverrideLeader(ctx context.Context) error
- func (s *Driver) ResetDerivationPipeline(ctx context.Context) error
- func (s *Driver) SequencerActive(ctx context.Context) (bool, 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 EngineController
- type Finalizer
- type L1Chain
- type L1FetcherMetrics
- type L2Chain
- type MeteredL1Fetcher
- func (m *MeteredL1Fetcher) FetchReceipts(ctx context.Context, blockHash common.Hash) (eth.BlockInfo, types.Receipts, error)
- func (m *MeteredL1Fetcher) InfoAndTxsByHash(ctx context.Context, hash common.Hash) (eth.BlockInfo, types.Transactions, error)
- func (m *MeteredL1Fetcher) InfoByHash(ctx context.Context, hash common.Hash) (eth.BlockInfo, error)
- func (m *MeteredL1Fetcher) L1BlockRefByHash(ctx context.Context, hash common.Hash) (eth.L1BlockRef, error)
- func (m *MeteredL1Fetcher) L1BlockRefByLabel(ctx context.Context, label eth.BlockLabel) (eth.L1BlockRef, error)
- func (m *MeteredL1Fetcher) L1BlockRefByNumber(ctx context.Context, num uint64) (eth.L1BlockRef, error)
- type Metrics
- type Network
- type ResetStepBackoffEvent
- type SequencerStateListener
- type StepAttemptEvent
- type StepDelayedReqEvent
- type StepEvent
- type StepReqEvent
- type StepSchedulingDeriver
- type SyncDeriver
- type SyncStatusdeprecated
- type SyncStatusTracker
Constants ¶
This section is empty.
Variables ¶
var ( ErrSequencerAlreadyStarted = sequencing.ErrSequencerAlreadyStarted ErrSequencerAlreadyStopped = sequencing.ErrSequencerAlreadyStopped )
aliases to not disrupt op-conductor code
Functions ¶
This section is empty.
Types ¶
type AltDAIface ¶ added in v1.9.1
type AltDAIface interface { // Notify L1 finalized head so AltDA finality is always behind L1 Finalize(ref eth.L1BlockRef) // Set the engine finalization signal callback OnFinalizedHeadSignal(f altda.HeadSignalFn) derive.AltDAInputFetcher }
type AltSync ¶
type AltSync interface { // RequestL2Range informs the sync source that the given range of L2 blocks is missing, // and should be retrieved from any available alternative syncing source. // The start and end of the range are exclusive: // the start is the head we already have, the end is the first thing we have queued up. // It's the task of the alt-sync mechanism to use this hint to fetch the right payloads. // Note that the end and start may not be consistent: in this case the sync method should fetch older history // // If the end value is zeroed, then the sync-method may determine the end free of choice, // e.g. sync till the chain head meets the wallclock time. This functionality is optional: // a fixed target to sync towards may be determined by picking up payloads through P2P gossip or other sources. // // The sync results should be returned back to the driver via the OnUnsafeL2Payload(ctx, payload) method. // The latest requested range should always take priority over previous requests. // There may be overlaps in requested ranges. // An error may be returned if the scheduling fails immediately, e.g. a context timeout. RequestL2Range(ctx context.Context, start, end eth.L2BlockRef) error }
type AttributesHandler ¶ added in v1.8.0
type AttributesHandler interface { // HasAttributes returns if there are any block attributes to process. // HasAttributes is for EngineQueue testing only, and can be removed when attribute processing is fully independent. HasAttributes() bool // SetAttributes overwrites the set of attributes. This may be nil, to clear what may be processed next. SetAttributes(attributes *derive.AttributesWithParent) // Proceed runs one attempt of processing attributes, if any. // Proceed returns io.EOF if there are no attributes to process. Proceed(ctx context.Context) error }
type CLSync ¶ added in v1.7.7
type CLSync interface {
LowestQueuedUnsafeBlock() eth.L2BlockRef
}
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"` // SequencerMaxSafeLag is the maximum number of L2 blocks for restricting the distance between L2 safe and unsafe. // Disabled if 0. SequencerMaxSafeLag uint64 `json:"sequencer_max_safe_lag"` }
type DerivationPipeline ¶
type DerivationPipeline interface { Reset() Step(ctx context.Context, pendingSafeHead eth.L2BlockRef) (*derive.AttributesWithParent, error) Origin() eth.L1BlockRef DerivationReady() bool ConfirmEngineReset() }
type Driver ¶
type Driver struct { *SyncDeriver // contains filtered or unexported fields }
func NewDriver ¶
func NewDriver( sys event.Registry, drain Drain, driverCfg *Config, cfg *rollup.Config, l2 L2Chain, l1 L1Chain, supervisor interop.InteropBackend, l1Blobs derive.L1BlobsFetcher, altSync AltSync, network Network, log log.Logger, metrics Metrics, sequencerStateListener sequencing.SequencerStateListener, safeHeadListener rollup.SafeHeadListener, syncCfg *sync.Config, sequencerConductor conductor.SequencerConductor, altDA AltDAIface, ) *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) ConductorEnabled ¶ added in v1.9.4
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) OverrideLeader ¶ added in v1.8.0
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) SequencerActive ¶ added in v1.1.2
func (*Driver) Start ¶
Start starts up the state loop. The loop will have been started iff err is not nil.
func (*Driver) StartSequencer ¶
func (*Driver) StopSequencer ¶
func (*Driver) SyncStatus ¶
SyncStatus blocks the driver event loop and captures the syncing status.
type EngineController ¶ added in v1.8.0
type Finalizer ¶ added in v1.7.7
type Finalizer interface { FinalizedL1() eth.L1BlockRef event.Deriver }
type L1Chain ¶
type L1Chain interface { derive.L1Fetcher L1BlockRefByLabel(context.Context, eth.BlockLabel) (eth.L1BlockRef, error) }
type L1FetcherMetrics ¶ added in v1.0.8
type MeteredL1Fetcher ¶ added in v1.0.8
type MeteredL1Fetcher struct {
// contains filtered or unexported fields
}
func NewMeteredL1Fetcher ¶ added in v1.0.8
func NewMeteredL1Fetcher(inner derive.L1Fetcher, metrics L1FetcherMetrics) *MeteredL1Fetcher
func (*MeteredL1Fetcher) FetchReceipts ¶ added in v1.0.8
func (*MeteredL1Fetcher) InfoAndTxsByHash ¶ added in v1.0.8
func (m *MeteredL1Fetcher) InfoAndTxsByHash(ctx context.Context, hash common.Hash) (eth.BlockInfo, types.Transactions, error)
func (*MeteredL1Fetcher) InfoByHash ¶ added in v1.0.8
func (*MeteredL1Fetcher) L1BlockRefByHash ¶ added in v1.0.8
func (m *MeteredL1Fetcher) L1BlockRefByHash(ctx context.Context, hash common.Hash) (eth.L1BlockRef, error)
func (*MeteredL1Fetcher) L1BlockRefByLabel ¶ added in v1.0.8
func (m *MeteredL1Fetcher) L1BlockRefByLabel(ctx context.Context, label eth.BlockLabel) (eth.L1BlockRef, error)
func (*MeteredL1Fetcher) L1BlockRefByNumber ¶ added in v1.0.8
func (m *MeteredL1Fetcher) L1BlockRefByNumber(ctx context.Context, num uint64) (eth.L1BlockRef, error)
type Metrics ¶
type Metrics interface { RecordPipelineReset() RecordPublishingError() RecordDerivationError() RecordReceivedUnsafePayload(payload *eth.ExecutionPayloadEnvelope) RecordL1Ref(name string, ref eth.L1BlockRef) RecordL2Ref(name string, ref eth.L2BlockRef) RecordChannelInputBytes(inputCompressedBytes int) RecordHeadChannelOpened() RecordChannelTimedOut() RecordFrame() RecordDerivedBatches(batchType string) RecordUnsafePayloadsBuffer(length uint64, memSize uint64, next eth.BlockID) SetDerivationIdle(idle bool) RecordL1ReorgDepth(d uint64) engine.Metrics L1FetcherMetrics event.Metrics sequencing.Metrics }
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.ExecutionPayloadEnvelope) error }
type ResetStepBackoffEvent ¶ added in v1.8.0
type ResetStepBackoffEvent struct { }
func (ResetStepBackoffEvent) String ¶ added in v1.8.0
func (ev ResetStepBackoffEvent) String() string
type SequencerStateListener ¶ added in v1.1.2
type StepAttemptEvent ¶ added in v1.8.0
type StepAttemptEvent struct{}
func (StepAttemptEvent) String ¶ added in v1.8.0
func (ev StepAttemptEvent) String() string
type StepDelayedReqEvent ¶ added in v1.8.0
func (StepDelayedReqEvent) String ¶ added in v1.8.0
func (ev StepDelayedReqEvent) String() string
type StepReqEvent ¶ added in v1.8.0
type StepReqEvent struct {
ResetBackoff bool
}
func (StepReqEvent) String ¶ added in v1.8.0
func (ev StepReqEvent) String() string
type StepSchedulingDeriver ¶ added in v1.8.0
type StepSchedulingDeriver struct {
// contains filtered or unexported fields
}
StepSchedulingDeriver is a deriver that emits StepEvent events. The deriver can be requested to schedule a step with a StepReqEvent.
It is then up to the caller to translate scheduling into StepAttemptEvent emissions, by waiting for NextStep or NextDelayedStep channels (nil if there is nothing to wait for, for channel-merging purposes).
Upon StepAttemptEvent the scheduler will then emit a StepEvent, while maintaining backoff state, to not spam steps.
Backoff can be reset by sending a request with StepReqEvent.ResetBackoff set to true, or by sending a ResetStepBackoffEvent.
func NewStepSchedulingDeriver ¶ added in v1.8.0
func NewStepSchedulingDeriver(log log.Logger) *StepSchedulingDeriver
func (*StepSchedulingDeriver) AttachEmitter ¶ added in v1.8.0
func (s *StepSchedulingDeriver) AttachEmitter(em event.Emitter)
func (*StepSchedulingDeriver) NextDelayedStep ¶ added in v1.8.0
func (s *StepSchedulingDeriver) NextDelayedStep() <-chan time.Time
NextDelayedStep is a temporary channel to await, and if triggered, the caller should emit a StepAttemptEvent to queue up a step while maintaining backoff. The returned channel may be nil, if there is no requested step with delay scheduled.
func (*StepSchedulingDeriver) NextStep ¶ added in v1.8.0
func (s *StepSchedulingDeriver) NextStep() <-chan struct{}
NextStep is a channel to await, and if triggered, the caller should emit a StepAttemptEvent to queue up a step while maintaining backoff.
type SyncDeriver ¶ added in v1.8.0
type SyncDeriver struct { // The derivation pipeline is reset whenever we reorg. // The derivation pipeline determines the new l2Safe. Derivation DerivationPipeline SafeHeadNotifs rollup.SafeHeadListener // notified when safe head is updated CLSync CLSync // The engine controller is used by the sequencer & Derivation components. // We will also use it for EL sync in a future PR. Engine EngineController // Sync Mod Config SyncCfg *sync.Config Config *rollup.Config L1 L1Chain L2 L2Chain Emitter event.Emitter Log log.Logger Ctx context.Context Drain func() error }
func (*SyncDeriver) AttachEmitter ¶ added in v1.8.0
func (s *SyncDeriver) AttachEmitter(em event.Emitter)
func (*SyncDeriver) SyncStep ¶ added in v1.8.0
func (s *SyncDeriver) SyncStep()
SyncStep performs the sequence of encapsulated syncing steps. Warning: this sequence will be broken apart as outlined in op-node derivers design doc.
type SyncStatus
deprecated
type SyncStatus = eth.SyncStatus
Deprecated: use eth.SyncStatus instead.
type SyncStatusTracker ¶ added in v1.8.0
type SyncStatusTracker interface { event.Deriver SyncStatus() *eth.SyncStatus L1Head() eth.L1BlockRef }