198 Commits

Author SHA1 Message Date
Daniel Lubarov
e4cbee2b57
Disable ZK in large_config (#180)
* Disable ZK in large_config

Speeds up the tests from ~6m to ~1m (debug mode). `large_config` is crate-private so I don't think we need to worry about real users forgetting ZK, and I don't think ZK seems important in these tests, though we should probably have ZK enabled for a couple tests.

A couple tests need ZK or they fail; I added a TODO to look later.

This led to a few other changes:
- Fixed a bug where `trim` could truncate the final poly to a non-power-of-two length. This was improbable when ZK is on due to randomization.
- Gave a few methods access to the whole `CircuitConfig` vs `FriConfig` -- sort of necessary for the above fix, and I don't think there's much downside.
- Remove `cap_height` from `FriConfig` -- didn't really need it any more after giving more methods access to `CircuitConfig`, and having a single copy of the param feels cleaner/safer to me.

* PR feedback
2021-08-14 10:01:10 -07:00
Daniel Lubarov
f3bfd66657
Add a BoolTarget (#179)
It's just a wrapper around `Target`, which signifies that the wrapped `Target` has already been range checked. Should make it easier to audit code that expects bools.
2021-08-14 08:53:39 -07:00
Daniel Lubarov
9c42fef997
Little refactor (#178) 2021-08-14 08:47:03 -07:00
Daniel Lubarov
bbfc0f8adc no mut 2021-08-12 13:56:45 -07:00
Daniel Lubarov
b20d6dc191
Minor optimizations (#174) 2021-08-12 13:32:49 -07:00
wborgeaud
702eab1583 Add wide_arithmetic 2021-08-12 16:03:13 +02:00
Daniel Lubarov
090cf79787
Replace some old division code (#171)
- Delete unsafe methods
- Have related methods call the new div_add_extension method to simplify
2021-08-10 11:48:53 -07:00
wborgeaud
94123c456e Fix merge conflict 2021-08-10 09:21:03 +02:00
wborgeaud
4433fd8048 Merge branch 'main' into optimize_arithmetic_ops 2021-08-10 09:11:08 +02:00
wborgeaud
b15e36d29c PR feedback 2021-08-10 09:07:01 +02:00
Daniel Lubarov
b89f4d656d
Update various dependencies (#163) 2021-08-09 10:11:42 -07:00
wborgeaud
3adabbedf1 Fix comments 2021-08-09 14:15:20 +02:00
wborgeaud
905aaa2ed9 Unused 2021-08-09 14:07:32 +02:00
wborgeaud
d0cb1becf0 Minor bis 2021-08-09 14:07:16 +02:00
wborgeaud
8e6c30dc70 Use only one gate for div 2021-08-09 13:55:49 +02:00
wborgeaud
ff68b66bbb Add div_add 2021-08-09 13:46:20 +02:00
wborgeaud
417e6055ae Optimize coset in compute_evaluation 2021-08-09 13:21:42 +02:00
wborgeaud
d27dd92af9 Some more optimization 2021-08-09 13:08:09 +02:00
wborgeaud
4b44578ffa More optimizations 2021-08-09 12:39:37 +02:00
wborgeaud
ed8dc9fdc7 Cleaning 2021-08-09 11:33:38 +02:00
wborgeaud
eeb33f99ca Optimize mul_ext_algebra 2021-08-09 11:30:03 +02:00
wborgeaud
f0f8320b93 First pass 2021-08-09 10:46:29 +02:00
wborgeaud
dd076e5c73 Auto resize partial witness 2021-08-09 09:58:09 +02:00
wborgeaud
db236e4824 Fix tests 2021-08-06 15:14:38 +02:00
wborgeaud
7d11d0f8a1 Change PartialWitness to use Vecs 2021-08-06 14:58:39 +02:00
wborgeaud
a255c320ac
Merge pull request #157 from mir-protocol/remove_reverse_limbs
Remove reversed limbs sum
2021-08-05 21:37:58 +02:00
Daniel Lubarov
7b20f342df
More eval_unfiltered_recursively tweaks (#156) 2021-08-05 08:03:49 -07:00
wborgeaud
df07909f1e Merge branch 'main' into remove_reverse_limbs 2021-08-05 16:04:16 +02:00
wborgeaud
5418026082 Remove reversed sum from BaseSumGate 2021-08-05 13:47:33 +02:00
Nicholas Ward
4eb8153895
Merge pull request #154 from mir-protocol/random_access_gadget
added random access gadget
2021-08-04 14:31:08 -07:00
Nicholas Ward
c7093cd551 addressed comments 2021-08-04 14:19:06 -07:00
Nicholas Ward
32c8c366bf added random access gadget 2021-08-04 10:58:12 -07:00
Daniel Lubarov
079baff718
Optimize some exp methods to use ExponentiationGate (#151) 2021-08-04 09:55:29 -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
08b018fc02
Merge pull request #144 from mir-protocol/optimize_small_exp_u64
Hardcode small exponents in `exp_u64_extension`
2021-08-02 19:12:07 +02:00
wborgeaud
df690f92bf Hardcode small exponents in exp_u64_extension 2021-08-02 13:31:12 +02:00
wborgeaud
fc9d64defe Small nits for the exponentiation gate 2021-08-02 13:12:50 +02:00
Daniel Lubarov
36a1386c6f
Small fix in arithmetic_extension_special_cases (#140)
This is detecting the case where we multiply something by 1 and add 0.  In that case we can just return the thing being multiplied by 1. We were using the wrong constant to detect this.

Reduces the cost of `compute_evaluation` from 8 to 6 gates.
2021-07-30 12:00:24 -07:00
Daniel Lubarov
50b07f2ceb
Special cases for extension field arithmetic (#138)
We previously checked for special cases, like arithmetic on constant Targets, in `arithmetic`. We can handle those cases without actually adding an `ArithmeticGate`.

Now that `arithmetic` just calls `arithmetic_extension`, it makes more sense to check for special cases in the latter method, so it applies to both base and extension field arithmetic.

Reduces gate count from 16149 to 15689.
2021-07-30 09:03:11 -07: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
Nicholas Ward
8440a4cbdf fix 2021-07-29 15:15:40 -07:00
Nicholas Ward
cfda56e3d3 Merge branch 'main' into exp_gate_config 2021-07-29 14:19:24 -07:00
Nicholas Ward
a111fc3164 fixes 2021-07-29 14:18:18 -07:00
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
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
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
fa06cc5509 fix 2021-07-28 17:37:26 -07:00
Nicholas Ward
17217f1143 addressed nit 2021-07-28 17:34:41 -07:00