altair

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

Documentation

Index

Constants

View Source
const (
	TIMELY_SOURCE_FLAG_INDEX uint8 = 0
	TIMELY_TARGET_FLAG_INDEX uint8 = 1
	TIMELY_HEAD_FLAG_INDEX   uint8 = 2
)

Participation flag indices

View Source
const (
	TIMELY_SOURCE_WEIGHT common.Gwei = 14
	TIMELY_TARGET_WEIGHT common.Gwei = 26
	TIMELY_HEAD_WEIGHT   common.Gwei = 14
	SYNC_REWARD_WEIGHT   common.Gwei = 2
	PROPOSER_WEIGHT      common.Gwei = 8
	WEIGHT_DENOMINATOR   common.Gwei = 64
)

Participation flag fractions

View Source
const FINALIZED_ROOT_INDEX = tree.Gindex64((1 << finalizedRootProofLen) | (_stateFinalizedCheckpoint << 1) | 1)
View Source
const NEXT_SYNC_COMMITTEE_INDEX = tree.Gindex64((1 << syncCommitteeProofLen) | _nextSyncCommittee)
View Source
const ParticipationFlagsType = Uint8Type

Variables

View Source
var FinalizedRootProofBranchType = VectorType(RootType, finalizedRootProofLen)
View Source
var SyncAggregatorSelectionDataType = ContainerType("SyncAggregatorSelectionData", []FieldDef{
	{"slot", common.SlotType},
	{"subcommittee_index", Uint64Type},
})
View Source
var SyncCommitteeMessageType = ContainerType("SyncCommitteeMessage", []FieldDef{
	{"slot", common.SlotType},
	{"beacon_block_root", RootType},
	{"validator_index", common.ValidatorIndexType},
	{"signature", common.BLSSignatureType},
})
View Source
var SyncCommitteeProofBranchType = VectorType(RootType, syncCommitteeProofLen)

Functions

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 ComputeFlagDeltas

func ComputeFlagDeltas(ctx context.Context, spec *common.Spec, epc *common.EpochsContext, attesterData *EpochAttesterData,
	flag ParticipationFlags, weight common.Gwei, isInactivityLeak bool) (*common.Deltas, error)

func ComputeInactivityPenaltyDeltas

func ComputeInactivityPenaltyDeltas(ctx context.Context, spec *common.Spec, epc *common.EpochsContext,
	attesterData *EpochAttesterData, inactivityScores *InactivityScoresView, inactivityPenaltyQuotient uint64) (*common.Deltas, error)

func ContributionAndProofType added in v0.19.0

func ContributionAndProofType(spec *common.Spec) *ContainerTypeDef

func InactivityScoresType

func InactivityScoresType(spec *common.Spec) *BasicListTypeDef

func IsSyncCommitteeAggregator added in v0.26.1

func IsSyncCommitteeAggregator(spec *common.Spec, sig common.BLSSignature) bool

func LightClientSnapshotType added in v0.19.0

func LightClientSnapshotType(spec *common.Spec) *ContainerTypeDef

func LightClientUpdateType added in v0.19.0

func LightClientUpdateType(spec *common.Spec) *ContainerTypeDef

func ParticipationRegistryType

func ParticipationRegistryType(spec *common.Spec) *BasicListTypeDef

func ProcessAttestation

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

func ProcessAttestations

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

func ProcessEpochRewardsAndPenalties

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

func ProcessInactivityUpdates

func ProcessInactivityUpdates(ctx context.Context, spec *common.Spec, attesterData *EpochAttesterData, state AltairLikeBeaconState) error

func ProcessParticipationFlagUpdates

func ProcessParticipationFlagUpdates(ctx context.Context, spec *common.Spec, state AltairLikeBeaconState) error

func ProcessSyncAggregate added in v0.16.0

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

func ProcessSyncCommitteeUpdates

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

func SignedBeaconBlockType

func SignedBeaconBlockType(spec *common.Spec) *ContainerTypeDef

func SignedContributionAndProofType added in v0.19.0

func SignedContributionAndProofType(spec *common.Spec) *ContainerTypeDef

func SyncAggregateType

func SyncAggregateType(spec *common.Spec) *ContainerTypeDef

