From 4c050945eb86036129f6fc4037d4dc50340701b5 Mon Sep 17 00:00:00 2001 From: sanaz Date: Fri, 10 May 2024 15:28:25 -0700 Subject: [PATCH] adds a comment about the range check --- proof.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/proof.go b/proof.go index 925332a0..70af6eb3 100644 --- a/proof.go +++ b/proof.go @@ -251,6 +251,7 @@ func (proof Proof) VerifyNamespace(h hash.Hash, nID namespace.ID, leaves [][]byt // If there is an issue during the proof verification e.g., a node does not conform to the namespace hash format, then a proper error is returned to indicate the root cause of the issue. // The leafHashes parameter is a list of leaf hashes, where each leaf hash is represented // by a byte slice. +// The size of leafHashes should match the proof range i.e., end-start. // If the verifyCompleteness parameter is set to true, the function also checks // the completeness of the proof by verifying that there is no leaf in the // tree represented by the root parameter that matches the namespace ID nID @@ -405,6 +406,7 @@ func (proof Proof) VerifyLeafHashes(nth *NmtHasher, verifyCompleteness bool, nID // and the provided proof to regenerate and compare the root. Note that the leavesWithoutNamespace data should not contain the prefixed namespace, unlike the tree.Push method, // which takes prefixed data. All leaves implicitly have the same namespace ID: // `nid`. +// The size of the leavesWithoutNamespace should be equal to the proof range i.e., end-start. // VerifyInclusion does not verify the completeness of the proof, so it's possible for leavesWithoutNamespace to be a subset of the leaves in the tree that have the namespace ID nid. func (proof Proof) VerifyInclusion(h hash.Hash, nid namespace.ID, leavesWithoutNamespace [][]byte, root []byte) bool { // check the range of the proof