diff --git a/crypto-primitives/src/merkle_tree/constraints.rs b/crypto-primitives/src/merkle_tree/constraints.rs index 9a23c34..83ae4f5 100644 --- a/crypto-primitives/src/merkle_tree/constraints.rs +++ b/crypto-primitives/src/merkle_tree/constraints.rs @@ -1,6 +1,6 @@ use crate::{ crh::{CRHSchemeGadget, TwoToOneCRHSchemeGadget}, - merkle_tree::{Config, Path}, + merkle_tree::{Config, IdentityDigestConverter, Path}, }; use ark_ff::PrimeField; use ark_r1cs_std::prelude::*; @@ -9,15 +9,11 @@ use ark_relations::r1cs::{Namespace, SynthesisError}; use ark_std::vec::Vec; use ark_std::{borrow::Borrow, fmt::Debug}; -#[cfg(test)] -use crate::merkle_tree::IdentityDigestConverter; - pub trait DigestVarConverter { type TargetType: Borrow; fn convert(from: From) -> Result; } -#[cfg(test)] impl DigestVarConverter for IdentityDigestConverter { type TargetType = T; diff --git a/crypto-primitives/src/merkle_tree/mod.rs b/crypto-primitives/src/merkle_tree/mod.rs index 7dcabfa..1a40045 100644 --- a/crypto-primitives/src/merkle_tree/mod.rs +++ b/crypto-primitives/src/merkle_tree/mod.rs @@ -1,7 +1,5 @@ #![allow(clippy::needless_range_loop)] -use core::hash::BuildHasherDefault; - /// Defines a trait to chain two types of CRHs. use crate::{ crh::{CRHScheme, TwoToOneCRHScheme}, @@ -11,7 +9,12 @@ use crate::{ use ark_serialize::{CanonicalDeserialize, CanonicalSerialize}; #[cfg(not(feature = "std"))] use ark_std::vec::Vec; -use ark_std::{borrow::Borrow, collections::BTreeSet, fmt::Debug, hash::Hash}; +use ark_std::{ + borrow::Borrow, + collections::BTreeSet, + fmt::Debug, + hash::{BuildHasherDefault, Hash}, +}; use hashbrown::HashMap; #[cfg(feature = "parallel")] use rayon::prelude::*; @@ -48,12 +51,10 @@ pub trait DigestConverter { } /// A trivial converter where digest of previous layer's hash is the same as next layer's input. -#[cfg(test)] pub struct IdentityDigestConverter { _prev_layer_digest: T, } -#[cfg(test)] impl DigestConverter for IdentityDigestConverter { type TargetType = T; fn convert(item: T) -> Result {