da

package
v0.10.7 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrDataNotFound is used to indicated that requested data failed to be retrieved.
	ErrDataNotFound = errors.New("data not found")
	// ErrNamespaceNotFound is used to indicate that the block contains data, but not for the requested namespace.
	ErrNamespaceNotFound = errors.New("namespace not found in data")
	// ErrBlobNotFound is used to indicate that the blob was not found.
	ErrBlobNotFound = errors.New("blob: not found")
	// ErrEDSNotFound is used to indicate that the EDS was not found.
	ErrEDSNotFound = errors.New("eds not found")
)

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
}

BaseResult contains basic information returned by DA layer.

type BlockRetriever

type BlockRetriever interface {
	// RetrieveBlocks returns blocks at given data layer height from data availability layer.
	RetrieveBlocks(ctx context.Context, dataLayerHeight uint64) ResultRetrieveBlocks
}

BlockRetriever is additional interface that can be implemented by Data Availability Layer Client that is able to retrieve block data from DA layer. This gives the ability to use it for block synchronization.

type DataAvailabilityLayerClient

type DataAvailabilityLayerClient interface {
	// Init is called once to allow DA client to read configuration and initialize resources.
	Init(namespaceID types.NamespaceID, config []byte, kvStore ds.Datastore, logger log.Logger) error

	// Start is called once, after Init. It's implementation should start operation of DataAvailabilityLayerClient.
	Start() error

	// Stop is called once, when DataAvailabilityLayerClient is no longer needed.
	Stop() error

	// SubmitBlocks submits the passed in blocks to the DA layer.
	// This should create a transaction which (potentially)
	// triggers a state transition in the DA layer.
	SubmitBlocks(ctx context.Context, blocks []*types.Block) ResultSubmitBlocks
}

DataAvailabilityLayerClient defines generic interface for DA layer block submission. It also contains life-cycle methods.

type ResultCheckBlock

type ResultCheckBlock struct {
	BaseResult
	// DataAvailable is the actual answer whether the block is available or not.
	// It can be true if and only if Code is equal to StatusSuccess.
	DataAvailable bool
}

ResultCheckBlock contains information about block availability, returned from DA layer client.

type ResultRetrieveBlocks

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

ResultRetrieveBlocks contains batch of blocks returned from DA layer client.

type ResultSubmitBlocks added in v0.10.0

type ResultSubmitBlocks struct {
	BaseResult
}

ResultSubmitBlocks contains information returned from DA layer after blocks 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
	StatusError
)

Data Availability return codes.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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