func SyncAggregatorSelectionSigningRoot added in v0.26.1

func SyncAggregatorSelectionSigningRoot(spec *common.Spec, domainFn common.BLSDomainFn, slot common.Slot, subcommitteeIndex uint64) (common.Root, error)

func SyncCommitteeBitsType

func SyncCommitteeBitsType(spec *common.Spec) *BitVectorTypeDef

func SyncCommitteeContributionType added in v0.19.0

func SyncCommitteeContributionType(spec *common.Spec) *ContainerTypeDef

func SyncCommitteeSubnetBitsType added in v0.19.0

func SyncCommitteeSubnetBitsType(spec *common.Spec) *BitVectorTypeDef

func TranslateParticipation added in v0.19.0

func TranslateParticipation(spec *common.Spec, epc *common.EpochsContext, state common.BeaconState,
	pendingAtts *phase0.PendingAttestationsView, participationRegistry ParticipationRegistry) error

func ValidateSyncAggregatorSelectionProof added in v0.26.1

func ValidateSyncAggregatorSelectionProof(spec *common.Spec, epc *common.EpochsContext, domainFn common.BLSDomainFn,
	aggregator common.ValidatorIndex, selectionProof common.BLSSignature, slot common.Slot, subcommitteeIndex uint64) error

Types

type AltairLikeBeaconState added in v0.19.0

type AltairLikeBeaconState interface {
	common.BeaconState
	InactivityScores() (*InactivityScoresView, error)
	CurrentEpochParticipation() (*ParticipationRegistryView, error)
	PreviousEpochParticipation() (*ParticipationRegistryView, 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 phase0.ProposerSlashings `json:"proposer_slashings" yaml:"proposer_slashings"`
	AttesterSlashings phase0.AttesterSlashings `json:"attester_slashings" yaml:"attester_slashings"`
	Attestations      phase0.Attestations      `json:"attestations" yaml:"attestations"`
	Deposits          phase0.Deposits          `json:"deposits" yaml:"deposits"`
	VoluntaryExits    phase0.VoluntaryExits    `json:"voluntary_exits" yaml:"voluntary_exits"`

	SyncAggregate SyncAggregate `json:"sync_aggregate" yaml:"sync_aggregate"`
}

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        phase0.HistoricalBatchRoots `json:"block_roots" yaml:"block_roots"`
	StateRoots        phase0.HistoricalBatchRoots `json:"state_roots" yaml:"state_roots"`
	HistoricalRoots   phase0.HistoricalRoots      `json:"historical_roots" yaml:"historical_roots"`
	// Eth1
	Eth1Data         common.Eth1Data      `json:"eth1_data" yaml:"eth1_data"`
	Eth1DataVotes    phase0.Eth1DataVotes `json:"eth1_data_votes" yaml:"eth1_data_votes"`
	Eth1DepositIndex common.DepositIndex  `json:"eth1_deposit_index" yaml:"eth1_deposit_index"`
	// Registry
	Validators  phase0.ValidatorRegistry `json:"validators" yaml:"validators"`
	Balances    phase0.Balances          `json:"balances" yaml:"balances"`
	RandaoMixes phase0.RandaoMixes       `json:"randao_mixes" yaml:"randao_mixes"`
	Slashings   phase0.SlashingsHistory  `json:"slashings" yaml:"slashings"`
	// Participation
	PreviousEpochParticipation ParticipationRegistry `json:"previous_epoch_participation" yaml:"previous_epoch_participation"`
	CurrentEpochParticipation  ParticipationRegistry `json:"current_epoch_participation" yaml:"current_epoch_participation"`
	// 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"`
	// Inactivity
	InactivityScores InactivityScores `json:"inactivity_scores" yaml:"inactivity_scores"`
	// Light client sync committees
	CurrentSyncCommittee common.SyncCommittee `json:"current_sync_committee" yaml:"current_sync_committee"`
	NextSyncCommittee    common.SyncCommittee `json:"next_sync_committee" yaml:"next_sync_committee"`
}

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 NewBeaconStateView

func NewBeaconStateView(spec *common.Spec) *BeaconStateView

