38 Commits

Author SHA1 Message Date
wborgeaud
c0f09591ee Recursive recursive verifier test 2021-07-23 18:24:09 +02:00
wborgeaud
c16d93ab33 scaling.rs -> reducing.rs 2021-07-23 17:31:00 +02:00
wborgeaud
ca540a8475 Working fri_combine_initial 2021-07-23 17:29:31 +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
Daniel Lubarov
6bd197e9cf
Observe public inputs (#119)
* Observe public inputs

* Observe the hash instead
2021-07-22 10:27:10 -07:00
wborgeaud
15a64017dc We need only 126 wires now 2021-07-22 14:42:42 +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
Daniel Lubarov
48f5c9347f
route -> assert (#112)
Doesn't really matter except that failure messages might be different if the copy-generator runs first.
2021-07-20 13:04:34 -07:00
Daniel Lubarov
ac1872a8c8
FRI tweaks (#111)
- Call `exp_power_of_2` instead of manual squaring
- Replace `evaluations[i]` with `evals`
2021-07-20 12:49:02 -07:00
Daniel Lubarov
8438d23937
Tree of scopes (#106)
* Tree of scopes

This is an extension of the context concept.

Earlier I was planning to store a simple stack of contexts, but I ended up storing the whole history, in a tree structure. This gives us more control over the output, i.e. we can print the gate count of a parent scope before those of its child scopes, which seems more user-friendly.

Sample gate count output:

    [2021-07-19T18:09:24Z INFO  plonky2::circuit_builder] 27829 gates to root
    [2021-07-19T18:09:24Z INFO  plonky2::circuit_builder] | 2373 gates to evaluate the vanishing polynomial at our challenge point, zeta.
    [2021-07-19T18:09:24Z INFO  plonky2::circuit_builder] | | 1284 gates to evaluate gate constraints
    [2021-07-19T18:09:24Z INFO  plonky2::circuit_builder] | 25312 gates to verify FRI proof
    [2021-07-19T18:09:24Z INFO  plonky2::circuit_builder] | | 650 gates to verify 0'th FRI query
    [2021-07-19T18:09:24Z INFO  plonky2::circuit_builder] | | | 96 gates to check FRI initial proof
    [2021-07-19T18:09:24Z INFO  plonky2::circuit_builder] | | | 65 gates to compute x from its index
    [2021-07-19T18:09:24Z INFO  plonky2::circuit_builder] | | | 233 gates to combine initial oracles
    ...

Sample copy constraint failure:

    Error: Copy constraint 'root > verify FRI proof > verify 0'th FRI query > check FRI initial proof > verify 0'th initial Merkle proof > check Merkle root: 0-th hash element' between wire 12 of gate #2550 [...] and wire 0 of gate #0 [...] is not satisfied. Got values of 6861386743364621393 and 0 respectively.

* No min

* info -> debug

* Move to its own file
2021-07-19 12:22:18 -07:00
Daniel Lubarov
a9e5f1e4e2
More routed wires for recursion (#104)
* More routed wires for recursion

For the insertion gate, which (with a FRI arity of 4) uses 1 wire for the insertion index, D for the elemnet to insert, 3D for the original list, and 4D for the output list.

* import
2021-07-19 08:52:10 -07:00
wborgeaud
9baea1ae26 Trim final poly and check FRI arity 2021-07-19 16:24:21 +02:00
Daniel Lubarov
d11bcd1928
Optional zk (#101)
* Make ZK optional

* Remove rate from FriConfig

Seems redundant, and we've had some tests break due to the two fields not matching.

* zero_knowledge: false in bench
2021-07-18 23:24:33 -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
4bc06deed8 zs_root -> zs_partial_products_root 2021-07-15 10:59:53 +02:00
wborgeaud
a6bc83217b Minor 2021-07-15 10:55:18 +02:00
wborgeaud
fe05da6720 Clipp 2021-07-15 10:39:57 +02:00
wborgeaud
7dec6efc6c Rewrite Markable to avoid Arcs 2021-07-15 09:52:42 +02:00
wborgeaud
0ba5916346 Minor 2021-07-15 09:11:54 +02:00
wborgeaud
514ee0feda More realistic config 2021-07-14 21:52:34 +02:00
wborgeaud
7793b5a956 Identify problem in GMiMc 2021-07-14 20:54:30 +02:00
wborgeaud
c3d53392c4 Problem in permutation argument 2021-07-14 08:14:00 +02:00
wborgeaud
5c2c01b1ab Circuit compiles 2021-07-13 15:20:14 +02:00
wborgeaud
c99d7f48fd Add Merkle tree test 2021-07-13 09:44:35 +02:00
wborgeaud
139430c549 Fixed GMiMC 2021-07-13 09:15:16 +02:00
wborgeaud
ad24f5d4d1 Almost working recursive verifier 2021-07-12 14:25:28 +02:00
wborgeaud
cbb0cbffb1 Finish test setup 2021-07-09 10:01:58 +02:00
wborgeaud
b50a9809db Start recursive verifier test 2021-07-08 17:16:26 +02:00
wborgeaud
8796c73362 Change MulExtensionGate to ArithmeticExtensionGate and change gadgets to use the new wires in this gate. 2021-06-23 18:04:43 +02:00
wborgeaud
897ec3b053 Target version of proof structs 2021-06-04 10:47:46 +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
b7bc1bf313 Seed Challenger with a hash of the instance
I think this is the recommended way to apply Fiat-Shamir, to avoid any possible attacks like taking someone else's proof and using it to prove a slightly different statement.
2021-04-22 16:38:49 -07:00
Daniel Lubarov
524005579d Comments etc 2021-04-02 20:58:19 -07:00
Daniel Lubarov
44eeb505eb Tweaks 2021-03-30 10:02:00 -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
9fdff8ea08 Gate infra 2021-02-26 13:18:41 -08:00