Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add test to show that IPA fails for cap 1, 2, 3, and 4 #1346

Merged
merged 2 commits into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion ipa-core/src/query/runner/oprf_ipa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,13 +147,15 @@ where
#[cfg(not(feature = "relaxed-dp"))]
let padding_params = PaddingParameters::default();
match config.per_user_credit_cap {
1 => oprf_ipa::<_, BA8, BA3, HV, BA20, 1, 256>(ctx, input, aws, dp_params, padding_params).await,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using BA3 for trigger values with cap 1 is gross, but the input is assumed to be fixed size, so it is a much bigger change to make if we want it

2 | 4 => oprf_ipa::<_, BA8, BA3, HV, BA20, 2, 256>(ctx, input, aws, dp_params, padding_params).await,
8 => oprf_ipa::<_, BA8, BA3, HV, BA20, 3, 256>(ctx, input, aws, dp_params, padding_params).await,
16 => oprf_ipa::<_, BA8, BA3, HV, BA20, 4, 256>(ctx, input, aws, dp_params, padding_params).await,
32 => oprf_ipa::<_, BA8, BA3, HV, BA20, 5, 256>(ctx, input, aws, dp_params, padding_params).await,
64 => oprf_ipa::<_, BA8, BA3, HV, BA20, 6, 256>(ctx, input, aws, dp_params, padding_params).await,
128 => oprf_ipa::<_, BA8, BA3, HV, BA20, 7, 256>(ctx, input, aws, dp_params, padding_params).await,
_ => panic!(
"Invalid value specified for per-user cap: {:?}. Must be one of 8, 16, 32, 64, or 128.",
"Invalid value specified for per-user cap: {:?}. Must be one of 1, 2, 4, 8, 16, 32, 64, or 128.",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know why we picked cap sizes to be a power of two, but I tried to stick with the same approach.

@eriktaubeneck, @shinta-liem would that be sufficient for in-market test to support cap of 1, 2 and 4?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, that's plenty sufficient

config.per_user_credit_cap
),
}
Expand Down
15 changes: 15 additions & 0 deletions ipa-core/tests/compact_gate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,21 @@ fn compact_gate_cap_8_no_window_semi_honest_encryped_input() {
test_compact_gate(IpaSecurityModel::SemiHonest, 8, 0, true);
}

#[test]
fn compact_gate_cap_1_no_window_semi_honest_encryped_input() {
test_compact_gate(IpaSecurityModel::SemiHonest, 1, 0, true);
}

#[test]
fn compact_gate_cap_2_no_window_semi_honest_encryped_input() {
test_compact_gate(IpaSecurityModel::SemiHonest, 2, 0, true);
}

#[test]
fn compact_gate_cap_4_no_window_semi_honest_encryped_input() {
test_compact_gate(IpaSecurityModel::SemiHonest, 4, 0, true);
}

#[test]
fn compact_gate_cap_8_no_window_semi_honest_plaintext_input() {
test_compact_gate(IpaSecurityModel::SemiHonest, 8, 0, false);
Expand Down