Skip to content

fix: resolve vulture dead-code findings on main#999

Merged
tcoratger merged 1 commit into
leanEthereum:mainfrom
tcoratger:audit/fix-dead-code-findings
Jun 13, 2026
Merged

fix: resolve vulture dead-code findings on main#999
tcoratger merged 1 commit into
leanEthereum:mainfrom
tcoratger:audit/fix-dead-code-findings

Conversation

@tcoratger

Copy link
Copy Markdown
Collaborator

Summary

The Dead code detection CI job (vulture, via just deadcode) is failing on main. Several recently-merged PRs introduced symbols vulture reports, because they were verified with just check (which does not run vulture) rather than just deadcode. This PR makes the dead-code job green again.

Findings and how each is handled

Genuinely unused — fixed in code:

  • self_inner (×4, 100% confidence) in tests/node/validator/test_service.py: mock functions replacing _maybe_produce_block / _produce_attestations via patch.object receive the instance positionally but never use it. Renamed to _self, the idiomatic intentionally-unused marker vulture respects. The parameter cannot be dropped (the patched method is still called with the instance first).

Live code vulture cannot see — added to vulture_whitelist.py (its stated purpose: name the indirectly-used symbols):

  • _check_list_lengths (spec/crypto/xmss/containers.py): a @model_validator invoked by pydantic. Removing it would disable the XMSS signature length validation.
  • _reject_oversized_validator_set (node/genesis/config.py): a @field_validator invoked by pydantic. Removing it would disable the genesis validator-count bound.
  • is_admin (node/api/routes.py): access-tier flag set on every route entry to document the route; not yet read by the registration path.
  • extra_field (tests/node/networking/test_types.py): the attribute assignment is the action under test (slotted classes must reject new attributes), never read back.

Not addressed (out of scope): the packages/testing/build/lib/* hits are a gitignored local build artifact that CI never checks out.

Verification

  • just deadcode exits 0 against a tree without the local build/ artifact (mirroring CI's fresh checkout).
  • just check is fully green.
  • uv run pytest tests/node/validator/test_service.py — 51 passed.

🤖 Generated with Claude Code

Rename four unused mock self parameters to _self (the patched method
still receives the instance positionally) and whitelist symbols vulture
cannot see are live: the pydantic Signature and genesis-config validators
invoked via decorators, the route access-tier flag set at every call site,
and the slotted-class test attribute assignment.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@tcoratger tcoratger force-pushed the audit/fix-dead-code-findings branch from dc24b56 to 7717544 Compare June 12, 2026 23:47
@tcoratger tcoratger merged commit 5a9c895 into leanEthereum:main Jun 13, 2026
13 of 14 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