da

package
v3.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: Apache-2.0 Imports: 13 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EmptySquareShares

func EmptySquareShares() []share.Share

EmptySquare is a copy of the function defined in the square package to avoid a circular dependency. TODO deduplicate

func ExtendShares

func ExtendShares(s [][]byte) (*rsmt2d.ExtendedDataSquare, error)

func MinShares

func MinShares() [][]byte

MinShares returns one tail-padded share.

func RoundUpPowerOfTwo

func RoundUpPowerOfTwo[I constraints.Integer](input I) I

RoundUpPowerOfTwo returns the next power of two greater than or equal to input.

func SquareSize

func SquareSize(len int) int

SquareSize is a copy of the function defined in the square package to avoid a circular dependency. TODO deduplicate

Types

type DataAvailabilityHeader

type DataAvailabilityHeader struct {
	// RowRoot_j = root((M_{j,1} || M_{j,2} || ... || M_{j,2k} ))
	RowRoots [][]byte `json:"row_roots"`
	// ColumnRoot_j = root((M_{1,j} || M_{2,j} || ... || M_{2k,j} ))
	ColumnRoots [][]byte `json:"column_roots"`
	// contains filtered or unexported fields
}

DataAvailabilityHeader (DAHeader) contains the row and column roots of the erasure coded version of the data in Block.Data. The original Block.Data is split into shares and arranged in a square of width squareSize. Then, this square is "extended" into an extended data square (EDS) of width 2*squareSize by applying Reed-Solomon encoding. For details see Section 5.2 of https://arxiv.org/abs/1809.09044 or the Celestia specification: https://github.com/celestiaorg/celestia-specs/blob/master/src/specs/data_structures.md#availabledataheader

func DataAvailabilityHeaderFromProto

func DataAvailabilityHeaderFromProto(dahp *daproto.DataAvailabilityHeader) (dah *DataAvailabilityHeader, err error)

func MinDataAvailabilityHeader

func MinDataAvailabilityHeader() DataAvailabilityHeader

MinDataAvailabilityHeader returns the minimum valid data availability header. It is equal to the data availability header for a block with one tail padding share.

func NewDataAvailabilityHeader

func NewDataAvailabilityHeader(eds *rsmt2d.ExtendedDataSquare) (DataAvailabilityHeader, error)

NewDataAvailabilityHeader generates a DataAvailability header using the provided extended data square.

func (*DataAvailabilityHeader) Equals

Equals checks equality of two DAHeaders.

func (*DataAvailabilityHeader) Hash

func (dah *DataAvailabilityHeader) Hash() []byte

Hash computes the Merkle root of the row and column roots. Hash memoizes the result in `DataAvailabilityHeader.hash`.

func (*DataAvailabilityHeader) IsZero

func (dah *DataAvailabilityHeader) IsZero() bool

func (*DataAvailabilityHeader) SquareSize

func (dah *DataAvailabilityHeader) SquareSize() int

SquareSize returns the number of rows in the original data square.

func (*DataAvailabilityHeader) String

func (dah *DataAvailabilityHeader) String() string

String returns hex representation of merkle hash of the DAHeader.

func (*DataAvailabilityHeader) ToProto

func (*DataAvailabilityHeader) ValidateBasic

func (dah *DataAvailabilityHeader) ValidateBasic() error

ValidateBasic runs stateless checks on the DataAvailabilityHeader.

Jump to

Keyboard shortcuts

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