beacon

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2025 License: MIT Imports: 11 Imported by: 5

Documentation

Index

Constants

View Source
const (
	BEACON_BLOCK_HEADER_NUM_FIELDS = uint64(5)

	BEACON_BLOCK_HEADER_TREE_HEIGHT  = uint64(3)
	BEACON_STATE_TREE_HEIGHT_DENEB   = uint64(5)
	BEACON_STATE_TREE_HEIGHT_ELECTRA = uint64(6)
	BEACON_STATE_TREE_HEIGHT_FULU    = uint64(6)
	BALANCE_TREE_HEIGHT              = uint64(38)
	VALIDATOR_TREE_HEIGHT            = uint64(40)

	STATE_ROOT_INDEX = uint64(3)

	VALIDATORS_INDEX = uint64(11)
	BALANCES_INDEX   = uint64(12)

	VALIDATOR_FIELDS_LENGTH = uint64(8)

	VALIDATOR_PUBKEY_INDEX                 = uint64(0)
	VALIDATOR_WITHDRAWAL_CREDENTIALS_INDEX = uint64(1)
	VALIDATOR_BALANCE_INDEX                = uint64(2)
	VALIDATOR_SLASHED_INDEX                = uint64(3)
	VALIDATOR_EXIT_EPOCH_INDEX             = uint64(6)

	SECONDS_PER_SLOT  = uint64(12)
	SLOTS_PER_EPOCH   = uint64(32)
	SECONDS_PER_EPOCH = SECONDS_PER_SLOT * SLOTS_PER_EPOCH

	FAR_FUTURE_EPOCH = ^uint64(0)
	UINT64_MASK      = 0xffffffffffffffff
)

Variables

This section is empty.

Functions

func ComputeValidatorBalancesTreeLeaves

func ComputeValidatorBalancesTreeLeaves(balances []phase0.Gwei) []phase0.Root

func ComputeValidatorTreeLeaves

func ComputeValidatorTreeLeaves(validators []*phase0.Validator) ([]phase0.Root, error)

func CreateVersionedSignedBlock

func CreateVersionedSignedBlock(block interface{}) (spec.VersionedSignedBeaconBlock, error)

func CreateVersionedState

func CreateVersionedState(state interface{}) (spec.VersionedBeaconState, error)

func GetBalanceRoots

func GetBalanceRoots(balances []phase0.Gwei) ([]phase0.Root, error)

func GetBlockHeaderFieldRoots

func GetBlockHeaderFieldRoots(blockHeader *phase0.BeaconBlockHeader) ([]phase0.Root, error)

func GetGenesisTime

func GetGenesisTime(state *spec.VersionedBeaconState) (uint64, error)

func GetValidatorBalancesProofDepth

func GetValidatorBalancesProofDepth(numBalances int) uint64

func MarshalSSZVersionedBeaconState

func MarshalSSZVersionedBeaconState(beaconState spec.VersionedBeaconState) ([]byte, error)

func ProveBeaconTopLevelRootAgainstBeaconState

func ProveBeaconTopLevelRootAgainstBeaconState(beaconTopLevelRoots *VersionedBeaconStateTopLevelRoots, index uint64) (common.Proof, error)

func ProveValidatorBalanceAgainstValidatorBalanceList

func ProveValidatorBalanceAgainstValidatorBalanceList(balances []phase0.Gwei, validatorIndex uint64) (phase0.Root, common.Proof, error)

func UnmarshalSSZVersionedBeaconState

func UnmarshalSSZVersionedBeaconState(data []byte) (*spec.VersionedBeaconState, error)

Types

type BeaconStateTopLevelRootsDeneb added in v1.5.0

type BeaconStateTopLevelRootsDeneb struct {
	GenesisTimeRoot                  *phase0.Root
	GenesisValidatorsRoot            *phase0.Root
	SlotRoot                         *phase0.Root
	ForkRoot                         *phase0.Root
	LatestBlockHeaderRoot            *phase0.Root
	BlockRootsRoot                   *phase0.Root
	StateRootsRoot                   *phase0.Root
	HistoricalRootsRoot              *phase0.Root
	ETH1DataRoot                     *phase0.Root
	ETH1DataVotesRoot                *phase0.Root
	ETH1DepositIndexRoot             *phase0.Root
	ValidatorsRoot                   *phase0.Root
	BalancesRoot                     *phase0.Root
	RANDAOMixesRoot                  *phase0.Root
	SlashingsRoot                    *phase0.Root
	PreviousEpochParticipationRoot   *phase0.Root
	CurrentEpochParticipationRoot    *phase0.Root
	JustificationBitsRoot            *phase0.Root
	PreviousJustifiedCheckpointRoot  *phase0.Root
	CurrentJustifiedCheckpointRoot   *phase0.Root
	FinalizedCheckpointRoot          *phase0.Root
	InactivityScoresRoot             *phase0.Root
	CurrentSyncCommitteeRoot         *phase0.Root
	NextSyncCommitteeRoot            *phase0.Root
	LatestExecutionPayloadHeaderRoot *phase0.Root
	NextWithdrawalIndexRoot          *phase0.Root
	NextWithdrawalValidatorIndexRoot *phase0.Root
	HistoricalSummariesRoot          *phase0.Root
}