func UpgradeToAltair added in v0.19.0

func UpgradeToAltair(spec *common.Spec, epc *common.EpochsContext, pre *phase0.BeaconStateView) (*BeaconStateView, error)

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.BalancesRegistry, error)

func (*BeaconStateView) BlockRoots

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

func (*BeaconStateView) CopyState added in v0.16.0

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

func (*BeaconStateView) CurrentEpochParticipation

func (state *BeaconStateView) CurrentEpochParticipation() (*ParticipationRegistryView, error)

func (*BeaconStateView) CurrentJustifiedCheckpoint

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

func (*BeaconStateView) CurrentSyncCommittee

func (state *BeaconStateView) CurrentSyncCommittee() (*common.SyncCommitteeView, error)

func (*BeaconStateView) Eth1Data

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

func (*BeaconStateView) Eth1DataVotes

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

func (*BeaconStateView) Eth1DepositIndex added in v0.19.0

func (state *BeaconStateView) Eth1DepositIndex() (common.DepositIndex, 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) InactivityScores

func (state *BeaconStateView) InactivityScores() (*InactivityScoresView, 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) NextSyncCommittee

func (state *BeaconStateView) NextSyncCommittee() (*common.SyncCommitteeView, error)

func (*BeaconStateView) PreviousEpochParticipation

func (state *BeaconStateView) PreviousEpochParticipation() (*ParticipationRegistryView, 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) RotateSyncCommittee added in v0.16.0

func (state *BeaconStateView) RotateSyncCommittee(next *common.SyncCommitteeView) error

func (*BeaconStateView) SeedRandao

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

func (*BeaconStateView) SetBalances added in v0.16.0

func (state *BeaconStateView) SetBalances(balances []common.Gwei) error

func (*BeaconStateView) SetCurrentJustifiedCheckpoint

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

func (*BeaconStateView) SetCurrentSyncCommittee added in v0.16.2

func (state *BeaconStateView) SetCurrentSyncCommittee(v *common.SyncCommitteeView) 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) SetNextSyncCommittee added in v0.16.2

func (state *BeaconStateView) SetNextSyncCommittee(v *common.SyncCommitteeView) 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 ContributionAndProof added in v0.19.0

type ContributionAndProof struct {
	AggregatorIndex common.ValidatorIndex     `yaml:"aggregator_index" json:"aggregator_index"`
	Contribution    SyncCommitteeContribution `yaml:"contribution" json:"contribution"`
	SelectionProof  common.BLSSignature       `yaml:"selection_proof" json:"selection_proof"`
}

func (*ContributionAndProof) ByteLength added in v0.19.0

func (cnp *ContributionAndProof) ByteLength(spec *common.Spec) uint64

func (*ContributionAndProof) Deserialize added in v0.19.0

func (cnp *ContributionAndProof) Deserialize(spec *common.Spec, dr *codec.DecodingReader) error

func (*ContributionAndProof) FixedLength added in v0.19.0

func (cnp *ContributionAndProof) FixedLength(spec *common.Spec) uint64

func (*ContributionAndProof) HashTreeRoot added in v0.19.0

func (cnp *ContributionAndProof) HashTreeRoot(spec *common.Spec, hFn tree.HashFn) common.Root

func (*ContributionAndProof) Serialize added in v0.19.0

func (cnp *ContributionAndProof) Serialize(spec *common.Spec, w *codec.EncodingWriter) error

type ContributionAndProofView added in v0.19.0

type ContributionAndProofView struct {
	*ContainerView
}

func AsContributionAndProof added in v0.19.0

func AsContributionAndProof(v View, err error) (*ContributionAndProofView, error)

type EpochAttesterData

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

	Flats           []common.FlatValidator
	EligibleIndices []common.ValidatorIndex

	PrevParticipation ParticipationRegistry
	CurrParticipation ParticipationRegistry

	PrevEpochUnslashedStake       EpochStakeSummary
	CurrEpochUnslashedTargetStake common.Gwei
}

func ComputeEpochAttesterData

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

type EpochStakeSummary

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

type FinalizedRootProofBranch added in v0.19.0

type FinalizedRootProofBranch [finalizedRootProofLen]common.Root

