1109 Commits

Author SHA1 Message Date
Nicholas Ward
0811279fb7 range check outputs, and addressed comments 2021-09-29 14:45:14 -07:00
Daniel Lubarov
ac97412667 Renaming 2021-09-29 12:07:27 -07:00
wborgeaud
a97b9a7112 Add compressed FRI proof type using a HashMap 2021-09-29 21:01:15 +02:00
Daniel Lubarov
3f22663296
Split up PartitionWitness data (#273)
* Split up `PartitionWitness` data

This addresses two minor inefficiencies:
- Some preprocessed forest data was being cloned during proving.
- Some of the `ForestNode` data (like node sizes) is only needed in preprocessing, not proving. It was taking up cache space during proving because it was interleaved with data that is used during proving (parents, values).

Now `Forest` contains the disjoint-set forest. `PartitionWitness` is now mainly a Vec of target values; it also holds a reference to the (preprocessed) representative map.

On my laptop, this speeds up witness generation ~12%, resulting in an overall ~0.5% speedup.

* Feedback

* No size data (#278)

* No size data

* feedback
2021-09-28 22:31:20 -07:00
Nicholas Ward
932cc812ab U32ArithmeticGate 2021-09-28 17:03:35 -07:00
Daniel Lubarov
3d39925973
Couple tweaks for Goldilocks (#274)
- impl `RichField`
- Fix missing imports (easy to miss since they're conditionally compiled)
- Have the benchmarks use Goldilocks
2021-09-28 10:03:19 -07:00
Daniel Lubarov
bd38ada0d1 Change case to get rid of warning 2021-09-27 22:39:42 -07:00
Hamish Ivey-Law
a0de564806
Implement Poseidon width 8 and 12 for Goldilocks field. (#268)
* Implement Poseidon width 8 and 12 for Goldilocks field.

* Comment on generating Poseidon implementations.

* Update Goldilocks 8 constants with corrected MDS matrix.

* Add Goldilocks test vectors and refactor tests.

* Add test vectors of all -1's.

* cargo fmt pedantry.
2021-09-28 10:51:03 +10:00
Daniel Lubarov
31b1a0a9da
Less use of ZK configs in tests (#272)
ZK circuit tests are quite slow, so I think we should use them very sparingly, and not in any tests with loops
2021-09-27 11:42:53 -07:00
Daniel Lubarov
76fcc4ee2c
Very explicit path compression (#271)
* Very explicit path compression

* fmt

* Remove `t` -- no longer needed

* Move comment

* Also remove index field
2021-09-27 10:00:44 -07:00
wborgeaud
1a508d0c19
Merge pull request #270 from mir-protocol/poseidon_8
Use `SPONGE_WIDTH` instead of hardcoded values in various places
2021-09-27 12:55:46 +02:00
wborgeaud
df9a211475 PR comments 2021-09-27 12:29:27 +02:00
Daniel Lubarov
541ad5d755 Minor 2021-09-26 16:37:35 -07:00
Daniel Lubarov
7bf257546e Minor 2021-09-26 16:28:09 -07:00
wborgeaud
747c9f894b Back to width 12 2021-09-26 20:09:26 +02:00
Daniel Lubarov
f382289896
Derive challenges from other proof fields (#262)
* Derive challenges from other proof fields

* Delete failing test

Seems really hard to get the challenges right with the new model.

* Move PoW check

* Other feedback
2021-09-25 19:41:48 -07:00
wborgeaud
1a55538e23 8->SPONGE_WIDTH in most places 2021-09-24 15:50:48 +02:00
wborgeaud
42a7ff9cc2 Working 2021-09-24 13:06:07 +02:00
Nicholas Ward
23b1161d27
Merge pull request #249 from mir-protocol/sorting_gadget
Memory sorting gadget
2021-09-23 09:28:47 -07:00
Nicholas Ward
0c0a8fd862 tweaks 2021-09-23 09:16:38 -07:00
Daniel Lubarov
d2dcc31a6c
Fix witness generation performance (#269)
See #266. This avoids the quadratic costs (w.r.t. partition size), as we will now only enumerate watchers the first time a representative is assigned.
2021-09-22 23:45:16 -07:00
Daniel Lubarov
202967a40b Other tweaks 2021-09-22 18:14:58 -07:00
Daniel Lubarov
d541e251ee Add a MemoryOp to simplify MemoryOpSortGenerator 2021-09-22 18:10:38 -07:00
Nicholas Ward
8aa4376360 addressed comments (set sorted values in partial witness; no more directly setting gate inputs) 2021-09-22 14:03:27 -07:00
Daniel Lubarov
e8cb2bbd22
Witness generation fix (#266)
When we went through newly-populated values, as in

    for &(watch, _) in &buffer.target_values

`watch` was not necessarily a representative, because it came from a `GeneratedValues`, whose `set_target` doesn't know about representatives.
2021-09-22 13:43:11 -07:00
Nicholas Ward
2ec3b29741 addressed comments 2021-09-22 11:49:28 -07:00
Jakub Nabaglo
7360391515
Cache FFT roots (#261) 2021-09-22 10:56:09 -07:00
Nicholas Ward
6c4173d2ec fmt 2021-09-21 18:02:56 -07:00
Nicholas Ward
644d87e495 fixes galore 2021-09-21 18:01:21 -07:00
Jakub Nabaglo
46cc27571d
Delete unrolled FFT (#258) 2021-09-21 17:32:38 -07:00
Jakub Nabaglo
2f8286ff98
Fix a few warnings (#259) 2021-09-21 13:12:46 -07:00
Daniel Lubarov
43cbb84cc9
Have verify_merkle_proof call permute_swapped (#257)
Rather than adding the gate "manually".
2021-09-21 12:29:37 -07:00
wborgeaud
5f3a5e6bad Add num_bits==1,2 cases in le_sum 2021-09-21 18:27:49 +02:00
wborgeaud
4305a95cdb Small fixes to the le_sum and reduce gadgets 2021-09-21 12:52:28 +02:00
wborgeaud
5d8241760f
Merge pull request #255 from mir-protocol/better_compressed_merkle_paths
Simpler Merkle paths compression
2021-09-21 08:56:34 +02:00
wborgeaud
391759479e PR feedback 2021-09-21 08:37:23 +02:00
Jakub Nabaglo
1369dd7c76
Many small optimizations to scalar Poseidon (#253)
* Many small optimizations

* Lints

* Hamish comments

* Inlining
2021-09-20 10:52:12 -07:00
wborgeaud
1f42916bfc Comments 2021-09-20 17:58:25 +02:00
wborgeaud
36e4d3608d Working (de)compression for FRI proofs 2021-09-20 17:34:52 +02:00
Daniel Lubarov
471ace6d85
Remove loop unrolling in a few more places where it doesn't seem important (#254)
LLVM will do some unrolling/inlining, but I think we should only force it in places we know it's really justified.
2021-09-20 07:50:00 -07:00
wborgeaud
422e72954c Working path (de)compression 2021-09-20 14:37:28 +02:00
Jakub Nabaglo
5e748ed76b
#[inline] add_assign in CrandallField (#252) 2021-09-19 10:03:57 -07:00
wborgeaud
0be8650bca PR feedback 2021-09-18 09:23:39 +02:00
wborgeaud
b8f6b3a778 Merge branch 'main' into poseidon_gate 2021-09-18 08:55:54 +02:00
Nicholas Ward
3d93766cc8 test (wip) 2021-09-17 14:50:37 -07:00
Nicholas Ward
8dd00b8d41 added generator 2021-09-17 13:40:07 -07:00
Nicholas Ward
2c1c116ead fixes (addressed comments) 2021-09-17 13:09:24 -07:00
Jakub Nabaglo
d3de2b5518 Fix alignment assumptions in AVX2 Poseidon 2021-09-17 10:04:05 -07:00
wborgeaud
14bbf5ae11 Fix AVX2 conflict 2021-09-17 17:50:43 +02:00
wborgeaud
675f32835b Minor 2021-09-17 13:50:42 +02:00