da

package
v1.0.0-beta.10....-9ad4016 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NamespaceVersionIndex          = 0
	NamespaceVersionSize           = 1
	NamespaceIDSize                = 28
	NamespaceSize                  = NamespaceVersionSize + NamespaceIDSize
	NamespaceVersionZero           = uint8(0)
	NamespaceVersionMax            = uint8(255)
	NamespaceVersionZeroPrefixSize = 18
	NamespaceVersionZeroDataSize   = 10
)

Variables

View Source
var (
	ErrBlobNotFound               = errors.New("blob: not found")
	ErrBlobSizeOverLimit          = errors.New("blob: over size limit")
	ErrTxTimedOut                 = errors.New("timed out waiting for tx to be included in a block")
	ErrTxAlreadyInMempool         = errors.New("tx already in mempool")
	ErrTxIncorrectAccountSequence = errors.New("incorrect account sequence")
	ErrContextDeadline            = errors.New("context deadline")
	ErrHeightFromFuture           = errors.New("given height is from the future")
	ErrContextCanceled            = errors.New("context canceled")
)

Functions

func SplitID

func SplitID(id []byte) (uint64, []byte, error)

SplitID splits an ID into a height and a commitment. if len(id) <= 8, it returns 0 and nil.

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
	// Height is the height of the block on Data Availability Layer for given result.
	Height uint64
	// SubmittedCount is the number of successfully submitted blocks.
	SubmittedCount uint64
	// BlobSize is the size of the blob submitted.
	BlobSize uint64
	// IDs is the list of IDs of the blobs submitted.
	IDs [][]byte
	// Timestamp is the timestamp of the posted data on Data Availability Layer.
	Timestamp time.Time
}

BaseResult contains basic information returned by DA layer.

type Blob

type Blob = []byte

Blob is the data submitted/received from the DA layer.

type Commitment

type Commitment = []byte

Commitment should contain serialized cryptographic commitment to Blob value.

type GetIDsResult

type GetIDsResult struct {
	IDs       []ID
	Timestamp time.Time
}

GetIDsResult holds the result of GetIDs call: IDs and timestamp of corresponding block.

type ID

type ID = []byte

ID should contain serialized data required by the implementation to find blob in DA.

type Namespace

type Namespace struct {
	Version uint8
	ID      [NamespaceIDSize]byte
}

Namespace mirrors Celestia namespace layout (version + 28-byte ID).

func NamespaceFromBytes

func NamespaceFromBytes(b []byte) (*Namespace, error)

NamespaceFromBytes parses a namespace from its byte representation.

func NamespaceFromString

func NamespaceFromString(s string) *Namespace

NamespaceFromString deterministically builds a version-0 namespace from a string.

func NewNamespaceV0

func NewNamespaceV0(data []byte) (*Namespace, error)

NewNamespaceV0 builds a version-0 namespace from up to 10 bytes of data.

func ParseHexNamespace

func ParseHexNamespace(hexStr string) (*Namespace, error)

ParseHexNamespace parses a hex string (with or without 0x) into a namespace.

func (Namespace) Bytes

func (n Namespace) Bytes() []byte

Bytes returns the namespace as a byte slice.

func (Namespace) HexString

func (n Namespace) HexString() string

HexString returns the 0x-prefixed hex encoding of the namespace bytes.

func (Namespace) IsValidForVersion0

func (n Namespace) IsValidForVersion0() bool

IsValidForVersion0 validates version-0 namespace rules (first 18 bytes zero).

type Proof

type Proof = []byte

Proof should contain serialized proof of inclusion (publication) of Blob in DA.

type ResultRetrieve

type ResultRetrieve 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 [][]byte
}

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

type ResultSubmit

type ResultSubmit struct {
	BaseResult
}

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

type StatusCode

type StatusCode uint64

StatusCode mirrors the blob RPC status codes shared with block/internal/da.

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

Data Availability return codes.

Jump to

Keyboard shortcuts

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