repro: pool truncation deletes history before the frontier fetch can fail - #2724
Draft
dorianvp wants to merge 1 commit into
Draft
repro: pool truncation deletes history before the frontier fetch can fail#2724dorianvp wants to merge 1 commit into
dorianvp wants to merge 1 commit into
Conversation
…ails 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
truncate_to_pool_activation_heightinpepper-sync/src/sync.rs(lines 1626 to 1717) rewinds the wallet stores before it fetches the frontiers it needs to rebuild the shard trees. The store truncation atpepper-sync/src/sync.rs:1658(truncate_stores(wallet, rescan_from - 1, false)?) deletes blocks, transactions, nullifiers and outpoints at or aboverescan_from. The frontier fetch atpepper-sync/src/sync.rs:1660(client::get_frontiers(fetch_request_sender, birthday).await?) comes after it. When the fetch fails, the function returnsErrbeforestate::reopen_scan_ranges_from(line 1703),add_scan_targets(line 1704) andset_save_flag(line 1706) run. The wallet is left with history deleted at or aboverescan_fromwhile the scan ranges covering those heights still readScanned, so the deleted history is not rescanned.What the test does
sync::test::pool_truncation_atomicity::frontier_fetch_failure_leaves_stores_and_scan_ranges_consistentbuilds aMockWalleton aLocalNetworkwith Nu5 at height 20, a birthday of 10, wallet blocks at 15 and 25 and a singleScannedrange 10..31. It drops the fetch request receiver soclient::get_frontiersfails withServerError::FetcherDropped, callstruncate_to_pool_activation_heightforShieldedPool::Orchard, and asserts the intended invariant: the block at 25 is either still present or the range covering it is no longer markedScanned.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