Skip to content

Commit de3c913

Browse files
tcoratgerlatifkasuliclaude
authored
test: remove banner-separator comments (leanEthereum#812)
* Add attestation proof order fixture * test: remove banner-separator comments The code style bans banner-style separator comments, since they add visual clutter and blank lines already mark logical sections. Drop the 63 pure dash and equals divider lines across the QUIC, service, and fork-choice test files, keeping the section heading text as plain single-line comments. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Adam Mohammed A Latif <latifkasuli@gmail.com> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 250092d commit de3c913

5 files changed

Lines changed: 0 additions & 63 deletions

File tree

tests/consensus/lstar/fc/test_block_production.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ def test_block_builder_fixed_point_advances_justification(
6363
fork_choice_test(
6464
steps=[
6565
# Chain setup
66-
# ===========
6766
#
6867
# genesis(0) -> block_1(1) -> block_2(2) -> block_3(3) -> block_4(4) -> block_5(5)
6968
#
@@ -119,7 +118,6 @@ def test_block_builder_fixed_point_advances_justification(
119118
),
120119
),
121120
# Attestation delivery
122-
# ====================
123121
#
124122
# Why gossip instead of in-block attestations?
125123
# In-block specs derive the source from the parent state's
@@ -201,7 +199,6 @@ def test_block_builder_fixed_point_advances_justification(
201199
),
202200
),
203201
# Fixed-point block production
204-
# ============================
205202
#
206203
# No explicit attestations -- the builder reads from the
207204
# "known" pool and iterates:

tests/consensus/lstar/fc/test_fork_choice_head.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,6 @@ def test_head_selection_by_weight_not_depth(
571571
checks=StoreChecks(head_slot=Slot(1)),
572572
),
573573
# Fork A: 5 blocks deep, minimal attestation weight
574-
# ===================================================
575574
#
576575
# common(1) -> a_2 -> a_3 -> a_4 -> a_5 -> a_6
577576
#
@@ -602,7 +601,6 @@ def test_head_selection_by_weight_not_depth(
602601
checks=StoreChecks(head_slot=Slot(6), head_root_label="a_6"),
603602
),
604603
# Fork B: 2 blocks deep, heavy attestation weight
605-
# =================================================
606604
#
607605
# common(1) -> b_9 -> b_12
608606
#
@@ -694,7 +692,6 @@ def test_fork_from_before_finalization_not_considered(
694692
anchor_state=generate_pre_state(num_validators=8),
695693
steps=[
696694
# Canonical justification / finalization chain
697-
# =============================================
698695
#
699696
# genesis -> 1 -> 2 -> 3 -> 4 -> 5
700697
#
@@ -796,7 +793,6 @@ def test_fork_from_before_finalization_not_considered(
796793
),
797794
),
798795
# Dead fork with majority weight
799-
# ================================
800796
#
801797
# block_2(2) -> dead_6(6) -> dead_7(7)
802798
#

tests/lean_spec/node/networking/service/test_service.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,7 @@
3535

3636
FORK_DIGEST = "0x12345678"
3737

38-
# ---------------------------------------------------------------------------
3938
# Helpers
40-
# ---------------------------------------------------------------------------
4139

4240

4341
def _make_network_service(
@@ -74,9 +72,7 @@ async def __anext__(self) -> NetworkEvent:
7472
return event
7573

7674

77-
# ---------------------------------------------------------------------------
7875
# run() lifecycle
79-
# ---------------------------------------------------------------------------
8076

8177

8278
class TestRunLifecycle:
@@ -155,9 +151,7 @@ async def test_stop_async_iteration_exception_caught(self, peer_id: PeerId) -> N
155151
assert not svc.is_running
156152

157153

158-
# ---------------------------------------------------------------------------
159154
# Event dispatch — aggregated attestation
160-
# ---------------------------------------------------------------------------
161155

162156

163157
class TestAggregatedAttestationDispatch:
@@ -188,9 +182,7 @@ async def test_gossip_aggregated_attestation_routed(self, peer_id: PeerId) -> No
188182
mock_handler.assert_awaited_once_with(signed_aggregate, peer_id)
189183

190184

191-
# ---------------------------------------------------------------------------
192185
# Event dispatch — secondary events
193-
# ---------------------------------------------------------------------------
194186

195187

196188
class TestSecondaryEventDispatch:
@@ -304,9 +296,7 @@ async def test_peer_disconnected_removes_from_manager(
304296
assert peer_id_2 not in sync_service.peer_manager
305297

306298

307-
# ---------------------------------------------------------------------------
308299
# Publish methods
309-
# ---------------------------------------------------------------------------
310300

311301

312302
class TestPublishBlock:
@@ -412,9 +402,7 @@ async def test_publish_aggregated_attestation_happy_path(self, peer_id: PeerId)
412402
assert data == compress(signed_aggregate.encode_bytes())
413403

414404

415-
# ---------------------------------------------------------------------------
416405
# Edge cases for _handle_event match exhaustiveness
417-
# ---------------------------------------------------------------------------
418406

419407

420408
class TestHandleEventEdgeCases:
@@ -450,9 +438,7 @@ async def test_multiple_peer_events_sequence(
450438
assert peer_id_2 not in sync_service.peer_manager
451439

452440

453-
# ---------------------------------------------------------------------------
454441
# Constructor / init field defaults
455-
# ---------------------------------------------------------------------------
456442

457443

458444
class TestNetworkServiceInit:

tests/lean_spec/node/networking/transport/quic/test_connection.py

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,7 @@
3333
)
3434
from lean_spec.node.networking.types import ProtocolId
3535

36-
# ---------------------------------------------------------------------------
3736
# Shared fixtures
38-
# ---------------------------------------------------------------------------
3937

4038

4139
@pytest.fixture
@@ -70,10 +68,8 @@ def quic_connection(mock_protocol: MagicMock, peer_a: PeerId) -> QuicConnection:
7068
)
7169

7270

73-
# ---------------------------------------------------------------------------
7471
# Multiaddr detection — per the multiaddr spec, protocol names are
7572
# case-sensitive and always lowercase.
76-
# ---------------------------------------------------------------------------
7773

7874

7975
class TestIsQuicMultiaddr:
@@ -113,9 +109,7 @@ def test_detection(self, multiaddr: str, expected: bool) -> None:
113109
assert is_quic_multiaddr(multiaddr) == expected
114110

115111

116-
# ---------------------------------------------------------------------------
117112
# Multiaddr parsing
118-
# ---------------------------------------------------------------------------
119113

120114

121115
class TestParseMultiaddr:
@@ -172,13 +166,11 @@ def test_no_quic_tag_returns_none_transport(self) -> None:
172166
assert (host, port, transport) == ("10.0.0.1", 3000, None)
173167

174168

175-
# ---------------------------------------------------------------------------
176169
# ALPN protocol — per the libp2p TLS spec
177170
#
178171
# https://github.com/libp2p/specs/blob/master/tls/tls.md
179172
# "Endpoints MUST NOT send (and MUST NOT accept) any ALPN extension that
180173
# does not include "libp2p" as the ALPN protocol string."
181-
# ---------------------------------------------------------------------------
182174

183175

184176
class TestAlpnProtocol:
@@ -193,13 +185,11 @@ def test_alpn_is_libp2p(self) -> None:
193185
assert LIBP2P_ALPN_PROTOCOL == "libp2p"
194186

195187

196-
# ---------------------------------------------------------------------------
197188
# QuicStream — read behavior per RFC 9000 Section 3
198189
#
199190
# - Data arrives in order per-stream.
200191
# - FIN (end_stream=True) signals graceful half-close — all data delivered.
201192
# - RESET_STREAM signals abrupt termination — data may be lost.
202-
# ---------------------------------------------------------------------------
203193

204194

205195
class TestQuicStreamRead:
@@ -237,12 +227,10 @@ async def test_read_after_close_returns_empty(self, quic_stream: QuicStream) ->
237227
assert await quic_stream.read() == b""
238228

239229

240-
# ---------------------------------------------------------------------------
241230
# QuicStream — RESET_STREAM handling per RFC 9000 Section 3.2
242231
#
243232
# RESET_STREAM is an error/abort, NOT a clean end-of-stream.
244233
# Data may have been lost. The application must be notified.
245-
# ---------------------------------------------------------------------------
246234

247235

248236
class TestQuicStreamReset:
@@ -280,11 +268,9 @@ def test_reset_error_is_subclass_of_transport_error(self) -> None:
280268
assert issubclass(QuicStreamResetError, QuicTransportError)
281269

282270

283-
# ---------------------------------------------------------------------------
284271
# QuicStream — write behavior per RFC 9000 Section 3
285272
#
286273
# After FIN is sent (or stream is closed), further writes must fail.
287-
# ---------------------------------------------------------------------------
288274

289275

290276
class TestQuicStreamWrite:
@@ -305,11 +291,9 @@ async def test_write_after_fin_raises(self, quic_stream: QuicStream) -> None:
305291
await quic_stream.write(b"data")
306292

307293

308-
# ---------------------------------------------------------------------------
309294
# QuicStream — half-close (FIN) per RFC 9000 Section 3
310295
#
311296
# Sending FIN closes the write side. Read side stays open.
312-
# ---------------------------------------------------------------------------
313297

314298

315299
class TestQuicStreamFinishWrite:
@@ -335,9 +319,7 @@ async def test_finish_write_is_idempotent(
335319
mock_protocol._quic.send_stream_data.assert_called_once()
336320

337321

338-
# ---------------------------------------------------------------------------
339322
# QuicStream — full close (both directions)
340-
# ---------------------------------------------------------------------------
341323

342324

343325
class TestQuicStreamClose:
@@ -363,13 +345,11 @@ async def test_close_is_idempotent(
363345
mock_protocol._quic.send_stream_data.assert_called_once()
364346

365347

366-
# ---------------------------------------------------------------------------
367348
# QuicConnection — event handling per RFC 9000
368349
#
369350
# - StreamDataReceived: data from peer, may create new remote-initiated stream
370351
# - StreamReset: abrupt stream termination by peer
371352
# - ConnectionTerminated: all streams implicitly closed (RFC 9000 Section 10)
372-
# ---------------------------------------------------------------------------
373353

374354

375355
class TestQuicConnectionHandleEvent:
@@ -469,9 +449,7 @@ def test_connection_terminated_resets_all_streams(
469449
assert s2._reset_error.error_code == 0
470450

471451

472-
# ---------------------------------------------------------------------------
473452
# QuicConnection — open/accept/close
474-
# ---------------------------------------------------------------------------
475453

476454

477455
class TestQuicConnectionOpenStream:
@@ -532,12 +510,10 @@ async def test_close_is_idempotent(
532510
mock_protocol._quic.close.assert_called_once()
533511

534512

535-
# ---------------------------------------------------------------------------
536513
# LibP2PQuicProtocol — handshake, event routing, buffering
537514
#
538515
# Per libp2p-QUIC spec, ALPN protocol is "libp2p".
539516
# Events between handshake completion and connection assignment must be buffered.
540-
# ---------------------------------------------------------------------------
541517

542518

543519
class TestLibP2PQuicProtocol:

tests/lean_spec/node/networking/transport/quic/test_tls.py

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,7 @@
3030
generate_libp2p_certificate,
3131
)
3232

33-
# ---------------------------------------------------------------------------
3433
# Shared fixtures
35-
# ---------------------------------------------------------------------------
3634

3735

3836
@pytest.fixture
@@ -41,9 +39,7 @@ def identity_key() -> IdentityKeypair:
4139
return IdentityKeypair.generate()
4240

4341

44-
# ---------------------------------------------------------------------------
4542
# Constants — sanity checks for protocol-defined values
46-
# ---------------------------------------------------------------------------
4743

4844

4945
class TestConstants:
@@ -62,14 +58,12 @@ def test_key_type_secp256k1(self) -> None:
6258
assert KeyType.SECP256K1 == 2
6359

6460

65-
# ---------------------------------------------------------------------------
6661
# ASN.1 length encoding — must cover all 3 branches
6762
#
6863
# DER length encoding:
6964
# - Short form: length < 128 → single byte
7065
# - Long 1-byte: 128 ≤ length < 256 → 0x81 + 1 byte
7166
# - Long 2-byte: length ≥ 256 → 0x82 + 2 bytes (big-endian)
72-
# ---------------------------------------------------------------------------
7367

7468

7569
class TestEncodeAsn1Length:
@@ -115,9 +109,7 @@ def test_two_byte_long_form(self, length: int, expected: bytes) -> None:
115109
assert _encode_asn1_length(length) == expected
116110

117111

118-
# ---------------------------------------------------------------------------
119112
# ASN.1 OCTET STRING encoding
120-
# ---------------------------------------------------------------------------
121113

122114

123115
class TestEncodeAsn1OctetString:
@@ -142,9 +134,7 @@ def test_long_form_length(self) -> None:
142134
assert result[4:] == data
143135

144136

145-
# ---------------------------------------------------------------------------
146137
# ASN.1 SEQUENCE encoding
147-
# ---------------------------------------------------------------------------
148138

149139

150140
class TestEncodeAsn1Sequence:
@@ -162,9 +152,7 @@ def test_empty_sequence(self) -> None:
162152
assert result == bytes([0x30, 0])
163153

164154

165-
# ---------------------------------------------------------------------------
166155
# ASN.1 SignedKey — SEQUENCE { OCTET STRING, OCTET STRING }
167-
# ---------------------------------------------------------------------------
168156

169157

170158
class TestEncodeAsn1SignedKey:
@@ -191,9 +179,7 @@ def test_structure_is_sequence_of_two_octet_strings(self) -> None:
191179
assert rest2 == b""
192180

193181

194-
# ---------------------------------------------------------------------------
195182
# Extension payload — protobuf + ASN.1 wrapping
196-
# ---------------------------------------------------------------------------
197183

198184

199185
class TestCreateExtensionPayload:
@@ -254,9 +240,7 @@ def test_signature_verifies(self, identity_key: IdentityKeypair) -> None:
254240
assert identity_key.public_key.verify(expected_message, signature)
255241

256242

257-
# ---------------------------------------------------------------------------
258243
# Full certificate generation
259-
# ---------------------------------------------------------------------------
260244

261245

262246
class TestGenerateLibp2pCertificate:
@@ -367,11 +351,9 @@ def test_returned_certificate_matches_pem(self, identity_key: IdentityKeypair) -
367351
assert reparsed == certificate
368352

369353

370-
# ---------------------------------------------------------------------------
371354
# DER parsing helpers (test-only)
372355
#
373356
# Minimal DER TLV parser for verifying hand-encoded ASN.1 output.
374-
# ---------------------------------------------------------------------------
375357

376358

377359
def _parse_der_length(data: bytes, offset: int) -> tuple[int, int]:

0 commit comments

Comments
 (0)