common

package
v0.34.0-crescendo-prev... Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindHeightsByCheckpoints

func FindHeightsByCheckpoints(
	logger zerolog.Logger,
	headers storage.Headers,
	seals storage.Seals,
	checkpointFilePath string,
	blocksToSkip uint,
	startHeight uint64,
	endHeight uint64,
) (
	uint64,
	flow.StateCommitment,
	uint64,
	error,
)

FindHeightsByCheckpoints finds the sealed height that produces the state commitment included in the checkpoint file.

func GenerateProtocolSnapshotForCheckpoint

func GenerateProtocolSnapshotForCheckpoint(
	logger zerolog.Logger,
	state protocol.State,
	headers storage.Headers,
	seals storage.Seals,
	checkpointDir string,
	blocksToSkip uint,
) (protocol.Snapshot, uint64, flow.StateCommitment, error)

GenerateProtocolSnapshotForCheckpoint finds a sealed block that produces the state commitment contained in the latest checkpoint file, and return a protocol snapshot for the finalized block that seals the sealed block. The returned protocol snapshot can be used for dynamic bootstrapping an execution node along with the latest checkpoint file.

When finding a sealed block it iterates backwards through each sealed height from the last sealed height, and see if the state commitment matches with one of the state commitments contained in the checkpoint file. However, the iteration could be slow, in order to speed up the iteration, we can skip some blocks each time. Since a checkpoint file usually contains 500 tries, which might cover around 250 blocks (assuming 2 tries per block), then skipping 10 blocks each time will still allow us to find the sealed block while not missing the height contained by the checkpoint file. So the blocksToSkip parameter is used to skip some blocks each time when iterating the sealed heights.

func GenerateProtocolSnapshotForCheckpointWithHeights

func GenerateProtocolSnapshotForCheckpointWithHeights(
	logger zerolog.Logger,
	state protocol.State,
	headers storage.Headers,
	seals storage.Seals,
	checkpointDir string,
	blocksToSkip uint,
	endHeight uint64,
) (protocol.Snapshot, uint64, flow.StateCommitment, error)

GenerateProtocolSnapshotForCheckpointWithHeights does the same thing as GenerateProtocolSnapshotForCheckpoint except that it allows the caller to specify the end height of the sealed block that we iterate backwards from.

Types

This section is empty.

Jump to

Keyboard shortcuts

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