func (FinalizedRootProofBranch) ByteLength added in v0.19.0

func (fb FinalizedRootProofBranch) ByteLength() (out uint64)

func (*FinalizedRootProofBranch) Deserialize added in v0.19.0

func (fb *FinalizedRootProofBranch) Deserialize(dr *codec.DecodingReader) error

func (*FinalizedRootProofBranch) FixedLength added in v0.19.0

func (fb *FinalizedRootProofBranch) FixedLength() uint64

func (FinalizedRootProofBranch) HashTreeRoot added in v0.19.0

func (fb FinalizedRootProofBranch) HashTreeRoot(hFn tree.HashFn) common.Root

func (FinalizedRootProofBranch) Serialize added in v0.19.0

type InactivityScores

type InactivityScores []Uint64View

func (InactivityScores) ByteLength

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

func (*InactivityScores) Deserialize

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

func (*InactivityScores) FixedLength

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

func (InactivityScores) HashTreeRoot

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

func (InactivityScores) Serialize

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

func (InactivityScores) View added in v0.19.0

type InactivityScoresView

type InactivityScoresView struct {
	*BasicListView
}

func AsInactivityScores

func AsInactivityScores(v View, err error) (*InactivityScoresView, error)

func (*InactivityScoresView) GetScore

func (v *InactivityScoresView) GetScore(index common.ValidatorIndex) (uint64, error)

func (*InactivityScoresView) SetScore

func (v *InactivityScoresView) SetScore(index common.ValidatorIndex, score uint64) error

type LightClientSnapshot added in v0.19.0

type LightClientSnapshot struct {
	// Beacon block header
	Header common.BeaconBlockHeader `yaml:"header" json:"header"`
	// Sync committees corresponding to the header
	CurrentSyncCommittee common.SyncCommittee `yaml:"current_sync_committee" json:"current_sync_committee"`
	NextSyncCommittee    common.SyncCommittee `yaml:"next_sync_committee" json:"next_sync_committee"`
}

func (*LightClientSnapshot) ByteLength added in v0.19.0

func (lcs *LightClientSnapshot) ByteLength(spec *common.Spec) uint64

func (*LightClientSnapshot) Deserialize added in v0.19.0

func (lcs *LightClientSnapshot) Deserialize(spec *common.Spec, dr *codec.DecodingReader) error

func (*LightClientSnapshot) FixedLength added in v0.19.0

func (lcs *LightClientSnapshot) FixedLength(spec *common.Spec) uint64

func (*LightClientSnapshot) HashTreeRoot added in v0.19.0

func (lcs *LightClientSnapshot) HashTreeRoot(spec *common.Spec, hFn tree.HashFn) common.Root

func (*LightClientSnapshot) Serialize added in v0.19.0

func (lcs *LightClientSnapshot) Serialize(spec *common.Spec, w *codec.EncodingWriter) error

type LightClientUpdate added in v0.19.0

type LightClientUpdate struct {
	// Update beacon block header
	AttestedHeader common.BeaconBlockHeader `yaml:"attested_header" json:"attested_header"`
	// Next sync committee corresponding to the header
	NextSyncCommittee       common.SyncCommittee     `yaml:"next_sync_committee" json:"next_sync_committee"`
	NextSyncCommitteeBranch SyncCommitteeProofBranch `yaml:"next_sync_committee_branch" json:"next_sync_committee_branch"`
	// Finality proof for the update header
	FinalizedHeader common.BeaconBlockHeader `yaml:"finalized_header" json:"finalized_header"`
	FinalityBranch  FinalizedRootProofBranch `yaml:"finality_branch" json:"finality_branch"`
	// Sync committee aggregate signature
	SyncAggregate SyncAggregate `yaml:"sync_aggregate" json:"sync_aggregate"`
	// Slot at which the aggregate signature was created (untrusted)
	SignatureSlot common.Slot `yaml:"signature_slot" json:"signature_slot"`
}

func (*LightClientUpdate) ByteLength added in v0.19.0

func (lcu *LightClientUpdate) ByteLength(spec *common.Spec) uint64

func (*LightClientUpdate) Deserialize added in v0.19.0

