da

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2025 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrBlobNotFound is used to indicate that the blob was not found.
	ErrBlobNotFound = errors.New("blob: not found")

	// ErrBlobSizeOverLimit is used to indicate that the blob size is over limit
	ErrBlobSizeOverLimit = errors.New("blob: over size limit")

	// ErrTxTimedout is the error message returned by the DA when mempool is congested
	ErrTxTimedout = errors.New("timed out waiting for tx to be included in a block")

	// ErrTxAlreadyInMempool is  the error message returned by the DA when tx is already in mempool
	ErrTxAlreadyInMempool = errors.New("tx already in mempool")

	// ErrTxIncorrectAccountSequence is the error message returned by the DA when tx has incorrect sequence
	ErrTxIncorrectAccountSequence = errors.New("incorrect account sequence")

	// ErrTxSizeTooBig is the error message returned by the DA when tx size is too big
	ErrTxSizeTooBig = errors.New("tx size is too big")

	//ErrTxTooLarge is the err message returned by the DA when tx size is too large
	ErrTxTooLarge = errors.New("tx too large")

	// ErrContextDeadline is the error message returned by the DA when context deadline exceeds
	ErrContextDeadline = errors.New("context deadline")
)

Functions

This section is empty.

Types

type BaseResult

type BaseResult struct {
	// Code is to determine if the action succeeded.
	Code StatusCode
	// Message may contain DA layer specific information (like DA block height/hash, detailed error message, etc)
	Message string
	// DAHeight informs about a height on Data Availability Layer for given result.
	DAHeight uint64
	// BlobSize is the size of the blob submitted.
	BlobSize uint64
	// SubmittedCount is the number of successfully submitted blocks.
	SubmittedCount uint64
}

BaseResult contains basic information returned by DA layer.

type DAClient

type DAClient struct {
	DA              goDA.DA
	GasPrice        float64
	GasMultiplier   float64
	Namespace       goDA.Namespace
	SubmitTimeout   time.Duration
	RetrieveTimeout time.Duration
}

DAClient is a new DA implementation.

func NewDAClient

func NewDAClient(da goDA.DA, gasPrice, gasMultiplier float64, ns goDA.Namespace) *DAClient

NewDAClient returns a new DA client.

func (*DAClient) RetrieveBatch

func (dac *DAClient) RetrieveBatch(ctx context.Context, dataLayerHeight uint64) ResultRetrieveBatch

RetrieveBatch retrieves block data from DA.

func (*DAClient) SubmitBatch

func (dac *DAClient) SubmitBatch(ctx context.Context, data []*sequencing.Batch, maxBlobSize uint64, gasPrice float64) ResultSubmitBatch

SubmitBatch submits block data to DA.

type ResultRetrieveBatch

type ResultRetrieveBatch struct {
	BaseResult
	// Data is the block data retrieved from Data Availability Layer.
	// If Code is not equal to StatusSuccess, it has to be nil.
	Data []*types.Data
}

ResultRetrieveBatch contains batch of block data returned from DA layer client.

type ResultSubmitBatch

type ResultSubmitBatch struct {
	BaseResult
}

ResultSubmitBatch contains information returned from DA layer after block headers/data submission.

type StatusCode

type StatusCode uint64

StatusCode is a type for DA layer return status. TODO: define an enum of different non-happy-path cases that might need to be handled by Rollkit independent of the underlying DA chain.

const (
	StatusUnknown StatusCode = iota
	StatusSuccess
	StatusNotFound
	StatusNotIncludedInBlock
	StatusAlreadyInMempool
	StatusTooBig
	StatusContextDeadline
	StatusError
)

Data Availability return codes.

Jump to

Keyboard shortcuts

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