Skip to content

Commit 94ce7d5

Browse files
authored
Poseidon gkr (#81)
* wip * wip * wip * 2 full rounds * partial rounds * wip * real constants * stats * 590K poseidons/s * fix (still wip) * works!! * evaluate_sequential * typo * fix deadlock * experiment-double-internal-layers * Revert "experiment-double-internal-layers" This reverts commit cff0334. * naming * WOAwwwwwww * working for real with the pcs * overhead versus plaintext * pretty text * evaluate_univariate_multilinear * create a dedicated "poseidon_circuit" crate * wip * using packed pcs * simplify * simplify * w * compress * optional compress * GKR integration in leanVM, wip * abstract away the univariate skip from Poseidon GKR api * fix * fix * wip * fix * gud * remove dead code * fix whir * Proving_Poseidons_with_GKR.pdf + reset benchmarks + cleanup * revert reseting benchmarks * log scale for WHIR recursion graph --------- Co-authored-by: Tom Wambsgans <[email protected]>
1 parent 6956042 commit 94ce7d5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+4616
-3565
lines changed

Cargo.lock

Lines changed: 227 additions & 207 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 7 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,11 @@ lean_prover = { path = "crates/lean_prover" }
5151
rec_aggregation = { path = "crates/rec_aggregation" }
5252
witness_generation = { path = "crates/lean_prover/witness_generation" }
5353
vm_air = { path = "crates/lean_prover/vm_air" }
54+
poseidon_circuit = { path = "crates/poseidon_circuit" }
5455

5556
# External
5657
thiserror = "2.0"
58+
clap = { version = "4.3.10", features = ["derive"] }
5759
rand = "0.9.2"
5860
sha3 = "0.10.8"
5961
rayon = "1.5.1"
@@ -78,26 +80,15 @@ p3-poseidon2-air = { git = "https://github.com/TomWambsgans/Plonky3.git", branch
7880
p3-goldilocks = { git = "https://github.com/TomWambsgans/Plonky3.git", branch = "lean-multisig" }
7981
p3-challenger = { git = "https://github.com/TomWambsgans/Plonky3.git", branch = "lean-multisig" }
8082
p3-util = { git = "https://github.com/TomWambsgans/Plonky3.git", branch = "lean-multisig" }
83+
p3-monty-31 = { git = "https://github.com/TomWambsgans/Plonky3.git", branch = "lean-multisig" }
8184

8285
whir-p3 = { git = "https://github.com/TomWambsgans/whir-p3", branch = "lean-multisig" }
8386
multilinear-toolkit = { git = "https://github.com/leanEthereum/multilinear-toolkit.git" }
8487

8588
[dependencies]
86-
air.workspace = true
87-
p3-field.workspace = true
88-
p3-koala-bear.workspace = true
89-
p3-poseidon2.workspace = true
90-
rand.workspace = true
91-
p3-poseidon2-air.workspace = true
92-
p3-matrix.workspace = true
93-
p3-challenger.workspace = true
94-
whir-p3.workspace = true
95-
p3-uni-stark.workspace = true
96-
utils.workspace = true
97-
p3-util.workspace = true
98-
packed_pcs.workspace = true
99-
p3-air.workspace = true
100-
multilinear-toolkit.workspace = true
89+
clap.workspace = true
90+
rec_aggregation.workspace = true
91+
poseidon_circuit.workspace = true
10192

10293
# [patch."https://github.com/TomWambsgans/Plonky3.git"]
10394
# p3-koala-bear = { path = "../zk/Plonky3/koala-bear" }
@@ -110,28 +101,13 @@ multilinear-toolkit.workspace = true
110101
# p3-poseidon2-air = { path = "../zk/Plonky3/poseidon2-air" }
111102
# p3-dft = { path = "../zk/Plonky3/dft" }
112103
# p3-challenger = { path = "../zk/Plonky3/challenger" }
104+
# p3-monty-31 = { path = "../zk/Plonky3/monty-31" }
113105

114106
# [patch."https://github.com/TomWambsgans/whir-p3.git"]
115107
# whir-p3 = { path = "../zk/whir/fork-whir-p3" }
116108

117109
# [patch."https://github.com/leanEthereum/multilinear-toolkit.git"]
118110
# multilinear-toolkit = { path = "../zk/multilinear-toolkit" }
119111

120-
[dev-dependencies]
121-
criterion = { version = "0.7", default-features = false, features = ["cargo_bench_support"] }
122-
rec_aggregation.workspace = true
123-
124112
[profile.release]
125113
lto = "thin"
126-
127-
[[bench]]
128-
name = "poseidon2"
129-
harness = false
130-
131-
[[bench]]
132-
name = "recursion"
133-
harness = false
134-
135-
[[bench]]
136-
name = "xmss"
137-
harness = false

README.md

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,56 +6,54 @@ XMSS + minimal [zkVM](minimal_zkVM.pdf) = lightweight PQ signatures, with unboun
66
## Proving System
77

88

9-
- AIR tables committed via multilinear polynomial, using [WHIR](https://eprint.iacr.org/2024/1586.pdf)
9+
- [WHIR](https://eprint.iacr.org/2024/1586.pdf)
1010
- [SuperSpartan](https://eprint.iacr.org/2023/552.pdf), with AIR-specific optimizations developed by W. Borgeaud in [A simple multivariate AIR argument inspired by SuperSpartan](https://solvable.group/posts/super-air/#fnref:1)
1111
- [Univariate Skip](https://eprint.iacr.org/2024/108.pdf)
1212
- [Logup*](https://eprint.iacr.org/2025/946.pdf)
1313
- ...
1414

1515
The VM design is inspired by the famous [Cairo paper](https://eprint.iacr.org/2021/1063.pdf).
1616

17-
Details on how to prove AIR constraints in the multilinear settings are described in [Whirlaway.pdf](Whirlaway.pdf).
18-
19-
[Deep-wiki](https://deepwiki.com/leanEthereum/leanMultisig/1-overview) (thanks [adust09](https://github.com/adust09))
20-
21-
2217
## Benchmarks
2318

24-
cpu: i9-12900H, ram: 32 gb
25-
26-
> TLDR: Slow, **but there is hope** (cf [TODO](TODO.md))
19+
Benchmarks are performed on 2 laptops:
20+
- i9-12900H, 32 gb of RAM
21+
- mac m4 max
2722

28-
target ≈ 128 bits of security, currently using conjecture: 4.12 of [WHIR](https://eprint.iacr.org/2024/1586.pdf), "up to capacity" (TODO: a version without any conjecture, requires an extension of koala-bear of degree > 5)
23+
target ≈ 128 bits of security, currently using conjecture: 4.12 of [WHIR](https://eprint.iacr.org/2024/1586.pdf), "up to capacity" (TODO: provable security)
2924

3025
### Poseidon2
3126

27+
Poseidon2 over 16 KoalaBear field elements.
28+
3229
```console
33-
RUSTFLAGS='-C target-cpu=native' cargo run --release
30+
RUSTFLAGS='-C target-cpu=native' cargo run --release -- poseidon --log-n-perms 20
3431
```
3532

36-
50 % over 16 field elements, 50 % over 24 field elements. rate = 1/2
37-
3833
![Alt text](docs/benchmark_graphs/graphs/raw_poseidons.svg)
3934

4035
### Recursion
4136

42-
```console
43-
RUSTFLAGS='-C target-cpu=native' cargo test --release --package rec_aggregation --lib -- recursion::test_whir_recursion --nocapture
44-
```
4537

4638
The full recursion program is not finished yet. Instead, we prove validity of a WHIR opening, with 25 variables, and rate = 1/4.
4739

40+
```console
41+
RUSTFLAGS='-C target-cpu=native' cargo run --release -- recursion
42+
```
43+
4844
![Alt text](docs/benchmark_graphs/graphs/recursive_whir_opening.svg)
4945

5046
### XMSS aggregation
5147

5248
```console
53-
RUSTFLAGS='-C target-cpu=native' NUM_XMSS_AGGREGATED='500' cargo test --release --package rec_aggregation --lib -- xmss_aggregate::test_xmss_aggregate --nocapture
49+
RUSTFLAGS='-C target-cpu=native' cargo run --release -- xmss --n-signatures 800
5450
```
5551

56-
500 XMSS aggregated. "Trivial encoding" (for now).
52+
[Trivial encoding](docs/XMSS_trivial_encoding.pdf) (for now).
53+
54+
55+
![Alt text](docs/benchmark_graphs/graphs/xmss_aggregated.svg)
5756

58-
![Alt text](docs/benchmark_graphs/graphs/xmss_aggregated_time.svg)
5957
![Alt text](docs/benchmark_graphs/graphs/xmss_aggregated_overhead.svg)
6058

6159
### Proof size
@@ -65,7 +63,7 @@ With conjecture "up to capacity", current proofs with rate = 1/2 are about ≈ 4
6563
- The remaining 100 - 200 KiB will be significantly reduced in the future (this part has not been optimized at all).
6664
- WHIR proof size will also be reduced, thanks to merkle pruning (TODO).
6765

68-
Reasonable target: 256 KiB for fast proof, 128 KiB for slower proofs (rate = 1/4 or 1/8).
66+
Target: 256 KiB for fast proof, 128 KiB for slower proofs (rate = 1/4 or 1/8).
6967

7068
## Credits
7169

benches/poseidon2.rs

Lines changed: 0 additions & 42 deletions
This file was deleted.

benches/recursion.rs

Lines changed: 0 additions & 23 deletions
This file was deleted.

benches/xmss.rs

Lines changed: 0 additions & 26 deletions
This file was deleted.

crates/air/Cargo.toml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,8 @@ p3-uni-stark.workspace = true
1515
p3-matrix.workspace = true
1616
p3-util.workspace = true
1717
multilinear-toolkit.workspace = true
18-
p3-koala-bear.workspace = true
19-
rand.workspace = true
20-
whir-p3.workspace = true
21-
packed_pcs.workspace = true
22-
2318

2419
[dev-dependencies]
2520
p3-koala-bear.workspace = true
2621
p3-matrix.workspace = true
27-
rand.workspace = true
22+
rand.workspace = true

crates/air/src/examples/mod.rs

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)