forked from celestiaorg/smt
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rewrite tree to use lazy-loaded cache with deferred commit
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.
- Loading branch information
Showing
19 changed files
with
1,267 additions
and
1,614 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.