func (lcu *LightClientUpdate) Deserialize(spec *common.Spec, dr *codec.DecodingReader) error

func (*LightClientUpdate) FixedLength added in v0.19.0

func (lcu *LightClientUpdate) FixedLength(spec *common.Spec) uint64

func (*LightClientUpdate) HashTreeRoot added in v0.19.0

func (lcu *LightClientUpdate) HashTreeRoot(spec *common.Spec, hFn tree.HashFn) common.Root

func (*LightClientUpdate) Serialize added in v0.19.0

func (lcu *LightClientUpdate) Serialize(spec *common.Spec, w *codec.EncodingWriter) error

type ParticipationFlags

type ParticipationFlags Uint8View
const (
	TIMELY_SOURCE_FLAG ParticipationFlags = 1 << TIMELY_SOURCE_FLAG_INDEX
	TIMELY_TARGET_FLAG ParticipationFlags = 1 << TIMELY_TARGET_FLAG_INDEX
	TIMELY_HEAD_FLAG   ParticipationFlags = 1 << TIMELY_HEAD_FLAG_INDEX
)

func AsParticipationFlags

func AsParticipationFlags(v View, err error) (ParticipationFlags, error)

func GetApplicableAttestationParticipationFlags added in v0.16.0

func GetApplicableAttestationParticipationFlags(
	spec *common.Spec, state common.BeaconState,
	data *phase0.AttestationData, inclusionDelay common.Slot) (out ParticipationFlags, err error)

func (ParticipationFlags) ByteLength

func (ParticipationFlags) ByteLength() uint64

func (*ParticipationFlags) Deserialize

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

func (ParticipationFlags) FixedLength

func (ParticipationFlags) FixedLength() uint64

func (ParticipationFlags) HashTreeRoot

func (t ParticipationFlags) HashTreeRoot(hFn tree.HashFn) common.Root

func (ParticipationFlags) MarshalJSON added in v0.24.0

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

func (ParticipationFlags) Serialize

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

func (ParticipationFlags) String

func (e ParticipationFlags) String() string

func (*ParticipationFlags) UnmarshalJSON added in v0.24.0

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

type ParticipationRegistry

type ParticipationRegistry []ParticipationFlags

func (ParticipationRegistry) ByteLength

func (r ParticipationRegistry) ByteLength(spec *common.Spec) (out uint64)

func (*ParticipationRegistry) Deserialize

func (r *ParticipationRegistry) Deserialize(spec *common.Spec, dr *codec.DecodingReader) error

func (*ParticipationRegistry) FixedLength

func (r *ParticipationRegistry) FixedLength(spec *common.Spec) uint64

func (ParticipationRegistry) HashTreeRoot

func (r ParticipationRegistry) HashTreeRoot(spec *common.Spec, hFn tree.HashFn) common.Root

func (ParticipationRegistry) MarshalJSON added in v0.16.4

func (r ParticipationRegistry) MarshalJSON() ([]byte, error)

func (ParticipationRegistry) MarshalYAML added in v0.16.4

func (r ParticipationRegistry) MarshalYAML() (interface{}, error)

func (ParticipationRegistry) Serialize

func (r ParticipationRegistry) Serialize(spec *common.Spec, w *codec.EncodingWriter) error

func (ParticipationRegistry) String added in v0.16.3

func (r ParticipationRegistry) String() string

func (*ParticipationRegistry) UnmarshalJSON added in v0.16.4

func (r *ParticipationRegistry) UnmarshalJSON(data []byte) error

func (*ParticipationRegistry) UnmarshalYAML added in v0.16.4

func (r *ParticipationRegistry) UnmarshalYAML(value *yaml.Node) error

func (ParticipationRegistry) View added in v0.19.0

type ParticipationRegistryView

type ParticipationRegistryView struct {
	*BasicListView
}

func AsParticipationRegistry

func AsParticipationRegistry(v View, err error) (*ParticipationRegistryView, error)

func (*ParticipationRegistryView) FillZeroes

func (v *ParticipationRegistryView) FillZeroes(length uint64) error

func (*ParticipationRegistryView) GetFlags

func (*ParticipationRegistryView) Raw

func (*ParticipationRegistryView) SetFlags

