phase0

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2021 License: MIT Imports: 18 Imported by: 35

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AttestationDataType = ContainerType("AttestationData", []FieldDef{
	{"slot", common.SlotType},
	{"index", common.CommitteeIndexType},

	{"beacon_block_root", RootType},

	{"source", common.CheckpointType},
	{"target", common.CheckpointType},
})
View Source
var DepositRootsType = ComplexListType(RootType, 1<<common.DEPOSIT_CONTRACT_TREE_DEPTH)
View Source
var ProposerSlashingType = ContainerType("ProposerSlashing", []FieldDef{
	{"header_1", common.SignedBeaconBlockHeaderType},
	{"header_2", common.SignedBeaconBlockHeaderType},
})
View Source
var SignedVoluntaryExitType = ContainerType("SignedVoluntaryExit", []FieldDef{
	{"message", VoluntaryExitType},
	{"signature", common.BLSSignatureType},
})
View Source
var ValidatorType = ContainerType("Validator", []FieldDef{
	{"pubkey", common.BLSPubkeyType},
	{"withdrawal_credentials", common.Bytes32Type},
	{"effective_balance", common.GweiType},
	{"slashed", BoolType},

	{"activation_eligibility_epoch", common.EpochType},
	{"activation_epoch", common.EpochType},
	{"exit_epoch", common.EpochType},
	{"withdrawable_epoch", common.EpochType},
})
View Source
var VoluntaryExitType = ContainerType("VoluntaryExit", []FieldDef{
	{"epoch", common.EpochType},
	{"validator_index", common.ValidatorIndexType},
})

Functions

func AggregateSelectionProofSigningRoot

func AggregateSelectionProofSigningRoot(spec *common.Spec, domainFn common.BLSDomainFn, slot common.Slot) (common.Root, error)

func AttestationBitsType

func AttestationBitsType(spec *common.Spec) *BitListTypeDef

func AttestationType

func AttestationType(spec *common.Spec) *ContainerTypeDef

func AttesterSlashingType

func AttesterSlashingType(spec *common.Spec) *ContainerTypeDef

func BatchRootsType

func BatchRootsType(spec *common.Spec) VectorTypeDef

func BeaconBlockBodyType

func BeaconBlockBodyType(spec *common.Spec) *ContainerTypeDef

func BeaconBlockType

func BeaconBlockType(spec *common.Spec) *ContainerTypeDef

func BeaconStateType

func BeaconStateType(spec *common.Spec) *ContainerTypeDef

func BlockAttestationsType

func BlockAttestationsType(spec *common.Spec) ListTypeDef

func BlockAttesterSlashingsType

func BlockAttesterSlashingsType(spec *common.Spec) ListTypeDef

func BlockDepositsType

func BlockDepositsType(spec *common.Spec) ListTypeDef

func BlockProposerSlashingsType

func BlockProposerSlashingsType(spec *common.Spec) ListTypeDef

func BlockVoluntaryExitsType

func BlockVoluntaryExitsType(spec *common.Spec) ListTypeDef

func ComputeSubnetForAttestation

func ComputeSubnetForAttestation(spec *common.Spec, committeesPerSlot uint64, slot common.Slot, committeeIndex common.CommitteeIndex) (uint64, error)

func Eth1DataVotesType

func Eth1DataVotesType(spec *common.Spec) ListTypeDef

func HistoricalBatchType

func HistoricalBatchType(spec *common.Spec) *ContainerTypeDef

func HistoricalRootsType

func HistoricalRootsType(spec *common.Spec) ListTypeDef

func IndexedAttestationType

func IndexedAttestationType(spec *common.Spec) *ContainerTypeDef

func InitiateValidatorExit

func InitiateValidatorExit(spec *common.Spec, epc *common.EpochsContext, state common.BeaconState, index common.ValidatorIndex) error

Initiate the exit of the validator of the given index

func IsActive

func IsActive(v common.Validator, epoch common.Epoch) (bool, error)

func IsAggregator

func IsAggregator(spec *common.Spec, commSize uint64, selectionProof common.BLSSignature) bool

Given some committee size at a given slot, and a signature (not validated here) for that same slot

func IsDoubleVote

func IsDoubleVote(a *AttestationData, b *AttestationData) bool

Check if a and b have the same target epoch.

func IsEligibleForActivation

func IsEligibleForActivation(v common.Validator, finalizedEpoch common.Epoch) (bool, error)

func IsEligibleForActivationQueue

func IsEligibleForActivationQueue(v common.Validator, spec *common.Spec) (bool, error)

func IsSlashable

func IsSlashable(v common.Validator, epoch common.Epoch) (bool, error)

func IsSlashableAttestationData

func IsSlashableAttestationData(a *AttestationData, b *AttestationData) bool

func IsSurroundVote

func IsSurroundVote(a *AttestationData, b *AttestationData) bool

Check if a surrounds b, i.E. source(a) < source(b) and target(a) > target(b)

func IsValidGenesisState

func IsValidGenesisState(spec *common.Spec, state *BeaconStateView) (bool, error)

func PendingAttestationType

func PendingAttestationType(spec *common.Spec) *ContainerTypeDef

func PendingAttestationsType

func PendingAttestationsType(spec *common.Spec) ListTypeDef

func ProcessAttestation

func ProcessAttestation(spec *common.Spec, epc *common.EpochsContext, state *BeaconStateView, attestation *Attestation) error

func ProcessAttestations

func ProcessAttestations(ctx context.Context, spec *common.Spec, epc *common.EpochsContext, state *BeaconStateView, ops []Attestation) error

func ProcessAttesterSlashing

func ProcessAttesterSlashing(spec *common.Spec, epc *common.EpochsContext, state common.BeaconState, attesterSlashing *AttesterSlashing) error

func ProcessAttesterSlashings

func ProcessAttesterSlashings(ctx context.Context, spec *common.Spec, epc *common.EpochsContext, state common.BeaconState, ops []AttesterSlashing) error

func ProcessDeposit

func ProcessDeposit(spec *common.Spec, epc *common.EpochsContext, state common.BeaconState, dep *common.Deposit, ignoreSignatureAndProof bool) error

Process an Eth1 deposit, registering a validator or increasing its balance.

func ProcessDeposits

func ProcessDeposits(ctx context.Context, spec *common.Spec, epc *common.EpochsContext, state common.BeaconState, ops []common.Deposit) error

Verify that outstanding deposits are processed up to the maximum number of deposits, then process all in order.

func ProcessEffectiveBalanceUpdates

func ProcessEffectiveBalanceUpdates(ctx context.Context, spec *common.Spec, epc *common.EpochsContext, flats []common.FlatValidator, state common.BeaconState) error

func ProcessEpochJustification

func ProcessEpochJustification(ctx context.Context, spec *common.Spec, data *JustificationStakeData, state common.BeaconState) error

func ProcessEpochRegistryUpdates

func ProcessEpochRegistryUpdates(ctx context.Context, spec *common.Spec, epc *common.EpochsContext, flats []common.FlatValidator, state common.BeaconState) error

