forkchoice

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: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ForkChoiceStorage

type ForkChoiceStorage interface {
	ForkChoiceStorageWriter
	ForkChoiceStorageReader
}

type ForkChoiceStorageReader

type ForkChoiceStorageReader interface {
	Ancestor(root common.Hash, slot uint64) common.Hash
	AnchorSlot() uint64
	Engine() execution_client.ExecutionEngine
	FinalizedCheckpoint() solid.Checkpoint
	FinalizedSlot() uint64
	GetEth1Hash(eth2Root common.Hash) common.Hash
	GetHead() (common.Hash, uint64, error)
	HighestSeen() uint64
	JustifiedCheckpoint() solid.Checkpoint
	ProposerBoostRoot() common.Hash
	GetFullState(libcommon.Hash, bool) (*state2.CachingBeaconState, error)
	Slot() uint64
	Time() uint64
}

type ForkChoiceStorageWriter

type ForkChoiceStorageWriter interface {
	OnAttestation(attestation *solid.Attestation, fromBlock bool) error
	OnAttesterSlashing(attesterSlashing *cltypes.AttesterSlashing, test bool) error
	OnBlock(block *cltypes.SignedBeaconBlock, newPayload bool, fullValidation bool) error
	OnTick(time uint64)
}

type ForkChoiceStore

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

func NewForkChoiceStore

func NewForkChoiceStore(ctx context.Context, anchorState *state2.CachingBeaconState, engine execution_client.ExecutionEngine, recorder freezer.Freezer, operationsPool pool.OperationsPool, forkGraph fork_graph.ForkGraph) (*ForkChoiceStore, error)

NewForkChoiceStore initialize a new store from the given anchor state, either genesis or checkpoint sync state.

func (*ForkChoiceStore) AdvanceHighestSeen

func (f *ForkChoiceStore) AdvanceHighestSeen(n uint64) uint64

AdvanceHighestSeen advances the highest seen block by n and returns the new slot after the change

func (*ForkChoiceStore) Ancestor

func (f *ForkChoiceStore) Ancestor(root libcommon.Hash, slot uint64) libcommon.Hash

Ancestor returns the ancestor to the given root.

func (*ForkChoiceStore) AnchorSlot

func (f *ForkChoiceStore) AnchorSlot() uint64

FinalizedCheckpoint returns justified checkpoint

func (*ForkChoiceStore) Engine

FinalizedCheckpoint returns justified checkpoint

func (*ForkChoiceStore) FinalizedCheckpoint

func (f *ForkChoiceStore) FinalizedCheckpoint() solid.Checkpoint

FinalizedCheckpoint returns justified checkpoint

func (*ForkChoiceStore) FinalizedSlot

func (f *ForkChoiceStore) FinalizedSlot() uint64

FinalizedCheckpoint returns justified checkpoint

func (*ForkChoiceStore) GetEth1Hash

func (f *ForkChoiceStore) GetEth1Hash(eth2Root libcommon.Hash) libcommon.Hash

FinalizedCheckpoint returns justified checkpoint

func (*ForkChoiceStore) GetFullState

func (f *ForkChoiceStore) GetFullState(blockRoot libcommon.Hash, alwaysCopy bool) (*state2.CachingBeaconState, error)

func (*ForkChoiceStore) GetHead

func (f *ForkChoiceStore) GetHead() (libcommon.Hash, uint64, error)

GetHead fetches the current head.

func (*ForkChoiceStore) HighestSeen

func (f *ForkChoiceStore) HighestSeen() uint64

Highest seen returns highest seen slot

func (*ForkChoiceStore) JustifiedCheckpoint

func (f *ForkChoiceStore) JustifiedCheckpoint() solid.Checkpoint

JustifiedCheckpoint returns justified checkpoint

func (*ForkChoiceStore) OnAttestation

func (f *ForkChoiceStore) OnAttestation(attestation *solid.Attestation, fromBlock bool) error

OnAttestation processes incoming attestations.

func (*ForkChoiceStore) OnAttesterSlashing

func (f *ForkChoiceStore) OnAttesterSlashing(attesterSlashing *cltypes.AttesterSlashing, test bool) error

func (*ForkChoiceStore) OnBlock

func (f *ForkChoiceStore) OnBlock(block *cltypes.SignedBeaconBlock, newPayload, fullValidation bool) error

func (*ForkChoiceStore) OnBlsToExecutionChange

func (f *ForkChoiceStore) OnBlsToExecutionChange(signedChange *cltypes.SignedBLSToExecutionChange, test bool) error

func (*ForkChoiceStore) OnProposerSlashing

func (f *ForkChoiceStore) OnProposerSlashing(proposerSlashing *cltypes.ProposerSlashing, test bool) (err error)

OnProposerSlashing is a non-official handler for proposer slashing operations. it pushes the proposer slashing in the pool.

func (*ForkChoiceStore) OnTick

func (f *ForkChoiceStore) OnTick(time uint64)

OnTick executes on_tick operation for forkchoice.

func (*ForkChoiceStore) OnVoluntaryExit

func (f *ForkChoiceStore) OnVoluntaryExit(signedVoluntaryExit *cltypes.SignedVoluntaryExit, test bool) error

OnVoluntaryExit is a non-official handler for voluntary exit operations. it pushes the voluntary exit in the pool.

func (*ForkChoiceStore) PreverifiedValidator

func (f *ForkChoiceStore) PreverifiedValidator(blockRoot libcommon.Hash) uint64

Highest seen returns highest seen slot

func (*ForkChoiceStore) ProposerBoostRoot

func (f *ForkChoiceStore) ProposerBoostRoot() libcommon.Hash

ProposerBoostRoot returns proposer boost root

func (*ForkChoiceStore) Slot

func (f *ForkChoiceStore) Slot() uint64

Slot calculates the current slot number using the time and genesis slot.

func (*ForkChoiceStore) Time

func (f *ForkChoiceStore) Time() uint64

Time returns current time

type LatestMessage

type LatestMessage struct {
	Epoch uint64
	Root  libcommon.Hash
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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