-
Notifications
You must be signed in to change notification settings - Fork 45
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
Merkle mountain range partial #86
Conversation
0dd24c2
to
8b87b08
Compare
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.
Looks good! A preliminary review
src/merkle/mmr/partial.rs
Outdated
/// A partial view of the MMR. | ||
/// | ||
/// Data structure used to maintain the proof of a single value up-to-date. Only the data relevant | ||
/// to `value` is stored, meaning the path from the leaf to the root, and the peaks in the MMR that |
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.
When we say path from the leaf to the root
, can we specify in the docs if we refer to a peak or absolute root (i.e. the root of the peaks)?
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.
Updated it to path from the leaf to the peak
.
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.
And to clarify, this implementation can not have the hash(peaks)
. That would imply the partial view would need to be updated with every message.
edit: well ... we could change it to have a valid but not necessarily up-to-date value. This isn't implemented ATM. Maybe I should update @bobbinth , any opinions?
/// Note: It is the caller's responsability to call update with the correct sibling node, | ||
/// otherwise the updated root will be incorrect. | ||
pub fn update(&mut self, right_sibling: Word) { |
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.
Should this be exposed as public? It might lead to an inconsistent state of the tree, so I think we should either leave it in private scope, or suffix it with _unchecked
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.
Yes, the purpose of this structure is to have a partial view of the MMR that can be sporadically updated, this method can not be private.
Is _unchecked
the best option? This shouldn't panic
8b87b08
to
21fd481
Compare
21fd481
to
b305c7e
Compare
@bobbinth this PR has a few conflicts now, let me know if I should rebase it, I don't know if we still want this. |
We'll probably come back to this later - so, don't close it yet. As for rebasing, if it is not too much effort then, yes - I'd keep it up to date. |
superseded by #195 |
Describe your changes
This adds the MmrPartial structure, useful to keep track of a single entry in the MMR and have infrequent updates.
Checklist before requesting a review
next
according to naming convention.