func ProcessEpochRewardsAndPenalties

func ProcessEpochRewardsAndPenalties(ctx context.Context, spec *common.Spec, epc *common.EpochsContext,
	attesterData *EpochAttesterData, state *BeaconStateView) error

func ProcessEpochSlashings

func ProcessEpochSlashings(ctx context.Context, spec *common.Spec, epc *common.EpochsContext, flats []common.FlatValidator, state common.BeaconState) error

func ProcessEth1DataReset

func ProcessEth1DataReset(ctx context.Context, spec *common.Spec, epc *common.EpochsContext, state common.BeaconState) error

func ProcessEth1Vote

func ProcessEth1Vote(ctx context.Context, spec *common.Spec, epc *common.EpochsContext, state common.BeaconState, data common.Eth1Data) error

func ProcessHistoricalRootsUpdate

func ProcessHistoricalRootsUpdate(ctx context.Context, spec *common.Spec, epc *common.EpochsContext, state common.BeaconState) error

func ProcessParticipationRecordUpdates

func ProcessParticipationRecordUpdates(ctx context.Context, spec *common.Spec, epc *common.EpochsContext, state *BeaconStateView) error

func ProcessProposerSlashing

func ProcessProposerSlashing(spec *common.Spec, epc *common.EpochsContext, state common.BeaconState, ps *ProposerSlashing) error

func ProcessProposerSlashings

func ProcessProposerSlashings(ctx context.Context, spec *common.Spec, epc *common.EpochsContext, state common.BeaconState, ops []ProposerSlashing) error

func ProcessRandaoMixesReset

func ProcessRandaoMixesReset(ctx context.Context, spec *common.Spec, epc *common.EpochsContext, state common.BeaconState) error

func ProcessRandaoReveal

func ProcessRandaoReveal(ctx context.Context, spec *common.Spec, epc *common.EpochsContext, state common.BeaconState, reveal common.BLSSignature) error

func ProcessSlashingsReset

func ProcessSlashingsReset(ctx context.Context, spec *common.Spec, epc *common.EpochsContext, state common.BeaconState) error

func ProcessVoluntaryExit

func ProcessVoluntaryExit(spec *common.Spec, epc *common.EpochsContext, state common.BeaconState, signedExit *SignedVoluntaryExit) error

func ProcessVoluntaryExits

func ProcessVoluntaryExits(ctx context.Context, spec *common.Spec, epc *common.EpochsContext, state common.BeaconState, ops []SignedVoluntaryExit) error

func RandaoMixesType

func RandaoMixesType(spec *common.Spec) VectorTypeDef

func RegistryBalancesType

func RegistryBalancesType(spec *common.Spec) *BasicListTypeDef

func SignedBeaconBlockType

func SignedBeaconBlockType(spec *common.Spec) *ContainerTypeDef

func SlashValidator

func SlashValidator(spec *common.Spec, epc *common.EpochsContext, state common.BeaconState,
	slashedIndex common.ValidatorIndex, whistleblowerIndex *common.ValidatorIndex) error

Slash the validator with the given index.

func SlashingsType

func SlashingsType(spec *common.Spec) VectorTypeDef

Balances slashed at every withdrawal period

func ValidateAggregateSelectionProof

func ValidateAggregateSelectionProof(spec *common.Spec, epc *common.EpochsContext, state common.BeaconState,
	slot common.Slot, commIndex common.CommitteeIndex, aggregator common.ValidatorIndex, selectionProof common.BLSSignature) (bool, error)

func ValidateIndexedAttestation

func ValidateIndexedAttestation(spec *common.Spec, epc *common.EpochsContext, state common.BeaconState, indexedAttestation *IndexedAttestation) error

Verify validity of slashable_attestation fields.

func ValidateIndexedAttestationIndicesSet

func ValidateIndexedAttestationIndicesSet(spec *common.Spec, indexedAttestation *IndexedAttestation) (common.ValidatorSet, error)

func ValidateIndexedAttestationNoSignature

func ValidateIndexedAttestationNoSignature(spec *common.Spec, state common.BeaconState, indexedAttestation *IndexedAttestation) error

func ValidateIndexedAttestationSignature

func ValidateIndexedAttestationSignature(spec *common.Spec, dom common.BLSDomain, pubCache *common.PubkeyCache, indexedAttestation *IndexedAttestation) error

func ValidateProposerSlashing

func ValidateProposerSlashing(spec *common.Spec, epc *common.EpochsContext, state common.BeaconState, ps *ProposerSlashing) error

func ValidateProposerSlashingNoSignature

func ValidateProposerSlashingNoSignature(spec *common.Spec, ps *ProposerSlashing) error

func ValidateVoluntaryExit

func ValidateVoluntaryExit(spec *common.Spec, epc *common.EpochsContext, state common.BeaconState, signedExit *SignedVoluntaryExit) error

func ValidatorsRegistryType

func ValidatorsRegistryType(spec *common.Spec) ListTypeDef

Types

type AggregateAndProof

type AggregateAndProof struct {
	AggregatorIndex common.ValidatorIndex `json:"aggregator_index"`
	Aggregate       Attestation           `json:"aggregate"`
	SelectionProof  common.BLSSignature   `json:"selection_proof"`
}

func (*AggregateAndProof) ByteLength

func (a *AggregateAndProof) ByteLength(spec *common.Spec) uint64

func (*AggregateAndProof) Deserialize

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

func (*AggregateAndProof) FixedLength

func (a *AggregateAndProof) FixedLength(*common.Spec) uint64

func (*AggregateAndProof) HashTreeRoot

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

func (*AggregateAndProof) Serialize

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

type Attestation

type Attestation struct {
	AggregationBits AttestationBits     `json:"aggregation_bits" yaml:"aggregation_bits"`
	Data            AttestationData     `json:"data" yaml:"data"`
	Signature       common.BLSSignature `json:"signature" yaml:"signature"`
}

func (*Attestation) ByteLength

func (a *Attestation) ByteLength(spec *common.Spec) uint64

func (*Attestation) ConvertToIndexed

func (attestation *Attestation) ConvertToIndexed(spec *common.Spec, committee []common.ValidatorIndex) (*IndexedAttestation, error)

Convert attestation to (almost) indexed-verifiable form

func (*Attestation) Deserialize

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

func (*Attestation) FixedLength

func (a *Attestation) FixedLength(*common.Spec) uint64

func (*Attestation) HashTreeRoot

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

func (*Attestation) Serialize

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

type AttestationBits

type AttestationBits []byte

AttestationBits is formatted as a serialized SSZ bitlist, including the delimit bit

func (AttestationBits) BitLen

func (cb AttestationBits) BitLen() uint64

func (AttestationBits) ByteLength

func (a AttestationBits) ByteLength(spec *common.Spec) uint64

func (AttestationBits) Copy

func (cb AttestationBits) Copy() AttestationBits

func (AttestationBits) Covers

func (cb AttestationBits) Covers(other AttestationBits) (bool, error)

Returns true if other only has bits set to 1 that this bitfield also has set to 1

