From 0afb9b0cf43be81e4f945d9439ba8a4d3b42a054 Mon Sep 17 00:00:00 2001 From: Dmitry Vagner Date: Wed, 5 Oct 2022 10:10:45 -0700 Subject: [PATCH] fmt --- evm/src/cpu/kernel/tests/hash.rs | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/evm/src/cpu/kernel/tests/hash.rs b/evm/src/cpu/kernel/tests/hash.rs index 8d940e16..dab93161 100644 --- a/evm/src/cpu/kernel/tests/hash.rs +++ b/evm/src/cpu/kernel/tests/hash.rs @@ -32,14 +32,17 @@ fn make_random_input() -> (u32, Vec) { fn make_custom_input() -> (u32, Vec) { // Hardcode a custom message - (48, vec![ - 86, 124, 206, 245, 74, 57, 250, 43, 60, 30, 254, 43, 143, 144, 242, 215, 13, 103, 237, 61, - 90, 105, 123, 250, 189, 181, 110, 192, 227, 57, 145, 46, 221, 238, 7, 181, 146, 111, 209, - 150, 31, 157, 229, 126, 206, 105, 37, 17, - ]) + ( + 48, + vec![ + 86, 124, 206, 245, 74, 57, 250, 43, 60, 30, 254, 43, 143, 144, 242, 215, 13, 103, 237, + 61, 90, 105, 123, 250, 189, 181, 110, 192, 227, 57, 145, 46, 221, 238, 7, 181, 146, + 111, 209, 150, 31, 157, 229, 126, 206, 105, 37, 17, + ], + ) } -fn make_input_stack(length: u32, message: Vec) -> Vec { +fn make_input_stack(length: u32, message: Vec) -> Vec { let mut initial_stack = vec![U256::from(length)]; let bytes: Vec = message.iter().map(|&x| U256::from(x as u32)).collect(); initial_stack.extend(bytes); @@ -50,7 +53,7 @@ fn make_input_stack(length: u32, message: Vec) -> Vec { fn test_hash(hash_fn_label: &str, standard_implementation: &dyn Fn(Vec) -> U256) -> Result<()> { // Make the inputs. - let (length_random, message_random) = make_random_input(); + let (length_random, message_random) = make_random_input(); let (length_custom, message_custom) = make_custom_input(); // Hash the message using a standard implementation. @@ -68,7 +71,7 @@ fn test_hash(hash_fn_label: &str, standard_implementation: &dyn Fn(Vec) -> U // Run the kernel code. let result_random = run_with_kernel(&kernel, kernel_function, initial_stack_random)?; let result_custom = run_with_kernel(&kernel, kernel_function, initial_stack_custom)?; - + // Print stack for debugging // let printable_stack: Vec = result.stack().iter().map(|x| format!("{:x}", x)).collect(); // println!("{:#?}", printable_stack);