diff --git a/ipa-core/Cargo.toml b/ipa-core/Cargo.toml index 0081a0a50..3faa2b95e 100644 --- a/ipa-core/Cargo.toml +++ b/ipa-core/Cargo.toml @@ -16,11 +16,14 @@ default = [ "stall-detection", "aggregate-circuit", "ipa-prf", - "ipa-step/string-step", + "descriptive-gate", ] cli = ["comfy-table", "clap"] -# Enabling compact gates disables any tests that rely on descriptive gates. -compact-gate = ["ipa-step/string-step"] +# Enable compact gate optimization +compact-gate = [] +# mutually exclusive with compact-gate and disables compact gate optimization. +# It is enabled by default +descriptive-gate = ["ipa-step/string-step"] disable-metrics = [] # TODO move web-app to a separate crate. It adds a lot of build time to people who mostly write protocols # TODO Consider moving out benches as well @@ -82,7 +85,6 @@ ipa-step = { version = "*", path = "../ipa-step" } ipa-step-derive = { version = "*", path = "../ipa-step-derive" } aes = "0.8.3" -assertions = "0.1.0" async-trait = "0.1.79" async-scoped = { version = "0.9.0", features = ["use-tokio"], optional = true } axum = { version = "0.7.5", optional = true, features = ["http2", "macros"] } diff --git a/ipa-core/build.rs b/ipa-core/build.rs index 768dc5040..ce1987c72 100644 --- a/ipa-core/build.rs +++ b/ipa-core/build.rs @@ -44,7 +44,7 @@ fn main() { // https://docs.rs/tectonic_cfg_support/latest/tectonic_cfg_support/struct.TargetConfiguration.html cfg_aliases! { compact_gate: { feature = "compact-gate" }, - descriptive_gate: { not(compact_gate) }, + descriptive_gate: { all(not(feature = "compact-gate"), feature = "descriptive-gate") }, unit_test: { all(not(feature = "shuttle"), feature = "in-memory-infra", descriptive_gate) }, web_test: { all(not(feature = "shuttle"), feature = "real-world-infra") }, } diff --git a/ipa-core/src/protocol/ipa_prf/mod.rs b/ipa-core/src/protocol/ipa_prf/mod.rs index 9626731e4..3c6cddb61 100644 --- a/ipa-core/src/protocol/ipa_prf/mod.rs +++ b/ipa-core/src/protocol/ipa_prf/mod.rs @@ -733,7 +733,7 @@ pub mod tests { } } -#[cfg(all(test, all(feature = "compact-gate", feature = "in-memory-infra")))] +#[cfg(all(test, all(compact_gate, feature = "in-memory-infra")))] mod compact_gate_tests { use ipa_step::{CompactStep, StepNarrow}; diff --git a/ipa-core/src/report/hybrid.rs b/ipa-core/src/report/hybrid.rs index 0956495ae..81f1f1b6d 100644 --- a/ipa-core/src/report/hybrid.rs +++ b/ipa-core/src/report/hybrid.rs @@ -5,7 +5,6 @@ use std::{ ops::{Add, Deref}, }; -use assertions::const_assert; use bytes::{BufMut, Bytes}; use generic_array::{ArrayLength, GenericArray}; use hpke::Serializable as _; @@ -13,6 +12,7 @@ use rand_core::{CryptoRng, RngCore}; use typenum::{Sum, Unsigned, U16}; use crate::{ + const_assert_eq, error::{BoxError, Error}, ff::{boolean_array::BA64, Serializable}, hpke::{ @@ -407,14 +407,9 @@ impl UniqueBytes for EncryptedHybridReport { } impl UniqueTag { - fn _compile_check() { - // This will vaild at compile time if TAG_SIZE doesn't match U16 - // the macro expansion needs to be wrapped in a function - const_assert!(TAG_SIZE == 16); - } - // Function to attempt to create a UniqueTag from a UniqueBytes implementor pub fn from_unique_bytes(item: &T) -> Self { + const_assert_eq!(16, TAG_SIZE); UniqueTag { bytes: item.unique_bytes(), } diff --git a/scripts/coverage-ci b/scripts/coverage-ci index c652e9f65..6f79c7599 100755 --- a/scripts/coverage-ci +++ b/scripts/coverage-ci @@ -14,8 +14,7 @@ cargo test --features "cli test-fixture relaxed-dp" # Provide code coverage stats for ipa-metrics crate with partitions enabled cargo test -p ipa-metrics --features "partitions" -# descriptive-gate does not require a feature flag. -for gate in "compact-gate" ""; do +for gate in "compact-gate" "descriptive-gate"; do cargo test --no-default-features --features "cli web-app real-world-infra test-fixture $gate" done