dfns / cggmp21

State-of-art threshold ECDSA in Rust
Apache License 2.0
49 stars 8 forks source link

`key_share`: add HD-related methods to `DirtyKeyInfo` #104

Closed survived closed 1 month ago

github-actions[bot] commented 1 month ago

Benchmark Result

Benchmarks ```text RUST_TESTS_SEED=186decef24815754cb1a6dc3456ef0bef2e2ca281fad3cca28bf84587f165c9d n = 3 Non-threshold DKG Protocol Performance: - Protocol took 419.79µs to complete In particular: - Stage: 6.22µs - Setup networking: 6.01µs (96.6%) - Unstaged: 210.00ns (3.4%) - Round 1: 141.15µs - Sample x_i, rid_i, chain_code: 62.61µs (44.4%) - Sample schnorr commitment: 58.33µs (41.3%) - Commit to public data: 19.93µs (14.1%) - Unstaged: 290.00ns (0.2%) - Round 2: 1.39µs - Hash received msgs (reliability check): 1.22µs (87.7%) - Unstaged: 171.00ns (12.3%) - Round 3: 2.03µs - Assert other parties hashed messages (reliability check): 1.92µs (94.6%) - Unstaged: 110.00ns (5.4%) - Round 4: 33.88µs - Validate decommitments: 30.30µs (89.4%) - Calculate chain_code: 822.00ns (2.4%) - Calculate challege rid: 2.38µs (7.0%) - Prove knowledge of `x_i`: 241.00ns (0.7%) - Unstaged: 140.00ns (0.4%) - Round 5: 235.11µs - Validate schnorr proofs: 234.82µs (99.9%) - Unstaged: 291.00ns (0.1%) Threshold DKG Protocol Performance: - Protocol took 1.32ms to complete In particular: - Stage: 1.89µs - Setup networking: 1.81µs (95.8%) - Unstaged: 80.00ns (4.2%) - Round 1: 197.84µs - Sample rid_i, schnorr commitment, polynomial, chain_code: 174.99µs (88.4%) - Commit to public data: 22.66µs (11.5%) - Unstaged: 190.00ns (0.1%) - Round 2: 1.34µs - Hash received msgs (reliability check): 1.18µs (88.1%) - Unstaged: 160.00ns (11.9%) - Round 3: 380.00ns - Assert other parties hashed messages (reliability check): 250.00ns (65.8%) - Unstaged: 130.00ns (34.2%) - Round 4: 825.56µs - Validate decommitments: 73.49µs (8.9%) - Validate data size: 441.00ns (0.1%) - Validate Feldmann VSS: 365.29µs (44.2%) - Compute rid: 170.00ns (0.0%) - Compute chain_code: 1.20µs (0.1%) - Compute Ys: 352.09µs (42.6%) - Compute sigma: 371.00ns (0.0%) - Calculate challenge: 28.97µs (3.5%) - Prove knowledge of `sigma_i`: 3.36µs (0.4%) - Unstaged: 180.00ns (0.0%) - Round 5: 290.49µs - Validate schnorr proofs: 289.30µs (99.6%) - Derive resulting public key and other data: 1.00µs (0.3%) - Unstaged: 190.00ns (0.1%) Auxiliary data generation protocol Protocol Performance: - Protocol took 9.52s to complete In particular: - Stage: 12.95µs - Retrieve auxiliary data: 241.00ns (1.9%) - Setup networking: 12.68µs (97.9%) - Unstaged: 30.00ns (0.2%) - Round 1: 1.16s - Retrieve primes (p and q): 100.00ns (0.0%) - Compute paillier decryption key (N): 3.10µs (0.0%) - Generate auxiliary params r, λ, t, s: 9.03ms (0.8%) - Prove Πprm (ψˆ_i): 1.15s (99.2%) - Sample random bytes: 2.39µs (0.0%) - Compute hash commitment and sample decommitment: 301.63µs (0.0%) - Unstaged: 241.00ns (0.0%) - Round 2: 1.70µs - Hash received msgs (reliability check): 1.43µs (84.1%) - Unstaged: 271.00ns (15.9%) - Round 3: 491.00ns - Assert other parties hashed messages (reliability check): 311.00ns (63.3%) - Unstaged: 180.00ns (36.7%) - Round 4: 5.88s - Validate round 1 decommitments: 599.89µs (0.0%) - Validate П_prm (ψ_i): 2.28s (38.8%) - Add together shared random bytes: 1.11µs (0.0%) - Compute П_mod (ψ_i): 3.43s (58.3%) - Assemble security params for П_fac (ф_i): 5.19µs (0.0%) - Compute П_fac (ф_i^j): 171.28ms (2.9%) - Unstaged: 1.00µs (0.0%) - Round 5: 2.49s - Validate ψ_j (П_mod): 2.32s (93.1%) - Validate ф_j (П_fac): 172.27ms (6.9%) - Assemble auxiliary info: 149.46µs (0.0%) - Unstaged: 851.00ns (0.0%) Signing protocol Protocol Performance: - Protocol took 4.16s to complete In particular: - Stage: 139.76µs - Map t-out-of-n protocol to t-out-of-t: 69.81µs (49.9%) - Retrieve auxiliary data: 66.00µs (47.2%) - Precompute execution id and security params: 581.00ns (0.4%) - Setup networking: 3.29µs (2.4%) - Unstaged: 80.00ns (0.1%) - Round 1: 188.88ms - Generate local ephemeral secrets (k_i, y_i, p_i, v_i): 48.48µs (0.0%) - Encrypt G_i and K_i: 107.27ms (56.8%) - Prove ψ0_j: 81.56ms (43.2%) - Unstaged: 631.00ns (0.0%) - Round 2: 15.04µs - Hash received msgs (reliability check): 14.80µs (98.4%) - Unstaged: 240.00ns (1.6%) - Round 3: 2.23s - Assert other parties hashed messages (reliability check): 591.00ns (0.0%) - Verify psi0 proofs: 268.63ms (12.1%) - Sample random r, hat_r, s, hat_s, beta, hat_beta: 12.10µs (0.0%) - Encrypt D_ji: 70.26ms (3.2%) - Encrypt F_ji: 35.75ms (1.6%) - Encrypt hat_D_ji: 558.86ms (25.1%) - Encrypt hat_F_ji: 35.71ms (1.6%) - Prove psi_ji: 790.75ms (35.5%) - Prove psiˆ_ji: 208.75ms (9.4%) - Prove psi_prime_ji : 257.39ms (11.6%) - Unstaged: 1.35µs (0.0%) - Round 4: 1.56s - Retrieve auxiliary data: 5.14µs (0.0%) - Validate psi: 164.47ms (10.6%) - Validate hat_psi: 164.47ms (10.6%) - Validate psi_prime: 933.19ms (59.9%) - Compute Gamma, Delta_i, delta_i, chi_i: 215.07ms (13.8%) - Prove psi_prime_prime: 81.46ms (5.2%) - Unstaged: 523.00ns (0.0%) - Presig output: 184.72ms - Validate psi_prime_prime: 184.59ms (99.9%) - Calculate presignature: 132.96µs (0.1%) - Unstaged: 781.00ns (0.0%) - Partial signing: 7.00µs - Signature reconstruction: 196.30µs ```
github-actions[bot] commented 1 month ago

