async

package
v1.19.10 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 15, 2026 License: MIT, MIT Imports: 7 Imported by: 3 modules, 4 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrPermanentPublish = errors.New("permanent publish failure")

ErrPermanentPublish marks a publish failure that no retry can fix. Producers wrap it around deterministic rejections only, as a strict allowlist: Topic.Publish also surfaces the caller's context error, so a publish that merely hit publishTimeout must stay retryable, and classifying that as permanent would silently disable retry altogether.

Functions

This section is empty.

Types

type AsyncGossiper

type AsyncGossiper interface {
	Gossip(payload *eth.ExecutionPayloadEnvelope)
	Clear()
	Stop()
	Start()
}

type Metrics

type Metrics interface {
	RecordPublishingError()
	RecordDroppedPublish()
	RecordPublishQueueLen(length int)
	RecordPublishDelay(duration time.Duration)
}

To avoid import cycles, we define a new Metrics interface here this interface is compatible with driver.Metrics

type Network

type Network interface {
	SignAndPublishL2Payload(ctx context.Context, envelope *eth.ExecutionPayloadEnvelope) error
	// GossipTimestampThreshold is the age past which peers reject a block
	// outright. Zero means unbounded, which is what a node with p2p disabled
	// reports; publishing is a no-op there anyway.
	GossipTimestampThreshold() time.Duration
}

To avoid import cycles, we define a new Network interface here this interface is compatible with driver.Network

type NoOpGossiper

type NoOpGossiper struct{}

NoOpGossiper is a no-op implementation of AsyncGossiper it serves as a placeholder for when the AsyncGossiper is not needed

func (NoOpGossiper) Clear

func (NoOpGossiper) Clear()

func (NoOpGossiper) Gossip

func (NoOpGossiper) Gossip(payload *eth.ExecutionPayloadEnvelope)

func (NoOpGossiper) Start

func (NoOpGossiper) Start()

func (NoOpGossiper) Stop

func (NoOpGossiper) Stop()

type SimpleAsyncGossiper

type SimpleAsyncGossiper struct {
	// contains filtered or unexported fields
}

SimpleAsyncGossiper publishes sealed blocks to peers off the sequencer's hot path, in seal order, on a dedicated goroutine.

The sequencer hands a block over only once it has inserted it, so every queued block is one this node has already adopted as its canonical head. A queued block can therefore be late, but it can never be one the sequencer has to take back — which is what makes it safe to queue and retry at all.

Gossip and Clear only take a mutex. Neither waits for the network.

func NewAsyncGossiper

func NewAsyncGossiper(ctx context.Context, net Network, log log.Logger, metrics Metrics) *SimpleAsyncGossiper

func (*SimpleAsyncGossiper) Clear

func (p *SimpleAsyncGossiper) Clear()

Clear drops every queued block. The sequencer calls it each time sequencing starts, since anything still queued was sealed under a previous stint and extends a chain it is no longer necessarily building on. It is not called on a reset, so blocks inserted before a reset but not yet published stay queued.

func (*SimpleAsyncGossiper) Gossip

func (p *SimpleAsyncGossiper) Gossip(payload *eth.ExecutionPayloadEnvelope)

Gossip queues a block for publication and returns. It does not wait for the network, nor for the publish goroutine.

func (*SimpleAsyncGossiper) Start

func (p *SimpleAsyncGossiper) Start()

Start starts the publish goroutine.

func (*SimpleAsyncGossiper) Stop

func (p *SimpleAsyncGossiper) Stop()

Stop stops the publish goroutine and waits for it to exit. It is safe to call on a gossiper that was never started, and on one whose loop has already exited because the parent context was cancelled.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL