From 23b9e4d48a6d98028fb7218e585fd633fa442014 Mon Sep 17 00:00:00 2001 From: aniampio Date: Wed, 3 Aug 2022 18:58:52 +0100 Subject: [PATCH] Update benchmarks --- .../benches/benchmarks.rs | 2 +- .../benches/benchmarks.rs | 24 +++++++++++++++---- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/common/nym_offline_compact_ecash/benches/benchmarks.rs b/common/nym_offline_compact_ecash/benches/benchmarks.rs index 0c4ee3c929..1975f4fd17 100644 --- a/common/nym_offline_compact_ecash/benches/benchmarks.rs +++ b/common/nym_offline_compact_ecash/benches/benchmarks.rs @@ -220,7 +220,7 @@ fn bench_compact_ecash(c: &mut Criterion) { let vk = verification_keys_auth.get(0).clone().unwrap(); group.bench_function( &format!("[Client] issue_verify_a_partial_wallet_with_L_{}", case.L, ), - |b| b.iter(|| issue_verify(&grp, vk, &user_keypair.secret_key(), w, &req_info)), + |b| b.iter(|| issue_verify(&grp, vk, &user_keypair.secret_key(), w, &req_info).unwrap()), ); let unblinded_wallet_shares: Vec = izip!( diff --git a/common/nym_offline_divisible_ecash/benches/benchmarks.rs b/common/nym_offline_divisible_ecash/benches/benchmarks.rs index 1c563b2c4f..02cf30fc41 100644 --- a/common/nym_offline_divisible_ecash/benches/benchmarks.rs +++ b/common/nym_offline_divisible_ecash/benches/benchmarks.rs @@ -6,6 +6,7 @@ use bls12_381::{G1Affine, G1Projective, G2Affine, G2Prepared, G2Projective, Gt, use criterion::{Criterion, criterion_group, criterion_main}; use ff::Field; use group::{Curve, Group}; +use itertools::izip; use rand::seq::SliceRandom; use rand::thread_rng; @@ -218,7 +219,7 @@ fn bench_divisible_ecash(c: &mut Criterion) { ); - let mut partial_wallets = Vec::new(); + let mut wallet_blinded_signatures = Vec::new(); for auth_keypair in authorities_keypairs { let blind_signature = issue( ¶ms, @@ -226,10 +227,25 @@ fn bench_divisible_ecash(c: &mut Criterion) { pk_user.clone(), &auth_keypair.secret_key(), ).unwrap(); - let partial_wallet = issue_verify(&grp, &auth_keypair.verification_key(), &sk_user, &blind_signature, &req_info).unwrap(); - partial_wallets.push(partial_wallet); + wallet_blinded_signatures.push(blind_signature); } + // CLIENT BENCHMARK: verify the issued partial wallet + let w = wallet_blinded_signatures.get(0).clone().unwrap(); + let vk = verification_keys_auth.get(0).clone().unwrap(); + group.bench_function( + &format!("[Client] issue_verify_a_partial_wallet_with_L_{}", case.L, ), + |b| b.iter(|| issue_verify(&grp, vk, &sk_user, w, &req_info).unwrap()), + ); + + let partial_wallets: Vec = izip!( + wallet_blinded_signatures.iter(), + verification_keys_auth.iter() + ) + .map(|(w, vk)| issue_verify(&grp, &vk, &sk_user, &w, &req_info).unwrap()) + .collect(); + + // AGGREGATE WALLET let mut wallet = aggregate_wallets(&grp, &verification_key, &sk_user, &partial_wallets).unwrap(); @@ -306,5 +322,5 @@ fn bench_divisible_ecash(c: &mut Criterion) { assert_eq!(identify_result, IdentifyResult::DoubleSpendingPublicKeys(pk_user)); } -criterion_group!(benches, bench_divisible_ecash); +criterion_group!(benches, bench_pairings, bench_divisible_ecash); criterion_main!(benches); \ No newline at end of file