diff --git a/beacon_node/beacon_chain/src/beacon_chain.rs b/beacon_node/beacon_chain/src/beacon_chain.rs index 49630096cee..70853998e3c 100644 --- a/beacon_node/beacon_chain/src/beacon_chain.rs +++ b/beacon_node/beacon_chain/src/beacon_chain.rs @@ -88,7 +88,8 @@ use state_processing::{ }, per_slot_processing, state_advance::{complete_state_advance, partial_state_advance}, - BlockSignatureStrategy, ConsensusContext, SigVerifiedOp, VerifyBlockRoot, VerifyOperation, + BlockSignatureStrategy, ConsensusContext, SigVerifiedOp, StateProcessingStrategy, + VerifyBlockRoot, VerifyOperation, }; use std::borrow::Cow; use std::cmp::Ordering; @@ -4651,6 +4652,7 @@ impl BeaconChain { &mut state, &block, signature_strategy, + StateProcessingStrategy::Accurate, VerifyBlockRoot::True, &mut ctxt, &self.spec, diff --git a/beacon_node/beacon_chain/src/block_verification.rs b/beacon_node/beacon_chain/src/block_verification.rs index 5102381a1a1..ca4df864db9 100644 --- a/beacon_node/beacon_chain/src/block_verification.rs +++ b/beacon_node/beacon_chain/src/block_verification.rs @@ -78,7 +78,7 @@ use state_processing::{ per_block_processing, per_slot_processing, state_advance::partial_state_advance, BlockProcessingError, BlockSignatureStrategy, ConsensusContext, SlotProcessingError, - VerifyBlockRoot, + StateProcessingStrategy, VerifyBlockRoot, }; use std::borrow::Cow; use std::fs; @@ -1400,6 +1400,7 @@ impl ExecutionPendingBlock { &block, // Signatures were verified earlier in this function. BlockSignatureStrategy::NoVerification, + StateProcessingStrategy::Accurate, VerifyBlockRoot::True, &mut consensus_context, &chain.spec, diff --git a/beacon_node/beacon_chain/src/fork_revert.rs b/beacon_node/beacon_chain/src/fork_revert.rs index ef23248aba6..ccd17af243d 100644 --- a/beacon_node/beacon_chain/src/fork_revert.rs +++ b/beacon_node/beacon_chain/src/fork_revert.rs @@ -5,7 +5,7 @@ use slog::{info, warn, Logger}; use state_processing::state_advance::complete_state_advance; use state_processing::{ per_block_processing, per_block_processing::BlockSignatureStrategy, ConsensusContext, - VerifyBlockRoot, + StateProcessingStrategy, VerifyBlockRoot, }; use std::sync::Arc; use std::time::Duration; @@ -177,6 +177,7 @@ pub fn reset_fork_choice_to_finalization, Cold: It &mut state, &block, BlockSignatureStrategy::NoVerification, + StateProcessingStrategy::Accurate, VerifyBlockRoot::True, &mut ctxt, spec, diff --git a/beacon_node/beacon_chain/src/test_utils.rs b/beacon_node/beacon_chain/src/test_utils.rs index 7ade38385a9..37a2f315c29 100644 --- a/beacon_node/beacon_chain/src/test_utils.rs +++ b/beacon_node/beacon_chain/src/test_utils.rs @@ -1,3 +1,4 @@ +use crate::observed_operations::ObservationOutcome; pub use crate::persisted_beacon_chain::PersistedBeaconChain; pub use crate::{ beacon_chain::{BEACON_CHAIN_DB_KEY, ETH1_CACHE_DB_KEY, FORK_CHOICE_DB_KEY, OP_POOL_DB_KEY}, @@ -26,6 +27,7 @@ use futures::channel::mpsc::Receiver; pub use genesis::{interop_genesis_state_with_eth1, DEFAULT_ETH1_BLOCK_HASH}; use int_to_bytes::int_to_bytes32; use merkle_proof::MerkleTree; +use operation_pool::ReceivedPreCapella; use parking_lot::Mutex; use parking_lot::RwLockWriteGuard; use rand::rngs::StdRng; @@ -38,7 +40,7 @@ use slot_clock::{SlotClock, TestingSlotClock}; use state_processing::per_block_processing::compute_timestamp_at_slot; use state_processing::{ state_advance::{complete_state_advance, partial_state_advance}, - StateRootStrategy, + StateProcessingStrategy, }; use std::borrow::Cow; use std::collections::{HashMap, HashSet}; @@ -709,7 +711,7 @@ where pub fn get_hot_state(&self, state_hash: BeaconStateHash) -> Option> { self.chain .store - .load_hot_state(&state_hash.into(), StateRootStrategy::Accurate) + .load_hot_state(&state_hash.into(), StateProcessingStrategy::Accurate) .unwrap() } @@ -1494,6 +1496,26 @@ where .sign(sk, &fork, genesis_validators_root, &self.chain.spec) } + pub fn add_bls_to_execution_change( + &self, + validator_index: u64, + address: Address, + ) -> Result<(), String> { + let signed_bls_change = self.make_bls_to_execution_change(validator_index, address); + if let ObservationOutcome::New(verified_bls_change) = self + .chain + .verify_bls_to_execution_change_for_gossip(signed_bls_change) + .expect("should verify BLS to execution change for gossip") + { + self.chain + .import_bls_to_execution_change(verified_bls_change, ReceivedPreCapella::No) + .then_some(()) + .ok_or("should import BLS to execution change to the op pool".to_string()) + } else { + Err("should observe new BLS to execution change".to_string()) + } + } + pub fn make_bls_to_execution_change( &self, validator_index: u64, diff --git a/beacon_node/beacon_chain/tests/attestation_verification.rs b/beacon_node/beacon_chain/tests/attestation_verification.rs index 6a9e6047938..3ebc3c8cf58 100644 --- a/beacon_node/beacon_chain/tests/attestation_verification.rs +++ b/beacon_node/beacon_chain/tests/attestation_verification.rs @@ -1,5 +1,6 @@ #![cfg(not(debug_assertions))] +use beacon_chain::test_utils::HARNESS_GENESIS_TIME; use beacon_chain::{ attestation_verification::Error as AttnError, test_utils::{ @@ -7,6 +8,7 @@ use beacon_chain::{ }, BeaconChain, BeaconChainError, BeaconChainTypes, WhenSlotSkipped, }; +use genesis::{interop_genesis_state, DEFAULT_ETH1_BLOCK_HASH}; use int_to_bytes::int_to_bytes32; use lazy_static::lazy_static; use state_processing::{ @@ -14,9 +16,9 @@ use state_processing::{ }; use tree_hash::TreeHash; use types::{ - test_utils::generate_deterministic_keypair, AggregateSignature, Attestation, BeaconStateError, - BitList, Epoch, EthSpec, Hash256, Keypair, MainnetEthSpec, SecretKey, SelectionProof, - SignedAggregateAndProof, Slot, SubnetId, Unsigned, + test_utils::generate_deterministic_keypair, Address, AggregateSignature, Attestation, + BeaconStateError, BitList, Epoch, EthSpec, Hash256, Keypair, MainnetEthSpec, SecretKey, + SelectionProof, SignedAggregateAndProof, Slot, SubnetId, Unsigned, }; pub type E = MainnetEthSpec; @@ -50,6 +52,48 @@ fn get_harness(validator_count: usize) -> BeaconChainHarness BeaconChainHarness> { + let mut spec = E::default_spec(); + spec.altair_fork_epoch = Some(Epoch::new(0)); + spec.bellatrix_fork_epoch = Some(Epoch::new(0)); + spec.capella_fork_epoch = Some(Epoch::new(1)); + + let validator_keypairs = KEYPAIRS[0..validator_count].to_vec(); + let genesis_state = interop_genesis_state( + &validator_keypairs, + HARNESS_GENESIS_TIME, + Hash256::from_slice(DEFAULT_ETH1_BLOCK_HASH), + None, + &spec, + ) + .unwrap(); + + let harness = BeaconChainHarness::builder(MainnetEthSpec) + .spec(spec) + .keypairs(validator_keypairs) + .withdrawal_keypairs( + KEYPAIRS[0..validator_count] + .iter() + .cloned() + .map(Some) + .collect(), + ) + .genesis_state_ephemeral_store(genesis_state) + .mock_execution_layer() + .build(); + + harness + .execution_block_generator() + .move_to_terminal_block() + .unwrap(); + + harness.advance_slot(); + + harness +} + /// Returns an attestation that is valid for some slot in the given `chain`. /// /// Also returns some info about who created it. @@ -998,6 +1042,100 @@ async fn attestation_that_skips_epochs() { .expect("should gossip verify attestation that skips slots"); } +/// Ensures that an attestation can be processed when a validator receives proposer reward +/// in an epoch _and_ is scheduled for a withdrawal. This is a regression test for a scenario where +/// inconsistent state lookup could cause withdrawal root mismatch. +#[tokio::test] +async fn attestation_validator_receive_proposer_reward_and_withdrawals() { + let harness = get_harness_capella_spec(VALIDATOR_COUNT); + + // Advance to a Capella block. Make sure the blocks have attestations. + let two_thirds = (VALIDATOR_COUNT / 3) * 2; + let attesters = (0..two_thirds).collect(); + harness + .extend_chain( + // To trigger the bug we need the proposer attestation reward to be signed at a block + // that isn't the first in the epoch. + MainnetEthSpec::slots_per_epoch() as usize + 1, + BlockStrategy::OnCanonicalHead, + AttestationStrategy::SomeValidators(attesters), + ) + .await; + + // Add BLS change for the block proposer at slot 33. This sets up a withdrawal for the block proposer. + let proposer_index = harness + .chain + .block_at_slot(harness.get_current_slot(), WhenSlotSkipped::None) + .expect("should not error getting block at slot") + .expect("should find block at slot") + .message() + .proposer_index(); + harness + .add_bls_to_execution_change(proposer_index, Address::from_low_u64_be(proposer_index)) + .unwrap(); + + // Apply two blocks: one to process the BLS change, and another to process the withdrawal. + harness.advance_slot(); + harness + .extend_chain( + 2, + BlockStrategy::OnCanonicalHead, + AttestationStrategy::SomeValidators(vec![]), + ) + .await; + let earlier_slot = harness.get_current_slot(); + let earlier_block = harness + .chain + .block_at_slot(earlier_slot, WhenSlotSkipped::None) + .expect("should not error getting block at slot") + .expect("should find block at slot"); + + // Extend the chain out a few epochs so we have some chain depth to play with. + harness.advance_slot(); + harness + .extend_chain( + MainnetEthSpec::slots_per_epoch() as usize * 2, + BlockStrategy::OnCanonicalHead, + AttestationStrategy::SomeValidators(vec![]), + ) + .await; + + let current_slot = harness.get_current_slot(); + let mut state = harness + .chain + .get_state(&earlier_block.state_root(), Some(earlier_slot)) + .expect("should not error getting state") + .expect("should find state"); + + while state.slot() < current_slot { + per_slot_processing(&mut state, None, &harness.spec).expect("should process slot"); + } + + let state_root = state.update_tree_hash_cache().unwrap(); + + // Get an attestation pointed to an old block (where we do not have its shuffling cached). + // Verifying the attestation triggers an inconsistent state replay. + let remaining_attesters = (two_thirds..VALIDATOR_COUNT).collect(); + let (attestation, subnet_id) = harness + .get_unaggregated_attestations( + &AttestationStrategy::SomeValidators(remaining_attesters), + &state, + state_root, + earlier_block.canonical_root(), + current_slot, + ) + .first() + .expect("should have at least one committee") + .first() + .cloned() + .expect("should have at least one attestation in committee"); + + harness + .chain + .verify_unaggregated_attestation_for_gossip(&attestation, Some(subnet_id)) + .expect("should gossip verify attestation without checking withdrawals root"); +} + #[tokio::test] async fn attestation_to_finalized_block() { let harness = get_harness(VALIDATOR_COUNT); diff --git a/beacon_node/beacon_chain/tests/block_verification.rs b/beacon_node/beacon_chain/tests/block_verification.rs index 38a55e2212a..c66ed60a9ca 100644 --- a/beacon_node/beacon_chain/tests/block_verification.rs +++ b/beacon_node/beacon_chain/tests/block_verification.rs @@ -11,7 +11,8 @@ use slasher::{Config as SlasherConfig, Slasher}; use state_processing::{ common::get_indexed_attestation, per_block_processing::{per_block_processing, BlockSignatureStrategy}, - per_slot_processing, BlockProcessingError, ConsensusContext, VerifyBlockRoot, + per_slot_processing, BlockProcessingError, ConsensusContext, StateProcessingStrategy, + VerifyBlockRoot, }; use std::marker::PhantomData; use std::sync::Arc; @@ -1167,6 +1168,7 @@ async fn add_base_block_to_altair_chain() { &mut state, &base_block, BlockSignatureStrategy::NoVerification, + StateProcessingStrategy::Accurate, VerifyBlockRoot::True, &mut ctxt, &harness.chain.spec, @@ -1305,6 +1307,7 @@ async fn add_altair_block_to_base_chain() { &mut state, &altair_block, BlockSignatureStrategy::NoVerification, + StateProcessingStrategy::Accurate, VerifyBlockRoot::True, &mut ctxt, &harness.chain.spec, diff --git a/beacon_node/store/src/hot_cold_store.rs b/beacon_node/store/src/hot_cold_store.rs index 70fb22742e0..7695ea520e8 100644 --- a/beacon_node/store/src/hot_cold_store.rs +++ b/beacon_node/store/src/hot_cold_store.rs @@ -30,7 +30,7 @@ use slog::{debug, error, info, trace, warn, Logger}; use ssz::{Decode, Encode}; use ssz_derive::{Decode, Encode}; use state_processing::{ - BlockProcessingError, BlockReplayer, SlotProcessingError, StateRootStrategy, + BlockProcessingError, BlockReplayer, SlotProcessingError, StateProcessingStrategy, }; use std::cmp::min; use std::convert::TryInto; @@ -531,10 +531,10 @@ impl, Cold: ItemStore> HotColdDB // chain. This way we avoid returning a state that doesn't match `state_root`. self.load_cold_state(state_root) } else { - self.load_hot_state(state_root, StateRootStrategy::Accurate) + self.load_hot_state(state_root, StateProcessingStrategy::Accurate) } } else { - match self.load_hot_state(state_root, StateRootStrategy::Accurate)? { + match self.load_hot_state(state_root, StateProcessingStrategy::Accurate)? { Some(state) => Ok(Some(state)), None => self.load_cold_state(state_root), } @@ -572,7 +572,7 @@ impl, Cold: ItemStore> HotColdDB } .into()) } else { - self.load_hot_state(state_root, StateRootStrategy::Inconsistent) + self.load_hot_state(state_root, StateProcessingStrategy::Inconsistent) } } @@ -662,10 +662,13 @@ impl, Cold: ItemStore> HotColdDB { // NOTE: minor inefficiency here because we load an unnecessary hot state summary // - // `StateRootStrategy` should be irrelevant here since we never replay blocks for an epoch + // `StateProcessingStrategy` should be irrelevant here since we never replay blocks for an epoch // boundary state in the hot DB. let state = self - .load_hot_state(&epoch_boundary_state_root, StateRootStrategy::Accurate)? + .load_hot_state( + &epoch_boundary_state_root, + StateProcessingStrategy::Accurate, + )? .ok_or(HotColdDBError::MissingEpochBoundaryState( epoch_boundary_state_root, ))?; @@ -834,7 +837,7 @@ impl, Cold: ItemStore> HotColdDB pub fn load_hot_state( &self, state_root: &Hash256, - state_root_strategy: StateRootStrategy, + state_processing_strategy: StateProcessingStrategy, ) -> Result>, Error> { metrics::inc_counter(&metrics::BEACON_STATE_HOT_GET_COUNT); @@ -867,7 +870,7 @@ impl, Cold: ItemStore> HotColdDB blocks, slot, no_state_root_iter(), - state_root_strategy, + state_processing_strategy, )? }; @@ -1038,7 +1041,7 @@ impl, Cold: ItemStore> HotColdDB blocks, slot, Some(state_root_iter), - StateRootStrategy::Accurate, + StateProcessingStrategy::Accurate, )?; // If state is not error, put it in the cache. @@ -1130,10 +1133,10 @@ impl, Cold: ItemStore> HotColdDB blocks: Vec>>, target_slot: Slot, state_root_iter: Option>>, - state_root_strategy: StateRootStrategy, + state_processing_strategy: StateProcessingStrategy, ) -> Result, Error> { let mut block_replayer = BlockReplayer::new(state, &self.spec) - .state_root_strategy(state_root_strategy) + .state_processing_strategy(state_processing_strategy) .no_signature_verification() .minimal_block_root_verification(); diff --git a/beacon_node/store/src/reconstruct.rs b/beacon_node/store/src/reconstruct.rs index c399f1b4571..cd50babdb0c 100644 --- a/beacon_node/store/src/reconstruct.rs +++ b/beacon_node/store/src/reconstruct.rs @@ -5,7 +5,7 @@ use itertools::{process_results, Itertools}; use slog::info; use state_processing::{ per_block_processing, per_slot_processing, BlockSignatureStrategy, ConsensusContext, - VerifyBlockRoot, + StateProcessingStrategy, VerifyBlockRoot, }; use std::sync::Arc; use types::{EthSpec, Hash256}; @@ -96,6 +96,7 @@ where &mut state, &block, BlockSignatureStrategy::NoVerification, + StateProcessingStrategy::Accurate, VerifyBlockRoot::True, &mut ctxt, &self.spec, diff --git a/consensus/state_processing/src/block_replayer.rs b/consensus/state_processing/src/block_replayer.rs index cc7bd17c50c..ed5e6429412 100644 --- a/consensus/state_processing/src/block_replayer.rs +++ b/consensus/state_processing/src/block_replayer.rs @@ -29,7 +29,7 @@ pub struct BlockReplayer< > { state: BeaconState, spec: &'a ChainSpec, - state_root_strategy: StateRootStrategy, + state_processing_strategy: StateProcessingStrategy, block_sig_strategy: BlockSignatureStrategy, verify_block_root: Option, pre_block_hook: Option>, @@ -60,13 +60,13 @@ impl From for BlockReplayError { } } -/// Defines how state roots should be computed during block replay. -#[derive(PartialEq)] -pub enum StateRootStrategy { +/// Defines how state roots should be computed and whether to perform all state transitions during block replay. +#[derive(PartialEq, Clone, Copy)] +pub enum StateProcessingStrategy { /// Perform all transitions faithfully to the specification. Accurate, - /// Don't compute state roots, eventually computing an invalid beacon state that can only be - /// used for obtaining shuffling. + /// Don't compute state roots and process withdrawals, eventually computing an invalid beacon + /// state that can only be used for obtaining shuffling. Inconsistent, } @@ -87,7 +87,7 @@ where Self { state, spec, - state_root_strategy: StateRootStrategy::Accurate, + state_processing_strategy: StateProcessingStrategy::Accurate, block_sig_strategy: BlockSignatureStrategy::VerifyBulk, verify_block_root: Some(VerifyBlockRoot::True), pre_block_hook: None, @@ -100,12 +100,15 @@ where } } - /// Set the replayer's state root strategy different from the default. - pub fn state_root_strategy(mut self, state_root_strategy: StateRootStrategy) -> Self { - if state_root_strategy == StateRootStrategy::Inconsistent { + /// Set the replayer's state processing strategy different from the default. + pub fn state_processing_strategy( + mut self, + state_processing_strategy: StateProcessingStrategy, + ) -> Self { + if state_processing_strategy == StateProcessingStrategy::Inconsistent { self.verify_block_root = None; } - self.state_root_strategy = state_root_strategy; + self.state_processing_strategy = state_processing_strategy; self } @@ -182,7 +185,7 @@ where i: usize, ) -> Result, Error> { // If we don't care about state roots then return immediately. - if self.state_root_strategy == StateRootStrategy::Inconsistent { + if self.state_processing_strategy == StateProcessingStrategy::Inconsistent { return Ok(Some(Hash256::zero())); } @@ -249,7 +252,7 @@ where // If no explicit policy is set, verify only the first 1 or 2 block roots if using // accurate state roots. Inaccurate state roots require block root verification to // be off. - if i <= 1 && self.state_root_strategy == StateRootStrategy::Accurate { + if i <= 1 && self.state_processing_strategy == StateProcessingStrategy::Accurate { VerifyBlockRoot::True } else { VerifyBlockRoot::False @@ -263,6 +266,7 @@ where &mut self.state, block, self.block_sig_strategy, + self.state_processing_strategy, verify_block_root, &mut ctxt, self.spec, diff --git a/consensus/state_processing/src/lib.rs b/consensus/state_processing/src/lib.rs index 9641e8f96ec..7340206a345 100644 --- a/consensus/state_processing/src/lib.rs +++ b/consensus/state_processing/src/lib.rs @@ -27,7 +27,7 @@ pub mod state_advance; pub mod upgrade; pub mod verify_operation; -pub use block_replayer::{BlockReplayError, BlockReplayer, StateRootStrategy}; +pub use block_replayer::{BlockReplayError, BlockReplayer, StateProcessingStrategy}; pub use consensus_context::{ConsensusContext, ContextError}; pub use genesis::{ eth2_genesis_time, initialize_beacon_state_from_eth1, is_valid_genesis_state, diff --git a/consensus/state_processing/src/per_block_processing.rs b/consensus/state_processing/src/per_block_processing.rs index c564b98d669..124fdf6500b 100644 --- a/consensus/state_processing/src/per_block_processing.rs +++ b/consensus/state_processing/src/per_block_processing.rs @@ -39,6 +39,7 @@ mod verify_exit; mod verify_proposer_slashing; use crate::common::decrease_balance; +use crate::StateProcessingStrategy; #[cfg(feature = "arbitrary-fuzz")] use arbitrary::Arbitrary; @@ -96,6 +97,7 @@ pub fn per_block_processing>( state: &mut BeaconState, signed_block: &SignedBeaconBlock, block_signature_strategy: BlockSignatureStrategy, + state_processing_strategy: StateProcessingStrategy, verify_block_root: VerifyBlockRoot, ctxt: &mut ConsensusContext, spec: &ChainSpec, @@ -160,7 +162,9 @@ pub fn per_block_processing>( // previous block. if is_execution_enabled(state, block.body()) { let payload = block.body().execution_payload()?; - process_withdrawals::(state, payload, spec)?; + if state_processing_strategy == StateProcessingStrategy::Accurate { + process_withdrawals::(state, payload, spec)?; + } process_execution_payload::(state, payload, spec)?; } diff --git a/consensus/state_processing/src/per_block_processing/tests.rs b/consensus/state_processing/src/per_block_processing/tests.rs index 6eabbf0d44a..ddb9ca6ad54 100644 --- a/consensus/state_processing/src/per_block_processing/tests.rs +++ b/consensus/state_processing/src/per_block_processing/tests.rs @@ -1,11 +1,11 @@ #![cfg(all(test, not(feature = "fake_crypto")))] -use crate::per_block_processing; use crate::per_block_processing::errors::{ AttestationInvalid, AttesterSlashingInvalid, BlockOperationError, BlockProcessingError, DepositInvalid, HeaderInvalid, IndexedAttestationInvalid, IntoWithIndex, ProposerSlashingInvalid, }; +use crate::{per_block_processing, StateProcessingStrategy}; use crate::{ per_block_processing::{process_operations, verify_exit::verify_exit}, BlockSignatureStrategy, ConsensusContext, VerifyBlockRoot, VerifySignatures, @@ -72,6 +72,7 @@ async fn valid_block_ok() { &mut state, &block, BlockSignatureStrategy::VerifyIndividual, + StateProcessingStrategy::Accurate, VerifyBlockRoot::True, &mut ctxt, &spec, @@ -97,6 +98,7 @@ async fn invalid_block_header_state_slot() { &mut state, &SignedBeaconBlock::from_block(block, signature), BlockSignatureStrategy::VerifyIndividual, + StateProcessingStrategy::Accurate, VerifyBlockRoot::True, &mut ctxt, &spec, @@ -129,6 +131,7 @@ async fn invalid_parent_block_root() { &mut state, &SignedBeaconBlock::from_block(block, signature), BlockSignatureStrategy::VerifyIndividual, + StateProcessingStrategy::Accurate, VerifyBlockRoot::True, &mut ctxt, &spec, @@ -162,6 +165,7 @@ async fn invalid_block_signature() { &mut state, &SignedBeaconBlock::from_block(block, Signature::empty()), BlockSignatureStrategy::VerifyIndividual, + StateProcessingStrategy::Accurate, VerifyBlockRoot::True, &mut ctxt, &spec, @@ -195,6 +199,7 @@ async fn invalid_randao_reveal_signature() { &mut state, &signed_block, BlockSignatureStrategy::VerifyIndividual, + StateProcessingStrategy::Accurate, VerifyBlockRoot::True, &mut ctxt, &spec, diff --git a/lcli/src/transition_blocks.rs b/lcli/src/transition_blocks.rs index 44a1772ccd2..cf971c69f00 100644 --- a/lcli/src/transition_blocks.rs +++ b/lcli/src/transition_blocks.rs @@ -74,7 +74,7 @@ use eth2::{ use ssz::Encode; use state_processing::{ block_signature_verifier::BlockSignatureVerifier, per_block_processing, per_slot_processing, - BlockSignatureStrategy, ConsensusContext, VerifyBlockRoot, + BlockSignatureStrategy, ConsensusContext, StateProcessingStrategy, VerifyBlockRoot, }; use std::borrow::Cow; use std::fs::File; @@ -381,6 +381,7 @@ fn do_transition( &mut pre_state, &block, BlockSignatureStrategy::NoVerification, + StateProcessingStrategy::Accurate, VerifyBlockRoot::True, &mut ctxt, spec, diff --git a/testing/ef_tests/src/cases/sanity_blocks.rs b/testing/ef_tests/src/cases/sanity_blocks.rs index 8a757897243..e51fed1907f 100644 --- a/testing/ef_tests/src/cases/sanity_blocks.rs +++ b/testing/ef_tests/src/cases/sanity_blocks.rs @@ -5,7 +5,7 @@ use crate::decode::{ssz_decode_file_with, ssz_decode_state, yaml_decode_file}; use serde_derive::Deserialize; use state_processing::{ per_block_processing, per_slot_processing, BlockProcessingError, BlockSignatureStrategy, - ConsensusContext, VerifyBlockRoot, + ConsensusContext, StateProcessingStrategy, VerifyBlockRoot, }; use types::{BeaconState, EthSpec, ForkName, RelativeEpoch, SignedBeaconBlock}; @@ -96,6 +96,7 @@ impl Case for SanityBlocks { &mut indiv_state, signed_block, BlockSignatureStrategy::VerifyIndividual, + StateProcessingStrategy::Accurate, VerifyBlockRoot::True, &mut ctxt, spec, @@ -106,6 +107,7 @@ impl Case for SanityBlocks { &mut bulk_state, signed_block, BlockSignatureStrategy::VerifyBulk, + StateProcessingStrategy::Accurate, VerifyBlockRoot::True, &mut ctxt, spec, diff --git a/testing/ef_tests/src/cases/transition.rs b/testing/ef_tests/src/cases/transition.rs index 314e51d5302..bb4efdb6de9 100644 --- a/testing/ef_tests/src/cases/transition.rs +++ b/testing/ef_tests/src/cases/transition.rs @@ -4,7 +4,7 @@ use crate::decode::{ssz_decode_file_with, ssz_decode_state, yaml_decode_file}; use serde_derive::Deserialize; use state_processing::{ per_block_processing, state_advance::complete_state_advance, BlockSignatureStrategy, - ConsensusContext, VerifyBlockRoot, + ConsensusContext, StateProcessingStrategy, VerifyBlockRoot, }; use std::str::FromStr; use types::{BeaconState, Epoch, ForkName, SignedBeaconBlock}; @@ -101,6 +101,7 @@ impl Case for TransitionTest { &mut state, block, BlockSignatureStrategy::VerifyBulk, + StateProcessingStrategy::Accurate, VerifyBlockRoot::True, &mut ctxt, spec, diff --git a/testing/state_transition_vectors/src/exit.rs b/testing/state_transition_vectors/src/exit.rs index d581eba965f..7e7fd23e0d0 100644 --- a/testing/state_transition_vectors/src/exit.rs +++ b/testing/state_transition_vectors/src/exit.rs @@ -2,7 +2,7 @@ use super::*; use beacon_chain::test_utils::{BeaconChainHarness, EphemeralHarnessType}; use state_processing::{ per_block_processing, per_block_processing::errors::ExitInvalid, BlockProcessingError, - BlockSignatureStrategy, ConsensusContext, VerifyBlockRoot, + BlockSignatureStrategy, ConsensusContext, StateProcessingStrategy, VerifyBlockRoot, }; use types::{BeaconBlock, BeaconState, Epoch, EthSpec, SignedBeaconBlock}; @@ -69,6 +69,7 @@ impl ExitTest { state, block, BlockSignatureStrategy::VerifyIndividual, + StateProcessingStrategy::Accurate, VerifyBlockRoot::True, &mut ctxt, &E::default_spec(),