Skip to content

Commit 26cf279

Browse files
Make the disabled verifiers to be a provingSystemId instead of Strings
1 parent 308412b commit 26cf279

File tree

3 files changed

+22
-6
lines changed

3 files changed

+22
-6
lines changed

crates/batcher/src/config/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
use aligned_sdk::common::types::ProvingSystemId;
12
use ethers::{core::k256::ecdsa::SigningKey, signers::Wallet, types::Address};
23
use serde::Deserialize;
34

@@ -54,7 +55,7 @@ pub struct BatcherConfigFromYaml {
5455
pub amount_of_proofs_for_min_max_fee: usize,
5556
pub min_bump_percentage: u64,
5657
pub balance_unlock_polling_interval_seconds: u64,
57-
pub disabled_verifiers: Vec<String>,
58+
pub disabled_verifiers: Vec<ProvingSystemId>,
5859
}
5960

6061
#[derive(Debug, Deserialize)]

crates/batcher/src/lib.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ pub struct Batcher {
136136

137137
// The list of disabled verifiers from the config file. Note that this is separate from the
138138
// contract's disabled verifiers, and is updated only when the batcher is restarted.
139-
config_disabled_verifiers: Vec<String>,
139+
config_disabled_verifiers: Vec<ProvingSystemId>,
140140

141141
// Observability and monitoring
142142
pub metrics: metrics::BatcherMetrics,
@@ -1492,10 +1492,7 @@ impl Batcher {
14921492

14931493
async fn is_verifier_disabled(&self, verifier: ProvingSystemId) -> bool {
14941494
// Check if the verifier is disabled in the configuration first
1495-
if self
1496-
.config_disabled_verifiers
1497-
.contains(&verifier.to_string())
1498-
{
1495+
if self.config_disabled_verifiers.contains(&verifier) {
14991496
return true;
15001497
}
15011498
let disabled_verifiers = self.disabled_verifiers.lock().await;

crates/sdk/src/common/types.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,24 @@ impl Display for ProvingSystemId {
7070
}
7171
}
7272

73+
impl FromStr for ProvingSystemId {
74+
type Err = String;
75+
76+
fn from_str(s: &str) -> Result<Self, Self::Err> {
77+
match s {
78+
"GnarkPlonkBls12_381" => Ok(ProvingSystemId::GnarkPlonkBls12_381),
79+
"GnarkPlonkBn254" => Ok(ProvingSystemId::GnarkPlonkBn254),
80+
"GnarkGroth16Bn254" => Ok(ProvingSystemId::GnarkGroth16Bn254),
81+
"SP1" => Ok(ProvingSystemId::SP1),
82+
"Risc0" => Ok(ProvingSystemId::Risc0),
83+
"CircomGroth16Bn256" => Ok(ProvingSystemId::CircomGroth16Bn256),
84+
"Mina" => Ok(ProvingSystemId::Mina),
85+
"MinaAccount" => Ok(ProvingSystemId::MinaAccount),
86+
_ => Err(format!("Invalid ProvingSystemId: {}", s)),
87+
}
88+
}
89+
}
90+
7391
#[derive(Debug, Serialize, Deserialize, Clone)]
7492
pub struct VerificationData {
7593
pub proving_system: ProvingSystemId,

0 commit comments

Comments
 (0)