Crate direct deps

Direct deps ```text cggmp21-keygen v0.3.0 (/home/runner/work/cggmp21/cggmp21/pr_branch/cggmp21-keygen) digest v0.10.6 futures v0.3.24 generic-ec v0.4.0 generic-ec-zkp v0.4.0 hex v0.4.3 key-share v0.4.1 (/home/runner/work/cggmp21/cggmp21/pr_branch/key-share) paillier-zk v0.4.0 rand_core v0.6.4 rand_hash v0.1.0 round-based v0.3.0 serde v1.0.193 serde_with v2.3.3 sha2 v0.10.6 thiserror v1.0.48 udigest v0.2.0 ```

Compared to base branch

Diff ```text --- direct-deps-base 2024-07-22 13:47:32.225400686 +0000 +++ direct-deps-pr 2024-07-22 13:47:32.737405788 +0000 @@ -1 +1 @@ -cggmp21-keygen v0.3.0 (/home/runner/work/cggmp21/cggmp21/base_branch/cggmp21-keygen) +cggmp21-keygen v0.3.0 (/home/runner/work/cggmp21/cggmp21/pr_branch/cggmp21-keygen) @@ -7 +7 @@ -key-share v0.4.0 (/home/runner/work/cggmp21/cggmp21/base_branch/key-share) +key-share v0.4.1 (/home/runner/work/cggmp21/cggmp21/pr_branch/key-share) ```

