Add progress on state_processing fixed-len update

This commit is contained in:
Paul Hauner
2019-05-08 15:36:02 +10:00
parent 7a67d34293
commit 8cefd20e9d
29 changed files with 275 additions and 268 deletions

View File

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