Repository navigation
fix(platform-wallet): report a note beyond the rebuilt tree as retryable while a scan is pending - #6481
Draft
lklimek wants to merge 1 commit into
Draft
fix(platform-wallet): report a note beyond the rebuilt tree as retryable while a scan is pending#6481lklimek wants to merge 1 commit into
lklimek wants to merge 1 commit into
Conversation
…ble while a scan is pending <sub>🤖 Co-authored by [Claudius the Magnificent](https://github.com/lklimek/claudius) AI Agent</sub> Co-Authored-By: Codex <[email protected]>
Contributor
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
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. |
Collaborator
|
🕓 Review not started yet because this PR is a draft.
Commit 450646c. Normal review starts when eligible; priority review starts as soon as a slot is available. |
This branch has not been deployed
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.
TL;DR
After the wallet repairs its shielded note tree, paying from a note the repair has not reached yet now returns the usual "try again after sync" error instead of a permanent storage error.
User story
As a wallet user, when I spend shielded funds right after my wallet repaired its note tree, I get an error that tells my app to retry after sync, so the payment succeeds once the rescan catches up.
Scenario
Actual behavior
#5565 lets the wallet rebuild its shielded commitment tree while keeping the notes it already knows. Until the rescan reaches a note again, the rebuilt tree is shorter than that note's position. Spending that note then fails with a generic store error ("note position N is not in the commitment tree (size M)"), which hosts treat as non-retryable. A note below the current tree size gets the retryable
ShieldedMerkleWitnessUnavailable(FFI code 88), so results are inconsistent during the rescan.Expected behavior
While a scan that will reach the note's position is still pending for its subwallet, the spend gets
ShieldedMerkleWitnessUnavailable(code 88, retryable). A position that no pending scan will reach still returns the store error.Detailed discussion
Builds on #5565 (stacked; reported there as an outside-diff review item).
witness_at_depth(wallet/shielded/file_store.rs) returnsOk(None)instead ofErrfor a position at or past the tree size when the tree was reset and the owning restored subwallet has not completed a scan since. The existing spend path mapsOk(None)toShieldedMerkleWitnessUnavailable.store.rs) and the variant docs describe the rebuild case.Testing
should_retry_a_retained_note_beyond_the_rebuilt_tree_until_the_scan_completes: a note beyond the emptied tree is retryable before the scan and gets a valid witness after it; a stale tail note getsShieldedStoreErroronce the pool's confirmed end is reached; a missing position with no retained note keeps the store error.platform-walletclippy (all targets, all features) clean; store, scan and spend-selection tests green.Out of scope
None.
Known limitations
If syncs never complete, a note beyond the rebuilt tree stays retryable indefinitely (the same as any note waiting for its witness).
🤖 Co-authored by Claudius the Magnificent AI Agent
🤖 Generated with Claude Code