From 6ea538938bd35176274dd1e6282c8fdceb2d6bb9 Mon Sep 17 00:00:00 2001 From: Paul Hauner Date: Wed, 8 May 2019 16:35:22 +1000 Subject: [PATCH] Fix `state_processing` under new `BeaconStateTypes` --- eth2/state_processing/src/per_epoch_processing/tests.rs | 5 +++-- .../src/per_epoch_processing/validator_statuses.rs | 3 +-- eth2/types/src/beacon_state.rs | 2 +- eth2/types/src/lib.rs | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eth2/state_processing/src/per_epoch_processing/tests.rs b/eth2/state_processing/src/per_epoch_processing/tests.rs index 69450edcd..bbbd7d7c5 100644 --- a/eth2/state_processing/src/per_epoch_processing/tests.rs +++ b/eth2/state_processing/src/per_epoch_processing/tests.rs @@ -8,9 +8,10 @@ use types::*; fn runs_without_error() { Builder::from_env(Env::default().default_filter_or("error")).init(); - let spec = ChainSpec::few_validators(); + let spec = FewValidatorsStateTypes::spec(); - let mut builder = TestingBeaconStateBuilder::from_deterministic_keypairs(8, &spec); + let mut builder: TestingBeaconStateBuilder = + TestingBeaconStateBuilder::from_deterministic_keypairs(8, &spec); let target_slot = (spec.genesis_epoch + 4).end_slot(spec.slots_per_epoch); builder.teleport_to_slot(target_slot, &spec); diff --git a/eth2/state_processing/src/per_epoch_processing/validator_statuses.rs b/eth2/state_processing/src/per_epoch_processing/validator_statuses.rs index b5fba4be1..038737fd9 100644 --- a/eth2/state_processing/src/per_epoch_processing/validator_statuses.rs +++ b/eth2/state_processing/src/per_epoch_processing/validator_statuses.rs @@ -246,7 +246,7 @@ impl ValidatorStatuses { status.is_previous_epoch_boundary_attester = true; } - if has_common_beacon_block_root(a, state, spec)? { + if has_common_beacon_block_root(a, state)? { self.total_balances.previous_epoch_head_attesters += attesting_balance; status.is_previous_epoch_head_attester = true; } @@ -335,7 +335,6 @@ fn has_common_epoch_boundary_root( fn has_common_beacon_block_root( a: &PendingAttestation, state: &BeaconState, - spec: &ChainSpec, ) -> Result { let state_block_root = *state.get_block_root(a.data.slot)?; diff --git a/eth2/types/src/beacon_state.rs b/eth2/types/src/beacon_state.rs index 42022c89f..3dc5358c8 100644 --- a/eth2/types/src/beacon_state.rs +++ b/eth2/types/src/beacon_state.rs @@ -15,7 +15,7 @@ use tree_hash_derive::{CachedTreeHash, TreeHash}; pub use beacon_state_types::*; -pub mod beacon_state_types; +mod beacon_state_types; mod epoch_cache; mod pubkey_cache; mod tests; diff --git a/eth2/types/src/lib.rs b/eth2/types/src/lib.rs index 03682439c..99e64e823 100644 --- a/eth2/types/src/lib.rs +++ b/eth2/types/src/lib.rs @@ -47,7 +47,7 @@ pub use crate::attester_slashing::AttesterSlashing; pub use crate::beacon_block::BeaconBlock; pub use crate::beacon_block_body::BeaconBlockBody; pub use crate::beacon_block_header::BeaconBlockHeader; -pub use crate::beacon_state::{BeaconState, BeaconStateTypes, Error as BeaconStateError}; +pub use crate::beacon_state::{Error as BeaconStateError, *}; pub use crate::chain_spec::{ChainSpec, Domain}; pub use crate::crosslink::Crosslink; pub use crate::crosslink_committee::CrosslinkCommittee;