repro: transparent discovery persists addresses and loses scan targets when a later scope fails - #2729
Draft
dorianvp wants to merge 1 commit into
Draft
Conversation
… drops targets on error 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
pepper-sync/src/sync/transparent.rs,update_addresses_and_scan_targets(lines 26-185). Per scope, new addresses are derived and queried one gRPC call at a time (lines 125-159). The addresses discovered for a scope are written into the wallet inside the per-scope loop (lines 163-169), while the collectedscan_targetsare appended to the wallet only once after all scopes complete (lines 174-179). If a server error propagates from a?in a later scope (lines 67, 132, 141), the function returnsErrwith the earlier scope's addresses persisted and every collected scan target discarded. On the next sync those persisted addresses are only queried over the recent window (block_rangeat lines 49-57), so transactions found in the aborted pass below that window are never scanned.What the test does
pepper-sync/src/sync/transparent.rs,tests::error_in_later_scope_does_not_persist_addresses_without_their_scan_targets.The test builds a UFVK with a transparent key from a fixed seed, an in-memory
SyncWalletwith no known addresses, and a responder task standing in forclient::fetch::fetch. Withgap_limit: 2and the external and internal scopes enabled, the responder answers the first external address with a stream containing one transaction, the next two with empty streams, and the first internal address withtonic::Status::internal, which the client does not retry. The test asserts the call returnsErrand then asserts the invariant that either no addresses were persisted or the scan targets found for the persisted addresses were also persisted.Observed failing output
This PR is a reproduction only and does not include a fix. The sync-bench A/B rule was not run because the commit adds a test only.
🤖 Generated with Claude Code