43 Commits

Author SHA1 Message Date
Nicholas Ward
3e00a5819f fix: endian-ness 2021-07-21 14:12:33 -07:00
Nicholas Ward
164bb7f5ca fixes 2021-07-21 13:23:50 -07:00
Nicholas Ward
7f92a33964 cargo fmt 2021-07-21 13:05:40 -07:00
Nicholas Ward
1dd850b0e5 fixes 2021-07-21 13:05:32 -07:00
Nicholas Ward
c5bbe9d503 fixes 2021-07-21 09:56:00 -07:00
Nicholas Ward
b103c0774f progress 2021-07-20 15:42:27 -07:00
Daniel Lubarov
77ce69dc15
Proof serialization (#93)
Using `serde_cbor` for now. It's probably far from optimal, as we have many `Vec`s which I assume it will prefix with their lengths, but it's a nice and easy method for now.
2021-07-15 07:35:12 -07:00
Hamish Ivey-Law
574a3d4847
FFT improvements (#81)
* Use built-in `reverse_bits`; remove duplicate `reverse_index_bits`.

* Reduce precomputation time/space complexity from quadratic to linear.

* Several working cache-friendly FFTs.

* Fix to allow FFT of constant polynomial.

* Simplify FFT strategy choice.

* Add PrimeField and CHARACTERISTIC properties to Fields.

* Add faster method for inverse of 2^m.

* Pre-compute some of the roots; tidy up loop iteration.

* Precomputation for both FFT variants.

* Refactor precomputation; add optional parameters; rename some things.

* Unrolled version with zero tail.

* Iterative version of Unrolled precomputation.

* Test zero tail algo.

* Restore default degree.

* Address comments from @dlubarov and @wborgeaud.
2021-07-01 14:55:41 +10:00
wborgeaud
b44a01c975 Merge main 2021-06-15 09:20:00 +02:00
wborgeaud
445ea3771d Remove Frobeniable trait 2021-06-14 10:28:15 +02:00
wborgeaud
20741cfb4a Implement out-of-circuit repeated_frobenius using hardcoded constants 2021-06-11 13:45:51 +02:00
Daniel Lubarov
f929f94626
Have rustfmt group imports (#60)
* Have rustfmt group imports

See `rustfmt.toml`; the rest is automated changes.

* fmt
2021-06-10 14:10:35 -07:00
wborgeaud
96a880193c Clippy 2021-05-18 16:09:22 +02:00
wborgeaud
a2cf2c03b6 Working FRI with field extensions 2021-05-18 15:22:06 +02:00
wborgeaud
e7c37dfa00 Merge pull request #31 from mir-protocol/fix-subtraction
Fixes a bug in the field subtraction
2021-05-04 17:59:23 +02:00
wborgeaud
20dae028d8 fix subtraction 2021-05-04 17:57:59 +02:00
Daniel Lubarov
116f92eade Merge pull request #28 from mir-protocol/mds
Add methods for MDS matrices
2021-04-29 07:03:57 -07:00
Daniel Lubarov
6db30c6db3 Precomputed MDS matrix for CrandallField 2021-04-28 14:42:21 -07:00
wborgeaud
79a8ccd9a0 Working bit-reversed version 2021-04-28 18:38:05 +02:00
Daniel Lubarov
872673702e Tweaks to CrandallField 2021-04-25 17:14:26 -07:00
Daniel Lubarov
035d15bc3d Interpolants of arbitrary (point, value) lists
Closes #10. This combines Lagrange interpolation with FFTs as mentioned there.

I was previously thinking that all our polynomial encodings might as well just use power-of-two length vectors, so they'll be "FFT-ready", with no need to trim/pad. This sort of breaks that assumption though, as e.g. I think we'll want to compute interpolants with three coefficients in the batch opening argument.

I think we can still skip trimming/padding in most cases, since it the majority of our polynomials will have power-of-two-minus-1 degrees with high probability. But we'll now have one or two uses where that's not the case.
2021-04-24 19:20:18 -07:00
Daniel Lubarov
7ffb9cf9b2 Merge pull request #17 from mir-protocol/rescue_bench
Make Rescue a bit faster
2021-04-24 10:53:52 -07:00
Daniel Lubarov
80775eadb1 Make Rescue a bit faster
... by switching to Rescue Prime (which has a smaller security margin), and precomputing an addition chain for the exponent used in the cubic root calculation. Also adds a benchmark.
2021-04-23 13:25:29 -07:00
Daniel Lubarov
af4c8734ce Address some clippy warnings 2021-04-23 12:35:19 -07:00
wborgeaud
6b407e45ef Progress on FRI 2021-04-21 22:31:45 +02:00
Daniel Lubarov
5fe8d633b6 Split main into multiple binaries
... and other minor refactoring.

`bench_recursion` will be the default bin run by `cargo run`; the otheres can be selected with the `--bin` flag.

We could probably delete some of the other binaries later. E.g. `field_search` might not be useful any more. `bench_fft` should maybe be converted to a benchmark (although there are some pros and cons, e.g. the bench framework has a minimum number of runs, and isn't helpful in testing multi-core performance).
2021-04-06 13:23:47 -07:00
Daniel Lubarov
cb1c69e50f Validate that the cosets for Plonk's permutation argument are disjoint
When we had a large field, we could just pick random shifts, and get disjoint cosets with high probability. With a 64-bit field, I think the probability of a collision is non-negligible (something like 1 in a million), so we should probably verify that the cosets are disjoint.

If there are any concerns with this method (or if it's just confusing), I think it would also be reasonable to use the brute force approach of explicitly computing the cosets and checking that they're disjoint. I coded that as well, and it took like 80ms, so not really a big deal since it's a one-time preprocessing cost.

Also fixes some overflow bugs in the inversion code.
2021-04-04 14:34:33 -07:00
Daniel Lubarov
facbe117fb Move some stuff into Field 2021-04-02 19:04:26 -07:00
Daniel Lubarov
78860cc3db Final fixes 2021-04-02 18:29:33 -07:00
Daniel Lubarov
572a55ed29 Fix to_canonical_u64 2021-04-02 18:23:22 -07:00
Daniel Lubarov
285ec16599 Fix neg 2021-04-02 18:12:44 -07:00
Daniel Lubarov
c25c689ef0 More tests, ported from plonky1 2021-04-02 17:49:57 -07:00
Daniel Lubarov
4086b2b447 Arithmetic & permutation gadgets 2021-04-02 15:29:21 -07:00
Daniel Lubarov
aea4eeaaae Minor 2021-04-02 14:00:26 -07:00
Daniel Lubarov
347206d161 Add Z terms in vanishing poly 2021-03-30 23:12:47 -07:00
Daniel Lubarov
3c262a8c49 Fix some warnings 2021-03-30 20:16:20 -07:00
Daniel Lubarov
6c8dfb97ac Refactor polynomial code 2021-03-30 13:30:31 -07:00
Daniel Lubarov
ba96ab4e99 More prover work 2021-03-26 23:51:48 -07:00
Daniel Lubarov
58425eb548 Misc 2021-02-27 21:42:12 -08:00
Daniel Lubarov
9fdff8ea08 Gate infra 2021-02-26 13:18:41 -08:00
Daniel Lubarov
3ba9ef8ab7 Const generics in GMiMC 2021-02-24 12:25:13 -08:00
Daniel Lubarov
1480876c9a Add some FRI params & clean up FFT a bit 2021-02-17 22:19:18 -08:00
Daniel Lubarov
13cc76316c Initial commit 2021-02-17 14:36:32 -08:00