Run NodesReferencevms

da

Package da provides Data Availability layer infrastructure for the Lux blockchain.

import "github.com/luxfi/node/vms/da"

Package da provides Data Availability layer infrastructure for the Lux blockchain. DA is consensus-critical: validators must certify availability before block finalization.

Functions

ComputeDARoot

func ComputeDARoot(commitments []*DACommitment) []byte

ComputeDARoot computes the DA root from commitments

Types

BlockDAInfo

BlockDAInfo contains DA-related information for a block header

Chunk

Chunk represents a chunk of data with its proof

DABlob

DABlob represents a data availability blob

func NewDABlob(data []byte, submitter ids.ID, height uint64) (*DABlob, error)
func (b *DABlob) CreateCommitment() *DACommitment
func (b *DABlob) GetChunk(index uint32) (*Chunk, error)
func (b *DABlob) VerifyChunk(chunk *Chunk) bool

DACert

DACert represents a Data Availability Certificate

DACommitment

DACommitment represents a commitment to data availability

ErasureCodedBlob

ErasureCodedBlob represents an erasure-coded blob

func ApplyErasureCoding(blob *DABlob, config *ErasureConfig) (*ErasureCodedBlob, error)
func (e *ErasureCodedBlob) CanRecover(availableIndices []uint32) bool

ErasureConfig

ErasureConfig configures erasure coding parameters

func DefaultErasureConfig() *ErasureConfig

Sample

Sample represents a random sample for availability verification

Sampler

Sampler handles data availability sampling

func NewSampler(config *SamplingConfig) *Sampler
func (s *Sampler) GenerateSampleIndices(blobID ids.ID, chunkCount uint32, seed []byte) []uint32
func (s *Sampler) VerifySamples(blob *DABlob, samples []*Sample) *SamplingResult

SamplingConfig

SamplingConfig configures DA sampling parameters

func DefaultSamplingConfig() *SamplingConfig

SamplingResult

SamplingResult represents the result of data availability sampling

Store

Store manages DA blob storage and retrieval

func NewStore(db database.Database, config *StoreConfig) *Store
func (s *Store) DeleteBlob(ctx context.Context, blobID ids.ID) error
func (s *Store) GetBlob(ctx context.Context, blobID ids.ID) (*DABlob, error)
func (s *Store) GetCert(ctx context.Context, blobID ids.ID) (*DACert, error)
func (s *Store) GetChunks(ctx context.Context, blobID ids.ID, indices []uint32) ([]*Chunk, error)
func (s *Store) PruneExpired(ctx context.Context) (int, error)
func (s *Store) Stats() map[string]interface{}
func (s *Store) StoreBlob(ctx context.Context, blob *DABlob) error
func (s *Store) StoreCert(ctx context.Context, cert *DACert) error

StoreConfig

StoreConfig configures the DA store

func DefaultStoreConfig() *StoreConfig

Validator

Validator handles DA validation and certification

func NewValidator(store *Store, config *ValidatorConfig) *Validator
func (v *Validator) CalculateConfidence(sampleCount int, successRate float64) float64
func (v *Validator) CertifyAvailability(ctx context.Context, commitment *DACommitment, signature []byte) (*DACert, error)
func (v *Validator) SampleAndVerify(ctx context.Context, blobID ids.ID, seed []byte) (*SamplingResult, error)
func (v *Validator) ValidateBlob(ctx context.Context, blob *DABlob) (*DACommitment, error)
func (v *Validator) VerifyCert(ctx context.Context, cert *DACert) (bool, error)

ValidatorConfig

ValidatorConfig configures the DA validator

func DefaultValidatorConfig() *ValidatorConfig