Move Jubjub, Pedersen hash and primitives into zcash_primitives

This commit is contained in:
Jack Grigg 2019-08-06 10:46:40 +01:00
parent b8af749b40
commit 5fb9b86ba0
No known key found for this signature in database
GPG Key ID: 9E8255172BBF9898
42 changed files with 99 additions and 94 deletions

8
Cargo.lock generated
View File

@ -57,7 +57,7 @@ name = "bellman"
version = "0.1.0"
dependencies = [
"bit-vec 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)",
"blake2s_simd 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)",
"blake2s_simd 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)",
"byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"crossbeam 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"ff 0.4.0",
@ -313,7 +313,6 @@ dependencies = [
"pairing 0.14.2",
"rand_core 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rand_os 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"sapling-crypto 0.0.1",
"zcash_primitives 0.0.0",
"zcash_proofs 0.0.0",
]
@ -536,7 +535,6 @@ dependencies = [
"pairing 0.14.2",
"rand_core 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rand_xorshift 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"sapling-crypto 0.0.1",
"zcash_primitives 0.0.0",
]
@ -546,18 +544,19 @@ version = "0.0.0"
dependencies = [
"aes 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"blake2b_simd 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)",
"blake2s_simd 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)",
"byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"crypto_api_chachapoly 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"ff 0.4.0",
"fpe 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"pairing 0.14.2",
"rand 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rand_core 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rand_os 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rand_xorshift 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"sapling-crypto 0.0.1",
"sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -574,7 +573,6 @@ dependencies = [
"rand_core 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rand_os 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rand_xorshift 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"sapling-crypto 0.0.1",
"zcash_primitives 0.0.0",
]

View File

@ -24,6 +24,5 @@ lazy_static = "1"
byteorder = "1"
rand_core = "0.5"
rand_os = "0.2"
sapling-crypto = { path = "../sapling-crypto" }
zcash_primitives = { path = "../zcash_primitives" }
zcash_proofs = { path = "../zcash_proofs" }

View File

