diff --git a/zcash_client_backend/examples/diversify-address.rs b/zcash_client_backend/examples/diversify-address.rs index aa77e6e9a..30b8339b3 100644 --- a/zcash_client_backend/examples/diversify-address.rs +++ b/zcash_client_backend/examples/diversify-address.rs @@ -2,7 +2,8 @@ use gumdrop::Options; use zcash_client_backend::encoding::{decode_extended_full_viewing_key, encode_payment_address}; use zcash_primitives::{ constants::{mainnet, testnet}, - zip32::{DiversifierIndex, ExtendedFullViewingKey}, + sapling::zip32::ExtendedFullViewingKey, + zip32::DiversifierIndex, }; fn parse_viewing_key(s: &str) -> Result<(ExtendedFullViewingKey, bool), &'static str> { diff --git a/zcash_client_backend/src/encoding.rs b/zcash_client_backend/src/encoding.rs index 9484122c7..d8ed7a643 100644 --- a/zcash_client_backend/src/encoding.rs +++ b/zcash_client_backend/src/encoding.rs @@ -14,8 +14,10 @@ use zcash_address::unified::{self, Encoding}; use zcash_primitives::{ consensus, legacy::TransparentAddress, - sapling, - zip32::{ExtendedFullViewingKey, ExtendedSpendingKey}, + sapling::{ + self, + zip32::{ExtendedFullViewingKey, ExtendedSpendingKey}, + }, }; fn bech32_encode(hrp: &str, write: F) -> String @@ -449,7 +451,10 @@ pub fn decode_transparent_address( #[cfg(test)] mod tests { - use zcash_primitives::{constants, sapling::PaymentAddress, zip32::ExtendedSpendingKey}; + use zcash_primitives::{ + constants, + sapling::{zip32::ExtendedSpendingKey, PaymentAddress}, + }; use super::{ decode_extended_full_viewing_key, decode_extended_spending_key, decode_payment_address, diff --git a/zcash_client_backend/src/scanning.rs b/zcash_client_backend/src/scanning.rs index 5e644f081..073056b76 100644 --- a/zcash_client_backend/src/scanning.rs +++ b/zcash_client_backend/src/scanning.rs @@ -666,10 +666,11 @@ mod tests { note_encryption::{sapling_note_encryption, PreparedIncomingViewingKey, SaplingDomain}, util::generate_random_rseed, value::NoteValue, + zip32::{DiversifiableFullViewingKey, ExtendedSpendingKey}, Nullifier, SaplingIvk, }, transaction::components::amount::NonNegativeAmount, - zip32::{AccountId, DiversifiableFullViewingKey, ExtendedSpendingKey}, + zip32::AccountId, }; use crate::{ diff --git a/zcash_client_backend/src/wallet.rs b/zcash_client_backend/src/wallet.rs index 35b32fffc..9a467dbbd 100644 --- a/zcash_client_backend/src/wallet.rs +++ b/zcash_client_backend/src/wallet.rs @@ -5,7 +5,6 @@ use incrementalmerkletree::Position; use zcash_note_encryption::EphemeralKeyBytes; use zcash_primitives::{ consensus::BlockHeight, - keys::OutgoingViewingKey, legacy::TransparentAddress, sapling, transaction::{ @@ -262,7 +261,7 @@ pub enum OvkPolicy { /// /// Transaction outputs will be decryptable by the recipients, and whoever controls /// the provided outgoing viewing key. - Custom(OutgoingViewingKey), + Custom(sapling::keys::OutgoingViewingKey), /// Use no outgoing viewing key. Transaction outputs will be decryptable by their /// recipients, but not by the sender. diff --git a/zcash_client_sqlite/src/chain.rs b/zcash_client_sqlite/src/chain.rs index 011713ca0..e49312a45 100644 --- a/zcash_client_sqlite/src/chain.rs +++ b/zcash_client_sqlite/src/chain.rs @@ -326,8 +326,8 @@ mod tests { use zcash_primitives::{ block::BlockHash, + sapling::zip32::ExtendedSpendingKey, transaction::{components::amount::NonNegativeAmount, fees::zip317::FeeRule}, - zip32::ExtendedSpendingKey, }; use zcash_client_backend::{ diff --git a/zcash_client_sqlite/src/wallet.rs b/zcash_client_sqlite/src/wallet.rs index 552790b83..32f6ac999 100644 --- a/zcash_client_sqlite/src/wallet.rs +++ b/zcash_client_sqlite/src/wallet.rs @@ -1976,11 +1976,11 @@ mod tests { }, zcash_primitives::{ consensus::BlockHeight, + sapling::zip32::ExtendedSpendingKey, transaction::{ components::{amount::NonNegativeAmount, Amount, OutPoint, TxOut}, fees::fixed::FeeRule as FixedFeeRule, }, - zip32::ExtendedSpendingKey, }, }; diff --git a/zcash_client_sqlite/src/wallet/scanning.rs b/zcash_client_sqlite/src/wallet/scanning.rs index 70a7c9d05..b0c171395 100644 --- a/zcash_client_sqlite/src/wallet/scanning.rs +++ b/zcash_client_sqlite/src/wallet/scanning.rs @@ -511,9 +511,8 @@ pub(crate) mod tests { use zcash_primitives::{ block::BlockHash, consensus::{BlockHeight, NetworkUpgrade, Parameters}, - sapling::Node, + sapling::{zip32::DiversifiableFullViewingKey, Node}, transaction::components::amount::NonNegativeAmount, - zip32::DiversifiableFullViewingKey, }; use crate::{ diff --git a/zcash_extensions/src/transparent/demo.rs b/zcash_extensions/src/transparent/demo.rs index 5188e3d7e..9171dd132 100644 --- a/zcash_extensions/src/transparent/demo.rs +++ b/zcash_extensions/src/transparent/demo.rs @@ -485,7 +485,7 @@ mod tests { constants, extensions::transparent::{self as tze, Extension, FromPayload, ToPayload}, legacy::TransparentAddress, - sapling::{self, Node, Rseed}, + sapling::{self, zip32::ExtendedSpendingKey, Node, Rseed}, transaction::{ builder::Builder, components::{ @@ -495,7 +495,6 @@ mod tests { fees::fixed, Transaction, TransactionData, TxVersion, }, - zip32::ExtendedSpendingKey, }; use zcash_proofs::prover::LocalTxProver; diff --git a/zcash_primitives/src/sapling/builder.rs b/zcash_primitives/src/sapling/builder.rs index c21c20e34..e0a4f3e23 100644 --- a/zcash_primitives/src/sapling/builder.rs +++ b/zcash_primitives/src/sapling/builder.rs @@ -8,7 +8,6 @@ use rand::{seq::SliceRandom, RngCore}; use rand_core::CryptoRng; use crate::{ - keys::OutgoingViewingKey, sapling::{ self, bundle::{ @@ -16,6 +15,7 @@ use crate::{ SpendDescription, }, constants::{SPENDING_KEY_GENERATOR, VALUE_COMMITMENT_RANDOMNESS_GENERATOR}, + keys::OutgoingViewingKey, note_encryption::{sapling_note_encryption, Zip212Enforcement}, prover::{OutputProver, SpendProver}, redjubjub::{PrivateKey, PublicKey, Signature}, @@ -24,14 +24,14 @@ use crate::{ value::{ CommitmentSum, NoteValue, TrapdoorSum, ValueCommitTrapdoor, ValueCommitment, ValueSum, }, - verify_spend_sig, Diversifier, MerklePath, Node, Note, PaymentAddress, ProofGenerationKey, - SaplingIvk, + verify_spend_sig, + zip32::ExtendedSpendingKey, + Diversifier, MerklePath, Node, Note, PaymentAddress, ProofGenerationKey, SaplingIvk, }, transaction::{ builder::Progress, components::{amount::NonNegativeAmount, sapling::fees}, }, - zip32::ExtendedSpendingKey, }; /// If there are any shielded inputs, always have at least two shielded outputs, padding diff --git a/zcash_primitives/src/sapling/note_encryption.rs b/zcash_primitives/src/sapling/note_encryption.rs index a4760caad..d4e84454d 100644 --- a/zcash_primitives/src/sapling/note_encryption.rs +++ b/zcash_primitives/src/sapling/note_encryption.rs @@ -488,18 +488,15 @@ mod tests { Zip212Enforcement, }; - use crate::{ - keys::OutgoingViewingKey, - sapling::{ - bundle::{GrothProofBytes, OutputDescription}, - circuit::GROTH_PROOF_SIZE, - keys::{DiversifiedTransmissionKey, EphemeralSecretKey}, - note::ExtractedNoteCommitment, - note_encryption::PreparedIncomingViewingKey, - util::generate_random_rseed, - value::{NoteValue, ValueCommitTrapdoor, ValueCommitment}, - Diversifier, PaymentAddress, Rseed, SaplingIvk, - }, + use crate::sapling::{ + bundle::{GrothProofBytes, OutputDescription}, + circuit::GROTH_PROOF_SIZE, + keys::{DiversifiedTransmissionKey, EphemeralSecretKey, OutgoingViewingKey}, + note::ExtractedNoteCommitment, + note_encryption::PreparedIncomingViewingKey, + util::generate_random_rseed, + value::{NoteValue, ValueCommitTrapdoor, ValueCommitment}, + Diversifier, PaymentAddress, Rseed, SaplingIvk, }; fn random_enc_ciphertext( diff --git a/zcash_primitives/src/transaction/builder.rs b/zcash_primitives/src/transaction/builder.rs index 135ee4aca..3ff1cec40 100644 --- a/zcash_primitives/src/transaction/builder.rs +++ b/zcash_primitives/src/transaction/builder.rs @@ -9,7 +9,6 @@ use rand::{rngs::OsRng, CryptoRng, RngCore}; use crate::{ consensus::{self, BlockHeight, BranchId, NetworkUpgrade}, - keys::OutgoingViewingKey, legacy::TransparentAddress, memo::MemoBytes, sapling::{ @@ -29,7 +28,6 @@ use crate::{ txid::TxIdDigester, Transaction, TransactionData, TxVersion, Unauthorized, }, - zip32::ExtendedSpendingKey, }; #[cfg(feature = "transparent-inputs")] @@ -329,7 +327,7 @@ impl<'a, P: consensus::Parameters, R: RngCore + CryptoRng> Builder<'a, P, R> { /// paths for previous Sapling notes. pub fn add_sapling_spend( &mut self, - extsk: ExtendedSpendingKey, + extsk: sapling::zip32::ExtendedSpendingKey, diversifier: Diversifier, note: Note, merkle_path: sapling::MerklePath, @@ -346,7 +344,7 @@ impl<'a, P: consensus::Parameters, R: RngCore + CryptoRng> Builder<'a, P, R> { /// Adds a Sapling address to send funds to. pub fn add_sapling_output( &mut self, - ovk: Option, + ovk: Option, to: PaymentAddress, value: NonNegativeAmount, memo: MemoBytes, @@ -737,9 +735,8 @@ mod tests { consensus::{NetworkUpgrade, Parameters, TEST_NETWORK}, legacy::TransparentAddress, memo::MemoBytes, - sapling::{self, Node, Rseed}, + sapling::{self, zip32::ExtendedSpendingKey, Node, Rseed}, transaction::components::amount::{Amount, BalanceError, NonNegativeAmount}, - zip32::ExtendedSpendingKey, }; use super::{Builder, Error};