dfns / cggmp21

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

Remove unused deps & track deps changes on CI #13

Closed survived closed 1 year ago

survived commented 1 year ago

PR enables a lint unused_crate_dependencies which prohibits having unused deps. Also new CI workflow is introduced which generates deps tree and compares with base branch deps tree.

github-actions[bot] commented 1 year 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=d#e2643917) generic-ec-zkp v0.1.0 (https://github.com/dfns-labs/generic-ec?branch=d#e2643917) hex v0.4.3 paillier-zk v0.1.0 (https://github.com/dfns-labs/paillier-zk?branch=m#72f8eda3) 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#16bb42a4) serde v1.0.145 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-03-09 14:25:36.580362129 +0000 +++ direct-deps-pr 2023-03-09 14:25:37.172376034 +0000 @@ -1 +0,0 @@ -cggmp21 v0.0.0 (/home/runner/work/cggmp21/cggmp21/base_branch/cggmp21) @@ -4 +2,0 @@ -generic-array v0.14.6 @@ -9 +6,0 @@ -phantom-type v0.4.2 ```

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.145 │ │ │ └── serde_derive v1.0.145 (proc-macro) │ │ │ ├── proc-macro2 v1.0.46 │ │ │ │ └── unicode-ident v1.0.4 │ │ │ ├── quote v1.0.21 │ │ │ │ └── proc-macro2 v1.0.46 (*) │ │ │ └── syn v1.0.101 │ │ │ ├── proc-macro2 v1.0.46 (*) │ │ │ ├── quote v1.0.21 (*) │ │ │ └── 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.46 (*) │ │ │ ├── quote v1.0.21 (*) │ │ │ └── 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 │ ├── 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=d#e2643917) │ ├── generic-array v0.14.6 (*) │ ├── generic-ec-core v0.1.0 (https://github.com/dfns-labs/generic-ec?branch=d#e2643917) │ │ ├── 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.145 (*) │ │ ├── subtle v2.4.1 │ │ └── zeroize v1.5.7 │ │ └── zeroize_derive v1.3.2 (proc-macro) │ │ ├── proc-macro2 v1.0.46 (*) │ │ ├── quote v1.0.21 (*) │ │ ├── syn v1.0.101 (*) │ │ └── synstructure v0.12.6 │ │ ├── proc-macro2 v1.0.46 (*) │ │ ├── quote v1.0.21 (*) │ │ ├── syn v1.0.101 (*) │ │ └── unicode-xid v0.2.4 │ ├── hex v0.4.3 │ │ └── serde v1.0.145 (*) │ ├── 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.46 (*) │ │ │ ├── quote v1.0.21 (*) │ │ │ └── syn v1.0.101 (*) │ │ ├── proc-macro2 v1.0.46 (*) │ │ ├── quote v1.0.21 (*) │ │ └── syn v1.0.101 (*) │ ├── rand_core v0.6.4 (*) │ ├── serde v1.0.145 (*) │ ├── serde_with v2.0.1 │ │ ├── serde v1.0.145 (*) │ │ └── 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.46 (*) │ │ │ │ ├── quote v1.0.21 (*) │ │ │ │ ├── strsim v0.10.0 │ │ │ │ └── syn v1.0.101 (*) │ │ │ └── darling_macro v0.14.1 (proc-macro) │ │ │ ├── darling_core v0.14.1 (*) │ │ │ ├── quote v1.0.21 (*) │ │ │ └── syn v1.0.101 (*) │ │ ├── proc-macro2 v1.0.46 (*) │ │ ├── quote v1.0.21 (*) │ │ └── 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=d#e2643917) │ ├── digest v0.10.6 (*) │ ├── generic-array v0.14.6 (*) │ ├── generic-ec v0.0.0 (https://github.com/dfns-labs/generic-ec?branch=d#e2643917) (*) │ ├── rand_core v0.6.4 (*) │ ├── serde v1.0.145 (*) │ └── subtle v2.4.1 ├── hex v0.4.3 (*) ├── paillier-zk v0.1.0 (https://github.com/dfns-labs/paillier-zk?branch=m#72f8eda3) │ ├── generic-ec v0.0.0 (https://github.com/dfns-labs/generic-ec?branch=d#e2643917) (*) │ ├── generic-ec-core v0.1.0 (https://github.com/dfns-labs/generic-ec?branch=d#e2643917) (*) │ ├── libpaillier v0.5.0 │ │ ├── digest v0.10.6 (*) │ │ ├── serde v1.0.145 (*) │ │ ├── serde_bare v0.5.0 │ │ │ └── serde v1.0.145 (*) │ │ ├── unknown_order v0.6.0 │ │ │ ├── digest v0.9.0 │ │ │ │ └── generic-array v0.14.6 (*) │ │ │ ├── hex v0.4.3 (*) │ │ │ ├── num-traits v0.2.15 │ │ │ ├── rand v0.8.5 │ │ │ │ ├── libc v0.2.134 │ │ │ │ ├── rand_chacha v0.3.1 │ │ │ │ │ ├── ppv-lite86 v0.2.17 │ │ │ │ │ └── rand_core v0.6.4 (*) │ │ │ │ └── rand_core v0.6.4 (*) │ │ │ ├── rug v1.18.0 │ │ │ │ ├── az v1.2.1 │ │ │ │ ├── gmp-mpfr-sys v1.4.12 │ │ │ │ │ └── libc v0.2.134 │ │ │ │ ├── libc v0.2.134 │ │ │ │ ├── num-integer v0.1.45 (*) │ │ │ │ └── num-traits v0.2.15 │ │ │ ├── serde v1.0.145 (*) │ │ │ ├── subtle v2.4.1 │ │ │ └── zeroize v1.5.7 (*) │ │ └── zeroize v1.5.7 (*) │ ├── rand_chacha v0.3.1 (*) │ ├── rand_core v0.6.4 (*) │ ├── serde v1.0.145 (*) │ ├── sha2 v0.10.6 │ │ ├── cfg-if v1.0.0 │ │ ├── cpufeatures v0.2.5 │ │ └── digest v0.10.6 (*) │ ├── subtle v2.4.1 │ ├── thiserror v1.0.37 │ │ └── thiserror-impl v1.0.37 (proc-macro) │ │ ├── proc-macro2 v1.0.46 (*) │ │ ├── quote v1.0.21 (*) │ │ └── syn v1.0.101 (*) │ └── zeroize v1.5.7 (*) ├── 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#16bb42a4) │ ├── async-stream v0.3.3 │ │ ├── async-stream-impl v0.3.3 (proc-macro) │ │ │ ├── proc-macro2 v1.0.46 (*) │ │ │ ├── quote v1.0.21 (*) │ │ │ └── syn v1.0.101 (*) │ │ └── futures-core v0.3.24 │ ├── bincode v1.3.3 │ │ └── serde v1.0.145 (*) │ ├── 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#16bb42a4) │ │ ├── proc-macro2 v1.0.46 (*) │ │ ├── quote v1.0.21 (*) │ │ └── syn v1.0.101 (*) │ ├── serde v1.0.145 (*) │ ├── 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.46 (*) │ │ ├── quote v1.0.21 (*) │ │ └── syn v1.0.101 (*) │ └── tracing-core v0.1.29 │ └── once_cell v1.17.0 ├── serde v1.0.145 (*) ├── serde_json v1.0.89 │ ├── itoa v1.0.4 │ ├── ryu v1.0.11 │ └── serde v1.0.145 (*) ├── serde_with v2.0.1 (*) ├── sha2 v0.10.6 (*) └── thiserror v1.0.37 (*) ```

