 Documentation
      ¶
      Documentation
      ¶
    
    
  
    
  
    Index ¶
- Variables
- type AltDAIface
- type AltSync
- type AttributesHandler
- 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) OnUnsafeL2Payload(ctx context.Context, payload *eth.ExecutionPayloadEnvelope)
- 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) SetRecoverMode(ctx context.Context, mode 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 Finalizer
- type L1Chain
- type L2Chain
- type Metrics
- type Network
- type SequencerStateListener
- type StepDeriver
- type StepEvent
- type StepSchedulingDeriver
- func (s *StepSchedulingDeriver) AttachEmitter(em event.Emitter)
- func (s *StepSchedulingDeriver) AttemptStep(ctx context.Context)
- func (s *StepSchedulingDeriver) NextDelayedStep() <-chan time.Time
- func (s *StepSchedulingDeriver) NextStep() <-chan struct{}
- func (s *StepSchedulingDeriver) OnEvent(ctx context.Context, ev event.Event) bool
- func (s *StepSchedulingDeriver) RequestStep(ctx context.Context, resetBackoff bool)
- func (s *StepSchedulingDeriver) ResetStepBackoff(ctx context.Context)
 
- type SyncDeriver
- func (s *SyncDeriver) AttachEmitter(em event.Emitter)
- func (s *SyncDeriver) OnELSyncStarted()
- func (s *SyncDeriver) OnEvent(ctx context.Context, ev event.Event) bool
- func (s *SyncDeriver) OnL1Finalized(ctx context.Context)
- func (s *SyncDeriver) OnL1Unsafe(ctx context.Context)
- func (s *SyncDeriver) OnUnsafeL2Payload(ctx context.Context, envelope *eth.ExecutionPayloadEnvelope)
- func (s *SyncDeriver) SyncStep()
 
- 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 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"`
	// RecoverMode forces the sequencer to select the next L1 Origin exactly, and create an empty block,
	// to be compatible with verifiers forcefully generating the same block while catching up the sequencing window timeout.
	RecoverMode bool `json:"recover_mode"`
}
    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 {
	StatusTracker SyncStatusTracker
	Finalizer     Finalizer
	SyncDeriver *SyncDeriver
	// contains filtered or unexported fields
}
    func NewDriver ¶
func NewDriver( sys event.Registry, drain Drain, driverCfg *Config, cfg *rollup.Config, l1ChainConfig *params.ChainConfig, depSet derive.DependencySet, l2 L2Chain, l1 L1Chain, 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, indexingMode bool, ) *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) OnUnsafeL2Payload ¶
func (s *Driver) OnUnsafeL2Payload(ctx context.Context, payload *eth.ExecutionPayloadEnvelope)
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) SetRecoverMode ¶ added in v1.13.0
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 Finalizer ¶ added in v1.7.7
type Finalizer interface {
	FinalizedL1() eth.L1BlockRef
	OnL1Finalized(x eth.L1BlockRef)
	event.Deriver
}
    type L1Chain ¶
type L1Chain interface {
	derive.L1Fetcher
	L1BlockRefByLabel(context.Context, eth.BlockLabel) (eth.L1BlockRef, error)
}
    type Metrics ¶
type Metrics interface {
	RecordPipelineReset()
	RecordPublishingError()
	RecordDerivationError()
	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)
	SetSequencerState(active bool)
	RecordL1ReorgDepth(d uint64)
	opnodemetrics.Metricer
	metered.L1FetcherMetrics
	event.Metrics
	sequencing.Metrics
}
    type Network ¶
type Network interface {
	// SignAndPublishL2Payload is called by the driver whenever there is a new payload to publish, synchronously with the driver main loop.
	SignAndPublishL2Payload(ctx context.Context, payload *eth.ExecutionPayloadEnvelope) error
}
    type SequencerStateListener ¶ added in v1.1.2
type StepDeriver ¶ added in v1.13.6
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) AttemptStep ¶ added in v1.13.6
func (s *StepSchedulingDeriver) AttemptStep(ctx context.Context)
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.
func (*StepSchedulingDeriver) RequestStep ¶ added in v1.13.6
func (s *StepSchedulingDeriver) RequestStep(ctx context.Context, resetBackoff bool)
func (*StepSchedulingDeriver) ResetStepBackoff ¶ added in v1.13.6
func (s *StepSchedulingDeriver) ResetStepBackoff(ctx context.Context)
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
	// The engine controller is used by the sequencer & Derivation components.
	// We will also use it for EL sync in a future PR.
	Engine *engine.EngineController
	// Sync Mod Config
	SyncCfg *sync.Config
	Config *rollup.Config
	L1 L1Chain
	// Track L1 view when new unsafe L1 block is observed
	L1Tracker *status.L1Tracker
	L2        L2Chain
	Emitter event.Emitter
	Log log.Logger
	Ctx context.Context
	// When in interop, and managed by an op-supervisor,
	// the node performs a reset based on the instructions of the op-supervisor.
	ManagedBySupervisor bool
	StepDeriver StepDeriver
}
    func (*SyncDeriver) AttachEmitter ¶ added in v1.8.0
func (s *SyncDeriver) AttachEmitter(em event.Emitter)
func (*SyncDeriver) OnELSyncStarted ¶ added in v1.13.6
func (s *SyncDeriver) OnELSyncStarted()
func (*SyncDeriver) OnL1Finalized ¶ added in v1.13.6
func (s *SyncDeriver) OnL1Finalized(ctx context.Context)
func (*SyncDeriver) OnL1Unsafe ¶ added in v1.13.6
func (s *SyncDeriver) OnL1Unsafe(ctx context.Context)
func (*SyncDeriver) OnUnsafeL2Payload ¶ added in v1.13.6
func (s *SyncDeriver) OnUnsafeL2Payload(ctx context.Context, envelope *eth.ExecutionPayloadEnvelope)
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 SyncStatusTracker ¶ added in v1.8.0
type SyncStatusTracker interface {
	event.Deriver
	SyncStatus() *eth.SyncStatus
	L1Head() eth.L1BlockRef
	OnL1Unsafe(x eth.L1BlockRef)
	OnL1Safe(x eth.L1BlockRef)
	OnL1Finalized(x eth.L1BlockRef)
}