From 12ec5633fc3d1f746b9c11d71e149694d72d5c3d Mon Sep 17 00:00:00 2001 From: sweexordious Date: Mon, 1 Jul 2024 11:50:35 +0100 Subject: [PATCH] docs: document end exclusive to compute subtree root --- nmt.go | 1 + proof.go | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/nmt.go b/nmt.go index 76591c5..f8f82f5 100644 --- a/nmt.go +++ b/nmt.go @@ -646,6 +646,7 @@ func (n *NamespacedMerkleTree) updateMinMaxID(id namespace.ID) { // ComputeSubtreeRoot takes a leaf range and returns the corresponding subtree root. // Also, it requires the start and end range to correctly reference an inner node. +// The provided range, defined by start and end, is end-exclusive. func (n *NamespacedMerkleTree) ComputeSubtreeRoot(start, end int) ([]byte, error) { if start < 0 { return nil, fmt.Errorf("start %d shouldn't be strictly negative", start) diff --git a/proof.go b/proof.go index 5c5b5c2..289fc41 100644 --- a/proof.go +++ b/proof.go @@ -506,7 +506,7 @@ func (proof Proof) VerifySubtreeRootInclusion(nth *NmtHasher, subtreeRoots [][]b // check whether the number of ranges matches the number of subtree roots. // if not, make an early return. if len(subtreeRoots) != len(ranges) { - return false, fmt.Errorf("number of subtree roots %d is different than the number of leaf ranges %d", len(subtreeRoots), len(ranges)) + return false, fmt.Errorf("number of subtree roots %d is different than the number of the expected leaf ranges %d", len(subtreeRoots), len(ranges)) } var computeRoot func(start, end int) ([]byte, error)