Re-implement merkletree with persistent storage (key-value db) (#487)

* refactor merkletree to work with disk keyvalue database (wip)

* various fixes post reimplementation; pending delete leaf

* add delete operation case for the new in db tree approach

* polish tree update & delete; everything works (pending polishing)

* polish panics into errs, prints, etc

* Implement iterator

* Lint

* fix case no-siblings

* case delete with semi-empty branch

* polishing

* starting to add rocksdb & heeddb for the DB & Txn traits

* Satisfy the borrow checker

* abstract merkletree tests to use the various available DBs

* update store_node interface (rm hash input), rm heed.rs

* polishing

* typos

* Ditch transactions

* add feature for rocksdb, return errs at new_with_db, remove empty leaf case in Leaf::new

* intermediate instead of leaf in empty node when deleting leaf

---------

Co-authored-by: Ahmad <root@ahmadafuni.com>
This commit is contained in:
arnaucube 2026-03-11 16:32:42 +01:00 committed by GitHub
parent a79f82eb9d
commit 32f45872d7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 974 additions and 431 deletions

View file

@ -48,6 +48,7 @@ good_lp = { version = "1.8", default-features = false, features = [
"scip_bundled",
] }
annotate-snippets = "0.11"
rocksdb = { version = "0.24.0", optional = true } # keyvalue database for merkletree
# Uncomment for debugging with https://github.com/ed255/plonky2/ at branch `feat/debug`. The repo directory needs to be checked out next to the pod2 repo directory.
# [patch."https://github.com/0xPARC/plonky2"]
@ -57,12 +58,13 @@ annotate-snippets = "0.11"
pretty_assertions = "1.4.1"
# Used only for testing JSON Schema generation and validation.
jsonschema = "0.30.0"
tempfile = "3"
[build-dependencies]
vergen-gitcl = { version = "1.0.0", features = ["build"] }
[features]
default = ["backend_plonky2", "zk", "mem_cache"]
default = ["backend_plonky2", "zk", "mem_cache", "db_rocksdb"]
backend_plonky2 = ["plonky2"]
zk = []
metrics = []
@ -70,6 +72,7 @@ time = []
examples = []
disk_cache = ["directories", "minicbor-serde"]
mem_cache = []
db_rocksdb = ["rocksdb"]
# Uncomment in order to enable debug information in the release builds. This allows getting panic backtraces with a performance similar to regular release.
# [profile.release]