da

package
v0.3.3-gamma Latest Latest
Warning

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

Go to latest
Published: May 11, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

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 BatchRetriever

type BatchRetriever interface {
	// RetrieveBatches returns blocks at given data layer height from data availability layer.
	RetrieveBatches(dataLayerHeight uint64) ResultRetrieveBatch
}

BatchRetriever 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 Client

type Client string

Client defines all the possible da clients

const (
	Mock     Client = "mock"
	Celestia Client = "celestia"
)

Data availability clients

type DataAvailabilityLayerClient

type DataAvailabilityLayerClient interface {
	// Init is called once to allow DA client to read configuration and initialize resources.
	Init(config []byte, kvStore store.KVStore, 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

	// SubmitBatch submits the passed in block to the DA layer.
	// This should create a transaction which (potentially)
	// triggers a state transition in the DA layer.
	SubmitBatch(batch *types.Batch) ResultSubmitBatch

	// CheckBatchAvailability queries DA layer to check data availability of block corresponding at given height.
	CheckBatchAvailability(dataLayerHeight uint64) ResultCheckBatch

	GetClientType() Client
}

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

type ResultCheckBatch

type ResultCheckBatch 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
}

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

type ResultRetrieveBatch

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

ResultRetrieveBatch contains batch of blocks returned from DA layer client.

type ResultSubmitBatch

type ResultSubmitBatch struct {
	BaseResult
}

ResultSubmitBatch contains information returned from DA layer after block 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 Furyint independent of the underlying DA chain.

const (
	StatusUnknown StatusCode = iota
	StatusSuccess
	StatusTimeout
	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