Skip to content

Commit 8e7c620

Browse files
committed
compile feature
1 parent 8251273 commit 8e7c620

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

prover/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ sp1-zkvm = { git = "https://github.com/succinctlabs/sp1.git", tag = "v5.2.4" }
129129
sp1-verifier = { git = "https://github.com/succinctlabs/sp1.git", tag = "v5.2.4" }
130130

131131
# Workspace Members
132-
morph-prove = { path = "bin/host" }
132+
morph-prove = { path = "bin/host", default-features = false }
133133
prover-executor-client = { path = "crates/executor/client" }
134134
prover-executor-core = { path = "crates/executor/core" }
135135
prover-executor-host = { path = "crates/executor/host" }

prover/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ To generate a PLONK proof that is small enough to be verified on-chain and verif
4747
// use network prover
4848
cargo run --release --package morph-prove --bin prove -- --block-path ./testdata/mpt/mainnet_25215.json --prove
4949
// use local cpu prover
50-
cargo run --release --no-default-features --features local --package morph-prove --bin prove -- --block-path ./testdata/mpt/mainnet_25215.json --prove
50+
cargo run --release --features local --package morph-prove --bin prove -- --block-path ./testdata/mpt/mainnet_25215.json --prove
5151
// prove specified block range
5252
cargo run --release --package morph-prove --bin prove -- --start-block 0x35 --end-block 0x37 --rpc http://127.0.0.1:8545 --use-rpc-db --prove
5353
```

prover/bin/host/src/lib.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use prover_primitives::{alloy_primitives::keccak256, B256};
88
use prover_utils::read_env_var;
99
#[cfg(feature = "local")]
1010
use sp1_sdk::CpuProver;
11-
#[cfg(feature = "network")]
11+
#[cfg(all(feature = "network", not(feature = "local")))]
1212
use sp1_sdk::{network::NetworkMode, NetworkProver};
1313
use sp1_sdk::{HashableKey, Prover, ProverClient, SP1ProvingKey, SP1Stdin, SP1VerifyingKey};
1414
use sp1_verifier::PlonkVerifier;
@@ -27,16 +27,21 @@ pub struct BatchProver<C> {
2727
vk: SP1VerifyingKey,
2828
}
2929

30-
#[cfg(feature = "network")]
31-
pub type DefaultClient = NetworkProver;
3230
#[cfg(feature = "local")]
3331
pub type DefaultClient = CpuProver;
32+
#[cfg(all(feature = "network", not(feature = "local")))]
33+
pub type DefaultClient = NetworkProver;
34+
35+
// If both features are enabled (e.g. defaults + `--features local`), prefer `local`.
36+
// If neither is enabled, fail fast with a clear message.
37+
#[cfg(all(not(feature = "local"), not(feature = "network")))]
38+
compile_error!("One of `local` or `network` features must be enabled for morph-prove.");
3439

3540
/// A batch prover that uses the default proving client based on the feature flag.
3641
impl Default for BatchProver<DefaultClient> {
3742
fn default() -> Self {
3843
let prover_client = {
39-
#[cfg(feature = "network")]
44+
#[cfg(all(feature = "network", not(feature = "local")))]
4045
{
4146
ProverClient::builder()
4247
.network_for(NetworkMode::Mainnet)

0 commit comments

Comments
 (0)