-
Notifications
You must be signed in to change notification settings - Fork 120
feat: move rocksdb backend for LargeSmt from -crypto to -node
#1499
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
Merged
Merged
Changes from 14 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
877790d
y
drahnr 4e8c25a
Merge remote-tracking branch 'origin/next' into bernhard-migrate-rock…
drahnr 5ebd43c
sanity
drahnr 5ab5770
maybe
drahnr c91e646
SecretKey(new) vs BlockSigner(old)
drahnr f47111a
yuk
drahnr 594aa40
clippy
drahnr 196b03e
toml, use git dep for CI
drahnr 9078f6b
.git suffix for temp patch
drahnr 4622178
bump patch
drahnr 769e33d
Merge remote-tracking branch 'origin/next' into bernhard-migrate-rock…
drahnr 5f4ccbf
Merge remote-tracking branch 'origin/next' into bernhard-migrate-rock…
drahnr 082c895
toml fmt fix
drahnr 9bec418
Merge remote-tracking branch 'origin/next' into bernhard-migrate-rock…
drahnr a038b16
Merge branch 'next' into bernhard-migrate-rocksdb-from-crypto
drahnr 2823451
remove pathc, use 0.19.7
drahnr cd0ee6d
re-align with upstream
drahnr 2e9998f
fix nit
drahnr 713ce4f
fix = Merge remote-tracking branch 'origin/next' into bernhard-migrat…
drahnr 63fa27f
fix doctest
drahnr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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 hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| [package] | ||
| authors.workspace = true | ||
| description = "Large-scale Sparse Merkle Tree backed by pluggable storage - RocksDB backend" | ||
| edition.workspace = true | ||
| homepage.workspace = true | ||
| keywords = ["merkle", "miden", "node", "smt"] | ||
| license.workspace = true | ||
| name = "miden-large-smt-backend-rocksdb" | ||
| readme = "README.md" | ||
| repository.workspace = true | ||
| rust-version.workspace = true | ||
| version.workspace = true | ||
|
|
||
| [lints] | ||
| workspace = true | ||
|
|
||
| [dependencies] | ||
| miden-crypto = { features = ["concurrent", "std"], workspace = true } | ||
| miden-protocol = { features = ["std"], workspace = true } | ||
| rayon = { version = "1.10" } | ||
| rocksdb = { default-features = false, features = ["bindgen-runtime", "lz4"], version = "0.24" } | ||
| winter-utils = { version = "0.13" } |
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| # miden-large-smt-backend-rocksdb | ||
|
|
||
| Large-scale Sparse Merkle Tree backed by pluggable storage - RocksDB backend implementation. | ||
|
|
||
| This crate provides `LargeSmt`, a hybrid SMT implementation that stores the top of the tree | ||
| (depths 0–23) in memory and persists the lower depths (24–64) in storage as fixed-size subtrees. | ||
| This hybrid layout scales beyond RAM while keeping common operations fast. | ||
|
|
||
| ## Migration Status | ||
|
|
||
| This crate is the future home for `LargeSmt` and its storage backends. Currently it re-exports | ||
| types from `miden-protocol` (which re-exports from `miden-crypto`). | ||
|
|
||
| The migration will be completed in phases: | ||
| 1. ✅ Create this crate as a re-export layer (current state) | ||
| 2. Copy the full implementation from miden-crypto to this crate | ||
| 3. Update miden-crypto to remove the rocksdb feature | ||
| 4. Update dependents to use this crate directly | ||
|
|
||
| ## Features | ||
|
|
||
| - **concurrent**: Enables parallel processing with rayon (enabled by default) | ||
| - **rocksdb**: (Future) Enables RocksDB storage backend | ||
|
|
||
| ## Usage | ||
|
|
||
| ```rust | ||
| use miden_large_smt::{LargeSmt, MemoryStorage}; | ||
|
|
||
| // Create an empty tree with in-memory storage | ||
| let storage = MemoryStorage::new(); | ||
| let smt = LargeSmt::new(storage).unwrap(); | ||
| ``` | ||
|
|
||
| ## Re-exported Types | ||
|
|
||
| This crate re-exports the following types from `miden-protocol`: | ||
|
|
||
| - `LargeSmt` - The large-scale SMT implementation | ||
| - `LargeSmtError` - Error type for LargeSmt operations | ||
| - `MemoryStorage` - In-memory storage backend | ||
| - `SmtStorage` - Storage backend trait | ||
| - `Subtree` - Serializable subtree representation | ||
| - `StorageUpdates` / `StorageUpdateParts` - Batch update types | ||
| - Various SMT types: `Smt`, `SmtLeaf`, `SmtProof`, `LeafIndex`, etc. |
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| //! Large-scale Sparse Merkle Tree backed by pluggable storage. | ||
| //! | ||
| //! `LargeSmt` stores the top of the tree (depths 0–23) in memory and persists the lower | ||
| //! depths (24–64) in storage as fixed-size subtrees. This hybrid layout scales beyond RAM | ||
| //! while keeping common operations fast. | ||
| //! | ||
| //! # Usage | ||
| //! | ||
| //! ```ignore | ||
| //! use miden_large_smt::{LargeSmt, MemoryStorage}; | ||
| //! | ||
| //! // Create an empty tree with in-memory storage | ||
| //! let storage = MemoryStorage::new(); | ||
| //! let smt = LargeSmt::new(storage).unwrap(); | ||
| //! ``` | ||
| //! | ||
| //! ```ignore | ||
| //! use miden_large_smt_backend_rocksdb::{LargeSmt, RocksDbConfig, RocksDbStorage}; | ||
| //! | ||
| //! let storage = RocksDbStorage::open(RocksDbConfig::new("/path/to/db")).unwrap(); | ||
| //! let smt = LargeSmt::new(storage).unwrap(); | ||
| //! ``` | ||
|
|
||
| extern crate alloc; | ||
|
|
||
| mod rocksdb; | ||
| // Re-export from miden-protocol. | ||
| pub use miden_protocol::crypto::merkle::smt::{ | ||
| InnerNode, | ||
| LargeSmt, | ||
| LargeSmtError, | ||
| LeafIndex, | ||
| MemoryStorage, | ||
| SMT_DEPTH, | ||
| Smt, | ||
| SmtLeaf, | ||
| SmtLeafError, | ||
| SmtProof, | ||
| SmtStorage, | ||
| StorageError, | ||
| StorageUpdateParts, | ||
| StorageUpdates, | ||
| Subtree, | ||
| SubtreeError, | ||
| SubtreeUpdate, | ||
| }; | ||
| // Also re-export commonly used types for convenience | ||
| pub use miden_protocol::{ | ||
| EMPTY_WORD, | ||
| Felt, | ||
| Word, | ||
| crypto::{ | ||
| hash::rpo::Rpo256, | ||
| merkle::{EmptySubtreeRoots, InnerNodeInfo, MerkleError, NodeIndex, SparseMerklePath}, | ||
| }, | ||
| }; | ||
| pub use rocksdb::{RocksDbConfig, RocksDbStorage}; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.