Skip to content

Commit

Permalink
More cleaning
Browse files Browse the repository at this point in the history
  • Loading branch information
autquis committed Apr 16, 2024
1 parent 025b2c4 commit 02ac850
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
7 changes: 2 additions & 5 deletions crypto-primitives/src/crh/sha256/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ use crate::{
crh::{CRHScheme, TwoToOneCRHScheme},
Error,
};
use ark_std::rand::Rng;
#[cfg(not(feature = "std"))]
use ark_std::vec::Vec;
use ark_std::{borrow::Borrow, rand::Rng};
use sha2::digest::Digest;

// Re-export the RustCrypto Sha256 type and its associated traits
pub use sha2::{digest, Sha256};
Expand All @@ -13,10 +14,6 @@ pub use sha2::{digest, Sha256};
pub mod constraints;

// Implement the CRH traits for SHA-256

use core::borrow::Borrow;
use sha2::digest::Digest;

impl CRHScheme for Sha256 {
type Input = [u8];
// This is always 32 bytes. It has to be a Vec to impl CanonicalSerialize
Expand Down
4 changes: 2 additions & 2 deletions crypto-primitives/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ pub enum Error {
SerializationError(ark_serialize::SerializationError),
}

impl core::fmt::Display for Error {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
impl ark_std::fmt::Display for Error {
fn fmt(&self, f: &mut ark_std::fmt::Formatter<'_>) -> ark_std::fmt::Result {
match self {
Self::IncorrectInputLength(len) => write!(f, "incorrect input length: {len}"),
Self::NotPrimeOrder => write!(f, "element is not prime order"),
Expand Down
6 changes: 3 additions & 3 deletions crypto-primitives/src/merkle_tree/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use crate::{
use ark_serialize::{CanonicalDeserialize, CanonicalSerialize};
#[cfg(not(feature = "std"))]
use ark_std::vec::Vec;
use ark_std::{borrow::Borrow, collections::BTreeSet, hash::Hash};
use ark_std::{borrow::Borrow, collections::BTreeSet, fmt::Debug, hash::Hash};
use hashbrown::HashMap;
#[cfg(feature = "parallel")]
use rayon::prelude::*;
Expand Down Expand Up @@ -62,7 +62,7 @@ pub trait Config {
// leaf layer
type LeafDigest: Clone
+ Eq
+ core::fmt::Debug
+ Debug
+ Hash
+ Default
+ CanonicalSerialize
Expand All @@ -78,7 +78,7 @@ pub trait Config {
// inner layer
type InnerDigest: Clone
+ Eq
+ core::fmt::Debug
+ Debug
+ Hash
+ Default
+ CanonicalSerialize
Expand Down

0 comments on commit 02ac850

Please sign in to comment.