common

package
v0.32.3 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2024 License: MIT Imports: 17 Imported by: 87

Documentation

Index

Constants

View Source
const ATTESTATION_SUBNET_COUNT = 64
View Source
const BASE_REWARDS_PER_EPOCH = 4
View Source
const BLOB_TX_TYPE = 0x03

Deneb

View Source
const BLSDomainTreeType = RootType
View Source
const BLSDomainTypeTreeType = Bytes4Type
View Source
const BLSPointType = RootType
View Source
const BLS_WITHDRAWAL_PREFIX = 0
View Source
const BYTES_PER_LOGS_BLOOM = 256
View Source
const Bytes32Type = RootType
View Source
const CommitteeIndexType = Uint64Type
View Source
const DEPOSIT_CONTRACT_TREE_DEPTH = 32
View Source
const EPOCHS_PER_RANDOM_SUBNET_SUBSCRIPTION = 256
View Source
const ETH1_ADDRESS_WITHDRAWAL_PREFIX = 1
View Source
const EpochType = Uint64Type
View Source
const Eth1AddressType = SmallByteVecMeta(20)
View Source
const FAR_FUTURE_EPOCH = Epoch(^uint64(0))
View Source
const ForkDigestType = Bytes4Type
View Source
const GweiType = Uint64Type
View Source
const Hash32Type = RootType
View Source
const JUSTIFICATION_BITS_LENGTH = 4
View Source
const KZGCommitmentSize = 48
View Source
const MAX_EXTRA_DATA_BYTES = 32
View Source
const MetadataByteLen = 8 + attnetByteLen + syncnetByteLen
View Source
const RANDOM_SUBNETS_PER_VALIDATOR = 1
View Source
const SECONDS_PER_DAY = 24 * 60 * 60
View Source
const SYNC_COMMITTEE_SUBNET_COUNT = 4
View Source
const SlotType = Uint64Type
View Source
const StatusByteLen = 4 + 32 + 8 + 32 + 8
View Source
const TARGET_AGGREGATORS_PER_COMMITTEE = 16
View Source
const TARGET_AGGREGATORS_PER_SYNC_SUBCOMMITTEE = 16
View Source
const TimestampType = Uint64Type
View Source
const VERSIONED_HASH_VERSION_KZG = 0x01
View Source
const ValidatorIndexMarker = ValidatorIndex(^uint64(0))

Custom constant, not in spec: An impossible high validator index used to mark special internal cases. (all 1s binary)

View Source
const ValidatorIndexType = Uint64Type
View Source
const VersionType = Bytes4Type
View Source
const WithdrawalIndexType = Uint64Type

Variables

View Source
var BLSPubkeyType = BasicVectorType(ByteType, 48)
View Source
var BLSSignatureType = BasicVectorType(ByteType, 96)
View Source
var BLSToExecutionChangeType = ContainerType("BLSToExecutionChange", []FieldDef{
	{"validator_index", ValidatorIndexType},
	{"from_bls_pubkey", BLSPubkeyType},
	{"to_execution_address", Eth1AddressType},
})
View Source
var BeaconBlockHeaderType = ContainerType("BeaconBlockHeader", []FieldDef{
	{"slot", SlotType},
	{"proposer_index", ValidatorIndexType},
	{"parent_root", RootType},
	{"state_root", RootType},
	{"body_root", RootType},
})
View Source
var CheckpointType = ContainerType("Checkpoint", []FieldDef{
	{"epoch", EpochType},
	{"root", RootType},
})
View Source
var DOMAIN_AGGREGATE_AND_PROOF = BLSDomainType{0x06, 0x00, 0x00, 0x00}
View Source
var DOMAIN_BEACON_ATTESTER = BLSDomainType{0x01, 0x00, 0x00, 0x00}
View Source
var DOMAIN_BEACON_PROPOSER = BLSDomainType{0x00, 0x00, 0x00, 0x00}

Phase0

View Source
var DOMAIN_BLS_TO_EXECUTION_CHANGE = BLSDomainType{0x0A, 0x00, 0x00, 0x00}

Capella

View Source
var DOMAIN_CONTRIBUTION_AND_PROOF = BLSDomainType{0x09, 0x00, 0x00, 0x00}
View Source
var DOMAIN_DEPOSIT = BLSDomainType{0x03, 0x00, 0x00, 0x00}
View Source
var DOMAIN_RANDAO = BLSDomainType{0x02, 0x00, 0x00, 0x00}
View Source
var DOMAIN_SELECTION_PROOF = BLSDomainType{0x05, 0x00, 0x00, 0x00}
View Source
var DOMAIN_SYNC_COMMITTEE = BLSDomainType{0x07, 0x00, 0x00, 0x00}

Altair

View Source
var DOMAIN_SYNC_COMMITTEE_SELECTION_PROOF = BLSDomainType{0x08, 0x00, 0x00, 0x00}
View Source
var DOMAIN_VOLUNTARY_EXIT = BLSDomainType{0x04, 0x00, 0x00, 0x00}
View Source
var DepositDataType = ContainerType("DepositData", []FieldDef{
	{"pubkey", BLSPubkeyType},
	{"withdrawal_credentials", Bytes32Type},
	{"amount", GweiType},
	{"signature", BLSSignatureType},
})
View Source
var DepositMessageType = ContainerType("DepositMessage", []FieldDef{
	{"pubkey", BLSPubkeyType},
	{"withdrawal_credentials", Bytes32Type},
	{"amount", GweiType},
})
View Source
var DepositProofType = VectorType(Bytes32Type, DEPOSIT_CONTRACT_TREE_DEPTH+1)
View Source
var DepositType = ContainerType("Deposit", []FieldDef{
	{"proof", DepositProofType},
	{"data", DepositDataType},
})
View Source
var Eth1DataType = ContainerType("Eth1Data", []FieldDef{
	{"deposit_root", RootType},
	{"deposit_count", Uint64Type},
	{"block_hash", Bytes32Type},
})
View Source
var ExtraDataType = BasicListType(Uint8Type, MAX_EXTRA_DATA_BYTES)
View Source
var ForkDataType = ContainerType("ForkData", []FieldDef{
	{"current_version", VersionType},
	{"genesis_validators_root", RootType},
})
View Source
var ForkType = ContainerType("Fork", []FieldDef{
	{"previous_version", VersionType},
	{"current_version", VersionType},
	{"epoch", EpochType},
})
View Source
var JustificationBitsType = BitVectorType(JUSTIFICATION_BITS_LENGTH)
View Source
var SignedBLSToExecutionChangeType = ContainerType("SignedBLSToExecutionChange", []FieldDef{
	{"message", BLSToExecutionChangeType},
	{"signature", BLSSignatureType},
})
View Source
var SignedBeaconBlockHeaderType = ContainerType("SignedBeaconBlockHeader", []FieldDef{
	{"message", BeaconBlockHeaderType},
	{"signature", BLSSignatureType},
})
View Source
var SigningDataType = ContainerType("SigningData", []FieldDef{
	{"object_root", RootType},
	{"domain", BLSDomainTreeType},
})
View Source
var WithdrawalType = ContainerType("Withdrawal", []FieldDef{
	{"index", WithdrawalIndexType},
	{"validator_index", ValidatorIndexType},
	{"address", Eth1AddressType},
	{"amount", GweiType},
})

Functions

func BlockSignedBLSToExecutionChangesType added in v0.29.0

func BlockSignedBLSToExecutionChangesType(spec *Spec) ListTypeDef

func CommitteeCount

func CommitteeCount(spec *Spec, activeValidators uint64) uint64

func DecreaseBalance

func DecreaseBalance(v BalancesRegistry, index ValidatorIndex, delta Gwei) error

func IncreaseBalance

func IncreaseBalance(v BalancesRegistry, index ValidatorIndex, delta Gwei) error

func PayloadTransactionsType added in v0.16.0

func PayloadTransactionsType(spec *Spec) ListTypeDef

func PostSlotTransition

func PostSlotTransition(ctx context.Context, spec *Spec, epc *EpochsContext, state BeaconState, benv *BeaconBlockEnvelope, validateResult bool) error

PostSlotTransition finishes a state transition after applying ProcessSlots(..., block.Slot).

func PrepareRandao

func PrepareRandao(mixes RandaoMixes, epoch Epoch) error

Prepare the randao mix for the given epoch by copying over the mix from the previous epoch.

func ProcessHeader

func ProcessHeader(ctx context.Context, spec *Spec, state BeaconState, header *BeaconBlockHeader, expectedProposer ValidatorIndex) error

func ProcessSlot

func ProcessSlot(ctx context.Context, _ *Spec, state BeaconState) error

func ProcessSlots

func ProcessSlots(ctx context.Context, spec *Spec, epc *EpochsContext, state UpgradeableBeaconState, slot Slot) error

Process the state to the given slot. Returns an error if the slot is older than the state is already at. Mutates the state, does not copy.

func SetRecentRoots

func SetRecentRoots(spec *Spec, state BeaconState, slot Slot, blockRoot Root, stateRoot Root) error

func ShuffleList

func ShuffleList(rounds uint8, input []ValidatorIndex, seed Root)

ShuffleList shuffles a list, using the given seed for randomness.

func StateTransition

func StateTransition(ctx context.Context, spec *Spec, epc *EpochsContext, state UpgradeableBeaconState, benv *BeaconBlockEnvelope, validateResult bool) error

StateTransition to the slot of the given block, then process the block. Returns an error if the slot is older or equal to what the state is already at. Mutates the state, does not copy.

func SyncCommitteePubkeysType added in v0.16.0

func SyncCommitteePubkeysType(spec *Spec) *ComplexVectorTypeDef

func SyncCommitteeType added in v0.16.0

func SyncCommitteeType(spec *Spec) *ContainerTypeDef

func TransactionType added in v0.19.0

func TransactionType(spec *Spec) *BasicListTypeDef

func UnshuffleList

func UnshuffleList(rounds uint8, input []ValidatorIndex, seed Root)

UnshuffleList undoes a list shuffling using the seed of the shuffling.

func UpdateHistoricalRoots

func UpdateHistoricalRoots(state BeaconState) error

func WithdrawalsType added in v0.29.0

func WithdrawalsType(spec *Spec) ListTypeDef

Types

type AltairPreset added in v0.16.0

type AltairPreset struct {
	// Updated penalty values
	INACTIVITY_PENALTY_QUOTIENT_ALTAIR      Uint64View `yaml:"INACTIVITY_PENALTY_QUOTIENT_ALTAIR" json:"INACTIVITY_PENALTY_QUOTIENT_ALTAIR"`
	MIN_SLASHING_PENALTY_QUOTIENT_ALTAIR    Uint64View `yaml:"MIN_SLASHING_PENALTY_QUOTIENT_ALTAIR" json:"MIN_SLASHING_PENALTY_QUOTIENT_ALTAIR"`
	PROPORTIONAL_SLASHING_MULTIPLIER_ALTAIR Uint64View `yaml:"PROPORTIONAL_SLASHING_MULTIPLIER_ALTAIR" json:"PROPORTIONAL_SLASHING_MULTIPLIER_ALTAIR"`

	// Sync committee
	SYNC_COMMITTEE_SIZE              Uint64View `yaml:"SYNC_COMMITTEE_SIZE" json:"SYNC_COMMITTEE_SIZE"`
	EPOCHS_PER_SYNC_COMMITTEE_PERIOD Epoch      `yaml:"EPOCHS_PER_SYNC_COMMITTEE_PERIOD" json:"EPOCHS_PER_SYNC_COMMITTEE_PERIOD"`

	// Sync committees and light clients
	MIN_SYNC_COMMITTEE_PARTICIPANTS Uint64View `yaml:"MIN_SYNC_COMMITTEE_PARTICIPANTS" json:"MIN_SYNC_COMMITTEE_PARTICIPANTS"`
}

type AttnetBits

type AttnetBits [attnetByteLen]byte

func (*AttnetBits) BitLen

func (ab *AttnetBits) BitLen() uint64

func (AttnetBits) ByteLength

func (p AttnetBits) ByteLength() uint64

func (*AttnetBits) Deserialize

func (p *AttnetBits) Deserialize(dr *codec.DecodingReader) error

func (AttnetBits) FixedLength

func (AttnetBits) FixedLength() uint64

func (AttnetBits) HashTreeRoot

func (p AttnetBits) HashTreeRoot(_ tree.HashFn) (out Root)

func (AttnetBits) MarshalText

func (p AttnetBits) MarshalText() ([]byte, error)

func (AttnetBits) Serialize

func (p AttnetBits) Serialize(w *codec.EncodingWriter) error

func (AttnetBits) String

func (p AttnetBits) String() string

func (*AttnetBits) UnmarshalText

func (p *AttnetBits) UnmarshalText(text []byte) error

type BLSDomain

type BLSDomain [32]byte

BLS domain (8 bytes): fork version (32 bits) concatenated with BLS domain type (32 bits)

func ComputeDomain

func ComputeDomain(domainType BLSDomainType, forkVersion Version, genesisValidatorsRoot Root) (out BLSDomain)

func GetDomain

func GetDomain(state BeaconState, dom BLSDomainType, messageEpoch Epoch) (BLSDomain, error)

Return the signature domain (fork version concatenated with domain type) of a message.

func (*BLSDomain) ByteLength added in v0.16.1

func (a *BLSDomain) ByteLength() uint64

func (*BLSDomain) Deserialize

func (dom *BLSDomain) Deserialize(dr *codec.DecodingReader) error

func (*BLSDomain) FixedLength

func (a *BLSDomain) FixedLength() uint64

func (BLSDomain) HashTreeRoot

func (dom BLSDomain) HashTreeRoot(hFn tree.HashFn) Root

func (*BLSDomain) Serialize added in v0.16.1

func (dom *BLSDomain) Serialize(w *codec.EncodingWriter) error

func (BLSDomain) String

func (dom BLSDomain) String() string

type BLSDomainFn

type BLSDomainFn func(typ BLSDomainType, epoch Epoch) (BLSDomain, error)

Sometimes a beacon state is not available, or too much for what it is good for. Functions that just need a specific BLS domain can use this function.

type BLSDomainType

type BLSDomainType [4]byte

Mixed into a BLS domain to define its type

func (*BLSDomainType) ByteLength added in v0.16.1

func (dt *BLSDomainType) ByteLength() uint64

func (*BLSDomainType) Deserialize added in v0.16.1

func (dt *BLSDomainType) Deserialize(dr *codec.DecodingReader) error

