Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Daira-Emma Hopwood <[email protected]>
  • Loading branch information
nuttycom and daira committed Dec 9, 2024
1 parent 867267d commit fd76997
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 14 deletions.
2 changes: 1 addition & 1 deletion zcash_client_backend/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ and this library adheres to Rust's notion of
- `AccountSource::key_derivation`
- `error::PcztError`
- `wallet::ExtractErrT`
- `wallet::create_proposed_transaction_pczt`
- `wallet::create_pczt_from_proposal`
- `wallet::extract_and_store_transaction_from_pczt`

### Changed
Expand Down
2 changes: 1 addition & 1 deletion zcash_client_backend/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ transparent-inputs = [
## Enables receiving and spending Orchard funds.
orchard = ["dep:orchard", "dep:pasta_curves", "zcash_keys/orchard"]

## Enables creating partially-signed transactions for use in hardware wallet and multisig scenarios.
## Enables creating partially-constructed transactions for use in hardware wallet and multisig scenarios.
pczt = [
"orchard",
"transparent-inputs",
Expand Down
4 changes: 2 additions & 2 deletions zcash_client_backend/src/data_api/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ pub enum Error<DataSourceError, CommitmentTreeError, SelectionError, FeeError, C
/// Attempted to create a spend to an unsupported Unified Address receiver
NoSupportedReceivers(Box<UnifiedAddress>),

/// A proposed transaction cannot be built because it requires spending an input of a type for
/// which a key that is required to construct the transaciton is not available.
/// A proposed transaction cannot be built because it requires spending an input of
/// a type for which a key required to construct the transaction is not available.
KeyNotAvailable(PoolType),

/// A note being spent does not correspond to either the internal or external
Expand Down
10 changes: 5 additions & 5 deletions zcash_client_backend/src/data_api/testing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1092,12 +1092,12 @@ where
)
}

/// Invokes [`create_proposed_transaction_pczt`] with the given arguments.
/// Invokes [`create_pczt_from_proposal`] with the given arguments.
///
/// [`create_proposed_transaction_pczt`]: super::wallet::create_proposed_transaction_pczt
/// [`create_pczt_from_proposal`]: super::wallet::create_pczt_from_proposal
#[cfg(feature = "pczt")]
#[allow(clippy::type_complexity)]
pub fn create_proposed_transaction_pczt<InputsErrT, FeeRuleT, ChangeErrT>(
pub fn create_pczt_from_proposal<InputsErrT, FeeRuleT, ChangeErrT>(
&mut self,
spend_from_account: <DbT as InputSource>::AccountId,
ovk_policy: OvkPolicy,
Expand All @@ -1110,11 +1110,11 @@ where
<DbT as WalletRead>::AccountId: serde::Serialize,
FeeRuleT: FeeRule,
{
use super::wallet::create_proposed_transaction_pczt;
use super::wallet::create_pczt_from_proposal;

let network = self.network().clone();

create_proposed_transaction_pczt(
create_pczt_from_proposal(
self.wallet_mut(),
&network,
spend_from_account,
Expand Down
8 changes: 5 additions & 3 deletions zcash_client_backend/src/data_api/testing/pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3111,8 +3111,10 @@ pub fn pczt_single_step<P0: ShieldedPoolTester, P1: ShieldedPoolTester, DSF>(
.with_block_cache(cache)
.with_initial_chain_state(|_, network| {
// Initialize the chain state to after ZIP 212 became enforced.
let birthday_height =
network.activation_height(NetworkUpgrade::Nu5).unwrap() + ZIP212_GRACE_PERIOD;
let birthday_height = std::cmp::max(
network.activation_height(NetworkUpgrade::Nu5).unwrap(),
network.activation_height(NetworkUpgrade::Canopy).unwrap() + ZIP212_GRACE_PERIOD,
);

InitialChainState {
chain_state: ChainState::new(
Expand Down Expand Up @@ -3168,7 +3170,7 @@ pub fn pczt_single_step<P0: ShieldedPoolTester, P1: ShieldedPoolTester, DSF>(
let _min_target_height = proposal0.min_target_height();
assert_eq!(proposal0.steps().len(), 1);

let create_proposed_result = st.create_proposed_transaction_pczt::<Infallible, _, Infallible>(
let create_proposed_result = st.create_pczt_from_proposal::<Infallible, _, Infallible>(
account.id(),
OvkPolicy::Sender,
&proposal0,
Expand Down
4 changes: 2 additions & 2 deletions zcash_client_backend/src/data_api/wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1329,7 +1329,7 @@ where
#[allow(clippy::too_many_arguments)]
#[allow(clippy::type_complexity)]
#[cfg(feature = "pczt")]
pub fn create_proposed_transaction_pczt<DbT, ParamsT, InputsErrT, FeeRuleT, ChangeErrT, N>(
pub fn create_pczt_from_proposal<DbT, ParamsT, InputsErrT, FeeRuleT, ChangeErrT, N>(
wallet_db: &mut DbT,
params: &ParamsT,
account_id: <DbT as WalletRead>::AccountId,
Expand Down Expand Up @@ -1592,7 +1592,7 @@ where

/// Finalizes the given PCZT, and persists the transaction to the wallet database.
///
/// The PCZT should have been created via [`create_proposed_transaction_pczt`], which adds
/// The PCZT should have been created via [`create_pczt_from_proposal`], which adds
/// metadata necessary for the wallet backend.
///
/// Returns the transaction ID for the resulting transaction.
Expand Down

0 comments on commit fd76997

Please sign in to comment.