light

package
v0.20.4-test3 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultSampleAmount uint = 16
)

SampleAmount specifies the minimum required amount of samples a light node must perform before declaring that a block is available

Functions

This section is empty.

Types

type Option added in v0.9.3

type Option func(*Parameters)

Option is a function that configures light availability Parameters

func WithSampleAmount added in v0.9.3

func WithSampleAmount(sampleAmount uint) Option

WithSampleAmount is a functional option that the Availability interface implementers use to set the SampleAmount configuration param

type Parameters added in v0.9.3

type Parameters struct {
	SampleAmount uint // The minimum required amount of samples to perform
}

Parameters is the set of Parameters that must be configured for the light availability implementation

func DefaultParameters added in v0.9.3

func DefaultParameters() *Parameters

DefaultParameters returns the default Parameters' configuration values for the light availability implementation

func (*Parameters) Validate added in v0.9.3

func (p *Parameters) Validate() error

Validate validates the values in Parameters

type SamplingResult added in v0.20.2

type SamplingResult struct {
	Available []shwap.SampleCoords `json:"available"`
	Remaining []shwap.SampleCoords `json:"remaining"`
}

SamplingResult holds the available and remaining samples.

func NewSamplingResult added in v0.20.2

func NewSamplingResult(squareSize, sampleCount int) *SamplingResult

NewSamplingResult creates a new SamplingResult with randomly selected samples.

type ShareAvailability

type ShareAvailability struct {
	// contains filtered or unexported fields
}

ShareAvailability implements share.Availability using Data Availability Sampling technique. It is light because it does not require the downloading of all the data to verify its availability. It is assumed that there are a lot of lightAvailability instances on the network doing sampling over the same Root to collectively verify its availability.

func NewShareAvailability

func NewShareAvailability(
	getter shwap.Getter,
	ds datastore.Batching,
	bs blockstore.Blockstore,
	opts ...Option,
) *ShareAvailability

NewShareAvailability creates a new light Availability.

func (*ShareAvailability) Close added in v0.11.0

func (la *ShareAvailability) Close(ctx context.Context) error

Close flushes all queued writes to disk.

func (*ShareAvailability) Prune added in v0.20.2

Prune deletes samples and all sampling data corresponding to provided header from store. The operation will remove all data that ShareAvailable might have created

func (*ShareAvailability) SharesAvailable

func (la *ShareAvailability) SharesAvailable(ctx context.Context, header *header.ExtendedHeader) error

SharesAvailable randomly samples `params.SampleAmount` amount of Shares committed to the given ExtendedHeader. This way SharesAvailable subjectively verifies that Shares are available.

Jump to

Keyboard shortcuts

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