Move pedersen hashes to sapling module.
This commit is contained in:
parent
88d58aac0a
commit
bc087a5ff7
|
@ -1,6 +1,6 @@
|
|||
use criterion::{criterion_group, criterion_main, Criterion};
|
||||
use rand_core::{OsRng, RngCore};
|
||||
use zcash_primitives::pedersen_hash::{pedersen_hash, Personalization};
|
||||
use zcash_primitives::sapling::pedersen_hash::{pedersen_hash, Personalization};
|
||||
|
||||
fn bench_pedersen_hash(c: &mut Criterion) {
|
||||
let rng = &mut OsRng;
|
||||
|
|
|
@ -15,7 +15,6 @@ pub mod legacy;
|
|||
pub mod memo;
|
||||
pub mod merkle_tree;
|
||||
pub mod note_encryption;
|
||||
pub mod pedersen_hash;
|
||||
pub mod primitives;
|
||||
pub mod sapling;
|
||||
pub mod serialize;
|
||||
|
|
|
@ -10,7 +10,7 @@ use crate::constants;
|
|||
|
||||
use crate::sapling::group_hash::group_hash;
|
||||
|
||||
use crate::pedersen_hash::{pedersen_hash, Personalization};
|
||||
use crate::sapling::pedersen_hash::{pedersen_hash, Personalization};
|
||||
|
||||
use byteorder::{LittleEndian, WriteBytesExt};
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
//! Structs and constants specific to the Sapling shielded pool.
|
||||
|
||||
pub mod group_hash;
|
||||
pub mod pedersen_hash;
|
||||
pub mod prover;
|
||||
pub mod redjubjub;
|
||||
pub mod util;
|
||||
|
@ -12,14 +13,12 @@ use lazy_static::lazy_static;
|
|||
use rand_core::{CryptoRng, RngCore};
|
||||
use std::io::{self, Read, Write};
|
||||
|
||||
use crate::{
|
||||
constants::SPENDING_KEY_GENERATOR,
|
||||
merkle_tree::Hashable,
|
||||
pedersen_hash::{pedersen_hash, Personalization},
|
||||
primitives::Note,
|
||||
};
|
||||
use crate::{constants::SPENDING_KEY_GENERATOR, merkle_tree::Hashable, primitives::Note};
|
||||
|
||||
use self::redjubjub::{PrivateKey, PublicKey, Signature};
|
||||
use self::{
|
||||
pedersen_hash::{pedersen_hash, Personalization},
|
||||
redjubjub::{PrivateKey, PublicKey, Signature},
|
||||
};
|
||||
|
||||
pub const SAPLING_COMMITMENT_TREE_DEPTH: usize = 32;
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
//! Test vectors from https://github.com/zcash-hackworks/zcash-test-vectors/blob/master/sapling_pedersen.py
|
||||
|
||||
use crate::pedersen_hash::{test::TestVector, Personalization};
|
||||
use crate::sapling::pedersen_hash::{test::TestVector, Personalization};
|
||||
|
||||
pub fn get_vectors<'a>() -> Vec<TestVector<'a>> {
|
||||
return vec![
|
||||
|
|
|
@ -4,7 +4,7 @@ use super::ecc::{EdwardsPoint, MontgomeryPoint};
|
|||
use bellman::gadgets::boolean::Boolean;
|
||||
use bellman::gadgets::lookup::*;
|
||||
use bellman::{ConstraintSystem, SynthesisError};
|
||||
pub use zcash_primitives::pedersen_hash::Personalization;
|
||||
pub use zcash_primitives::sapling::pedersen_hash::Personalization;
|
||||
|
||||
use crate::constants::PEDERSEN_CIRCUIT_GENERATORS;
|
||||
|
||||
|
@ -111,7 +111,7 @@ mod test {
|
|||
use group::Curve;
|
||||
use rand_core::{RngCore, SeedableRng};
|
||||
use rand_xorshift::XorShiftRng;
|
||||
use zcash_primitives::pedersen_hash;
|
||||
use zcash_primitives::sapling::pedersen_hash;
|
||||
|
||||
/// Predict the number of constraints of a Pedersen hash
|
||||
fn ph_num_constraints(input_bits: usize) -> usize {
|
||||
|
|
|
@ -517,8 +517,8 @@ fn test_input_circuit_with_bls12_381() {
|
|||
use rand_core::{RngCore, SeedableRng};
|
||||
use rand_xorshift::XorShiftRng;
|
||||
use zcash_primitives::{
|
||||
pedersen_hash,
|
||||
primitives::{Diversifier, Note, ProofGenerationKey, Rseed},
|
||||
sapling::pedersen_hash,
|
||||
};
|
||||
|
||||
let mut rng = XorShiftRng::from_seed([
|
||||
|
@ -660,8 +660,8 @@ fn test_input_circuit_with_bls12_381_external_test_vectors() {
|
|||
use rand_core::{RngCore, SeedableRng};
|
||||
use rand_xorshift::XorShiftRng;
|
||||
use zcash_primitives::{
|
||||
pedersen_hash,
|
||||
primitives::{Diversifier, Note, ProofGenerationKey, Rseed},
|
||||
sapling::pedersen_hash,
|
||||
};
|
||||
|
||||
let mut rng = XorShiftRng::from_seed([
|
||||
|
|
Loading…
Reference in New Issue