From df3f8df7bdd5b00c4d81bf89f3ee1350478ea04d Mon Sep 17 00:00:00 2001 From: Paul Hauner Date: Sun, 17 Mar 2019 18:56:05 +1100 Subject: [PATCH] Ensure fork_choice tests pass under v0.5.0 --- eth2/fork_choice/src/longest_chain.rs | 2 +- eth2/fork_choice/tests/tests.rs | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eth2/fork_choice/src/longest_chain.rs b/eth2/fork_choice/src/longest_chain.rs index 333553c02..423edc567 100644 --- a/eth2/fork_choice/src/longest_chain.rs +++ b/eth2/fork_choice/src/longest_chain.rs @@ -34,7 +34,7 @@ impl ForkChoice for LongestChain { ) -> Result<(), ForkChoiceError> { // add the block hash to head_block_hashes removing the parent if it exists self.head_block_hashes - .retain(|hash| *hash != block.parent_root); + .retain(|hash| *hash != block.previous_block_root); self.head_block_hashes.push(*block_hash); Ok(()) } diff --git a/eth2/fork_choice/tests/tests.rs b/eth2/fork_choice/tests/tests.rs index cd5ff360f..80fbbbe20 100644 --- a/eth2/fork_choice/tests/tests.rs +++ b/eth2/fork_choice/tests/tests.rs @@ -90,6 +90,8 @@ fn test_yaml_vectors( let randao_reveal = Signature::empty_signature(); let signature = Signature::empty_signature(); let body = BeaconBlockBody { + eth1_data, + randao_reveal, proposer_slashings: vec![], attester_slashings: vec![], attestations: vec![], @@ -117,14 +119,14 @@ fn test_yaml_vectors( // default params for genesis let block_hash = id_to_hash(&block_id); let mut slot = spec.genesis_slot; - let parent_root = id_to_hash(&parent_id); + let previous_block_root = id_to_hash(&parent_id); // set the slot and parent based off the YAML. Start with genesis; // if not the genesis, update slot if parent_id != block_id { // find parent slot slot = *(block_slot - .get(&parent_root) + .get(&previous_block_root) .expect("Parent should have a slot number")) + 1; } else { @@ -137,10 +139,8 @@ fn test_yaml_vectors( // build the BeaconBlock let beacon_block = BeaconBlock { slot, - parent_root, + previous_block_root, state_root: state_root.clone(), - randao_reveal: randao_reveal.clone(), - eth1_data: eth1_data.clone(), signature: signature.clone(), body: body.clone(), };