-
Notifications
You must be signed in to change notification settings - Fork 4
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
Use lazy-loaded cached tree implementation #6
Conversation
This introduces a largely rewritten implementation of the SMT which operates on a cached, lazily-loaded tree structure which must be explicitly committed to DB, replacing the existing pattern of performing DB reads and writes on for each operation. This gives a significant performance improvement on all operations while preserving backwards compatibility of commitment hashes. This also: * refactors the hasher objects to allow tree paths and stored values to be hashed independently, and Options to configure them. By passing an identity function as the path hasher, the raw key can be used directly as the leaf. * removes value storage from the tree; the caller must maintain their own value mapping. * removes the DeepSubtree code supporting state-transition fraud proofs, as it was not compatible as-is with this implementation (but there should be no technical block to adapting it to this pattern). * renames various types and decouples the path and value hashing functions. * expands tests to cover corner cases, e.g. orphan node removal.
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.
The hashers.go file was missing from the repo and had to be copied in
Damn...
Going to approve this just so we can merge it in and start iterating on top of the lazy-loaded PR. A couple things to keep in mind (before we clean up the code and such):
- Can you try to integrate the lazy-loaded PR into the pocket repo and see if everything still works as expected?
- Note that the README in this repo will also need to be updated, but happy to leave that for a future PR as well.
With that said
Thanks for pulling from the new branch, and pointing out the missing file - sorry about that! |
No worries thanks for all your hard work! |
This is a port of this PR whilst retaining the squashed commit history of @roysc
Although using the latest vulcanize/smt lazy_loading branch some changes had to be made:
hashers.go
file was missing from the repo and had to be copied incelestiaorg/smt
were replaced withpokt-network/smt
This solves and merge conflicts and enables lazy loading to be used in the repo.