Compared to base branch

Diff ```text --- all-deps-base 2023-03-09 14:25:36.868368936 +0000 +++ all-deps-pr 2023-03-09 14:25:37.460382759 +0000 @@ -74 +73,0 @@ -tokio-macros v1.8.2 (proc-macro) ```
github-actions[bot] commented 1 year ago

Benchmark Result

Benchmarks ```text RUST_TESTS_SEED=9c45ba7cd8fbd1fa518dd52b668faec90e59d69b8d45d7e53b92ba546e2dd6f8 n = 3 Key refresh protocol Protocol Performance: - Protocol took 3.52s to complete In particular: - Setup: 28.30µs - Retrieve auxiliary data: 1.10µs (3.9%) - Setup networking: 21.50µs (76.0%) - Precompute execution id and shared state: 5.40µs (19.1%) - Unstaged: 300.00ns (1.1%) - Round 1: 413.32ms - Retrieve or compute primes (p and q): 400.00ns (0.0%) - Compute paillier decryption key (N): 22.18ms (5.4%) - Generate secret y and public Y: 214.00µs (0.1%) - Compute schnorr commitment τ_i: 208.40µs (0.1%) - Generate secret x_i and public X_i: 628.49µs (0.2%) - Generate auxiliary params r, λ, t, s: 5.67ms (1.4%) - Prove Πprm (ψ_i): 383.91ms (92.9%) - Compute schnorr commitment τ_j: 423.09µs (0.1%) - Sample random bytes: 1.00µs (0.0%) - Compute hash commitment and sample decommitment: 91.00µs (0.0%) - Unstaged: 500.00ns (0.0%) - Round 2: 400.00ns - Round 3: 2.14s - Validate round 1 decommitments: 178.40µs (0.0%) - Validate data sizes: 600.00ns (0.0%) - Validate П_prm (ψ_i): 737.25ms (34.5%) - Validate X_i: 51.80µs (0.0%) - Compute paillier encryption keys: 7.40µs (0.0%) - Add together shared random bytes: 200.00ns (0.0%) - Compute schnorr proof п_i: 4.80µs (0.0%) - Compute П_mod (ψ_i): 1.19s (55.7%) - Sample challenge for schnorr_pok: 6.70µs (0.0%) - Prepare auxiliary params and security level for proofs: 1.60µs (0.0%) - Compute schnorr proof ψ_i^j: 1.60µs (0.0%) - Paillier encryption of x_i^j: 50.88ms (2.4%) - Compute П_fac (ф_i): 158.84ms (7.4%) - Unstaged: 800.00ns (0.0%) - Round 4: 973.19ms - Paillier decrypt x_j^i from C_j^i: 44.07ms (4.5%) - Validate shares: 466.59µs (0.0%) - Validate schnorr proofs п_j and ψ_j^k: 3.54ms (0.4%) - Validate ψ_j (П_mod): 765.92ms (78.7%) - Validate ф_j (П_fac): 159.17ms (16.4%) - Calculate new x_i: 600.00ns (0.0%) - Calculate new X_i: 9.50µs (0.0%) - Assemble new core share: 600.00ns (0.0%) - Assemble auxiliary info: 1.60µs (0.0%) - Unstaged: 300.00ns (0.0%) Signing protocol Protocol Performance: - Protocol took 2.36s to complete In particular: - Setup: 28.01ms - Validate security level: 4.90µs (0.0%) - Retrieve auxiliary data: 27.99ms (99.9%) - Precompute execution id and security params: 5.30µs (0.0%) - Setup networking: 4.50µs (0.0%) - Unstaged: 400.00ns (0.0%) - Round 1: 185.92ms - Generate local ephemeral secrets (k_i, y_i, p_i, v_i): 45.40µs (0.0%) - Encrypt G_i and K_i: 50.36ms (27.1%) - Prove ψ0_j: 135.51ms (72.9%) - Unstaged: 800.00ns (0.0%) - Round 2: 1.12s - Hash received msgs (reliability check): 61.10µs (0.0%) - Verify psi0 proofs: 113.31ms (10.1%) - Sample random r, hat_r, s, hat_s, beta, hat_beta: 95.80µs (0.0%) - Encrypt D_ji: 73.96ms (6.6%) - Encrypt F_ji: 66.73ms (6.0%) - Encrypt hat_D_ji: 85.16ms (7.6%) - Encrypt hat_F_ji: 77.78ms (7.0%) - Prove psi_ji: 287.55ms (25.7%) - Prove psiˆ_ji: 288.00ms (25.8%) - Prove psi_prime_ji : 125.41ms (11.2%) - Unstaged: 1.30µs (0.0%) - Round 3: 904.67ms - Assert other parties hashed messages (reliability check): 500.00ns (0.0%) - Retrieve auxiliary data: 7.40µs (0.0%) - Validate psi: 272.18ms (30.1%) - Validate hat_psi: 284.75ms (31.5%) - Validate psi_prime: 121.61ms (13.4%) - Compute Gamma, Delta_i, delta_i, chi_i: 88.38ms (9.8%) - Prove psi_prime_prime: 137.74ms (15.2%) - Unstaged: 700.00ns (0.0%) - Presig output: 126.06ms - Validate psi_prime_prime: 125.55ms (99.6%) - Calculate presignature: 506.20µs (0.4%) - Unstaged: 200.00ns (0.0%) - Partial signing: 21.00µs - Signature reconstruction: 709.19µs ```