func (*AttestationBits) Deserialize

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

func (AttestationBits) FilterNonParticipants

func (cb AttestationBits) FilterNonParticipants(committee []common.ValidatorIndex) []common.ValidatorIndex

In-place filters a list of committees indices to only keep the bitfield NON-participants. The result is not sorted. Returns the re-sliced filtered non-participants list.

WARNING: unsafe to use, panics if committee size does not match.

func (AttestationBits) FilterParticipants

func (cb AttestationBits) FilterParticipants(committee []common.ValidatorIndex) []common.ValidatorIndex

In-place filters a list of committees indices to only keep the bitfield participants. The result is not sorted. Returns the re-sliced filtered participants list.

WARNING: unsafe to use, panics if committee size does not match.

func (*AttestationBits) FixedLength

func (a *AttestationBits) FixedLength(*common.Spec) uint64

func (AttestationBits) GetBit

func (cb AttestationBits) GetBit(i uint64) bool

func (AttestationBits) HashTreeRoot

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

func (AttestationBits) MarshalText

func (cb AttestationBits) MarshalText() ([]byte, error)

func (AttestationBits) OnesCount

func (cb AttestationBits) OnesCount() uint64

func (AttestationBits) Or

func (cb AttestationBits) Or(other AttestationBits)

Sets the bits to true that are true in other. (in place)

func (AttestationBits) Serialize

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

func (AttestationBits) SetBit

func (cb AttestationBits) SetBit(i uint64, v bool)

func (AttestationBits) SingleParticipant

func (cb AttestationBits) SingleParticipant(committee []common.ValidatorIndex) (common.ValidatorIndex, error)

func (AttestationBits) String

func (cb AttestationBits) String() string

func (*AttestationBits) UnmarshalText

func (cb *AttestationBits) UnmarshalText(text []byte) error

func (AttestationBits) View

type AttestationBitsView

type AttestationBitsView struct {
	*BitListView
}

func AsAttestationBits

func AsAttestationBits(v View, err error) (*AttestationBitsView, error)

func (*AttestationBitsView) Raw

type AttestationData

type AttestationData struct {
	Slot  common.Slot           `json:"slot" yaml:"slot"`
	Index common.CommitteeIndex `json:"index" yaml:"index"`

	// LMD GHOST vote
	BeaconBlockRoot common.Root `json:"beacon_block_root" yaml:"beacon_block_root"`

	// FFG vote
	Source common.Checkpoint `json:"source" yaml:"source"`
	Target common.Checkpoint `json:"target" yaml:"target"`
}

func (*AttestationData) ByteLength

func (a *AttestationData) ByteLength() uint64

func (*AttestationData) Deserialize

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

func (*AttestationData) FixedLength

func (*AttestationData) FixedLength() uint64

func (*AttestationData) HashTreeRoot

func (p *AttestationData) HashTreeRoot(hFn tree.HashFn) common.Root

func (*AttestationData) Serialize

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

func (*AttestationData) View

func (data *AttestationData) View() *AttestationDataView

type AttestationDataView

type AttestationDataView struct{ *ContainerView }

func AsAttestationData

func AsAttestationData(v View, err error) (*AttestationDataView, error)

func (*AttestationDataView) Raw

type Attestations

type Attestations []Attestation

func (Attestations) ByteLength

func (a Attestations) ByteLength(spec *common.Spec) (out uint64)

func (*Attestations) Deserialize

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

func (*Attestations) FixedLength

func (a *Attestations) FixedLength(*common.Spec) uint64

func (Attestations) HashTreeRoot

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

func (Attestations) Serialize

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

type AttesterFlag

type AttesterFlag uint8
const (
	PrevSourceAttester AttesterFlag = 1 << iota
	PrevTargetAttester
	PrevHeadAttester

	CurrSourceAttester
	CurrTargetAttester
	CurrHeadAttester

	UnslashedAttester
	EligibleAttester
)

func (AttesterFlag) HasMarkers

func (flags AttesterFlag) HasMarkers(markers AttesterFlag) bool

type AttesterSlashing

type AttesterSlashing struct {
	Attestation1 IndexedAttestation `json:"attestation_1" yaml:"attestation_1"`
	Attestation2 IndexedAttestation `json:"attestation_2" yaml:"attestation_2"`
}

func (*AttesterSlashing) ByteLength

func (a *AttesterSlashing) ByteLength(spec *common.Spec) uint64

func (*AttesterSlashing) Deserialize

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

func (*AttesterSlashing) FixedLength

func (a *AttesterSlashing) FixedLength(*common.Spec) uint64

func (*AttesterSlashing) HashTreeRoot

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

func (*AttesterSlashing) Serialize

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

type AttesterSlashings

type AttesterSlashings []AttesterSlashing

func (AttesterSlashings) ByteLength

func (a AttesterSlashings) ByteLength(spec *common.Spec) (out uint64)

func (*AttesterSlashings) Deserialize

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

func (*AttesterSlashings) FixedLength

func (a *AttesterSlashings) FixedLength(*common.Spec) uint64

func (AttesterSlashings) HashTreeRoot

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

func (AttesterSlashings) Serialize

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

type AttesterStatus

type AttesterStatus struct {
	// The delay of inclusion of the latest attestation by the attester.
	// No delay (i.e. 0) by default
	InclusionDelay common.Slot
	// The validator index of the proposer of the attested beacon block.
	// Only valid if the validator has an attesting flag set.
	AttestedProposer common.ValidatorIndex
	// A bitfield of markers describing the recent actions of the validator
	Flags AttesterFlag
}

type Balances

type Balances []common.Gwei

func (Balances) ByteLength

func (a Balances) ByteLength(spec *common.Spec) (out uint64)

func (*Balances) Deserialize

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

func (*Balances) FixedLength

func (a *Balances) FixedLength(spec *common.Spec) uint64

func (Balances) HashTreeRoot

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

func (Balances) Serialize

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

type BatchRootsView

type BatchRootsView struct{ *ComplexVectorView }

func AsBatchRoots

func AsBatchRoots(v View, err error) (*BatchRootsView, error)

func (*BatchRootsView) GetRoot

func (v *BatchRootsView) GetRoot(slot common.Slot) (common.Root, error)

Return the root at the given slot. Only valid to SLOTS_PER_HISTORICAL_ROOT slots ago.

func (*BatchRootsView) SetRoot

func (v *BatchRootsView) SetRoot(slot common.Slot, r common.Root) error

type BeaconBlock

type BeaconBlock struct {
	Slot          common.Slot           `json:"slot" yaml:"slot"`
	ProposerIndex common.ValidatorIndex `json:"proposer_index" yaml:"proposer_index"`
	ParentRoot    common.Root           `json:"parent_root" yaml:"parent_root"`
	StateRoot     common.Root           `json:"state_root" yaml:"state_root"`
	Body          BeaconBlockBody       `json:"body" yaml:"body"`
}

func (*BeaconBlock) ByteLength

func (b *BeaconBlock) ByteLength(spec *common.Spec) uint64

