celestiaorg / nmt

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

feat!: accounts for IgnoreMaxNamespace flag in the ProveNamespace method #194

Closed staheri14 closed 1 year ago

staheri14 commented 1 year ago

Overview

Closes https://github.com/celestiaorg/nmt/issues/159

codecov[bot] commented 1 year ago

Codecov Report

Merging #194 (42eeaaa) into master (fd00c52) will decrease coverage by 0.30%. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #194      +/-   ##
==========================================
- Coverage   95.71%   95.41%   -0.30%     
==========================================
  Files           5        5              
  Lines         560      567       +7     
==========================================
+ Hits          536      541       +5     
- Misses         14       15       +1     
- Partials       10       11       +1     
Impacted Files Coverage Δ
nmt.go 97.14% <100.00%> (-0.89%) :arrow_down:
staheri14 commented 1 year ago

Adding the following note for the future reference: The codecov has decreased since previously, there was a possibility of encountering an error in the buildRangeProof function call from within the ProveNamespace function. This error would occur if we deliberately corrupted the state of the tree and then attempted to create namespace proofs using the corrupted tree (tests are available in Test_ProveNamespace_Err ). However, we now add an early call to the Root() function at the beginning of ProveNamespace, which effectively catches any corruption in the tree state and returns immediately. As a result, when we reach the buildRangeProof line, the tree state has already been validated and guaranteed to be valid, preventing the buildRangeProoferror from occurring