dfns / cggmp21

State-of-art threshold ECDSA in Rust
Apache License 2.0
43 stars 6 forks source link

Add DKG benchmarks #46

Closed survived closed 1 year ago

survived commented 1 year ago

Closes #27

github-actions[bot] commented 1 year ago

Benchmark Result

Benchmarks ```text RUST_TESTS_SEED=325f35a9bc00c4b5b1ee8469eee1f9395f21fc9df4d57f5e7978f3683424d629 n = 3 Non-threshold DKG Protocol Performance: - Protocol took 810.23µs to complete In particular: - Setup: 8.10µs - Setup networking: 7.80µs (96.3%) - Unstaged: 300.00ns (3.7%) - Round 1: 210.21µs - Compute execution id: 300.00ns (0.1%) - Sample x_i, rid_i: 94.00µs (44.7%) - Sample schnorr commitment: 84.70µs (40.3%) - Commit to public data: 30.80µs (14.7%) - Unstaged: 400.00ns (0.2%) - Round 2: 4.50µs - Hash received msgs (reliability check): 4.20µs (93.3%) - Unstaged: 300.00ns (6.7%) - Round 3: 400.00ns - Assert other parties hashed messages (reliability check): 200.00ns (50.0%) - Unstaged: 200.00ns (50.0%) - Round 4: 71.50µs - Validate decommitments: 65.70µs (91.9%) - Calculate challege rid: 5.30µs (7.4%) - Prove knowledge of `x_i`: 300.00ns (0.4%) - Unstaged: 200.00ns (0.3%) - Round 5: 515.52µs - Validate schnorr proofs: 514.82µs (99.9%) - Unstaged: 700.00ns (0.1%) Threshold DKG Protocol Performance: - Protocol took 3.23ms to complete In particular: - Setup: 3.20µs - Setup networking: 3.10µs (96.9%) - Unstaged: 100.00ns (3.1%) - Round 1: 292.31µs - Compute execution id: 100.00ns (0.0%) - Sample rid_i, schnorr commitment, polynomial: 256.01µs (87.6%) - Commit to public data: 35.90µs (12.3%) - Unstaged: 300.00ns (0.1%) - Round 2: 4.40µs - Hash received msgs (reliability check): 4.20µs (95.5%) - Unstaged: 200.00ns (4.5%) - Round 3: 400.00ns - Assert other parties hashed messages (reliability check): 100.00ns (25.0%) - Unstaged: 300.00ns (75.0%) - Round 4: 2.55ms - Validate decommitments: 72.30µs (2.8%) - Validate data size: 400.00ns (0.0%) - Validate Feldmann VSS: 536.42µs (21.0%) - Compute rid: 300.00ns (0.0%) - Compute Ys: 1.92ms (75.1%) - Compute sigma: 1.20µs (0.0%) - Calculate challenge: 22.60µs (0.9%) - Prove knowledge of `sigma_i`: 300.00ns (0.0%) - Unstaged: 200.00ns (0.0%) - Round 5: 379.81µs - Validate schnorr proofs: 376.91µs (99.2%) - Derive resulting public key and other data: 1.90µs (0.5%) - Unstaged: 1.00µs (0.3%) Key refresh protocol Protocol Performance: - Protocol took 3.23s to complete In particular: - Setup: 15.70µs - Retrieve auxiliary data: 800.00ns (5.1%) - Setup networking: 11.20µs (71.3%) - Precompute execution id and shared state: 3.50µs (22.3%) - Unstaged: 200.00ns (1.3%) - Round 1: 343.29ms - Retrieve primes (p and q): 300.00ns (0.0%) - Compute paillier decryption key (N): 18.33ms (5.3%) - Generate secret x_i and public X_i: 259.41µs (0.1%) - Generate auxiliary params r, λ, t, s: 4.96ms (1.4%) - Prove Πprm (ψˆ_i): 318.99ms (92.9%) - Compute schnorr commitment τ_j: 260.51µs (0.1%) - Sample random bytes: 300.00ns (0.0%) - Compute hash commitment and sample decommitment: 488.02µs (0.1%) - Unstaged: 300.00ns (0.0%) - Round 2: 5.10µs - Hash received msgs (reliability check): 4.70µs (92.2%) - Unstaged: 400.00ns (7.8%) - Round 3: 800.00ns - Assert other parties hashed messages (reliability check): 400.00ns (50.0%) - Unstaged: 400.00ns (50.0%) - Round 4: 2.01s - Validate round 1 decommitments: 1.06ms (0.1%) - Validate data sizes: 800.00ns (0.0%) - Validate П_prm (ψ_i): 665.89ms (33.2%) - Validate X_i: 8.40µs (0.0%) - Compute paillier encryption keys: 14.10µs (0.0%) - Add together shared random bytes: 3.60µs (0.0%) - Compute П_mod (ψ_i): 1.16s (57.6%) - Assemble security params for П_fac (ф_i): 2.44ms (0.1%) - Compute schnorr proof ψ_i^j: 12.70µs (0.0%) - Prepare auxiliary params and security level for proofs: 700.00ns (0.0%) - Paillier encryption of x_i^j: 42.96ms (2.1%) - Compute П_fac (ф_i^j): 139.02ms (6.9%) - Unstaged: 2.20µs (0.0%) - Round 5: 877.05ms - Paillier decrypt x_j^i from C_j^i: 37.47ms (4.3%) - Validate shares: 173.41µs (0.0%) - Validate schnorr proofs п_j and ψ_j^k: 1.02ms (0.1%) - Validate ψ_j (П_mod): 687.41ms (78.4%) - Validate ф_j (П_fac): 150.95ms (17.2%) - Calculate new x_i: 2.20µs (0.0%) - Calculate new X_i: 11.20µs (0.0%) - Assemble new core share: 400.00ns (0.0%) - Assemble auxiliary info: 5.30µs (0.0%) - Unstaged: 3.80µs (0.0%) Signing protocol Protocol Performance: - Protocol took 2.06s to complete In particular: - Setup: 25.13ms - Map t-out-of-n protocol to t-out-of-t: 7.40µs (0.0%) - Retrieve auxiliary data: 25.11ms (99.9%) - Precompute execution id and security params: 3.40µs (0.0%) - Setup networking: 8.50µs (0.0%) - Unstaged: 100.00ns (0.0%) - Round 1: 154.01ms - Generate local ephemeral secrets (k_i, y_i, p_i, v_i): 49.70µs (0.0%) - Encrypt G_i and K_i: 42.38ms (27.5%) - Prove ψ0_j: 111.58ms (72.4%) - Unstaged: 4.70µs (0.0%) - Round 2: 58.20µs - Hash received msgs (reliability check): 57.60µs (99.0%) - Unstaged: 600.00ns (1.0%) - Round 3: 1.02s - Assert other parties hashed messages (reliability check): 1.40µs (0.0%) - Verify psi0 proofs: 103.11ms (10.1%) - Sample random r, hat_r, s, hat_s, beta, hat_beta: 93.60µs (0.0%) - Encrypt D_ji: 70.88ms (7.0%) - Encrypt F_ji: 65.46ms (6.4%) - Encrypt hat_D_ji: 78.85ms (7.8%) - Encrypt hat_F_ji: 76.17ms (7.5%) - Prove psi_ji: 257.93ms (25.4%) - Prove psiˆ_ji: 255.89ms (25.2%) - Prove psi_prime_ji : 107.92ms (10.6%) - Unstaged: 3.50µs (0.0%) - Round 4: 765.90ms - Retrieve auxiliary data: 12.20µs (0.0%) - Validate psi: 232.54ms (30.4%) - Validate hat_psi: 228.57ms (29.8%) - Validate psi_prime: 108.35ms (14.1%) - Compute Gamma, Delta_i, delta_i, chi_i: 75.42ms (9.8%) - Prove psi_prime_prime: 121.01ms (15.8%) - Unstaged: 1.20µs (0.0%) - Presig output: 103.20ms - Validate psi_prime_prime: 103.00ms (99.8%) - Calculate presignature: 196.91µs (0.2%) - Unstaged: 2.10µs (0.0%) - Partial signing: 14.70µs - Signature reconstruction: 283.91µs ```