Move sapling keys into sapling module.

This commit is contained in:
Kris Nuttycombe 2021-03-04 14:40:45 -07:00 committed by Jack Grigg
parent 4086df772c
commit 33effb7d67
8 changed files with 20 additions and 15 deletions

View File

@ -4,9 +4,10 @@
use subtle::{Choice, ConditionallySelectable};
use zcash_primitives::{
keys::OutgoingViewingKey,
merkle_tree::IncrementalWitness,
sapling::{Diversifier, Node, Note, Nullifier, PaymentAddress, Rseed},
sapling::{
keys::OutgoingViewingKey, Diversifier, Node, Note, Nullifier, PaymentAddress, Rseed,
},
transaction::{components::Amount, TxId},
};

View File

@ -619,8 +619,8 @@ pub mod testing {
use proptest::prelude::{any, prop_compose, prop_oneof};
use proptest::strategy::Strategy;
use zcash_primitives::{
consensus::TEST_NETWORK, keys::testing::arb_shielded_addr,
legacy::testing::arb_transparent_addr,
consensus::TEST_NETWORK, legacy::testing::arb_transparent_addr,
sapling::keys::testing::arb_shielded_addr,
transaction::components::amount::testing::arb_nonnegative_amount,
};

View File

@ -10,7 +10,6 @@
pub mod block;
pub mod consensus;
pub mod constants;
pub mod keys;
pub mod legacy;
pub mod memo;
pub mod merkle_tree;

View File

@ -13,7 +13,7 @@ use group::{cofactor::CofactorGroup, GroupEncoding};
use rand_core::{CryptoRng, RngCore};
use std::convert::TryInto;
use crate::keys::OutgoingViewingKey;
use crate::sapling::keys::OutgoingViewingKey;
pub const KDF_SAPLING_PERSONALIZATION: &[u8; 16] = b"Zcash_SaplingKDF";
pub const PRF_OCK_PERSONALIZATION: &[u8; 16] = b"Zcash_Derive_ock";
@ -112,10 +112,12 @@ pub fn prf_ock(
/// use ff::Field;
/// use rand_core::OsRng;
/// use zcash_primitives::{
/// keys::{OutgoingViewingKey, prf_expand},
/// memo::MemoBytes,
/// note_encryption::SaplingNoteEncryption,
/// sapling::{Diversifier, PaymentAddress, Rseed, ValueCommitment},
/// sapling::{
/// keys::{OutgoingViewingKey, prf_expand},
/// Diversifier, PaymentAddress, Rseed, ValueCommitment
/// },
/// };
///
/// let mut rng = OsRng;
@ -580,10 +582,12 @@ mod tests {
NetworkUpgrade::{Canopy, Sapling},
Parameters, TEST_NETWORK, ZIP212_GRACE_PERIOD,
},
keys::OutgoingViewingKey,
memo::MemoBytes,
sapling::util::generate_random_rseed,
sapling::{Diversifier, PaymentAddress, Rseed, SaplingIvk, ValueCommitment},
sapling::{
keys::OutgoingViewingKey, Diversifier, PaymentAddress, Rseed, SaplingIvk,
ValueCommitment,
},
};
fn random_enc_ciphertext<R: RngCore + CryptoRng>(

View File

@ -1,6 +1,7 @@
//! Structs and constants specific to the Sapling shielded pool.
pub mod group_hash;
pub mod keys;
pub mod pedersen_hash;
pub mod prover;
pub mod redjubjub;
@ -20,12 +21,12 @@ use subtle::{Choice, ConstantTimeEq};
use crate::{
constants::{self, SPENDING_KEY_GENERATOR},
keys::prf_expand,
merkle_tree::Hashable,
};
use self::{
group_hash::group_hash,
keys::prf_expand,
pedersen_hash::{pedersen_hash, Personalization},
redjubjub::{PrivateKey, PublicKey, Signature},
};

View File

@ -12,18 +12,18 @@ use rand::{rngs::OsRng, seq::SliceRandom, CryptoRng, RngCore};
use crate::{
consensus::{self, BlockHeight},
keys::OutgoingViewingKey,
legacy::TransparentAddress,
memo::MemoBytes,
merkle_tree::MerklePath,
note_encryption::SaplingNoteEncryption,
sapling::{
prover::TxProver, redjubjub::PrivateKey, spend_sig_internal,
keys::OutgoingViewingKey, prover::TxProver, redjubjub::PrivateKey, spend_sig_internal,
util::generate_random_rseed_internal, Diversifier, Node, Note, PaymentAddress,
},
transaction::{
components::{
amount::Amount, amount::DEFAULT_FEE, OutputDescription, SpendDescription, TxOut,
amount::{Amount, DEFAULT_FEE},
OutputDescription, SpendDescription, TxOut,
},
signature_hash_data, SignableInput, Transaction, TransactionData, SIGHASH_ALL,
},

View File

@ -14,7 +14,7 @@ use crate::{
};
use std::io::{self, Read, Write};
use crate::keys::{
use crate::sapling::keys::{
prf_expand, prf_expand_vec, ExpandedSpendingKey, FullViewingKey, OutgoingViewingKey,
};