Nicholas Ward
ebcfde1d81
updates
2021-11-10 09:53:12 -08:00
Nicholas Ward
6b294c1d97
fmt
2021-11-09 18:10:52 -08:00
Nicholas Ward
34eacdada6
progress
2021-11-09 18:10:52 -08:00
Nicholas Ward
f71adac40b
fix
2021-11-09 18:10:52 -08:00
Nicholas Ward
e48e0a4a58
fmt
2021-11-09 18:10:52 -08:00
Nicholas Ward
ffb544e4a5
initial non-native add
2021-11-09 18:10:52 -08:00
Nicholas Ward
d334a924b4
merge new circuit builder stuff
2021-11-09 18:10:47 -08:00
Nicholas Ward
7054fcdaf9
initial
2021-11-09 18:09:39 -08:00
Jakub Nabaglo
168f572804
Fix rustfmt failures on main ( #348 )
2021-11-09 14:52:05 -08:00
Daniel Lubarov
e9ae9a045f
import
2021-11-05 21:36:33 -07:00
Daniel Lubarov
671bb9be2e
Specialize InterpolationGate ( #339 )
...
* Specialize `InterpolationGate`
To cosets of subgroups of roots of unity. This way
- `InterpolationGate` needs fewer routed wires, bringing our minimum routed wires down from 28 to 25.
- The recursive `compute_evaluation` avoids some multiplications, saving 100~200 gates depending on `num_routed_wires`.
* Update test
* feedback
2021-11-05 09:29:08 -07:00
Daniel Lubarov
75fe5686a2
Better fixed-base exponentiation and exp_power_of_2 ( #340 )
...
Saves 84 gates with `num_routed_wires: 48`.
2021-11-05 09:10:46 -07:00
Daniel Lubarov
1450ffb29c
Small recursion optimizations ( #338 )
...
* Small recursion optimizations
Main thing is memoizing arithmetic operations. Overall savings is ~50 gates.
* feedback
2021-11-04 16:23:01 -07:00
Daniel Lubarov
fdce382af3
Standard configs ( #337 )
...
`large_config` was similar to `standard_recursion_config`; let's standardize on the latter.
2021-11-03 14:30:32 -07:00
Daniel Lubarov
c8e043a53f
Optimize recursive Poseidon constraint evaluation ( #333 )
...
* More wires for ConstantGate
* fix
* fix
* Optimize recursive Poseidon constraint evaluation
- Avoid `ArithmeticGate`s with unique constants; use `ConstantGate` wires instead
- Avoid an unnecessary squaring in exponentiations
Brings Poseidon evaluation down to a reasonable 273 gates when `num_routed_wires = 48`.
2021-11-02 14:42:30 -07:00
Jakub Nabaglo
bc57a561e6
Delete CrandallField
2021-11-02 12:29:26 -07:00
Daniel Lubarov
c6f91148d5
PoseidonMdsGate ( #330 )
...
PoseidonGate's recursive evaluations were using a lot of gates, and the MDS layer was the main culprit.
The other issue is that `constant_layer_recursive` creates a bunch of `ArithmeticGate`s with unique constants. We could either change `ArithmeticGate` to support different constants per operation, or wire in constants from `ConstantGate`, and change `ConstantGate` to support several constants per gate.
This won't really help anything near term since we're still between 2^12 and 2^13, but could have some benefits later, depending on what recursion arities and security settings we end up using.
`PoseidonMdsGate` needs `2 * D * WIDTH = 48` routed wires, and the combination of adding a gate and increasing routed wires slows down the prover a bit. So for now, I kept it at 28 wires, and the old code path is still used.
2021-11-02 08:16:28 -07:00
Daniel Lubarov
b0b2a10da0
Only log timing for the final proof in recursion tests ( #315 )
...
* Only log timing for the final proof in recursion tests
Just to reduce noise; the performance of the final proof is most meaningful
* fmt
2021-10-21 14:22:22 -07:00
wborgeaud
1f1827dae7
Clippy
2021-10-21 14:36:36 +02:00
wborgeaud
318185d1c0
Use only one BaseSumGate
2021-10-21 12:56:02 +02:00
wborgeaud
1d2ae77eea
Change parameters order in CircuitBuilder::arithmetic
2021-10-21 08:56:30 +02:00
Daniel Lubarov
22ce2da9e1
Add add_const, mul_const, mul_const_add methods ( #312 )
...
* Add mul_const, mul_const_add methods
To replace some arithmetic calls; I think it's easier to read.
* One more
* Couple more
* tweak
* tweak
2021-10-20 23:43:52 -07:00
Daniel Lubarov
0b75b24c09
Have split_low_high use range_check ( #311 )
2021-10-20 23:43:35 -07:00
wborgeaud
019ccf537b
Merge pull request #309 from mir-protocol/use_quadratic_extension
...
Generalize `RandomAccessGate` to allow using quadratic field extensions
2021-10-18 22:00:04 +02:00
wborgeaud
dda14011c5
Forgot a random access check
2021-10-18 17:23:39 +02:00
wborgeaud
5b81006e9a
Fill random access gates to make sure all generators are run
2021-10-18 17:11:59 +02:00
wborgeaud
3f0b5ab9d3
Keep track of the last used RAM gate
2021-10-18 16:48:21 +02:00
wborgeaud
a35cd98b03
New random access gadget
2021-10-18 15:45:52 +02:00
wborgeaud
104fd08e72
Working RAM gate
2021-10-18 15:19:09 +02:00
wborgeaud
9503bb22f4
Take config by reference to avoid clone
2021-10-18 11:11:48 +02:00
wborgeaud
9b098a9fbe
Trivial random access
2021-10-06 16:37:27 +02:00
Daniel Lubarov
5098c2a386
Have ArithmeticExtensionGate adapt based on available wires ( #287 )
2021-10-05 23:28:29 -07:00
wborgeaud
242ee26b6f
Generalize to fields with less than 64 bits
2021-10-05 17:50:38 +02:00
wborgeaud
6d601c6113
Overflow fixes
2021-10-05 14:27:30 +02:00
Daniel Lubarov
01c2047a66
Outdated TODO
2021-10-03 22:22:30 -07:00
Daniel Lubarov
31b1a0a9da
Less use of ZK configs in tests ( #272 )
...
ZK circuit tests are quite slow, so I think we should use them very sparingly, and not in any tests with loops
2021-09-27 11:42:53 -07:00
Daniel Lubarov
7bf257546e
Minor
2021-09-26 16:28:09 -07:00
Nicholas Ward
23b1161d27
Merge pull request #249 from mir-protocol/sorting_gadget
...
Memory sorting gadget
2021-09-23 09:28:47 -07:00
Nicholas Ward
0c0a8fd862
tweaks
2021-09-23 09:16:38 -07:00
Daniel Lubarov
202967a40b
Other tweaks
2021-09-22 18:14:58 -07:00
Daniel Lubarov
d541e251ee
Add a MemoryOp to simplify MemoryOpSortGenerator
2021-09-22 18:10:38 -07:00
Nicholas Ward
8aa4376360
addressed comments (set sorted values in partial witness; no more directly setting gate inputs)
2021-09-22 14:03:27 -07:00
Nicholas Ward
2ec3b29741
addressed comments
2021-09-22 11:49:28 -07:00
Nicholas Ward
6c4173d2ec
fmt
2021-09-21 18:02:56 -07:00
Nicholas Ward
644d87e495
fixes galore
2021-09-21 18:01:21 -07:00
wborgeaud
5f3a5e6bad
Add num_bits==1,2 cases in le_sum
2021-09-21 18:27:49 +02:00
wborgeaud
4305a95cdb
Small fixes to the le_sum and reduce gadgets
2021-09-21 12:52:28 +02:00
Nicholas Ward
3d93766cc8
test (wip)
2021-09-17 14:50:37 -07:00
Nicholas Ward
8dd00b8d41
added generator
2021-09-17 13:40:07 -07:00
Nicholas Ward
2c1c116ead
fixes (addressed comments)
2021-09-17 13:09:24 -07:00