fix(rs-platform-wallet): reserve platform receive address on hand-out (Found-026) [backport]#3658
Draft
lklimek wants to merge 1 commit into
Draft
fix(rs-platform-wallet): reserve platform receive address on hand-out (Found-026) [backport]#3658lklimek wants to merge 1 commit into
lklimek wants to merge 1 commit into
Conversation
… (Found-026) [backport] Semantic backport of the #3549-proven Found-026 reserve-on-hand-out fix. Region diverged on v3.1-dev so re-applied by hand, not cherry-picked. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Semantic backport to
v3.1-devof the Found-026 reserve-on-hand-out fix already proven on #3549 (3/3 focused 14-thread + R2-clean + adjudicated).Problem
key-wallet
AddressPool::next_unusedreturns the firstused==falseindex WITHOUT marking it;usedonly flips on a positive synced balance. Two concurrent callers ofPlatformAddressWallet::next_unused_receive_addresstherefore receive the SAME address before the sync pass — duplicate-address race.Fix
Reserve the handed-out index under the already-held
wallet_manager.write()guard: swapnext_unused(...)fornext_unused_with_info(...), then callmark_index_used(info.index)before releasing the guard.mark_index_usedis idempotent, so a later real sync hit on the index is a no-op (no gap-limit /highest_useddouble-counting).Why hand-applied (not cherry-picked)
The
next_unused_receive_addressregion diverged on v3.1-dev (different rust-dashcore pin, no Found-026 doc block, direct-Addressreturn) so a textual cherry-pick of the #3549 commit does NOT apply. Same SEMANTIC transform re-applied by hand to v3.1-dev's own structure; verified the v3.1-dev key-wallet pin (53130869e5b...) exposes byte-identicalAddressPool(next_unused_with_info,mark_index_used,AddressInfo) to the proven pin (5297d61...).Validation
cargo check(lib + --tests),cargo clippy --lib -D warnings,cargo test --lib(121 passed, 0 failed),rustfmt— all clean. Behavioural correctness proven on #3549; v3.1-dev has no e2e harness / found_026 guards (those are #3549-only) so this PR confirms compile + no lib-test regression.Backport sibling of #3549 / Found-026.
🤖 Generated with Claude Code