func (*BeaconBlock) Deserialize

func (b *BeaconBlock) Deserialize(spec *common.Spec, dr *codec.DecodingReader) error

func (*BeaconBlock) FixedLength

func (a *BeaconBlock) FixedLength(*common.Spec) uint64

func (*BeaconBlock) HashTreeRoot

func (b *BeaconBlock) HashTreeRoot(spec *common.Spec, hFn tree.HashFn) common.Root

func (*BeaconBlock) Header

func (block *BeaconBlock) Header(spec *common.Spec) *common.BeaconBlockHeader

func (*BeaconBlock) Serialize

func (b *BeaconBlock) Serialize(spec *common.Spec, w *codec.EncodingWriter) error

type BeaconBlockBody

type BeaconBlockBody struct {
	RandaoReveal common.BLSSignature `json:"randao_reveal" yaml:"randao_reveal"`
	Eth1Data     common.Eth1Data     `json:"eth1_data" yaml:"eth1_data"`
	Graffiti     common.Root         `json:"graffiti" yaml:"graffiti"`

	ProposerSlashings ProposerSlashings `json:"proposer_slashings" yaml:"proposer_slashings"`
	AttesterSlashings AttesterSlashings `json:"attester_slashings" yaml:"attester_slashings"`
	Attestations      Attestations      `json:"attestations" yaml:"attestations"`
	Deposits          Deposits          `json:"deposits" yaml:"deposits"`
	VoluntaryExits    VoluntaryExits    `json:"voluntary_exits" yaml:"voluntary_exits"`
}

func (*BeaconBlockBody) ByteLength

func (b *BeaconBlockBody) ByteLength(spec *common.Spec) uint64

func (BeaconBlockBody) CheckLimits

func (b BeaconBlockBody) CheckLimits(spec *common.Spec) error

func (*BeaconBlockBody) Deserialize

func (b *BeaconBlockBody) Deserialize(spec *common.Spec, dr *codec.DecodingReader) error

func (*BeaconBlockBody) FixedLength

func (a *BeaconBlockBody) FixedLength(*common.Spec) uint64

func (*BeaconBlockBody) HashTreeRoot

func (b *BeaconBlockBody) HashTreeRoot(spec *common.Spec, hFn tree.HashFn) common.Root

func (*BeaconBlockBody) Serialize

func (b *BeaconBlockBody) Serialize(spec *common.Spec, w *codec.EncodingWriter) error

type BeaconState

type BeaconState struct {
	// Versioning
	GenesisTime           common.Timestamp `json:"genesis_time" yaml:"genesis_time"`
	GenesisValidatorsRoot common.Root      `json:"genesis_validators_root" yaml:"genesis_validators_root"`
	Slot                  common.Slot      `json:"slot" yaml:"slot"`
	Fork                  common.Fork      `json:"fork" yaml:"fork"`
	// History
	LatestBlockHeader common.BeaconBlockHeader `json:"latest_block_header" yaml:"latest_block_header"`
	BlockRoots        HistoricalBatchRoots     `json:"block_roots" yaml:"block_roots"`
	StateRoots        HistoricalBatchRoots     `json:"state_roots" yaml:"state_roots"`
	HistoricalRoots   HistoricalRoots          `json:"historical_roots" yaml:"historical_roots"`
	// Eth1
	Eth1Data      common.Eth1Data     `json:"eth1_data" yaml:"eth1_data"`
	Eth1DataVotes Eth1DataVotes       `json:"eth1_data_votes" yaml:"eth1_data_votes"`
	DepositIndex  common.DepositIndex `json:"eth1_deposit_index" yaml:"eth1_deposit_index"`
	// Registry
	Validators  ValidatorRegistry `json:"validators" yaml:"validators"`
	Balances    Balances          `json:"balances" yaml:"balances"`
	RandaoMixes RandaoMixes       `json:"randao_mixes" yaml:"randao_mixes"`
	Slashings   SlashingsHistory  `json:"slashings" yaml:"slashings"`
	// Attestations
	PreviousEpochAttestations PendingAttestations `json:"previous_epoch_attestations" yaml:"previous_epoch_attestations"`
	CurrentEpochAttestations  PendingAttestations `json:"current_epoch_attestations" yaml:"current_epoch_attestations"`
	// Finality
	JustificationBits           common.JustificationBits `json:"justification_bits" yaml:"justification_bits"`
	PreviousJustifiedCheckpoint common.Checkpoint        `json:"previous_justified_checkpoint" yaml:"previous_justified_checkpoint"`
	CurrentJustifiedCheckpoint  common.Checkpoint        `json:"current_justified_checkpoint" yaml:"current_justified_checkpoint"`
	FinalizedCheckpoint         common.Checkpoint        `json:"finalized_checkpoint" yaml:"finalized_checkpoint"`
}

func (*BeaconState) ByteLength

func (v *BeaconState) ByteLength(spec *common.Spec) uint64

func (*BeaconState) Deserialize

func (v *BeaconState) Deserialize(spec *common.Spec, dr *codec.DecodingReader) error

func (*BeaconState) FixedLength

func (*BeaconState) FixedLength(*common.Spec) uint64

func (*BeaconState) HashTreeRoot

func (v *BeaconState) HashTreeRoot(spec *common.Spec, hFn tree.HashFn) common.Root

func (*BeaconState) Serialize

func (v *BeaconState) Serialize(spec *common.Spec, w *codec.EncodingWriter) error

type BeaconStateView

type BeaconStateView struct {
	*ContainerView
}

func AsBeaconStateView

func AsBeaconStateView(v View, err error) (*BeaconStateView, error)

To load a state:

state, err := beacon.AsBeaconStateView(beacon.BeaconStateType.Deserialize(codec.NewDecodingReader(reader, size)))

func GenesisFromEth1

func GenesisFromEth1(spec *common.Spec, eth1BlockHash common.Root, time common.Timestamp, deps []common.Deposit, ignoreSignaturesAndProofs bool) (*BeaconStateView, *common.EpochsContext, error)

func KickStartState

func KickStartState(spec *common.Spec, eth1BlockHash common.Root, time common.Timestamp, validators []KickstartValidatorData) (*BeaconStateView, *common.EpochsContext, error)

To build a genesis state without Eth 1.0 deposits, i.e. directly from a sequence of minimal validator data.

func KickStartStateWithSignatures

func KickStartStateWithSignatures(spec *common.Spec, eth1BlockHash common.Root, time common.Timestamp, validators []KickstartValidatorData, keys [][32]byte) (*BeaconStateView, *common.EpochsContext, error)

To build a genesis state without Eth 1.0 deposits, i.e. directly from a sequence of minimal validator data.

func NewBeaconStateView

func NewBeaconStateView(spec *common.Spec) *BeaconStateView

func (*BeaconStateView) AddValidator

func (state *BeaconStateView) AddValidator(spec *common.Spec, pub common.BLSPubkey, withdrawalCreds common.Root, balance common.Gwei) error

func (*BeaconStateView) Balances

func (state *BeaconStateView) Balances() (common.Balances, error)

