From 568753e21bb2274ff04e86005ec0d392f47de67e Mon Sep 17 00:00:00 2001 From: Alex Koshelev Date: Tue, 22 Oct 2024 20:41:17 -0700 Subject: [PATCH] Fix compact gate build errors This fixes #1301 and cleans up assertions --- ipa-core/Cargo.toml | 8 ++++---- ipa-core/build.rs | 2 +- ipa-core/src/protocol/ipa_prf/mod.rs | 2 +- ipa-core/src/report/hybrid.rs | 9 ++------- 4 files changed, 8 insertions(+), 13 deletions(-) diff --git a/ipa-core/Cargo.toml b/ipa-core/Cargo.toml index 0081a0a50..f70b31bfe 100644 --- a/ipa-core/Cargo.toml +++ b/ipa-core/Cargo.toml @@ -16,11 +16,12 @@ default = [ "stall-detection", "aggregate-circuit", "ipa-prf", - "ipa-step/string-step", + "string-step", ] 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 = [] +string-step = ["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 +83,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..8acd772ea 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 = "string-step") }, 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(), }