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

Feature/partial tree #33

Merged
merged 19 commits into from
Dec 19, 2022
Merged

Feature/partial tree #33

merged 19 commits into from
Dec 19, 2022

Conversation

EvgenKor
Copy link
Collaborator

@EvgenKor EvgenKor commented Dec 9, 2022

Added support for partial tree sync by a client (with specified index), rollbacking, wiping and client self-healing:

  • Building tree siblings to get relayer ability calculate necessary tree nodes to support client's partial tree (getLeftSiblings method in libzkbob_rs::merkle)
  • Calculating Merkle tree root for the specified index without any tree modifications (get_root_at method in libzkbob_rs::merkle)
  • Supporting tree built from the specified index (store first_index, sync state with siblings) (add_leafs_commitments_and_siblings method in libzkbob_rs::merkle)
  • Tree rollback function was optimized. Currently it works much more faster (rollback method in libzkbob_rs::merkle)
  • Rollback currently supports tx sparse array and state (not only Merkle tree) (rollback method in libzkbob_rs::client::state)
  • Added stable index value to the Merkle tree database to support client smooth rollback for self-healing
  • Wipe methods for state and Merkle tree
  • Updated library libzkbob-rs-node to support siblings, stable indexes and wipe methods
  • Updated library libzkbob-rs-wasm to support all integrated methods on the client library side
  • Integrated needed unit tests for new and updated methods

This branch can be tested along zkbob-client-js library and zkbob-console tool with associated branches

Copy link

@AllFi AllFi left a comment

Choose a reason for hiding this comment

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

It works fine in zkbob-console. The changes look good to me.

pub fn wipe(&mut self) {
let mut wipe_batch = self.db.transaction();

// ???: It works fine in the local tests,
Copy link

Choose a reason for hiding this comment

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

Yes, kvdb-web implementation of DeletePrefix doesn't look correct.
image

libzkbob-rs/src/merkle.rs Show resolved Hide resolved
libzkbob-rs/src/merkle.rs Show resolved Hide resolved
libzkbob-rs/src/merkle.rs Show resolved Hide resolved
@r0wdy1 r0wdy1 merged commit cd06d48 into develop Dec 19, 2022
@EvgenKor EvgenKor deleted the feature/partial_tree branch December 20, 2022 07:46
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.

4 participants