primitives

package
v5.1.2-mekong Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2024 License: GPL-3.0 Imports: 9 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PointAtInfinity = append([]byte{0xC0}, make([]byte, 95)...)

Functions

func ConvertKzgCommitmentToVersionedHash added in v5.1.1

func ConvertKzgCommitmentToVersionedHash(commitment []byte) common.Hash

func NewAttestationCommitteeBits added in v5.1.0

func NewAttestationCommitteeBits() bitfield.Bitvector64

func WeiToBigInt added in v5.1.0

func WeiToBigInt(w Wei) *big.Int

WeiToBigInt is a convenience method to cast a wei back to a big int

Types

type CommitteeIndex

type CommitteeIndex uint64

CommitteeIndex --

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

HashTreeRootWith --

func (*CommitteeIndex) MarshalSSZ

func (c *CommitteeIndex) MarshalSSZ() ([]byte, error)

MarshalSSZ --

func (*CommitteeIndex) MarshalSSZTo

func (c *CommitteeIndex) MarshalSSZTo(dst []byte) ([]byte, error)

MarshalSSZTo --

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 --

type Domain

type Domain []byte

Domain represents a 32 bytes domain object in Ethereum beacon chain consensus.

func (Domain) HashTreeRoot

func (d Domain) HashTreeRoot() ([32]byte, error)

HashTreeRoot --

func (Domain) HashTreeRootWith

func (d Domain) HashTreeRootWith(hh *fssz.Hasher) error

HashTreeRootWith --

func (*Domain) MarshalSSZ

func (d *Domain) MarshalSSZ() ([]byte, error)

MarshalSSZ --

func (*Domain) MarshalSSZTo

func (d *Domain) MarshalSSZTo(dst []byte) ([]byte, error)

MarshalSSZTo --

func (*Domain) SizeSSZ

func (_ *Domain) SizeSSZ() int

SizeSSZ --

func (*Domain) UnmarshalSSZ

func (d *Domain) UnmarshalSSZ(buf []byte) error

UnmarshalSSZ --

type Epoch

type Epoch uint64

Epoch represents a single epoch.

func MaxEpoch

func MaxEpoch(a, b Epoch) Epoch

MaxEpoch compares two epochs and returns the greater one.

func (Epoch) Add

func (e Epoch) Add(x uint64) Epoch

Add increases epoch by x. In case of arithmetic issues (overflow/underflow/div by zero) panic is thrown.

func (Epoch) AddEpoch

func (e Epoch) AddEpoch(x Epoch) Epoch

AddEpoch increases epoch using another epoch value. In case of arithmetic issues (overflow/underflow/div by zero) panic is thrown.

func (Epoch) Div

func (e Epoch) Div(x uint64) Epoch

Div divides epoch by x. In case of arithmetic issues (overflow/underflow/div by zero) panic is thrown.

func (Epoch) HashTreeRoot

func (e Epoch) HashTreeRoot() ([32]byte, error)

HashTreeRoot --

func (Epoch) HashTreeRootWith

func (e Epoch) HashTreeRootWith(hh *fssz.Hasher) error

HashTreeRootWith --

func (*Epoch) MarshalSSZ

func (e *Epoch) MarshalSSZ() ([]byte, error)

MarshalSSZ --

func (*Epoch) MarshalSSZTo

func (e *Epoch) MarshalSSZTo(dst []byte) ([]byte, error)

MarshalSSZTo --

func (Epoch) Mod

func (e Epoch) Mod(x uint64) Epoch

Mod returns result of `epoch % x`. In case of arithmetic issues (overflow/underflow/div by zero) panic is thrown.

func (Epoch) Mul

func (e Epoch) Mul(x uint64) Epoch

Mul multiplies epoch by x. In case of arithmetic issues (overflow/underflow/div by zero) panic is thrown.

func (Epoch) SafeAdd

func (e Epoch) SafeAdd(x uint64) (Epoch, error)

