Skip to content

Commit

Permalink
docs: document end exclusive to compute subtree root
Browse files Browse the repository at this point in the history
  • Loading branch information
rach-id committed Jul 1, 2024
1 parent 9d92a94 commit 12ec563
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions nmt.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion proof.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 12ec563

Please sign in to comment.