Skip to content

Commit

Permalink
a step closer
Browse files Browse the repository at this point in the history
  • Loading branch information
benjaminsavage committed Nov 1, 2023
1 parent 942700e commit 8107744
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 31 deletions.
31 changes: 0 additions & 31 deletions src/protocol/prf_sharding/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -363,32 +363,6 @@ where
})
}

// fn chunk_rows_by_user<BK, TV, TS>(
// input_rows: Vec<PrfShardedIpaInputRow<BK, TV, TS>>,
// ) -> Vec<Vec<PrfShardedIpaInputRow<BK, TV, TS>>>
// where
// BK: GaloisField,
// TV: GaloisField,
// TS: GaloisField,
// {
// let mut rows_for_user: Vec<PrfShardedIpaInputRow<BK, TV, TS>> = vec![];

// let mut rows_chunked_by_user = vec![];
// for row in input_rows {
// if rows_for_user.is_empty() || row.prf_of_match_key == rows_for_user[0].prf_of_match_key {
// rows_for_user.push(row);
// } else {
// rows_chunked_by_user.push(rows_for_user);
// rows_for_user = vec![row];
// }
// }
// if !rows_for_user.is_empty() {
// rows_chunked_by_user.push(rows_for_user);
// }

// rows_chunked_by_user
// }

/// Sub-protocol of the PRF-sharded IPA Protocol
///
/// After the computation of the per-user PRF, addition of dummy records and shuffling,
Expand Down Expand Up @@ -485,13 +459,8 @@ where
0..BK::BITS + TV::BITS,
);

// transform value bits to large field
// let large_field_values = converted_values
// .map(|val| BitDecomposed::to_additive_sharing_in_large_field_consuming(val.unwrap()));

// move each value to the correct bucket
let row_contributions_stream = converted_bks_and_tvs
// .zip(large_field_values)
.zip(futures::stream::repeat(
prime_field_ctx.narrow(&Step::MoveValueToCorrectBreakdown)
.set_total_records(num_outputs),
Expand Down
13 changes: 13 additions & 0 deletions src/query/runner/oprf_ipa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,18 @@ where
panic!("Encrypted match key handling is not handled for OPRF flow as yet");
};

let mut histogram = vec![];
let mut last_prf = input[0].mk_oprf + 1;
let mut cur_count = 0;
for row in input {
if row.mk_oprf != last_prf {
cur_count = 0;
} else {
cur_count += 1;
}
histogram[cur_count] += 1;
}

// TODO: Compute OPRFs and shuffle and add dummies and stuff (Daniel's code will be called here)
let sharded_input = input
.into_iter()
Expand Down Expand Up @@ -110,6 +122,7 @@ where
sharded_input,
user_cap.ilog2().try_into().unwrap(),
config.attribution_window_seconds,
&histogram,
)
.await
}
Expand Down

0 comments on commit 8107744

Please sign in to comment.