func (*BeaconStateView) BlockRoots

func (state *BeaconStateView) BlockRoots() (common.BatchRoots, error)

func (*BeaconStateView) Copy

func (state *BeaconStateView) Copy() (common.BeaconState, error)

func (*BeaconStateView) CurrentEpochAttestations

func (state *BeaconStateView) CurrentEpochAttestations() (*PendingAttestationsView, error)

func (*BeaconStateView) CurrentJustifiedCheckpoint

func (state *BeaconStateView) CurrentJustifiedCheckpoint() (common.Checkpoint, error)

func (*BeaconStateView) DepositIndex

func (state *BeaconStateView) DepositIndex() (common.DepositIndex, error)

func (*BeaconStateView) Eth1Data

func (state *BeaconStateView) Eth1Data() (common.Eth1Data, error)

func (*BeaconStateView) Eth1DataVotes

func (state *BeaconStateView) Eth1DataVotes() (common.Eth1DataVotes, error)

func (*BeaconStateView) FinalizedCheckpoint

func (state *BeaconStateView) FinalizedCheckpoint() (common.Checkpoint, error)

func (*BeaconStateView) Fork

func (state *BeaconStateView) Fork() (common.Fork, error)

func (*BeaconStateView) ForkSettings

func (state *BeaconStateView) ForkSettings(spec *common.Spec) *common.ForkSettings

func (*BeaconStateView) GenesisTime

func (state *BeaconStateView) GenesisTime() (common.Timestamp, error)

func (*BeaconStateView) GenesisValidatorsRoot

func (state *BeaconStateView) GenesisValidatorsRoot() (common.Root, error)

func (*BeaconStateView) HistoricalRoots

func (state *BeaconStateView) HistoricalRoots() (common.HistoricalRoots, error)

func (*BeaconStateView) IncrementDepositIndex

func (state *BeaconStateView) IncrementDepositIndex() error

func (*BeaconStateView) JustificationBits

func (state *BeaconStateView) JustificationBits() (common.JustificationBits, error)

func (*BeaconStateView) LatestBlockHeader

func (state *BeaconStateView) LatestBlockHeader() (*common.BeaconBlockHeader, error)

func (*BeaconStateView) PreviousEpochAttestations

func (state *BeaconStateView) PreviousEpochAttestations() (*PendingAttestationsView, error)

func (*BeaconStateView) PreviousJustifiedCheckpoint

func (state *BeaconStateView) PreviousJustifiedCheckpoint() (common.Checkpoint, error)

func (*BeaconStateView) ProcessBlock

func (state *BeaconStateView) ProcessBlock(ctx context.Context, spec *common.Spec, epc *common.EpochsContext, benv *common.BeaconBlockEnvelope) error

func (*BeaconStateView) ProcessEpoch

func (state *BeaconStateView) ProcessEpoch(ctx context.Context, spec *common.Spec, epc *common.EpochsContext) error

func (*BeaconStateView) RandaoMixes

func (state *BeaconStateView) RandaoMixes() (common.RandaoMixes, error)

func (*BeaconStateView) Raw

func (state *BeaconStateView) Raw(spec *common.Spec) (*BeaconState, error)

Raw converts the tree-structured state into a flattened native Go structure.

func (*BeaconStateView) SeedRandao

func (state *BeaconStateView) SeedRandao(spec *common.Spec, seed common.Root) error

func (*BeaconStateView) SetCurrentJustifiedCheckpoint

func (state *BeaconStateView) SetCurrentJustifiedCheckpoint(c common.Checkpoint) error

func (*BeaconStateView) SetEth1Data

func (state *BeaconStateView) SetEth1Data(v common.Eth1Data) error

func (*BeaconStateView) SetFinalizedCheckpoint

func (state *BeaconStateView) SetFinalizedCheckpoint(c common.Checkpoint) error

func (*BeaconStateView) SetFork

func (state *BeaconStateView) SetFork(f common.Fork) error

func (*BeaconStateView) SetGenesisTime

func (state *BeaconStateView) SetGenesisTime(t common.Timestamp) error

func (*BeaconStateView) SetGenesisValidatorsRoot

func (state *BeaconStateView) SetGenesisValidatorsRoot(r common.Root) error

func (*BeaconStateView) SetJustificationBits

func (state *BeaconStateView) SetJustificationBits(bits common.JustificationBits) error

func (*BeaconStateView) SetLatestBlockHeader

func (state *BeaconStateView) SetLatestBlockHeader(v *common.BeaconBlockHeader) error

func (*BeaconStateView) SetPreviousJustifiedCheckpoint

func (state *BeaconStateView) SetPreviousJustifiedCheckpoint(c common.Checkpoint) error

func (*BeaconStateView) SetSlot

func (state *BeaconStateView) SetSlot(slot common.Slot) error

func (*BeaconStateView) Slashings

func (state *BeaconStateView) Slashings() (common.Slashings, error)

func (*BeaconStateView) Slot

func (state *BeaconStateView) Slot() (common.Slot, error)

func (*BeaconStateView) StateRoots

func (state *BeaconStateView) StateRoots() (common.BatchRoots, error)

func (*BeaconStateView) Validators

func (state *BeaconStateView) Validators() (common.ValidatorRegistry, error)

type DepositRootsView

type DepositRootsView struct {
	*ComplexListView
}

func AsDepositRootsView

func AsDepositRootsView(v View, err error) (*DepositRootsView, error)

func NewDepositRootsView

func NewDepositRootsView() *DepositRootsView

type Deposits

type Deposits []common.Deposit

func (Deposits) ByteLength

func (a Deposits) ByteLength(*common.Spec) (out uint64)

func (*Deposits) Deserialize

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

func (*Deposits) FixedLength

func (a *Deposits) FixedLength(*common.Spec) uint64

func (Deposits) HashTreeRoot

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

func (Deposits) Serialize

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

type EpochAttesterData

type EpochAttesterData struct {
	PrevEpoch common.Epoch
	CurrEpoch common.Epoch

	Statuses []AttesterStatus
	Flats    []common.FlatValidator

	PrevEpochUnslashedStake       EpochStakeSummary
	CurrEpochUnslashedTargetStake common.Gwei
}

func ComputeEpochAttesterData

func ComputeEpochAttesterData(ctx context.Context, spec *common.Spec, epc *common.EpochsContext, flats []common.FlatValidator, state *BeaconStateView) (out *EpochAttesterData, err error)

type EpochStakeSummary

type EpochStakeSummary struct {
	SourceStake common.Gwei
	TargetStake common.Gwei
	HeadStake   common.Gwei
}

type Eth1DataVotes

type Eth1DataVotes []common.Eth1Data

func (Eth1DataVotes) ByteLength

func (a Eth1DataVotes) ByteLength(spec *common.Spec) (out uint64)

func (*Eth1DataVotes) Deserialize

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

func (*Eth1DataVotes) FixedLength

func (a *Eth1DataVotes) FixedLength(spec *common.Spec) uint64

func (Eth1DataVotes) HashTreeRoot

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