func (*BLSDomainType) FixedLength added in v0.16.1

func (dt *BLSDomainType) FixedLength() uint64

func (BLSDomainType) HashTreeRoot added in v0.16.1

func (dt BLSDomainType) HashTreeRoot(hFn tree.HashFn) Root

func (BLSDomainType) MarshalText

func (dt BLSDomainType) MarshalText() ([]byte, error)

func (*BLSDomainType) Serialize added in v0.16.1

func (dt *BLSDomainType) Serialize(w *codec.EncodingWriter) error

func (BLSDomainType) String

func (dt BLSDomainType) String() string

func (*BLSDomainType) UnmarshalText

func (dt *BLSDomainType) UnmarshalText(text []byte) error

type BLSPoint added in v0.16.1

type BLSPoint = Root

TODO: BLSPoint can be customized to have more bls-specific functionality and checks (e.g. modulus, not full 256 bits)

type BLSPubkey

type BLSPubkey [48]byte

func AsBLSPubkey

func AsBLSPubkey(v View, err error) (BLSPubkey, error)

func (BLSPubkey) ByteLength added in v0.17.0

func (BLSPubkey) ByteLength() uint64

func (*BLSPubkey) Deserialize added in v0.17.0

func (p *BLSPubkey) Deserialize(dr *codec.DecodingReader) error

func (BLSPubkey) FixedLength added in v0.17.0

func (BLSPubkey) FixedLength() uint64

func (BLSPubkey) HashTreeRoot added in v0.17.0

func (p BLSPubkey) HashTreeRoot(hFn tree.HashFn) tree.Root

func (BLSPubkey) MarshalText added in v0.17.0

func (p BLSPubkey) MarshalText() ([]byte, error)

func (*BLSPubkey) Pubkey added in v0.17.0

func (p *BLSPubkey) Pubkey() (*blsu.Pubkey, error)

func (*BLSPubkey) Serialize added in v0.17.0

func (p *BLSPubkey) Serialize(w *codec.EncodingWriter) error

func (BLSPubkey) String added in v0.17.0

func (p BLSPubkey) String() string

func (*BLSPubkey) UnmarshalText added in v0.17.0

func (p *BLSPubkey) UnmarshalText(text []byte) error

type BLSPubkeyView

type BLSPubkeyView struct {
	*BasicVectorView
}

func ViewPubkey

func ViewPubkey(pub *BLSPubkey) *BLSPubkeyView

type BLSSignature

type BLSSignature [96]byte

func AsBLSSignature

func AsBLSSignature(v View, err error) (BLSSignature, error)

func (BLSSignature) ByteLength added in v0.17.0

func (BLSSignature) ByteLength() uint64

func (*BLSSignature) Deserialize added in v0.17.0

func (s *BLSSignature) Deserialize(dr *codec.DecodingReader) error

func (BLSSignature) FixedLength added in v0.17.0

func (BLSSignature) FixedLength() uint64

func (BLSSignature) HashTreeRoot added in v0.17.0

func (s BLSSignature) HashTreeRoot(hFn tree.HashFn) tree.Root

func (BLSSignature) MarshalText added in v0.17.0

func (p BLSSignature) MarshalText() ([]byte, error)

func (*BLSSignature) Serialize added in v0.17.0

func (s *BLSSignature) Serialize(w *codec.EncodingWriter) error

func (*BLSSignature) Signature added in v0.17.0

func (p *BLSSignature) Signature() (*blsu.Signature, error)

func (BLSSignature) String added in v0.17.0

func (p BLSSignature) String() string

func (*BLSSignature) UnmarshalText added in v0.17.0

func (p *BLSSignature) UnmarshalText(text []byte) error

type BLSSignatureView

type BLSSignatureView struct {
	*BasicVectorView
}

func ViewSignature

func ViewSignature(sig *BLSSignature) *BLSSignatureView

type BLSToExecutionChange added in v0.29.0

type BLSToExecutionChange struct {
	ValidatorIndex     ValidatorIndex `json:"validator_index" yaml:"validator_index"`
	FromBLSPubKey      BLSPubkey      `json:"from_bls_pubkey" yaml:"from_bls_pubkey"`
	ToExecutionAddress Eth1Address    `json:"to_execution_address" yaml:"to_execution_address"`
}

func (*BLSToExecutionChange) ByteLength added in v0.29.0

func (s *BLSToExecutionChange) ByteLength() uint64

func (*BLSToExecutionChange) Deserialize added in v0.29.0

func (s *BLSToExecutionChange) Deserialize(dr *codec.DecodingReader) error

func (*BLSToExecutionChange) FixedLength added in v0.29.0

func (s *BLSToExecutionChange) FixedLength() uint64

func (*BLSToExecutionChange) HashTreeRoot added in v0.29.0

func (s *BLSToExecutionChange) HashTreeRoot(hFn tree.HashFn) Root

func (*BLSToExecutionChange) Serialize added in v0.29.0

func (*BLSToExecutionChange) View added in v0.29.0

type BLSToExecutionChangeView added in v0.29.0

type BLSToExecutionChangeView struct {
	*ContainerView
}

func AsBLSToExecutionChange added in v0.29.0

func AsBLSToExecutionChange(v View, err error) (*BLSToExecutionChangeView, error)

func (*BLSToExecutionChangeView) FromBLSPubKey added in v0.29.0

func (v *BLSToExecutionChangeView) FromBLSPubKey() (BLSPubkey, error)

func (*BLSToExecutionChangeView) Raw added in v0.29.0

func (*BLSToExecutionChangeView) ToExecutionAddress added in v0.29.0

func (v *BLSToExecutionChangeView) ToExecutionAddress() (Eth1Address, error)

func (*BLSToExecutionChangeView) ValidatorIndex added in v0.29.0

func (v *BLSToExecutionChangeView) ValidatorIndex() (ValidatorIndex, error)

type BalancesRegistry added in v0.19.0

type BalancesRegistry interface {
	GetBalance(index ValidatorIndex) (Gwei, error)
	SetBalance(index ValidatorIndex, bal Gwei) error
	AppendBalance(bal Gwei) error
	Iter() (next func() (bal Gwei, ok bool, err error))
	AllBalances() ([]Gwei, error)
	Length() (uint64, error)
}

type BatchRoots

type BatchRoots interface {
	GetRoot(slot Slot) (Root, error)
	SetRoot(slot Slot, r Root) error
	HashTreeRoot(fn tree.HashFn) Root
}

type BeaconBlockEnvelope

type BeaconBlockEnvelope struct {
	ForkDigest ForkDigest

	// Block header details
	BeaconBlockHeader

	// Fork-specific block body
	Body SpecObj

	// Cached block root (hash-tree-root of Message)
	BlockRoot Root

	// Block signature
	Signature BLSSignature
}

func (*BeaconBlockEnvelope) VerifySignature

func (b *BeaconBlockEnvelope) VerifySignature(spec *Spec, genesisValidatorsRoot Root, proposer ValidatorIndex, pub *CachedPubkey) bool

func (*BeaconBlockEnvelope) VerifySignatureVersioned added in v0.16.0

func (b *BeaconBlockEnvelope) VerifySignatureVersioned(spec *Spec, version Version, genesisValidatorsRoot Root, proposer ValidatorIndex, cachedPub *CachedPubkey) bool

type BeaconBlockHeader

type BeaconBlockHeader struct {
	Slot          Slot           `json:"slot" yaml:"slot"`
	ProposerIndex ValidatorIndex `json:"proposer_index" yaml:"proposer_index"`
	ParentRoot    Root           `json:"parent_root" yaml:"parent_root"`
	StateRoot     Root           `json:"state_root" yaml:"state_root"`
	BodyRoot      Root           `json:"body_root" yaml:"body_root"`
}

func (*BeaconBlockHeader) ByteLength

func (s *BeaconBlockHeader) ByteLength() uint64

func (*BeaconBlockHeader) Deserialize

func (s *BeaconBlockHeader) Deserialize(dr *codec.DecodingReader) error

func (*BeaconBlockHeader) FixedLength

func (b *BeaconBlockHeader) FixedLength() uint64

func (*BeaconBlockHeader) HashTreeRoot

func (b *BeaconBlockHeader) HashTreeRoot(hFn tree.HashFn) Root

func (*BeaconBlockHeader) Serialize

func (s *BeaconBlockHeader) Serialize(w *codec.EncodingWriter) error

func (*BeaconBlockHeader) View

type BeaconBlockHeaderView

type BeaconBlockHeaderView struct {
	*ContainerView
}

func AsBeaconBlockHeader

func AsBeaconBlockHeader(v View, err error) (*BeaconBlockHeaderView, error)

func (*BeaconBlockHeaderView) BodyRoot

func (v *BeaconBlockHeaderView) BodyRoot() (Root, error)

func (*BeaconBlockHeaderView) ParentRoot

func (v *BeaconBlockHeaderView) ParentRoot() (Root, error)

func (*BeaconBlockHeaderView) ProposerIndex

func (v *BeaconBlockHeaderView) ProposerIndex() (ValidatorIndex, error)

func (*BeaconBlockHeaderView) Raw

func (*BeaconBlockHeaderView) SetStateRoot

func (v *BeaconBlockHeaderView) SetStateRoot(root Root) error

func (*BeaconBlockHeaderView) Slot

func (v *BeaconBlockHeaderView) Slot() (Slot, error)

func (*BeaconBlockHeaderView) StateRoot

func (v *BeaconBlockHeaderView) StateRoot() (Root, error)

type BeaconState

type BeaconState interface {
	view.View

	GenesisTime() (Timestamp, error)
	SetGenesisTime(t Timestamp) error
	GenesisValidatorsRoot() (Root, error)
	SetGenesisValidatorsRoot(r Root) error

	Slot() (Slot, error)
	SetSlot(slot Slot) error
	Fork() (Fork, error)
	SetFork(f Fork) error
	// Returns a copy of the latest header in the state
	LatestBlockHeader() (*BeaconBlockHeader, error)
	SetLatestBlockHeader(v *BeaconBlockHeader) error
	BlockRoots() (BatchRoots, error)
	StateRoots() (BatchRoots, error)
	HistoricalRoots() (HistoricalRoots, error)
	Eth1Data() (Eth1Data, error)
	SetEth1Data(v Eth1Data) error
	Eth1DataVotes() (Eth1DataVotes, error)
	Eth1DepositIndex() (DepositIndex, error)
	IncrementDepositIndex() error

	Validators() (ValidatorRegistry, error)

	Balances() (BalancesRegistry, error)
	SetBalances(balances []Gwei) error

	AddValidator(spec *Spec, pub BLSPubkey, withdrawalCreds Root, balance Gwei) error

	RandaoMixes() (RandaoMixes, error)
	SeedRandao(spec *Spec, seed Root) error

	Slashings() (Slashings, error)

	JustificationBits() (JustificationBits, error)
	SetJustificationBits(bits JustificationBits) error

	PreviousJustifiedCheckpoint() (Checkpoint, error)
	SetPreviousJustifiedCheckpoint(c Checkpoint) error
	CurrentJustifiedCheckpoint() (Checkpoint, error)
	SetCurrentJustifiedCheckpoint(c Checkpoint) error
	FinalizedCheckpoint() (Checkpoint, error)
	SetFinalizedCheckpoint(c Checkpoint) error

	HashTreeRoot(fn tree.HashFn) Root
	CopyState() (BeaconState, error)

	ForkSettings(spec *Spec) *ForkSettings

	// ProcessEpoch applies an epoch-transition to the state.
	ProcessEpoch(ctx context.Context, spec *Spec, epc *EpochsContext) error
	// ProcessBlock applies a block to the state.
	// Excludes slot processing and signature validation. Just applies the block as-is. Error if mismatching slot.
	ProcessBlock(ctx context.Context, spec *Spec, epc *EpochsContext, benv *BeaconBlockEnvelope) error
}

type BellatrixPreset added in v0.25.0

type BellatrixPreset struct {
	INACTIVITY_PENALTY_QUOTIENT_BELLATRIX      Uint64View `yaml:"INACTIVITY_PENALTY_QUOTIENT_BELLATRIX" json:"INACTIVITY_PENALTY_QUOTIENT_BELLATRIX"`
	MIN_SLASHING_PENALTY_QUOTIENT_BELLATRIX    Uint64View `yaml:"MIN_SLASHING_PENALTY_QUOTIENT_BELLATRIX" json:"MIN_SLASHING_PENALTY_QUOTIENT_BELLATRIX"`
	PROPORTIONAL_SLASHING_MULTIPLIER_BELLATRIX Uint64View `yaml:"PROPORTIONAL_SLASHING_MULTIPLIER_BELLATRIX" json:"PROPORTIONAL_SLASHING_MULTIPLIER_BELLATRIX"`
	MAX_BYTES_PER_TRANSACTION                  Uint64View `yaml:"MAX_BYTES_PER_TRANSACTION" json:"MAX_BYTES_PER_TRANSACTION"`
	MAX_TRANSACTIONS_PER_PAYLOAD               Uint64View `yaml:"MAX_TRANSACTIONS_PER_PAYLOAD" json:"MAX_TRANSACTIONS_PER_PAYLOAD"`
	BYTES_PER_LOGS_BLOOM                       Uint64View `yaml:"BYTES_PER_LOGS_BLOOM" json:"BYTES_PER_LOGS_BLOOM"`
	MAX_EXTRA_DATA_BYTES                       Uint64View `yaml:"MAX_EXTRA_DATA_BYTES" json:"MAX_EXTRA_DATA_BYTES"`
}

type BoundedIndex

type BoundedIndex struct {
	Index      ValidatorIndex
	Activation Epoch
	Exit       Epoch
}

func LoadBoundedIndices

func LoadBoundedIndices(validators ValidatorRegistry) ([]BoundedIndex, error)

type Bytes32 added in v0.16.0

type Bytes32 = Root

type CachedPubkey

type CachedPubkey struct {
	Compressed BLSPubkey
	// contains filtered or unexported fields
}

func (*CachedPubkey) Pubkey added in v0.17.0

func (c *CachedPubkey) Pubkey() (*blsu.Pubkey, error)

type CapellaPreset added in v0.29.0

