da

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: Apache-2.0 Imports: 12 Imported by: 28

Documentation

Index

Constants

View Source
const (
	EventHealthStatus = "DAHealthStatus"
)
View Source
const (
	// EventTypeKey is a reserved composite key for event name.
	EventTypeKey = "da.event"
)

Type keys

View Source
const PathSeparator = "|"

Variables

View Source
var (
	// ErrFailedTxBuild is returned when transaction build fails.
	ErrTxBroadcastConfigError = errors.New("failed building tx")
	// ErrFailedTxBroadcast is returned when transaction broadcast fails.
	ErrTxBroadcastNetworkError = errors.New("failed broadcasting tx")
	// ErrTxBroadcastTimeout is returned when transaction broadcast times out.
	ErrTxBroadcastTimeout = errors.New("broadcast timeout error")
	// ErrUnableToGetProof is returned when proof is not available.
	ErrUnableToGetProof = errors.New("unable to get proof")
	// ErrRetrieval is returned when retrieval rpc falls
	ErrRetrieval = errors.New("retrieval failed")
	// ErrBlobNotFound is returned when blob is not found.
	ErrBlobNotFound = errors.New("blob not found")
	// ErrBlobNotIncluded is returned when blob is not included.
	ErrBlobNotIncluded = errors.New("blob not included")
	// ErrProofNotMatching is returned when proof does not match.
	ErrProofNotMatching = errors.New("proof not matching")
	// ErrNameSpace is returned when wrong namespace used
	ErrNameSpace = errors.New("namespace not matching")
)
View Source
var EventHealthStatusList = map[string][]string{EventTypeKey: {EventHealthStatus}}
View Source
var EventQueryDAHealthStatus = uevent.QueryFor(EventTypeKey, EventHealthStatus)

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
	// Error is the error returned by the DA layer
	Error error
}

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(daMetaData *DASubmitMetaData) ResultRetrieveBatch
	// CheckBatchAvailability checks the availability of the blob received getting proofs and validating them
	CheckBatchAvailability(daMetaData *DASubmitMetaData) ResultCheckBatch
}

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 Blob added in v1.1.0

type Blob = []byte

Blob is the data submitted/received from DA interface.

type Client

type Client string

Client defines all the possible da clients

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

Data availability clients

type Commitment added in v1.1.0

type Commitment = []byte

Commitment should contain serialized cryptographic commitment to Blob value.

type DACheckMetaData added in v1.1.0

type DACheckMetaData struct {
	// Height is the height of the block in the da layer
	Height uint64
	// Client is the client to use to fetch data from the da layer
	Client Client
	// Submission index in the Hub
	SLIndex uint64
	// Namespace ID
	Namespace []byte
	// Share commitment, for each blob, used to obtain blobs and proofs
	Commitment Commitment
	// Initial position for each blob in the NMT
	Index int
	// Number of shares of each blob
	Length int
	// Proofs necessary to validate blob inclusion in the specific height
	Proofs []*blob.Proof
	// NMT roots for each NMT Proof
	NMTRoots []byte
	// Proofs necessary to validate blob inclusion in the specific height
	RowProofs []*merkle.Proof
	// any NMT root for the specific height, necessary for non-inclusion proof
	Root []byte
}

DAMetaData contains meta data about a batch on the Data Availability Layer.

type DASubmitMetaData added in v1.1.0

type DASubmitMetaData struct {
	// Height is the height of the block in the da layer
	Height uint64
	// Namespace ID
	Namespace []byte
	// Client is the client to use to fetch data from the da layer
	Client Client
	// Share commitment, for each blob, used to obtain blobs and proofs
	Commitment Commitment
	// Initial position for each blob in the NMT
	Index int
	// Number of shares of each blob
	Length int
	// any NMT root for the specific height, necessary for non-inclusion proof
	Root []byte
}

DAMetaData contains meta data about a batch on the Data Availability Layer.

func (*DASubmitMetaData) FromPath added in v1.1.0

func (d *DASubmitMetaData) FromPath(path string) (*DASubmitMetaData, error)

FromPath parses a path to a DAMetaData.

func (*DASubmitMetaData) ToPath added in v1.1.0

func (d *DASubmitMetaData) ToPath() string

ToPath converts a DAMetaData to a path.

type DataAvailabilityLayerClient

type DataAvailabilityLayerClient interface {
	// Init is called once to allow DA client to read configuration and initialize resources.
	Init(config []byte, pubsubServer *pubsub.Server, kvStore store.KVStore, logger types.Logger, options ...Option) 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

	GetClientType() Client

	// CheckBatchAvailability checks the availability of the blob submitted getting proofs and validating them
	CheckBatchAvailability(daMetaData *DASubmitMetaData) ResultCheckBatch
}

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

type EventDataHealth added in v1.1.0

type EventDataHealth struct {
	// Error is the error that was encountered in case of a health check failure, nil implies healthy
	Error error
}

type Option added in v1.1.0

type Option func(DataAvailabilityLayerClient)

Option is a function that sets a parameter on the da layer.

type ResultCheckBatch

type ResultCheckBatch struct {
	BaseResult
	// DAHeight informs about a height on Data Availability Layer for given result.
	CheckMetaData *DACheckMetaData
}

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
	// DAHeight informs about a height on Data Availability Layer for given result.
	CheckMetaData *DACheckMetaData
}

ResultRetrieveBatch contains batch of blocks returned from DA layer client.

type ResultSubmitBatch

type ResultSubmitBatch struct {
	BaseResult
	// DAHeight informs about a height on Data Availability Layer for given result.
	SubmitMetaData *DASubmitMetaData
}

ResultSubmitBatch contains information returned from DA layer after block submission.

func SubmitBatchHealthEventHelper added in v1.1.0

func SubmitBatchHealthEventHelper(pubsubServer *pubsub.Server, ctx context.Context, err error) (ResultSubmitBatch, error)

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 Dymint independent of the underlying DA chain.

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