fork_graph

package
v0.0.0-...-92d349b Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

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 struct {
	// contains filtered or unexported fields
}

ForkGraph is our graph for ETH 2.0 consensus forkchoice. Each node is a (block root, changes) pair and each edge is the path described as (prevBlockRoot, currBlockRoot). if we want to go forward we use blocks.

func New

func New(anchorState *state.BeaconState) *ForkGraph

Initialize fork graph with a new state

func (*ForkGraph) AddChainSegment

func (f *ForkGraph) AddChainSegment(signedBlock *cltypes.SignedBeaconBlock) (ChainSegmentInsertionResult, error)

Add a new node and edge to the graph

func (*ForkGraph) Config

func (f *ForkGraph) Config() *clparams.BeaconChainConfig

func (*ForkGraph) GenesisTime

func (f *ForkGraph) GenesisTime() uint64

func (*ForkGraph) GetChildren

func (f *ForkGraph) GetChildren(parent libcommon.Hash) []libcommon.Hash

GetChildren retrieves the children block root of the given block root.

func (*ForkGraph) GetCurrentJustifiedCheckpoint

func (f *ForkGraph) GetCurrentJustifiedCheckpoint(blockRoot libcommon.Hash) (*cltypes.Checkpoint, bool)

func (*ForkGraph) GetFinalizedCheckpoint

func (f *ForkGraph) GetFinalizedCheckpoint(blockRoot libcommon.Hash) (*cltypes.Checkpoint, bool)

func (*ForkGraph) GetHeader

func (f *ForkGraph) GetHeader(blockRoot libcommon.Hash) (*cltypes.BeaconBlockHeader, bool)

func (*ForkGraph) GetState

func (f *ForkGraph) GetState(blockRoot libcommon.Hash) (*state.BeaconState, error)

func (*ForkGraph) LastState

func (f *ForkGraph) LastState() *state.BeaconState

LastState returns the last state.

Jump to

Keyboard shortcuts

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