Skip to content

Commit

Permalink
chore: address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
h5law committed Sep 18, 2023
1 parent 26ab5dc commit 45af038
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
3 changes: 2 additions & 1 deletion options.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ func WithValueHasher(vh ValueHasher) Option {

// NoPrehashSpec returns a new TreeSpec that has a nil Value and Path Hasher
// NOTE: This should only be used when values are already hashed and a path is
// used instead of a key during proof verification
// used instead of a key during proof verification, otherwise these will be
// double hashed and produce an incorrect leaf digest invalidating the proof.
func NoPrehashSpec(hasher hash.Hash, sumTree bool) *TreeSpec {
spec := newTreeSpec(hasher, sumTree)
opt := WithPathHasher(newNilPathHasher(hasher.Size()))
Expand Down
5 changes: 2 additions & 3 deletions smt.go
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ func (smt *SMT) ProveClosest(path []byte) (
// save current node information as "parent" info
parentDepth = depth
parent = node
// if we hit a nil node we must backstep and try the other child of the
// if we hit a nil node we must back-step and try the other child of the
// parent node (left -> right, right -> left)
if node == nil {
parent, err = smt.resolveLazy(parent)
Expand All @@ -420,7 +420,7 @@ func (smt *SMT) ProveClosest(path []byte) (
if !ok {
panic("parent not inner node")

Check warning on line 421 in smt.go

View check run for this annotation

Codecov / codecov/patch

smt.go#L415-L421

Added lines #L415 - L421 were not covered by tests
}
// trim the last sibling node added as it is no longer relavent
// trim the last sibling node added as it is no longer relevant
if len(siblings) > 0 {
siblings = siblings[:len(siblings)-1]
}
Expand Down Expand Up @@ -459,7 +459,6 @@ func (smt *SMT) ProveClosest(path []byte) (
node, sib = inner.rightChild, inner.leftChild
}
siblings = append(siblings, sib)

depth += 1
}

Expand Down

0 comments on commit 45af038

Please sign in to comment.