dfns / cggmp21

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

Add note about serialization to the key share docs #91

Closed survived closed 3 months ago

survived commented 3 months ago

89 reminded me that we never explicitly mentioned which serialization backeds we support. PR adds this information to the docs.

github-actions[bot] commented 3 months ago

Crate direct deps

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

Compared to base branch

Diff ```text --- direct-deps-base 2024-03-18 13:05:54.099651584 +0000 +++ direct-deps-pr 2024-03-18 13:05:54.375653168 +0000 @@ -1 +1 @@ -cggmp21-keygen v0.1.0 (/home/runner/work/cggmp21/cggmp21/base_branch/cggmp21-keygen) +cggmp21-keygen v0.1.0 (/home/runner/work/cggmp21/cggmp21/pr_branch/cggmp21-keygen) @@ -7 +7 @@ -key-share v0.2.0 (/home/runner/work/cggmp21/cggmp21/base_branch/key-share) +key-share v0.2.1 (/home/runner/work/cggmp21/cggmp21/pr_branch/key-share) ```

All deps

cargo tree ```text cggmp21 v0.2.0 (/home/runner/work/cggmp21/cggmp21/pr_branch/cggmp21) ├── cggmp21-keygen v0.1.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.188 │ │ │ │ └── serde_derive v1.0.188 (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 │ ├── futures v0.3.24 │ │ ├── futures-channel v0.3.24 │ │ │ ├── futures-core v0.3.24 │ │ │ └── futures-sink 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-channel 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 │ │ │ │ ├── proc-macro2 v1.0.66 (*) │ │ │ │ ├── quote v1.0.33 (*) │ │ │ │ └── unicode-ident v1.0.4 │ │ │ ├── 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 │ │ ├── futures-io v0.3.24 │ │ ├── futures-sink v0.3.24 │ │ ├── futures-task v0.3.24 │ │ └── futures-util v0.3.24 (*) │ ├── generic-ec v0.2.0 │ │ ├── generic-ec-core v0.1.3 │ │ │ ├── generic-array v0.14.6 (*) │ │ │ ├── rand_core v0.6.4 │ │ │ ├── serde v1.0.188 (*) │ │ │ ├── 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 (*) │ │ │ └── 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.188 (*) │ │ ├── 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 │ │ ├── serde v1.0.188 (*) │ │ ├── serde_with v2.3.3 │ │ │ ├── serde v1.0.188 (*) │ │ │ └── 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.1.0 │ │ │ ├── digest v0.10.6 (*) │ │ │ └── udigest-derive v0.1.0 (proc-macro) │ │ │ ├── proc-macro2 v1.0.66 (*) │ │ │ ├── quote v1.0.33 (*) │ │ │ └── syn v2.0.32 (*) │ │ └── zeroize v1.6.0 (*) │ ├── generic-ec-zkp v0.2.0 │ │ ├── generic-array v0.14.6 (*) │ │ ├── generic-ec v0.2.0 (*) │ │ ├── rand_core v0.6.4 │ │ ├── serde v1.0.188 (*) │ │ ├── subtle v2.4.1 │ │ └── udigest v0.1.0 (*) │ ├── hex v0.4.3 (*) │ ├── key-share v0.2.1 (/home/runner/work/cggmp21/cggmp21/pr_branch/key-share) │ │ ├── generic-ec v0.2.0 (*) │ │ ├── generic-ec-zkp v0.2.0 (*) │ │ ├── hex v0.4.3 (*) │ │ ├── serde v1.0.188 (*) │ │ ├── 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.2.0 │ │ ├── futures-util v0.3.24 (*) │ │ ├── phantom-type v0.3.1 │ │ │ └── educe v0.4.19 (proc-macro) (*) │ │ ├── round-based-derive v0.2.0 (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-attributes v0.1.22 (proc-macro) │ │ │ ├── proc-macro2 v1.0.66 (*) │ │ │ ├── quote v1.0.33 (*) │ │ │ └── syn v1.0.101 (*) │ │ └── tracing-core v0.1.29 │ │ └── once_cell v1.17.0 │ ├── serde v1.0.188 (*) │ ├── 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.1.0 (*) ├── digest v0.10.6 (*) ├── futures v0.3.24 (*) ├── generic-ec v0.2.0 (*) ├── generic-ec-zkp v0.2.0 (*) ├── hex v0.4.3 (*) ├── key-share v0.2.1 (/home/runner/work/cggmp21/cggmp21/pr_branch/key-share) (*) ├── paillier-zk v0.2.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.188 (*) │ │ ├── serde v1.0.188 (*) │ │ └── thiserror v1.0.48 (*) │ ├── generic-ec v0.2.0 (*) │ ├── rand_core v0.6.4 │ ├── rug v1.21.0 (*) │ ├── serde v1.0.188 (*) │ ├── serde_with v3.0.0 │ │ ├── serde v1.0.188 (*) │ │ └── 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 (*) ├── rand_chacha v0.3.1 │ ├── ppv-lite86 v0.2.17 │ └── rand_core v0.6.4 ├── rand_core v0.6.4 ├── round-based v0.2.0 (*) ├── serde v1.0.188 (*) ├── serde_with v2.3.3 (*) ├── sha2 v0.10.6 (*) ├── thiserror v1.0.48 (*) └── udigest v0.1.0 (*) ```

