Skip to content

Commit

Permalink
Fix compact gate build errors
Browse files Browse the repository at this point in the history
This fixes private-attribution#1301 and cleans up assertions
  • Loading branch information
akoshelev committed Oct 23, 2024
1 parent ebb5556 commit 568753e
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 13 deletions.
8 changes: 4 additions & 4 deletions ipa-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"] }
Expand Down
2 changes: 1 addition & 1 deletion ipa-core/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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") },
}
Expand Down
2 changes: 1 addition & 1 deletion ipa-core/src/protocol/ipa_prf/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down
9 changes: 2 additions & 7 deletions ipa-core/src/report/hybrid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ use std::{
ops::{Add, Deref},
};

use assertions::const_assert;
use bytes::{BufMut, Bytes};
use generic_array::{ArrayLength, GenericArray};
use hpke::Serializable as _;
use rand_core::{CryptoRng, RngCore};
use typenum::{Sum, Unsigned, U16};

use crate::{
const_assert_eq,
error::{BoxError, Error},
ff::{boolean_array::BA64, Serializable},
hpke::{
Expand Down Expand Up @@ -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<T: UniqueBytes>(item: &T) -> Self {
const_assert_eq!(16, TAG_SIZE);
UniqueTag {
bytes: item.unique_bytes(),
}
Expand Down

0 comments on commit 568753e

Please sign in to comment.