func (Eth1DataVotes) Serialize

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

type Eth1DataVotesView

type Eth1DataVotesView struct{ *ComplexListView }

func AsEth1DataVotes

func AsEth1DataVotes(v View, err error) (*Eth1DataVotesView, error)

func (*Eth1DataVotesView) Append

func (v *Eth1DataVotesView) Append(dat common.Eth1Data) error

func (*Eth1DataVotesView) Count

func (v *Eth1DataVotesView) Count(dat common.Eth1Data) (uint64, error)

func (*Eth1DataVotesView) Length

func (v *Eth1DataVotesView) Length() (uint64, error)

func (*Eth1DataVotesView) Reset

func (v *Eth1DataVotesView) Reset() error

Done at the end of every voting period

type HistoricalBatch

type HistoricalBatch struct {
	BlockRoots HistoricalBatchRoots `json:"block_roots" yaml:"block_roots"`
	StateRoots HistoricalBatchRoots `json:"state_roots" yaml:"state_roots"`
}

func (*HistoricalBatch) ByteLength

func (a *HistoricalBatch) ByteLength(spec *common.Spec) uint64

func (*HistoricalBatch) Deserialize

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

func (*HistoricalBatch) FixedLength

func (*HistoricalBatch) FixedLength(spec *common.Spec) uint64

func (*HistoricalBatch) HashTreeRoot

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

func (*HistoricalBatch) Serialize

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

type HistoricalBatchRoots

type HistoricalBatchRoots []common.Root

HistoricalBatchRoots stores roots: a batch of state or block roots. It represents a Vector[Root, SLOTS_PER_HISTORICAL_ROOT]

func (HistoricalBatchRoots) ByteLength

func (a HistoricalBatchRoots) ByteLength(spec *common.Spec) (out uint64)

func (*HistoricalBatchRoots) Deserialize

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

func (*HistoricalBatchRoots) FixedLength

func (a *HistoricalBatchRoots) FixedLength(spec *common.Spec) uint64

func (HistoricalBatchRoots) HashTreeRoot

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

func (HistoricalBatchRoots) Serialize

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

type HistoricalBatchView

type HistoricalBatchView struct{ *ContainerView }

func AsHistoricalBatch

func AsHistoricalBatch(v View, err error) (*HistoricalBatchView, error)

func (*HistoricalBatchView) BlockRoots

func (v *HistoricalBatchView) BlockRoots() (*BatchRootsView, error)

func (*HistoricalBatchView) StateRoots

func (v *HistoricalBatchView) StateRoots() (*BatchRootsView, error)

type HistoricalRoots

type HistoricalRoots []common.Root

roots of HistoricalBatch

func (HistoricalRoots) ByteLength

func (a HistoricalRoots) ByteLength(spec *common.Spec) (out uint64)

func (*HistoricalRoots) Deserialize

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

func (*HistoricalRoots) FixedLength

func (a *HistoricalRoots) FixedLength(spec *common.Spec) uint64

func (HistoricalRoots) HashTreeRoot

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

func (HistoricalRoots) Serialize

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

type HistoricalRootsView

type HistoricalRootsView struct{ *ComplexListView }

roots of HistoricalBatch

func AsHistoricalRoots

func AsHistoricalRoots(v View, err error) (*HistoricalRootsView, error)

func (*HistoricalRootsView) Append

func (h *HistoricalRootsView) Append(root common.Root) error

type IndexedAttestation

type IndexedAttestation struct {
	AttestingIndices common.CommitteeIndices `json:"attesting_indices" yaml:"attesting_indices"`
	Data             AttestationData         `json:"data" yaml:"data"`
	Signature        common.BLSSignature     `json:"signature" yaml:"signature"`
}

func (*IndexedAttestation) ByteLength

func (a *IndexedAttestation) ByteLength(spec *common.Spec) uint64

func (*IndexedAttestation) Deserialize

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

func (*IndexedAttestation) FixedLength

func (*IndexedAttestation) FixedLength(*common.Spec) uint64

func (*IndexedAttestation) HashTreeRoot

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

func (*IndexedAttestation) Serialize

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

type JustificationStakeData

type JustificationStakeData struct {
	CurrentEpoch common.Epoch
	// Minimum 1 effective balance increment. May include balance of recently slashed validators.
	TotalActiveStake common.Gwei
	// Minimum 1 effective balance increment
	PrevEpochUnslashedTargetStake common.Gwei
	// Minimum 1 effective balance increment
	CurrEpochUnslashedTargetStake common.Gwei
}

type KickstartValidatorData

type KickstartValidatorData struct {
	Pubkey                common.BLSPubkey
	WithdrawalCredentials common.Root
	Balance               common.Gwei
}

type PendingAttestation

type PendingAttestation struct {
	AggregationBits AttestationBits       `json:"aggregation_bits" yaml:"aggregation_bits"`
	Data            AttestationData       `json:"data" yaml:"data"`
	InclusionDelay  common.Slot           `json:"inclusion_delay" yaml:"inclusion_delay"`
	ProposerIndex   common.ValidatorIndex `json:"proposer_index" yaml:"proposer_index"`
}

func (*PendingAttestation) ByteLength

func (a *PendingAttestation) ByteLength(spec *common.Spec) uint64

func (*PendingAttestation) Deserialize

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

func (*PendingAttestation) FixedLength

func (a *PendingAttestation) FixedLength(*common.Spec) uint64

func (*PendingAttestation) HashTreeRoot

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

func (*PendingAttestation) Serialize

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

func (*PendingAttestation) View

type PendingAttestationView

type PendingAttestationView struct{ *ContainerView }

func AsPendingAttestation

func AsPendingAttestation(v View, err error) (*PendingAttestationView, error)

func (*PendingAttestationView) Raw

type PendingAttestations

type PendingAttestations []*PendingAttestation

func (PendingAttestations) ByteLength

func (p PendingAttestations) ByteLength(spec *common.Spec) (out uint64)

func (*PendingAttestations) Deserialize

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

func (*PendingAttestations) FixedLength

func (a *PendingAttestations) FixedLength(*common.Spec) uint64

func (PendingAttestations) HashTreeRoot

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

func (PendingAttestations) Serialize

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

type PendingAttestationsView

type PendingAttestationsView struct{ *ComplexListView }

func AsPendingAttestations

func AsPendingAttestations(v View, err error) (*PendingAttestationsView, error)

type ProposerSlashing

type ProposerSlashing struct {
	SignedHeader1 common.SignedBeaconBlockHeader `json:"signed_header_1" yaml:"signed_header_1"`
	SignedHeader2 common.SignedBeaconBlockHeader `json:"signed_header_2" yaml:"signed_header_2"`
}

func (*ProposerSlashing) ByteLength

func (a *ProposerSlashing) ByteLength() uint64

func (*ProposerSlashing) Deserialize

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

func (*ProposerSlashing) FixedLength

func (*ProposerSlashing) FixedLength() uint64

func (*ProposerSlashing) HashTreeRoot

