103 Commits

Author SHA1 Message Date
wborgeaud
a97b9a7112 Add compressed FRI proof type using a HashMap 2021-09-29 21:01:15 +02:00
Daniel Lubarov
3f22663296
Split up PartitionWitness data (#273)
* Split up `PartitionWitness` data

This addresses two minor inefficiencies:
- Some preprocessed forest data was being cloned during proving.
- Some of the `ForestNode` data (like node sizes) is only needed in preprocessing, not proving. It was taking up cache space during proving because it was interleaved with data that is used during proving (parents, values).

Now `Forest` contains the disjoint-set forest. `PartitionWitness` is now mainly a Vec of target values; it also holds a reference to the (preprocessed) representative map.

On my laptop, this speeds up witness generation ~12%, resulting in an overall ~0.5% speedup.

* Feedback

* No size data (#278)

* No size data

* feedback
2021-09-28 22:31:20 -07:00
Daniel Lubarov
3d39925973
Couple tweaks for Goldilocks (#274)
- impl `RichField`
- Fix missing imports (easy to miss since they're conditionally compiled)
- Have the benchmarks use Goldilocks
2021-09-28 10:03:19 -07:00
Daniel Lubarov
76fcc4ee2c
Very explicit path compression (#271)
* Very explicit path compression

* fmt

* Remove `t` -- no longer needed

* Move comment

* Also remove index field
2021-09-27 10:00:44 -07:00
Daniel Lubarov
541ad5d755 Minor 2021-09-26 16:37:35 -07:00
Daniel Lubarov
f382289896
Derive challenges from other proof fields (#262)
* Derive challenges from other proof fields

* Delete failing test

Seems really hard to get the challenges right with the new model.

* Move PoW check

* Other feedback
2021-09-25 19:41:48 -07:00
Jakub Nabaglo
7360391515
Cache FFT roots (#261) 2021-09-22 10:56:09 -07:00
Jakub Nabaglo
2f8286ff98
Fix a few warnings (#259) 2021-09-21 13:12:46 -07:00
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
f83c587cc5 Comments 2021-09-17 13:47:08 +02:00
wborgeaud
b63d83aacf Add Poseidon gadget 2021-09-16 21:18:08 +02:00
Daniel Lubarov
b3008b9475
Some changes to generator_indices_by_watches (#234)
* Some changes to generator_indices_by_watches

- Index generators by the representatives (in disjoint-set forest terminology) of their watched targets, rather than the watched targets themselves.  Enqueuing generators based on their watch lists then works correctly, so we no longer need the step where we reenqueue all generators.
- In #195, it was pointed out that this slows down witness generation a bit. I moved the indexing code to preprocessing, so the prover is a bit faster (~7ms for me).

* Outdated comment

* Panic instead of infinite loop if we get stuck

* BTree

* fmt
2021-09-13 16:38:55 -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
c07f99ac81 merge 2021-09-06 21:38:52 -07:00
Daniel Lubarov
676c244de7 Unused field 2021-09-06 17:01:15 -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
7acdf976c1 fixed fill_switch_gates 2021-09-04 16:28:07 -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
2ab37e688f progress 2021-09-03 18:07:20 -07:00
Jakub Nabaglo
5513a64614
Buffer reuse in eval_vanishing_poly_base (#211)
* Buffer reuse in eval_vanishing_poly_base

* Lint
2021-08-31 13:23:00 -07:00
wborgeaud
d01d206524 Remove named connects 2021-08-24 18:20:47 +02: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
wborgeaud
181ddf93ab Merge two impls 2021-08-23 11:06:33 +02:00
wborgeaud
2fcfa230a6 Pr feedback 2021-08-22 10:36:44 +02:00
Daniel Lubarov
88e0656650
Address a few more unused warnings (#196) 2021-08-20 08:58:48 -07:00
Daniel Lubarov
535c385643
Field: Default (#193)
* Field: Default

It's done for primitive types like `u64`, so seems conventional, and some code in mir-core expects it.

* HashOut::ZERO

* Default for HashOut

* fmt

* pub elements

* Debug

* rand_from_rng
2021-08-20 08:44:28 -07:00
wborgeaud
1c07cb1917 Renaming 2021-08-20 13:06:07 +02:00
wborgeaud
5264859a6d Minor 2021-08-20 12:59:25 +02:00
wborgeaud
507577b7ad Comments 2021-08-20 12:55:59 +02: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
c53d050408 More cleaning 2021-08-20 11:03:55 +02:00
wborgeaud
6584734928 Cleaning 2021-08-20 10:44:19 +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
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
af0ea25fc8 more trials 2021-08-19 15:59:05 +02:00
wborgeaud
74c2be5090 First pass 2021-08-19 14:54:11 +02:00
Daniel Lubarov
aae2c9d16f Reduce PoW bits
The PoW search was taking significant time sometimes.
2021-08-17 23:55:16 -07:00
wborgeaud
561228103f More scalar muls 2021-08-17 10:26:31 +02:00
wborgeaud
896988ca30 Put back generator check 2021-08-17 09:12:40 +02:00
wborgeaud
9a54540116 Minor 2021-08-16 11:08:26 +02:00
wborgeaud
5a9c5b295c Minor 2021-08-16 10:41:12 +02:00
wborgeaud
3d83d9ff42 Minor 2021-08-16 10:28:08 +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