From 7503f31ddc117b91debcfacd8d7b3e517a86899e Mon Sep 17 00:00:00 2001 From: Paul Hauner Date: Mon, 18 Mar 2019 18:09:31 +1100 Subject: [PATCH] Fix bug with per-block processing --- eth2/state_processing/src/per_block_processing.rs | 5 ++++- eth2/state_processing/src/per_slot_processing.rs | 3 --- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/eth2/state_processing/src/per_block_processing.rs b/eth2/state_processing/src/per_block_processing.rs index 78cf927f5..14c72c53b 100644 --- a/eth2/state_processing/src/per_block_processing.rs +++ b/eth2/state_processing/src/per_block_processing.rs @@ -100,8 +100,11 @@ pub fn process_block_header( ) -> Result<(), Error> { verify!(block.slot == state.slot, Invalid::StateSlotMismatch); + // NOTE: this is not to spec. I think spec is broken. See: + // + // https://github.com/ethereum/eth2.0-specs/issues/797 verify!( - block.previous_block_root.as_bytes() == &state.latest_block_header.hash_tree_root()[..], + block.previous_block_root == *state.get_block_root(state.slot - 1, spec)?, Invalid::ParentBlockRootMismatch ); diff --git a/eth2/state_processing/src/per_slot_processing.rs b/eth2/state_processing/src/per_slot_processing.rs index a90c5b408..8f02b70e3 100644 --- a/eth2/state_processing/src/per_slot_processing.rs +++ b/eth2/state_processing/src/per_slot_processing.rs @@ -25,9 +25,6 @@ pub fn per_slot_processing( state.slot += 1; - let latest_block_root = Hash256::from_slice(&state.latest_block_header.hash_tree_root()[..]); - state.set_block_root(state.slot - 1, latest_block_root, spec)?; - Ok(()) }