dfns / cggmp21

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

Update rug and paillier-zk #56

Closed maurges closed 10 months ago

maurges commented 10 months ago

Now it builds for downstream users without tweaking lockfile to lock older rug

github-actions[bot] commented 10 months ago

Crate direct deps

Direct deps ```text digest v0.10.6 futures v0.3.24 generic-ec v0.0.0 (https://github.com/dfns-labs/generic-ec?branch=m#448b0789) generic-ec-zkp v0.1.0 (https://github.com/dfns-labs/generic-ec?branch=m#448b0789) hex v0.4.3 paillier-zk v0.1.0 (https://github.com/dfns-labs/paillier-zk?branch=m#b344dd32) rand_chacha v0.3.1 rand_core v0.6.4 round-based v0.2.0 (https://github.com/Zengo-X/round-based-protocol?branch=round-based2#46bdc24d) serde v1.0.160 serde_json v1.0.89 serde_with v2.0.1 sha2 v0.10.6 thiserror v1.0.37 ```

Compared to base branch

Diff ```text --- direct-deps-base 2023-09-07 09:27:10.401677395 +0000 +++ direct-deps-pr 2023-09-07 09:27:10.933688047 +0000 @@ -6 +6 @@ -paillier-zk v0.1.0 (https://github.com/dfns-labs/paillier-zk?branch=m#e003d4fb) +paillier-zk v0.1.0 (https://github.com/dfns-labs/paillier-zk?branch=m#b344dd32) ```

All deps

