Documentation
¶
Index ¶
- Variables
- type AsyncGossiper
- type BuildingState
- type DisabledSequencer
- func (ds DisabledSequencer) Active() bool
- func (ds DisabledSequencer) Close()
- func (ds DisabledSequencer) ConductorEnabled(ctx context.Context) bool
- func (ds DisabledSequencer) Init(ctx context.Context, active bool) error
- func (ds DisabledSequencer) OnEvent(ctx context.Context, ev event.Event) bool
- func (ds DisabledSequencer) OverrideLeader(ctx context.Context) error
- func (ds DisabledSequencer) RunAction()
- func (ds DisabledSequencer) RunLoop(ctx context.Context)
- func (ds DisabledSequencer) SetMaxSafeLag(ctx context.Context, v uint64) error
- func (ds DisabledSequencer) SetRecoverMode(mode bool)
- func (ds DisabledSequencer) Start(ctx context.Context, head common.Hash) error
- func (ds DisabledSequencer) Stop(ctx context.Context) (hash common.Hash, err error)
- type L1Blocks
- type L1OriginSelector
- func (los *L1OriginSelector) CurrentAndNextOrigin(ctx context.Context, l2Head eth.L2BlockRef) (eth.L1BlockRef, eth.L1BlockRef, error)
- func (los *L1OriginSelector) FindL1Origin(ctx context.Context, l2Head eth.L2BlockRef) (eth.L1BlockRef, error)
- func (los *L1OriginSelector) OnEvent(ctx context.Context, ev event.Event) bool
- func (los *L1OriginSelector) ResetOrigins()
- func (los *L1OriginSelector) SetRecoverMode(enabled bool)
- type L1OriginSelectorIface
- type Metrics
- type Sequencer
- func (s *Sequencer) Active() bool
- func (s *Sequencer) AttachEmitter(em event.Emitter)
- func (s *Sequencer) Building() BuildingState
- func (s *Sequencer) Close()
- func (s *Sequencer) ConductorEnabled(ctx context.Context) bool
- func (s *Sequencer) Init(ctx context.Context, active bool) error
- func (s *Sequencer) NextAction() (t time.Time, ok bool)
- func (s *Sequencer) OnEvent(ctx context.Context, ev event.Event) bool
- func (s *Sequencer) OverrideLeader(ctx context.Context) error
- func (s *Sequencer) RunAction()
- func (s *Sequencer) RunLoop(ctx context.Context)
- func (s *Sequencer) SetMaxSafeLag(ctx context.Context, v uint64) error
- func (s *Sequencer) SetRecoverMode(mode bool)
- func (s *Sequencer) Start(ctx context.Context, head common.Hash) error
- func (s *Sequencer) Stop(ctx context.Context) (common.Hash, error)
- type SequencerEngine
- type SequencerIface
- type SequencerStateListener
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidL1Origin = fmt.Errorf("origin-selector: currentL1Origin.Hash != l2Head.L1Origin.Hash") ErrNextL1OriginOrphaned = fmt.Errorf("origin-selector: nextL1Origin.ParentHash != currentL1Origin.Hash") ErrNextL1OriginRequired = fmt.Errorf("origin-selector: nextL1Origin not supplied but required to satisfy constraints") )
var ( ErrSequencerAlreadyStarted = errors.New("sequencer already running") ErrSequencerAlreadyStopped = errors.New("sequencer not running") )
var ErrSequencerNotEnabled = errors.New("sequencer is not enabled")
Functions ¶
This section is empty.
Types ¶
type AsyncGossiper ¶
type AsyncGossiper interface {
Gossip(payload *eth.ExecutionPayloadEnvelope)
Get() *eth.ExecutionPayloadEnvelope
Clear()
Stop()
Start()
}
type BuildingState ¶
type BuildingState struct {
Onto eth.L2BlockRef
Info eth.PayloadInfo
Started time.Time
// Set once known
Ref eth.L2BlockRef
}
type DisabledSequencer ¶
type DisabledSequencer struct{}
func (DisabledSequencer) Active ¶
func (ds DisabledSequencer) Active() bool
func (DisabledSequencer) Close ¶
func (ds DisabledSequencer) Close()
func (DisabledSequencer) ConductorEnabled ¶
func (ds DisabledSequencer) ConductorEnabled(ctx context.Context) bool
func (DisabledSequencer) Init ¶
func (ds DisabledSequencer) Init(ctx context.Context, active bool) error
func (DisabledSequencer) OverrideLeader ¶
func (ds DisabledSequencer) OverrideLeader(ctx context.Context) error
func (DisabledSequencer) RunAction ¶ added in v1.19.5
func (ds DisabledSequencer) RunAction()
func (DisabledSequencer) RunLoop ¶ added in v1.19.5
func (ds DisabledSequencer) RunLoop(ctx context.Context)
func (DisabledSequencer) SetMaxSafeLag ¶
func (ds DisabledSequencer) SetMaxSafeLag(ctx context.Context, v uint64) error
func (DisabledSequencer) SetRecoverMode ¶
func (ds DisabledSequencer) SetRecoverMode(mode bool)
type L1Blocks ¶
type L1Blocks interface {
derive.L1BlockRefByHashFetcher
derive.L1BlockRefByNumberFetcher
}
type L1OriginSelector ¶
type L1OriginSelector struct {
// contains filtered or unexported fields
}
func NewL1OriginSelector ¶
func (*L1OriginSelector) CurrentAndNextOrigin ¶
func (los *L1OriginSelector) CurrentAndNextOrigin(ctx context.Context, l2Head eth.L2BlockRef) (eth.L1BlockRef, eth.L1BlockRef, error)
CurrentAndNextOrigin returns the current cached values for the current L1 origin for the supplied l2Head, and its successor. It only performs a fetch to L1 if the cache is invalid. The cache can be updated asynchronously by other methods on L1OriginSelector. The returned currentOrigin should _always_ be non-empty, because it is populated from l2Head whose l1Origin is first specified in the rollup.Config.Genesis.L1 and progressed to non-empty values thereafter.
func (*L1OriginSelector) FindL1Origin ¶
func (los *L1OriginSelector) FindL1Origin(ctx context.Context, l2Head eth.L2BlockRef) (eth.L1BlockRef, error)
FindL1Origin determines what the L1 Origin for the next L2 Block should be. It wraps the FindL1OriginOfNextL2Block function and handles caching and network requests.
func (*L1OriginSelector) ResetOrigins ¶
func (los *L1OriginSelector) ResetOrigins()
func (*L1OriginSelector) SetRecoverMode ¶
func (los *L1OriginSelector) SetRecoverMode(enabled bool)
type L1OriginSelectorIface ¶
type L1OriginSelectorIface interface {
FindL1Origin(ctx context.Context, l2Head eth.L2BlockRef) (eth.L1BlockRef, error)
SetRecoverMode(bool)
}
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(driverCtx context.Context, log log.Logger, rollupCfg *rollup.Config, sealingDuration time.Duration, attributesBuilder derive.AttributesBuilder, l1OriginSelector L1OriginSelectorIface, listener SequencerStateListener, conductor conductor.SequencerConductor, asyncGossip AsyncGossiper, metrics Metrics, eng SequencerEngine, ) *Sequencer
func (*Sequencer) AttachEmitter ¶
func (*Sequencer) Building ¶ added in v1.19.5
func (s *Sequencer) Building() BuildingState
Building returns the block-building job the sequencer currently has in flight. The zero value means no job is in flight.
func (*Sequencer) OnEvent ¶
OnEvent implements event.Deriver. It never blocks and never mutates sequencer state: accepted events are appended to the inbox log and replayed in arrival order on the sequencer goroutine.
func (*Sequencer) RunAction ¶ added in v1.19.5
func (s *Sequencer) RunAction()
RunAction performs one sequencer action: it processes a payload left in the async-gossip buffer, seals the pending block-building job, or starts a new build. Engine interactions happen as direct synchronous calls, not events.
func (*Sequencer) RunLoop ¶ added in v1.19.5
RunLoop runs the sequencer scheduling loop: it replays ingested events and runs the next sequencer action when its scheduled time arrives, until ctx is canceled. Event ingestion and RPC start/stop interrupt the wait via the wake channel.
func (*Sequencer) SetMaxSafeLag ¶
func (*Sequencer) SetRecoverMode ¶
type SequencerEngine ¶ added in v1.19.5
type SequencerEngine interface {
// RequestForkchoiceUpdate requests the engine to emit a ForkchoiceUpdateEvent,
// for when no L2 head data is available yet.
RequestForkchoiceUpdate(ctx context.Context)
// StartBuild starts a block-building job, returning the payload info and build
// metadata. Errors: engine.ErrStaleBuild if the parent is no longer the unsafe
// head (a forkchoice update has been requested, so waiting for the next head
// update is the way forward), engine.ErrBuildInvalid if the engine rejected the
// attributes, otherwise a temporary, reset, or critical failure for which the
// matching event has been emitted.
StartBuild(ctx context.Context, attrs *derive.AttributesWithParent) (*engine.BuildStartResult, error)
// SealBuild retrieves a built payload via GetPayload, returning the sealed
// envelope and block ref. Emits no events. Errors wrap engine.ErrSealExpired
// (job timed out or is unknown; the same attributes may be rebuilt) or
// engine.ErrSealInvalid (payload contents rejected), or are
// engine.ErrStaleBuild when the sealed block no longer extends the unsafe head.
SealBuild(ctx context.Context, info eth.PayloadInfo, buildStarted time.Time) (*engine.SealResult, error)
// ProcessPayload inserts a payload via NewPayload, updates the unsafe head, and
// finalizes via forkchoice update, emitting UnsafeUpdateEvent on success.
// Errors: engine.ErrStaleBuild if the payload no longer extends the unsafe head
// and engine.ErrPayloadDenied if the SuperAuthority denied it, both emitting
// nothing; engine.ErrPayloadInvalid if the engine rejected the block; otherwise
// a temporary failure whose EngineTemporaryErrorEvent has been emitted.
ProcessPayload(ctx context.Context, envelope *eth.ExecutionPayloadEnvelope, ref eth.L2BlockRef, buildStarted time.Time) error
}
SequencerEngine provides direct-call methods for the sequencer to interact with the engine controller, bypassing the event system for latency-critical block production. The event system is still used for derivation.
Outcomes reach the caller as return values: none of these methods emit the build-lifecycle events their event-driven counterparts do (BuildStartedEvent, BuildSealedEvent, PayloadSuccessEvent, or the seal-error events). Two classes of event are still emitted, and callers must not treat either as their own recovery signal:
- state notifications other subsystems depend on (ForkchoiceUpdateEvent, UnsafeUpdateEvent);
- engine-internal recovery the caller cannot perform itself (BuildInvalidEvent, PayloadInvalidEvent), plus the generic EngineTemporaryErrorEvent / ResetEvent / CriticalErrorEvent signals that other subsystems act on.
type SequencerIface ¶
type SequencerIface interface {
event.Deriver
// RunAction performs one sequencer action: start, seal, or (re)process a
// block. Engine calls inside it use the sequencer's own lifetime context, so
// it takes none. Called from the sequencer goroutine, or directly by tests.
RunAction()
// RunLoop runs the sequencer scheduling loop, and blocks until ctx is canceled.
RunLoop(ctx context.Context)
Active() bool
Init(ctx context.Context, active bool) error
Start(ctx context.Context, head common.Hash) error
Stop(ctx context.Context) (hash common.Hash, err error)
SetMaxSafeLag(ctx context.Context, v uint64) error
OverrideLeader(ctx context.Context) error
ConductorEnabled(ctx context.Context) bool
SetRecoverMode(mode bool)
Close()
}