feat: add BatchAVLProver::restore_root - #22
Closed
mwaddip wants to merge 1 commit into
Closed
Conversation
Add a public method that installs a persisted root and rebases the proof cycle atomically. Replaces the ad-hoc field assignments currently spread across four restore sites in the node. After restoring a storage-loaded root, callers must: - Clear is_new/visited flags on the fresh tree - Drop stale changed-node buffers from the previous cycle - Rebase old_top_node to the new root - Clear accumulated directions from any prior (failed) cycle restore_root() does all of this in one place, owning the proof-cycle invariant.
This was referenced Aug 12, 2026
Author
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.
Add
BatchAVLProver::restore_root(root, height)— a single method that installs a persisted root and rebases the proof cycle atomically.Replaces the ad-hoc field assignments currently spread across four restore sites in ergo-node-rust (startup resume, snapshot bootstrap,
reset_to,rollback_prover_to). Each site does a different incomplete subset ofold_top_nodesync, flag reset, and buffer clear —restore_rootowns the invariant in one place.Depends on PR #21 (
new_persistedconstructors — nodes fromunpack()needis_new = falsesotree.reset()can reach them) and PR #18 (needs_cycle_resetguard —restore_rootcallstree.reset()inline and must suppress the implicit reset in the nextperform_one_operation). The fullrestore_rootbody with theneeds_cycle_resetgate ships when all three land.