From 7d854249487c748111d2097e4d240e90827aa1fa Mon Sep 17 00:00:00 2001 From: Sergio Chouhy Date: Fri, 17 Oct 2025 16:07:59 -0300 Subject: [PATCH] remove unnecessary rs_merkle dep --- Cargo.toml | 1 - common/Cargo.toml | 1 - common/src/block.rs | 20 ++++++++++++++++++-- common/src/lib.rs | 19 ------------------- 4 files changed, 18 insertions(+), 23 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 11e3144..d23053c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -28,7 +28,6 @@ env_logger = "0.10" log = "0.4.28" lru = "0.7.8" thiserror = "2.0.12" -rs_merkle = "1.4" sha2 = "0.10.8" hex = "0.4.3" aes-gcm = "0.10.3" diff --git a/common/Cargo.toml b/common/Cargo.toml index d235246..668ffbd 100644 --- a/common/Cargo.toml +++ b/common/Cargo.toml @@ -11,7 +11,6 @@ serde.workspace = true reqwest.workspace = true k256.workspace = true -rs_merkle.workspace = true sha2.workspace = true log.workspace = true elliptic-curve.workspace = true diff --git a/common/src/block.rs b/common/src/block.rs index 20f3aa7..456c879 100644 --- a/common/src/block.rs +++ b/common/src/block.rs @@ -1,7 +1,23 @@ use borsh::{BorshDeserialize, BorshSerialize}; -use rs_merkle::Hasher; +use sha2::{Digest, Sha256, digest::FixedOutput}; -use crate::{OwnHasher, transaction::EncodedTransaction}; +use crate::transaction::EncodedTransaction; + +pub type HashType = [u8; 32]; + +#[derive(Debug, Clone)] +///Our own hasher. +/// Currently it is SHA256 hasher wrapper. May change in a future. +pub struct OwnHasher {} + +impl OwnHasher { + fn hash(data: &[u8]) -> HashType { + let mut hasher = Sha256::new(); + + hasher.update(data); + ::from(hasher.finalize_fixed()) + } +} pub type BlockHash = [u8; 32]; pub type BlockId = u64; diff --git a/common/src/lib.rs b/common/src/lib.rs index a2f9156..5a96dc1 100644 --- a/common/src/lib.rs +++ b/common/src/lib.rs @@ -1,6 +1,4 @@ -use rs_merkle::Hasher; use serde::Deserialize; -use sha2::{Digest, Sha256, digest::FixedOutput}; pub mod block; pub mod rpc_primitives; @@ -13,23 +11,6 @@ pub mod test_utils; use rpc_primitives::errors::RpcError; pub type HashType = [u8; 32]; -pub type CommitmentHashType = Vec; - -#[derive(Debug, Clone)] -///Our own hasher. -/// Currently it is SHA256 hasher wrapper. May change in a future. -pub struct OwnHasher {} - -impl Hasher for OwnHasher { - type Hash = HashType; - - fn hash(data: &[u8]) -> HashType { - let mut hasher = Sha256::new(); - - hasher.update(data); - ::from(hasher.finalize_fixed()) - } -} #[derive(Debug, Clone, Deserialize)] pub struct SequencerRpcError {