Skip to content

Conversation

@ilitteri
Copy link
Contributor

Motivation

cargo test at the workspace level or in cmd/ethrex is not compiling. This is because ethrex-l2-rpc is a dev-dependencie.

This issue uncovered a bigger issue, that is the existence of benches inside cmd/ethrex.

Description

This PR solves the compilation error by moving benchmarks to a separate crate, benches. It also removes an unsued benchmark.

@ilitteri ilitteri requested a review from a team as a code owner October 17, 2025 00:31
Copilot AI review requested due to automatic review settings October 17, 2025 00:31
@github-actions github-actions bot added L1 Ethereum client L2 Rollup client labels Oct 17, 2025
Copy link
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

Fix cargo test compilation by moving benchmarks out of cmd/ethrex into a dedicated benches crate and updating related paths and CI.

  • Move bench targets from cmd/ethrex to a new benches crate and remove the unused import_blocks benchmark
  • Update include paths in build_block_benchmark.rs now that it lives under benches
  • Add benches to workspace and update the CI workflow to run the benchmark from the new location

Reviewed Changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
cmd/ethrex/bench/import_blocks_benchmark.rs Remove unused benchmark to eliminate dev-dep coupling.
cmd/ethrex/Cargo.toml Drop bench-related dev-deps and bench targets; formatting tweaks for features.
benches/benches/build_block_benchmark.rs Adjust include paths to fixtures after relocating the bench into its own crate.
benches/Cargo.toml New crate for benchmarks, with dev-deps and bench target configuration.
Cargo.toml Add benches crate to the workspace members.
.github/workflows/pr_perf_build_block_bench.yml Update benchmark workflow working directory to the new crate (note: see comment below).

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

uses: boa-dev/criterion-compare-action@v3
with:
cwd: "cmd/ethrex/bench"
cwd: "benches/benches"
Copy link

Copilot AI Oct 17, 2025

Choose a reason for hiding this comment

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

cwd should point to the crate root (where Cargo.toml resides). The benches crate root is benches, not benches/benches. Update to cwd: 'benches' so cargo bench runs correctly.

Suggested change
cwd: "benches/benches"
cwd: "benches"

Copilot uses AI. Check for mistakes.

async fn setup_genesis(accounts: &Vec<Address>) -> (Store, Genesis) {
let storage_path = tempfile::TempDir::new().unwrap();
if std::fs::exists(&storage_path).unwrap_or(false) {
Copy link

Copilot AI Oct 17, 2025

Choose a reason for hiding this comment

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

std::fs::exists does not exist. Use std::fs::try_exists(&storage_path).unwrap_or(false) or Path::new(&storage_path).exists().

Suggested change
if std::fs::exists(&storage_path).unwrap_or(false) {
if storage_path.path().exists() {

Copilot uses AI. Check for mistakes.
@github-actions
Copy link

Lines of code report

Total lines added: 232
Total lines removed: 0
Total lines changed: 232

Detailed view
+-------------------------------------------------+-------+------+
| File                                            | Lines | Diff |
+-------------------------------------------------+-------+------+
| ethrex/benches/benches/build_block_benchmark.rs | 232   | +232 |
+-------------------------------------------------+-------+------+

@github-project-automation github-project-automation bot moved this to In Review in ethrex_l1 Oct 17, 2025
@ilitteri ilitteri enabled auto-merge October 17, 2025 01:38
@ilitteri ilitteri added this pull request to the merge queue Oct 17, 2025
Merged via the queue into main with commit c7dab68 Oct 17, 2025
31 checks passed
@ilitteri ilitteri deleted the fix_cargo_test_compilation branch October 17, 2025 02:25
@github-project-automation github-project-automation bot moved this from In Review to Done in ethrex_l1 Oct 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

L1 Ethereum client L2 Rollup client

Projects

Status: Done
Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants