Skip to content

refactor(networking): drop dead code across gossipsub, ENR, transport, fixtures#736

Merged
tcoratger merged 2 commits into
leanEthereum:mainfrom
tcoratger:refactor/networking-cleanup
May 21, 2026
Merged

refactor(networking): drop dead code across gossipsub, ENR, transport, fixtures#736
tcoratger merged 2 commits into
leanEthereum:mainfrom
tcoratger:refactor/networking-cleanup

Conversation

@tcoratger
Copy link
Copy Markdown
Collaborator

Summary

Nine targeted cleanups identified by a recent audit of subspecs/networking/. Each item is either entirely unused in production or fully superseded by a different code path. Net: 28 files, 57 insertions, 980 deletions, 2 files deleted.

Items

Deletions

# What Why
1 SnappyDecompressor type + GossipsubMessage.snappy_decompress field + lazy snappy branch in compute_id Production always passes domain= explicitly; the lazy callable path was test-only
2 NOISE_IDENTITY_PREFIX + create_identity_proof + verify_identity_proof (entire signature.py) Noise handshake replaced by QUIC + libp2p-tls; zero production callers
3 PrunePeerInfo + ControlPrune.peers (PRUNE peer-exchange) Never produced or consumed
4 ENR IPv6 (ENR.ip6, udp6_port, quic6_port, IP6/UDP6/QUIC6 keys + IPv6 branches in parse_multiaddr and ENR.multiaddr) No production caller; IPv6 not on the roadmap
5 SyncCommitteeSubnets + SYNCNETS + ENR.sync_committee_subnets Lean Ethereum has no sync committees
6 negotiate_client (eager protocol negotiation) Production uses negotiate_lazy_client; this variant was test-only
7 TTFB_TIMEOUT Unused constant
8 GOSSIPSUB_PROTOCOL_ID_V11 Never advertised (default is v1.2); stale v1.1 docstring references updated to v1.2

Refactor

# What Why
9 Three call sites computing self._gossipsub_behavior._instance_id % 0xFFFF now read the existing _short_id field Dedup + fixes an off-by-one inconsistency: source used % 0x10000 (0..65535) while the duplicates used % 0xFFFF (0..65534)

Fixture sweep

For items 3, 4, 5: mirrors the discv5 PR #734 precedent. The corresponding sections in packages/testing/src/consensus_testing/test_fixtures/networking_codec.py (_build_prune_peer, IPv6 emission, sync_committee_subnets emission) are removed too, since the protocol features they exercise no longer exist.

Test plan

  • `ruff check` — clean
  • `ruff format --check` — clean
  • `ty check` (scoped to `subspecs/networking/` + `packages/testing/`) — clean
  • Full `pytest` suite on CI

🤖 Generated with Claude Code

tcoratger and others added 2 commits May 20, 2026 23:56
…, fixtures

Nine targeted cleanups identified by an audit of the networking
subspec. Each item is either entirely unused in production or fully
superseded by a different code path.

Deletions:
- TTFB_TIMEOUT — unused constant.
- GOSSIPSUB_PROTOCOL_ID_V11 — never advertised; default is v1.2.
  Stale v1.1 docstring references updated to v1.2.
- negotiate_client (eager protocol negotiation) — production uses
  negotiate_lazy_client; this variant was test-only.
- PrunePeerInfo + ControlPrune.peers (PRUNE peer-exchange) — never
  produced or consumed.
- ENR.ip6 / udp6_port / quic6_port plus IP6 / UDP6 / QUIC6 keys,
  the IPv6 branches in parse_multiaddr and ENR.multiaddr — no
  production caller; IPv6 not on the roadmap.
- SyncCommitteeSubnets + SYNCNETS + ENR.sync_committee_subnets —
  lean Ethereum has no sync committees.
- SnappyDecompressor type + GossipsubMessage.snappy_decompress field
  + the lazy snappy branch in compute_id — production always passes
  domain= explicitly.
- NOISE_IDENTITY_PREFIX + create_identity_proof + verify_identity_proof
  (entire signature.py module) — Noise handshake was replaced by
  QUIC + libp2p-tls; zero production callers.

Refactor:
- Three call sites computing self._gossipsub_behavior._instance_id %
  0xFFFF now read the existing _short_id field. Fixes an off-by-one
  inconsistency: the source used % 0x10000 (0..65535) while the
  duplicates used % 0xFFFF (0..65534).

Interop fixture sweep:
- Mirrors the discv5 PR leanEthereum#734 precedent: the corresponding sections
  in packages/testing/.../networking_codec.py (_build_prune_peer,
  IPv6 emission, sync_committee_subnets emission) are removed too,
  since the protocol features they exercise no longer exist.

Net: 28 files, 57 insertions, 980 deletions, 2 files deleted.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Trailing whitespace left over from the targeted deletions in
the previous commit. No behavior change.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@tcoratger tcoratger merged commit 0854dde into leanEthereum:main May 21, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant