From 4be2637aac9ad0a91d8f3d434d19b7dace955163 Mon Sep 17 00:00:00 2001 From: Ulisse Bordignon Date: Tue, 8 Oct 2024 12:08:11 +0200 Subject: [PATCH] chore(repo): fix clippy lints --- common/bitcoin/src/validate_btc_difficulty.rs | 2 +- common/common/src/utils.rs | 4 +-- common/debug_signers/src/test_utils.rs | 2 -- common/eos/src/eos_enclave_state.rs | 3 +- common/eos/src/eos_hash.rs | 3 +- common/eos/src/eos_incremerkle.rs | 21 +++++++++----- common/eos/src/eos_merkle_proof.rs | 5 ++-- common/eos/src/eos_state.rs | 3 +- common/eos/src/get_action_digest.rs | 2 +- common/eos/src/protocol_features.rs | 4 +-- common/eos/src/validate_signature.rs | 3 +- .../src/eth_contracts/test_utils/mod.rs | 1 - .../ethereum/src/eth_submission_material.rs | 26 +++++------------ .../debug_functions/int_block_reprocessor.rs | 4 +-- .../eos_on_int/src/eos/get_eos_output.rs | 1 - .../eos_on_int/src/eos/submit_eos_block.rs | 19 +++++++----- .../src/get_latest_block_numbers.rs | 4 ++- .../debug_functions/eth_block_reprocessor.rs | 29 +++++++++---------- .../debug_functions/int_block_reprocessor.rs | 29 +++++++++---------- .../int_on_eos/src/eos/get_eos_output.rs | 1 - .../int_on_eos/src/eos/submit_eos_block.rs | 23 ++++++++------- .../src/get_latest_block_numbers.rs | 4 ++- .../multi_incremerkle_submission/mod.rs | 2 +- .../debug_functions/evm_block_reprocessor.rs | 29 +++++++++---------- .../debug_functions/int_block_reprocessor.rs | 29 +++++++++---------- .../vanilla_apps/pbtc-on-int/src/main.rs | 4 +-- .../vanilla_apps/peos-on-int/src/main.rs | 4 +-- .../vanilla_apps/perc20-on-int/src/main.rs | 4 +-- .../vanilla_apps/pint-on-algo/src/main.rs | 4 +-- .../vanilla_apps/pint-on-eos/src/main.rs | 4 +-- .../vanilla_apps/pint-on-evm/src/main.rs | 4 +-- 31 files changed, 138 insertions(+), 139 deletions(-) diff --git a/common/bitcoin/src/validate_btc_difficulty.rs b/common/bitcoin/src/validate_btc_difficulty.rs index 36a144ea8..1e647b4ab 100644 --- a/common/bitcoin/src/validate_btc_difficulty.rs +++ b/common/bitcoin/src/validate_btc_difficulty.rs @@ -82,7 +82,7 @@ mod tests { #[test] fn should_err_if_difficulty_is_below_threshold() { let block_header = get_sample_btc_block_and_id().unwrap().block.header; - let threshold = u64::max_value(); + let threshold = u64::MAX; assert!(check_difficulty_is_above_threshold(threshold, &block_header, BtcNetwork::Bitcoin).is_err()); } diff --git a/common/common/src/utils.rs b/common/common/src/utils.rs index 6b71446fb..86cf32ee8 100644 --- a/common/common/src/utils.rs +++ b/common/common/src/utils.rs @@ -174,7 +174,7 @@ mod tests { #[test] fn should_convert_u64_to_bytes() { - let u_64 = u64::max_value(); + let u_64 = u64::MAX; let expected_result = [255, 255, 255, 255, 255, 255, 255, 255]; let result = convert_u64_to_bytes(u_64); assert_eq!(result, expected_result); @@ -183,7 +183,7 @@ mod tests { #[test] fn should_convert_bytes_to_u64() { let bytes = vec![255, 255, 255, 255, 255, 255, 255, 255]; - let expected_result = u64::max_value(); + let expected_result = u64::MAX; let result = convert_bytes_to_u64(&bytes).unwrap(); assert_eq!(result, expected_result); } diff --git a/common/debug_signers/src/test_utils.rs b/common/debug_signers/src/test_utils.rs index 2220b06da..b8cf25541 100644 --- a/common/debug_signers/src/test_utils.rs +++ b/common/debug_signers/src/test_utils.rs @@ -1,5 +1,3 @@ -#![cfg(test)] - use common_eth::{convert_hex_to_eth_address, EthPrivateKey}; use ethereum_types::{Address as EthAddress, H256}; diff --git a/common/eos/src/eos_enclave_state.rs b/common/eos/src/eos_enclave_state.rs index 8198d876c..598b4cb63 100644 --- a/common/eos/src/eos_enclave_state.rs +++ b/common/eos/src/eos_enclave_state.rs @@ -7,12 +7,13 @@ use common::{ use common_safe_addresses::SAFE_EOS_ADDRESS_STR; use serde::{Deserialize, Serialize}; +#[cfg(not(feature = "spring_1-0"))] +use crate::Incremerkles; use crate::{ eos_database_utils::EosDbUtils, eos_global_sequences::ProcessedGlobalSequences, eos_types::EosKnownSchedulesJsons, protocol_features::EnabledFeatures, - Incremerkles, }; #[derive(Serialize, Deserialize)] diff --git a/common/eos/src/eos_hash.rs b/common/eos/src/eos_hash.rs index b5b4e17b8..c6a6da686 100644 --- a/common/eos/src/eos_hash.rs +++ b/common/eos/src/eos_hash.rs @@ -125,8 +125,7 @@ macro_rules! impl_hash { where H: Hasher, { - state.write(&self.0); - state.finish(); + self.0.hash(state); } } diff --git a/common/eos/src/eos_incremerkle.rs b/common/eos/src/eos_incremerkle.rs index f62f274e9..020793325 100644 --- a/common/eos/src/eos_incremerkle.rs +++ b/common/eos/src/eos_incremerkle.rs @@ -9,7 +9,9 @@ use derive_more::{Constructor, Deref, DerefMut}; use eos_chain::Checksum256; use serde::{Deserialize, Serialize}; -use crate::{EosDbUtils, EosState}; +use crate::EosDbUtils; +#[cfg(not(feature = "spring_1-0"))] +use crate::EosState; // NOTE: The light client for EOS doesn't keep blocks - they are too frequent and too numerous // for efficient use in TEEs. @@ -29,6 +31,7 @@ use crate::{EosDbUtils, EosState}; // keep up to some X incremerkles around. This means we have a choice of incremerkle from which we can // verifiy a new submission. +#[cfg(not(feature = "spring_1-0"))] const MAX_NUM_INCREMERKLES: usize = 10; #[derive(Clone, Default, Debug, PartialEq, Eq, Serialize, Deserialize, Constructor, Deref, DerefMut)] @@ -93,6 +96,7 @@ impl Incremerkles { // TODO Make more efficient my taking &mut self, however that makes using the above // state-version of this more difficult to manage for the caller. + #[cfg(not(feature = "spring_1-0"))] fn add_block_ids( &self, eos_db_utils: &EosDbUtils, @@ -134,6 +138,7 @@ impl Incremerkles { Ok(mutable_self) } + #[cfg(not(feature = "spring_1-0"))] fn add(&mut self, incremerkle: Incremerkle) { if incremerkle.block_num() > self.latest_block_num() || self.is_empty() { info!("adding new incremerkle to list"); @@ -388,10 +393,9 @@ mod tests { #![allow(clippy::needless_range_loop)] use std::str::FromStr; - use common::{ - test_utils::get_test_database, - types::{Byte, Bytes}, - }; + #[cfg(not(feature = "spring_1-0"))] + use common::test_utils::get_test_database; + use common::types::{Byte, Bytes}; use eos_chain::{AccountName, Action, ActionName, PermissionLevel, PermissionName, SerializeData}; use super::*; @@ -440,8 +444,8 @@ mod tests { } for i in 0..(leaves.len() / 2) { leaves[i] = MerkleProof::hash_canonical_pair(Incremerkle::make_canonical_pair( - &convert_hex_to_checksum256(&hex::encode(&leaves[2 * i])).unwrap(), - &convert_hex_to_checksum256(&hex::encode(&leaves[(2 * i) + 1])).unwrap(), + &convert_hex_to_checksum256(hex::encode(&leaves[2 * i])).unwrap(), + &convert_hex_to_checksum256(hex::encode(&leaves[(2 * i) + 1])).unwrap(), )) .unwrap() .as_bytes() @@ -685,6 +689,7 @@ mod tests { .for_each(|(result, expected_result)| assert_eq!(result, expected_result)) } + #[cfg(not(feature = "spring_1-0"))] #[test] fn should_only_allow_max_num_incremerkles() { let mut incremerkles = Incremerkles::default(); @@ -699,6 +704,7 @@ mod tests { } } + #[cfg(not(feature = "spring_1-0"))] #[test] fn should_put_and_get_incremerkles_in_db() { let mut incremerkles = Incremerkles::default(); @@ -713,6 +719,7 @@ mod tests { assert_eq!(incremerkles.block_nums(), incremerkles_from_db.block_nums()); } + #[cfg(not(feature = "spring_1-0"))] #[test] fn should_only_add_subsequent_incremerkles() { let mut incremerkles = Incremerkles::default(); diff --git a/common/eos/src/eos_merkle_proof.rs b/common/eos/src/eos_merkle_proof.rs index 2be6727a7..b254f333e 100644 --- a/common/eos/src/eos_merkle_proof.rs +++ b/common/eos/src/eos_merkle_proof.rs @@ -112,10 +112,9 @@ mod tests { #[test] fn should_verify_merkle_proofs() { let num_proofs = 4; - vec![0, num_proofs - 1] + [0, num_proofs - 1] .iter() - .enumerate() - .map(|(_, i)| get_sample_eos_submission_material_n(i + 1)) + .map(|i| get_sample_eos_submission_material_n(i + 1)) .map(|submission_material| submission_material.action_proofs[0].action_proof.clone().into()) .for_each(|proof: MerkleProof| assert!(proof.verify().unwrap())); } diff --git a/common/eos/src/eos_state.rs b/common/eos/src/eos_state.rs index 7e11a9fab..4f349ee41 100644 --- a/common/eos/src/eos_state.rs +++ b/common/eos/src/eos_state.rs @@ -6,12 +6,13 @@ use common::{ }; pub use crate::bitcoin_crate_alias::blockdata::transaction::Transaction as BtcTransaction; +#[cfg(not(feature = "spring_1-0"))] +use crate::eos_incremerkle::Incremerkles; use crate::{ eos_action_proofs::EosActionProofs, eos_block_header::EosBlockHeaderV2, eos_database_utils::EosDbUtils, eos_global_sequences::{GlobalSequences, ProcessedGlobalSequences}, - eos_incremerkle::Incremerkles, eos_producer_schedule::EosProducerScheduleV2, eos_submission_material::EosSubmissionMaterial, eos_types::Checksum256s, diff --git a/common/eos/src/get_action_digest.rs b/common/eos/src/get_action_digest.rs index bad269b4f..49cd79c26 100644 --- a/common/eos/src/get_action_digest.rs +++ b/common/eos/src/get_action_digest.rs @@ -139,7 +139,7 @@ mod tests { data: hex::decode("c0a6c36c3adc90bb8d6e0d0000000000085042544300000022314e393348584a687848754732444e59356b786a51373147347463726b5278354341") .unwrap(), }; - let results = vec![ + let results = [ hex::encode(get_action_digest(&action, true).unwrap()), // Assum the action HAS return value... hex::encode(get_action_digest(&action, false).unwrap()), // Assume the action has NO return value... ]; diff --git a/common/eos/src/protocol_features.rs b/common/eos/src/protocol_features.rs index 09e271d39..bfee5705c 100644 --- a/common/eos/src/protocol_features.rs +++ b/common/eos/src/protocol_features.rs @@ -231,7 +231,7 @@ mod tests { #[test] fn should_multi_add_available_features() { let existing_feature_hash = hex::decode(WTMSIG_BLOCK_SIGNATURE_FEATURE_HASH).unwrap(); - let existing_feature_hashes = vec![existing_feature_hash.clone(), existing_feature_hash]; + let existing_feature_hashes = [existing_feature_hash.clone(), existing_feature_hash]; existing_feature_hashes .iter() .for_each(|hash| assert!(AVAILABLE_FEATURES.contains(hash))); @@ -245,7 +245,7 @@ mod tests { fn should_fail_when_multi_addiing_non_available_features() { let unavailable_feature_hash = vec![0u8; 32]; let existing_feature_hash = hex::decode(WTMSIG_BLOCK_SIGNATURE_FEATURE_HASH).unwrap(); - let feature_hashes = vec![existing_feature_hash, unavailable_feature_hash.clone()]; + let feature_hashes = [existing_feature_hash, unavailable_feature_hash.clone()]; assert!(feature_hashes .iter() .map(|hash| AVAILABLE_FEATURES.contains(hash)) diff --git a/common/eos/src/validate_signature.rs b/common/eos/src/validate_signature.rs index 9f95b17f2..268e25678 100644 --- a/common/eos/src/validate_signature.rs +++ b/common/eos/src/validate_signature.rs @@ -7,6 +7,8 @@ use common::{ use eos_chain::{AccountName as EosAccountName, PublicKey as EosProducerKey}; use secp256k1::Message; +#[cfg(not(feature = "spring_1-0"))] +use crate::protocol_features::WTMSIG_BLOCK_SIGNATURE_FEATURE_HASH; use crate::{ bitcoin_crate_alias::hashes::{sha256, Hash}, eos_block_header::{EosBlockHeaderV1, EosBlockHeaderV2}, @@ -14,7 +16,6 @@ use crate::{ eos_crypto::{eos_public_key::EosPublicKey, eos_signature::EosSignature}, eos_producer_key::EosProducerKeyV1, eos_producer_schedule::{EosProducerScheduleV1, EosProducerScheduleV2}, - protocol_features::WTMSIG_BLOCK_SIGNATURE_FEATURE_HASH, EosState, }; diff --git a/common/ethereum/src/eth_contracts/test_utils/mod.rs b/common/ethereum/src/eth_contracts/test_utils/mod.rs index cbab0b5dd..b63115611 100644 --- a/common/ethereum/src/eth_contracts/test_utils/mod.rs +++ b/common/ethereum/src/eth_contracts/test_utils/mod.rs @@ -1,4 +1,3 @@ -#![cfg(test)] use std::{fs::read_to_string, path::Path, str::FromStr}; use common::{dictionaries::eth_evm::EthEvmTokenDictionary, types::Result}; diff --git a/common/ethereum/src/eth_submission_material.rs b/common/ethereum/src/eth_submission_material.rs index 7bf127deb..b4b1dc231 100644 --- a/common/ethereum/src/eth_submission_material.rs +++ b/common/ethereum/src/eth_submission_material.rs @@ -561,15 +561,10 @@ mod tests { .unwrap(); let num_receipts_after = result.receipts.len(); assert!(num_receipts_before > num_receipts_after); - result - .receipts - .0 - .iter() - .map(|receipt| { - assert!(receipt.logs.contain_topic(&topics[0])); - receipt - }) - .for_each(|receipt| assert!(receipt.logs.contain_address(&address))); + result.receipts.0.iter().for_each(|receipt| { + assert!(receipt.logs.contain_topic(&topics[0])); + assert!(receipt.logs.contain_address(&address)) + }); } #[test] @@ -585,15 +580,10 @@ mod tests { let num_receipts_after = result.receipts.len(); assert!(num_receipts_before > num_receipts_after); assert_eq!(num_receipts_after, expected_num_receipts_after); - result - .receipts - .0 - .iter() - .map(|receipt| { - assert!(receipt.logs.contain_topic(&topics[0])); - receipt - }) - .for_each(|receipt| assert!(receipt.logs.contain_address(&address))); + result.receipts.0.iter().for_each(|receipt| { + assert!(receipt.logs.contain_topic(&topics[0])); + assert!(receipt.logs.contain_address(&address)) + }); } #[test] diff --git a/v2_bridges/btc_on_int/src/debug_functions/int_block_reprocessor.rs b/v2_bridges/btc_on_int/src/debug_functions/int_block_reprocessor.rs index 6367679ad..dbccbd9c3 100644 --- a/v2_bridges/btc_on_int/src/debug_functions/int_block_reprocessor.rs +++ b/v2_bridges/btc_on_int/src/debug_functions/int_block_reprocessor.rs @@ -85,8 +85,8 @@ fn reprocess_int_block(db: &D, block_json: &str, signature /// /// ### NOTE: /// -/// - This function will increment the core's INT nonce, meaning the outputted reports will have a -/// gap in their report IDs! +/// - This function will increment the core's INT nonce, meaning the outputted reports will have a gap in their report +/// IDs! /// /// ### BEWARE: /// If you don't broadcast the transaction outputted from this function, ALL future BTC transactions will diff --git a/v2_bridges/eos_on_int/src/eos/get_eos_output.rs b/v2_bridges/eos_on_int/src/eos/get_eos_output.rs index 71795d686..6ba4c578c 100644 --- a/v2_bridges/eos_on_int/src/eos/get_eos_output.rs +++ b/v2_bridges/eos_on_int/src/eos/get_eos_output.rs @@ -123,7 +123,6 @@ use std::str::FromStr; #[cfg(test)] use common::errors::AppError; #[cfg(test)] -#[cfg(test)] impl FromStr for EosOutput { type Err = AppError; diff --git a/v2_bridges/eos_on_int/src/eos/submit_eos_block.rs b/v2_bridges/eos_on_int/src/eos/submit_eos_block.rs index ecaeadbae..edc593697 100644 --- a/v2_bridges/eos_on_int/src/eos/submit_eos_block.rs +++ b/v2_bridges/eos_on_int/src/eos/submit_eos_block.rs @@ -1,4 +1,6 @@ use common::{traits::DatabaseInterface, types::Result, CoreType}; +#[cfg(not(feature = "spring_1-0"))] +use common_eos::Incremerkles; use common_eos::{ end_eos_db_transaction_and_return_state, get_active_schedule_from_db_and_add_to_state, @@ -17,7 +19,6 @@ use common_eos::{ validate_block_header_signature, validate_producer_slot_of_block_in_state, EosState, - Incremerkles, }; use crate::eos::{ @@ -115,7 +116,7 @@ mod tests { use common::test_utils::get_test_database; use common_chain_ids::EthChainId; - use common_eos::{initialize_eos_core_inner, EosPrivateKey, EosSubmissionMaterial, ProcessedGlobalSequences}; + use common_eos::{initialize_eos_core_inner, EosPrivateKey, ProcessedGlobalSequences}; use common_eth::{ initialize_eth_core_with_router_contract_and_return_state, EthDbUtils, @@ -136,12 +137,6 @@ mod tests { get_sample_int_address, get_sample_int_private_key, get_sample_router_address, - multi_incremerkle_submission::{ - get_incremekle_update_block, - get_init_block, - get_sample_dictionary as get_sample_dictionary_for_incremerkle_test, - get_submission_block, - }, }, }; @@ -267,7 +262,15 @@ mod tests { #[cfg(not(feature = "spring_1-0"))] mod legacy_blocks { + use common_eos::EosSubmissionMaterial; + use super::*; + use crate::test_utils::multi_incremerkle_submission::{ + get_incremekle_update_block, + get_init_block, + get_sample_dictionary as get_sample_dictionary_for_incremerkle_test, + get_submission_block, + }; #[test] fn should_submit_eos_block() { diff --git a/v2_bridges/eos_on_int/src/get_latest_block_numbers.rs b/v2_bridges/eos_on_int/src/get_latest_block_numbers.rs index c0f40ce76..d29122861 100644 --- a/v2_bridges/eos_on_int/src/get_latest_block_numbers.rs +++ b/v2_bridges/eos_on_int/src/get_latest_block_numbers.rs @@ -1,5 +1,7 @@ use common::{core_type::CoreType, traits::DatabaseInterface, types::Result}; -use common_eos::{EosDbUtils, Incremerkles}; +use common_eos::EosDbUtils; +#[cfg(not(feature = "spring_1-0"))] +use common_eos::Incremerkles; use common_eth::{EthDbUtils, EthDbUtilsExt}; use serde::{Deserialize, Serialize}; diff --git a/v2_bridges/erc20_on_int/src/debug_functions/eth_block_reprocessor.rs b/v2_bridges/erc20_on_int/src/debug_functions/eth_block_reprocessor.rs index 21ad03942..c841fdda6 100644 --- a/v2_bridges/erc20_on_int/src/debug_functions/eth_block_reprocessor.rs +++ b/v2_bridges/erc20_on_int/src/debug_functions/eth_block_reprocessor.rs @@ -161,12 +161,12 @@ fn reprocess_eth_block( /// submission pipeline, signing any signatures for pegouts it may find in the block /// /// ### NOTES: -/// - This function will increment the core's ETH nonce, meaning the outputted reports will have a -/// gap in their report IDs! +/// - This function will increment the core's ETH nonce, meaning the outputted reports will have a gap in their report +/// IDs! /// -/// - This version of the ETH block reprocessor __will__ deduct fees from any transaction info(s) it -/// parses from the submitted block, but it will __not__ accrue those fees on to the total in the -/// dictionary. This is to avoid accounting for fees twice. +/// - This version of the ETH block reprocessor __will__ deduct fees from any transaction info(s) it parses from the +/// submitted block, but it will __not__ accrue those fees on to the total in the dictionary. This is to avoid +/// accounting for fees twice. /// /// ### BEWARE: /// If you don't broadcast the transaction outputted from this function, ALL future ETH transactions will @@ -185,9 +185,9 @@ pub fn debug_reprocess_eth_block(db: &D, block_json: &str, /// /// - This function will NOT increment the core's ETH nonce if one is passed in! /// -/// - This version of the ETH block reprocessor __will__ deduct fees from any transaction info(s) it -/// parses from the submitted block, but it will __not__ accrue those fees on to the total in the -/// dictionary. This is to avoid accounting for fees twice. +/// - This version of the ETH block reprocessor __will__ deduct fees from any transaction info(s) it parses from the +/// submitted block, but it will __not__ accrue those fees on to the total in the dictionary. This is to avoid +/// accounting for fees twice. /// /// ### BEWARE: /// @@ -209,14 +209,13 @@ pub fn debug_reprocess_eth_block_with_nonce( /// /// ### NOTES: /// -/// - This function will increment the core's ETH nonce, meaning the outputted reports will have a -/// gap in their report IDs! +/// - This function will increment the core's ETH nonce, meaning the outputted reports will have a gap in their report +/// IDs! /// -/// - This version of the ETH block reprocessor __will__ deduct fees from any transaction info(s) it -/// parses from the submitted block, and __will__ accrue those fees on to the total in the -/// dictionary. Only use this is you know what you're doing and why, and make sure you're avoiding -/// accruing the fees twice if the block has already been processed through the non-debug ETH -/// block submission pipeline. +/// - This version of the ETH block reprocessor __will__ deduct fees from any transaction info(s) it parses from the +/// submitted block, and __will__ accrue those fees on to the total in the dictionary. Only use this is you know what +/// you're doing and why, and make sure you're avoiding accruing the fees twice if the block has already been +/// processed through the non-debug ETH block submission pipeline. /// /// ### BEWARE: /// If you don't broadcast the transaction outputted from this function, ALL future ETH transactions will diff --git a/v2_bridges/erc20_on_int/src/debug_functions/int_block_reprocessor.rs b/v2_bridges/erc20_on_int/src/debug_functions/int_block_reprocessor.rs index 000fbfbbd..7ba04fe81 100644 --- a/v2_bridges/erc20_on_int/src/debug_functions/int_block_reprocessor.rs +++ b/v2_bridges/erc20_on_int/src/debug_functions/int_block_reprocessor.rs @@ -160,12 +160,12 @@ fn reprocess_int_block( /// /// ### NOTES: /// -/// - This function will increment the core's INT nonce, meaning the outputted reports will have a -/// gap in their report IDs! +/// - This function will increment the core's INT nonce, meaning the outputted reports will have a gap in their report +/// IDs! /// -/// - This version of the INT block reprocessor __will__ deduct fees from any transaction info(s) it -/// parses from the submitted block, but it will __not__ accrue those fees on to the total in the -/// dictionary. This is to avoid accounting for fees twice. +/// - This version of the INT block reprocessor __will__ deduct fees from any transaction info(s) it parses from the +/// submitted block, but it will __not__ accrue those fees on to the total in the dictionary. This is to avoid +/// accounting for fees twice. /// /// ### BEWARE: /// If you don't broadcast the transaction outputted from this function, ALL future INT transactions will @@ -184,9 +184,9 @@ pub fn debug_reprocess_int_block(db: &D, block_json: &str, /// /// - This function will NOT increment the core's INT nonce if one is passed in! /// -/// - This version of the INT block reprocessor __will__ deduct fees from any transaction info(s) it -/// parses from the submitted block, but it will __not__ accrue those fees on to the total in the -/// dictionary. This is to avoid accounting for fees twice. +/// - This version of the INT block reprocessor __will__ deduct fees from any transaction info(s) it parses from the +/// submitted block, but it will __not__ accrue those fees on to the total in the dictionary. This is to avoid +/// accounting for fees twice. /// /// ### BEWARE: /// @@ -208,14 +208,13 @@ pub fn debug_reprocess_int_block_with_nonce( /// /// ### NOTES: /// -/// - This function will increment the core's INT nonce, meaning the outputted reports will have a -/// gap in their report IDs! +/// - This function will increment the core's INT nonce, meaning the outputted reports will have a gap in their report +/// IDs! /// -/// - This version of the INT block reprocessor __will__ deduct fees from any transaction info(s) it -/// parses from the submitted block, and __will__ accrue those fees on to the total in the -/// dictionary. Only use this is you know what you're doing and why, and make sure you're avoiding -/// accruing the fees twice if the block has already been processed through the non-debug INT -/// block submission pipeline. +/// - This version of the INT block reprocessor __will__ deduct fees from any transaction info(s) it parses from the +/// submitted block, and __will__ accrue those fees on to the total in the dictionary. Only use this is you know what +/// you're doing and why, and make sure you're avoiding accruing the fees twice if the block has already been +/// processed through the non-debug INT block submission pipeline. /// /// ### BEWARE: /// If you don't broadcast the transaction outputted from this function, ALL future INT transactions will diff --git a/v2_bridges/int_on_eos/src/eos/get_eos_output.rs b/v2_bridges/int_on_eos/src/eos/get_eos_output.rs index b8a3dabce..de4690e81 100644 --- a/v2_bridges/int_on_eos/src/eos/get_eos_output.rs +++ b/v2_bridges/int_on_eos/src/eos/get_eos_output.rs @@ -112,7 +112,6 @@ use std::str::FromStr; #[cfg(test)] use common::errors::AppError; #[cfg(test)] -#[cfg(test)] impl FromStr for EosOutput { type Err = AppError; diff --git a/v2_bridges/int_on_eos/src/eos/submit_eos_block.rs b/v2_bridges/int_on_eos/src/eos/submit_eos_block.rs index 9292c75d3..c75a0f35a 100644 --- a/v2_bridges/int_on_eos/src/eos/submit_eos_block.rs +++ b/v2_bridges/int_on_eos/src/eos/submit_eos_block.rs @@ -1,4 +1,6 @@ use common::{traits::DatabaseInterface, types::Result, CoreType}; +#[cfg(not(feature = "spring_1-0"))] +use common_eos::Incremerkles; use common_eos::{ end_eos_db_transaction_and_return_state, get_active_schedule_from_db_and_add_to_state, @@ -16,7 +18,6 @@ use common_eos::{ validate_block_header_signature, validate_producer_slot_of_block_in_state, EosState, - Incremerkles, }; use crate::eos::{ @@ -113,16 +114,14 @@ mod tests { use common::test_utils::get_test_database; use common_chain_ids::{EosChainId, EthChainId}; - use common_eos::{initialize_eos_core_inner, EosPrivateKey, EosSubmissionMaterial, ProcessedGlobalSequences}; + use common_eos::{initialize_eos_core_inner, EosPrivateKey, ProcessedGlobalSequences}; use common_eth::{ - initialize_eth_core_with_router_contract_and_return_state, initialize_eth_core_with_vault_and_router_contracts_and_return_state, EthDbUtils, EthDbUtilsExt, EthState as IntState, VaultUsingCores, }; - use ethereum_types::Address as EthAddress; use serde_json::json; use super::*; @@ -141,12 +140,6 @@ mod tests { get_sample_int_private_key, get_sample_router_address, get_sample_vault_address, - multi_incremerkle_submission::{ - get_incremekle_update_block, - get_init_block, - get_sample_dictionary as get_sample_dictionary_for_incremerkle_test, - get_submission_block, - }, }, }; @@ -395,7 +388,17 @@ mod tests { #[cfg(not(feature = "spring_1-0"))] mod legacy_blocks { + use common_eos::EosSubmissionMaterial; + use common_eth::initialize_eth_core_with_router_contract_and_return_state; + use ethereum_types::Address as EthAddress; + use super::*; + use crate::test_utils::multi_incremerkle_submission::{ + get_incremekle_update_block, + get_init_block, + get_sample_dictionary as get_sample_dictionary_for_incremerkle_test, + get_submission_block, + }; #[test] fn should_submit_eos_block_1() { diff --git a/v2_bridges/int_on_eos/src/get_latest_block_numbers.rs b/v2_bridges/int_on_eos/src/get_latest_block_numbers.rs index c0f40ce76..d29122861 100644 --- a/v2_bridges/int_on_eos/src/get_latest_block_numbers.rs +++ b/v2_bridges/int_on_eos/src/get_latest_block_numbers.rs @@ -1,5 +1,7 @@ use common::{core_type::CoreType, traits::DatabaseInterface, types::Result}; -use common_eos::{EosDbUtils, Incremerkles}; +use common_eos::EosDbUtils; +#[cfg(not(feature = "spring_1-0"))] +use common_eos::Incremerkles; use common_eth::{EthDbUtils, EthDbUtilsExt}; use serde::{Deserialize, Serialize}; diff --git a/v2_bridges/int_on_eos/src/test_utils/multi_incremerkle_submission/mod.rs b/v2_bridges/int_on_eos/src/test_utils/multi_incremerkle_submission/mod.rs index f1f7e7de9..1af332c0e 100644 --- a/v2_bridges/int_on_eos/src/test_utils/multi_incremerkle_submission/mod.rs +++ b/v2_bridges/int_on_eos/src/test_utils/multi_incremerkle_submission/mod.rs @@ -1,4 +1,4 @@ -#![cfg(test)] +#![cfg(all(test, not(feature = "spring_1-0")))] use std::fs::read_to_string; use common::dictionaries::eos_eth::{ diff --git a/v2_bridges/int_on_evm/src/debug_functions/evm_block_reprocessor.rs b/v2_bridges/int_on_evm/src/debug_functions/evm_block_reprocessor.rs index 3109be64b..5f1011ffa 100644 --- a/v2_bridges/int_on_evm/src/debug_functions/evm_block_reprocessor.rs +++ b/v2_bridges/int_on_evm/src/debug_functions/evm_block_reprocessor.rs @@ -158,12 +158,12 @@ fn reprocess_evm_block( /// /// ### NOTES: /// -/// - This function will increment the core's EVM nonce, meaning the outputted reports will have a -/// gap in their report IDs! +/// - This function will increment the core's EVM nonce, meaning the outputted reports will have a gap in their report +/// IDs! /// -/// - This version of the EVM block reprocessor __will__ deduct fees from any transaction info(s) it -/// parses from the submitted block, but it will __not__ accrue those fees on to the total in the -/// dictionary. This is to avoid accounting for fees twice. +/// - This version of the EVM block reprocessor __will__ deduct fees from any transaction info(s) it parses from the +/// submitted block, but it will __not__ accrue those fees on to the total in the dictionary. This is to avoid +/// accounting for fees twice. /// /// ### BEWARE: /// If you don't broadcast the transaction outputted from this function, ALL future EVM transactions will @@ -181,9 +181,9 @@ pub fn debug_reprocess_evm_block(db: &D, block_json: &str, /// ### NOTES: /// - This function will NOT increment the core's EVM nonce if one is passed in. /// -/// - This version of the EVM block reprocessor __will__ deduct fees from any transaction info(s) it -/// parses from the submitted block, but it will __not__ accrue those fees on to the total in the -/// dictionary. This is to avoid accounting for fees twice. +/// - This version of the EVM block reprocessor __will__ deduct fees from any transaction info(s) it parses from the +/// submitted block, but it will __not__ accrue those fees on to the total in the dictionary. This is to avoid +/// accounting for fees twice. /// /// ### BEWARE: /// @@ -205,14 +205,13 @@ pub fn debug_reprocess_evm_block_with_nonce( /// /// ### NOTES: /// -/// - This function will increment the core's EVM nonce, meaning the outputted reports will have a -/// gap in their report IDs! +/// - This function will increment the core's EVM nonce, meaning the outputted reports will have a gap in their report +/// IDs! /// -/// - This version of the EVM block reprocessor __will__ deduct fees from any transaction info(s) it -/// parses from the submitted block, and __will__ accrue those fees on to the total in the -/// dictionary. Only use this is you know what you're doing and why, and make sure you're avoiding -/// accruing the fees twice if the block has already been processed through the non-debug EVM -/// block submission pipeline. +/// - This version of the EVM block reprocessor __will__ deduct fees from any transaction info(s) it parses from the +/// submitted block, and __will__ accrue those fees on to the total in the dictionary. Only use this is you know what +/// you're doing and why, and make sure you're avoiding accruing the fees twice if the block has already been +/// processed through the non-debug EVM block submission pipeline. /// /// ### BEWARE: /// If you don't broadcast the transaction outputted from this function, ALL future EVM transactions will diff --git a/v2_bridges/int_on_evm/src/debug_functions/int_block_reprocessor.rs b/v2_bridges/int_on_evm/src/debug_functions/int_block_reprocessor.rs index d9f11922c..15044543f 100644 --- a/v2_bridges/int_on_evm/src/debug_functions/int_block_reprocessor.rs +++ b/v2_bridges/int_on_evm/src/debug_functions/int_block_reprocessor.rs @@ -161,12 +161,12 @@ fn reprocess_int_block( /// submission pipeline, signing any signatures for pegouts it may find in the block /// /// ### NOTES: -/// - This function will increment the core's INT nonce, meaning the outputted reports will have a -/// gap in their report IDs! +/// - This function will increment the core's INT nonce, meaning the outputted reports will have a gap in their report +/// IDs! /// -/// - This version of the INT block reprocessor __will__ deduct fees from any transaction info(s) it -/// parses from the submitted block, but it will __not__ accrue those fees on to the total in the -/// dictionary. This is to avoid accounting for fees twice. +/// - This version of the INT block reprocessor __will__ deduct fees from any transaction info(s) it parses from the +/// submitted block, but it will __not__ accrue those fees on to the total in the dictionary. This is to avoid +/// accounting for fees twice. /// /// ### BEWARE: /// If you don't broadcast the transaction outputted from this function, ALL future INT transactions will @@ -184,9 +184,9 @@ pub fn debug_reprocess_int_block(db: &D, block_json: &str, /// ### NOTES: /// - This function will NOT increment the core's INT nonce if one is passed in. /// -/// - This version of the INT block reprocessor __will__ deduct fees from any transaction info(s) it -/// parses from the submitted block, but it will __not__ accrue those fees on to the total in the -/// dictionary. This is to avoid accounting for fees twice. +/// - This version of the INT block reprocessor __will__ deduct fees from any transaction info(s) it parses from the +/// submitted block, but it will __not__ accrue those fees on to the total in the dictionary. This is to avoid +/// accounting for fees twice. /// /// ### BEWARE: /// @@ -208,14 +208,13 @@ pub fn debug_reprocess_int_block_with_nonce( /// /// ### NOTES: /// -/// - This function will increment the core's INT nonce, meaning the outputted reports will have a -/// gap in their report IDs! +/// - This function will increment the core's INT nonce, meaning the outputted reports will have a gap in their report +/// IDs! /// -/// - This version of the INT block reprocessor __will__ deduct fees from any transaction info(s) it -/// parses from the submitted block, and __will__ accrue those fees on to the total in the -/// dictionary. Only use this is you know what you're doing and why, and make sure you're avoiding -/// accruing the fees twice if the block has already been processed through the non-debug INT -/// block submission pipeline. +/// - This version of the INT block reprocessor __will__ deduct fees from any transaction info(s) it parses from the +/// submitted block, and __will__ accrue those fees on to the total in the dictionary. Only use this is you know what +/// you're doing and why, and make sure you're avoiding accruing the fees twice if the block has already been +/// processed through the non-debug INT block submission pipeline. /// /// ### BEWARE: /// If you don't broadcast the transaction outputted from this function, ALL future INT transactions will diff --git a/v2_bridges/vanilla_apps/pbtc-on-int/src/main.rs b/v2_bridges/vanilla_apps/pbtc-on-int/src/main.rs index f8c788572..433e5bff0 100644 --- a/v2_bridges/vanilla_apps/pbtc-on-int/src/main.rs +++ b/v2_bridges/vanilla_apps/pbtc-on-int/src/main.rs @@ -47,11 +47,11 @@ use btc_on_int::{ use common::AppError; #[cfg(feature = "file-logger")] use common_file_logger::init_logger; -#[cfg(feature = "json-rpc")] +#[cfg(feature = "json-rpc-db")] use common_jsonrpc_db::get_db; #[cfg(feature = "rocks-db")] use common_rocksdb_database::get_db; -#[cfg(feature = "stderr-logger")] +#[cfg(feature = "std-err-logger")] use common_stderr_logger::init_logger; use crate::{ diff --git a/v2_bridges/vanilla_apps/peos-on-int/src/main.rs b/v2_bridges/vanilla_apps/peos-on-int/src/main.rs index 455c96935..616df2e7b 100644 --- a/v2_bridges/vanilla_apps/peos-on-int/src/main.rs +++ b/v2_bridges/vanilla_apps/peos-on-int/src/main.rs @@ -12,11 +12,11 @@ mod usage_info; use common::AppError; #[cfg(feature = "file-logger")] use common_file_logger::init_logger; -#[cfg(feature = "json-rpc")] +#[cfg(feature = "json-rpc-db")] use common_jsonrpc_db::get_db; #[cfg(feature = "rocks-db")] use common_rocksdb_database::get_db; -#[cfg(feature = "stderr-logger")] +#[cfg(feature = "std-err-logger")] use common_stderr_logger::init_logger; use eos_on_int::{ debug_add_debug_signer, diff --git a/v2_bridges/vanilla_apps/perc20-on-int/src/main.rs b/v2_bridges/vanilla_apps/perc20-on-int/src/main.rs index 41d722b58..6aaab3d9d 100644 --- a/v2_bridges/vanilla_apps/perc20-on-int/src/main.rs +++ b/v2_bridges/vanilla_apps/perc20-on-int/src/main.rs @@ -11,11 +11,11 @@ mod usage_info; use common::AppError; #[cfg(feature = "file-logger")] use common_file_logger::init_logger; -#[cfg(feature = "json-rpc")] +#[cfg(feature = "json-rpc-db")] use common_jsonrpc_db::get_db; #[cfg(feature = "rocks-db")] use common_rocksdb_database::get_db; -#[cfg(feature = "stderr-logger")] +#[cfg(feature = "std-err-logger")] use common_stderr_logger::init_logger; use erc20_on_int::{ debug_add_debug_signer, diff --git a/v2_bridges/vanilla_apps/pint-on-algo/src/main.rs b/v2_bridges/vanilla_apps/pint-on-algo/src/main.rs index 1e13289cf..4bab438db 100644 --- a/v2_bridges/vanilla_apps/pint-on-algo/src/main.rs +++ b/v2_bridges/vanilla_apps/pint-on-algo/src/main.rs @@ -11,11 +11,11 @@ mod usage_info; use common::AppError; #[cfg(feature = "file-logger")] use common_file_logger::init_logger; -#[cfg(feature = "json-rpc")] +#[cfg(feature = "json-rpc-db")] use common_jsonrpc_db::get_db; #[cfg(feature = "rocks-db")] use common_rocksdb_database::get_db; -#[cfg(feature = "stderr-logger")] +#[cfg(feature = "std-err-logger")] use common_stderr_logger::init_logger; use int_on_algo::{ debug_add_debug_signer, diff --git a/v2_bridges/vanilla_apps/pint-on-eos/src/main.rs b/v2_bridges/vanilla_apps/pint-on-eos/src/main.rs index b2806fbc4..ffb222e2a 100644 --- a/v2_bridges/vanilla_apps/pint-on-eos/src/main.rs +++ b/v2_bridges/vanilla_apps/pint-on-eos/src/main.rs @@ -11,11 +11,11 @@ mod usage_info; use common::AppError; #[cfg(feature = "file-logger")] use common_file_logger::init_logger; -#[cfg(feature = "json-rpc")] +#[cfg(feature = "json-rpc-db")] use common_jsonrpc_db::get_db; #[cfg(feature = "rocks-db")] use common_rocksdb_database::get_db; -#[cfg(feature = "stderr-logger")] +#[cfg(feature = "std-err-logger")] use common_stderr_logger::init_logger; use int_on_eos::{ debug_add_debug_signer, diff --git a/v2_bridges/vanilla_apps/pint-on-evm/src/main.rs b/v2_bridges/vanilla_apps/pint-on-evm/src/main.rs index 55334be06..d7935dde0 100644 --- a/v2_bridges/vanilla_apps/pint-on-evm/src/main.rs +++ b/v2_bridges/vanilla_apps/pint-on-evm/src/main.rs @@ -11,11 +11,11 @@ mod usage_info; use common::AppError; #[cfg(feature = "file-logger")] use common_file_logger::init_logger; -#[cfg(feature = "json-rpc")] +#[cfg(feature = "json-rpc-db")] use common_jsonrpc_db::get_db; #[cfg(feature = "rocks-db")] use common_rocksdb_database::get_db; -#[cfg(feature = "stderr-logger")] +#[cfg(feature = "std-err-logger")] use common_stderr_logger::init_logger; use int_on_evm::{ debug_add_debug_signer,