SafeAdd increases epoch by x. In case of arithmetic issues (overflow/underflow/div by zero) error is returned.

func (Epoch) SafeAddEpoch

func (e Epoch) SafeAddEpoch(x Epoch) (Epoch, error)

SafeAddEpoch increases epoch using another epoch value. In case of arithmetic issues (overflow/underflow/div by zero) error is returned.

func (Epoch) SafeDiv

func (e Epoch) SafeDiv(x uint64) (Epoch, error)

SafeDiv divides epoch by x. In case of arithmetic issues (overflow/underflow/div by zero) error is returned.

func (Epoch) SafeMod

func (e Epoch) SafeMod(x uint64) (Epoch, error)

SafeMod returns result of `epoch % x`. In case of arithmetic issues (overflow/underflow/div by zero) error is returned.

func (Epoch) SafeMul

func (e Epoch) SafeMul(x uint64) (Epoch, error)

SafeMul multiplies epoch by x. In case of arithmetic issues (overflow/underflow/div by zero) error is returned.

func (Epoch) SafeSub

func (e Epoch) SafeSub(x uint64) (Epoch, error)

SafeSub subtracts x from the epoch. In case of arithmetic issues (overflow/underflow/div by zero) error is returned.

func (*Epoch) SizeSSZ

func (e *Epoch) SizeSSZ() int

SizeSSZ --

func (Epoch) Sub

func (e Epoch) Sub(x uint64) Epoch

Sub subtracts x from the epoch. In case of arithmetic issues (overflow/underflow/div by zero) panic is thrown.

func (*Epoch) UnmarshalSSZ

func (e *Epoch) UnmarshalSSZ(buf []byte) error

UnmarshalSSZ --

type ExecutionAddress

type ExecutionAddress [20]byte

type Gwei added in v5.1.0

type Gwei uint64

Gwei is a denomination of 1e9 Wei represented as an uint64.

func WeiToGwei added in v5.1.0

func WeiToGwei(v Wei) Gwei

WeiToGwei converts big int wei to uint64 gwei. The input `v` is copied before being modified.

func (Gwei) HashTreeRoot added in v5.1.0

func (g Gwei) HashTreeRoot() ([32]byte, error)

HashTreeRoot --

func (Gwei) HashTreeRootWith added in v5.1.0

func (g Gwei) HashTreeRootWith(hh *fssz.Hasher) error

HashTreeRootWith --

func (*Gwei) MarshalSSZ added in v5.1.0

func (g *Gwei) MarshalSSZ() ([]byte, error)

MarshalSSZ --

func (*Gwei) MarshalSSZTo added in v5.1.0

func (g *Gwei) MarshalSSZTo(dst []byte) ([]byte, error)

MarshalSSZTo --

func (*Gwei) SizeSSZ added in v5.1.0

func (g *Gwei) SizeSSZ() int

SizeSSZ --

func (*Gwei) UnmarshalSSZ added in v5.1.0

func (g *Gwei) UnmarshalSSZ(buf []byte) error

UnmarshalSSZ --

type PayloadID

type PayloadID [8]byte

PayloadID represents an execution engine Payload ID

type SSZBytes

type SSZBytes []byte

SSZBytes --

func (*SSZBytes) HashTreeRoot

func (b *SSZBytes) HashTreeRoot() ([32]byte, error)

HashTreeRoot --

func (*SSZBytes) HashTreeRootWith

func (b *SSZBytes) HashTreeRootWith(hh *fssz.Hasher) error

HashTreeRootWith --

type SSZUint64

type SSZUint64 uint64

SSZUint64 --

func (*SSZUint64) HashTreeRoot

func (s *SSZUint64) HashTreeRoot() ([32]byte, error)

HashTreeRoot --

func (*SSZUint64) HashTreeRootWith

func (s *SSZUint64) HashTreeRootWith(hh *fssz.Hasher) error

HashTreeRootWith --

func (*SSZUint64) MarshalSSZ

func (s *SSZUint64) MarshalSSZ() ([]byte, error)