cargo tree ```text cggmp21 v0.0.0 (/home/runner/work/cggmp21/cggmp21/pr_branch/cggmp21) ├── digest v0.10.6 │ ├── block-buffer v0.10.3 │ │ └── generic-array v0.14.6 │ │ ├── serde v1.0.160 │ │ │ └── serde_derive v1.0.160 (proc-macro) │ │ │ ├── proc-macro2 v1.0.66 │ │ │ │ └── unicode-ident v1.0.4 │ │ │ ├── quote v1.0.26 │ │ │ │ └── proc-macro2 v1.0.66 (*) │ │ │ └── syn v2.0.15 │ │ │ ├── proc-macro2 v1.0.66 (*) │ │ │ ├── quote v1.0.26 (*) │ │ │ └── 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.26 (*) │ │ │ └── syn v1.0.101 │ │ │ ├── proc-macro2 v1.0.66 (*) │ │ │ ├── quote v1.0.26 (*) │ │ │ └── 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.0.0 (https://github.com/dfns-labs/generic-ec?branch=m#448b0789) │ ├── generic-ec-core v0.1.0 (https://github.com/dfns-labs/generic-ec?branch=m#448b0789) │ │ ├── generic-array v0.14.6 (*) │ │ ├── rand_core v0.6.4 │ │ │ └── getrandom v0.2.8 │ │ │ ├── cfg-if v1.0.0 │ │ │ └── libc v0.2.134 │ │ ├── serde v1.0.160 (*) │ │ ├── subtle v2.4.1 │ │ └── zeroize v1.5.7 │ │ └── zeroize_derive v1.3.2 (proc-macro) │ │ ├── proc-macro2 v1.0.66 (*) │ │ ├── quote v1.0.26 (*) │ │ ├── syn v1.0.101 (*) │ │ └── synstructure v0.12.6 │ │ ├── proc-macro2 v1.0.66 (*) │ │ ├── quote v1.0.26 (*) │ │ ├── syn v1.0.101 (*) │ │ └── unicode-xid v0.2.4 │ ├── hex v0.4.3 │ │ └── serde v1.0.160 (*) │ ├── 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.26 (*) │ │ │ └── syn v1.0.101 (*) │ │ ├── proc-macro2 v1.0.66 (*) │ │ ├── quote v1.0.26 (*) │ │ └── syn v1.0.101 (*) │ ├── rand_core v0.6.4 (*) │ ├── serde v1.0.160 (*) │ ├── serde_with v2.0.1 │ │ ├── serde v1.0.160 (*) │ │ └── serde_with_macros v2.0.1 (proc-macro) │ │ ├── darling v0.14.1 │ │ │ ├── darling_core v0.14.1 │ │ │ │ ├── fnv v1.0.7 │ │ │ │ ├── ident_case v1.0.1 │ │ │ │ ├── proc-macro2 v1.0.66 (*) │ │ │ │ ├── quote v1.0.26 (*) │ │ │ │ ├── strsim v0.10.0 │ │ │ │ └── syn v1.0.101 (*) │ │ │ └── darling_macro v0.14.1 (proc-macro) │ │ │ ├── darling_core v0.14.1 (*) │ │ │ ├── quote v1.0.26 (*) │ │ │ └── syn v1.0.101 (*) │ │ ├── proc-macro2 v1.0.66 (*) │ │ ├── quote v1.0.26 (*) │ │ └── syn v1.0.101 (*) │ ├── subtle v2.4.1 │ └── zeroize v1.5.7 (*) ├── generic-ec-zkp v0.1.0 (https://github.com/dfns-labs/generic-ec?branch=m#448b0789) │ ├── digest v0.10.6 (*) │ ├── generic-array v0.14.6 (*) │ ├── generic-ec v0.0.0 (https://github.com/dfns-labs/generic-ec?branch=m#448b0789) (*) │ ├── rand_core v0.6.4 (*) │ ├── serde v1.0.160 (*) │ └── subtle v2.4.1 ├── hex v0.4.3 (*) ├── paillier-zk v0.1.0 (https://github.com/dfns-labs/paillier-zk?branch=m#b344dd32) │ ├── digest v0.10.6 (*) │ ├── fast-paillier v0.1.0 (https://github.com/dfns-labs/fast-paillier?branch=m#09ba60ec) │ │ ├── bytemuck v1.13.1 │ │ │ └── bytemuck_derive v1.4.1 (proc-macro) │ │ │ ├── proc-macro2 v1.0.66 (*) │ │ │ ├── quote v1.0.26 (*) │ │ │ └── syn v2.0.15 (*) │ │ ├── rand_core v0.6.4 (*) │ │ ├── rug v1.21.0 │ │ │ ├── az v1.2.1 │ │ │ ├── gmp-mpfr-sys v1.6.1 │ │ │ │ └── libc v0.2.134 │ │ │ ├── libc v0.2.134 │ │ │ └── serde v1.0.160 (*) │ │ ├── serde v1.0.160 (*) │ │ └── thiserror v1.0.37 │ │ └── thiserror-impl v1.0.37 (proc-macro) │ │ ├── proc-macro2 v1.0.66 (*) │ │ ├── quote v1.0.26 (*) │ │ └── syn v1.0.101 (*) │ ├── generic-ec v0.0.0 (https://github.com/dfns-labs/generic-ec?branch=m#448b0789) (*) │ ├── rand_core v0.6.4 (*) │ ├── rug v1.21.0 (*) │ ├── serde v1.0.160 (*) │ ├── serde_with v3.0.0 │ │ ├── serde v1.0.160 (*) │ │ └── serde_with_macros v3.0.0 (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.26 (*) │ │ │ │ ├── strsim v0.10.0 │ │ │ │ └── syn v2.0.15 (*) │ │ │ └── darling_macro v0.20.1 (proc-macro) │ │ │ ├── darling_core v0.20.1 (*) │ │ │ ├── quote v1.0.26 (*) │ │ │ └── syn v2.0.15 (*) │ │ ├── proc-macro2 v1.0.66 (*) │ │ ├── quote v1.0.26 (*) │ │ └── syn v2.0.15 (*) │ └── thiserror v1.0.37 (*) ├── 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 (https://github.com/Zengo-X/round-based-protocol?branch=round-based2#46bdc24d) │ ├── async-stream v0.3.3 │ │ ├── async-stream-impl v0.3.3 (proc-macro) │ │ │ ├── proc-macro2 v1.0.66 (*) │ │ │ ├── quote v1.0.26 (*) │ │ │ └── syn v1.0.101 (*) │ │ └── futures-core v0.3.24 │ ├── bincode v1.3.3 │ │ └── serde v1.0.160 (*) │ ├── futures v0.3.24 (*) │ ├── never v0.1.0 │ ├── phantom-type v0.3.1 │ │ └── educe v0.4.19 (proc-macro) (*) │ ├── round-based-derive v0.1.0 (proc-macro) (https://github.com/Zengo-X/round-based-protocol?branch=round-based2#46bdc24d) │ │ ├── proc-macro2 v1.0.66 (*) │ │ ├── quote v1.0.26 (*) │ │ └── syn v1.0.101 (*) │ ├── serde v1.0.160 (*) │ ├── thiserror v1.0.37 (*) │ ├── tokio v1.21.2 │ │ └── pin-project-lite v0.2.9 │ ├── tokio-stream v0.1.10 │ │ ├── futures-core v0.3.24 │ │ ├── pin-project-lite v0.2.9 │ │ ├── tokio v1.21.2 (*) │ │ └── tokio-util v0.7.4 │ │ ├── bytes v1.2.1 │ │ ├── futures-core v0.3.24 │ │ ├── futures-sink v0.3.24 │ │ ├── pin-project-lite v0.2.9 │ │ └── tokio v1.21.2 (*) │ └── 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.26 (*) │ │ └── syn v1.0.101 (*) │ └── tracing-core v0.1.29 │ └── once_cell v1.17.0 ├── serde v1.0.160 (*) ├── serde_json v1.0.89 │ ├── itoa v1.0.4 │ ├── ryu v1.0.11 │ └── serde v1.0.160 (*) ├── serde_with v2.0.1 (*) ├── sha2 v0.10.6 │ ├── cfg-if v1.0.0 │ ├── cpufeatures v0.2.5 │ └── digest v0.10.6 (*) └── thiserror v1.0.37 (*) ```

