Documentation ¶
Index ¶
- func AddInMixin(root [32]byte, length uint64) ([32]byte, error)
- func BlockHeaderRoot(header *ethpb.BeaconBlockHeader) ([32]byte, error)
- func Eth1DataEncKey(eth1Data *ethpb.Eth1Data) []byte
- func Eth1DataRootWithHasher(hasher htrutils.HashFn, eth1Data *ethpb.Eth1Data) ([32]byte, error)
- func Eth1DatasEncKey(eth1Datas []*ethpb.Eth1Data) ([32]byte, error)
- func Eth1DatasRoot(eth1Datas []*ethpb.Eth1Data) ([32]byte, error)
- func HandleByteArrays(val [][]byte, indices []uint64, convertAll bool) ([][32]byte, error)
- func HandleValidatorSlice(val []*ethpb.Validator, indices []uint64, convertAll bool) ([][32]byte, error)
- func Merkleize(leaves [][]byte) [][][]byte
- func MerkleizeTrieLeaves(layers [][][32]byte, hashLayer [][32]byte, hasher func([]byte) [32]byte) ([][][32]byte, [][32]byte)
- func PendingAttEncKey(att *pb.PendingAttestation) []byte
- func PendingAttRootWithHasher(hasher htrutils.HashFn, att *pb.PendingAttestation) ([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
- func ReturnTrieLayerVariable(elements [][32]byte, length uint64) [][]*[32]byte
- func Uint64ListRootWithRegistryLimit(balances []uint64) ([32]byte, error)
- func ValidatorEncKey(validator *ethpb.Validator) []byte
- func ValidatorRootWithHasher(hasher htrutils.HashFn, validator *ethpb.Validator) ([32]byte, error)
- type Reference
- type ValidatorMapHandler
- func (v *ValidatorMapHandler) AddRef()
- func (v *ValidatorMapHandler) Copy() *ValidatorMapHandler
- func (v *ValidatorMapHandler) Get(key [48]byte) (types.ValidatorIndex, bool)
- func (v *ValidatorMapHandler) IsNil() bool
- func (v *ValidatorMapHandler) MapRef() *Reference
- func (v *ValidatorMapHandler) Set(key [48]byte, index types.ValidatorIndex)
- func (v *ValidatorMapHandler) ValidatorIndexMap() map[[48]byte]types.ValidatorIndex
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddInMixin ¶ added in v0.3.5
AddInMixin describes a method from which a lenth 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 eth2 Simple Serialize specification.
func Eth1DataEncKey ¶ added in v1.3.4
Eth1DataEncKey returns the encoded key in bytes of input `eth1Data`, the returned key bytes can be used for caching purposes.
func Eth1DataRootWithHasher ¶ added in v1.3.4
Eth1DataRootWithHasher returns the hash tree root of input `eth1Data`.
func Eth1DatasEncKey ¶ added in v1.3.4
Eth1DataEncKey returns the encoded key in bytes of input `eth1Data`s, the returned key bytes can be used for caching purposes.
func Eth1DatasRoot ¶ added in v1.3.4
Eth1DatasRoot returns the hash tree root of input `eth1Datas`.
func HandleByteArrays ¶ added in v1.3.5
HandleByteArrays computes and returns byte arrays in a slice of root format.
func HandleValidatorSlice ¶ added in v1.3.5
func HandleValidatorSlice(val []*ethpb.Validator, indices []uint64, convertAll bool) ([][32]byte, error)
HandleValidatorSlice returns the validator indices in a slice of root format.
func Merkleize ¶ added in v0.3.9
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 32.
func MerkleizeTrieLeaves ¶ added in v1.3.5
func MerkleizeTrieLeaves(layers [][][32]byte, hashLayer [][32]byte, hasher func([]byte) [32]byte) ([][][32]byte, [][32]byte)
MerkleizeTrieLeaves merkleize the trie leaves.
func PendingAttEncKey ¶ added in v1.3.4
func PendingAttEncKey(att *pb.PendingAttestation) []byte
PendingAttEncKey returns the encoded key in bytes of input `pendingAttestation`, the returned key bytes can be used for caching purposes.
func PendingAttRootWithHasher ¶ added in v1.3.4
PendingAttestationRoot describes a method from which the hash tree root of a pending attestation is returned.
func RecomputeFromLayer ¶ added in v0.3.5
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 ¶ added in v0.3.5
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 ¶ added in v0.3.5
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 ¶ added in v0.3.5
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 Uint64ListRootWithRegistryLimit ¶ added in v1.3.5
Uint64ListRootWithRegistryLimit computes the HashTreeRoot Merkleization of a list of uint64 and mixed with registry limit.
func ValidatorEncKey ¶ added in v1.3.4
ValidatorEncKey returns the encoded key in bytes of input `validator`, the returned key bytes can be used for caching purposes.
Types ¶
type Reference ¶ added in v1.3.4
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.
func (*Reference) AddRef ¶ added in v1.3.4
func (r *Reference) AddRef()
AddRef adds 1 to the reference number.
type ValidatorMapHandler ¶ added in v1.3.4
type ValidatorMapHandler struct {
// contains filtered or unexported fields
}
ValidatorMapHandler is a container to hold the map and a reference tracker for how many states shared this.
func NewValMapHandler ¶ added in v1.3.4
func NewValMapHandler(vals []*ethpb.Validator) *ValidatorMapHandler
NewValMapHandler returns a new validator map handler.
func (*ValidatorMapHandler) AddRef ¶ added in v1.3.4
func (v *ValidatorMapHandler) AddRef()
Copy the whole map and returns a map handler with the copied map.
func (*ValidatorMapHandler) Copy ¶ added in v1.3.4
func (v *ValidatorMapHandler) Copy() *ValidatorMapHandler
Copy the whole map and returns a map handler with the copied map.
func (*ValidatorMapHandler) Get ¶ added in v1.3.4
func (v *ValidatorMapHandler) Get(key [48]byte) (types.ValidatorIndex, bool)
Get the validator index using the corresponding public key.
func (*ValidatorMapHandler) IsNil ¶ added in v1.3.4
func (v *ValidatorMapHandler) IsNil() bool
IsNil returns true if the underlying validator index map is nil.
func (*ValidatorMapHandler) MapRef ¶ added in v1.3.4
func (v *ValidatorMapHandler) MapRef() *Reference
MapRef returns the map reference.
func (*ValidatorMapHandler) Set ¶ added in v1.3.4
func (v *ValidatorMapHandler) Set(key [48]byte, index types.ValidatorIndex)
Set the validator index using the corresponding public key.
func (*ValidatorMapHandler) ValidatorIndexMap ¶ added in v1.3.4
func (v *ValidatorMapHandler) ValidatorIndexMap() map[[48]byte]types.ValidatorIndex
ValidatorIndexMap returns the validator index map.