MarshalSSZ --

func (*SSZUint64) MarshalSSZTo

func (s *SSZUint64) MarshalSSZTo(dst []byte) ([]byte, error)

MarshalSSZTo --

func (*SSZUint64) SizeSSZ

func (s *SSZUint64) SizeSSZ() int

SizeSSZ --

func (*SSZUint64) UnmarshalSSZ

func (s *SSZUint64) UnmarshalSSZ(buf []byte) error

UnmarshalSSZ --

type Slot

type Slot uint64

Slot represents a single slot.

func (Slot) Add

func (s Slot) Add(x uint64) Slot

Add increases slot by x. In case of arithmetic issues (overflow/underflow/div by zero) panic is thrown.

func (Slot) AddSlot

func (s Slot) AddSlot(x Slot) Slot

AddSlot increases slot by another slot. In case of arithmetic issues (overflow/underflow/div by zero) panic is thrown.

func (Slot) Div

func (s Slot) Div(x uint64) Slot

Div divides slot by x. In case of arithmetic issues (overflow/underflow/div by zero) panic is thrown.

func (Slot) DivSlot

func (s Slot) DivSlot(x Slot) Slot

DivSlot divides slot by another slot. In case of arithmetic issues (overflow/underflow/div by zero) panic is thrown.

func (Slot) FlooredSubSlot added in v5.0.4

func (s Slot) FlooredSubSlot(x Slot) Slot

FlooredSubSlot safely subtracts x from the slot, returning 0 if the result would underflow.

func (Slot) HashTreeRoot

func (s Slot) HashTreeRoot() ([32]byte, error)

HashTreeRoot --

func (Slot) HashTreeRootWith

func (s Slot) HashTreeRootWith(hh *fssz.Hasher) error

HashTreeRootWith --

func (*Slot) MarshalSSZ

func (s *Slot) MarshalSSZ() ([]byte, error)

MarshalSSZ --

func (*Slot) MarshalSSZTo

func (s *Slot) MarshalSSZTo(dst []byte) ([]byte, error)

MarshalSSZTo --

func (Slot) Mod

func (s Slot) Mod(x uint64) Slot

Mod returns result of `slot % x`. In case of arithmetic issues (overflow/underflow/div by zero) panic is thrown.

func (Slot) ModSlot

func (s Slot) ModSlot(x Slot) Slot

ModSlot returns result of `slot % slot`. In case of arithmetic issues (overflow/underflow/div by zero) panic is thrown.

func (Slot) Mul

func (s Slot) Mul(x uint64) Slot

Mul multiplies slot by x. In case of arithmetic issues (overflow/underflow/div by zero) panic is thrown.

func (Slot) MulSlot

func (s Slot) MulSlot(x Slot) Slot

MulSlot multiplies slot by another slot. In case of arithmetic issues (overflow/underflow/div by zero) panic is thrown.

func (Slot) SafeAdd

func (s Slot) SafeAdd(x uint64) (Slot, error)

SafeAdd increases slot by x. In case of arithmetic issues (overflow/underflow/div by zero) error is returned.

func (Slot) SafeAddSlot

func (s Slot) SafeAddSlot(x Slot) (Slot, error)

SafeAddSlot increases slot by another slot. In case of arithmetic issues (overflow/underflow/div by zero) error is returned.

func (Slot) SafeDiv

func (s Slot) SafeDiv(x uint64) (Slot, error)

SafeDiv divides slot by x. In case of arithmetic issues (overflow/underflow/div by zero) error is returned.

func (Slot) SafeDivSlot

func (s Slot) SafeDivSlot(x Slot) (Slot, error)

SafeDivSlot divides slot by another slot. In case of arithmetic issues (overflow/underflow/div by zero) error is returned.

func (Slot) SafeMod

func (s Slot) SafeMod(x uint64) (Slot, error)

SafeMod returns result of `slot % x`. In case of arithmetic issues (overflow/underflow/div by zero) error is returned.