func (p *ProposerSlashing) HashTreeRoot(hFn tree.HashFn) common.Root

func (*ProposerSlashing) Serialize

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

type ProposerSlashings

type ProposerSlashings []ProposerSlashing

func (ProposerSlashings) ByteLength

func (a ProposerSlashings) ByteLength(_ *common.Spec) (out uint64)

func (*ProposerSlashings) Deserialize

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

func (*ProposerSlashings) FixedLength

func (*ProposerSlashings) FixedLength(*common.Spec) uint64

func (ProposerSlashings) HashTreeRoot

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

func (ProposerSlashings) Serialize

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

type RandaoMixes

type RandaoMixes []common.Root

RandaoMixes is a EPOCHS_PER_HISTORICAL_VECTOR vector

func (RandaoMixes) ByteLength

func (a RandaoMixes) ByteLength(spec *common.Spec) (out uint64)

func (*RandaoMixes) Deserialize

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

func (*RandaoMixes) FixedLength

func (a *RandaoMixes) FixedLength(spec *common.Spec) uint64

func (RandaoMixes) HashTreeRoot

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

func (RandaoMixes) Serialize

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

type RandaoMixesView

type RandaoMixesView struct{ *ComplexVectorView }

Randomness and committees

func AsRandaoMixes

func AsRandaoMixes(v View, err error) (*RandaoMixesView, error)

func SeedRandao

func SeedRandao(spec *common.Spec, seed common.Root) (*RandaoMixesView, error)

func (*RandaoMixesView) GetRandomMix

func (mixes *RandaoMixesView) GetRandomMix(epoch common.Epoch) (common.Root, error)

Provides a source of randomness for the state, for e.g. shuffling

func (*RandaoMixesView) SetRandomMix

func (mixes *RandaoMixesView) SetRandomMix(epoch common.Epoch, mix common.Root) error

type RegistryBalancesView

type RegistryBalancesView struct {
	*BasicListView
}

func AsRegistryBalances

func AsRegistryBalances(v View, err error) (*RegistryBalancesView, error)

func (*RegistryBalancesView) AllBalances

func (v *RegistryBalancesView) AllBalances() ([]common.Gwei, error)

func (*RegistryBalancesView) GetBalance

func (v *RegistryBalancesView) GetBalance(index common.ValidatorIndex) (common.Gwei, error)

func (*RegistryBalancesView) Iter

func (v *RegistryBalancesView) Iter() (next func() (bal common.Gwei, ok bool, err error))

func (*RegistryBalancesView) SetBalance

func (v *RegistryBalancesView) SetBalance(index common.ValidatorIndex, bal common.Gwei) error

type RegistryIndices

type RegistryIndices []common.ValidatorIndex

func (RegistryIndices) ByteLength

func (a RegistryIndices) ByteLength(spec *common.Spec) uint64

func (*RegistryIndices) Deserialize

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

func (*RegistryIndices) FixedLength

func (*RegistryIndices) FixedLength() uint64

func (RegistryIndices) HashTreeRoot

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

func (RegistryIndices) Serialize

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

type RegistryProcessData

type RegistryProcessData struct {
	IndicesToSetActivationEligibility []common.ValidatorIndex
	// Ignores churn. Apply churn-limit manually.
	// Maybe, because finality affects it still.
	IndicesToMaybeActivate []common.ValidatorIndex

	IndicesToEject []common.ValidatorIndex

	ExitQueueEnd      common.Epoch
	ExitQueueEndChurn uint64
	ChurnLimit        uint64
}

func ComputeRegistryProcessData

func ComputeRegistryProcessData(spec *common.Spec, flats []common.FlatValidator, currentEpoch common.Epoch) *RegistryProcessData

type RewardsAndPenalties

type RewardsAndPenalties struct {
	Source         *common.Deltas
	Target         *common.Deltas
	Head           *common.Deltas
	InclusionDelay *common.Deltas
	Inactivity     *common.Deltas
}

func AttestationRewardsAndPenalties

func AttestationRewardsAndPenalties(ctx context.Context, spec *common.Spec,
	epc *common.EpochsContext, attesterData *EpochAttesterData, state *BeaconStateView) (*RewardsAndPenalties, error)

func NewRewardsAndPenalties

func NewRewardsAndPenalties(validatorCount uint64) *RewardsAndPenalties

type SignedAggregateAndProof

type SignedAggregateAndProof struct {
	Message   AggregateAndProof   `json:"message"`
	Signature common.BLSSignature `json:"signature"`
}

func (*SignedAggregateAndProof) ByteLength

func (a *SignedAggregateAndProof) ByteLength(spec *common.Spec) uint64

func (*SignedAggregateAndProof) Deserialize

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

func (*SignedAggregateAndProof) FixedLength

func (a *SignedAggregateAndProof) FixedLength(*common.Spec) uint64

func (*SignedAggregateAndProof) HashTreeRoot

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

func (*SignedAggregateAndProof) Serialize

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

type SignedBeaconBlock

type SignedBeaconBlock struct {
	Message   BeaconBlock         `json:"message" yaml:"message"`
	Signature common.BLSSignature `json:"signature" yaml:"signature"`
}

func (*SignedBeaconBlock) ByteLength

func (b *SignedBeaconBlock) ByteLength(spec *common.Spec) uint64

func (*SignedBeaconBlock) Deserialize

func (b *SignedBeaconBlock) Deserialize(spec *common.Spec, dr *codec.DecodingReader) error

func (*SignedBeaconBlock) Envelope

func (*SignedBeaconBlock) FixedLength

func (a *SignedBeaconBlock) FixedLength(*common.Spec) uint64

func (*SignedBeaconBlock) HashTreeRoot

func (b *SignedBeaconBlock) HashTreeRoot(spec *common.Spec, hFn tree.HashFn) common.Root

func (*SignedBeaconBlock) Serialize

func (b *SignedBeaconBlock) Serialize(spec *common.Spec, w *codec.EncodingWriter) error

func (*SignedBeaconBlock) SignedHeader

func (block *SignedBeaconBlock) SignedHeader(spec *common.Spec) *common.SignedBeaconBlockHeader

type SignedVoluntaryExit

type SignedVoluntaryExit struct {
	Message   VoluntaryExit       `json:"message" yaml:"message"`
	Signature common.BLSSignature `json:"signature" yaml:"signature"`
}

func (*SignedVoluntaryExit) ByteLength

func (v *SignedVoluntaryExit) ByteLength() uint64

func (*SignedVoluntaryExit) Deserialize

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

func (*SignedVoluntaryExit) FixedLength

func (*SignedVoluntaryExit) FixedLength() uint64

func (*SignedVoluntaryExit) HashTreeRoot

func (v *SignedVoluntaryExit) HashTreeRoot(hFn tree.HashFn) common.Root

func (*SignedVoluntaryExit) Serialize

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

type SlashingsHistory

type SlashingsHistory []common.Gwei

SlashingsHistory is a EPOCHS_PER_SLASHINGS_VECTOR vector

func (SlashingsHistory) ByteLength

