diff --git a/crypto-primitives/src/commitment/blake2s/constraints.rs b/crypto-primitives/src/commitment/blake2s/constraints.rs index 2ad7a05..93e8413 100644 --- a/crypto-primitives/src/commitment/blake2s/constraints.rs +++ b/crypto-primitives/src/commitment/blake2s/constraints.rs @@ -1,8 +1,8 @@ -use crate::crypto_primitives::commitment::blake2s::Blake2sCommitment; 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, }; use algebra::{PrimeField, Field}; @@ -105,12 +105,10 @@ mod test { use algebra::fields::bls12_381::Fr; use rand::{thread_rng, Rng}; + 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_std::prelude::*; diff --git a/crypto-primitives/src/commitment/blake2s/mod.rs b/crypto-primitives/src/commitment/blake2s/mod.rs index eeec4b7..2617d85 100644 --- a/crypto-primitives/src/commitment/blake2s/mod.rs +++ b/crypto-primitives/src/commitment/blake2s/mod.rs @@ -6,6 +6,10 @@ use rand::Rng; pub struct Blake2sCommitment; +#[cfg(feature = "r1cs")] +pub mod constraints; + + impl CommitmentScheme for Blake2sCommitment { type Parameters = (); type Randomness = [u8; 32]; diff --git a/crypto-primitives/src/lib.rs b/crypto-primitives/src/lib.rs index 9fd4f95..b987ef9 100644 --- a/crypto-primitives/src/lib.rs +++ b/crypto-primitives/src/lib.rs @@ -20,6 +20,17 @@ pub use self::{ 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; #[derive(Debug)]