feat!: adds input range check to optimize VerifyLeafHashes and VerifyInclusion methods#253
Merged
feat!: adds input range check to optimize VerifyLeafHashes and VerifyInclusion methods#253
Conversation
Contributor
Author
|
[To the reviewers] The codecov error is not specific to this PR, I am investigating it. |
Collaborator
|
Thanks yea agreed the CodeCov issue isn't caused by this PR: #250 |
rootulp
previously approved these changes
May 13, 2024
walldiss
previously approved these changes
May 14, 2024
Contributor
Author
|
Waiting on #255 to merge |
…into sanaz/optimization
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #253 +/- ##
==========================================
+ Coverage 66.24% 66.50% +0.26%
==========================================
Files 6 6
Lines 1022 1030 +8
==========================================
+ Hits 677 685 +8
Misses 328 328
Partials 17 17 ☔ View full report in Codecov by Sentry. |
rootulp
approved these changes
May 16, 2024
evan-forbes
approved these changes
May 16, 2024
rootulp
added a commit
to celestiaorg/celestia-app
that referenced
this pull request
Jun 21, 2024
Motivation: because celestia-core v1.37.0 uses NMT v0.21.0 which contains this fix: celestiaorg/nmt#253
topdev22
added a commit
to topdev22/app-celestia
that referenced
this pull request
Sep 26, 2025
Motivation: because celestia-core v1.37.0 uses NMT v0.21.0 which contains this fix: celestiaorg/nmt#253
clevergoldfox
added a commit
to clevergoldfox/celestia-app
that referenced
this pull request
Feb 3, 2026
Motivation: because celestia-core v1.37.0 uses NMT v0.21.0 which contains this fix: celestiaorg/nmt#253
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR optimizes the
VerifyLeafHashesandVerifyInclusionmethods 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 of
VerifyLeafHashesandVerifyInclusion. 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.