From c431bd993e9ed0d7aeffd37574e30a416955ea9c Mon Sep 17 00:00:00 2001 From: Grant Wuerker Date: Tue, 6 Aug 2019 14:56:13 +0200 Subject: [PATCH] Implicit conflicts resolved. --- beacon_node/beacon_chain/src/beacon_chain.rs | 10 +++++----- beacon_node/beacon_chain/src/fork_choice.rs | 12 ++++-------- beacon_node/beacon_chain/tests/tests.rs | 1 + 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/beacon_node/beacon_chain/src/beacon_chain.rs b/beacon_node/beacon_chain/src/beacon_chain.rs index 3e8467a492..49e2cec838 100644 --- a/beacon_node/beacon_chain/src/beacon_chain.rs +++ b/beacon_node/beacon_chain/src/beacon_chain.rs @@ -520,8 +520,8 @@ impl BeaconChain { if let Some(state) = self.get_attestation_state(&attestation) { if self.fork_choice.should_process_attestation(&state, &attestation)? { - let indexed_attestation = common::convert_to_indexed(&state, &attestation)?; - per_block_processing::verify_indexed_attestation(&state, &indexed_attestation, &self.spec)?; + let indexed_attestation = common::get_indexed_attestation(&state, &attestation)?; + per_block_processing::is_valid_indexed_attestation(&state, &indexed_attestation, &self.spec)?; self.fork_choice.process_attestation(&state, &attestation)?; } } @@ -540,14 +540,14 @@ impl BeaconChain { } /// Retrieves the `BeaconState` used to create the attestation. - fn get_attestation_state(&self, attestation: &Attestation) -> Option> { + fn get_attestation_state(&self, attestation: &Attestation) -> Option> { // Current state is used if the attestation targets a historic block and a slot within an // equal or adjacent epoch. let slots_per_epoch = T::EthSpec::slots_per_epoch(); let min_slot = (self.state.read().slot.epoch(slots_per_epoch) - 1).start_slot(slots_per_epoch); let blocks = BestBlockRootsIterator::owned(self.store.clone(), self.state.read().clone(), self.state.read().slot.clone()); for (root, slot) in blocks { - if root == attestation.data.target_root { + if root == attestation.data.target.root { return Some(self.state.read().clone()); } @@ -557,7 +557,7 @@ impl BeaconChain { }; // A different state is retrieved from the database. - match self.store.get::(&attestation.data.target_root) { + match self.store.get::>(&attestation.data.target.root) { Ok(Some(block)) => match self.store.get::>(&block.state_root) { Ok(state) => state, _ => None diff --git a/beacon_node/beacon_chain/src/fork_choice.rs b/beacon_node/beacon_chain/src/fork_choice.rs index 29b3664f18..3900575aee 100644 --- a/beacon_node/beacon_chain/src/fork_choice.rs +++ b/beacon_node/beacon_chain/src/fork_choice.rs @@ -4,7 +4,6 @@ use state_processing::common::get_attesting_indices; use std::sync::Arc; use store::{Error as StoreError, Store}; use types::{Attestation, BeaconBlock, BeaconState, BeaconStateError, Epoch, EthSpec, Hash256, Slot}; -use state_processing::common; type Result = std::result::Result; @@ -172,14 +171,11 @@ impl ForkChoice { } /// Determines whether or not the given attestation contains a latest message. - pub fn should_process_attestation(&self, state: &BeaconState, attestation: &Attestation) -> Result { - let validator_indices = common::get_attesting_indices_unsorted( - state, - &attestation.data, - &attestation.aggregation_bitfield, - )?; + pub fn should_process_attestation(&self, state: &BeaconState, attestation: &Attestation) -> Result { + let validator_indices = + get_attesting_indices(state, &attestation.data, &attestation.aggregation_bits)?; - let block_slot = state.get_attestation_slot(&attestation.data)?; + let block_slot = state.get_attestation_data_slot(&attestation.data)?; Ok(validator_indices .iter() diff --git a/beacon_node/beacon_chain/tests/tests.rs b/beacon_node/beacon_chain/tests/tests.rs index 730b8ec67e..cc1a84973e 100644 --- a/beacon_node/beacon_chain/tests/tests.rs +++ b/beacon_node/beacon_chain/tests/tests.rs @@ -1,3 +1,4 @@ +#![cfg(not(debug_assertions))] use beacon_chain::test_utils::{ AttestationStrategy, BeaconChainHarness, BlockStrategy, CommonTypes, PersistedBeaconChain,