Skip to content

Commit ac646c6

Browse files
committed
refactor: replace sp1,risc0 features for .env variables
1 parent 319c112 commit ac646c6

File tree

3 files changed

+12
-15
lines changed

3 files changed

+12
-15
lines changed

aggregation_mode/Cargo.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,4 @@ opt-level = 3
4040
[features]
4141
default = []
4242
prove = []
43-
sp1 = []
44-
risc0 = []
4543
gpu = ["risc0-zkvm/cuda"]

aggregation_mode/src/aggregators/mod.rs

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,16 @@ impl Display for ZKVMEngine {
2323
}
2424

2525
impl ZKVMEngine {
26-
pub fn from_rust_features() -> Option<Self> {
27-
#[cfg(feature = "sp1")]
28-
{
29-
return Some(ZKVMEngine::SP1);
30-
}
31-
32-
#[cfg(feature = "risc0")]
33-
{
34-
return Some(ZKVMEngine::RISC0);
35-
}
26+
pub fn from_env() -> Option<Self> {
27+
let key = "AGGREGATOR";
28+
let value = std::env::var(key).ok()?;
29+
let engine = match value.as_str() {
30+
"sp1" => ZKVMEngine::SP1,
31+
"risc0" => ZKVMEngine::RISC0,
32+
_ => panic!("Invalid AGGREGATOR, possible options are: sp1|risc0"),
33+
};
3634

37-
None
35+
Some(engine)
3836
}
3937
}
4038

aggregation_mode/src/backend/mod.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ impl ProofAggregator {
6464
rpc_provider,
6565
);
6666

67-
let engine = ZKVMEngine::from_rust_features().expect("A feature defining zkvm engine");
67+
let engine =
68+
ZKVMEngine::from_env().expect("AGGREGATOR env variable to be set to one of sp1|risc0");
6869
let fetcher = ProofsFetcher::new(config);
6970

7071
Self {
@@ -75,7 +76,7 @@ impl ProofAggregator {
7576
}
7677

7778
pub async fn start(&mut self, config: &Config) {
78-
info!("Starting proof aggregator service",);
79+
info!("Starting proof aggregator service");
7980

8081
info!("About to aggregate and submit proof to be verified on chain");
8182
let res = self.aggregate_and_submit_proofs_on_chain().await;

0 commit comments

Comments
 (0)