Compared to base branch

Diff ```text --- all-deps-base 2024-03-18 13:05:54.231652341 +0000 +++ all-deps-pr 2024-03-18 13:05:54.507653926 +0000 @@ -6 +6 @@ -cggmp21-keygen v0.1.0 (/home/runner/work/cggmp21/cggmp21/base_branch/cggmp21-keygen) +cggmp21-keygen v0.1.0 (/home/runner/work/cggmp21/cggmp21/pr_branch/cggmp21-keygen) @@ -33 +33 @@ -key-share v0.2.0 (/home/runner/work/cggmp21/cggmp21/base_branch/key-share) +key-share v0.2.1 (/home/runner/work/cggmp21/cggmp21/pr_branch/key-share) ```
github-actions[bot] commented 3 months ago

The spec was successfully compiled. PDF is available here.

github-actions[bot] commented 3 months ago

Benchmark Result

Benchmarks ```text RUST_TESTS_SEED=78dc620e3f4381615ba63e0ab747641f3e473a52a1ed116839c33c24fc7f9642 n = 3 Non-threshold DKG Protocol Performance: - Protocol took 432.93µs to complete In particular: - Stage: 6.10µs - Setup networking: 5.90µs (96.7%) - Unstaged: 201.00ns (3.3%) - Round 1: 144.83µs - Compute execution id: 4.18µs (2.9%) - Sample x_i, rid_i, chain_code: 64.17µs (44.3%) - Sample schnorr commitment: 59.40µs (41.0%) - Commit to public data: 16.74µs (11.6%) - Unstaged: 340.00ns (0.2%) - Round 2: 3.02µs - Hash received msgs (reliability check): 2.84µs (94.1%) - Unstaged: 179.00ns (5.9%) - Round 3: 300.00ns - Assert other parties hashed messages (reliability check): 160.00ns (53.3%) - Unstaged: 140.00ns (46.7%) - Round 4: 37.23µs - Validate decommitments: 30.45µs (81.8%) - Calculate chain_code: 801.00ns (2.2%) - Calculate challege rid: 5.11µs (13.7%) - Prove knowledge of `x_i`: 721.00ns (1.9%) - Unstaged: 150.00ns (0.4%) - Round 5: 241.45µs - Validate schnorr proofs: 241.15µs (99.9%) - Unstaged: 300.00ns (0.1%) Threshold DKG Protocol Performance: - Protocol took 1.28ms to complete In particular: - Stage: 2.07µs - Setup networking: 2.01µs (97.1%) - Unstaged: 60.00ns (2.9%) - Round 1: 204.36µs - Compute execution id: 1.37µs (0.7%) - Sample rid_i, schnorr commitment, polynomial, chain_code: 179.99µs (88.1%) - Commit to public data: 22.77µs (11.1%) - Unstaged: 230.00ns (0.1%) - Round 2: 1.20µs - Hash received msgs (reliability check): 1.04µs (86.6%) - Unstaged: 161.00ns (13.4%) - Round 3: 310.00ns - Assert other parties hashed messages (reliability check): 190.00ns (61.3%) - Unstaged: 120.00ns (38.7%) - Round 4: 804.95µs - Validate decommitments: 44.20µs (5.5%) - Validate data size: 421.00ns (0.1%) - Validate Feldmann VSS: 356.77µs (44.3%) - Compute rid: 200.00ns (0.0%) - Compute chain_code: 831.00ns (0.1%) - Compute Ys: 386.72µs (48.0%) - Compute sigma: 590.00ns (0.1%) - Calculate challenge: 14.63µs (1.8%) - Prove knowledge of `sigma_i`: 431.00ns (0.1%) - Unstaged: 159.00ns (0.0%) - Round 5: 266.26µs - Validate schnorr proofs: 264.68µs (99.4%) - Derive resulting public key and other data: 1.35µs (0.5%) - Unstaged: 231.00ns (0.1%) Auxiliary data generation protocol Protocol Performance: - Protocol took 9.61s to complete In particular: - Stage: 12.53µs - Retrieve auxiliary data: 240.00ns (1.9%) - Setup networking: 11.01µs (87.8%) - Precompute execution id and shared state: 1.19µs (9.5%) - Unstaged: 91.00ns (0.7%) - Round 1: 1.23s - Retrieve primes (p and q): 211.00ns (0.0%) - Compute paillier decryption key (N): 6.26µs (0.0%) - Generate auxiliary params r, λ, t, s: 9.05ms (0.7%) - Prove Πprm (ψˆ_i): 1.22s (99.2%) - Sample random bytes: 2.64µs (0.0%) - Compute hash commitment and sample decommitment: 276.42µs (0.0%) - Unstaged: 261.00ns (0.0%) - Round 2: 1.48µs - Hash received msgs (reliability check): 1.09µs (73.7%) - Unstaged: 390.00ns (26.3%) - Round 3: 330.00ns - Assert other parties hashed messages (reliability check): 180.00ns (54.5%) - Unstaged: 150.00ns (45.5%) - Round 4: 5.88s - Validate round 1 decommitments: 536.45µs (0.0%) - Validate П_prm (ψ_i): 2.28s (38.7%) - Add together shared random bytes: 2.30µs (0.0%) - Compute П_mod (ψ_i): 3.43s (58.3%) - Assemble security params for П_fac (ф_i): 7.73µs (0.0%) - Compute П_fac (ф_i^j): 171.17ms (2.9%) - Unstaged: 1.44µs (0.0%) - Round 5: 2.51s - Validate ψ_j (П_mod): 2.33s (93.1%) - Validate ф_j (П_fac): 172.14ms (6.9%) - Assemble auxiliary info: 148.82µs (0.0%) - Unstaged: 4.70µs (0.0%) Signing protocol Protocol Performance: - Protocol took 4.16s to complete In particular: - Stage: 143.55µs - Map t-out-of-n protocol to t-out-of-t: 72.10µs (50.2%) - Retrieve auxiliary data: 67.21µs (46.8%) - Precompute execution id and security params: 581.00ns (0.4%) - Setup networking: 3.48µs (2.4%) - Unstaged: 191.00ns (0.1%) - Round 1: 188.53ms - Generate local ephemeral secrets (k_i, y_i, p_i, v_i): 49.85µs (0.0%) - Encrypt G_i and K_i: 107.38ms (57.0%) - Prove ψ0_j: 81.09ms (43.0%) - Unstaged: 1.23µs (0.0%) - Round 2: 14.20µs - Hash received msgs (reliability check): 13.83µs (97.4%) - Unstaged: 371.00ns (2.6%) - Round 3: 2.23s - Assert other parties hashed messages (reliability check): 1.32µs (0.0%) - Verify psi0 proofs: 268.58ms (12.0%) - Sample random r, hat_r, s, hat_s, beta, hat_beta: 56.65µs (0.0%) - Encrypt D_ji: 70.29ms (3.2%) - Encrypt F_ji: 35.74ms (1.6%) - Encrypt hat_D_ji: 562.12ms (25.2%) - Encrypt hat_F_ji: 35.85ms (1.6%) - Prove psi_ji: 791.75ms (35.5%) - Prove psiˆ_ji: 208.87ms (9.4%) - Prove psi_prime_ji : 257.60ms (11.5%) - Unstaged: 2.92µs (0.0%) - Round 4: 1.56s - Retrieve auxiliary data: 6.10µs (0.0%) - Validate psi: 164.94ms (10.6%) - Validate hat_psi: 164.79ms (10.6%) - Validate psi_prime: 933.43ms (59.9%) - Compute Gamma, Delta_i, delta_i, chi_i: 215.06ms (13.8%) - Prove psi_prime_prime: 81.21ms (5.2%) - Unstaged: 561.00ns (0.0%) - Presig output: 184.79ms - Validate psi_prime_prime: 184.66ms (99.9%) - Calculate presignature: 134.52µs (0.1%) - Unstaged: 1.30µs (0.0%) - Partial signing: 9.88µs - Signature reconstruction: 201.26µs ```