Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update deps, improve tests #120

Merged
merged 20 commits into from
Dec 13, 2024
Merged

Update deps, improve tests #120

merged 20 commits into from
Dec 13, 2024

Conversation

survived
Copy link
Contributor

@survived survived commented Nov 25, 2024

  • Update hd-wallet to v0.6
    This update is critical as it's a security fix
  • Update round-based to v0.4
    This is mostly quality-life update, it greatly improves ergonomics in the tests
  • Improve tests by developing own test_suite! macro

Blocked on #122

Signed-off-by: Denis Varlakov <[email protected]>
Copy link

github-actions bot commented Nov 25, 2024

Crate direct deps

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

Compared to base branch

Diff
--- direct-deps-base	2024-12-09 11:43:53.696621318 +0000
+++ direct-deps-pr	2024-12-09 11:43:54.368620735 +0000
@@ -1 +1 @@
-cggmp21-keygen v0.4.0 (/home/runner/work/cggmp21/cggmp21/base_branch/cggmp21-keygen)
+cggmp21-keygen v0.5.0 (/home/runner/work/cggmp21/cggmp21/pr_branch/cggmp21-keygen)
@@ -7 +7 @@
-key-share v0.5.1 (/home/runner/work/cggmp21/cggmp21/base_branch/key-share)
+key-share v0.6.0 (/home/runner/work/cggmp21/cggmp21/pr_branch/key-share)
@@ -11 +11 @@
-round-based v0.3.0
+round-based v0.4.0

All deps

cargo tree
cggmp21 v0.6.0 (/home/runner/work/cggmp21/cggmp21/pr_branch/cggmp21)
├── cggmp21-keygen v0.5.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.92
│   │   │       │       │   └── unicode-ident v1.0.4
│   │   │       │       ├── quote v1.0.37
│   │   │       │       │   └── proc-macro2 v1.0.92 (*)
│   │   │       │       └── syn v2.0.90
│   │   │       │           ├── proc-macro2 v1.0.92 (*)
│   │   │       │           ├── quote v1.0.37 (*)
│   │   │       │           └── 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.5 (proc-macro)
│   │   ├── proc-macro2 v1.0.92 (*)
│   │   ├── quote v1.0.37 (*)
│   │   └── syn v2.0.90 (*)
│   ├── generic-ec v0.4.1
│   │   ├── 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.92 (*)
│   │   │           ├── quote v1.0.37 (*)
│   │   │           ├── syn v1.0.101
│   │   │           │   ├── proc-macro2 v1.0.92 (*)
│   │   │           │   ├── quote v1.0.37 (*)
│   │   │           │   └── unicode-ident v1.0.4
│   │   │           └── synstructure v0.12.6
│   │   │               ├── proc-macro2 v1.0.92 (*)
│   │   │               ├── quote v1.0.37 (*)
│   │   │               ├── 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.92 (*)
│   │   │       │   ├── quote v1.0.37 (*)
│   │   │       │   └── syn v1.0.101 (*)
│   │   │       ├── proc-macro2 v1.0.92 (*)
│   │   │       ├── quote v1.0.37 (*)
│   │   │       └── 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.1
│   │   │       ├── digest v0.10.6 (*)
│   │   │       └── udigest-derive v0.3.0 (proc-macro)
│   │   │           ├── proc-macro2 v1.0.92 (*)
│   │   │           ├── quote v1.0.37 (*)
│   │   │           └── syn v2.0.90 (*)
│   │   ├── 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.92 (*)
│   │   │       │   │   ├── quote v1.0.37 (*)
│   │   │       │   │   ├── strsim v0.10.0
│   │   │       │   │   └── syn v2.0.90 (*)
│   │   │       │   └── darling_macro v0.20.1 (proc-macro)
│   │   │       │       ├── darling_core v0.20.1 (*)
│   │   │       │       ├── quote v1.0.37 (*)
│   │   │       │       └── syn v2.0.90 (*)
│   │   │       ├── proc-macro2 v1.0.92 (*)
│   │   │       ├── quote v1.0.37 (*)
│   │   │       └── syn v2.0.90 (*)
│   │   ├── subtle v2.4.1
│   │   ├── udigest v0.2.1 (*)
│   │   └── zeroize v1.6.0 (*)
│   ├── generic-ec-zkp v0.4.1
│   │   ├── generic-array v0.14.6 (*)
│   │   ├── generic-ec v0.4.1 (*)
│   │   ├── rand_core v0.6.4
│   │   ├── serde v1.0.193 (*)
│   │   ├── subtle v2.4.1
│   │   └── udigest v0.2.1 (*)
│   ├── hex v0.4.3 (*)
│   ├── key-share v0.6.0 (/home/runner/work/cggmp21/cggmp21/pr_branch/key-share)
│   │   ├── displaydoc v0.2.5 (proc-macro) (*)
│   │   ├── generic-ec v0.4.1 (*)
│   │   ├── generic-ec-zkp v0.4.1 (*)
│   │   ├── 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.92 (*)
│   │           ├── quote v1.0.37 (*)
│   │           └── syn v2.0.90 (*)
│   ├── rand_core v0.6.4
│   ├── round-based v0.4.0
│   │   ├── 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.92 (*)
│   │   │   │   ├── quote v1.0.37 (*)
│   │   │   │   └── 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.2 (proc-macro)
│   │   │   ├── proc-macro2 v1.0.92 (*)
│   │   │   ├── quote v1.0.37 (*)
│   │   │   └── syn v1.0.101 (*)
│   │   ├── thiserror v2.0.4
│   │   │   └── thiserror-impl v2.0.4 (proc-macro)
│   │   │       ├── proc-macro2 v1.0.92 (*)
│   │   │       ├── quote v1.0.37 (*)
│   │   │       └── syn v2.0.90 (*)
│   │   └── 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.1 (*)
├── 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.1 (*)
├── generic-ec-zkp v0.4.1 (*)
├── hex v0.4.3 (*)
├── key-share v0.6.0 (/home/runner/work/cggmp21/cggmp21/pr_branch/key-share) (*)
├── paillier-zk v0.4.1
│   ├── digest v0.10.6 (*)
│   ├── fast-paillier v0.1.0
│   │   ├── bytemuck v1.13.1
│   │   │   └── bytemuck_derive v1.4.1 (proc-macro)
│   │   │       ├── proc-macro2 v1.0.92 (*)
│   │   │       ├── quote v1.0.37 (*)
│   │   │       └── syn v2.0.90 (*)
│   │   ├── 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.1 (*)
│   ├── 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.92 (*)
│   │       ├── quote v1.0.37 (*)
│   │       └── syn v2.0.90 (*)
│   ├── thiserror v1.0.48 (*)
│   └── udigest v0.2.1 (*)
├── rand_core v0.6.4
├── rand_hash v0.1.0 (*)
├── round-based v0.4.0 (*)
├── serde v1.0.193 (*)
├── serde_with v2.3.3 (*)
├── sha2 v0.10.6 (*)
├── thiserror v1.0.48 (*)
└── udigest v0.2.1 (*)

