714 Commits

Author SHA1 Message Date
Nicholas Ward
95503ff7fa Merge branch 'main' into exp_gate_config 2021-07-29 14:10:35 -07:00
Nicholas Ward
e46bd08f00 exponention gate takes only bits 2021-07-29 12:59:11 -07:00
Daniel Lubarov
c5da582f4f Logging tweaks 2021-07-29 12:06:32 -07:00
Daniel Lubarov
e382decc9f Import fixes 2021-07-29 11:45:58 -07:00
Nicholas Ward
56b62f1964 new exp gate takes in CircuitConfig and determines num_bits 2021-07-29 10:26:46 -07:00
Daniel Lubarov
df03c22c48 Fix order 2021-07-29 09:12:24 -07:00
Daniel Lubarov
5f79b9630e
Update division calls (#132)
We have two division methods: one "unsafe" one, which permits 0/0 = anything, and one "safe" one, for which 0/0 results in an unsatisfiable instance. The latter is slightly more expensive.

I switched a few calls over to safe division, where unsafe division didn't seem sound (or at least it wasn't obvious). For calls where unsafe division did seem sound, I added comments explaining why.

Closes #97.
2021-07-28 18:06:32 -07:00
Nicholas Ward
f7e9af6f0a
Merge pull request #133 from mir-protocol/exp_gadget
Exponentiation gadget
2021-07-28 17:37:46 -07:00
Nicholas Ward
fa06cc5509 fix 2021-07-28 17:37:26 -07:00
Nicholas Ward
17217f1143 addressed nit 2021-07-28 17:34:41 -07:00
Nicholas Ward
2fd9ce2114 fixes to exp functions 2021-07-28 13:38:41 -07:00
Nicholas Ward
247fa39386 exponentiation gadget 2021-07-28 10:56:12 -07:00
Nicholas Ward
6749a94c52 fix 2021-07-28 10:17:32 -07:00
Nicholas Ward
a1aa5d6349
Merge pull request #131 from mir-protocol/exp_gate
Exponentiation gate
2021-07-28 10:10:25 -07:00
Nicholas Ward
607d0a89cb fixed max_power_bits 2021-07-28 10:09:35 -07:00
Nicholas Ward
68672c0038 addressed comments 2021-07-28 09:20:20 -07:00
Nicholas Ward
a38a5e227d select_ext takes bit as extension; used in recursive eval 2021-07-27 22:51:40 -07:00
Nicholas Ward
33ba269ccb fixes 2021-07-27 15:58:19 -07:00
Nicholas Ward
3944c5e68e added eval_unfiltered_recursively 2021-07-27 13:29:57 -07:00
Nicholas Ward
044eb597c2 added eval_unfiltered_base 2021-07-27 13:18:42 -07:00
Nicholas Ward
21ec75335a fix: power bits in test now LE 2021-07-27 13:09:28 -07:00
Nicholas Ward
b5418bffb3 added output wire 2021-07-27 13:09:15 -07:00
Nicholas Ward
9f4cf9f3d9
Merge pull request #130 from mir-protocol/exp_gate_nits
nits
2021-07-27 12:59:14 -07:00
Daniel Lubarov
54626be7ce comment 2021-07-27 12:48:52 -07:00
Daniel Lubarov
1e9845afcf nits 2021-07-27 12:47:15 -07:00
Nicholas Ward
b66ad6c96a added debug assert 2021-07-27 12:34:47 -07:00
Nicholas Ward
34d59305a1 Merge branch 'main' into exp_gate 2021-07-27 12:29:24 -07:00
Nicholas Ward
7e5e4fc682 updated num_constraints 2021-07-27 12:18:09 -07:00
Nicholas Ward
59bfc52f9c removed extraneous constraint 2021-07-27 11:55:25 -07:00
Nicholas Ward
695e5bc98c fix? 2021-07-27 11:04:16 -07:00
Nicholas Ward
0b8f5860f5 removed if statement 2021-07-27 10:46:10 -07:00
Nicholas Ward
af62688bd7 fixes 2021-07-27 10:19:46 -07:00
Daniel Lubarov
9081ae7337
Reduce noise in FRI logging (#129)
* Reduce noise in FRI logging

Previously, all logs related to gate counts were at the `Debug` log level. This PR gives us more flexibility to adjust the log levels of particular scopes.

In particular, our circuit checks 40 FRI queries, and we log a bunch of steps for each query, creating a lot of noise. With this change, we log just a single FRI query at the `Debug` level, and demote others to the `Trace` level.

With `RUST_LOG=debug`, our logs now look like

```
[2021-07-26T21:07:45Z DEBUG plonky2::context_tree] 17631 gates to root
[2021-07-26T21:07:45Z DEBUG plonky2::context_tree] | 8 gates to observe proof and generates challenges
[2021-07-26T21:07:45Z DEBUG plonky2::context_tree] | 4150 gates to evaluate the vanishing polynomial at our challenge point, zeta.
[2021-07-26T21:07:45Z DEBUG plonky2::context_tree] | | 3184 gates to evaluate gate constraints
[2021-07-26T21:07:45Z DEBUG plonky2::context_tree] | | | 227 gates to evaluate InterpolationGate { num_points: 4, _phantom: PhantomData }<D=4> constraints
[2021-07-26T21:07:45Z DEBUG plonky2::context_tree] | | | 867 gates to evaluate <R=101> GMiMCGate { ... } constraints
[2021-07-26T21:07:45Z DEBUG plonky2::context_tree] | | | 576 gates to evaluate BaseSumGate { num_limbs: 63 } + Base: 2 constraints
[2021-07-26T21:07:45Z DEBUG plonky2::context_tree] | | | 78 gates to evaluate ArithmeticExtensionGate constraints
[2021-07-26T21:07:45Z DEBUG plonky2::context_tree] | | | 288 gates to evaluate BaseSumGate { num_limbs: 31 } + Base: 2 constraints
[2021-07-26T21:07:45Z DEBUG plonky2::context_tree] | | | 115 gates to evaluate InsertionGate { vec_size: 3, _phantom: PhantomData }<D=4> constraints
[2021-07-26T21:07:45Z DEBUG plonky2::context_tree] | | | 26 gates to evaluate BaseSumGate { num_limbs: 2 } + Base: 2 constraints
[2021-07-26T21:07:45Z DEBUG plonky2::context_tree] | | | 633 gates to evaluate ReducingGate { num_coeffs: 21 } constraints
[2021-07-26T21:07:45Z DEBUG plonky2::context_tree] | | | 4 gates to evaluate ConstantGate constraints
[2021-07-26T21:07:45Z DEBUG plonky2::context_tree] | | | 11 gates to evaluate PublicInputGate constraints
[2021-07-26T21:07:45Z DEBUG plonky2::context_tree] | | | 2 gates to evaluate NoopGate constraints
[2021-07-26T21:07:45Z DEBUG plonky2::context_tree] | 16 gates to check vanishing and quotient polynomials.
[2021-07-26T21:07:45Z DEBUG plonky2::context_tree] | 13336 gates to verify FRI proof
[2021-07-26T21:07:45Z DEBUG plonky2::context_tree] | | 6 gates to recover the random betas used in the FRI reductions.
[2021-07-26T21:07:45Z DEBUG plonky2::context_tree] | | 4 gates to check PoW
[2021-07-26T21:07:45Z DEBUG plonky2::context_tree] | | 104 gates to precompute reduced evaluations
[2021-07-26T21:07:45Z DEBUG plonky2::context_tree] | | 330 gates to verify one (of 40) query rounds
[2021-07-26T21:07:45Z DEBUG plonky2::context_tree] | | | 95 gates to check FRI initial proof
[2021-07-26T21:07:45Z DEBUG plonky2::context_tree] | | | | 22 gates to verify 0'th initial Merkle proof
[2021-07-26T21:07:45Z DEBUG plonky2::context_tree] | | | | 33 gates to verify 1'th initial Merkle proof
[2021-07-26T21:07:45Z DEBUG plonky2::context_tree] | | | | 20 gates to verify 2'th initial Merkle proof
[2021-07-26T21:07:45Z DEBUG plonky2::context_tree] | | | | 20 gates to verify 3'th initial Merkle proof
[2021-07-26T21:07:45Z DEBUG plonky2::context_tree] | | | 34 gates to compute x from its index
[2021-07-26T21:07:45Z DEBUG plonky2::context_tree] | | | 32 gates to combine initial oracles
[2021-07-26T21:07:45Z DEBUG plonky2::context_tree] | | | 17 gates to verify FRI round Merkle proof.
[2021-07-26T21:07:45Z DEBUG plonky2::context_tree] | | | 10 gates to infer evaluation using interpolation
[2021-07-26T21:07:45Z DEBUG plonky2::context_tree] | | | 15 gates to verify FRI round Merkle proof.
[2021-07-26T21:07:45Z DEBUG plonky2::context_tree] | | | 10 gates to infer evaluation using interpolation
[2021-07-26T21:07:45Z DEBUG plonky2::context_tree] | | | 13 gates to verify FRI round Merkle proof.
[2021-07-26T21:07:45Z DEBUG plonky2::context_tree] | | | 10 gates to infer evaluation using interpolation
[2021-07-26T21:07:45Z DEBUG plonky2::context_tree] | | | 11 gates to verify FRI round Merkle proof.
[2021-07-26T21:07:45Z DEBUG plonky2::context_tree] | | | 10 gates to infer evaluation using interpolation
[2021-07-26T21:07:45Z DEBUG plonky2::context_tree] | | | 9 gates to verify FRI round Merkle proof.
[2021-07-26T21:07:45Z DEBUG plonky2::context_tree] | | | 10 gates to infer evaluation using interpolation
[2021-07-26T21:07:45Z DEBUG plonky2::context_tree] | | | 7 gates to verify FRI round Merkle proof.
[2021-07-26T21:07:45Z DEBUG plonky2::context_tree] | | | 10 gates to infer final evaluation using interpolation
[2021-07-26T21:07:45Z DEBUG plonky2::context_tree] | | | 8 gates to evaluate final polynomial
```

This bit corresponds to the single FRI query being shown:

```
[2021-07-26T21:07:45Z DEBUG plonky2::context_tree] | | 330 gates to verify one (of 40) query rounds
```

* Minor cleanup

* Address feedback
2021-07-26 16:21:14 -07:00
Daniel Lubarov
3fc02c76bc
Couple fixes to ReducingGate (#128) 2021-07-25 09:34:51 -07:00
wborgeaud
1e5a503a14
Merge pull request #127 from mir-protocol/reducing_gate
Add `ReducingGate` to compute reductions by `alpha` of base field elements
2021-07-25 18:14:40 +02:00
wborgeaud
deea1c979b PR feedback 2021-07-25 18:12:26 +02:00
wborgeaud
5fbeb8742e
Merge pull request #126 from mir-protocol/remove_exp_from_complement
Replace `exp_from_complement_bits` with simpler method
2021-07-25 17:50:08 +02:00
Nicholas Ward
d7a9274fef updated for add_gate changes 2021-07-23 20:06:00 -07:00
Nicholas Ward
da9017bcbc Merge branch 'main' into exp_gate 2021-07-23 20:01:58 -07:00
Nicholas Ward
b06d7bc8f5 cargo fmt 2021-07-23 15:56:25 -07:00
Nicholas Ward
0c4a1bc5af fixes 2021-07-23 15:56:14 -07:00
Nicholas Ward
8e2f33bd42 fix 2021-07-23 15:52:37 -07:00
Nicholas Ward
64d8a44320 cargo fmt 2021-07-23 15:47:03 -07:00
Nicholas Ward
1c8015b93d finished tests (don't pass yet) 2021-07-23 15:46:52 -07:00
Nicholas Ward
9932517e86 cargo fmt 2021-07-23 15:11:53 -07:00
Nicholas Ward
40055dc45d basic tests 2021-07-23 15:11:42 -07:00
Nicholas Ward
6d22ad6ee0 initial version of exponentiation gate 2021-07-23 15:08:54 -07:00
wborgeaud
d509f03b1b Implement eval_unfiltered_base 2021-07-23 18:32:59 +02:00
wborgeaud
c0f09591ee Recursive recursive verifier test 2021-07-23 18:24:09 +02:00
wborgeaud
8f18089aac Implement eval_unfiltered_recursively for ReducingGate 2021-07-23 18:06:14 +02:00