package
5.2.0
Repository: https://github.com/prysmaticlabs/prysm.git
Documentation: pkg.go.dev

# Functions

AddValidatorFlag adds new validator flag to existing one.
AddValidatorToRegistry updates the beacon state with validator information def add_validator_to_registry(state: BeaconState, pubkey: BLSPubkey, withdrawal_credentials: Bytes32, amount: uint64) -> None: index = get_index_for_new_validator(state) validator = get_validator_from_deposit(pubkey, withdrawal_credentials) set_or_append_list(state.validators, index, validator) set_or_append_list(state.balances, index, 0) set_or_append_list(state.previous_epoch_participation, index, ParticipationFlags(0b0000_0000)) // New in Altair set_or_append_list(state.current_epoch_participation, index, ParticipationFlags(0b0000_0000)) // New in Altair set_or_append_list(state.inactivity_scores, index, uint64(0)) // New in Altair.
ApplyDeposit Spec pseudocode definition: def apply_deposit(state: BeaconState, pubkey: BLSPubkey, withdrawal_credentials: Bytes32, amount: uint64, signature: BLSSignature) -> None: validator_pubkeys = [v.pubkey for v in state.validators] if pubkey not in validator_pubkeys: # Verify the deposit signature (proof of possession) which is not checked by the deposit contract deposit_message = DepositMessage( pubkey=pubkey, withdrawal_credentials=withdrawal_credentials, amount=amount, ) domain = compute_domain(DOMAIN_DEPOSIT) # Fork-agnostic domain since deposits are valid across forks signing_root = compute_signing_root(deposit_message, domain) if bls.Verify(pubkey, signing_root, signature): add_validator_to_registry(state, pubkey, withdrawal_credentials, amount) else: # Increase balance by deposit amount index = ValidatorIndex(validator_pubkeys.index(pubkey)) increase_balance(state, index, amount).
AttestationParticipationFlagIndices retrieves a map of attestation scoring based on Altair's participation flag indices.
AttestationsDelta computes and returns the rewards and penalties differences for individual validators based on the voting records.
BaseReward takes state and validator index and calculate individual validator's base reward.
BaseRewardPerIncrement of the beacon state Spec code: def get_base_reward_per_increment(state: BeaconState) -> Gwei: return Gwei(EFFECTIVE_BALANCE_INCREMENT * BASE_REWARD_FACTOR // integer_squareroot(get_total_active_balance(state))).
BaseRewardWithTotalBalance calculates the base reward with the provided total balance.
EpochParticipation sets and returns the proposer reward numerator and epoch participation.
GetValidatorFromDeposit gets a new validator object with provided parameters def get_validator_from_deposit(pubkey: BLSPubkey, withdrawal_credentials: Bytes32, amount: uint64) -> Validator: effective_balance = min(amount - amount % EFFECTIVE_BALANCE_INCREMENT, MAX_EFFECTIVE_BALANCE) return Validator( pubkey=pubkey, withdrawal_credentials=withdrawal_credentials, effective_balance=effective_balance, slashed=False, activation_eligibility_epoch=FAR_FUTURE_EPOCH, activation_epoch=FAR_FUTURE_EPOCH, exit_epoch=FAR_FUTURE_EPOCH, withdrawable_epoch=FAR_FUTURE_EPOCH, ).
HasValidatorFlag returns true if the flag at position has set.
InitializePrecomputeValidators precomputes individual validator for its attested balances and the total sum of validators attested balances of the epoch.
IsSyncCommitteeAggregator checks whether the provided signature is for a valid aggregator.
MatchingStatus returns the matching statues for attestation data's source target and head.
NextSyncCommittee returns the next sync committee for a given state.
NextSyncCommitteeIndices returns the next sync committee indices for a given state.
ProcessAttestationNoVerifySignature processes the attestation without verifying the attestation signature.
ProcessAttestationsNoVerifySignature applies processing operations to a block's inner attestation records.
ProcessDeposit takes in a deposit object and inserts it into the registry as a new validator or balance change.
ProcessDeposits processes validator deposits for beacon state Altair.
ProcessEpoch describes the per epoch operations that are performed on the beacon state.
ProcessEpochParticipation processes the epoch participation in state and updates individual validator's pre computes, it also tracks and updates epoch attesting balances.
ProcessInactivityScores of beacon chain.
ProcessParticipationFlagUpdates processes participation flag updates by rotating current to previous.
ProcessPreGenesisDeposits processes a deposit for the beacon state before chainstart.
ProcessRewardsAndPenaltiesPrecompute processes the rewards and penalties of individual validator.
ProcessSyncAggregate verifies sync committee aggregate signature signing over the previous slot block root.
ProcessSyncCommitteeUpdates processes sync client committee updates for the beacon state.
RewardProposer rewards proposer by increasing proposer's balance with input reward numerator and calculated reward denominator.
SetParticipationAndRewardProposer retrieves and sets the epoch participation bits in state.
SyncRewards returns the proposer reward and the sync participant reward given the total active balance in state.
SyncSubCommitteePubkeys returns the pubkeys participating in a sync subcommittee.
TranslateParticipation translates pending attestations into participation bits, then inserts the bits into beacon state.
UpgradeToAltair updates input state to return the version Altair state.
ValidateNilSyncContribution validates the following fields are not nil: -the contribution and proof itself -the message within contribution and proof -the contribution within contribution and proof -the aggregation bits within contribution.
ValidateSyncMessageTime validates sync message to ensure that the provided slot is valid.
VerifySyncCommitteeSig verifies sync committee signature `syncSig` is valid with respect to public keys `syncKeys`.

# Variables

# Structs

AttDelta contains rewards and penalties for a single attestation.