Documentation
¶
Index ¶
- Variables
- func ForceEngineReset(ec ResetEngineControl, ...)
- func ValidEngineKind(value Kind) bool
- type AttributesForceResetter
- type BlockInsertionErrType
- type BuildCancelEvent
- type BuildInvalidEvent
- type BuildSealEvent
- type BuildSealedEvent
- type BuildStartEvent
- type BuildStartResult
- type BuildStartedEvent
- type CrossUpdateHandler
- type Engine
- type EngineController
- func (e *EngineController) AddUnsafePayload(ctx context.Context, envelope *eth.ExecutionPayloadEnvelope)
- func (e *EngineController) BackupUnsafeL2Head() eth.L2BlockRef
- func (e *EngineController) CancelBlock(ctx context.Context, id eth.PayloadInfo) error
- func (e *EngineController) CommitBlock(ctx context.Context, signed *opsigner.SignedExecutionPayloadEnvelope) error
- func (e *EngineController) Finalized() eth.L2BlockRef
- func (e *EngineController) FinalizedHead() eth.L2BlockRef
- func (e *EngineController) FollowSource(eSafeBlockRef, eLocalSafeRef, eFinalizedRef eth.L2BlockRef)
- func (e *EngineController) ForceReset(ctx context.Context, ...)
- func (e *EngineController) InsertUnsafePayload(ctx context.Context, envelope *eth.ExecutionPayloadEnvelope, ...) error
- func (e *EngineController) IsDenied(blockNumber uint64, payloadHash common.Hash) (bool, error)
- func (e *EngineController) IsEngineInitialELSyncing() bool
- func (e *EngineController) OnEvent(ctx context.Context, ev event.Event) bool
- func (e *EngineController) OpenBlock(ctx context.Context, parent eth.BlockID, attrs *eth.PayloadAttributes) (eth.PayloadInfo, error)
- func (e *EngineController) PeekUnsafePayload() (*eth.ExecutionPayloadEnvelope, eth.L2BlockRef)
- func (e *EngineController) PendingSafeL2Head() eth.L2BlockRef
- func (e *EngineController) ProcessPayload(ctx context.Context, envelope *eth.ExecutionPayloadEnvelope, ...) error
- func (e *EngineController) PromoteFinalized(ctx context.Context, ref eth.L2BlockRef)
- func (e *EngineController) PromoteSafe(ctx context.Context, ref eth.L2BlockRef, source eth.L1BlockRef)
- func (e *EngineController) RequestForkchoiceUpdate(ctx context.Context)
- func (e *EngineController) RequestPendingSafeUpdate(ctx context.Context)
- func (e *EngineController) SafeL2Head() eth.L2BlockRef
- func (e *EngineController) SealBlock(ctx context.Context, id eth.PayloadInfo) (*eth.ExecutionPayloadEnvelope, error)
- func (e *EngineController) SealBuild(ctx context.Context, info eth.PayloadInfo, buildStarted time.Time) (*SealResult, error)
- func (e *EngineController) SetAttributesResetter(resetter AttributesForceResetter)
- func (e *EngineController) SetBackupUnsafeL2Head(r eth.L2BlockRef, triggerReorg bool)
- func (e *EngineController) SetCrossUpdateHandler(handler CrossUpdateHandler)
- func (e *EngineController) SetDeprecatedSafeHead(r eth.L2BlockRef)deprecated
- func (e *EngineController) SetFinalizedHead(r eth.L2BlockRef)
- func (e *EngineController) SetLocalSafeHead(r eth.L2BlockRef)
- func (e *EngineController) SetOriginSelectorResetter(resetter OriginSelectorForceResetter)
- func (e *EngineController) SetPendingSafeL2Head(r eth.L2BlockRef)
- func (e *EngineController) SetPipelineResetter(resetter PipelineForceResetter)
- func (e *EngineController) SetUnsafeHead(r eth.L2BlockRef)
- func (e *EngineController) StartBuild(ctx context.Context, attrs *derive.AttributesWithParent) (*BuildStartResult, error)
- func (e *EngineController) TryBackupUnsafeReorg(ctx context.Context) (bool, error)
- func (e *EngineController) TryInitialResetEngineForSequencer(ctx context.Context)
- func (e *EngineController) TryUpdateEngine(ctx context.Context)
- func (e *EngineController) TryUpdateLocalSafe(ctx context.Context, ref eth.L2BlockRef, concluding bool, ...)
- func (e *EngineController) TryUpdatePendingSafe(ctx context.Context, ref eth.L2BlockRef, concluding bool, ...)
- func (e *EngineController) UnsafeL2Head() eth.L2BlockRef
- type EngineResetConfirmedEvent
- type ExecEngine
- type FinalizedUpdateEvent
- type ForkchoiceUpdateEvent
- type ForkchoiceUpdateInitEvent
- type InteropReplacedBlockEvent
- type InvalidPayloadAttributesEvent
- type Kind
- type LocalSafeUpdateEvent
- type Metrics
- type OriginSelectorForceResetter
- type PayloadInvalidEvent
- type PayloadProcessEvent
- type PayloadSealExpiredErrorEvent
- type PayloadSealInvalidEvent
- type PayloadSuccessEvent
- type PayloadsQueue
- func (pq *PayloadsQueue) DropInapplicableUnsafePayloads(event ForkchoiceUpdateEvent)
- func (upq *PayloadsQueue) Len() int
- func (upq *PayloadsQueue) MemSize() uint64
- func (upq *PayloadsQueue) Peek() *eth.ExecutionPayloadEnvelope
- func (upq *PayloadsQueue) Pop() *eth.ExecutionPayloadEnvelope
- func (upq *PayloadsQueue) Push(e *eth.ExecutionPayloadEnvelope) error
- type PendingSafeUpdateEvent
- type PipelineForceResetter
- type ResetEngineControl
- type ResetEngineRequestEvent
- type RollupAPI
- type SafeDerivedEvent
- type SealResult
- type SyncDeriver
- type UnsafeUpdateEvent
Constants ¶
This section is empty.
Variables ¶
var ( // ErrPayloadDenied is returned when a payload is denied by the SuperAuthority denylist. ErrPayloadDenied = errors.New("payload denied by SuperAuthority") // ErrPayloadInvalid is returned when a payload's execution is invalid. ErrPayloadInvalid = errors.New("payload execution invalid") )
var ErrBuildInvalid = errors.New("invalid block-building attributes")
ErrBuildInvalid is returned by StartBuild when the engine rejects the payload attributes. It is not a temporary failure: the caller must start a new build rather than retry the same one.
Unlike the seal errors, the engine keeps emitting BuildInvalidEvent on both paths, because onBuildInvalid performs engine-internal recovery that a direct caller cannot do for itself (exiting on an invalid deposits-only block, reverting the pending-safe head, restoring the backup unsafe head). Its downstream InvalidPayloadAttributesEvent is therefore also emitted for sequencer-originated builds; recovery stays single-signal because the only consumer that acted on it for those builds is the sequencer, which drops the handler when it moves to these direct calls.
var ErrEngineSyncing = errors.New("engine is syncing")
var ErrSealExpired = errors.New("payload seal job expired")
ErrSealExpired is returned when a payload cannot be sealed because the block-building job timed out, is unknown to the engine, or was otherwise invalidated. The same attributes may be re-attempted with a new job.
var ErrSealInvalid = errors.New("sealed payload is invalid")
ErrSealInvalid is returned when the sealed payload contents are invalid. The build should be restarted with fresh attributes.
var ErrStaleBuild = errors.New("stale block-building job, parent is not the unsafe head")
ErrStaleBuild is returned by the direct-call build methods when the job no longer extends the current unsafe head. The caller should wait for the next forkchoice update (already requested) and re-attempt on the new head.
var Kinds = []Kind{ Geth, Reth, Erigon, }
var ReplaceBlockSource = eth.L1BlockRef{ Hash: common.HexToHash("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"), Number: ^uint64(0), ParentHash: common.Hash{}, Time: 0, }
ReplaceBlockSource is a magic value for the "Source" attribute, used when a L2 block is a replacement of an invalidated block. After the replacement has been processed, a reset is performed to derive the next L2 blocks.
Functions ¶
func ForceEngineReset ¶
func ForceEngineReset(ec ResetEngineControl, localUnsafe, localSafe, crossSafe, finalized eth.L2BlockRef)
func ValidEngineKind ¶
Types ¶
type AttributesForceResetter ¶
type AttributesForceResetter interface {
ForceReset()
}
type BlockInsertionErrType ¶
type BlockInsertionErrType uint
const ( // BlockInsertOK indicates that the payload was successfully executed and appended to the canonical chain. BlockInsertOK BlockInsertionErrType = iota // BlockInsertTemporaryErr indicates that the insertion failed but may succeed at a later time without changes to the payload. BlockInsertTemporaryErr // BlockInsertPrestateErr indicates that the pre-state to insert the payload could not be prepared, e.g. due to missing chain data. BlockInsertPrestateErr // BlockInsertPayloadErr indicates that the payload was invalid and cannot become canonical. BlockInsertPayloadErr )
type BuildCancelEvent ¶
type BuildCancelEvent struct {
Info eth.PayloadInfo
Force bool
}
func (BuildCancelEvent) String ¶
func (ev BuildCancelEvent) String() string
type BuildInvalidEvent ¶
type BuildInvalidEvent struct {
Attributes *derive.AttributesWithParent
Err error
}
BuildInvalidEvent is an internal engine event, to post-process upon invalid attributes. Not for temporary processing problems.
func (BuildInvalidEvent) String ¶
func (ev BuildInvalidEvent) String() string
type BuildSealEvent ¶
type BuildSealEvent struct {
Info eth.PayloadInfo
BuildStarted time.Time
// if payload should be promoted to safe (must also be pending safe, see DerivedFrom)
Concluding bool
// payload is promoted to pending-safe if non-zero
DerivedFrom eth.L1BlockRef
}
func (BuildSealEvent) String ¶
func (ev BuildSealEvent) String() string
type BuildSealedEvent ¶
type BuildSealedEvent struct {
// if payload should be promoted to (local) safe (must also be pending safe, see DerivedFrom)
Concluding bool
// payload is promoted to pending-safe if non-zero
DerivedFrom eth.L1BlockRef
BuildStarted time.Time
Info eth.PayloadInfo
Envelope *eth.ExecutionPayloadEnvelope
Ref eth.L2BlockRef
}
BuildSealedEvent is emitted by the engine when a payload finished building, but is not locally inserted as canonical block yet
func (BuildSealedEvent) String ¶
func (ev BuildSealedEvent) String() string
type BuildStartEvent ¶
type BuildStartEvent struct {
Attributes *derive.AttributesWithParent
}
func (BuildStartEvent) String ¶
func (ev BuildStartEvent) String() string
type BuildStartResult ¶ added in v1.19.5
type BuildStartResult struct {
Info eth.PayloadInfo
BuildStarted time.Time
Parent eth.L2BlockRef
}
BuildStartResult contains the result of starting a block-building job.
type BuildStartedEvent ¶
type BuildStartedEvent struct {
Info eth.PayloadInfo
BuildStarted time.Time
Parent eth.L2BlockRef
// if payload should be promoted to (local) safe (must also be pending safe, see DerivedFrom)
Concluding bool
// payload is promoted to pending-safe if non-zero
DerivedFrom eth.L1BlockRef
}
func (BuildStartedEvent) String ¶
func (ev BuildStartedEvent) String() string
type CrossUpdateHandler ¶
type CrossUpdateHandler interface {
OnCrossSafeUpdate(ctx context.Context, crossSafe eth.L2BlockRef, localSafe eth.L2BlockRef)
}
CrossUpdateHandler handles cross-safe L2 head changes. It is optional: callers that don't track cross-chain safety leave it unset, so consumers must nil-check before invoking it.
type Engine ¶
type Engine interface {
ExecEngine
derive.L2Source
}
type EngineController ¶
type EngineController struct {
// Used at EL-sync completion to read/clear the safedb.
// EngineController is first initialized and used to initialize SyncDeriver.
// Embed SyncDeriver into EngineController after initializing SyncDeriver
SyncDeriver SyncDeriver
// contains filtered or unexported fields
}
func NewEngineController ¶
func (*EngineController) AddUnsafePayload ¶
func (e *EngineController) AddUnsafePayload(ctx context.Context, envelope *eth.ExecutionPayloadEnvelope)
AddUnsafePayload schedules an execution payload to be processed, ahead of deriving it from L1.
func (*EngineController) BackupUnsafeL2Head ¶
func (e *EngineController) BackupUnsafeL2Head() eth.L2BlockRef
func (*EngineController) CancelBlock ¶
func (e *EngineController) CancelBlock(ctx context.Context, id eth.PayloadInfo) error
func (*EngineController) CommitBlock ¶
func (e *EngineController) CommitBlock(ctx context.Context, signed *opsigner.SignedExecutionPayloadEnvelope) error
func (*EngineController) Finalized ¶
func (e *EngineController) Finalized() eth.L2BlockRef
func (*EngineController) FinalizedHead ¶
func (e *EngineController) FinalizedHead() eth.L2BlockRef
FinalizedHead returns the finalized L2 head, bounded by local-finalized (the SuperAuthority can delay finalization but cannot finalize a block the node hasn't locally finalized). superAuthorityFinalizedHead caches the last successful resolution and is trusted without re-validation — finalized blocks cannot reorg.
func (*EngineController) FollowSource ¶
func (e *EngineController) FollowSource(eSafeBlockRef, eLocalSafeRef, eFinalizedRef eth.L2BlockRef)
func (*EngineController) ForceReset ¶
func (e *EngineController) ForceReset(ctx context.Context, localUnsafe, localSafe, crossSafe, finalized eth.L2BlockRef)
ForceReset performs a forced reset to the specified block references, acquiring lock
func (*EngineController) InsertUnsafePayload ¶
func (e *EngineController) InsertUnsafePayload(ctx context.Context, envelope *eth.ExecutionPayloadEnvelope, ref eth.L2BlockRef) error
func (*EngineController) IsDenied ¶ added in v1.19.5
IsDenied reports whether the payload is on the SuperAuthority deny-list; false when no SuperAuthority is registered.
func (*EngineController) IsEngineInitialELSyncing ¶
func (e *EngineController) IsEngineInitialELSyncing() bool
func (*EngineController) OpenBlock ¶
func (e *EngineController) OpenBlock(ctx context.Context, parent eth.BlockID, attrs *eth.PayloadAttributes) (eth.PayloadInfo, error)
func (*EngineController) PeekUnsafePayload ¶
func (e *EngineController) PeekUnsafePayload() (*eth.ExecutionPayloadEnvelope, eth.L2BlockRef)
func (*EngineController) PendingSafeL2Head ¶
func (e *EngineController) PendingSafeL2Head() eth.L2BlockRef
func (*EngineController) ProcessPayload ¶ added in v1.19.5
func (e *EngineController) ProcessPayload(ctx context.Context, envelope *eth.ExecutionPayloadEnvelope, ref eth.L2BlockRef, buildStarted time.Time) error
ProcessPayload inserts a payload via NewPayload, updates unsafe head, and finalizes via FCU. Acquires e.mu. Combines processNewPayload and finalizePayload for the direct-call path. Emits UnsafeUpdateEvent on success. On error, emits appropriate error events before returning. Returns ErrStaleBuild without inserting when the payload no longer extends the unsafe head. A nil return means the payload was inserted (NewPayload valid) and the unsafe head updated; the concluding forkchoice update may still have failed transiently — it is logged and retried implicitly, since every subsequent build-start and engine update carries the full forkchoice state. Does NOT emit PayloadSuccessEvent.
func (*EngineController) PromoteFinalized ¶
func (e *EngineController) PromoteFinalized(ctx context.Context, ref eth.L2BlockRef)
func (*EngineController) PromoteSafe ¶
func (e *EngineController) PromoteSafe(ctx context.Context, ref eth.L2BlockRef, source eth.L1BlockRef)
PromoteSafe promotes the given ref to cross-safe head and emits SafeDerivedEvent. It updates the forkchoice state but does NOT send FCU to the engine. The FCU is deferred to L1 origin boundaries on the consolidation path. Callers that need immediate FCU (e.g. FollowSource, supervisor) will have it sent by a subsequent tryUpdateEngine call (e.g. from promoteFinalized or the next SyncStep).
func (*EngineController) RequestForkchoiceUpdate ¶
func (e *EngineController) RequestForkchoiceUpdate(ctx context.Context)
func (*EngineController) RequestPendingSafeUpdate ¶
func (e *EngineController) RequestPendingSafeUpdate(ctx context.Context)
func (*EngineController) SafeL2Head ¶
func (e *EngineController) SafeL2Head() eth.L2BlockRef
SafeL2Head returns the safe L2 head. With a SuperAuthority registered, the result is bounded by local-safe and validated against the EL where applicable. On a transient verifier read failure or any reorg signal, the cross-safe fallback is used.
func (*EngineController) SealBlock ¶
func (e *EngineController) SealBlock(ctx context.Context, id eth.PayloadInfo) (*eth.ExecutionPayloadEnvelope, error)
func (*EngineController) SealBuild ¶ added in v1.19.5
func (e *EngineController) SealBuild(ctx context.Context, info eth.PayloadInfo, buildStarted time.Time) (*SealResult, error)
SealBuild retrieves a built payload via GetPayload directly, bypassing the event system. Acquires e.mu. Returns the sealed envelope and block ref. Emits no events on error: the error wraps ErrSealExpired or ErrSealInvalid, or is ErrStaleBuild when the sealed block no longer extends the unsafe head. Does NOT emit BuildSealedEvent.
func (*EngineController) SetAttributesResetter ¶
func (e *EngineController) SetAttributesResetter(resetter AttributesForceResetter)
SetAttributesResetter sets the attributes component that needs force reset notifications
func (*EngineController) SetBackupUnsafeL2Head ¶
func (e *EngineController) SetBackupUnsafeL2Head(r eth.L2BlockRef, triggerReorg bool)
SetBackupUnsafeL2Head implements LocalEngineControl.
func (*EngineController) SetCrossUpdateHandler ¶
func (e *EngineController) SetCrossUpdateHandler(handler CrossUpdateHandler)
func (*EngineController) SetDeprecatedSafeHead
deprecated
added in
v1.17.0
func (e *EngineController) SetDeprecatedSafeHead(r eth.L2BlockRef)
SetDeprecatedSafeHead sets the cross-safe head.
Deprecated: This is only used by supervisor pathways.
func (*EngineController) SetFinalizedHead ¶
func (e *EngineController) SetFinalizedHead(r eth.L2BlockRef)
SetFinalizedHead implements LocalEngineControl.
func (*EngineController) SetLocalSafeHead ¶
func (e *EngineController) SetLocalSafeHead(r eth.L2BlockRef)
SetLocalSafeHead sets the local-safe head.
func (*EngineController) SetOriginSelectorResetter ¶
func (e *EngineController) SetOriginSelectorResetter(resetter OriginSelectorForceResetter)
SetOriginSelectorResetter sets the origin selector component that needs force reset notifications
func (*EngineController) SetPendingSafeL2Head ¶
func (e *EngineController) SetPendingSafeL2Head(r eth.L2BlockRef)
SetPendingSafeL2Head implements LocalEngineControl.
func (*EngineController) SetPipelineResetter ¶
func (e *EngineController) SetPipelineResetter(resetter PipelineForceResetter)
SetPipelineResetter sets the pipeline component that needs force reset notifications
func (*EngineController) SetUnsafeHead ¶
func (e *EngineController) SetUnsafeHead(r eth.L2BlockRef)
SetUnsafeHead sets the local-unsafe head.
func (*EngineController) StartBuild ¶ added in v1.19.5
func (e *EngineController) StartBuild(ctx context.Context, attrs *derive.AttributesWithParent) (*BuildStartResult, error)
StartBuild starts a block-building job directly, bypassing the event system. Acquires e.mu. Returns the build result or an error. Emits ForkchoiceUpdateEvent for other listeners. On error, emits appropriate error events before returning; a stale parent yields ErrStaleBuild after a forkchoice update has been requested. Does NOT emit BuildStartedEvent.
func (*EngineController) TryBackupUnsafeReorg ¶
func (e *EngineController) TryBackupUnsafeReorg(ctx context.Context) (bool, error)
func (*EngineController) TryInitialResetEngineForSequencer ¶
func (e *EngineController) TryInitialResetEngineForSequencer(ctx context.Context)
TryInitialResetEngineForSequencer resets engine controller with the info from FindL2Heads and only propagates ForkchoiceUpdateEvent info to the sequencer to trigger sequencer block building, but not propagating ForkchoiceUpdateEvent to other event Deriver avoiding side effects
func (*EngineController) TryUpdateEngine ¶
func (e *EngineController) TryUpdateEngine(ctx context.Context)
func (*EngineController) TryUpdateLocalSafe ¶
func (e *EngineController) TryUpdateLocalSafe(ctx context.Context, ref eth.L2BlockRef, concluding bool, source eth.L1BlockRef)
TryUpdateLocalSafe updates the local safe head if the new reference is newer and concluding, acquiring lock
func (*EngineController) TryUpdatePendingSafe ¶
func (e *EngineController) TryUpdatePendingSafe(ctx context.Context, ref eth.L2BlockRef, concluding bool, source eth.L1BlockRef)
TryUpdatePendingSafe updates the pending safe head if the new reference is newer, acquiring lock
func (*EngineController) UnsafeL2Head ¶
func (e *EngineController) UnsafeL2Head() eth.L2BlockRef
type EngineResetConfirmedEvent ¶
type EngineResetConfirmedEvent struct {
LocalUnsafe eth.L2BlockRef
LocalSafe eth.L2BlockRef
CrossSafe eth.L2BlockRef
Finalized eth.L2BlockRef
}
func (EngineResetConfirmedEvent) String ¶
func (ev EngineResetConfirmedEvent) String() string
type ExecEngine ¶
type ExecEngine interface {
GetPayload(ctx context.Context, payloadInfo eth.PayloadInfo) (*eth.ExecutionPayloadEnvelope, error)
ForkchoiceUpdate(ctx context.Context, state *eth.ForkchoiceState, attr *eth.PayloadAttributes) (*eth.ForkchoiceUpdatedResult, error)
NewPayload(ctx context.Context, payload *eth.ExecutionPayload, parentBeaconBlockRoot *common.Hash) (*eth.PayloadStatusV1, error)
L2BlockRefByLabel(ctx context.Context, label eth.BlockLabel) (eth.L2BlockRef, error)
L2BlockRefByHash(ctx context.Context, hash common.Hash) (eth.L2BlockRef, error)
L2BlockRefByNumber(ctx context.Context, num uint64) (eth.L2BlockRef, error)
}
type FinalizedUpdateEvent ¶
type FinalizedUpdateEvent struct {
Ref eth.L2BlockRef
}
FinalizedUpdateEvent signals that a block has been marked as finalized.
func (FinalizedUpdateEvent) String ¶
func (ev FinalizedUpdateEvent) String() string
type ForkchoiceUpdateEvent ¶
type ForkchoiceUpdateEvent struct {
UnsafeL2Head, SafeL2Head, FinalizedL2Head eth.L2BlockRef
}
func (ForkchoiceUpdateEvent) String ¶
func (ev ForkchoiceUpdateEvent) String() string
type ForkchoiceUpdateInitEvent ¶
type ForkchoiceUpdateInitEvent struct {
UnsafeL2Head, SafeL2Head, FinalizedL2Head eth.L2BlockRef
}
ForkchoiceUpdateInitEvent is only for the sequencer to be signaled during initialization
func (ForkchoiceUpdateInitEvent) String ¶
func (ev ForkchoiceUpdateInitEvent) String() string
type InteropReplacedBlockEvent ¶
type InteropReplacedBlockEvent struct {
Ref eth.BlockRef
Envelope *eth.ExecutionPayloadEnvelope
}
InteropReplacedBlockEvent is emitted when a replacement is done.
func (InteropReplacedBlockEvent) String ¶
func (ev InteropReplacedBlockEvent) String() string
type InvalidPayloadAttributesEvent ¶
type InvalidPayloadAttributesEvent struct {
Attributes *derive.AttributesWithParent
Err error
}
InvalidPayloadAttributesEvent is a signal to external derivers that the attributes were invalid.
func (InvalidPayloadAttributesEvent) String ¶
func (ev InvalidPayloadAttributesEvent) String() string
type Kind ¶
type Kind string
Kind identifies the engine client's kind, used to control the behavior of optimism in different engine clients.
func (Kind) SupportsPostFinalizationELSync ¶
type LocalSafeUpdateEvent ¶
type LocalSafeUpdateEvent struct {
Ref eth.L2BlockRef
Source eth.L1BlockRef
}
LocalSafeUpdateEvent signals that a block is now considered to be local-safe.
func (LocalSafeUpdateEvent) String ¶
func (ev LocalSafeUpdateEvent) String() string
type Metrics ¶
type Metrics interface {
RecordUnsafePayloadsBuffer(length uint64, memSize uint64, next eth.BlockID)
}
Metrics interface for CLSync functionality
type OriginSelectorForceResetter ¶
type OriginSelectorForceResetter interface {
ResetOrigins()
}
type PayloadInvalidEvent ¶
type PayloadInvalidEvent struct {
Envelope *eth.ExecutionPayloadEnvelope
Err error
}
func (PayloadInvalidEvent) String ¶
func (ev PayloadInvalidEvent) String() string
type PayloadProcessEvent ¶
type PayloadProcessEvent struct {
// if payload should be promoted to (local) safe (must also be pending safe, see DerivedFrom)
Concluding bool
// payload is promoted to pending-safe if non-zero
DerivedFrom eth.L1BlockRef
BuildStarted time.Time
Envelope *eth.ExecutionPayloadEnvelope
Ref eth.L2BlockRef
}
func (PayloadProcessEvent) String ¶
func (ev PayloadProcessEvent) String() string
type PayloadSealExpiredErrorEvent ¶
type PayloadSealExpiredErrorEvent struct {
Info eth.PayloadInfo
Err error
Concluding bool
DerivedFrom eth.L1BlockRef
}
PayloadSealExpiredErrorEvent identifies a form of failed payload-sealing that is not coupled to the attributes themselves, but rather the build-job process. The user should re-attempt by starting a new build process. The payload-sealing job should not be re-attempted, as it most likely expired, timed out, or referenced an otherwise invalidated block-building job identifier.
func (PayloadSealExpiredErrorEvent) String ¶
func (ev PayloadSealExpiredErrorEvent) String() string
type PayloadSealInvalidEvent ¶
type PayloadSealInvalidEvent struct {
Info eth.PayloadInfo
Err error
Concluding bool
DerivedFrom eth.L1BlockRef
}
PayloadSealInvalidEvent identifies a permanent in-consensus problem with the payload sealing.
func (PayloadSealInvalidEvent) String ¶
func (ev PayloadSealInvalidEvent) String() string
type PayloadSuccessEvent ¶
type PayloadSuccessEvent struct {
// if payload should be promoted to (local) safe (must also be pending safe, see DerivedFrom)
Concluding bool
// payload is promoted to pending-safe if non-zero
DerivedFrom eth.L1BlockRef
BuildStarted time.Time
InsertStarted time.Time
Envelope *eth.ExecutionPayloadEnvelope
Ref eth.L2BlockRef
}
func (PayloadSuccessEvent) String ¶
func (ev PayloadSuccessEvent) String() string
type PayloadsQueue ¶
type PayloadsQueue struct {
MaxSize uint64
SizeFn func(p *eth.ExecutionPayloadEnvelope) uint64
// contains filtered or unexported fields
}
PayloadsQueue buffers payloads by block number. PayloadsQueue is not safe to use concurrently. PayloadsQueue exposes typed Push/Peek/Pop methods to use the queue, without the need to use heap.Push/heap.Pop as caller. PayloadsQueue maintains a MaxSize by counting and tracking sizes of added eth.ExecutionPayload entries. When the size grows too large, the first (lowest block-number) payload is removed from the queue. PayloadsQueue allows entries with same block number, but does not allow duplicate blocks
func NewPayloadsQueue ¶
func NewPayloadsQueue(log log.Logger, maxSize uint64, sizeFn func(p *eth.ExecutionPayloadEnvelope) uint64) *PayloadsQueue
func (*PayloadsQueue) DropInapplicableUnsafePayloads ¶
func (pq *PayloadsQueue) DropInapplicableUnsafePayloads(event ForkchoiceUpdateEvent)
func (*PayloadsQueue) Len ¶
func (upq *PayloadsQueue) Len() int
func (*PayloadsQueue) MemSize ¶
func (upq *PayloadsQueue) MemSize() uint64
func (*PayloadsQueue) Peek ¶
func (upq *PayloadsQueue) Peek() *eth.ExecutionPayloadEnvelope
Peek retrieves the payload with the lowest block number from the queue in O(1), or nil if the queue is empty.
func (*PayloadsQueue) Pop ¶
func (upq *PayloadsQueue) Pop() *eth.ExecutionPayloadEnvelope
Pop removes the payload with the lowest block number from the queue in O(log(N)), and may return nil if the queue is empty.
func (*PayloadsQueue) Push ¶
func (upq *PayloadsQueue) Push(e *eth.ExecutionPayloadEnvelope) error
Push adds the payload to the queue, in O(log(N)).
Don't DoS ourselves by buffering too many unsafe payloads. If the queue size after pushing exceed the allowed memory, then pop payloads until memory is not exceeding anymore.
We prefer higher block numbers over lower block numbers, since lower block numbers are more likely to be conflicts and/or read from L1 sooner. The higher payload block numbers can be preserved, and once L1 contents meets these, they can all be processed in order.
type PendingSafeUpdateEvent ¶
type PendingSafeUpdateEvent struct {
PendingSafe eth.L2BlockRef
Unsafe eth.L2BlockRef // tip, added to the signal, to determine if there are existing blocks to consolidate
}
func (PendingSafeUpdateEvent) String ¶
func (ev PendingSafeUpdateEvent) String() string
type PipelineForceResetter ¶
type PipelineForceResetter interface {
ResetPipeline()
}
type ResetEngineControl ¶
type ResetEngineControl interface {
SetUnsafeHead(eth.L2BlockRef)
SetLocalSafeHead(ref eth.L2BlockRef)
SetDeprecatedSafeHead(eth.L2BlockRef)
SetFinalizedHead(eth.L2BlockRef)
SetBackupUnsafeL2Head(block eth.L2BlockRef, triggerReorg bool)
SetPendingSafeL2Head(eth.L2BlockRef)
}
type ResetEngineRequestEvent ¶
type ResetEngineRequestEvent struct{}
ResetEngineRequestEvent requests the EngineController to walk the L2 chain backwards until it finds a plausible unsafe head, and find an L2 safe block that is guaranteed to still be from the L1 chain. This event is not used in interop.
func (ResetEngineRequestEvent) String ¶
func (ev ResetEngineRequestEvent) String() string
type RollupAPI ¶
RollupAPI is the API we serve as rollup-node to interact with the execution engine and forkchoice state.
type SafeDerivedEvent ¶
type SafeDerivedEvent struct {
Safe eth.L2BlockRef
Source eth.L1BlockRef
}
SafeDerivedEvent signals that a block was determined to be safe, and derived from the given L1 block. This is signaled upon procedural call of PromoteSafe method
func (SafeDerivedEvent) String ¶
func (ev SafeDerivedEvent) String() string
type SealResult ¶ added in v1.19.5
type SealResult struct {
Envelope *eth.ExecutionPayloadEnvelope
Ref eth.L2BlockRef
}
SealResult contains the result of sealing a block-building job.
type SyncDeriver ¶
type SyncDeriver interface {
// ResetSafeDB removes safedb entries at or above ref (a zero ref clears it entirely).
// Called at EL-sync completion to trim a safedb whose tip isn't part of the synced chain.
ResetSafeDB(ref eth.L2BlockRef)
// SafeDBTip returns the L2 safe head at the safedb tip, reporting ok=false when the
// safedb is disabled or empty.
SafeDBTip(ctx context.Context) (l2 eth.BlockID, ok bool, err error)
// SafeDBHeadAtOrAboveL2 returns the L2 safe head the safedb recorded at the first L1 source
// whose safe head reached at least l2Num, reporting ok=false when there's no such entry.
SafeDBHeadAtOrAboveL2(ctx context.Context, l2Num uint64) (l2 eth.BlockID, ok bool, err error)
}
type UnsafeUpdateEvent ¶
type UnsafeUpdateEvent struct {
Ref eth.L2BlockRef
}
UnsafeUpdateEvent signals that the given block is now considered safe. This is pre-forkchoice update; the change may not be reflected yet in the EL.
func (UnsafeUpdateEvent) String ¶
func (ev UnsafeUpdateEvent) String() string