Skip to content

apollo_l1_events: delete dead code (unsure, review carefully) - #15144

Open
asaf-sw wants to merge 1 commit into
mainfrom
code_slayer/remove_dead_code_in_apollo_l1_events
Open

asaf-sw wants to merge 1 commit into
mainfrom
code_slayer/remove_dead_code_in_apollo_l1_events

Conversation

@asaf-sw

@asaf-sw asaf-sw commented Sep 19, 2026

Copy link
Copy Markdown
Contributor

Caution

REVIEW WITH CARE! THIS PR REQUIRES CAREFUL HUMAN REVIEW...
If you find this to be a false positive comment in detail why this code should be kept and close the PR.

Summary

Deletes the unused test-helper method FakeL1EventsProviderClient::assert_add_events_received_with from crates/apollo_l1_events/src/test_utils.rs.

Why it appears dead

  • test_utils is gated #[cfg(any(test, feature = "testing"))] and is exposed to other crates via the testing feature, so assert_add_events_received_with is part of this crate's cross-crate testing API — the Rust dead_code lint does not flag it, which is why a plain build stays clean.
  • The identifier assert_add_events_received_with appears exactly once in the entire starkware-libs/sequencer workspace — its own definition. There are zero call sites: the crate's own tests (l1_events_provider_tests.rs) construct FakeL1EventsProviderClient and call flush_messages, but never this assertion helper.
  • It is not referenced in either sibling repo checked out alongside this one: starkware-industries/sequencer-devops and starkware-industries/starkware (grep of source, scripts, and config — no hits).
  • The method is a self-contained inherent method; removing it orphans no imports (mem, Itertools via collect_vec, and Event all remain used elsewhere in the file).

What a human must verify

  • This is pub testing API exported through the testing feature. I cannot rule out a consumer outside the three repos in scope (e.g. another StarkWare repo not checked out here) that enables apollo_l1_events/testing and calls this assertion helper.
  • Confirm the helper is not intended as imminent scaffolding for a test that has not landed yet. It is a deliberately written #[track_caller] assertion helper, so it may have been added ahead of the test that will use it.

If either is true, this is a false positive — please comment why it should be kept and close the PR.

Verification

  • unset CI && scripts/rust_fmt.sh — clean.
  • cargo build -p apollo_l1_events and cargo build -p apollo_l1_events --tests — zero dead_code/unused warnings.
  • cargo clippy -p apollo_l1_events --all-targets — clean.
  • SEED=0 cargo test -p apollo_l1_events — unit suite green (88 passed, 0 failed, 4 ignored). The one failing test, the anvil-backed integration flow test in tests/flow_test_cancellation.rs, panics with Anvil binary not found! before any crate code runs — the Foundry anvil binary is absent in this CI sandbox, so it fails identically on main and is unrelated to this deletion.

Caution

REVIEW WITH CARE! THIS PR REQUIRES CAREFUL HUMAN REVIEW...
If you find this to be a false positive comment in detail why this code should be kept and close the PR.

🤖 Generated with Claude Code

https://claude.ai/code/session_01MZtkRKfRyFcojC9WSgGFQG


Generated by Claude Code

Delete the unused test-helper method
`FakeL1EventsProviderClient::assert_add_events_received_with` from
crates/apollo_l1_events/src/test_utils.rs.

Why it appears dead:
- `test_utils` is gated `#[cfg(any(test, feature = "testing"))]` and is exposed to
  other crates through the `testing` feature, so this method is part of the crate's
  cross-crate *testing* API. The rustc `dead_code` lint does not flag public items,
  which is why a plain build stays clean and this was not caught by the compiler.
- The identifier `assert_add_events_received_with` appears exactly once in the whole
  starkware-libs/sequencer workspace: its own definition. There are zero call sites.
  The crate's own tests (l1_events_provider_tests.rs) construct
  FakeL1EventsProviderClient and call flush_messages, but never this assertion helper.
- Not referenced in either sibling repo checked out alongside this one
  (starkware-industries/sequencer-devops, starkware-industries/starkware): grep of
  source, scripts and config found no hits.
- Removing it orphans no imports: `mem`, `Itertools` (via `collect_vec`) and `Event`
  all remain used elsewhere in the file.

This is routed as a low-confidence change because the method is `pub` testing API
exported via the `testing` feature: a consumer outside the three in-scope repos
could enable apollo_l1_events/testing and call it, and it may be scaffolding for a
test that has not landed yet. A human owner should confirm before merging.

Verified: rustfmt clean; `cargo build -p apollo_l1_events` and
`cargo build -p apollo_l1_events --tests` build with zero dead_code/unused warnings;
`cargo clippy -p apollo_l1_events --all-targets` clean; `SEED=0 cargo test -p
apollo_l1_events` runs the unit suite green (88 passed, 0 failed, 4 ignored). The only
failing test, the anvil-backed integration flow test in tests/flow_test_cancellation.rs,
panics with "Anvil binary not found!" before any crate code runs -- the Foundry `anvil`
binary is absent in this sandbox, so it fails identically on main and is unrelated to
this deletion (that flow test never referenced the removed helper).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MZtkRKfRyFcojC9WSgGFQG
@reviewable-StarkWare

Copy link
Copy Markdown

This change is Reviewable

asaf-sw commented Sep 19, 2026

Copy link
Copy Markdown
Contributor Author

CI note: run-integration-tests failed with a panic in crates/apollo_integration_tests/src/integration_test_manager.rs:369Node service Hybrid(Mempool) unexpectedly stopped during multi-node startup, with the surrounding log full of transient P2P churn (ConnectionRefused / BrokenPipe / peer blacklisting). This is the known-flaky hybrid multi-node integration harness and is unrelated to this diff.

Why it can't be this PR's failure: the change only deletes one #[cfg(any(test, feature = "testing"))] test-helper method in apollo_l1_events (FakeL1EventsProviderClient::assert_add_events_received_with). That identifier has zero references anywhere in the repo outside its own definition, and it is not part of the mempool or integration-test code path. The lib and --tests builds, run-workspace-tests, cargo-deny, commitlint, and semgrep all pass; the panic is a node-startup race in the test harness, not a compile/behavior change from this deletion.

I've re-run the failed jobs once to confirm the flake.


Generated by Claude Code

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.

3 participants