Documentation
¶
Overview ¶
This package implements a based sequencer.
Index ¶
- Constants
- Variables
- type PersistentPendingTxs
- type Sequencer
- func (s *Sequencer) AddToPendingTxs(txs [][]byte, ids [][]byte, timestamp time.Time)
- func (s *Sequencer) GetNextBatch(ctx context.Context, req coresequencer.GetNextBatchRequest) (*coresequencer.GetNextBatchResponse, error)
- func (s *Sequencer) SubmitBatchTxs(ctx context.Context, req coresequencer.SubmitBatchTxsRequest) (*coresequencer.SubmitBatchTxsResponse, error)
- func (s *Sequencer) VerifyBatch(ctx context.Context, req coresequencer.VerifyBatchRequest) (*coresequencer.VerifyBatchResponse, error)
- type TxsWithTimestamp
Constants ¶
const ( FlagBasedURL = "based.url" FlagBasedAuth = "based.auth" FlagBasedNamespace = "based.namespace" FlagBasedStartHeight = "based.start-height" FlagBasedMaxHeightDrift = "based.max-height-drift" FlagBasedGasMultiplier = "based.gas-multiplier" FlagBasedGasPrice = "based.gas-price" )
const (
DefaultMaxBlobSize uint64 = 1_500_000
)
Variables ¶
var ( ErrInvalidId = errors.New("invalid id") ErrInvalidMaxBytes = errors.New("invalid max bytes") )
Functions ¶
This section is empty.
Types ¶
type PersistentPendingTxs ¶
type PersistentPendingTxs struct {
// contains filtered or unexported fields
}
PersistentPendingTxs is a persistent queue for pending transactions.
func NewPersistentPendingTxs ¶
func NewPersistentPendingTxs(store datastore.Batching) (*PersistentPendingTxs, error)
NewPersistentPendingTxs creates a new PersistentPendingTxs instance.
func (*PersistentPendingTxs) Load ¶
func (pt *PersistentPendingTxs) Load() error
Load loads the pending transactions from the datastore.
func (*PersistentPendingTxs) PopUpToMaxBytes ¶
func (pt *PersistentPendingTxs) PopUpToMaxBytes(maxBytes uint64) ([][]byte, [][]byte, uint64, time.Time)
PopUpToMaxBytes pops transactions from the queue until the total size is less than maxBytes.
func (*PersistentPendingTxs) Save ¶
func (pt *PersistentPendingTxs) Save() error
Save saves the pending transactions to the datastore.
type Sequencer ¶
type Sequencer struct {
// id is the unique identifier for the chain associated with this Sequencer.
Id []byte
// DA represents the Data Availability layer interface used by the Sequencer.
DA coreda.DA
// contains filtered or unexported fields
}
Sequencer is responsible for managing transactions and interacting with the Data Availability (DA) layer. It handles tasks such as adding transactions to a pending queue, retrieving batches of transactions, verifying batches, and submitting them to the DA layer. The Sequencer ensures that transactions are processed in a reliable and efficient manner while adhering to constraints like maximum blob size and height drift. Sequencer represents a structure responsible for managing the sequencing of transactions and interacting with the Data Availability (DA) layer.
func NewSequencer ¶
func NewSequencer( logger zerolog.Logger, daImpl coreda.DA, Id []byte, daStartHeight uint64, maxHeightDrift uint64, ds datastore.Batching, ) (*Sequencer, error)
NewSequencer creates a new Sequencer instance.
func (*Sequencer) AddToPendingTxs ¶
AddToPendingTxs adds transactions to the pending queue.
func (*Sequencer) GetNextBatch ¶
func (s *Sequencer) GetNextBatch(ctx context.Context, req coresequencer.GetNextBatchRequest) (*coresequencer.GetNextBatchResponse, error)
GetNextBatch implements sequencer.Sequencer.
func (*Sequencer) SubmitBatchTxs ¶
func (s *Sequencer) SubmitBatchTxs(ctx context.Context, req coresequencer.SubmitBatchTxsRequest) (*coresequencer.SubmitBatchTxsResponse, error)
SubmitBatchTxs implements sequencer.Sequencer.
func (*Sequencer) VerifyBatch ¶
func (s *Sequencer) VerifyBatch(ctx context.Context, req coresequencer.VerifyBatchRequest) (*coresequencer.VerifyBatchResponse, error)
VerifyBatch implements sequencer.Sequencer.