From 87cc8300ee0ecf07ecf3589dbbf33dfb1e55444a Mon Sep 17 00:00:00 2001 From: Hossein Moghaddas Date: Tue, 22 Oct 2024 17:34:34 +0200 Subject: [PATCH 1/2] Undo changes in `0960300` --- crypto-primitives/src/merkle_tree/constraints.rs | 6 +----- crypto-primitives/src/merkle_tree/mod.rs | 2 -- 2 files changed, 1 insertion(+), 7 deletions(-) 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..e11a176 100644 --- a/crypto-primitives/src/merkle_tree/mod.rs +++ b/crypto-primitives/src/merkle_tree/mod.rs @@ -48,12 +48,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 { From 9979306395b563579d156e61a3f5b5f5a74fe09e Mon Sep 17 00:00:00 2001 From: Hossein Moghaddas Date: Tue, 22 Oct 2024 19:26:22 +0200 Subject: [PATCH 2/2] Replace `core` with `ark_std` --- crypto-primitives/src/merkle_tree/mod.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/crypto-primitives/src/merkle_tree/mod.rs b/crypto-primitives/src/merkle_tree/mod.rs index e11a176..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::*;