Commit 47c9c25
committed
feat(l1): add overlay + read cascade for deep reorgs
Builds on the journal added in #6686. Introduces:
- Overlay struct: in-memory aggregated reverse-diff bridging on-disk state
at the cache edge D to the virtual state at a deep-reorg pivot T-1.
Built by walking STATE_HISTORY[D..=T] descending, with older-entry-wins
semantics so the post-walk value at every key is the pre-image at T-1.
- OverlayCf enum + classify_by_key_length, reusing PR 1's classify_trie_key.
- TrieLayerCache: optional overlay field plus set/clear/lookup accessors.
- TrieWrapper::get cascade now reads: layer cache -> overlay -> disk.
No orchestration wired yet; PR 3 will install/clear overlays via
apply_fork_choice_with_deep_reorg. 14 unit tests covering descending-range
load, older-wins, bloom miss, hash mismatch, missing entry, swapped-args
rejection, CF classification, cascade short-circuit, and edge cases.1 parent 5f49d31 commit 47c9c25
1 file changed
Lines changed: 679 additions & 0 deletions
0 commit comments