Skip to content

Tags: leanEthereum/leanSpec

Tags

latest

Toggle latest's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
refactor(chain): tidy ChainService and rework its test suite (#825)

Service:
- Reuse the clock's own pre-genesis wait instead of recomputing it by hand.
- Drop the redundant no-op store reassignment in the skip-ahead path, and
  the needless int() cast around INTERVALS_PER_SLOT.
- Add a forward-only precondition (target >= store.time) and a note that
  attestation acceptance for jumped slots defers safely to the final tick.
- Rewrite docstrings and comments to the repo documentation rules.

Tests:
- Replace the mock-heavy suite (MockStore/MockCheckpoint/StoreInterceptingSpec)
  with a real Store plus a thin recording spec; the clock-timing tests that
  belonged to SlotClock are dropped (already covered in test_clock.py).
- Test the catch-up helpers directly where they return, and drive the run loop
  only where the loop itself is under test.
- Cover the full scenario spread with parametrized cases: no-op, within-slot,
  slot boundary, just-over, deep skip; plus the backward-target precondition
  and a store swapped in during the yield (the post-yield re-read).
- 22 tests, 100% line and branch coverage of service.py.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>