Commit 11983a2
refactor(node/sync): tidy backfill, require store_view, fix range watermark (leanEthereum#1109)
Clarity, modern-Python, and one liveness fix in BackfillSync.
Documentation:
- Trim the banner-essay module and class docstrings and the verbose method
Args/Returns blocks to the project rules, keeping the genuine rationale
(depth cap bounds an attacker-claimed ancient parent; head-not-finalized
gap floor; authoritative-only watermark) glued to its code.
Structure:
- Make store_view required and drop its dead None mode; no production caller
passed None, and the degraded branch only served tests.
- Inline the two single-use fetch helpers into their batch loops, turning
their per-batch return into continue so the loop still advances.
- Batch both fetch loops with itertools.batched instead of manual index and
slot-offset arithmetic.
Watermark liveness fix:
- Advance the range watermark only on an authoritative answer (the peer
claimed the range, or returned blocks). An empty reply from a fallback
peer no longer strands a range that another peer can still serve.
- Make the watermark Slot | None so genesis slot 0 is fetchable; the old
Slot(0) sentinel could not tell "covered" from "nothing covered".
- Cover the fix with a regression test; make the test peer authoritative.
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent d4c94c7 commit 11983a2
2 files changed
Lines changed: 147 additions & 306 deletions
0 commit comments