das

package
v0.4.0-dirty Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2022 License: Apache-2.0 Imports: 13 Imported by: 2

Documentation

Overview

Package das contains the most important functionality provided by celestia-node. It contains logic for running data availability sampling (DAS) routines on block headers in the network. DAS is the process of verifying the availability of block data by sampling chunks or shares of those blocks.

Package das can confirm the availability of block data in the network via the Availability interface which is implemented both in `full` and `light` mode. `Full` availability ensures the full reparation of a block's data square (meaning the instance will sample for enough shares to be able to fully repair the block's data square) while `light` availability samples for shares randomly until it is sufficiently likely that all block data is available as it is assumed that there are enough `light` availability instances active on the network doing sampling over the same block to collectively verify its availability.

The central component of this package is the `DASer`. It performs one basic function: a sampling loop that performs DAS on new ExtendedHeaders in the network. The DASer kicks off this loop by loading its last DASed header (`checkpoint`) and kicking off a `catchUp` loop to DAS all headers between the checkpoint and the current network head. It simultaneously continues to perform DAS over new ExtendedHeaders received via gossipsub.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DASer

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

DASer continuously validates availability of data committed to headers.

func NewDASer

func NewDASer(
	da share.Availability,
	hsub header.Subscriber,
	getter header.Getter,
	cstore datastore.Datastore,
	bcast fraud.Broadcaster,
) *DASer

NewDASer creates a new DASer.

func (*DASer) CatchUpRoutineState added in v0.3.0

func (d *DASer) CatchUpRoutineState() JobInfo

CatchUpRoutineState reports the current state of the DASer's `catchUp` routine.

func (*DASer) SampleRoutineState added in v0.3.0

func (d *DASer) SampleRoutineState() RoutineState

SampleRoutineState reports the current state of the DASer's main sampling routine.

func (*DASer) Start

func (d *DASer) Start(context.Context) error

Start initiates subscription for new ExtendedHeaders and spawns a sampling routine.

func (*DASer) Stop

func (d *DASer) Stop(ctx context.Context) error

Stop stops sampling.

type JobInfo added in v0.3.0

type JobInfo struct {
	Start time.Time `json:"start"`
	End   time.Time `json:"end"`
	Error error     `json:"error"`

	ID     uint64 `json:"id"`
	Height uint64 `json:"height"`
	From   uint64 `json:"from"`
	To     uint64 `json:"to"`
}

JobInfo contains information about a catchUp job.

func (JobInfo) Duration added in v0.3.0

func (ji JobInfo) Duration() time.Duration

func (JobInfo) Finished added in v0.3.0

func (ji JobInfo) Finished() bool

type RoutineState added in v0.3.0

type RoutineState struct {
	// reports if an error has occurred during the routine's
	// sampling process
	Error error `json:"error"`
	// tracks the latest successfully sampled height of the routine
	LatestSampledHeight uint64 `json:"latest_sampled_height"`
	// tracks the square width of the latest successfully sampled
	// height of the routine
	LatestSampledSquareWidth uint64 `json:"latest_sampled_square_width"`
	// tracks whether routine is running
	IsRunning bool `json:"is_running"`
}

RoutineState contains important information about the state of a current sampling routine.

Jump to

Keyboard shortcuts

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