Documentation ¶
Overview ¶
TODO(@Wondertan): Instead of doing sampling over the coordinates do a random walk over NMT trees.
Index ¶
- Variables
- func EmptyGetter() (share.Getter, blockservice.BlockService)
- func GetterWithRandSquare(t *testing.T, n int) (share.Getter, *share.Root)
- func Node(dn *availability_test.TestDagNet) *availability_test.TestNode
- func RandNode(dn *availability_test.TestDagNet, squareSize int) (*availability_test.TestNode, *share.Root)
- func SubNetNode(sn *availability_test.SubNet) *availability_test.TestNode
- type Option
- type Parameters
- type Sample
- type ShareAvailability
Constants ¶
This section is empty.
Variables ¶
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 ¶
func EmptyGetter ¶ added in v0.6.2
EmptyGetter provides an unfilled share.Getter with corresponding blockservice.BlockService than can be filled by the test.
func GetterWithRandSquare ¶ added in v0.6.2
GetterWithRandSquare provides a share.Getter filled with 'n' NMT trees of 'n' random shares, essentially storing a whole square.
func Node ¶
func Node(dn *availability_test.TestDagNet) *availability_test.TestNode
Node creates a new empty Light Node.
func RandNode ¶
func RandNode(dn *availability_test.TestDagNet, squareSize int) (*availability_test.TestNode, *share.Root)
RandNode creates a Light Node filled with a random block of the given size.
func SubNetNode ¶
func SubNetNode(sn *availability_test.SubNet) *availability_test.TestNode
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
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 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 share.Getter, opts ...Option, ) *ShareAvailability
NewShareAvailability creates a new light Availability.
func TestAvailability ¶
func TestAvailability(getter share.Getter) *ShareAvailability
func (*ShareAvailability) ProbabilityOfAvailability ¶
func (la *ShareAvailability) ProbabilityOfAvailability(context.Context) float64
ProbabilityOfAvailability calculates the probability that the data square is available based on the amount of samples collected (params.SampleAmount).
Formula: 1 - (0.75 ** amount of samples)
func (*ShareAvailability) SharesAvailable ¶
SharesAvailable randomly samples `params.SampleAmount` amount of Shares committed to the given Root. This way SharesAvailable subjectively verifies that Shares are available.