spec: update tags to v0.5.1

This commit is contained in:
Michael Sproul
2019-04-15 10:51:20 +10:00
parent 2914d77cd3
commit d95ae95ce8
48 changed files with 148 additions and 148 deletions

View File

@@ -32,7 +32,7 @@ impl std::ops::AddAssign for Delta {
/// Apply attester and proposer rewards.
///
/// Spec v0.5.0
/// Spec v0.5.1
pub fn apply_rewards(
state: &mut BeaconState,
validator_statuses: &mut ValidatorStatuses,
@@ -79,7 +79,7 @@ pub fn apply_rewards(
/// Applies the attestation inclusion reward to each proposer for every validator who included an
/// attestation in the previous epoch.
///
/// Spec v0.5.0
/// Spec v0.5.1
fn get_proposer_deltas(
deltas: &mut Vec<Delta>,
state: &mut BeaconState,
@@ -120,7 +120,7 @@ fn get_proposer_deltas(
/// Apply rewards for participation in attestations during the previous epoch.
///
/// Spec v0.5.0
/// Spec v0.5.1
fn get_justification_and_finalization_deltas(
deltas: &mut Vec<Delta>,
state: &BeaconState,
@@ -163,7 +163,7 @@ fn get_justification_and_finalization_deltas(
/// Determine the delta for a single validator, if the chain is finalizing normally.
///
/// Spec v0.5.0
/// Spec v0.5.1
fn compute_normal_justification_and_finalization_delta(
validator: &ValidatorStatus,
total_balances: &TotalBalances,
@@ -215,7 +215,7 @@ fn compute_normal_justification_and_finalization_delta(
/// Determine the delta for a single delta, assuming the chain is _not_ finalizing normally.
///
/// Spec v0.5.0
/// Spec v0.5.1
fn compute_inactivity_leak_delta(
validator: &ValidatorStatus,
base_reward: u64,
@@ -261,7 +261,7 @@ fn compute_inactivity_leak_delta(
/// Calculate the deltas based upon the winning roots for attestations during the previous epoch.
///
/// Spec v0.5.0
/// Spec v0.5.1
fn get_crosslink_deltas(
deltas: &mut Vec<Delta>,
state: &BeaconState,
@@ -295,7 +295,7 @@ fn get_crosslink_deltas(
/// Returns the base reward for some validator.
///
/// Spec v0.5.0
/// Spec v0.5.1
fn get_base_reward(
state: &BeaconState,
index: usize,
@@ -312,7 +312,7 @@ fn get_base_reward(
/// Returns the inactivity penalty for some validator.
///
/// Spec v0.5.0
/// Spec v0.5.1
fn get_inactivity_penalty(
state: &BeaconState,
index: usize,
@@ -328,7 +328,7 @@ fn get_inactivity_penalty(
/// Returns the epochs since the last finalized epoch.
///
/// Spec v0.5.0
/// Spec v0.5.1
fn epochs_since_finality(state: &BeaconState, spec: &ChainSpec) -> Epoch {
state.current_epoch(spec) + 1 - state.finalized_epoch
}

View File

@@ -3,7 +3,7 @@ use types::*;
/// Returns validator indices which participated in the attestation.
///
/// Spec v0.5.0
/// Spec v0.5.1
pub fn get_attestation_participants(
state: &BeaconState,
attestation_data: &AttestationData,

View File

@@ -5,7 +5,7 @@ use types::*;
/// Returns the distance between the first included attestation for some validator and this
/// slot.
///
/// Spec v0.5.0
/// Spec v0.5.1
pub fn inclusion_distance(
state: &BeaconState,
attestations: &[&PendingAttestation],
@@ -18,7 +18,7 @@ pub fn inclusion_distance(
/// Returns the slot of the earliest included attestation for some validator.
///
/// Spec v0.5.0
/// Spec v0.5.1
pub fn inclusion_slot(
state: &BeaconState,
attestations: &[&PendingAttestation],
@@ -31,7 +31,7 @@ pub fn inclusion_slot(
/// Finds the earliest included attestation for some validator.
///
/// Spec v0.5.0
/// Spec v0.5.1
fn earliest_included_attestation(
state: &BeaconState,
attestations: &[&PendingAttestation],

View File

@@ -4,7 +4,7 @@ use types::{BeaconStateError as Error, *};
/// Iterate through the validator registry and eject active validators with balance below
/// ``EJECTION_BALANCE``.
///
/// Spec v0.5.0
/// Spec v0.5.1
pub fn process_ejections(state: &mut BeaconState, spec: &ChainSpec) -> Result<(), Error> {
// There is an awkward double (triple?) loop here because we can't loop across the borrowed
// active validator indices and mutate state in the one loop.

View File

@@ -2,7 +2,7 @@ use types::*;
/// Process the exit queue.
///
/// Spec v0.5.0
/// Spec v0.5.1
pub fn process_exit_queue(state: &mut BeaconState, spec: &ChainSpec) {
let current_epoch = state.current_epoch(spec);
@@ -31,7 +31,7 @@ pub fn process_exit_queue(state: &mut BeaconState, spec: &ChainSpec) {
/// Initiate an exit for the validator of the given `index`.
///
/// Spec v0.5.0
/// Spec v0.5.1
fn prepare_validator_for_withdrawal(
state: &mut BeaconState,
validator_index: usize,

View File

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

View File

@@ -4,7 +4,7 @@ use types::*;
/// Peforms a validator registry update, if required.
///
/// Spec v0.5.0
/// Spec v0.5.1
pub fn update_registry_and_shuffling_data(
state: &mut BeaconState,
current_total_balance: u64,
@@ -49,7 +49,7 @@ pub fn update_registry_and_shuffling_data(
/// Returns `true` if the validator registry should be updated during an epoch processing.
///
/// Spec v0.5.0
/// Spec v0.5.1
pub fn should_update_validator_registry(
state: &BeaconState,
spec: &ChainSpec,
@@ -78,7 +78,7 @@ pub fn should_update_validator_registry(
///
/// Note: Utilizes the cache and will fail if the appropriate cache is not initialized.
///
/// Spec v0.5.0
/// Spec v0.5.1
pub fn update_validator_registry(
state: &mut BeaconState,
current_total_balance: u64,
@@ -133,7 +133,7 @@ pub fn update_validator_registry(
/// Activate the validator of the given ``index``.
///
/// Spec v0.5.0
/// Spec v0.5.1
pub fn activate_validator(
state: &mut BeaconState,
validator_index: usize,

View File

@@ -160,7 +160,7 @@ impl ValidatorStatuses {
/// - Active validators
/// - Total balances for the current and previous epochs.
///
/// Spec v0.5.0
/// Spec v0.5.1
pub fn new(state: &BeaconState, spec: &ChainSpec) -> Result<Self, BeaconStateError> {
let mut statuses = Vec::with_capacity(state.validator_registry.len());
let mut total_balances = TotalBalances::default();
@@ -195,7 +195,7 @@ impl ValidatorStatuses {
/// Process some attestations from the given `state` updating the `statuses` and
/// `total_balances` fields.
///
/// Spec v0.5.0
/// Spec v0.5.1
pub fn process_attestations(
&mut self,
state: &BeaconState,
@@ -261,7 +261,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.5.0
/// Spec v0.5.1
pub fn process_winning_roots(
&mut self,
state: &BeaconState,
@@ -297,14 +297,14 @@ impl ValidatorStatuses {
/// Returns the distance between when the attestation was created and when it was included in a
/// block.
///
/// Spec v0.5.0
/// Spec v0.5.1
fn inclusion_distance(a: &PendingAttestation) -> Slot {
a.inclusion_slot - a.data.slot
}
/// Returns `true` if some `PendingAttestation` is from the supplied `epoch`.
///
/// Spec v0.5.0
/// Spec v0.5.1
fn is_from_epoch(a: &PendingAttestation, epoch: Epoch, spec: &ChainSpec) -> bool {
a.data.slot.epoch(spec.slots_per_epoch) == epoch
}
@@ -312,7 +312,7 @@ fn is_from_epoch(a: &PendingAttestation, epoch: Epoch, spec: &ChainSpec) -> bool
/// Returns `true` if a `PendingAttestation` and `BeaconState` share the same beacon block hash for
/// the first slot of the given epoch.
///
/// Spec v0.5.0
/// Spec v0.5.1
fn has_common_epoch_boundary_root(
a: &PendingAttestation,
state: &BeaconState,
@@ -328,7 +328,7 @@ fn has_common_epoch_boundary_root(
/// Returns `true` if a `PendingAttestation` and `BeaconState` share the same beacon block hash for
/// the current slot of the `PendingAttestation`.
///
/// Spec v0.5.0
/// Spec v0.5.1
fn has_common_beacon_block_root(
a: &PendingAttestation,
state: &BeaconState,

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.5.0
/// Spec v0.5.1
pub fn is_better_than(&self, other: &Self) -> bool {
if self.total_attesting_balance > other.total_attesting_balance {
true
@@ -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.5.0
/// Spec v0.5.1
pub fn winning_root(
state: &BeaconState,
shard: u64,
@@ -89,7 +89,7 @@ pub fn winning_root(
/// Returns `true` if pending attestation `a` is eligible to become a winning root.
///
/// Spec v0.5.0
/// Spec v0.5.1
fn is_eligible_for_winning_root(state: &BeaconState, a: &PendingAttestation, shard: Shard) -> bool {
if shard >= state.latest_crosslinks.len() as u64 {
return false;
@@ -100,7 +100,7 @@ fn is_eligible_for_winning_root(state: &BeaconState, a: &PendingAttestation, sha
/// Returns all indices which voted for a given crosslink. Does not contain duplicates.
///
/// Spec v0.5.0
/// Spec v0.5.1
fn get_attesting_validator_indices(
state: &BeaconState,
shard: u64,