block

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BadEncodingError

type BadEncodingError struct{}

BadEncodingError contains all relevant information to generate a BadEncodingFraudProof.

type Block

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

Block represents the entirety of a Block in the Celestia network. It contains the erasure coded block data as well as its ExtendedHeader.

func (*Block) Commit

func (b *Block) Commit() *core.Commit

Commit returns the commit of the Block.

func (*Block) Data

func (b *Block) Data() *ExtendedBlockData

Data returns the erasure coded data of the Block.

func (*Block) DataSize

func (b *Block) DataSize() uint

DataSize returns the width of the ExtendedBlockData.

func (*Block) Header

func (b *Block) Header() *header.ExtendedHeader

Header returns the ExtendedHeader of the Block.

type ExtendedBlockData

type ExtendedBlockData = rsmt2d.ExtendedDataSquare

ExtendedBlockData is an alias to rsmt2d's ExtendedDataSquare type.

type Fetcher

type Fetcher interface {
	GetBlock(ctx context.Context, height *int64) (*RawBlock, error)
	Commit(ctx context.Context, height *int64) (*core.Commit, error)
	ValidatorSet(ctx context.Context, height *int64) (*core.ValidatorSet, error)
	SubscribeNewBlockEvent(ctx context.Context) (<-chan *RawBlock, error)
	UnsubscribeNewBlockEvent(ctx context.Context) error
}

Fetcher encompasses the behavior necessary to fetch new "raw" blocks.

type RawBlock

type RawBlock = core.Block

RawBlock is an alias to a "raw" Core block. It is "raw" because it is still awaiting erasure coding.

type Service

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

Service represents the Block service that can be started / stopped on a `Full` node. Service contains 4 main functionalities:

  1. Fetching "raw" blocks from either Celestia Core or other Celestia Full nodes.
  2. Erasure coding the "raw" blocks and producing a DataAvailabilityHeader + verifying the Data root.
  3. Storing erasure coded blocks.
  4. Serving erasure coded blocks to other `Full` node peers.

TODO @renaynay: add docs about broadcaster

func NewBlockService

func NewBlockService(fetcher Fetcher, store ipld.DAGService, broadcaster header.Broadcaster) *Service

NewBlockService creates a new instance of block Service.

func (*Service) GetBlockData

func (s *Service) GetBlockData(ctx context.Context, dah *da.DataAvailabilityHeader) (*ExtendedBlockData, error)

func (*Service) Start

func (s *Service) Start(ctx context.Context) error

Start starts the block Service.

func (*Service) Stop

func (s *Service) Stop(ctx context.Context) error

Stop stops the block Service.

func (*Service) StoreBlockData

func (s *Service) StoreBlockData(ctx context.Context, data *ExtendedBlockData) error

Jump to

Keyboard shortcuts

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