1
1
use ark_bls12_381:: { Bls12_381 , Fr , G1Affine } ;
2
2
use ark_ff:: Zero ;
3
+ use ark_serialize:: { CanonicalSerialize , Compress } ;
3
4
use ark_std:: {
4
5
collections:: BTreeSet ,
5
6
rand:: { prelude:: StdRng , SeedableRng } ,
@@ -399,21 +400,27 @@ fn pseudonym(c: &mut Criterion) {
399
400
} ) ;
400
401
}
401
402
402
- criterion_group ! ( benches, threshold_issuance_with_known_user_id, pseudonym) ;
403
- criterion_main ! ( benches) ;
403
+ // criterion_group!(benches, threshold_issuance_with_known_user_id, pseudonym);
404
+ // criterion_main!(benches);
404
405
405
- /* fn timing_info(mut times: Vec<std::time::Duration>) -> String {
406
+ fn timing_info ( mut times : Vec < std:: time:: Duration > ) -> String {
406
407
times. sort ( ) ;
407
408
let median = {
408
409
let mid = times. len ( ) / 2 ;
409
410
if times. len ( ) % 2 == 0 {
410
- (times[mid - 1] + times[mid]) / 2
411
+ ( times[ mid - 1 ] + times[ mid] ) / 2
411
412
} else {
412
413
times[ mid]
413
414
}
414
415
} ;
415
416
let total = times. iter ( ) . sum :: < std:: time:: Duration > ( ) ;
416
- format!("{:.2?} | [{:.2?}, {:.2?}, {:.2?}]", total, times[0], median, times[times.len() - 1])
417
+ format ! (
418
+ "{:.2?} | [{:.2?}, {:.2?}, {:.2?}]" ,
419
+ total,
420
+ times[ 0 ] ,
421
+ median,
422
+ times[ times. len( ) - 1 ]
423
+ )
417
424
}
418
425
419
426
fn main ( ) {
@@ -428,28 +435,51 @@ fn main() {
428
435
) ;
429
436
430
437
const NUM_ITERATIONS : usize = 10 ;
438
+ // let ps = [(5, 10), (10, 20)];
439
+ // let ps = [(5, 10), (10, 20), (15, 30), (20, 40), (25, 50), (30, 60), (35, 70), (40, 80), (45, 90), (50, 100), (55, 110), (60, 120), (65, 130), (70, 140)];
440
+ let ps = [ ( 350 , 700 ) ] ;
441
+ let max = ps. iter ( ) . map ( |( t, _) | * t) . max ( ) . unwrap ( ) ;
442
+ let start = Instant :: now ( ) ;
443
+ // The signers run OT protocol instances. This is also a one time setup.
444
+ let base_ot_outputs = test_utils:: ot:: do_pairwise_base_ot :: < BASE_OT_KEY_SIZE > (
445
+ & mut rng,
446
+ OTE_PARAMS . num_base_ot ( ) ,
447
+ max,
448
+ ( 1 ..=max) . into_iter ( ) . collect :: < BTreeSet < _ > > ( ) ,
449
+ ) ;
450
+ println ! ( "Time taken for {} base OT {:.2?}" , max, start. elapsed( ) ) ;
451
+ println ! (
452
+ "Uncompressed size of base OT {}" ,
453
+ base_ot_outputs. serialized_size( Compress :: No )
454
+ ) ;
455
+ println ! (
456
+ "Compressed size of base OT {}" ,
457
+ base_ot_outputs. serialized_size( Compress :: Yes )
458
+ ) ;
431
459
432
- for (threshold_signers, total_signers) in [(5, 10), (10, 20), (15, 30), (20, 40), (25, 50), (30, 60), (35, 70), (40, 80), (45, 90), (50, 100), (55, 110), (60, 120), (65, 130), (70, 140)] {
433
- println!("\nRunning {} iterations for {}-of-{}", NUM_ITERATIONS, threshold_signers, total_signers);
460
+ for ( threshold_signers, total_signers) in ps {
461
+ println ! (
462
+ "\n Running {} iterations for {}-of-{}" ,
463
+ NUM_ITERATIONS , threshold_signers, total_signers
464
+ ) ;
434
465
let all_party_set = ( 1 ..=total_signers) . into_iter ( ) . collect :: < BTreeSet < _ > > ( ) ;
435
466
436
467
// The signers do a keygen. This is a one time setup.
437
- let (sk, sk_shares) =
438
- trusted_party_keygen(&mut rng, threshold_signers, total_signers);
468
+ let ( sk, sk_shares) = trusted_party_keygen ( & mut rng, threshold_signers, total_signers) ;
439
469
let isk_shares = sk_shares
440
470
. into_iter ( )
441
471
. map ( |s| IssuerSecretKey ( s) )
442
472
. collect :: < Vec < _ > > ( ) ;
443
473
// Public key created by the trusted party using the secret key directly. In practice, this will be a result of a DKG
444
474
let threshold_ipk = IssuerPublicKey :: new ( & mut rng, & IssuerSecretKey ( sk) , & params) ;
445
475
446
- // The signers run OT protocol instances. This is also a one time setup.
447
- let base_ot_outputs = test_utils::ot::do_pairwise_base_ot::<BASE_OT_KEY_SIZE>(
448
- &mut rng,
449
- OTE_PARAMS.num_base_ot(),
450
- total_signers,
451
- all_party_set.clone(),
452
- );
476
+ // // The signers run OT protocol instances. This is also a one time setup.
477
+ // let base_ot_outputs = test_utils::ot::do_pairwise_base_ot::<BASE_OT_KEY_SIZE>(
478
+ // &mut rng,
479
+ // OTE_PARAMS.num_base_ot(),
480
+ // total_signers,
481
+ // all_party_set.clone(),
482
+ // );
453
483
454
484
let mut phase1_time = vec ! [ ] ;
455
485
let mut phase2_time = vec ! [ ] ;
@@ -492,4 +522,4 @@ fn main() {
492
522
println ! ( "Phase2 time: {:?}" , timing_info( phase2_time) ) ;
493
523
println ! ( "Aggregation time: {:?}" , timing_info( aggr_time) ) ;
494
524
}
495
- }*/
525
+ }
0 commit comments