From 268a1817abbc92ce1f5d78691c4c5f736b2a43eb Mon Sep 17 00:00:00 2001 From: aniampio Date: Wed, 10 Aug 2022 18:57:00 +0100 Subject: [PATCH] Remove spend verification from the identify function --- common/nym_offline_compact_ecash/benches/benchmarks.rs | 5 +++-- common/nym_offline_compact_ecash/src/scheme/identify.rs | 4 ---- common/nym_offline_divisible_ecash/benches/benchmarks.rs | 5 +++-- .../nym_offline_divisible_ecash/src/scheme/identification.rs | 4 ---- 4 files changed, 6 insertions(+), 12 deletions(-) diff --git a/common/nym_offline_compact_ecash/benches/benchmarks.rs b/common/nym_offline_compact_ecash/benches/benchmarks.rs index 1975f4fd17..df2c3545b1 100644 --- a/common/nym_offline_compact_ecash/benches/benchmarks.rs +++ b/common/nym_offline_compact_ecash/benches/benchmarks.rs @@ -152,7 +152,8 @@ struct BenchCase { fn bench_compact_ecash(c: &mut Criterion) { let mut group = c.benchmark_group("benchmark-compact-ecash"); - group.measurement_time(Duration::from_secs(200)); + group.sample_size(300); + group.measurement_time(Duration::from_secs(1500)); let case = BenchCase { num_authorities: 100, @@ -353,5 +354,5 @@ fn bench_compact_ecash(c: &mut Criterion) { assert_eq!(identify_result, IdentifyResult::DoubleSpendingPublicKeys(user_keypair.public_key())); } -criterion_group!(benches, bench_pairings, bench_compact_ecash); +criterion_group!(benches, bench_compact_ecash); criterion_main!(benches); diff --git a/common/nym_offline_compact_ecash/src/scheme/identify.rs b/common/nym_offline_compact_ecash/src/scheme/identify.rs index 7b4deaed14..e3b7630ae8 100644 --- a/common/nym_offline_compact_ecash/src/scheme/identify.rs +++ b/common/nym_offline_compact_ecash/src/scheme/identify.rs @@ -13,10 +13,6 @@ pub enum IdentifyResult { pub fn identify(params: &Parameters, public_keys_u: &[PublicKeyUser], verification_key: &VerificationKeyAuth, payment1: Payment, payment2: Payment, pay_info1: PayInfo, pay_info2: PayInfo) -> Result { - // verify first the validity of both payments - assert!(payment1.spend_verify(¶ms, &verification_key, &pay_info1).unwrap()); - assert!(payment2.spend_verify(¶ms, &verification_key, &pay_info2).unwrap()); - let mut k = 0; let mut j = 0; 'outer: for (id1, pay1_ss) in payment1.ss.iter().enumerate() { diff --git a/common/nym_offline_divisible_ecash/benches/benchmarks.rs b/common/nym_offline_divisible_ecash/benches/benchmarks.rs index 02cf30fc41..ee2b3cadc4 100644 --- a/common/nym_offline_divisible_ecash/benches/benchmarks.rs +++ b/common/nym_offline_divisible_ecash/benches/benchmarks.rs @@ -149,7 +149,8 @@ struct BenchCase { fn bench_divisible_ecash(c: &mut Criterion) { let mut group = c.benchmark_group("benchmark-divisible-ecash"); - group.measurement_time(Duration::from_secs(200)); + group.sample_size(300); + group.measurement_time(Duration::from_secs(1500)); let case = BenchCase { num_authorities: 100, @@ -322,5 +323,5 @@ fn bench_divisible_ecash(c: &mut Criterion) { assert_eq!(identify_result, IdentifyResult::DoubleSpendingPublicKeys(pk_user)); } -criterion_group!(benches, bench_pairings, bench_divisible_ecash); +criterion_group!(benches, bench_divisible_ecash); criterion_main!(benches); \ No newline at end of file diff --git a/common/nym_offline_divisible_ecash/src/scheme/identification.rs b/common/nym_offline_divisible_ecash/src/scheme/identification.rs index 237971a095..4c1fa882b7 100644 --- a/common/nym_offline_divisible_ecash/src/scheme/identification.rs +++ b/common/nym_offline_divisible_ecash/src/scheme/identification.rs @@ -27,10 +27,6 @@ pub fn identify( payment2: Payment, pay_info1: PayInfo, pay_info2: PayInfo) -> Result { - // verify first the validity of both payments - assert!(payment1.spend_verify(¶ms, &verification_key, &pay_info1).unwrap()); - assert!(payment2.spend_verify(¶ms, &verification_key, &pay_info2).unwrap()); - let params_a = params.get_params_a(); // compute the serial numbers for k1 in [0, V1-1]