Repository navigation
feat(dash-spv)!: make the storage private and add header queries to DashSpvClient - #1176
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
a6de8d8 to
15bdb45
Compare
|
Waiting for bot review — coderabbitai not yet. Wait for the missing reviews, or a writer can post |
|
Waiting for bot review — coderabbitai not yet. Wait for the missing reviews, or a writer can post |
|
Bots are done — your move: address xdustinface requested changes, then post |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev #1176 +/- ##
=======================================
Coverage 78.86% 78.87%
=======================================
Files 304 304
Lines 81410 81381 -29
=======================================
- Hits 64202 64187 -15
+ Misses 17208 17194 -14
|
xdustinface
left a comment
There was a problem hiding this comment.
Direction looks right. A few things before merge:
1. Platform's offline storage wipe
Platform's offline clear_storage (spv/runtime.rs) opens its own DiskStorageManager, which no longer compiles. It only exists because Platform drops the client on stop() and builds a new one per start. Keeping one client across stop/start and clearing through it would remove it. Is that the plan for the Platform side? If dropping on stop is deliberate (e.g. memory while backgrounded), a client-free DashSpvClient::clear_storage_at(&ClientConfig) would be the alternative.
update_config should also reject a changed storage_path now that the client opens its storage from it.
2. Stale DashSpvClient docs
The doc comment in client/core.rs still describes the S: StorageManager parameter, swappable storage backends, and DiskStorageManager as a third type argument in the examples.
3. No tests for the new queries
anchored_tip / birth_height_anchors_chain_to_nearest_checkpoint in client/mod.rs could assert tip_header(), header_at and header_height against the 200 000 checkpoint, including the Ok(None) cases.
Non-blocking
tip_headerreturnsOptionandget_tipdrops read errors, unlike the other two.get_tip_height+get_header(tip)would giveResult<Option<_>>.pub mod syncstill exports managers generic over storage traits that are no longer nameable outside the crate. Follow-up to make thempub(crate)?
…ashSpvClient The storage module is no longer exported, and `DashSpvClient` is no longer generic over the storage: `new` opens a `DiskStorageManager` at `config.storage_path` itself. `storage()` is replaced by `tip_header`, `header_at` and `header_height`. Tests and benches reach the storage types through `test_utils`. Closes #1173 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
1 - I talked with them, we already have a method in the SPV CLient to clear the storage, there is no point on exposing the entire storage. About the update config method, I think is not even tested and a lot of stuff cant be really changed runtime, I would drop that feature entirely and force everyone to create a new client if they want to change the configuration, avoiding possible issues. No body uses the method here or in platform 2 - Done 3 - I dont really see the point on having a test for a facade without logic, can you explain why you think they are important to have here?? About pub mod sync, I will take care of them in a different PR, no point on having them exposed I think but it is out of the scope of this one, just in case I have to adjust something different else |
15bdb45 to
8965f47
Compare
|
Waiting for bot review — coderabbitai not yet. Wait for the missing reviews, or a writer can post |
|
Bots are done — your move: address xdustinface requested changes, then post |
Platform reads headers through the storage internals (
client.storage()→block_headers()). This makes the storage internal and gives the client the queries it needs.dash_spv::storageis no longer exported, andDashSpvClient<W, N>is no longer generic over the storage.DashSpvClient::newno longer takes a storage: it opens aDiskStorageManageratconfig.storage_path.storage()is replaced bytip_header(),header_at(height)andheader_height(&BlockHash). A missing header isOk(None), distinct from a read error.test_utils(test-utilsfeature).Breaking:
dash_spv::storageis private,DashSpvClientloses its storage type parameter, andDashSpvClient::newandstorage()change as above.Closes #1173
🤖 Generated with Claude Code
Summary by CodeRabbit
PR Hygiene ·
8965f47/self-revieweddash-spv-bench/src/main.rs,dash-spv-ffi/src/client.rs) — QuantumExplorer or xdustinfacedash-spv(dash-spv/CLAUDE.md,dash-spv/README.md,dash-spv/benches/storage.rsand 19 more) — QuantumExplorer or xdustinfaceWhen every merge requirement is met, the
PR Hygienecheck passes. Reviewer limits do not block merging; other required GitHub checks and protections still apply.