syncer

package
v0.0.0-...-2eef473 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2024 License: LGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

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

Variables

View Source
var (
	ErrCommitteeUpdateHeaderInDifferentSyncPeriod = errors.New("sync committee in different sync period")
	ErrBeaconStateAvailableYet                    = errors.New("beacon state object not available yet")
)

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) FindLatestAttestedHeadersAtInterval

func (s *Syncer) FindLatestAttestedHeadersAtInterval(initialSlot, lowestSlot uint64) (uint64, error)

Sanity check the finalized and attested header are at 32 boundary blocks, so we can download the beacon state

func (*Syncer) FindOldestAttestedHeaderAtInterval

func (s *Syncer) FindOldestAttestedHeaderAtInterval(initialSlot, highestSlot uint64) (uint64, error)

FindOldestAttestedHeaderAtInterval finds a set of headers (finalized and attested headers) that are at 32 boundary blocks (with a sync committee super majority signature), so we can download the beacon state.

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) GetFinalizedUpdate

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

func (*Syncer) GetFinalizedUpdateAtAttestedSlot

func (s *Syncer) GetFinalizedUpdateAtAttestedSlot(attestedSlot uint64, boundary uint64, fetchNextSyncCommittee bool) (scale.Update, error)

func (*Syncer) GetFinalizedUpdateWithSyncCommittee

func (s *Syncer) GetFinalizedUpdateWithSyncCommittee(syncCommitteePeriod, lastFinalizedSlot 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) GetLatestPossibleFinalizedUpdate

func (s *Syncer) GetLatestPossibleFinalizedUpdate(attestedSlot uint64, boundary uint64) (scale.Update, 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)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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