type CapellaPreset struct {
	MAX_BLS_TO_EXECUTION_CHANGES         Uint64View `yaml:"MAX_BLS_TO_EXECUTION_CHANGES" json:"MAX_BLS_TO_EXECUTION_CHANGES"`
	MAX_WITHDRAWALS_PER_PAYLOAD          Uint64View `yaml:"MAX_WITHDRAWALS_PER_PAYLOAD" json:"MAX_WITHDRAWALS_PER_PAYLOAD"`
	MAX_VALIDATORS_PER_WITHDRAWALS_SWEEP Uint64View `yaml:"MAX_VALIDATORS_PER_WITHDRAWALS_SWEEP" json:"MAX_VALIDATORS_PER_WITHDRAWALS_SWEEP"`
}

type Checkpoint

type Checkpoint struct {
	Epoch Epoch `json:"epoch" yaml:"epoch"`
	Root  Root  `json:"root" yaml:"root"`
}

func (*Checkpoint) ByteLength

func (a *Checkpoint) ByteLength() uint64

func (*Checkpoint) Deserialize

func (c *Checkpoint) Deserialize(dr *codec.DecodingReader) error

func (*Checkpoint) FixedLength

func (g *Checkpoint) FixedLength() uint64

func (*Checkpoint) HashTreeRoot

func (c *Checkpoint) HashTreeRoot(hFn tree.HashFn) Root

func (*Checkpoint) Serialize

func (a *Checkpoint) Serialize(w *codec.EncodingWriter) error

func (*Checkpoint) String

func (c *Checkpoint) String() string

func (*Checkpoint) View

func (c *Checkpoint) View() *CheckpointView

type CheckpointView

type CheckpointView struct {
	*ContainerView
}

func AsCheckPoint

func AsCheckPoint(v View, err error) (*CheckpointView, error)

func (*CheckpointView) Epoch

func (v *CheckpointView) Epoch() (Epoch, error)

func (*CheckpointView) Raw

func (v *CheckpointView) Raw() (Checkpoint, error)

func (*CheckpointView) Root

func (v *CheckpointView) Root() (Root, error)

func (*CheckpointView) Set

func (v *CheckpointView) Set(ch *Checkpoint) error

type CommitteeIndex

type CommitteeIndex Uint64View

func AsCommitteeIndex

func AsCommitteeIndex(v View, err error) (CommitteeIndex, error)

func (CommitteeIndex) ByteLength

func (CommitteeIndex) ByteLength() uint64

func (*CommitteeIndex) Deserialize

func (i *CommitteeIndex) Deserialize(dr *codec.DecodingReader) error

func (CommitteeIndex) FixedLength

func (CommitteeIndex) FixedLength() uint64

func (CommitteeIndex) HashTreeRoot

func (i CommitteeIndex) HashTreeRoot(hFn tree.HashFn) Root

func (CommitteeIndex) MarshalJSON

func (e CommitteeIndex) MarshalJSON() ([]byte, error)

func (CommitteeIndex) Serialize

func (i CommitteeIndex) Serialize(w *codec.EncodingWriter) error

func (CommitteeIndex) String

func (e CommitteeIndex) String() string

func (*CommitteeIndex) UnmarshalJSON

func (e *CommitteeIndex) UnmarshalJSON(b []byte) error

type CommitteeIndices

type CommitteeIndices []ValidatorIndex

func (CommitteeIndices) ByteLength

func (a CommitteeIndices) ByteLength(*Spec) uint64

func (*CommitteeIndices) Deserialize

func (p *CommitteeIndices) Deserialize(spec *Spec, dr *codec.DecodingReader) error

func (*CommitteeIndices) FixedLength

func (*CommitteeIndices) FixedLength(*Spec) uint64

func (CommitteeIndices) HashTreeRoot

func (p CommitteeIndices) HashTreeRoot(spec *Spec, hFn tree.HashFn) Root

func (CommitteeIndices) Serialize

func (a CommitteeIndices) Serialize(_ *Spec, w *codec.EncodingWriter) error

type Config added in v0.16.0

type Config struct {
	PRESET_BASE string `yaml:"PRESET_BASE" json:"PRESET_BASE"`

	CONFIG_NAME string `yaml:"CONFIG_NAME" json:"CONFIG_NAME"`

	// Transition
	TERMINAL_TOTAL_DIFFICULTY            Uint256View `yaml:"TERMINAL_TOTAL_DIFFICULTY" json:"TERMINAL_TOTAL_DIFFICULTY"`
	TERMINAL_BLOCK_HASH                  Hash32      `yaml:"TERMINAL_BLOCK_HASH" json:"TERMINAL_BLOCK_HASH"`
	TERMINAL_BLOCK_HASH_ACTIVATION_EPOCH Epoch       `yaml:"TERMINAL_BLOCK_HASH_ACTIVATION_EPOCH" json:"TERMINAL_BLOCK_HASH_ACTIVATION_EPOCH"`

	// Genesis.
	MIN_GENESIS_ACTIVE_VALIDATOR_COUNT Uint64View `yaml:"MIN_GENESIS_ACTIVE_VALIDATOR_COUNT" json:"MIN_GENESIS_ACTIVE_VALIDATOR_COUNT"`
	MIN_GENESIS_TIME                   Timestamp  `yaml:"MIN_GENESIS_TIME" json:"MIN_GENESIS_TIME"`
	GENESIS_FORK_VERSION               Version    `yaml:"GENESIS_FORK_VERSION" json:"GENESIS_FORK_VERSION"`
	GENESIS_DELAY                      Timestamp  `yaml:"GENESIS_DELAY" json:"GENESIS_DELAY"`

	// Altair
	ALTAIR_FORK_VERSION Version `yaml:"ALTAIR_FORK_VERSION" json:"ALTAIR_FORK_VERSION"`
	ALTAIR_FORK_EPOCH   Epoch   `yaml:"ALTAIR_FORK_EPOCH" json:"ALTAIR_FORK_EPOCH"`

	// Bellatrix
	BELLATRIX_FORK_VERSION Version `yaml:"BELLATRIX_FORK_VERSION" json:"BELLATRIX_FORK_VERSION"`
	BELLATRIX_FORK_EPOCH   Epoch   `yaml:"BELLATRIX_FORK_EPOCH" json:"BELLATRIX_FORK_EPOCH"`

	// Capella
	CAPELLA_FORK_VERSION Version `yaml:"CAPELLA_FORK_VERSION" json:"CAPELLA_FORK_VERSION"`
	CAPELLA_FORK_EPOCH   Epoch   `yaml:"CAPELLA_FORK_EPOCH" json:"CAPELLA_FORK_EPOCH"`

	// Deneb
	DENEB_FORK_VERSION Version `yaml:"DENEB_FORK_VERSION" json:"DENEB_FORK_VERSION"`
	DENEB_FORK_EPOCH   Epoch   `yaml:"DENEB_FORK_EPOCH" json:"DENEB_FORK_EPOCH"`

	// EIP6110
	EIP6110_FORK_VERSION Version `yaml:"EIP6110_FORK_VERSION" json:"EIP6110_FORK_VERSION"`
	EIP6110_FORK_EPOCH   Epoch   `yaml:"EIP6110_FORK_EPOCH" json:"EIP6110_FORK_EPOCH"`

	// EIP7002
	EIP7002_FORK_VERSION Version `yaml:"EIP7002_FORK_VERSION" json:"EIP7002_FORK_VERSION"`
	EIP7002_FORK_EPOCH   Epoch   `yaml:"EIP7002_FORK_EPOCH" json:"EIP7002_FORK_EPOCH"`

	// WHISK
	WHISK_FORK_VERSION Version `yaml:"WHISK_FORK_VERSION" json:"WHISK_FORK_VERSION"`
	WHISK_FORK_EPOCH   Epoch   `yaml:"WHISK_FORK_EPOCH" json:"WHISK_FORK_EPOCH"`

	// Time parameters
	SECONDS_PER_SLOT                    Timestamp  `yaml:"SECONDS_PER_SLOT" json:"SECONDS_PER_SLOT"`
	SECONDS_PER_ETH1_BLOCK              Uint64View `yaml:"SECONDS_PER_ETH1_BLOCK" json:"SECONDS_PER_ETH1_BLOCK"`
	MIN_VALIDATOR_WITHDRAWABILITY_DELAY Epoch      `yaml:"MIN_VALIDATOR_WITHDRAWABILITY_DELAY" json:"MIN_VALIDATOR_WITHDRAWABILITY_DELAY"`
	SHARD_COMMITTEE_PERIOD              Epoch      `yaml:"SHARD_COMMITTEE_PERIOD" json:"SHARD_COMMITTEE_PERIOD"`
	ETH1_FOLLOW_DISTANCE                Uint64View `yaml:"ETH1_FOLLOW_DISTANCE" json:"ETH1_FOLLOW_DISTANCE"`

	// Validator cycle
	INACTIVITY_SCORE_BIAS          Uint64View `yaml:"INACTIVITY_SCORE_BIAS" json:"INACTIVITY_SCORE_BIAS"`
	INACTIVITY_SCORE_RECOVERY_RATE Uint64View `yaml:"INACTIVITY_SCORE_RECOVERY_RATE" json:"INACTIVITY_SCORE_RECOVERY_RATE"`
	EJECTION_BALANCE               Gwei       `yaml:"EJECTION_BALANCE" json:"EJECTION_BALANCE"`
	MIN_PER_EPOCH_CHURN_LIMIT      Uint64View `yaml:"MIN_PER_EPOCH_CHURN_LIMIT" json:"MIN_PER_EPOCH_CHURN_LIMIT"`
	CHURN_LIMIT_QUOTIENT           Uint64View `yaml:"CHURN_LIMIT_QUOTIENT" json:"CHURN_LIMIT_QUOTIENT"`
	// New in Deneb:EIP7514
	MAX_PER_EPOCH_ACTIVATION_CHURN_LIMIT Uint64View `yaml:"MAX_PER_EPOCH_ACTIVATION_CHURN_LIMIT" json:"MAX_PER_EPOCH_ACTIVATION_CHURN_LIMIT"`

	// Fork choice
	PROPOSER_SCORE_BOOST                Uint64View `yaml:"PROPOSER_SCORE_BOOST" json:"PROPOSER_SCORE_BOOST"`
	REORG_HEAD_WEIGHT_THRESHOLD         Uint64View `yaml:"REORG_HEAD_WEIGHT_THRESHOLD" json:"REORG_HEAD_WEIGHT_THRESHOLD"`
	REORG_PARENT_WEIGHT_THRESHOLD       Uint64View `yaml:"REORG_PARENT_WEIGHT_THRESHOLD" json:"REORG_PARENT_WEIGHT_THRESHOLD"`
	REORG_MAX_EPOCHS_SINCE_FINALIZATION Epoch      `yaml:"REORG_MAX_EPOCHS_SINCE_FINALIZATION" json:"REORG_MAX_EPOCHS_SINCE_FINALIZATION"`

	// Deposit contract
	DEPOSIT_CHAIN_ID         Uint64View  `yaml:"DEPOSIT_CHAIN_ID" json:"DEPOSIT_CHAIN_ID"`
	DEPOSIT_NETWORK_ID       Uint64View  `yaml:"DEPOSIT_NETWORK_ID" json:"DEPOSIT_NETWORK_ID"`
	DEPOSIT_CONTRACT_ADDRESS Eth1Address `yaml:"DEPOSIT_CONTRACT_ADDRESS" json:"DEPOSIT_CONTRACT_ADDRESS"`

	// Networking
	GOSSIP_MAX_SIZE                    Uint64View           `yaml:"GOSSIP_MAX_SIZE" json:"GOSSIP_MAX_SIZE"`
	MAX_REQUEST_BLOCKS                 Uint64View           `yaml:"MAX_REQUEST_BLOCKS" json:"MAX_REQUEST_BLOCKS"`
	EPOCHS_PER_SUBNET_SUBSCRIPTION     Uint64View           `yaml:"EPOCHS_PER_SUBNET_SUBSCRIPTION" json:"EPOCHS_PER_SUBNET_SUBSCRIPTION"`
	MIN_EPOCHS_FOR_BLOCK_REQUESTS      Uint64View           `yaml:"MIN_EPOCHS_FOR_BLOCK_REQUESTS" json:"MIN_EPOCHS_FOR_BLOCK_REQUESTS"`
	MAX_CHUNK_SIZE                     Uint64View           `yaml:"MAX_CHUNK_SIZE" json:"MAX_CHUNK_SIZE"`
	TTFB_TIMEOUT                       Uint64View           `yaml:"TTFB_TIMEOUT" json:"TTFB_TIMEOUT"`
	RESP_TIMEOUT                       Uint64View           `yaml:"RESP_TIMEOUT" json:"RESP_TIMEOUT"`
	ATTESTATION_PROPAGATION_SLOT_RANGE Uint64View           `yaml:"ATTESTATION_PROPAGATION_SLOT_RANGE" json:"ATTESTATION_PROPAGATION_SLOT_RANGE"`
	MAXIMUM_GOSSIP_CLOCK_DISPARITY     Uint64View           `yaml:"MAXIMUM_GOSSIP_CLOCK_DISPARITY" json:"MAXIMUM_GOSSIP_CLOCK_DISPARITY"`
	MESSAGE_DOMAIN_INVALID_SNAPPY      NetworkMessageDomain `yaml:"MESSAGE_DOMAIN_INVALID_SNAPPY" json:"MESSAGE_DOMAIN_INVALID_SNAPPY"`
	MESSAGE_DOMAIN_VALID_SNAPPY        NetworkMessageDomain `yaml:"MESSAGE_DOMAIN_VALID_SNAPPY" json:"MESSAGE_DOMAIN_VALID_SNAPPY"`
	SUBNETS_PER_NODE                   Uint64View           `yaml:"SUBNETS_PER_NODE" json:"SUBNETS_PER_NODE"`
	ATTESTATION_SUBNET_COUNT           Uint64View           `yaml:"ATTESTATION_SUBNET_COUNT" json:"ATTESTATION_SUBNET_COUNT"`
	ATTESTATION_SUBNET_EXTRA_BITS      Uint64View           `yaml:"ATTESTATION_SUBNET_EXTRA_BITS" json:"ATTESTATION_SUBNET_EXTRA_BITS"`
	ATTESTATION_SUBNET_PREFIX_BITS     Uint64View           `yaml:"ATTESTATION_SUBNET_PREFIX_BITS" json:"ATTESTATION_SUBNET_PREFIX_BITS"`

	// Deneb
	MAX_REQUEST_BLOCKS_DENEB              Uint64View `yaml:"MAX_REQUEST_BLOCKS_DENEB" json:"MAX_REQUEST_BLOCKS_DENEB"`
	MAX_REQUEST_BLOB_SIDECARS             Uint64View `yaml:"MAX_REQUEST_BLOB_SIDECARS" json:"MAX_REQUEST_BLOB_SIDECARS"`
	MIN_EPOCHS_FOR_BLOB_SIDECARS_REQUESTS Uint64View `yaml:"MIN_EPOCHS_FOR_BLOB_SIDECARS_REQUESTS" json:"MIN_EPOCHS_FOR_BLOB_SIDECARS_REQUESTS"`
	BLOB_SIDECAR_SUBNET_COUNT             Uint64View `yaml:"BLOB_SIDECAR_SUBNET_COUNT" json:"BLOB_SIDECAR_SUBNET_COUNT"`

	// Whish
	WHISK_EPOCHS_PER_SHUFFLING_PHASE Uint64View `yaml:"WHISK_EPOCHS_PER_SHUFFLING_PHASE" json:"WHISK_EPOCHS_PER_SHUFFLING_PHASE"`
	WHISK_PROPOSER_SELECTION_GAP     Uint64View `yaml:"WHISK_PROPOSER_SELECTION_GAP" json:"WHISK_PROPOSER_SELECTION_GAP"`

	// EIP7594
	EIP7594_FORK_VERSION Version `yaml:"EIP7594_FORK_VERSION" json:"EIP7594_FORK_VERSION"`
	EIP7594_FORK_EPOCH   Epoch   `yaml:"EIP7594_FORK_EPOCH" json:"EIP7594_FORK_EPOCH"`
}

