celestiaorg / nmt

Namespaced Merkle Tree
Apache License 2.0
112 stars 39 forks source link

feat!: handles empty proofs in validateLeafHash and VerifyInclusion #184

Closed staheri14 closed 1 year ago

staheri14 commented 1 year ago

Overview

Closes https://github.com/celestiaorg/nmt/issues/140 The changes made in this PR are considered to be breaking, as they modify the behavior of VerifyInclusion. In the prior version, the VerifyInclusion function would return false for the first test case named "valid empty proof and leaves == empty." of the TestVerifyInclusion_EmptyProofs suite. However, with the changes implemented, an empty proof for an empty set of leaves is now considered a valid proof. As a result, VerifyInclusion now returns true. cc: @liamsi

Checklist

codecov[bot] commented 1 year ago

Codecov Report

Merging #184 (fc595aa) into master (f05092f) will increase coverage by 1.51%. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #184      +/-   ##
==========================================
+ Coverage   94.14%   95.66%   +1.51%     
==========================================
  Files           5        5              
  Lines         547      554       +7     
==========================================
+ Hits          515      530      +15     
+ Misses         18       14       -4     
+ Partials       14       10       -4     
Impacted Files Coverage Δ
proof.go 93.70% <100.00%> (+6.20%) :arrow_up: