59 Commits

Author SHA1 Message Date
Daniel Lubarov
7b20f342df
More eval_unfiltered_recursively tweaks (#156) 2021-08-05 08:03:49 -07:00
Daniel Lubarov
8b8e4d223d
Optimize witness generation a bit (#153)
Mainly storing pending generators in a Vec rather than a HashMap.  Requires an extra check to make sure we don't run one twice after adding it to the Vec twice.
2021-08-04 09:55:11 -07:00
Nicholas Ward
fa5a5c5ebf cargo fmt 2021-08-03 08:59:25 -07:00
Daniel Lubarov
5c96e7b366 Trivial fixes from "cargo fix" 2021-08-02 10:58:03 -07:00
Daniel Lubarov
d6211b8ab8
Reuse a buffer of generated values (#142)
* Reuse a buffer of generated values

To avoid allocating `GeneratedValues` all the time. Saves ~60ms or so.

* PR feedback
2021-08-02 10:55:10 -07:00
wborgeaud
2bbcf17699 Test eval_unfiltered_* functions 2021-08-02 14:17:42 +02:00
Daniel Lubarov
018fb005f8
Move stuff around (#135)
No functional changes here. The biggest change was moving certain files into new directories like `plonk` and `iop` (for things like `Challenger` that could be used in STARKs or other IOPs). I also split a few files, renames, etc, but again nothing functional, so I don't think a careful review is necessary (just a sanity check).
2021-07-29 22:00:29 -07:00
Daniel Lubarov
e382decc9f Import fixes 2021-07-29 11:45:58 -07:00
Daniel Lubarov
bcf524bed0
Have add_gate take a generic type instead of GateRef (#125)
* Have add_gate take a generic type instead of GateRef

There are a couple advantages
- Users writing their own gates won't need to know about the `GateRef` wrapper; it's more of an internal thing now.
- Easier access to gate methods requiring `self` -- for example, `split_le_base` can just call `gate_type.limbs()` now.

* Update comment

* Always insert
2021-07-22 23:48:03 -07:00
wborgeaud
a70e97befc Fix merge issues 2021-07-23 08:21:55 +02:00
wborgeaud
9a1c289f8e Merge branch 'main' into remove_acc_in_gmimc
# Conflicts:
#	src/gadgets/arithmetic.rs
2021-07-23 08:16:23 +02:00
wborgeaud
ca3a2fcfc8 Clippy 2021-07-22 16:09:54 +02:00
wborgeaud
15a64017dc We need only 126 wires now 2021-07-22 14:42:42 +02:00
wborgeaud
467485c3f0 Remove accumulator wires in GMiMCGate 2021-07-22 14:33:02 +02:00
wborgeaud
3a24e8f4c1 Manually implement eval_unfiltered_base for all gates 2021-07-22 14:00:55 +02:00
Daniel Lubarov
eb18c7ea33
Faster witness generation (#116)
Saves ~300ms in the test. The main change is to have generators return fixed-size `Vec`s instead of `HashMap`s, which have more overhead.
2021-07-21 08:26:34 -07: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
Daniel Lubarov
35c8643681 Tiny cleanup 2021-07-18 23:31:21 -07:00
Daniel Lubarov
0a5d46bfa9
Have prove return Result (#100)
* Have `prove` return `Result`

To address that TODO.

* PR feedback
2021-07-18 23:14:48 -07:00
wborgeaud
097413479e PR feedback 2021-07-18 10:35:42 +02:00
wborgeaud
fe05da6720 Clipp 2021-07-15 10:39:57 +02:00
wborgeaud
139430c549 Fixed GMiMC 2021-07-13 09:15:16 +02:00
wborgeaud
fc0f8a78ce First try 2021-07-02 14:13:57 +02:00
wborgeaud
3bc27c65ef Rollback to previous semantics 2021-06-23 13:46:19 +02:00
wborgeaud
ea6a724560 Enforce copy constraints in partial witness generation. 2021-06-14 17:02:52 +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
741dc4c94c Tweaks to bench_ldes 2021-05-22 09:38:07 -07:00
Daniel Lubarov
a4be58557e Fix GMiMCGate 2021-05-20 05:35:16 -07:00
Daniel Lubarov
747974558f Add test_low_degree for other gates 2021-05-20 05:27:56 -07:00
Daniel Lubarov
aabfbe82cd Fix GMiMCEvalGate 2021-04-28 13:50:40 -07:00
Daniel Lubarov
d3ac365667 Recursive evaluation of GMiMCGate
If we did it all with `ArithmeticGate`s, the main loop (with ~101 iterations of cubing and a couple adds) would be fairly expensive, so this uses a (much smaller) custom gate called `GMiMCEvalGate` which does all the computations for one iteration of that loop.
2021-04-27 13:16:24 -07:00
Daniel Lubarov
b18f152c43 Remove access to "next" wire & constant values
As discussed, it seems like the batch opening argument will be a significant cost, and we can reduce that cost by not including shifted openings (except for `Z`s which need them).
2021-04-23 13:54:35 -07:00
wborgeaud
6b3aa02b01 Merge master 2021-04-21 22:36:06 +02:00
wborgeaud
6b407e45ef Progress on FRI 2021-04-21 22:31:45 +02:00
Daniel Lubarov
70f4f2aab8 Minimal num_wires 2021-04-16 21:40:51 -07:00
Daniel Lubarov
62dccedda4 Fix id() to include (generic) R param 2021-04-16 09:01:54 -07:00
wborgeaud
7ff4150679 Merge with merkle_proofs_2 2021-04-12 10:38:07 +02:00
Daniel Lubarov
a14ddc3b03 Fix constraint count 2021-04-10 14:54:46 -07:00
Daniel Lubarov
04f74446fa Misc fixes to get tests green again 2021-04-09 11:40:51 -07:00
Daniel Lubarov
959aaccae6 Merkle proofs 2021-04-08 09:38:57 -07:00
Daniel Lubarov
9b158103d2 Rename 2021-04-02 20:34:27 -07:00
Daniel Lubarov
4086b2b447 Arithmetic & permutation gadgets 2021-04-02 15:29:21 -07:00
Daniel Lubarov
aea4eeaaae Minor 2021-04-02 14:00:26 -07:00
Daniel Lubarov
3c262a8c49 Fix some warnings 2021-03-30 20:16:20 -07:00
Daniel Lubarov
f42120482a No more polynomial programming abstraction
It was too expensive.
2021-03-28 19:52:01 -07:00
Daniel Lubarov
75b9340000 Tweak APIs 2021-03-21 11:29:47 -07:00
Daniel Lubarov
ca7f20bf45 FriConsistencyGate 2021-03-18 12:44:45 -07:00
Daniel Lubarov
ea33c5567f GMiMC, witness generation 2021-03-01 13:40:05 -08:00
Daniel Lubarov
ec0632bf16 Degree-3 GMiMC gate 2021-03-01 12:35:02 -08:00
Daniel Lubarov
45da024aef Minor 2021-02-28 21:43:10 -08:00