type Deltas

type Deltas struct {
	Rewards   GweiList `json:"rewards" yaml:"rewards"`
	Penalties GweiList `json:"penalties" yaml:"penalties"`
}

func NewDeltas

func NewDeltas(validatorCount uint64) *Deltas

func (*Deltas) Add

func (deltas *Deltas) Add(other *Deltas)

func (*Deltas) ByteLength

func (a *Deltas) ByteLength(spec *Spec) uint64

func (*Deltas) Deserialize

func (a *Deltas) Deserialize(spec *Spec, dr *codec.DecodingReader) error

func (*Deltas) FixedLength

func (a *Deltas) FixedLength(*Spec) uint64

func (*Deltas) HashTreeRoot

func (a *Deltas) HashTreeRoot(spec *Spec, hFn tree.HashFn) Root

func (*Deltas) Serialize

func (a *Deltas) Serialize(spec *Spec, w *codec.EncodingWriter) error

type DenebPreset added in v0.30.0

type DenebPreset struct {
	FIELD_ELEMENTS_PER_BLOB              Uint64View `yaml:"FIELD_ELEMENTS_PER_BLOB" json:"FIELD_ELEMENTS_PER_BLOB"`
	MAX_BLOB_COMMITMENTS_PER_BLOCK       Uint64View `yaml:"MAX_BLOB_COMMITMENTS_PER_BLOCK" json:"MAX_BLOB_COMMITMENTS_PER_BLOCK"`
	MAX_BLOBS_PER_BLOCK                  Uint64View `yaml:"MAX_BLOBS_PER_BLOCK" json:"MAX_BLOBS_PER_BLOCK"`
	KZG_COMMITMENT_INCLUSION_PROOF_DEPTH Uint64View `yaml:"KZG_COMMITMENT_INCLUSION_PROOF_DEPTH" json:"KZG_COMMITMENT_INCLUSION_PROOF_DEPTH"`
}

type Deposit

type Deposit struct {
	Proof DepositProof `json:"proof" yaml:"proof"`
	Data  DepositData  `json:"data" yaml:"data"`
}

func (*Deposit) ByteLength

func (a *Deposit) ByteLength() uint64

func (*Deposit) Deserialize

func (d *Deposit) Deserialize(dr *codec.DecodingReader) error

func (*Deposit) FixedLength

func (a *Deposit) FixedLength() uint64

func (*Deposit) HashTreeRoot

func (b *Deposit) HashTreeRoot(hFn tree.HashFn) Root

func (*Deposit) Serialize

func (d *Deposit) Serialize(w *codec.EncodingWriter) error

type DepositData

type DepositData struct {
	Pubkey                BLSPubkey `json:"pubkey" yaml:"pubkey"`
	WithdrawalCredentials Root      `json:"withdrawal_credentials" yaml:"withdrawal_credentials"`
	Amount                Gwei      `json:"amount" yaml:"amount"`
	// Signing over DepositMessage
	Signature BLSSignature `json:"signature" yaml:"signature"`
}

func (*DepositData) ByteLength

func (a *DepositData) ByteLength() uint64

func (*DepositData) Deserialize

func (d *DepositData) Deserialize(dr *codec.DecodingReader) error

func (*DepositData) FixedLength

func (a *DepositData) FixedLength() uint64

func (*DepositData) HashTreeRoot

func (d *DepositData) HashTreeRoot(hFn tree.HashFn) Root

hash-tree-root including the signature

func (*DepositData) MessageRoot

func (d *DepositData) MessageRoot() Root

hash-tree-root excluding the signature

func (*DepositData) Serialize

func (d *DepositData) Serialize(w *codec.EncodingWriter) error

func (*DepositData) ToMessage

func (d *DepositData) ToMessage() *DepositMessage

type DepositIndex

type DepositIndex Uint64View

Eth1 deposit ordering

func AsDepositIndex

func AsDepositIndex(v View, err error) (DepositIndex, error)

func (DepositIndex) ByteLength

func (DepositIndex) ByteLength() uint64

func (*DepositIndex) Deserialize

func (i *DepositIndex) Deserialize(dr *codec.DecodingReader) error

func (DepositIndex) FixedLength

func (DepositIndex) FixedLength() uint64

func (DepositIndex) HashTreeRoot

func (i DepositIndex) HashTreeRoot(hFn tree.HashFn) Root

func (DepositIndex) MarshalJSON

func (e DepositIndex) MarshalJSON() ([]byte, error)

func (DepositIndex) Serialize

func (i DepositIndex) Serialize(w *codec.EncodingWriter) error

func (DepositIndex) String

func (e DepositIndex) String() string

func (*DepositIndex) UnmarshalJSON

func (e *DepositIndex) UnmarshalJSON(b []byte) error

type DepositMessage

type DepositMessage struct {
	Pubkey                BLSPubkey `json:"pubkey" yaml:"pubkey"`
	WithdrawalCredentials Root      `json:"withdrawal_credentials" yaml:"withdrawal_credentials"`
	Amount                Gwei      `json:"amount" yaml:"amount"`
}

func (*DepositMessage) ByteLength added in v0.16.1

func (a *DepositMessage) ByteLength() uint64

func (*DepositMessage) Deserialize added in v0.16.1

func (d *DepositMessage) Deserialize(dr *codec.DecodingReader) error

func (*DepositMessage) FixedLength added in v0.16.1

func (a *DepositMessage) FixedLength() uint64

func (*DepositMessage) HashTreeRoot

func (b *DepositMessage) HashTreeRoot(hFn tree.HashFn) Root

func (*DepositMessage) Serialize added in v0.16.1

func (d *DepositMessage) Serialize(w *codec.EncodingWriter) error

type DepositProof

type DepositProof [DEPOSIT_CONTRACT_TREE_DEPTH + 1]Root

DepositProof contains the proof for the merkle-path to deposit root, including list mix-in.

func (*DepositProof) ByteLength

func (a *DepositProof) ByteLength() uint64

func (*DepositProof) Deserialize

func (d *DepositProof) Deserialize(dr *codec.DecodingReader) error

func (*DepositProof) FixedLength

func (a *DepositProof) FixedLength() uint64

func (*DepositProof) HashTreeRoot

func (b *DepositProof) HashTreeRoot(hFn tree.HashFn) Root

func (*DepositProof) Serialize

func (d *DepositProof) Serialize(w *codec.EncodingWriter) error

type EnvelopeBuilder

type EnvelopeBuilder interface {
	Envelope(spec *Spec, digest ForkDigest) *BeaconBlockEnvelope
}

type Epoch

type Epoch Uint64View
const GENESIS_EPOCH Epoch = 0

func AsEpoch

func AsEpoch(v View, err error) (Epoch, error)

func (Epoch) ByteLength

func (Epoch) ByteLength() uint64

func (*Epoch) Deserialize

func (a *Epoch) Deserialize(dr *codec.DecodingReader) error

func (Epoch) FixedLength

func (Epoch) FixedLength() uint64

func (Epoch) HashTreeRoot

func (e Epoch) HashTreeRoot(hFn tree.HashFn) Root

func (Epoch) MarshalJSON

func (e Epoch) MarshalJSON() ([]byte, error)

func (Epoch) Previous

func (e Epoch) Previous() Epoch

func (Epoch) Serialize

func (i Epoch) Serialize(w *codec.EncodingWriter) error

func (Epoch) String

func (e Epoch) String() string

func (*Epoch) UnmarshalJSON

func (e *Epoch) UnmarshalJSON(b []byte) error

type EpochsContext

type EpochsContext struct {
	Spec *Spec

	// ValidatorPubkeyCache may be replaced when a new forked-out cache takes over to process an alternative Eth1 deposit chain.
	ValidatorPubkeyCache *PubkeyCache
	Proposers            *ProposersEpoch

	PreviousEpoch *ShufflingEpoch
	CurrentEpoch  *ShufflingEpoch
	NextEpoch     *ShufflingEpoch

	// nil for pre-altair chain
	CurrentSyncCommittee *IndexedSyncCommittee
	NextSyncCommittee    *IndexedSyncCommittee

	// TODO: track active effective balances
	// TODO: track total active stake
	// Effective balances of all validators at the start of the epoch.
	EffectiveBalances []Gwei
	// Total effective balance of the active validators at the start of the epoch.
	TotalActiveStake Gwei
	// cached integer square root of TotalActiveStake
	TotalActiveStakeSqRoot Gwei
}

func NewEpochsContext

func NewEpochsContext(spec *Spec, state BeaconState) (*EpochsContext, error)

NewEpochsContext constructs a new context for the processing of the current epoch.

func (*EpochsContext) Clone

func (epc *EpochsContext) Clone() *EpochsContext

func (*EpochsContext) GetBeaconCommittee

func (epc *EpochsContext) GetBeaconCommittee(slot Slot, index CommitteeIndex) ([]ValidatorIndex, error)

Return the beacon committee at slot for index.

func (*EpochsContext) GetBeaconProposer

func (epc *EpochsContext) GetBeaconProposer(slot Slot) (ValidatorIndex, error)

func (*EpochsContext) GetCommitteeCountPerSlot added in v0.16.0

func (epc *EpochsContext) GetCommitteeCountPerSlot(epoch Epoch) (uint64, error)

func (*EpochsContext) LoadProposers

func (epc *EpochsContext) LoadProposers(state BeaconState) error

func (*EpochsContext) LoadShuffling

func (epc *EpochsContext) LoadShuffling(state BeaconState) error

func (*EpochsContext) LoadSyncCommittees added in v0.16.0

func (epc *EpochsContext) LoadSyncCommittees(state SyncCommitteeBeaconState) error

func (*EpochsContext) RotateEpochs

func (epc *EpochsContext) RotateEpochs(state BeaconState) error

type Eth1Address

type Eth1Address [20]byte

func AsEth1Address added in v0.15.1

func AsEth1Address(v View, err error) (Eth1Address, error)

func (*Eth1Address) ByteLength added in v0.15.1

func (*Eth1Address) ByteLength() uint64

func (*Eth1Address) Deserialize added in v0.15.1

func (addr *Eth1Address) Deserialize(dr *codec.DecodingReader) error

func (*Eth1Address) FixedLength added in v0.15.1

func (*Eth1Address) FixedLength() uint64

func (*Eth1Address) HashTreeRoot added in v0.15.1

func (addr *Eth1Address) HashTreeRoot(hFn tree.HashFn) tree.Root

func (Eth1Address) MarshalText

func (addr Eth1Address) MarshalText() ([]byte, error)

func (*Eth1Address) Serialize added in v0.15.1

func (addr *Eth1Address) Serialize(w *codec.EncodingWriter) error

func (Eth1Address) String

func (addr Eth1Address) String() string

func (*Eth1Address) UnmarshalText

func (addr *Eth1Address) UnmarshalText(text []byte) error

func (Eth1Address) View added in v0.15.1

func (addr Eth1Address) View() SmallByteVecView

type Eth1Data

type Eth1Data struct {
	// Hash-tree-root of DepositData tree.
	DepositRoot  Root         `json:"deposit_root" yaml:"deposit_root"`
	DepositCount DepositIndex `json:"deposit_count" yaml:"deposit_count"`
	BlockHash    Root         `json:"block_hash" yaml:"block_hash"`
}

func (*Eth1Data) ByteLength

func (a *Eth1Data) ByteLength() uint64

func (*Eth1Data) Deserialize

func (b *Eth1Data) Deserialize(dr *codec.DecodingReader) error

func (*Eth1Data) FixedLength

func (a *Eth1Data) FixedLength() uint64

func (*Eth1Data) HashTreeRoot

func (b *Eth1Data) HashTreeRoot(hFn tree.HashFn) Root

func (*Eth1Data) Serialize

func (a *Eth1Data) Serialize(w *codec.EncodingWriter) error

func (*Eth1Data) View

func (dat *Eth1Data) View() *Eth1DataView

type Eth1DataView

type Eth1DataView struct{ *ContainerView }

func AsEth1Data

func AsEth1Data(v View, err error) (*Eth1DataView, error)

func (*Eth1DataView) BlockHash

func (v *Eth1DataView) BlockHash() (Root, error)

func (*Eth1DataView) DepositCount

func (v *Eth1DataView) DepositCount() (DepositIndex, error)

func (*Eth1DataView) DepositRoot

func (v *Eth1DataView) DepositRoot() (Root, error)

func (*Eth1DataView) Raw

func (v *Eth1DataView) Raw() (Eth1Data, error)

func (*Eth1DataView) SetDepositRoot

func (v *Eth1DataView) SetDepositRoot(r Root) error

type Eth1DataVotes

type Eth1DataVotes interface {
	Reset() error
	Length() (uint64, error)
	Count(dat Eth1Data) (uint64, error)
	Append(dat Eth1Data) error
}

type Eth2Data

type Eth2Data struct {
	ForkDigest      ForkDigest `json:"fork_digest" yaml:"fork_digest"`
	NextForkVersion Version    `json:"next_fork_version" yaml:"next_fork_version"`
	NextForkEpoch   Epoch      `json:"next_fork_epoch" yaml:"next_fork_epoch"`
}

func (Eth2Data) ByteLength

