Documentation ¶
Index ¶
- func AddInMixin(root [32]byte, length uint64) ([32]byte, error)
- func ArraysRoot(input [][]byte, length uint64) ([32]byte, error)
- func BlockHeaderRoot(header *ethpb.BeaconBlockHeader) ([32]byte, error)
- func EpochAttestationsRoot(atts []*ethpb.PendingAttestation) ([32]byte, error)
- func Eth1DataRootWithHasher(eth1Data *ethpb.Eth1Data) ([32]byte, error)
- func Eth1DataVotesRoot(eth1DataVotes []*ethpb.Eth1Data) ([32]byte, error)
- func Eth1DatasRoot(eth1Datas []*ethpb.Eth1Data) ([32]byte, error)
- func Eth1Root(eth1Data *ethpb.Eth1Data) ([32]byte, error)
- func HistoricalSummariesRoot(summaries []*ethpb.HistoricalSummary) ([32]byte, error)
- func Merkleize(leaves [][]byte) [][][]byte
- func MerkleizeTrieLeaves(layers [][][32]byte, hashLayer [][32]byte) ([][][32]byte, [][32]byte, error)
- func OptimizedValidatorRoots(validators []*ethpb.Validator) ([][32]byte, error)
- func PackUint64IntoChunks(vals []uint64) ([][32]byte, error)
- func ParticipationBitsRoot(bits []byte) ([32]byte, error)
- func PendingAttRootWithHasher(att *ethpb.PendingAttestation) ([32]byte, error)
- func PendingConsolidationsRoot(slice []*ethpb.PendingConsolidation) ([32]byte, error)
- func PendingDepositsRoot(slice []*ethpb.PendingDeposit) ([32]byte, error)
- func PendingPartialWithdrawalsRoot(slice []*ethpb.PendingPartialWithdrawal) ([32]byte, error)
- func RecomputeFromLayer(changedLeaves [][32]byte, changedIdx []uint64, layer [][]*[32]byte) ([32]byte, [][]*[32]byte, error)
- func RecomputeFromLayerVariable(changedLeaves [][32]byte, changedIdx []uint64, layer [][]*[32]byte) ([32]byte, [][]*[32]byte, error)
- func ReturnTrieLayer(elements [][32]byte, length uint64) ([][]*[32]byte, error)
- func ReturnTrieLayerVariable(elements [][32]byte, length uint64) [][]*[32]byte
- func RootsArrayHashTreeRoot(vals [][]byte, length uint64) ([32]byte, error)
- func SyncCommitteeRoot(committee *ethpb.SyncCommittee) ([32]byte, error)
- func Uint64ListRootWithRegistryLimit(balances []uint64) ([32]byte, error)
- func UnrealizedCheckpointBalances(cp, pp []byte, validators ValReader, currentEpoch primitives.Epoch) (uint64, uint64, uint64, error)
- func ValidatorFieldRoots(validator *ethpb.Validator) ([][32]byte, error)
- func ValidatorLimitForBalancesChunks() uint64
- func ValidatorRegistryRoot(vals []*ethpb.Validator) ([32]byte, error)
- func ValidatorRootWithHasher(validator *ethpb.Validator) ([32]byte, error)
- type Reference
- type ValMultiValueSliceReader
- type ValReader
- type ValSliceReader
- type ValidatorMapHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddInMixin ¶
AddInMixin describes a method from which a length mixin is added to the provided root.
func BlockHeaderRoot ¶
func BlockHeaderRoot(header *ethpb.BeaconBlockHeader) ([32]byte, error)
BlockHeaderRoot computes the HashTreeRoot Merkleization of a BeaconBlockHeader struct according to the Ethereum Simple Serialize specification.
func EpochAttestationsRoot ¶
func EpochAttestationsRoot(atts []*ethpb.PendingAttestation) ([32]byte, error)
func Eth1DataRootWithHasher ¶
Eth1DataRootWithHasher returns the hash tree root of input `eth1Data`.
func Eth1DataVotesRoot ¶
Eth1DataVotesRoot computes the HashTreeRoot Merkleization of a list of Eth1Data structs according to the eth2 Simple Serialize specification.
func Eth1DatasRoot ¶
Eth1DatasRoot returns the hash tree root of input `eth1Datas`.
func Eth1Root ¶
Eth1Root computes the HashTreeRoot Merkleization of a BeaconBlockHeader struct according to the eth2 Simple Serialize specification.
func HistoricalSummariesRoot ¶
func HistoricalSummariesRoot(summaries []*ethpb.HistoricalSummary) ([32]byte, error)
func Merkleize ¶
Merkleize 32-byte leaves into a Merkle trie for its adequate depth, returning the resulting layers of the trie based on the appropriate depth. This function pads the leaves to a length of a multiple of 32.
func MerkleizeTrieLeaves ¶
func MerkleizeTrieLeaves(layers [][][32]byte, hashLayer [][32]byte) ([][][32]byte, [][32]byte, error)
MerkleizeTrieLeaves merkleize the trie leaves.
func OptimizedValidatorRoots ¶
OptimizedValidatorRoots uses an optimized routine with gohashtree in order to derive a list of validator roots from a list of validator objects.
func PackUint64IntoChunks ¶
PackUint64IntoChunks packs a list of uint64 values into 32 byte roots.
func ParticipationBitsRoot ¶
ParticipationBitsRoot computes the HashTreeRoot merkleization of participation roots.
func PendingAttRootWithHasher ¶
func PendingAttRootWithHasher(att *ethpb.PendingAttestation) ([32]byte, error)
PendingAttRootWithHasher describes a method from which the hash tree root of a pending attestation is returned.
func PendingConsolidationsRoot ¶ added in v5.1.0
func PendingConsolidationsRoot(slice []*ethpb.PendingConsolidation) ([32]byte, error)
func PendingDepositsRoot ¶ added in v5.2.0
func PendingDepositsRoot(slice []*ethpb.PendingDeposit) ([32]byte, error)
func PendingPartialWithdrawalsRoot ¶ added in v5.1.0
func PendingPartialWithdrawalsRoot(slice []*ethpb.PendingPartialWithdrawal) ([32]byte, error)
func RecomputeFromLayer ¶
func RecomputeFromLayer(changedLeaves [][32]byte, changedIdx []uint64, layer [][]*[32]byte) ([32]byte, [][]*[32]byte, error)
RecomputeFromLayer recomputes specific branches of a fixed sized trie depending on the provided changed indexes.
func RecomputeFromLayerVariable ¶
func RecomputeFromLayerVariable(changedLeaves [][32]byte, changedIdx []uint64, layer [][]*[32]byte) ([32]byte, [][]*[32]byte, error)
RecomputeFromLayerVariable recomputes specific branches of a variable sized trie depending on the provided changed indexes.
func ReturnTrieLayer ¶
ReturnTrieLayer returns the representation of a merkle trie when provided with the elements of a fixed sized trie and the corresponding depth of it.
func ReturnTrieLayerVariable ¶
ReturnTrieLayerVariable returns the representation of a merkle trie when provided with the elements of a variable sized trie and the corresponding depth of it.
func RootsArrayHashTreeRoot ¶
RootsArrayHashTreeRoot computes the Merkle root of arrays of 32-byte hashes, such as [64][32]byte according to the Simple Serialize specification of Ethereum.
func SyncCommitteeRoot ¶
func SyncCommitteeRoot(committee *ethpb.SyncCommittee) ([32]byte, error)
SyncCommitteeRoot computes the HashTreeRoot Merkleization of a committee root. a SyncCommitteeRoot struct according to the eth2 Simple Serialize specification.
func Uint64ListRootWithRegistryLimit ¶
Uint64ListRootWithRegistryLimit computes the HashTreeRoot Merkleization of a list of uint64 and mixed with registry limit.
func UnrealizedCheckpointBalances ¶
func UnrealizedCheckpointBalances(cp, pp []byte, validators ValReader, currentEpoch primitives.Epoch) (uint64, uint64, uint64, error)
UnrealizedCheckpointBalances returns the total current active balance, the total previous epoch correctly attested for target balance, and the total current epoch correctly attested for target balance. It takes the current and previous epoch participation bits as parameters so implicitly only works for beacon states post-Altair.
func ValidatorFieldRoots ¶
ValidatorFieldRoots describes a method from which the hash tree root of a validator is returned.
func ValidatorLimitForBalancesChunks ¶
func ValidatorLimitForBalancesChunks() uint64
ValidatorLimitForBalancesChunks returns the limit of validators after going through the chunking process.
func ValidatorRegistryRoot ¶
ValidatorRegistryRoot computes the HashTreeRoot Merkleization of a list of validator structs according to the Ethereum Simple Serialize specification.
Types ¶
type Reference ¶
type Reference struct {
// contains filtered or unexported fields
}
Reference structs are shared across BeaconState copies to understand when the state must use copy-on-write for shared fields or may modify a field in place when it holds the only reference to the field value. References are tracked in a map of fieldIndex -> *reference. Whenever a state releases their reference to the field value, they must decrement the refs. Likewise whenever a copy is performed then the state must increment the refs counter.
type ValMultiValueSliceReader ¶ added in v5.0.2
type ValMultiValueSliceReader struct { ValMVSlice *multi_value_slice.Slice[*ethpb.Validator] Identifier multi_value_slice.Identifiable }
ValMultiValueSliceReader describes a struct that conforms to the ValReader interface. This struct is specifically designed for accessing validator data from a multivalue slice.
func NewValMultiValueSliceReader ¶ added in v5.0.2
func NewValMultiValueSliceReader(valSlice *multi_value_slice.Slice[*ethpb.Validator], identifier multi_value_slice.Identifiable) ValMultiValueSliceReader
NewValMultiValueSliceReader constructs a new val reader object.
func (ValMultiValueSliceReader) At ¶ added in v5.0.2
func (v ValMultiValueSliceReader) At(i int) (*ethpb.Validator, error)
At returns the validator at the provided index.
func (ValMultiValueSliceReader) Len ¶ added in v5.0.2
func (v ValMultiValueSliceReader) Len() int
Len is the length of the validator registry.
type ValReader ¶ added in v5.0.2
ValReader specifies an interface through which we can access the validator registry.
type ValSliceReader ¶ added in v5.0.2
ValSliceReader describes a struct that conforms to the ValReader interface
func NewValSliceReader ¶ added in v5.0.2
func NewValSliceReader(vals []*ethpb.Validator) ValSliceReader
NewValSliceReader constructs a ValSliceReader object.
func (ValSliceReader) At ¶ added in v5.0.2
func (v ValSliceReader) At(i int) (*ethpb.Validator, error)
At returns the validator at the provided index.
func (ValSliceReader) Len ¶ added in v5.0.2
func (v ValSliceReader) Len() int
Len is the length of the validator registry.
type ValidatorMapHandler ¶
ValidatorMapHandler is a container to hold the map and a reference tracker for how many states shared this.
func NewValMapHandler ¶
func NewValMapHandler(vals []*ethpb.Validator) *ValidatorMapHandler
NewValMapHandler returns a new validator map handler.
func (*ValidatorMapHandler) AddRef ¶
func (v *ValidatorMapHandler) AddRef()
AddRef copies the whole map and returns a map handler with the copied map.
func (*ValidatorMapHandler) Get ¶
func (v *ValidatorMapHandler) Get(key [fieldparams.BLSPubkeyLength]byte) (primitives.ValidatorIndex, bool)
Get the validator index using the corresponding public key.
func (*ValidatorMapHandler) IsNil ¶
func (v *ValidatorMapHandler) IsNil() bool
IsNil returns true if the underlying validator index map is nil.
func (*ValidatorMapHandler) Set ¶
func (v *ValidatorMapHandler) Set(key [fieldparams.BLSPubkeyLength]byte, index primitives.ValidatorIndex)
Set the validator index using the corresponding public key.
Source Files ¶
- block_header_root.go
- eth1_root.go
- field_root_attestation.go
- field_root_eth1.go
- field_root_validator.go
- field_root_vector.go
- historical_summaries_root.go
- participation_bit_root.go
- pending_attestation_root.go
- pending_consolidations_root.go
- pending_deposits_root.go
- pending_partial_withdrawals_root.go
- reference.go
- sync_committee.root.go
- trie_helpers.go
- unrealized_justification.go
- validator_map_handler.go
- validator_reader.go
- validator_root.go