fork_graph

package
v0.0.0-...-ff78b6e Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2023 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrStateNotFound = errors.New("state not found")

Functions

This section is empty.

Types

type ChainSegmentInsertionResult

type ChainSegmentInsertionResult uint
const (
	Success        ChainSegmentInsertionResult = 0
	InvalidBlock   ChainSegmentInsertionResult = 1
	MissingSegment ChainSegmentInsertionResult = 2
	BelowAnchor    ChainSegmentInsertionResult = 3
	LogisticError  ChainSegmentInsertionResult = 4
	PreValidated   ChainSegmentInsertionResult = 5
)

type ForkGraph

type ForkGraph interface {
	AddChainSegment(signedBlock *cltypes.SignedBeaconBlock, fullValidation bool) (*state.CachingBeaconState, ChainSegmentInsertionResult, error)
	GetHeader(blockRoot libcommon.Hash) (*cltypes.BeaconBlockHeader, bool)
	GetState(blockRoot libcommon.Hash, alwaysCopy bool) (*state.CachingBeaconState, error)
	GetCurrentJustifiedCheckpoint(blockRoot libcommon.Hash) (solid.Checkpoint, bool)
	GetFinalizedCheckpoint(blockRoot libcommon.Hash) (solid.Checkpoint, bool)
	MarkHeaderAsInvalid(blockRoot libcommon.Hash)
	AnchorSlot() uint64
	Prune(uint64) error
}

* The state store process is related to graph theory in the sense that the Ethereum blockchain can be thought of as a directed graph, * where each block represents a node and the links between blocks represent directed edges. * In this context, rolling back the state of Ethereum to a previous state can be thought of as traversing the graph in reverse, * from the current state to a previous state. * The process of reverting the state involves undoing the changes made in the blocks that have been added to the blockchain since the previous state. * This can be thought of as "reversing the edges" in the graph, effectively undoing the changes made to the state of Ethereum. * By thinking of the Ethereum blockchain as a graph, we can use graph theory concepts, such as traversal algorithms, * to analyze and manipulate the state of the blockchain.

func NewForkGraphDisk

func NewForkGraphDisk(anchorState *state.CachingBeaconState, aferoFs afero.Fs) ForkGraph

Initialize fork graph with a new state

Jump to

Keyboard shortcuts

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