repro: ironwood tree-size truncation clears sapling and orchard trees - #2723
Draft
dorianvp wants to merge 1 commit into
Draft
repro: ironwood tree-size truncation clears sapling and orchard trees#2723dorianvp wants to merge 1 commit into
dorianvp wants to merge 1 commit into
Conversation
…rd trees 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 1712) selects the shard trees to clear withif target_pool >= pool(line 1674).ShieldedPoolderivesOrdas Sapling < Orchard < Ironwood, so an Ironwood target clears the Sapling, Orchard and Ironwood trees. The doc comment on the function (lines 1620 to 1625) says that the target pool and any later pool are cleared and that earlier pools only roll back to the next checkpoint above the rescan height.The cleared trees are reseeded with the frontier at the wallet birthday (lines 1662 to 1685). Scan ranges are reopened from
rescan_from = max(activation, birthday)bystate::reopen_scan_ranges_from(line 1704). When the birthday is below the NU6.3 activation, the sapling and orchard leaves in[birthday, rescan_from)are removed from the trees and their scan ranges remainScanned, so they are never rebuilt. This is a witness loss for notes received in that window.What the test does
sync::test::pool_activation_truncation::ironwood_truncation_keeps_sapling_and_orchard_leaves_below_activationbuilds aMockWalleton aLocalNetworkwith NU6.3 activation at height 100 and a birthday of 10. The sapling and orchard shard trees hold one leaf per height from 10 to 20 with checkpoints. The scan ranges10..50and50..150areScanned. A fake fetcher answers theFetchRequest::TreeStaterequest with an empty tree state at the requested height. The test callstruncate_to_pool_activation_heightwithtarget_pool = ShieldedPool::Ironwoodand asserts the documented behaviour: the scan ranges belowrescan_fromstayScannedand the sapling and orchard trees keep their leaves.Observed failing output on
devThe scan range assertion passes, which confirms that the ranges below the rescan height are still
Scannedwhile the sapling tree no longer has any leaves.This PR is a reproduction and is not a fix. The sync-bench A/B rule was not run because the commit adds a test only.
🤖 Generated with Claude Code