Browse Source

Fix Blake2s gadget test

master
Pratyush Mishra 5 years ago
parent
commit
1b6f681cdb
3 changed files with 21 additions and 8 deletions
  1. +6
    -8
      crypto-primitives/src/commitment/blake2s/constraints.rs
  2. +4
    -0
      crypto-primitives/src/commitment/blake2s/mod.rs
  3. +11
    -0
      crypto-primitives/src/lib.rs

+ 6
- 8
crypto-primitives/src/commitment/blake2s/constraints.rs

@ -1,8 +1,8 @@
use crate::crypto_primitives::commitment::blake2s::Blake2sCommitment;
use r1cs_core::{ConstraintSystem, SynthesisError}; use r1cs_core::{ConstraintSystem, SynthesisError};
use crate::gadgets::{
prf::blake2s::{blake2s_gadget, Blake2sOutputGadget},
use crate::{
commitment::blake2s::Blake2sCommitment,
prf::blake2s::constraints::{blake2s_gadget, Blake2sOutputGadget},
CommitmentGadget, CommitmentGadget,
}; };
use algebra::{PrimeField, Field}; use algebra::{PrimeField, Field};
@ -105,12 +105,10 @@ mod test {
use algebra::fields::bls12_381::Fr; use algebra::fields::bls12_381::Fr;
use rand::{thread_rng, Rng}; use rand::{thread_rng, Rng};
use crate::*;
use crate::{ use crate::{
crypto_primitives::commitment::{blake2s::Blake2sCommitment, CommitmentScheme},
gadgets::commitment::{
blake2s::{Blake2sCommitmentGadget, Blake2sRandomnessGadget},
CommitmentGadget,
},
commitment::blake2s::Blake2sCommitment,
commitment::blake2s::constraints::{Blake2sCommitmentGadget, Blake2sRandomnessGadget},
}; };
use r1cs_core::ConstraintSystem; use r1cs_core::ConstraintSystem;
use r1cs_std::prelude::*; use r1cs_std::prelude::*;

+ 4
- 0
crypto-primitives/src/commitment/blake2s/mod.rs

@ -6,6 +6,10 @@ use rand::Rng;
pub struct Blake2sCommitment; pub struct Blake2sCommitment;
#[cfg(feature = "r1cs")]
pub mod constraints;
impl CommitmentScheme for Blake2sCommitment { impl CommitmentScheme for Blake2sCommitment {
type Parameters = (); type Parameters = ();
type Randomness = [u8; 32]; type Randomness = [u8; 32];

+ 11
- 0
crypto-primitives/src/lib.rs

@ -20,6 +20,17 @@ pub use self::{
signature::SignatureScheme, signature::SignatureScheme,
}; };
#[cfg(feature = "r1cs")]
pub use self::{
commitment::CommitmentGadget,
crh::FixedLengthCRHGadget,
mht::constraints::{MerklePath, MerklePathVerifierGadget},
nizk::NIZKVerifierGadget,
prf::PRFGadget,
signature::SigRandomizePkGadget,
};
pub type Error = Box<dyn std::error::Error>; pub type Error = Box<dyn std::error::Error>;
#[derive(Debug)] #[derive(Debug)]

Loading…
Cancel
Save