Skip to content

Commit

Permalink
Undo changes in 0960300 (#154)
Browse files Browse the repository at this point in the history
* Undo changes in `0960300`

* Replace `core` with `ark_std`
  • Loading branch information
autquis authored Oct 23, 2024
1 parent 6d026d6 commit 6a770eb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
6 changes: 1 addition & 5 deletions crypto-primitives/src/merkle_tree/constraints.rs
Original file line number Diff line number Diff line change
@@ -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::*;
Expand All @@ -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<From, To: ?Sized> {
type TargetType: Borrow<To>;
fn convert(from: From) -> Result<Self::TargetType, SynthesisError>;
}

#[cfg(test)]
impl<T> DigestVarConverter<T, T> for IdentityDigestConverter<T> {
type TargetType = T;

Expand Down
11 changes: 6 additions & 5 deletions crypto-primitives/src/merkle_tree/mod.rs
Original file line number Diff line number Diff line change
@@ -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},
Expand All @@ -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::*;
Expand Down Expand Up @@ -48,12 +51,10 @@ pub trait DigestConverter<From, To: ?Sized> {
}

/// A trivial converter where digest of previous layer's hash is the same as next layer's input.
#[cfg(test)]
pub struct IdentityDigestConverter<T> {
_prev_layer_digest: T,
}

#[cfg(test)]
impl<T> DigestConverter<T, T> for IdentityDigestConverter<T> {
type TargetType = T;
fn convert(item: T) -> Result<T, Error> {
Expand Down

0 comments on commit 6a770eb

Please sign in to comment.