Documentation ¶
Index ¶
- Variables
- type ForkChoiceStorage
- type ForkChoiceStorageReader
- type ForkChoiceStorageWriter
- type ForkChoiceStore
- func (f *ForkChoiceStore) AddPreverifiedBlobSidecar(blobSidecar *cltypes.BlobSidecar) error
- func (f *ForkChoiceStore) Ancestor(root libcommon.Hash, slot uint64) libcommon.Hash
- func (f *ForkChoiceStore) AnchorSlot() uint64
- func (f *ForkChoiceStore) BlockRewards(root libcommon.Hash) (*eth2.BlockRewardsCollector, bool)
- func (f *ForkChoiceStore) DumpBeaconStateOnDisk(bs *state.CachingBeaconState) error
- func (f *ForkChoiceStore) Engine() execution_client.ExecutionEngine
- func (f *ForkChoiceStore) FinalizedCheckpoint() solid.Checkpoint
- func (f *ForkChoiceStore) FinalizedSlot() uint64
- func (f *ForkChoiceStore) ForkNodes() []ForkNode
- func (f *ForkChoiceStore) GetBalances(blockRoot libcommon.Hash) (solid.Uint64ListSSZ, error)
- func (f *ForkChoiceStore) GetBeaconCommitee(slot, committeeIndex uint64) ([]uint64, error)
- func (f *ForkChoiceStore) GetCurrentParticipationIndicies(blockRoot libcommon.Hash) (*solid.ParticipationBitList, error)
- func (f *ForkChoiceStore) GetEth1Hash(eth2Root libcommon.Hash) libcommon.Hash
- func (f *ForkChoiceStore) GetFinalityCheckpoints(blockRoot libcommon.Hash) (solid.Checkpoint, solid.Checkpoint, solid.Checkpoint, bool)
- func (f *ForkChoiceStore) GetHead(auxilliaryState *state.CachingBeaconState) (libcommon.Hash, uint64, error)
- func (f *ForkChoiceStore) GetHeader(blockRoot libcommon.Hash) (*cltypes.BeaconBlockHeader, bool)
- func (f *ForkChoiceStore) GetInactivitiesScores(blockRoot libcommon.Hash) (solid.Uint64ListSSZ, error)
- func (f *ForkChoiceStore) GetLightClientBootstrap(blockRoot libcommon.Hash) (*cltypes.LightClientBootstrap, bool)
- func (f *ForkChoiceStore) GetLightClientUpdate(period uint64) (*cltypes.LightClientUpdate, bool)
- func (f *ForkChoiceStore) GetPreviousParticipationIndicies(blockRoot libcommon.Hash) (*solid.ParticipationBitList, error)
- func (f *ForkChoiceStore) GetStateAtBlockRoot(blockRoot libcommon.Hash, alwaysCopy bool) (*state2.CachingBeaconState, error)
- func (f *ForkChoiceStore) GetSyncCommittees(period uint64) (*solid.SyncCommittee, *solid.SyncCommittee, bool)
- func (f *ForkChoiceStore) GetValidatorSet(blockRoot libcommon.Hash) (*solid.ValidatorSet, error)
- func (f *ForkChoiceStore) HighestSeen() uint64
- func (f *ForkChoiceStore) IsHeadOptimistic() bool
- func (f *ForkChoiceStore) IsRootOptimistic(root libcommon.Hash) bool
- func (f *ForkChoiceStore) JustifiedCheckpoint() solid.Checkpoint
- func (f *ForkChoiceStore) JustifiedSlot() uint64
- func (f *ForkChoiceStore) LowestAvailableSlot() uint64
- func (f *ForkChoiceStore) NewestLightClientUpdate() *cltypes.LightClientUpdate
- func (f *ForkChoiceStore) OnAttestation(attestation *solid.Attestation, fromBlock bool, insert bool) error
- func (f *ForkChoiceStore) OnAttesterSlashing(attesterSlashing *cltypes.AttesterSlashing, test bool) error
- func (f *ForkChoiceStore) OnBlock(ctx context.Context, block *cltypes.SignedBeaconBlock, ...) error
- func (f *ForkChoiceStore) OnTick(time uint64)
- func (f *ForkChoiceStore) Participation(epoch uint64) (*solid.ParticipationBitList, bool)
- func (f *ForkChoiceStore) PreverifiedHistoricalRoots(blockRoot libcommon.Hash) uint64
- func (f *ForkChoiceStore) PreverifiedHistoricalSummaries(blockRoot libcommon.Hash) uint64
- func (f *ForkChoiceStore) PreverifiedValidator(blockRoot libcommon.Hash) uint64
- func (f *ForkChoiceStore) ProcessAttestingIndicies(attestation *solid.Attestation, attestionIndicies []uint64)
- func (f *ForkChoiceStore) ProposerBoostRoot() libcommon.Hash
- func (f *ForkChoiceStore) RandaoMixes(blockRoot libcommon.Hash, out solid.HashListSSZ) bool
- func (f *ForkChoiceStore) SetSynced(s bool)
- func (f *ForkChoiceStore) Slot() uint64
- func (f *ForkChoiceStore) Synced() bool
- func (f *ForkChoiceStore) Time() uint64
- func (f *ForkChoiceStore) TotalActiveBalance(root libcommon.Hash) (uint64, bool)
- func (f *ForkChoiceStore) ValidateOnAttestation(attestation *solid.Attestation) error
- type ForkNode
- type LatestMessage
Constants ¶
This section is empty.
Variables ¶
var ErrEIP4844DataNotAvailable = errors.New("EIP-4844 blob data is not available")
var (
ErrIgnore = errors.New("ignore")
)
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 LowestAvailableSlot() uint64 GetEth1Hash(eth2Root common.Hash) common.Hash GetHead(auxilliaryState *state.CachingBeaconState) (common.Hash, uint64, error) HighestSeen() uint64 JustifiedCheckpoint() solid.Checkpoint JustifiedSlot() uint64 ProposerBoostRoot() common.Hash GetStateAtBlockRoot( blockRoot libcommon.Hash, alwaysCopy bool, ) (*state.CachingBeaconState, error) GetFinalityCheckpoints( blockRoot libcommon.Hash, ) (solid.Checkpoint, solid.Checkpoint, solid.Checkpoint, bool) GetSyncCommittees(period uint64) (*solid.SyncCommittee, *solid.SyncCommittee, bool) GetBeaconCommitee(slot, committeeIndex uint64) ([]uint64, error) Slot() uint64 Time() uint64 Participation(epoch uint64) (*solid.ParticipationBitList, bool) RandaoMixes(blockRoot libcommon.Hash, out solid.HashListSSZ) bool BlockRewards(root libcommon.Hash) (*eth2.BlockRewardsCollector, bool) TotalActiveBalance(root libcommon.Hash) (uint64, bool) ForkNodes() []ForkNode Synced() bool GetLightClientBootstrap(blockRoot libcommon.Hash) (*cltypes.LightClientBootstrap, bool) NewestLightClientUpdate() *cltypes.LightClientUpdate GetLightClientUpdate(period uint64) (*cltypes.LightClientUpdate, bool) GetHeader(blockRoot libcommon.Hash) (*cltypes.BeaconBlockHeader, bool) GetBalances(blockRoot libcommon.Hash) (solid.Uint64ListSSZ, error) GetInactivitiesScores(blockRoot libcommon.Hash) (solid.Uint64ListSSZ, error) GetPreviousParticipationIndicies(blockRoot libcommon.Hash) (*solid.ParticipationBitList, error) GetValidatorSet(blockRoot libcommon.Hash) (*solid.ValidatorSet, error) GetCurrentParticipationIndicies(blockRoot libcommon.Hash) (*solid.ParticipationBitList, error) ValidateOnAttestation(attestation *solid.Attestation) error IsRootOptimistic(root common.Hash) bool IsHeadOptimistic() bool }
type ForkChoiceStorageWriter ¶
type ForkChoiceStorageWriter interface { OnAttestation(attestation *solid.Attestation, fromBlock, insert bool) error OnAttesterSlashing(attesterSlashing *cltypes.AttesterSlashing, test bool) error OnBlock( ctx context.Context, block *cltypes.SignedBeaconBlock, newPayload bool, fullValidation bool, checkDataAvaibility bool, ) error AddPreverifiedBlobSidecar(blobSidecar *cltypes.BlobSidecar) error OnTick(time uint64) SetSynced(synced bool) ProcessAttestingIndicies(attestation *solid.Attestation, attestionIndicies []uint64) }
type ForkChoiceStore ¶
type ForkChoiceStore struct {
// contains filtered or unexported fields
}
func NewForkChoiceStore ¶
func NewForkChoiceStore( ethClock eth_clock.EthereumClock, anchorState *state2.CachingBeaconState, engine execution_client.ExecutionEngine, operationsPool pool.OperationsPool, forkGraph fork_graph.ForkGraph, emitters *beaconevents.EventEmitter, syncedDataManager *synced_data.SyncedDataManager, blobStorage blob_storage.BlobStorage, validatorMonitor monitor.ValidatorMonitor, probabilisticHeadGetter bool, ) (*ForkChoiceStore, error)
NewForkChoiceStore initialize a new store from the given anchor state, either genesis or checkpoint sync state.
func (*ForkChoiceStore) AddPreverifiedBlobSidecar ¶
func (f *ForkChoiceStore) AddPreverifiedBlobSidecar(blobSidecar *cltypes.BlobSidecar) error
func (*ForkChoiceStore) AnchorSlot ¶
func (f *ForkChoiceStore) AnchorSlot() uint64
FinalizedCheckpoint returns justified checkpoint
func (*ForkChoiceStore) BlockRewards ¶
func (f *ForkChoiceStore) BlockRewards(root libcommon.Hash) (*eth2.BlockRewardsCollector, bool)
func (*ForkChoiceStore) DumpBeaconStateOnDisk ¶
func (f *ForkChoiceStore) DumpBeaconStateOnDisk(bs *state.CachingBeaconState) error
func (*ForkChoiceStore) Engine ¶
func (f *ForkChoiceStore) Engine() execution_client.ExecutionEngine
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) ForkNodes ¶
func (f *ForkChoiceStore) ForkNodes() []ForkNode
func (*ForkChoiceStore) GetBalances ¶
func (f *ForkChoiceStore) GetBalances(blockRoot libcommon.Hash) (solid.Uint64ListSSZ, error)
func (*ForkChoiceStore) GetBeaconCommitee ¶
func (f *ForkChoiceStore) GetBeaconCommitee(slot, committeeIndex uint64) ([]uint64, error)
func (*ForkChoiceStore) GetCurrentParticipationIndicies ¶
func (f *ForkChoiceStore) GetCurrentParticipationIndicies(blockRoot libcommon.Hash) (*solid.ParticipationBitList, error)
func (*ForkChoiceStore) GetEth1Hash ¶
func (f *ForkChoiceStore) GetEth1Hash(eth2Root libcommon.Hash) libcommon.Hash
FinalizedCheckpoint returns justified checkpoint
func (*ForkChoiceStore) GetFinalityCheckpoints ¶
func (f *ForkChoiceStore) GetFinalityCheckpoints(blockRoot libcommon.Hash) (solid.Checkpoint, solid.Checkpoint, solid.Checkpoint, bool)
func (*ForkChoiceStore) GetHead ¶
func (f *ForkChoiceStore) GetHead(auxilliaryState *state.CachingBeaconState) (libcommon.Hash, uint64, error)
GetHead returns the head of the fork choice store. it can take an optional auxilliary state to determine the current weights instead of computing the justified state.
func (*ForkChoiceStore) GetHeader ¶
func (f *ForkChoiceStore) GetHeader(blockRoot libcommon.Hash) (*cltypes.BeaconBlockHeader, bool)
func (*ForkChoiceStore) GetInactivitiesScores ¶
func (f *ForkChoiceStore) GetInactivitiesScores(blockRoot libcommon.Hash) (solid.Uint64ListSSZ, error)
func (*ForkChoiceStore) GetLightClientBootstrap ¶
func (f *ForkChoiceStore) GetLightClientBootstrap(blockRoot libcommon.Hash) (*cltypes.LightClientBootstrap, bool)
func (*ForkChoiceStore) GetLightClientUpdate ¶
func (f *ForkChoiceStore) GetLightClientUpdate(period uint64) (*cltypes.LightClientUpdate, bool)
func (*ForkChoiceStore) GetPreviousParticipationIndicies ¶
func (f *ForkChoiceStore) GetPreviousParticipationIndicies(blockRoot libcommon.Hash) (*solid.ParticipationBitList, error)
func (*ForkChoiceStore) GetStateAtBlockRoot ¶
func (f *ForkChoiceStore) GetStateAtBlockRoot(blockRoot libcommon.Hash, alwaysCopy bool) (*state2.CachingBeaconState, error)
func (*ForkChoiceStore) GetSyncCommittees ¶
func (f *ForkChoiceStore) GetSyncCommittees(period uint64) (*solid.SyncCommittee, *solid.SyncCommittee, bool)
func (*ForkChoiceStore) GetValidatorSet ¶
func (f *ForkChoiceStore) GetValidatorSet(blockRoot libcommon.Hash) (*solid.ValidatorSet, error)
func (*ForkChoiceStore) HighestSeen ¶
func (f *ForkChoiceStore) HighestSeen() uint64
Highest seen returns highest seen slot
func (*ForkChoiceStore) IsHeadOptimistic ¶
func (f *ForkChoiceStore) IsHeadOptimistic() bool
func (*ForkChoiceStore) IsRootOptimistic ¶
func (f *ForkChoiceStore) IsRootOptimistic(root libcommon.Hash) bool
func (*ForkChoiceStore) JustifiedCheckpoint ¶
func (f *ForkChoiceStore) JustifiedCheckpoint() solid.Checkpoint
JustifiedCheckpoint returns justified checkpoint
func (*ForkChoiceStore) JustifiedSlot ¶
func (f *ForkChoiceStore) JustifiedSlot() uint64
FinalizedCheckpoint returns justified checkpoint
func (*ForkChoiceStore) LowestAvailableSlot ¶
func (f *ForkChoiceStore) LowestAvailableSlot() uint64
func (*ForkChoiceStore) NewestLightClientUpdate ¶
func (f *ForkChoiceStore) NewestLightClientUpdate() *cltypes.LightClientUpdate
func (*ForkChoiceStore) OnAttestation ¶
func (f *ForkChoiceStore) OnAttestation( attestation *solid.Attestation, fromBlock bool, insert 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(ctx context.Context, block *cltypes.SignedBeaconBlock, newPayload, fullValidation, checkDataAvaiability bool) error
func (*ForkChoiceStore) OnTick ¶
func (f *ForkChoiceStore) OnTick(time uint64)
OnTick executes on_tick operation for forkchoice.
func (*ForkChoiceStore) Participation ¶
func (f *ForkChoiceStore) Participation(epoch uint64) (*solid.ParticipationBitList, bool)
func (*ForkChoiceStore) PreverifiedHistoricalRoots ¶
func (f *ForkChoiceStore) PreverifiedHistoricalRoots(blockRoot libcommon.Hash) uint64
func (*ForkChoiceStore) PreverifiedHistoricalSummaries ¶
func (f *ForkChoiceStore) PreverifiedHistoricalSummaries(blockRoot libcommon.Hash) uint64
func (*ForkChoiceStore) PreverifiedValidator ¶
func (f *ForkChoiceStore) PreverifiedValidator(blockRoot libcommon.Hash) uint64
func (*ForkChoiceStore) ProcessAttestingIndicies ¶
func (f *ForkChoiceStore) ProcessAttestingIndicies( attestation *solid.Attestation, attestionIndicies []uint64, )
func (*ForkChoiceStore) ProposerBoostRoot ¶
func (f *ForkChoiceStore) ProposerBoostRoot() libcommon.Hash
ProposerBoostRoot returns proposer boost root
func (*ForkChoiceStore) RandaoMixes ¶
func (f *ForkChoiceStore) RandaoMixes(blockRoot libcommon.Hash, out solid.HashListSSZ) bool
func (*ForkChoiceStore) SetSynced ¶
func (f *ForkChoiceStore) SetSynced(s bool)
func (*ForkChoiceStore) Slot ¶
func (f *ForkChoiceStore) Slot() uint64
Slot calculates the current slot number using the time and genesis slot.
func (*ForkChoiceStore) Synced ¶
func (f *ForkChoiceStore) Synced() bool
func (*ForkChoiceStore) TotalActiveBalance ¶
func (f *ForkChoiceStore) TotalActiveBalance(root libcommon.Hash) (uint64, bool)
func (*ForkChoiceStore) ValidateOnAttestation ¶
func (f *ForkChoiceStore) ValidateOnAttestation(attestation *solid.Attestation) error
type ForkNode ¶
type ForkNode struct { Slot uint64 `json:"slot,string"` BlockRoot libcommon.Hash `json:"block_root"` ParentRoot libcommon.Hash `json:"parent_root"` JustifiedEpoch uint64 `json:"justified_epoch,string"` FinalizedEpoch uint64 `json:"finalized_epoch,string"` Weight uint64 `json:"weight,string"` Validity string `json:"validity"` ExecutionBlock libcommon.Hash `json:"execution_block_hash"` }
ForkNode is a struct that represents a node in the fork choice tree.