From 0fdd93b8ce1a3559aa9fa740bcbfaa0e87c96682 Mon Sep 17 00:00:00 2001 From: Nicholas Ward Date: Thu, 16 Feb 2023 11:54:18 -0800 Subject: [PATCH] cleanup --- evm/src/cpu/kernel/tests/bignum.rs | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/evm/src/cpu/kernel/tests/bignum.rs b/evm/src/cpu/kernel/tests/bignum.rs index 17dc5dda..12e8b357 100644 --- a/evm/src/cpu/kernel/tests/bignum.rs +++ b/evm/src/cpu/kernel/tests/bignum.rs @@ -1,7 +1,7 @@ use anyhow::Result; use ethereum_types::U256; use itertools::Itertools; -use num::{BigUint, Zero, One}; +use num::{BigUint, One, Zero}; use num_bigint::RandBigInt; use rand::Rng; @@ -100,8 +100,9 @@ fn prepare_two_bignums_diff(bit_size: usize) -> (BigUint, BigUint, U256, Vec(prepare_bignum_fn: &F) -> Result<()> -where F: Fn(usize) -> (BigUint, U256, Vec) { - +where + F: Fn(usize) -> (BigUint, U256, Vec), +{ let (a, length, memory) = prepare_bignum_fn(1000); let halved = a >> 1; @@ -125,7 +126,9 @@ where F: Fn(usize) -> (BigUint, U256, Vec) { } fn test_iszero_bignum(prepare_bignum_fn: &F) -> Result<()> -where F: Fn(usize) -> (BigUint, U256, Vec) { +where + F: Fn(usize) -> (BigUint, U256, Vec), +{ let (a, length, memory) = { let (a, length, memory) = prepare_bignum_fn(1000); while a == BigUint::zero() { @@ -163,7 +166,9 @@ where F: Fn(usize) -> (BigUint, U256, Vec) { } fn test_ge_bignum(prepare_two_bignums_fn: &F) -> Result<()> -where F: Fn(usize) -> (BigUint, BigUint, U256, Vec) { +where + F: Fn(usize) -> (BigUint, BigUint, U256, Vec), +{ let (_a, _b, length, memory) = prepare_two_bignums_fn(1000); let retdest = 0xDEADBEEFu32.into(); @@ -194,7 +199,9 @@ where F: Fn(usize) -> (BigUint, BigUint, U256, Vec) { } fn test_add_bignum(prepare_two_bignums_fn: &F) -> Result<()> -where F: Fn(usize) -> (BigUint, BigUint, U256, Vec) { +where + F: Fn(usize) -> (BigUint, BigUint, U256, Vec), +{ let (a, b, length, memory) = prepare_two_bignums_fn(1000); // Determine expected sum. @@ -228,7 +235,9 @@ where F: Fn(usize) -> (BigUint, BigUint, U256, Vec) { } fn test_addmul_bignum(prepare_two_bignums_fn: &F) -> Result<()> -where F: Fn(usize) -> (BigUint, BigUint, U256, Vec) { +where + F: Fn(usize) -> (BigUint, BigUint, U256, Vec), +{ let mut rng = rand::thread_rng(); let (a, b, length, mut memory) = prepare_two_bignums_fn(1000); let len: usize = length.try_into().unwrap(); @@ -270,7 +279,9 @@ where F: Fn(usize) -> (BigUint, BigUint, U256, Vec) { } fn test_mul_bignum(prepare_bignum_fn: &F) -> Result<()> -where F: Fn(usize) -> (BigUint, U256, Vec) { +where + F: Fn(usize) -> (BigUint, U256, Vec), +{ let (a, b, length, memory) = prepare_two_bignums_fn(1000); // Determine expected product.