From 39c3526884e41a885552cb2c1b4680608444ee8e Mon Sep 17 00:00:00 2001 From: Paul Hauner Date: Mon, 20 May 2019 16:47:44 +1000 Subject: [PATCH] Run `cargo fmt --all` --- .../block_processing_builder.rs | 14 ++++++++++---- .../src/per_block_processing/tests.rs | 10 ++++++---- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/eth2/state_processing/src/per_block_processing/block_processing_builder.rs b/eth2/state_processing/src/per_block_processing/block_processing_builder.rs index 307fc4a3d..35e736d5f 100644 --- a/eth2/state_processing/src/per_block_processing/block_processing_builder.rs +++ b/eth2/state_processing/src/per_block_processing/block_processing_builder.rs @@ -1,6 +1,6 @@ +use tree_hash::SignedRoot; use types::test_utils::{TestingBeaconBlockBuilder, TestingBeaconStateBuilder}; use types::*; -use tree_hash::SignedRoot; pub struct BlockProcessingBuilder { pub state_builder: TestingBeaconStateBuilder, @@ -31,7 +31,12 @@ impl BlockProcessingBuilder { self.state_builder.build_caches(&spec).unwrap(); } - pub fn build(mut self, randao_sk: Option, previous_block_root: Option, spec: &ChainSpec) -> (BeaconBlock, BeaconState) { + pub fn build( + mut self, + randao_sk: Option, + previous_block_root: Option, + spec: &ChainSpec, + ) -> (BeaconBlock, BeaconState) { let (state, keypairs) = self.state_builder.build(); let builder = &mut self.block_builder; @@ -39,7 +44,9 @@ impl BlockProcessingBuilder { match previous_block_root { Some(root) => builder.set_previous_block_root(root), - None => builder.set_previous_block_root(Hash256::from_slice(&state.latest_block_header.signed_root())), + None => builder.set_previous_block_root(Hash256::from_slice( + &state.latest_block_header.signed_root(), + )), } let proposer_index = state @@ -56,5 +63,4 @@ impl BlockProcessingBuilder { (block, state) } - } diff --git a/eth2/state_processing/src/per_block_processing/tests.rs b/eth2/state_processing/src/per_block_processing/tests.rs index 715c3e852..19418aba1 100644 --- a/eth2/state_processing/src/per_block_processing/tests.rs +++ b/eth2/state_processing/src/per_block_processing/tests.rs @@ -49,8 +49,8 @@ fn invalid_parent_block_root() { assert_eq!( result, Err(BlockProcessingError::Invalid( - BlockInvalid::ParentBlockRootMismatch{ - state: Hash256::from_slice(&state.latest_block_header.signed_root()), + BlockInvalid::ParentBlockRootMismatch { + state: Hash256::from_slice(&state.latest_block_header.signed_root()), block: block.previous_block_root } )) @@ -88,13 +88,15 @@ fn invalid_randao_reveal_signature() { // sign randao reveal with random keypair let keypair = Keypair::random(); let (block, mut state) = builder.build(Some(keypair.sk), None, &spec); - + let result = per_block_processing(&mut state, &block, &spec); // should get a BadRandaoSignature error assert_eq!( result, - Err(BlockProcessingError::Invalid(BlockInvalid::BadRandaoSignature)) + Err(BlockProcessingError::Invalid( + BlockInvalid::BadRandaoSignature + )) ); }