syncer

package
v0.0.0-...-7cdd60a Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2025 License: LGPL-3.0 Imports: 16 Imported by: 1

Documentation

Index

Constants

View Source
const (
	BlockRootGeneralizedIndex            = 37
	FinalizedCheckpointGeneralizedIndex  = 105
	CurrentSyncCommitteeGeneralizedIndex = 54
	NextSyncCommitteeGeneralizedIndex    = 55
	ExecutionPayloadGeneralizedIndex     = 25
)

Variables

View Source
var (
	ErrCommitteeUpdateHeaderInDifferentSyncPeriod = errors.New("sync committee in different sync period")
	ErrBeaconStateUnavailable                     = errors.New("beacon state object not available yet")
	ErrSyncCommitteeNotSuperMajority              = errors.New("update received was not signed by supermajority")
)

Functions

This section is empty.

Types

type Syncer

type Syncer struct {
	Client api.BeaconAPI
	// contains filtered or unexported fields
}

func New

func New(client api.BeaconAPI, store store.BeaconStore, protocol *protocol.Protocol) *Syncer

func (*Syncer) FindBeaconHeaderWithBlockIncluded

func (s *Syncer) FindBeaconHeaderWithBlockIncluded(slot uint64) (state.BeaconBlockHeader, error)

func (*Syncer) FindValidAttestedHeader

func (s *Syncer) FindValidAttestedHeader(minSlot, maxSlot uint64) (uint64, error)

FindValidAttestedHeader Find a valid beacon header attested and finalized header pair.

func (*Syncer) GetBlockRoots

func (s *Syncer) GetBlockRoots(slot uint64) (scale.BlockRootProof, error)

func (*Syncer) GetBlockRootsFromState

func (s *Syncer) GetBlockRootsFromState(beaconState state.BeaconState) (scale.BlockRootProof, error)

func (*Syncer) GetCheckpoint

func (s *Syncer) GetCheckpoint() (scale.BeaconCheckpoint, error)

func (*Syncer) GetCheckpointAtSlot

func (s *Syncer) GetCheckpointAtSlot(slot uint64) (scale.BeaconCheckpoint, error)

func (*Syncer) GetCheckpointFromFile

func (s *Syncer) GetCheckpointFromFile(file string) (scale.BeaconCheckpoint, error)

func (*Syncer) GetFinalizedHeader

func (s *Syncer) GetFinalizedHeader() (scale.BeaconHeader, error)

func (*Syncer) GetFinalizedUpdate

func (s *Syncer) GetFinalizedUpdate() (scale.Update, error)

func (*Syncer) GetFinalizedUpdateAtAttestedSlot

func (s *Syncer) GetFinalizedUpdateAtAttestedSlot(minSlot, maxSlot uint64, fetchNextSyncCommittee bool) (scale.Update, error)

func (*Syncer) GetFinalizedUpdateWithSyncCommittee

func (s *Syncer) GetFinalizedUpdateWithSyncCommittee(syncCommitteePeriod uint64) (scale.Update, error)

func (*Syncer) GetHeaderUpdate

func (s *Syncer) GetHeaderUpdate(blockRoot common.Hash, checkpoint *cache.Proof) (scale.HeaderUpdatePayload, error)

func (*Syncer) GetHeaderUpdateBySlotWithCheckpoint

func (s *Syncer) GetHeaderUpdateBySlotWithCheckpoint(slot uint64, checkpoint *cache.Proof) (scale.HeaderUpdatePayload, error)

func (*Syncer) GetSyncCommitteePeriodUpdate

func (s *Syncer) GetSyncCommitteePeriodUpdate(period uint64, lastFinalizedSlot uint64) (scale.Update, error)

GetSyncCommitteePeriodUpdate fetches a sync committee update from the light client API endpoint. If it fails (typically because it cannot download the finalized header beacon state because the slot does not fall on a 32 slot interval, due to a missed block), it will construct an update manually from data download from the beacon API, or if that is unavailable, use a stored beacon state.

func (*Syncer) GetSyncCommitteePeriodUpdateFromEndpoint

func (s *Syncer) GetSyncCommitteePeriodUpdateFromEndpoint(from uint64) (scale.Update, error)

GetSyncCommitteePeriodUpdateFromEndpoint fetches a sync committee update from the light client API endpoint. If it cannot download the required beacon state from the API, it will look in the data store if the state is stored. If not, it returns an error.

func (*Syncer) HasFinalizedHeaderChanged

func (s *Syncer) HasFinalizedHeaderChanged(finalizedHeader scale.BeaconHeader, lastFinalizedBlockRoot common.Hash) (bool, error)

func (*Syncer) UnmarshalBeaconState

func (s *Syncer) UnmarshalBeaconState(slot uint64, data []byte) (state.BeaconState, error)

func (*Syncer) ValidatePair

func (s *Syncer) ValidatePair(finalizedSlot, attestedSlot uint64, attestedState state.BeaconState) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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