-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support calculating root from consistency proof #140
Merged
mhutchinson
merged 3 commits into
transparency-dev:main
from
mhutchinson:rootFromConsistencyProof
Sep 18, 2024
Merged
Support calculating root from consistency proof #140
mhutchinson
merged 3 commits into
transparency-dev:main
from
mhutchinson:rootFromConsistencyProof
Sep 18, 2024
Conversation
This file contains 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
This is useful for other teams in the transparency space and was requested via the transparency-dev Slack channel. The new method is similar in essence to RootFromInclusionProof so fits in within the API. As noted in the CHANGELOG, this change fixes a logical bug in the previous code that would have successfully verified an _empty_ proof from a tree size of 0 to any other tree size. In this change, trying to verify a consistency from a tree size of 0 to any other size than 0 will be considered an error, no matter what proof is provided.
AlCutter
reviewed
Sep 18, 2024
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #140 +/- ##
==========================================
- Coverage 89.33% 86.93% -2.41%
==========================================
Files 7 7
Lines 497 375 -122
==========================================
- Hits 444 326 -118
+ Misses 48 44 -4
Partials 5 5 ☔ View full report in Codecov by Sentry. |
Also updated comment on VerifyConsistency to say size1 is required to be > 0. The function is only clearly defined in this case. It's now undefined where size1 is 0.
AlCutter
approved these changes
Sep 18, 2024
This was referenced Sep 18, 2024
mhutchinson
added a commit
to mhutchinson/witness
that referenced
this pull request
Sep 18, 2024
The tests show that this currently works, providing that the proof is empty. When the merkle library is updated to pull in transparency-dev/merkle#140, this will fail too. In both of the new test cases, the witness should ratchet forward when a new checkpoint is provided. As a separate note, I recommend rewriting these tests at some near point in the future. They are currently quite brittle as they rely on hard coded test data with no obvious script to update them. An in-memory test log would be a great way to generate the test data in a flexible way.
mhutchinson
added a commit
to transparency-dev/witness
that referenced
this pull request
Sep 19, 2024
* Added tests for witnesses updating from tree size 0 The tests show that this currently works, providing that the proof is empty. When the merkle library is updated to pull in transparency-dev/merkle#140, this will fail too. In both of the new test cases, the witness should ratchet forward when a new checkpoint is provided. As a separate note, I recommend rewriting these tests at some near point in the future. They are currently quite brittle as they rely on hard coded test data with no obvious script to update them. An in-memory test log would be a great way to generate the test data in a flexible way. * Support ratcheting forward from checkpoints for size 0 The only way to handle this is via a special case.
mhutchinson
added a commit
to mhutchinson/witness
that referenced
this pull request
Sep 19, 2024
This is primarily to pull in transparency-dev/merkle#140 now to confirm it doesn't have any suprises while I'm still context loaded on the issue. Better that than it surprising someone down the road.
mhutchinson
added a commit
to transparency-dev/witness
that referenced
this pull request
Sep 19, 2024
This is primarily to pull in transparency-dev/merkle#140 now to confirm it doesn't have any suprises while I'm still context loaded on the issue. Better that than it surprising someone down the road.
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 is useful for other teams in the transparency space and was requested via the transparency-dev Slack channel. The new method is similar in essence to RootFromInclusionProof so fits in within the API.
As noted in the CHANGELOG, this change fixes a logical bug in the previous code that would have successfully verified an empty proof from a tree size of 0 to any other tree size. In this change, trying to verify a consistency from a tree size of 0 to any other size than 0 will be considered an error, no matter what proof is provided.