143 Commits

Author SHA1 Message Date
Daniel Lubarov
64cd2e5686
2 challenges, 28 routed wires (#310)
* 2 challenges, 28 routed wires

2 challenges gives certain checks approximately (field_bits - degree_bits) * 2 bits of security, so we maintain our target of 100 bits for circuits with 2^14 gates or fewer.

28 routed wires is the min for `InterpolationGate`. A lower number helps reduce proof sizes. We can go back to a high number if there's any strong reason to reduce our gate count (e.g. if we were trying to hit 2^12).

* Check FRI conjectured security

* Fix
2021-10-19 12:38:20 -07:00
wborgeaud
5f4a244240 PR feedback 2021-10-18 21:38:57 +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
00ce9d9f25 Add num_copies to RAM gate 2021-10-18 11:07:18 +02:00
wborgeaud
710959f077 Comments 2021-10-13 15:45:43 +02:00
wborgeaud
7f6d90ee42 Clean get_challenges 2021-10-13 15:39:12 +02:00
wborgeaud
164aa0947e Use cap_height: 0 in size-optimized proof 2021-10-12 21:36:20 +02:00
wborgeaud
d43850e580
Merge pull request #298 from mir-protocol/remove_inferred_elmt
Remove inferred element in compressed proof
2021-10-12 20:22:05 +02:00
wborgeaud
839110b794 coset_index in other places 2021-10-12 20:21:29 +02:00
wborgeaud
1ced853f33 Add coset_index var 2021-10-12 08:40:56 +02:00
wborgeaud
cdb2892969 Move inferred elements to a new struct 2021-10-12 08:38:43 +02:00
wborgeaud
62f3b558ad Typos 2021-10-11 18:45:55 +02:00
wborgeaud
288a8e1155 Minor comments 2021-10-11 18:44:17 +02:00
wborgeaud
ddac8026f2 Comments 2021-10-11 17:24:06 +02:00
wborgeaud
acadd64371 Clippy 2021-10-11 16:51:30 +02:00
wborgeaud
ea69a87338 Working 2021-10-11 16:40:31 +02:00
Jakub Nabaglo
c55181a4ea
Fix logging in tests (#293)
* Fix logging in tests

* lint
2021-10-08 17:07:03 -07:00
wborgeaud
d2a5e67980 Somewhat working 2021-10-07 19:30:39 +02:00
wborgeaud
ea3e31504a First pass 2021-10-06 15:50:56 +02:00
Daniel Lubarov
5098c2a386
Have ArithmeticExtensionGate adapt based on available wires (#287) 2021-10-05 23:28:29 -07:00
Daniel Lubarov
a407e5e1a0 Fix 2021-10-05 16:33:08 -07:00
Daniel Lubarov
cb129fb095
Refactor recursion tests (#285)
* Refactor recursion tests

E.g. the main part of `test_recursive_recursive_verifier` is now

```rust
let (proof, vd, cd) = dummy_proof::<F, D>(&config, 8_000)?;
let (proof, vd, cd) = recursive_proof(proof, vd, cd, &config, &config, false)?;
let (proof, _vd, cd) = recursive_proof(proof, vd, cd, &config, &config, true)?;
```

Also adds a new `test_size_optimized_recursion` to see how small we can make the final proof in a recursion chain. The final proof is ~74kb (depending on compression luck) and takes ~20s to prove on my M1 (depending on PoW luck).

* Refactor serialization

* Don't log timestamps
2021-10-05 08:36:24 -07:00
Daniel Lubarov
898cac1709
Automatically select FRI reduction arities (#282)
* Automatically select FRI reduction arities

This way when a proof's degree changes, we won't need to manually update the `FriConfig`s of any recursive proofs on top of it.

For now I've added two methods of selecting arities. The first, `ConstantArityBits`, just applies a fixed reduciton arity until the degree has shrunk below a certain threshold. The second, `MinSize`, searches for the sequence of arities that minimizes proof size.

Note that this optimization is approximate -- e.g. it doesn't account for the effect of compression, and doesn't count some minor contributions to proof size, like the Merkle roots from the commit phase. It also assumes we're not using Merkle caps in serialized proofs, and that we're inferring one of the evaluations, even though we haven't made those changes yet.

I think we should generally use `ConstantArityBits` for proofs that we will recurse on, since using a single arity tends to be more recursion-friendly. We could use `MinSize` for generating final bridge proofs, since we won't do further recursion on top of those.

* Fix tests

* Feedback
2021-10-04 13:52:05 -07:00
wborgeaud
d9634e075e
Merge pull request #279 from mir-protocol/duplicate_indices
Remove duplicate query indices in FRI proofs
2021-10-04 10:40:18 +02:00
Daniel Lubarov
9d8b32c355 fmt 2021-10-03 22:59:10 -07:00
Daniel Lubarov
dadc1b2add cargo fix 2021-10-03 22:22:10 -07:00
wborgeaud
fbefaa4768 Unused import 2021-10-02 14:01:08 +02:00
wborgeaud
e3b2416025 Merge branch 'duplicate_indices' into custom_serializer 2021-10-02 13:56:46 +02:00
wborgeaud
3859ca2090 PR comments 2021-10-02 10:46:02 +02:00
wborgeaud
0839ed8793 Unused import 2021-10-02 09:55:38 +02:00
wborgeaud
76d3f488bd Fixes 2021-10-02 09:53:31 +02:00
wborgeaud
17ed6a2b04 Clippy 2021-10-01 17:12:46 +02:00
wborgeaud
fb585064a9 (De)Serializer for CompressedProof 2021-10-01 16:54:14 +02:00
wborgeaud
8f212d31ef Working custom (de)serializer 2021-10-01 14:59:16 +02:00
wborgeaud
28eca4bfdd Clippy 2021-09-30 19:09:27 +02:00
wborgeaud
dd68971609 Cleaning 2021-09-30 18:58:36 +02:00
wborgeaud
94375cdf68 Minor 2021-09-30 08:02:01 +02:00
wborgeaud
f92ce1a80c Add CompressedProof type 2021-09-30 06:56:32 +02:00
Daniel Lubarov
ac97412667 Renaming 2021-09-29 12:07:27 -07:00
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