Skip to content

Commit

Permalink
Print FLP, JR, and nonce sizes
Browse files Browse the repository at this point in the history
  • Loading branch information
jimouris committed Jan 30, 2024
1 parent 1864211 commit 11e6f2c
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions src/bin/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ fn generate_keys(
fn generate_randomness(
keys: (&Vec<VidpfKey>, &Vec<VidpfKey>),
) -> (Vec<[u8; 16]>, Vec<[[u8; 16]; 2]>) {
keys.0
let (nonces, jr_parts): (Vec<[u8; 16]>, Vec<[[u8; 16]; 2]>) = keys
.0
.par_iter()
.zip(keys.1.par_iter())
.map(|(key_0, key_1)| {
Expand All @@ -92,15 +93,22 @@ fn generate_randomness(

(nonce, jr_parts)
})
.unzip()
.unzip();

let encoded: Vec<u8> = bincode::serialize(&nonces[0]).unwrap();
println!("Nonce size: {:?} bytes", encoded.len());
let encoded: Vec<u8> = bincode::serialize(&jr_parts[0]).unwrap();
println!("JR size: {:?} bytes", encoded.len());

(nonces, jr_parts)
}

fn generate_proofs(
typ: &Count<Field64>,
beta_values: &Vec<Vec<Field64>>,
all_jr_parts: &Vec<[[u8; 16]; 2]>,
) -> (Vec<Vec<Field64>>, Vec<Vec<Field64>>) {
all_jr_parts
let (proofs_0, proofs_1): (Vec<Vec<Field64>>, Vec<Vec<Field64>>) = all_jr_parts
.par_iter()
.zip_eq(beta_values.par_iter())
.map(|(jr_parts, input_beta)| {
Expand All @@ -124,7 +132,12 @@ fn generate_proofs(

(proof_0, proof_1)
})
.unzip()
.unzip();

let encoded: Vec<u8> = bincode::serialize(&proofs_0[0]).unwrap();
println!("FLP proof size: {:?} bytes", encoded.len());

(proofs_0, proofs_1)
}

async fn reset_servers(
Expand Down

0 comments on commit 11e6f2c

Please sign in to comment.