Skip to content

feat(l1, l2): remove unused dependencies#6413

Closed
kevaundray wants to merge 2 commits intolambdaclass:mainfrom
kevaundray:kw/rem-unused-deps
Closed

feat(l1, l2): remove unused dependencies#6413
kevaundray wants to merge 2 commits intolambdaclass:mainfrom
kevaundray:kw/rem-unused-deps

Conversation

@kevaundray
Copy link
Copy Markdown
Contributor

@kevaundray kevaundray commented Mar 26, 2026

Motivation

Used cargo machete --with-metadata and cargo udeps to check for unused deps. There were some false positives with cargo machete that I had to manually filter out.

Description

Checklist

  • Updated STORE_SCHEMA_VERSION (crates/storage/lib.rs) if the PR includes breaking changes to the Store requiring a re-sync.

Closes #issue_number

@kevaundray kevaundray marked this pull request as ready for review March 26, 2026 22:49
Copilot AI review requested due to automatic review settings March 26, 2026 22:49
@kevaundray kevaundray requested review from a team and avilagaston9 as code owners March 26, 2026 22:49
@greptile-apps
Copy link
Copy Markdown

greptile-apps bot commented Mar 26, 2026

Greptile Summary

This PR performs a dependency cleanup across 25 Cargo.toml files, using cargo machete --with-metadata and cargo udeps to identify unused dependencies. The vast majority of removals are correct and verified — for example, moving k256 to [dev-dependencies] in crates/common (only used in a #[test] block), removing datatest-stable/walkdir/bitvec/sha3 from crates/vm/levm regular deps (confirmed absent from all non-test source), and stripping async-trait, serde_json, and hex-literal from crates/networking/p2p and crates/storage.\n\nKey changes:\n- Removes ~30 unused dependencies across the L1 and L2 crates.\n- crates/common: moves k256 from [dependencies][dev-dependencies].\n- crates/l2: removes ethrex-guest-program, ethrex-dev, directories, tui-big-text, tui-scrollview, tabwriter, color-eyre, and simplifies feature flags for sp1, risc0, and l2.\n- One breaking issue found: ethrex-guest-program is fully removed from crates/l2/Cargo.toml, but crates/l2/sequencer/l1_proof_sender.rs still imports ethrex_guest_program::ZKVM_SP1_PROGRAM_ELF under #[cfg(feature = \"sp1\")]. Since cmd/ethrex enables ethrex-l2/sp1 as part of its own sp1 feature, building with --features sp1 will fail to compile.

Confidence Score: 2/5

Not safe to merge as-is — the sp1 feature flag build is broken due to a missing ethrex-guest-program dependency in crates/l2.

The overwhelming majority of changes are correct, clean dependency removals with no functional impact. However, one concrete compilation error is introduced: crates/l2/sequencer/l1_proof_sender.rs references ethrex_guest_program::ZKVM_SP1_PROGRAM_ELF under #[cfg(feature = "sp1")], but ethrex-guest-program is no longer declared as a dependency of crates/l2. This breaks cargo build --features sp1 for the cmd/ethrex binary, which is a primary build target.

crates/l2/Cargo.toml and crates/l2/sequencer/l1_proof_sender.rs need attention — the dependency removal and remaining usage are inconsistent.

Important Files Changed

Filename Overview
crates/l2/Cargo.toml Removes ethrex-guest-program entirely, but sequencer still uses it under #[cfg(feature = "sp1")] — breaks --features sp1 builds.
crates/vm/levm/Cargo.toml Removes datatest-stable, walkdir, sha3, bitvec, serde_json, lazy_static that were incorrectly listed as regular deps despite having no usage in non-test source; also drops unused dev-deps (hex, colored, spinoff).
crates/common/Cargo.toml Removes tinyvec, sha3, url, k256 from main deps; correctly moves k256 to [dev-dependencies] since it is only used inside a #[test] block.
crates/l2/common/Cargo.toml Removes ethrex-rlp, ethrex-trie, ethrex-vm, sha3, hex — none of which are used in the crate's source files.
crates/networking/p2p/Cargo.toml Removes unused async-trait, serde_json from main deps and hex-literal from dev-deps; confirmed none are referenced in p2p source files.
crates/vm/Cargo.toml Removes ethrex-trie, lazy_static, rkyv, bincode, ethereum-types — all confirmed absent from the crate's source files.
crates/storage/Cargo.toml Removes async-trait, ethereum-types, hex from main deps and hex, hex-literal, tempfile from dev-deps; none used in storage source.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[cmd/ethrex --features sp1] -->|enables| B[ethrex-prover/sp1]
    A -->|enables| C[ethrex-l2/sp1]
    B -->|direct dep| D[ethrex-guest-program]
    C -->|sp1 = dep:sp1-sdk\nNO ethrex-guest-program| E{ethrex-l2}
    E -->|cfg feature sp1| F[l1_proof_sender.rs\nuse ethrex_guest_program::ZKVM_SP1_PROGRAM_ELF]
    F -->|❌ ethrex-guest-program\nnot a declared dep| G[Compilation Error]
    style G fill:#ff4444,color:#fff
    style F fill:#ffaa00,color:#000
Loading
Prompt To Fix All With AI
This is a comment left during a code review.
Path: crates/l2/Cargo.toml
Line: 76-78

Comment:
**Missing `ethrex-guest-program` dependency breaks `sp1` feature compilation**

`ethrex-guest-program` has been completely removed as a dependency from this crate, but `crates/l2/sequencer/l1_proof_sender.rs` still imports from it under `#[cfg(feature = "sp1")]`:

```rust
#[cfg(feature = "sp1")]
use ethrex_guest_program::ZKVM_SP1_PROGRAM_ELF;
```

Since `cmd/ethrex/Cargo.toml` has `sp1 = ["ethrex-prover/sp1", "ethrex-l2/sp1"]`, building the `cmd/ethrex` binary with `--features sp1` will enable `ethrex-l2/sp1`, which will trigger the `#[cfg(feature = "sp1")]` block in `l1_proof_sender.rs` — but `ethrex_guest_program` is no longer a declared dependency of `ethrex-l2`, causing a compilation failure.

The fix is to either:
1. Re-add `ethrex-guest-program` as an **optional** dependency tied to the `sp1` feature, e.g.:
   ```toml
   ethrex-guest-program = { path = "../guest-program", optional = true }
   
   [features]
   sp1 = ["dep:ethrex-guest-program", "dep:sp1-sdk"]
   ```
2. Or remove the `ethrex_guest_program` usage from `l1_proof_sender.rs` if it truly is no longer needed.

How can I resolve this? If you propose a fix, please make it concise.

Reviews (1): Last reviewed commit: "commit" | Re-trigger Greptile

Comment thread crates/l2/Cargo.toml
Comment on lines 76 to 78
[features]
default = ["l2"]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P0 Missing ethrex-guest-program dependency breaks sp1 feature compilation

ethrex-guest-program has been completely removed as a dependency from this crate, but crates/l2/sequencer/l1_proof_sender.rs still imports from it under #[cfg(feature = "sp1")]:

#[cfg(feature = "sp1")]
use ethrex_guest_program::ZKVM_SP1_PROGRAM_ELF;

Since cmd/ethrex/Cargo.toml has sp1 = ["ethrex-prover/sp1", "ethrex-l2/sp1"], building the cmd/ethrex binary with --features sp1 will enable ethrex-l2/sp1, which will trigger the #[cfg(feature = "sp1")] block in l1_proof_sender.rs — but ethrex_guest_program is no longer a declared dependency of ethrex-l2, causing a compilation failure.

The fix is to either:

  1. Re-add ethrex-guest-program as an optional dependency tied to the sp1 feature, e.g.:
    ethrex-guest-program = { path = "../guest-program", optional = true }
    
    [features]
    sp1 = ["dep:ethrex-guest-program", "dep:sp1-sdk"]
  2. Or remove the ethrex_guest_program usage from l1_proof_sender.rs if it truly is no longer needed.
Prompt To Fix With AI
This is a comment left during a code review.
Path: crates/l2/Cargo.toml
Line: 76-78

Comment:
**Missing `ethrex-guest-program` dependency breaks `sp1` feature compilation**

`ethrex-guest-program` has been completely removed as a dependency from this crate, but `crates/l2/sequencer/l1_proof_sender.rs` still imports from it under `#[cfg(feature = "sp1")]`:

```rust
#[cfg(feature = "sp1")]
use ethrex_guest_program::ZKVM_SP1_PROGRAM_ELF;
```

Since `cmd/ethrex/Cargo.toml` has `sp1 = ["ethrex-prover/sp1", "ethrex-l2/sp1"]`, building the `cmd/ethrex` binary with `--features sp1` will enable `ethrex-l2/sp1`, which will trigger the `#[cfg(feature = "sp1")]` block in `l1_proof_sender.rs` — but `ethrex_guest_program` is no longer a declared dependency of `ethrex-l2`, causing a compilation failure.

The fix is to either:
1. Re-add `ethrex-guest-program` as an **optional** dependency tied to the `sp1` feature, e.g.:
   ```toml
   ethrex-guest-program = { path = "../guest-program", optional = true }
   
   [features]
   sp1 = ["dep:ethrex-guest-program", "dep:sp1-sdk"]
   ```
2. Or remove the `ethrex_guest_program` usage from `l1_proof_sender.rs` if it truly is no longer needed.

How can I resolve this? If you propose a fix, please make it concise.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Removes unused Rust dependencies across several workspace crates (plus corresponding lockfile cleanup) based on cargo machete --with-metadata and cargo udeps, aiming to reduce compile times and dependency surface area.

Changes:

  • Pruned unused deps from multiple Cargo.toml manifests (tooling, common, VM, storage, networking, L2).
  • Updated multiple Cargo.lock files to reflect the reduced dependency graph.
  • Adjusted ethrex-l2 feature definitions (sp1, risc0, l2) alongside dependency removals.

Reviewed changes

Copilot reviewed 17 out of 25 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tooling/repl/Cargo.toml Removes unused ethereum-types from REPL tooling crate.
tooling/monitor/Cargo.toml Removes unused TUI/error-reporting dependencies from monitor tooling crate.
tooling/Cargo.lock Lockfile updated after tooling dependency pruning.
test/Cargo.toml Removes unused tempfile from test crate.
crates/vm/levm/runner/Cargo.toml Removes unused json5 from LEVM runner crate.
crates/vm/levm/bench/revm_comparison/Cargo.lock Lockfile updated after bench dependency pruning.
crates/vm/levm/Cargo.toml Removes multiple unused deps/dev-deps from ethrex-levm.
crates/vm/Cargo.toml Removes unused dependencies from ethrex-vm.
crates/storage/Cargo.toml Removes unused deps/dev-deps from ethrex-storage.
crates/networking/p2p/Cargo.toml Removes unused deps/dev-deps from ethrex-p2p.
crates/l2/tee/quote-gen/Cargo.lock Lockfile updated after dependency pruning for quote generator.
crates/l2/storage/Cargo.toml Removes unused deps from L2 storage crate.
crates/l2/sdk/Cargo.toml Removes unused eyre from L2 SDK crate.
crates/l2/common/Cargo.toml Removes unused deps from L2 common crate.
crates/l2/Cargo.toml Removes unused deps and modifies feature wiring for L2 crate.
crates/guest-program/bin/zisk/Cargo.lock Lockfile updated after guest-program bin dependency pruning.
crates/guest-program/bin/sp1/Cargo.lock Lockfile updated after guest-program bin dependency pruning.
crates/guest-program/bin/risc0/Cargo.lock Lockfile updated after guest-program bin dependency pruning.
crates/guest-program/bin/openvm/Cargo.lock Lockfile updated after guest-program bin dependency pruning.
crates/common/trie/Cargo.toml Removes unused deps from trie crate.
crates/common/rlp/Cargo.toml Removes unused deps from RLP crate.
crates/common/Cargo.toml Removes unused deps; moves k256 to dev-dependencies.
crates/blockchain/Cargo.toml Removes unused deps/dev-deps from blockchain crate.
cmd/ethrex/Cargo.toml Removes unused clap_complete from CLI crate.
Cargo.lock Workspace lockfile updated after dependency graph changes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread crates/l2/Cargo.toml Outdated
Comment on lines +79 to +86
sp1 = ["dep:sp1-sdk"]
risc0 = []

rocksdb = []

metrics = ["ethrex-blockchain/metrics"]

l2 = ["ethrex-guest-program/l2"]
l2 = []
Copy link

Copilot AI Mar 26, 2026

Choose a reason for hiding this comment

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

ethrex-l2 still references ethrex_guest_program behind the sp1 feature (e.g. sequencer/l1_proof_sender.rs imports ethrex_guest_program::ZKVM_SP1_PROGRAM_ELF). With ethrex-guest-program removed from [dependencies] and sp1 no longer enabling it, building ethrex-l2 with --features sp1 will fail. Re-add ethrex-guest-program as an optional dependency and include it in the sp1 (and any other relevant) feature(s), or remove/relocate the ethrex_guest_program usage from this crate.

Copilot uses AI. Check for mistakes.
@ilitteri ilitteri enabled auto-merge March 27, 2026 00:02
auto-merge was automatically disabled March 30, 2026 10:43

Head branch was pushed to by a user without write access

@avilagaston9 avilagaston9 enabled auto-merge March 30, 2026 15:07
@avilagaston9 avilagaston9 disabled auto-merge March 30, 2026 15:11
github-merge-queue bot pushed a commit that referenced this pull request Mar 30, 2026
## Motivation

Continuation of #6413. Used `cargo machete --with-metadata` and `cargo
udeps` to check for unused deps, filtering out false positives manually.

## Description

Cherry-picked from #6413 onto current main with merge conflicts resolved
(guest program Cargo.lock files).

## Checklist

- [ ] Updated `STORE_SCHEMA_VERSION` (crates/storage/lib.rs) if the PR
includes breaking changes to the `Store` requiring a re-sync.

---------

Co-authored-by: Kevaundray Wedderburn <kevtheappdev@gmail.com>
@iovoid
Copy link
Copy Markdown
Contributor

iovoid commented Apr 1, 2026

Superseded by #6421

@iovoid iovoid closed this Apr 1, 2026
edg-l pushed a commit that referenced this pull request Apr 8, 2026
Continuation of #6413. Used `cargo machete --with-metadata` and `cargo
udeps` to check for unused deps, filtering out false positives manually.

Cherry-picked from #6413 onto current main with merge conflicts resolved
(guest program Cargo.lock files).

- [ ] Updated `STORE_SCHEMA_VERSION` (crates/storage/lib.rs) if the PR
includes breaking changes to the `Store` requiring a re-sync.

---------

Co-authored-by: Kevaundray Wedderburn <kevtheappdev@gmail.com>
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.

6 participants