Skip to content

chore(deps): bump platform to 2cc4cdcf8 (rust-dashcore 309fac8)#834

Merged
lklimek merged 5 commits into
v1.0-devfrom
chore/bump-rust-dashcore-309fac8
Apr 23, 2026
Merged

chore(deps): bump platform to 2cc4cdcf8 (rust-dashcore 309fac8)#834
lklimek merged 5 commits into
v1.0-devfrom
chore/bump-rust-dashcore-309fac8

Conversation

@lklimek
Copy link
Copy Markdown
Contributor

@lklimek lklimek commented Apr 20, 2026

Summary

Bumps the Dash Platform pin to 2cc4cdcf8 (which pulls in rust-dashcore 309fac8) and adapts DET to the upstream WalletInterface / SPV API changes. Extracted from PR #830 to keep that PR focused on the bug-2 pool-extension fix.

Why now

PR #830 originally carried the platform bump, the bug-2 pool-extension fix, and a clear_data_dir reset fix in a single branch. The bump is a pure dependency update with associated API adaptations; mixing it with a behavioural SPV bug fix makes the diff harder to review and raises the blast radius of any revert. This PR carries only the bump and the one clear_data_dir change that is directly tied to the new filter_committed_height field introduced by the bump.

What's in this PR

Commit 1 — chore(deps): bump platform to 2cc4cdcf8 (rust-dashcore 309fac8)

Pure API adaptation. No behavioural change.

  • Cargo.toml / Cargo.lock — pin bump.
  • src/model/wallet/mod.rsAddressProvider trait became #[async_trait]; adapted.
  • src/ui/tools/masternode_list_diff_screen.rs:
    • QualifiedQuorumEntry iteration changed from &QualifiedQuorumEntry to (&u16, &QualifiedQuorumEntry) tuples.
    • feed_qr_info signature changed from closure-based to &QRInfoBlockData struct — helper build_qr_info_block_data extracted.
    • SdkError::Protocol(e) wrapping for upstream ProtocolError.

Commit 2 — fix(spv): reset filter_committed_height on Clear SPV Data

