Skip to content

fix(rs-sdk): replay chained unknown addresses#3722

Draft
thepastaclaw wants to merge 1 commit into
dashpay:fix/rs-sdk-address-sync-found-025from
thepastaclaw:fix-3650-iterative-unknown-replay
Draft

fix(rs-sdk): replay chained unknown addresses#3722
thepastaclaw wants to merge 1 commit into
dashpay:fix/rs-sdk-address-sync-found-025from
thepastaclaw:fix-3650-iterative-unknown-replay

Conversation

@thepastaclaw
Copy link
Copy Markdown
Collaborator

@thepastaclaw thepastaclaw commented May 21, 2026

Addresses CodeRabbit's chained post-snapshot address replay finding on #3650.

Summary

  • Make the Found-025 end-of-pass unknown-address replay iterate while recovered addresses expose additional pending addresses.
  • Preserve buffered change order and keep foreign-wallet misses on the cheap debug-only path.
  • Add a regression test where on_address_found for the first recovered address exposes the next buffered address.

Validation

  • cargo fmt -p dash-sdk --check
  • cargo test -p dash-sdk --lib address_sync — 32 passed
  • Code review gate: Recommendation: ship

Original PR: #3650

Summary by CodeRabbit

  • Bug Fixes

    • Enhanced address balance synchronization to better handle unknown addresses that emerge during the sync process with improved iterative recovery logic.
  • Tests

    • Added regression test to verify proper handling of dependent address recovery during synchronization.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 21, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 0beac912-341d-47d2-bf42-63d9f410d5e8

📥 Commits

Reviewing files that changed from the base of the PR and between 64c1979 and ddee997.

📒 Files selected for processing (1)
  • packages/rs-sdk/src/platform/address_sync/mod.rs

📝 Walkthrough

Walkthrough

The PR refactors address balance synchronization's end-of-pass recovery from a single refresh-and-replay pass to iterative looping. The refresh_and_replay_unknown function now repeatedly polls the provider and replays buffered changes until no further progress is made, handling cases where recovering one post-snapshot address reveals another pending address. A new regression test validates chained address resolution.

Changes

Address Sync Iterative Recovery

Layer / File(s) Summary
Iterative refresh and replay implementation
packages/rs-sdk/src/platform/address_sync/mod.rs
Documentation updated and refresh_and_replay_unknown now loops to rebuild an extras map from pending addresses filtered to unresolved keys, replays matching buffered changes, and breaks only when no progress is made on the remaining buffered misses.
Regression test for chained pending addresses
packages/rs-sdk/src/platform/address_sync/mod.rs
New async test verifies that both post-snapshot buffered changes are applied when one recovered address triggers discovery of another pending address, with correct callback ordering and re-polling of the provider.

Estimated Code Review Effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested Labels

ready for final review

Poem

🐰 A loop reborn, no longer one pass,
Now iterates through addresses with class!
When one unknown finds its long-lost friend,
The sync continues 'til the loop's end.
Chained pending returns, all properly found,
A rabbit approves with a hop and a bound! 🥕

🚥 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 title accurately summarizes the main change: fixing the replay of chained unknown addresses in the rs-sdk, which matches the iterative refresh logic update described in the summary.
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

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 thepastaclaw force-pushed the fix-3650-iterative-unknown-replay branch from 2b3b8d7 to ddee997 Compare May 21, 2026 12:24
@thepastaclaw
Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 21, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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