initialsync

package
v5.0.1-rc.4 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2024 License: GPL-3.0 Imports: 45 Imported by: 0

Documentation

Overview

Package initialsync includes all initial block download and processing logic for the beacon node, using a round robin strategy and a finite-state-machine to handle edge-cases in a beacon node's sync status.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrBatchSignatureMismatch is returned by VerifiedROBlobs when any of the blobs in the batch have a signature
	// which does not match the signature for the block with a corresponding root.
	ErrBatchSignatureMismatch = errors.New("Sidecar block header signature does not match signed block")
	// ErrBlockRootMismatch is returned by VerifiedROBlobs in the scenario where the root of the given signed block
	// does not match the block header in one of the corresponding sidecars.
	ErrBatchBlockRootMismatch = errors.New("Sidecar block header root does not match signed block")
)

Functions

This section is empty.

Types

type BlobBatchVerifier

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

BlobBatchVerifier solves problems that come from verifying batches of blobs from RPC. First: we only update forkchoice after the entire batch has completed, so the n+1 elements in the batch won't be in forkchoice yet. Second: it is more efficient to batch some verifications, like kzg commitment verification. Batch adds a method to BlobVerifier to verify the kzg commitments of all blob sidecars for a block together, then using the cached result of the batch verification when verifying the individual blobs.

func (*BlobBatchVerifier) VerifiedROBlobs

func (batch *BlobBatchVerifier) VerifiedROBlobs(ctx context.Context, blk blocks.ROBlock, scs []blocks.ROBlob) ([]blocks.VerifiedROBlob, error)

type Config

type Config struct {
	P2P                 p2p.P2P
	DB                  db.NoHeadAccessDatabase
	Chain               blockchainService
	StateNotifier       statefeed.Notifier
	BlockNotifier       blockfeed.Notifier
	ClockWaiter         startup.ClockWaiter
	InitialSyncComplete chan struct{}
	BlobStorage         *filesystem.BlobStorage
}

Config to set up the initial sync service.

type Option

type Option func(*Service)

Option is a functional option for the initial-sync Service.

func WithSyncChecker

func WithSyncChecker(checker *SyncChecker) Option

WithSyncChecker registers the initial sync service in the checker.

func WithVerifierWaiter

func WithVerifierWaiter(viw *verification.InitializerWaiter) Option

WithVerifierWaiter sets the verification.InitializerWaiter for the initial-sync Service.

type Service

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

Service service.

func NewService

func NewService(ctx context.Context, cfg *Config, opts ...Option) *Service

NewService configures the initial sync service responsible for bringing the node up to the latest head of the blockchain.

func (*Service) Initialized

func (s *Service) Initialized() bool

Initialized returns true if initial sync has been started.

func (*Service) Resync

func (s *Service) Resync() error

Resync allows a node to start syncing again if it has fallen behind the current network head.

func (*Service) Start

func (s *Service) Start()

Start the initial sync service.

func (*Service) Status

func (s *Service) Status() error

Status of initial sync.

func (*Service) Stop

func (s *Service) Stop() error

Stop initial sync.

func (*Service) Synced

func (s *Service) Synced() bool

Synced returns true if initial sync has been completed.

func (*Service) Syncing

func (s *Service) Syncing() bool

Syncing returns true if initial sync is still running.

type SyncChecker

type SyncChecker struct {
	Svc *Service
}

SyncChecker allows other services to check the current status of initial-sync and use that internally in their service.

func (*SyncChecker) Synced

func (s *SyncChecker) Synced() bool

Synced returns the status of the service.

Directories

Path Synopsis
Package testing includes useful mocks for testing initial sync status in unit tests.
Package testing includes useful mocks for testing initial sync status in unit tests.

Jump to

Keyboard shortcuts

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