-
Notifications
You must be signed in to change notification settings - Fork 93
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
[feature/jmt (2/4) Implementation of functions to manipulate a Jmt #892
base: feature/jmt-1-integrate-storage-traits-with-jmt
Are you sure you want to change the base?
[feature/jmt (2/4) Implementation of functions to manipulate a Jmt #892
Conversation
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.
So far so good. I haven't done a deep review of the update
logic.
// Inclusion and Exclusion proof require that the root is set, hence we add it | ||
// here. Jmt does not make the constructor for `NibblePath` accessible, so | ||
// we add and remove a node instead. | ||
// TODO: Find a way to set the root without adding and deleting a node | ||
let mock_key = MerkleTreeKey::new(Bytes32::default()); | ||
let mock_value = vec![0u8]; | ||
tree.update(mock_key, &mock_value)?; | ||
tree.delete(mock_key)?; |
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.
Ugh...
// We start from version 2 to be consistent with the version obtained | ||
// when returning a new tree. | ||
// TODO: Change Self::new so that the initial version of a new tree is 0. | ||
let version = 2; |
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.
Perhaps this should be a constant
set: I, | ||
) -> Result<Self, MerkleTreeError<StorageError>> | ||
where | ||
I: Iterator<Item = (B, D)>, |
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.
Nit: This could be more generic if we use IntoIterator
. It saves the caller from explicitly calling .iter()
or .into_iter()
most of the time.
This PR builds upon #891 to provide the basic functions to manipulate a jmt:
Tests are provided in the last PR of this feature.
Checklist
Before requesting review
After merging, notify other teams
[Add or remove entries as needed]