Skip to content

fix: sync old_top_node after PersistentBatchAVLProver::rollback() - #19

Closed
mwaddip wants to merge 1 commit into
ergoplatform:mainfrom
mwaddip:fix/sync-old-top-node-after-rollback
Closed

fix: sync old_top_node after PersistentBatchAVLProver::rollback()#19
mwaddip wants to merge 1 commit into
ergoplatform:mainfrom
mwaddip:fix/sync-old-top-node-after-rollback

Conversation

@mwaddip

@mwaddip mwaddip commented Jul 28, 2026

Copy link
Copy Markdown

When rollback() restores a stored tree root, old_top_node was left pointing at the dummy-tree root from BatchAVLProver::new(). The first generate_proof() call after rollback would produce a wrong proof by walking the stale snapshot; subsequent calls self-corrected.

Triggered in ergo-node-rust when at-tip memory tuning fires synced() → recreates the validator → PersistentBatchAVLProver::new() → rollback(). The first block validated after reopen fails with an AD proofs digest mismatch.

When rollback() restores a stored tree root, old_top_node was left
pointing at the dummy-tree root from BatchAVLProver::new(). The first
generate_proof() call after rollback would produce a wrong proof by
walking the stale snapshot; subsequent calls self-corrected.

Triggered in ergo-node-rust when at-tip memory tuning fires
synced() → recreates the validator → PersistentBatchAVLProver::new()
→ rollback(). The first block validated after reopen fails with an
AD proofs digest mismatch.
@mwaddip

mwaddip commented Aug 12, 2026

Copy link
Copy Markdown
Author

Superseded by #27, which does not carry this commit. There, PersistentBatchAVLProver::rollback delegates to BatchAVLProver::restore_root, which performs the old_top_node rebase this PR added along with the rest of the rewind state. Same behaviour, one rewind implementation rather than two that have to agree by hand.

@mwaddip mwaddip closed this Aug 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant