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

Clean up and refactor #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Clean up and refactor #6

wants to merge 1 commit into from

Conversation

roysc
Copy link
Collaborator

@roysc roysc commented Feb 14, 2023

Various renames and refactoring of types, including hashers.

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.
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.

1 participant