beacon

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2024 License: MIT Imports: 12 Imported by: 5

Documentation

Index

Constants

View Source
const (
	SlotsPerHistoricalRoot = uint64(8192)

	// Index of the historical summaries in the beacon state
	HistoricalSummaryListIndex = uint64(27)

	// Index of validator list in beacon state
	ValidatorListIndex = uint64(11)

	// Index of the beacon body root inside the beacon body header
	BeaconBlockBodyRootIndex = uint64(4)

	// Index of the execution payload in the BeaconBlockBody container
	ExecutionPayloadIndex = uint64(9)

	// Index of the timestamp inside the execution payload
	TimestampIndex = uint64(9)

	// Index of the withdrawals inside the execution payload
	WithdrawalsIndex = uint64(14)

	// Index of the slot in the beacon block header
	SlotIndex = uint64(0)

	// in the historical summary coontainer, the block root summary is at index 0
	BlockSummaryRootIndex = uint64(0)
)
View Source
const (
	BlockBodyMerkleSubtreeNumLayers = uint64(4)

	// Number of layers for the merkleixation of the Validator List in the Beacon State
	ValidatorListMerkleSubtreeNumLayers = uint64(40)

	// Number of layers for the merkleixation of the Historical Summary List in the Beacon State
	HistoricalSummaryListMerkleSubtreeNumLayers = uint64(24)

	// Number of layers for the merkleization of the Withdrawal List in the Execution Payload
	WithdrawalListMerkleSubtreeNumLayers = uint64(4)

	// Number of layers for the merkleization of the Block Roots in the Beacon State
	BlockRootsMerkleSubtreeNumLayers = uint64(13)
)

Variables

This section is empty.

Functions

func ComputeExecutionPayloadFieldRootsCapella added in v0.0.3

func ComputeExecutionPayloadFieldRootsCapella(executionPayloadFields *capella.ExecutionPayload) ([]phase0.Root, error)

func ComputeExecutionPayloadFieldRootsDeneb added in v0.0.3

func ComputeExecutionPayloadFieldRootsDeneb(executionPayloadFields *deneb.ExecutionPayload) ([]phase0.Root, error)

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 GetBlockRoots added in v0.0.3

func GetBlockRoots(beaconState spec.VersionedBeaconState) ([]phase0.Root, error)

func GetExecutionPayloadFieldRootsCapella added in v0.0.3

func GetExecutionPayloadFieldRootsCapella(executionPayloadFields *capella.ExecutionPayload) ([]phase0.Root, error)

func GetGenesisTime

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

func GetHistoricalSummaries added in v0.0.3

func GetHistoricalSummaries(state *spec.VersionedBeaconState) ([]*capella.HistoricalSummary, error)

func MarshalSSZVersionedBeaconState

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

func ProveBeaconTopLevelRootAgainstBeaconState

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

func ProveBlockBodyAgainstBlockHeader added in v0.0.3

func ProveBlockBodyAgainstBlockHeader(blockHeader *phase0.BeaconBlockHeader) (common.Proof, error)

func ProveBlockRootAgainstBeaconStateViaHistoricalSummaries added in v0.0.3

func ProveBlockRootAgainstBeaconStateViaHistoricalSummaries(beaconStateTopLevelRoots *BeaconStateTopLevelRoots, historicalSummaries []*capella.HistoricalSummary, historicalBlockRoots []phase0.Root, historicalSummaryIndex uint64, blockRootIndex uint64) ([][32]byte, error)

func ProveBlockRootAgainstBlockRootsList added in v0.0.3

func ProveBlockRootAgainstBlockRootsList(blockRoots []phase0.Root, blockRootIndex uint64) (common.Proof, error)

func ProveBlockRootListAgainstHistoricalSummary added in v0.0.3

func ProveBlockRootListAgainstHistoricalSummary(historicalSummary *capella.HistoricalSummary) (common.Proof, error)

func ProveExecutionPayloadAgainstBlockBodyCapella added in v0.0.3

func ProveExecutionPayloadAgainstBlockBodyCapella(beaconBlockBody *capella.BeaconBlockBody) (common.Proof, [32]byte, error)

Refer to beaconblockbody.go in go-eth2-client https://github.com/attestantio/go-eth2-client/blob/654ac05b4c534d96562329f988655e49e5743ff5/spec/bellatrix/beaconblockbody_encoding.go

func ProveExecutionPayloadAgainstBlockBodyDeneb added in v0.0.3

func ProveExecutionPayloadAgainstBlockBodyDeneb(beaconBlockBody *deneb.BeaconBlockBody) (common.Proof, [32]byte, error)

Refer to beaconblockbody.go in go-eth2-client https://github.com/attestantio/go-eth2-client/blob/654ac05b4c534d96562329f988655e49e5743ff5/spec/bellatrix/beaconblockbody_encoding.go

func ProveExecutionPayloadAgainstBlockHeaderCapella added in v0.0.3

func ProveExecutionPayloadAgainstBlockHeaderCapella(
	blockHeader *phase0.BeaconBlockHeader,
	withdrawalBeaconBlockBody *capella.BeaconBlockBody,
) ([][32]byte, [32]byte, error)

func ProveExecutionPayloadAgainstBlockHeaderDeneb added in v0.0.3

func ProveExecutionPayloadAgainstBlockHeaderDeneb(
	blockHeader *phase0.BeaconBlockHeader,
	withdrawalBeaconBlockBody *deneb.BeaconBlockBody,
) ([][32]byte, [32]byte, error)

func ProveHistoricalSummaryAgainstHistoricalSummariesList added in v0.0.3

func ProveHistoricalSummaryAgainstHistoricalSummariesList(historicalSummaries []*capella.HistoricalSummary, historicalSummaryIndex uint64) (common.Proof, error)

func ProveSlotAgainstBlockHeader added in v0.0.3

func ProveSlotAgainstBlockHeader(blockHeader *phase0.BeaconBlockHeader) (common.Proof, error)

func ProveTimestampAgainstExecutionPayload added in v0.0.3

func ProveTimestampAgainstExecutionPayload(executionPayloadFieldRoots []phase0.Root) (common.Proof, error)

func ProveValidatorBalanceAgainstValidatorBalanceList

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

func ProveWithdrawalAgainstExecutionPayload added in v0.0.3

func ProveWithdrawalAgainstExecutionPayload(
	executionPayloadFieldRoots []phase0.Root,
	withdrawals []*capella.Withdrawal,
	withdrawalIndex uint8,
) ([][32]byte, error)

func ProveWithdrawalAgainstWithdrawalList added in v0.0.3

func ProveWithdrawalAgainstWithdrawalList(withdrawals []*capella.Withdrawal, withdrawalIndex uint8) (common.Proof, error)

func ProveWithdrawalListAgainstExecutionPayload added in v0.0.3

func ProveWithdrawalListAgainstExecutionPayload(executionPayloadFieldRoots []phase0.Root) (common.Proof, error)

func UnmarshalSSZVersionedBeaconState

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

Types

type BeaconStateTopLevelRoots

type BeaconStateTopLevelRoots 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
}

Jump to

Keyboard shortcuts

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