func (d Eth2Data) ByteLength() uint64

func (*Eth2Data) Deserialize

func (d *Eth2Data) Deserialize(dr *codec.DecodingReader) error

func (*Eth2Data) FixedLength

func (*Eth2Data) FixedLength() uint64

func (*Eth2Data) HashTreeRoot

func (d *Eth2Data) HashTreeRoot(hFn tree.HashFn) Root

func (*Eth2Data) Serialize

func (d *Eth2Data) Serialize(w *codec.EncodingWriter) error

type ExecutionEngine added in v0.16.0

type ExecutionEngine interface {
}

ExecutionEngine represents an extensible execution-engine interface to verify execution payloads with. This engine may implement various interfaces, such as bellatrix.ExecutionEngine, capella.ExecutionEngine, deneb.ExecutionEngine

type ExtendedNodeRef

type ExtendedNodeRef struct {
	NodeRef
	ParentRoot Root
}

func (ExtendedNodeRef) String

func (n ExtendedNodeRef) String() string

type ExtraData added in v0.21.0

type ExtraData []byte

func (ExtraData) ByteLength added in v0.21.0

func (otx ExtraData) ByteLength() (out uint64)

func (*ExtraData) Deserialize added in v0.21.0

func (otx *ExtraData) Deserialize(dr *codec.DecodingReader) error

func (*ExtraData) FixedLength added in v0.21.0

func (otx *ExtraData) FixedLength() uint64

func (ExtraData) HashTreeRoot added in v0.21.0

func (otx ExtraData) HashTreeRoot(hFn tree.HashFn) Root

func (ExtraData) MarshalText added in v0.21.0

func (otx ExtraData) MarshalText() ([]byte, error)

func (ExtraData) Serialize added in v0.21.0

func (otx ExtraData) Serialize(w *codec.EncodingWriter) error

func (ExtraData) String added in v0.21.0

func (otx ExtraData) String() string

func (*ExtraData) UnmarshalText added in v0.21.0

func (otx *ExtraData) UnmarshalText(text []byte) error

func (ExtraData) View added in v0.21.0

func (otx ExtraData) View() (*ExtraDataView, error)

type ExtraDataView added in v0.21.0

type ExtraDataView struct {
	*BasicListView
}

func AsExtraData added in v0.21.0

func AsExtraData(v View, err error) (*ExtraDataView, error)

func (*ExtraDataView) Raw added in v0.21.0

func (v *ExtraDataView) Raw() (ExtraData, error)

type FlatValidator

type FlatValidator struct {
	EffectiveBalance           Gwei
	Slashed                    bool
	ActivationEligibilityEpoch Epoch
	ActivationEpoch            Epoch
	ExitEpoch                  Epoch
	WithdrawableEpoch          Epoch
}

func FlattenValidators

func FlattenValidators(vals ValidatorRegistry) ([]FlatValidator, error)

func (*FlatValidator) IsActive

func (v *FlatValidator) IsActive(epoch Epoch) bool

type Fork

type Fork struct {
	PreviousVersion Version `json:"previous_version" yaml:"previous_version"`
	CurrentVersion  Version `json:"current_version" yaml:"current_version"`
	Epoch           Epoch   `json:"epoch" yaml:"epoch"`
}

func (*Fork) ByteLength

func (a *Fork) ByteLength() uint64

func (*Fork) Deserialize

func (b *Fork) Deserialize(dr *codec.DecodingReader) error

func (*Fork) FixedLength

func (a *Fork) FixedLength() uint64

func (*Fork) GetDomain

func (f *Fork) GetDomain(dom BLSDomainType, genesisValRoot Root, messageEpoch Epoch) (BLSDomain, error)

Return the signature domain (fork version concatenated with domain type) of a message.

func (*Fork) HashTreeRoot

func (a *Fork) HashTreeRoot(hFn tree.HashFn) Root

func (*Fork) Serialize

func (a *Fork) Serialize(w *codec.EncodingWriter) error

func (*Fork) View

func (f *Fork) View() *ForkView

type ForkData

type ForkData struct {
	CurrentVersion        Version `json:"current_version" yaml:"current_version"`
	GenesisValidatorsRoot Root    `json:"genesis_validators_root" yaml:"genesis_validators_root"`
}

func (ForkData) ByteLength

func (p ForkData) ByteLength() uint64

func (*ForkData) Deserialize

func (v *ForkData) Deserialize(dr *codec.DecodingReader) error

func (*ForkData) FixedLength

func (*ForkData) FixedLength() uint64

func (*ForkData) HashTreeRoot

func (d *ForkData) HashTreeRoot(hFn tree.HashFn) Root

func (*ForkData) Serialize

func (v *ForkData) Serialize(w *codec.EncodingWriter) error

type ForkDigest

type ForkDigest [4]byte

A digest of the current fork data

func ComputeForkDigest

func ComputeForkDigest(currentVersion Version, genesisValidatorsRoot Root) ForkDigest

func (ForkDigest) ByteLength

func (p ForkDigest) ByteLength() uint64

func (*ForkDigest) Deserialize

func (p *ForkDigest) Deserialize(dr *codec.DecodingReader) error

func (ForkDigest) FixedLength

func (ForkDigest) FixedLength() uint64

func (ForkDigest) HashTreeRoot

func (p ForkDigest) HashTreeRoot(_ tree.HashFn) (out Root)

func (ForkDigest) MarshalText

func (p ForkDigest) MarshalText() ([]byte, error)

func (ForkDigest) Serialize

func (p ForkDigest) Serialize(w *codec.EncodingWriter) error

func (ForkDigest) String

func (p ForkDigest) String() string

func (*ForkDigest) UnmarshalText

func (p *ForkDigest) UnmarshalText(text []byte) error

type ForkSettings

type ForkSettings struct {
	MinSlashingPenaltyQuotient     uint64
	ProportionalSlashingMultiplier uint64
	InactivityPenaltyQuotient      uint64
	CalcProposerShare              func(whistleblowerReward Gwei) Gwei
}

ForkSettings are values that changed throughout forks, without change in surrounding logic. To select the right settings based on configuration, ForkSettings(spec) is called on the fork-specific implementation of the BeaconState interface.

type ForkView

type ForkView struct{ *ContainerView }

func AsFork

func AsFork(v View, err error) (*ForkView, error)

func (*ForkView) CurrentVersion

func (f *ForkView) CurrentVersion() (Version, error)

func (*ForkView) Epoch

func (f *ForkView) Epoch() (Epoch, error)

func (*ForkView) PreviousVersion

func (f *ForkView) PreviousVersion() (Version, error)

func (*ForkView) Raw

func (f *ForkView) Raw() (Fork, error)

type Goodbye

type Goodbye Uint64View

func (Goodbye) ByteLength

func (Goodbye) ByteLength() uint64

func (*Goodbye) Deserialize

func (i *Goodbye) Deserialize(dr *codec.DecodingReader) error

func (Goodbye) FixedLength

func (Goodbye) FixedLength() uint64

func (Goodbye) HashTreeRoot

func (i Goodbye) HashTreeRoot(hFn tree.HashFn) Root

func (Goodbye) MarshalJSON

func (i Goodbye) MarshalJSON() ([]byte, error)

func (Goodbye) Serialize

func (i Goodbye) Serialize(w *codec.EncodingWriter) error

func (Goodbye) String

func (i Goodbye) String() string

func (*Goodbye) UnmarshalJSON

func (i *Goodbye) UnmarshalJSON(b []byte) error

type Gwei

type Gwei Uint64View

func ApplyDeltas

func ApplyDeltas(state BeaconState, deltas *Deltas) ([]Gwei, error)

Applies deltas to the balances in the state, returns the resulting balances, ready to overwrite the state balances subtree with.

func AsGwei

func AsGwei(v View, err error) (Gwei, error)

func (Gwei) ByteLength

func (Gwei) ByteLength() uint64

func (*Gwei) Deserialize

func (g *Gwei) Deserialize(dr *codec.DecodingReader) error

func (Gwei) FixedLength

func (g Gwei) FixedLength() uint64

func (Gwei) HashTreeRoot

func (g Gwei) HashTreeRoot(hFn tree.HashFn) Root

func (Gwei) MarshalJSON

func (e Gwei) MarshalJSON() ([]byte, error)

func (Gwei) Serialize

func (i Gwei) Serialize(w *codec.EncodingWriter) error

func (Gwei) String

func (e Gwei) String() string

func (*Gwei) UnmarshalJSON

func (e *Gwei) UnmarshalJSON(b []byte) error

type GweiList

type GweiList []Gwei

func (GweiList) ByteLength

func (a GweiList) ByteLength(spec *Spec) (out uint64)

func (*GweiList) Deserialize

func (a *GweiList) Deserialize(spec *Spec, dr *codec.DecodingReader) error

func (*GweiList) FixedLength

func (a *GweiList) FixedLength(spec *Spec) uint64

func (GweiList) HashTreeRoot

func (li GweiList) HashTreeRoot(spec *Spec, hFn tree.HashFn) Root

func (GweiList) Serialize

func (a GweiList) Serialize(spec *Spec, w *codec.EncodingWriter) error

type Hash32 added in v0.16.0

type Hash32 = Root

type HistoricalRoots

type HistoricalRoots interface {
	Append(root Root) error
}

type IndexedSyncCommittee added in v0.16.0

type IndexedSyncCommittee struct {
	CachedPubkeys []*CachedPubkey
	Indices       []ValidatorIndex
}

func (*IndexedSyncCommittee) InSubnet added in v0.26.1

func (isc *IndexedSyncCommittee) InSubnet(spec *Spec, valIndex ValidatorIndex, subnet uint64) bool

func (*IndexedSyncCommittee) Subcommittee added in v0.26.1

func (isc *IndexedSyncCommittee) Subcommittee(spec *Spec, subnet uint64) (pubs []*CachedPubkey, indices []ValidatorIndex, err error)

func (*IndexedSyncCommittee) Subnets added in v0.26.1

func (isc *IndexedSyncCommittee) Subnets(spec *Spec, valIndex ValidatorIndex) (out []uint64)

type JustificationBits

type JustificationBits [1]byte

func (*JustificationBits) BitLen

func (jb *JustificationBits) BitLen() uint64

func (JustificationBits) ByteLength

func (jb JustificationBits) ByteLength() uint64

func (*JustificationBits) Deserialize

func (b *JustificationBits) Deserialize(dr *codec.DecodingReader) error

func (JustificationBits) FixedLength

func (jb JustificationBits) FixedLength() uint64

func (JustificationBits) HashTreeRoot

func (jb JustificationBits) HashTreeRoot(hFn tree.HashFn) Root

func (*JustificationBits) IsJustified

func (jb *JustificationBits) IsJustified(epochsAgo ...Epoch) bool

func (JustificationBits) MarshalText

func (jb JustificationBits) MarshalText() ([]byte, error)

func (*JustificationBits) NextEpoch

func (jb *JustificationBits) NextEpoch()

Prepare bitfield for next epoch by shifting previous bits (truncating to bitfield length)

func (JustificationBits) Serialize

func (a JustificationBits) Serialize(w *codec.EncodingWriter) error

func (*JustificationBits) String

func (jb *JustificationBits) String() string

func (*JustificationBits) UnmarshalText

func (jb *JustificationBits) UnmarshalText(text []byte) error

func (*JustificationBits) View added in v0.19.0

type JustificationBitsView

type JustificationBitsView struct {
	*BitVectorView
}

func AsJustificationBits

func AsJustificationBits(v View, err error) (*JustificationBitsView, error)

func (*JustificationBitsView) Raw

func (*JustificationBitsView) Set

type KZGCommitment added in v0.30.0

type KZGCommitment [KZGCommitmentSize]byte

func (KZGCommitment) ByteLength added in v0.30.0

func (KZGCommitment) ByteLength() uint64

func (*KZGCommitment) Deserialize added in v0.30.0

func (p *KZGCommitment) Deserialize(dr *codec.DecodingReader) error

func (KZGCommitment) FixedLength added in v0.30.0

func (KZGCommitment) FixedLength() uint64

func (KZGCommitment) HashTreeRoot added in v0.30.0

func (p KZGCommitment) HashTreeRoot(hFn tree.HashFn) tree.Root

func (KZGCommitment) MarshalText added in v0.30.0

func (p KZGCommitment) MarshalText() ([]byte, error)

func (*KZGCommitment) Serialize added in v0.30.0

func (p *KZGCommitment) Serialize(w *codec.EncodingWriter) error

func (KZGCommitment) String added in v0.30.0

func (p KZGCommitment) String() string

func (*KZGCommitment) ToPubkey added in v0.30.0

func (p *KZGCommitment) ToPubkey() (*blsu.Pubkey, error)

func (KZGCommitment) ToVersionedHash added in v0.30.0

func (p KZGCommitment) ToVersionedHash() (out Hash32)

func (*KZGCommitment) UnmarshalText added in v0.30.0

func (p *KZGCommitment) UnmarshalText(text []byte) error

type LogsBloom added in v0.16.0

type LogsBloom [BYTES_PER_LOGS_BLOOM]byte

func (*LogsBloom) ByteLength added in v0.16.0

func (*LogsBloom) ByteLength() uint64

func (*LogsBloom) Deserialize added in v0.16.0

func (s *LogsBloom) Deserialize(dr *codec.DecodingReader) error

func (*LogsBloom) FixedLength added in v0.16.0

func (*LogsBloom) FixedLength() uint64

func (*LogsBloom) HashTreeRoot added in v0.16.0

func (s *LogsBloom) HashTreeRoot(hFn tree.HashFn) tree.Root

func (LogsBloom) MarshalText added in v0.16.0

func (p LogsBloom) MarshalText() ([]byte, error)

func (*LogsBloom) Serialize added in v0.16.0

func (s *LogsBloom) Serialize(w *codec.EncodingWriter) error

func (LogsBloom) String added in v0.16.0

func (p LogsBloom) String() string

func (*LogsBloom) UnmarshalText added in v0.16.0

func (p *LogsBloom) UnmarshalText(text []byte) error

func (*LogsBloom) View added in v0.16.0

func (s *LogsBloom) View() *LogsBloomView

type LogsBloomView added in v0.16.0

type LogsBloomView struct {
	*view.BasicVectorView
}

func AsLogsBloom added in v0.16.0

func AsLogsBloom(v view.View, err error) (*LogsBloomView, error)

func (*LogsBloomView) Raw added in v0.16.0

func (v *LogsBloomView) Raw() (*LogsBloom, error)

