Skip to content

Commit

Permalink
Add build script to STM
Browse files Browse the repository at this point in the history
It will automatically detect WASM compilation and will deactivate batch verification
of aggregates, provided by BLST, which is not available in WASM.
  • Loading branch information
jpraynaud committed Oct 10, 2023
1 parent e1c36ba commit 7e6c683
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
11 changes: 11 additions & 0 deletions mithril-stm/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
use std::env;

fn main() {
let target_arch = env::var("CARGO_CFG_TARGET_ARCH").unwrap();
let target_no_batch_verify_aggregates =
target_arch.eq("wasm32") || env::var("STM_TEST_NO_BATCH_VERIFY_AGGREGATES").is_ok();

if !target_no_batch_verify_aggregates {
println!("cargo:rustc-cfg=feature=\"batch-verify-aggregates\"");
}
}
1 change: 1 addition & 0 deletions mithril-stm/src/multi_sig.rs
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,7 @@ impl Signature {
}

/// Batch verify several sets of signatures with their corresponding verification keys.
#[cfg(feature = "batch-verify-aggregates")]
pub fn batch_verify_aggregates(
msgs: &[Vec<u8>],
vks: &[VerificationKey],
Expand Down
1 change: 1 addition & 0 deletions mithril-stm/src/stm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -789,6 +789,7 @@ impl<D: Clone + Digest + FixedOutput + Send + Sync> StmAggrSig<D> {
}

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

0 comments on commit 7e6c683

Please sign in to comment.