type BeaconStateTopLevelRootsElectra added in v1.5.0

type BeaconStateTopLevelRootsElectra struct {
	GenesisTimeRoot                   *phase0.Root
	GenesisValidatorsRoot             *phase0.Root
	SlotRoot                          *phase0.Root
	ForkRoot                          *phase0.Root
	LatestBlockHeaderRoot             *phase0.Root
	BlockRootsRoot                    *phase0.Root
	StateRootsRoot                    *phase0.Root
	HistoricalRootsRoot               *phase0.Root
	ETH1DataRoot                      *phase0.Root
	ETH1DataVotesRoot                 *phase0.Root
	ETH1DepositIndexRoot              *phase0.Root
	ValidatorsRoot                    *phase0.Root
	BalancesRoot                      *phase0.Root
	RANDAOMixesRoot                   *phase0.Root
	SlashingsRoot                     *phase0.Root
	PreviousEpochParticipationRoot    *phase0.Root
	CurrentEpochParticipationRoot     *phase0.Root
	JustificationBitsRoot             *phase0.Root
	PreviousJustifiedCheckpointRoot   *phase0.Root
	CurrentJustifiedCheckpointRoot    *phase0.Root
	FinalizedCheckpointRoot           *phase0.Root
	InactivityScoresRoot              *phase0.Root
	CurrentSyncCommitteeRoot          *phase0.Root
	NextSyncCommitteeRoot             *phase0.Root
	LatestExecutionPayloadHeaderRoot  *phase0.Root
	NextWithdrawalIndexRoot           *phase0.Root
	NextWithdrawalValidatorIndexRoot  *phase0.Root
	HistoricalSummariesRoot           *phase0.Root
	DepositRequestsStartIndexRoot     *phase0.Root
	DepositBalanceToConsumeRoot       *phase0.Root
	ExitBalanceToConsumeRoot          *phase0.Root
	EarliestExitEpochRoot             *phase0.Root
	ConsolidationBalanceToConsumeRoot *phase0.Root
	EarliestConsolidationEpochRoot    *phase0.Root
	PendingDepositsRoot               *phase0.Root
	PendingPartialWithdrawalsRoot     *phase0.Root
	PendingConsolidationsRoot         *phase0.Root
}

type BeaconStateTopLevelRootsFulu added in v1.6.0

type BeaconStateTopLevelRootsFulu struct {
	GenesisTimeRoot                   *phase0.Root
	GenesisValidatorsRoot             *phase0.Root
	SlotRoot                          *phase0.Root
	ForkRoot                          *phase0.Root
	LatestBlockHeaderRoot             *phase0.Root
	BlockRootsRoot                    *phase0.Root
	StateRootsRoot                    *phase0.Root
	HistoricalRootsRoot               *phase0.Root
	ETH1DataRoot                      *phase0.Root
	ETH1DataVotesRoot                 *phase0.Root
	ETH1DepositIndexRoot              *phase0.Root
	ValidatorsRoot                    *phase0.Root
	BalancesRoot                      *phase0.Root
	RANDAOMixesRoot                   *phase0.Root
	SlashingsRoot                     *phase0.Root
	PreviousEpochParticipationRoot    *phase0.Root
	CurrentEpochParticipationRoot     *phase0.Root
	JustificationBitsRoot             *phase0.Root
	PreviousJustifiedCheckpointRoot   *phase0.Root
	CurrentJustifiedCheckpointRoot    *phase0.Root
	FinalizedCheckpointRoot           *phase0.Root
	InactivityScoresRoot              *phase0.Root
	CurrentSyncCommitteeRoot          *phase0.Root
	NextSyncCommitteeRoot             *phase0.Root
	LatestExecutionPayloadHeaderRoot  *phase0.Root
	NextWithdrawalIndexRoot           *phase0.Root
	NextWithdrawalValidatorIndexRoot  *phase0.Root
	HistoricalSummariesRoot           *phase0.Root
	DepositRequestsStartIndexRoot     *phase0.Root
	DepositBalanceToConsumeRoot       *phase0.Root
	ExitBalanceToConsumeRoot          *phase0.Root
	EarliestExitEpochRoot             *phase0.Root
	ConsolidationBalanceToConsumeRoot *phase0.Root
	EarliestConsolidationEpochRoot    *phase0.Root
	PendingDepositsRoot               *phase0.Root
	PendingPartialWithdrawalsRoot     *phase0.Root
	PendingConsolidationsRoot         *phase0.Root
	ProposerLookaheadRoot             *phase0.Root
}

Jump to

Keyboard shortcuts

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