253 Commits

Author SHA1 Message Date
wborgeaud
1f42916bfc Comments 2021-09-20 17:58:25 +02:00
wborgeaud
36e4d3608d Working (de)compression for FRI proofs 2021-09-20 17:34:52 +02:00
wborgeaud
b63d83aacf Add Poseidon gadget 2021-09-16 21:18:08 +02:00
Daniel Lubarov
91f7b4e300
Replace CrandallQuarticField with a more generic QuarticExtension (#232)
* Replace `CrandallQuarticField` with a more generic `QuarticExtension`

And likewise for `CrandallQuadraticField`.

There are a few parameters which we can't automatically derive (in const Rust), so I specified them in a `AutoExtendable` trait.

This would make it fairly easy to add extension fields for `GoldilocksField` and any future fields.

* Attempt to derive 2-adicity, see Hamish's feedback

* Simplify TWO_ADICITY based on chat with Hamish

* PR feedback

* Merge AutoExtendable into Extendable (#235)
2021-09-13 11:45:17 -07:00
Daniel Lubarov
c76eb9ddeb
Prepare for the switch to Poseidon (#228)
* Prepare for the switch to Poseidon

Everything will now select a permutation based on the `PERMUTATION_FAMILY` const.

The `Poseidon` variant won't work quite yet since the gate isn't in place; I left that as a `todo!()`

* fix
2021-09-13 10:22:25 -07:00
Daniel Lubarov
3bc34c59d8
Refactor GMiMC code (#224)
* Refactor GMiMC code

Adds a sub-trait of `Field` called `GMiMCInterface`, which is similar to `PoseidonInterface`.

This lets us have different fields with different GMiMC constants in a type-safe way.

* Remove `Interface`

* Const generic for width
2021-09-07 18:28:28 -07:00
Nicholas Ward
effcc967d0 fmt 2021-09-06 21:39:00 -07:00
Nicholas Ward
c07f99ac81 merge 2021-09-06 21:38:52 -07:00
Nicholas Ward
1818e69ce3 addressed comments 2021-09-06 08:38:47 -07:00
Daniel Lubarov
236a143abf
Move some Field members to a Field64 subtrait (#213)
* Move some Field members to a Field64 subtrait

I.e. move anything specific to 64-bit fields.

Also, relatedly,
- Tweak a bunch of prover code to require `Field64`, since 64-bit stuff is used in a couple places, like the FRI proof-of-work
- Remove `bits()`, which was unused and assumed a 64-bit field
- Rename a couple methods to reflect that they're u64 variants

There are no functional changes.

* Field64 -> PrimeField

* Remove `exp_u32`, `kth_root_u32`

* PrimeField: PrimeField

* Move `to_canonical_biguint` as well

* Add back from_noncanonical_u128
2021-09-05 10:27:11 -07:00
Nicholas Ward
6f885db677 fixes 2021-09-04 16:44:49 -07:00
Nicholas Ward
1fb7eeb03e variable-sized tests 2021-09-04 16:29:33 -07:00
Nicholas Ward
4c3f3cda39 6x6 test 2021-09-04 16:29:33 -07:00
Nicholas Ward
4f7a587bfa fix for non-2x2 permutation case 2021-09-04 16:29:32 -07:00
Daniel Lubarov
f89f49249a wip 2021-09-04 16:27:40 -07:00
Nicholas Ward
10d016a92c chunk size as field 2021-09-03 18:07:21 -07:00
Nicholas Ward
3ad0365967 fixed infinite loop 2021-09-03 18:07:21 -07:00
Nicholas Ward
3494839227 removed more to_vec calls (within maps) 2021-09-03 18:07:21 -07:00
Nicholas Ward
260d4bd13c removed to_vec calls 2021-09-03 18:07:21 -07:00
Nicholas Ward
485d4862ff fixes 2021-09-03 18:07:21 -07:00
Nicholas Ward
4ea1df82ba fixes 2021-09-03 18:07:21 -07:00
Nicholas Ward
ab744a7c36 edits and fixes 2021-09-03 18:07:21 -07:00
Nicholas Ward
d4aa4d7153 fixes and new generator 2021-09-03 18:07:21 -07:00
Nicholas Ward
f7607dddd4 fmt 2021-09-03 18:07:21 -07:00
Nicholas Ward
fe843db57f many fixes 2021-09-03 18:07:20 -07:00
Nicholas Ward
a1d5f5b6fe progress 2021-09-03 18:07:20 -07:00
Nicholas Ward
013c8bb612 progress 2021-09-03 18:07:20 -07:00
Nicholas Ward
2ab37e688f progress 2021-09-03 18:07:20 -07:00
Nicholas Ward
a574fecc4d permutation progress 2021-09-03 18:07:20 -07:00
Nicholas Ward
412ada762a permutation progress 2021-09-03 18:07:20 -07:00
Nicholas Ward
b0a855a9c3 progress on permutation 2021-09-03 18:07:20 -07:00
wborgeaud
71f64329c7 Minor 2021-08-24 08:30:34 +02:00
wborgeaud
69a945547a route, assert_equal -> connect 2021-08-24 08:25:11 +02:00
wborgeaud
cd1bd9e77b
Merge pull request #195 from mir-protocol/partition_witness
Remove `CopyGenerator`s and add new `PartitionWitness`
2021-08-24 08:16:35 +02:00
Nicholas Ward
8f75a8de7f Merge commit '717efbb' 2021-08-23 14:22:20 -07:00
wborgeaud
a90ea6ec79 PartialWitness back to HashMap 2021-08-20 11:56:57 +02:00
wborgeaud
e81001b9ba Clippy 2021-08-20 11:13:40 +02:00
wborgeaud
c6cf5cf130 Move PartitionWitness 2021-08-20 09:55:49 +02:00
wborgeaud
a44bf9ffd8 Added witness trait 2021-08-20 09:50:07 +02:00
Nicholas Ward
f5c5ed9cfd finished switch gate 2021-08-19 19:41:18 -07:00
Daniel Lubarov
90c7a72ceb
Remove some unused warnings (#192)
- Made some methods public, if they seemed like they'd be useful crates that depend on plonky2, and seemed like good/stable APIs
- Deleted a few things I didn't think seemed very useful
- Left a few for now that I was on the fence about
2021-08-19 08:23:45 -07:00
wborgeaud
74c2be5090 First pass 2021-08-19 14:54:11 +02:00
wborgeaud
561228103f More scalar muls 2021-08-17 10:26:31 +02:00
Daniel Lubarov
69193a8dc2
Remove *_three methods (#182)
* Remove *_three methods

Since there's no longer a performance reason for them, and I think the *_many methods are about as short etc.

* PR feedback
2021-08-17 00:38:41 -07:00
wborgeaud
9a54540116 Minor 2021-08-16 11:08:26 +02:00
wborgeaud
5a9c5b295c Minor 2021-08-16 10:41:12 +02:00
wborgeaud
b366482866 The mother of all arithmetic optimizations 2021-08-16 10:18:10 +02:00
wborgeaud
6ba6201b94 Merge branch 'main' into push_to_8192
# Conflicts:
#	src/fri/recursive_verifier.rs
#	src/plonk/circuit_data.rs
#	src/plonk/recursive_verifier.rs
#	src/util/reducing.rs
2021-08-16 08:49:49 +02:00
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