Commit b1689c5
Merkleproof verify circuit (#143)
* merkletree: add keypath circuit
* merkletree-circuit: implement proof of existence verification in-circuit
* parametrize max_depth at the tree circuit
* Constrain selectors in-circuit
* implement merketree nonexistence proof circuit, and add edgecase tests
* add non-existence proofs documentation in the mdbook, mv EMPTY->EMPTY_VALUE & NULL->EMPTY_HASH, dependency clean and public exposure methods
* review comments, some extra polishing and add a test that expects wrong proofs to fail
* Add circuit to check only merkleproofs-of-existence
With this, the merkletree_circuit module offers two different circuits:
- `MerkleProofCircuit`: allows to verify both proofs of existence and proofs
non-existence with the same circuit.
- `MerkleProofExistenceCircuit`: allows to verify proofs of existence only.
In this way, if only proofs of existence are needed,
`MerkleProofExistenceCircuit` should be used, which requires less amount
of constraints than `MerkleProofCircuit`.
* Code review
---------
Co-authored-by: Ahmad <[email protected]>1 parent abce0af commit b1689c5
File tree
9 files changed
+683
-26
lines changed- book/src
- src
- backends/plonky2
- primitives
- middleware
9 files changed
+683
-26
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
137 | 137 | | |
138 | 138 | | |
139 | 139 | | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
140 | 144 | | |
141 | 145 | | |
142 | 146 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
| 33 | + | |
34 | 34 | | |
35 | | - | |
| 35 | + | |
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
110 | 110 | | |
111 | 111 | | |
112 | 112 | | |
113 | | - | |
| 113 | + | |
114 | 114 | | |
115 | 115 | | |
116 | 116 | | |
| |||
137 | 137 | | |
138 | 138 | | |
139 | 139 | | |
140 | | - | |
| 140 | + | |
141 | 141 | | |
142 | 142 | | |
143 | 143 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
11 | 14 | | |
12 | 15 | | |
13 | 16 | | |
| |||
178 | 181 | | |
179 | 182 | | |
180 | 183 | | |
181 | | - | |
182 | | - | |
| 184 | + | |
| 185 | + | |
183 | 186 | | |
184 | 187 | | |
185 | 188 | | |
| |||
209 | 212 | | |
210 | 213 | | |
211 | 214 | | |
212 | | - | |
213 | | - | |
| 215 | + | |
| 216 | + | |
214 | 217 | | |
215 | | - | |
| 218 | + | |
216 | 219 | | |
217 | 220 | | |
218 | 221 | | |
| |||
244 | 247 | | |
245 | 248 | | |
246 | 249 | | |
247 | | - | |
| 250 | + | |
248 | 251 | | |
249 | 252 | | |
250 | 253 | | |
251 | 254 | | |
| 255 | + | |
252 | 256 | | |
253 | 257 | | |
254 | 258 | | |
| |||
302 | 306 | | |
303 | 307 | | |
304 | 308 | | |
305 | | - | |
| 309 | + | |
306 | 310 | | |
307 | 311 | | |
308 | 312 | | |
309 | 313 | | |
310 | 314 | | |
311 | 315 | | |
312 | | - | |
| 316 | + | |
313 | 317 | | |
314 | 318 | | |
315 | 319 | | |
| |||
360 | 364 | | |
361 | 365 | | |
362 | 366 | | |
363 | | - | |
| 367 | + | |
364 | 368 | | |
365 | 369 | | |
366 | 370 | | |
| |||
472 | 476 | | |
473 | 477 | | |
474 | 478 | | |
475 | | - | |
476 | | - | |
| 479 | + | |
| 480 | + | |
477 | 481 | | |
478 | 482 | | |
479 | 483 | | |
480 | | - | |
| 484 | + | |
481 | 485 | | |
482 | 486 | | |
483 | 487 | | |
| |||
520 | 524 | | |
521 | 525 | | |
522 | 526 | | |
523 | | - | |
| 527 | + | |
524 | 528 | | |
525 | 529 | | |
526 | 530 | | |
| |||
0 commit comments