Compared to base branch

Diff
--- all-deps-base	2024-12-09 11:43:53.836621196 +0000
+++ all-deps-pr	2024-12-09 11:43:54.508620613 +0000
@@ -6 +6 @@
-cggmp21-keygen v0.4.0 (/home/runner/work/cggmp21/cggmp21/base_branch/cggmp21-keygen)
+cggmp21-keygen v0.5.0 (/home/runner/work/cggmp21/cggmp21/pr_branch/cggmp21-keygen)
@@ -13 +13 @@
-displaydoc v0.2.4 (proc-macro)
+displaydoc v0.2.5 (proc-macro)
@@ -34 +34 @@
-key-share v0.5.1 (/home/runner/work/cggmp21/cggmp21/base_branch/key-share)
+key-share v0.6.0 (/home/runner/work/cggmp21/cggmp21/pr_branch/key-share)
@@ -45,2 +45,2 @@
-proc-macro2 v1.0.66
-quote v1.0.33
+proc-macro2 v1.0.92
+quote v1.0.37
@@ -49,2 +49,2 @@
-round-based v0.3.0
-round-based-derive v0.2.1 (proc-macro)
+round-based v0.4.0
+round-based-derive v0.2.2 (proc-macro)
@@ -63 +63 @@
-syn v2.0.32
+syn v2.0.90
@@ -65,0 +66 @@
+thiserror v2.0.4
@@ -66,0 +68 @@
+thiserror-impl v2.0.4 (proc-macro)

Copy link

github-actions bot commented Nov 25, 2024

The spec was successfully compiled. PDF is available here.

Copy link

github-actions bot commented Nov 25, 2024

Benchmark Result

Benchmarks
RUST_TESTS_SEED=fd9b4c0886f04eaae1ad15ae54e8d3a650ec694d48afcf28e8b2f5331f27402f
n = 3

Non-threshold DKG
Protocol Performance:
  - Protocol took 428.47µs to complete
