Documentation
¶
Index ¶
- Constants
- Variables
- type BlockOptions
- type Broadcaster
- type DAHeightEvent
- type DASubmitterFailureReason
- type EventSource
- type Metrics
- type MockBroadcaster
- type MockBroadcaster_Expecter
- type MockBroadcaster_Store_Call
- func (_c *MockBroadcaster_Store_Call[H]) Return(store header.Store[H]) *MockBroadcaster_Store_Call[H]
- func (_c *MockBroadcaster_Store_Call[H]) Run(run func()) *MockBroadcaster_Store_Call[H]
- func (_c *MockBroadcaster_Store_Call[H]) RunAndReturn(run func() header.Store[H]) *MockBroadcaster_Store_Call[H]
- type MockBroadcaster_WriteToStoreAndBroadcast_Call
- func (_c *MockBroadcaster_WriteToStoreAndBroadcast_Call[H]) Return(err error) *MockBroadcaster_WriteToStoreAndBroadcast_Call[H]
- func (_c *MockBroadcaster_WriteToStoreAndBroadcast_Call[H]) Run(run func(ctx context.Context, payload H, opts ...pubsub.PubOpt)) *MockBroadcaster_WriteToStoreAndBroadcast_Call[H]
- func (_c *MockBroadcaster_WriteToStoreAndBroadcast_Call[H]) RunAndReturn(run func(ctx context.Context, payload H, opts ...pubsub.PubOpt) error) *MockBroadcaster_WriteToStoreAndBroadcast_Call[H]
- type Replayer
Constants ¶
const DefaultMaxBlobSize = 1.5 * 1024 * 1024 // 1.5MB fallback blob size limit
const MaxRetriesBeforeHalt = 3
MaxRetriesBeforeHalt is the maximum number of retries before halting.
const MaxRetriesTimeout = 10 * time.Second
MaxRetriesTimeout is the maximum time to wait before halting.
const ( // MetricsSubsystem is a subsystem shared by all metrics exposed by this // package. MetricsSubsystem = "sequencer" )
Variables ¶
var ( // ErrNotProposer is used when the node is not a proposer ErrNotProposer = errors.New("not a proposer") // ErrNoBatch indicate no batch is available for creating block ErrNoBatch = errors.New("no batch to process") // ErrNoTransactionsInBatch is used when no transactions are found in batch ErrNoTransactionsInBatch = errors.New("no transactions found in batch") // ErrHeightFromFutureStr is the error message for height from future returned by da ErrHeightFromFutureStr = errors.New("given height is from the future") // ErrOversizedItem is an unrecoverable error indicating a single item exceeds DA blob size limit ErrOversizedItem = errors.New("single item exceeds DA blob size limit") )
These errors are used by block components.
var DataHashForEmptyTxs = []byte{110, 52, 11, 156, 255, 179, 122, 152, 156, 165, 68, 230, 187, 120, 10, 44, 120, 144, 29, 63, 179, 55, 56, 118, 133, 17, 163, 6, 23, 175, 160, 29}
DataHashForEmptyTxs is the hash of an empty block data.
Functions ¶
This section is empty.
Types ¶
type BlockOptions ¶
type BlockOptions struct {
AggregatorNodeSignatureBytesProvider types.AggregatorNodeSignatureBytesProvider
SyncNodeSignatureBytesProvider types.SyncNodeSignatureBytesProvider
ValidatorHasherProvider types.ValidatorHasherProvider
}
BlockOptions defines the options for creating block components
func DefaultBlockOptions ¶
func DefaultBlockOptions() BlockOptions
DefaultBlockOptions returns the default block options
func (*BlockOptions) Validate ¶
func (opts *BlockOptions) Validate() error
Validate validates the BlockOptions
type Broadcaster ¶
type Broadcaster[H header.Header[H]] interface { WriteToStoreAndBroadcast(ctx context.Context, payload H, opts ...pubsub.PubOpt) error Store() header.Store[H] }
broadcaster interface for P2P broadcasting
type DAHeightEvent ¶
type DAHeightEvent struct {
Header *types.SignedHeader
Data *types.Data
// DaHeight corresponds to the highest DA included height between the Header and Data.
DaHeight uint64
// Source indicates where this event originated from (DA or P2P)
Source EventSource
}
DAHeightEvent represents a DA event for caching
type DASubmitterFailureReason ¶
type DASubmitterFailureReason string
DASubmitterFailureReason represents a typed failure reason for DA submission failures
const ( DASubmitterFailureReasonAlreadyRejected DASubmitterFailureReason = "already_rejected" DASubmitterFailureReasonInsufficientFee DASubmitterFailureReason = "insufficient_fee" DASubmitterFailureReasonTimeout DASubmitterFailureReason = "timeout" DASubmitterFailureReasonAlreadyInMempool DASubmitterFailureReason = "already_in_mempool" DASubmitterFailureReasonNotIncludedInBlock DASubmitterFailureReason = "not_included_in_block" DASubmitterFailureReasonTooBig DASubmitterFailureReason = "too_big" DASubmitterFailureReasonContextCanceled DASubmitterFailureReason = "context_canceled" DASubmitterFailureReasonUnknown DASubmitterFailureReason = "unknown" )
func AllDASubmitterFailureReasons ¶
func AllDASubmitterFailureReasons() []DASubmitterFailureReason
AllDASubmitterFailureReasons returns all possible failure reasons
type EventSource ¶
type EventSource string
EventSource represents the origin of a block event
const ( // SourceDA indicates the event came from the DA layer SourceDA EventSource = "DA" // SourceP2P indicates the event came from P2P network SourceP2P EventSource = "P2P" )
type Metrics ¶
type Metrics struct {
// Original metrics
Height metrics.Gauge // Height of the chain
NumTxs metrics.Gauge // Number of transactions in the latest block
BlockSizeBytes metrics.Gauge // Size of the latest block
TotalTxs metrics.Gauge // Total number of transactions
CommittedHeight metrics.Gauge `metrics_name:"latest_block_height"` // The latest block height
// Channel metrics
ChannelBufferUsage map[string]metrics.Gauge
DroppedSignals metrics.Counter
// Error metrics
ErrorsByType map[string]metrics.Counter
RecoverableErrors metrics.Counter
NonRecoverableErrors metrics.Counter
// Performance metrics
OperationDuration map[string]metrics.Histogram
GoroutineCount metrics.Gauge
// DA metrics
DASubmissionAttempts metrics.Counter
DASubmissionSuccesses metrics.Counter
DASubmissionFailures metrics.Counter
DARetrievalAttempts metrics.Counter
DARetrievalSuccesses metrics.Counter
DARetrievalFailures metrics.Counter
DAInclusionHeight metrics.Gauge
PendingHeadersCount metrics.Gauge
PendingDataCount metrics.Gauge
// Sync metrics
SyncLag metrics.Gauge
HeadersSynced metrics.Counter
DataSynced metrics.Counter
BlocksApplied metrics.Counter
InvalidHeadersCount metrics.Counter
// Block production metrics
BlockProductionTime metrics.Histogram
EmptyBlocksProduced metrics.Counter
LazyBlocksProduced metrics.Counter
NormalBlocksProduced metrics.Counter
TxsPerBlock metrics.Histogram
// State transition metrics
StateTransitions map[string]metrics.Counter
InvalidTransitions metrics.Counter
// DA Submitter metrics
DASubmitterFailures map[DASubmitterFailureReason]metrics.Counter // Counter with reason label
DASubmitterLastFailure map[DASubmitterFailureReason]metrics.Gauge // Timestamp gauge with reason label
DASubmitterPendingBlobs metrics.Gauge // Total number of blobs awaiting submission (backlog)
DASubmitterResends metrics.Counter // Number of resend attempts
}
Metrics contains all metrics exposed by this package.
func PrometheusMetrics ¶
PrometheusMetrics returns Metrics built using Prometheus client library
type MockBroadcaster ¶
MockBroadcaster is an autogenerated mock type for the Broadcaster type
func NewMockBroadcaster ¶
func NewMockBroadcaster[H header.Header[H]](t interface { mock.TestingT Cleanup(func()) }) *MockBroadcaster[H]
NewMockBroadcaster creates a new instance of MockBroadcaster. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.
func (*MockBroadcaster[H]) EXPECT ¶
func (_m *MockBroadcaster[H]) EXPECT() *MockBroadcaster_Expecter[H]
func (*MockBroadcaster[H]) Store ¶
func (_mock *MockBroadcaster[H]) Store() header.Store[H]
Store provides a mock function for the type MockBroadcaster
func (*MockBroadcaster[H]) WriteToStoreAndBroadcast ¶
func (_mock *MockBroadcaster[H]) WriteToStoreAndBroadcast(ctx context.Context, payload H, opts ...pubsub.PubOpt) error
WriteToStoreAndBroadcast provides a mock function for the type MockBroadcaster
type MockBroadcaster_Expecter ¶
type MockBroadcaster_Expecter[H header.Header[H]] struct { // contains filtered or unexported fields }
func (*MockBroadcaster_Expecter[H]) Store ¶
func (_e *MockBroadcaster_Expecter[H]) Store() *MockBroadcaster_Store_Call[H]
Store is a helper method to define mock.On call
func (*MockBroadcaster_Expecter[H]) WriteToStoreAndBroadcast ¶
func (_e *MockBroadcaster_Expecter[H]) WriteToStoreAndBroadcast(ctx interface{}, payload interface{}, opts ...interface{}) *MockBroadcaster_WriteToStoreAndBroadcast_Call[H]
WriteToStoreAndBroadcast is a helper method to define mock.On call
- ctx context.Context
- payload H
- opts ...pubsub.PubOpt
type MockBroadcaster_Store_Call ¶
MockBroadcaster_Store_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Store'
func (*MockBroadcaster_Store_Call[H]) Return ¶
func (_c *MockBroadcaster_Store_Call[H]) Return(store header.Store[H]) *MockBroadcaster_Store_Call[H]
func (*MockBroadcaster_Store_Call[H]) Run ¶
func (_c *MockBroadcaster_Store_Call[H]) Run(run func()) *MockBroadcaster_Store_Call[H]
func (*MockBroadcaster_Store_Call[H]) RunAndReturn ¶
func (_c *MockBroadcaster_Store_Call[H]) RunAndReturn(run func() header.Store[H]) *MockBroadcaster_Store_Call[H]
type MockBroadcaster_WriteToStoreAndBroadcast_Call ¶
MockBroadcaster_WriteToStoreAndBroadcast_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WriteToStoreAndBroadcast'
func (*MockBroadcaster_WriteToStoreAndBroadcast_Call[H]) Return ¶
func (_c *MockBroadcaster_WriteToStoreAndBroadcast_Call[H]) Return(err error) *MockBroadcaster_WriteToStoreAndBroadcast_Call[H]
func (*MockBroadcaster_WriteToStoreAndBroadcast_Call[H]) Run ¶
func (_c *MockBroadcaster_WriteToStoreAndBroadcast_Call[H]) Run(run func(ctx context.Context, payload H, opts ...pubsub.PubOpt)) *MockBroadcaster_WriteToStoreAndBroadcast_Call[H]
func (*MockBroadcaster_WriteToStoreAndBroadcast_Call[H]) RunAndReturn ¶
func (_c *MockBroadcaster_WriteToStoreAndBroadcast_Call[H]) RunAndReturn(run func(ctx context.Context, payload H, opts ...pubsub.PubOpt) error) *MockBroadcaster_WriteToStoreAndBroadcast_Call[H]
type Replayer ¶
type Replayer struct {
// contains filtered or unexported fields
}
Replayer handles synchronization of the execution layer with ev-node's state. It replays blocks from the store to bring the execution layer up to date.
func NewReplayer ¶
func NewReplayer( store store.Store, exec coreexecutor.Executor, genesis genesis.Genesis, logger zerolog.Logger, ) *Replayer
NewReplayer creates a new execution layer replayer.
func (*Replayer) SyncToHeight ¶
SyncToHeight checks if the execution layer is behind ev-node and syncs it to the target height. This is useful for crash recovery scenarios where ev-node is ahead of the execution layer.
Returns: - error if sync fails or if execution layer is ahead of ev-node (unexpected state)