repro: a hash discontinuity inside a non-verify load aborts the sync session - #2728
Draft
dorianvp wants to merge 1 commit into
Draft
repro: a hash discontinuity inside a non-verify load aborts the sync session#2728dorianvp wants to merge 1 commit into
dorianvp wants to merge 1 commit into
Conversation
…ts sync 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 (
mid-load-reorg-aborts-sync)process_scan_resultsinpepper-sync/src/sync.rs:1536-1585treats aScanError::ContinuityError(HashDiscontinuity { height, .. })as a re-org only whenheightequals the start of the load's range and the load's priority isVerify. Every other hash discontinuity falls through toscan_results?atpepper-sync/src/sync.rs:1584, which returns the error fromprocess_scan_resultsand therefore from thesyncloop atpepper-sync/src/sync.rs:520-531, so the sync session aborts instead of marking the affected blocksVerifyand re-scanning.Secondary: on the re-org path,
state::set_scan_priorityis called with the load's block range (pepper-sync/src/sync.rs:1550-1554). That function panics when no wallet scan range has exactly that block range (pepper-sync/src/sync/state.rs:436-447). The loader splits a load by output budget (pepper-sync/src/scan/task.rs:504-531), andScanTask::splittruncates the load'sscan_range(pepper-sync/src/scan/task.rs:822-838), so aVerifyload can arrive as a sub-range of the wallet's scan range and the panic is reachable.What the tests do
Both tests live in
pepper-sync/src/sync.rsundermod test::load_continuity_failureand callprocess_scan_resultsdirectly on aMockWallet.discontinuity_inside_chain_tip_load_is_treated_as_reorg: the wallet holds90..100 Scannedand100..200 Scanning. The load100..200 ChainTipreportsHashDiscontinuity { height: 150 }. The test assertsOk(())and aVerifyrange covering the discontinuity.reorg_in_split_verify_load_does_not_panic: the wallet holds100..110 Scanning(the verify range selected by the loader). The load100..105 VerifyreportsHashDiscontinuity { height: 100 }. The test asserts the call does not panic and leaves aVerifyrange.The commit also adds
Sendto the two closure type aliases in the test-onlypepper-sync/src/mocks.rsso thatMockWalletsatisfies theW: Sendbound ofprocess_scan_results.Observed output on
devNotes
This PR is a reproduction and not a fix. Both tests are expected to fail on
dev.The abort in the first case is recoverable on the next sync session, because
update_scan_rangesplaces a freshVerifyrange above the highest scanned height. The session itself still ends with an error.The sync-bench A/B rule was not run because the commit adds tests only.
🤖 Generated with Claude Code