Skip to content

Commit 7e6c683

Browse files
committed
Add build script to STM
It will automatically detect WASM compilation and will deactivate batch verification of aggregates, provided by BLST, which is not available in WASM.
1 parent e1c36ba commit 7e6c683

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

mithril-stm/build.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
use std::env;
2+
3+
fn main() {
4+
let target_arch = env::var("CARGO_CFG_TARGET_ARCH").unwrap();
5+
let target_no_batch_verify_aggregates =
6+
target_arch.eq("wasm32") || env::var("STM_TEST_NO_BATCH_VERIFY_AGGREGATES").is_ok();
7+
8+
if !target_no_batch_verify_aggregates {
9+
println!("cargo:rustc-cfg=feature=\"batch-verify-aggregates\"");
10+
}
11+
}

mithril-stm/src/multi_sig.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,7 @@ impl Signature {
404404
}
405405

406406
/// Batch verify several sets of signatures with their corresponding verification keys.
407+
#[cfg(feature = "batch-verify-aggregates")]
407408
pub fn batch_verify_aggregates(
408409
msgs: &[Vec<u8>],
409410
vks: &[VerificationKey],

mithril-stm/src/stm.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -789,6 +789,7 @@ impl<D: Clone + Digest + FixedOutput + Send + Sync> StmAggrSig<D> {
789789
}
790790

791791
/// Batch verify a set of signatures, with different messages and avks.
792+
#[cfg(feature = "batch-verify-aggregates")]
792793
pub fn batch_verify(
793794
stm_signatures: &[Self],
794795
msgs: &[Vec<u8>],

0 commit comments

Comments
 (0)