A direct consequence of the bump. Ships here (not in #830) because pre-bump it would be a no-op.

  • Pre-bump: WalletManager::update_filter_committed_height was a default trait impl wrapping update_synced_height. Resetting synced_height to 0 was sufficient for rescan.
  • Post-bump (rust-dashcore 309fac8): filter_committed_height is an independent field and is what FiltersManager::new() reads for its "already synced" guard. Leaving synced_height = 0 while filter_committed_height stayed stale meant the "Clear SPV Data" rescan was silently skipped.
  • Fix: SpvManager::clear_data_dir now calls wm.update_filter_committed_height(0) instead of update_synced_height(0).
  • Regression test added: test_clear_data_dir_resets_filter_committed_height.

Files (effective diff vs v1.0-dev)

File Lines Purpose
Cargo.toml / Cargo.lock ~+164/-100 Platform pin bump
src/model/wallet/mod.rs small AddressProvider async-trait adaptation
src/ui/tools/masternode_list_diff_screen.rs +115/- QualifiedQuorumEntry tuple-iter + feed_qr_info API adaptation
src/spv/manager.rs +13 clear_data_dir — reset filter_committed_height
src/spv/tests.rs +43 test_clear_data_dir_resets_filter_committed_height

Test plan

Automated (all green)

  • cargo build --all-features — clean
  • cargo clippy --all-features --all-targets -- -D warnings — clean
  • cargo +nightly fmt --all -- --check — clean
  • cargo test --all-features --workspace --lib — 453 / 453 pass

Manual on testnet

  • MasternodeListDiff screen still renders. QR info feeds update without panic on the new &QRInfoBlockData path.
  • SDK identity / contract fetches work against testnet (sanity check that the AddressProvider async-trait change didn't regress anything).
  • "Clear SPV Data" triggers a real rescan. With an already-synced wallet, click Clear SPV Data, relaunch, and confirm filter sync actually re-runs from the checkpoint — not skipped.

Related

  • Parent issue: #829
  • Sibling PR: #830 — narrowed to the bug-2 atomic pool-extension fix once this lands.
  • Sibling PR: #833 — bug-1 startup init-order race (independent).

🤖 Co-authored by Claudius the Magnificent AI Agent

Summary by CodeRabbit

Release Notes

  • Bug Fixes

    • Fixed wallet filter synchronization state not being properly cleared during data reset operations.
  • Improvements

    • Improved masternode list QR info handling with more reliable block-height resolution and caching, and more accurate quorum selection display.
  • Chores

    • Updated Dash SDK dependencies to a newer platform revision.

lklimek and others added 2 commits April 20, 2026 16:25
Adapts dash-evo-tool to rust-dashcore 309fac8 API changes shipped via
platform rev 2cc4cdcf85ce62b437031671336bf622b3aafaa5.

API surface changes handled:

- `MasternodeListEngine::feed_qr_info` signature changed: now takes
  `&QRInfoBlockData` rather than an `Option<F>` height-lookup closure.
  Both call sites in `masternode_list_diff_screen.rs` now pre-populate
  the bundle via a new `build_qr_info_block_data` helper that resolves
  hash->height from the screen's cache/Core RPC and height->hash for
  cycle boundary blocks via `get_block_hash` (Core RPC).
- `MasternodeListEngine::rotated_quorums_per_cycle` is now a
  `BTreeMap<BlockHash, BTreeMap<u16, QualifiedQuorumEntry>>` (was a
  `Vec`). `render_last_commitments` now destructures the inner map
  directly and the quorum index comes from the map key.
- `AddressProvider::on_address_found` / `on_address_absent` are now
  `async fn` (via the trait's `#[async_trait]`). `WalletAddressProvider`
  is annotated with `#[async_trait]` and both callbacks made `async`.
- `sml::quorum_validation_error::ClientDataRetrievalError` was removed
  upstream. The only DET uses were inside the feed_qr_info closure that
  is now replaced wholesale; the import is gone.

No behavioural change - this is pure API adaptation. All existing SPV
fixes on this branch (DB fallback for start_spv, atomic BIP44 pool
extension, SPV restart on mid-session import) continue to behave
identically and their tests still pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
At rust-dashcore 309fac8, WalletManager gained an independent
filter_committed_height field. FiltersManager::new() reads
filter_committed_height() for its "already synced" guard; the field is
no longer derived from synced_height.

Previously clear_data_dir called update_synced_height(0), which
pre-bump effectively reset both fields via the trait's default impl.
Post-bump it only resets synced_height, leaving filter_committed_height
at its stale previous value. FiltersManager then logs "Filters already
synced to N" and skips the rescan, producing zero balance after a
Clear SPV Data.

Switch clear_data_dir to update_filter_committed_height(0), which
unconditionally sets the field and only bumps synced_height upward if
the incoming height is larger — exactly the semantics we need for a
rescan-floor reset.

Adds a regression test asserting filter_committed_height is lowered to 0
after clear_data_dir().

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 20, 2026

Warning

Rate limit exceeded

@lklimek has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 35 minutes and 56 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 35 minutes and 56 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 829cea16-0855-43f2-b8e6-f6bb4aaea1c6

📥 Commits

Reviewing files that changed from the base of the PR and between 2b16d6f and fd8df3d.

📒 Files selected for processing (3)
  • src/spv/manager.rs
  • src/spv/tests.rs
  • src/ui/tools/masternode_list_diff_screen.rs
📝 Walkthrough

Walkthrough

Updates dependency git revisions; convert wallet address provider callbacks to async; change SPV clear logic to reset filter_committed_height with stricter lock handling and add a regression test; replace closure-based QRInfo height resolution with a cache+Core-RPC helper and switch quorum display/selection to quorum_index.

Changes

Cohort / File(s) Summary
Dependency Updates
Cargo.toml
Bumped git revisions for dash-sdk and rs-sdk-trusted-context-provider dependencies from 9d799d... to 2cc4cdc....
Async Address Provider
src/model/wallet/mod.rs
AddressProvider for WalletAddressProvider impl annotated with #[async_trait]; on_address_found and on_address_absent signatures changed to async fn.
SPV Filter State Management
src/spv/manager.rs, src/spv/tests.rs
clear_data_dir now resets filter_committed_height to 0 and returns an error if wallet lock acquisition fails; updated docs/comments; new async regression test verifies clearing behavior.
Masternode List QR Info Refactor
src/ui/tools/masternode_list_diff_screen.rs
Introduced build_qr_info_block_data helper to resolve block hashes to heights via block_height_cache with Core RPC fallback and caching; both QRInfo ingestion paths now use resolved QRInfoBlockData; quorum display/selection now keyed by quorum_index.

Sequence Diagram(s)

sequenceDiagram
    participant UI as "UI (Screen)"
    participant Engine as "MasternodeListEngine"
    participant Cache as "block_height_cache"
    participant Core as "Core RPC"

    rect rgba(200,230,255,0.5)
    UI->>Engine: request feed_qr_info_and_get_dmls(...)
    Engine->>Engine: enumerate referenced QRInfo hashes
    Engine->>Cache: lookup hash heights
    alt cache hit
        Cache-->>Engine: return height
    else cache miss
        Engine->>Core: get block height by hash
        Core-->>Engine: return height
        Engine->>Cache: insert resolved height
    end
    Engine-->>UI: call feed_qr_info(&QRInfoBlockData)
    end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

🐰 Hops in code, a little async song,

Filters cleared and hashes sorted strong,
QR heights fetched, cached with care,
Quorums numbered true and fair,
My whiskers twitch — the build is long but bright. 🥕

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately summarizes the main change: bumping Dash platform dependency to a new commit with associated API adaptations.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/bump-rust-dashcore-309fac8

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@thepastaclaw
Copy link
Copy Markdown
Collaborator

thepastaclaw commented Apr 23, 2026

Review Gate

Commit: fd8df3d3

  • Debounce: 1m ago (need 30m)

  • CI checks: checks still running (2 pending)

  • CodeRabbit review: comment found

  • Off-peak hours: peak window (5am-11am PT) — currently 06:54 AM PT Thursday

  • Run review now (check to override)

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/spv/manager.rs`:
- Around line 821-830: The code currently swallows failures from
self.wallet.try_write() when resetting
WalletManager::update_filter_committed_height(0) and still returns Ok(()) after
clearing SPV data; instead, propagate the error so the SPV clear operation fails
if the lock/update fails. Change the match to return an Err (or map the
PoisonError to the existing error type) when try_write() returns Err(_) rather
than only logging, ensuring the caller of the SPV clear routine sees the failure
and no success is returned when update_filter_committed_height could not be
applied.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 23d1f699-8628-4ce3-878f-9f51db8afcec

📥 Commits

Reviewing files that changed from the base of the PR and between eb7c162 and 6aba82a.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (5)
  • Cargo.toml
  • src/model/wallet/mod.rs
  • src/spv/manager.rs
  • src/spv/tests.rs
  • src/ui/tools/masternode_list_diff_screen.rs

Comment thread src/spv/manager.rs Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the pinned Dash Platform (dash-sdk) revision and adapts Dash Evo Tool to upstream Wallet/SPV and SML masternode list engine API changes, including a targeted SPV reset fix for the new filter_committed_height state.

Changes:

  • Bump dash-sdk / platform git rev (and resulting Cargo.lock updates).
  • Adapt WalletAddressProvider to upstream AddressProvider becoming #[async_trait] with async callbacks.
  • Update MasternodeListDiff QRInfo processing to the new feed_qr_info(&QRInfoBlockData) API and fix “Clear SPV Data” to reset filter_committed_height, with a regression test.

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
Cargo.toml Bumps Dash Platform/dash-sdk pin to 2cc4cdcf8….
Cargo.lock Locks updated dependency graph for the new platform + rust-dashcore revisions.
src/model/wallet/mod.rs Applies async-trait adaptation for AddressProvider callbacks.
src/ui/tools/masternode_list_diff_screen.rs Refactors QRInfo height/hash resolution to build QRInfoBlockData and adapts to updated engine iteration/signatures.
src/spv/manager.rs Resets filter_committed_height during SPV data clear to ensure rescans aren’t skipped.
src/spv/tests.rs Adds regression test ensuring clear_data_dir() resets filter_committed_height.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/ui/tools/masternode_list_diff_screen.rs Outdated
- spv/manager.rs: propagate try_write() failure in clear_data_dir
  instead of logging-and-continuing. A contended or poisoned RwLock
  would have left filter_committed_height stale in memory while the
  on-disk data was wiped, re-triggering the exact skipped-rescan bug
  this PR is meant to fix.
- ui/tools/masternode_list_diff_screen.rs: use get_block_hash_and_cache
  helper in build_qr_info_block_data so both engine block_container
  and caches are consulted/populated consistently; drops redundant
  direct RPC call and redundant block_height_cache write.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@lklimek lklimek requested a review from Copilot April 23, 2026 13:32
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/ui/tools/masternode_list_diff_screen.rs`:
- Around line 4255-4263: When build_qr_info_block_data fails the code only sets
ui_state.error and returns, leaving self.task.pending set and the pending
spinner stuck; replace the early-return error handling to call the existing
display_message(...) with MessageType::Error (which will clear self.task.pending
and set ui_state.error) instead of only assigning ui_state.error. Apply the same
change in the feed_qr_info_and_get_dmls error branch so both
build_qr_info_block_data and feed_qr_info_and_get_dmls use display_message to
clear pending and record the error.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 4a07e44f-6c7e-47a1-aa0d-c5cb0b201edb

📥 Commits

Reviewing files that changed from the base of the PR and between 6aba82a and 2b16d6f.

📒 Files selected for processing (2)
  • src/spv/manager.rs
  • src/ui/tools/masternode_list_diff_screen.rs

Comment thread src/ui/tools/masternode_list_diff_screen.rs Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 6 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Error paths in `feed_qr_info_and_get_dmls` and the `MnListFetchedQrInfo`
handler returned early after setting `ui_state.error` without clearing
`self.task.pending`, leaving the pending spinner stuck after a failure.
Clear `self.task.pending = None` on every error return so the UI is
always returned to an idle state.

Also move `build_qr_info_block_data` above the `insert_mn_list_diff`
calls in the `MnListFetchedQrInfo` handler so a failure does not leave
the diff cache partially populated.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@lklimek lklimek requested a review from Copilot April 23, 2026 13:56
@lklimek lklimek enabled auto-merge (squash) April 23, 2026 13:58
@lklimek lklimek merged commit bc6c0c2 into v1.0-dev Apr 23, 2026
8 checks passed
@lklimek lklimek deleted the chore/bump-rust-dashcore-309fac8 branch April 23, 2026 14:01
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 6 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/spv/manager.rs
Comment on lines 806 to 838
if let Ok(mut storage_guard) = self.storage.lock() {
*storage_guard = None;
}

if let Ok(mut client_guard) = self.spv_client.write() {
*client_guard = None;
}

if let Ok(mut request_guard) = self.request_tx.lock() {
*request_guard = None;
}

if let Ok(mut wallet_map) = self.det_wallets.write() {
wallet_map.clear();
}

// Reset the in-memory WalletManager's synced_height so the next SPV session
// scans filters from genesis instead of the stale height from the previous run.
match self.wallet.try_write() {
Ok(mut wm) => {
wm.update_synced_height(0);
}
Err(_) => {
tracing::warn!("Failed to reset WalletManager synced_height during SPV data clear");
}
// Reset the in-memory WalletManager's filter_committed_height so the next
// SPV session scans filters from genesis instead of the stale height from the
// previous run. We reset filter_committed_height (not synced_height) because at
// rust-dashcore 309fac8 these became independent fields — FiltersManager::new()
// reads filter_committed_height() for its "already synced" guard.
//
// This must succeed before we wipe the on-disk data; otherwise the in-memory
// height would stay stale while on-disk filters are gone, re-triggering the
// skipped-rescan bug this clear is meant to prevent.
{
let mut wm = self.wallet.try_write().map_err(|e| {
format!(
"Failed to reset WalletManager filter_committed_height during SPV data clear: {e}"
)
})?;
wm.update_filter_committed_height(0);
}
Copy link

Copilot AI Apr 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clear_data_dir() now returns Err if self.wallet.try_write() fails, but this lock attempt happens after clearing storage/spv_client/request_tx and det_wallets. If try_write fails, the function exits early with those fields already cleared, leaving SpvManager in a partially-reset state (and without resetting filter_committed_height or touching on-disk data). To keep the operation atomic, acquire the wallet write lock before mutating other state (or defer clearing det_wallets/client fields until after the lock succeeds), or otherwise roll back the partial in-memory changes on this error path.

Copilot uses AI. Check for mistakes.
Comment on lines +4246 to +4247
// Build this BEFORE inserting diffs into the cache so a failure does not
// leave the cache partially populated.
Copy link

Copilot AI Apr 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment says building block_data before inserting diffs avoids leaving "the cache" partially populated on failure, but build_qr_info_block_data() itself populates block_height_cache/block_hash_cache via get_*_and_cache. Consider clarifying the comment to refer specifically to the mn_list_diff/diff caches (or adjust the flow if the intent is truly to avoid any cache mutation before success).

Suggested change
// Build this BEFORE inserting diffs into the cache so a failure does not
// leave the cache partially populated.
// Build this BEFORE inserting mn_list_diff entries so a failure does not
// leave the diff-related caches partially populated. Note that
// build_qr_info_block_data() may still warm block hash/height caches.

Copilot uses AI. Check for mistakes.
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.

3 participants