In particular:
  - Stage: 8.98µs
    - Setup networking: 8.72µs (97.1%)
    - Unstaged: 260.00ns (2.9%)
  - Round 1: 145.50µs
    - Sample x_i, rid_i, chain_code: 63.34µs (43.5%)
    - Sample schnorr commitment: 60.21µs (41.4%)
    - Commit to public data: 21.65µs (14.9%)
    - Unstaged: 300.00ns (0.2%)
  - Round 2: 1.31µs
    - Hash received msgs (reliability check): 1.13µs (86.2%)
    - Unstaged: 181.00ns (13.8%)
  - Round 3: 270.00ns
    - Assert other parties hashed messages (reliability check): 160.00ns (59.3%)
    - Unstaged: 110.00ns (40.7%)
  - Round 4: 36.00µs
    - Validate decommitments: 32.77µs (91.0%)
    - Calculate chain_code: 802.00ns (2.2%)
    - Calculate challege rid: 2.06µs (5.7%)
    - Prove knowledge of `x_i`: 221.00ns (0.6%)
    - Unstaged: 140.00ns (0.4%)
  - Round 5: 236.41µs
    - Validate schnorr proofs: 235.98µs (99.8%)
    - Unstaged: 430.00ns (0.2%)


Threshold DKG
Protocol Performance:
  - Protocol took 1.30ms to complete
In particular:
  - Stage: 1.71µs
    - Setup networking: 1.66µs (97.1%)
    - Unstaged: 50.00ns (2.9%)
  - Round 1: 202.34µs
    - Sample rid_i, schnorr commitment, polynomial, chain_code: 177.25µs (87.6%)
    - Commit to public data: 24.86µs (12.3%)
    - Unstaged: 231.00ns (0.1%)
  - Round 2: 1.23µs
    - Hash received msgs (reliability check): 1.08µs (87.8%)
    - Unstaged: 150.00ns (12.2%)
  - Round 3: 410.00ns
    - Assert other parties hashed messages (reliability check): 280.00ns (68.3%)
    - Unstaged: 130.00ns (31.7%)
  - Round 4: 793.79µs
    - Validate decommitments: 48.12µs (6.1%)
    - Validate data size: 331.00ns (0.0%)
    - Validate Feldmann VSS: 353.10µs (44.5%)
    - Compute rid: 200.00ns (0.0%)
    - Compute chain_code: 741.00ns (0.1%)
    - Compute Ys: 357.93µs (45.1%)
    - Compute sigma: 341.00ns (0.0%)
    - Calculate challenge: 32.63µs (4.1%)
    - Prove knowledge of `sigma_i`: 260.00ns (0.0%)
    - Unstaged: 140.00ns (0.0%)
  - Round 5: 299.63µs
    - Validate schnorr proofs: 298.43µs (99.6%)
    - Derive resulting public key and other data: 972.00ns (0.3%)
    - Unstaged: 230.00ns (0.1%)


Auxiliary data generation protocol
Protocol Performance:
  - Protocol took 9.57s to complete
In particular:
  - Stage: 15.53µs
    - Retrieve auxiliary data: 130.00ns (0.8%)
    - Setup networking: 15.33µs (98.7%)
    - Unstaged: 70.00ns (0.5%)
  - Round 1: 1.17s
    - Retrieve primes (p and q): 90.00ns (0.0%)
    - Compute paillier decryption key (N): 3.26µs (0.0%)
    - Generate auxiliary params r, λ, t, s: 9.11ms (0.8%)
    - Prove Πprm (ψˆ_i): 1.16s (99.2%)
    - Sample random bytes: 2.31µs (0.0%)
    - Compute hash commitment and sample decommitment: 300.20µs (0.0%)
    - Unstaged: 260.00ns (0.0%)
  - Round 2: 2.04µs
    - Hash received msgs (reliability check): 1.33µs (65.2%)
    - Unstaged: 711.00ns (34.8%)
  - Round 3: 380.00ns
    - Assert other parties hashed messages (reliability check): 211.00ns (55.5%)
    - Unstaged: 169.00ns (44.5%)
  - Round 4: 5.90s
    - Validate round 1 decommitments: 597.58µs (0.0%)
    - Validate П_prm (ψ_i): 2.29s (38.9%)
    - Add together shared random bytes: 1.25µs (0.0%)
    - Compute П_mod (ψ_i): 3.43s (58.2%)
    - Assemble security params for П_fac (ф_i): 6.47µs (0.0%)
    - Compute П_fac (ф_i^j): 171.35ms (2.9%)
    - Unstaged: 1.02µs (0.0%)
  - Round 5: 2.51s
    - Validate ψ_j (П_mod): 2.33s (93.1%)
    - Validate ф_j (П_fac): 172.23ms (6.9%)
    - Assemble auxiliary info: 151.13µs (0.0%)
    - Unstaged: 791.00ns (0.0%)


