From dd00f96f51b9eee0a063ad44baf783dbc285ec19 Mon Sep 17 00:00:00 2001 From: zancas Date: Fri, 29 Nov 2024 16:08:01 -0700 Subject: [PATCH 01/30] what todo?! --- libtonode-tests/tests/chain_generics.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libtonode-tests/tests/chain_generics.rs b/libtonode-tests/tests/chain_generics.rs index 3dc85d47e8..ce03ee0f1b 100644 --- a/libtonode-tests/tests/chain_generics.rs +++ b/libtonode-tests/tests/chain_generics.rs @@ -379,6 +379,10 @@ mod chain_generics { target ); } + + fn lightserver_uri(&self) -> Option { + todo!() + } } } } From f8f2679e80c372e54ab0fd13de56986ed8ac36fe Mon Sep 17 00:00:00 2001 From: zancas Date: Fri, 29 Nov 2024 18:04:42 -0700 Subject: [PATCH 02/30] fix typo --- darkside-tests/src/darkside_connector.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/darkside-tests/src/darkside_connector.rs b/darkside-tests/src/darkside_connector.rs index 25ec133f01..83ba8f70f6 100644 --- a/darkside-tests/src/darkside_connector.rs +++ b/darkside-tests/src/darkside_connector.rs @@ -47,7 +47,7 @@ impl DarksideConnector { let uri = Uri::builder() .scheme(uri.scheme().unwrap().clone()) .authority(uri.authority().unwrap().clone()) - //here. The Request's uri contains the path to the GRPC sever and + //here. The Request's uri contains the path to the GRPC server and //the method being called .path_and_query(req.uri().path_and_query().unwrap().clone()) .build() From 312e2bfd1ac7bab814ad32652885f40d785ba697 Mon Sep 17 00:00:00 2001 From: zancas Date: Fri, 29 Nov 2024 18:45:40 -0700 Subject: [PATCH 03/30] implement index on valuetransfers --- zingolib/src/wallet/data.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/zingolib/src/wallet/data.rs b/zingolib/src/wallet/data.rs index 8e2906e3af..89ddfe7363 100644 --- a/zingolib/src/wallet/data.rs +++ b/zingolib/src/wallet/data.rs @@ -681,6 +681,15 @@ pub mod summaries { #[derive(PartialEq, Debug)] pub struct ValueTransfers(pub Vec); + // Implement the Index trait + impl std::ops::Index for ValueTransfers { + type Output = ValueTransfer; // The type of the value returned by the index + + fn index(&self, index: usize) -> &Self::Output { + &self.0[index] // Forward the indexing operation to the underlying data structure + } + } + impl ValueTransfers { /// Creates a new ValueTransfer pub fn new(value_transfers: Vec) -> Self { From f312170812332fce4bb6652dd26755b23a66326c Mon Sep 17 00:00:00 2001 From: zancas Date: Fri, 29 Nov 2024 18:54:15 -0700 Subject: [PATCH 04/30] impl Deref for ValueTransfers --- zingolib/src/wallet/data.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/zingolib/src/wallet/data.rs b/zingolib/src/wallet/data.rs index 89ddfe7363..a48e33287e 100644 --- a/zingolib/src/wallet/data.rs +++ b/zingolib/src/wallet/data.rs @@ -681,6 +681,13 @@ pub mod summaries { #[derive(PartialEq, Debug)] pub struct ValueTransfers(pub Vec); + impl std::ops::Deref for ValueTransfers { + type Target = Vec; + + fn deref(&self) -> &Self::Target { + &self.0 + } + } // Implement the Index trait impl std::ops::Index for ValueTransfers { type Output = ValueTransfer; // The type of the value returned by the index From 647eecd393fb76a4558ef4a3675a91605248fc7b Mon Sep 17 00:00:00 2001 From: zancas Date: Fri, 29 Nov 2024 19:12:03 -0700 Subject: [PATCH 05/30] set incremental on in dev builds to support language analyzer --- Cargo.toml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index 8c0e6f0cf1..dbe6103eeb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -104,7 +104,11 @@ bs58 = "0.5" [profile.release] debug = false +incremental = false [profile.test] opt-level = 3 debug = false + +[profile.dev] +incremental = true From 0849fe963c6edf5cfbf95c6af5627712f3c90dbd Mon Sep 17 00:00:00 2001 From: zancas Date: Fri, 29 Nov 2024 19:24:14 -0700 Subject: [PATCH 06/30] deprecate, probably useless, ValueTransfers::new --- zingolib/CHANGELOG.md | 4 ++++ zingolib/src/wallet/data.rs | 1 + 2 files changed, 5 insertions(+) diff --git a/zingolib/CHANGELOG.md b/zingolib/CHANGELOG.md index 3c98132645..9e945fa3fc 100644 --- a/zingolib/CHANGELOG.md +++ b/zingolib/CHANGELOG.md @@ -21,6 +21,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `LightClient::value_transfers::create_send_value_transfers` (in-function definition) -> `ValueTransfers::create_send_value_transfers` +### Deprecated + +- ValueTransfers::new + ### Removed - `lightclient.do_list_notes` is deprecated diff --git a/zingolib/src/wallet/data.rs b/zingolib/src/wallet/data.rs index a48e33287e..e33884837a 100644 --- a/zingolib/src/wallet/data.rs +++ b/zingolib/src/wallet/data.rs @@ -699,6 +699,7 @@ pub mod summaries { impl ValueTransfers { /// Creates a new ValueTransfer + #[deprecated(since = "1.10.2", note = "never used")] pub fn new(value_transfers: Vec) -> Self { ValueTransfers(value_transfers) } From 314a0b5e01ec4b08f63b6e922028e6b7be234869 Mon Sep 17 00:00:00 2001 From: zancas Date: Fri, 29 Nov 2024 19:25:51 -0700 Subject: [PATCH 07/30] this is now a particular case of deref logic --- zingolib/src/wallet/data.rs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/zingolib/src/wallet/data.rs b/zingolib/src/wallet/data.rs index e33884837a..b356b36d59 100644 --- a/zingolib/src/wallet/data.rs +++ b/zingolib/src/wallet/data.rs @@ -703,10 +703,6 @@ pub mod summaries { pub fn new(value_transfers: Vec) -> Self { ValueTransfers(value_transfers) } - /// Implicitly dispatch to the wrapped data - pub fn iter(&self) -> std::slice::Iter { - self.0.iter() - } /// Creates value transfers for all notes in a transaction that are sent to another /// recipient. A value transfer is a group of all notes to a specific receiver in a transaction. From c5f0e7c327bab37227aef9be6b01a10a3c20176f Mon Sep 17 00:00:00 2001 From: zancas Date: Fri, 29 Nov 2024 19:30:53 -0700 Subject: [PATCH 08/30] to reduce overhead: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_to_owned --- zingolib/src/testutils/chain_generics/with_assertions.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zingolib/src/testutils/chain_generics/with_assertions.rs b/zingolib/src/testutils/chain_generics/with_assertions.rs index 3f12f0c52d..bf2fa20ca5 100644 --- a/zingolib/src/testutils/chain_generics/with_assertions.rs +++ b/zingolib/src/testutils/chain_generics/with_assertions.rs @@ -15,13 +15,13 @@ use zingo_status::confirmation_status::ConfirmationStatus; /// this function handles inputs and their lifetimes to create a proposal pub async fn to_clients_proposal( sender: &LightClient, - sends: &Vec<(&LightClient, PoolType, u64, Option<&str>)>, + sends: &[(&LightClient, PoolType, u64, Option<&str>)], ) -> zcash_client_backend::proposal::Proposal< zcash_primitives::transaction::fees::zip317::FeeRule, zcash_client_backend::wallet::NoteId, > { let mut subraw_receivers = vec![]; - for (recipient, pooltype, amount, memo_str) in sends.clone() { + for (recipient, pooltype, amount, memo_str) in sends.iter().copied() { let address = get_base_address(recipient, pooltype).await; subraw_receivers.push((address, amount, memo_str)); } From c4d7b068a76170615c55b513e4b6085836e1e9ee Mon Sep 17 00:00:00 2001 From: zancas Date: Fri, 29 Nov 2024 19:32:58 -0700 Subject: [PATCH 09/30] remove clippy-irritating dbg --- zingolib/src/testutils/chain_generics/with_assertions.rs | 9 --------- 1 file changed, 9 deletions(-) diff --git a/zingolib/src/testutils/chain_generics/with_assertions.rs b/zingolib/src/testutils/chain_generics/with_assertions.rs index bf2fa20ca5..237d625e88 100644 --- a/zingolib/src/testutils/chain_generics/with_assertions.rs +++ b/zingolib/src/testutils/chain_generics/with_assertions.rs @@ -76,15 +76,6 @@ where .as_ref() .expect("record is ok"); - dbg!( - crate::grpc_connector::get_latest_block( - sender.config.lightwalletd_uri.read().unwrap().to_owned() - ) - .await - .unwrap() - .height - ); - lookup_statuses(sender, txids.clone()).await.map(|status| { assert_eq!( status, From 5afd9e56bc140e49799cc410eab31799c8b51fcc Mon Sep 17 00:00:00 2001 From: zancas Date: Fri, 29 Nov 2024 19:39:54 -0700 Subject: [PATCH 10/30] comment out dbg, and rationalize commenting --- .../src/testutils/chain_generics/with_assertions.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/zingolib/src/testutils/chain_generics/with_assertions.rs b/zingolib/src/testutils/chain_generics/with_assertions.rs index 237d625e88..8bf1b66789 100644 --- a/zingolib/src/testutils/chain_generics/with_assertions.rs +++ b/zingolib/src/testutils/chain_generics/with_assertions.rs @@ -76,6 +76,17 @@ where .as_ref() .expect("record is ok"); + /* The following debug causes a clippy error: + https://rust-lang.github.io/rust-clippy/master/index.html#await_holding_lock + dbg!( + crate::grpc_connector::get_latest_block( + sender.config.lightwalletd_uri.read().unwrap().to_owned() + ) + .await + .unwrap() + .height + ); + */ lookup_statuses(sender, txids.clone()).await.map(|status| { assert_eq!( status, From 3f610d8e406905e4c2df7ed5a23ea3fc4ff24336 Mon Sep 17 00:00:00 2001 From: zancas Date: Fri, 29 Nov 2024 19:41:12 -0700 Subject: [PATCH 11/30] clean up last clippy warnings --- .../src/testutils/chain_generics/with_assertions.rs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/zingolib/src/testutils/chain_generics/with_assertions.rs b/zingolib/src/testutils/chain_generics/with_assertions.rs index 8bf1b66789..75b21ec4ce 100644 --- a/zingolib/src/testutils/chain_generics/with_assertions.rs +++ b/zingolib/src/testutils/chain_generics/with_assertions.rs @@ -88,10 +88,7 @@ where ); */ lookup_statuses(sender, txids.clone()).await.map(|status| { - assert_eq!( - status, - Some(ConfirmationStatus::Transmitted(send_height.into())) - ); + assert_eq!(status, Some(ConfirmationStatus::Transmitted(send_height))); }); let send_ua_id = sender.do_addresses().await[0]["address"].clone(); @@ -196,10 +193,7 @@ where .expect("record is ok"); lookup_statuses(client, txids.clone()).await.map(|status| { - assert_eq!( - status, - Some(ConfirmationStatus::Transmitted(send_height.into())) - ); + assert_eq!(status, Some(ConfirmationStatus::Transmitted(send_height))); }); if test_mempool { From 810af943678f75f895ae2512dd250f90f35ad9ec Mon Sep 17 00:00:00 2001 From: zancas Date: Fri, 29 Nov 2024 19:52:20 -0700 Subject: [PATCH 12/30] impl DerefMut and use it --- zingolib/src/lightclient/describe.rs | 2 +- zingolib/src/wallet/data.rs | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/zingolib/src/lightclient/describe.rs b/zingolib/src/lightclient/describe.rs index 7c168abe77..77c671e114 100644 --- a/zingolib/src/lightclient/describe.rs +++ b/zingolib/src/lightclient/describe.rs @@ -301,7 +301,7 @@ impl LightClient { pub async fn sorted_value_transfers(&self, newer_first: bool) -> ValueTransfers { let mut value_transfers = self.value_transfers().await; if newer_first { - value_transfers.0.reverse(); + value_transfers.reverse(); } value_transfers } diff --git a/zingolib/src/wallet/data.rs b/zingolib/src/wallet/data.rs index b356b36d59..9aa073dec7 100644 --- a/zingolib/src/wallet/data.rs +++ b/zingolib/src/wallet/data.rs @@ -688,6 +688,11 @@ pub mod summaries { &self.0 } } + impl std::ops::DerefMut for ValueTransfers { + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.0 + } + } // Implement the Index trait impl std::ops::Index for ValueTransfers { type Output = ValueTransfer; // The type of the value returned by the index From fdc62869e7e73dcfd7483c7508d6d139138f8746 Mon Sep 17 00:00:00 2001 From: zancas Date: Fri, 29 Nov 2024 19:54:10 -0700 Subject: [PATCH 13/30] update consumer to use ergonomic interface --- zingolib/src/lightclient/describe.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zingolib/src/lightclient/describe.rs b/zingolib/src/lightclient/describe.rs index 77c671e114..982fe3841f 100644 --- a/zingolib/src/lightclient/describe.rs +++ b/zingolib/src/lightclient/describe.rs @@ -265,7 +265,7 @@ impl LightClient { /// Provides a list of ValueTransfers associated with the sender, or containing the string. pub async fn messages_containing(&self, filter: Option<&str>) -> ValueTransfers { - let mut value_transfers = self.sorted_value_transfers(true).await.0; + let mut value_transfers = self.sorted_value_transfers(true).await; value_transfers.reverse(); // Filter out VTs where all memos are empty. @@ -293,7 +293,7 @@ impl LightClient { None => value_transfers.retain(|vt| !vt.memos().is_empty()), } - ValueTransfers(value_transfers) + value_transfers } /// Provides a list of value transfers sorted From cc5f349b63726573d0fd9dce079f526f321b997e Mon Sep 17 00:00:00 2001 From: zancas Date: Fri, 29 Nov 2024 19:56:17 -0700 Subject: [PATCH 14/30] improve no_messages call --- libtonode-tests/tests/concrete.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libtonode-tests/tests/concrete.rs b/libtonode-tests/tests/concrete.rs index 0ecf865602..65e0d36ba7 100644 --- a/libtonode-tests/tests/concrete.rs +++ b/libtonode-tests/tests/concrete.rs @@ -212,7 +212,7 @@ mod fast { let no_messages = &recipient.messages_containing(None).await; - assert_eq!(no_messages.0.len(), 0); + assert_eq!(no_messages.len(), 0); from_inputs::quick_send( &faucet, From 1aa961e733b512ef6320526a709a7a396d78351b Mon Sep 17 00:00:00 2001 From: zancas Date: Fri, 29 Nov 2024 20:18:13 -0700 Subject: [PATCH 15/30] use impl<'a> std::iter::IntoIterator for &'a ValueTransfers --- libtonode-tests/tests/concrete.rs | 8 ++++---- zingolib/src/wallet/data.rs | 7 +++++++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/libtonode-tests/tests/concrete.rs b/libtonode-tests/tests/concrete.rs index 65e0d36ba7..f7508e90b0 100644 --- a/libtonode-tests/tests/concrete.rs +++ b/libtonode-tests/tests/concrete.rs @@ -237,7 +237,7 @@ mod fast { let single_message = &recipient.messages_containing(None).await; - assert_eq!(single_message.0.len(), 1); + assert_eq!(single_message.len(), 1); } /// Test sending and receiving messages between three parties. @@ -425,12 +425,12 @@ mod fast { let all_vts = &recipient.sorted_value_transfers(true).await; let all_messages = &recipient.messages_containing(None).await; - for vt in all_vts.0.iter() { + for vt in all_vts { dbg!(vt.blockheight()); } - assert_eq!(value_transfers_bob.0.len(), 3); - assert_eq!(value_transfers_charlie.0.len(), 2); + assert_eq!(value_transfers_bob.len(), 3); + assert_eq!(value_transfers_charlie.len(), 2); // Also asserting the order now (sorry juanky) // ALL MESSAGES (First one should be the oldest one) diff --git a/zingolib/src/wallet/data.rs b/zingolib/src/wallet/data.rs index 9aa073dec7..2c9df978c9 100644 --- a/zingolib/src/wallet/data.rs +++ b/zingolib/src/wallet/data.rs @@ -680,7 +680,14 @@ pub mod summaries { /// A wrapper struct for implementing display and json on a vec of value trasnfers #[derive(PartialEq, Debug)] pub struct ValueTransfers(pub Vec); + impl<'a> std::iter::IntoIterator for &'a ValueTransfers { + type Item = &'a ValueTransfer; + type IntoIter = std::slice::Iter<'a, ValueTransfer>; + fn into_iter(self) -> Self::IntoIter { + self.0.iter() + } + } impl std::ops::Deref for ValueTransfers { type Target = Vec; From ec04445480649990edad6471bda30f8cc19226a1 Mon Sep 17 00:00:00 2001 From: zancas Date: Fri, 29 Nov 2024 20:21:02 -0700 Subject: [PATCH 16/30] use Derefgit add -p! Ha. :) --- zingolib/src/wallet/data.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zingolib/src/wallet/data.rs b/zingolib/src/wallet/data.rs index 2c9df978c9..04fcc88dc9 100644 --- a/zingolib/src/wallet/data.rs +++ b/zingolib/src/wallet/data.rs @@ -685,7 +685,7 @@ pub mod summaries { type IntoIter = std::slice::Iter<'a, ValueTransfer>; fn into_iter(self) -> Self::IntoIter { - self.0.iter() + self.iter() } } impl std::ops::Deref for ValueTransfers { From cc1af3b66a60065c4b08b8fbc307636968fb8fa1 Mon Sep 17 00:00:00 2001 From: zancas Date: Fri, 29 Nov 2024 20:37:23 -0700 Subject: [PATCH 17/30] update comments and unify behavior, explicitly note inauthenticity! --- libtonode-tests/tests/concrete.rs | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/libtonode-tests/tests/concrete.rs b/libtonode-tests/tests/concrete.rs index f7508e90b0..4075844038 100644 --- a/libtonode-tests/tests/concrete.rs +++ b/libtonode-tests/tests/concrete.rs @@ -252,8 +252,11 @@ mod fast { /// /// After the messages are sent, the test checks that the `messages_containing` method /// returns the expected messages for each party in the correct order. + /// NOTE: This test is explicitly spoofing inauthentic addresses since Bob and Charlie are + /// actually the same recipient faucet!! #[tokio::test] async fn message_thread() { + // Begin test setup let (regtest_manager, _cph, faucet, recipient, _txid) = scenarios::orchard_funded_recipient(10_000_000).await; @@ -356,60 +359,60 @@ mod fast { ) .unwrap()]) .unwrap(); + // Complete test setup + // Message One, Alice to Bob recipient.propose_send(alice_to_bob.clone()).await.unwrap(); - recipient .complete_and_broadcast_stored_proposal() .await .unwrap(); - increase_height_and_wait_for_client(®test_manager, &recipient, 1) .await .unwrap(); + // Message Two, Alice to Bob recipient .propose_send(alice_to_bob_2.clone()) .await .unwrap(); - recipient .complete_and_broadcast_stored_proposal() .await .unwrap(); - increase_height_and_wait_for_client(®test_manager, &recipient, 1) .await .unwrap(); + // Message Three, Bob to Alice faucet.propose_send(bob_to_alice.clone()).await.unwrap(); - faucet .complete_and_broadcast_stored_proposal() .await .unwrap(); - increase_height_and_wait_for_client(®test_manager, &recipient, 1) .await .unwrap(); + // Message Four, Alice to Charlie recipient .propose_send(alice_to_charlie.clone()) .await .unwrap(); - recipient .complete_and_broadcast_stored_proposal() .await .unwrap(); + increase_height_and_wait_for_client(®test_manager, &recipient, 1) + .await + .unwrap(); + // Message Five, Charlie to Alice faucet.propose_send(charlie_to_alice.clone()).await.unwrap(); - faucet .complete_and_broadcast_stored_proposal() .await .unwrap(); - increase_height_and_wait_for_client(®test_manager, &recipient, 1) .await .unwrap(); From 6fa99f119af1f8084b148034fd02ef8df5a52c02 Mon Sep 17 00:00:00 2001 From: zancas Date: Fri, 29 Nov 2024 20:52:15 -0700 Subject: [PATCH 18/30] tighten test --- libtonode-tests/tests/concrete.rs | 95 +++++++++---------------------- 1 file changed, 26 insertions(+), 69 deletions(-) diff --git a/libtonode-tests/tests/concrete.rs b/libtonode-tests/tests/concrete.rs index 4075844038..0575e35d7f 100644 --- a/libtonode-tests/tests/concrete.rs +++ b/libtonode-tests/tests/concrete.rs @@ -252,14 +252,27 @@ mod fast { /// /// After the messages are sent, the test checks that the `messages_containing` method /// returns the expected messages for each party in the correct order. - /// NOTE: This test is explicitly spoofing inauthentic addresses since Bob and Charlie are - /// actually the same recipient faucet!! #[tokio::test] async fn message_thread() { // Begin test setup let (regtest_manager, _cph, faucet, recipient, _txid) = scenarios::orchard_funded_recipient(10_000_000).await; - + macro_rules! send_and_sync { + ($client:ident, $message:ident) => { + // Propose sending the message + $client.propose_send($message.clone()).await.unwrap(); + // Complete and broadcast the stored proposal + $client + .complete_and_broadcast_stored_proposal() + .await + .unwrap(); + // Increase the height and wait for the client + increase_height_and_wait_for_client(®test_manager, &$client, 1) + .await + .unwrap(); + }; + } + // Addresses: alice, bob, charlie let alice = get_base_address(&recipient, PoolType::ORCHARD).await; let bob = faucet .wallet @@ -273,7 +286,6 @@ mod fast { false, ) .unwrap(); - let charlie = faucet .wallet .wallet_capability() @@ -287,6 +299,7 @@ mod fast { ) .unwrap(); + // messages let alice_to_bob = TransactionRequest::new(vec![Payment::new( ZcashAddress::from_str(&bob.encode(&faucet.config().chain)).unwrap(), NonNegativeAmount::from_u64(1_000).unwrap(), @@ -299,7 +312,6 @@ mod fast { ) .unwrap()]) .unwrap(); - let alice_to_bob_2 = TransactionRequest::new(vec![Payment::new( ZcashAddress::from_str(&bob.encode(&faucet.config().chain)).unwrap(), NonNegativeAmount::from_u64(1_000).unwrap(), @@ -312,7 +324,6 @@ mod fast { ) .unwrap()]) .unwrap(); - let alice_to_charlie = TransactionRequest::new(vec![Payment::new( ZcashAddress::from_str(&charlie.encode(&faucet.config().chain)).unwrap(), NonNegativeAmount::from_u64(1_000).unwrap(), @@ -325,7 +336,6 @@ mod fast { ) .unwrap()]) .unwrap(); - let charlie_to_alice = TransactionRequest::new(vec![Payment::new( ZcashAddress::from_str(&alice).unwrap(), NonNegativeAmount::from_u64(1_000).unwrap(), @@ -342,7 +352,6 @@ mod fast { ) .unwrap()]) .unwrap(); - let bob_to_alice = TransactionRequest::new(vec![Payment::new( ZcashAddress::from_str(&alice).unwrap(), NonNegativeAmount::from_u64(1_000).unwrap(), @@ -361,90 +370,38 @@ mod fast { .unwrap(); // Complete test setup - // Message One, Alice to Bob - recipient.propose_send(alice_to_bob.clone()).await.unwrap(); - recipient - .complete_and_broadcast_stored_proposal() - .await - .unwrap(); - increase_height_and_wait_for_client(®test_manager, &recipient, 1) - .await - .unwrap(); - - // Message Two, Alice to Bob - recipient - .propose_send(alice_to_bob_2.clone()) - .await - .unwrap(); - recipient - .complete_and_broadcast_stored_proposal() - .await - .unwrap(); - increase_height_and_wait_for_client(®test_manager, &recipient, 1) - .await - .unwrap(); - - // Message Three, Bob to Alice - faucet.propose_send(bob_to_alice.clone()).await.unwrap(); - faucet - .complete_and_broadcast_stored_proposal() - .await - .unwrap(); - increase_height_and_wait_for_client(®test_manager, &recipient, 1) - .await - .unwrap(); - - // Message Four, Alice to Charlie - recipient - .propose_send(alice_to_charlie.clone()) - .await - .unwrap(); - recipient - .complete_and_broadcast_stored_proposal() - .await - .unwrap(); - increase_height_and_wait_for_client(®test_manager, &recipient, 1) - .await - .unwrap(); - - // Message Five, Charlie to Alice - faucet.propose_send(charlie_to_alice.clone()).await.unwrap(); - faucet - .complete_and_broadcast_stored_proposal() - .await - .unwrap(); + // Message Sending + send_and_sync!(recipient, alice_to_bob); + send_and_sync!(recipient, alice_to_bob_2); + send_and_sync!(faucet, bob_to_alice); + send_and_sync!(recipient, alice_to_charlie); + send_and_sync!(faucet, charlie_to_alice); + // Final sync of recipient increase_height_and_wait_for_client(®test_manager, &recipient, 1) .await .unwrap(); + // Collect observations let value_transfers_bob = &recipient .messages_containing(Some(&bob.encode(&recipient.config().chain))) .await; - let value_transfers_charlie = &recipient .messages_containing(Some(&charlie.encode(&recipient.config().chain))) .await; - let all_vts = &recipient.sorted_value_transfers(true).await; let all_messages = &recipient.messages_containing(None).await; - for vt in all_vts { - dbg!(vt.blockheight()); - } - + // Make assertions assert_eq!(value_transfers_bob.len(), 3); assert_eq!(value_transfers_charlie.len(), 2); // Also asserting the order now (sorry juanky) // ALL MESSAGES (First one should be the oldest one) assert!(all_messages - .0 .windows(2) .all(|pair| { pair[0].blockheight() <= pair[1].blockheight() })); - // ALL VTS (First one should be the most recent one) assert!(all_vts - .0 .windows(2) .all(|pair| { pair[0].blockheight() >= pair[1].blockheight() })); } From a96fcfee95aa9c5d9309499902dfbbcf8923ffea Mon Sep 17 00:00:00 2001 From: zancas Date: Fri, 29 Nov 2024 21:05:08 -0700 Subject: [PATCH 19/30] rm dbg --- libtonode-tests/tests/concrete.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/libtonode-tests/tests/concrete.rs b/libtonode-tests/tests/concrete.rs index 0575e35d7f..7f27d97874 100644 --- a/libtonode-tests/tests/concrete.rs +++ b/libtonode-tests/tests/concrete.rs @@ -165,8 +165,6 @@ mod fast { let value_transfers = &recipient.sorted_value_transfers(true).await; - dbg!(value_transfers); - assert!(value_transfers.iter().any(|vt| vt.kind() == ValueTransferKind::Sent(SentValueTransfer::SendToSelf( SelfSendValueTransfer::Basic From 2af883320abb944045a94a6f05215de2e25d74f9 Mon Sep 17 00:00:00 2001 From: zancas Date: Fri, 29 Nov 2024 21:08:10 -0700 Subject: [PATCH 20/30] simplify interface in fast::value_transfers --- libtonode-tests/tests/concrete.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libtonode-tests/tests/concrete.rs b/libtonode-tests/tests/concrete.rs index 7f27d97874..105f5f28f5 100644 --- a/libtonode-tests/tests/concrete.rs +++ b/libtonode-tests/tests/concrete.rs @@ -455,10 +455,10 @@ mod fast { let mut value_transfers3 = recipient.sorted_value_transfers(false).await; let mut value_transfers4 = recipient.sorted_value_transfers(false).await; - assert_eq!(value_transfers.0[0].memos().len(), 4); + assert_eq!(value_transfers[0].memos().len(), 4); - value_transfers3.0.reverse(); - value_transfers4.0.reverse(); + value_transfers3.reverse(); + value_transfers4.reverse(); assert_eq!(value_transfers, value_transfers1); assert_eq!(value_transfers, value_transfers2); From b5629f76045b9d18d303a72fcf03c27e7dc8eaeb Mon Sep 17 00:00:00 2001 From: zancas Date: Fri, 29 Nov 2024 21:10:29 -0700 Subject: [PATCH 21/30] finish simplifying with same semantics --- libtonode-tests/tests/concrete.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libtonode-tests/tests/concrete.rs b/libtonode-tests/tests/concrete.rs index 105f5f28f5..bb131ed056 100644 --- a/libtonode-tests/tests/concrete.rs +++ b/libtonode-tests/tests/concrete.rs @@ -462,8 +462,8 @@ mod fast { assert_eq!(value_transfers, value_transfers1); assert_eq!(value_transfers, value_transfers2); - assert_eq!(value_transfers.0, value_transfers3.0); - assert_eq!(value_transfers.0, value_transfers4.0); + assert_eq!(value_transfers, &value_transfers3); + assert_eq!(value_transfers, &value_transfers4); } pub mod tex { From b7a7d979d0726f2305b0ef0dc7d4ba5fc497ebed Mon Sep 17 00:00:00 2001 From: zancas Date: Fri, 29 Nov 2024 21:14:04 -0700 Subject: [PATCH 22/30] fix incorrect test assertion, and rm dbg --- libtonode-tests/tests/concrete.rs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/libtonode-tests/tests/concrete.rs b/libtonode-tests/tests/concrete.rs index bb131ed056..a3696987bf 100644 --- a/libtonode-tests/tests/concrete.rs +++ b/libtonode-tests/tests/concrete.rs @@ -501,11 +501,11 @@ mod fast { let proposal = sender.propose_send(transaction_request).await.unwrap(); assert_eq!(proposal.steps().len(), 2usize); - let sent_txids_according_to_broadcast = sender + let _sent_txids_according_to_broadcast = sender .complete_and_broadcast_stored_proposal() .await .unwrap(); - let txids = sender + let _txids = sender .wallet .transactions() .read() @@ -514,8 +514,6 @@ mod fast { .keys() .cloned() .collect::>(); - dbg!(&txids); - dbg!(sent_txids_according_to_broadcast); assert_eq!( sender .wallet @@ -526,10 +524,10 @@ mod fast { .len(), 3usize ); - let val_tranfers = dbg!(sender.sorted_value_transfers(true).await); + let val_transfers = sender.sorted_value_transfers(true).await; // This fails, as we don't scan sends to tex correctly yet assert_eq!( - val_tranfers.0[0].recipient_address().unwrap(), + val_transfers[1].recipient_address().unwrap(), tex_addr_from_first.encode() ); } From 496a44450dd6e4d64cad6598da7fb4c47448fa2a Mon Sep 17 00:00:00 2001 From: zancas Date: Fri, 29 Nov 2024 21:34:22 -0700 Subject: [PATCH 23/30] these implementations make ValueTransfer ergonomic, important for clarity --- zingolib/src/wallet/data.rs | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/zingolib/src/wallet/data.rs b/zingolib/src/wallet/data.rs index 8e2906e3af..04fcc88dc9 100644 --- a/zingolib/src/wallet/data.rs +++ b/zingolib/src/wallet/data.rs @@ -680,16 +680,41 @@ pub mod summaries { /// A wrapper struct for implementing display and json on a vec of value trasnfers #[derive(PartialEq, Debug)] pub struct ValueTransfers(pub Vec); + impl<'a> std::iter::IntoIterator for &'a ValueTransfers { + type Item = &'a ValueTransfer; + type IntoIter = std::slice::Iter<'a, ValueTransfer>; + + fn into_iter(self) -> Self::IntoIter { + self.iter() + } + } + impl std::ops::Deref for ValueTransfers { + type Target = Vec; + + fn deref(&self) -> &Self::Target { + &self.0 + } + } + impl std::ops::DerefMut for ValueTransfers { + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.0 + } + } + // Implement the Index trait + impl std::ops::Index for ValueTransfers { + type Output = ValueTransfer; // The type of the value returned by the index + + fn index(&self, index: usize) -> &Self::Output { + &self.0[index] // Forward the indexing operation to the underlying data structure + } + } impl ValueTransfers { /// Creates a new ValueTransfer + #[deprecated(since = "1.10.2", note = "never used")] pub fn new(value_transfers: Vec) -> Self { ValueTransfers(value_transfers) } - /// Implicitly dispatch to the wrapped data - pub fn iter(&self) -> std::slice::Iter { - self.0.iter() - } /// Creates value transfers for all notes in a transaction that are sent to another /// recipient. A value transfer is a group of all notes to a specific receiver in a transaction. From ab4ce7d2e612865faeabcd94ccef55ab645dc97b Mon Sep 17 00:00:00 2001 From: zancas Date: Fri, 29 Nov 2024 21:36:30 -0700 Subject: [PATCH 24/30] start applying ergonomic calls to ValueTransfer --- libtonode-tests/tests/concrete.rs | 124 ++++++++++-------------------- 1 file changed, 40 insertions(+), 84 deletions(-) diff --git a/libtonode-tests/tests/concrete.rs b/libtonode-tests/tests/concrete.rs index 0ecf865602..bf2e8ca98f 100644 --- a/libtonode-tests/tests/concrete.rs +++ b/libtonode-tests/tests/concrete.rs @@ -165,8 +165,6 @@ mod fast { let value_transfers = &recipient.sorted_value_transfers(true).await; - dbg!(value_transfers); - assert!(value_transfers.iter().any(|vt| vt.kind() == ValueTransferKind::Sent(SentValueTransfer::SendToSelf( SelfSendValueTransfer::Basic @@ -212,7 +210,7 @@ mod fast { let no_messages = &recipient.messages_containing(None).await; - assert_eq!(no_messages.0.len(), 0); + assert_eq!(no_messages.len(), 0); from_inputs::quick_send( &faucet, @@ -237,7 +235,7 @@ mod fast { let single_message = &recipient.messages_containing(None).await; - assert_eq!(single_message.0.len(), 1); + assert_eq!(single_message.len(), 1); } /// Test sending and receiving messages between three parties. @@ -254,9 +252,25 @@ mod fast { /// returns the expected messages for each party in the correct order. #[tokio::test] async fn message_thread() { + // Begin test setup let (regtest_manager, _cph, faucet, recipient, _txid) = scenarios::orchard_funded_recipient(10_000_000).await; - + macro_rules! send_and_sync { + ($client:ident, $message:ident) => { + // Propose sending the message + $client.propose_send($message.clone()).await.unwrap(); + // Complete and broadcast the stored proposal + $client + .complete_and_broadcast_stored_proposal() + .await + .unwrap(); + // Increase the height and wait for the client + increase_height_and_wait_for_client(®test_manager, &$client, 1) + .await + .unwrap(); + }; + } + // Addresses: alice, bob, charlie let alice = get_base_address(&recipient, PoolType::ORCHARD).await; let bob = faucet .wallet @@ -270,7 +284,6 @@ mod fast { false, ) .unwrap(); - let charlie = faucet .wallet .wallet_capability() @@ -284,6 +297,7 @@ mod fast { ) .unwrap(); + // messages let alice_to_bob = TransactionRequest::new(vec![Payment::new( ZcashAddress::from_str(&bob.encode(&faucet.config().chain)).unwrap(), NonNegativeAmount::from_u64(1_000).unwrap(), @@ -296,7 +310,6 @@ mod fast { ) .unwrap()]) .unwrap(); - let alice_to_bob_2 = TransactionRequest::new(vec![Payment::new( ZcashAddress::from_str(&bob.encode(&faucet.config().chain)).unwrap(), NonNegativeAmount::from_u64(1_000).unwrap(), @@ -309,7 +322,6 @@ mod fast { ) .unwrap()]) .unwrap(); - let alice_to_charlie = TransactionRequest::new(vec![Payment::new( ZcashAddress::from_str(&charlie.encode(&faucet.config().chain)).unwrap(), NonNegativeAmount::from_u64(1_000).unwrap(), @@ -322,7 +334,6 @@ mod fast { ) .unwrap()]) .unwrap(); - let charlie_to_alice = TransactionRequest::new(vec![Payment::new( ZcashAddress::from_str(&alice).unwrap(), NonNegativeAmount::from_u64(1_000).unwrap(), @@ -339,7 +350,6 @@ mod fast { ) .unwrap()]) .unwrap(); - let bob_to_alice = TransactionRequest::new(vec![Payment::new( ZcashAddress::from_str(&alice).unwrap(), NonNegativeAmount::from_u64(1_000).unwrap(), @@ -356,92 +366,40 @@ mod fast { ) .unwrap()]) .unwrap(); - - recipient.propose_send(alice_to_bob.clone()).await.unwrap(); - - recipient - .complete_and_broadcast_stored_proposal() - .await - .unwrap(); - - increase_height_and_wait_for_client(®test_manager, &recipient, 1) - .await - .unwrap(); - - recipient - .propose_send(alice_to_bob_2.clone()) - .await - .unwrap(); - - recipient - .complete_and_broadcast_stored_proposal() - .await - .unwrap(); - - increase_height_and_wait_for_client(®test_manager, &recipient, 1) - .await - .unwrap(); - - faucet.propose_send(bob_to_alice.clone()).await.unwrap(); - - faucet - .complete_and_broadcast_stored_proposal() - .await - .unwrap(); - - increase_height_and_wait_for_client(®test_manager, &recipient, 1) - .await - .unwrap(); - - recipient - .propose_send(alice_to_charlie.clone()) - .await - .unwrap(); - - recipient - .complete_and_broadcast_stored_proposal() - .await - .unwrap(); - - faucet.propose_send(charlie_to_alice.clone()).await.unwrap(); - - faucet - .complete_and_broadcast_stored_proposal() - .await - .unwrap(); - + // Complete test setup + + // Message Sending + send_and_sync!(recipient, alice_to_bob); + send_and_sync!(recipient, alice_to_bob_2); + send_and_sync!(faucet, bob_to_alice); + send_and_sync!(recipient, alice_to_charlie); + send_and_sync!(faucet, charlie_to_alice); + // Final sync of recipient increase_height_and_wait_for_client(®test_manager, &recipient, 1) .await .unwrap(); + // Collect observations let value_transfers_bob = &recipient .messages_containing(Some(&bob.encode(&recipient.config().chain))) .await; - let value_transfers_charlie = &recipient .messages_containing(Some(&charlie.encode(&recipient.config().chain))) .await; - let all_vts = &recipient.sorted_value_transfers(true).await; let all_messages = &recipient.messages_containing(None).await; - for vt in all_vts.0.iter() { - dbg!(vt.blockheight()); - } - - assert_eq!(value_transfers_bob.0.len(), 3); - assert_eq!(value_transfers_charlie.0.len(), 2); + // Make assertions + assert_eq!(value_transfers_bob.len(), 3); + assert_eq!(value_transfers_charlie.len(), 2); // Also asserting the order now (sorry juanky) // ALL MESSAGES (First one should be the oldest one) assert!(all_messages - .0 .windows(2) .all(|pair| { pair[0].blockheight() <= pair[1].blockheight() })); - // ALL VTS (First one should be the most recent one) assert!(all_vts - .0 .windows(2) .all(|pair| { pair[0].blockheight() >= pair[1].blockheight() })); } @@ -497,15 +455,15 @@ mod fast { let mut value_transfers3 = recipient.sorted_value_transfers(false).await; let mut value_transfers4 = recipient.sorted_value_transfers(false).await; - assert_eq!(value_transfers.0[0].memos().len(), 4); + assert_eq!(value_transfers[0].memos().len(), 4); - value_transfers3.0.reverse(); - value_transfers4.0.reverse(); + value_transfers3.reverse(); + value_transfers4.reverse(); assert_eq!(value_transfers, value_transfers1); assert_eq!(value_transfers, value_transfers2); - assert_eq!(value_transfers.0, value_transfers3.0); - assert_eq!(value_transfers.0, value_transfers4.0); + assert_eq!(value_transfers, &value_transfers3); + assert_eq!(value_transfers, &value_transfers4); } pub mod tex { @@ -543,11 +501,11 @@ mod fast { let proposal = sender.propose_send(transaction_request).await.unwrap(); assert_eq!(proposal.steps().len(), 2usize); - let sent_txids_according_to_broadcast = sender + let _sent_txids_according_to_broadcast = sender .complete_and_broadcast_stored_proposal() .await .unwrap(); - let txids = sender + let _txids = sender .wallet .transactions() .read() @@ -556,8 +514,6 @@ mod fast { .keys() .cloned() .collect::>(); - dbg!(&txids); - dbg!(sent_txids_according_to_broadcast); assert_eq!( sender .wallet From 513c8f263b6336b8a114c40cc207858e7f49edf3 Mon Sep 17 00:00:00 2001 From: zancas Date: Fri, 29 Nov 2024 22:07:56 -0700 Subject: [PATCH 25/30] complete migration to idiomatic ValueTransfers interface --- darkside-tests/tests/advanced_reorg_tests.rs | 22 ++++++------- libtonode-tests/tests/concrete.rs | 2 +- zingolib/src/lightclient/describe.rs | 16 +++++----- .../src/testutils/chain_generics/fixtures.rs | 31 +++++++------------ zingolib/src/wallet/data.rs | 3 +- 5 files changed, 33 insertions(+), 41 deletions(-) diff --git a/darkside-tests/tests/advanced_reorg_tests.rs b/darkside-tests/tests/advanced_reorg_tests.rs index ab7ad2959a..46b6eb8ccf 100644 --- a/darkside-tests/tests/advanced_reorg_tests.rs +++ b/darkside-tests/tests/advanced_reorg_tests.rs @@ -58,7 +58,7 @@ async fn reorg_changes_incoming_tx_height() { } ); - let before_reorg_transactions = light_client.sorted_value_transfers(true).await.0; + let before_reorg_transactions = light_client.sorted_value_transfers(true).await; assert_eq!(before_reorg_transactions.len(), 1); assert_eq!( @@ -93,7 +93,7 @@ async fn reorg_changes_incoming_tx_height() { } ); - let after_reorg_transactions = light_client.sorted_value_transfers(true).await.0; + let after_reorg_transactions = light_client.sorted_value_transfers(true).await; assert_eq!(after_reorg_transactions.len(), 1); assert_eq!( @@ -214,7 +214,7 @@ async fn reorg_changes_incoming_tx_index() { } ); - let before_reorg_transactions = light_client.sorted_value_transfers(true).await.0; + let before_reorg_transactions = light_client.sorted_value_transfers(true).await; assert_eq!(before_reorg_transactions.len(), 1); assert_eq!( @@ -249,7 +249,7 @@ async fn reorg_changes_incoming_tx_index() { } ); - let after_reorg_transactions = light_client.sorted_value_transfers(true).await.0; + let after_reorg_transactions = light_client.sorted_value_transfers(true).await; assert_eq!(after_reorg_transactions.len(), 1); assert_eq!( @@ -369,7 +369,7 @@ async fn reorg_expires_incoming_tx() { } ); - let before_reorg_transactions = light_client.sorted_value_transfers(true).await.0; + let before_reorg_transactions = light_client.sorted_value_transfers(true).await; assert_eq!(before_reorg_transactions.len(), 1); assert_eq!( @@ -404,7 +404,7 @@ async fn reorg_expires_incoming_tx() { } ); - let after_reorg_transactions = light_client.sorted_value_transfers(true).await.0; + let after_reorg_transactions = light_client.sorted_value_transfers(true).await; assert_eq!(after_reorg_transactions.len(), 0); } @@ -547,7 +547,7 @@ async fn reorg_changes_outgoing_tx_height() { } ); - let before_reorg_transactions = light_client.sorted_value_transfers(true).await.0; + let before_reorg_transactions = light_client.sorted_value_transfers(true).await; assert_eq!(before_reorg_transactions.len(), 1); assert_eq!( @@ -661,7 +661,7 @@ async fn reorg_changes_outgoing_tx_height() { expected_after_reorg_balance ); - let after_reorg_transactions = light_client.sorted_value_transfers(true).await.0; + let after_reorg_transactions = light_client.sorted_value_transfers(true).await; assert_eq!(after_reorg_transactions.len(), 3); @@ -786,7 +786,7 @@ async fn reorg_expires_outgoing_tx_height() { light_client.do_sync(true).await.unwrap(); assert_eq!(light_client.do_balance().await, expected_initial_balance); - let before_reorg_transactions = light_client.sorted_value_transfers(true).await.0; + let before_reorg_transactions = light_client.sorted_value_transfers(true).await; assert_eq!(before_reorg_transactions.len(), 1); assert_eq!( @@ -872,7 +872,7 @@ async fn reorg_expires_outgoing_tx_height() { // sent transaction was never mined and has expired. assert_eq!(light_client.do_balance().await, expected_initial_balance); - let after_reorg_transactions = light_client.sorted_value_transfers(true).await.0; + let after_reorg_transactions = light_client.sorted_value_transfers(true).await; assert_eq!(after_reorg_transactions.len(), 1); @@ -964,7 +964,7 @@ async fn reorg_changes_outgoing_tx_index() { } ); - let before_reorg_transactions = light_client.sorted_value_transfers(true).await.0; + let before_reorg_transactions = light_client.sorted_value_transfers(true).await; assert_eq!(before_reorg_transactions.len(), 1); assert_eq!( diff --git a/libtonode-tests/tests/concrete.rs b/libtonode-tests/tests/concrete.rs index bf2e8ca98f..11f16a3bda 100644 --- a/libtonode-tests/tests/concrete.rs +++ b/libtonode-tests/tests/concrete.rs @@ -527,7 +527,7 @@ mod fast { let val_tranfers = dbg!(sender.sorted_value_transfers(true).await); // This fails, as we don't scan sends to tex correctly yet assert_eq!( - val_tranfers.0[0].recipient_address().unwrap(), + val_tranfers[0].recipient_address().unwrap(), tex_addr_from_first.encode() ); } diff --git a/zingolib/src/lightclient/describe.rs b/zingolib/src/lightclient/describe.rs index 7c168abe77..6db0510fe4 100644 --- a/zingolib/src/lightclient/describe.rs +++ b/zingolib/src/lightclient/describe.rs @@ -265,7 +265,7 @@ impl LightClient { /// Provides a list of ValueTransfers associated with the sender, or containing the string. pub async fn messages_containing(&self, filter: Option<&str>) -> ValueTransfers { - let mut value_transfers = self.sorted_value_transfers(true).await.0; + let mut value_transfers = self.sorted_value_transfers(true).await; value_transfers.reverse(); // Filter out VTs where all memos are empty. @@ -293,7 +293,7 @@ impl LightClient { None => value_transfers.retain(|vt| !vt.memos().is_empty()), } - ValueTransfers(value_transfers) + value_transfers } /// Provides a list of value transfers sorted @@ -301,7 +301,7 @@ impl LightClient { pub async fn sorted_value_transfers(&self, newer_first: bool) -> ValueTransfers { let mut value_transfers = self.value_transfers().await; if newer_first { - value_transfers.0.reverse(); + value_transfers.reverse(); } value_transfers } @@ -557,7 +557,7 @@ impl LightClient { } }; } - ValueTransfers(value_transfers) + ValueTransfers::new(value_transfers) } /// TODO: doc comment @@ -700,9 +700,9 @@ impl LightClient { /// TODO: Add Doc Comment Here! pub async fn do_total_memobytes_to_address(&self) -> finsight::TotalMemoBytesToAddress { - let value_transfers = self.sorted_value_transfers(true).await.0; + let value_transfers = self.sorted_value_transfers(true).await; let mut memobytes_by_address = HashMap::new(); - for value_transfer in value_transfers { + for value_transfer in &value_transfers { if let ValueTransferKind::Sent(SentValueTransfer::Send) = value_transfer.kind() { let address = value_transfer .recipient_address() @@ -955,9 +955,9 @@ impl LightClient { } async fn value_transfer_by_to_address(&self) -> finsight::ValuesSentToAddress { - let value_transfers = self.sorted_value_transfers(false).await.0; + let value_transfers = self.sorted_value_transfers(false).await; let mut amount_by_address = HashMap::new(); - for value_transfer in value_transfers { + for value_transfer in &value_transfers { if let ValueTransferKind::Sent(SentValueTransfer::Send) = value_transfer.kind() { let address = value_transfer .recipient_address() diff --git a/zingolib/src/testutils/chain_generics/fixtures.rs b/zingolib/src/testutils/chain_generics/fixtures.rs index 4c7fcda713..ae3146a695 100644 --- a/zingolib/src/testutils/chain_generics/fixtures.rs +++ b/zingolib/src/testutils/chain_generics/fixtures.rs @@ -58,35 +58,28 @@ where ) .await; - assert_eq!(sender.sorted_value_transfers(true).await.0.len(), 3); + assert_eq!(sender.sorted_value_transfers(true).await.len(), 3); assert!(sender .sorted_value_transfers(false) .await - .0 .iter() .any(|vt| { vt.kind() == ValueTransferKind::Received })); assert!(sender .sorted_value_transfers(false) .await - .0 .iter() .any(|vt| { vt.kind() == ValueTransferKind::Sent(SentValueTransfer::Send) })); - assert!(sender - .sorted_value_transfers(false) - .await - .0 - .iter() - .any(|vt| { - vt.kind() - == ValueTransferKind::Sent(SentValueTransfer::SendToSelf( - SelfSendValueTransfer::MemoToSelf, - )) - })); + assert!(sender.sorted_value_transfers(false).await.iter().any(|vt| { + vt.kind() + == ValueTransferKind::Sent(SentValueTransfer::SendToSelf( + SelfSendValueTransfer::MemoToSelf, + )) + })); - assert_eq!(recipient.sorted_value_transfers(true).await.0.len(), 1); + assert_eq!(recipient.sorted_value_transfers(true).await.len(), 1); with_assertions::propose_send_bump_sync_all_recipients( &mut environment, @@ -96,18 +89,18 @@ where ) .await; - assert_eq!(sender.sorted_value_transfers(true).await.0.len(), 4); + assert_eq!(sender.sorted_value_transfers(true).await.len(), 4); assert_eq!( - sender.sorted_value_transfers(true).await.0[0].kind(), + sender.sorted_value_transfers(true).await[0].kind(), ValueTransferKind::Sent(SentValueTransfer::SendToSelf(SelfSendValueTransfer::Basic)) ); with_assertions::assure_propose_shield_bump_sync(&mut environment, &sender, false) .await .unwrap(); - assert_eq!(sender.sorted_value_transfers(true).await.0.len(), 5); + assert_eq!(sender.sorted_value_transfers(true).await.len(), 5); assert_eq!( - sender.sorted_value_transfers(true).await.0[0].kind(), + sender.sorted_value_transfers(true).await[0].kind(), ValueTransferKind::Sent(SentValueTransfer::SendToSelf(SelfSendValueTransfer::Shield)) ); } diff --git a/zingolib/src/wallet/data.rs b/zingolib/src/wallet/data.rs index 04fcc88dc9..8d7f0e8ffd 100644 --- a/zingolib/src/wallet/data.rs +++ b/zingolib/src/wallet/data.rs @@ -679,7 +679,7 @@ pub mod summaries { /// A wrapper struct for implementing display and json on a vec of value trasnfers #[derive(PartialEq, Debug)] - pub struct ValueTransfers(pub Vec); + pub struct ValueTransfers(Vec); impl<'a> std::iter::IntoIterator for &'a ValueTransfers { type Item = &'a ValueTransfer; type IntoIter = std::slice::Iter<'a, ValueTransfer>; @@ -711,7 +711,6 @@ pub mod summaries { impl ValueTransfers { /// Creates a new ValueTransfer - #[deprecated(since = "1.10.2", note = "never used")] pub fn new(value_transfers: Vec) -> Self { ValueTransfers(value_transfers) } From 2ed49cb21fbfa1929fd0a2db42aa1dc618946c31 Mon Sep 17 00:00:00 2001 From: zancas Date: Sat, 30 Nov 2024 06:28:39 -0700 Subject: [PATCH 26/30] propose short staling interval --- zingolib/src/wallet/transaction_records_by_id.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/zingolib/src/wallet/transaction_records_by_id.rs b/zingolib/src/wallet/transaction_records_by_id.rs index e8d9f92044..a59abc8aec 100644 --- a/zingolib/src/wallet/transaction_records_by_id.rs +++ b/zingolib/src/wallet/transaction_records_by_id.rs @@ -466,9 +466,9 @@ impl TransactionRecordsById { /// Invalidates all those transactions which were broadcast but never 'confirmed' accepted by a miner. pub(crate) fn clear_expired_mempool(&mut self, latest_height: u64) { - let cutoff = BlockHeight::from_u32( - (latest_height.saturating_sub(crate::config::MAX_REORG as u64)) as u32, - ); + let stale_watch_interval = 3; + let cutoff = + BlockHeight::from_u32((latest_height.saturating_sub(stale_watch_interval)) as u32); let txids_to_remove = self .iter() From d31c9d0400863ce0e7863e86b1e51abe1b485509 Mon Sep 17 00:00:00 2001 From: zancas Date: Sat, 30 Nov 2024 12:45:35 -0700 Subject: [PATCH 27/30] name block window before clearing pending the pending_window, verify consistent behavior at 9 --- libtonode-tests/tests/concrete.rs | 8 ++++---- zingolib/src/wallet/transaction_records_by_id.rs | 8 +++++--- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/libtonode-tests/tests/concrete.rs b/libtonode-tests/tests/concrete.rs index 0ecf865602..5aab705bab 100644 --- a/libtonode-tests/tests/concrete.rs +++ b/libtonode-tests/tests/concrete.rs @@ -2741,7 +2741,6 @@ mod slow { */ } - // FIXME: it seems this test makes assertions on mempool but mempool monitoring is off? #[tokio::test] async fn mempool_clearing_and_full_batch_syncs_correct_trees() { async fn do_maybe_recent_txid(lc: &LightClient) -> JsonValue { @@ -2901,7 +2900,7 @@ mod slow { .find(|tx| tx["txid"] == sent_transaction_id) .unwrap() .clone(); - log::debug!("the transactions are: {}", &mempool_only_tx); + dbg!(&mempool_only_tx["txid"]); assert_eq!( mempool_only_tx["outgoing_metadata"][0]["memo"], "Outgoing Memo" @@ -2947,9 +2946,10 @@ mod slow { let transactions = recipient.do_list_transactions().await; + dbg!(notes.len()); // There are 2 unspent notes, the pending transaction, and the final receipt - println!("{}", json::stringify_pretty(notes.clone(), 4)); - println!("{}", json::stringify_pretty(transactions.clone(), 4)); + //println!("{}", json::stringify_pretty(notes.clone(), 4)); + //println!("{}", json::stringify_pretty(transactions.clone(), 4)); // Two unspent notes: one change, pending, one from faucet, confirmed assert_eq!(notes["unspent_orchard_notes"].len(), 2); assert_eq!(notes["unspent_sapling_notes"].len(), 0); diff --git a/zingolib/src/wallet/transaction_records_by_id.rs b/zingolib/src/wallet/transaction_records_by_id.rs index a59abc8aec..26eb1c5c2d 100644 --- a/zingolib/src/wallet/transaction_records_by_id.rs +++ b/zingolib/src/wallet/transaction_records_by_id.rs @@ -466,9 +466,11 @@ impl TransactionRecordsById { /// Invalidates all those transactions which were broadcast but never 'confirmed' accepted by a miner. pub(crate) fn clear_expired_mempool(&mut self, latest_height: u64) { - let stale_watch_interval = 3; - let cutoff = - BlockHeight::from_u32((latest_height.saturating_sub(stale_watch_interval)) as u32); + // Pending windows of less than 9 cause + // mempool_clearing_and_full_batch_syncs_correct_trees + // to FAIL + let pending_window = 9; + let cutoff = BlockHeight::from_u32((latest_height.saturating_sub(pending_window)) as u32); let txids_to_remove = self .iter() From 1f8f41e5e315fb07223f1f47e70c377606ad524e Mon Sep 17 00:00:00 2001 From: zancas Date: Sat, 30 Nov 2024 13:26:50 -0700 Subject: [PATCH 28/30] the pending_window is about 140 - 210 seconds, usually. --- libtonode-tests/tests/concrete.rs | 807 +++++++++--------- .../src/wallet/transaction_records_by_id.rs | 6 +- 2 files changed, 405 insertions(+), 408 deletions(-) diff --git a/libtonode-tests/tests/concrete.rs b/libtonode-tests/tests/concrete.rs index 5aab705bab..5f1e4d52d2 100644 --- a/libtonode-tests/tests/concrete.rs +++ b/libtonode-tests/tests/concrete.rs @@ -145,141 +145,432 @@ mod fast { use super::*; #[tokio::test] - async fn create_send_to_self_with_zfz_active() { - let (_regtest_manager, _cph, _faucet, recipient, _txid) = - scenarios::orchard_funded_recipient(5_000_000).await; - - recipient - .propose_send_all( - address_from_str(&get_base_address_macro!(&recipient, "unified")).unwrap(), - true, + async fn mempool_clearing_and_full_batch_syncs_correct_trees() { + async fn do_maybe_recent_txid(lc: &LightClient) -> JsonValue { + json::object! { + "last_txid" => lc.wallet.transactions().read().await.get_some_txid_from_highest_wallet_block().map(|t| t.to_string()) + } + } + let value = 100_000; + let regtest_network = RegtestNetwork::all_upgrades_active(); + let (regtest_manager, _cph, faucet, recipient, orig_transaction_id, _, _) = + scenarios::faucet_funded_recipient( + Some(value), + None, None, + PoolType::Shielded(ShieldedProtocol::Sapling), + regtest_network, + ) + .await; + let orig_transaction_id = orig_transaction_id.unwrap(); + assert_eq!( + do_maybe_recent_txid(&recipient).await["last_txid"], + orig_transaction_id + ); + // Put some transactions unrelated to the recipient (faucet->faucet) on-chain, to get some clutter + for _ in 0..5 { + zingolib::testutils::send_value_between_clients_and_sync( + ®test_manager, + &faucet, + &faucet, + 5_000, + "unified", ) .await .unwrap(); + } - recipient - .complete_and_broadcast_stored_proposal() - .await - .unwrap(); - - let value_transfers = &recipient.sorted_value_transfers(true).await; + let sent_to_self = 10; + // Send recipient->recipient, to make tree equality check at the end simpler + zingolib::testutils::send_value_between_clients_and_sync( + ®test_manager, + &recipient, + &recipient, + sent_to_self, + "unified", + ) + .await + .unwrap(); + let fees = zingolib::testutils::lightclient::get_fees_paid_by_client(&recipient).await; + assert_eq!(value - fees, 90_000); + let balance_minus_step_one_fees = value - fees; - dbg!(value_transfers); + // 3a. stash zcashd state + log::debug!( + "old zcashd chain info {}", + std::str::from_utf8( + ®test_manager + .get_cli_handle() + .arg("getblockchaininfo") + .output() + .unwrap() + .stdout + ) + .unwrap() + ); - assert!(value_transfers.iter().any(|vt| vt.kind() - == ValueTransferKind::Sent(SentValueTransfer::SendToSelf( - SelfSendValueTransfer::Basic - )))); - assert!(value_transfers.iter().any(|vt| vt.kind() - == ValueTransferKind::Sent(SentValueTransfer::Send) - && vt.recipient_address() == Some(ZENNIES_FOR_ZINGO_REGTEST_ADDRESS))); - } + // Turn zcashd off and on again, to write down the blocks + drop(_cph); // turn off zcashd and lightwalletd + let _cph = regtest_manager.launch(false).unwrap(); + log::debug!( + "new zcashd chain info {}", + std::str::from_utf8( + ®test_manager + .get_cli_handle() + .arg("getblockchaininfo") + .output() + .unwrap() + .stdout + ) + .unwrap() + ); - /// This tests checks that messages_containing returns an empty vector when empty memos are included. - #[tokio::test] - async fn filter_empty_messages() { - let mut environment = LibtonodeEnvironment::setup().await; + let zcd_datadir = ®test_manager.zcashd_data_dir; + let zcashd_parent = Path::new(zcd_datadir).parent().unwrap(); + let original_zcashd_directory = zcashd_parent.join("original_zcashd"); - let faucet = environment.create_faucet().await; - let recipient = environment.create_client().await; + log::debug!( + "The original zcashd directory is at: {}", + &original_zcashd_directory.to_string_lossy().to_string() + ); - environment.bump_chain().await; - faucet.do_sync(false).await.unwrap(); + let source = &zcd_datadir.to_string_lossy().to_string(); + let dest = &original_zcashd_directory.to_string_lossy().to_string(); + std::process::Command::new("cp") + .arg("-rf") + .arg(source) + .arg(dest) + .output() + .expect("directory copy failed"); - check_client_balances!(faucet, o: 0 s: 2_500_000_000u64 t: 0u64); + // 3. Send z-to-z transaction to external z address with a memo + let sent_value = 2000; + let outgoing_memo = "Outgoing Memo"; - from_inputs::quick_send( - &faucet, - vec![ - ( - get_base_address_macro!(recipient, "unified").as_str(), - 5_000, - Some(""), - ), - ( - get_base_address_macro!(recipient, "unified").as_str(), - 5_000, - Some(""), - ), - ], + let sent_transaction_id = from_inputs::quick_send( + &recipient, + vec![( + &get_base_address_macro!(faucet, "sapling"), + sent_value, + Some(outgoing_memo), + )], ) .await - .unwrap(); + .unwrap() + .first() + .to_string(); - environment.bump_chain().await; + let second_transaction_fee; + { + let tmds = recipient + .wallet + .transaction_context + .transaction_metadata_set + .read() + .await; + let record = tmds + .transaction_records_by_id + .get( + &crate::utils::conversion::txid_from_hex_encoded_str(&sent_transaction_id) + .unwrap(), + ) + .unwrap(); + second_transaction_fee = tmds + .transaction_records_by_id + .calculate_transaction_fee(record) + .unwrap(); + // Sync recipient + } // drop transaction_record references and tmds read lock recipient.do_sync(false).await.unwrap(); - let no_messages = &recipient.messages_containing(None).await; - - assert_eq!(no_messages.0.len(), 0); - - from_inputs::quick_send( - &faucet, - vec![ - ( - get_base_address_macro!(recipient, "unified").as_str(), - 5_000, - Some("Hello"), - ), - ( - get_base_address_macro!(recipient, "unified").as_str(), - 5_000, - Some(""), - ), - ], - ) - .await - .unwrap(); + // 4b write down state before clearing the mempool + let notes_before = recipient.do_list_notes(true).await; + let transactions_before = recipient.do_list_transactions().await; - environment.bump_chain().await; + // Sync recipient again. We assert this should be a no-op, as we just synced recipient.do_sync(false).await.unwrap(); + let post_sync_notes_before = recipient.do_list_notes(true).await; + let post_sync_transactions_before = recipient.do_list_transactions().await; + assert_eq!(post_sync_notes_before, notes_before); + assert_eq!(post_sync_transactions_before, transactions_before); - let single_message = &recipient.messages_containing(None).await; - - assert_eq!(single_message.0.len(), 1); - } + drop(_cph); // Turn off zcashd and lightwalletd - /// Test sending and receiving messages between three parties. - /// - /// This test case consists of the following sequence of events: - /// - /// 1. Alice sends a message to Bob. - /// 2. Alice sends another message to Bob. - /// 3. Bob sends a message to Alice. - /// 4. Alice sends a message to Charlie. - /// 5. Charlie sends a message to Alice. - /// - /// After the messages are sent, the test checks that the `messages_containing` method - /// returns the expected messages for each party in the correct order. - #[tokio::test] - async fn message_thread() { - let (regtest_manager, _cph, faucet, recipient, _txid) = - scenarios::orchard_funded_recipient(10_000_000).await; + // 5. check that the sent transaction is correctly marked in the client + let transactions = recipient.do_list_transactions().await; + let mempool_only_tx = transactions + .members() + .find(|tx| tx["txid"] == sent_transaction_id) + .unwrap() + .clone(); + dbg!(&mempool_only_tx["txid"]); + assert_eq!( + mempool_only_tx["outgoing_metadata"][0]["memo"], + "Outgoing Memo" + ); + assert_eq!(mempool_only_tx["txid"], sent_transaction_id); - let alice = get_base_address(&recipient, PoolType::ORCHARD).await; - let bob = faucet - .wallet - .wallet_capability() - .new_address( - ReceiverSelection { - orchard: true, - sapling: true, - transparent: true, - }, - false, - ) - .unwrap(); + // 6. note that the client correctly considers the note pending + assert_eq!(mempool_only_tx["pending"], true); - let charlie = faucet - .wallet - .wallet_capability() - .new_address( - ReceiverSelection { - orchard: true, - sapling: true, - transparent: true, - }, + std::process::Command::new("rm") + .arg("-rf") + .arg(source) + .output() + .expect("recursive rm failed"); + std::process::Command::new("cp") + .arg("--recursive") + .arg("--remove-destination") + .arg(dest) + .arg(source) + .output() + .expect("directory copy failed"); + assert_eq!( + source, + ®test_manager + .zcashd_data_dir + .to_string_lossy() + .to_string() + ); + let _cph = regtest_manager.launch(false).unwrap(); + let notes_after = recipient.do_list_notes(true).await; + let transactions_after = recipient.do_list_transactions().await; + + assert_eq!(notes_before.pretty(2), notes_after.pretty(2)); + assert_eq!(transactions_before.pretty(2), transactions_after.pretty(2)); + + // 6. Mine 10 blocks, the pending transaction should still be there. + zingolib::testutils::increase_height_and_wait_for_client(®test_manager, &recipient, 1) + .await + .unwrap(); + assert_eq!(recipient.wallet.last_synced_height().await, 12); + + let notes = recipient.do_list_notes(true).await; + + let transactions = recipient.do_list_transactions().await; + + // There are 2 unspent notes, the pending transaction, and the final receipt + //println!("{}", json::stringify_pretty(notes.clone(), 4)); + //println!("{}", json::stringify_pretty(transactions.clone(), 4)); + // Two unspent notes: one change, pending, one from faucet, confirmed + assert_eq!(notes["unspent_orchard_notes"].len(), 2); + assert_eq!(notes["unspent_sapling_notes"].len(), 0); + let note = notes["unspent_orchard_notes"][1].clone(); + assert_eq!(note["created_in_txid"], sent_transaction_id); + assert_eq!( + note["value"].as_u64().unwrap(), + balance_minus_step_one_fees - sent_value - second_transaction_fee - sent_to_self + ); + assert!(note["pending"].as_bool().unwrap()); + assert_eq!(transactions.len(), 3); + + // 7. Mine 3 blocks, so the 2 block pending_window is passed + zingolib::testutils::increase_height_and_wait_for_client(®test_manager, &recipient, 3) + .await + .unwrap(); + assert_eq!(recipient.wallet.last_synced_height().await, 15); + + let notes = recipient.do_list_notes(true).await; + let transactions = recipient.do_list_transactions().await; + + // There are now three notes, the original (confirmed and spent) note, the send to self note, and its change. + assert_eq!(notes["unspent_orchard_notes"].len(), 2); + assert_eq!( + notes["spent_orchard_notes"][0]["created_in_txid"], + orig_transaction_id + ); + assert!(!notes["unspent_orchard_notes"][0]["pending"] + .as_bool() + .unwrap()); + assert_eq!(notes["pending_orchard_notes"].len(), 0); + assert_eq!(transactions.len(), 2); + let read_lock = recipient + .wallet + .transaction_context + .transaction_metadata_set + .read() + .await; + let wallet_trees = read_lock.witness_trees().unwrap(); + let last_leaf = wallet_trees + .witness_tree_orchard + .max_leaf_position(None) + .unwrap(); + let server_trees = zingolib::grpc_connector::get_trees( + recipient.get_server_uri(), + recipient.wallet.last_synced_height().await, + ) + .await + .unwrap(); + let server_orchard_front = zcash_primitives::merkle_tree::read_commitment_tree::< + MerkleHashOrchard, + &[u8], + { zingolib::wallet::data::COMMITMENT_TREE_LEVELS }, + >(&hex::decode(server_trees.orchard_tree).unwrap()[..]) + .unwrap() + .to_frontier() + .take(); + let mut server_orchard_shardtree: ShardTree<_, COMMITMENT_TREE_LEVELS, MAX_SHARD_LEVEL> = + ShardTree::new( + MemoryShardStore::::empty(), + MAX_REORG, + ); + server_orchard_shardtree + .insert_frontier_nodes( + server_orchard_front.unwrap(), + zingolib::testutils::incrementalmerkletree::Retention::Marked, + ) + .unwrap(); + // This height doesn't matter, all we need is any arbitrary checkpoint ID + // as witness_at_checkpoint_depth requres a checkpoint to function now + server_orchard_shardtree + .checkpoint(BlockHeight::from_u32(0)) + .unwrap(); + assert_eq!( + wallet_trees + .witness_tree_orchard + .witness_at_checkpoint_depth(last_leaf.unwrap(), 0) + .unwrap_or_else(|_| panic!("{:#?}", wallet_trees.witness_tree_orchard)), + server_orchard_shardtree + .witness_at_checkpoint_depth(last_leaf.unwrap(), 0) + .unwrap() + ) + } + #[tokio::test] + async fn create_send_to_self_with_zfz_active() { + let (_regtest_manager, _cph, _faucet, recipient, _txid) = + scenarios::orchard_funded_recipient(5_000_000).await; + + recipient + .propose_send_all( + address_from_str(&get_base_address_macro!(&recipient, "unified")).unwrap(), + true, + None, + ) + .await + .unwrap(); + + recipient + .complete_and_broadcast_stored_proposal() + .await + .unwrap(); + + let value_transfers = &recipient.sorted_value_transfers(true).await; + + dbg!(value_transfers); + + assert!(value_transfers.iter().any(|vt| vt.kind() + == ValueTransferKind::Sent(SentValueTransfer::SendToSelf( + SelfSendValueTransfer::Basic + )))); + assert!(value_transfers.iter().any(|vt| vt.kind() + == ValueTransferKind::Sent(SentValueTransfer::Send) + && vt.recipient_address() == Some(ZENNIES_FOR_ZINGO_REGTEST_ADDRESS))); + } + + /// This tests checks that messages_containing returns an empty vector when empty memos are included. + #[tokio::test] + async fn filter_empty_messages() { + let mut environment = LibtonodeEnvironment::setup().await; + + let faucet = environment.create_faucet().await; + let recipient = environment.create_client().await; + + environment.bump_chain().await; + faucet.do_sync(false).await.unwrap(); + + check_client_balances!(faucet, o: 0 s: 2_500_000_000u64 t: 0u64); + + from_inputs::quick_send( + &faucet, + vec![ + ( + get_base_address_macro!(recipient, "unified").as_str(), + 5_000, + Some(""), + ), + ( + get_base_address_macro!(recipient, "unified").as_str(), + 5_000, + Some(""), + ), + ], + ) + .await + .unwrap(); + + environment.bump_chain().await; + recipient.do_sync(false).await.unwrap(); + + let no_messages = &recipient.messages_containing(None).await; + + assert_eq!(no_messages.0.len(), 0); + + from_inputs::quick_send( + &faucet, + vec![ + ( + get_base_address_macro!(recipient, "unified").as_str(), + 5_000, + Some("Hello"), + ), + ( + get_base_address_macro!(recipient, "unified").as_str(), + 5_000, + Some(""), + ), + ], + ) + .await + .unwrap(); + + environment.bump_chain().await; + recipient.do_sync(false).await.unwrap(); + + let single_message = &recipient.messages_containing(None).await; + + assert_eq!(single_message.0.len(), 1); + } + + /// Test sending and receiving messages between three parties. + /// + /// This test case consists of the following sequence of events: + /// + /// 1. Alice sends a message to Bob. + /// 2. Alice sends another message to Bob. + /// 3. Bob sends a message to Alice. + /// 4. Alice sends a message to Charlie. + /// 5. Charlie sends a message to Alice. + /// + /// After the messages are sent, the test checks that the `messages_containing` method + /// returns the expected messages for each party in the correct order. + #[tokio::test] + async fn message_thread() { + let (regtest_manager, _cph, faucet, recipient, _txid) = + scenarios::orchard_funded_recipient(10_000_000).await; + + let alice = get_base_address(&recipient, PoolType::ORCHARD).await; + let bob = faucet + .wallet + .wallet_capability() + .new_address( + ReceiverSelection { + orchard: true, + sapling: true, + transparent: true, + }, + false, + ) + .unwrap(); + + let charlie = faucet + .wallet + .wallet_capability() + .new_address( + ReceiverSelection { + orchard: true, + sapling: true, + transparent: true, + }, false, ) .unwrap(); @@ -2741,298 +3032,6 @@ mod slow { */ } - #[tokio::test] - async fn mempool_clearing_and_full_batch_syncs_correct_trees() { - async fn do_maybe_recent_txid(lc: &LightClient) -> JsonValue { - json::object! { - "last_txid" => lc.wallet.transactions().read().await.get_some_txid_from_highest_wallet_block().map(|t| t.to_string()) - } - } - let value = 100_000; - let regtest_network = RegtestNetwork::all_upgrades_active(); - let (regtest_manager, _cph, faucet, recipient, orig_transaction_id, _, _) = - scenarios::faucet_funded_recipient( - Some(value), - None, - None, - PoolType::Shielded(ShieldedProtocol::Sapling), - regtest_network, - ) - .await; - let orig_transaction_id = orig_transaction_id.unwrap(); - assert_eq!( - do_maybe_recent_txid(&recipient).await["last_txid"], - orig_transaction_id - ); - // Put some transactions unrelated to the recipient (faucet->faucet) on-chain, to get some clutter - for _ in 0..5 { - zingolib::testutils::send_value_between_clients_and_sync( - ®test_manager, - &faucet, - &faucet, - 5_000, - "unified", - ) - .await - .unwrap(); - } - - let sent_to_self = 10; - // Send recipient->recipient, to make tree equality check at the end simpler - zingolib::testutils::send_value_between_clients_and_sync( - ®test_manager, - &recipient, - &recipient, - sent_to_self, - "unified", - ) - .await - .unwrap(); - let fees = get_fees_paid_by_client(&recipient).await; - assert_eq!(value - fees, 90_000); - let balance_minus_step_one_fees = value - fees; - - // 3a. stash zcashd state - log::debug!( - "old zcashd chain info {}", - std::str::from_utf8( - ®test_manager - .get_cli_handle() - .arg("getblockchaininfo") - .output() - .unwrap() - .stdout - ) - .unwrap() - ); - - // Turn zcashd off and on again, to write down the blocks - drop(_cph); // turn off zcashd and lightwalletd - let _cph = regtest_manager.launch(false).unwrap(); - log::debug!( - "new zcashd chain info {}", - std::str::from_utf8( - ®test_manager - .get_cli_handle() - .arg("getblockchaininfo") - .output() - .unwrap() - .stdout - ) - .unwrap() - ); - - let zcd_datadir = ®test_manager.zcashd_data_dir; - let zcashd_parent = Path::new(zcd_datadir).parent().unwrap(); - let original_zcashd_directory = zcashd_parent.join("original_zcashd"); - - log::debug!( - "The original zcashd directory is at: {}", - &original_zcashd_directory.to_string_lossy().to_string() - ); - - let source = &zcd_datadir.to_string_lossy().to_string(); - let dest = &original_zcashd_directory.to_string_lossy().to_string(); - std::process::Command::new("cp") - .arg("-rf") - .arg(source) - .arg(dest) - .output() - .expect("directory copy failed"); - - // 3. Send z-to-z transaction to external z address with a memo - let sent_value = 2000; - let outgoing_memo = "Outgoing Memo"; - - let sent_transaction_id = from_inputs::quick_send( - &recipient, - vec![( - &get_base_address_macro!(faucet, "sapling"), - sent_value, - Some(outgoing_memo), - )], - ) - .await - .unwrap() - .first() - .to_string(); - - let second_transaction_fee; - { - let tmds = recipient - .wallet - .transaction_context - .transaction_metadata_set - .read() - .await; - let record = tmds - .transaction_records_by_id - .get( - &crate::utils::conversion::txid_from_hex_encoded_str(&sent_transaction_id) - .unwrap(), - ) - .unwrap(); - second_transaction_fee = tmds - .transaction_records_by_id - .calculate_transaction_fee(record) - .unwrap(); - // Sync recipient - } // drop transaction_record references and tmds read lock - recipient.do_sync(false).await.unwrap(); - - // 4b write down state before clearing the mempool - let notes_before = recipient.do_list_notes(true).await; - let transactions_before = recipient.do_list_transactions().await; - - // Sync recipient again. We assert this should be a no-op, as we just synced - recipient.do_sync(false).await.unwrap(); - let post_sync_notes_before = recipient.do_list_notes(true).await; - let post_sync_transactions_before = recipient.do_list_transactions().await; - assert_eq!(post_sync_notes_before, notes_before); - assert_eq!(post_sync_transactions_before, transactions_before); - - drop(_cph); // Turn off zcashd and lightwalletd - - // 5. check that the sent transaction is correctly marked in the client - let transactions = recipient.do_list_transactions().await; - let mempool_only_tx = transactions - .members() - .find(|tx| tx["txid"] == sent_transaction_id) - .unwrap() - .clone(); - dbg!(&mempool_only_tx["txid"]); - assert_eq!( - mempool_only_tx["outgoing_metadata"][0]["memo"], - "Outgoing Memo" - ); - assert_eq!(mempool_only_tx["txid"], sent_transaction_id); - - // 6. note that the client correctly considers the note pending - assert_eq!(mempool_only_tx["pending"], true); - - std::process::Command::new("rm") - .arg("-rf") - .arg(source) - .output() - .expect("recursive rm failed"); - std::process::Command::new("cp") - .arg("--recursive") - .arg("--remove-destination") - .arg(dest) - .arg(source) - .output() - .expect("directory copy failed"); - assert_eq!( - source, - ®test_manager - .zcashd_data_dir - .to_string_lossy() - .to_string() - ); - let _cph = regtest_manager.launch(false).unwrap(); - let notes_after = recipient.do_list_notes(true).await; - let transactions_after = recipient.do_list_transactions().await; - - assert_eq!(notes_before.pretty(2), notes_after.pretty(2)); - assert_eq!(transactions_before.pretty(2), transactions_after.pretty(2)); - - // 6. Mine 10 blocks, the pending transaction should still be there. - zingolib::testutils::increase_height_and_wait_for_client(®test_manager, &recipient, 10) - .await - .unwrap(); - assert_eq!(recipient.wallet.last_synced_height().await, 21); - - let notes = recipient.do_list_notes(true).await; - - let transactions = recipient.do_list_transactions().await; - - dbg!(notes.len()); - // There are 2 unspent notes, the pending transaction, and the final receipt - //println!("{}", json::stringify_pretty(notes.clone(), 4)); - //println!("{}", json::stringify_pretty(transactions.clone(), 4)); - // Two unspent notes: one change, pending, one from faucet, confirmed - assert_eq!(notes["unspent_orchard_notes"].len(), 2); - assert_eq!(notes["unspent_sapling_notes"].len(), 0); - let note = notes["unspent_orchard_notes"][1].clone(); - assert_eq!(note["created_in_txid"], sent_transaction_id); - assert_eq!( - note["value"].as_u64().unwrap(), - balance_minus_step_one_fees - sent_value - second_transaction_fee - sent_to_self - ); - assert!(note["pending"].as_bool().unwrap()); - assert_eq!(transactions.len(), 3); - - // 7. Mine 100 blocks, so the mempool expires - zingolib::testutils::increase_height_and_wait_for_client(®test_manager, &recipient, 100) - .await - .unwrap(); - assert_eq!(recipient.wallet.last_synced_height().await, 121); - - let notes = recipient.do_list_notes(true).await; - let transactions = recipient.do_list_transactions().await; - - // There are now three notes, the original (confirmed and spent) note, the send to self note, and its change. - assert_eq!(notes["unspent_orchard_notes"].len(), 2); - assert_eq!( - notes["spent_orchard_notes"][0]["created_in_txid"], - orig_transaction_id - ); - assert!(!notes["unspent_orchard_notes"][0]["pending"] - .as_bool() - .unwrap()); - assert_eq!(notes["pending_orchard_notes"].len(), 0); - assert_eq!(transactions.len(), 2); - let read_lock = recipient - .wallet - .transaction_context - .transaction_metadata_set - .read() - .await; - let wallet_trees = read_lock.witness_trees().unwrap(); - let last_leaf = wallet_trees - .witness_tree_orchard - .max_leaf_position(None) - .unwrap(); - let server_trees = zingolib::grpc_connector::get_trees( - recipient.get_server_uri(), - recipient.wallet.last_synced_height().await, - ) - .await - .unwrap(); - let server_orchard_front = zcash_primitives::merkle_tree::read_commitment_tree::< - MerkleHashOrchard, - &[u8], - { zingolib::wallet::data::COMMITMENT_TREE_LEVELS }, - >(&hex::decode(server_trees.orchard_tree).unwrap()[..]) - .unwrap() - .to_frontier() - .take(); - let mut server_orchard_shardtree: ShardTree<_, COMMITMENT_TREE_LEVELS, MAX_SHARD_LEVEL> = - ShardTree::new( - MemoryShardStore::::empty(), - MAX_REORG, - ); - server_orchard_shardtree - .insert_frontier_nodes( - server_orchard_front.unwrap(), - zingolib::testutils::incrementalmerkletree::Retention::Marked, - ) - .unwrap(); - // This height doesn't matter, all we need is any arbitrary checkpoint ID - // as witness_at_checkpoint_depth requres a checkpoint to function now - server_orchard_shardtree - .checkpoint(BlockHeight::from_u32(0)) - .unwrap(); - assert_eq!( - wallet_trees - .witness_tree_orchard - .witness_at_checkpoint_depth(last_leaf.unwrap(), 0) - .unwrap_or_else(|_| panic!("{:#?}", wallet_trees.witness_tree_orchard)), - server_orchard_shardtree - .witness_at_checkpoint_depth(last_leaf.unwrap(), 0) - .unwrap() - ) - } // FIXME: it seems this test makes assertions on mempool but mempool monitoring is off? #[tokio::test] async fn mempool_and_balance() { diff --git a/zingolib/src/wallet/transaction_records_by_id.rs b/zingolib/src/wallet/transaction_records_by_id.rs index 26eb1c5c2d..678b438d6d 100644 --- a/zingolib/src/wallet/transaction_records_by_id.rs +++ b/zingolib/src/wallet/transaction_records_by_id.rs @@ -466,10 +466,8 @@ impl TransactionRecordsById { /// Invalidates all those transactions which were broadcast but never 'confirmed' accepted by a miner. pub(crate) fn clear_expired_mempool(&mut self, latest_height: u64) { - // Pending windows of less than 9 cause - // mempool_clearing_and_full_batch_syncs_correct_trees - // to FAIL - let pending_window = 9; + // Pending window: How long to wait past the chain tip before clearing a pending + let pending_window = 2; let cutoff = BlockHeight::from_u32((latest_height.saturating_sub(pending_window)) as u32); let txids_to_remove = self From 1a0c1a87aec042f8efcb97bcb3a43c6e5077f4f7 Mon Sep 17 00:00:00 2001 From: zancas Date: Sat, 30 Nov 2024 17:42:09 -0700 Subject: [PATCH 29/30] update dependency versions --- Cargo.lock | 128 ++++++++++++++++++++++++++--------------------------- Cargo.toml | 4 +- 2 files changed, 66 insertions(+), 66 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 26e2b39340..145dc15f28 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -159,7 +159,7 @@ checksum = "c7c24de15d275a1ecfd47a380fb4d5ec9bfe0933f309ed5e705b775596a3574d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -170,7 +170,7 @@ checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -349,7 +349,7 @@ dependencies = [ "regex", "rustc-hash", "shlex", - "syn 2.0.89", + "syn 2.0.90", "which", ] @@ -509,9 +509,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.2.1" +version = "1.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd9de9f2205d5ef3fd67e685b0df337994ddd4495e2a28d185500d0e1edfea47" +checksum = "f34d93e62b03caf570cccc334cbc6c2fceca82f39211051345108adcba3eebdc" dependencies = [ "jobserver", "libc", @@ -653,7 +653,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f76990911f2267d837d9d0ad060aa63aaad170af40904b29461734c339030d4d" dependencies = [ "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -769,7 +769,7 @@ dependencies = [ "tokio", "tonic", "tonic-build", - "tower 0.4.13", + "tower 0.5.1", "zcash_client_backend", "zcash_primitives", "zingo-netutils", @@ -864,7 +864,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -912,7 +912,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -1110,7 +1110,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -1173,7 +1173,7 @@ dependencies = [ "proc-macro-error2", "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -1585,7 +1585,7 @@ checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -1703,10 +1703,11 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.72" +version = "0.3.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a88f1bda2bd75b0452a14784937d796722fdebfe50df998aeb3f0b7603019a9" +checksum = "a865e038f7f6ed956f788f0d7d60c541fff74c7bd74272c5d4cf15c63743e705" dependencies = [ + "once_cell", "wasm-bindgen", ] @@ -1756,15 +1757,15 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "libc" -version = "0.2.166" +version = "0.2.167" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2ccc108bbc0b1331bd061864e7cd823c0cab660bbe6970e66e2c0614decde36" +checksum = "09d6582e104315a817dff97f75133544b2e094ee22447d2acf4a74e189ba06fc" [[package]] name = "libloading" -version = "0.8.5" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4" +checksum = "fc2f4eb4bc735547cfed7c0a4922cbd04a4655978c09b54f1f7b228750664c34" dependencies = [ "cfg-if", "windows-targets 0.52.6", @@ -1940,11 +1941,10 @@ dependencies = [ [[package]] name = "mio" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80e04d1dcff3aae0704555fe5fee3bcfaf3d1fdf8a7e521d5b9d2b42acb52cec" +checksum = "2886843bf800fba2e3377cff24abf6379b4c4d5c6681eaf9ea5b0d15090450bd" dependencies = [ - "hermit-abi", "libc", "wasi", "windows-sys 0.52.0", @@ -2108,7 +2108,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -2288,7 +2288,7 @@ checksum = "3c0f5fad0874fc7abcd4d750e76917eaebbecaa2c20bde22e1dbeeba8beb758c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -2351,7 +2351,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "64d1ec885c64d0457d564db4ec299b2dae3f9c02808b8ad9c3a089c591b18033" dependencies = [ "proc-macro2", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -2373,7 +2373,7 @@ dependencies = [ "proc-macro-error-attr2", "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -2432,7 +2432,7 @@ dependencies = [ "prost", "prost-types", "regex", - "syn 2.0.89", + "syn 2.0.90", "tempfile", ] @@ -2446,7 +2446,7 @@ dependencies = [ "itertools 0.13.0", "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -2761,7 +2761,7 @@ dependencies = [ "proc-macro2", "quote", "rust-embed-utils", - "syn 2.0.89", + "syn 2.0.90", "walkdir", ] @@ -3048,7 +3048,7 @@ checksum = "ad1e866f866923f252f05c889987993144fb74e722403468a4ebd70c3cd756c0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -3219,9 +3219,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.89" +version = "2.0.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44d46482f1c1c87acd84dea20c1bf5ebff4c757009ed6bf19cfd36fb10e92c4e" +checksum = "919d3b74a5dd0ccd15aeb8f93e7006bd9e14c295087c9896a110f490752bcf31" dependencies = [ "proc-macro2", "quote", @@ -3251,7 +3251,7 @@ checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -3322,7 +3322,7 @@ dependencies = [ "cfg-if", "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -3333,7 +3333,7 @@ checksum = "5c89e72a01ed4c579669add59014b9a524d609c0c88c6a585ce37485879f6ffb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", "test-case-core", ] @@ -3354,7 +3354,7 @@ checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -3447,7 +3447,7 @@ checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -3540,7 +3540,7 @@ dependencies = [ "prost-build", "prost-types", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -3595,7 +3595,6 @@ version = "0.1.41" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" dependencies = [ - "log", "pin-project-lite", "tracing-attributes", "tracing-core", @@ -3609,7 +3608,7 @@ checksum = "395ae124c09f9e6918a2310af6038fba074bcf474ac352496d5910dd59a2226d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -3635,9 +3634,9 @@ dependencies = [ [[package]] name = "tracing-subscriber" -version = "0.3.18" +version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" +checksum = "e8189decb5ac0fa7bc8b96b7cb9b2701d60d48805aca84a238004d665fcc4008" dependencies = [ "nu-ansi-term", "sharded-slab", @@ -3799,7 +3798,7 @@ checksum = "d674d135b4a8c1d7e813e2f8d1c9a58308aee4a680323066025e53132218bd91" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -3838,9 +3837,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.95" +version = "0.2.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "128d1e363af62632b8eb57219c8fd7877144af57558fb2ef0368d0087bddeb2e" +checksum = "d15e63b4482863c109d70a7b8706c1e364eb6ea449b201a76c5b89cedcec2d5c" dependencies = [ "cfg-if", "once_cell", @@ -3849,36 +3848,37 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.95" +version = "0.2.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb6dd4d3ca0ddffd1dd1c9c04f94b868c37ff5fac97c30b97cff2d74fce3a358" +checksum = "8d36ef12e3aaca16ddd3f67922bc63e48e953f126de60bd33ccc0101ef9998cd" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.45" +version = "0.4.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc7ec4f8827a71586374db3e87abdb5a2bb3a15afed140221307c3ec06b1f63b" +checksum = "9dfaf8f50e5f293737ee323940c7d8b08a66a95a419223d9f41610ca08b0833d" dependencies = [ "cfg-if", "js-sys", + "once_cell", "wasm-bindgen", "web-sys", ] [[package]] name = "wasm-bindgen-macro" -version = "0.2.95" +version = "0.2.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e79384be7f8f5a9dd5d7167216f022090cf1f9ec128e6e6a482a2cb5c5422c56" +checksum = "705440e08b42d3e4b36de7d66c944be628d579796b8090bfa3471478a2260051" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -3886,28 +3886,28 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.95" +version = "0.2.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26c6ab57572f7a24a4985830b120de1594465e5d500f24afe89e16b4e833ef68" +checksum = "98c9ae5a76e46f4deecd0f0255cc223cfa18dc9b261213b8aa0c7b36f61b3f1d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.95" +version = "0.2.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65fc09f10666a9f147042251e0dda9c18f166ff7de300607007e96bdebc1068d" +checksum = "6ee99da9c5ba11bd675621338ef6fa52296b76b83305e9b6e5c77d4c286d6d49" [[package]] name = "web-sys" -version = "0.3.72" +version = "0.3.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6488b90108c040df0fe62fa815cbdee25124641df01814dd7282749234c6112" +checksum = "a98bc3c33f0fe7e59ad7cd041b89034fa82a7c2d4365ca538dda6cdaf513863c" dependencies = [ "js-sys", "wasm-bindgen", @@ -4205,7 +4205,7 @@ checksum = "2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", "synstructure", ] @@ -4413,7 +4413,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -4433,7 +4433,7 @@ checksum = "595eed982f7d355beb85837f651fa22e90b3c044842dc7f2c2842c086f295808" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", "synstructure", ] @@ -4454,7 +4454,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -4476,7 +4476,7 @@ checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -4520,7 +4520,7 @@ dependencies = [ "thiserror", "tokio-rustls", "tonic", - "tower 0.4.13", + "tower 0.5.1", "webpki-roots 0.25.4", "zcash_client_backend", ] diff --git a/Cargo.toml b/Cargo.toml index 8c0e6f0cf1..077a95b9ea 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -91,10 +91,10 @@ tokio = "1" tokio-rustls = "0.26" tonic = {version = "0.12", features = ["tls", "tls-roots", "tls-webpki-roots"]} tonic-build = "0.12" -tower = { version = "0.4" } +tower = { version = "0.5" } tracing = "0.1" tracing-subscriber = "0.3" -webpki-roots = "0.25" +webpki-roots = "0.26" # Parallel processing crossbeam-channel = "0.5" From ba327233fac6508f6a6a88773131c7e4d56bc419 Mon Sep 17 00:00:00 2001 From: zancas Date: Sat, 30 Nov 2024 20:46:07 -0700 Subject: [PATCH 30/30] undeprecate, cargo update, fix typo, remove incorrect comment --- Cargo.lock | 296 ++++++++++++++++++------------ libtonode-tests/tests/concrete.rs | 3 +- zingolib/src/wallet/data.rs | 1 - 3 files changed, 182 insertions(+), 118 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 48b0eaca7f..3d9ca14dcc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -64,9 +64,9 @@ dependencies = [ [[package]] name = "anstream" -version = "0.6.17" +version = "0.6.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23a1e53f0f5d86382dafe1cf314783b2044280f406e7e1506368220ad11b1338" +checksum = "8acc5369981196006228e28809f761875c0327210a891e941f4c683b3a99529b" dependencies = [ "anstyle", "anstyle-parse", @@ -113,9 +113,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.92" +version = "1.0.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74f37166d7d48a0284b99dd824694c26119c700b53bf0d1540cdb147dbdaaf13" +checksum = "4c95c10ba0b00a02636238b814946408b1322d5ac4760326e6fb8ec956d85775" [[package]] name = "append-only-vec" @@ -187,21 +187,20 @@ checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "aws-lc-rs" -version = "1.10.0" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdd82dba44d209fddb11c190e0a94b78651f95299598e472215667417a03ff1d" +checksum = "f47bb8cc16b669d267eeccf585aea077d0882f4777b1c1f740217885d6e6e5a3" dependencies = [ "aws-lc-sys", - "mirai-annotations", "paste", "zeroize", ] [[package]] name = "aws-lc-sys" -version = "0.22.0" +version = "0.23.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df7a4168111d7eb622a31b214057b8509c0a7e1794f44c546d742330dc793972" +checksum = "a2101df3813227bbaaaa0b04cd61c534c7954b22bd68d399b440be937dc63ff7" dependencies = [ "bindgen", "cc", @@ -214,9 +213,9 @@ dependencies = [ [[package]] name = "axum" -version = "0.7.7" +version = "0.7.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "504e3947307ac8326a5437504c517c4b56716c9d98fac0028c2acc7ca47d70ae" +checksum = "edca88bc138befd0323b20752846e6587272d3b03b0343c8ea28a6f819e6e71f" dependencies = [ "async-trait", "axum-core", @@ -233,7 +232,7 @@ dependencies = [ "pin-project-lite", "rustversion", "serde", - "sync_wrapper 1.0.1", + "sync_wrapper 1.0.2", "tower 0.5.1", "tower-layer", "tower-service", @@ -254,7 +253,7 @@ dependencies = [ "mime", "pin-project-lite", "rustversion", - "sync_wrapper 1.0.1", + "sync_wrapper 1.0.2", "tower-layer", "tower-service", ] @@ -495,9 +494,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.8.0" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ac0150caa2ae65ca5bd83f25c7de183dea78d4d366469f148435e2acfbad0da" +checksum = "325918d6fe32f23b19878fe4b34794ae41fc19ddbe53b10571a4874d44ffd39b" [[package]] name = "cbc" @@ -596,18 +595,18 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.20" +version = "4.5.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b97f376d85a664d5837dbae44bf546e6477a679ff6610010f17276f686d867e8" +checksum = "fb3b4b9e5a7c7514dfa52869339ee98b3156b0bfb4e8a77c4ff4babb64b1604f" dependencies = [ "clap_builder", ] [[package]] name = "clap_builder" -version = "4.5.20" +version = "4.5.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19bc80abd44e4bed93ca373a0704ccbd1b710dc5749406201bb018272808dc54" +checksum = "b17a95aa67cc7b5ebd32aa5370189aa0d79069ef1c64ce893bd30fb24bff20ec" dependencies = [ "anstream", "anstyle", @@ -617,9 +616,9 @@ dependencies = [ [[package]] name = "clap_lex" -version = "0.7.2" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1462739cb27611015575c0c11df5df7601141071f07518d56fcc1be504cbec97" +checksum = "afb84c814227b90d6895e01398aee0d8033c00e7466aca416fb6a8e0eb19d8a7" [[package]] name = "clipboard-win" @@ -634,9 +633,9 @@ dependencies = [ [[package]] name = "cmake" -version = "0.1.51" +version = "0.1.52" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb1e43aa7fd152b1f968787f7dbcdeb306d1867ff373c69955211876c053f91a" +checksum = "c682c223677e0e5b6b7f63a64b9351844c3f1b1678a68b7ee617e30fb082620e" dependencies = [ "cc", ] @@ -673,6 +672,16 @@ dependencies = [ "libc", ] +[[package]] +name = "core-foundation" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b55271e5c8c478ad3f38ad24ef34923091e0548492a266d19b3c0b4d82574c63" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "core-foundation-sys" version = "0.8.7" @@ -681,9 +690,9 @@ checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" [[package]] name = "cpufeatures" -version = "0.2.14" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "608697df725056feaccfa42cffdaeeec3fccc4ffc38358ecd19b243e716a78e0" +checksum = "16b80225097f2e5ae4e7179dd2266824648f3e2f49d9134d584b76389d31c4c3" dependencies = [ "libc", ] @@ -924,12 +933,12 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "errno" -version = "0.3.9" +version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" +checksum = "33d852cb9b869c2a9b3df2f71a3074817f01e1844f839a144f5fcef059a4eb5d" dependencies = [ "libc", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -952,9 +961,9 @@ dependencies = [ [[package]] name = "fastrand" -version = "2.1.1" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8c02a5121d4ea3eb16a80748c74f5549a5665e4c21333c6098f283870fbdea6" +checksum = "486f806e73c5707928240ddc295403b1b93c96a02038563881c4a2fd84b81ac4" [[package]] name = "fd-lock" @@ -1194,9 +1203,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.4.6" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "524e8ac6999421f49a846c2d4411f337e53497d8ec55d67753beffa43c5d9205" +checksum = "ccae279728d634d083c00f6099cb58f01cc99c145b84b8be2f6c74618d79922e" dependencies = [ "atomic-waker", "bytes", @@ -1204,7 +1213,7 @@ dependencies = [ "futures-core", "futures-sink", "http", - "indexmap 2.6.0", + "indexmap 2.7.0", "slab", "tokio", "tokio-util", @@ -1259,9 +1268,9 @@ checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" [[package]] name = "hashbrown" -version = "0.15.0" +version = "0.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e087f84d4f86bf4b218b927129862374b72199ae7d8657835f1e89000eea4fb" +checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" [[package]] name = "heck" @@ -1353,9 +1362,9 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "hyper" -version = "1.5.0" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbbff0a806a4728c99295b254c8838933b5b082d75e3cb70c8dab21fdfbcfa9a" +checksum = "97818827ef4f364230e16705d4706e2897df2bb60617d6ca15d598025a3c481f" dependencies = [ "bytes", "futures-channel", @@ -1393,9 +1402,9 @@ dependencies = [ [[package]] name = "hyper-timeout" -version = "0.5.1" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3203a961e5c83b6f5498933e78b6b263e208c197b63e9c6c53cc82ffd3f63793" +checksum = "2b90d566bffbce6a75bd8b09a05aa8c2cb1fabb6cb348f8840c9e4c90a0d83b0" dependencies = [ "hyper", "hyper-util", @@ -1582,12 +1591,23 @@ dependencies = [ [[package]] name = "idna" -version = "0.5.0" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" +checksum = "686f825264d630750a544639377bae737628043f20d38bbc029e8f29ea968a7e" dependencies = [ - "unicode-bidi", - "unicode-normalization", + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "daca1df1c957320b2cf139ac61e7bd64fed304c5040df000a745aa1de3b4ef71" +dependencies = [ + "icu_normalizer", + "icu_properties", ] [[package]] @@ -1614,12 +1634,12 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.6.0" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" +checksum = "62f822373a4fe84d4bb149bf54e584a7f4abec90e072ed49cda0edea5b95471f" dependencies = [ "equivalent", - "hashbrown 0.15.0", + "hashbrown 0.15.2", ] [[package]] @@ -1669,9 +1689,9 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.11" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" +checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674" [[package]] name = "jobserver" @@ -1803,6 +1823,12 @@ version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" +[[package]] +name = "litemap" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ee93343901ab17bd981295f2cf0026d4ad018c7c31ba84549a4ddbb47a45104" + [[package]] name = "litrs" version = "0.4.1" @@ -1925,12 +1951,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "mirai-annotations" -version = "1.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9be0862c1b3f26a88803c4a49de6889c10e608b3ee9344e6ef5b45fb37ad3d1" - [[package]] name = "multimap" version = "0.10.0" @@ -1949,7 +1969,7 @@ dependencies = [ "openssl-probe", "openssl-sys", "schannel", - "security-framework", + "security-framework 2.11.1", "security-framework-sys", "tempfile", ] @@ -2249,7 +2269,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4c5cc86750666a3ed20bdaf5ca2a0344f9c67674cae0515bec2da16fbaa47db" dependencies = [ "fixedbitset", - "indexmap 2.6.0", + "indexmap 2.7.0", ] [[package]] @@ -2359,9 +2379,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.89" +version = "1.0.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f139b0662de085916d1fb67d2b4169d1addddda1919e696f3252b740b629986e" +checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0" dependencies = [ "unicode-ident", ] @@ -2631,9 +2651,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.8" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "368758f23274712b504848e9d5a6f010445cc8b87a7cdb4d7cbee666c1288da3" +checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" dependencies = [ "aho-corasick", "memchr", @@ -2686,7 +2706,7 @@ dependencies = [ "serde", "serde_json", "serde_urlencoded", - "sync_wrapper 1.0.1", + "sync_wrapper 1.0.2", "system-configuration", "tokio", "tokio-native-tls", @@ -2770,9 +2790,9 @@ checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" [[package]] name = "rustix" -version = "0.38.38" +version = "0.38.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa260229e6538e52293eeb577aabd09945a09d6d9cc0fc550ed7529056c2e32a" +checksum = "d7f649912bc1495e167a6edee79151c84b1bad49748cb4f1f1167f459f6224f6" dependencies = [ "bitflags 2.6.0", "errno", @@ -2783,9 +2803,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.23.16" +version = "0.23.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eee87ff5d9b36712a58574e12e9f0ea80f915a5b0ac518d322b24a465617925e" +checksum = "934b404430bb06b3fae2cba809eb45a1ab1aecd64491213d7c3301b88393f8d1" dependencies = [ "aws-lc-rs", "log", @@ -2799,15 +2819,14 @@ dependencies = [ [[package]] name = "rustls-native-certs" -version = "0.8.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcaf18a4f2be7326cd874a5fa579fae794320a0f388d365dca7e480e55f83f8a" +checksum = "7fcff2dd52b58a8d98a70243663a0d234c4e2b79235637849d15913394a247d3" dependencies = [ "openssl-probe", - "rustls-pemfile", "rustls-pki-types", "schannel", - "security-framework", + "security-framework 3.0.1", ] [[package]] @@ -2927,9 +2946,9 @@ dependencies = [ [[package]] name = "schannel" -version = "0.1.26" +version = "0.1.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01227be5826fa0690321a2ba6c5cd57a19cf3f6a09e76973b58e61de6ab9d1c1" +checksum = "1f29ebaa345f945cec9fbbc532eb307f0fdad8161f281b6369539c8d84876b3d" dependencies = [ "windows-sys 0.59.0", ] @@ -2974,7 +2993,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" dependencies = [ "bitflags 2.6.0", - "core-foundation", + "core-foundation 0.9.4", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework" +version = "3.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1415a607e92bec364ea2cf9264646dcce0f91e6d65281bd6f2819cca3bf39c8" +dependencies = [ + "bitflags 2.6.0", + "core-foundation 0.10.0", "core-foundation-sys", "libc", "security-framework-sys", @@ -2982,9 +3014,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.12.0" +version = "2.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea4a292869320c0272d7bc55a5a6aafaff59b4f63404a003887b679a2e05b4b6" +checksum = "fa39c7303dc58b5543c94d22c1766b0d31f2ee58306363ea622b10bbc075eaa2" dependencies = [ "core-foundation-sys", "libc", @@ -2992,9 +3024,9 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.214" +version = "1.0.215" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f55c3193aca71c12ad7890f1785d2b73e1b9f63a0bbc353c08ef26fe03fc56b5" +checksum = "6513c1ad0b11a9376da888e3e0baa0077f1aed55c17f50e7b2397136129fb88f" dependencies = [ "serde_derive", ] @@ -3011,9 +3043,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.214" +version = "1.0.215" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de523f781f095e28fa605cdce0f8307e451cc0fd14e2eb4cd2e98a355b147766" +checksum = "ad1e866f866923f252f05c889987993144fb74e722403468a4ebd70c3cd756c0" dependencies = [ "proc-macro2", "quote", @@ -3022,9 +3054,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.132" +version = "1.0.133" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d726bfaff4b320266d395898905d0eba0345aae23b54aee3a737e260fd46db03" +checksum = "c7fceb2473b9166b2294ef05efcb65a3db80803f0b03ef86a5fc88a2b85ee377" dependencies = [ "itoa", "memchr", @@ -3050,7 +3082,7 @@ version = "0.9.34+deprecated" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a8b1a1a2ebf674015cc02edccce75287f1a0130d394307b36743c2f5d504b47" dependencies = [ - "indexmap 2.6.0", + "indexmap 2.7.0", "itoa", "ryu", "serde", @@ -3131,9 +3163,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "socket2" -version = "0.5.7" +version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c" +checksum = "c970269d99b64e60ec3bd6ad27270092a5394c4e309314b18ae3fe575695fbe8" dependencies = [ "libc", "windows-sys 0.52.0", @@ -3145,6 +3177,12 @@ version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + [[package]] name = "static_assertions" version = "1.1.0" @@ -3165,9 +3203,9 @@ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "subtle" -version = "2.5.0" +version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "syn" @@ -3199,9 +3237,9 @@ checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" [[package]] name = "sync_wrapper" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394" +checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" dependencies = [ "futures-core", ] @@ -3224,7 +3262,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c879d448e9d986b661742763247d3693ed13609438cf3d006f51f5368a5ba6b" dependencies = [ "bitflags 2.6.0", - "core-foundation", + "core-foundation 0.9.4", "system-configuration-sys", ] @@ -3256,9 +3294,9 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.13.0" +version = "3.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0f2c9fc62d0beef6951ccffd757e241266a2c833136efbe35af6cd2567dca5b" +checksum = "28cce251fcbc87fac86a866eeb0d6c2d536fc16d06f184bb61aeae11aa4cee0c" dependencies = [ "cfg-if", "fastrand", @@ -3302,18 +3340,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.66" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d171f59dbaa811dbbb1aee1e73db92ec2b122911a48e1390dfe327a821ddede" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.66" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b08be0f17bd307950653ce45db00cd31200d82b624b36e181337d9c7d92765b5" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", @@ -3359,6 +3397,16 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" +[[package]] +name = "tinystr" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9117f5d4db391c1cf6927e7bea3db74b9a1c1add8f7eda9ffd5364f40f57b82f" +dependencies = [ + "displaydoc", + "zerovec", +] + [[package]] name = "tinyvec" version = "1.8.0" @@ -3376,9 +3424,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.41.0" +version = "1.41.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "145f3413504347a2be84393cc8a7d2fb4d863b375909ea59f2158261aa258bbb" +checksum = "22cfb5bee7a6a52939ca9224d6ac897bb669134078daa8735560897f69de4d33" dependencies = [ "backtrace", "bytes", @@ -3479,7 +3527,7 @@ dependencies = [ "tower-layer", "tower-service", "tracing", - "webpki-roots 0.26.6", + "webpki-roots 0.26.7", ] [[package]] @@ -3544,9 +3592,9 @@ checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" [[package]] name = "tracing" -version = "0.1.40" +version = "0.1.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" +checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" dependencies = [ "pin-project-lite", "tracing-attributes", @@ -3555,9 +3603,9 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.27" +version = "0.1.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" +checksum = "395ae124c09f9e6918a2310af6038fba074bcf474ac352496d5910dd59a2226d" dependencies = [ "proc-macro2", "quote", @@ -3566,9 +3614,9 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.32" +version = "0.1.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" +checksum = "e672c95779cf947c5311f83787af4fa8fffd12fb27e4993211a84bdfd9610f9c" dependencies = [ "once_cell", "valuable", @@ -3638,17 +3686,11 @@ version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94" -[[package]] -name = "unicode-bidi" -version = "0.3.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ab17db44d7388991a428b2ee655ce0c212e862eff1768a455c58f9aad6e7893" - [[package]] name = "unicode-ident" -version = "1.0.13" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" +checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83" [[package]] name = "unicode-normalization" @@ -3704,15 +3746,27 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] name = "url" -version = "2.5.2" +version = "2.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c" +checksum = "32f8b686cadd1473f4bd0117a5d28d36b1ade384ea9b5069a1c40aefed7fda60" dependencies = [ "form_urlencoded", "idna", "percent-encoding", ] +[[package]] +name = "utf16_iter" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8232dd3cdaed5356e0f716d285e4b40b932ac434100fe9b7e0e8e935b9e6246" + +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + [[package]] name = "utf8parse" version = "0.2.2" @@ -3868,9 +3922,9 @@ checksum = "5f20c57d8d7db6d3b86154206ae5d8fba62dd39573114de97c2cb0578251f8e1" [[package]] name = "webpki-roots" -version = "0.26.6" +version = "0.26.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "841c67bff177718f1d4dfefde8d8f0e78f9b6589319ba88312f567fc5841a958" +checksum = "5d642ff16b7e79272ae451b7322067cdc17cadf68c23264be9d94a32319efe7e" dependencies = [ "rustls-pki-types", ] @@ -4105,6 +4159,18 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" +[[package]] +name = "write16" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1890f4022759daae28ed4fe62859b1236caebfc61ede2f63ed4e695f3f6d936" + +[[package]] +name = "writeable" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51" + [[package]] name = "wyz" version = "0.5.1" diff --git a/libtonode-tests/tests/concrete.rs b/libtonode-tests/tests/concrete.rs index 236bba296c..50f1da0fa1 100644 --- a/libtonode-tests/tests/concrete.rs +++ b/libtonode-tests/tests/concrete.rs @@ -816,9 +816,8 @@ mod fast { 3usize ); let val_transfers = sender.sorted_value_transfers(true).await; - // This fails, as we don't scan sends to tex correctly yet assert_eq!( - val_tranfers[0].recipient_address().unwrap(), + val_transfers[0].recipient_address().unwrap(), tex_addr_from_first.encode() ); } diff --git a/zingolib/src/wallet/data.rs b/zingolib/src/wallet/data.rs index da13ef6588..8d7f0e8ffd 100644 --- a/zingolib/src/wallet/data.rs +++ b/zingolib/src/wallet/data.rs @@ -711,7 +711,6 @@ pub mod summaries { impl ValueTransfers { /// Creates a new ValueTransfer - #[deprecated(since = "1.10.2", note = "never used")] pub fn new(value_transfers: Vec) -> Self { ValueTransfers(value_transfers) }