rename TreeHashType to HashType

This commit is contained in:
Sergio Chouhy
2025-10-17 16:04:09 -03:00
parent 217551f960
commit b93c0aa390
6 changed files with 18 additions and 21 deletions
+4 -7
View File
@@ -12,7 +12,7 @@ pub mod test_utils;
use rpc_primitives::errors::RpcError;
pub type TreeHashType = [u8; 32];
pub type HashType = [u8; 32];
pub type CommitmentHashType = Vec<u8>;
#[derive(Debug, Clone)]
@@ -21,19 +21,16 @@ pub type CommitmentHashType = Vec<u8>;
pub struct OwnHasher {}
impl Hasher for OwnHasher {
type Hash = TreeHashType;
type Hash = HashType;
fn hash(data: &[u8]) -> TreeHashType {
fn hash(data: &[u8]) -> HashType {
let mut hasher = Sha256::new();
hasher.update(data);
<TreeHashType>::from(hasher.finalize_fixed())
<HashType>::from(hasher.finalize_fixed())
}
}
///Account id on blockchain
pub type AccountId = TreeHashType;
#[derive(Debug, Clone, Deserialize)]
pub struct SequencerRpcError {
pub jsonrpc: String,
+2 -2
View File
@@ -91,7 +91,7 @@ mod tests {
use sha2::{Digest, digest::FixedOutput};
use crate::{
TreeHashType,
HashType,
transaction::{EncodedTransaction, TxKind},
};
@@ -109,7 +109,7 @@ mod tests {
let data = borsh::to_vec(&body).unwrap();
let mut hasher = sha2::Sha256::new();
hasher.update(&data);
TreeHashType::from(hasher.finalize_fixed())
HashType::from(hasher.finalize_fixed())
};
let hash = body.hash();