primitives

package
v0.1.1-experimental.5 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Code generated by fastssz. DO NOT EDIT. Hash: 35b728845b060bda9d981a0ca29f1602629802bf5e6ab14576244d963e35ad90 Version: 0.1.3

Code generated by fastssz. DO NOT EDIT. Hash: 78897c75db41c99d2a98ac3fbe573f969002de0ee429ca50b4ef7e46eb735fe3 Version: 0.1.3

Code generated by fastssz. DO NOT EDIT. Hash: 1751a6f0562963e421653d395e5ff2cf861a5a66368a1725ff298fe7a59c09fa Version: 0.1.3

Code generated by fastssz. DO NOT EDIT. Hash: c7a44f3e5fa5c31d87ad91f10a623314e5254d382a4ddb0b2644a236444cc17d Version: 0.1.3

Index

Constants

View Source
const (
	// WeiPerEther is the number of Wei in an Eth.
	WeiPerEther = 1e18

	// GweiPerEther is the number of Gwei in an Eth.
	GweiPerEther = 1e9

	// WeiPerGwei is the number of Wei in a Gwei.
	WeiPerGwei = 1e9
)

Variables

View Source
var (
	DomainTypeProposer          = DomainType{0x00, 0x00, 0x00, 0x00}
	DomainTypeAttester          = DomainType{0x01, 0x00, 0x00, 0x00}
	DomainTypeRandao            = DomainType{0x02, 0x00, 0x00, 0x00}
	DomainTypeDeposit           = DomainType{0x03, 0x00, 0x00, 0x00}
	DomainTypeVoluntaryExit     = DomainType{0x04, 0x00, 0x00, 0x00}
	DomainTypeSelectionProof    = DomainType{0x05, 0x00, 0x00, 0x00}
	DomainTypeAggregateAndProof = DomainType{0x06, 0x00, 0x00, 0x00}
	DomainTypeApplicationMask   = DomainType{0x00, 0x00, 0x00, 0x01}
)

Domain constants as defined in the Ethereum 2.0 specification: https://github.com/ethereum/consensus-specs/blob/dev/specs/phase0/beacon-chain.md#domain-types

View Source
var ErrInvalidBufferSize = errors.New("invalid buffer size")

ErrInvalidBufferSize indicates that the provided buffer size is invalid.

Functions

This section is empty.

Types

type BLSPubkey

type BLSPubkey = Bytes48

ValidatorIndex as per the Ethereum 2.0 Specification: https://github.com/ethereum/consensus-specs/blob/dev/specs/phase0/beacon-chain.md#custom-types

type BLSSignature

type BLSSignature = Bytes96

BLSSignature as per the Ethereum 2.0 Specification: https://github.com/ethereum/consensus-specs/blob/dev/specs/phase0/beacon-chain.md#custom-types

type BeaconBlockHeader

type BeaconBlockHeader struct {
	// Slot is the slot number of the block.
	Slot Slot `json:"slot"`
	// ProposerIndex is the index of the proposer of the block.
	ProposerIndex ValidatorIndex `json:"proposerIndex"`
	// ParentRoot is the root of the parent block.
	ParentRoot Root `json:"parentRoot"    ssz-size:"32"`
	// StateRoot is the root of the beacon state after executing
	// the block. Will be 0x00...00 prior to execution.
	StateRoot Root `json:"stateRoot"     ssz-size:"32"`
	// 	// BodyRoot is the root of the block body.
	BodyRoot Root `json:"bodyRoot"      ssz-size:"32"`
}

func (*BeaconBlockHeader) GetTree

func (b *BeaconBlockHeader) GetTree() (*ssz.Node, error)

GetTree ssz hashes the BeaconBlockHeader object

func (*BeaconBlockHeader) HashTreeRoot

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

HashTreeRoot ssz hashes the BeaconBlockHeader object

func (*BeaconBlockHeader) HashTreeRootWith

func (b *BeaconBlockHeader) HashTreeRootWith(hh ssz.HashWalker) (err error)