func (a SlashingsHistory) ByteLength(spec *common.Spec) (out uint64)

func (*SlashingsHistory) Deserialize

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

func (*SlashingsHistory) FixedLength

func (a *SlashingsHistory) FixedLength(spec *common.Spec) uint64

func (SlashingsHistory) HashTreeRoot

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

func (SlashingsHistory) Serialize

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

type SlashingsView

type SlashingsView struct{ *BasicVectorView }

func AsSlashings

func AsSlashings(v View, err error) (*SlashingsView, error)

func (*SlashingsView) AddSlashing

func (sl *SlashingsView) AddSlashing(epoch common.Epoch, add common.Gwei) error

func (*SlashingsView) GetSlashingsValue

func (sl *SlashingsView) GetSlashingsValue(epoch common.Epoch) (common.Gwei, error)

func (*SlashingsView) ResetSlashings

func (sl *SlashingsView) ResetSlashings(epoch common.Epoch) error

func (*SlashingsView) Total

func (sl *SlashingsView) Total() (sum common.Gwei, err error)

type Validator

type Validator struct {
	Pubkey                common.BLSPubkey `json:"pubkey" yaml:"pubkey"`
	WithdrawalCredentials common.Root      `json:"withdrawal_credentials" yaml:"withdrawal_credentials"`
	EffectiveBalance      common.Gwei      `json:"effective_balance" yaml:"effective_balance"`
	Slashed               bool             `json:"slashed" yaml:"slashed"`

	ActivationEligibilityEpoch common.Epoch `json:"activation_eligibility_epoch" yaml:"activation_eligibility_epoch"`
	ActivationEpoch            common.Epoch `json:"activation_epoch" yaml:"activation_epoch"`
	ExitEpoch                  common.Epoch `json:"exit_epoch" yaml:"exit_epoch"`
	WithdrawableEpoch          common.Epoch `json:"withdrawable_epoch" yaml:"withdrawable_epoch"`
}

func (*Validator) ByteLength

func (a *Validator) ByteLength() uint64

func (*Validator) Deserialize

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

func (*Validator) FixedLength

func (*Validator) FixedLength() uint64

func (*Validator) HashTreeRoot

func (v *Validator) HashTreeRoot(hFn tree.HashFn) common.Root

func (*Validator) Serialize

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

func (*Validator) View

func (v *Validator) View() *ValidatorView

type ValidatorRegistry

type ValidatorRegistry []*Validator

func (ValidatorRegistry) ByteLength

func (a ValidatorRegistry) ByteLength(spec *common.Spec) (out uint64)

func (*ValidatorRegistry) Deserialize

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

func (*ValidatorRegistry) FixedLength

func (a *ValidatorRegistry) FixedLength(spec *common.Spec) uint64

func (ValidatorRegistry) HashTreeRoot

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

func (ValidatorRegistry) Serialize

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

type ValidatorView

type ValidatorView struct {
	*ContainerView
}

func AsValidator

func AsValidator(v View, err error) (*ValidatorView, error)

func NewValidatorView

func NewValidatorView() *ValidatorView

func (*ValidatorView) ActivationEligibilityEpoch

func (v *ValidatorView) ActivationEligibilityEpoch() (common.Epoch, error)

func (*ValidatorView) ActivationEpoch

func (v *ValidatorView) ActivationEpoch() (common.Epoch, error)

func (*ValidatorView) EffectiveBalance

func (v *ValidatorView) EffectiveBalance() (common.Gwei, error)

func (*ValidatorView) ExitEpoch

func (v *ValidatorView) ExitEpoch() (common.Epoch, error)

func (*ValidatorView) Flatten

func (v *ValidatorView) Flatten(dst *common.FlatValidator) error

func (*ValidatorView) MakeSlashed

func (v *ValidatorView) MakeSlashed() error

func (*ValidatorView) Pubkey

func (v *ValidatorView) Pubkey() (common.BLSPubkey, error)

func (*ValidatorView) SetActivationEligibilityEpoch

func (v *ValidatorView) SetActivationEligibilityEpoch(epoch common.Epoch) error

func (*ValidatorView) SetActivationEpoch

func (v *ValidatorView) SetActivationEpoch(epoch common.Epoch) error

func (*ValidatorView) SetEffectiveBalance

func (v *ValidatorView) SetEffectiveBalance(b common.Gwei) error

func (*ValidatorView) SetExitEpoch

func (v *ValidatorView) SetExitEpoch(ep common.Epoch) error

func (*ValidatorView) SetWithdrawableEpoch

func (v *ValidatorView) SetWithdrawableEpoch(epoch common.Epoch) error

func (*ValidatorView) Slashed

func (v *ValidatorView) Slashed() (bool, error)

func (*ValidatorView) WithdrawableEpoch

func (v *ValidatorView) WithdrawableEpoch() (common.Epoch, error)

func (*ValidatorView) WithdrawalCredentials

func (v *ValidatorView) WithdrawalCredentials() (out common.Root, err error)

type ValidatorsRegistryView

type ValidatorsRegistryView struct{ *ComplexListView }

func AsValidatorsRegistry

func AsValidatorsRegistry(v View, err error) (*ValidatorsRegistryView, error)

func (*ValidatorsRegistryView) IsValidIndex

func (registry *ValidatorsRegistryView) IsValidIndex(index common.ValidatorIndex) (valid bool, err error)

func (*ValidatorsRegistryView) Iter

func (registry *ValidatorsRegistryView) Iter() (next func() (val common.Validator, ok bool, err error))

func (*ValidatorsRegistryView) Validator

func (registry *ValidatorsRegistryView) Validator(index common.ValidatorIndex) (common.Validator, error)

func (*ValidatorsRegistryView) ValidatorCount

func (registry *ValidatorsRegistryView) ValidatorCount() (uint64, error)

type VoluntaryExit

type VoluntaryExit struct {
	// Earliest epoch when voluntary exit can be processed
	Epoch          common.Epoch          `json:"epoch" yaml:"epoch"`
	ValidatorIndex common.ValidatorIndex `json:"validator_index" yaml:"validator_index"`
}

func (*VoluntaryExit) ByteLength

func (v *VoluntaryExit) ByteLength() uint64

func (*VoluntaryExit) Deserialize

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

func (*VoluntaryExit) FixedLength

func (*VoluntaryExit) FixedLength() uint64

func (*VoluntaryExit) HashTreeRoot

func (v *VoluntaryExit) HashTreeRoot(hFn tree.HashFn) common.Root

func (*VoluntaryExit) Serialize

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

type VoluntaryExits

type VoluntaryExits []SignedVoluntaryExit

func (VoluntaryExits) ByteLength

func (a VoluntaryExits) ByteLength(spec *common.Spec) (out uint64)

func (*VoluntaryExits) Deserialize

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

func (*VoluntaryExits) FixedLength

func (*VoluntaryExits) FixedLength(*common.Spec) uint64

func (VoluntaryExits) HashTreeRoot

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

func (VoluntaryExits) Serialize

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

Jump to

Keyboard shortcuts

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