Skip to content

feat: add --storage-mode CLI argument to provider node#33

Merged
bkontur merged 4 commits intodevfrom
bko-demo-simplify
Mar 5, 2026
Merged

feat: add --storage-mode CLI argument to provider node#33
bkontur merged 4 commits intodevfrom
bko-demo-simplify

Conversation

@bkontur
Copy link
Collaborator

@bkontur bkontur commented Mar 5, 2026

Context

Very dummy implementation to make Westend demo persistent, will be reworked later.

Summary

  • 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>
  • Complete the DiskStorage implementation: get_chunk_at_index, get_bucket_stats, total_nodes, total_bytes (with efficient bucket-level aggregation instead of full node scans)
  • Add clap CLI with --storage-mode and --storage-path arguments
  • Parameterize justfile recipes (start-provider, demo) and full-flow.js for provider/client seeds with auto-detected bucket IDs
  • Add disk provider integration test step to CI workflow (Charlie on port 3334)
  • Extract shared Merkle proof logic (build_merkle_proof, collect_chunk_hashes, get_chunk_at_index) as default trait methods to eliminate duplication between backends
  • Add deserialization error logging in DiskStorage

bkontur added 4 commits March 5, 2026 12:49
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
@bkontur bkontur marked this pull request as ready for review March 5, 2026 21:49
@bkontur bkontur enabled auto-merge (squash) March 5, 2026 21:49
@bkontur bkontur merged commit 19c92b7 into dev Mar 5, 2026
10 checks passed
@bkontur bkontur deleted the bko-demo-simplify branch March 5, 2026 22:19
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