Signing protocol
Protocol Performance:
  - Protocol took 1.59s to complete
In particular:
  - Stage: 136.89µs
    - Map t-out-of-n protocol to t-out-of-t: 66.17µs (48.3%)
    - Retrieve auxiliary data: 66.19µs (48.4%)
    - Precompute execution id and security params: 652.00ns (0.5%)
    - Setup networking: 3.77µs (2.8%)
    - Unstaged: 100.00ns (0.1%)
  - Round 1: 117.51ms
    - Generate local ephemeral secrets (k_i, y_i, p_i, v_i): 54.67µs (0.0%)
    - Encrypt G_i and K_i: 36.47ms (31.0%)
    - Prove ψ0_j: 80.98ms (68.9%)
    - Unstaged: 690.00ns (0.0%)
  - Round 2: 15.76µs
    - Hash received msgs (reliability check): 15.38µs (97.6%)
    - Unstaged: 382.00ns (2.4%)
  - Round 3: 803.56ms
    - Assert other parties hashed messages (reliability check): 991.00ns (0.0%)
    - Verify psi0 proofs: 92.90ms (11.6%)
    - Sample random r, hat_r, s, hat_s, beta, hat_beta: 16.96µs (0.0%)
    - Encrypt D_ji: 70.29ms (8.7%)
    - Encrypt F_ji: 35.71ms (4.4%)
    - Encrypt hat_D_ji: 70.32ms (8.8%)
    - Encrypt hat_F_ji: 35.78ms (4.5%)
    - Prove psi_ji: 208.80ms (26.0%)
    - Prove psiˆ_ji: 208.57ms (26.0%)
    - Prove psi_prime_ji : 81.18ms (10.1%)
    - Unstaged: 3.22µs (0.0%)
  - Round 4: 574.97ms
    - Retrieve auxiliary data: 5.01µs (0.0%)
    - Validate psi: 165.30ms (28.7%)
    - Validate hat_psi: 164.25ms (28.6%)
    - Validate psi_prime: 92.39ms (16.1%)
    - Compute Gamma, Delta_i, delta_i, chi_i: 71.83ms (12.5%)
    - Prove psi_prime_prime: 81.21ms (14.1%)
    - Unstaged: 682.00ns (0.0%)
  - Presig output: 96.70ms
    - Validate psi_prime_prime: 96.57ms (99.9%)
    - Calculate presignature: 134.69µs (0.1%)
    - Unstaged: 951.00ns (0.0%)
  - Partial signing: 8.93µs
  - Signature reconstruction: 198.30µs


Cargo.toml Outdated Show resolved Hide resolved
wasm/no_std/Cargo.toml Outdated Show resolved Hide resolved
Signed-off-by: Denis Varlakov <[email protected]>
Signed-off-by: Denis Varlakov <[email protected]>
Signed-off-by: Denis Varlakov <[email protected]>
Signed-off-by: Denis Varlakov <[email protected]>
Signed-off-by: Denis Varlakov <[email protected]>
Signed-off-by: Denis Varlakov <[email protected]>
Cargo.toml Outdated Show resolved Hide resolved
@survived survived changed the title Update hd-wallet to v0.6 Update deps, improve tests Nov 27, 2024
Signed-off-by: Denis Varlakov <[email protected]>
wasm/no_std/Cargo.toml Outdated Show resolved Hide resolved
Signed-off-by: Denis Varlakov <[email protected]>
Signed-off-by: Denis Varlakov <[email protected]>
Signed-off-by: Denis Varlakov <[email protected]>
Signed-off-by: Denis Varlakov <[email protected]>
@survived survived marked this pull request as ready for review December 6, 2024 15:33
@survived survived requested a review from maurges December 6, 2024 15:33
Signed-off-by: Denis Varlakov <[email protected]>
@survived
Copy link
Contributor Author

survived commented Dec 9, 2024

@maurges #122 is merged, this PR is unblocked

maurges
maurges previously approved these changes Dec 11, 2024
@survived survived dismissed maurges’s stale review December 11, 2024 14:14

The merge-base changed after approval.

maurges
maurges previously approved these changes Dec 12, 2024
@survived survived dismissed maurges’s stale review December 12, 2024 09:23

The merge-base changed after approval.

maurges
maurges previously approved these changes Dec 12, 2024
@survived survived dismissed maurges’s stale review December 12, 2024 09:28

The merge-base changed after approval.

@survived survived merged commit c669185 into m Dec 13, 2024
19 checks passed
@survived survived deleted the update-hd-wallets branch December 13, 2024 10:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants