checkpoint

package
v5.3.0-rc.0 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2025 License: GPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ComputeWeakSubjectivityCheckpoint added in v5.3.0

func ComputeWeakSubjectivityCheckpoint(ctx context.Context, client *beacon.Client) (*beacon.WeakSubjectivityData, error)

ComputeWeakSubjectivityCheckpoint attempts to use the prysm weak_subjectivity api to obtain the current weak_subjectivity checkpoint. For non-prysm nodes, the same computation will be performed with extra steps, using the head state downloaded from the beacon node api.

Types

type APIInitializer

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

APIInitializer manages initializing the beacon node using checkpoint sync, retrieving the checkpoint state and root from the remote beacon node api.

func NewAPIInitializer

func NewAPIInitializer(beaconNodeHost string) (*APIInitializer, error)

NewAPIInitializer creates an APIInitializer, handling the set up of a beacon node api client using the provided host string.

func (*APIInitializer) Initialize

func (dl *APIInitializer) Initialize(ctx context.Context, d db.Database) error

Initialize downloads origin state and block for checkpoint sync and initializes database records to prepare the node to begin syncing from that point.

type FileInitializer

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

FileInitializer initializes a beacon-node database to use checkpoint sync, using ssz-encoded block and state data stored in files on the local filesystem.

func NewFileInitializer

func NewFileInitializer(blockPath string, statePath string) (*FileInitializer, error)

NewFileInitializer validates the given path information and creates an Initializer which will use the provided state and block files to prepare the node for checkpoint sync.

func (*FileInitializer) Initialize

func (fi *FileInitializer) Initialize(ctx context.Context, d db.Database) error

Initialize is called in the BeaconNode db startup code if an Initializer is present. Initialize does what is needed to prepare the beacon node database for syncing from the weak subjectivity checkpoint.

type Initializer

type Initializer interface {
	Initialize(ctx context.Context, d db.Database) error
}

Initializer describes a type that is able to obtain the checkpoint sync data (BeaconState and SignedBeaconBlock) in some way and perform database setup to prepare the beacon node for syncing from the given checkpoint. See FileInitializer and APIInitializer.

type OriginData added in v5.3.0

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

OriginData represents the BeaconState and ReadOnlySignedBeaconBlock necessary to start an empty Beacon Node using Checkpoint Sync.

func DownloadFinalizedData added in v5.3.0

func DownloadFinalizedData(ctx context.Context, client *beacon.Client) (*OriginData, error)

DownloadFinalizedData downloads the most recently finalized state, and the block most recently applied to that state. This pair can be used to initialize a new beacon node via checkpoint sync.

func (*OriginData) BlockBytes added in v5.3.0

func (o *OriginData) BlockBytes() []byte

BlockBytes returns the ssz-encoded bytes of the downloaded ReadOnlySignedBeaconBlock value.

func (*OriginData) SaveBlock added in v5.3.0

func (o *OriginData) SaveBlock(dir string) (string, error)

SaveBlock saves the downloaded block to a unique file in the given path. For readability and collision avoidance, the file name includes: type, config name, slot and root

func (*OriginData) SaveState added in v5.3.0

func (o *OriginData) SaveState(dir string) (string, error)

SaveState saves the downloaded state to a unique file in the given path. For readability and collision avoidance, the file name includes: type, config name, slot and root

func (*OriginData) StateBytes added in v5.3.0

func (o *OriginData) StateBytes() []byte

StateBytes returns the ssz-encoded bytes of the downloaded BeaconState value.

Jump to

Keyboard shortcuts

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