From 2172a8f5e39e4bfc02f2c522e207c1b02901e3c4 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 e8160f8..b8333f0 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()); }