-
Notifications
You must be signed in to change notification settings - Fork 25
Clarify language in consistency proof verification algorithm #139
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -475,29 +475,29 @@ Given a Merkle Tree over `n` elements, a subtree defined by `[start, end)`, a co | |
| 1. If `end` is `n`, run the following: | ||
| 1. Set `fn` to `start` and `sn` to `end - 1`. | ||
| 2. Set `r` to `node_hash`. | ||
| 3. Right-shift `fn` and `sn` equally until `LSB(fn)` is set or `sn` is zero. | ||
| 3. Until `LSB(fn)` is set or `sn` is `0`, right-shift `fn` and `sn` equally. | ||
| 4. For each value `p` in the `proof` array: | ||
| 1. If `sn` is 0, then stop iteration and fail the proof verification. | ||
| 1. If `sn` is `0`, then stop iteration and fail the proof verification. | ||
| 2. Set `r` to `HASH(0x01 || p || r)`. | ||
| 3. If `LSB(sn)` is not set, the right-shift `sn` until either `LSB(sn)` is set or `sn` is zero. | ||
| 3. Until `LSB(sn)` is set, right-shift `sn`. | ||
| 4. Right-shift `sn` once more. | ||
| 5. Check `sn` is 0 and `r` is `root_hash`. If either is not equal, fail the proof verification. If all are equal, accept the proof. | ||
| 5. Compare `sn` to `0` and `r` to `root_hash`. If either is not equal, fail the proof verification. If all are equal, accept the proof. | ||
| 2. Otherwise, run the following: | ||
| 1. If `proof` is an empty array, stop and fail verification. | ||
| 2. If `end - start` is an exact power of two, prepend `node_hash` to the `proof` array. | ||
| 3. Set `fn` to `start`, `sn` to `end - 1`, and `tn` to `n - 1`. | ||
| 4. Right-shift `fn`, `sn`, and `tn` equally until `LSB(sn)` is not set or `fn = sn`. | ||
| 4. Until `LSB(sn)` is not set or `fn` is equal to `sn`, right-shift `fn`, `sn`, and `tn` equally. | ||
| 5. Set both `fr` and `sr` to the first value in the `proof` array. | ||
| 6. For each subsequent value `c` in the `proof` array: | ||
| 1. If `tn` is 0, then stop the iteration and fail the proof verification. | ||
| 1. If `tn` is `0`, then stop the iteration and fail the proof verification. | ||
| 2. If `LSB(sn)` is set, or if `sn` is equal to `tn`, then: | ||
| 1. If `fn < sn`, set `fr` to `HASH(0x01 || c || fr)`. | ||
| 2. Set `sr` to `HASH(0x01 || c || sr)`. | ||
| 3. If `LSB(sn)` is not set, then right-shift each of `fn`, `sn`, and `tn` equally until either `LSB(sn)` is set or `sn` is 0. | ||
| 3. Until `LSB(sn)` is set, right-shift `fn`, `sn`, and `tn` equally. | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For myself: |
||
| 3. Otherwise: | ||
| 1. Set `sr` to `HASH(0x01 || sr || c)`. | ||
| 4. Finally, right-shift each of `fn`, `sn`, and `tn` one time. | ||
| 7. Check `tn` is 0, `fr` is `node_hash`, and `sr` is `root_hash`. If any are not equal, fail the proof verification. If all are equal, accept the proof. | ||
| 4. Right-shift `fn`, `sn`, and `tn` once more. | ||
| 7. Compare `tn` to `0`, `fr` to `node_hash`, and `sr` to `root_hash`. If any are not equal, fail the proof verification. If all are equal, accept the proof. | ||
|
|
||
| ## Arbitrary Intervals | ||
|
|
||
|
|
||
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For myself:
snis non-zero by (1), soLSB(sn)will eventually be set.