feat: add --storage-mode CLI argument to provider node#33
Merged
Conversation
Introduce a StorageBackend trait that both Storage (in-memory) and DiskStorage (persistent disk) implement, allowing the provider node to select the storage backend at startup via --storage-mode <inmemory|disk>. - Add StorageBackend trait with default implementations for collect_chunk_hashes and get_chunk_at_index (shared Merkle proof logic) - Complete DiskStorage: get_chunk_at_index, get_bucket_stats, total_nodes, total_bytes with efficient bucket-level aggregation - Add clap CLI with --storage-mode and --storage-path arguments - Make ProviderState generic over dyn StorageBackend - Parameterize justfile start-provider and demo recipes - Parameterize full-flow.js for provider/client seeds and auto-detect bucket ID from BucketCreated event - Add disk provider integration test step to CI workflow - Add deserialization error logging in DiskStorage
- Fix clippy unused import: hash_children only used in tests, not main module - Add explicit params to inmemory demo step in CI - Rename demo steps to "Run L0 demo" for clarity - Reorder CI: start both providers first, then run both demos
Consolidate storage.rs, disk_storage.rs, and storage-related items from lib.rs into a storage/ module directory with shared trait, types, and per-backend files. Make BucketState private in both backends.
- Move calculate_tree_size to StorageBackend default method (was duplicated) - Remove dead collect_chunks method - Remove unused root_to_bucket map (written but never read) - Remove dead get_bucket inherent method on Storage - Strip pub from private BucketState fields and methods
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Context
Very dummy implementation to make Westend demo persistent, will be reworked later.
Summary
StorageBackendtrait that bothStorage(in-memory) andDiskStorage(persistent disk) implement, allowing the provider node to select the storage backend at startup via--storage-mode <inmemory|disk>DiskStorageimplementation:get_chunk_at_index,get_bucket_stats,total_nodes,total_bytes(with efficient bucket-level aggregation instead of full node scans)--storage-modeand--storage-pathargumentsjustfilerecipes (start-provider,demo) andfull-flow.jsfor provider/client seeds with auto-detected bucket IDsbuild_merkle_proof,collect_chunk_hashes,get_chunk_at_index) as default trait methods to eliminate duplication between backendsDiskStorage