Skip to content
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

Add MMR rewinding #327

Merged
merged 2 commits into from
May 29, 2019
Merged

Add MMR rewinding #327

merged 2 commits into from
May 29, 2019

Conversation

SWvheerden
Copy link
Collaborator

This PR adds the ability to rewind and forward the MMR without changing it permanently

Description

  • Added in checkpoints to give the MMR the ability to group changes, it can now rewind based on those changes.
  • Fixed a bug where duplicate entries where not added but you thought they where, correctly now tells you they have not.
  • cleared clippy

Motivation and Context

Fixes #288

How Has This Been Tested?

Added additional unit tests

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Feature refactor (No new feature or functional changes, but performance or technical debt improvements)
  • New Tests
  • Documentation

Checklist:

  • I'm merging against the development branch
  • I ran cargo-fmt --all before pushing
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.

Copy link
Collaborator

@CjS77 CjS77 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@@ -49,6 +52,12 @@ pub(crate) struct MerkleCheckPoint {
pub objects_to_del: Vec<ObjectHash>,
mmr_to_add: Vec<MerkleNode>,
}

pub(crate) struct CpCleanup {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
pub(crate) struct CpCleanup {
pub(crate) struct CheckpointCleanup {

Writing MMR out would be a screenful, Checkpoint is fine

@CjS77 CjS77 merged commit dfc25ce into development May 29, 2019
@CjS77 CjS77 deleted the SW_MMR_Rewind branch May 29, 2019 11:47
@@ -190,16 +282,45 @@ impl MerkleChangeTracker {
if !self.enabled {
return Ok(());
}
hashmap.drain();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this does anything. You still need to call collect() or take() on this struct

@CjS77
Copy link
Collaborator

CjS77 commented Jun 4, 2019 via email

@stringhandler
Copy link
Collaborator

Nvm, see it does the same as clear, just creates a new iterator at the same time

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MMR rewind
3 participants