Compared to base branch

Diff ```text --- all-deps-base 2023-09-07 09:27:10.581681238 +0000 +++ all-deps-pr 2023-09-07 09:27:11.109691356 +0000 @@ -21 +21 @@ -fast-paillier v0.1.0 (https://github.com/dfns-labs/fast-paillier?branch=m#fec7aa7e) +fast-paillier v0.1.0 (https://github.com/dfns-labs/fast-paillier?branch=m#09ba60ec) @@ -48 +48 @@ -paillier-zk v0.1.0 (https://github.com/dfns-labs/paillier-zk?branch=m#e003d4fb) +paillier-zk v0.1.0 (https://github.com/dfns-labs/paillier-zk?branch=m#b344dd32) @@ -60 +60 @@ -rug v1.20.1 +rug v1.21.0 ```
github-actions[bot] commented 10 months ago

Benchmark Result

Benchmarks ```text RUST_TESTS_SEED=fe8ad57399cf0a65cc02988f30e64ca6009394eadd22c5a3a4d430b092cce20e n = 3 Non-threshold DKG Protocol Performance: - Protocol took 649.01µs to complete In particular: - Setup: 10.00µs - Setup networking: 9.40µs (94.0%) - Unstaged: 600.00ns (6.0%) - Round 1: 168.00µs - Compute execution id: 200.00ns (0.1%) - Sample x_i, rid_i: 75.30µs (44.8%) - Sample schnorr commitment: 66.60µs (39.6%) - Commit to public data: 25.50µs (15.2%) - Unstaged: 400.00ns (0.2%) - Round 2: 3.80µs - Hash received msgs (reliability check): 3.60µs (94.7%) - Unstaged: 200.00ns (5.3%) - Round 3: 400.00ns - Assert other parties hashed messages (reliability check): 200.00ns (50.0%) - Unstaged: 200.00ns (50.0%) - Round 4: 60.00µs - Validate decommitments: 55.30µs (92.2%) - Calculate challege rid: 4.20µs (7.0%) - Prove knowledge of `x_i`: 200.00ns (0.3%) - Unstaged: 300.00ns (0.5%) - Round 5: 406.81µs - Validate schnorr proofs: 406.41µs (99.9%) - Unstaged: 400.00ns (0.1%) Threshold DKG Protocol Performance: - Protocol took 1.41ms to complete In particular: - Setup: 2.30µs - Setup networking: 2.20µs (95.7%) - Unstaged: 100.00ns (4.3%) - Round 1: 228.90µs - Compute execution id: 100.00ns (0.0%) - Sample rid_i, schnorr commitment, polynomial: 201.00µs (87.8%) - Commit to public data: 27.40µs (12.0%) - Unstaged: 400.00ns (0.2%) - Round 2: 3.90µs - Hash received msgs (reliability check): 3.70µs (94.9%) - Unstaged: 200.00ns (5.1%) - Round 3: 300.00ns - Assert other parties hashed messages (reliability check): 100.00ns (33.3%) - Unstaged: 200.00ns (66.7%) - Round 4: 872.81µs - Validate decommitments: 53.70µs (6.2%) - Validate data size: 700.00ns (0.1%) - Validate Feldmann VSS: 398.21µs (45.6%) - Compute rid: 300.00ns (0.0%) - Compute Ys: 401.11µs (46.0%) - Compute sigma: 400.00ns (0.0%) - Calculate challenge: 17.90µs (2.1%) - Prove knowledge of `sigma_i`: 200.00ns (0.0%) - Unstaged: 300.00ns (0.0%) - Round 5: 301.60µs - Validate schnorr proofs: 299.60µs (99.3%) - Derive resulting public key and other data: 1.60µs (0.5%) - Unstaged: 400.00ns (0.1%) Auxiliary data generation protocol Protocol Performance: - Protocol took 10.95s to complete In particular: - Setup: 8.10µs - Retrieve auxiliary data: 300.00ns (3.7%) - Setup networking: 7.00µs (86.4%) - Precompute execution id and shared state: 700.00ns (8.6%) - Unstaged: 100.00ns (1.2%) - Round 1: 1.32s - Retrieve primes (p and q): 200.00ns (0.0%) - Compute paillier decryption key (N): 6.30µs (0.0%) - Generate auxiliary params r, λ, t, s: 10.39ms (0.8%) - Prove Πprm (ψˆ_i): 1.31s (99.1%) - Sample random bytes: 3.10µs (0.0%) - Compute hash commitment and sample decommitment: 989.51µs (0.1%) - Unstaged: 200.00ns (0.0%) - Round 2: 4.40µs - Hash received msgs (reliability check): 3.90µs (88.6%) - Unstaged: 500.00ns (11.4%) - Round 3: 500.00ns - Assert other parties hashed messages (reliability check): 300.00ns (60.0%) - Unstaged: 200.00ns (40.0%) - Round 4: 6.76s - Validate round 1 decommitments: 1.98ms (0.0%) - Validate П_prm (ψ_i): 2.61s (38.7%) - Add together shared random bytes: 1.90µs (0.0%) - Compute П_mod (ψ_i): 3.94s (58.4%) - Assemble security params for П_fac (ф_i): 9.70µs (0.0%) - Compute П_fac (ф_i^j): 198.64ms (2.9%) - Unstaged: 2.10µs (0.0%) - Round 5: 2.86s - Validate ψ_j (П_mod): 2.67s (93.1%) - Validate ф_j (П_fac): 197.89ms (6.9%) - Assemble auxiliary info: 2.00µs (0.0%) - Unstaged: 900.00ns (0.0%) Signing protocol Protocol Performance: - Protocol took 2.17s to complete In particular: - Setup: 142.50µs - Map t-out-of-n protocol to t-out-of-t: 9.40µs (6.6%) - Retrieve auxiliary data: 125.80µs (88.3%) - Precompute execution id and security params: 700.00ns (0.5%) - Setup networking: 6.40µs (4.5%) - Unstaged: 200.00ns (0.1%) - Round 1: 199.75ms - Generate local ephemeral secrets (k_i, y_i, p_i, v_i): 67.20µs (0.0%) - Encrypt G_i and K_i: 73.82ms (37.0%) - Prove ψ0_j: 125.85ms (63.0%) - Unstaged: 7.30µs (0.0%) - Round 2: 76.70µs - Hash received msgs (reliability check): 76.50µs (99.7%) - Unstaged: 200.00ns (0.3%) - Round 3: 1.09s - Assert other parties hashed messages (reliability check): 900.00ns (0.0%) - Verify psi0 proofs: 105.95ms (9.7%) - Sample random r, hat_r, s, hat_s, beta, hat_beta: 51.30µs (0.0%) - Encrypt D_ji: 80.85ms (7.4%) - Encrypt F_ji: 73.77ms (6.8%) - Encrypt hat_D_ji: 80.76ms (7.4%) - Encrypt hat_F_ji: 73.77ms (6.8%) - Prove psi_ji: 273.63ms (25.1%) - Prove psiˆ_ji: 272.94ms (25.1%) - Prove psi_prime_ji : 126.29ms (11.6%) - Unstaged: 1.40µs (0.0%) - Round 4: 772.78ms - Retrieve auxiliary data: 5.30µs (0.0%) - Validate psi: 228.61ms (29.6%) - Validate hat_psi: 228.84ms (29.6%) - Validate psi_prime: 106.29ms (13.8%) - Compute Gamma, Delta_i, delta_i, chi_i: 82.57ms (10.7%) - Prove psi_prime_prime: 126.47ms (16.4%) - Unstaged: 700.00ns (0.0%) - Presig output: 106.34ms - Validate psi_prime_prime: 106.19ms (99.9%) - Calculate presignature: 150.40µs (0.1%) - Unstaged: 900.00ns (0.0%) - Partial signing: 10.30µs - Signature reconstruction: 223.80µs ```