From ffdbd9f44c2d05ea7026294e3598d6d8ab045233 Mon Sep 17 00:00:00 2001 From: fluidvanadium Date: Wed, 28 Aug 2024 22:25:23 +0000 Subject: [PATCH 1/7] moved get_transparent_addresses --- zingolib/src/lightclient/propose.rs | 11 +---------- zingolib/src/wallet/describe.rs | 9 +++++++++ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/zingolib/src/lightclient/propose.rs b/zingolib/src/lightclient/propose.rs index ff74b4e9d..8b5150148 100644 --- a/zingolib/src/lightclient/propose.rs +++ b/zingolib/src/lightclient/propose.rs @@ -180,7 +180,7 @@ impl LightClient { &input_selector, // don't shield dust NonNegativeAmount::const_from_u64(10_000), - &self.get_transparent_addresses(), + &self.wallet.get_transparent_addresses(), // review! do we want to require confirmations? // make it configurable? 0, @@ -289,15 +289,6 @@ impl LightClient { )) } - fn get_transparent_addresses(&self) -> Vec { - self.wallet - .wallet_capability() - .transparent_child_addresses() - .iter() - .map(|(_index, sk)| *sk) - .collect::>() - } - /// Creates and stores a proposal for shielding all transparent funds.. pub async fn propose_shield( &self, diff --git a/zingolib/src/wallet/describe.rs b/zingolib/src/wallet/describe.rs index 0ccbf3649..59641f053 100644 --- a/zingolib/src/wallet/describe.rs +++ b/zingolib/src/wallet/describe.rs @@ -284,6 +284,15 @@ impl LightWallet { pub fn transactions(&self) -> Arc> { self.transaction_context.transaction_metadata_set.clone() } + + /// lists the transparent addresses known by the wallet. + pub fn get_transparent_addresses(&self) -> Vec { + self.wallet_capability() + .transparent_child_addresses() + .iter() + .map(|(_index, sk)| *sk) + .collect::>() + } } #[cfg(test)] From 90f0258824d372231c352fc3912d4dd573e0249f Mon Sep 17 00:00:00 2001 From: fluidvanadium Date: Wed, 28 Aug 2024 22:37:07 +0000 Subject: [PATCH 2/7] begin moving propose to LightWallet from LightClient --- zingolib/src/lightclient/propose.rs | 145 ------------------------- zingolib/src/lightclient/send.rs | 7 +- zingolib/src/wallet.rs | 1 + zingolib/src/wallet/propose.rs | 162 ++++++++++++++++++++++++++++ 4 files changed, 166 insertions(+), 149 deletions(-) create mode 100644 zingolib/src/wallet/propose.rs diff --git a/zingolib/src/lightclient/propose.rs b/zingolib/src/lightclient/propose.rs index 8b5150148..3f1d5269c 100644 --- a/zingolib/src/lightclient/propose.rs +++ b/zingolib/src/lightclient/propose.rs @@ -25,78 +25,6 @@ use crate::wallet::send::change_memo_from_transaction_request; use crate::wallet::tx_map_and_maybe_trees::TxMapAndMaybeTrees; use crate::wallet::tx_map_and_maybe_trees::TxMapAndMaybeTreesTraitError; -type GISKit = GreedyInputSelector< - TxMapAndMaybeTrees, - zcash_client_backend::fees::zip317::SingleOutputChangeStrategy, ->; - -// This private helper is a very small DRY, but it has already corrected a minor -// divergence in change strategy. -// Because shielding operations are never expected to create dust notes this change -// is not a bugfix. -fn build_default_giskit(memo: Option) -> GISKit { - let change_strategy = zcash_client_backend::fees::zip317::SingleOutputChangeStrategy::new( - zcash_primitives::transaction::fees::zip317::FeeRule::standard(), - memo, - ShieldedProtocol::Orchard, - ); // review consider change strategy! - - GISKit::new( - change_strategy, - zcash_client_backend::fees::DustOutputPolicy::new( - zcash_client_backend::fees::DustAction::AllowDustChange, - None, - ), - ) -} -/// Errors that can result from do_propose -#[derive(Debug, Error)] -pub enum ProposeSendError { - /// error in using trait to create spend proposal - #[error("{0}")] - Proposal( - zcash_client_backend::data_api::error::Error< - TxMapAndMaybeTreesTraitError, - TxMapAndMaybeTreesTraitError, - zcash_client_backend::data_api::wallet::input_selection::GreedyInputSelectorError< - zcash_primitives::transaction::fees::zip317::FeeError, - zcash_client_backend::wallet::NoteId, - >, - zcash_primitives::transaction::fees::zip317::FeeError, - >, - ), - /// failed to construct a transaction request - #[error("{0}")] - TransactionRequestFailed(#[from] Zip321Error), - /// send all is transferring no value - #[error("send all is transferring no value. only enough funds to pay the fees!")] - ZeroValueSendAll, - /// failed to calculate balance. - #[error("failed to calculated balance. {0}")] - BalanceError(#[from] crate::wallet::error::BalanceError), -} - -/// Errors that can result from do_propose -#[derive(Debug, Error)] -pub enum ProposeShieldError { - /// error in parsed addresses - #[error("{0}")] - Receiver(zcash_client_backend::zip321::Zip321Error), - #[error("{0}")] - /// error in using trait to create shielding proposal - Component( - zcash_client_backend::data_api::error::Error< - TxMapAndMaybeTreesTraitError, - TxMapAndMaybeTreesTraitError, - zcash_client_backend::data_api::wallet::input_selection::GreedyInputSelectorError< - zcash_primitives::transaction::fees::zip317::FeeError, - Infallible, - >, - zcash_primitives::transaction::fees::zip317::FeeError, - >, - ), -} - fn append_zingo_zenny_receiver(receivers: &mut Vec) { let dev_donation_receiver = Receiver::new( crate::utils::conversion::address_from_str( @@ -117,79 +45,6 @@ impl LightClient { let mut latest_proposal_lock = self.latest_proposal.write().await; *latest_proposal_lock = Some(proposal); } - - /// Creates a proposal from a transaction request. - pub(crate) async fn create_send_proposal( - &self, - request: TransactionRequest, - ) -> Result { - let memo = change_memo_from_transaction_request(&request); - - let input_selector = build_default_giskit(Some(memo)); - let mut tmamt = self - .wallet - .transaction_context - .transaction_metadata_set - .write() - .await; - - zcash_client_backend::data_api::wallet::propose_transfer::< - TxMapAndMaybeTrees, - ChainType, - GISKit, - TxMapAndMaybeTreesTraitError, - >( - tmamt.deref_mut(), - &self.wallet.transaction_context.config.chain, - zcash_primitives::zip32::AccountId::ZERO, - &input_selector, - request, - NonZeroU32::MIN, //review! use custom constant? - ) - .map_err(ProposeSendError::Proposal) - } - - /// The shield operation consumes a proposal that transfers value - /// into the Orchard pool. - /// - /// The proposal is generated with this method, which operates on - /// the balance transparent pool, without other input. - /// In other words, shield does not take a user-specified amount - /// to shield, rather it consumes all transparent value in the wallet that - /// can be consumsed without costing more in zip317 fees than is being transferred. - pub(crate) async fn create_shield_proposal( - &self, - ) -> Result { - let input_selector = build_default_giskit(None); - - let mut tmamt = self - .wallet - .transaction_context - .transaction_metadata_set - .write() - .await; - - let proposed_shield = zcash_client_backend::data_api::wallet::propose_shielding::< - TxMapAndMaybeTrees, - ChainType, - GISKit, - TxMapAndMaybeTreesTraitError, - >( - &mut tmamt, - &self.wallet.transaction_context.config.chain, - &input_selector, - // don't shield dust - NonNegativeAmount::const_from_u64(10_000), - &self.wallet.get_transparent_addresses(), - // review! do we want to require confirmations? - // make it configurable? - 0, - ) - .map_err(ProposeShieldError::Component)?; - - Ok(proposed_shield) - } - /// Creates and stores a proposal from a transaction request. pub async fn propose_send( &self, diff --git a/zingolib/src/lightclient/send.rs b/zingolib/src/lightclient/send.rs index 97fbd3a9e..8cb49ebce 100644 --- a/zingolib/src/lightclient/send.rs +++ b/zingolib/src/lightclient/send.rs @@ -42,10 +42,9 @@ pub mod send_with_proposal { use zcash_proofs::prover::LocalTxProver; use crate::lightclient::LightClient; - use crate::{ - lightclient::propose::{ProposeSendError, ProposeShieldError}, - wallet::utils::read_sapling_params, - }; + use crate::wallet::propose::ProposeSendError; + use crate::wallet::propose::ProposeShieldError; + use crate::wallet::utils::read_sapling_params; #[allow(missing_docs)] // error types document themselves #[derive(Debug, Error)] diff --git a/zingolib/src/wallet.rs b/zingolib/src/wallet.rs index 13872c31b..dee891102 100644 --- a/zingolib/src/wallet.rs +++ b/zingolib/src/wallet.rs @@ -55,6 +55,7 @@ pub mod utils; //these mods contain pieces of the impl LightWallet pub mod describe; pub mod disk; +pub mod propose; pub mod send; pub mod witnesses; diff --git a/zingolib/src/wallet/propose.rs b/zingolib/src/wallet/propose.rs new file mode 100644 index 000000000..83f6b34a3 --- /dev/null +++ b/zingolib/src/wallet/propose.rs @@ -0,0 +1,162 @@ +use std::{convert::Infallible, num::NonZeroU32, ops::DerefMut as _}; + +use thiserror::Error; +use zcash_client_backend::{ + data_api::wallet::input_selection::GreedyInputSelector, + zip321::{TransactionRequest, Zip321Error}, + ShieldedProtocol, +}; +use zcash_primitives::{memo::MemoBytes, transaction::components::amount::NonNegativeAmount}; + +use crate::config::ChainType; + +use super::{ + send::change_memo_from_transaction_request, + tx_map_and_maybe_trees::{TxMapAndMaybeTrees, TxMapAndMaybeTreesTraitError}, + LightWallet, +}; + +type GISKit = GreedyInputSelector< + TxMapAndMaybeTrees, + zcash_client_backend::fees::zip317::SingleOutputChangeStrategy, +>; + +// This private helper is a very small DRY, but it has already corrected a minor +// divergence in change strategy. +// Because shielding operations are never expected to create dust notes this change +// is not a bugfix. +fn build_default_giskit(memo: Option) -> GISKit { + let change_strategy = zcash_client_backend::fees::zip317::SingleOutputChangeStrategy::new( + zcash_primitives::transaction::fees::zip317::FeeRule::standard(), + memo, + ShieldedProtocol::Orchard, + ); // review consider change strategy! + + GISKit::new( + change_strategy, + zcash_client_backend::fees::DustOutputPolicy::new( + zcash_client_backend::fees::DustAction::AllowDustChange, + None, + ), + ) +} + +/// Errors that can result from do_propose +#[derive(Debug, Error)] +pub enum ProposeSendError { + /// error in using trait to create spend proposal + #[error("{0}")] + Proposal( + zcash_client_backend::data_api::error::Error< + TxMapAndMaybeTreesTraitError, + TxMapAndMaybeTreesTraitError, + zcash_client_backend::data_api::wallet::input_selection::GreedyInputSelectorError< + zcash_primitives::transaction::fees::zip317::FeeError, + zcash_client_backend::wallet::NoteId, + >, + zcash_primitives::transaction::fees::zip317::FeeError, + >, + ), + /// failed to construct a transaction request + #[error("{0}")] + TransactionRequestFailed(#[from] Zip321Error), + /// send all is transferring no value + #[error("send all is transferring no value. only enough funds to pay the fees!")] + ZeroValueSendAll, + /// failed to calculate balance. + #[error("failed to calculated balance. {0}")] + BalanceError(#[from] crate::wallet::error::BalanceError), +} + +/// Errors that can result from do_propose +#[derive(Debug, Error)] +pub enum ProposeShieldError { + /// error in parsed addresses + #[error("{0}")] + Receiver(zcash_client_backend::zip321::Zip321Error), + #[error("{0}")] + /// error in using trait to create shielding proposal + Component( + zcash_client_backend::data_api::error::Error< + TxMapAndMaybeTreesTraitError, + TxMapAndMaybeTreesTraitError, + zcash_client_backend::data_api::wallet::input_selection::GreedyInputSelectorError< + zcash_primitives::transaction::fees::zip317::FeeError, + Infallible, + >, + zcash_primitives::transaction::fees::zip317::FeeError, + >, + ), +} + +impl LightWallet { + /// Creates a proposal from a transaction request. + pub(crate) async fn create_send_proposal( + &self, + request: TransactionRequest, + ) -> Result { + let memo = change_memo_from_transaction_request(&request); + + let input_selector = build_default_giskit(Some(memo)); + let mut tmamt = self + .transaction_context + .transaction_metadata_set + .write() + .await; + + zcash_client_backend::data_api::wallet::propose_transfer::< + TxMapAndMaybeTrees, + ChainType, + GISKit, + TxMapAndMaybeTreesTraitError, + >( + tmamt.deref_mut(), + &self.transaction_context.config.chain, + zcash_primitives::zip32::AccountId::ZERO, + &input_selector, + request, + NonZeroU32::MIN, //review! use custom constant? + ) + .map_err(ProposeSendError::Proposal) + } + + /// The shield operation consumes a proposal that transfers value + /// into the Orchard pool. + /// + /// The proposal is generated with this method, which operates on + /// the balance transparent pool, without other input. + /// In other words, shield does not take a user-specified amount + /// to shield, rather it consumes all transparent value in the wallet that + /// can be consumsed without costing more in zip317 fees than is being transferred. + pub(crate) async fn create_shield_proposal( + &self, + ) -> Result { + let input_selector = build_default_giskit(None); + + let mut tmamt = self + .transaction_context + .transaction_metadata_set + .write() + .await; + + let proposed_shield = zcash_client_backend::data_api::wallet::propose_shielding::< + TxMapAndMaybeTrees, + ChainType, + GISKit, + TxMapAndMaybeTreesTraitError, + >( + &mut tmamt, + &self.transaction_context.config.chain, + &input_selector, + // don't shield dust + NonNegativeAmount::const_from_u64(10_000), + &self.get_transparent_addresses(), + // review! do we want to require confirmations? + // make it configurable? + 0, + ) + .map_err(ProposeShieldError::Component)?; + + Ok(proposed_shield) + } +} From a452b1c76fcd2a06146291b086209c62cda86db2 Mon Sep 17 00:00:00 2001 From: fluidvanadium Date: Wed, 28 Aug 2024 22:42:28 +0000 Subject: [PATCH 3/7] compiles --- zingolib/src/lightclient/propose.rs | 16 +++++++++------- zingolib/src/lightclient/send.rs | 4 ++-- zingolib/src/testutils/lightclient.rs | 2 +- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/zingolib/src/lightclient/propose.rs b/zingolib/src/lightclient/propose.rs index 3f1d5269c..cffa4b46a 100644 --- a/zingolib/src/lightclient/propose.rs +++ b/zingolib/src/lightclient/propose.rs @@ -12,6 +12,8 @@ use zcash_primitives::{memo::MemoBytes, transaction::components::amount::NonNega use crate::config::ZENNIES_FOR_ZINGO_AMOUNT; use crate::config::ZENNIES_FOR_ZINGO_DONATION_ADDRESS; +use crate::wallet::propose::ProposeSendError; +use crate::wallet::propose::ProposeShieldError; use thiserror::Error; use crate::config::ChainType; @@ -49,8 +51,8 @@ impl LightClient { pub async fn propose_send( &self, request: TransactionRequest, - ) -> Result { - let proposal = self.create_send_proposal(request).await?; + ) -> Result { + let proposal = self.wallet.create_send_proposal(request).await?; self.store_proposal(ZingoProposal::Transfer(proposal.clone())) .await; Ok(proposal) @@ -75,7 +77,7 @@ impl LightClient { } let request = transaction_request_from_receivers(receivers) .map_err(ProposeSendError::TransactionRequestFailed)?; - let proposal = self.create_send_proposal(request).await?; + let proposal = self.wallet.create_send_proposal(request).await?; self.store_proposal(ZingoProposal::Transfer(proposal.clone())) .await; Ok(proposal) @@ -109,7 +111,7 @@ impl LightClient { append_zingo_zenny_receiver(&mut receivers); } let request = transaction_request_from_receivers(receivers)?; - let failing_proposal = self.create_send_proposal(request).await; + let failing_proposal = self.wallet.create_send_proposal(request).await; let shortfall = match failing_proposal { Err(ProposeSendError::Proposal( @@ -148,7 +150,7 @@ impl LightClient { pub async fn propose_shield( &self, ) -> Result { - let proposal = self.create_shield_proposal().await?; + let proposal = self.wallet.create_shield_proposal().await?; self.store_proposal(ZingoProposal::Shield(proposal.clone())) .await; Ok(proposal) @@ -173,7 +175,7 @@ mod shielding { #[tokio::test] async fn propose_shield_missing_scan_prerequisite() { let basic_client = create_basic_client().await; - let propose_shield_result = basic_client.create_shield_proposal().await; + let propose_shield_result = basic_client.wallet.create_shield_proposal().await; match propose_shield_result { Err(ProposeShieldError::Component( zcash_client_backend::data_api::error::Error::ScanRequired, @@ -185,7 +187,7 @@ mod shielding { async fn get_transparent_addresses() { let basic_client = create_basic_client().await; assert_eq!( - basic_client.get_transparent_addresses(), + basic_client.wallet.get_transparent_addresses(), [zcash_primitives::legacy::TransparentAddress::PublicKeyHash( [ 161, 138, 222, 242, 254, 121, 71, 105, 93, 131, 177, 31, 59, 185, 120, 148, diff --git a/zingolib/src/lightclient/send.rs b/zingolib/src/lightclient/send.rs index 8cb49ebce..6a2f30f67 100644 --- a/zingolib/src/lightclient/send.rs +++ b/zingolib/src/lightclient/send.rs @@ -233,13 +233,13 @@ pub mod send_with_proposal { &self, request: TransactionRequest, ) -> Result, QuickSendError> { - let proposal = self.create_send_proposal(request).await?; + let proposal = self.wallet.create_send_proposal(request).await?; Ok(self.complete_and_broadcast::(&proposal).await?) } /// Shields all transparent funds without confirmation. pub async fn quick_shield(&self) -> Result, QuickShieldError> { - let proposal = self.create_shield_proposal().await?; + let proposal = self.wallet.create_shield_proposal().await?; Ok(self.complete_and_broadcast::(&proposal).await?) } } diff --git a/zingolib/src/testutils/lightclient.rs b/zingolib/src/testutils/lightclient.rs index 6adcf8fa9..70ab00b7c 100644 --- a/zingolib/src/testutils/lightclient.rs +++ b/zingolib/src/testutils/lightclient.rs @@ -88,7 +88,7 @@ pub mod from_inputs { raw_receivers: Vec<(&str, u64, Option<&str>)>, ) -> Result< crate::data::proposal::ProportionalFeeProposal, - crate::lightclient::propose::ProposeSendError, + crate::wallet::propose::ProposeSendError, > { let request = transaction_request_from_send_inputs(proposer, raw_receivers) .expect("should be able to create a transaction request as receivers are valid."); From 99252dd24ff7a10a6b9eca1d60f5b1794404b622 Mon Sep 17 00:00:00 2001 From: fluidvanadium Date: Wed, 28 Aug 2024 22:59:41 +0000 Subject: [PATCH 4/7] cargo fmt --- zingolib/src/lightclient/propose.rs | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/zingolib/src/lightclient/propose.rs b/zingolib/src/lightclient/propose.rs index cffa4b46a..00f125fae 100644 --- a/zingolib/src/lightclient/propose.rs +++ b/zingolib/src/lightclient/propose.rs @@ -1,20 +1,12 @@ //! LightClient function do_propose generates a proposal to send to specified addresses. -use std::convert::Infallible; -use std::num::NonZeroU32; -use std::ops::DerefMut; - -use zcash_client_backend::data_api::wallet::input_selection::GreedyInputSelector; use zcash_client_backend::zip321::TransactionRequest; -use zcash_client_backend::zip321::Zip321Error; -use zcash_client_backend::ShieldedProtocol; -use zcash_primitives::{memo::MemoBytes, transaction::components::amount::NonNegativeAmount}; +use zcash_primitives::transaction::components::amount::NonNegativeAmount; use crate::config::ZENNIES_FOR_ZINGO_AMOUNT; use crate::config::ZENNIES_FOR_ZINGO_DONATION_ADDRESS; use crate::wallet::propose::ProposeSendError; use crate::wallet::propose::ProposeShieldError; -use thiserror::Error; use crate::config::ChainType; use crate::data::proposal::ProportionalFeeProposal; @@ -23,9 +15,6 @@ use crate::data::proposal::ZingoProposal; use crate::data::receivers::transaction_request_from_receivers; use crate::data::receivers::Receiver; use crate::lightclient::LightClient; -use crate::wallet::send::change_memo_from_transaction_request; -use crate::wallet::tx_map_and_maybe_trees::TxMapAndMaybeTrees; -use crate::wallet::tx_map_and_maybe_trees::TxMapAndMaybeTreesTraitError; fn append_zingo_zenny_receiver(receivers: &mut Vec) { let dev_donation_receiver = Receiver::new( From c5d9fbc17c45502b416eb634728882846eb91be5 Mon Sep 17 00:00:00 2001 From: fluidvanadium Date: Wed, 28 Aug 2024 23:00:06 +0000 Subject: [PATCH 5/7] fix tests and docs --- libtonode-tests/tests/concrete.rs | 2 +- libtonode-tests/tests/wallet.rs | 2 +- zingolib/src/wallet/propose.rs | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/libtonode-tests/tests/concrete.rs b/libtonode-tests/tests/concrete.rs index 88ad80ca3..61f6f9da6 100644 --- a/libtonode-tests/tests/concrete.rs +++ b/libtonode-tests/tests/concrete.rs @@ -11,11 +11,11 @@ use zcash_address::unified::Fvk; use zcash_client_backend::encoding::encode_payment_address; use zcash_primitives::transaction::components::amount::NonNegativeAmount; use zcash_primitives::{consensus::BlockHeight, transaction::fees::zip317::MINIMUM_FEE}; -use zingolib::lightclient::propose::ProposeSendError; use zingolib::testutils::lightclient::from_inputs; use zingolib::testutils::{build_fvk_client, increase_height_and_wait_for_client, scenarios}; use zingolib::utils::conversion::address_from_str; use zingolib::wallet::data::summaries::TransactionSummaryInterface; +use zingolib::wallet::propose::ProposeSendError; use zingolib::{check_client_balances, get_base_address_macro, get_otd, validate_otds}; use zingolib::config::{ChainType, RegtestNetwork, MAX_REORG}; diff --git a/libtonode-tests/tests/wallet.rs b/libtonode-tests/tests/wallet.rs index 3293eb9b4..a4982ddc3 100644 --- a/libtonode-tests/tests/wallet.rs +++ b/libtonode-tests/tests/wallet.rs @@ -9,7 +9,6 @@ mod load_wallet { use zingolib::config::RegtestNetwork; use zingolib::config::ZingoConfig; use zingolib::get_base_address_macro; - use zingolib::lightclient::propose::ProposeSendError::Proposal; use zingolib::lightclient::send::send_with_proposal::QuickSendError; use zingolib::lightclient::LightClient; use zingolib::lightclient::PoolBalances; @@ -18,6 +17,7 @@ mod load_wallet { use zingolib::testutils::scenarios; use zingolib::utils; use zingolib::wallet::disk::testing::examples; + use zingolib::wallet::propose::ProposeSendError::Proposal; use zingolib::wallet::LightWallet; #[tokio::test] diff --git a/zingolib/src/wallet/propose.rs b/zingolib/src/wallet/propose.rs index 83f6b34a3..0813387df 100644 --- a/zingolib/src/wallet/propose.rs +++ b/zingolib/src/wallet/propose.rs @@ -1,3 +1,5 @@ +//! creating proposals from wallet data + use std::{convert::Infallible, num::NonZeroU32, ops::DerefMut as _}; use thiserror::Error; From 613f2617f3e6a1d4ff83f236f6a3a66bd493c5d3 Mon Sep 17 00:00:00 2001 From: fluidvanadium Date: Wed, 28 Aug 2024 23:08:15 +0000 Subject: [PATCH 6/7] fixed doc link --- .../src/wallet/transaction_records_by_id/trait_inputsource.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zingolib/src/wallet/transaction_records_by_id/trait_inputsource.rs b/zingolib/src/wallet/transaction_records_by_id/trait_inputsource.rs index 333aebd5e..b1720f63e 100644 --- a/zingolib/src/wallet/transaction_records_by_id/trait_inputsource.rs +++ b/zingolib/src/wallet/transaction_records_by_id/trait_inputsource.rs @@ -152,7 +152,7 @@ impl InputSource for TransactionRecordsById { /// the trait method below is used as a TxMapAndMaybeTrees trait method by propose_transaction. /// this function is used inside a loop that calculates a fee and balances change /// this algorithm influences strategy for user fee minimization - /// see [crate::lightclient::LightClient::create_send_proposal] + /// see [crate::wallet::LightWallet::create_send_proposal] /// TRAIT DOCUMENTATION /// Returns a list of spendable notes sufficient to cover the specified target value, if /// possible. Only spendable notes corresponding to the specified shielded protocol will From 2910466b2ddf6a75212a51e8cc2d61c40781d555 Mon Sep 17 00:00:00 2001 From: zancas Date: Thu, 29 Aug 2024 15:47:58 -0600 Subject: [PATCH 7/7] move to SOS, and conventional use --- zingolib/src/lightclient/propose.rs | 3 +-- zingolib/src/lightclient/send.rs | 6 +----- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/zingolib/src/lightclient/propose.rs b/zingolib/src/lightclient/propose.rs index 00f125fae..b7994189f 100644 --- a/zingolib/src/lightclient/propose.rs +++ b/zingolib/src/lightclient/propose.rs @@ -5,8 +5,7 @@ use zcash_primitives::transaction::components::amount::NonNegativeAmount; use crate::config::ZENNIES_FOR_ZINGO_AMOUNT; use crate::config::ZENNIES_FOR_ZINGO_DONATION_ADDRESS; -use crate::wallet::propose::ProposeSendError; -use crate::wallet::propose::ProposeShieldError; +use crate::wallet::propose::{ProposeSendError, ProposeShieldError}; use crate::config::ChainType; use crate::data::proposal::ProportionalFeeProposal; diff --git a/zingolib/src/lightclient/send.rs b/zingolib/src/lightclient/send.rs index e82babce2..607a97edb 100644 --- a/zingolib/src/lightclient/send.rs +++ b/zingolib/src/lightclient/send.rs @@ -38,12 +38,8 @@ pub mod send_with_proposal { use thiserror::Error; - use crate::lightclient::propose::{ProposeSendError, ProposeShieldError}; use crate::lightclient::LightClient; - use crate::{ - lightclient::propose::{ProposeSendError, ProposeShieldError}, - wallet::utils::read_sapling_params, - }; + use crate::wallet::propose::{ProposeSendError, ProposeShieldError}; #[allow(missing_docs)] // error types document themselves #[derive(Debug, Error)]