Closed staheri14 closed 6 months ago
[To the reviewers] The codecov error is not specific to this PR, I am investigating it.
Thanks yea agreed the CodeCov issue isn't caused by this PR: https://github.com/celestiaorg/nmt/issues/250
Waiting on #255 to merge
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 66.50%. Comparing base (
559fe2b
) to head (a660fac
).
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
This PR optimizes the
VerifyLeafHashes
andVerifyInclusion
methods by ensuring that the size of the provided leaves or leaf hashes matches the proof range and, if not, making an early return in order to prevent unnecessary hashing operations that would otherwise occur. It introduces a breaking change by altering the behaviour ofVerifyLeafHashes
andVerifyInclusion
. Previously, verification would succeed even if the provided leaves or leaf hashes exceeded the proof range, as long as the proof was valid and the extra leaves were appended at the end. In the new implementation, the verification will return false or an error in such cases.