light_client

package
v6.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2025 License: GPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const ErrNotEnoughSyncCommitteeBits = "sync committee bits count is less than required"

Variables

This section is empty.

Functions

func ComputeTransactionsRoot

func ComputeTransactionsRoot(payload interfaces.ExecutionData) ([]byte, error)

func ComputeWithdrawalsRoot

func ComputeWithdrawalsRoot(payload interfaces.ExecutionData) ([]byte, error)

func CreateDefaultLightClientUpdate

func CreateDefaultLightClientUpdate(currentSlot primitives.Slot, attestedState state.BeaconState) (interfaces.LightClientUpdate, error)

func HasFinality

func HasFinality(update interfaces.LightClientUpdate) (bool, error)

func HasRelevantSyncCommittee

func HasRelevantSyncCommittee(update interfaces.LightClientUpdate) (bool, error)

func IsBetterUpdate

func IsBetterUpdate(newUpdate, oldUpdate interfaces.LightClientUpdate) (bool, error)

func NewLightClientUpdateFromBeaconState

func NewLightClientUpdateFromBeaconState(
	ctx context.Context,
	currentSlot primitives.Slot,
	state state.BeaconState,
	block interfaces.ReadOnlySignedBeaconBlock,
	attestedState state.BeaconState,
	attestedBlock interfaces.ReadOnlySignedBeaconBlock,
	finalizedBlock interfaces.ReadOnlySignedBeaconBlock) (interfaces.LightClientUpdate, error)

To form a LightClientUpdate, the following historical states and blocks are needed:

  • state: the post state of any block with a post-Altair parent block
  • block: the corresponding block
  • attested_state: the post state of attested_block
  • attested_block: the block referred to by block.parent_root
  • finalized_block: the block referred to by attested_state.finalized_checkpoint.root, if locally available (may be unavailable, e.g., when using checkpoint sync, or if it was pruned locally)

Types

type Store

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

func (*Store) LastFinalityUpdate

func (s *Store) LastFinalityUpdate() interfaces.LightClientFinalityUpdate

func (*Store) LastOptimisticUpdate

func (s *Store) LastOptimisticUpdate() interfaces.LightClientOptimisticUpdate

func (*Store) SetLastFinalityUpdate

func (s *Store) SetLastFinalityUpdate(update interfaces.LightClientFinalityUpdate)

func (*Store) SetLastOptimisticUpdate

func (s *Store) SetLastOptimisticUpdate(update interfaces.LightClientOptimisticUpdate)

Jump to

Keyboard shortcuts

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