bootstrap

package
v1.14.1 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2025 License: BSD-3-Clause Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bootstrapper

type Bootstrapper struct {
	Config

	TimeoutRegistrar core.TimeoutRegistrar
	// list of NoOpsHandler for messages dropped by bootstrapper
	core.StateSummaryFrontierHandler
	core.AcceptedStateSummaryHandler
	core.PutHandler
	core.QueryHandler
	core.ChitsHandler
	core.AppHandler
	// contains filtered or unexported fields
}

bootstrapper repeatedly performs the bootstrapping protocol.

  1. Wait until a sufficient amount of stake is connected.
  2. Sample a small number of nodes to get the last accepted block ID
  3. Verify against the full network that the last accepted block ID received in step 2 is an accepted block.
  4. Sync the full ancestry of the last accepted block.
  5. Execute all the fetched blocks that haven't already been executed.
  6. Restart the bootstrapping protocol until the number of blocks being accepted during a bootstrapping round stops decreasing.

Note: Because of step 6, the bootstrapping protocol will generally be performed multiple times.

Invariant: The VM is not guaranteed to be initialized until Start has been called, so it must be guaranteed the VM is not used until after Start.

func New

func New(config Config, onFinished func(ctx context.Context, lastReqID uint32) error) (*Bootstrapper, error)

func (*Bootstrapper) Accepted

func (b *Bootstrapper) Accepted(ctx context.Context, nodeID ids.NodeID, requestID uint32, containerIDs set.Set[ids.ID]) error

func (*Bootstrapper) AcceptedFrontier

func (b *Bootstrapper) AcceptedFrontier(ctx context.Context, nodeID ids.NodeID, requestID uint32, containerID ids.ID) error

func (*Bootstrapper) Ancestors

func (b *Bootstrapper) Ancestors(ctx context.Context, nodeID ids.NodeID, requestID uint32, blks [][]byte) error

Ancestors handles the receipt of multiple containers. Should be received in response to a GetAncestors message to [nodeID] with request ID [requestID]

func (*Bootstrapper) Clear

func (b *Bootstrapper) Clear(context.Context) error

func (*Bootstrapper) Connected

func (b *Bootstrapper) Connected(ctx context.Context, nodeID ids.NodeID, nodeVersion *version.Application) error

func (*Bootstrapper) Context

func (b *Bootstrapper) Context() *consensus.Context

func (*Bootstrapper) Disconnected

func (b *Bootstrapper) Disconnected(ctx context.Context, nodeID ids.NodeID) error

func (*Bootstrapper) GetAcceptedFailed

func (b *Bootstrapper) GetAcceptedFailed(ctx context.Context, nodeID ids.NodeID, requestID uint32) error

func (*Bootstrapper) GetAcceptedFrontierFailed

func (b *Bootstrapper) GetAcceptedFrontierFailed(ctx context.Context, nodeID ids.NodeID, requestID uint32) error

func (*Bootstrapper) GetAncestorsFailed

func (b *Bootstrapper) GetAncestorsFailed(ctx context.Context, nodeID ids.NodeID, requestID uint32) error

func (*Bootstrapper) Gossip

func (*Bootstrapper) Gossip(context.Context) error

func (*Bootstrapper) HealthCheck

func (b *Bootstrapper) HealthCheck(ctx context.Context) (interface{}, error)

func (*Bootstrapper) Notify

func (b *Bootstrapper) Notify(_ context.Context, msg core.Message) error

func (*Bootstrapper) Shutdown

func (b *Bootstrapper) Shutdown(ctx context.Context) error

func (*Bootstrapper) Start

func (b *Bootstrapper) Start(ctx context.Context, startReqID uint32) error

func (*Bootstrapper) Timeout

func (b *Bootstrapper) Timeout() error

type Config

type Config struct {
	core.AllGetsServer

	Ctx     *consensus.Context
	Beacons validators.Manager

	SampleK          int
	StartupTracker   tracker.Startup
	Sender           core.Sender
	BootstrapTracker core.BootstrapTracker

	// PeerTracker manages the set of nodes that we fetch the next block from.
	PeerTracker *p2p.PeerTracker

	// This node will only consider the first [AncestorsMaxContainersReceived]
	// containers in an ancestors message it receives.
	AncestorsMaxContainersReceived int

	// Database used to track the fetched, but not yet executed, blocks during
	// bootstrapping.
	DB db.Database

	VM block.ChainVM

	// NonVerifyingParse parses blocks without verifying them.
	NonVerifyingParse block.ParseFunc

	Bootstrapped func()

	core.Haltable
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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