type RewardsAndPenalties added in v0.16.0

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

func AttestationRewardsAndPenalties added in v0.16.0

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

func NewRewardsAndPenalties added in v0.16.0

func NewRewardsAndPenalties(validatorCount uint64) *RewardsAndPenalties

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 SignedContributionAndProof added in v0.19.0

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

func (*SignedContributionAndProof) ByteLength added in v0.19.0

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

func (*SignedContributionAndProof) Deserialize added in v0.19.0

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

func (*SignedContributionAndProof) FixedLength added in v0.19.0

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

func (*SignedContributionAndProof) HashTreeRoot added in v0.19.0

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

func (*SignedContributionAndProof) Serialize added in v0.19.0

func (*SignedContributionAndProof) VerifySignature added in v0.26.1

func (b *SignedContributionAndProof) VerifySignature(spec *common.Spec, epc *common.EpochsContext, domainFn common.BLSDomainFn) error

VerifySignature verifies the outer Signature ONLY. This does not verify the selection proof or contribution contents.

type SignedContributionAndProofView added in v0.19.0

type SignedContributionAndProofView struct {
	*ContainerView
}

func AsSignedContributionAndProof added in v0.19.0

func AsSignedContributionAndProof(v View, err error) (*SignedContributionAndProofView, error)

type SyncAggregate

type SyncAggregate struct {
	SyncCommitteeBits      SyncCommitteeBits   `json:"sync_committee_bits" yaml:"sync_committee_bits"`
	SyncCommitteeSignature common.BLSSignature `json:"sync_committee_signature" yaml:"sync_committee_signature"`
}

func (*SyncAggregate) ByteLength

func (agg *SyncAggregate) ByteLength(spec *common.Spec) uint64

func (*SyncAggregate) Deserialize

func (agg *SyncAggregate) Deserialize(spec *common.Spec, dr *codec.DecodingReader) error

func (*SyncAggregate) FixedLength

func (agg *SyncAggregate) FixedLength(spec *common.Spec) uint64

func (*SyncAggregate) HashTreeRoot

func (agg *SyncAggregate) HashTreeRoot(spec *common.Spec, hFn tree.HashFn) common.Root

func (*SyncAggregate) Serialize

func (agg *SyncAggregate) Serialize(spec *common.Spec, w *codec.EncodingWriter) error

type SyncAggregateView

type SyncAggregateView struct {
	*ContainerView
}

func AsSyncAggregate

func AsSyncAggregate(v View, err error) (*SyncAggregateView, error)

type SyncAggregatorSelectionData added in v0.19.0

type SyncAggregatorSelectionData struct {
	Slot              common.Slot `yaml:"slot" json:"slot"`
	SubcommitteeIndex Uint64View  `yaml:"subcommittee_index" json:"subcommittee_index"`
}

func (*SyncAggregatorSelectionData) ByteLength added in v0.19.0

func (sd *SyncAggregatorSelectionData) ByteLength() uint64

func (*SyncAggregatorSelectionData) Deserialize added in v0.19.0

func (*SyncAggregatorSelectionData) FixedLength added in v0.19.0

func (sd *SyncAggregatorSelectionData) FixedLength() uint64

func (*SyncAggregatorSelectionData) HashTreeRoot added in v0.19.0

func (sd *SyncAggregatorSelectionData) HashTreeRoot(hFn tree.HashFn) common.Root

func (*SyncAggregatorSelectionData) Serialize added in v0.19.0

type SyncCommitteeBits

type SyncCommitteeBits []byte

SyncCommitteeBits is formatted as a serialized SSZ bitvector, with trailing zero bits if length does not align with byte length.

func (SyncCommitteeBits) ByteLength

func (li SyncCommitteeBits) ByteLength(spec *common.Spec) uint64

func (*SyncCommitteeBits) Deserialize

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

func (*SyncCommitteeBits) FixedLength

func (li *SyncCommitteeBits) FixedLength(spec *common.Spec) uint64

func (SyncCommitteeBits) GetBit

func (li SyncCommitteeBits) GetBit(i uint64) bool

func (SyncCommitteeBits) HashTreeRoot

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

