v0.6: update all spec version comments

This commit is contained in:
Michael Sproul
2019-06-17 16:25:57 +10:00
parent 1823378bfa
commit 03c50354f4
44 changed files with 159 additions and 159 deletions

View File

@@ -3,7 +3,7 @@ use types::*;
/// Returns validator indices which participated in the attestation, sorted by increasing index.
///
/// Spec v0.6.1
/// Spec v0.6.3
pub fn get_attesting_indices<T: EthSpec>(
state: &BeaconState<T>,
attestation_data: &AttestationData,
@@ -18,7 +18,7 @@ pub fn get_attesting_indices<T: EthSpec>(
/// Returns validator indices which participated in the attestation, unsorted.
///
/// Spec v0.6.1
/// Spec v0.6.3
pub fn get_attesting_indices_unsorted<T: EthSpec>(
state: &BeaconState<T>,
attestation_data: &AttestationData,

View File

@@ -3,7 +3,7 @@ use types::{BeaconStateError as Error, *};
/// Initiate the exit of the validator of the given `index`.
///
/// Spec v0.6.1
/// Spec v0.6.3
pub fn initiate_validator_exit<T: EthSpec>(
state: &mut BeaconState<T>,
index: usize,

View File

@@ -3,7 +3,7 @@ use types::{BeaconStateError as Error, *};
/// Slash the validator with index ``index``.
///
/// Spec v0.6.1
/// Spec v0.6.3
pub fn slash_validator<T: EthSpec>(
state: &mut BeaconState<T>,
slashed_index: usize,

View File

@@ -4,7 +4,7 @@ use types::*;
///
/// Is title `verify_bitfield` in spec.
///
/// Spec v0.6.1
/// Spec v0.6.3
pub fn verify_bitfield_length(bitfield: &Bitfield, committee_size: usize) -> bool {
if bitfield.num_bytes() != ((committee_size + 7) / 8) {
return false;

View File

@@ -9,7 +9,7 @@ pub enum GenesisError {
/// Returns the genesis `BeaconState`
///
/// Spec v0.6.1
/// Spec v0.6.3
pub fn get_genesis_beacon_state<T: EthSpec>(
genesis_validator_deposits: &[Deposit],
genesis_time: u64,

View File

@@ -40,7 +40,7 @@ mod verify_transfer;
/// Returns `Ok(())` if the block is valid and the state was successfully updated. Otherwise
/// returns an error describing why the block was invalid or how the function failed to execute.
///
/// Spec v0.6.1
/// Spec v0.6.3
pub fn per_block_processing<T: EthSpec>(
state: &mut BeaconState<T>,
block: &BeaconBlock,
@@ -55,7 +55,7 @@ pub fn per_block_processing<T: EthSpec>(
/// Returns `Ok(())` if the block is valid and the state was successfully updated. Otherwise
/// returns an error describing why the block was invalid or how the function failed to execute.
///
/// Spec v0.6.1
/// Spec v0.6.3
pub fn per_block_processing_without_verifying_block_signature<T: EthSpec>(
state: &mut BeaconState<T>,
block: &BeaconBlock,
@@ -70,7 +70,7 @@ pub fn per_block_processing_without_verifying_block_signature<T: EthSpec>(
/// Returns `Ok(())` if the block is valid and the state was successfully updated. Otherwise
/// returns an error describing why the block was invalid or how the function failed to execute.
///
/// Spec v0.6.1
/// Spec v0.6.3
fn per_block_processing_signature_optional<T: EthSpec>(
mut state: &mut BeaconState<T>,
block: &BeaconBlock,
@@ -97,7 +97,7 @@ fn per_block_processing_signature_optional<T: EthSpec>(
/// Processes the block header.
///
/// Spec v0.6.1
/// Spec v0.6.3
pub fn process_block_header<T: EthSpec>(
state: &mut BeaconState<T>,
block: &BeaconBlock,
@@ -132,7 +132,7 @@ pub fn process_block_header<T: EthSpec>(
/// Verifies the signature of a block.
///
/// Spec v0.6.1
/// Spec v0.6.3
pub fn verify_block_signature<T: EthSpec>(
state: &BeaconState<T>,
block: &BeaconBlock,
@@ -160,7 +160,7 @@ pub fn verify_block_signature<T: EthSpec>(
/// Verifies the `randao_reveal` against the block's proposer pubkey and updates
/// `state.latest_randao_mixes`.
///
/// Spec v0.6.1
/// Spec v0.6.3
pub fn process_randao<T: EthSpec>(
state: &mut BeaconState<T>,
block: &BeaconBlock,
@@ -191,7 +191,7 @@ pub fn process_randao<T: EthSpec>(
/// Update the `state.eth1_data_votes` based upon the `eth1_data` provided.
///
/// Spec v0.6.1
/// Spec v0.6.3
pub fn process_eth1_data<T: EthSpec>(
state: &mut BeaconState<T>,
eth1_data: &Eth1Data,
@@ -217,7 +217,7 @@ pub fn process_eth1_data<T: EthSpec>(
/// Returns `Ok(())` if the validation and state updates completed successfully, otherwise returns
/// an `Err` describing the invalid object or cause of failure.
///
/// Spec v0.6.1
/// Spec v0.6.3
pub fn process_proposer_slashings<T: EthSpec>(
state: &mut BeaconState<T>,
proposer_slashings: &[ProposerSlashing],
@@ -250,7 +250,7 @@ pub fn process_proposer_slashings<T: EthSpec>(
/// Returns `Ok(())` if the validation and state updates completed successfully, otherwise returns
/// an `Err` describing the invalid object or cause of failure.
///
/// Spec v0.6.1
/// Spec v0.6.3
pub fn process_attester_slashings<T: EthSpec>(
state: &mut BeaconState<T>,
attester_slashings: &[AttesterSlashing],
@@ -308,7 +308,7 @@ pub fn process_attester_slashings<T: EthSpec>(
/// Returns `Ok(())` if the validation and state updates completed successfully, otherwise returns
/// an `Err` describing the invalid object or cause of failure.
///
/// Spec v0.6.1
/// Spec v0.6.3
pub fn process_attestations<T: EthSpec>(
state: &mut BeaconState<T>,
attestations: &[Attestation],
@@ -357,7 +357,7 @@ pub fn process_attestations<T: EthSpec>(
/// Returns `Ok(())` if the validation and state updates completed successfully, otherwise returns
/// an `Err` describing the invalid object or cause of failure.
///
/// Spec v0.6.1
/// Spec v0.6.3
pub fn process_deposits<T: EthSpec>(
state: &mut BeaconState<T>,
deposits: &[Deposit],
@@ -434,7 +434,7 @@ pub fn process_deposits<T: EthSpec>(
/// Returns `Ok(())` if the validation and state updates completed successfully, otherwise returns
/// an `Err` describing the invalid object or cause of failure.
///
/// Spec v0.6.1
/// Spec v0.6.3
pub fn process_exits<T: EthSpec>(
state: &mut BeaconState<T>,
voluntary_exits: &[VoluntaryExit],
@@ -466,7 +466,7 @@ pub fn process_exits<T: EthSpec>(
/// Returns `Ok(())` if the validation and state updates completed successfully, otherwise returns
/// an `Err` describing the invalid object or cause of failure.
///
/// Spec v0.6.1
/// Spec v0.6.3
pub fn process_transfers<T: EthSpec>(
state: &mut BeaconState<T>,
transfers: &[Transfer],

View File

@@ -11,7 +11,7 @@ use types::*;
///
/// Returns `Ok(())` if the `Attestation` is valid, otherwise indicates the reason for invalidity.
///
/// Spec v0.6.1
/// Spec v0.6.3
pub fn validate_attestation<T: EthSpec>(
state: &BeaconState<T>,
attestation: &Attestation,
@@ -34,7 +34,7 @@ pub fn validate_attestation_time_independent_only<T: EthSpec>(
///
/// Returns `Ok(())` if the `Attestation` is valid, otherwise indicates the reason for invalidity.
///
/// Spec v0.6.1
/// Spec v0.6.3
pub fn validate_attestation_without_signature<T: EthSpec>(
state: &BeaconState<T>,
attestation: &Attestation,
@@ -47,7 +47,7 @@ pub fn validate_attestation_without_signature<T: EthSpec>(
/// given state, optionally validating the aggregate signature.
///
///
/// Spec v0.6.1
/// Spec v0.6.3
fn validate_attestation_parametric<T: EthSpec>(
state: &BeaconState<T>,
attestation: &Attestation,
@@ -99,7 +99,7 @@ fn validate_attestation_parametric<T: EthSpec>(
/// Check target epoch, source epoch, source root, and source crosslink.
///
/// Spec v0.6.1
/// Spec v0.6.3
fn verify_casper_ffg_vote<T: EthSpec>(
attestation: &Attestation,
state: &BeaconState<T>,

View File

@@ -8,7 +8,7 @@ use types::*;
///
/// Returns `Ok(())` if the `AttesterSlashing` is valid, otherwise indicates the reason for invalidity.
///
/// Spec v0.6.1
/// Spec v0.6.3
pub fn verify_attester_slashing<T: EthSpec>(
state: &BeaconState<T>,
attester_slashing: &AttesterSlashing,
@@ -39,7 +39,7 @@ pub fn verify_attester_slashing<T: EthSpec>(
///
/// Returns Ok(indices) if `indices.len() > 0`.
///
/// Spec v0.6.1
/// Spec v0.6.3
pub fn get_slashable_indices<T: EthSpec>(
state: &BeaconState<T>,
attester_slashing: &AttesterSlashing,

View File

@@ -5,7 +5,7 @@ use types::*;
/// Verify `Deposit.pubkey` signed `Deposit.signature`.
///
/// Spec v0.6.1
/// Spec v0.6.3
pub fn verify_deposit_signature<T: EthSpec>(
state: &BeaconState<T>,
deposit: &Deposit,
@@ -25,7 +25,7 @@ pub fn verify_deposit_signature<T: EthSpec>(
/// Verify that the `Deposit` index is correct.
///
/// Spec v0.6.1
/// Spec v0.6.3
pub fn verify_deposit_index<T: EthSpec>(
state: &BeaconState<T>,
deposit: &Deposit,
@@ -57,7 +57,7 @@ pub fn get_existing_validator_index<T: EthSpec>(
/// Verify that a deposit is included in the state's eth1 deposit root.
///
/// Spec v0.6.1
/// Spec v0.6.3
pub fn verify_deposit_merkle_proof<T: EthSpec>(
state: &BeaconState<T>,
deposit: &Deposit,

View File

@@ -7,7 +7,7 @@ use types::*;
///
/// Returns `Ok(())` if the `Exit` is valid, otherwise indicates the reason for invalidity.
///
/// Spec v0.6.1
/// Spec v0.6.3
pub fn verify_exit<T: EthSpec>(
state: &BeaconState<T>,
exit: &VoluntaryExit,
@@ -18,7 +18,7 @@ pub fn verify_exit<T: EthSpec>(
/// Like `verify_exit` but doesn't run checks which may become true in future states.
///
/// Spec v0.6.1
/// Spec v0.6.3
pub fn verify_exit_time_independent_only<T: EthSpec>(
state: &BeaconState<T>,
exit: &VoluntaryExit,
@@ -29,7 +29,7 @@ pub fn verify_exit_time_independent_only<T: EthSpec>(
/// Parametric version of `verify_exit` that skips some checks if `time_independent_only` is true.
///
/// Spec v0.6.1
/// Spec v0.6.3
fn verify_exit_parametric<T: EthSpec>(
state: &BeaconState<T>,
exit: &VoluntaryExit,

View File

@@ -8,7 +8,7 @@ use types::*;
/// Verify an `IndexedAttestation`.
///
/// Spec v0.6.1
/// Spec v0.6.3
pub fn verify_indexed_attestation<T: EthSpec>(
state: &BeaconState<T>,
indexed_attestation: &IndexedAttestation,
@@ -19,7 +19,7 @@ pub fn verify_indexed_attestation<T: EthSpec>(
/// Verify but don't check the signature.
///
/// Spec v0.6.1
/// Spec v0.6.3
pub fn verify_indexed_attestation_without_signature<T: EthSpec>(
state: &BeaconState<T>,
indexed_attestation: &IndexedAttestation,
@@ -30,7 +30,7 @@ pub fn verify_indexed_attestation_without_signature<T: EthSpec>(
/// Optionally check the signature.
///
/// Spec v0.6.1
/// Spec v0.6.3
fn verify_indexed_attestation_parametric<T: EthSpec>(
state: &BeaconState<T>,
indexed_attestation: &IndexedAttestation,
@@ -107,7 +107,7 @@ where
/// Verify the signature of an IndexedAttestation.
///
/// Spec v0.6.1
/// Spec v0.6.3
fn verify_indexed_attestation_signature<T: EthSpec>(
state: &BeaconState<T>,
indexed_attestation: &IndexedAttestation,

View File

@@ -7,7 +7,7 @@ use types::*;
///
/// Returns `Ok(())` if the `ProposerSlashing` is valid, otherwise indicates the reason for invalidity.
///
/// Spec v0.6.1
/// Spec v0.6.3
pub fn verify_proposer_slashing<T: EthSpec>(
proposer_slashing: &ProposerSlashing,
state: &BeaconState<T>,
@@ -65,7 +65,7 @@ pub fn verify_proposer_slashing<T: EthSpec>(
///
/// Returns `true` if the signature is valid.
///
/// Spec v0.6.1
/// Spec v0.6.3
fn verify_header_signature<T: EthSpec>(
header: &BeaconBlockHeader,
pubkey: &PublicKey,

View File

@@ -8,7 +8,7 @@ use types::*;
///
/// Returns `Ok(())` if the `Transfer` is valid, otherwise indicates the reason for invalidity.
///
/// Spec v0.6.1
/// Spec v0.6.3
pub fn verify_transfer<T: EthSpec>(
state: &BeaconState<T>,
transfer: &Transfer,
@@ -19,7 +19,7 @@ pub fn verify_transfer<T: EthSpec>(
/// Like `verify_transfer` but doesn't run checks which may become true in future states.
///
/// Spec v0.6.1
/// Spec v0.6.3
pub fn verify_transfer_time_independent_only<T: EthSpec>(
state: &BeaconState<T>,
transfer: &Transfer,
@@ -37,7 +37,7 @@ pub fn verify_transfer_time_independent_only<T: EthSpec>(
/// present or future.
/// - Validator transfer eligibility (e.g., is withdrawable)
///
/// Spec v0.6.1
/// Spec v0.6.3
fn verify_transfer_parametric<T: EthSpec>(
state: &BeaconState<T>,
transfer: &Transfer,
@@ -154,7 +154,7 @@ fn verify_transfer_parametric<T: EthSpec>(
///
/// Does not check that the transfer is valid, however checks for overflow in all actions.
///
/// Spec v0.6.1
/// Spec v0.6.3
pub fn execute_transfer<T: EthSpec>(
state: &mut BeaconState<T>,
transfer: &Transfer,

View File

@@ -26,7 +26,7 @@ pub type WinningRootHashSet = HashMap<u64, WinningRoot>;
/// Mutates the given `BeaconState`, returning early if an error is encountered. If an error is
/// returned, a state might be "half-processed" and therefore in an invalid state.
///
/// Spec v0.6.1
/// Spec v0.6.3
pub fn per_epoch_processing<T: EthSpec>(
state: &mut BeaconState<T>,
spec: &ChainSpec,
@@ -80,7 +80,7 @@ pub fn per_epoch_processing<T: EthSpec>(
/// - `finalized_epoch`
/// - `finalized_root`
///
/// Spec v0.6.1
/// Spec v0.6.3
pub fn process_justification_and_finalization<T: EthSpec>(
state: &mut BeaconState<T>,
total_balances: &TotalBalances,
@@ -147,7 +147,7 @@ pub fn process_justification_and_finalization<T: EthSpec>(
///
/// Also returns a `WinningRootHashSet` for later use during epoch processing.
///
/// Spec v0.6.1
/// Spec v0.6.3
pub fn process_crosslinks<T: EthSpec>(
state: &mut BeaconState<T>,
spec: &ChainSpec,
@@ -183,7 +183,7 @@ pub fn process_crosslinks<T: EthSpec>(
/// Finish up an epoch update.
///
/// Spec v0.6.1
/// Spec v0.6.3
pub fn process_final_updates<T: EthSpec>(
state: &mut BeaconState<T>,
spec: &ChainSpec,

View File

@@ -32,7 +32,7 @@ impl std::ops::AddAssign for Delta {
/// Apply attester and proposer rewards.
///
/// Spec v0.6.1
/// Spec v0.6.3
pub fn process_rewards_and_penalties<T: EthSpec>(
state: &mut BeaconState<T>,
validator_statuses: &mut ValidatorStatuses,
@@ -74,7 +74,7 @@ pub fn process_rewards_and_penalties<T: EthSpec>(
/// For each attesting validator, reward the proposer who was first to include their attestation.
///
/// Spec v0.6.1
/// Spec v0.6.3
fn get_proposer_deltas<T: EthSpec>(
deltas: &mut Vec<Delta>,
state: &BeaconState<T>,
@@ -111,7 +111,7 @@ fn get_proposer_deltas<T: EthSpec>(
/// Apply rewards for participation in attestations during the previous epoch.
///
/// Spec v0.6.1
/// Spec v0.6.3
fn get_attestation_deltas<T: EthSpec>(
deltas: &mut Vec<Delta>,
state: &BeaconState<T>,
@@ -144,7 +144,7 @@ fn get_attestation_deltas<T: EthSpec>(
/// Determine the delta for a single validator, sans proposer rewards.
///
/// Spec v0.6.1
/// Spec v0.6.3
fn get_attestation_delta(
validator: &ValidatorStatus,
total_balances: &TotalBalances,
@@ -224,7 +224,7 @@ fn get_attestation_delta(
/// Calculate the deltas based upon the winning roots for attestations during the previous epoch.
///
/// Spec v0.6.1
/// Spec v0.6.3
fn get_crosslink_deltas<T: EthSpec>(
deltas: &mut Vec<Delta>,
state: &BeaconState<T>,
@@ -258,7 +258,7 @@ fn get_crosslink_deltas<T: EthSpec>(
/// Returns the base reward for some validator.
///
/// Spec v0.6.1
/// Spec v0.6.3
fn get_base_reward<T: EthSpec>(
state: &BeaconState<T>,
index: usize,

View File

@@ -2,7 +2,7 @@ use types::{BeaconStateError as Error, *};
/// Process slashings.
///
/// Spec v0.6.1
/// Spec v0.6.3
pub fn process_slashings<T: EthSpec>(
state: &mut BeaconState<T>,
current_total_balance: u64,

View File

@@ -5,7 +5,7 @@ use types::*;
/// Peforms a validator registry update, if required.
///
/// Spec v0.6.1
/// Spec v0.6.3
pub fn process_registry_updates<T: EthSpec>(
state: &mut BeaconState<T>,
spec: &ChainSpec,

View File

@@ -162,7 +162,7 @@ impl ValidatorStatuses {
/// - Active validators
/// - Total balances for the current and previous epochs.
///
/// Spec v0.6.1
/// Spec v0.6.3
pub fn new<T: EthSpec>(
state: &BeaconState<T>,
spec: &ChainSpec,
@@ -202,7 +202,7 @@ impl ValidatorStatuses {
/// Process some attestations from the given `state` updating the `statuses` and
/// `total_balances` fields.
///
/// Spec v0.6.1
/// Spec v0.6.3
pub fn process_attestations<T: EthSpec>(
&mut self,
state: &BeaconState<T>,
@@ -289,7 +289,7 @@ impl ValidatorStatuses {
/// Update the `statuses` for each validator based upon whether or not they attested to the
/// "winning" shard block root for the previous epoch.
///
/// Spec v0.6.1
/// Spec v0.6.3
pub fn process_winning_roots<T: EthSpec>(
&mut self,
state: &BeaconState<T>,
@@ -323,7 +323,7 @@ impl ValidatorStatuses {
/// Returns `true` if some `PendingAttestation` is from the supplied `epoch`.
///
/// Spec v0.6.1
/// Spec v0.6.3
fn is_from_epoch(a: &PendingAttestation, epoch: Epoch) -> bool {
a.data.target_epoch == epoch
}
@@ -331,7 +331,7 @@ fn is_from_epoch(a: &PendingAttestation, epoch: Epoch) -> bool {
/// Returns `true` if the attestation's FFG target is equal to the hash of the `state`'s first
/// beacon block in the given `epoch`.
///
/// Spec v0.6.1
/// Spec v0.6.3
fn target_matches_epoch_start_block<T: EthSpec>(
a: &PendingAttestation,
state: &BeaconState<T>,
@@ -346,7 +346,7 @@ fn target_matches_epoch_start_block<T: EthSpec>(
/// Returns `true` if a `PendingAttestation` and `BeaconState` share the same beacon block hash for
/// the current slot of the `PendingAttestation`.
///
/// Spec v0.6.1
/// Spec v0.6.3
fn has_common_beacon_block_root<T: EthSpec>(
a: &PendingAttestation,
state: &BeaconState<T>,

View File

@@ -16,7 +16,7 @@ impl WinningRoot {
/// A winning root is "better" than another if it has a higher `total_attesting_balance`. Ties
/// are broken by favouring the higher `crosslink_data_root` value.
///
/// Spec v0.6.1
/// Spec v0.6.3
pub fn is_better_than(&self, other: &Self) -> bool {
(
self.total_attesting_balance,
@@ -34,7 +34,7 @@ impl WinningRoot {
/// The `WinningRoot` object also contains additional fields that are useful in later stages of
/// per-epoch processing.
///
/// Spec v0.6.1
/// Spec v0.6.3
pub fn winning_root<T: EthSpec>(
state: &BeaconState<T>,
shard: u64,

View File

@@ -9,7 +9,7 @@ pub enum Error {
/// Advances a state forward by one slot, performing per-epoch processing if required.
///
/// Spec v0.6.1
/// Spec v0.6.3
pub fn per_slot_processing<T: EthSpec>(
state: &mut BeaconState<T>,
spec: &ChainSpec,