diff --git a/Cargo.lock b/Cargo.lock index d492522..0b1a618 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -320,6 +320,16 @@ dependencies = [ "inout", ] +[[package]] +name = "colored" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cbf2150cce219b664a8a70df7a1f933836724b503f8a413af9365b4dcc4d90b8" +dependencies = [ + "lazy_static", + "windows-sys 0.48.0", +] + [[package]] name = "concurrent-queue" version = "2.4.0" @@ -2805,6 +2815,7 @@ name = "unit_tests" version = "0.1.0" dependencies = [ "anyhow", + "colored", "env_logger", "flate2", "jsonrpsee", diff --git a/macro_utils/Cargo.toml b/macro_utils/Cargo.toml index 9b4900b..72af1f9 100644 --- a/macro_utils/Cargo.toml +++ b/macro_utils/Cargo.toml @@ -16,4 +16,4 @@ url = "2.5.0" syn = "2.0.48" quote = "1.0.35" tokio = { version = "1", features = ["full"] } -lazy_static = "1.4.0" \ No newline at end of file +lazy_static = "1.4.0" diff --git a/unit_tests/Cargo.toml b/unit_tests/Cargo.toml index 4775814..036972d 100644 --- a/unit_tests/Cargo.toml +++ b/unit_tests/Cargo.toml @@ -20,6 +20,7 @@ macro_utils = { path = "../macro_utils/" } rand = "0.8.5" serde_json = "1.0" once_cell = "1.8.0" +colored = "2.0" [dev-dependencies] jsonrpsee = { version = "0.21.0", features = ["client"] } diff --git a/unit_tests/src/constants.rs b/unit_tests/src/constants.rs index 5d9d926..6f03bc2 100644 --- a/unit_tests/src/constants.rs +++ b/unit_tests/src/constants.rs @@ -163,3 +163,4 @@ pub const ERR_PATHFINDER: &str = "Error waiting for response from Pathfinder cli pub const SPEC_0_5_1: &str = "0.5.1"; pub const SPEC_0_6_0: &str = "0.6.0"; pub const SPEC_0_7_0: &str = "0.7.0"; +pub const SPEC_0_7_1: &str = "0.7.1"; diff --git a/unit_tests/tests/common.rs b/unit_tests/tests/common.rs index ebed895..8c90218 100644 --- a/unit_tests/tests/common.rs +++ b/unit_tests/tests/common.rs @@ -50,4 +50,4 @@ pub fn get_block_setting() -> BlockId { Err(_) => BlockId::Number(100000), }, } -} +} \ No newline at end of file diff --git a/unit_tests/tests/test_block_hash_and_number.rs b/unit_tests/tests/test_block_hash_and_number.rs index a3f90c7..cd91544 100644 --- a/unit_tests/tests/test_block_hash_and_number.rs +++ b/unit_tests/tests/test_block_hash_and_number.rs @@ -1,5 +1,6 @@ mod common; use common::*; +use starknet_core::types::BlockHashAndNumber; use std::collections::HashMap; @@ -8,6 +9,8 @@ use starknet_providers::{ Provider, }; +use colored::*; + /// /// Unit test for `starknet_BlockHashAndNumber` /// @@ -16,24 +19,121 @@ use starknet_providers::{ /// #[rstest] #[tokio::test] -#[ignore = "Slash this ignore when Deoxys node is fully synced"] -async fn work_latest_block(clients: HashMap>) { +async fn work_existing_block(clients: HashMap>) { let deoxys = &clients[DEOXYS]; let pathfinder = &clients[PATHFINDER]; + let juno = &clients[JUNO]; - let response_deoxys = deoxys + let deoxys_responce = deoxys .block_hash_and_number() .await - .expect("Error waiting for response from Deoxys node"); - let response_pathfinder = pathfinder + .expect("Deoxys : Error while getting the block number"); + let pathfinder_responce = pathfinder .block_hash_and_number() .await - .expect("Error waiting for response from Deoxys node"); - let response_expected = deoxys - .block_number() + .expect("RPC : Error while getting the block number"); + let juno_responce = juno + .block_hash_and_number() .await - .expect("Error waiting for response from Deoxys node"); + .expect("Juno : Error while getting the block number"); + + assert!(deoxys_responce.block_number > 0); + assert!(pathfinder_responce.block_number > 0); + assert!(juno_responce.block_number > 0); + + if !check_block_number(deoxys_responce.clone(), pathfinder_responce.clone(), juno_responce.clone()) { + println!("{}", "\nMismatch on Block numbers are skipped since it may not be an error.".green().bold()); + } + + if !check_block_hashes(deoxys_responce, pathfinder_responce, juno_responce) { + println!("{}", "\nMismatch on Block hashes are skipped since it may not be an error.".green().bold()); + } +} + +fn check_block_number(responce_deoxys: BlockHashAndNumber, responce_pathfinder: BlockHashAndNumber, responce_juno: BlockHashAndNumber) -> bool { + let deoxys_block_number = responce_deoxys.block_number; + let pathfinder_block_number = responce_pathfinder.block_number; + let juno_block_number = responce_juno.block_number; + + if deoxys_block_number != pathfinder_block_number || pathfinder_block_number != juno_block_number || juno_block_number != deoxys_block_number { + println!("{}", "Block number mismatch detected\n".red().bold()); + println!("Deoxys: {}", format!("{}", deoxys_block_number).cyan().bold()); + println!("Pathfinder: {}", format!("{}", pathfinder_block_number).magenta().bold()); + println!("Juno: {}\n", format!("{}", juno_block_number).green().bold()); + + if deoxys_block_number != pathfinder_block_number { + println!( + "{} {} != {}", + "Mismatch between Deoxys and Pathfinder:".red(), + deoxys_block_number.to_string().yellow().bold(), + pathfinder_block_number.to_string().yellow().bold() + ); + } + if pathfinder_block_number != juno_block_number { + println!( + "{} {} != {}", + "Mismatch between Pathfinder and Juno:".red(), + pathfinder_block_number.to_string().yellow().bold(), + juno_block_number.to_string().yellow().bold() + ); + } + if juno_block_number != deoxys_block_number { + println!( + "{} {} != {}", + "Mismatch between Juno and Deoxys:".red(), + juno_block_number.to_string().yellow().bold(), + deoxys_block_number.to_string().yellow().bold() + ); + } + + return false; + } else { + println!("{}", "All nodes have matching block numbers".green().bold()); + return true; + } + +} + +fn check_block_hashes(responce_deoxys: BlockHashAndNumber, responce_pathfinder: BlockHashAndNumber, responce_juno: BlockHashAndNumber) -> bool { + let deoxys_block_hash = responce_deoxys.block_hash; + let pathfinder_block_hash = responce_pathfinder.block_hash; + let juno_block_hash = responce_juno.block_hash; + + if deoxys_block_hash != pathfinder_block_hash || pathfinder_block_hash != juno_block_hash || juno_block_hash != deoxys_block_hash { + println!("{}", "Block hash mismatch detected\n".red().bold()); + println!("Deoxys: {}", format!("0x{:x}", deoxys_block_hash).cyan().bold()); + println!("Pathfinder: {}", format!("0x{:x}", pathfinder_block_hash).magenta().bold()); + println!("Juno: {}\n", format!("0x{:x}", juno_block_hash).green().bold()); + + if deoxys_block_hash != pathfinder_block_hash { + println!( + "{} {} != {}", + "Mismatch between Deoxys and Pathfinder:".red(), + format!("0x{:x}", deoxys_block_hash).yellow().bold(), + format!("0x{:x}", pathfinder_block_hash).yellow().bold() + ); + } + if pathfinder_block_hash != juno_block_hash { + println!( + "{} {} != {}", + "Mismatch between Pathfinder and Juno:".red(), + format!("0x{:x}", pathfinder_block_hash).yellow().bold(), + format!("0x{:x}", juno_block_hash).yellow().bold() + ); + } + if juno_block_hash != deoxys_block_hash { + println!( + "{} {} != {}", + "Mismatch between Juno and Deoxys:".red(), + format!("0x{:x}", juno_block_hash).yellow().bold(), + format!("0x{:x}", deoxys_block_hash).yellow().bold() + ); + } + + return false; + } else { + println!("{}", "All nodes have matching block hashes".green().bold()); + return true; + } - assert_eq!(response_deoxys.block_number, response_expected); - assert_eq!(response_deoxys, response_pathfinder); } diff --git a/unit_tests/tests/test_block_number.rs b/unit_tests/tests/test_block_number.rs index 762d439..54977e0 100644 --- a/unit_tests/tests/test_block_number.rs +++ b/unit_tests/tests/test_block_number.rs @@ -7,6 +7,7 @@ use starknet_providers::{ jsonrpc::{HttpTransport, JsonRpcClient}, Provider, }; +use colored::*; // Add this import for colored output /// /// Unit test for `starknet_blockNumber` @@ -16,10 +17,10 @@ use starknet_providers::{ /// #[rstest] #[tokio::test] -#[ignore = "Slash this ignore when Deoxys node is fully synced"] async fn work_existing_block(clients: HashMap>) { let deoxys = &clients[DEOXYS]; let pathfinder = &clients[PATHFINDER]; + let juno = &clients[JUNO]; let response_deoxys = deoxys .block_number() @@ -29,7 +30,53 @@ async fn work_existing_block(clients: HashMap 0); - assert_eq!(response_deoxys, response_pathfinder); + assert!(response_pathfinder > 0); + assert!(response_juno > 0); + + let mut mismatch = false; + + if response_deoxys != response_pathfinder || response_pathfinder != response_juno || response_juno != response_deoxys { + mismatch = true; + println!("{}", "Block number mismatch detected\n".red().bold()); + println!("Deoxys: {}", format!("{}", response_deoxys).cyan().bold()); + println!("Pathfinder: {}", format!("{}", response_pathfinder).magenta().bold()); + println!("Juno: {}\n", format!("{}", response_juno).green().bold()); + + if response_deoxys != response_pathfinder { + println!( + "{} {} != {}", + "Mismatch between Deoxys and Pathfinder:".red(), + response_deoxys.to_string().yellow().bold(), + response_pathfinder.to_string().yellow().bold() + ); + } + if response_pathfinder != response_juno { + println!( + "{} {} != {}", + "Mismatch between Pathfinder and Juno:".red(), + response_pathfinder.to_string().yellow().bold(), + response_juno.to_string().yellow().bold() + ); + } + if response_juno != response_deoxys { + println!( + "{} {} != {}", + "Mismatch between Juno and Deoxys:".red(), + response_juno.to_string().yellow().bold(), + response_deoxys.to_string().yellow().bold() + ); + } + } else { + println!("{}", "All nodes have matching block numbers".green().bold()); + } + + if mismatch { + println!("{}", "\nMismatch on Block numbers are skipped since it may not be an error.".green().bold()); + } } diff --git a/unit_tests/tests/test_chain_id.rs b/unit_tests/tests/test_chain_id.rs index f00230f..0b08094 100644 --- a/unit_tests/tests/test_chain_id.rs +++ b/unit_tests/tests/test_chain_id.rs @@ -21,6 +21,8 @@ async fn chain_id(clients: HashMap>) { .await .expect("Error while getting chain id from deoxys"); + log::info!("response_deoxys: {:?}", response_deoxys); + let response_pathfinder = pathfinder .chain_id() .await diff --git a/unit_tests/tests/test_get_block_transaction_count.rs b/unit_tests/tests/test_get_block_transaction_count.rs index f8db248..737c9e4 100644 --- a/unit_tests/tests/test_get_block_transaction_count.rs +++ b/unit_tests/tests/test_get_block_transaction_count.rs @@ -46,6 +46,7 @@ async fn fail_non_existing_block(clients: HashMap>) { let deoxys = &clients[DEOXYS]; let pathfinder = &clients[PATHFINDER]; + let juno = &clients[JUNO]; let block_tag = BlockId::Tag(BlockTag::Latest); @@ -59,12 +60,20 @@ async fn work_with_latest_block(clients: HashMap, pathfinder: JsonRpcClient, + juno: JsonRpcClient, block_number: u64, ) { let block_number = BlockId::Number(block_number); @@ -79,7 +88,14 @@ async fn work_with_block( .await .expect("Error waiting for response from Pathfinder node"); + let response_juno = juno + .get_block_transaction_count(block_number) + .await + .expect("Error waiting for response from Juno node"); + + assert_eq!(response_juno, response_deoxys); assert_eq!(response_deoxys, response_pathfinder); + assert_eq!(response_pathfinder, response_juno); } #[rstest] @@ -87,8 +103,9 @@ async fn work_with_block( async fn work_with_block_1( deoxys: JsonRpcClient, pathfinder: JsonRpcClient, + juno: JsonRpcClient ) { - work_with_block(deoxys, pathfinder, 1).await; + work_with_block(deoxys, pathfinder, juno, 1).await; } #[rstest] @@ -96,6 +113,7 @@ async fn work_with_block_1( async fn work_with_block_1_hash(clients: HashMap>) { let deoxys = &clients[DEOXYS]; let pathfinder = &clients[PATHFINDER]; + let juno = &clients[JUNO]; let block_hash = BlockId::Hash( FieldElement::from_hex_be( @@ -114,7 +132,14 @@ async fn work_with_block_1_hash(clients: HashMap, pathfinder: JsonRpcClient, + juno: JsonRpcClient ) { - work_with_block(deoxys, pathfinder, 1).await; + work_with_block(deoxys, pathfinder, juno, 1).await; } #[rstest] @@ -131,8 +157,9 @@ async fn work_with_block_5066( async fn work_with_block_100_000( deoxys: JsonRpcClient, pathfinder: JsonRpcClient, + juno: JsonRpcClient ) { - work_with_block(deoxys, pathfinder, 100_000).await; + work_with_block(deoxys, pathfinder, juno, 100_000).await; } #[rstest] @@ -140,6 +167,7 @@ async fn work_with_block_100_000( async fn work_with_block_100_000_hash(clients: HashMap>) { let deoxys = &clients[DEOXYS]; let pathfinder = &clients[PATHFINDER]; + let juno = &clients[JUNO]; let block_hash = BlockId::Hash( FieldElement::from_hex_be( @@ -158,7 +186,14 @@ async fn work_with_block_100_000_hash(clients: HashMap bool { + let mut exception_found = false; + + match (value1, value2) { + (Value::Object(map1), Value::Object(map2)) => { + for key in map1.keys().chain(map2.keys()).collect::>() { + let new_path = format!("{}/{}", path, key); + match (map1.get(key), map2.get(key)) { + (Some(v1), Some(v2)) => { + if compare_json_values(&new_path, v1, v2) { + exception_found = true; + } + } + (Some(v1), None) => println!("{}: present in first, absent in second", new_path), + (None, Some(v2)) => println!("{}: absent in first, present in second", new_path), + (None, None) => unreachable!(), + } + } + } + (Value::Array(arr1), Value::Array(arr2)) => { + for (index, (item1, item2)) in arr1.iter().zip(arr2.iter()).enumerate() { + let new_path = format!("{}[{}]", path, index); + if compare_json_values(&new_path, item1, item2) { + exception_found = true; + } + } + if arr1.len() > arr2.len() { + for index in arr2.len()..arr1.len() { + println!("{}[{}]: present in first, absent in second", path, index); + } + } else if arr2.len() > arr1.len() { + for index in arr1.len()..arr2.len() { + println!("{}[{}]: absent in first, present in second", path, index); + } + } + } + _ => { + if value1 != value2 { + let exception_paths = [ + "/l1_data_gas_price/price_in_fri", + "/l1_data_gas_price/price_in_wei" + ]; + + if exception_paths.contains(&path) { + println!("{} - Bypassed as exception", format!("{}: {:?} != {:?}", path, value1, value2).yellow()); + exception_found = true; + } else { + println!("{}: {:?} != {:?}", path, value1, value2); + } + } + } + } + + exception_found +} + /// /// Unit test for `starknet_get_block_with_tx_hashes` /// @@ -59,7 +118,7 @@ async fn work_existing_block(clients: HashMap block, @@ -83,7 +142,21 @@ async fn work_existing_block(clients: HashMap block, + MaybePendingBlockWithTxHashes::PendingBlock(_) => { + panic!("Expected block, got pending block") + } + }; + let block_pathfinder = match response_pathfinder { + MaybePendingBlockWithTxHashes::Block(block) => block, + MaybePendingBlockWithTxHashes::PendingBlock(_) => { + panic!("Expected block, got pending block") + } + }; + + // Convert the blocks to JSON values + let block_deoxys_json: Value = serde_json::to_value(&block_deoxys).expect("Failed to convert deoxys block to JSON"); + let block_pathfinder_json: Value = serde_json::to_value(&block_pathfinder).expect("Failed to convert pathfinder block to JSON"); + + // Compare the JSON values and print differences if they don't match + if block_deoxys_json != block_pathfinder_json { + println!("{}", format!("Block does not match differences found\n").red().bold()); + let exception_found = compare_json_values("", &block_deoxys_json, &block_pathfinder_json); + + if !exception_found { + panic!("Blocks do not match"); + } else { + println!("\nMismatch skipped: {}", format!("field exception found").green().bold()); + } + } } /// block 1 @@ -209,7 +308,26 @@ async fn work_loop(deoxys: JsonRpcClient, pathfinder: JsonRpcClie match response_pathfinder { Ok(response_pathfinder) => { if response_deoxys != response_pathfinder { - Err(format!("block {}", block_id)) + // Convert the blocks to JSON values + let block_deoxys_json: Value = serde_json::to_value(&response_deoxys) + .expect("Failed to convert deoxys block to JSON"); + let block_pathfinder_json: Value = serde_json::to_value(&response_pathfinder) + .expect("Failed to convert pathfinder block to JSON"); + + // Compare the JSON values and print differences + println!("Blocks for block {} do not match. Differences:", block_id); + let exception_found = compare_json_values( + "", + &block_deoxys_json, + &block_pathfinder_json, + ); + + if !exception_found { + Err(format!("block {}", block_id)) + } else { + println!("{}", "Test passed with exceptions".green()); + Ok(()) + } } else { Ok(()) } diff --git a/unit_tests/tests/test_spec_version.rs b/unit_tests/tests/test_spec_version.rs new file mode 100644 index 0000000..cb07e43 --- /dev/null +++ b/unit_tests/tests/test_spec_version.rs @@ -0,0 +1,41 @@ +#![feature(assert_matches)] + +mod common; +use std::collections::HashMap; + +use common::*; +use starknet_providers::{jsonrpc::HttpTransport, JsonRpcClient, Provider}; +use colored::*; + +/// +/// Unit test for `starknet_specversion` +/// +/// Purpose: Retrieve the Deoxys node spec version +/// Success case: Spec version should be 0.7.1 +/// +#[rstest] +#[tokio::test] +async fn test_spec_version_7_1(clients: HashMap>) { + let deoxys = &clients[DEOXYS]; + let pathfinder = &clients[PATHFINDER]; + let juno = &clients[JUNO]; + + let response_deoxys = deoxys + .spec_version() + .await + .expect("Deoxys: Error while getting the block number"); + let response_pathfinder = pathfinder + .spec_version() + .await + .expect("RPC: Error while getting the block number"); + let response_juno = juno + .spec_version() + .await + .expect("Juno: Error while getting the block number"); + + assert_eq!(response_deoxys, SPEC_0_7_1, "Deoxys spec version mismatch"); + assert_eq!(response_pathfinder, SPEC_0_7_0, "Pathfinder spec version mismatch"); + assert_eq!(response_juno, SPEC_0_7_1, "Juno spec version mismatch"); + + println!("Spec version matches for all clients: {}", format!("0.7.1").green().bold()); +} diff --git a/unit_tests/tests/test_specversion.rs b/unit_tests/tests/test_specversion.rs deleted file mode 100644 index c60aa8a..0000000 --- a/unit_tests/tests/test_specversion.rs +++ /dev/null @@ -1,21 +0,0 @@ -#![feature(assert_matches)] - -mod common; -use common::*; -use starknet_providers::{jsonrpc::HttpTransport, JsonRpcClient, Provider}; - -/// -/// Unit test for `starknet_specversion` -/// -/// purpose: retrieve the Deoxys node spec version -/// success case: spec version should be 0.7.0 -/// -#[rstest] -#[tokio::test] -#[logging] -async fn test_specversion(deoxys: JsonRpcClient) { - let response_deoxys = deoxys.spec_version().await.expect(ERR_DEOXYS); - - log::info!("Deoxys RPC spec: {}", response_deoxys); - assert_eq!(response_deoxys, SPEC_0_7_0); -} diff --git a/unit_tests/tests/test_syncing.rs b/unit_tests/tests/test_syncing.rs index b03e8b6..cb22104 100644 --- a/unit_tests/tests/test_syncing.rs +++ b/unit_tests/tests/test_syncing.rs @@ -4,6 +4,7 @@ use common::*; use starknet_core::types::SyncStatusType; use starknet_providers::{jsonrpc::HttpTransport, JsonRpcClient, Provider}; use std::collections::HashMap; +use colored::*; /// /// Unit test for `starknet_syncing` @@ -16,6 +17,7 @@ use std::collections::HashMap; async fn syncing(clients: HashMap>) { let deoxys = &clients[DEOXYS]; let pathfinder = &clients[PATHFINDER]; + let node_c = &clients[JUNO]; let response_deoxys = deoxys .syncing() @@ -27,12 +29,96 @@ async fn syncing(clients: HashMap>) { .await .expect("Error while getting sync status from pathfinder node"); - assert!(compare_sync_status(response_deoxys, response_pathfinder)); + let response_node_c = node_c + .syncing() + .await + .expect("Error while getting sync status from juno node"); + + assert_sync_status(response_deoxys, response_pathfinder, response_node_c); +} + +/// Assert and print detailed differences between three SyncStatusType +fn assert_sync_status(a: SyncStatusType, b: SyncStatusType, c: SyncStatusType) { + let ab_sync_status_match = compare_sync_status(&a, &b); + let bc_sync_status_match = compare_sync_status(&b, &c); + let ca_sync_status_match = compare_sync_status(&c, &a); + + if !ab_sync_status_match || !bc_sync_status_match || !ca_sync_status_match { + println!("{}", "Sync status mismatch detected\n".red().bold()); + println!("- Deoxys: {}", format!("{:?}", a).cyan().bold()); + println!("- Pathfinder: {}", format!("{:?}", b).magenta().bold()); + println!("- Juno: {}\n", format!("{:?}", c).green().bold()); + + let nodes = vec![("Deoxys", &a), ("Pathfinder", &b), ("Juno", &c)]; + for i in 0..nodes.len() { + for j in (i + 1)..nodes.len() { + let (name1, status1) = &nodes[i]; + let (name2, status2) = &nodes[j]; + if !compare_sync_status(status1, status2) { + match (status1, status2) { + (SyncStatusType::Syncing(sync1), SyncStatusType::Syncing(sync2)) => { + if sync1.current_block_num != sync2.current_block_num { + println!( + "{}: {} {} != {} {}", + "Current block number mismatch".red(), + name1, + sync1.current_block_num.to_string().yellow().bold(), + sync2.current_block_num.to_string().yellow().bold(), + name2 + ); + } + if sync1.current_block_hash != sync2.current_block_hash { + println!( + "{}: {} {} != {} {}", + "Current block hash mismatch:".red(), + name1, + format!("0x{:x}", sync1.current_block_hash).yellow().bold(), + format!("0x{:x}", sync2.current_block_hash).yellow().bold(), + name2 + ); + } + if sync1.highest_block_num != sync2.highest_block_num { + println!( + "{}: {} {} != {}", + "Highest block number mismatch:".red(), + name1, + sync1.highest_block_num.to_string().yellow().bold(), + sync2.highest_block_num.to_string().yellow().bold() + ); + } + if sync1.highest_block_hash != sync2.highest_block_hash { + println!( + "{}: {} {} != {} {}", + "Highest block hash mismatch:".red(), + name1, + format!("0x{:x}", sync1.highest_block_hash).yellow().bold(), + format!("0x{:x}", sync2.highest_block_hash).yellow().bold(), + name2 + ); + } + if sync1.current_block_num != sync2.current_block_num { + println!("Mismatch skipped: {}", "Nodes are not on the same height".green().bold()); + } + }, + (SyncStatusType::Syncing(_), SyncStatusType::NotSyncing) => { + println!("Mismatch skipped: {}", format!("Node {} is not syncing.", name2).green().bold()); + }, + (SyncStatusType::NotSyncing, SyncStatusType::Syncing(_)) => { + println!("Mismatch skipped: {}", format!("Node {} is not syncing.", name1).green().bold()); + }, + _ => { + panic!("Mismatch detected: {}", "starknet_syncing mismatch".red().bold()); + } + } + } + } + } + } } /// compare 2 SyncStatus, only fields corresponding to current and highest block are compared /// because the other fields are not deterministic and depend on restart of the node -fn compare_sync_status(a: SyncStatusType, b: SyncStatusType) -> bool { +fn compare_sync_status(a: &SyncStatusType, b: &SyncStatusType) -> bool { match (a, b) { (SyncStatusType::Syncing(a), SyncStatusType::Syncing(b)) => { a.current_block_num == b.current_block_num