sequencer

package
v1.0.0-beta.2 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2025 License: Apache-2.0 Imports: 5 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Batch

type Batch struct {
	Transactions [][]byte
}

Batch is a collection of transactions

func (*Batch) Hash

func (batch *Batch) Hash() ([]byte, error)

Hash returns the cryptographic hash of the batch

type DummySequencer

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

DummySequencer is a dummy implementation of the Sequencer interface for testing

func NewDummySequencer

func NewDummySequencer() *DummySequencer

NewDummySequencer creates a new dummy Sequencer instance

func (*DummySequencer) GetNextBatch

GetNextBatch gets the next batch from the sequencer

func (*DummySequencer) SubmitBatchTxs

SubmitBatchTxs submits a batch of transactions to the sequencer

func (*DummySequencer) VerifyBatch

VerifyBatch verifies a batch of transactions received from the sequencer

type GetNextBatchRequest

type GetNextBatchRequest struct {
	Id            []byte
	LastBatchData [][]byte
	MaxBytes      uint64
}

GetNextBatchRequest is a request to get the next batch of transactions from sequencer to chain

type GetNextBatchResponse

type GetNextBatchResponse struct {
	Batch     *Batch
	Timestamp time.Time
	BatchData [][]byte
}

GetNextBatchResponse is a response to getting the next batch of transactions from sequencer to chain

type Sequencer

type Sequencer interface {
	// SubmitBatchTxs submits a batch of transactions from  to sequencer
	// Id is the unique identifier for the  chain
	// Batch is the batch of transactions to submit
	// returns an error if any from the sequencer
	SubmitBatchTxs(ctx context.Context, req SubmitBatchTxsRequest) (*SubmitBatchTxsResponse, error)

	// GetNextBatch returns the next batch of transactions from sequencer to
	// Id is the unique identifier for the  chain
	// LastBatchHash is the cryptographic hash of the last batch received by the
	// MaxBytes is the maximum number of bytes to return in the batch
	// returns the next batch of transactions and an error if any from the sequencer
	GetNextBatch(ctx context.Context, req GetNextBatchRequest) (*GetNextBatchResponse, error)

	// VerifyBatch verifies a batch of transactions received from the sequencer
	// Id is the unique identifier for the  chain
	// BatchHash is the cryptographic hash of the batch to verify
	// returns a boolean indicating if the batch is valid and an error if any from the sequencer
	VerifyBatch(ctx context.Context, req VerifyBatchRequest) (*VerifyBatchResponse, error)
}

Sequencer is a generic interface for a sequencer

type SubmitBatchTxsRequest

type SubmitBatchTxsRequest struct {
	Id    []byte
	Batch *Batch
}

SubmitBatchTxsRequest is a request to submit a batch of transactions from chain to sequencer

type SubmitBatchTxsResponse

type SubmitBatchTxsResponse struct {
}

SubmitBatchTxsResponse is a response to submitting a batch of transactions from chain to sequencer

type VerifyBatchRequest

type VerifyBatchRequest struct {
	Id        []byte
	BatchData [][]byte
}

VerifyBatchRequest is a request to verify a batch of transactions received from the sequencer

type VerifyBatchResponse

type VerifyBatchResponse struct {
	Status bool
}

VerifyBatchResponse is a response to verifying a batch of transactions received from the sequencer

Jump to

Keyboard shortcuts

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