All deps

cargo tree ```text cggmp21 v0.4.0 (/home/runner/work/cggmp21/cggmp21/pr_branch/cggmp21) ├── cggmp21-keygen v0.3.0 (/home/runner/work/cggmp21/cggmp21/pr_branch/cggmp21-keygen) │ ├── digest v0.10.6 │ │ ├── block-buffer v0.10.3 │ │ │ └── generic-array v0.14.6 │ │ │ ├── serde v1.0.193 │ │ │ │ └── serde_derive v1.0.193 (proc-macro) │ │ │ │ ├── proc-macro2 v1.0.66 │ │ │ │ │ └── unicode-ident v1.0.4 │ │ │ │ ├── quote v1.0.33 │ │ │ │ │ └── proc-macro2 v1.0.66 (*) │ │ │ │ └── syn v2.0.32 │ │ │ │ ├── proc-macro2 v1.0.66 (*) │ │ │ │ ├── quote v1.0.33 (*) │ │ │ │ └── unicode-ident v1.0.4 │ │ │ └── typenum v1.15.0 │ │ └── crypto-common v0.1.6 │ │ ├── generic-array v0.14.6 (*) │ │ └── typenum v1.15.0 │ ├── displaydoc v0.2.4 (proc-macro) │ │ ├── proc-macro2 v1.0.66 (*) │ │ ├── quote v1.0.33 (*) │ │ └── syn v2.0.32 (*) │ ├── generic-ec v0.4.0 │ │ ├── digest v0.10.6 (*) │ │ ├── generic-ec-core v0.2.0 │ │ │ ├── generic-array v0.14.6 (*) │ │ │ ├── rand_core v0.6.4 │ │ │ ├── serde v1.0.193 (*) │ │ │ ├── subtle v2.4.1 │ │ │ └── zeroize v1.6.0 │ │ │ └── zeroize_derive v1.3.2 (proc-macro) │ │ │ ├── proc-macro2 v1.0.66 (*) │ │ │ ├── quote v1.0.33 (*) │ │ │ ├── syn v1.0.101 │ │ │ │ ├── proc-macro2 v1.0.66 (*) │ │ │ │ ├── quote v1.0.33 (*) │ │ │ │ └── unicode-ident v1.0.4 │ │ │ └── synstructure v0.12.6 │ │ │ ├── proc-macro2 v1.0.66 (*) │ │ │ ├── quote v1.0.33 (*) │ │ │ ├── syn v1.0.101 (*) │ │ │ └── unicode-xid v0.2.4 │ │ ├── hex v0.4.3 │ │ │ └── serde v1.0.193 (*) │ │ ├── phantom-type v0.4.2 │ │ │ └── educe v0.4.19 (proc-macro) │ │ │ ├── enum-ordinalize v3.1.11 (proc-macro) │ │ │ │ ├── num-bigint v0.4.3 │ │ │ │ │ ├── num-integer v0.1.45 │ │ │ │ │ │ └── num-traits v0.2.15 │ │ │ │ │ └── num-traits v0.2.15 │ │ │ │ ├── num-traits v0.2.15 │ │ │ │ ├── proc-macro2 v1.0.66 (*) │ │ │ │ ├── quote v1.0.33 (*) │ │ │ │ └── syn v1.0.101 (*) │ │ │ ├── proc-macro2 v1.0.66 (*) │ │ │ ├── quote v1.0.33 (*) │ │ │ └── syn v1.0.101 (*) │ │ ├── rand_core v0.6.4 │ │ ├── rand_hash v0.1.0 │ │ │ ├── digest v0.10.6 (*) │ │ │ ├── rand_core v0.6.4 │ │ │ └── udigest v0.2.0 │ │ │ ├── digest v0.10.6 (*) │ │ │ └── udigest-derive v0.2.0 (proc-macro) │ │ │ ├── proc-macro2 v1.0.66 (*) │ │ │ ├── quote v1.0.33 (*) │ │ │ └── syn v2.0.32 (*) │ │ ├── serde v1.0.193 (*) │ │ ├── serde_with v2.3.3 │ │ │ ├── serde v1.0.193 (*) │ │ │ └── serde_with_macros v2.3.3 (proc-macro) │ │ │ ├── darling v0.20.1 │ │ │ │ ├── darling_core v0.20.1 │ │ │ │ │ ├── fnv v1.0.7 │ │ │ │ │ ├── ident_case v1.0.1 │ │ │ │ │ ├── proc-macro2 v1.0.66 (*) │ │ │ │ │ ├── quote v1.0.33 (*) │ │ │ │ │ ├── strsim v0.10.0 │ │ │ │ │ └── syn v2.0.32 (*) │ │ │ │ └── darling_macro v0.20.1 (proc-macro) │ │ │ │ ├── darling_core v0.20.1 (*) │ │ │ │ ├── quote v1.0.33 (*) │ │ │ │ └── syn v2.0.32 (*) │ │ │ ├── proc-macro2 v1.0.66 (*) │ │ │ ├── quote v1.0.33 (*) │ │ │ └── syn v2.0.32 (*) │ │ ├── subtle v2.4.1 │ │ ├── udigest v0.2.0 (*) │ │ └── zeroize v1.6.0 (*) │ ├── generic-ec-zkp v0.4.0 │ │ ├── generic-array v0.14.6 (*) │ │ ├── generic-ec v0.4.0 (*) │ │ ├── rand_core v0.6.4 │ │ ├── serde v1.0.193 (*) │ │ ├── subtle v2.4.1 │ │ └── udigest v0.2.0 (*) │ ├── hex v0.4.3 (*) │ ├── key-share v0.4.1 (/home/runner/work/cggmp21/cggmp21/pr_branch/key-share) │ │ ├── displaydoc v0.2.4 (proc-macro) (*) │ │ ├── generic-ec v0.4.0 (*) │ │ ├── generic-ec-zkp v0.4.0 (*) │ │ ├── hex v0.4.3 (*) │ │ ├── serde v1.0.193 (*) │ │ ├── serde_with v2.3.3 (*) │ │ └── thiserror v1.0.48 │ │ └── thiserror-impl v1.0.48 (proc-macro) │ │ ├── proc-macro2 v1.0.66 (*) │ │ ├── quote v1.0.33 (*) │ │ └── syn v2.0.32 (*) │ ├── rand_core v0.6.4 │ ├── round-based v0.3.0 │ │ ├── displaydoc v0.2.4 (proc-macro) (*) │ │ ├── futures-util v0.3.24 │ │ │ ├── futures-channel v0.3.24 │ │ │ │ ├── futures-core v0.3.24 │ │ │ │ └── futures-sink v0.3.24 │ │ │ ├── futures-core v0.3.24 │ │ │ ├── futures-io v0.3.24 │ │ │ ├── futures-macro v0.3.24 (proc-macro) │ │ │ │ ├── proc-macro2 v1.0.66 (*) │ │ │ │ ├── quote v1.0.33 (*) │ │ │ │ └── syn v1.0.101 (*) │ │ │ ├── futures-sink v0.3.24 │ │ │ ├── futures-task v0.3.24 │ │ │ ├── memchr v2.5.0 │ │ │ ├── pin-project-lite v0.2.9 │ │ │ ├── pin-utils v0.1.0 │ │ │ └── slab v0.4.7 │ │ ├── phantom-type v0.3.1 │ │ │ └── educe v0.4.19 (proc-macro) (*) │ │ ├── round-based-derive v0.2.1 (proc-macro) │ │ │ ├── proc-macro2 v1.0.66 (*) │ │ │ ├── quote v1.0.33 (*) │ │ │ └── syn v1.0.101 (*) │ │ ├── thiserror v1.0.48 (*) │ │ └── tracing v0.1.36 │ │ ├── cfg-if v1.0.0 │ │ ├── pin-project-lite v0.2.9 │ │ └── tracing-core v0.1.29 │ ├── serde v1.0.193 (*) │ ├── serde_with v2.3.3 (*) │ ├── sha2 v0.10.6 │ │ ├── cfg-if v1.0.0 │ │ ├── cpufeatures v0.2.12 │ │ └── digest v0.10.6 (*) │ ├── thiserror v1.0.48 (*) │ └── udigest v0.2.0 (*) ├── digest v0.10.6 (*) ├── futures v0.3.24 │ ├── futures-channel v0.3.24 (*) │ ├── futures-core v0.3.24 │ ├── futures-executor v0.3.24 │ │ ├── futures-core v0.3.24 │ │ ├── futures-task v0.3.24 │ │ └── futures-util v0.3.24 (*) │ ├── futures-io v0.3.24 │ ├── futures-sink v0.3.24 │ ├── futures-task v0.3.24 │ └── futures-util v0.3.24 (*) ├── generic-ec v0.4.0 (*) ├── generic-ec-zkp v0.4.0 (*) ├── hex v0.4.3 (*) ├── key-share v0.4.1 (/home/runner/work/cggmp21/cggmp21/pr_branch/key-share) (*) ├── paillier-zk v0.4.0 │ ├── digest v0.10.6 (*) │ ├── fast-paillier v0.1.0 │ │ ├── bytemuck v1.13.1 │ │ │ └── bytemuck_derive v1.4.1 (proc-macro) │ │ │ ├── proc-macro2 v1.0.66 (*) │ │ │ ├── quote v1.0.33 (*) │ │ │ └── syn v2.0.32 (*) │ │ ├── rand_core v0.6.4 │ │ ├── rug v1.21.0 │ │ │ ├── az v1.2.1 │ │ │ ├── gmp-mpfr-sys v1.6.1 │ │ │ │ └── libc v0.2.153 │ │ │ ├── libc v0.2.153 │ │ │ └── serde v1.0.193 (*) │ │ ├── serde v1.0.193 (*) │ │ └── thiserror v1.0.48 (*) │ ├── generic-ec v0.4.0 (*) │ ├── rand_core v0.6.4 │ ├── rand_hash v0.1.0 (*) │ ├── rug v1.21.0 (*) │ ├── serde v1.0.193 (*) │ ├── serde_with v3.0.0 │ │ ├── serde v1.0.193 (*) │ │ └── serde_with_macros v3.0.0 (proc-macro) │ │ ├── darling v0.20.1 (*) │ │ ├── proc-macro2 v1.0.66 (*) │ │ ├── quote v1.0.33 (*) │ │ └── syn v2.0.32 (*) │ ├── thiserror v1.0.48 (*) │ └── udigest v0.2.0 (*) ├── rand_core v0.6.4 ├── rand_hash v0.1.0 (*) ├── round-based v0.3.0 (*) ├── serde v1.0.193 (*) ├── serde_with v2.3.3 (*) ├── sha2 v0.10.6 (*) ├── thiserror v1.0.48 (*) └── udigest v0.2.0 (*) ```

Compared to base branch

Diff ```text --- all-deps-base 2024-07-22 13:47:32.361402042 +0000 +++ all-deps-pr 2024-07-22 13:47:32.873407143 +0000 @@ -6 +6 @@ -cggmp21-keygen v0.3.0 (/home/runner/work/cggmp21/cggmp21/base_branch/cggmp21-keygen) +cggmp21-keygen v0.3.0 (/home/runner/work/cggmp21/cggmp21/pr_branch/cggmp21-keygen) @@ -34 +34 @@ -key-share v0.4.0 (/home/runner/work/cggmp21/cggmp21/base_branch/key-share) +key-share v0.4.1 (/home/runner/work/cggmp21/cggmp21/pr_branch/key-share) ```
github-actions[bot] commented 1 month ago

The spec was successfully compiled. PDF is available here.