From 75964cf6da129a78bbcabf0c10f9638cb5498fe0 Mon Sep 17 00:00:00 2001 From: Luke Parker Date: Tue, 19 Aug 2025 21:45:59 -0400 Subject: [PATCH] Place Schnorr signature aggregation behind a feature flag --- Cargo.lock | 2 +- coordinator/Cargo.toml | 2 +- crypto/schnorr/Cargo.toml | 3 ++- crypto/schnorr/src/lib.rs | 1 + crypto/schnorr/src/tests/mod.rs | 9 +++++---- 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6cef2eab..91e51d24 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7845,7 +7845,7 @@ dependencies = [ [[package]] name = "schnorr-signatures" -version = "0.5.1" +version = "0.5.2" dependencies = [ "ciphersuite", "dalek-ff-group", diff --git a/coordinator/Cargo.toml b/coordinator/Cargo.toml index 1067fbb0..aa1c489d 100644 --- a/coordinator/Cargo.toml +++ b/coordinator/Cargo.toml @@ -26,7 +26,7 @@ blake2 = { version = "0.10", default-features = false, features = ["std"] } transcript = { package = "flexible-transcript", path = "../crypto/transcript", default-features = false, features = ["std", "recommended"] } ciphersuite = { path = "../crypto/ciphersuite", default-features = false, features = ["std"] } -schnorr = { package = "schnorr-signatures", path = "../crypto/schnorr", default-features = false, features = ["std"] } +schnorr = { package = "schnorr-signatures", path = "../crypto/schnorr", default-features = false, features = ["std", "aggregate"] } dkg-musig = { path = "../crypto/dkg/musig", default-features = false, features = ["std"] } frost = { package = "modular-frost", path = "../crypto/frost" } frost-schnorrkel = { path = "../crypto/schnorrkel" } diff --git a/crypto/schnorr/Cargo.toml b/crypto/schnorr/Cargo.toml index 2ea04f5b..8cc11325 100644 --- a/crypto/schnorr/Cargo.toml +++ b/crypto/schnorr/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "schnorr-signatures" -version = "0.5.1" +version = "0.5.2" description = "Minimal Schnorr signatures crate hosting common code" license = "MIT" repository = "https://github.com/serai-dex/serai/tree/develop/crypto/schnorr" @@ -39,5 +39,6 @@ dalek-ff-group = { path = "../dalek-ff-group" } ciphersuite = { path = "../ciphersuite", features = ["ed25519"] } [features] +aggregate = [] std = ["std-shims/std", "rand_core/std", "zeroize/std", "transcript/std", "ciphersuite/std", "multiexp/std"] default = ["std"] diff --git a/crypto/schnorr/src/lib.rs b/crypto/schnorr/src/lib.rs index ecca87f7..e5b9f3c2 100644 --- a/crypto/schnorr/src/lib.rs +++ b/crypto/schnorr/src/lib.rs @@ -25,6 +25,7 @@ use ciphersuite::{ use multiexp::{multiexp_vartime, BatchVerifier}; /// Half-aggregation from . +#[cfg(feature = "aggregate")] pub mod aggregate; #[cfg(test)] diff --git a/crypto/schnorr/src/tests/mod.rs b/crypto/schnorr/src/tests/mod.rs index 47bd9bc3..97d569db 100644 --- a/crypto/schnorr/src/tests/mod.rs +++ b/crypto/schnorr/src/tests/mod.rs @@ -9,10 +9,9 @@ use ciphersuite::{ }; use multiexp::BatchVerifier; -use crate::{ - SchnorrSignature, - aggregate::{SchnorrAggregator, SchnorrAggregate}, -}; +use crate::SchnorrSignature; +#[cfg(feature = "aggregate")] +use crate::aggregate::{SchnorrAggregator, SchnorrAggregate}; mod rfc8032; @@ -77,6 +76,7 @@ pub(crate) fn batch_verify() { } } +#[cfg(feature = "aggregate")] pub(crate) fn aggregate() { const DST: &[u8] = b"Schnorr Aggregator Test"; @@ -117,5 +117,6 @@ fn test() { sign::(); verify::(); batch_verify::(); + #[cfg(feature = "aggregate")] aggregate::(); }