HashTreeRootWith ssz hashes the BeaconBlockHeader object with a hasher

func (BeaconBlockHeader) MarshalJSON

func (b BeaconBlockHeader) MarshalJSON() ([]byte, error)

MarshalJSON marshals as JSON.

func (*BeaconBlockHeader) MarshalSSZ

func (b *BeaconBlockHeader) MarshalSSZ() ([]byte, error)

MarshalSSZ ssz marshals the BeaconBlockHeader object

func (*BeaconBlockHeader) MarshalSSZTo

func (b *BeaconBlockHeader) MarshalSSZTo(buf []byte) (dst []byte, err error)

MarshalSSZTo ssz marshals the BeaconBlockHeader object to a target array

func (*BeaconBlockHeader) SizeSSZ

func (b *BeaconBlockHeader) SizeSSZ() (size int)

SizeSSZ returns the ssz encoded size in bytes for the BeaconBlockHeader object

func (*BeaconBlockHeader) String

func (h *BeaconBlockHeader) String() string

String returns a string representation of the beacon block header.

func (*BeaconBlockHeader) UnmarshalJSON

func (b *BeaconBlockHeader) UnmarshalJSON(input []byte) error

UnmarshalJSON unmarshals from JSON.

func (*BeaconBlockHeader) UnmarshalSSZ

func (b *BeaconBlockHeader) UnmarshalSSZ(buf []byte) error

UnmarshalSSZ ssz unmarshals the BeaconBlockHeader object

type Bytes32

type Bytes32 [32]byte

Bytes32 represents a 32-byte array.

func (Bytes32) MarshalText

func (h Bytes32) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface for Bytes32.

func (Bytes32) String

func (h Bytes32) String() string

String returns the hex string representation of Bytes32.

func (*Bytes32) UnmarshalJSON

func (h *Bytes32) UnmarshalJSON(input []byte) error

UnmarshalJSON implements the json.Unmarshaler interface for Bytes32.

func (*Bytes32) UnmarshalText

func (h *Bytes32) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface for Bytes32.

type Bytes4

type Bytes4 [4]byte

Bytes4 represents a 4-byte array.

func (Bytes4) MarshalText

func (h Bytes4) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface for Bytes4.

func (Bytes4) String

func (h Bytes4) String() string

String returns the hex string representation of Bytes4.

func (*Bytes4) UnmarshalJSON

func (h *Bytes4) UnmarshalJSON(input []byte) error

UnmarshalJSON implements the json.Unmarshaler interface for Bytes4.

func (*Bytes4) UnmarshalText

func (h *Bytes4) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface for Bytes4.

type Bytes48

type Bytes48 [48]byte

Bytes48 represents a 48-byte array.

func (Bytes48) MarshalText

func (h Bytes48) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface for Bytes48.

func (Bytes48) String

func (h Bytes48) String() string

String returns the hex string representation of Bytes48.

func (*Bytes48) UnmarshalJSON

func (h *Bytes48) UnmarshalJSON(input []byte) error

UnmarshalJSON implements the json.Unmarshaler interface for Bytes48.

func (*Bytes48) UnmarshalText

func (h *Bytes48) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface for Bytes48.

type Bytes96

type Bytes96 [96]byte

Bytes96 represents a 96-byte array.

func (Bytes96) MarshalText

func (h Bytes96) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface for Bytes96.

func (Bytes96) String

func (h Bytes96) String() string

String returns the hex string representation of Bytes96.

func (*Bytes96) UnmarshalJSON

func (h *Bytes96) UnmarshalJSON(input []byte) error

UnmarshalJSON implements the json.Unmarshaler interface for Bytes96.

func (*Bytes96) UnmarshalText

func (h *Bytes96) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface for Bytes96.

type CommitteeIndex

type CommitteeIndex uint64

CommitteeIndex as per the Ethereum 2.0 Specification: https://github.com/ethereum/consensus-specs/blob/dev/specs/phase0/beacon-chain.md#custom-types

type DomainType

type DomainType = Bytes4

