From 5114bcee25c1a897cd056c300b38c4aad0b57010 Mon Sep 17 00:00:00 2001 From: idky137 Date: Fri, 6 Sep 2024 00:39:47 +0100 Subject: [PATCH] updated prints --- integration-tests/tests/integrations.rs | 33 +++++++++--------- zaino-nym/src/client.rs | 2 -- zaino-serve/src/rpc/service.rs | 45 ++++++++++++------------- zaino-testutils/src/lib.rs | 23 ++++--------- zainod/src/indexer.rs | 2 +- 5 files changed, 44 insertions(+), 61 deletions(-) diff --git a/integration-tests/tests/integrations.rs b/integration-tests/tests/integrations.rs index 3ad7008..b0f34f6 100644 --- a/integration-tests/tests/integrations.rs +++ b/integration-tests/tests/integrations.rs @@ -19,10 +19,7 @@ mod wallet_basic { let zingo_client = test_manager.build_lightclient().await; let lightd_info = zingo_client.do_info().await; - println!( - "@zingoindexertest: Lightd_info response:\n{:#?}.", - lightd_info - ); + println!("[TEST LOG] Lightd_info response:\n{:#?}.", lightd_info); drop_test_manager( Some(test_manager.temp_conf_dir.path().to_path_buf()), @@ -53,7 +50,7 @@ mod wallet_basic { zingo_client.do_sync(false).await.unwrap(); let balance = zingo_client.do_balance().await; - println!("@zingoindexertest: zingo_client balance: \n{:#?}.", balance); + println!("[TEST LOG] zingo_client balance: \n{:#?}.", balance); assert_eq!(balance.orchard_balance.unwrap(), 1_875_000_000); drop_test_manager( @@ -85,7 +82,7 @@ mod wallet_basic { zingo_client.do_sync(false).await.unwrap(); let balance = zingo_client.do_balance().await; - println!("@zingoindexertest: zingo_client balance: \n{:#?}.", balance); + println!("[TEST LOG] zingo_client balance: \n{:#?}.", balance); assert_eq!(balance.sapling_balance.unwrap(), 250_000); drop_test_manager( @@ -117,7 +114,7 @@ mod wallet_basic { zingo_client.do_sync(false).await.unwrap(); let balance = zingo_client.do_balance().await; - println!("@zingoindexertest: zingo_client balance: \n{:#?}.", balance); + println!("[TEST LOG] zingo_client balance: \n{:#?}.", balance); assert_eq!(balance.transparent_balance.unwrap(), 250_000); drop_test_manager( @@ -165,7 +162,7 @@ mod wallet_basic { zingo_client.do_sync(false).await.unwrap(); let balance = zingo_client.do_balance().await; - println!("@zingoindexertest: zingo_client balance: \n{:#?}.", balance); + println!("[TEST LOG] zingo_client balance: \n{:#?}.", balance); assert_eq!(balance.orchard_balance.unwrap(), 2_499_500_000); assert_eq!(balance.sapling_balance.unwrap(), 250_000); assert_eq!(balance.transparent_balance.unwrap(), 250_000); @@ -199,7 +196,7 @@ mod wallet_basic { zingo_client.do_sync(false).await.unwrap(); let balance = zingo_client.do_balance().await; - println!("@zingoindexertest: zingo_client balance: \n{:#?}.", balance); + println!("[TEST LOG] zingo_client balance: \n{:#?}.", balance); assert_eq!(balance.sapling_balance.unwrap(), 250_000); zingo_client @@ -210,7 +207,7 @@ mod wallet_basic { zingo_client.do_sync(false).await.unwrap(); let balance = zingo_client.do_balance().await; - println!("@zingoindexertest: zingo_client balance: \n{:#?}.", balance); + println!("[TEST LOG] zingo_client balance: \n{:#?}.", balance); assert_eq!(balance.sapling_balance.unwrap(), 0); assert_eq!(balance.orchard_balance.unwrap(), 2_500_000_000); @@ -243,7 +240,7 @@ mod wallet_basic { zingo_client.do_sync(false).await.unwrap(); let balance = zingo_client.do_balance().await; - println!("@zingoindexertest: zingo_client balance: \n{:#?}.", balance); + println!("[TEST LOG] zingo_client balance: \n{:#?}.", balance); assert_eq!(balance.transparent_balance.unwrap(), 250_000); zingo_client @@ -254,7 +251,7 @@ mod wallet_basic { zingo_client.do_sync(false).await.unwrap(); let balance = zingo_client.do_balance().await; - println!("@zingoindexertest: zingo_client balance: \n{:#?}.", balance); + println!("[TEST LOG] zingo_client balance: \n{:#?}.", balance); assert_eq!(balance.transparent_balance.unwrap(), 0); assert_eq!(balance.orchard_balance.unwrap(), 2_500_000_000); @@ -295,7 +292,7 @@ mod wallet_basic { zingo_client.do_sync(false).await.unwrap(); let balance = zingo_client.do_balance().await; - println!("@zingoindexertest: zingo_client balance: \n{:#?}.", balance); + println!("[TEST LOG] zingo_client balance: \n{:#?}.", balance); assert_eq!(balance.sapling_balance.unwrap(), 250_000); assert_eq!(balance.transparent_balance.unwrap(), 250_000); @@ -307,7 +304,7 @@ mod wallet_basic { zingo_client.do_sync(false).await.unwrap(); let balance = zingo_client.do_balance().await; - println!("@zingoindexertest: zingo_client balance: \n{:#?}.", balance); + println!("[TEST LOG] zingo_client balance: \n{:#?}.", balance); assert_eq!(balance.sapling_balance.unwrap(), 0); assert_eq!(balance.transparent_balance.unwrap(), 0); assert_eq!(balance.orchard_balance.unwrap(), 2_500_000_000); @@ -359,11 +356,11 @@ mod wallet_basic { .unwrap(); test_manager.regtest_manager.generate_n_blocks(30).unwrap(); - println!("@zingoindexertest: syncing full batch."); + println!("[TEST LOG] syncing full batch."); zingo_client.do_sync(false).await.unwrap(); let balance = zingo_client.do_balance().await; - println!("@zingoindexertest: zingo_client balance: \n{:#?}.", balance); + println!("[TEST LOG] zingo_client balance: \n{:#?}.", balance); assert_eq!(balance.orchard_balance.unwrap(), 76_874_500_000); assert_eq!(balance.sapling_balance.unwrap(), 250_000); assert_eq!(balance.transparent_balance.unwrap(), 250_000); @@ -405,13 +402,13 @@ mod wallet_basic { start_zingo_mempool_monitor(&zingo_client).await; let balance = zingo_client.do_balance().await; - println!("@zingoindexertest: zingo_client balance: \n{:#?}.", balance); + println!("[TEST LOG] zingo_client balance: \n{:#?}.", balance); assert_eq!(balance.unverified_sapling_balance.unwrap(), 500_000); test_manager.regtest_manager.generate_n_blocks(1).unwrap(); zingo_client.do_sync(false).await.unwrap(); let balance = zingo_client.do_balance().await; - println!("@zingoindexertest: zingo_client balance: \n{:#?}.", balance); + println!("[TEST LOG] zingo_client balance: \n{:#?}.", balance); assert_eq!(balance.verified_sapling_balance.unwrap(), 500_000); drop_test_manager( diff --git a/zaino-nym/src/client.rs b/zaino-nym/src/client.rs index 2cc63fd..281178c 100644 --- a/zaino-nym/src/client.rs +++ b/zaino-nym/src/client.rs @@ -1,6 +1,4 @@ //! Nym client functionality. -//! -//! TODO: - Add NymClientError error type and rewrite functions to return >. use nym_sdk::mixnet::{ MixnetClient, MixnetClientBuilder, MixnetMessageSender, Recipient, ReconstructedMessage, diff --git a/zaino-serve/src/rpc/service.rs b/zaino-serve/src/rpc/service.rs index 4f9c835..7b2b42f 100644 --- a/zaino-serve/src/rpc/service.rs +++ b/zaino-serve/src/rpc/service.rs @@ -102,7 +102,7 @@ impl CompactTxStreamer for GrpcClient { 'life0: 'async_trait, Self: 'async_trait, { - println!("@zingoindexerd: Received call of get_latest_block."); + println!("[TEST] Received call of get_latest_block."); Box::pin(async { let blockchain_info = JsonRpcConnector::new( self.zebrad_uri.clone(), @@ -144,7 +144,7 @@ impl CompactTxStreamer for GrpcClient { 'life0: 'async_trait, Self: 'async_trait, { - println!("@zingoindexerd: Received call of get_block."); + println!("[TEST] Received call of get_block."); Box::pin(async { Err(tonic::Status::unimplemented("get_block not yet implemented. If you require this RPC please open an issue or PR at the Zingo-Indexer github (https://github.com/zingolabs/zingo-indexer).")) }) @@ -169,7 +169,7 @@ impl CompactTxStreamer for GrpcClient { 'life0: 'async_trait, Self: 'async_trait, { - println!("@zingoindexerd: Received call of get_block_nullifiers."); + println!("[TEST] Received call of get_block_nullifiers."); Box::pin(async { Err(tonic::Status::unimplemented("get_block_nullifiers not yet implemented. If you require this RPC please open an issue or PR at the Zingo-Indexer github (https://github.com/zingolabs/zingo-indexer).")) }) @@ -201,7 +201,7 @@ impl CompactTxStreamer for GrpcClient { 'life0: 'async_trait, Self: 'async_trait, { - println!("@zingoindexerd: Received call of get_block_range."); + println!("[TEST] Received call of get_block_range."); let zebrad_uri = self.zebrad_uri.clone(); Box::pin(async move { let blockrange = request.into_inner(); @@ -216,16 +216,13 @@ impl CompactTxStreamer for GrpcClient { if start > end { (start, end) = (end, start); } - println!( - "@zingoindexertest: Fetching blocks in range: {}-{}.", - start, end - ); + println!("[TEST] Fetching blocks in range: {}-{}.", start, end); let (channel_tx, channel_rx) = tokio::sync::mpsc::channel(32); tokio::spawn(async move { // NOTE: This timeout is so slow due to the blockcache not being implemented. This should be reduced to 30s once functionality is in place. let timeout = timeout(std::time::Duration::from_secs(120), async { for height in (start..=end).rev() { - println!("@zingoindexertest: Fetching block at height: {}.", height); + println!("[TEST] Fetching block at height: {}.", height); let compact_block = get_block_from_node(&zebrad_uri, &height).await; match compact_block { Ok(block) => { @@ -290,7 +287,7 @@ impl CompactTxStreamer for GrpcClient { 'life0: 'async_trait, Self: 'async_trait, { - println!("@zingoindexerd: Received call of get_block_range_nullifiers."); + println!("[TEST] Received call of get_block_range_nullifiers."); Box::pin(async { Err(tonic::Status::unimplemented("get_block_range_nullifiers not yet implemented. If you require this RPC please open an issue or PR at the Zingo-Indexer github (https://github.com/zingolabs/zingo-indexer).")) }) @@ -312,7 +309,7 @@ impl CompactTxStreamer for GrpcClient { 'life0: 'async_trait, Self: 'async_trait, { - println!("@zingoindexerd: Received call of get_transaction."); + println!("[TEST] Received call of get_transaction."); Box::pin(async { let hash = request.into_inner().hash; if hash.len() == 32 { @@ -367,7 +364,7 @@ impl CompactTxStreamer for GrpcClient { 'life0: 'async_trait, Self: 'async_trait, { - println!("@zingoindexerd: Received call of send_transaction."); + println!("[TEST] Received call of send_transaction."); Box::pin(async { let hex_tx = hex::encode(request.into_inner().data); let tx_output = JsonRpcConnector::new( @@ -410,7 +407,7 @@ impl CompactTxStreamer for GrpcClient { 'life0: 'async_trait, Self: 'async_trait, { - println!("@zingoindexerd: Received call of get_taddress_txids."); + println!("[TEST] Received call of get_taddress_txids."); Box::pin(async move { let block_filter = request.into_inner(); let address = block_filter.address; @@ -514,7 +511,7 @@ impl CompactTxStreamer for GrpcClient { 'life0: 'async_trait, Self: 'async_trait, { - println!("@zingoindexerd: Received call of get_taddress_balance."); + println!("[TEST] Received call of get_taddress_balance."); Box::pin(async { Err(tonic::Status::unimplemented("get_taddress_balance not yet implemented. If you require this RPC please open an issue or PR at the Zingo-Indexer github (https://github.com/zingolabs/zingo-indexer).")) }) @@ -538,7 +535,7 @@ impl CompactTxStreamer for GrpcClient { 'life0: 'async_trait, Self: 'async_trait, { - println!("@zingoindexerd: Received call of get_taddress_balance_stream."); + println!("[TEST] Received call of get_taddress_balance_stream."); Box::pin(async { Err(tonic::Status::unimplemented("get_taddress_balance_stream not yet implemented. If you require this RPC please open an issue or PR at the Zingo-Indexer github (https://github.com/zingolabs/zingo-indexer).")) }) @@ -578,7 +575,7 @@ impl CompactTxStreamer for GrpcClient { 'life0: 'async_trait, Self: 'async_trait, { - println!("@zingoindexerd: Received call of get_mempool_tx."); + println!("[TEST] Received call of get_mempool_tx."); Box::pin(async { Err(tonic::Status::unimplemented("get_mempool_tx not yet implemented. If you require this RPC please open an issue or PR at the Zingo-Indexer github (https://github.com/zingolabs/zingo-indexer).")) }) @@ -611,7 +608,7 @@ impl CompactTxStreamer for GrpcClient { 'life0: 'async_trait, Self: 'async_trait, { - println!("@zingoindexerd: Received call of get_mempool_stream."); + println!("[TEST] Received call of get_mempool_stream."); Box::pin(async { let zebrad_client = JsonRpcConnector::new( self.zebrad_uri.clone(), @@ -736,7 +733,7 @@ impl CompactTxStreamer for GrpcClient { 'life0: 'async_trait, Self: 'async_trait, { - println!("@zingoindexerd: Received call of get_tree_state."); + println!("[TEST] Received call of get_tree_state."); Box::pin(async { let block_id = request.into_inner(); let hash_or_height = if block_id.height != 0 { @@ -790,7 +787,7 @@ impl CompactTxStreamer for GrpcClient { 'life0: 'async_trait, Self: 'async_trait, { - println!("@zingoindexerd: Received call of get_latest_tree_state."); + println!("[TEST] Received call of get_latest_tree_state."); Box::pin(async { Err(tonic::Status::unimplemented("get_latest_tree_state not yet implemented. If you require this RPC please open an issue or PR at the Zingo-Indexer github (https://github.com/zingolabs/zingo-indexer).")) }) @@ -823,7 +820,7 @@ impl CompactTxStreamer for GrpcClient { 'life0: 'async_trait, Self: 'async_trait, { - println!("@zingoindexerd: Received call of get_subtree_roots."); + println!("[TEST] Received call of get_subtree_roots."); Box::pin(async { Err(tonic::Status::unimplemented("get_subtree_roots not yet implemented. If you require this RPC please open an issue or PR at the Zingo-Indexer github (https://github.com/zingolabs/zingo-indexer).")) }) @@ -849,7 +846,7 @@ impl CompactTxStreamer for GrpcClient { 'life0: 'async_trait, Self: 'async_trait, { - println!("@zingoindexerd: Received call of get_address_utxos."); + println!("[TEST] Received call of get_address_utxos."); Box::pin(async { Err(tonic::Status::unimplemented("get_address_utxos not yet implemented. If you require this RPC please open an issue or PR at the Zingo-Indexer github (https://github.com/zingolabs/zingo-indexer).")) }) @@ -879,7 +876,7 @@ impl CompactTxStreamer for GrpcClient { 'life0: 'async_trait, Self: 'async_trait, { - println!("@zingoindexerd: Received call of get_address_utxos_stream."); + println!("[TEST] Received call of get_address_utxos_stream."); Box::pin(async { Err(tonic::Status::unimplemented("get_address_utxos_stream not yet implemented. If you require this RPC please open an issue or PR at the Zingo-Indexer github (https://github.com/zingolabs/zingo-indexer).")) }) @@ -901,7 +898,7 @@ impl CompactTxStreamer for GrpcClient { 'life0: 'async_trait, Self: 'async_trait, { - println!("@zingoindexerd: Received call of get_lightd_info."); + println!("[TEST] Received call of get_lightd_info."); // TODO: Add user and password as fields of GrpcClient and use here. // TODO: Return Nym_Address in get_lightd_info response, for use by wallets. Box::pin(async { @@ -977,7 +974,7 @@ impl CompactTxStreamer for GrpcClient { 'life0: 'async_trait, Self: 'async_trait, { - println!("@zingoindexerd: Received call of ping."); + println!("[TEST] Received call of ping."); Box::pin(async { Err(tonic::Status::unimplemented("ping not yet implemented. If you require this RPC please open an issue or PR at the Zingo-Indexer github (https://github.com/zingolabs/zingo-indexer).")) }) diff --git a/zaino-testutils/src/lib.rs b/zaino-testutils/src/lib.rs index c489d8c..2eade9b 100644 --- a/zaino-testutils/src/lib.rs +++ b/zaino-testutils/src/lib.rs @@ -139,17 +139,14 @@ pub async fn drop_test_manager( if let Some(ref path) = temp_conf_path { if let Err(e) = std::fs::remove_dir_all(path) { eprintln!( - "@zingoindexerd: Failed to delete temporary regtest configuration directory: {:?}.", + "Failed to delete temporary regtest configuration directory: {:?}.", e ); } } if let Some(ref path) = Some(temp_wallet_path) { if let Err(e) = std::fs::remove_dir_all(path) { - eprintln!( - "@zingoindexerd: Failed to delete temporary directory: {:?}.", - e - ); + eprintln!("Failed to delete temporary directory: {:?}.", e); } } } @@ -179,17 +176,14 @@ fn set_custom_drops( if let Some(ref path) = temp_conf_path_panic { if let Err(e) = std::fs::remove_dir_all(path) { eprintln!( - "@zingoindexerd: Failed to delete temporary regtest config directory: {:?}.", + "Failed to delete temporary regtest config directory: {:?}.", e ); } } if let Some(ref path) = temp_wallet_path_panic { if let Err(e) = std::fs::remove_dir_all(path) { - eprintln!( - "@zingoindexerd: Failed to delete temporary wallet directory: {:?}.", - e - ); + eprintln!("Failed to delete temporary wallet directory: {:?}.", e); } } // Assures tests fail on secondary thread panics. @@ -199,22 +193,19 @@ fn set_custom_drops( CTRL_C_ONCE.call_once(|| { ctrlc::set_handler(move || { - println!("@zingoindexerd: Received Ctrl+C, exiting."); + println!("Received Ctrl+C, exiting."); online_ctrlc.store(false, std::sync::atomic::Ordering::SeqCst); if let Some(ref path) = temp_conf_path_ctrlc { if let Err(e) = std::fs::remove_dir_all(path) { eprintln!( - "@zingoindexerd: Failed to delete temporary regtest config directory: {:?}.", + "Failed to delete temporary regtest config directory: {:?}.", e ); } } if let Some(ref path) = temp_wallet_path_ctrlc { if let Err(e) = std::fs::remove_dir_all(path) { - eprintln!( - "@zingoindexerd: Failed to delete temporary wallet directory: {:?}.", - e - ); + eprintln!("Failed to delete temporary wallet directory: {:?}.", e); } } // Assures tests fail on ctrlc exit. diff --git a/zainod/src/indexer.rs b/zainod/src/indexer.rs index ff6cc96..66ef239 100644 --- a/zainod/src/indexer.rs +++ b/zainod/src/indexer.rs @@ -236,7 +236,7 @@ fn startup_message() { ▒▒▒▒▒▒▒███▓▒▓▓▓▓▓▒▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▒▒▒ ▒▒▒▒▒▒▓████▒▒▒▒▒▒▒▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ ▒▒▒▒▒▒▒░▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ - Thank you for using ZingoLabs Zingdexer! + Thank you for using ZingoLabs Zaino! - Donate to us at https://free2z.cash/zingolabs. - Submit any security conserns to us at zingodisclosure@proton.me.