From 237c9dea1d36dc2fa409b2d2c25ccf2b54ad25f9 Mon Sep 17 00:00:00 2001 From: Matjaz Verbole Date: Mon, 3 Jul 2023 10:08:37 +0200 Subject: [PATCH] :bug: Fix verify proof function by checking if all sibling hashes were used. --- src/sparse_merkle_tree/smt.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/sparse_merkle_tree/smt.rs b/src/sparse_merkle_tree/smt.rs index c6a7a35..cf23363 100644 --- a/src/sparse_merkle_tree/smt.rs +++ b/src/sparse_merkle_tree/smt.rs @@ -1402,6 +1402,11 @@ impl SparseMerkleTree { while !sorted_queries.is_empty() { let query = &sorted_queries.pop_front().unwrap(); if query.is_zero_height() { + if next_sibling_hash != sibling_hashes.len() { + return Err(SMTError::InvalidInput(String::from( + "Not all sibling hashes were used", + ))); + } return Ok(query.hash.clone()); }