Skip to content

Commit

Permalink
use BA32 instead of BA16 for hybrid histogram values
Browse files Browse the repository at this point in the history
  • Loading branch information
eriktaubeneck committed Dec 7, 2024
1 parent b27a4b3 commit 76f20a3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 15 deletions.
9 changes: 3 additions & 6 deletions ipa-core/src/bin/report_collector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,7 @@ use ipa_core::{
CsvSerializer, IpaQueryResult, Verbosity,
},
config::{KeyRegistries, NetworkConfig},
ff::{
boolean_array::{BA16, BA32},
FieldType,
},
ff::{boolean_array::BA32, FieldType},
helpers::{
query::{
DpMechanism, HybridQueryParams, IpaQueryConfig, QueryConfig, QuerySize, QueryType,
Expand Down Expand Up @@ -465,10 +462,10 @@ async fn hybrid(

tracing::info!("Starting query for OPRF");

// the value for histogram values (BA16) must be kept in sync with the server-side
// the value for histogram values (BA32) must be kept in sync with the server-side
// implementation, otherwise a runtime reconstruct error will be generated.
// see ipa-core/src/query/executor.rs
let actual = run_hybrid_query_and_validate::<BA16>(
let actual = run_hybrid_query_and_validate::<BA32>(

Check warning on line 468 in ipa-core/src/bin/report_collector.rs

View check run for this annotation

Codecov / codecov/patch

ipa-core/src/bin/report_collector.rs#L468

Added line #L468 was not covered by tests
submissions,
count,
helper_clients,
Expand Down
12 changes: 6 additions & 6 deletions ipa-core/src/query/runner/hybrid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use crate::{
error::{Error, LengthError},
ff::{
boolean::Boolean,
boolean_array::{BooleanArray, BA16, BA3, BA8},
boolean_array::{BooleanArray, BA3, BA32, BA8},
curve_points::RP25519,
ec_prime_field::Fp25519,
Serializable, U128Conversions,
Expand Down Expand Up @@ -190,7 +190,7 @@ pub async fn execute_hybrid_protocol<'a, R: PrivateKeyRegistry>(
let ctx = ShardedMaliciousContext::new_with_gate(prss, gateway, gate, sharded);

Ok(Box::new(
Query::<_, BA16, R>::new(ipa_config, key_registry)
Query::<_, BA32, R>::new(ipa_config, key_registry)

Check warning on line 193 in ipa-core/src/query/runner/hybrid.rs

View check run for this annotation

Codecov / codecov/patch

ipa-core/src/query/runner/hybrid.rs#L193

Added line #L193 was not covered by tests
.execute(ctx, config.size, input)
.await?,
))
Expand All @@ -208,7 +208,7 @@ mod tests {

use crate::{
ff::{
boolean_array::{BA16, BA3, BA8},
boolean_array::{BA3, BA32, BA8},
U128Conversions,
},
helpers::{
Expand Down Expand Up @@ -310,7 +310,7 @@ mod tests {
};
let input = BodyStream::from(buffer);

HybridQuery::<_, BA16, KeyRegistry<KeyPair>>::new(
HybridQuery::<_, BA32, KeyRegistry<KeyPair>>::new(
query_params,
Arc::clone(&key_registry),
)
Expand Down Expand Up @@ -393,7 +393,7 @@ mod tests {
let query_params = HybridQueryParams::default();
let input = BodyStream::from(buffer);

HybridQuery::<_, BA16, KeyRegistry<KeyPair>>::new(
HybridQuery::<_, BA32, KeyRegistry<KeyPair>>::new(
query_params,
Arc::clone(&key_registry),
)
Expand Down Expand Up @@ -439,7 +439,7 @@ mod tests {
};
let input = BodyStream::from(buffer);

HybridQuery::<_, BA16, KeyRegistry<KeyPair>>::new(
HybridQuery::<_, BA32, KeyRegistry<KeyPair>>::new(
query_params,
Arc::clone(&key_registry),
)
Expand Down
4 changes: 1 addition & 3 deletions ipa-core/src/secret_sharing/vector/transpose.rs
Original file line number Diff line number Diff line change
Expand Up @@ -674,9 +674,6 @@ macro_rules! impl_transpose_shares_ba_to_bool {
// Usage: Share conversion input (convert_to_fp25519 test). M = CONV_CHUNK, N = MK_BITS.
impl_transpose_shares_ba_to_bool!(BA64, 256, 64, test_transpose_shares_ba_to_bool_256x64);

// Usage: Quicksort. M = SORT_CHUNK, N = sort key bits.
impl_transpose_shares_ba_to_bool!(BA32, 256, 32, test_transpose_shares_ba_to_bool_256x32);

/// Implement a transpose of a MxN matrix of secret-shared bits accessed via
/// `Fn(usize) -> AdditiveShare<BA{N}>` into a NxM bit matrix represented as `[AdditiveShare<Boolean, M>; N]`.
///
Expand Down Expand Up @@ -786,6 +783,7 @@ macro_rules! impl_transpose_shares_ba_to_bool_small {
// Dimensions: Arbitrary (rows are padded to whole bytes).

// Usage: Aggregation input. M = AGG_CHUNK, N = BK or TV bits.
impl_transpose_shares_ba_to_bool_small!(BA32, 256, 32, test_transpose_shares_ba_to_bool_256x32); // Addtional Usage: Quicksort. M = SORT_CHUNK, N = sort key bits.
impl_transpose_shares_ba_to_bool_small!(BA16, 256, 16, test_transpose_shares_ba_to_bool_256x16);
impl_transpose_shares_ba_to_bool_small!(BA8, 256, 8, test_transpose_shares_ba_to_bool_256x8);
impl_transpose_shares_ba_to_bool_small!(BA5, 256, 5, test_transpose_shares_ba_to_bool_256x5);
Expand Down

0 comments on commit 76f20a3

Please sign in to comment.