Repository navigation
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Expected Behavior
Background shielded note sync should not crowd out the wallet's own requests. When the wallet is caught up, it should fetch the chunks that can contain notes and nothing more.
Current Behavior
- 16 chunk queries in flight per sync cycle.
platform-walletraises the SDK'sDEFAULT_MAX_CONCURRENT = 4(types.rs#L9) tomax_concurrent: 16(sync.rs#L274-L281). On testnet these queries took 2–37 s each against the 10 s default request timeout (request_settings.rs#L9). Queries that time out get their nodes banned, and a user transition sent during the burst shares the same nodes. In one ~25 min session the gRPC log shows 240Timeout expired, in bursts that line up with the sync cycles. One of those bursts caused the broadcast failure in the linked issue. - Most of those queries are past the end of the tree. The stream seeds the whole window up front (sync_shielded_notes.rs#L238-L260) without using the tree size it already knows. In the reproduction the tree had
total_count=4574, yet one cycle queried 16 chunks of 8192 starting at 4096 … 126976. Only the first returned notes (478); the other 15 returnednotes_returned=0after up to 37 s each, and every cycle repeats them.
Log shape (one cycle, reproduction values):
fetching shielded notes chunk chunk_start=4096 chunk_size=8192
fetching shielded notes chunk chunk_start=12288 chunk_size=8192
… 14 more, up to chunk_start=126976
shielded notes chunk fetched chunk_start=4096 notes_returned=478 total_count=4574 elapsed_ms=Some(11319)
shielded notes chunk fetched chunk_start=86016 notes_returned=0 total_count=4574 elapsed_ms=Some(37528)
Possible Solution
- Bound the window by the tree size. Once
total_countis known (from the first response, or from the previous cycle), stop queueing chunks whose start is>= total_count. In steady state that is one query per cycle instead of 16. - Revisit the 16. It was chosen for the initial download across ~13 nodes. For incremental cycles the SDK default of 4 (or fewer) is enough. Alternatively, make it depend on the remaining distance to
total_count. - Optional. Give user-initiated broadcasts priority, or a separate connection/budget, so a background sync cannot delay them past the request timeout.
Steps to Reproduce (for bugs)
- Run a wallet with shielded sync enabled on testnet (iOS app or SwiftExampleApp) until it is caught up.
- Watch
dash_sdk/run.logandgrpc/run.log: each sync cycle logs 16fetching shielded notes chunklines with starts far abovetotal_count, followed byTimeout expired/ban addressbursts. - Send any state transition during a burst and it may time out (see the linked issue).
Context
Surfaced by dashpay/dashwallet-ios#1156 testing on testnet. This load is what pushed an IdentityCreate broadcast past its timeout; the resulting AlreadyExists failure is tracked in the linked issue. It also costs mobile data and battery on every cycle.
Your Environment
- Version used:
v4.3-dev@b1a4f35f9b - Environment name and version: SwiftDashSDK (
rs-platform-walletshielded sync), iOS 26.5 simulator - Operating System and version: macOS 27 host, testnet
- Link to your project: dashpay/dashwallet-ios
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working
Activity
romchornyi commentedon Sep 25, 2026
Related: #4998 — the
AlreadyExistsfailure one of these bursts caused.