Skip to content

fix(rotortree): rewrite an open upper-level node on every checkpoint - #62

Merged
rymnc merged 3 commits into
ethsystems:mainfrom
dkgoutham:fix/rotortree-checkpoint-stale-upper-chunk
Nov 17, 2026
Merged

rymnc merged 3 commits into
ethsystems:mainfrom
dkgoutham:fix/rotortree-checkpoint-stale-upper-chunk

Conversation

@dkgoutham

Copy link
Copy Markdown
Contributor

fixes #60

A checkpoint counted every full 128-node chunk as final. Above level 0, a level's last node stays open until its N^L-leaf subtree fills. So a checkpoint could write that node once, and the next checkpoint mapped the stale copy back. Reopen made the same count.

  • Recovery now maps only final chunks (leaf_count / N^L nodes per level) and copies the rest into memory, as the runtime remap does. It used to map chunks that a later checkpoint rewrites in place, and on Linux a snapshot taken after reopen then changed. main already does this for partial upper-level chunks.
  • Checkpoint and reopen now count final chunks with the same helper. A chunk holding an open node is rewritten until it is final, as the level-0 tail already is.

Three regression tests in storage_integration.rs (N = 2, 3) compare every node with LeanIMT. Each fails on main; the snapshot one fails only on Linux.

Stores written before this fix can already hold a stale chunk, and this doesn't repair them.

@dkgoutham
dkgoutham marked this pull request as ready for review November 11, 2026 09:46
@rymnc
rymnc enabled auto-merge (squash) November 17, 2026 08:19
@rymnc
rymnc merged commit 90bfd8c into ethsystems:main Nov 17, 2026
14 checks passed
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.

rotortree: checkpoint saves an unfinished upper-level node and never rewrites it

2 participants