Use `sapling-crypto` crate directly outside `zcash_primitives`

This commit is contained in:
Jack Grigg 2023-12-12 18:46:51 +00:00
parent bf984ff38d
commit b6907b14e6
33 changed files with 119 additions and 133 deletions

4
Cargo.lock generated
View File

@ -3011,6 +3011,7 @@ dependencies = [
"prost",
"rand_core",
"rayon",
"sapling-crypto",
"secrecy",
"shardtree",
"subtle",
@ -3043,6 +3044,7 @@ dependencies = [
"rand_core",
"regex",
"rusqlite",
"sapling-crypto",
"schemer",
"schemer-rusqlite",
"secrecy",
@ -3075,6 +3077,7 @@ dependencies = [
"ff",
"jubjub",
"rand_core",
"sapling-crypto",
"zcash_address",
"zcash_primitives",
"zcash_proofs",
@ -3161,6 +3164,7 @@ dependencies = [
"minreq",
"rand_core",
"redjubjub",
"sapling-crypto",
"tracing",
"wagyu-zcash-parameters",
"xdg",

View File

@ -57,6 +57,7 @@ subtle.workspace = true
bls12_381.workspace = true
group.workspace = true
orchard.workspace = true
sapling.workspace = true
# - Note commitment trees
incrementalmerkletree.workspace = true

View File

@ -1,8 +1,8 @@
use gumdrop::Options;
use sapling::zip32::ExtendedFullViewingKey;
use zcash_client_backend::encoding::{decode_extended_full_viewing_key, encode_payment_address};
use zcash_primitives::{
constants::{mainnet, testnet},
sapling::zip32::ExtendedFullViewingKey,
zip32::DiversifierIndex,
};

View File

@ -2,6 +2,7 @@
use std::convert::TryFrom;
use sapling::PaymentAddress;
use zcash_address::{
unified::{self, Container, Encoding},
ConversionError, Network, ToAddress, TryFromRawAddress, ZcashAddress,
@ -9,7 +10,6 @@ use zcash_address::{
use zcash_primitives::{
consensus,
legacy::TransparentAddress,
sapling::PaymentAddress,
zip32::{AccountId, DiversifierIndex},
};

View File

@ -8,6 +8,7 @@ use std::{
};
use incrementalmerkletree::{frontier::Frontier, Retention};
use sapling::{Node, NOTE_COMMITMENT_TREE_DEPTH};
use secrecy::SecretVec;
use shardtree::{error::ShardTreeError, store::ShardStore, ShardTree};
use zcash_primitives::{
@ -15,7 +16,6 @@ use zcash_primitives::{
consensus::BlockHeight,
legacy::TransparentAddress,
memo::{Memo, MemoBytes},
sapling::{self, Node, NOTE_COMMITMENT_TREE_DEPTH},
transaction::{
components::{
amount::{Amount, BalanceError, NonNegativeAmount},
@ -1066,7 +1066,6 @@ pub mod testing {
consensus::{BlockHeight, Network},
legacy::TransparentAddress,
memo::Memo,
sapling,
transaction::{components::Amount, Transaction, TxId},
zip32::{AccountId, Scope},
};

View File

@ -8,7 +8,6 @@
//! # {
//! use zcash_primitives::{
//! consensus::{BlockHeight, Network, Parameters},
//! sapling
//! };
//!
//! use zcash_client_backend::{
@ -146,9 +145,9 @@
use std::ops::Range;
use sapling::note_encryption::PreparedIncomingViewingKey;
use zcash_primitives::{
consensus::{self, BlockHeight},
sapling::{self, note_encryption::PreparedIncomingViewingKey},
zip32::Scope,
};

View File

@ -6,7 +6,6 @@ use std::fmt::{self, Debug, Display};
use shardtree::error::ShardTreeError;
use zcash_primitives::transaction::components::amount::NonNegativeAmount;
use zcash_primitives::{
sapling,
transaction::{
builder,
components::{amount::BalanceError, transparent},

View File

@ -1,12 +1,12 @@
use std::num::NonZeroU32;
use sapling::{
note_encryption::{try_sapling_note_decryption, PreparedIncomingViewingKey},
prover::{OutputProver, SpendProver},
};
use zcash_primitives::{
consensus::{self, NetworkUpgrade},
memo::MemoBytes,
sapling::{
note_encryption::{try_sapling_note_decryption, PreparedIncomingViewingKey},
prover::{OutputProver, SpendProver},
},
transaction::{
builder::Builder,
components::amount::{Amount, NonNegativeAmount},
@ -39,11 +39,9 @@ use super::SaplingInputSource;
#[cfg(feature = "transparent-inputs")]
use {
super::TransparentInputSource,
crate::wallet::WalletTransparentOutput,
input_selection::ShieldingSelector,
std::convert::Infallible,
zcash_primitives::{legacy::TransparentAddress, sapling::keys::OutgoingViewingKey},
super::TransparentInputSource, crate::wallet::WalletTransparentOutput,
input_selection::ShieldingSelector, sapling::keys::OutgoingViewingKey,
std::convert::Infallible, zcash_primitives::legacy::TransparentAddress,
};
/// Scans a [`Transaction`] for any information that can be decrypted by the accounts in
@ -187,8 +185,8 @@ where
/// # }
/// ```
///
/// [`sapling::SpendProver`]: zcash_primitives::sapling::prover::SpendProver
/// [`sapling::OutputProver`]: zcash_primitives::sapling::prover::OutputProver
/// [`sapling::SpendProver`]: sapling::prover::SpendProver
/// [`sapling::OutputProver`]: sapling::prover::OutputProver
#[allow(clippy::too_many_arguments)]
#[allow(clippy::type_complexity)]
#[deprecated(
@ -303,8 +301,8 @@ where
/// spent. A value of 10 confirmations is recommended and 0-conf transactions are
/// not supported.
///
/// [`sapling::SpendProver`]: zcash_primitives::sapling::prover::SpendProver
/// [`sapling::OutputProver`]: zcash_primitives::sapling::prover::OutputProver
/// [`sapling::SpendProver`]: sapling::prover::SpendProver
/// [`sapling::OutputProver`]: sapling::prover::OutputProver
#[allow(clippy::too_many_arguments)]
#[allow(clippy::type_complexity)]
pub fn spend<DbT, ParamsT, InputsT>(
@ -825,8 +823,8 @@ where
/// spent. A value of 10 confirmations is recommended and 0-conf transactions are
/// not supported.
///
/// [`sapling::SpendProver`]: zcash_primitives::sapling::prover::SpendProver
/// [`sapling::OutputProver`]: zcash_primitives::sapling::prover::OutputProver
/// [`sapling::SpendProver`]: sapling::prover::SpendProver
/// [`sapling::OutputProver`]: sapling::prover::OutputProver
#[cfg(feature = "transparent-inputs")]
#[allow(clippy::too_many_arguments)]
#[allow(clippy::type_complexity)]

View File

@ -450,7 +450,7 @@ impl sapling::OutputView for SaplingPayment {
/// notes.
///
/// This implementation performs input selection using methods available via the
/// [`SaplingInputSource`] and [`TransparentInputSource`] interfaces.
/// [`SaplingInputSource`] and `TransparentInputSource` interfaces.
pub struct GreedyInputSelector<DbT, ChangeT> {
change_strategy: ChangeT,
dust_output_policy: DustOutputPolicy,

View File

@ -1,14 +1,11 @@
use std::collections::HashMap;
use sapling::note_encryption::{
try_sapling_note_decryption, try_sapling_output_recovery, PreparedIncomingViewingKey,
};
use zcash_primitives::{
consensus::{self, BlockHeight},
memo::MemoBytes,
sapling::{
self,
note_encryption::{
try_sapling_note_decryption, try_sapling_output_recovery, PreparedIncomingViewingKey,
},
},
transaction::Transaction,
zip32::{AccountId, Scope},
};

View File

@ -10,15 +10,10 @@ use bech32::{self, Error, FromBase32, ToBase32, Variant};
use bs58::{self, decode::Error as Bs58Error};
use std::fmt;
use std::io::{self, Write};
use sapling::zip32::{ExtendedFullViewingKey, ExtendedSpendingKey};
use zcash_address::unified::{self, Encoding};
use zcash_primitives::{
consensus,
legacy::TransparentAddress,
sapling::{
self,
zip32::{ExtendedFullViewingKey, ExtendedSpendingKey},
},
};
use zcash_primitives::{consensus, legacy::TransparentAddress};
fn bech32_encode<F>(hrp: &str, write: F) -> String
where
@ -188,14 +183,14 @@ impl<P: consensus::Parameters> AddressCodec<P> for UnifiedAddress {
/// let extsk = sapling::spending_key(&[0; 32][..], COIN_TYPE, AccountId::ZERO);
/// let encoded = encode_extended_spending_key(HRP_SAPLING_EXTENDED_SPENDING_KEY, &extsk);
/// ```
/// [`ExtendedSpendingKey`]: zcash_primitives::sapling::zip32::ExtendedSpendingKey
/// [`ExtendedSpendingKey`]: sapling::zip32::ExtendedSpendingKey
pub fn encode_extended_spending_key(hrp: &str, extsk: &ExtendedSpendingKey) -> String {
bech32_encode(hrp, |w| extsk.write(w))
}
/// Decodes an [`ExtendedSpendingKey`] from a Bech32-encoded string.
///
/// [`ExtendedSpendingKey`]: zcash_primitives::sapling::zip32::ExtendedSpendingKey
/// [`ExtendedSpendingKey`]: sapling::zip32::ExtendedSpendingKey
pub fn decode_extended_spending_key(
hrp: &str,
s: &str,
@ -208,9 +203,9 @@ pub fn decode_extended_spending_key(
/// # Examples
///
/// ```
/// use ::sapling::zip32::ExtendedFullViewingKey;
/// use zcash_primitives::{
/// constants::testnet::{COIN_TYPE, HRP_SAPLING_EXTENDED_FULL_VIEWING_KEY},
/// sapling::zip32::ExtendedFullViewingKey,
/// zip32::AccountId,
/// };
/// use zcash_client_backend::{
@ -222,14 +217,14 @@ pub fn decode_extended_spending_key(
/// let extfvk = extsk.to_extended_full_viewing_key();
/// let encoded = encode_extended_full_viewing_key(HRP_SAPLING_EXTENDED_FULL_VIEWING_KEY, &extfvk);
/// ```
/// [`ExtendedFullViewingKey`]: zcash_primitives::sapling::zip32::ExtendedFullViewingKey
/// [`ExtendedFullViewingKey`]: sapling::zip32::ExtendedFullViewingKey
pub fn encode_extended_full_viewing_key(hrp: &str, extfvk: &ExtendedFullViewingKey) -> String {
bech32_encode(hrp, |w| extfvk.write(w))
}
/// Decodes an [`ExtendedFullViewingKey`] from a Bech32-encoded string.
///
/// [`ExtendedFullViewingKey`]: zcash_primitives::sapling::zip32::ExtendedFullViewingKey
/// [`ExtendedFullViewingKey`]: sapling::zip32::ExtendedFullViewingKey
pub fn decode_extended_full_viewing_key(
hrp: &str,
s: &str,
@ -243,12 +238,12 @@ pub fn decode_extended_full_viewing_key(
///
/// ```
/// use group::Group;
/// use sapling::{Diversifier, PaymentAddress};
/// use zcash_client_backend::{
/// encoding::encode_payment_address,
/// };
/// use zcash_primitives::{
/// constants::testnet::HRP_SAPLING_PAYMENT_ADDRESS,
/// sapling::{Diversifier, PaymentAddress},
/// };
///
/// let pa = PaymentAddress::from_bytes(&[
@ -264,7 +259,7 @@ pub fn decode_extended_full_viewing_key(
/// "ztestsapling1qqqqqqqqqqqqqqqqqqcguyvaw2vjk4sdyeg0lc970u659lvhqq7t0np6hlup5lusxle75ss7jnk",
/// );
/// ```
/// [`PaymentAddress`]: zcash_primitives::sapling::PaymentAddress
/// [`PaymentAddress`]: sapling::PaymentAddress
pub fn encode_payment_address(hrp: &str, addr: &sapling::PaymentAddress) -> String {
bech32_encode(hrp, |w| w.write_all(&addr.to_bytes()))
}
@ -273,7 +268,7 @@ pub fn encode_payment_address(hrp: &str, addr: &sapling::PaymentAddress) -> Stri
/// using the human-readable prefix values defined in the specified
/// network parameters.
///
/// [`PaymentAddress`]: zcash_primitives::sapling::PaymentAddress
/// [`PaymentAddress`]: sapling::PaymentAddress
pub fn encode_payment_address_p<P: consensus::Parameters>(
params: &P,
addr: &sapling::PaymentAddress,
@ -287,12 +282,12 @@ pub fn encode_payment_address_p<P: consensus::Parameters>(
///
/// ```
/// use group::Group;
/// use sapling::{Diversifier, PaymentAddress};
/// use zcash_client_backend::{
/// encoding::decode_payment_address,
/// };
/// use zcash_primitives::{
/// consensus::{TEST_NETWORK, Parameters},
/// sapling::{Diversifier, PaymentAddress},
/// };
///
/// let pa = PaymentAddress::from_bytes(&[
@ -311,7 +306,7 @@ pub fn encode_payment_address_p<P: consensus::Parameters>(
/// Ok(pa),
/// );
/// ```
/// [`PaymentAddress`]: zcash_primitives::sapling::PaymentAddress
/// [`PaymentAddress`]: sapling::PaymentAddress
pub fn decode_payment_address(
hrp: &str,
s: &str,
@ -451,10 +446,8 @@ pub fn decode_transparent_address(
#[cfg(test)]
mod tests {
use zcash_primitives::{
constants,
sapling::{zip32::ExtendedSpendingKey, PaymentAddress},
};
use sapling::{zip32::ExtendedSpendingKey, PaymentAddress};
use zcash_primitives::constants;
use super::{
decode_extended_full_viewing_key, decode_extended_spending_key, decode_payment_address,

View File

@ -3,10 +3,8 @@
use std::convert::Infallible;
use zcash_primitives::{
sapling::builder::{SaplingOutputInfo, SpendDescriptionInfo},
transaction::components::amount::NonNegativeAmount,
};
use sapling::builder::{SaplingOutputInfo, SpendDescriptionInfo};
use zcash_primitives::transaction::components::amount::NonNegativeAmount;
/// A trait that provides a minimized view of a Sapling input suitable for use in
/// fee and change calculation.

View File

@ -28,7 +28,7 @@ use {
};
pub mod sapling {
pub use zcash_primitives::sapling::zip32::{
pub use sapling::zip32::{
DiversifiableFullViewingKey, ExtendedFullViewingKey, ExtendedSpendingKey,
};
use zcash_primitives::zip32::{AccountId, ChildIndex};
@ -53,7 +53,7 @@ pub mod sapling {
///
/// let extsk = sapling::spending_key(&[0; 32][..], COIN_TYPE, AccountId::ZERO);
/// ```
/// [`ExtendedSpendingKey`]: zcash_primitives::sapling::zip32::ExtendedSpendingKey
/// [`ExtendedSpendingKey`]: sapling::zip32::ExtendedSpendingKey
pub fn spending_key(seed: &[u8], coin_type: u32, account: AccountId) -> ExtendedSpendingKey {
if seed.len() < 32 {
panic!("ZIP 32 seeds MUST be at least 32 bytes");

View File

@ -9,12 +9,12 @@ use std::{
use incrementalmerkletree::frontier::CommitmentTree;
use nonempty::NonEmpty;
use sapling::{note::ExtractedNoteCommitment, Node, Nullifier, NOTE_COMMITMENT_TREE_DEPTH};
use zcash_primitives::{
block::{BlockHash, BlockHeader},
consensus::{self, BlockHeight, Parameters},
memo::{self, MemoBytes},
merkle_tree::read_commitment_tree,
sapling::{self, note::ExtractedNoteCommitment, Node, Nullifier, NOTE_COMMITMENT_TREE_DEPTH},
transaction::{
components::{amount::NonNegativeAmount, OutPoint},
fees::StandardFeeRule,

View File

@ -5,17 +5,16 @@ use std::convert::TryFrom;
use std::fmt::{self, Debug};
use incrementalmerkletree::{Position, Retention};
use sapling::{
note_encryption::{CompactOutputDescription, PreparedIncomingViewingKey, SaplingDomain},
zip32::DiversifiableFullViewingKey,
SaplingIvk,
};
use subtle::{ConditionallySelectable, ConstantTimeEq, CtOption};
use zcash_note_encryption::batch;
use zcash_primitives::consensus::{BlockHeight, NetworkUpgrade};
use zcash_primitives::{
consensus,
sapling::{
self,
note_encryption::{CompactOutputDescription, PreparedIncomingViewingKey, SaplingDomain},
zip32::DiversifiableFullViewingKey,
SaplingIvk,
},
zip32::{AccountId, Scope},
};
@ -124,7 +123,7 @@ impl ScanningKey for (Scope, SaplingIvk, sapling::NullifierDerivingKey) {
/// The [`ScanningKey`] implementation for [`SaplingIvk`]s.
/// Nullifiers cannot be derived when scanning with these keys.
///
/// [`SaplingIvk`]: zcash_primitives::sapling::SaplingIvk
/// [`SaplingIvk`]: sapling::SaplingIvk
impl ScanningKey for SaplingIvk {
type Scope = ();
type SaplingNk = ();
@ -244,12 +243,12 @@ impl fmt::Display for ScanError {
/// [`WalletSaplingOutput`]s, whereas the implementation for [`SaplingIvk`] cannot
/// do so and will return the unit value in those outputs instead.
///
/// [`ExtendedFullViewingKey`]: zcash_primitives::sapling::zip32::ExtendedFullViewingKey
/// [`SaplingIvk`]: zcash_primitives::sapling::SaplingIvk
/// [`ExtendedFullViewingKey`]: sapling::zip32::ExtendedFullViewingKey
/// [`SaplingIvk`]: sapling::SaplingIvk
/// [`CompactBlock`]: crate::proto::compact_formats::CompactBlock
/// [`ScanningKey`]: crate::scanning::ScanningKey
/// [`CommitmentTree`]: zcash_primitives::sapling::CommitmentTree
/// [`IncrementalWitness`]: zcash_primitives::sapling::IncrementalWitness
/// [`CommitmentTree`]: sapling::CommitmentTree
/// [`IncrementalWitness`]: sapling::IncrementalWitness
/// [`WalletSaplingOutput`]: crate::wallet::WalletSaplingOutput
/// [`WalletTx`]: crate::wallet::WalletTx
pub fn scan_block<P: consensus::Parameters + Send + 'static, K: ScanningKey>(
@ -658,20 +657,19 @@ mod tests {
};
use incrementalmerkletree::{Position, Retention};
use rand_core::{OsRng, RngCore};
use sapling::{
constants::SPENDING_KEY_GENERATOR,
note_encryption::{sapling_note_encryption, PreparedIncomingViewingKey, SaplingDomain},
util::generate_random_rseed,
value::NoteValue,
zip32::{DiversifiableFullViewingKey, ExtendedSpendingKey},
Nullifier, SaplingIvk,
};
use zcash_note_encryption::Domain;
use zcash_primitives::{
block::BlockHash,
consensus::{sapling_zip212_enforcement, BlockHeight, Network},
memo::MemoBytes,
sapling::{
self,
constants::SPENDING_KEY_GENERATOR,
note_encryption::{sapling_note_encryption, PreparedIncomingViewingKey, SaplingDomain},
util::generate_random_rseed,
value::NoteValue,
zip32::{DiversifiableFullViewingKey, ExtendedSpendingKey},
Nullifier, SaplingIvk,
},
transaction::components::amount::NonNegativeAmount,
zip32::AccountId,
};

View File

@ -6,7 +6,6 @@ use zcash_note_encryption::EphemeralKeyBytes;
use zcash_primitives::{
consensus::BlockHeight,
legacy::TransparentAddress,
sapling,
transaction::{
components::{
amount::NonNegativeAmount,
@ -333,7 +332,7 @@ pub enum OvkPolicy {
/// Transaction outputs will be decryptable by the sender, in addition to the
/// recipients.
///
/// [`ExtendedFullViewingKey`]: zcash_primitives::sapling::zip32::ExtendedFullViewingKey
/// [`ExtendedFullViewingKey`]: sapling::zip32::ExtendedFullViewingKey
Sender,
/// Use a custom outgoing viewing key. This might for instance be derived from a

View File

@ -749,9 +749,9 @@ pub mod testing {
use proptest::option;
use proptest::prelude::{any, prop_compose, prop_oneof};
use proptest::strategy::Strategy;
use sapling::testing::arb_payment_address;
use zcash_primitives::{
consensus::TEST_NETWORK, legacy::testing::arb_transparent_addr,
sapling::testing::arb_payment_address,
transaction::components::amount::testing::arb_nonnegative_amount,
};

View File

@ -37,6 +37,9 @@ jubjub.workspace = true
# - Secret management
secrecy.workspace = true
# - Shielded protocols
sapling.workspace = true
# - Note commitment trees
incrementalmerkletree.workspace = true
shardtree = { workspace = true, features = ["legacy-api"] }

View File

@ -324,9 +324,9 @@ where
mod tests {
use std::num::NonZeroU32;
use sapling::zip32::ExtendedSpendingKey;
use zcash_primitives::{
block::BlockHash,
sapling::zip32::ExtendedSpendingKey,
transaction::{components::amount::NonNegativeAmount, fees::zip317::FeeRule},
};

View File

@ -50,7 +50,6 @@ use zcash_primitives::{
consensus::{self, BlockHeight},
legacy::TransparentAddress,
memo::{Memo, MemoBytes},
sapling,
transaction::{
components::amount::{Amount, NonNegativeAmount},
Transaction, TxId,

View File

@ -14,6 +14,13 @@ use tempfile::NamedTempFile;
#[cfg(feature = "unstable")]
use tempfile::TempDir;
use sapling::{
note_encryption::{sapling_note_encryption, SaplingDomain},
util::generate_random_rseed,
value::NoteValue,
zip32::DiversifiableFullViewingKey,
Note, Nullifier, PaymentAddress,
};
use zcash_client_backend::fees::{standard, DustOutputPolicy};
#[allow(deprecated)]
use zcash_client_backend::{
@ -42,13 +49,6 @@ use zcash_primitives::{
block::BlockHash,
consensus::{self, BlockHeight, Network, NetworkUpgrade, Parameters},
memo::{Memo, MemoBytes},
sapling::{
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},

View File

@ -197,14 +197,14 @@ pub(crate) fn add_account<P: consensus::Parameters>(
// birthday frontier is the empty frontier, we don't need to do anything.
if let Some(frontier) = birthday.sapling_frontier().value() {
debug!("Inserting frontier into ShardTree: {:?}", frontier);
let shard_store = SqliteShardStore::<
_,
zcash_primitives::sapling::Node,
SAPLING_SHARD_HEIGHT,
>::from_connection(conn, SAPLING_TABLES_PREFIX)?;
let shard_store =
SqliteShardStore::<_, ::sapling::Node, SAPLING_SHARD_HEIGHT>::from_connection(
conn,
SAPLING_TABLES_PREFIX,
)?;
let mut shard_tree: ShardTree<
_,
{ zcash_primitives::sapling::NOTE_COMMITMENT_TREE_DEPTH },
{ ::sapling::NOTE_COMMITMENT_TREE_DEPTH },
SAPLING_SHARD_HEIGHT,
> = ShardTree::new(shard_store, PRUNING_DEPTH.try_into().unwrap());
shard_tree.insert_frontier_nodes(
@ -977,9 +977,9 @@ fn parse_block_metadata<P: consensus::Parameters>(
} else {
// parse the legacy commitment tree data
read_commitment_tree::<
zcash_primitives::sapling::Node,
::sapling::Node,
_,
{ zcash_primitives::sapling::NOTE_COMMITMENT_TREE_DEPTH },
{ ::sapling::NOTE_COMMITMENT_TREE_DEPTH },
>(Cursor::new(sapling_tree))
.map(|tree| tree.size().try_into().unwrap())
.map_err(SqliteClientError::from)
@ -1989,6 +1989,7 @@ mod tests {
testing::{AddressType, TestState},
PRUNING_DEPTH,
},
sapling::zip32::ExtendedSpendingKey,
zcash_client_backend::{
data_api::{
wallet::input_selection::GreedyInputSelector, TransparentInputSource, WalletWrite,
@ -1999,7 +2000,6 @@ mod tests {
},
zcash_primitives::{
consensus::BlockHeight,
sapling::zip32::ExtendedSpendingKey,
transaction::{
components::{amount::NonNegativeAmount, Amount, OutPoint, TxOut},
fees::fixed::FeeRule as FixedFeeRule,

View File

@ -174,9 +174,9 @@ mod tests {
keys::{sapling, UnifiedFullViewingKey, UnifiedSpendingKey},
};
use ::sapling::zip32::ExtendedFullViewingKey;
use zcash_primitives::{
consensus::{self, BlockHeight, BranchId, Network, NetworkUpgrade, Parameters},
sapling::zip32::ExtendedFullViewingKey,
transaction::{TransactionData, TxVersion},
zip32::AccountId,
};

View File

@ -8,12 +8,12 @@ use schemer_rusqlite::RusqliteMigration;
use uuid::Uuid;
use sapling::note_encryption::{
try_sapling_note_decryption, PreparedIncomingViewingKey, Zip212Enforcement,
};
use zcash_client_backend::keys::UnifiedFullViewingKey;
use zcash_primitives::{
consensus::{self, sapling_zip212_enforcement, BlockHeight, BranchId},
sapling::note_encryption::{
try_sapling_note_decryption, PreparedIncomingViewingKey, Zip212Enforcement,
},
transaction::Transaction,
zip32::Scope,
};

View File

@ -19,7 +19,6 @@ use zcash_client_backend::data_api::{
use zcash_primitives::{
consensus::{self, BlockHeight, NetworkUpgrade},
merkle_tree::{read_commitment_tree, read_incremental_witness},
sapling,
};
use crate::{

View File

@ -5,10 +5,10 @@ use incrementalmerkletree::Position;
use rusqlite::{named_params, params, types::Value, Connection, Row};
use std::rc::Rc;
use sapling::{Diversifier, Note, Nullifier, Rseed};
use zcash_primitives::{
consensus::{self, BlockHeight},
memo::MemoBytes,
sapling::{self, Diversifier, Note, Nullifier, Rseed},
transaction::{
components::{amount::NonNegativeAmount, Amount},
TxId,
@ -470,17 +470,17 @@ pub(crate) mod tests {
use secrecy::Secret;
use zcash_proofs::prover::LocalTxProver;
use sapling::{
note_encryption::try_sapling_output_recovery,
prover::{OutputProver, SpendProver},
zip32::ExtendedSpendingKey,
Node, Note, PaymentAddress,
};
use zcash_primitives::{
block::BlockHash,
consensus::{sapling_zip212_enforcement, BranchId},
legacy::TransparentAddress,
memo::{Memo, MemoBytes},
sapling::{
note_encryption::try_sapling_output_recovery,
prover::{OutputProver, SpendProver},
zip32::ExtendedSpendingKey,
Node, Note, PaymentAddress,
},
transaction::{
components::{amount::NonNegativeAmount, Amount},
fees::{

View File

@ -501,6 +501,7 @@ pub(crate) fn update_chain_tip<P: consensus::Parameters>(
pub(crate) mod tests {
use incrementalmerkletree::{frontier::Frontier, Hashable, Level, Position};
use sapling::{zip32::DiversifiableFullViewingKey, Node};
use secrecy::SecretVec;
use zcash_client_backend::data_api::{
chain::CommitmentTreeRoot,
@ -511,7 +512,6 @@ pub(crate) mod tests {
use zcash_primitives::{
block::BlockHash,
consensus::{BlockHeight, NetworkUpgrade, Parameters},
sapling::{zip32::DiversifiableFullViewingKey, Node},
transaction::components::amount::NonNegativeAmount,
};

View File

@ -18,6 +18,7 @@ zcash_primitives = { workspace = true, features = ["zfuture" ] }
ff.workspace = true
jubjub.workspace = true
rand_core.workspace = true
sapling.workspace = true
zcash_address.workspace = true
zcash_proofs.workspace = true

View File

@ -480,12 +480,12 @@ mod tests {
use ff::Field;
use rand_core::OsRng;
use sapling::{zip32::ExtendedSpendingKey, Node, Rseed};
use zcash_primitives::{
consensus::{BlockHeight, BranchId, NetworkUpgrade, Parameters},
constants,
extensions::transparent::{self as tze, Extension, FromPayload, ToPayload},
legacy::TransparentAddress,
sapling::{self, zip32::ExtendedSpendingKey, Node, Rseed},
transaction::{
builder::Builder,
components::{

View File

@ -3,19 +3,19 @@ use std::iter;
use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion, Throughput};
use ff::Field;
use rand_core::OsRng;
use sapling::{
builder::SaplingBuilder,
note_encryption::{
try_sapling_compact_note_decryption, try_sapling_note_decryption, CompactOutputDescription,
PreparedIncomingViewingKey, SaplingDomain,
},
prover::mock::{MockOutputProver, MockSpendProver},
value::NoteValue,
Diversifier, SaplingIvk,
};
use zcash_note_encryption::batch;
use zcash_primitives::{
consensus::{sapling_zip212_enforcement, NetworkUpgrade::Canopy, Parameters, TEST_NETWORK},
sapling::{
builder::SaplingBuilder,
note_encryption::{
try_sapling_compact_note_decryption, try_sapling_note_decryption,
CompactOutputDescription, PreparedIncomingViewingKey, SaplingDomain,
},
prover::mock::{MockOutputProver, MockSpendProver},
value::NoteValue,
Diversifier, SaplingIvk,
},
transaction::components::Amount,
};

View File

@ -28,6 +28,7 @@ jubjub.workspace = true
lazy_static.workspace = true
minreq = { version = "2", features = ["https"], optional = true }
rand_core.workspace = true
sapling.workspace = true
tracing.workspace = true
# Dependencies used internally:

View File

@ -11,7 +11,7 @@
use bellman::groth16::{prepare_verifying_key, PreparedVerifyingKey, VerifyingKey};
use bls12_381::Bls12;
use zcash_primitives::sapling::circuit::{
use sapling::circuit::{
OutputParameters, PreparedOutputVerifyingKey, PreparedSpendVerifyingKey, SpendParameters,
};

View File

@ -3,16 +3,14 @@
use bellman::groth16::Proof;
use bls12_381::Bls12;
use std::path::Path;
use zcash_primitives::{
sapling::{
self,
bundle::GrothProofBytes,
prover::{OutputProver, SpendProver},
value::{NoteValue, ValueCommitTrapdoor},
Diversifier, MerklePath, PaymentAddress, ProofGenerationKey, Rseed,
},
transaction::components::GROTH_PROOF_SIZE,
use sapling::{
bundle::GrothProofBytes,
prover::{OutputProver, SpendProver},
value::{NoteValue, ValueCommitTrapdoor},
Diversifier, MerklePath, PaymentAddress, ProofGenerationKey, Rseed,
};
use zcash_primitives::transaction::components::GROTH_PROOF_SIZE;
use crate::{load_parameters, parse_parameters, OutputParameters, SpendParameters};