repro: a failed spending-transaction fetch loses the detected spend - #2722
Draft
dorianvp wants to merge 1 commit into
Draft
repro: a failed spending-transaction fetch loses the detected spend#2722dorianvp wants to merge 1 commit into
dorianvp wants to merge 1 commit into
Conversation
… leaves the note unspent Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Claim
update_shielded_spendsinpepper-sync/src/sync/spend.rs(lines 42 to 135) consumes the matching nullifier from the wallet's liveNullifierMapinsidedetect_shielded_spends(remove_entry, lines 256 to 267, called at lines 65 to 72) beforescan_spending_transactions(line 112, body at lines 146 to 215) awaits the network (client::get_compact_blockat line 189 andscan_transactionsat line 201). When that fetch returnsErr, the function returns at line 123 beforeupdate_spent_notes(line 126) runs. The nullifier is gone from the map and the note is never marked spent, so the wallet reports a spent note as spendable and a later sync cannot re-detect it from the map.What the test does
sync::test::spend_reset_lifecycle::failed_spending_transaction_fetch_must_not_lose_the_detected_spendinpepper-sync/src/sync.rsbuilds aMockWalletwith one confirmed funding transaction holding a sapling note with a known nullifier, and a nullifier map entry mapping that nullifier to aScanTargetfor a spending txid that is not in the wallet. It drops theFetchRequestreceiver so every fetch fails withFetcherDropped, callsupdate_shielded_spendswith an emptyscanned_blocksmap, asserts the call returnsErr, and then asserts that the spend is still recoverable: either the note carries the spending txid or the nullifier is still mapped.Observed failing output
This PR is a reproduction and not a fix. The sync-bench A/B rule was not run because the commit adds a test only.
🤖 Generated with Claude Code