dfns / cggmp21

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

Add method to read signature from bytes and raw parts #63

Closed maurges closed 8 months ago

github-actions[bot] commented 8 months ago

Benchmark Result

Benchmarks ```text RUST_TESTS_SEED=8fa92929c6589db586c51cc5999fa57f22b5bc4eeb6d17284771b177437195fa n = 3 Non-threshold DKG Protocol Performance: - Protocol took 672.71µs to complete In particular: - Setup: 4.20µs - Setup networking: 4.00µs (95.2%) - Unstaged: 200.00ns (4.8%) - Round 1: 173.30µs - Compute execution id: 300.00ns (0.2%) - Sample x_i, rid_i: 75.10µs (43.3%) - Sample schnorr commitment: 69.40µs (40.0%) - Commit to public data: 28.00µs (16.2%) - Unstaged: 500.00ns (0.3%) - Round 2: 4.40µs - Hash received msgs (reliability check): 4.10µs (93.2%) - Unstaged: 300.00ns (6.8%) - Round 3: 400.00ns - Assert other parties hashed messages (reliability check): 200.00ns (50.0%) - Unstaged: 200.00ns (50.0%) - Round 4: 70.70µs - Validate decommitments: 68.10µs (96.3%) - Calculate challege rid: 2.10µs (3.0%) - Prove knowledge of `x_i`: 400.00ns (0.6%) - Unstaged: 100.00ns (0.1%) - Round 5: 419.71µs - Validate schnorr proofs: 419.11µs (99.9%) - Unstaged: 600.00ns (0.1%) Threshold DKG Protocol Performance: - Protocol took 1.54ms to complete In particular: - Setup: 2.30µs - Setup networking: 2.20µs (95.7%) - Unstaged: 100.00ns (4.3%) - Round 1: 246.20µs - Compute execution id: 100.00ns (0.0%) - Sample rid_i, schnorr commitment, polynomial: 211.30µs (85.8%) - Commit to public data: 34.40µs (14.0%) - 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: 957.02µs - Validate decommitments: 66.80µs (7.0%) - Validate data size: 900.00ns (0.1%) - Validate Feldmann VSS: 417.41µs (43.6%) - Compute rid: 400.00ns (0.0%) - Compute Ys: 450.11µs (47.0%) - Compute sigma: 500.00ns (0.1%) - Calculate challenge: 20.30µs (2.1%) - Prove knowledge of `sigma_i`: 300.00ns (0.0%) - Unstaged: 300.00ns (0.0%) - Round 5: 324.61µs - Validate schnorr proofs: 320.61µs (98.8%) - Derive resulting public key and other data: 1.60µs (0.5%) - Unstaged: 2.40µs (0.7%) Auxiliary data generation protocol Protocol Performance: - Protocol took 14.64s to complete In particular: - Setup: 8.00µs - Retrieve auxiliary data: 500.00ns (6.2%) - Setup networking: 6.30µs (78.8%) - Precompute execution id and shared state: 1.00µs (12.5%) - Unstaged: 200.00ns (2.5%) - Round 1: 1.78s - Retrieve primes (p and q): 200.00ns (0.0%) - Compute paillier decryption key (N): 4.20µs (0.0%) - Generate auxiliary params r, λ, t, s: 14.46ms (0.8%) - Prove Πprm (ψˆ_i): 1.77s (99.1%) - Sample random bytes: 2.20µs (0.0%) - Compute hash commitment and sample decommitment: 1.12ms (0.1%) - Unstaged: 400.00ns (0.0%) - Round 2: 5.30µs - Hash received msgs (reliability check): 5.00µs (94.3%) - Unstaged: 300.00ns (5.7%) - Round 3: 700.00ns - Assert other parties hashed messages (reliability check): 300.00ns (42.9%) - Unstaged: 400.00ns (57.1%) - Round 4: 8.98s - Validate round 1 decommitments: 2.23ms (0.0%) - Validate П_prm (ψ_i): 3.47s (38.6%) - Add together shared random bytes: 2.20µs (0.0%) - Compute П_mod (ψ_i): 5.25s (58.4%) - Assemble security params for П_fac (ф_i): 7.60µs (0.0%) - Compute П_fac (ф_i^j): 262.16ms (2.9%) - Unstaged: 1.30µs (0.0%) - Round 5: 3.87s - Validate ψ_j (П_mod): 3.61s (93.2%) - Validate ф_j (П_fac): 264.45ms (6.8%) - Assemble auxiliary info: 195.40µs (0.0%) - Unstaged: 1.20µs (0.0%) Signing protocol Protocol Performance: - Protocol took 2.46s to complete In particular: - Setup: 105.30µs - Map t-out-of-n protocol to t-out-of-t: 8.40µs (8.0%) - Retrieve auxiliary data: 91.60µs (87.0%) - Precompute execution id and security params: 700.00ns (0.7%) - Setup networking: 4.40µs (4.2%) - Unstaged: 200.00ns (0.2%) - Round 1: 181.61ms - Generate local ephemeral secrets (k_i, y_i, p_i, v_i): 68.70µs (0.0%) - Encrypt G_i and K_i: 55.99ms (30.8%) - Prove ψ0_j: 125.55ms (69.1%) - Unstaged: 2.00µs (0.0%) - Round 2: 88.20µs - Hash received msgs (reliability check): 87.80µs (99.5%) - Unstaged: 400.00ns (0.5%) - Round 3: 1.24s - Assert other parties hashed messages (reliability check): 600.00ns (0.0%) - Verify psi0 proofs: 142.54ms (11.5%) - Sample random r, hat_r, s, hat_s, beta, hat_beta: 69.10µs (0.0%) - Encrypt D_ji: 108.95ms (8.8%) - Encrypt F_ji: 55.96ms (4.5%) - Encrypt hat_D_ji: 108.89ms (8.8%) - Encrypt hat_F_ji: 55.95ms (4.5%) - Prove psi_ji: 320.84ms (25.9%) - Prove psiˆ_ji: 321.24ms (25.9%) - Prove psi_prime_ji : 124.78ms (10.1%) - Unstaged: 1.90µs (0.0%) - Round 4: 892.15ms - Retrieve auxiliary data: 5.90µs (0.0%) - Validate psi: 254.34ms (28.5%) - Validate hat_psi: 255.49ms (28.6%) - Validate psi_prime: 147.30ms (16.5%) - Compute Gamma, Delta_i, delta_i, chi_i: 110.78ms (12.4%) - Prove psi_prime_prime: 124.23ms (13.9%) - Unstaged: 500.00ns (0.0%) - Presig output: 142.95ms - Validate psi_prime_prime: 142.79ms (99.9%) - Calculate presignature: 162.00µs (0.1%) - Unstaged: 900.00ns (0.0%) - Partial signing: 13.40µs - Signature reconstruction: 241.20µs ```