Documentation ¶
Index ¶
- Constants
- func GetDepth(v uint64) uint8
- func IntersectionOfSortedSets(v1, v2 IterableSSZ[uint64]) []uint64
- func IsUint64SortedSet(set IterableSSZ[uint64]) bool
- func NewUint64Slice(limit int) *byteBasedUint64Slice
- func RangeErr[T any](r Ranger[T], fn func(int, T, int) error) (err error)
- type Attestation
- func (a *Attestation) Clone() clonable.Clonable
- func (a *Attestation) Copy() *Attestation
- func (a *Attestation) DecodeSSZ(buf []byte, version int) error
- func (a *Attestation) ElectraSingleCommitteeIndex() (uint64, error)
- func (a *Attestation) EncodeSSZ(dst []byte) ([]byte, error)
- func (a *Attestation) EncodingSizeSSZ() (size int)
- func (a *Attestation) HashSSZ() (o [32]byte, err error)
- func (*Attestation) Static() bool
- func (a *Attestation) UnmarshalJSON(data []byte) error
- type AttestationData
- func (a *AttestationData) Clone() clonable.Clonable
- func (a *AttestationData) DecodeSSZ(buf []byte, version int) error
- func (a *AttestationData) EncodeSSZ(dst []byte) ([]byte, error)
- func (a *AttestationData) EncodingSizeSSZ() int
- func (a *AttestationData) Equal(other *AttestationData) bool
- func (a *AttestationData) HashSSZ() (o [32]byte, err error)
- func (a *AttestationData) Static() bool
- type BitList
- func (u *BitList) Append(v byte)
- func (u *BitList) Bits() int
- func (u *BitList) Bytes() []byte
- func (u *BitList) Cap() int
- func (u *BitList) Clear()
- func (u *BitList) Clone() clonable.Clonable
- func (u *BitList) Copy() *BitList
- func (u *BitList) CopyTo(target IterableSSZ[byte])
- func (u *BitList) DecodeSSZ(dst []byte, _ int) error
- func (u *BitList) EncodeSSZ(dst []byte) ([]byte, error)
- func (u *BitList) EncodingSizeSSZ() int
- func (u *BitList) Get(index int) byte
- func (u *BitList) GetBitAt(i int) bool
- func (u *BitList) HashSSZ() ([32]byte, error)
- func (u *BitList) Length() int
- func (u *BitList) MarshalJSON() ([]byte, error)
- func (u *BitList) Pop() (x byte)
- func (u *BitList) Range(fn func(index int, value byte, length int) bool)
- func (u *BitList) Set(index int, v byte)
- func (*BitList) Static() bool
- func (u *BitList) Union(other *BitList) (*BitList, error)
- func (u *BitList) UnmarshalJSON(input []byte) error
- type BitVector
- func (b *BitVector) BitCap() int
- func (b *BitVector) BitLen() int
- func (b *BitVector) Clone() clonable.Clonable
- func (b *BitVector) Copy() *BitVector
- func (b *BitVector) CopyTo(dst *BitVector)
- func (b *BitVector) DecodeSSZ(buf []byte, _ int) error
- func (b *BitVector) EncodeSSZ(dst []byte) ([]byte, error)
- func (b *BitVector) EncodingSizeSSZ() int
- func (b *BitVector) GetBitAt(i int) bool
- func (b *BitVector) GetOnIndices() []int
- func (b *BitVector) HashSSZ() ([32]byte, error)
- func (b *BitVector) MarshalJSON() ([]byte, error)
- func (b *BitVector) SetBitAt(i int, v bool) error
- func (b *BitVector) Static() bool
- func (b *BitVector) Union(other *BitVector) (*BitVector, error)
- func (b *BitVector) UnmarshalJSON(data []byte) error
- type Checkpoint
- func (c *Checkpoint) Clone() clonable.Clonable
- func (c *Checkpoint) Copy() *Checkpoint
- func (c *Checkpoint) DecodeSSZ(buf []byte, version int) error
- func (c *Checkpoint) EncodeSSZ(dst []byte) ([]byte, error)
- func (*Checkpoint) EncodingSizeSSZ() int
- func (c *Checkpoint) Equal(other Checkpoint) bool
- func (c Checkpoint) HashSSZ() (o [32]byte, err error)
- func (c Checkpoint) Static() bool
- type ExtraData
- func (e *ExtraData) Bytes() []byte
- func (*ExtraData) Clone() clonable.Clonable
- func (e *ExtraData) DecodeSSZ(buf []byte, _ int) error
- func (e *ExtraData) EncodeSSZ(buf []byte) ([]byte, error)
- func (e *ExtraData) EncodingSizeSSZ() int
- func (e *ExtraData) HashSSZ() ([32]byte, error)
- func (e ExtraData) MarshalJSON() ([]byte, error)
- func (e *ExtraData) SetBytes(buf []byte)
- func (*ExtraData) Static() bool
- func (e *ExtraData) UnmarshalJSON(buf []byte) error
- type HashListSSZ
- type HashVectorSSZ
- type IterableSSZ
- type ListSSZ
- func NewDynamicListSSZ[T encodableHashableSSZ](limit int) *ListSSZ[T]
- func NewDynamicListSSZFromList[T encodableHashableSSZ](list []T, limit int) *ListSSZ[T]
- func NewStaticListSSZ[T encodableHashableSSZ](limit int, bytesPerElement int) *ListSSZ[T]
- func NewStaticListSSZFromList[T encodableHashableSSZ](list []T, limit int, bytesPerElement int) *ListSSZ[T]
- func (l *ListSSZ[T]) Append(obj T)
- func (l *ListSSZ[T]) Clear()
- func (l *ListSSZ[T]) Clone() clonable.Clonable
- func (l *ListSSZ[T]) DecodeSSZ(buf []byte, version int) (err error)
- func (l *ListSSZ[T]) ElementProof(i int) [][32]byte
- func (l *ListSSZ[T]) EncodeSSZ(buf []byte) (dst []byte, err error)
- func (l *ListSSZ[T]) EncodingSizeSSZ() (size int)
- func (l *ListSSZ[T]) Get(index int) T
- func (l *ListSSZ[T]) HashSSZ() ([32]byte, error)
- func (l *ListSSZ[T]) Len() int
- func (l ListSSZ[T]) MarshalJSON() ([]byte, error)
- func (l *ListSSZ[T]) Range(fn func(index int, value T, length int) bool)
- func (l *ListSSZ[T]) Static() bool
- func (l *ListSSZ[T]) Truncate(length int)
- func (l *ListSSZ[T]) UnmarshalJSON(data []byte) error
- type ParticipationBitList
- func (u *ParticipationBitList) Append(v byte)
- func (u *ParticipationBitList) Bits() int
- func (u *ParticipationBitList) Bytes() []byte
- func (u *ParticipationBitList) Cap() int
- func (u *ParticipationBitList) Clear()
- func (u *ParticipationBitList) Clone() clonable.Clonable
- func (u *ParticipationBitList) Copy() *ParticipationBitList
- func (u *ParticipationBitList) CopyTo(target IterableSSZ[byte])
- func (u *ParticipationBitList) DecodeSSZ(dst []byte, _ int) error
- func (u *ParticipationBitList) EncodeSSZ(dst []byte) ([]byte, error)
- func (u *ParticipationBitList) EncodingSizeSSZ() int
- func (u *ParticipationBitList) Get(index int) byte
- func (u *ParticipationBitList) HashSSZ() ([32]byte, error)
- func (u *ParticipationBitList) Length() int
- func (u *ParticipationBitList) MarshalJSON() ([]byte, error)
- func (u *ParticipationBitList) Pop() (x byte)
- func (u *ParticipationBitList) Range(fn func(index int, value byte, length int) bool)
- func (u *ParticipationBitList) Set(index int, v byte)
- func (*ParticipationBitList) Static() bool
- func (u *ParticipationBitList) UnmarshalJSON(input []byte) error
- type PendingAttestation
- func (*PendingAttestation) Clone() clonable.Clonable
- func (a *PendingAttestation) DecodeSSZ(buf []byte, _ int) error
- func (a *PendingAttestation) EncodeSSZ(dst []byte) ([]byte, error)
- func (a *PendingAttestation) EncodingSizeSSZ() (size int)
- func (a *PendingAttestation) HashSSZ() (o [32]byte, err error)
- func (p *PendingAttestation) UnmarshalJSON(data []byte) error
- type Phase0Data
- type Ranger
- type RawUint64List
- func (arr *RawUint64List) Append(value uint64)
- func (arr *RawUint64List) Bytes() []byte
- func (arr *RawUint64List) Cap() int
- func (arr *RawUint64List) Clear()
- func (arr *RawUint64List) Clone() clonable.Clonable
- func (arr *RawUint64List) CopyTo(target IterableSSZ[uint64])
- func (arr *RawUint64List) DecodeSSZ(buf []byte, _ int) error
- func (arr *RawUint64List) EncodeSSZ(buf []byte) (dst []byte, err error)
- func (arr *RawUint64List) EncodingSizeSSZ() int
- func (arr *RawUint64List) Get(index int) uint64
- func (arr *RawUint64List) HashSSZ() ([32]byte, error)
- func (arr *RawUint64List) Length() int
- func (arr *RawUint64List) MarshalJSON() ([]byte, error)
- func (arr *RawUint64List) Pop() uint64
- func (arr *RawUint64List) Range(fn func(index int, value uint64, length int) bool)
- func (arr *RawUint64List) Set(index int, v uint64)
- func (arr *RawUint64List) SetReusableHashBuffer(buf []byte)
- func (arr *RawUint64List) Static() bool
- func (arr *RawUint64List) UnmarshalJSON(data []byte) error
- type SyncCommittee
- func (s *SyncCommittee) AggregatePublicKey() (out libcommon.Bytes48)
- func (s *SyncCommittee) Clone() clonable.Clonable
- func (s *SyncCommittee) Copy() *SyncCommittee
- func (s *SyncCommittee) DecodeSSZ(buf []byte, _ int) error
- func (s *SyncCommittee) EncodeSSZ(dst []byte) ([]byte, error)
- func (s *SyncCommittee) EncodingSizeSSZ() int
- func (s *SyncCommittee) Equal(o *SyncCommittee) bool
- func (s *SyncCommittee) GetCommittee() []libcommon.Bytes48
- func (s *SyncCommittee) HashSSZ() ([32]byte, error)
- func (s *SyncCommittee) MarshalJSON() ([]byte, error)
- func (s *SyncCommittee) SetAggregatePublicKey(k libcommon.Bytes48)
- func (s *SyncCommittee) SetCommittee(committee []libcommon.Bytes48)
- func (s *SyncCommittee) Static() bool
- func (s *SyncCommittee) UnmarshalJSON(input []byte) error
- type TransactionsSSZ
- func (*TransactionsSSZ) Clone() clonable.Clonable
- func (t *TransactionsSSZ) DecodeSSZ(buf []byte, _ int) error
- func (t *TransactionsSSZ) EncodeSSZ(buf []byte) (dst []byte, err error)
- func (t *TransactionsSSZ) EncodingSizeSSZ() (size int)
- func (t *TransactionsSSZ) ForEach(fn func(tx []byte, idx int, total int) bool)
- func (t *TransactionsSSZ) HashSSZ() ([32]byte, error)
- func (t TransactionsSSZ) MarshalJSON() ([]byte, error)
- func (*TransactionsSSZ) Static() bool
- func (t *TransactionsSSZ) UnderlyngReference() [][]byte
- func (t *TransactionsSSZ) UnmarshalJSON(buf []byte) error
- type Uint64ListSSZ
- type Uint64VectorSSZ
- type Validator
- func (v Validator) ActivationEligibilityEpoch() uint64
- func (v Validator) ActivationEpoch() uint64
- func (v Validator) Active(epoch uint64) bool
- func (v Validator) Clone() clonable.Clonable
- func (v Validator) CopyHashBufferTo(o []byte) error
- func (v Validator) CopyTo(dst Validator)
- func (v Validator) DecodeSSZ(buf []byte, _ int) error
- func (v Validator) EffectiveBalance() uint64
- func (v Validator) EncodeSSZ(dst []byte) ([]byte, error)
- func (v Validator) EncodingSizeSSZ() int
- func (v Validator) ExitEpoch() uint64
- func (v Validator) HashSSZ() ([32]byte, error)
- func (v Validator) IsSlashable(epoch uint64) bool
- func (v Validator) MarshalJSON() ([]byte, error)
- func (v Validator) PublicKey() (o [48]byte)
- func (v Validator) PublicKeyBytes() (o []byte)
- func (v Validator) SetActivationEligibilityEpoch(i uint64)
- func (v Validator) SetActivationEpoch(i uint64)
- func (v Validator) SetEffectiveBalance(i uint64)
- func (v Validator) SetEffectiveBalanceFromBytes(b []byte)
- func (v Validator) SetExitEpoch(i uint64)
- func (v Validator) SetPublicKey(o [48]byte)
- func (v Validator) SetSlashed(b bool)
- func (v Validator) SetWithdrawableEpoch(i uint64)
- func (v Validator) SetWithdrawalCredentials(o common.Hash)
- func (v Validator) Slashed() bool
- func (v *Validator) UnmarshalJSON(input []byte) error
- func (v Validator) WithdrawableEpoch() uint64
- func (v Validator) WithdrawalCredentials() (o common.Hash)
- type ValidatorSet
- func (v *ValidatorSet) Append(val Validator)
- func (v *ValidatorSet) Bytes() []byte
- func (v *ValidatorSet) Cap() int
- func (v *ValidatorSet) Clear()
- func (v *ValidatorSet) Clone() clonable.Clonable
- func (v *ValidatorSet) CopyTo(t *ValidatorSet)
- func (v *ValidatorSet) DecodeSSZ(buf []byte, _ int) error
- func (v *ValidatorSet) EncodeSSZ(buf []byte) ([]byte, error)
- func (v *ValidatorSet) EncodingSizeSSZ() int
- func (v *ValidatorSet) Get(idx int) Validator
- func (v *ValidatorSet) HashSSZ() ([32]byte, error)
- func (v *ValidatorSet) IsCurrentMatchingHeadAttester(idx int) bool
- func (v *ValidatorSet) IsCurrentMatchingSourceAttester(idx int) bool
- func (v *ValidatorSet) IsCurrentMatchingTargetAttester(idx int) bool
- func (v *ValidatorSet) IsPreviousMatchingHeadAttester(idx int) bool
- func (v *ValidatorSet) IsPreviousMatchingSourceAttester(idx int) bool
- func (v *ValidatorSet) IsPreviousMatchingTargetAttester(idx int) bool
- func (v *ValidatorSet) Length() int
- func (v *ValidatorSet) MarshalJSON() ([]byte, error)
- func (v *ValidatorSet) MinCurrentInclusionDelayAttestation(idx int) *PendingAttestation
- func (v *ValidatorSet) MinPreviousInclusionDelayAttestation(idx int) *PendingAttestation
- func (v *ValidatorSet) Pop() Validator
- func (v *ValidatorSet) Range(fn func(int, Validator, int) bool)
- func (v *ValidatorSet) ReadMerkleTree(r io.Reader) error
- func (v *ValidatorSet) Set(idx int, val Validator)
- func (v *ValidatorSet) SetActivationEligibilityEpochForValidatorAtIndex(index int, epoch uint64)
- func (v *ValidatorSet) SetActivationEpochForValidatorAtIndex(index int, epoch uint64)
- func (v *ValidatorSet) SetEffectiveBalanceForValidatorAtIndex(index int, balance uint64)
- func (v *ValidatorSet) SetExitEpochForValidatorAtIndex(index int, epoch uint64)
- func (v *ValidatorSet) SetIsCurrentMatchingHeadAttester(idx int, val bool)
- func (v *ValidatorSet) SetIsCurrentMatchingSourceAttester(idx int, val bool)
- func (v *ValidatorSet) SetIsCurrentMatchingTargetAttester(idx int, val bool)
- func (v *ValidatorSet) SetIsPreviousMatchingHeadAttester(idx int, val bool)
- func (v *ValidatorSet) SetIsPreviousMatchingSourceAttester(idx int, val bool)
- func (v *ValidatorSet) SetIsPreviousMatchingTargetAttester(idx int, val bool)
- func (v *ValidatorSet) SetMinCurrentInclusionDelayAttestation(idx int, val *PendingAttestation)
- func (v *ValidatorSet) SetMinPreviousInclusionDelayAttestation(idx int, val *PendingAttestation)
- func (v *ValidatorSet) SetValidatorSlashed(index int, slashed bool)
- func (v *ValidatorSet) SetWithdrawableEpochForValidatorAtIndex(index int, epoch uint64)
- func (v *ValidatorSet) SetWithdrawalCredentialForValidatorAtIndex(index int, creds libcommon.Hash)
- func (*ValidatorSet) Static() bool
- func (v *ValidatorSet) UnmarshalJSON(data []byte) error
- func (arr *ValidatorSet) WriteMerkleTree(w io.Writer) error
Constants ¶
const ( IsCurrentMatchingSourceAttesterBit = 0x0 IsPreviousMatchingSourceAttesterBit = 0x1 IsCurrentMatchingTargetAttesterBit = 0x2 IsPreviousMatchingTargetAttesterBit = 0x3 IsCurrentMatchingHeadAttesterBit = 0x4 IsPreviousMatchingHeadAttesterBit = 0x5 )
const AttestationDataSize = 128
const CheckpointSizeSSZ = 40
Variables ¶
This section is empty.
Functions ¶
func IntersectionOfSortedSets ¶
func IntersectionOfSortedSets(v1, v2 IterableSSZ[uint64]) []uint64
func IsUint64SortedSet ¶
func IsUint64SortedSet(set IterableSSZ[uint64]) bool
Check if it is sorted and check if there are duplicates. O(N) complexity.
func NewUint64Slice ¶
func NewUint64Slice(limit int) *byteBasedUint64Slice
NewUint64Slice creates a new instance of byteBasedUint64Slice with a specified capacity limit.
Types ¶
type Attestation ¶
type Attestation struct { AggregationBits *BitList `json:"aggregation_bits"` Data *AttestationData `json:"data"` Signature libcommon.Bytes96 `json:"signature"` CommitteeBits *BitVector `json:"committee_bits,omitempty"` // Electra EIP-7549 }
Attestation type represents a statement or confirmation of some occurrence or phenomenon.
func (*Attestation) Clone ¶
func (a *Attestation) Clone() clonable.Clonable
Clone creates a new clone of the Attestation instance.
func (*Attestation) Copy ¶
func (a *Attestation) Copy() *Attestation
func (*Attestation) DecodeSSZ ¶
func (a *Attestation) DecodeSSZ(buf []byte, version int) error
DecodeSSZ decodes the provided buffer into the Attestation instance.
func (*Attestation) ElectraSingleCommitteeIndex ¶
func (a *Attestation) ElectraSingleCommitteeIndex() (uint64, error)
func (*Attestation) EncodeSSZ ¶
func (a *Attestation) EncodeSSZ(dst []byte) ([]byte, error)
EncodeSSZ encodes the Attestation instance into the provided buffer.
func (*Attestation) EncodingSizeSSZ ¶
func (a *Attestation) EncodingSizeSSZ() (size int)
EncodingSizeSSZ returns the size of the Attestation instance when encoded in SSZ format.
func (*Attestation) HashSSZ ¶
func (a *Attestation) HashSSZ() (o [32]byte, err error)
HashSSZ hashes the Attestation instance using SSZ.
func (*Attestation) Static ¶
func (*Attestation) Static() bool
Static returns whether the attestation is static or not. For Attestation, it's always false.
func (*Attestation) UnmarshalJSON ¶
func (a *Attestation) UnmarshalJSON(data []byte) error
Implement custom json unmarshalling for Attestation.
type AttestationData ¶
type AttestationData struct { Slot uint64 `json:"slot,string"` CommitteeIndex uint64 `json:"index,string"` // CommitteeIndex will be deprecated and always equal to 0 after Electra // LMD GHOST vote BeaconBlockRoot libcommon.Hash `json:"beacon_block_root"` // FFG vote Source Checkpoint `json:"source"` Target Checkpoint `json:"target"` }
AttestationData contains information about attestantion, including finalized/attested checkpoints.
func (*AttestationData) Clone ¶
func (a *AttestationData) Clone() clonable.Clonable
func (*AttestationData) DecodeSSZ ¶
func (a *AttestationData) DecodeSSZ(buf []byte, version int) error
func (*AttestationData) EncodingSizeSSZ ¶
func (a *AttestationData) EncodingSizeSSZ() int
func (*AttestationData) Equal ¶
func (a *AttestationData) Equal(other *AttestationData) bool
func (*AttestationData) HashSSZ ¶
func (a *AttestationData) HashSSZ() (o [32]byte, err error)
func (*AttestationData) Static ¶
func (a *AttestationData) Static() bool
type BitList ¶
type BitList struct {
// contains filtered or unexported fields
}
Bitlist is like a dynamic binary string. It's like a flipbook of 1s and 0s! And just like a flipbook, we can add (Append), remove (Pop), or look at any bit (Get) we want.
func BitlistFromBytes ¶
BitlistFromBytes is like getting a new Power Ranger from a civilian - we already have the bits!
func NewBitList ¶
NewBitList creates a brand new BitList, just like when Zordon created the Power Rangers! We make sure to set its length and capacity first.
func (*BitList) Append ¶
Append is like adding a new Power Ranger to the team - the bitlist gets bigger!
func (*BitList) Clear ¶
func (u *BitList) Clear()
Clear wipes the BitList clean, just like the memory wipe spell from a particularly forgetful wizard.
func (*BitList) Clone ¶
Clone creates a new BitList with the same length and capacity as the original. Note that the underlying byte slice is not copied.
func (*BitList) CopyTo ¶
func (u *BitList) CopyTo(target IterableSSZ[byte])
CopyTo is like a Power Rangers team up episode - we get the bits from another list!
func (*BitList) DecodeSSZ ¶
DecodeSSZ replaces the underlying byte slice of the BitList with a copy of the input byte slice. It then updates the length of the BitList to match the length of the new byte slice.
func (*BitList) EncodeSSZ ¶
EncodeSSZ appends the underlying byte slice of the BitList to the destination byte slice. It returns the resulting byte slice.
func (*BitList) EncodingSizeSSZ ¶
EncodingSizeSSZ returns the current length of the BitList. This is the number of bytes that would be written out when EncodeSSZ is called.
func (*BitList) Get ¶
Get lets us peek at a bit in the list, like when the team uses their sensors to spot the monster.
func (*BitList) Length ¶
Length gives us the length of the bitlist, just like a roll call tells us how many Rangers there are.
func (*BitList) MarshalJSON ¶
func (*BitList) Pop ¶
Pop removes the first bit from the list, like when the Red Ranger takes the first hit.
func (*BitList) Range ¶
Range allows us to do something to each bit in the list, just like a Power Rangers roll call.
func (*BitList) UnmarshalJSON ¶
type BitVector ¶
type BitVector struct {
// contains filtered or unexported fields
}
func NewBitVector ¶
func (*BitVector) EncodingSizeSSZ ¶
func (*BitVector) GetOnIndices ¶
func (*BitVector) MarshalJSON ¶
func (*BitVector) UnmarshalJSON ¶
type Checkpoint ¶
func (*Checkpoint) Clone ¶
func (c *Checkpoint) Clone() clonable.Clonable
Clone returns a new Checkpoint object that is a copy of the current object.
func (*Checkpoint) Copy ¶
func (c *Checkpoint) Copy() *Checkpoint
Copy returns a copy of the Checkpoint object.
func (*Checkpoint) DecodeSSZ ¶
func (c *Checkpoint) DecodeSSZ(buf []byte, version int) error
DecodeSSZ decodes the Checkpoint object from SSZ-encoded data.
func (*Checkpoint) EncodeSSZ ¶
func (c *Checkpoint) EncodeSSZ(dst []byte) ([]byte, error)
EncodeSSZ encodes the Checkpoint object into SSZ format.
func (*Checkpoint) EncodingSizeSSZ ¶
func (*Checkpoint) EncodingSizeSSZ() int
EncodingSizeSSZ returns the size of the Checkpoint object when encoded as SSZ.
func (*Checkpoint) Equal ¶
func (c *Checkpoint) Equal(other Checkpoint) bool
Equal checks if the Checkpoint object is equal to another Checkpoint object.
func (Checkpoint) HashSSZ ¶
func (c Checkpoint) HashSSZ() (o [32]byte, err error)
HashSSZ returns the hash of the Checkpoint object when encoded as SSZ.
func (Checkpoint) Static ¶
func (c Checkpoint) Static() bool
Static always returns true, indicating that the Checkpoint object is static.
type ExtraData ¶
type ExtraData struct {
// contains filtered or unexported fields
}
ExtraData type stores data as a byte slice and its length.
func NewExtraData ¶
func NewExtraData() *ExtraData
NewExtraData creates a new instance of ExtraData type with initialized byte slice of length 32.
func (*ExtraData) EncodingSizeSSZ ¶
EncodingSizeSSZ returns the length of ExtraData.
func (ExtraData) MarshalJSON ¶
func (*ExtraData) Static ¶
Static always returns false, indicating that the ExtraData object is not static.
func (*ExtraData) UnmarshalJSON ¶
type HashListSSZ ¶
type HashListSSZ interface { IterableSSZ[common.Hash] json.Marshaler json.Unmarshaler }
func NewHashList ¶
func NewHashList(c int) HashListSSZ
type HashVectorSSZ ¶
type HashVectorSSZ interface { IterableSSZ[common.Hash] json.Marshaler json.Unmarshaler }
func NewHashVector ¶
func NewHashVector(s int) HashVectorSSZ
type IterableSSZ ¶
type ListSSZ ¶
type ListSSZ[T encodableHashableSSZ] struct {
// contains filtered or unexported fields
}
func NewDynamicListSSZ ¶
func NewStaticListSSZ ¶
func (*ListSSZ[T]) ElementProof ¶
func (*ListSSZ[T]) EncodingSizeSSZ ¶
func (ListSSZ[T]) MarshalJSON ¶
func (*ListSSZ[T]) UnmarshalJSON ¶
type ParticipationBitList ¶
type ParticipationBitList struct {
// contains filtered or unexported fields
}
ParticipationBitList is like a dynamic binary string. It's like a flipbook of 1s and 0s! And just like a flipbook, we can add (Append), remove (Pop), or look at any bit (Get) we want.
func NewParticipationBitList ¶
func NewParticipationBitList(l int, c int) *ParticipationBitList
NewBitList creates a brand new BitList, just like when Zordon created the Power Rangers! We make sure to set its length and capacity first.
func ParticipationBitListFromBytes ¶
func ParticipationBitListFromBytes(xs []byte, c int) *ParticipationBitList
BitlistFromBytes is like getting a new Power Ranger from a civilian - we already have the bits!
func (*ParticipationBitList) Append ¶
func (u *ParticipationBitList) Append(v byte)
Append is like adding a new Power Ranger to the team - the bitlist gets bigger!
func (*ParticipationBitList) Bits ¶
func (u *ParticipationBitList) Bits() int
getBitlistLength return the amount of bits in given bitlist.
func (*ParticipationBitList) Bytes ¶
func (u *ParticipationBitList) Bytes() []byte
func (*ParticipationBitList) Cap ¶
func (u *ParticipationBitList) Cap() int
Cap gives capacity of the bitlist
func (*ParticipationBitList) Clear ¶
func (u *ParticipationBitList) Clear()
Clear wipes the BitList clean, just like the memory wipe spell from a particularly forgetful wizard.
func (*ParticipationBitList) Clone ¶
func (u *ParticipationBitList) Clone() clonable.Clonable
Clone creates a new BitList with the same length and capacity as the original. Note that the underlying byte slice is not copied.
func (*ParticipationBitList) Copy ¶
func (u *ParticipationBitList) Copy() *ParticipationBitList
func (*ParticipationBitList) CopyTo ¶
func (u *ParticipationBitList) CopyTo(target IterableSSZ[byte])
CopyTo is like a Power Rangers team up episode - we get the bits from another list!
func (*ParticipationBitList) DecodeSSZ ¶
func (u *ParticipationBitList) DecodeSSZ(dst []byte, _ int) error
DecodeSSZ replaces the underlying byte slice of the BitList with a copy of the input byte slice. It then updates the length of the BitList to match the length of the new byte slice.
func (*ParticipationBitList) EncodeSSZ ¶
func (u *ParticipationBitList) EncodeSSZ(dst []byte) ([]byte, error)
EncodeSSZ appends the underlying byte slice of the BitList to the destination byte slice. It returns the resulting byte slice.
func (*ParticipationBitList) EncodingSizeSSZ ¶
func (u *ParticipationBitList) EncodingSizeSSZ() int
EncodingSizeSSZ returns the current length of the BitList. This is the number of bytes that would be written out when EncodeSSZ is called.
func (*ParticipationBitList) Get ¶
func (u *ParticipationBitList) Get(index int) byte
Get lets us peek at a bit in the list, like when the team uses their sensors to spot the monster.
func (*ParticipationBitList) HashSSZ ¶
func (u *ParticipationBitList) HashSSZ() ([32]byte, error)
func (*ParticipationBitList) Length ¶
func (u *ParticipationBitList) Length() int
Length gives us the length of the bitlist, just like a roll call tells us how many Rangers there are.
func (*ParticipationBitList) MarshalJSON ¶
func (u *ParticipationBitList) MarshalJSON() ([]byte, error)
func (*ParticipationBitList) Pop ¶
func (u *ParticipationBitList) Pop() (x byte)
Pop removes the first bit from the list, like when the Red Ranger takes the first hit.
func (*ParticipationBitList) Range ¶
func (u *ParticipationBitList) Range(fn func(index int, value byte, length int) bool)
Range allows us to do something to each bit in the list, just like a Power Rangers roll call.
func (*ParticipationBitList) Set ¶
func (u *ParticipationBitList) Set(index int, v byte)
Set is like the Red Ranger giving an order - we set a bit to a certain value.
func (*ParticipationBitList) Static ¶
func (*ParticipationBitList) Static() bool
Static returns false, because BitLists, like Power Rangers, are dynamic!
func (*ParticipationBitList) UnmarshalJSON ¶
func (u *ParticipationBitList) UnmarshalJSON(input []byte) error
type PendingAttestation ¶
type PendingAttestation struct { AggregationBits *BitList `json:"aggregation_bits"` Data *AttestationData `json:"attestation_data"` InclusionDelay uint64 `json:"inclusion_delay,string"` ProposerIndex uint64 `json:"proposer_index,string"` }
func (*PendingAttestation) Clone ¶
func (*PendingAttestation) Clone() clonable.Clonable
func (*PendingAttestation) DecodeSSZ ¶
func (a *PendingAttestation) DecodeSSZ(buf []byte, _ int) error
func (*PendingAttestation) EncodeSSZ ¶
func (a *PendingAttestation) EncodeSSZ(dst []byte) ([]byte, error)
func (*PendingAttestation) EncodingSizeSSZ ¶
func (a *PendingAttestation) EncodingSizeSSZ() (size int)
func (*PendingAttestation) HashSSZ ¶
func (a *PendingAttestation) HashSSZ() (o [32]byte, err error)
func (*PendingAttestation) UnmarshalJSON ¶
func (p *PendingAttestation) UnmarshalJSON(data []byte) error
Implement custom json unmarshalling for Attestation.
type Phase0Data ¶
type Phase0Data struct { // MinInclusionDelay MinCurrentInclusionDelayAttestation *PendingAttestation MinPreviousInclusionDelayAttestation *PendingAttestation }
This is all stuff used by phase0 state transition. It makes many operations faster.
type RawUint64List ¶
type RawUint64List struct {
// contains filtered or unexported fields
}
func NewRawUint64List ¶
func NewRawUint64List(limit int, u []uint64) *RawUint64List
func (*RawUint64List) Append ¶
func (arr *RawUint64List) Append(value uint64)
func (*RawUint64List) Bytes ¶
func (arr *RawUint64List) Bytes() []byte
func (*RawUint64List) Cap ¶
func (arr *RawUint64List) Cap() int
func (*RawUint64List) Clear ¶
func (arr *RawUint64List) Clear()
func (*RawUint64List) Clone ¶
func (arr *RawUint64List) Clone() clonable.Clonable
func (*RawUint64List) CopyTo ¶
func (arr *RawUint64List) CopyTo(target IterableSSZ[uint64])
func (*RawUint64List) EncodeSSZ ¶
func (arr *RawUint64List) EncodeSSZ(buf []byte) (dst []byte, err error)
func (*RawUint64List) EncodingSizeSSZ ¶
func (arr *RawUint64List) EncodingSizeSSZ() int
func (*RawUint64List) Get ¶
func (arr *RawUint64List) Get(index int) uint64
func (*RawUint64List) HashSSZ ¶
func (arr *RawUint64List) HashSSZ() ([32]byte, error)
func (*RawUint64List) Length ¶
func (arr *RawUint64List) Length() int
func (*RawUint64List) MarshalJSON ¶
func (arr *RawUint64List) MarshalJSON() ([]byte, error)
func (*RawUint64List) Pop ¶
func (arr *RawUint64List) Pop() uint64
func (*RawUint64List) Range ¶
func (arr *RawUint64List) Range(fn func(index int, value uint64, length int) bool)
func (*RawUint64List) Set ¶
func (arr *RawUint64List) Set(index int, v uint64)
func (*RawUint64List) SetReusableHashBuffer ¶
func (arr *RawUint64List) SetReusableHashBuffer(buf []byte)
func (*RawUint64List) Static ¶
func (arr *RawUint64List) Static() bool
func (*RawUint64List) UnmarshalJSON ¶
func (arr *RawUint64List) UnmarshalJSON(data []byte) error
type SyncCommittee ¶
type SyncCommittee [syncCommitteeSize]byte
func NewSyncCommitteeFromParameters ¶
func NewSyncCommitteeFromParameters( committee []libcommon.Bytes48, aggregatePublicKey libcommon.Bytes48, ) *SyncCommittee
func (*SyncCommittee) AggregatePublicKey ¶
func (s *SyncCommittee) AggregatePublicKey() (out libcommon.Bytes48)
func (*SyncCommittee) Clone ¶
func (s *SyncCommittee) Clone() clonable.Clonable
func (*SyncCommittee) Copy ¶
func (s *SyncCommittee) Copy() *SyncCommittee
func (*SyncCommittee) EncodingSizeSSZ ¶
func (s *SyncCommittee) EncodingSizeSSZ() int
func (*SyncCommittee) Equal ¶
func (s *SyncCommittee) Equal(o *SyncCommittee) bool
func (*SyncCommittee) GetCommittee ¶
func (s *SyncCommittee) GetCommittee() []libcommon.Bytes48
func (*SyncCommittee) HashSSZ ¶
func (s *SyncCommittee) HashSSZ() ([32]byte, error)
func (*SyncCommittee) MarshalJSON ¶
func (s *SyncCommittee) MarshalJSON() ([]byte, error)
func (*SyncCommittee) SetAggregatePublicKey ¶
func (s *SyncCommittee) SetAggregatePublicKey(k libcommon.Bytes48)
func (*SyncCommittee) SetCommittee ¶
func (s *SyncCommittee) SetCommittee(committee []libcommon.Bytes48)
func (*SyncCommittee) Static ¶
func (s *SyncCommittee) Static() bool
func (*SyncCommittee) UnmarshalJSON ¶
func (s *SyncCommittee) UnmarshalJSON(input []byte) error
type TransactionsSSZ ¶
type TransactionsSSZ struct {
// contains filtered or unexported fields
}
func NewTransactionsSSZFromTransactions ¶
func NewTransactionsSSZFromTransactions(txs [][]byte) *TransactionsSSZ
func (*TransactionsSSZ) Clone ¶
func (*TransactionsSSZ) Clone() clonable.Clonable
func (*TransactionsSSZ) EncodeSSZ ¶
func (t *TransactionsSSZ) EncodeSSZ(buf []byte) (dst []byte, err error)
func (*TransactionsSSZ) EncodingSizeSSZ ¶
func (t *TransactionsSSZ) EncodingSizeSSZ() (size int)
func (*TransactionsSSZ) ForEach ¶
func (t *TransactionsSSZ) ForEach(fn func(tx []byte, idx int, total int) bool)
func (*TransactionsSSZ) HashSSZ ¶
func (t *TransactionsSSZ) HashSSZ() ([32]byte, error)
func (TransactionsSSZ) MarshalJSON ¶
func (t TransactionsSSZ) MarshalJSON() ([]byte, error)
func (*TransactionsSSZ) Static ¶
func (*TransactionsSSZ) Static() bool
func (*TransactionsSSZ) UnderlyngReference ¶
func (t *TransactionsSSZ) UnderlyngReference() [][]byte
func (*TransactionsSSZ) UnmarshalJSON ¶
func (t *TransactionsSSZ) UnmarshalJSON(buf []byte) error
type Uint64ListSSZ ¶
type Uint64ListSSZ interface { IterableSSZ[uint64] json.Marshaler json.Unmarshaler }
func NewUint64ListSSZ ¶
func NewUint64ListSSZ(limit int) Uint64ListSSZ
func NewUint64ListSSZFromSlice ¶
func NewUint64ListSSZFromSlice(limit int, slice []uint64) Uint64ListSSZ
type Uint64VectorSSZ ¶
type Uint64VectorSSZ interface { IterableSSZ[uint64] json.Marshaler json.Unmarshaler }
func NewUint64VectorSSZ ¶
func NewUint64VectorSSZ(size int) Uint64VectorSSZ
type Validator ¶
type Validator []byte
The Validator type represents an Ethereum 2.0 validator. It is stored as a flat buffer, which is a serialized representation of the struct. A flat buffer enables efficient read and write operations, as well as memory storage, without the need for serialization or deserialization.
func NewValidator ¶
func NewValidator() Validator
func NewValidatorFromParameters ¶
func NewValidatorFromParameters( PublicKey [48]byte, WithdrawalCredentials [32]byte, EffectiveBalance uint64, Slashed bool, ActivationEligibilityEpoch uint64, ActivationEpoch uint64, ExitEpoch uint64, WithdrawableEpoch uint64, ) Validator
NewValidatorFromParameters creates a new Validator object from the provided parameters. It is represented as a flat buffer.
func (Validator) ActivationEligibilityEpoch ¶
func (Validator) ActivationEpoch ¶
func (Validator) CopyHashBufferTo ¶
func (Validator) EffectiveBalance ¶
func (Validator) EncodingSizeSSZ ¶
func (Validator) IsSlashable ¶
func (Validator) MarshalJSON ¶
func (Validator) PublicKeyBytes ¶
func (Validator) SetActivationEligibilityEpoch ¶
func (Validator) SetActivationEpoch ¶
func (Validator) SetEffectiveBalance ¶
func (Validator) SetEffectiveBalanceFromBytes ¶
func (Validator) SetExitEpoch ¶
func (Validator) SetPublicKey ¶
func (Validator) SetSlashed ¶
func (Validator) SetWithdrawableEpoch ¶
func (Validator) SetWithdrawalCredentials ¶
func (*Validator) UnmarshalJSON ¶
func (Validator) WithdrawableEpoch ¶
func (Validator) WithdrawalCredentials ¶
type ValidatorSet ¶
type ValidatorSet struct { *merkle_tree.MerkleTree // contains filtered or unexported fields }
func NewValidatorSet ¶
func NewValidatorSet(c int) *ValidatorSet
func NewValidatorSetWithLength ¶
func NewValidatorSetWithLength(c int, l int) *ValidatorSet
func (*ValidatorSet) Append ¶
func (v *ValidatorSet) Append(val Validator)
func (*ValidatorSet) Bytes ¶
func (v *ValidatorSet) Bytes() []byte
func (*ValidatorSet) Cap ¶
func (v *ValidatorSet) Cap() int
func (*ValidatorSet) Clear ¶
func (v *ValidatorSet) Clear()
func (*ValidatorSet) Clone ¶
func (v *ValidatorSet) Clone() clonable.Clonable
func (*ValidatorSet) CopyTo ¶
func (v *ValidatorSet) CopyTo(t *ValidatorSet)
func (*ValidatorSet) EncodingSizeSSZ ¶
func (v *ValidatorSet) EncodingSizeSSZ() int
func (*ValidatorSet) Get ¶
func (v *ValidatorSet) Get(idx int) Validator
func (*ValidatorSet) HashSSZ ¶
func (v *ValidatorSet) HashSSZ() ([32]byte, error)
func (*ValidatorSet) IsCurrentMatchingHeadAttester ¶
func (v *ValidatorSet) IsCurrentMatchingHeadAttester(idx int) bool
func (*ValidatorSet) IsCurrentMatchingSourceAttester ¶
func (v *ValidatorSet) IsCurrentMatchingSourceAttester(idx int) bool
func (*ValidatorSet) IsCurrentMatchingTargetAttester ¶
func (v *ValidatorSet) IsCurrentMatchingTargetAttester(idx int) bool
func (*ValidatorSet) IsPreviousMatchingHeadAttester ¶
func (v *ValidatorSet) IsPreviousMatchingHeadAttester(idx int) bool
func (*ValidatorSet) IsPreviousMatchingSourceAttester ¶
func (v *ValidatorSet) IsPreviousMatchingSourceAttester(idx int) bool
func (*ValidatorSet) IsPreviousMatchingTargetAttester ¶
func (v *ValidatorSet) IsPreviousMatchingTargetAttester(idx int) bool
func (*ValidatorSet) Length ¶
func (v *ValidatorSet) Length() int
func (*ValidatorSet) MarshalJSON ¶
func (v *ValidatorSet) MarshalJSON() ([]byte, error)
func (*ValidatorSet) MinCurrentInclusionDelayAttestation ¶
func (v *ValidatorSet) MinCurrentInclusionDelayAttestation(idx int) *PendingAttestation
func (*ValidatorSet) MinPreviousInclusionDelayAttestation ¶
func (v *ValidatorSet) MinPreviousInclusionDelayAttestation(idx int) *PendingAttestation
func (*ValidatorSet) Pop ¶
func (v *ValidatorSet) Pop() Validator
func (*ValidatorSet) ReadMerkleTree ¶
func (v *ValidatorSet) ReadMerkleTree(r io.Reader) error
func (*ValidatorSet) Set ¶
func (v *ValidatorSet) Set(idx int, val Validator)
func (*ValidatorSet) SetActivationEligibilityEpochForValidatorAtIndex ¶
func (v *ValidatorSet) SetActivationEligibilityEpochForValidatorAtIndex(index int, epoch uint64)
func (*ValidatorSet) SetActivationEpochForValidatorAtIndex ¶
func (v *ValidatorSet) SetActivationEpochForValidatorAtIndex(index int, epoch uint64)
func (*ValidatorSet) SetEffectiveBalanceForValidatorAtIndex ¶
func (v *ValidatorSet) SetEffectiveBalanceForValidatorAtIndex(index int, balance uint64)
func (*ValidatorSet) SetExitEpochForValidatorAtIndex ¶
func (v *ValidatorSet) SetExitEpochForValidatorAtIndex(index int, epoch uint64)
func (*ValidatorSet) SetIsCurrentMatchingHeadAttester ¶
func (v *ValidatorSet) SetIsCurrentMatchingHeadAttester(idx int, val bool)
func (*ValidatorSet) SetIsCurrentMatchingSourceAttester ¶
func (v *ValidatorSet) SetIsCurrentMatchingSourceAttester(idx int, val bool)
func (*ValidatorSet) SetIsCurrentMatchingTargetAttester ¶
func (v *ValidatorSet) SetIsCurrentMatchingTargetAttester(idx int, val bool)
func (*ValidatorSet) SetIsPreviousMatchingHeadAttester ¶
func (v *ValidatorSet) SetIsPreviousMatchingHeadAttester(idx int, val bool)
func (*ValidatorSet) SetIsPreviousMatchingSourceAttester ¶
func (v *ValidatorSet) SetIsPreviousMatchingSourceAttester(idx int, val bool)
func (*ValidatorSet) SetIsPreviousMatchingTargetAttester ¶
func (v *ValidatorSet) SetIsPreviousMatchingTargetAttester(idx int, val bool)
func (*ValidatorSet) SetMinCurrentInclusionDelayAttestation ¶
func (v *ValidatorSet) SetMinCurrentInclusionDelayAttestation(idx int, val *PendingAttestation)
func (*ValidatorSet) SetMinPreviousInclusionDelayAttestation ¶
func (v *ValidatorSet) SetMinPreviousInclusionDelayAttestation(idx int, val *PendingAttestation)
func (*ValidatorSet) SetValidatorSlashed ¶
func (v *ValidatorSet) SetValidatorSlashed(index int, slashed bool)
func (*ValidatorSet) SetWithdrawableEpochForValidatorAtIndex ¶
func (v *ValidatorSet) SetWithdrawableEpochForValidatorAtIndex(index int, epoch uint64)
func (*ValidatorSet) SetWithdrawalCredentialForValidatorAtIndex ¶
func (v *ValidatorSet) SetWithdrawalCredentialForValidatorAtIndex(index int, creds libcommon.Hash)
func (*ValidatorSet) Static ¶
func (*ValidatorSet) Static() bool
func (*ValidatorSet) UnmarshalJSON ¶
func (v *ValidatorSet) UnmarshalJSON(data []byte) error
func (*ValidatorSet) WriteMerkleTree ¶
func (arr *ValidatorSet) WriteMerkleTree(w io.Writer) error
Source Files ¶
- attestation.go
- attestation_data.go
- bitlist.go
- bitvector.go
- checkpoint.go
- extra_data.go
- hash_list.go
- hash_vector.go
- hashutil.go
- interfaces.go
- list_ssz.go
- participation_bitlist.go
- pending_attestation.go
- ranger.go
- sync_committee.go
- transactions.go
- uint64_list.go
- uint64_raw_list.go
- uint64_vector.go
- uint64slice_byte.go
- validator.go
- validator_set.go