chore: sweep dead helpers across subspecs#683
Merged
tcoratger merged 1 commit intoleanEthereum:mainfrom Apr 26, 2026
Merged
Conversation
Remove top-level functions, methods, and constants that have no production callers. All deletions verified by grep across src/ and tests/. Tests that exclusively exercised the removed code are dropped; tests that incidentally used a removed helper are rewritten against the surviving public API. Removed surface: - ENR: has, is_compatible_with - Eth2Data: no_scheduled_fork - Multihash: identity, sha256 (logic inlined into from_data) - PeerId: from_secp256k1 (callers go through IdentityKeypair.to_peer_id) - Secp256k1PublicKey: from_bytes - IdentityKeypair: from_bytes, private_key_bytes - MessageCache, SeenCache: clear, __len__ - RPC: is_empty (ControlMessage.is_empty stays — used by RPC.encode) - GossipsubBehavior: set_message_handler, _message_handler field - Fp.two_adic_generator, TWO_ADIC_GENERATORS, TWO_ADICITY - SyncService: process_pending_blocks, start_sync, _sync_lock - HeadSync: process_all_processable - PeerManager: clear - BlockCache: get_orphan_parents - ValidatorRegistry: from_secret_keys - GenesisConfig: create_state Net: 30 files changed, +43 / -1197. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
tcoratger
added a commit
to tcoratger/leanSpec
that referenced
this pull request
Apr 27, 2026
Absorbs 14 commits from main and resolves two textual conflicts in genesis/config.py and the matching test (PR leanEthereum#683 deleted the dead GenesisConfig.create_state helper that this branch had refactored to take a fork argument; production code goes through fork.generate_genesis directly, so the wrapper is genuinely dead). Reroutes two stale subspecs.containers imports left behind by the auto-merge: a new test file from PR leanEthereum#684 (Checkpoint __lt__) and a sync test fixture from PR leanEthereum#672. Both now resolve through forks.devnet4.containers. Tightens the docstring and inline comment introduced for update_safe_target by PR leanEthereum#680 to follow the project's documentation rules (short sentences, bullets over paragraphs). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Removes top-level functions, methods, and constants that have zero production callers across
src/(verified by grep). All deletions confirmed by grep acrosssrc/andtests/. Tests that exclusively exercised dead code are dropped; tests that incidentally used a removed helper are rewritten against the surviving public API.This is PR-A in a multi-PR plan from a wider audit of the subspecs codebase.
Diff: 30 files changed, +43 / −1197.
Removed surface
has,is_compatible_withno_scheduled_forkidentity,sha256(logic inlined intofrom_data)from_secp256k1(callers go throughIdentityKeypair.to_peer_id/PeerId.from_public_key)from_bytesfrom_bytes,private_key_bytesclear,__len__is_empty(ControlMessage.is_emptystays — it is used byRPC.encode)set_message_handler,_message_handlerfield, the dispatch branch in_handle_messagetwo_adic_generator, plusTWO_ADIC_GENERATORSandTWO_ADICITYconstantsprocess_pending_blocks,start_sync,_sync_lockprocess_all_processableclearget_orphan_parentsfrom_secret_keyscreate_stateDeliberately kept (against the audit)
decode_requestinreqresp/codec.py— the audit flagged it as dead because the inbound handler reimplements the logic inline, but it has rich wire-format test coverage and is the symmetric counterpart ofencode_request. The cleaner fix is to make the handler usedecode_request(separate PR).ENR.udp6_port,quic6_port,attestation_subnets,sync_committee_subnets,is_aggregator+ the matching ENR keys (UDP6,QUIC6,ATTNETS,SYNCNETS,IS_AGGREGATOR) — used bypackages/testing/src/consensus_testing/test_fixtures/networking_codec.pyto build cross-client spec fixtures. Not visible from asrc/-only grep.GossipsubMessage.snappy_decompressfield — borderline; reflects libp2p protocol behavior the spec should preserve.Out of scope (deferred)
subspecs/networking/discovery/package (PR-B decision pending: wire in or move toexperimental/).DatabaseProtocol slim-down + namespace dataclass collapse (PR-I).SyncService.reset/BackfillSync.reset/HeadSync.reset(deferred to PR-J — likely a deliberate test-cleanup API).Test plan
uvx tox -e all-checkspasses (ruff, format, ty, codespell, mdformat).🤖 Generated with Claude Code