275 Commits

Author SHA1 Message Date
wborgeaud
a35cd98b03 New random access gadget 2021-10-18 15:45:52 +02:00
wborgeaud
104fd08e72 Working RAM gate 2021-10-18 15:19:09 +02:00
wborgeaud
9b098a9fbe Trivial random access 2021-10-06 16:37:27 +02:00
Daniel Lubarov
5098c2a386
Have ArithmeticExtensionGate adapt based on available wires (#287) 2021-10-05 23:28:29 -07:00
wborgeaud
242ee26b6f Generalize to fields with less than 64 bits 2021-10-05 17:50:38 +02:00
wborgeaud
6d601c6113 Overflow fixes 2021-10-05 14:27:30 +02:00
Daniel Lubarov
01c2047a66 Outdated TODO 2021-10-03 22:22:30 -07: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
7bf257546e Minor 2021-09-26 16:28:09 -07: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
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
Nicholas Ward
2ec3b29741 addressed comments 2021-09-22 11:49:28 -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
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
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
Nicholas Ward
14fd1dfa6b fmt 2021-09-16 21:06:54 -07:00
Nicholas Ward
a00f2536ff initial memory sorting gadget 2021-09-16 20:44:17 -07:00
wborgeaud
b63d83aacf Add Poseidon gadget 2021-09-16 21:18:08 +02:00
Daniel Lubarov
91f7b4e300
Replace CrandallQuarticField with a more generic QuarticExtension (#232)
* Replace `CrandallQuarticField` with a more generic `QuarticExtension`

And likewise for `CrandallQuadraticField`.

There are a few parameters which we can't automatically derive (in const Rust), so I specified them in a `AutoExtendable` trait.

This would make it fairly easy to add extension fields for `GoldilocksField` and any future fields.

* Attempt to derive 2-adicity, see Hamish's feedback

* Simplify TWO_ADICITY based on chat with Hamish

* PR feedback

* Merge AutoExtendable into Extendable (#235)
2021-09-13 11:45:17 -07:00
Daniel Lubarov
c76eb9ddeb
Prepare for the switch to Poseidon (#228)
* Prepare for the switch to Poseidon

Everything will now select a permutation based on the `PERMUTATION_FAMILY` const.

The `Poseidon` variant won't work quite yet since the gate isn't in place; I left that as a `todo!()`

* fix
2021-09-13 10:22:25 -07:00
Daniel Lubarov
3bc34c59d8
Refactor GMiMC code (#224)
* Refactor GMiMC code

Adds a sub-trait of `Field` called `GMiMCInterface`, which is similar to `PoseidonInterface`.

This lets us have different fields with different GMiMC constants in a type-safe way.

* Remove `Interface`

* Const generic for width
2021-09-07 18:28:28 -07:00
Nicholas Ward
effcc967d0 fmt 2021-09-06 21:39:00 -07:00
Nicholas Ward
c07f99ac81 merge 2021-09-06 21:38:52 -07:00
Nicholas Ward
1818e69ce3 addressed comments 2021-09-06 08:38:47 -07:00
Daniel Lubarov
236a143abf
Move some Field members to a Field64 subtrait (#213)
* Move some Field members to a Field64 subtrait

I.e. move anything specific to 64-bit fields.

Also, relatedly,
- Tweak a bunch of prover code to require `Field64`, since 64-bit stuff is used in a couple places, like the FRI proof-of-work
- Remove `bits()`, which was unused and assumed a 64-bit field
- Rename a couple methods to reflect that they're u64 variants

There are no functional changes.

* Field64 -> PrimeField

* Remove `exp_u32`, `kth_root_u32`

* PrimeField: PrimeField

* Move `to_canonical_biguint` as well

* Add back from_noncanonical_u128
2021-09-05 10:27:11 -07:00
Nicholas Ward
6f885db677 fixes 2021-09-04 16:44:49 -07:00
Nicholas Ward
1fb7eeb03e variable-sized tests 2021-09-04 16:29:33 -07:00
Nicholas Ward
4c3f3cda39 6x6 test 2021-09-04 16:29:33 -07:00
Nicholas Ward
4f7a587bfa fix for non-2x2 permutation case 2021-09-04 16:29:32 -07:00
Daniel Lubarov
f89f49249a wip 2021-09-04 16:27:40 -07:00
Nicholas Ward
10d016a92c chunk size as field 2021-09-03 18:07:21 -07:00
Nicholas Ward
3ad0365967 fixed infinite loop 2021-09-03 18:07:21 -07:00
Nicholas Ward
3494839227 removed more to_vec calls (within maps) 2021-09-03 18:07:21 -07:00
Nicholas Ward
260d4bd13c removed to_vec calls 2021-09-03 18:07:21 -07:00
Nicholas Ward
485d4862ff fixes 2021-09-03 18:07:21 -07:00
Nicholas Ward
4ea1df82ba fixes 2021-09-03 18:07:21 -07:00
Nicholas Ward
ab744a7c36 edits and fixes 2021-09-03 18:07:21 -07:00
Nicholas Ward
d4aa4d7153 fixes and new generator 2021-09-03 18:07:21 -07:00
Nicholas Ward
f7607dddd4 fmt 2021-09-03 18:07:21 -07:00
Nicholas Ward
fe843db57f many fixes 2021-09-03 18:07:20 -07:00
Nicholas Ward
a1d5f5b6fe progress 2021-09-03 18:07:20 -07:00
Nicholas Ward
013c8bb612 progress 2021-09-03 18:07:20 -07:00
Nicholas Ward
2ab37e688f progress 2021-09-03 18:07:20 -07:00