sequencing

package module
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

README

go-sequencing

go-sequencing defines a generic sequencing interface for modular blockchains

Sequencing Interface

Implementations

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Batch

type Batch struct {
	Transactions []Tx
	Height       uint64
	Namespace    string
}

Batch is a collection of transactions

func (*Batch) FromProto

func (batch *Batch) FromProto(pb *pbseq.Batch)

FromProto deserializes a batch from a protobuf message.

func (*Batch) Marshal

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

Marshal serializes a batch to a byte slice.

func (*Batch) ToProto

func (batch *Batch) ToProto() *pbseq.Batch

ToProto serializes a batch to a protobuf message.

func (*Batch) Unmarshal

func (batch *Batch) Unmarshal(data []byte) error

Unmarshal deserializes a batch from a byte slice.

type BatchVerifier

type BatchVerifier interface {
	// VerifyBatch verifies a batch of transactions received from the sequencer
	VerifyBatch(ctx context.Context, batch *Batch) (bool, error)
}

BatchVerifier provides a method for verifying a batch of transactions received from the sequencer

type RollupId

type RollupId = []byte

RollupId is a unique identifier for a rollup chain

type Sequencer

type Sequencer interface {
	SequencerInput
	SequencerOutput
	BatchVerifier
}

Sequencer is a generic interface for a rollup sequencer

type SequencerInput

type SequencerInput interface {
	// SubmitRollupTransaction submits a transaction from rollup to sequencer
	SubmitRollupTransaction(ctx context.Context, rollupId RollupId, tx Tx) error
}

SequencerInput provides a method for submitting a transaction from rollup to sequencer

type SequencerOutput

type SequencerOutput interface {
	// GetNextBatch returns the next batch of transactions from sequencer to rollup
	// lastBatch is the last batch of transactions received from the sequencer
	// returns the next batch of transactions and an error if any from the sequencer
	GetNextBatch(ctx context.Context, lastBatch *Batch) (*Batch, error)
}

SequencerOutput provides a method for getting the next batch of transactions from sequencer to rollup

type Tx

type Tx = []byte

Tx is a rollup transaction

Directories

Path Synopsis
proto
types

Jump to

Keyboard shortcuts

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