Commit d3118f5
test: add 100% coverage for QUIC connection + fix RFC 9000 Section 10 bug (leanEthereum#529)
* refactor: simplify testing framework with proper OOP design
Move building logic from fixture classes to spec types where it belongs.
Each spec type now owns the methods that operate on its own fields:
- BlockSpec: resolve_proposer_index, resolve_parent_root, build_attestations,
build_signed_block, build_signed_block_with_store
- AggregatedAttestationSpec: build_attestation_data, build_invalid_proof
- GossipAttestationSpec: build_attestation_data, build_signed
- GossipAggregatedAttestationSpec: build_attestation_data, build_signed
Fixture files are now pure orchestration (~357 lines for fork_choice,
~144 for verify_signatures). Also:
- Fix double fixture registration bug in BaseFixture
- Fix assert tuple bug in genesis.py
- Move expect_exception field + serializer to BaseConsensusFixture
- Rewrite StoreChecks.validate_against_store with explicit checks
- Remove dispatch tables and unused arguments
- Convert all non-self methods to @staticmethod
- Modernize typing imports (dict, list, type, set)
- Delete dead code (_children, supports_fork, transitions_to)
- Add XmssKeyManager.sign_and_aggregate for common pattern
- Create test_types/utils.py for shared resolve_checkpoint
- Update doc-writer agent rules for better documentation quality
- Show full hex in error messages instead of truncated
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* test: add 100% coverage for QUIC connection module + fix RFC 9000 bug
Closes leanEthereum#516.
Adds 38 new tests (76 total) achieving 100% isolated coverage for
quic/connection.py (274 statements, 74 branches, 0 missing).
Fixes a spec violation: ConnectionTerminated was signaling FIN (clean
end-of-stream) on all open streams. Per RFC 9000 Section 10, connection
termination implicitly resets all streams — data may have been lost.
Changed to _receive_reset() so pending reads raise an error instead of
returning empty bytes that falsely imply successful delivery.
Also clarifies the doc-writer agent rule that line-by-line documentation
applies identically to test code.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent fb50720 commit d3118f5
3 files changed
Lines changed: 658 additions & 10 deletions
File tree
- .claude/agents
- src/lean_spec/subspecs/networking/transport/quic
- tests/lean_spec/subspecs/networking/transport/quic
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
53 | | - | |
| 53 | + | |
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
| |||
Lines changed: 8 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
342 | 342 | | |
343 | 343 | | |
344 | 344 | | |
345 | | - | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
346 | 352 | | |
347 | | - | |
| 353 | + | |
348 | 354 | | |
349 | 355 | | |
350 | 356 | | |
| |||
0 commit comments