@ -7,7 +7,6 @@ extern crate libc;
extern crate pairing;
extern crate rand_core;
extern crate rand_os;
extern crate sapling_crypto;
extern crate zcash_primitives;
extern crate zcash_proofs;
@ -16,7 +15,7 @@ extern crate lazy_static;
use ff::{PrimeField, PrimeFieldRepr};
use pairing::bls12_381::{Bls12, Fr, FrRepr};
use sapling_crypto::{
use zcash_primitives::{
constants::CRH_IVK_PERSONALIZATION,
jubjub::{
edwards,
@ -57,10 +56,12 @@ use std::ffi::OsString;
#[cfg(target_os = "windows")]
use std::os::windows::ffi::OsStringExt;
use sapling_crypto::primitives::{ProofGenerationKey, ViewingKey};
use zcash_primitives::{
merkle_tree::CommitmentTreeWitness,
note_encryption::sapling_ka_agree,
primitives::{
Diversifier, Note, PaymentAddress, ProofGenerationKey, ViewingKey,
},
redjubjub::{self, Signature},
sapling::{merkle_hash, spend_sig},
transaction::components::Amount,
@ -236,7 +237,7 @@ fn init_zksnark_params(
#[no_mangle]
pub extern "system" fn librustzcash_tree_uncommitted(result: *mut [c_uchar; 32]) {
let tmp = sapling_crypto::primitives::Note::<Bls12>::uncommitted().into_repr();
let tmp = Note::<Bls12>::uncommitted().into_repr();
// Should be okay, caller is responsible for ensuring the pointer
// is a valid pointer to 32 bytes that can be mutated.
@ -341,7 +342,7 @@ pub extern "system" fn librustzcash_crh_ivk(
#[no_mangle]
pub extern "system" fn librustzcash_check_diversifier(diversifier: *const [c_uchar; 11]) -> bool {
let diversifier = sapling_crypto::primitives::Diversifier(unsafe { *diversifier });
let diversifier = Diversifier(unsafe { *diversifier });
diversifier.g_d::<Bls12>(&JUBJUB).is_some()
}
@ -352,7 +353,7 @@ pub extern "system" fn librustzcash_ivk_to_pkd(
result: *mut [c_uchar; 32],
) -> bool {
let ivk = read_fs(unsafe { &*ivk });
let diversifier = sapling_crypto::primitives::Diversifier(unsafe { *diversifier });
let diversifier = Diversifier(unsafe { *diversifier });
if let Some(g_d) = diversifier.g_d::<Bls12>(&JUBJUB) {
let pk_d = g_d.mul(ivk, &JUBJUB);
@ -407,8 +408,8 @@ fn priv_get_note(
pk_d: *const [c_uchar; 32],
value: u64,
r: *const [c_uchar; 32],
) -> Result<sapling_crypto::primitives::Note<Bls12>, ()> {
let diversifier = sapling_crypto::primitives::Diversifier(unsafe { *diversifier });
) -> Result<Note<Bls12>, ()> {
let diversifier = Diversifier(unsafe { *diversifier });
let g_d = match diversifier.g_d::<Bls12>(&JUBJUB) {
Some(g_d) => g_d,
None => return Err(()),
@ -430,7 +431,7 @@ fn priv_get_note(
Err(_) => return Err(()),
};
let note = sapling_crypto::primitives::Note {
let note = Note {
value,
g_d,
pk_d,
@ -539,7 +540,7 @@ pub extern "system" fn librustzcash_sapling_ka_derivepublic(
esk: *const [c_uchar; 32],
result: *mut [c_uchar; 32],
) -> bool {
let diversifier = sapling_crypto::primitives::Diversifier(unsafe { *diversifier });
let diversifier = Diversifier(unsafe { *diversifier });
// Compute g_d from the diversifier
let g_d = match diversifier.g_d::<Bls12>(&JUBJUB) {
@ -940,7 +941,7 @@ pub extern "system" fn librustzcash_sapling_output_proof(
};
// Grab the diversifier from the caller.
let diversifier = sapling_crypto::primitives::Diversifier(unsafe { *diversifier });
let diversifier = Diversifier(unsafe { *diversifier });
// Grab pk_d from the caller.
let pk_d = match edwards::Point::<Bls12, Unknown>::read(&(unsafe { &*pk_d })[..], &JUBJUB) {
@ -955,7 +956,7 @@ pub extern "system" fn librustzcash_sapling_output_proof(
};
// Construct a payment address
let payment_address = sapling_crypto::primitives::PaymentAddress {
let payment_address = PaymentAddress {
pk_d: pk_d,
diversifier: diversifier,
};
@ -1086,7 +1087,7 @@ pub extern "system" fn librustzcash_sapling_spend_proof(
};
// Grab the diversifier from the caller
let diversifier = sapling_crypto::primitives::Diversifier(unsafe { *diversifier });
let diversifier = Diversifier(unsafe { *diversifier });
// The caller chooses the note randomness
let rcm = match Fs::from_repr(read_fs(&(unsafe { &*rcm })[..])) {

View File

@ -2,8 +2,8 @@ use ff::{PrimeField, PrimeFieldRepr};
use pairing::bls12_381::Bls12;
use rand_core::RngCore;
use rand_os::OsRng;
use sapling_crypto::jubjub::{edwards, JubjubBls12};
use sapling_crypto::primitives::{Diversifier, ViewingKey};
use zcash_primitives::jubjub::{edwards, JubjubBls12};
use zcash_primitives::primitives::{Diversifier, ViewingKey};
use {
librustzcash_sapling_generate_r, librustzcash_sapling_ka_agree,

View File

@ -1,6 +1,6 @@
use ff::{PrimeField, PrimeFieldRepr};
use pairing::bls12_381::Bls12;
use sapling_crypto::{
use zcash_primitives::{
jubjub::{fs::FsRepr, FixedGenerators, JubjubEngine, JubjubParams},
primitives::{Diversifier, ProofGenerationKey},
};

View File

@ -1,4 +1,4 @@
use sapling_crypto::jubjub::{FixedGenerators, JubjubParams};
use zcash_primitives::jubjub::{FixedGenerators, JubjubParams};
use super::JUBJUB;

View File

@ -1,6 +1,6 @@
use ff::{PrimeField, PrimeFieldRepr};
use pairing::bls12_381::Bls12;
use sapling_crypto::jubjub::{FixedGenerators, JubjubEngine};
use zcash_primitives::jubjub::{FixedGenerators, JubjubEngine};
use zcash_primitives::redjubjub::{PrivateKey, PublicKey, Signature};
use super::JUBJUB;

View File

@ -16,9 +16,3 @@ extern crate rand_xorshift;
#[cfg(test)]
extern crate sha2;
pub mod jubjub;
pub mod group_hash;
pub mod pedersen_hash;
pub mod primitives;
pub mod constants;

View File

@ -9,7 +9,6 @@ edition = "2018"
[dependencies]
bech32 = "0.7"
pairing = { path = "../pairing" }
sapling-crypto = { path = "../sapling-crypto" }
zcash_primitives = { path = "../zcash_primitives" }
[dev-dependencies]

View File

@ -5,7 +5,7 @@
use bech32::{self, Error, FromBase32, ToBase32};
use pairing::bls12_381::Bls12;
use sapling_crypto::{
use zcash_primitives::{
jubjub::edwards,
primitives::{Diversifier, PaymentAddress},
};
@ -98,15 +98,15 @@ pub fn decode_extended_full_viewing_key(
/// use pairing::bls12_381::Bls12;
/// use rand_core::SeedableRng;
/// use rand_xorshift::XorShiftRng;
/// use sapling_crypto::{
/// jubjub::edwards,
/// primitives::{Diversifier, PaymentAddress},
/// };
/// use zcash_client_backend::{
/// constants::testnet::HRP_SAPLING_PAYMENT_ADDRESS,
/// encoding::encode_payment_address,
/// };
/// use zcash_primitives::JUBJUB;
/// use zcash_primitives::{
/// jubjub::edwards,
/// primitives::{Diversifier, PaymentAddress},
/// JUBJUB,
/// };
///
/// let rng = &mut XorShiftRng::from_seed([
/// 0x59, 0x62, 0xbe, 0x3d, 0x76, 0x3d, 0x31, 0x8d, 0x17, 0xdb, 0x37, 0x32, 0x54, 0x06,
@ -138,15 +138,15 @@ pub fn encode_payment_address(hrp: &str, addr: &PaymentAddress<Bls12>) -> String
/// use pairing::bls12_381::Bls12;
/// use rand_core::SeedableRng;
/// use rand_xorshift::XorShiftRng;
/// use sapling_crypto::{
/// jubjub::edwards,
/// primitives::{Diversifier, PaymentAddress},
/// };
/// use zcash_client_backend::{
/// constants::testnet::HRP_SAPLING_PAYMENT_ADDRESS,
/// encoding::decode_payment_address,
/// };
/// use zcash_primitives::JUBJUB;
/// use zcash_primitives::{
/// jubjub::edwards,
/// primitives::{Diversifier, PaymentAddress},
/// JUBJUB,
/// };
///
/// let rng = &mut XorShiftRng::from_seed([
/// 0x59, 0x62, 0xbe, 0x3d, 0x76, 0x3d, 0x31, 0x8d, 0x17, 0xdb, 0x37, 0x32, 0x54, 0x06,
@ -187,7 +187,7 @@ mod tests {
use pairing::bls12_381::Bls12;
use rand_core::SeedableRng;
use rand_xorshift::XorShiftRng;
use sapling_crypto::{
use zcash_primitives::{
jubjub::edwards,
primitives::{Diversifier, PaymentAddress},
};

View File

@ -8,6 +8,7 @@ authors = [
[dependencies]
aes = "0.3"
blake2b_simd = "0.5"
blake2s_simd = "0.5"
byteorder = "1"
crypto_api_chachapoly = "0.2.1"
ff = { path = "../ff" }
@ -18,8 +19,8 @@ pairing = { path = "../pairing" }
rand = "0.7"
rand_core = "0.5"
rand_os = "0.2"
sapling-crypto = { path = "../sapling-crypto" }
sha2 = "0.8"
[dev-dependencies]
hex-literal = "0.1"
rand_xorshift = "0.2"

View File

@ -1,20 +1,22 @@
#![feature(test)]
extern crate rand;
extern crate rand_core;
extern crate rand_os;
extern crate test;
extern crate pairing;
extern crate sapling_crypto;
extern crate zcash_primitives;
use rand::{Rand, thread_rng};
use rand_core::RngCore;
use rand_os::OsRng;
use pairing::bls12_381::Bls12;
use sapling_crypto::jubjub::JubjubBls12;
use sapling_crypto::pedersen_hash::{pedersen_hash, Personalization};
use zcash_primitives::jubjub::JubjubBls12;
use zcash_primitives::pedersen_hash::{pedersen_hash, Personalization};
#[bench]
fn bench_pedersen_hash(b: &mut test::Bencher) {
let params = JubjubBls12::new();
let rng = &mut thread_rng();
let bits = (0..510).map(|_| bool::rand(rng)).collect::<Vec<_>>();
let rng = &mut OsRng;
let bits = (0..510).map(|_| (rng.next_u32() % 2) != 0).collect::<Vec<_>>();
let personalization = Personalization::MerkleTree(31);
b.iter(|| {

View File

@ -4,7 +4,7 @@
use blake2b_simd::{Hash as Blake2bHash, Params as Blake2bParams};
use ff::{PrimeField, PrimeFieldRepr};
use sapling_crypto::{
use crate::{
jubjub::{edwards, FixedGenerators, JubjubEngine, JubjubParams, ToUniform, Unknown},
primitives::{ProofGenerationKey, ViewingKey},
};
@ -188,7 +188,7 @@ impl<E: JubjubEngine> FullViewingKey<E> {
#[cfg(test)]
mod tests {
use pairing::bls12_381::Bls12;
use sapling_crypto::jubjub::{edwards, FixedGenerators, JubjubParams, PrimeOrder};
use crate::jubjub::{edwards, FixedGenerators, JubjubParams, PrimeOrder};
use std::error::Error;
use super::FullViewingKey;

View File

@ -3,6 +3,7 @@ extern crate lazy_static;
extern crate aes;
extern crate blake2b_simd;
extern crate blake2s_simd;
extern crate byteorder;
extern crate crypto_api_chachapoly;
extern crate ff;
@ -12,19 +13,25 @@ extern crate pairing;
extern crate rand;
extern crate rand_core;
extern crate rand_os;
extern crate sapling_crypto;
extern crate sha2;
#[cfg(test)]
#[macro_use]
extern crate hex_literal;
#[cfg(test)]
extern crate rand_xorshift;
use sapling_crypto::jubjub::JubjubBls12;
pub mod block;
pub mod constants;
pub mod group_hash;
pub mod jubjub;
pub mod keys;
pub mod legacy;
pub mod merkle_tree;
pub mod note_encryption;
pub mod pedersen_hash;
pub mod primitives;
pub mod prover;
pub mod redjubjub;
pub mod sapling;
@ -36,6 +43,8 @@ pub mod zip32;
#[cfg(test)]
mod test_vectors;
use jubjub::JubjubBls12;
lazy_static! {
pub static ref JUBJUB: JubjubBls12 = { JubjubBls12::new() };
}

View File

@ -6,7 +6,7 @@ use crypto_api_chachapoly::{ChaCha20Ietf, ChachaPolyIetf};
use ff::{PrimeField, PrimeFieldRepr};
use pairing::bls12_381::{Bls12, Fr};
use rand_core::{CryptoRng, RngCore};
use sapling_crypto::{
use crate::{
jubjub::{
edwards,
fs::{Fs, FsRepr},
@ -211,18 +211,16 @@ fn prf_ock(
/// extern crate ff;
/// extern crate pairing;
/// extern crate rand_os;
/// extern crate sapling_crypto;
/// extern crate zcash_primitives;
///
/// use ff::Field;
/// use pairing::bls12_381::Bls12;
/// use rand_os::OsRng;
/// use sapling_crypto::{
/// jubjub::fs::Fs,
/// primitives::{Diversifier, PaymentAddress, ValueCommitment},
/// };
/// use zcash_primitives::{
/// jubjub::fs::Fs,
/// keys::OutgoingViewingKey,
/// note_encryption::{Memo, SaplingNoteEncryption},
/// primitives::{Diversifier, PaymentAddress, ValueCommitment},
/// JUBJUB,
/// };
///
@ -551,7 +549,7 @@ mod tests {
use pairing::bls12_381::{Bls12, Fr, FrRepr};
use rand_core::{CryptoRng, RngCore};
use rand_os::OsRng;
use sapling_crypto::{
use crate::{
jubjub::{
edwards,
fs::{Fs, FsRepr},

View File

@ -1,7 +1,7 @@
//! Abstractions over the proving system and parameters.
use pairing::bls12_381::{Bls12, Fr};
use sapling_crypto::{
use crate::{
jubjub::{edwards, fs::Fs, Unknown},
primitives::{Diversifier, PaymentAddress, ProofGenerationKey},
};
@ -75,7 +75,8 @@ pub(crate) mod mock {
use ff::Field;
use pairing::bls12_381::{Bls12, Fr};
use rand_os::OsRng;
use sapling_crypto::{
use crate::{
jubjub::{edwards, fs::Fs, FixedGenerators, Unknown},
primitives::{Diversifier, PaymentAddress, ProofGenerationKey, ValueCommitment},
};

View File

@ -3,7 +3,7 @@
use ff::{Field, PrimeField, PrimeFieldRepr};
use rand_core::RngCore;
use sapling_crypto::jubjub::{
use crate::jubjub::{
edwards::Point, FixedGenerators, JubjubEngine, JubjubParams, Unknown,
};
use std::io::{self, Read, Write};
@ -210,7 +210,8 @@ mod tests {
use pairing::bls12_381::Bls12;
use rand_core::SeedableRng;
use rand_xorshift::XorShiftRng;
use sapling_crypto::jubjub::{edwards, fs::Fs, JubjubBls12};
use crate::jubjub::{edwards, fs::Fs, JubjubBls12};
use super::*;

View File

@ -3,7 +3,7 @@
use ff::{BitIterator, PrimeField, PrimeFieldRepr};
use pairing::bls12_381::{Bls12, Fr, FrRepr};
use rand_core::{CryptoRng, RngCore};
use sapling_crypto::{
use crate::{
jubjub::{fs::Fs, FixedGenerators, JubjubBls12},
pedersen_hash::{pedersen_hash, Personalization},
primitives::Note,

View File

@ -3,7 +3,7 @@
use ff::Field;
use pairing::bls12_381::{Bls12, Fr};
use rand::{rngs::OsRng, seq::SliceRandom, CryptoRng, RngCore};
use sapling_crypto::{
use crate::{
jubjub::fs::Fs,
primitives::{Diversifier, Note, PaymentAddress},
};
@ -534,7 +534,8 @@ impl<R: RngCore + CryptoRng> Builder<R> {
mod tests {
use ff::{Field, PrimeField};
use rand::rngs::OsRng;
use sapling_crypto::jubjub::fs::Fs;
use crate::jubjub::fs::Fs;
use super::{Builder, Error};
use crate::{

View File

@ -1,7 +1,7 @@
use byteorder::{LittleEndian, ReadBytesExt, WriteBytesExt};
use ff::{PrimeField, PrimeFieldRepr};
use pairing::bls12_381::{Bls12, Fr, FrRepr};
use sapling_crypto::jubjub::{edwards, Unknown};
use crate::jubjub::{edwards, Unknown};
use std::io::{self, Read, Write};
use legacy::Script;

View File

@ -1,7 +1,8 @@
use ff::Field;
use pairing::bls12_381::Bls12;
use rand_os::OsRng;
use sapling_crypto::jubjub::{fs::Fs, FixedGenerators};
use crate::jubjub::{fs::Fs, FixedGenerators};
use super::{components::Amount, sighash::signature_hash, Transaction, TransactionData};
use legacy::Script;

View File

@ -1,5 +1,6 @@
use blake2b_simd::Params;
use sapling_crypto::jubjub::{JubjubEngine, ToUniform};
use crate::jubjub::{JubjubEngine, ToUniform};
pub fn hash_to_scalar<E: JubjubEngine>(persona: &[u8], a: &[u8], b: &[u8]) -> E::Fs {
let mut hasher = Params::new().hash_length(64).personal(persona).to_state();

View File

@ -4,7 +4,8 @@ use byteorder::{ByteOrder, LittleEndian, ReadBytesExt, WriteBytesExt};
use ff::Field;
use fpe::ff1::{BinaryNumeralString, FF1};
use pairing::bls12_381::Bls12;
use sapling_crypto::{
use crate::{
jubjub::{fs::Fs, FixedGenerators, JubjubEngine, JubjubParams, ToUniform},
primitives::{Diversifier, PaymentAddress, ViewingKey},
};

View File

@ -13,7 +13,6 @@ directories = { version = "1", optional = true }
ff = { path = "../ff" }
pairing = { path = "../pairing" }
rand_os = "0.2"
sapling-crypto = { path = "../sapling-crypto" }
zcash_primitives = { path = "../zcash_primitives" }
[dev-dependencies]

View File

@ -1,14 +1,14 @@
extern crate ff;
extern crate sapling_crypto;
extern crate bellman;
extern crate pairing;
extern crate rand_core;
extern crate rand_xorshift;
extern crate zcash_primitives;
extern crate zcash_proofs;
use ff::Field;
use std::time::{Duration, Instant};
use sapling_crypto::jubjub::{
use zcash_primitives::jubjub::{
JubjubBls12,
edwards,
fs,
@ -16,7 +16,7 @@ use sapling_crypto::jubjub::{
use zcash_proofs::circuit::sapling::{
Spend
};
use sapling_crypto::primitives::{
use zcash_primitives::primitives::{
Diversifier,
ProofGenerationKey,
ValueCommitment

View File

@ -15,7 +15,7 @@ use bellman::gadgets::num::{
Num
};
use sapling_crypto::jubjub::{
use zcash_primitives::jubjub::{
edwards,
JubjubEngine,
JubjubParams,
@ -754,14 +754,14 @@ mod test {
use rand_xorshift::XorShiftRng;
use bellman::gadgets::test::*;
use sapling_crypto::jubjub::{
use zcash_primitives::jubjub::{
montgomery,
edwards,
JubjubBls12,
JubjubParams,
FixedGenerators
};
use sapling_crypto::jubjub::fs::Fs;
use zcash_primitives::jubjub::fs::Fs;
use super::{
MontgomeryPoint,

View File

@ -3,12 +3,12 @@ use super::ecc::{
EdwardsPoint
};
use bellman::gadgets::boolean::Boolean;
use sapling_crypto::jubjub::*;
use zcash_primitives::jubjub::*;
use bellman::{
ConstraintSystem, SynthesisError
};
use bellman::gadgets::lookup::*;
pub use sapling_crypto::pedersen_hash::Personalization;
pub use zcash_primitives::pedersen_hash::Personalization;
fn get_constant_bools(person: &Personalization) -> Vec<Boolean> {
person.get_bits()
@ -112,7 +112,7 @@ mod test {
use super::*;
use bellman::gadgets::test::*;
use bellman::gadgets::boolean::{Boolean, AllocatedBit};
use sapling_crypto::pedersen_hash;
use zcash_primitives::pedersen_hash;
use ff::PrimeField;
use pairing::bls12_381::{Bls12, Fr};
use rand_core::{RngCore, SeedableRng};

View File

@ -6,14 +6,14 @@ use bellman::{
Circuit
};
use sapling_crypto::jubjub::{
use zcash_primitives::jubjub::{
JubjubEngine,
FixedGenerators
};
use sapling_crypto::constants;
use zcash_primitives::constants;
use sapling_crypto::primitives::{
use zcash_primitives::primitives::{
ValueCommitment,
ProofGenerationKey,
PaymentAddress
@ -603,7 +603,7 @@ fn test_input_circuit_with_bls12_381() {
use pairing::bls12_381::*;
use rand_core::{RngCore, SeedableRng};
use rand_xorshift::XorShiftRng;
use sapling_crypto::{
use zcash_primitives::{
jubjub::{JubjubBls12, fs, edwards},
pedersen_hash,
primitives::{Diversifier, Note, ProofGenerationKey},
@ -747,7 +747,7 @@ fn test_output_circuit_with_bls12_381() {
use pairing::bls12_381::*;
use rand_core::{RngCore, SeedableRng};
use rand_xorshift::XorShiftRng;
use sapling_crypto::{
use zcash_primitives::{
jubjub::{JubjubBls12, fs, edwards},
primitives::{Diversifier, ProofGenerationKey},
};

View File

@ -4,7 +4,6 @@ extern crate byteorder;
extern crate ff;
extern crate pairing;
extern crate rand_os;
extern crate sapling_crypto;
extern crate zcash_primitives;
#[cfg(feature = "local-prover")]

View File

@ -3,7 +3,7 @@
use bellman::groth16::{Parameters, PreparedVerifyingKey};
use directories::BaseDirs;
use pairing::bls12_381::{Bls12, Fr};
use sapling_crypto::{
use zcash_primitives::{
jubjub::{edwards, fs::Fs, Unknown},
primitives::{Diversifier, PaymentAddress, ProofGenerationKey},
};

View File

@ -1,5 +1,5 @@
use pairing::bls12_381::Bls12;
use sapling_crypto::jubjub::{
use zcash_primitives::jubjub::{
edwards, fs::FsRepr, FixedGenerators, JubjubBls12, JubjubParams, Unknown,
};
use zcash_primitives::transaction::components::Amount;

View File

@ -7,7 +7,7 @@ use bellman::{
use ff::Field;
use pairing::bls12_381::{Bls12, Fr};
use rand_os::OsRng;
use sapling_crypto::{
use zcash_primitives::{
jubjub::{edwards, fs::Fs, FixedGenerators, JubjubBls12, Unknown},
primitives::{Diversifier, Note, PaymentAddress, ProofGenerationKey, ValueCommitment},
};

View File

@ -4,7 +4,7 @@ use bellman::{
};
use ff::Field;
use pairing::bls12_381::{Bls12, Fr};
use sapling_crypto::jubjub::{edwards, FixedGenerators, JubjubBls12, Unknown};
use zcash_primitives::jubjub::{edwards, FixedGenerators, JubjubBls12, Unknown};
use zcash_primitives::{
redjubjub::{PublicKey, Signature},
transaction::components::Amount,