132 Commits

Author SHA1 Message Date
Daniel Lubarov
7d6c0a448d
Halo2 style lookup arguments in System Zero (#513)
* Halo2 style lookup arguments in System Zero

It's a really nice and simple protocol, particularly for the verifier since the constraints are trivial (aside from the underlying batched permutation checks, which we already support). See the [Halo2 book](https://zcash.github.io/halo2/design/proving-system/lookup.html) and this [talk](https://www.youtube.com/watch?v=YlTt12s7vGE&t=5237s) by @daira.

Previously we generated the whole trace in row-wise form, but it's much more efficient to generate these "permuted" columns column-wise. So I changed our STARK framework to accept the trace in column-wise form. STARK impls now have the flexibility to do some generation row-wise and some column-wise (without extra costs; there's a single transpose as before).

* sorting

* fixes

* PR feedback

* into_iter

* timing
2022-03-16 17:37:34 -07:00
wborgeaud
dd4cc21309 PR feedback 2022-02-23 09:36:28 +01:00
wborgeaud
8c5cbbc7c6 Add first row Z check 2022-02-22 17:40:48 +01:00
wborgeaud
17bbc6f3e4 Minor 2022-02-22 17:30:08 +01:00
wborgeaud
a31c58b69d Use ReducingFactor 2022-02-22 17:23:55 +01:00
wborgeaud
150d764440 Simplification 2022-02-22 17:00:08 +01:00
wborgeaud
4ea418a486 Clippy 2022-02-22 16:35:20 +01:00
wborgeaud
064b3c07a8 Forgot to set permutation cap 2022-02-22 16:18:41 +01:00
wborgeaud
6cd2fc62b5 Should work (does not) 2022-02-22 11:44:24 +01:00
wborgeaud
ed4aef0fa0 Fill permutation todos 2022-02-22 10:46:51 +01:00
wborgeaud
56e269e27a Working (not recursively) 2022-02-22 10:37:08 +01:00
wborgeaud
85c1e1d5e0 Should work (does not) 2022-02-21 18:00:03 +01:00
wborgeaud
5c1173379e Compiles 2022-02-21 16:05:24 +01:00
wborgeaud
79ba85eb08 Compiles 2022-02-21 10:52:04 +01:00
wborgeaud
f4a29a0249 Merge branch 'main' into stark_permutation_checks 2022-02-21 10:19:12 +01:00
wborgeaud
d52fabaf26 First pass 2022-02-21 10:18:05 +01:00
Daniel Lubarov
bc3685587c
Rename constraint methods (#497)
Most of our constraints apply to all rows, and it seems safest to make that the "default".
2022-02-20 16:48:31 -08:00
wborgeaud
9516e14c3e
Merge pull request #491 from mir-protocol/fix_reduction_strategy
Fix reduction strategy
2022-02-18 17:07:03 +01:00
wborgeaud
67cb5dfd58 PR feedback 2022-02-17 08:26:23 +01:00
Daniel Lubarov
431faccbdb
Change compute_permutation_z_polys to batch permutation checks (#492)
* Change `compute_permutation_z_polys` to batch permutation checks

* feedback
2022-02-16 23:37:20 -07:00
wborgeaud
ea9006f52e Add rate_bits 2022-02-16 13:51:10 +01:00
wborgeaud
c9185d92bb Merge branch 'main' into fix_reduction_strategy
# Conflicts:
#	starky/src/prover.rs
2022-02-16 13:38:54 +01:00
wborgeaud
b28cd55326 Fix reduction strategy 2022-02-16 13:37:01 +01:00
Daniel Lubarov
72d13d0ded
Prover code for permutation argument (#485)
* Batch multiple perm args into one Z and compute Z columnwise

It's slightly complex because we batch `constraint_degree - 1` permutation arguments into a single `Z` polynomial. This is a slight generalization of the [technique](https://zcash.github.io/halo2/design/proving-system/lookup.html) described in the Halo2 book.

Without this batching, we would simply have `num_challenges` random challenges (betas and gammas). With this batching, however, we need to use different randomness for each permutation argument within the same batch. Hence we end up generating `batch_size * num_challenges` challenges for all permutation arguments.

* Feedback + updates for recursion code
2022-02-16 01:33:59 -08:00
wborgeaud
42d6532120 PR feedback 2022-02-15 08:35:57 +01:00
wborgeaud
acd62f1221 Changes after #481 2022-02-15 08:17:07 +01:00
wborgeaud
14d8cf2ceb Merge branch 'main' into recursive_starks 2022-02-15 08:13:50 +01:00
wborgeaud
7820ba965c Minor 2022-02-14 10:23:26 +01:00
wborgeaud
1686cb021f verify_stark_proof -> recursively_verify_stark_proof 2022-02-14 10:20:59 +01:00
wborgeaud
6dca4e26af Unused 2022-02-14 10:16:02 +01:00
wborgeaud
cff39c5550 Change visibility 2022-02-14 10:12:24 +01:00
wborgeaud
3db9c775b4 Add set_fri_openings 2022-02-14 10:09:08 +01:00
wborgeaud
80e3c928bb Clippy 2022-02-14 10:00:37 +01:00
wborgeaud
b0de3328c1 Working 2022-02-14 09:53:33 +01:00
wborgeaud
7af2d05828 Save allocation and add const generic bound 2022-02-13 15:04:40 +01:00
wborgeaud
d22fa8895b Fix one error to get another one 2022-02-11 10:37:17 +01:00
Daniel Lubarov
645d45f227
Column definitions for addition, range checks & lookups (#477)
* Column definitions for addition, range checks & lookups

I implemented addition (unsigned for now) as an example of how the arithmetic unit can interact with the 16-bit range check unit.

Range checks and lookups aren't implemented yet.

* Missing constraints

* Tweaks to get tests passing

* Reorg registers into files

* Minor
2022-02-10 12:05:04 -08:00
wborgeaud
24c201477c Recursive stark test (failing) 2022-02-10 16:14:18 +01:00
wborgeaud
3aa192a7f6 Add witness generation for stark proofs 2022-02-10 16:04:46 +01:00
wborgeaud
ff7a654840 Methods for virtual stark proofs 2022-02-09 17:11:13 +01:00
wborgeaud
101b3bac64 Small optimization 2022-02-08 18:24:28 +01:00
wborgeaud
ae330ff6a7 Clippy 2022-02-08 18:19:11 +01:00
wborgeaud
ba63a37b7d Compiles 2022-02-08 18:16:33 +01:00
wborgeaud
debe742c7f Progress 2022-02-07 10:41:52 +01:00
wborgeaud
fcef5a57f5 Fibonacci recursive constraints 2022-02-07 10:25:01 +01:00
Daniel Lubarov
b40827e655
trim_to_len helper function (#472)
* trim_to_len helper function

Seems a little nicer IMO to only remove a certain number of zeros, vs removing all trailing zeros then re-adding some.

* PR feedback
2022-02-06 23:35:46 -08:00
Daniel Lubarov
8f21fddd04
Add a PolynomialValues::selector method for convenience (#470)
Also adds a test for `eval_l_1_and_l_last`.
2022-02-06 23:06:04 -08:00
Jakub Nabaglo
83a572717e
Implement Poseidon in system_zero/permutation_unit (#459)
* Implement Poseidon in system_zero/permutation_unit

* Minor cleanup

* Daniel PR comments

* Update dependencies
2022-02-04 16:50:57 -08:00
wborgeaud
511cb863fc s/max_degree_bits/quotient_degree_bits 2022-02-04 20:42:49 +01:00
wborgeaud
fc502add01 Add quotient_degree_factor function 2022-02-04 20:24:58 +01:00