Update Sapling imports to migrate off re-exports at old paths

This commit is contained in:
Jack Grigg 2023-11-28 03:40:41 +00:00
parent 54fa31e00c
commit 0d06e561bb
11 changed files with 33 additions and 35 deletions

View File

@ -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> {

View File

@ -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<F>(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,

View File

@ -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::{

View File

@ -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.

View File

@ -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::{

View File

@ -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,
},
};

View File

@ -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::{

View File

@ -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;

View File

@ -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

View File

@ -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<R: RngCore + CryptoRng>(

View File

@ -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<OutgoingViewingKey>,
ovk: Option<sapling::keys::OutgoingViewingKey>,
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};