sequencing

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2024 License: Apache-2.0 Imports: 16 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidRollupId = errors.New("invalid rollup id")

ErrInvalidRollupId is returned when the rollup id is invalid

Functions

func GetTransactionHash added in v0.2.0

func GetTransactionHash(txBytes []byte) string

GetTransactionHash to get hash from transaction bytes using SHA-256

Types

type BatchQueue

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

BatchQueue ...

func NewBatchQueue

func NewBatchQueue() *BatchQueue

NewBatchQueue creates a new TransactionQueue

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 Sequencer

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

Sequencer implements go-sequencing interface using celestia backend

func NewSequencer

func NewSequencer(daAddress, daAuthToken string, daNamespace []byte, batchTime time.Duration, dbPath string) (*Sequencer, error)

NewSequencer ...

func (*Sequencer) Close added in v0.2.0

func (c *Sequencer) Close() error

Close safely closes the BadgerDB instance if it is open

func (*Sequencer) CompareAndSetMaxSize added in v0.2.0

func (c *Sequencer) CompareAndSetMaxSize(size uint64)

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

GetNextBatch implements sequencing.Sequencer.

func (*Sequencer) LoadLastBatchHashFromDB added in v0.2.0

func (c *Sequencer) LoadLastBatchHashFromDB() error

LoadLastBatchHashFromDB loads the last batch hash from BadgerDB into memory after a crash or restart.

func (*Sequencer) LoadSeenBatchesFromDB added in v0.2.0

func (c *Sequencer) LoadSeenBatchesFromDB() error

LoadSeenBatchesFromDB loads the seen batches from BadgerDB into memory after a crash or restart.

func (*Sequencer) SubmitRollupTransaction

SubmitRollupTransaction implements sequencing.Sequencer.

func (*Sequencer) VerifyBatch

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.

Jump to

Keyboard shortcuts

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