Skip to content

fix(platform-wallet): keep sync watermark monotonic#3724

Closed
thepastaclaw wants to merge 1 commit into
dashpay:feat/platform-wallet-sync-watermark-getterfrom
thepastaclaw:fix-3723-monotonic-sync-watermark
Closed

fix(platform-wallet): keep sync watermark monotonic#3724
thepastaclaw wants to merge 1 commit into
dashpay:feat/platform-wallet-sync-watermark-getterfrom
thepastaclaw:fix-3723-monotonic-sync-watermark

Conversation

@thepastaclaw
Copy link
Copy Markdown
Collaborator

@thepastaclaw thepastaclaw commented May 21, 2026

fix(platform-wallet): keep sync watermark monotonic

Summary

Fixes the CodeRabbit feedback on #3723 by keeping
PlatformPaymentAddressProvider::update_sync_state monotonic.

An out-of-order sync result can no longer move sync_height, sync_timestamp,
or last_known_recent_block backward after a newer result has already advanced
them.

Validation

  • cargo fmt -p platform-wallet --check
  • cargo test -p platform-wallet platform_addresses
  • Pre-commit hook: cargo fmt --all -- --check
  • Pre-commit hook: workspace cargo check
  • Code review gate against
    origin/feat/platform-wallet-sync-watermark-getter...fix-3723-monotonic-sync-watermark
    — Recommendation: ship

Summary by CodeRabbit

  • Bug Fixes
    • Improved wallet synchronization state tracking to ensure previously observed sync progress markers are preserved across updates, preventing potential regression in sync state management.

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: c7792991-0170-4def-bb3d-6492fcf883e8

📥 Commits

Reviewing files that changed from the base of the PR and between e75932b and d75aebf.

📒 Files selected for processing (1)
  • packages/rs-platform-wallet/src/wallet/platform_addresses/provider.rs

📝 Walkthrough

Walkthrough

The PlatformPaymentAddressProvider::update_sync_state method now enforces monotonic incremental sync state by comparing existing watermarks against incoming values using max() comparisons, preserving the highest previously observed sync_height, sync_timestamp, and last_known_recent_block.

Changes

Monotonic Sync Watermark Updates

Layer / File(s) Summary
Monotonic watermark comparison in sync state update
packages/rs-platform-wallet/src/wallet/platform_addresses/provider.rs
update_sync_state uses max() to update sync_height, sync_timestamp, and last_known_recent_block instead of overwriting them, ensuring watermark values never decrease across sync updates.

🎯 2 (Simple) | ⏱️ ~8 minutes

🐰 A little hop in the sync code, where watermarks now stand tall,
No backward slides, monotonic peaks—just the maximum of them all!
Preservation is the name of the game, each update knows its place,
Incremental wisdom shines through, in this careful sync embrace. 🌊

🚥 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 'fix(platform-wallet): keep sync watermark monotonic' accurately and concisely describes the main change: preventing sync watermarks from moving backward by using monotonic comparisons.
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
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.

@lklimek lklimek deleted the branch dashpay:feat/platform-wallet-sync-watermark-getter May 21, 2026 16:02
@lklimek lklimek closed this May 21, 2026
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.

2 participants