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

Prio3Sum: Use Field64 #1159

Merged
merged 1 commit into from
Dec 12, 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
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
Loading