func (Slot) SafeModSlot

func (s Slot) SafeModSlot(x Slot) (Slot, error)

SafeModSlot returns result of `slot % slot`. In case of arithmetic issues (overflow/underflow/div by zero) error is returned.

func (Slot) SafeMul

func (s Slot) SafeMul(x uint64) (Slot, error)

SafeMul multiplies slot by x. In case of arithmetic issues (overflow/underflow/div by zero) error is returned.

func (Slot) SafeMulSlot

func (s Slot) SafeMulSlot(x Slot) (Slot, error)

SafeMulSlot multiplies slot by another slot. In case of arithmetic issues (overflow/underflow/div by zero) error is returned.

func (Slot) SafeSub

func (s Slot) SafeSub(x uint64) (Slot, error)

SafeSub subtracts x from the slot. In case of arithmetic issues (overflow/underflow/div by zero) error is returned.

func (Slot) SafeSubSlot

func (s Slot) SafeSubSlot(x Slot) (Slot, error)

SafeSubSlot finds difference between two slot values. In case of arithmetic issues (overflow/underflow/div by zero) error is returned.

func (*Slot) SizeSSZ

func (s *Slot) SizeSSZ() int

SizeSSZ --

func (Slot) Sub

func (s Slot) Sub(x uint64) Slot

Sub subtracts x from the slot. In case of arithmetic issues (overflow/underflow/div by zero) panic is thrown.

func (Slot) SubSlot

func (s Slot) SubSlot(x Slot) Slot

SubSlot finds difference between two slot values. In case of arithmetic issues (overflow/underflow/div by zero) panic is thrown.

func (*Slot) UnmarshalSSZ

func (s *Slot) UnmarshalSSZ(buf []byte) error

UnmarshalSSZ --

type ValidatorIndex

type ValidatorIndex uint64

ValidatorIndex in eth2.

func (ValidatorIndex) Add

Add increases validator index by x.

func (ValidatorIndex) Div

Div divides validator index by x.

func (ValidatorIndex) HashTreeRoot

func (v ValidatorIndex) HashTreeRoot() ([32]byte, error)

HashTreeRoot --

func (ValidatorIndex) HashTreeRootWith

func (v ValidatorIndex) HashTreeRootWith(hh *fssz.Hasher) error

HashTreeRootWith --

func (*ValidatorIndex) MarshalSSZ

func (v *ValidatorIndex) MarshalSSZ() ([]byte, error)

MarshalSSZ --

func (*ValidatorIndex) MarshalSSZTo

func (v *ValidatorIndex) MarshalSSZTo(dst []byte) ([]byte, error)

MarshalSSZTo --

func (ValidatorIndex) Mod

Mod returns result of `validator index % x`.

func (*ValidatorIndex) SizeSSZ

func (v *ValidatorIndex) SizeSSZ() int

SizeSSZ --

func (ValidatorIndex) Sub

Sub subtracts x from the validator index.

func (*ValidatorIndex) UnmarshalSSZ

func (v *ValidatorIndex) UnmarshalSSZ(buf []byte) error

UnmarshalSSZ --

type Wei added in v5.1.0

type Wei *big.Int

Wei is the smallest unit of Ether, represented as a pointer to a bigInt.

func LittleEndianBytesToWei added in v5.1.0

func LittleEndianBytesToWei(value []byte) Wei

LittleEndianBytesToWei returns a Wei value given a little-endian binary representation. The only places we use this representation are in protobuf types that hold either the local execution payload bid or the builder bid. Going forward we should avoid that representation so this function being used in new places should be considered a code smell.

func Uint64ToWei added in v5.1.0

func Uint64ToWei(v uint64) Wei

Uint64ToWei creates a new Wei (aka big.Int) representing the given uint64 value.

func ZeroWei added in v5.1.0

func ZeroWei() Wei

ZW returns a non-nil zero value for primitives.Wei

Jump to

Keyboard shortcuts

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