type MetaData

type MetaData struct {
	SeqNumber SeqNr       `json:"seq_number" yaml:"seq_number"`
	Attnets   AttnetBits  `json:"attnets" yaml:"attnets"`
	Syncnets  SyncnetBits `json:"syncnets" yaml:"syncnets"`
}

func (MetaData) ByteLength

func (d MetaData) ByteLength() uint64

func (*MetaData) Data

func (m *MetaData) Data() map[string]interface{}

func (*MetaData) Deserialize

func (d *MetaData) Deserialize(dr *codec.DecodingReader) error

func (*MetaData) FixedLength

func (*MetaData) FixedLength() uint64

func (*MetaData) HashTreeRoot

func (d *MetaData) HashTreeRoot(hFn tree.HashFn) Root

func (*MetaData) Serialize

func (d *MetaData) Serialize(w *codec.EncodingWriter) error

func (*MetaData) String

func (m *MetaData) String() string

type NetworkMessageDomain added in v0.32.0

type NetworkMessageDomain [4]byte

A network message domain

func (NetworkMessageDomain) ByteLength added in v0.32.0

func (p NetworkMessageDomain) ByteLength() uint64

func (*NetworkMessageDomain) Deserialize added in v0.32.0

func (p *NetworkMessageDomain) Deserialize(dr *codec.DecodingReader) error

func (NetworkMessageDomain) FixedLength added in v0.32.0

func (NetworkMessageDomain) FixedLength() uint64

func (NetworkMessageDomain) HashTreeRoot added in v0.32.0

func (p NetworkMessageDomain) HashTreeRoot(_ tree.HashFn) (out Root)

func (NetworkMessageDomain) MarshalText added in v0.32.0

func (p NetworkMessageDomain) MarshalText() ([]byte, error)

func (NetworkMessageDomain) Serialize added in v0.32.0

func (NetworkMessageDomain) String added in v0.32.0

func (p NetworkMessageDomain) String() string

func (*NetworkMessageDomain) UnmarshalText added in v0.32.0

func (p *NetworkMessageDomain) UnmarshalText(text []byte) error

type NodeRef

type NodeRef struct {
	Slot Slot
	// Block root, may be equal to parent root if empty
	Root Root
}

func (NodeRef) String

func (n NodeRef) String() string

type PayloadTransactions added in v0.16.0

type PayloadTransactions []Transaction

func (PayloadTransactions) ByteLength added in v0.16.0

func (txs PayloadTransactions) ByteLength(spec *Spec) (out uint64)

func (*PayloadTransactions) Deserialize added in v0.16.0

func (txs *PayloadTransactions) Deserialize(spec *Spec, dr *codec.DecodingReader) error

func (*PayloadTransactions) FixedLength added in v0.16.0

func (txs *PayloadTransactions) FixedLength(*Spec) uint64

func (PayloadTransactions) HashTreeRoot added in v0.16.0

func (txs PayloadTransactions) HashTreeRoot(spec *Spec, hFn tree.HashFn) Root

func (PayloadTransactions) MarshalJSON added in v0.32.1

func (txs PayloadTransactions) MarshalJSON() ([]byte, error)

func (PayloadTransactions) Serialize added in v0.16.0

func (txs PayloadTransactions) Serialize(spec *Spec, w *codec.EncodingWriter) error

type Phase0Preset added in v0.16.0

type Phase0Preset struct {
	// Misc.
	MAX_COMMITTEES_PER_SLOT      Uint64View `yaml:"MAX_COMMITTEES_PER_SLOT" json:"MAX_COMMITTEES_PER_SLOT"`
	TARGET_COMMITTEE_SIZE        Uint64View `yaml:"TARGET_COMMITTEE_SIZE" json:"TARGET_COMMITTEE_SIZE"`
	MAX_VALIDATORS_PER_COMMITTEE Uint64View `yaml:"MAX_VALIDATORS_PER_COMMITTEE" json:"MAX_VALIDATORS_PER_COMMITTEE"`
	SHUFFLE_ROUND_COUNT          Uint8View  `yaml:"SHUFFLE_ROUND_COUNT" json:"SHUFFLE_ROUND_COUNT"`

	// Balance math
	HYSTERESIS_QUOTIENT            Uint64View `yaml:"HYSTERESIS_QUOTIENT" json:"HYSTERESIS_QUOTIENT"`
	HYSTERESIS_DOWNWARD_MULTIPLIER Uint64View `yaml:"HYSTERESIS_DOWNWARD_MULTIPLIER" json:"HYSTERESIS_DOWNWARD_MULTIPLIER"`
	HYSTERESIS_UPWARD_MULTIPLIER   Uint64View `yaml:"HYSTERESIS_UPWARD_MULTIPLIER" json:"HYSTERESIS_UPWARD_MULTIPLIER"`

	// Gwei values
	MIN_DEPOSIT_AMOUNT          Gwei `yaml:"MIN_DEPOSIT_AMOUNT" json:"MIN_DEPOSIT_AMOUNT"`
	MAX_EFFECTIVE_BALANCE       Gwei `yaml:"MAX_EFFECTIVE_BALANCE" json:"MAX_EFFECTIVE_BALANCE"`
	EFFECTIVE_BALANCE_INCREMENT Gwei `yaml:"EFFECTIVE_BALANCE_INCREMENT" json:"EFFECTIVE_BALANCE_INCREMENT"`

	// Time parameters
	MIN_ATTESTATION_INCLUSION_DELAY  Slot  `yaml:"MIN_ATTESTATION_INCLUSION_DELAY" json:"MIN_ATTESTATION_INCLUSION_DELAY"`
	SLOTS_PER_EPOCH                  Slot  `yaml:"SLOTS_PER_EPOCH" json:"SLOTS_PER_EPOCH"`
	MIN_SEED_LOOKAHEAD               Epoch `yaml:"MIN_SEED_LOOKAHEAD" json:"MIN_SEED_LOOKAHEAD"`
	MAX_SEED_LOOKAHEAD               Epoch `yaml:"MAX_SEED_LOOKAHEAD" json:"MAX_SEED_LOOKAHEAD"`
	EPOCHS_PER_ETH1_VOTING_PERIOD    Epoch `yaml:"EPOCHS_PER_ETH1_VOTING_PERIOD" json:"EPOCHS_PER_ETH1_VOTING_PERIOD"`
	SLOTS_PER_HISTORICAL_ROOT        Slot  `yaml:"SLOTS_PER_HISTORICAL_ROOT" json:"SLOTS_PER_HISTORICAL_ROOT"`
	MIN_EPOCHS_TO_INACTIVITY_PENALTY Epoch `yaml:"MIN_EPOCHS_TO_INACTIVITY_PENALTY" json:"MIN_EPOCHS_TO_INACTIVITY_PENALTY"`

	// State vector lengths
	EPOCHS_PER_HISTORICAL_VECTOR Epoch      `yaml:"EPOCHS_PER_HISTORICAL_VECTOR" json:"EPOCHS_PER_HISTORICAL_VECTOR"`
	EPOCHS_PER_SLASHINGS_VECTOR  Epoch      `yaml:"EPOCHS_PER_SLASHINGS_VECTOR" json:"EPOCHS_PER_SLASHINGS_VECTOR"`
	HISTORICAL_ROOTS_LIMIT       Uint64View `yaml:"HISTORICAL_ROOTS_LIMIT" json:"HISTORICAL_ROOTS_LIMIT"`
	VALIDATOR_REGISTRY_LIMIT     Uint64View `yaml:"VALIDATOR_REGISTRY_LIMIT" json:"VALIDATOR_REGISTRY_LIMIT"`

	// Reward and penalty quotients
	BASE_REWARD_FACTOR               Uint64View `yaml:"BASE_REWARD_FACTOR" json:"BASE_REWARD_FACTOR"`
	WHISTLEBLOWER_REWARD_QUOTIENT    Uint64View `yaml:"WHISTLEBLOWER_REWARD_QUOTIENT" json:"WHISTLEBLOWER_REWARD_QUOTIENT"`
	PROPOSER_REWARD_QUOTIENT         Uint64View `yaml:"PROPOSER_REWARD_QUOTIENT" json:"PROPOSER_REWARD_QUOTIENT"`
	INACTIVITY_PENALTY_QUOTIENT      Uint64View `yaml:"INACTIVITY_PENALTY_QUOTIENT" json:"INACTIVITY_PENALTY_QUOTIENT"`
	MIN_SLASHING_PENALTY_QUOTIENT    Uint64View `yaml:"MIN_SLASHING_PENALTY_QUOTIENT" json:"MIN_SLASHING_PENALTY_QUOTIENT"`
	PROPORTIONAL_SLASHING_MULTIPLIER Uint64View `yaml:"PROPORTIONAL_SLASHING_MULTIPLIER" json:"PROPORTIONAL_SLASHING_MULTIPLIER"`

	// Max operations per block
	MAX_PROPOSER_SLASHINGS Uint64View `yaml:"MAX_PROPOSER_SLASHINGS" json:"MAX_PROPOSER_SLASHINGS"`
	MAX_ATTESTER_SLASHINGS Uint64View `yaml:"MAX_ATTESTER_SLASHINGS" json:"MAX_ATTESTER_SLASHINGS"`
	MAX_ATTESTATIONS       Uint64View `yaml:"MAX_ATTESTATIONS" json:"MAX_ATTESTATIONS"`
	MAX_DEPOSITS           Uint64View `yaml:"MAX_DEPOSITS" json:"MAX_DEPOSITS"`
	MAX_VOLUNTARY_EXITS    Uint64View `yaml:"MAX_VOLUNTARY_EXITS" json:"MAX_VOLUNTARY_EXITS"`
}

func (*Phase0Preset) CheckPoint added in v0.16.0

func (c *Phase0Preset) CheckPoint() *ContainerTypeDef

func (*Phase0Preset) CommitteeIndices added in v0.16.0

func (c *Phase0Preset) CommitteeIndices() ListTypeDef

type Ping

type Ping SeqNr

func (Ping) ByteLength

func (Ping) ByteLength() uint64

func (*Ping) Deserialize

func (i *Ping) Deserialize(dr *codec.DecodingReader) error

func (Ping) FixedLength

func (Ping) FixedLength() uint64

func (Ping) HashTreeRoot

func (i Ping) HashTreeRoot(hFn tree.HashFn) Root

func (Ping) MarshalJSON

func (i Ping) MarshalJSON() ([]byte, error)

func (Ping) Serialize

func (i Ping) Serialize(w *codec.EncodingWriter) error

func (Ping) String

func (i Ping) String() string

func (*Ping) UnmarshalJSON

func (i *Ping) UnmarshalJSON(b []byte) error

type Pong

type Pong SeqNr

func (Pong) ByteLength

func (Pong) ByteLength() uint64

func (*Pong) Deserialize

func (i *Pong) Deserialize(dr *codec.DecodingReader) error

func (Pong) FixedLength

func (Pong) FixedLength() uint64

func (Pong) HashTreeRoot

func (i Pong) HashTreeRoot(hFn tree.HashFn) Root

func (Pong) MarshalJSON

func (i Pong) MarshalJSON() ([]byte, error)

func (Pong) Serialize

func (i Pong) Serialize(w *codec.EncodingWriter) error

func (Pong) String

func (i Pong) String() string

func (*Pong) UnmarshalJSON

func (i *Pong) UnmarshalJSON(b []byte) error

type ProposersEpoch

type ProposersEpoch struct {
	Spec  *Spec
	Epoch Epoch
	// Proposers is a slice of SLOTS_PER_EPOCH proposer indices for the epoch
	Proposers []ValidatorIndex

	CommitteesPerSlot uint64
}

func ComputeProposers

func ComputeProposers(spec *Spec, state BeaconState, epoch Epoch, active []ValidatorIndex) (*ProposersEpoch, error)

func (*ProposersEpoch) GetBeaconProposer

func (epc *ProposersEpoch) GetBeaconProposer(slot Slot) (ValidatorIndex, error)

type PubkeyCache

type PubkeyCache struct {
	// contains filtered or unexported fields
}

PubkeyCache is shared between any state. However, if .Append(index, pubkey) conflicts, a new cache will be forked out.

func EmptyPubkeyCache

func EmptyPubkeyCache() *PubkeyCache

func NewPubkeyCache

func NewPubkeyCache(vals ValidatorRegistry) (*PubkeyCache, error)

func (*PubkeyCache) AddValidator

func (pc *PubkeyCache) AddValidator(index ValidatorIndex, pub BLSPubkey) (*PubkeyCache, error)

AddValidator appends the (index, pubkey) pair to the pubkey cache. It returns the same cache if the added entry is not conflicting. If it conflicts, the part is inherited, and a forked pubkey cache is returned.

func (*PubkeyCache) Pubkey

func (pc *PubkeyCache) Pubkey(index ValidatorIndex) (pub *CachedPubkey, ok bool)

Get the pubkey of a validator index. Note: this does not mean the validator is part of the current state. It merely means that this is a known pubkey for that particular validator (could be in a later part of a forked version of the state).

func (*PubkeyCache) ValidatorIndex

func (pc *PubkeyCache) ValidatorIndex(pubkey BLSPubkey) (index ValidatorIndex, ok bool)

Get the validator index of a pubkey. Note: this does not mean the validator is part of the current state. It merely means that this is a known pubkey for that particular validator (could be in a later part of a forked version of the state).

type RandaoMixes

type RandaoMixes interface {
	GetRandomMix(epoch Epoch) (Root, error)
	SetRandomMix(epoch Epoch, mix Root) error
}

type Root

type Root = tree.Root

func ComputeForkDataRoot

func ComputeForkDataRoot(currentVersion Version, genesisValidatorsRoot Root) Root

func ComputeSigningRoot

func ComputeSigningRoot(msgRoot Root, dom BLSDomain) Root

func GetBlockRoot

func GetBlockRoot(spec *Spec, state BeaconState, epoch Epoch) (Root, error)

Return the block root at a recent epoch. Only valid to SLOTS_PER_HISTORICAL_ROOT slots ago.

func GetBlockRootAtSlot

func GetBlockRootAtSlot(spec *Spec, state BeaconState, slot Slot) (Root, error)

Return the block root at a recent slot. Only valid to SLOTS_PER_HISTORICAL_ROOT slots ago.

func GetSeed

func GetSeed(spec *Spec, mixes RandaoMixes, epoch Epoch, domainType BLSDomainType) (Root, error)

type SeqNr

type SeqNr Uint64View

