-
Notifications
You must be signed in to change notification settings - Fork 15
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
shardtree: Significantly rework handling of checkpoint depths and truncation operations. #115
Conversation
5583ba8
to
8189418
Compare
} | ||
|
||
fn rewind(&mut self, depth: usize) -> bool { | ||
if self.checkpoints.len() > depth { |
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.
Shouldn't it be valid to rewind by exactly the number of checkpoints?
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.
Depth is treated as a (reverse-ordered) 0-based index, so it must be less than the length.
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.
Reviewed 0c01af9 (the first commit), flushing comments.
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.
Reviewed 8189418.
The previous semantics of the `rewind` operation would remove the last checkpoint, if any, but would not further modify the tree. However, these semantics are error prone - if you rewind to a checkpoint, you are not able to rewind to the same checkpoint again; also, in practice, it doesn't make sense to shift the location of a checkpoint in the note commitment tree. This change alters `rewind` to (a) take an explicit checkpoint depth, with depth `0` meaning that any state added since the last checkpoint should be discarded, and (b) only allow a rewind operation to succeed if a checkpoint actually exists at the specified depth.
8189418
to
9a77e51
Compare
force-pushed to address comments from code review. |
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.
utACK 9a77e51 after doc fixes
Co-authored-by: Jack Grigg <thestr4d@gmail.com>
a8c17ce
to
3f59900
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.
Re-utACK 3f59900
No description provided.