Skip to content

Commit

Permalink
fix(l2,l1): add a default prover backend when compiling ethrex (#2075)
Browse files Browse the repository at this point in the history
**Motivation**

When compiling the project with the provided Makefile, compilation fails
due to unspecified prover backend.

**Description**

Add a default Makefile variable to the Makefile. If the variable is not
present, it will default to sp1.
Also, expand the compilation error message when there is no prover
backend specified.

Closes #2076
  • Loading branch information
lima-limon-inc authored Feb 25, 2025
1 parent 7ad8c91 commit 2e9e67c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
1 change: 1 addition & 0 deletions crates/l2/prover/bench/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,4 @@ risc0 = ["zkvm_interface/build_risc0", "ethrex-prover/build_risc0"]
sp1 = ["zkvm_interface/build_sp1", "zkvm_interface/build_sp1"]
gpu = ["ethrex-prover/gpu"]
l2 = ["ethrex-vm/l2", "zkvm_interface/l2"]
default = ["sp1"]
16 changes: 8 additions & 8 deletions crates/l2/prover/bench/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@ sp1:
sp1-gpu:
SP1_PROVER=cuda cargo r -r --features "sp1,gpu" -- --rpc-url ${RPC_URL} --block-number ${BLOCK_NUMBER}
risc0:
cargo r -r --features risc0 -- --rpc-url ${RPC_URL} --block-number ${BLOCK_NUMBER}
cargo r -r --no-default-features --features risc0 -- --rpc-url ${RPC_URL} --block-number ${BLOCK_NUMBER}
risc0-gpu:
cargo r -r --features "risc0,gpu" -- --rpc-url ${RPC_URL} --block-number ${BLOCK_NUMBER}
cargo r -r --no-default-features --features "risc0,gpu" -- --rpc-url ${RPC_URL} --block-number ${BLOCK_NUMBER}
else
sp1:
SP1_PROVER=cpu cargo r -r --features sp1 -- --rpc-url ${RPC_URL}
sp1-gpu:
SP1_PROVER=cuda cargo r -r --features "sp1,gpu" -- --rpc-url ${RPC_URL}
risc0:
cargo r -r --features risc0 -- --rpc-url ${RPC_URL}
cargo r -r --no-default-features --features risc0 -- --rpc-url ${RPC_URL}
risc0-gpu:
cargo r -r --features "risc0,gpu" -- --rpc-url ${RPC_URL}
cargo r -r --no-default-features --features "risc0,gpu" -- --rpc-url ${RPC_URL}
endif

# Proving
Expand All @@ -28,16 +28,16 @@ prove-sp1:
prove-sp1-gpu:
SP1_PROVER=cuda cargo r -r --features "sp1,gpu" -- --rpc-url ${RPC_URL} --prove --block-number ${BLOCK_NUMBER}
prove-risc0:
cargo r -r --features risc0 -- --rpc-url ${RPC_URL} --prove --block-number ${BLOCK_NUMBER}
cargo r -r --no-default-features --features risc0 -- --rpc-url ${RPC_URL} --prove --block-number ${BLOCK_NUMBER}
prove-risc0-gpu:
cargo r -r --features "risc0,gpu" -- --rpc-url ${RPC_URL} --prove --block-number ${BLOCK_NUMBER}
cargo r -r --no-default-features --features "risc0,gpu" -- --rpc-url ${RPC_URL} --prove --block-number ${BLOCK_NUMBER}
else
prove-sp1:
SP1_PROVER=cpu cargo r -r --features sp1 -- --rpc-url ${RPC_URL} --prove
prove-sp1-gpu:
SP1_PROVER=cuda cargo r -r --features "sp1,gpu" -- --rpc-url ${RPC_URL} --prove
prove-risc0:
cargo r -r --features risc0 -- --rpc-url ${RPC_URL} --prove
cargo r -r --no-default-features --features risc0 -- --rpc-url ${RPC_URL} --prove
prove-risc0-gpu:
cargo r -r --features "risc0,gpu" -- --rpc-url ${RPC_URL} --prove
cargo r -r --no-default-features --features "risc0,gpu" -- --rpc-url ${RPC_URL} --prove
endif
5 changes: 4 additions & 1 deletion crates/l2/prover/bench/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ use ethrex_vm::execution_db::ToExecDB;
use zkvm_interface::io::ProgramInput;

#[cfg(not(any(feature = "sp1", feature = "risc0")))]
compile_error!("Choose prover backends (sp1, risc0).");
compile_error!(
"Choose prover backends (sp1, risc0).
- Pass a feature flag to cargo (--feature or -F) with the desired backed. e.g: cargo build --workspace --no-default-features -F sp1. NOTE: Don't forget to pass --no-default-features, if not, the default prover will be used instead."
);

#[derive(Parser, Debug)]
struct Args {
Expand Down

0 comments on commit 2e9e67c

Please sign in to comment.