DomainType as per the Ethereum 2.0 Specification: https://github.com/ethereum/consensus-specs/blob/dev/specs/phase0/beacon-chain.md#custom-types

type ExecutionAddress

type ExecutionAddress = common.Address

ExecutionAddress represents an address on the execution layer which is derived via secp256k1 w/recovery bit.

Related: https://eips.ethereum.org/EIPS/eip-55

type ExecutionBlock

type ExecutionBlock = coretypes.Block

ExecutionBlock represents a block on the execution layer.

type ExecutionHash

type ExecutionHash = common.Hash

ExecutionHash represents a hash on the execution layer which is currently a Keccak256 hash.

type ExecutionHeader

type ExecutionHeader = coretypes.Header

ExecutionHeader represents a header on the execution layer.

type Fork

type Fork struct {
	// PreviousVersion is the last version before the fork.
	PreviousVersion Version
	// CurrentVersion is the first version after the fork.
	CurrentVersion Version
	// Epoch is the epoch at which the fork occurred.
	Epoch Epoch
}

Fork as defined in the Ethereum 2.0 specification: https://github.com/ethereum/consensus-specs/blob/dev/specs/phase0/beacon-chain.md#fork

func (*Fork) GetTree

func (f *Fork) GetTree() (*ssz.Node, error)

GetTree ssz hashes the Fork object

func (*Fork) HashTreeRoot

func (f *Fork) HashTreeRoot() ([32]byte, error)

HashTreeRoot ssz hashes the Fork object

func (*Fork) HashTreeRootWith

func (f *Fork) HashTreeRootWith(hh ssz.HashWalker) (err error)

HashTreeRootWith ssz hashes the Fork object with a hasher

func (*Fork) MarshalSSZ

func (f *Fork) MarshalSSZ() ([]byte, error)

MarshalSSZ ssz marshals the Fork object

func (*Fork) MarshalSSZTo

func (f *Fork) MarshalSSZTo(buf []byte) (dst []byte, err error)

MarshalSSZTo ssz marshals the Fork object to a target array

func (*Fork) SizeSSZ

func (f *Fork) SizeSSZ() (size int)

SizeSSZ returns the ssz encoded size in bytes for the Fork object

func (*Fork) String

func (f *Fork) String() string

String returns a string representation of the fork.

func (*Fork) UnmarshalSSZ

func (f *Fork) UnmarshalSSZ(buf []byte) error

UnmarshalSSZ ssz unmarshals the Fork object

type ForkDigest

type ForkDigest = Bytes4

ForkDigest as per the Ethereum 2.0 Specification: https://github.com/ethereum/consensus-specs/blob/dev/specs/phase0/beacon-chain.md#custom-types

type Gwei

type Gwei uint64

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

type Root

type Root = Bytes32

Root as per the Ethereum 2.0 Specification: https://github.com/ethereum/consensus-specs/blob/dev/specs/phase0/beacon-chain.md#custom-types

func ComputeSigningRoot

func ComputeSigningRoot(
	sszObject interface{ HashTreeRoot() ([32]byte, error) },
	domain Domain,
) (Root, error)

ComputeSigningRoot as defined in the Ethereum 2.0 specification. https://github.com/ethereum/consensus-specs/blob/dev/specs/phase0/beacon-chain.md#compute_signing_root

func ComputeSigningRootUInt64

func ComputeSigningRootUInt64(
	value uint64,
	domain Domain,
) (Root, error)

ComputeSigningRootUInt64 computes the signing root of a uint64 value.

type SigningData

type SigningData struct {
	ObjectRoot Root   `ssz-size:"32"`
	Domain     Domain `ssz-size:"32"`
}

SigningData as defined in the Ethereum 2.0 specification. https://github.com/ethereum/consensus-specs/blob/dev/specs/phase0/beacon-chain.md#signingdata

func (*SigningData) GetTree

func (s *SigningData) GetTree() (*ssz.Node, error)

GetTree ssz hashes the SigningData object

func (*SigningData) HashTreeRoot

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

HashTreeRoot ssz hashes the SigningData object