func (SeqNr) ByteLength

func (SeqNr) ByteLength() uint64

func (*SeqNr) Deserialize

func (i *SeqNr) Deserialize(dr *codec.DecodingReader) error

func (SeqNr) FixedLength

func (SeqNr) FixedLength() uint64

func (SeqNr) HashTreeRoot

func (i SeqNr) HashTreeRoot(hFn tree.HashFn) Root

func (SeqNr) MarshalJSON

func (i SeqNr) MarshalJSON() ([]byte, error)

func (SeqNr) Serialize

func (i SeqNr) Serialize(w *codec.EncodingWriter) error

func (SeqNr) String

func (i SeqNr) String() string

func (*SeqNr) UnmarshalJSON

func (i *SeqNr) UnmarshalJSON(b []byte) error

type ShufflingEpoch

type ShufflingEpoch struct {
	Epoch         Epoch
	ActiveIndices []ValidatorIndex
	Shuffling     []ValidatorIndex // the active validator indices, shuffled into their committee
	// slot (vector SLOTS_PER_EPOCH) -> index of committee (< MAX_COMMITTEES_PER_SLOT) -> index of validator within committee -> validator
	Committees [][][]ValidatorIndex // slices of Shuffling, 1 per slot. Committee can be nil slice.
}

With a high amount of shards, or low amount of validators, some shards may not have a committee this epoch.

func ComputeShufflingEpoch

func ComputeShufflingEpoch(spec *Spec, state BeaconState, indicesBounded []BoundedIndex, epoch Epoch) (*ShufflingEpoch, error)

func NewShufflingEpoch

func NewShufflingEpoch(spec *Spec, indicesBounded []BoundedIndex, seed Root, epoch Epoch) *ShufflingEpoch

type SignedBLSToExecutionChange added in v0.29.0

type SignedBLSToExecutionChange struct {
	BLSToExecutionChange BLSToExecutionChange `json:"message" yaml:"message"`
	Signature            BLSSignature         `json:"signature" yaml:"signature"`
}

func (*SignedBLSToExecutionChange) ByteLength added in v0.29.0

func (s *SignedBLSToExecutionChange) ByteLength() uint64

func (*SignedBLSToExecutionChange) Deserialize added in v0.29.0

func (*SignedBLSToExecutionChange) FixedLength added in v0.29.0

func (s *SignedBLSToExecutionChange) FixedLength() uint64

func (*SignedBLSToExecutionChange) HashTreeRoot added in v0.29.0

func (s *SignedBLSToExecutionChange) HashTreeRoot(hFn tree.HashFn) Root

func (*SignedBLSToExecutionChange) Serialize added in v0.29.0

func (*SignedBLSToExecutionChange) View added in v0.29.0

type SignedBLSToExecutionChangeView added in v0.29.0

type SignedBLSToExecutionChangeView struct {
	*ContainerView
}

func AsSignedBLSToExecutionChange added in v0.29.0

func AsSignedBLSToExecutionChange(v View, err error) (*SignedBLSToExecutionChangeView, error)

func (*SignedBLSToExecutionChangeView) BLSToExecutionChange added in v0.29.0

func (v *SignedBLSToExecutionChangeView) BLSToExecutionChange() (*BLSToExecutionChangeView, error)

func (*SignedBLSToExecutionChangeView) Raw added in v0.29.0

func (*SignedBLSToExecutionChangeView) Signature added in v0.29.0

type SignedBLSToExecutionChanges added in v0.29.0

type SignedBLSToExecutionChanges []SignedBLSToExecutionChange

func (SignedBLSToExecutionChanges) ByteLength added in v0.29.0

func (li SignedBLSToExecutionChanges) ByteLength(_ *Spec) (out uint64)

func (*SignedBLSToExecutionChanges) Deserialize added in v0.29.0

func (li *SignedBLSToExecutionChanges) Deserialize(spec *Spec, dr *codec.DecodingReader) error

func (*SignedBLSToExecutionChanges) FixedLength added in v0.29.0

func (*SignedBLSToExecutionChanges) FixedLength(*Spec) uint64

func (SignedBLSToExecutionChanges) HashTreeRoot added in v0.29.0

func (li SignedBLSToExecutionChanges) HashTreeRoot(spec *Spec, hFn tree.HashFn) Root

func (SignedBLSToExecutionChanges) MarshalJSON added in v0.32.1

func (li SignedBLSToExecutionChanges) MarshalJSON() ([]byte, error)

func (SignedBLSToExecutionChanges) Serialize added in v0.29.0

type SignedBeaconBlockHeader

type SignedBeaconBlockHeader struct {
	Message   BeaconBlockHeader `json:"message" yaml:"message"`
	Signature BLSSignature      `json:"signature" yaml:"signature"`
}

func (*SignedBeaconBlockHeader) ByteLength

func (s *SignedBeaconBlockHeader) ByteLength() uint64

func (*SignedBeaconBlockHeader) Deserialize

func (s *SignedBeaconBlockHeader) Deserialize(dr *codec.DecodingReader) error

func (*SignedBeaconBlockHeader) FixedLength

func (b *SignedBeaconBlockHeader) FixedLength() uint64

func (*SignedBeaconBlockHeader) HashTreeRoot

func (s *SignedBeaconBlockHeader) HashTreeRoot(hFn tree.HashFn) Root

func (*SignedBeaconBlockHeader) Serialize

type SigningData

type SigningData struct {
	ObjectRoot Root      `json:"object_root" yaml:"object_root"`
	Domain     BLSDomain `json:"domain" yaml:"domain"`
}

func (*SigningData) ByteLength added in v0.16.1

func (a *SigningData) ByteLength() uint64

func (*SigningData) Deserialize added in v0.16.1

func (d *SigningData) Deserialize(dr *codec.DecodingReader) error

func (*SigningData) FixedLength added in v0.16.1

func (a *SigningData) FixedLength() uint64

func (*SigningData) HashTreeRoot

func (d *SigningData) HashTreeRoot(hFn tree.HashFn) Root

func (*SigningData) Serialize added in v0.16.1

func (d *SigningData) Serialize(w *codec.EncodingWriter) error

type Slashings

type Slashings interface {
	GetSlashingsValue(epoch Epoch) (Gwei, error)
	ResetSlashings(epoch Epoch) error
	AddSlashing(epoch Epoch, add Gwei) error
	Total() (sum Gwei, err error)
}

type Slot

type Slot Uint64View
const GENESIS_SLOT Slot = 0

func AsSlot

func AsSlot(v View, err error) (Slot, error)

func (Slot) ByteLength

func (Slot) ByteLength() uint64

func (*Slot) Deserialize

func (a *Slot) Deserialize(dr *codec.DecodingReader) error

func (Slot) FixedLength

func (Slot) FixedLength() uint64

func (Slot) HashTreeRoot

func (s Slot) HashTreeRoot(hFn tree.HashFn) Root

func (Slot) MarshalJSON

func (e Slot) MarshalJSON() ([]byte, error)

func (Slot) Previous

func (s Slot) Previous() Slot

func (Slot) Serialize

func (i Slot) Serialize(w *codec.EncodingWriter) error

func (Slot) String

func (e Slot) String() string

func (*Slot) UnmarshalJSON

func (e *Slot) UnmarshalJSON(b []byte) error

type Spec

type Spec struct {
	Phase0Preset    `json:",inline" yaml:",inline"`
	AltairPreset    `json:",inline" yaml:",inline"`
	BellatrixPreset `json:",inline" yaml:",inline"`
	CapellaPreset   `json:",inline" yaml:",inline"`
	DenebPreset     `json:",inline" yaml:",inline"`
	Config          `json:",inline" yaml:",inline"`

	ExecutionEngine `json:"-" yaml:"-"`
}

func (*Spec) ComputeActivationExitEpoch

func (spec *Spec) ComputeActivationExitEpoch(e Epoch) Epoch

Return the epoch at which an activation or exit triggered in epoch takes effect.

func (*Spec) EpochStartSlot

func (spec *Spec) EpochStartSlot(e Epoch) (Slot, error)

func (*Spec) ForkVersion

func (spec *Spec) ForkVersion(slot Slot) Version

func (*Spec) GetChurnLimit

func (spec *Spec) GetChurnLimit(activeValidatorCount uint64) uint64

func (*Spec) SlotToEpoch

func (spec *Spec) SlotToEpoch(s Slot) Epoch

func (*Spec) TimeAtSlot added in v0.16.0

func (spec *Spec) TimeAtSlot(slot Slot, genesisTime Timestamp) (Timestamp, error)

func (*Spec) TimeToSlot

func (spec *Spec) TimeToSlot(t Timestamp, genesisTime Timestamp) Slot

func (*Spec) Wrap

func (spec *Spec) Wrap(des SpecObj) SSZObj

Wraps the object to parametrize with given spec. JSON and YAML functionality is proxied to the inner value.

type SpecObj

type SpecObj interface {
	Deserialize(spec *Spec, dr *codec.DecodingReader) error
	Serialize(spec *Spec, w *codec.EncodingWriter) error
	ByteLength(spec *Spec) uint64
	HashTreeRoot(spec *Spec, h tree.HashFn) Root
	FixedLength(spec *Spec) uint64
}

type Status

type Status struct {
	ForkDigest     ForkDigest `json:"fork_digest" yaml:"fork_digest"`
	FinalizedRoot  Root       `json:"finalized_root" yaml:"finalized_root"`
	FinalizedEpoch Epoch      `json:"finalized_epoch" yaml:"finalized_epoch"`
	HeadRoot       Root       `json:"head_root" yaml:"head_root"`
	HeadSlot       Slot       `json:"head_slot" yaml:"head_slot"`
}

func (Status) ByteLength

func (d Status) ByteLength() uint64

func (*Status) Data

func (s *Status) Data() map[string]interface{}

func (*Status) Deserialize

func (d *Status) Deserialize(dr *codec.DecodingReader) error

func (*Status) FixedLength

func (*Status) FixedLength() uint64

func (*Status) HashTreeRoot

func (d *Status) HashTreeRoot(hFn tree.HashFn) Root

func (*Status) Serialize

func (d *Status) Serialize(w *codec.EncodingWriter) error

func (*Status) String

func (s *Status) String() string

type Step added in v0.27.0

type Step uint64

Step combines a Slot and bool for block processing being included or not.

func AsStep added in v0.27.0

func AsStep(slot Slot, block bool) Step

func (Step) Block added in v0.27.0

func (st Step) Block() bool

func (Step) Slot added in v0.27.0

func (st Step) Slot() Slot

func (Step) String added in v0.27.0

func (st Step) String() string

type SyncCommittee added in v0.16.0

type SyncCommittee struct {
	Pubkeys         SyncCommitteePubkeys `json:"pubkeys" yaml:"pubkeys"`
	AggregatePubkey BLSPubkey            `json:"aggregate_pubkey" yaml:"aggregate_pubkey"`
}

func ComputeNextSyncCommittee added in v0.16.0

func ComputeNextSyncCommittee(spec *Spec, epc *EpochsContext, state BeaconState) (*SyncCommittee, error)

func IndicesToSyncCommittee added in v0.16.2

func IndicesToSyncCommittee(indices []ValidatorIndex, pubCache *PubkeyCache) (*SyncCommittee, error)

func (*SyncCommittee) ByteLength added in v0.16.0

func (a *SyncCommittee) ByteLength(spec *Spec) uint64

func (*SyncCommittee) Deserialize added in v0.16.0

func (a *SyncCommittee) Deserialize(spec *Spec, dr *codec.DecodingReader) error

func (*SyncCommittee) FixedLength added in v0.16.0

func (*SyncCommittee) FixedLength(spec *Spec) uint64

func (*SyncCommittee) HashTreeRoot added in v0.16.0

func (p *SyncCommittee) HashTreeRoot(spec *Spec, hFn tree.HashFn) Root

func (*SyncCommittee) Serialize added in v0.16.0

func (a *SyncCommittee) Serialize(spec *Spec, w *codec.EncodingWriter) error

func (*SyncCommittee) View added in v0.16.0

func (p *SyncCommittee) View(spec *Spec) (*SyncCommitteeView, error)

type SyncCommitteeBeaconState added in v0.16.0

type SyncCommitteeBeaconState interface {
	BeaconState
	CurrentSyncCommittee() (*SyncCommitteeView, error)
	NextSyncCommittee() (*SyncCommitteeView, error)
	SetCurrentSyncCommittee(v *SyncCommitteeView) error
	SetNextSyncCommittee(v *SyncCommitteeView) error
	RotateSyncCommittee(next *SyncCommitteeView) error
}

type SyncCommitteePubkeys added in v0.16.0

type SyncCommitteePubkeys []BLSPubkey

func (SyncCommitteePubkeys) ByteLength added in v0.16.0

func (a SyncCommitteePubkeys) ByteLength(spec *Spec) uint64

func (*SyncCommitteePubkeys) Deserialize added in v0.16.0

func (li *SyncCommitteePubkeys) Deserialize(spec *Spec, dr *codec.DecodingReader) error

func (*SyncCommitteePubkeys) FixedLength added in v0.16.0

func (a *SyncCommitteePubkeys) FixedLength(spec *Spec) uint64

func (SyncCommitteePubkeys) HashTreeRoot added in v0.16.0

func (li SyncCommitteePubkeys) HashTreeRoot(spec *Spec, hFn tree.HashFn) Root

func (SyncCommitteePubkeys) Serialize added in v0.16.0

func (a SyncCommitteePubkeys) Serialize(spec *Spec, w *codec.EncodingWriter) error

type SyncCommitteePubkeysView added in v0.16.0

type SyncCommitteePubkeysView struct {
	*ComplexVectorView
}

func AsSyncCommitteePubkeys added in v0.16.0

func AsSyncCommitteePubkeys(v View, err error) (*SyncCommitteePubkeysView, error)

func (*SyncCommitteePubkeysView) Flatten added in v0.16.0

func (v *SyncCommitteePubkeysView) Flatten() ([]BLSPubkey, error)

type SyncCommitteeView added in v0.16.0

type SyncCommitteeView struct {
	*ContainerView
}

func AsSyncCommittee added in v0.16.0

func AsSyncCommittee(v View, err error) (*SyncCommitteeView, error)

func (*SyncCommitteeView) AggregatePubkey added in v0.16.0

func (p *SyncCommitteeView) AggregatePubkey() (BLSPubkey, error)

func (*SyncCommitteeView) Pubkeys added in v0.16.0

type SyncnetBits added in v0.28.0

