backfill

package
v4.2.1 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2024 License: GPL-3.0 Imports: 30 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrChainBroken = errors.New("batch is not the ancestor of a known finalized root")

ErrChainBroken indicates a backfill batch can't be imported to the db because it is not known to be the ancestor of the canonical chain.

Functions

This section is empty.

Types

type BeaconDB added in v4.2.1

type BeaconDB interface {
	SaveBackfillStatus(context.Context, *dbval.BackfillStatus) error
	BackfillStatus(context.Context) (*dbval.BackfillStatus, error)
	BackfillFinalizedIndex(ctx context.Context, blocks []blocks.ROBlock, finalizedChildRoot [32]byte) error
	OriginCheckpointBlockRoot(context.Context) ([32]byte, error)
	Block(context.Context, [32]byte) (interfaces.ReadOnlySignedBeaconBlock, error)
	SaveROBlocks(ctx context.Context, blks []blocks.ROBlock, cache bool) error
	StateOrError(ctx context.Context, blockRoot [32]byte) (state.BeaconState, error)
}

BeaconDB describes the set of DB methods that the StatusUpdater type needs to function.

type PeerAssigner added in v4.2.1

type PeerAssigner interface {
	Assign(busy map[peer.ID]bool, n int) ([]peer.ID, error)
}

PeerAssigner describes a type that provides an Assign method, which can assign the best peer to service an RPC request. The Assign method takes a map of peers that should be excluded, allowing the caller to avoid making multiple concurrent requests to the same peer.

type Service added in v4.2.1

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

func NewService added in v4.2.1

func NewService(ctx context.Context, su *Store, cw startup.ClockWaiter, p p2p.P2P, pa PeerAssigner, opts ...ServiceOption) (*Service, error)

NewService initializes the backfill Service. Like all implementations of the Service interface, the service won't begin its runloop until Start() is called.

func (*Service) Start added in v4.2.1

func (s *Service) Start()

Start begins the runloop of backfill.Service in the current goroutine.

func (*Service) Status added in v4.2.1

func (s *Service) Status() error

func (*Service) Stop added in v4.2.1

func (s *Service) Stop() error

type ServiceOption added in v4.2.1

type ServiceOption func(*Service) error

func WithBatchSize added in v4.2.1

func WithBatchSize(n uint64) ServiceOption

func WithEnableBackfill added in v4.2.1

func WithEnableBackfill(enabled bool) ServiceOption

func WithWorkerCount added in v4.2.1

func WithWorkerCount(n int) ServiceOption

type Store added in v4.2.1

type Store struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Store provides a way to update and query the status of a backfill process that may be necessary to track when a node was initialized via checkpoint sync. With checkpoint sync, there will be a gap in node history from genesis until the checkpoint sync origin block. Store provides the means to update the value keeping track of the lower end of the missing block range via the FillFwd() method, to check whether a Slot is missing from the database via the AvailableBlock() method, and to see the current StartGap() and EndGap().

func NewUpdater added in v4.2.1

func NewUpdater(ctx context.Context, store BeaconDB) (*Store, error)

NewUpdater correctly initializes a StatusUpdater value with the required database value.

func (*Store) AvailableBlock added in v4.2.1

func (s *Store) AvailableBlock(sl primitives.Slot) bool

AvailableBlock determines if the given slot is covered by the current chain history. If the slot is <= backfill low slot, or >= backfill high slot, the result is true. If the slot is between the backfill low and high slots, the result is false.

type VerifiedROBlocks added in v4.2.1

type VerifiedROBlocks []blocks.ROBlock

VerifiedROBlocks represents a slice of blocks that have passed signature verification.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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