From ec5a823e37166e2acddacb814e8ca1febc08b873 Mon Sep 17 00:00:00 2001 From: Vindaar Date: Fri, 28 Jun 2024 10:56:47 +0200 Subject: [PATCH] [rust] replace all tabs by spaces --- .../constantine-ethereum-bls-sig/src/lib.rs | 2 +- .../tests/t_ethereum_bls_sig_vectors.rs | 40 +++++++------- .../src/lib.rs | 52 +++++++++---------- .../tests/t_ethereum_evm_precompiles.rs | 4 +- 4 files changed, 49 insertions(+), 49 deletions(-) diff --git a/constantine-rust/constantine-ethereum-bls-sig/src/lib.rs b/constantine-rust/constantine-ethereum-bls-sig/src/lib.rs index 1dd75a50..419e8774 100644 --- a/constantine-rust/constantine-ethereum-bls-sig/src/lib.rs +++ b/constantine-rust/constantine-ethereum-bls-sig/src/lib.rs @@ -24,7 +24,7 @@ pub fn deserialize_seckey( skey as *mut ctt_eth_bls_seckey, src.as_ptr() as *const byte, ); - match status { + match status { ctt_codec_scalar_status::cttCodecScalar_Success => Ok(true), _ => Err(status), } diff --git a/constantine-rust/constantine-ethereum-bls-sig/tests/t_ethereum_bls_sig_vectors.rs b/constantine-rust/constantine-ethereum-bls-sig/tests/t_ethereum_bls_sig_vectors.rs index c30510da..058f5e14 100644 --- a/constantine-rust/constantine-ethereum-bls-sig/tests/t_ethereum_bls_sig_vectors.rs +++ b/constantine-rust/constantine-ethereum-bls-sig/tests/t_ethereum_bls_sig_vectors.rs @@ -439,10 +439,10 @@ fn t_verify() { Err(_e) => assert!(test.output == false), // expected test failure Ok(v) => { if !test.output { // Test failure! - println!("Verification differs from expected \n - valid sig? {}\n - expected: {}", v, test.output); - assert!(test.output == true); // will fail + println!("Verification differs from expected \n + valid sig? {}\n + expected: {}", v, test.output); + assert!(test.output == true); // will fail } else { let mut output = [0u8; 48]; let status = serialize_pubkey_compressed(&pkey, &mut output); @@ -538,10 +538,10 @@ fn t_fast_aggregate_verify() { Err(_e) => assert!(!test.output), // expected test failure Ok(v) => { if v != test.output { - println!("Verification differs from expected \n - valid sig? {}\n - expected: {}", v, test.output - ); + println!("Verification differs from expected \n + valid sig? {}\n + expected: {}", v, test.output + ); } assert!(v == test.output); } @@ -625,10 +625,10 @@ fn t_aggregate_verify() { Err(_e) => assert!(!test.output), // expected test failure Ok(v) => { if v != test.output { - println!("Verification differs from expected \n - valid sig? {}\n - expected: {}", v, test.output - ); + println!("Verification differs from expected \n + valid sig? {}\n + expected: {}", v, test.output + ); } assert!(v == test.output); } @@ -720,10 +720,10 @@ fn t_batch_verify() { Err(_e) => assert!(!test.output), // expected test failure Ok(v) => { if v != test.output { - println!("Verification differs from expected \n - valid sig? {}\n - expected: {}", v, test.output - ); + println!("Verification differs from expected \n + valid sig? {}\n + expected: {}", v, test.output + ); } assert!(v == test.output); } @@ -735,10 +735,10 @@ fn t_batch_verify() { Err(_e) => assert!(!test.output), // expected test failure Ok(v) => { if v != test.output { - println!("Verification differs from expected \n - valid sig? {}\n - expected: {}", v, test.output - ); + println!("Verification differs from expected \n + valid sig? {}\n + expected: {}", v, test.output + ); } assert!(v == test.output); } diff --git a/constantine-rust/constantine-ethereum-evm-precompiles/src/lib.rs b/constantine-rust/constantine-ethereum-evm-precompiles/src/lib.rs index eec48c0a..2e689b09 100644 --- a/constantine-rust/constantine-ethereum-evm-precompiles/src/lib.rs +++ b/constantine-rust/constantine-ethereum-evm-precompiles/src/lib.rs @@ -37,12 +37,12 @@ pub fn evm_modexp( inputs: &[u8] ) -> Result { unsafe { - let status = ctt_eth_evm_modexp( + let status = ctt_eth_evm_modexp( result.as_mut_ptr() as *mut byte, result.len() as isize, inputs.as_ptr() as *const byte, inputs.len() as isize, - ); + ); match status { ctt_evm_status::cttEVM_Success => Ok(true), _ => Err(status) @@ -55,12 +55,12 @@ pub fn evm_bn254_g1add( inputs: &[u8] ) -> Result { unsafe { - let status = ctt_eth_evm_bn254_g1add( + let status = ctt_eth_evm_bn254_g1add( result.as_mut_ptr() as *mut byte, result.len() as isize, inputs.as_ptr() as *const byte, inputs.len() as isize, - ); + ); match status { ctt_evm_status::cttEVM_Success => Ok(true), _ => Err(status) @@ -73,12 +73,12 @@ pub fn evm_bn254_g1mul( inputs: &[u8] ) -> Result { unsafe { - let status = ctt_eth_evm_bn254_g1mul( + let status = ctt_eth_evm_bn254_g1mul( result.as_mut_ptr() as *mut byte, result.len() as isize, inputs.as_ptr() as *const byte, inputs.len() as isize, - ); + ); match status { ctt_evm_status::cttEVM_Success => Ok(true), _ => Err(status) @@ -91,12 +91,12 @@ pub fn evm_bn254_ec_pairing_check( inputs: &[u8] ) -> Result { unsafe { - let status = ctt_eth_evm_bn254_ecpairingcheck( + let status = ctt_eth_evm_bn254_ecpairingcheck( result.as_mut_ptr() as *mut byte, result.len() as isize, inputs.as_ptr() as *const byte, inputs.len() as isize, - ); + ); match status { ctt_evm_status::cttEVM_Success => Ok(true), _ => Err(status) @@ -108,12 +108,12 @@ pub fn evm_bls12381_g1add( inputs: &[u8] ) -> Result { unsafe { - let status = ctt_eth_evm_bls12381_g1add( + let status = ctt_eth_evm_bls12381_g1add( result.as_mut_ptr() as *mut byte, result.len() as isize, inputs.as_ptr() as *const byte, inputs.len() as isize, - ); + ); match status { ctt_evm_status::cttEVM_Success => Ok(true), _ => Err(status) @@ -126,12 +126,12 @@ pub fn evm_bls12381_g1mul( inputs: &[u8] ) -> Result { unsafe { - let status = ctt_eth_evm_bls12381_g1mul( + let status = ctt_eth_evm_bls12381_g1mul( result.as_mut_ptr() as *mut byte, result.len() as isize, inputs.as_ptr() as *const byte, inputs.len() as isize, - ); + ); match status { ctt_evm_status::cttEVM_Success => Ok(true), _ => Err(status) @@ -144,12 +144,12 @@ pub fn evm_bls12381_g1msm( inputs: &[u8] ) -> Result { unsafe { - let status = ctt_eth_evm_bls12381_g1msm( + let status = ctt_eth_evm_bls12381_g1msm( result.as_mut_ptr() as *mut byte, result.len() as isize, inputs.as_ptr() as *const byte, inputs.len() as isize, - ); + ); match status { ctt_evm_status::cttEVM_Success => Ok(true), _ => Err(status) @@ -162,12 +162,12 @@ pub fn evm_bls12381_g2add( inputs: &[u8] ) -> Result { unsafe { - let status = ctt_eth_evm_bls12381_g2add( + let status = ctt_eth_evm_bls12381_g2add( result.as_mut_ptr() as *mut byte, result.len() as isize, inputs.as_ptr() as *const byte, inputs.len() as isize, - ); + ); match status { ctt_evm_status::cttEVM_Success => Ok(true), _ => Err(status) @@ -180,12 +180,12 @@ pub fn evm_bls12381_g2mul( inputs: &[u8] ) -> Result { unsafe { - let status = ctt_eth_evm_bls12381_g2mul( + let status = ctt_eth_evm_bls12381_g2mul( result.as_mut_ptr() as *mut byte, result.len() as isize, inputs.as_ptr() as *const byte, inputs.len() as isize, - ); + ); match status { ctt_evm_status::cttEVM_Success => Ok(true), _ => Err(status) @@ -198,12 +198,12 @@ pub fn evm_bls12381_g2msm( inputs: &[u8] ) -> Result { unsafe { - let status = ctt_eth_evm_bls12381_g2msm( + let status = ctt_eth_evm_bls12381_g2msm( result.as_mut_ptr() as *mut byte, result.len() as isize, inputs.as_ptr() as *const byte, inputs.len() as isize, - ); + ); match status { ctt_evm_status::cttEVM_Success => Ok(true), _ => Err(status) @@ -217,12 +217,12 @@ pub fn evm_bls12381_pairing_check( inputs: &[u8] ) -> Result { unsafe { - let status = ctt_eth_evm_bls12381_pairingcheck( + let status = ctt_eth_evm_bls12381_pairingcheck( result.as_mut_ptr() as *mut byte, result.len() as isize, inputs.as_ptr() as *const byte, inputs.len() as isize, - ); + ); match status { ctt_evm_status::cttEVM_Success => Ok(true), _ => Err(status) @@ -235,12 +235,12 @@ pub fn evm_bls12381_map_fp_to_g1( inputs: &[u8] ) -> Result { unsafe { - let status = ctt_eth_evm_bls12381_map_fp_to_g1( + let status = ctt_eth_evm_bls12381_map_fp_to_g1( result.as_mut_ptr() as *mut byte, result.len() as isize, inputs.as_ptr() as *const byte, inputs.len() as isize, - ); + ); match status { ctt_evm_status::cttEVM_Success => Ok(true), _ => Err(status) @@ -253,12 +253,12 @@ pub fn evm_bls12381_map_fp2_to_g2( inputs: &[u8] ) -> Result { unsafe { - let status = ctt_eth_evm_bls12381_map_fp2_to_g2( + let status = ctt_eth_evm_bls12381_map_fp2_to_g2( result.as_mut_ptr() as *mut byte, result.len() as isize, inputs.as_ptr() as *const byte, inputs.len() as isize, - ); + ); match status { ctt_evm_status::cttEVM_Success => Ok(true), _ => Err(status) diff --git a/constantine-rust/constantine-ethereum-evm-precompiles/tests/t_ethereum_evm_precompiles.rs b/constantine-rust/constantine-ethereum-evm-precompiles/tests/t_ethereum_evm_precompiles.rs index 35cd36fe..72bc036a 100644 --- a/constantine-rust/constantine-ethereum-evm-precompiles/tests/t_ethereum_evm_precompiles.rs +++ b/constantine-rust/constantine-ethereum-evm-precompiles/tests/t_ethereum_evm_precompiles.rs @@ -107,8 +107,8 @@ fn t_generate(test_name: String, func: TestFunction) { for vector in vectors { println!("Running test case: {}", vector.Name); - let input = vector.Input; - let expected = vector.Expected; + let input = vector.Input; + let expected = vector.Expected; let input_bytes = from_hex(input) .expect("Test failed; input bytes could not be unmarshaled.");