Rename BeaconStateTypes to EthSpec

This commit is contained in:
Paul Hauner
2019-05-10 14:47:09 +10:00
parent 75b310a078
commit ce8ebeccbc
60 changed files with 223 additions and 235 deletions

View File

@@ -9,7 +9,7 @@ use types::*;
/// Returns `Ok(())` if the `Attestation` is valid, otherwise indicates the reason for invalidity.
///
/// Spec v0.5.1
pub fn validate_attestation<T: BeaconStateTypes>(
pub fn validate_attestation<T: EthSpec>(
state: &BeaconState<T>,
attestation: &Attestation,
spec: &ChainSpec,
@@ -18,7 +18,7 @@ pub fn validate_attestation<T: BeaconStateTypes>(
}
/// Like `validate_attestation` but doesn't run checks which may become true in future states.
pub fn validate_attestation_time_independent_only<T: BeaconStateTypes>(
pub fn validate_attestation_time_independent_only<T: EthSpec>(
state: &BeaconState<T>,
attestation: &Attestation,
spec: &ChainSpec,
@@ -32,7 +32,7 @@ pub fn validate_attestation_time_independent_only<T: BeaconStateTypes>(
/// Returns `Ok(())` if the `Attestation` is valid, otherwise indicates the reason for invalidity.
///
/// Spec v0.5.1
pub fn validate_attestation_without_signature<T: BeaconStateTypes>(
pub fn validate_attestation_without_signature<T: EthSpec>(
state: &BeaconState<T>,
attestation: &Attestation,
spec: &ChainSpec,
@@ -45,7 +45,7 @@ pub fn validate_attestation_without_signature<T: BeaconStateTypes>(
///
///
/// Spec v0.5.1
fn validate_attestation_parametric<T: BeaconStateTypes>(
fn validate_attestation_parametric<T: EthSpec>(
state: &BeaconState<T>,
attestation: &Attestation,
spec: &ChainSpec,
@@ -168,7 +168,7 @@ fn validate_attestation_parametric<T: BeaconStateTypes>(
/// match the current (or previous) justified epoch and root from the state.
///
/// Spec v0.5.1
fn verify_justified_epoch_and_root<T: BeaconStateTypes>(
fn verify_justified_epoch_and_root<T: EthSpec>(
attestation: &Attestation,
state: &BeaconState<T>,
spec: &ChainSpec,
@@ -223,7 +223,7 @@ fn verify_justified_epoch_and_root<T: BeaconStateTypes>(
/// - A `validator_index` in `committee` is not in `state.validator_registry`.
///
/// Spec v0.5.1
fn verify_attestation_signature<T: BeaconStateTypes>(
fn verify_attestation_signature<T: EthSpec>(
state: &BeaconState<T>,
committee: &[usize],
a: &Attestation,

View File

@@ -8,7 +8,7 @@ use types::*;
/// Returns `Ok(())` if the `AttesterSlashing` is valid, otherwise indicates the reason for invalidity.
///
/// Spec v0.5.1
pub fn verify_attester_slashing<T: BeaconStateTypes>(
pub fn verify_attester_slashing<T: EthSpec>(
state: &BeaconState<T>,
attester_slashing: &AttesterSlashing,
should_verify_slashable_attestations: bool,
@@ -42,7 +42,7 @@ pub fn verify_attester_slashing<T: BeaconStateTypes>(
/// Returns Ok(indices) if `indices.len() > 0`.
///
/// Spec v0.5.1
pub fn gather_attester_slashing_indices<T: BeaconStateTypes>(
pub fn gather_attester_slashing_indices<T: EthSpec>(
state: &BeaconState<T>,
attester_slashing: &AttesterSlashing,
spec: &ChainSpec,
@@ -57,7 +57,7 @@ pub fn gather_attester_slashing_indices<T: BeaconStateTypes>(
/// Same as `gather_attester_slashing_indices` but allows the caller to specify the criteria
/// for determining whether a given validator should be considered slashed.
pub fn gather_attester_slashing_indices_modular<F, T: BeaconStateTypes>(
pub fn gather_attester_slashing_indices_modular<F, T: EthSpec>(
state: &BeaconState<T>,
attester_slashing: &AttesterSlashing,
is_slashed: F,

View File

@@ -16,7 +16,7 @@ use types::*;
/// Note: this function is incomplete.
///
/// Spec v0.5.1
pub fn verify_deposit<T: BeaconStateTypes>(
pub fn verify_deposit<T: EthSpec>(
state: &BeaconState<T>,
deposit: &Deposit,
verify_merkle_branch: bool,
@@ -47,7 +47,7 @@ pub fn verify_deposit<T: BeaconStateTypes>(
/// Verify that the `Deposit` index is correct.
///
/// Spec v0.5.1
pub fn verify_deposit_index<T: BeaconStateTypes>(
pub fn verify_deposit_index<T: EthSpec>(
state: &BeaconState<T>,
deposit: &Deposit,
) -> Result<(), Error> {
@@ -68,7 +68,7 @@ pub fn verify_deposit_index<T: BeaconStateTypes>(
/// ## Errors
///
/// Errors if the state's `pubkey_cache` is not current.
pub fn get_existing_validator_index<T: BeaconStateTypes>(
pub fn get_existing_validator_index<T: EthSpec>(
state: &BeaconState<T>,
deposit: &Deposit,
) -> Result<Option<u64>, Error> {
@@ -92,7 +92,7 @@ pub fn get_existing_validator_index<T: BeaconStateTypes>(
/// Verify that a deposit is included in the state's eth1 deposit root.
///
/// Spec v0.5.1
fn verify_deposit_merkle_proof<T: BeaconStateTypes>(
fn verify_deposit_merkle_proof<T: EthSpec>(
state: &BeaconState<T>,
deposit: &Deposit,
spec: &ChainSpec,

View File

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

View File

@@ -8,7 +8,7 @@ use types::*;
/// Returns `Ok(())` if the `ProposerSlashing` is valid, otherwise indicates the reason for invalidity.
///
/// Spec v0.5.1
pub fn verify_proposer_slashing<T: BeaconStateTypes>(
pub fn verify_proposer_slashing<T: EthSpec>(
proposer_slashing: &ProposerSlashing,
state: &BeaconState<T>,
spec: &ChainSpec,

View File

@@ -11,7 +11,7 @@ use types::*;
/// Returns `Ok(())` if the `SlashableAttestation` is valid, otherwise indicates the reason for invalidity.
///
/// Spec v0.5.1
pub fn verify_slashable_attestation<T: BeaconStateTypes>(
pub fn verify_slashable_attestation<T: EthSpec>(
state: &BeaconState<T>,
slashable_attestation: &SlashableAttestation,
spec: &ChainSpec,

View File

@@ -11,7 +11,7 @@ use types::*;
/// Note: this function is incomplete.
///
/// Spec v0.5.1
pub fn verify_transfer<T: BeaconStateTypes>(
pub fn verify_transfer<T: EthSpec>(
state: &BeaconState<T>,
transfer: &Transfer,
spec: &ChainSpec,
@@ -20,7 +20,7 @@ pub fn verify_transfer<T: BeaconStateTypes>(
}
/// Like `verify_transfer` but doesn't run checks which may become true in future states.
pub fn verify_transfer_time_independent_only<T: BeaconStateTypes>(
pub fn verify_transfer_time_independent_only<T: EthSpec>(
state: &BeaconState<T>,
transfer: &Transfer,
spec: &ChainSpec,
@@ -29,7 +29,7 @@ pub fn verify_transfer_time_independent_only<T: BeaconStateTypes>(
}
/// Parametric version of `verify_transfer` that allows some checks to be skipped.
fn verify_transfer_parametric<T: BeaconStateTypes>(
fn verify_transfer_parametric<T: EthSpec>(
state: &BeaconState<T>,
transfer: &Transfer,
spec: &ChainSpec,
@@ -123,7 +123,7 @@ fn verify_transfer_parametric<T: BeaconStateTypes>(
/// Does not check that the transfer is valid, however checks for overflow in all actions.
///
/// Spec v0.5.1
pub fn execute_transfer<T: BeaconStateTypes>(
pub fn execute_transfer<T: EthSpec>(
state: &mut BeaconState<T>,
transfer: &Transfer,
spec: &ChainSpec,