func (SyncCommitteeBits) MarshalText

func (li SyncCommitteeBits) MarshalText() ([]byte, error)

func (SyncCommitteeBits) Serialize

func (li SyncCommitteeBits) Serialize(spec *common.Spec, w *codec.EncodingWriter) error

func (SyncCommitteeBits) SetBit

func (li SyncCommitteeBits) SetBit(i uint64, v bool)

func (SyncCommitteeBits) String

func (li SyncCommitteeBits) String() string

func (*SyncCommitteeBits) UnmarshalText

func (li *SyncCommitteeBits) UnmarshalText(text []byte) error

func (SyncCommitteeBits) View

type SyncCommitteeBitsView

type SyncCommitteeBitsView struct {
	*BitVectorView
}

func AsSyncCommitteeBits

func AsSyncCommitteeBits(v View, err error) (*SyncCommitteeBitsView, error)

func (*SyncCommitteeBitsView) Raw

type SyncCommitteeContribution added in v0.19.0

type SyncCommitteeContribution struct {
	// Slot to which this contribution pertains
	Slot common.Slot `yaml:"slot" json:"slot"`
	// Block root for this contribution
	BeaconBlockRoot common.Root `yaml:"beacon_block_root" json:"beacon_block_root"`
	// The subcommittee this contribution pertains to out of the broader sync committee
	SubcommitteeIndex Uint64View `yaml:"subcommittee_index" json:"subcommittee_index"`
	// A bit is set if a signature from the validator at the corresponding
	// index in the subcommittee is present in the aggregate `signature`.
	AggregationBits SyncCommitteeSubnetBits `yaml:"aggregation_bits" json:"aggregation_bits"`
	// Signature by the validator(s) over the block root of `slot`
	Signature common.BLSSignature `yaml:"signature" json:"signature"`
}

func (*SyncCommitteeContribution) ByteLength added in v0.19.0

func (sc *SyncCommitteeContribution) ByteLength(spec *common.Spec) uint64

func (*SyncCommitteeContribution) Deserialize added in v0.19.0

func (sc *SyncCommitteeContribution) Deserialize(spec *common.Spec, dr *codec.DecodingReader) error

func (*SyncCommitteeContribution) FixedLength added in v0.19.0

func (sc *SyncCommitteeContribution) FixedLength(spec *common.Spec) uint64

func (*SyncCommitteeContribution) HashTreeRoot added in v0.19.0

func (sc *SyncCommitteeContribution) HashTreeRoot(spec *common.Spec, hFn tree.HashFn) common.Root

func (*SyncCommitteeContribution) Serialize added in v0.19.0

func (*SyncCommitteeContribution) VerifySignature added in v0.26.1

func (sc *SyncCommitteeContribution) VerifySignature(spec *common.Spec, subcommitteePubkeys []*common.CachedPubkey, domFn common.BLSDomainFn) error

type SyncCommitteeContributionView added in v0.19.0

type SyncCommitteeContributionView struct {
	*ContainerView
}

func AsSyncCommitteeContribution added in v0.19.0

func AsSyncCommitteeContribution(v View, err error) (*SyncCommitteeContributionView, error)

type SyncCommitteeMessage added in v0.19.0

type SyncCommitteeMessage struct {
	// Slot to which this contribution pertains
	Slot common.Slot `yaml:"slot" json:"slot"`
	// Block root for this signature
	BeaconBlockRoot common.Root `yaml:"beacon_block_root" json:"beacon_block_root"`
	// Index of the validator that produced this signature
	ValidatorIndex common.ValidatorIndex `yaml:"validator_index" json:"validator_index"`
	// Signature by the validator over the block root of `slot`
	Signature common.BLSSignature `yaml:"signature" json:"signature"`
}

func (*SyncCommitteeMessage) ByteLength added in v0.19.0

func (msg *SyncCommitteeMessage) ByteLength() uint64

func (*SyncCommitteeMessage) Deserialize added in v0.19.0

func (msg *SyncCommitteeMessage) Deserialize(dr *codec.DecodingReader) error

func (*SyncCommitteeMessage) FixedLength added in v0.19.0

func (msg *SyncCommitteeMessage) FixedLength() uint64

