From 0f4ef715995d72b1f24dd3ad65ef37ef59e4e9c1 Mon Sep 17 00:00:00 2001 From: Tom French Date: Mon, 3 Apr 2023 10:14:51 +0100 Subject: [PATCH 1/3] fix: correct feature flag names when testing mutual exclusivity --- crates/nargo/src/backends.rs | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/crates/nargo/src/backends.rs b/crates/nargo/src/backends.rs index 85e94edda82..ea5aec4c576 100644 --- a/crates/nargo/src/backends.rs +++ b/crates/nargo/src/backends.rs @@ -10,6 +10,17 @@ cfg_if::cfg_if! { compile_error!("please specify a backend to compile with"); } } -// XXX: This works because there are only two features, we want to say only one of these can be enabled. (feature xor) -#[cfg(all(feature = "plonk", feature = "marlin"))] -compile_error!("feature \"plonk\" and feature \"marlin\" cannot be enabled at the same time"); + +// As we have 3 feature flags we must test all 3 potential pairings to ensure they're mutually exclusive. +#[cfg(all(feature = "plonk_bn254", feature = "plonk_bn254_wasm"))] +compile_error!( + "feature \"plonk_bn254\" and feature \"plonk_bn254_wasm\" cannot be enabled at the same time" +); +#[cfg(all(feature = "plonk_bn254_wasm", feature = "marlin"))] +compile_error!( + "feature \"plonk_bn254_wasm\" and feature \"marlin\" cannot be enabled at the same time" +); +#[cfg(all(feature = "plonk_bn254", feature = "marlin"))] +compile_error!( + "feature \"plonk_bn254\" and feature \"marlin\" cannot be enabled at the same time" +); From 31fa30501b4d40a4c694599704f69e564881ac5f Mon Sep 17 00:00:00 2001 From: Tom French Date: Mon, 3 Apr 2023 10:16:46 +0100 Subject: [PATCH 2/3] chore: remove default feature from `nargo` --- crates/nargo/Cargo.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/crates/nargo/Cargo.toml b/crates/nargo/Cargo.toml index 1cf42c9ad22..30b8c06a8da 100644 --- a/crates/nargo/Cargo.toml +++ b/crates/nargo/Cargo.toml @@ -22,7 +22,6 @@ aztec_wasm_backend = { optional = true, package = "barretenberg_wasm", git = "ht marlin_arkworks_backend = { optional = true, git = "https://github.com/noir-lang/marlin_arkworks_backend", rev = "144378edad821bfaa52bf2cacca8ecc87514a4fc" } [features] -default = ["plonk_bn254"] # The plonk backend can only use bn254, so we do not specify the field plonk_bn254 = ["aztec_backend"] marlin = ["marlin_arkworks_backend/bls12_381"] From 3516f2c094b4e3f6d9a63f13287b89a5b375e3f1 Mon Sep 17 00:00:00 2001 From: Tom French Date: Mon, 3 Apr 2023 17:18:06 +0100 Subject: [PATCH 3/3] chore: revert removal of default feature flag --- crates/nargo/Cargo.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/crates/nargo/Cargo.toml b/crates/nargo/Cargo.toml index 30b8c06a8da..1cf42c9ad22 100644 --- a/crates/nargo/Cargo.toml +++ b/crates/nargo/Cargo.toml @@ -22,6 +22,7 @@ aztec_wasm_backend = { optional = true, package = "barretenberg_wasm", git = "ht marlin_arkworks_backend = { optional = true, git = "https://github.com/noir-lang/marlin_arkworks_backend", rev = "144378edad821bfaa52bf2cacca8ecc87514a4fc" } [features] +default = ["plonk_bn254"] # The plonk backend can only use bn254, so we do not specify the field plonk_bn254 = ["aztec_backend"] marlin = ["marlin_arkworks_backend/bls12_381"]