Skip to content

native_blockifier: delete dead code (unsure, review carefully) - #14882

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

native_blockifier: delete dead code (unsure, review carefully)#14882
asaf-sw wants to merge 1 commit into
mainfrom
code_slayer/remove_dead_code_in_native_blockifier

Conversation

@asaf-sw

@asaf-sw asaf-sw commented Jul 25, 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.

What

Removes an entirely-unused test-only module and an unused generic helper:

  • src/py_test_utils.rs (whole file) and its #[cfg(any(feature = "testing", test))] pub mod py_test_utils; declaration in lib.rs. The module's only items — create_py_test_state, TOKEN_FOR_TESTING_CLASS_HASH, TOKEN_FOR_TESTING_CONTRACT_PATH — are referenced nowhere: not in native_blockifier's own test files, any other workspace crate, or the sibling repos. native_blockifier declares no testing feature, so the module only ever compiled under cfg(test) — it is not part of the compiled Python extension and cannot be reached from Python.
  • to_py_vec in py_utils.rs: a pub generic helper with no callers anywhere. It is a plain Rust pub fn (not a #[pyfunction] pyo3 export), so it is not reachable from Python either.

Why these look dead

A workspace-wide grep for each identifier (create_py_test_state, TOKEN_FOR_TESTING_*, to_py_vec) across all crates and the sibling repos starkware-industries/sequencer-devops and starkware-industries/starkware finds only the definition sites.

What a human must verify

native_blockifier is the (legacy) Python-binding crate, and py_test_utils.rs historically referenced a path inside the StarkWare repo build directory. These items have no in-workspace or sibling-repo callers and are not pyo3-exposed, but the owner should confirm no external build/test harness depends on them before merging.

Verification (local)

Env workarounds applied (RUSTC_WRAPPER=, CARGO_INCREMENTAL=0):

  • cargo build -p native_blockifier — clean, zero warnings.
  • cargo build -p native_blockifier --tests — clean, zero warnings (this is the cfg that compiles py_test_utils).
  • cargo clippy -p native_blockifier --all-targets — clean.
  • SEED=0 cargo test -p native_blockifier — 3 passed.

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 by Claude Code

Removes an entirely-unused test-only module and an unused generic helper:

- `src/py_test_utils.rs` (whole file) and its `#[cfg(any(feature = "testing",
  test))] pub mod py_test_utils;` declaration in lib.rs. The module's only items
  (`create_py_test_state`, `TOKEN_FOR_TESTING_CLASS_HASH`,
  `TOKEN_FOR_TESTING_CONTRACT_PATH`) are referenced nowhere -- not in
  `native_blockifier`'s own test files, any other workspace crate, or the sibling
  repos. Note `native_blockifier` declares no `testing` feature, so the module
  only ever compiled under `cfg(test)`; it is not part of the compiled Python
  extension and cannot be reached from the Python side.
- `to_py_vec` in `py_utils.rs`: a `pub` generic helper with no callers anywhere.
  It is a plain Rust `pub fn` (not a `#[pyfunction]`/pyo3 export), so it is not
  reachable from Python either.

Evidence: a workspace-wide grep for each identifier (`create_py_test_state`,
`TOKEN_FOR_TESTING_*`, `to_py_vec`) across all crates and the sibling repos
`starkware-industries/sequencer-devops` and `starkware-industries/starkware`
finds only the definition sites.

Verification (env workarounds: `RUSTC_WRAPPER=`, `CARGO_INCREMENTAL=0`):
- `cargo build -p native_blockifier` -- clean, zero warnings.
- `cargo build -p native_blockifier --tests` -- clean, zero warnings (this is the
  cfg that compiles `py_test_utils`).
- `cargo clippy -p native_blockifier --all-targets` -- clean.
- `SEED=0 cargo test -p native_blockifier` -- passes.

Filed as low-confidence: `native_blockifier` is the (legacy) Python-binding crate
and `py_test_utils.rs` historically referenced a path in the StarkWare repo build
directory. These items have no in-workspace or sibling-repo callers and are not
pyo3-exposed, but a human owner should confirm no external build/test harness
depends on them before merging.
@reviewable-StarkWare

Copy link
Copy Markdown

This change is Reviewable

@github-actions

Copy link
Copy Markdown

Artifacts upload workflows:

@dorimedini-starkware dorimedini-starkware left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dorimedini-starkware made 1 comment.
Reviewable status: 0 of 3 files reviewed, 1 unresolved discussion (waiting on asaf-sw).


a discussion (no related file):
did you bump the py-side commit to point to this change? if it passes, then this PR seems fine to me

asaf-sw commented Jul 25, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for looking. I'm an automated routine and can't bump the py-side pin or trigger the py-side CI myself, so that final gate is yours to run — but here's the evidence that the py-side can't be affected by this diff:

  • How the py-side consumes this crate. starkware links native_blockifier only as the prebuilt shared object (native_blockifier.pypy39-…-linux-gnu.so, via NATIVE_BLOCKIFIER_DATA / native_blockifier_py) and reaches it through import native_blockifier. So it can only see symbols that are actually exported into that .so.
  • None of the deleted items are in the .so.
    • py_test_utils (whole module) is #[cfg(any(feature = "testing", test))], and native_blockifier declares no testing feature — so it only ever compiles under cfg(test) and is never built into the release .so.
    • to_py_vec is a plain pub fn (generic helper), not a #[pyfunction]/#[pymethods] export, so it's not reachable from Python either.
  • No textual references on the py-side. grep -rE 'py_test_utils|create_py_test_state|TOKEN_FOR_TESTING_(CLASS_HASH|CONTRACT_PATH)|to_py_vec' across the entire starkware repo returns zero matches (and likewise zero across sequencer and sequencer-devops).

So bumping the py-side commit to this change should be a no-op for the build. If you'd still like the py-side CI run as the safety check before merging, that step is on your side — please go ahead, and I'll adjust if anything unexpected turns up.


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.

4 participants