Skip to content

Commit

Permalink
zcash_primitives: Move zip32::sapling to sapling::zip32
Browse files Browse the repository at this point in the history
  • Loading branch information
str4d committed Nov 22, 2023
1 parent 7e07be6 commit f40337a
Show file tree
Hide file tree
Showing 11 changed files with 18 additions and 14 deletions.
3 changes: 2 additions & 1 deletion zcash_client_backend/src/data_api/wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use zcash_primitives::{
self,
note_encryption::{try_sapling_note_decryption, PreparedIncomingViewingKey},
prover::{OutputProver, SpendProver},
zip32::{DiversifiableFullViewingKey, ExtendedSpendingKey},
Node,
},
transaction::{
Expand All @@ -17,7 +18,7 @@ use zcash_primitives::{
fees::{zip317::FeeError as Zip317FeeError, FeeRule, StandardFeeRule},
Transaction, TxId,
},
zip32::{sapling::DiversifiableFullViewingKey, sapling::ExtendedSpendingKey, AccountId, Scope},
zip32::{AccountId, Scope},
};

use crate::{
Expand Down
2 changes: 1 addition & 1 deletion zcash_client_backend/src/keys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use {
};

pub mod sapling {
pub use zcash_primitives::zip32::sapling::{
pub use zcash_primitives::sapling::zip32::{
DiversifiableFullViewingKey, ExtendedFullViewingKey, ExtendedSpendingKey,
};
use zcash_primitives::zip32::{AccountId, ChildIndex};
Expand Down
3 changes: 2 additions & 1 deletion zcash_client_backend/src/scanning.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ use zcash_primitives::{
sapling::{
self,
note_encryption::{CompactOutputDescription, PreparedIncomingViewingKey, SaplingDomain},
zip32::DiversifiableFullViewingKey,
SaplingIvk,
},
zip32::{sapling::DiversifiableFullViewingKey, AccountId, Scope},
zip32::{AccountId, Scope},
};

use crate::data_api::{BlockMetadata, ScannedBlock, ShieldedProtocol};
Expand Down
3 changes: 2 additions & 1 deletion zcash_client_sqlite/src/testing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,15 @@ use zcash_primitives::{
note_encryption::{sapling_note_encryption, SaplingDomain},
util::generate_random_rseed,
value::NoteValue,
zip32::DiversifiableFullViewingKey,
Note, Nullifier, PaymentAddress,
},
transaction::{
components::amount::NonNegativeAmount,
fees::{zip317::FeeError as Zip317FeeError, FeeRule, StandardFeeRule},
Transaction, TxId,
},
zip32::{sapling::DiversifiableFullViewingKey, DiversifierIndex},
zip32::DiversifierIndex,
};

use crate::{
Expand Down
3 changes: 2 additions & 1 deletion zcash_client_sqlite/src/wallet/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,9 @@ mod tests {

use zcash_primitives::{
consensus::{self, BlockHeight, BranchId, Network, NetworkUpgrade, Parameters},
sapling::zip32::ExtendedFullViewingKey,
transaction::{TransactionData, TxVersion},
zip32::{sapling::ExtendedFullViewingKey, AccountId},
zip32::AccountId,
};

use crate::{testing::TestBuilder, wallet::scanning::priority_code, WalletDb};
Expand Down
3 changes: 2 additions & 1 deletion zcash_client_sqlite/src/wallet/sapling.rs
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,7 @@ pub(crate) mod tests {
sapling::{
note_encryption::try_sapling_output_recovery,
prover::{OutputProver, SpendProver},
zip32::ExtendedSpendingKey,
Node, Note, PaymentAddress,
},
transaction::{
Expand All @@ -438,7 +439,7 @@ pub(crate) mod tests {
},
Transaction,
},
zip32::{sapling::ExtendedSpendingKey, Scope},
zip32::Scope,
};

use zcash_client_backend::{
Expand Down
2 changes: 2 additions & 0 deletions zcash_primitives/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ and this library adheres to Rust's notion of
- `ValueCommitTrapdoor::from_bytes`
- `impl Sub<TrapdoorSum> for TrapdoorSum`
- `impl Sub<CommitmentSum> for CommitmentSum`
- `zip32` module (moved from `zcash_primitives::zip32::sapling`).
- `impl Debug for keys::{ExpandedSpendingKey, ProofGenerationKey}`
- `zcash_primitives::transaction`:
- `builder::get_fee`
Expand Down Expand Up @@ -172,6 +173,7 @@ and this library adheres to Rust's notion of
`Bundle::<InProgress<Proven, Unsigned>>::apply_signatures` instead).
- `impl From<zcash_primitive::components::transaction::Amount> for u64`
- `zcash_primitives::zip32`:
- `sapling` module (moved from `zcash_primitives::sapling::zip32`).
- `ChildIndex::Hardened` (use `ChildIndex::hardened` instead).
- `ChildIndex::NonHardened`
- `sapling::ExtendedFullViewingKey::derive_child`
Expand Down
1 change: 1 addition & 0 deletions zcash_primitives/src/sapling.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ mod tree;
pub mod util;
pub mod value;
mod verifier;
pub mod zip32;

use group::GroupEncoding;
use rand_core::{CryptoRng, RngCore};
Expand Down
2 changes: 1 addition & 1 deletion zcash_primitives/src/sapling/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -891,10 +891,10 @@ pub mod testing {
redjubjub::PrivateKey,
testing::{arb_node, arb_note},
value::testing::arb_positive_note_value,
zip32::testing::arb_extended_spending_key,
Diversifier,
},
transaction::components::amount::MAX_MONEY,
zip32::sapling::testing::arb_extended_spending_key,
};
use incrementalmerkletree::{
frontier::testing::arb_commitment_tree, witness::IncrementalWitness,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,15 @@ use fpe::ff1::{BinaryNumeralString, FF1};
use std::io::{self, Read, Write};
use std::ops::AddAssign;

use super::{
ChainCode, ChildIndex, Diversifier, DiversifierIndex, NullifierDerivingKey, PaymentAddress,
Scope, ViewingKey,
};
use super::{Diversifier, NullifierDerivingKey, PaymentAddress, ViewingKey};
use crate::{
keys::{prf_expand, prf_expand_vec},
sapling::{
constants::PROOF_GENERATION_KEY_GENERATOR,
keys::{DecodingError, ExpandedSpendingKey, FullViewingKey, OutgoingViewingKey},
SaplingIvk,
},
zip32::{ChainCode, ChildIndex, DiversifierIndex, Scope},
};

pub const ZIP32_SAPLING_MASTER_PERSONALIZATION: &[u8; 16] = b"ZcashIP32Sapling";
Expand Down
4 changes: 1 addition & 3 deletions zcash_primitives/src/zip32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@
use memuse::{self, DynamicUsage};
use subtle::{Choice, ConditionallySelectable};

use crate::sapling::{Diversifier, NullifierDerivingKey, PaymentAddress, ViewingKey};
pub mod fingerprint;
pub mod sapling;

#[deprecated(note = "Please use the types exported from the `zip32::sapling` module instead.")]
pub use sapling::{
pub use crate::sapling::zip32::{
sapling_address, sapling_default_address, sapling_derive_internal_fvk, sapling_find_address,
DiversifiableFullViewingKey, ExtendedFullViewingKey, ExtendedSpendingKey,
ZIP32_SAPLING_FVFP_PERSONALIZATION, ZIP32_SAPLING_INT_PERSONALIZATION,
Expand Down

0 comments on commit f40337a

Please sign in to comment.