Skip to content

Commit

Permalink
Prio3Sum: Use Field64 (#1159)
Browse files Browse the repository at this point in the history
As of draft 12, Prio3Sum uses Field64 instead of Field128, since we no
longer use joint randomness in the circuit.

Co-authored-by: Michael Rosenberg <[email protected]>
  • Loading branch information
cjpatton and rozbb authored Dec 12, 2024
1 parent 3c1aeb3 commit a200dad
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion benches/cycle_counts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ fn prio3_client_histogram_10() -> Vec<Prio3InputShare<Field128, 16>> {
.1
}

fn prio3_client_sum_32() -> Vec<Prio3InputShare<Field128, 16>> {
fn prio3_client_sum_32() -> Vec<Prio3InputShare<Field64, 16>> {
let bits = 16;
let prio3 = Prio3::new_sum(2, (1 << bits) - 1).unwrap();
let measurement = 1337;
Expand Down
8 changes: 4 additions & 4 deletions src/vdaf/prio3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,14 +140,14 @@ impl Prio3SumVecMultithreaded {

/// The sum type. Each measurement is an integer in `[0,2^bits)` for some `0 < bits < 64` and the
/// aggregate is the sum.
pub type Prio3Sum = Prio3<Sum<Field128>, XofTurboShake128, 16>;
pub type Prio3Sum = Prio3<Sum<Field64>, XofTurboShake128, 16>;

impl Prio3Sum {
/// Construct an instance of `Prio3Sum` with the given number of aggregators, where each summand
/// must be in the range `[0, max_measurement]`. Errors if `max_measurement == 0`.
pub fn new_sum(
num_aggregators: u8,
max_measurement: <Field128 as FieldElementWithInteger>::Integer,
max_measurement: <Field64 as FieldElementWithInteger>::Integer,
) -> Result<Self, VdafError> {
Prio3::new(num_aggregators, 1, 0x00000001, Sum::new(max_measurement)?)
}
Expand Down Expand Up @@ -1711,7 +1711,7 @@ mod tests {

let (public_share, mut input_shares) = prio3.shard(CTX_STR, &1, &nonce).unwrap();
assert_matches!(input_shares[0].measurement_share, Share::Leader(ref mut data) => {
data[0] += Field128::one();
data[0] += Field64::one();
});
let result = run_vdaf_prepare(
&prio3,
Expand All @@ -1726,7 +1726,7 @@ mod tests {

let (public_share, mut input_shares) = prio3.shard(CTX_STR, &1, &nonce).unwrap();
assert_matches!(input_shares[0].proofs_share, Share::Leader(ref mut data) => {
data[0] += Field128::one();
data[0] += Field64::one();
});
let result = run_vdaf_prepare(
&prio3,
Expand Down
2 changes: 1 addition & 1 deletion src/vdaf/prio3_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ mod tests {
#[ignore]
#[test]
fn test_vec_prio3_sum() {
const FAKE_MAX_MEASUREMENT_UPDATE_ME: u128 = 0;
const FAKE_MAX_MEASUREMENT_UPDATE_ME: u64 = 0;
for test_vector_str in [
include_str!("test_vec/08/Prio3Sum_0.json"),
include_str!("test_vec/08/Prio3Sum_1.json"),
Expand Down

0 comments on commit a200dad

Please sign in to comment.