Documentation
¶
Index ¶
- Constants
- Variables
- func GetTransactionHash(txBytes []byte) string
- type BatchQueue
- type Metrics
- type MetricsProvider
- type Sequencer
- func (c *Sequencer) Close() error
- func (c *Sequencer) CompareAndSetMaxSize(size uint64)
- func (c *Sequencer) GetNextBatch(ctx context.Context, req sequencing.GetNextBatchRequest) (*sequencing.GetNextBatchResponse, error)
- func (c *Sequencer) LoadLastBatchHashFromDB() error
- func (c *Sequencer) LoadSeenBatchesFromDB() error
- func (c *Sequencer) SubmitRollupTransaction(ctx context.Context, req sequencing.SubmitRollupTransactionRequest) (*sequencing.SubmitRollupTransactionResponse, error)
- func (c *Sequencer) VerifyBatch(ctx context.Context, req sequencing.VerifyBatchRequest) (*sequencing.VerifyBatchResponse, error)
- type TransactionQueue
- func (tq *TransactionQueue) AddBatchBackToQueue(batch sequencing.Batch, db *badger.DB) error
- func (tq *TransactionQueue) AddTransaction(tx sequencing.Tx, db *badger.DB) error
- func (tq *TransactionQueue) GetNextBatch(max uint64, db *badger.DB) sequencing.Batch
- func (tq *TransactionQueue) LoadFromDB(db *badger.DB) error
Constants ¶
const ( // MetricsSubsystem is a subsystem shared by all metrics exposed by this // package. MetricsSubsystem = "sequencer" )
Variables ¶
var ErrInvalidRollupId = errors.New("invalid rollup id")
ErrInvalidRollupId is returned when the rollup id is invalid
Functions ¶
func GetTransactionHash ¶ added in v0.2.0
GetTransactionHash to get hash from transaction bytes using SHA-256
Types ¶
type BatchQueue ¶
type BatchQueue struct {
// contains filtered or unexported fields
}
BatchQueue ...
func (*BatchQueue) AddBatch ¶
func (bq *BatchQueue) AddBatch(batch sequencing.Batch, db *badger.DB) error
AddBatch adds a new transaction to the queue
func (*BatchQueue) LoadFromDB ¶ added in v0.2.0
func (bq *BatchQueue) LoadFromDB(db *badger.DB) error
LoadFromDB reloads all batches from BadgerDB into the in-memory queue after a crash or restart.
func (*BatchQueue) Next ¶
func (bq *BatchQueue) Next(db *badger.DB) (*sequencing.Batch, error)
Next extracts a batch of transactions from the queue
type Metrics ¶ added in v0.3.0
type Metrics struct {
// GasPrice
GasPrice metrics.Gauge
// Last submitted blob size
LastBlobSize metrics.Gauge
// cost / byte
// CostPerByte metrics.Gauge
// Wallet Balance
// WalletBalance metrics.Gauge
// Transaction Status
TransactionStatus metrics.Counter
// Number of pending blocks.
NumPendingBlocks metrics.Gauge
// Last included block height
IncludedBlockHeight metrics.Gauge
}
Metrics contains metrics exposed by this package.
func NopMetrics ¶ added in v0.3.0
NopMetrics returns no-op Metrics.
func PrometheusMetrics ¶ added in v0.3.0
PrometheusMetrics returns Metrics build using Prometheus client library. Optionally, labels can be provided along with their values ("foo", "fooValue").
type MetricsProvider ¶ added in v0.3.0
MetricsProvider returns sequencing Metrics.
func DefaultMetricsProvider ¶ added in v0.3.0
func DefaultMetricsProvider(enabled bool) MetricsProvider
DefaultMetricsProvider returns Metrics build using Prometheus client library if Prometheus is enabled. Otherwise, it returns no-op Metrics.
type Sequencer ¶
type Sequencer struct {
// contains filtered or unexported fields
}
Sequencer implements go-sequencing interface
func NewSequencer ¶
func NewSequencer(daAddress, daAuthToken string, daNamespace []byte, rollupId []byte, batchTime time.Duration, metrics *Metrics, dbPath string) (*Sequencer, error)
NewSequencer ...
func (*Sequencer) CompareAndSetMaxSize ¶ added in v0.2.0
CompareAndSetMaxSize compares the passed size with the current max size and sets the max size to the smaller of the two Initially the max size is set to the max blob size returned by the DA layer This can be overwritten by the execution client if it can only handle smaller size
func (*Sequencer) GetNextBatch ¶
func (c *Sequencer) GetNextBatch(ctx context.Context, req sequencing.GetNextBatchRequest) (*sequencing.GetNextBatchResponse, error)
GetNextBatch implements sequencing.Sequencer.
func (*Sequencer) LoadLastBatchHashFromDB ¶ added in v0.2.0
LoadLastBatchHashFromDB loads the last batch hash from BadgerDB into memory after a crash or restart.
func (*Sequencer) LoadSeenBatchesFromDB ¶ added in v0.2.0
LoadSeenBatchesFromDB loads the seen batches from BadgerDB into memory after a crash or restart.
func (*Sequencer) SubmitRollupTransaction ¶
func (c *Sequencer) SubmitRollupTransaction(ctx context.Context, req sequencing.SubmitRollupTransactionRequest) (*sequencing.SubmitRollupTransactionResponse, error)
SubmitRollupTransaction implements sequencing.Sequencer.
func (*Sequencer) VerifyBatch ¶
func (c *Sequencer) VerifyBatch(ctx context.Context, req sequencing.VerifyBatchRequest) (*sequencing.VerifyBatchResponse, error)
VerifyBatch implements sequencing.Sequencer.
type TransactionQueue ¶
type TransactionQueue struct {
// contains filtered or unexported fields
}
TransactionQueue is a queue of transactions
func NewTransactionQueue ¶
func NewTransactionQueue() *TransactionQueue
NewTransactionQueue creates a new TransactionQueue
func (*TransactionQueue) AddBatchBackToQueue ¶ added in v0.2.0
func (tq *TransactionQueue) AddBatchBackToQueue(batch sequencing.Batch, db *badger.DB) error
AddBatchBackToQueue re-adds the batch to the transaction queue (and BadgerDB) after a failure.
func (*TransactionQueue) AddTransaction ¶
func (tq *TransactionQueue) AddTransaction(tx sequencing.Tx, db *badger.DB) error
AddTransaction adds a new transaction to the queue
func (*TransactionQueue) GetNextBatch ¶
func (tq *TransactionQueue) GetNextBatch(max uint64, db *badger.DB) sequencing.Batch
GetNextBatch extracts a batch of transactions from the queue
func (*TransactionQueue) LoadFromDB ¶ added in v0.2.0
func (tq *TransactionQueue) LoadFromDB(db *badger.DB) error
LoadFromDB reloads all transactions from BadgerDB into the in-memory queue after a crash.