diff --git a/firewood/src/merkle/proof.rs b/firewood/src/merkle/proof.rs index c8a72368f..bd892235e 100644 --- a/firewood/src/merkle/proof.rs +++ b/firewood/src/merkle/proof.rs @@ -18,7 +18,7 @@ use crate::{ merkle_util::{new_merkle, DataStoreError, MerkleSetup}, }; -use super::{BinarySerde, NodeObjRef, TRIE_HASH_LEN}; +use super::{BinarySerde, NodeObjRef}; #[derive(Debug, Error)] pub enum ProofError { @@ -102,7 +102,7 @@ pub struct Proof(pub HashMap); #[derive(Debug)] enum SubProof { Data(Vec), - Hash([u8; TRIE_HASH_LEN]), + Hash(HashKey), } impl + Send> Proof { @@ -114,7 +114,7 @@ impl + Send> Proof { pub fn verify>( &self, key: K, - root_hash: [u8; 32], + root_hash: HashKey, ) -> Result>, ProofError> { let mut key_nibbles = Nibbles::<0>::new(key.as_ref()).into_iter(); @@ -147,7 +147,7 @@ impl + Send> Proof { pub fn verify_range_proof, V: AsRef<[u8]>>( &self, - root_hash: [u8; 32], + root_hash: HashKey, first_key: K, last_key: K, keys: Vec, @@ -262,7 +262,7 @@ impl + Send> Proof { fn proof_to_path, S: ShaleStore + Send + Sync, T: BinarySerde>( &self, key: K, - root_hash: [u8; 32], + root_hash: HashKey, merkle_setup: &mut MerkleSetup, allow_non_existent_node: bool, ) -> Result>, ProofError> { @@ -391,8 +391,8 @@ impl + Send> Proof { fn decode_subproof<'a, S: ShaleStore, T, N: AsRef<[u8]>>( merkle: &'a Merkle, - proofs_map: &HashMap<[u8; 32], N>, - child_hash: &[u8; 32], + proofs_map: &HashMap, + child_hash: &HashKey, ) -> Result, ProofError> { let child_proof = proofs_map .get(child_hash) @@ -459,7 +459,7 @@ fn locate_subproof( } } -fn generate_subproof_hash(encoded: &[u8]) -> Result<[u8; 32], ProofError> { +fn generate_subproof_hash(encoded: &[u8]) -> Result { match encoded.len() { 0..=31 => { let sub_hash = sha3::Keccak256::digest(encoded).into();