66 Commits

Author SHA1 Message Date
Hamish Ivey-Law
2c5f6fd62a
Fix compile time problems and generic hash implementation (#1024)
* Fix egregious magic number.

* Remove generic consts from core permutations.

* Remove redundant `where` clauses.

* Remove HashConfig and friends.

* Refactor Permutation code.

* Remove redundant `where` clauses and `use`s.

* Introduce AlgebraicPermutation to wrap `[Target; WIDTH]`s.

* Remove `generic_const_expr` feature from plonky2!

* Remove `generic_const_expr` feature from plonky2!

* Compile time fixed! Start removing `generic_const_expr` from evm.

* Remove redundant `where` clauses from Starky.

* Remove `generic_const_expr`s from benchmarks.

* Remove redundant HASH_SIZE `where` clause.

* Clippy.

* Fix unrelated OsRng issue in `bench_recursion`.

* Fix function doc.
2023-05-11 02:59:02 +10:00
Robin Salen
5de5bfb5e4
Move serialization files into dedicated module 2023-04-20 07:59:37 +02:00
Robin Salen
f71139d934
Add serialisation support for gates, generators, and various structs
Co-authored-by: Sebastien La Duca <sladuca777@gmail.com>
2023-04-20 07:59:36 +02:00
Robin Salen
9ee47ab745
Move HashConfig into GenericConfig associated types 2023-04-01 09:54:14 -04:00
Robin Salen
e857c020bf
Make hash functions generic 2023-03-31 18:55:06 -04:00
Daniel Lubarov
ff80f28b93 Revert "Set CI to use an older version of nightly"
This reverts commit da23fb116b934925f8a5cf37c2f1f092452fdc4d.
2023-02-10 23:10:39 -08:00
Daniel Lubarov
137bc78565 Prep for publishing to crates.io 2023-01-30 13:18:06 -08:00
Daniel Lubarov
ae212cfbbd
Merge pull request #859 from mir-protocol/remove_older_evm_recursion_logic
Remove some older EVM recursion logic
2023-01-04 00:07:15 -08:00
Daniel Lubarov
e12c6ad5b9 Remove some older EVM recursion logic
Some logic was replaced by the constant-degree logic in `fixed_recursive_verifier`.
2023-01-03 11:53:21 -08:00
Daniel Lubarov
6655e776a8 Remove CTL defaults
We ended up not needing the feature.
2023-01-03 11:36:42 -08:00
Daniel Lubarov
5719c0b70b feedback 2023-01-03 11:23:28 -08:00
Daniel Lubarov
595e751ac1 Shrink STARK proofs to a constant degree
The goal here is to end up with a single "root" circuit representing any EVM proof. I.e. it must verify each STARK, but be general enough to work with any combination of STARK sizes (within some range of sizes that we chose to support). This root circuit can then be plugged into our aggregation circuit.

In particular, for each STARK, and for each initial `degree_bits` (within a range that we choose to support), this adds a "shrinking chain" of circuits. Such a chain shrinks a STARK proof from that initial `degree_bits` down to a constant, `THRESHOLD_DEGREE_BITS`.

The root circuit then combines these shrunk-to-constant proofs for each table. It's similar to `RecursiveAllProof::verify_circuit`; I adapted the code from there and I think we can remove it after. The main difference is that now instead of having one verification key per STARK, we have several possible VKs, one per initial `degree_bits`. We bake the list of possible VKs into the root circuit, and have the prover indicate the index of the VK they're actually using.

This also partially removes the default feature of CTLs. So far we've used filters instead of defaults. Until now it was easy to keep supporting defaults just in case, but here maintaining support would require some more work. E.g. we couldn't use `exp_u64` any more, since the size delta is now dynamic, it can't be hardcoded. If there are no concerns, I'll fully remove the feature after.
2023-01-01 23:11:39 -08:00
Daniel Lubarov
92974aa105 A few more cyclic recursion changes
In preparation for adding the zkEVM aggregation circuit. Mainly,

- Adds a `WitnessWrite` trait, a sub-trait of `Witness`, and move the write methods to it. `GeneratedValues` impls `WitnessWrite`, which lets generators like `DummyProofGenerator` access all our write methods like `set_proof_with_pis_target`. Also removes some duplication.

- Remove `set_cyclic_recursion_data_target` - now that dummy proof data is automatically populated, all that remains is populating `condition` and the cyclic proof + VK. I think it's easy enough for callers to do this; the steps are the same as with `conditionally_verify_proof`. This way there's no cyclic-recursion-specific API to learn about.

- Split `cyclic_recursion` into two variants, one which checks the current circuit or a dummy, and a more general one which checks the current circuit or some other circuit. We can use the latter to build a more efficient aggregation circuit, where we check another aggregation proof or an EVM proof, with no dummy proofs involved.
2022-12-11 22:43:26 -08:00
Daniel Lubarov
b8b2fefe52 Use Keccak sponge table for bootloading
And get rid of the deprecated Keccak memory table.
2022-12-03 11:21:31 -08:00
Daniel Lubarov
5a153278aa fix 2022-11-28 22:34:29 -08:00
Brandon H. Gomes
6fd0da216a
fix: remove unstable features from plonky2
Signed-off-by: Brandon H. Gomes <bhgomes@pm.me>
2022-11-02 17:50:31 -07:00
wborgeaud
0e58efdcc1 Remove Config from CommonCircuitData 2022-10-25 10:08:21 +02:00
wborgeaud
1ae922dd4d Merge branch 'main' into generate_dummy_proof 2022-10-17 10:01:32 +02:00
wborgeaud
69bdbf6bf6 Redundant degree_bits 2022-10-13 18:19:05 +02:00
wborgeaud
816e7db345 Working 2022-10-11 11:02:03 +02:00
wborgeaud
4ff6bbb3de Hardcode verifier data in the circuit 2022-10-07 09:47:03 +02:00
wborgeaud
39fc219324 PR feedback 2022-10-06 16:40:03 +02:00
wborgeaud
0bc3f20479 PR feedback 2022-10-06 16:32:35 +02:00
wborgeaud
e515f1e1cc Split circuit and witness generation 2022-10-04 09:56:12 +02:00
wborgeaud
3be208edf0 Minor 2022-10-03 12:02:25 +02:00
wborgeaud
a5a4098d7a Merge branch 'main' into per_table_recursion
# Conflicts:
#	evm/src/all_stark.rs
#	evm/src/generation/mod.rs
#	evm/src/recursive_verifier.rs
2022-10-03 11:49:26 +02:00
wborgeaud
668957176a PR feedback 2022-10-03 11:44:52 +02:00
wborgeaud
3579f9e875 state() -> compact() 2022-10-03 10:53:33 +02:00
BGluth
8e08b218d2 Trie roots now use H256 instead of U256
- `H256` preserves any leading `0`s, which could be critical in some
  situations. Also just a slightly more appropriate type for hashes.
2022-09-29 15:56:09 -06:00
wborgeaud
1de3ed823a Update comments 2022-09-26 16:05:15 +02:00
wborgeaud
6cf6b56aa0 Method to compute verifier data without proving 2022-09-26 15:47:35 +02:00
wborgeaud
0053a02119 Cleaning 2022-09-23 16:28:20 +02:00
wborgeaud
502305146f Working 2022-09-23 16:25:02 +02:00
wborgeaud
a63ed60401 Add CTL verification 2022-09-23 15:50:57 +02:00
wborgeaud
e712986a92 Challenger state works 2022-09-23 13:41:14 +02:00
wborgeaud
6e6c2daf29 Add challenger state 2022-09-22 11:01:27 +02:00
wborgeaud
a930c1a823 s/l1/l0 2022-09-12 08:09:17 +02:00
wborgeaud
a760904549 Clippy 2022-09-05 16:37:54 +02:00
wborgeaud
e6708da36f Comments 2022-09-05 16:34:29 +02:00
wborgeaud
a5f4730bd5 Minor 2022-09-05 15:47:03 +02:00
wborgeaud
35b22974ed Recursively verify 2022-09-05 12:25:30 +02:00
wborgeaud
e6490fdd11 Add verify 2022-09-05 09:17:00 +02:00
wborgeaud
da03af2979 Minor 2022-09-05 08:38:57 +02:00
wborgeaud
c320a9e8ae Merge branch 'main' into per_table_recursion
# Conflicts:
#	evm/src/all_stark.rs
#	evm/src/proof.rs
2022-09-05 08:34:52 +02:00
wborgeaud
05c3c4d907 First pass 2022-08-26 10:12:45 +02:00
wborgeaud
2fa347128f All recursive proofs 2022-08-26 09:49:59 +02:00
wborgeaud
c4fc9b0ae4 Merge conflicts 2022-08-26 09:42:55 +02:00
wborgeaud
8600a5a46f Merge branch 'main' into per_table_recursion
# Conflicts:
#	evm/src/proof.rs
2022-08-26 09:41:00 +02:00
Daniel Lubarov
d0be79e822 Feedback 2022-08-25 23:35:38 -07:00
Daniel Lubarov
aa87f2c3ba Public memory 2022-08-25 20:19:18 -07:00