func (*SyncCommitteeMessage) HashTreeRoot added in v0.19.0

func (msg *SyncCommitteeMessage) HashTreeRoot(hFn tree.HashFn) common.Root

func (*SyncCommitteeMessage) Serialize added in v0.19.0

func (msg *SyncCommitteeMessage) Serialize(w *codec.EncodingWriter) error

func (*SyncCommitteeMessage) VerifySignature added in v0.26.1

func (msg *SyncCommitteeMessage) VerifySignature(spec *common.Spec, epc *common.EpochsContext, domFn common.BLSDomainFn) error

type SyncCommitteeMessageView added in v0.19.0

type SyncCommitteeMessageView struct {
	*ContainerView
}

func AsSyncCommitteeMessage added in v0.19.0

func AsSyncCommitteeMessage(v View, err error) (*SyncCommitteeMessageView, error)

type SyncCommitteeProofBranch added in v0.19.0

type SyncCommitteeProofBranch [syncCommitteeProofLen]common.Root

func (SyncCommitteeProofBranch) ByteLength added in v0.19.0

func (sb SyncCommitteeProofBranch) ByteLength() (out uint64)

func (*SyncCommitteeProofBranch) Deserialize added in v0.19.0

func (sb *SyncCommitteeProofBranch) Deserialize(dr *codec.DecodingReader) error

func (*SyncCommitteeProofBranch) FixedLength added in v0.19.0

func (sb *SyncCommitteeProofBranch) FixedLength() uint64

func (SyncCommitteeProofBranch) HashTreeRoot added in v0.19.0

func (sb SyncCommitteeProofBranch) HashTreeRoot(hFn tree.HashFn) common.Root

func (SyncCommitteeProofBranch) Serialize added in v0.19.0

type SyncCommitteeSubnetBits added in v0.19.0

type SyncCommitteeSubnetBits []byte

SyncCommitteeSubnetBits is formatted as a serialized SSZ bitvector, with trailing zero bits if length does not align with byte length.

func (SyncCommitteeSubnetBits) ByteLength added in v0.19.0

func (li SyncCommitteeSubnetBits) ByteLength(spec *common.Spec) uint64

func (*SyncCommitteeSubnetBits) Deserialize added in v0.19.0

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

func (*SyncCommitteeSubnetBits) FixedLength added in v0.19.0

func (li *SyncCommitteeSubnetBits) FixedLength(spec *common.Spec) uint64

func (SyncCommitteeSubnetBits) GetBit added in v0.19.0

func (li SyncCommitteeSubnetBits) GetBit(i uint64) bool

func (SyncCommitteeSubnetBits) HashTreeRoot added in v0.19.0

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

func (SyncCommitteeSubnetBits) MarshalText added in v0.19.0

func (li SyncCommitteeSubnetBits) MarshalText() ([]byte, error)

func (SyncCommitteeSubnetBits) OnesCount added in v0.26.1

func (li SyncCommitteeSubnetBits) OnesCount() uint64

func (SyncCommitteeSubnetBits) Serialize added in v0.19.0

func (li SyncCommitteeSubnetBits) Serialize(spec *common.Spec, w *codec.EncodingWriter) error

func (SyncCommitteeSubnetBits) SetBit added in v0.19.0

func (li SyncCommitteeSubnetBits) SetBit(i uint64, v bool)

func (SyncCommitteeSubnetBits) String added in v0.19.0

func (li SyncCommitteeSubnetBits) String() string

func (*SyncCommitteeSubnetBits) UnmarshalText added in v0.19.0

func (li *SyncCommitteeSubnetBits) UnmarshalText(text []byte) error

func (SyncCommitteeSubnetBits) View added in v0.19.0

type SyncCommitteeSubnetBitsView added in v0.19.0

type SyncCommitteeSubnetBitsView struct {
	*BitVectorView
}

func AsSyncCommitteeSubnetBits added in v0.19.0

func AsSyncCommitteeSubnetBits(v View, err error) (*SyncCommitteeSubnetBitsView, error)

func (*SyncCommitteeSubnetBitsView) Raw added in v0.19.0

Jump to

Keyboard shortcuts

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