44 Commits

Author SHA1 Message Date
wborgeaud
e26eb5f4ab Merge branch 'main' into arity4
# Conflicts:
#	src/gates/mod.rs
2021-11-22 22:32:37 +01:00
wborgeaud
8522026c36 Change file structure 2021-11-22 11:39:56 +01:00
wborgeaud
0de408c40f MulExtensionGate 2021-11-19 09:31:06 +01:00
wborgeaud
d44cb96744 Merge branch 'main' into reducing_ext_gate 2021-11-15 09:22:35 +01:00
Daniel Lubarov
857b74bac5
Bring back the base field arithmetic gate (#343)
* Bring back the base field arithmetic gate

* fix
2021-11-12 09:48:27 -08:00
wborgeaud
72ef58c19d Add ReducingExtGate 2021-11-12 18:24:08 +01:00
Nicholas Ward
3fff08aa80 U32 subtraction gate 2021-11-10 09:53:29 -08:00
Nicholas Ward
0ff6e6e0a0 fmt 2021-11-10 09:53:28 -08:00
Nicholas Ward
7e8c021b46 comparison gate 2021-11-10 09:53:28 -08:00
Daniel Lubarov
c6f91148d5
PoseidonMdsGate (#330)
PoseidonGate's recursive evaluations were using a lot of gates, and the MDS layer was the main culprit.

The other issue is that `constant_layer_recursive` creates a bunch of `ArithmeticGate`s with unique constants. We could either change `ArithmeticGate` to support different constants per operation, or wire in constants from `ConstantGate`, and change `ConstantGate` to support several constants per gate.

This won't really help anything near term since we're still between 2^12 and 2^13, but could have some benefits later, depending on what recursion arities and security settings we end up using.

`PoseidonMdsGate` needs `2 * D * WIDTH = 48` routed wires, and the combination of adding a gate and increasing routed wires slows down the prover a bit. So for now, I kept it at 28 wires, and the old code path is still used.
2021-11-02 08:16:28 -07:00
Nicholas Ward
932cc812ab U32ArithmeticGate 2021-09-28 17:03:35 -07:00
wborgeaud
b8f6b3a778 Merge branch 'main' into poseidon_gate 2021-09-18 08:55:54 +02:00
wborgeaud
b11e54d6ed Semi-working 2021-09-16 17:51:07 +02:00
Nicholas Ward
9fa0500390 comparison gate 2021-09-15 17:55:15 -07:00
Nicholas Ward
8f75a8de7f Merge commit '717efbb' 2021-08-23 14:22:20 -07:00
Daniel Lubarov
c1b8a4b4a7 visibility 2021-08-19 11:22:06 -07:00
Nicholas Ward
94a0ad7846 switch gate (in progress) 2021-08-18 17:46:38 -07:00
Nicholas Ward
acc59327e7 random access gate 2021-08-02 17:58:45 -07:00
Nicholas Ward
34d59305a1 Merge branch 'main' into exp_gate 2021-07-27 12:29:24 -07:00
Nicholas Ward
6d22ad6ee0 initial version of exponentiation gate 2021-07-23 15:08:54 -07:00
wborgeaud
0526a9e149 Working ReducingGate 2021-07-23 17:16:53 +02:00
Daniel Lubarov
b8ce1d1967
Public inputs (#113)
With this approach, we don't need `Target::PublicInput`; any routable `Target` can be marked as a public input via `register_public_input`.  The circuit itself hashes these targets, and routes the hash output to the first four wires of a `PublicInputGate`, which is placed at an arbitrary location in the circuit.

All gates have direct access to the purported hash of public inputs. We could think of them as accessing `PI_hash_i(x)` (as in Plonk), but these are now (four) constant functions, so they effectively have direct access to the hash itself.

`PublicInputGate` checks that its first four wires match this purported public input hash. The other gates ignore the hash.

Resolves #64.
2021-07-21 08:26:19 -07:00
Nicholas Ward
d8af0a9334 Merge main 2021-07-15 15:06:38 -07:00
Daniel Lubarov
83a1430038
Fix some warnings (#94) 2021-07-15 07:34:46 -07:00
Nicholas Ward
bec189b598 fixes 2021-07-09 16:31:19 -07:00
wborgeaud
b62c2e6990 Supplant ArithmeticGate with ArithmeticExtensionGate 2021-06-25 16:31:10 +02:00
wborgeaud
da3d34a0d4 Working gate tree generation 2021-06-22 14:31:46 +02:00
wborgeaud
5200d70cf0 Add interpolation gadgets 2021-06-11 16:22:29 +02:00
wborgeaud
8cf2758b6c Division gadget for extension field 2021-06-07 17:55:27 +02:00
wborgeaud
6f2275bc6d Progress 2021-06-07 11:19:54 +02:00
wborgeaud
51c06d74ee Recursive PoW 2021-06-04 16:02:48 +02:00
wborgeaud
42d5b80a7a BaseSum gate 2021-06-04 15:40:54 +02:00
Daniel Lubarov
cb7f8c8b8c
Draw challenge points from the extension field (#51)
* Draw challenge points from the extension field

* Now building

* Misc

* Default eval_unfiltered_base

* fmt

* A few field settings

* Add to Sage

* Display tweak

* eval_filtered_base

* Quartic in bench

* Missing methods

* Fix tests

* PR feedback
2021-05-30 13:25:53 -07:00
Daniel Lubarov
747974558f Add test_low_degree for other gates 2021-05-20 05:27:56 -07:00
Daniel Lubarov
d05513475c Not just quartic 2021-05-19 23:07:24 -07:00
Daniel Lubarov
6e83d956e9 Finish up 2021-05-19 23:03:52 -07:00
Daniel Lubarov
0c91739b3b [DRAFT] Interpolation gate
Over quartic field extension (for now). This would be used in our FRI recursive verifier later, for the consistency check.

To summarize the wires,
- `n` inputs for the `n` points to interpolate (don't need `4n` since they'll be in the subgroup of the base field)
- `4n` inputs for the `n` (extension field) values to interpolate
- `4` inputs for the point to evaluate the interpolant at (beta, which will be drawn from the extension field right?)
- `4` outputs for the interpolated value
- `4n` internal wires for the interpolant's coefficients

This definitely isn't the most optimal approach, e.g. we could route in a single "base" point and derive its neighboring points, but just wanted to keep it simple for now.
2021-05-19 12:10:41 -07:00
Daniel Lubarov
5fe8d633b6 Split main into multiple binaries
... and other minor refactoring.

`bench_recursion` will be the default bin run by `cargo run`; the otheres can be selected with the `--bin` flag.

We could probably delete some of the other binaries later. E.g. `field_search` might not be useful any more. `bench_fft` should maybe be converted to a benchmark (although there are some pros and cons, e.g. the bench framework has a minimum number of runs, and isn't helpful in testing multi-core performance).
2021-04-06 13:23:47 -07:00
Daniel Lubarov
4086b2b447 Arithmetic & permutation gadgets 2021-04-02 15:29:21 -07:00
Daniel Lubarov
f42120482a No more polynomial programming abstraction
It was too expensive.
2021-03-28 19:52:01 -07:00
Daniel Lubarov
ba96ab4e99 More prover work 2021-03-26 23:51:48 -07:00
Daniel Lubarov
ca7f20bf45 FriConsistencyGate 2021-03-18 12:44:45 -07:00
Daniel Lubarov
9fdff8ea08 Gate infra 2021-02-26 13:18:41 -08:00
Daniel Lubarov
13cc76316c Initial commit 2021-02-17 14:36:32 -08:00