type SyncnetBits [syncnetByteLen]byte

func (*SyncnetBits) BitLen added in v0.28.0

func (ab *SyncnetBits) BitLen() uint64

func (SyncnetBits) ByteLength added in v0.28.0

func (p SyncnetBits) ByteLength() uint64

func (*SyncnetBits) Deserialize added in v0.28.0

func (p *SyncnetBits) Deserialize(dr *codec.DecodingReader) error

func (SyncnetBits) FixedLength added in v0.28.0

func (SyncnetBits) FixedLength() uint64

func (SyncnetBits) HashTreeRoot added in v0.28.0

func (p SyncnetBits) HashTreeRoot(_ tree.HashFn) (out Root)

func (SyncnetBits) MarshalText added in v0.28.0

func (p SyncnetBits) MarshalText() ([]byte, error)

func (SyncnetBits) Serialize added in v0.28.0

func (p SyncnetBits) Serialize(w *codec.EncodingWriter) error

func (SyncnetBits) String added in v0.28.0

func (p SyncnetBits) String() string

func (*SyncnetBits) UnmarshalText added in v0.28.0

func (p *SyncnetBits) UnmarshalText(text []byte) error

type Timestamp

type Timestamp Uint64View

Unix timestamp

func AsTimestamp

func AsTimestamp(v View, err error) (Timestamp, error)

func (Timestamp) ByteLength

func (Timestamp) ByteLength() uint64

func (*Timestamp) Deserialize

func (a *Timestamp) Deserialize(dr *codec.DecodingReader) error

func (Timestamp) FixedLength

func (Timestamp) FixedLength() uint64

func (Timestamp) HashTreeRoot

func (t Timestamp) HashTreeRoot(hFn tree.HashFn) Root

func (Timestamp) MarshalJSON

func (e Timestamp) MarshalJSON() ([]byte, error)

func (Timestamp) Serialize

func (i Timestamp) Serialize(w *codec.EncodingWriter) error

func (Timestamp) String

func (e Timestamp) String() string

func (*Timestamp) UnmarshalJSON

func (e *Timestamp) UnmarshalJSON(b []byte) error

type Transaction added in v0.19.0

type Transaction []byte

func (Transaction) ByteLength added in v0.19.0

func (otx Transaction) ByteLength(spec *Spec) (out uint64)

func (*Transaction) Deserialize added in v0.19.0

func (otx *Transaction) Deserialize(spec *Spec, dr *codec.DecodingReader) error

func (*Transaction) FixedLength added in v0.19.0

func (otx *Transaction) FixedLength(*Spec) uint64

func (Transaction) HashTreeRoot added in v0.19.0

func (otx Transaction) HashTreeRoot(spec *Spec, hFn tree.HashFn) Root

func (Transaction) MarshalText added in v0.23.0

func (otx Transaction) MarshalText() ([]byte, error)

func (Transaction) Serialize added in v0.19.0

func (otx Transaction) Serialize(spec *Spec, w *codec.EncodingWriter) error

func (Transaction) String added in v0.23.0

func (otx Transaction) String() string

func (*Transaction) UnmarshalText added in v0.23.0

func (otx *Transaction) UnmarshalText(text []byte) error

func (Transaction) View added in v0.19.0

func (otx Transaction) View(spec *Spec) (*TransactionView, error)

type TransactionView added in v0.19.0

type TransactionView struct {
	*UnionView
}

func AsTransaction added in v0.19.0

func AsTransaction(v View, err error) (*TransactionView, error)

type UpgradeableBeaconState added in v0.16.1

type UpgradeableBeaconState interface {
	BeaconState

	// Called whenever the state may need to upgrade to a next fork, changes the BeaconState interface contents if so.
	UpgradeMaybe(ctx context.Context, spec *Spec, epc *EpochsContext) error
}

type Validator

type Validator interface {
	Pubkey() (BLSPubkey, error)
	WithdrawalCredentials() (out Root, err error)
	SetWithdrawalCredentials(out Root) (err error)
	EffectiveBalance() (Gwei, error)
	SetEffectiveBalance(b Gwei) error
	Slashed() (bool, error)
	MakeSlashed() error
	ActivationEligibilityEpoch() (Epoch, error)
	SetActivationEligibilityEpoch(epoch Epoch) error
	ActivationEpoch() (Epoch, error)
	SetActivationEpoch(epoch Epoch) error
	ExitEpoch() (Epoch, error)
	SetExitEpoch(ep Epoch) error
	WithdrawableEpoch() (Epoch, error)
	SetWithdrawableEpoch(epoch Epoch) error
	// Flatten the validator data into destination struct
	// For intensive validator registry work, it is more efficient to iterate the registry once,
	// unpack validators into a flat structure, and work with the flattened data.
	Flatten(dst *FlatValidator) error
}

type ValidatorIndex

type ValidatorIndex Uint64View

Index of a validator, pointing to a validator registry location

func ActiveIndices added in v0.16.2

func ActiveIndices(indicesBounded []BoundedIndex, epoch Epoch) []ValidatorIndex

func AsValidatorIndex

func AsValidatorIndex(v View, err error) (ValidatorIndex, error)

func ComputeProposerIndex

func ComputeProposerIndex(spec *Spec, registry ValidatorRegistry, active []ValidatorIndex, seed Root) (ValidatorIndex, error)

func ComputeSyncCommitteeIndices

func ComputeSyncCommitteeIndices(spec *Spec, state BeaconState, baseEpoch Epoch, active []ValidatorIndex) ([]ValidatorIndex, error)

Return the sequence of sync committee indices (which may include duplicate indices) for the next sync committee, given a state at a sync committee period boundary.

Note: Committee can contain duplicate indices for small validator sets (< SYNC_COMMITTEE_SIZE + 128)

func PermuteIndex

func PermuteIndex(rounds uint8, index ValidatorIndex, listSize uint64, seed Root) ValidatorIndex

PermuteIndex shuffles an individual list item without allocating a complete list. Returns the index in the would-be shuffled list.

func UnpermuteIndex

func UnpermuteIndex(rounds uint8, index ValidatorIndex, listSize uint64, seed Root) ValidatorIndex

UnpermuteIndex does the inverse of PermuteIndex, it returns the original index when given the same shuffling context parameters and permuted index.

func (ValidatorIndex) ByteLength

func (ValidatorIndex) ByteLength() uint64

func (*ValidatorIndex) Deserialize

func (i *ValidatorIndex) Deserialize(dr *codec.DecodingReader) error

func (ValidatorIndex) FixedLength

func (ValidatorIndex) FixedLength() uint64

func (ValidatorIndex) HashTreeRoot

func (i ValidatorIndex) HashTreeRoot(hFn tree.HashFn) Root

func (ValidatorIndex) MarshalJSON

func (e ValidatorIndex) MarshalJSON() ([]byte, error)

func (ValidatorIndex) Serialize

func (i ValidatorIndex) Serialize(w *codec.EncodingWriter) error

func (ValidatorIndex) String

func (e ValidatorIndex) String() string

func (*ValidatorIndex) UnmarshalJSON

func (e *ValidatorIndex) UnmarshalJSON(b []byte) error

type ValidatorRegistry

type ValidatorRegistry interface {
	ValidatorCount() (uint64, error)
	Validator(index ValidatorIndex) (Validator, error)
	Iter() (next func() (val Validator, ok bool, err error))
	IsValidIndex(index ValidatorIndex) (valid bool, err error)
	HashTreeRoot(fn tree.HashFn) Root
}

type ValidatorSet

type ValidatorSet []ValidatorIndex

Collection of validators, should always be sorted.

func (*ValidatorSet) Dedup

func (vs *ValidatorSet) Dedup()

De-duplicates entries in the set in-place. (util to make a valid set from a list with duplicates)

func (*ValidatorSet) Filter

func (vs *ValidatorSet) Filter(retain func(index ValidatorIndex) (bool, error)) error

Filter the set in-place. Retains every validator for which the function returns true.

func (ValidatorSet) Intersects

func (vs ValidatorSet) Intersects(target ValidatorSet) bool

Joins two validator sets: check if there is any overlap

func (ValidatorSet) Len

func (vs ValidatorSet) Len() int

func (ValidatorSet) Less

func (vs ValidatorSet) Less(i int, j int) bool

func (ValidatorSet) MergeDisjoint

func (vs ValidatorSet) MergeDisjoint(other ValidatorSet) ValidatorSet

merges with other disjoint set, producing a new set.

func (ValidatorSet) Swap

func (vs ValidatorSet) Swap(i int, j int)

func (ValidatorSet) ZigZagJoin

func (vs ValidatorSet) ZigZagJoin(target ValidatorSet, onIn func(i ValidatorIndex), onOut func(i ValidatorIndex))

Joins two validator sets: reports all indices of source that are in the target (call onIn), and those that are not (call onOut)

type Version

type Version [4]byte

32 bits, not strictly an integer, hence represented as 4 bytes (bytes not necessarily corresponding to versions)

func AsVersion

func AsVersion(v View, err error) (Version, error)

func (Version) ByteLength

func (a Version) ByteLength() uint64

func (*Version) Deserialize

func (v *Version) Deserialize(dr *codec.DecodingReader) error

func (Version) FixedLength

func (Version) FixedLength() uint64

func (Version) HashTreeRoot

func (p Version) HashTreeRoot(_ tree.HashFn) (out Root)

func (Version) MarshalText

func (p Version) MarshalText() ([]byte, error)

func (Version) Serialize

func (a Version) Serialize(w *codec.EncodingWriter) error

func (Version) String

func (p Version) String() string

func (Version) ToUint32

func (v Version) ToUint32() uint32

func (*Version) UnmarshalText

func (p *Version) UnmarshalText(text []byte) error

func (Version) View

func (v Version) View() SmallByteVecView

type Withdrawal added in v0.29.0

type Withdrawal struct {
	Index          WithdrawalIndex `json:"index" yaml:"index"`
	ValidatorIndex ValidatorIndex  `json:"validator_index" yaml:"validator_index"`
	Address        Eth1Address     `json:"address" yaml:"address"`
	Amount         Gwei            `json:"amount" yaml:"amount"`
}

func (*Withdrawal) ByteLength added in v0.29.0

func (s *Withdrawal) ByteLength() uint64

func (*Withdrawal) Deserialize added in v0.29.0

func (s *Withdrawal) Deserialize(dr *codec.DecodingReader) error

func (*Withdrawal) FixedLength added in v0.29.0

func (s *Withdrawal) FixedLength() uint64

func (*Withdrawal) HashTreeRoot added in v0.29.0

func (s *Withdrawal) HashTreeRoot(hFn tree.HashFn) Root

func (*Withdrawal) Serialize added in v0.29.0

func (s *Withdrawal) Serialize(w *codec.EncodingWriter) error

func (*Withdrawal) View added in v0.29.0

func (s *Withdrawal) View() *WithdrawalView

type WithdrawalIndex added in v0.29.0

type WithdrawalIndex Uint64View

func AsWithdrawalIndex added in v0.29.0

func AsWithdrawalIndex(v View, err error) (WithdrawalIndex, error)

func (WithdrawalIndex) ByteLength added in v0.29.0

func (WithdrawalIndex) ByteLength() uint64

func (*WithdrawalIndex) Deserialize added in v0.29.0

func (a *WithdrawalIndex) Deserialize(dr *codec.DecodingReader) error

func (WithdrawalIndex) FixedLength added in v0.29.0

func (WithdrawalIndex) FixedLength() uint64

func (WithdrawalIndex) HashTreeRoot added in v0.29.0

func (t WithdrawalIndex) HashTreeRoot(hFn tree.HashFn) Root

func (WithdrawalIndex) MarshalJSON added in v0.29.0

func (e WithdrawalIndex) MarshalJSON() ([]byte, error)

func (WithdrawalIndex) Serialize added in v0.29.0

func (i WithdrawalIndex) Serialize(w *codec.EncodingWriter) error

func (WithdrawalIndex) String added in v0.29.0

func (e WithdrawalIndex) String() string

func (*WithdrawalIndex) UnmarshalJSON added in v0.29.0

func (e *WithdrawalIndex) UnmarshalJSON(b []byte) error

type WithdrawalPrefix

type WithdrawalPrefix [1]byte

func (WithdrawalPrefix) MarshalText

func (p WithdrawalPrefix) MarshalText() ([]byte, error)

func (WithdrawalPrefix) String

func (p WithdrawalPrefix) String() string

func (*WithdrawalPrefix) UnmarshalText

func (p *WithdrawalPrefix) UnmarshalText(text []byte) error

type WithdrawalView added in v0.29.0

type WithdrawalView struct {
	*ContainerView
}

func AsWithdrawal added in v0.29.0

func AsWithdrawal(v View, err error) (*WithdrawalView, error)

func (*WithdrawalView) Address added in v0.29.0

func (v *WithdrawalView) Address() (Eth1Address, error)

func (*WithdrawalView) Amount added in v0.29.0

func (v *WithdrawalView) Amount() (Gwei, error)

func (*WithdrawalView) Index added in v0.29.0

func (v *WithdrawalView) Index() (WithdrawalIndex, error)

func (*WithdrawalView) Raw added in v0.29.0

func (v *WithdrawalView) Raw() (*Withdrawal, error)

func (*WithdrawalView) ValidatorIndex added in v0.29.0

func (v *WithdrawalView) ValidatorIndex() (ValidatorIndex, error)

type Withdrawals added in v0.29.0

type Withdrawals []Withdrawal

func (Withdrawals) ByteLength added in v0.29.0

func (ws Withdrawals) ByteLength(spec *Spec) (out uint64)

func (*Withdrawals) Deserialize added in v0.29.0

func (ws *Withdrawals) Deserialize(spec *Spec, dr *codec.DecodingReader) error

func (*Withdrawals) FixedLength added in v0.29.0

func (ws *Withdrawals) FixedLength(*Spec) uint64

func (Withdrawals) HashTreeRoot added in v0.29.0

func (ws Withdrawals) HashTreeRoot(spec *Spec, hFn tree.HashFn) Root

func (Withdrawals) MarshalJSON added in v0.32.1

func (ws Withdrawals) MarshalJSON() ([]byte, error)

func (Withdrawals) Serialize added in v0.29.0

func (ws Withdrawals) Serialize(spec *Spec, w *codec.EncodingWriter) error

type WrappedSpecObj added in v0.16.1

type WrappedSpecObj interface {
	SSZObj
	Unwrap() (*Spec, SpecObj)
}

Jump to

Keyboard shortcuts

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