Documentation
¶
Overview ¶
Package types contains ETH2 data types shared between various parts of the system (beacon chain, validator, slasher).
Index ¶
- Variables
- func Add64(a, b uint64) (uint64, error)
- func Div64(a, b uint64) (uint64, error)
- func HexDecodeOrDie(t *testing.T, str string) []byte
- func Mod64(a, b uint64) (uint64, error)
- func Mul64(a, b uint64) (uint64, error)
- func Sub64(a, b uint64) (uint64, error)
- type CommitteeIndex
- func (c CommitteeIndex) HashTreeRoot() ([32]byte, error)
- func (c CommitteeIndex) HashTreeRootWith(hh *fssz.Hasher) error
- func (c *CommitteeIndex) MarshalSSZ() ([]byte, error)
- func (c *CommitteeIndex) MarshalSSZTo(dst []byte) ([]byte, error)
- func (c *CommitteeIndex) SizeSSZ() int
- func (c *CommitteeIndex) UnmarshalSSZ(buf []byte) error
- type Domain
- type Epoch
- func (e Epoch) Add(x uint64) Epoch
- func (e Epoch) AddEpoch(x Epoch) Epoch
- func (e Epoch) Div(x uint64) Epoch
- func (e Epoch) HashTreeRoot() ([32]byte, error)
- func (e Epoch) HashTreeRootWith(hh *fssz.Hasher) error
- func (e *Epoch) MarshalSSZ() ([]byte, error)
- func (e *Epoch) MarshalSSZTo(dst []byte) ([]byte, error)
- func (e Epoch) Mod(x uint64) Epoch
- func (e Epoch) Mul(x uint64) Epoch
- func (e Epoch) SafeAdd(x uint64) (Epoch, error)
- func (e Epoch) SafeAddEpoch(x Epoch) (Epoch, error)
- func (e Epoch) SafeDiv(x uint64) (Epoch, error)
- func (e Epoch) SafeMod(x uint64) (Epoch, error)
- func (e Epoch) SafeMul(x uint64) (Epoch, error)
- func (e Epoch) SafeSub(x uint64) (Epoch, error)
- func (e *Epoch) SizeSSZ() int
- func (e Epoch) Sub(x uint64) Epoch
- func (e *Epoch) UnmarshalSSZ(buf []byte) error
- type SSZBytes
- type SSZUint64
- func (s *SSZUint64) HashTreeRoot() ([32]byte, error)
- func (s *SSZUint64) HashTreeRootWith(hh *fssz.Hasher) error
- func (s *SSZUint64) MarshalSSZ() ([]byte, error)
- func (s *SSZUint64) MarshalSSZTo(dst []byte) ([]byte, error)
- func (s *SSZUint64) SizeSSZ() int
- func (s *SSZUint64) UnmarshalSSZ(buf []byte) error
- type Slot
- func (s Slot) Add(x uint64) Slot
- func (s Slot) AddSlot(x Slot) Slot
- func (s Slot) Div(x uint64) Slot
- func (s Slot) DivSlot(x Slot) Slot
- func (s Slot) HashTreeRoot() ([32]byte, error)
- func (s Slot) HashTreeRootWith(hh *fssz.Hasher) error
- func (s *Slot) MarshalSSZ() ([]byte, error)
- func (s *Slot) MarshalSSZTo(dst []byte) ([]byte, error)
- func (s Slot) Mod(x uint64) Slot
- func (s Slot) ModSlot(x Slot) Slot
- func (s Slot) Mul(x uint64) Slot
- func (s Slot) MulSlot(x Slot) Slot
- func (s Slot) SafeAdd(x uint64) (Slot, error)
- func (s Slot) SafeAddSlot(x Slot) (Slot, error)
- func (s Slot) SafeDiv(x uint64) (Slot, error)
- func (s Slot) SafeDivSlot(x Slot) (Slot, error)
- func (s Slot) SafeMod(x uint64) (Slot, error)
- func (s Slot) SafeModSlot(x Slot) (Slot, error)
- func (s Slot) SafeMul(x uint64) (Slot, error)
- func (s Slot) SafeMulSlot(x Slot) (Slot, error)
- func (s Slot) SafeSub(x uint64) (Slot, error)
- func (s Slot) SafeSubSlot(x Slot) (Slot, error)
- func (s *Slot) SizeSSZ() int
- func (s Slot) Sub(x uint64) Slot
- func (s Slot) SubSlot(x Slot) Slot
- func (s *Slot) UnmarshalSSZ(buf []byte) error
- type ValidatorIndex
- func (v ValidatorIndex) Add(x uint64) ValidatorIndex
- func (v ValidatorIndex) Div(x uint64) ValidatorIndex
- func (v ValidatorIndex) HashTreeRoot() ([32]byte, error)
- func (v ValidatorIndex) HashTreeRootWith(hh *fssz.Hasher) error
- func (v *ValidatorIndex) MarshalSSZ() ([]byte, error)
- func (v *ValidatorIndex) MarshalSSZTo(dst []byte) ([]byte, error)
- func (v ValidatorIndex) Mod(x uint64) ValidatorIndex
- func (v *ValidatorIndex) SizeSSZ() int
- func (v ValidatorIndex) Sub(x uint64) ValidatorIndex
- func (v *ValidatorIndex) UnmarshalSSZ(buf []byte) error
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func Add64 ¶
Add64 adds two 64-bit unsigned integers and checks if they lead to an overflow. If they do not, it returns the result without an error.
func Mod64 ¶
Mod64 finds remainder of division of two 64-bit unsigned integers and checks for errors.
Types ¶
type CommitteeIndex ¶
type CommitteeIndex uint64
CommitteeIndex in eth2.
func (CommitteeIndex) HashTreeRoot ¶
func (c CommitteeIndex) HashTreeRoot() ([32]byte, error)
HashTreeRoot returns calculated hash root.
func (CommitteeIndex) HashTreeRootWith ¶
func (c CommitteeIndex) HashTreeRootWith(hh *fssz.Hasher) error
HashWithDefaultHasher hashes a HashRoot object with a Hasher from the default HasherPool.
func (*CommitteeIndex) MarshalSSZ ¶
func (c *CommitteeIndex) MarshalSSZ() ([]byte, error)
MarshalSSZ marshals committee index into a serialized object.
func (*CommitteeIndex) MarshalSSZTo ¶
func (c *CommitteeIndex) MarshalSSZTo(dst []byte) ([]byte, error)
MarshalSSZTo marshals committee index with the provided byte slice.
func (*CommitteeIndex) SizeSSZ ¶
func (c *CommitteeIndex) SizeSSZ() int
SizeSSZ returns the size of the serialized object.
func (*CommitteeIndex) UnmarshalSSZ ¶
func (c *CommitteeIndex) UnmarshalSSZ(buf []byte) error
UnmarshalSSZ deserializes the provided bytes buffer into the committee index object.
type Domain ¶
type Domain []byte
Domain represents a 32 bytes domain object in Ethereum beacon chain consensus.
func (Domain) HashTreeRoot ¶
HashTreeRoot returns calculated hash root.
func (Domain) HashTreeRootWith ¶
HashTreeRootWith hashes a Domain object with a Hasher from the default HasherPool.
func (*Domain) MarshalSSZ ¶
MarshalSSZ marshals Domain into a serialized object.
func (*Domain) MarshalSSZTo ¶
MarshalSSZTo marshals Domain with the provided byte slice.
func (*Domain) UnmarshalSSZ ¶
UnmarshalSSZ deserializes the provided bytes buffer into the Domain object.
type Epoch ¶
type Epoch uint64
Epoch represents a single epoch.
func (Epoch) Add ¶
Add increases epoch by x. In case of arithmetic issues (overflow/underflow/div by zero) panic is thrown.
func (Epoch) AddEpoch ¶
AddEpoch increases epoch using another epoch value. In case of arithmetic issues (overflow/underflow/div by zero) panic is thrown.
func (Epoch) Div ¶
Div divides epoch by x. In case of arithmetic issues (overflow/underflow/div by zero) panic is thrown.
func (Epoch) HashTreeRoot ¶
HashTreeRoot returns calculated hash root.
func (Epoch) HashTreeRootWith ¶
HashWithDefaultHasher hashes a HashRoot object with a Hasher from the default HasherPool.
func (*Epoch) MarshalSSZ ¶
MarshalSSZ marshals epoch into a serialized object.
func (*Epoch) MarshalSSZTo ¶
MarshalSSZTo marshals epoch with the provided byte slice.
func (Epoch) Mod ¶
Mod returns result of `epoch % x`. In case of arithmetic issues (overflow/underflow/div by zero) panic is thrown.
func (Epoch) Mul ¶
Mul multiplies epoch by x. In case of arithmetic issues (overflow/underflow/div by zero) panic is thrown.
func (Epoch) SafeAdd ¶
SafeAdd increases epoch by x. In case of arithmetic issues (overflow/underflow/div by zero) error is returned.
func (Epoch) SafeAddEpoch ¶
SafeAddEpoch increases epoch using another epoch value. In case of arithmetic issues (overflow/underflow/div by zero) error is returned.
func (Epoch) SafeDiv ¶
SafeDiv divides epoch by x. In case of arithmetic issues (overflow/underflow/div by zero) error is returned.
func (Epoch) SafeMod ¶
SafeMod returns result of `epoch % x`. In case of arithmetic issues (overflow/underflow/div by zero) error is returned.
func (Epoch) SafeMul ¶
SafeMul multiplies epoch by x. In case of arithmetic issues (overflow/underflow/div by zero) error is returned.
func (Epoch) SafeSub ¶
SafeSub subtracts x from the epoch. In case of arithmetic issues (overflow/underflow/div by zero) error is returned.
func (Epoch) Sub ¶
Sub subtracts x from the epoch. In case of arithmetic issues (overflow/underflow/div by zero) panic is thrown.
func (*Epoch) UnmarshalSSZ ¶
UnmarshalSSZ deserializes the provided bytes buffer into the epoch object.
type SSZBytes ¶
type SSZBytes []byte
SSZUint64 is a bytes slice that satisfies the fast-ssz interface.
func (*SSZBytes) HashTreeRoot ¶
HashTreeRoot hashes the uint64 object following the SSZ standard.
type SSZUint64 ¶
type SSZUint64 uint64
SSZUint64 is a uint64 type that satisfies the fast-ssz interface.
func (*SSZUint64) HashTreeRoot ¶
HashTreeRoot returns calculated hash root.
func (*SSZUint64) HashTreeRootWith ¶
HashWithDefaultHasher hashes a HashRoot object with a Hasher from the default HasherPool.
func (*SSZUint64) MarshalSSZ ¶
MarshalSSZ marshals uin64 into a serialized object.
func (*SSZUint64) MarshalSSZTo ¶
MarshalSSZTo marshals the uint64 with the provided byte slice.
func (*SSZUint64) UnmarshalSSZ ¶
UnmarshalSSZ deserializes the provided bytes buffer into the uint64 object.
type Slot ¶
type Slot uint64
Slot represents a single slot.
func (Slot) Add ¶
Add increases slot by x. In case of arithmetic issues (overflow/underflow/div by zero) panic is thrown.
func (Slot) AddSlot ¶
AddSlot increases slot by another slot. In case of arithmetic issues (overflow/underflow/div by zero) panic is thrown.
func (Slot) Div ¶
Div divides slot by x. In case of arithmetic issues (overflow/underflow/div by zero) panic is thrown.
func (Slot) DivSlot ¶
DivSlot divides slot by another slot. In case of arithmetic issues (overflow/underflow/div by zero) panic is thrown.
func (Slot) HashTreeRoot ¶
HashTreeRoot returns calculated hash root.
func (Slot) HashTreeRootWith ¶
HashWithDefaultHasher hashes a HashRoot object with a Hasher from the default HasherPool.
func (*Slot) MarshalSSZ ¶
MarshalSSZ marshals slot into a serialized object.
func (*Slot) MarshalSSZTo ¶
MarshalSSZTo marshals slot with the provided byte slice.
func (Slot) Mod ¶
Mod returns result of `slot % x`. In case of arithmetic issues (overflow/underflow/div by zero) panic is thrown.
func (Slot) ModSlot ¶
ModSlot returns result of `slot % slot`. In case of arithmetic issues (overflow/underflow/div by zero) panic is thrown.
func (Slot) Mul ¶
Mul multiplies slot by x. In case of arithmetic issues (overflow/underflow/div by zero) panic is thrown.
func (Slot) MulSlot ¶
MulSlot multiplies slot by another slot. In case of arithmetic issues (overflow/underflow/div by zero) panic is thrown.
func (Slot) SafeAdd ¶
SafeAdd increases slot by x. In case of arithmetic issues (overflow/underflow/div by zero) error is returned.
func (Slot) SafeAddSlot ¶
SafeAddSlot increases slot by another slot. In case of arithmetic issues (overflow/underflow/div by zero) error is returned.
func (Slot) SafeDiv ¶
SafeDiv divides slot by x. In case of arithmetic issues (overflow/underflow/div by zero) error is returned.
func (Slot) SafeDivSlot ¶
SafeDivSlot divides slot by another slot. In case of arithmetic issues (overflow/underflow/div by zero) error is returned.
func (Slot) SafeMod ¶
SafeMod returns result of `slot % x`. In case of arithmetic issues (overflow/underflow/div by zero) error is returned.
func (Slot) SafeModSlot ¶
SafeModSlot returns result of `slot % slot`. In case of arithmetic issues (overflow/underflow/div by zero) error is returned.
func (Slot) SafeMul ¶
SafeMul multiplies slot by x. In case of arithmetic issues (overflow/underflow/div by zero) error is returned.
func (Slot) SafeMulSlot ¶
SafeMulSlot multiplies slot by another slot. In case of arithmetic issues (overflow/underflow/div by zero) error is returned.
func (Slot) SafeSub ¶
SafeSub subtracts x from the slot. In case of arithmetic issues (overflow/underflow/div by zero) error is returned.
func (Slot) SafeSubSlot ¶
SafeSubSlot finds difference between two slot values. In case of arithmetic issues (overflow/underflow/div by zero) error is returned.
func (Slot) Sub ¶
Sub subtracts x from the slot. In case of arithmetic issues (overflow/underflow/div by zero) panic is thrown.
func (Slot) SubSlot ¶
SubSlot finds difference between two slot values. In case of arithmetic issues (overflow/underflow/div by zero) panic is thrown.
func (*Slot) UnmarshalSSZ ¶
UnmarshalSSZ deserializes the provided bytes buffer into the slot object.
type ValidatorIndex ¶
type ValidatorIndex uint64
ValidatorIndex in eth2.
func (ValidatorIndex) Add ¶
func (v ValidatorIndex) Add(x uint64) ValidatorIndex
Add increases validator index by x.
func (ValidatorIndex) Div ¶
func (v ValidatorIndex) Div(x uint64) ValidatorIndex
Div divides validator index by x.
func (ValidatorIndex) HashTreeRoot ¶
func (v ValidatorIndex) HashTreeRoot() ([32]byte, error)
HashTreeRoot returns calculated hash root.
func (ValidatorIndex) HashTreeRootWith ¶
func (v ValidatorIndex) HashTreeRootWith(hh *fssz.Hasher) error
HashWithDefaultHasher hashes a HashRoot object with a Hasher from the default HasherPool.
func (*ValidatorIndex) MarshalSSZ ¶
func (v *ValidatorIndex) MarshalSSZ() ([]byte, error)
MarshalSSZ marshals validator index into a serialized object.
func (*ValidatorIndex) MarshalSSZTo ¶
func (v *ValidatorIndex) MarshalSSZTo(dst []byte) ([]byte, error)
MarshalSSZTo marshals validator index with the provided byte slice.
func (ValidatorIndex) Mod ¶
func (v ValidatorIndex) Mod(x uint64) ValidatorIndex
Mod returns result of `validator index % x`.
func (*ValidatorIndex) SizeSSZ ¶
func (v *ValidatorIndex) SizeSSZ() int
SizeSSZ returns the size of the serialized object.
func (ValidatorIndex) Sub ¶
func (v ValidatorIndex) Sub(x uint64) ValidatorIndex
Sub subtracts x from the validator index.
func (*ValidatorIndex) UnmarshalSSZ ¶
func (v *ValidatorIndex) UnmarshalSSZ(buf []byte) error
UnmarshalSSZ deserializes the provided bytes buffer into the validator index object.