1028 Commits

Author SHA1 Message Date
Daniel Lubarov
5df784416a Add aggregation circuit
Which can be used to compress two proofs into one. Each inner proof can be either
- an "EVM root" proof (which typically proves one transaction, though it could be 0 or more)
- another aggregation proof
2023-01-03 15:46:59 -08:00
Daniel Lubarov
5719c0b70b feedback 2023-01-03 11:23:28 -08:00
Daniel Lubarov
18ce7ea547 Disable slow test on CI 2023-01-01 23:42:05 -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
b8e97aaaf8 Fix logic and Keccak CTLs
Lots of little bugs!

- The Keccak sponge table's padding logic was wrong, it was mixing up the number of rows with the number of hashes.
- The Keccak sponge table's Keccak-looking data was wrong - input to Keccak-f should be after xor'ing in the block.
- The Keccak sponge table's logic-looking filter was wrong. We do 5 logic CTLs for any final-block row, even if some of the xors are with 0s from Keccak padding.
- The CPU was using the wrong/outdated output memory channel for its Keccak sponge and logic CTLs.
- The Keccak table just didn't have a way to filter out padding rows. I added a filter column for this.
- The Keccak table wasn't remembering the original preimage of a permutation; lookers were seeing the preimage of the final step. I added columns for the original preimage.
- `ctl_data_logic` was using the wrong memory channel
- Kernel bootloading generation was using the wrong length for its Keccak sponge CTL, and its `keccak_sponge_log` was seeing the wrong clock since it was called after adding the final bootloading row.
2022-12-19 15:42:59 -08:00
wborgeaud
9d6b3b2d16 Ignore failing test 2022-12-14 17:34:22 +01:00
wborgeaud
83a290331e Fixes 2022-12-14 16:34:32 +01:00
wborgeaud
f91dfe7e1a Use the order of the BN base field in the interpreter 2022-12-14 16:22:57 +01:00
Nicholas Ward
6ab6580058 block_size macro 2022-12-13 14:42:45 -08:00
Nicholas Ward
f3937e9977 deps fix 2022-12-13 10:29:03 -08:00
Nicholas Ward
53004867b3 macro 2022-12-13 10:08:36 -08:00
Nicholas Ward
a564d7350c fixes and addressed comments 2022-12-13 10:08:36 -08:00
Nicholas Ward
24d6627a62 addressed comments 2022-12-13 10:08:36 -08:00
Nicholas Ward
29143fe5d3 fmt 2022-12-13 10:08:36 -08:00
Nicholas Ward
2e62ac1b63 cleanup 2022-12-13 10:08:36 -08:00
Nicholas Ward
f6af5240bd another clippy fix 2022-12-13 10:08:36 -08:00
Nicholas Ward
779c46c7a3 clippy fix 2022-12-13 10:08:36 -08:00
Nicholas Ward
fc14475541 documentation 2022-12-13 10:08:36 -08:00
Nicholas Ward
50ffb9072a documentation 2022-12-13 10:08:36 -08:00
Nicholas Ward
778aec627b rename blake -> blake2b 2022-12-13 10:08:36 -08:00
Nicholas Ward
d30a95f7d5 fixes 2022-12-13 10:08:36 -08:00
Nicholas Ward
2166a407ed minor memory access refactor 2022-12-13 10:08:36 -08:00
Nicholas Ward
7663848bbf cleaned up hash tests 2022-12-13 10:08:36 -08:00
Nicholas Ward
7a5a899b45 clippy 2022-12-13 10:08:36 -08:00
Nicholas Ward
90726a5866 fmt 2022-12-13 10:08:36 -08:00
Nicholas Ward
c0dbeb42d9 cleanup 2022-12-13 10:08:36 -08:00
Nicholas Ward
0d05a4bbbf FIX 2022-12-13 10:08:36 -08:00
Nicholas Ward
49504dde7d fixes 2022-12-13 10:08:36 -08:00
Nicholas Ward
20169a5476 debugging 2022-12-13 10:08:36 -08:00
Nicholas Ward
245e5faa6d fixes galore 2022-12-13 10:08:36 -08:00
Nicholas Ward
d3a7201348 fixes 2022-12-13 10:08:36 -08:00
Nicholas Ward
5759fb7b3c concat 2022-12-13 10:08:36 -08:00
Nicholas Ward
9774b74b90 Blake progress 2022-12-13 10:08:36 -08:00
Nicholas Ward
ebd606621f progress 2022-12-13 10:08:36 -08:00
Nicholas Ward
772dc5c9e7 util file 2022-12-13 10:08:36 -08:00
Nicholas Ward
df932544bd fixes and testing 2022-12-13 10:08:36 -08:00
Nicholas Ward
a38b1fb37c progress 2022-12-13 10:08:36 -08:00
Nicholas Ward
54a2e96473 progress 2022-12-13 10:08:36 -08:00
Nicholas Ward
1367f9bcca fmt 2022-12-13 10:08:36 -08:00
Nicholas Ward
dd29ec1f46 fixes and test infrastructure 2022-12-13 10:08:30 -08:00
Nicholas Ward
0cfe790210 updates 2022-12-13 10:08:16 -08:00
Nicholas Ward
5fab01b952 fix 2022-12-13 10:08:16 -08:00
Nicholas Ward
609ed6c984 fixes 2022-12-13 10:08:16 -08:00
Nicholas Ward
d3e5feba83 Blake progress 2022-12-13 10:08:16 -08:00
Nicholas Ward
6e782a1a1e Blake progress 2022-12-13 10:08:16 -08:00
Nicholas Ward
0c919443f9 progress 2022-12-13 10:08:16 -08:00
Nicholas Ward
b40338ff2e progress 2022-12-13 10:08:16 -08:00
Nicholas Ward
9a5db4b8d2 progress 2022-12-13 10:08:16 -08:00
Nicholas Ward
a1ea7ff930 progress 2022-12-13 10:08:16 -08:00
Nicholas Ward
1089bbf29e blake initial 2022-12-13 10:08:16 -08:00