func (*SigningData) HashTreeRootWith

func (s *SigningData) HashTreeRootWith(hh ssz.HashWalker) (err error)

HashTreeRootWith ssz hashes the SigningData object with a hasher

func (*SigningData) MarshalSSZ

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

MarshalSSZ ssz marshals the SigningData object

func (*SigningData) MarshalSSZTo

func (s *SigningData) MarshalSSZTo(buf []byte) (dst []byte, err error)

MarshalSSZTo ssz marshals the SigningData object to a target array

func (*SigningData) SizeSSZ

func (s *SigningData) SizeSSZ() (size int)

SizeSSZ returns the ssz encoded size in bytes for the SigningData object

func (*SigningData) UnmarshalSSZ

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

UnmarshalSSZ ssz unmarshals the SigningData object

type ValidatorIndex

type ValidatorIndex uint64

ValidatorIndex as per the Ethereum 2.0 Specification: https://github.com/ethereum/consensus-specs/blob/dev/specs/phase0/beacon-chain.md#custom-types

type Wei

type Wei struct {
	*uint256.Int
}

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

func WeiFromBytes

func WeiFromBytes(bz []byte) Wei

WeiFromBytes converts a Wei to a byte slice.

func ZeroWei

func ZeroWei() Wei

ZeroWei returns a zero Wei.

func (Wei) ToEther

func (w Wei) ToEther() string

WeiToEther returns the value of a Wei as an Ether. FOR DISPLAY PURPOSES ONLY. Do not use for actual blockchain things.

func (Wei) ToGwei

func (w Wei) ToGwei() Gwei

ToGwei converts Wei to uint64 gwei. It DOES not modify the underlying value.

type Withdrawal

type Withdrawal struct {
	Index     uint64           `json:"index"          ssz-size:"8"`
	Validator ValidatorIndex   `json:"validatorIndex" ssz-size:"8"`
	Address   ExecutionAddress `json:"address"        ssz-size:"20"`
	Amount    Gwei             `json:"amount"         ssz-size:"8"`
}

Withdrawal represents a validator withdrawal from the consensus layer.

func (*Withdrawal) Equals

func (w *Withdrawal) Equals(other *Withdrawal) bool

Equals returns true if the Withdrawal is equal to the other.

func (*Withdrawal) GetTree

func (w *Withdrawal) GetTree() (*ssz.Node, error)

GetTree ssz hashes the Withdrawal object

func (*Withdrawal) HashTreeRoot

func (w *Withdrawal) HashTreeRoot() ([32]byte, error)

HashTreeRoot ssz hashes the Withdrawal object

func (*Withdrawal) HashTreeRootWith

func (w *Withdrawal) HashTreeRootWith(hh ssz.HashWalker) (err error)

HashTreeRootWith ssz hashes the Withdrawal object with a hasher

func (Withdrawal) MarshalJSON

func (w Withdrawal) MarshalJSON() ([]byte, error)

MarshalJSON marshals as JSON.

func (*Withdrawal) MarshalSSZ

func (w *Withdrawal) MarshalSSZ() ([]byte, error)

MarshalSSZ ssz marshals the Withdrawal object

func (*Withdrawal) MarshalSSZTo

func (w *Withdrawal) MarshalSSZTo(buf []byte) (dst []byte, err error)

MarshalSSZTo ssz marshals the Withdrawal object to a target array

func (*Withdrawal) SizeSSZ

func (w *Withdrawal) SizeSSZ() (size int)

SizeSSZ returns the ssz encoded size in bytes for the Withdrawal object

func (*Withdrawal) String

func (w *Withdrawal) String() string

String returns a string representation of the Withdrawal.

func (*Withdrawal) UnmarshalJSON

func (w *Withdrawal) UnmarshalJSON(input []byte) error

UnmarshalJSON unmarshals from JSON.

func (*Withdrawal) UnmarshalSSZ

func (w *Withdrawal) UnmarshalSSZ(buf []byte) error

UnmarshalSSZ ssz unmarshals the Withdrawal object

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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