Fix state_processing under new BeaconStateTypes

This commit is contained in:
Paul Hauner 2019-05-08 16:35:22 +10:00
parent 81c1dcceec
commit 6ea538938b
No known key found for this signature in database
GPG Key ID: D362883A9218FCC6
4 changed files with 6 additions and 6 deletions

View File

@ -8,9 +8,10 @@ use types::*;
fn runs_without_error() { fn runs_without_error() {
Builder::from_env(Env::default().default_filter_or("error")).init(); 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<FewValidatorsStateTypes> =
TestingBeaconStateBuilder::from_deterministic_keypairs(8, &spec);
let target_slot = (spec.genesis_epoch + 4).end_slot(spec.slots_per_epoch); let target_slot = (spec.genesis_epoch + 4).end_slot(spec.slots_per_epoch);
builder.teleport_to_slot(target_slot, &spec); builder.teleport_to_slot(target_slot, &spec);

View File

@ -246,7 +246,7 @@ impl ValidatorStatuses {
status.is_previous_epoch_boundary_attester = true; 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; self.total_balances.previous_epoch_head_attesters += attesting_balance;
status.is_previous_epoch_head_attester = true; status.is_previous_epoch_head_attester = true;
} }
@ -335,7 +335,6 @@ fn has_common_epoch_boundary_root<T: BeaconStateTypes>(
fn has_common_beacon_block_root<T: BeaconStateTypes>( fn has_common_beacon_block_root<T: BeaconStateTypes>(
a: &PendingAttestation, a: &PendingAttestation,
state: &BeaconState<T>, state: &BeaconState<T>,
spec: &ChainSpec,
) -> Result<bool, BeaconStateError> { ) -> Result<bool, BeaconStateError> {
let state_block_root = *state.get_block_root(a.data.slot)?; let state_block_root = *state.get_block_root(a.data.slot)?;

View File

@ -15,7 +15,7 @@ use tree_hash_derive::{CachedTreeHash, TreeHash};
pub use beacon_state_types::*; pub use beacon_state_types::*;
pub mod beacon_state_types; mod beacon_state_types;
mod epoch_cache; mod epoch_cache;
mod pubkey_cache; mod pubkey_cache;
mod tests; mod tests;

View File

@ -47,7 +47,7 @@ pub use crate::attester_slashing::AttesterSlashing;
pub use crate::beacon_block::BeaconBlock; pub use crate::beacon_block::BeaconBlock;
pub use crate::beacon_block_body::BeaconBlockBody; pub use crate::beacon_block_body::BeaconBlockBody;
pub use crate::beacon_block_header::BeaconBlockHeader; 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::chain_spec::{ChainSpec, Domain};
pub use crate::crosslink::Crosslink; pub use crate::crosslink::Crosslink;
pub use crate::crosslink_committee::CrosslinkCommittee; pub use crate::crosslink_committee::CrosslinkCommittee;