Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CLSync ¶
type CLSync struct {
// contains filtered or unexported fields
}
CLSync holds on to a queue of received unsafe payloads, and tries to apply them to the tip of the chain when requested to.
func (*CLSync) AddUnsafePayload ¶
func (eq *CLSync) AddUnsafePayload(envelope *eth.ExecutionPayloadEnvelope)
AddUnsafePayload schedules an execution payload to be processed, ahead of deriving it from L1.
func (*CLSync) LowestQueuedUnsafeBlock ¶
func (eq *CLSync) LowestQueuedUnsafeBlock() eth.L2BlockRef
LowestQueuedUnsafeBlock retrieves the first queued-up L2 unsafe payload, or a zeroed reference if there is none.
type Engine ¶
type Engine interface { derive.EngineState InsertUnsafePayload(ctx context.Context, payload *eth.ExecutionPayloadEnvelope, ref eth.L2BlockRef) error }
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) 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.