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

Add docs #50

Merged
merged 7 commits into from
Jul 11, 2023
Merged

Add docs #50

merged 7 commits into from
Jul 11, 2023

Conversation

survived
Copy link
Contributor

@survived survived commented Jun 28, 2023

Blocked by #49

@survived survived force-pushed the docs branch 3 times, most recently from 581ecdb to 6e7ceaa Compare June 29, 2023 10:16
@survived survived marked this pull request as ready for review June 29, 2023 15:08
@survived survived requested a review from maurges June 29, 2023 15:08
Base automatically changed from polynomial to m July 3, 2023 13:51
cggmp21/src/key_share.rs Outdated Show resolved Hide resolved
cggmp21/src/key_share.rs Outdated Show resolved Hide resolved
cggmp21/src/key_share.rs Outdated Show resolved Hide resolved
cggmp21/src/security_level.rs Show resolved Hide resolved
@github-actions
Copy link

github-actions bot commented Jul 11, 2023

Crate direct deps

Direct deps
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#a2639222)
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
--- direct-deps-base	2023-07-11 13:17:58.020091217 +0000
+++ direct-deps-pr	2023-07-11 13:17:58.540088650 +0000
@@ -9 +9 @@
-round-based v0.2.0 (https://github.com/Zengo-X/round-based-protocol?branch=round-based2#16bb42a4)
+round-based v0.2.0 (https://github.com/Zengo-X/round-based-protocol?branch=round-based2#46bdc24d)

All deps

cargo tree
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.56
│   │       │       │   └── unicode-ident v1.0.4
│   │       │       ├── quote v1.0.26
│   │       │       │   └── proc-macro2 v1.0.56 (*)
│   │       │       └── syn v2.0.15
│   │       │           ├── proc-macro2 v1.0.56 (*)
│   │       │           ├── 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.56 (*)
│   │       │   ├── quote v1.0.26 (*)
│   │       │   └── syn v1.0.101
│   │       │       ├── proc-macro2 v1.0.56 (*)
│   │       │       ├── 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.56 (*)
│   │           ├── quote v1.0.26 (*)
│   │           ├── syn v1.0.101 (*)
│   │           └── synstructure v0.12.6
│   │               ├── proc-macro2 v1.0.56 (*)
│   │               ├── 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.56 (*)
│   │       │   ├── quote v1.0.26 (*)
│   │       │   └── syn v1.0.101 (*)
│   │       ├── proc-macro2 v1.0.56 (*)
│   │       ├── 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.56 (*)
│   │       │   │   ├── 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.56 (*)
│   │       ├── 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#a2639222)
│   ├── generic-ec v0.0.0 (https://github.com/dfns-labs/generic-ec?branch=m#448b0789) (*)
│   ├── libpaillier v0.5.0
│   │   ├── digest v0.10.6 (*)
│   │   ├── serde v1.0.160 (*)
│   │   ├── serde_bare v0.5.0
│   │   │   └── serde v1.0.160 (*)
│   │   ├── 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.160 (*)
│   │   │   ├── 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.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.56 (*)
│   │       │   │   ├── 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.56 (*)
│   │       ├── quote v1.0.26 (*)
│   │       └── syn v2.0.15 (*)
│   ├── 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.56 (*)
│   │       ├── quote v1.0.26 (*)
│   │       └── 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#46bdc24d)
│   ├── async-stream v0.3.3
│   │   ├── async-stream-impl v0.3.3 (proc-macro)
│   │   │   ├── proc-macro2 v1.0.56 (*)
│   │   │   ├── 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.56 (*)
│   │   ├── 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.56 (*)
│       │   ├── 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 (*)
└── thiserror v1.0.37 (*)

Compared to base branch

Diff
--- all-deps-base	2023-07-11 13:17:58.260090032 +0000
+++ all-deps-pr	2023-07-11 13:17:58.796087386 +0000
@@ -58,2 +58,2 @@
-round-based v0.2.0 (https://github.com/Zengo-X/round-based-protocol?branch=round-based2#16bb42a4)
-round-based-derive v0.1.0 (proc-macro) (https://github.com/Zengo-X/round-based-protocol?branch=round-based2#16bb42a4)
+round-based v0.2.0 (https://github.com/Zengo-X/round-based-protocol?branch=round-based2#46bdc24d)
+round-based-derive v0.1.0 (proc-macro) (https://github.com/Zengo-X/round-based-protocol?branch=round-based2#46bdc24d)

@survived survived requested a review from maurges July 11, 2023 13:15
@github-actions
Copy link

github-actions bot commented Jul 11, 2023

Benchmark Result

Benchmarks
RUST_TESTS_SEED=ea6e287023b6566ea050d3574b8cdf7188e62ca2a30785772e461ea122b45c3a
n = 3

Non-threshold DKG
Protocol Performance:
  - Protocol took 756.75µs to complete
In particular:
  - Setup: 8.90µs
    - Setup networking: 8.70µs (97.8%)
    - Unstaged: 200.00ns (2.2%)
  - Round 1: 191.31µs
    - Compute execution id: 400.00ns (0.2%)
    - Sample x_i, rid_i: 84.81µs (44.3%)
    - Sample schnorr commitment: 78.40µs (41.0%)
    - Commit to public data: 27.30µs (14.3%)
    - Unstaged: 400.00ns (0.2%)
  - Round 2: 4.70µs
    - Hash received msgs (reliability check): 4.50µs (95.7%)
    - Unstaged: 200.00ns (4.3%)
  - Round 3: 400.00ns
    - Assert other parties hashed messages (reliability check): 200.00ns (50.0%)
    - Unstaged: 200.00ns (50.0%)
  - Round 4: 72.01µs
    - Validate decommitments: 66.20µs (91.9%)
    - Calculate challege rid: 5.20µs (7.2%)
    - Prove knowledge of `x_i`: 300.00ns (0.4%)
    - Unstaged: 300.00ns (0.4%)
  - Round 5: 479.43µs
    - Validate schnorr proofs: 478.93µs (99.9%)
    - Unstaged: 500.00ns (0.1%)


Threshold DKG
Protocol Performance:
  - Protocol took 1.82ms to complete
In particular:
  - Setup: 3.30µs
    - Setup networking: 3.20µs (97.0%)
    - Unstaged: 100.00ns (3.0%)
  - Round 1: 271.12µs
    - Compute execution id: 200.00ns (0.1%)
    - Sample rid_i, schnorr commitment, polynomial: 236.41µs (87.2%)
    - Commit to public data: 34.20µs (12.6%)
    - Unstaged: 301.00ns (0.1%)
  - Round 2: 4.80µs
    - Hash received msgs (reliability check): 4.60µs (95.8%)
    - Unstaged: 200.00ns (4.2%)
  - Round 3: 500.00ns
    - Assert other parties hashed messages (reliability check): 200.00ns (40.0%)
    - Unstaged: 300.00ns (60.0%)
  - Round 4: 1.18ms
    - Validate decommitments: 64.00µs (5.4%)
    - Validate data size: 800.00ns (0.1%)
    - Validate Feldmann VSS: 587.14µs (49.9%)
    - Compute rid: 400.00ns (0.0%)
    - Compute Ys: 495.33µs (42.1%)
    - Compute sigma: 800.00ns (0.1%)
    - Calculate challenge: 27.70µs (2.4%)
    - Prove knowledge of `sigma_i`: 300.00ns (0.0%)
    - Unstaged: 300.00ns (0.0%)
  - Round 5: 358.62µs
    - Validate schnorr proofs: 356.22µs (99.3%)
    - Derive resulting public key and other data: 1.80µs (0.5%)
    - Unstaged: 600.00ns (0.2%)


Key refresh protocol
Protocol Performance:
  - Protocol took 3.43s to complete
In particular:
  - Setup: 16.70µs
    - Retrieve auxiliary data: 800.00ns (4.8%)
    - Setup networking: 11.80µs (70.7%)
    - Precompute execution id and shared state: 3.80µs (22.8%)
    - Unstaged: 300.00ns (1.8%)
  - Round 1: 396.66ms
    - Retrieve primes (p and q): 400.00ns (0.0%)
    - Compute paillier decryption key (N): 21.63ms (5.5%)
    - Generate secret x_i and public X_i: 240.21µs (0.1%)
    - Generate auxiliary params r, λ, t, s: 5.67ms (1.4%)
    - Prove Πprm (ψˆ_i): 368.37ms (92.9%)
    - Compute schnorr commitment τ_j: 241.92µs (0.1%)
    - Sample random bytes: 300.00ns (0.0%)
    - Compute hash commitment and sample decommitment: 504.03µs (0.1%)
    - Unstaged: 300.00ns (0.0%)
  - Round 2: 5.20µs
    - Hash received msgs (reliability check): 4.70µs (90.4%)
    - Unstaged: 500.00ns (9.6%)
  - Round 3: 600.00ns
    - Assert other parties hashed messages (reliability check): 300.00ns (50.0%)
    - Unstaged: 300.00ns (50.0%)
  - Round 4: 2.10s
    - Validate round 1 decommitments: 998.86µs (0.0%)
    - Validate data sizes: 500.00ns (0.0%)
    - Validate П_prm (ψ_i): 689.80ms (32.8%)
    - Validate X_i: 8.60µs (0.0%)
    - Compute paillier encryption keys: 14.00µs (0.0%)
    - Add together shared random bytes: 4.80µs (0.0%)
    - Compute П_mod (ψ_i): 1.21s (57.6%)
    - Assemble security params for П_fac (ф_i): 2.03ms (0.1%)
    - Compute schnorr proof ψ_i^j: 10.90µs (0.0%)
    - Prepare auxiliary params and security level for proofs: 300.00ns (0.0%)
    - Paillier encryption of x_i^j: 48.45ms (2.3%)
    - Compute П_fac (ф_i^j): 151.72ms (7.2%)
    - Unstaged: 1.90µs (0.0%)
  - Round 5: 929.18ms
    - Paillier decrypt x_j^i from C_j^i: 41.70ms (4.5%)
    - Validate shares: 160.11µs (0.0%)
    - Validate schnorr proofs п_j and ψ_j^k: 958.96µs (0.1%)
    - Validate ψ_j (П_mod): 733.80ms (79.0%)
    - Validate ф_j (П_fac): 152.56ms (16.4%)
    - Calculate new x_i: 900.00ns (0.0%)
    - Calculate new X_i: 8.00µs (0.0%)
    - Assemble new core share: 500.00ns (0.0%)
    - Assemble auxiliary info: 2.50µs (0.0%)
    - Unstaged: 800.00ns (0.0%)


Signing protocol
Protocol Performance:
  - Protocol took 2.26s to complete
In particular:
  - Setup: 25.83ms
    - Map t-out-of-n protocol to t-out-of-t: 7.20µs (0.0%)
    - Retrieve auxiliary data: 25.82ms (99.9%)
    - Precompute execution id and security params: 1.80µs (0.0%)
    - Setup networking: 4.50µs (0.0%)
    - Unstaged: 200.00ns (0.0%)
  - Round 1: 173.37ms
    - Generate local ephemeral secrets (k_i, y_i, p_i, v_i): 49.10µs (0.0%)
    - Encrypt G_i and K_i: 45.30ms (26.1%)
    - Prove ψ0_j: 128.02ms (73.8%)
    - Unstaged: 2.40µs (0.0%)
  - Round 2: 57.80µs
    - Hash received msgs (reliability check): 57.50µs (99.5%)
    - Unstaged: 300.00ns (0.5%)
  - Round 3: 1.11s
    - Assert other parties hashed messages (reliability check): 701.00ns (0.0%)
    - Verify psi0 proofs: 105.94ms (9.5%)
    - Sample random r, hat_r, s, hat_s, beta, hat_beta: 76.61µs (0.0%)
    - Encrypt D_ji: 89.03ms (8.0%)
    - Encrypt F_ji: 81.71ms (7.3%)
    - Encrypt hat_D_ji: 77.92ms (7.0%)
    - Encrypt hat_F_ji: 71.67ms (6.4%)
    - Prove psi_ji: 293.73ms (26.4%)
    - Prove psiˆ_ji: 270.55ms (24.3%)
    - Prove psi_prime_ji : 122.69ms (11.0%)
    - Unstaged: 1.70µs (0.0%)
  - Round 4: 831.28ms
    - Retrieve auxiliary data: 7.80µs (0.0%)
    - Validate psi: 265.02ms (31.9%)
    - Validate hat_psi: 255.01ms (30.7%)
    - Validate psi_prime: 110.54ms (13.3%)
    - Compute Gamma, Delta_i, delta_i, chi_i: 81.41ms (9.8%)
    - Prove psi_prime_prime: 119.30ms (14.4%)
    - Unstaged: 501.00ns (0.0%)
  - Presig output: 111.73ms
    - Validate psi_prime_prime: 111.55ms (99.8%)
    - Calculate presignature: 178.11µs (0.2%)
    - Unstaged: 600.00ns (0.0%)
  - Partial signing: 12.50µs
  - Signature reconstruction: 265.12µs


@survived survived merged commit 51f2998 into m Jul 11, 2023
4 checks passed
@survived survived deleted the docs branch July 11, 2023 13:28
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