75 Commits

Author SHA1 Message Date
Hamy Ratoanina
4eb6a3b57c
Fix eval_table 2023-09-19 14:03:57 -04:00
Hamy Ratoanina
1a4caaa08f
Move next row logic inside Column
Co-authored-by: Nicholas Ward <npward@berkeley.edu>
2023-09-15 18:59:33 -04:00
Hamy Ratoanina
c27fc96a06
Merge branch 'main' into next_row_ctls 2023-09-13 16:46:30 +02:00
Robin Salen
9508b49090
Move byte packing / unpacking to a distinct table (#1212)
* Duplicate Memory trace into BytePacking one

* Add mload_32bytes instruction

* Use dedicated ops for byte packing trace

* Change witness generation to reduce memory reads for MLOAD_32BYTES

* Remove segments

* Fix stack

* Fix extra product when fixing CTL for byte_packing

* Write output value in trace

* Add constraints for BYTE_PACKING table

* Add recursive constraints for BYTE_PACKING table

* Fix constraints

* Add address in trace and constraints

* Add timestamp and batch inputs into BytePackingOp struct

* Add extra column

* Fix BytePackingStark CTL

* Tiny fix in witness generation

* Fix the Memory CTL

* Add constraints for the new columns

* Remove 1 column

* Remove limb columns

* Fix

* Fix recursive circuit of BytePackingTable

* Fix constraints

* Fix endianness

* Add MSTORE_32BYTES instruction and move decomposition to packing table

* Add missing constraint

* Add range-check for all bytes

* Add extra constraint

* Cleanup

* Remove REMAINING_LEN column

* Add corresponding implementations in interpreter

* Fix recursive version

* Remove debug assertion because of CI

* Remove FILTER column

* Update new test from rebasing

* Reorder STARK modules to match TraceCheckPoint ordering

* Address comments

* Pacify clippy

* Add documentation to the packing module

* Fix doctest
2023-09-13 04:45:37 +10:00
Hamy Ratoanina
3c4f938f85
Make next row available to CTLs 2023-09-12 13:59:50 -04:00
Robin Salen
b711e5279a
Combine a few constraints 2023-08-18 15:36:46 -04:00
Hamy Ratoanina
59b73c84ee
Apply comments 2023-07-27 18:27:06 -04:00
Hamy Ratoanina
1590c1d0be
Fix indices in CTL functions 2023-07-27 18:27:05 -04:00
Hamy Ratoanina
f97deab8a7
Remove non-passing debug assert 2023-07-27 18:20:04 -04:00
Linda Guiga
06037f814f
Fix the memory CTL and implement the verifier memory bus
Co-authored-by: Hamy Ratoanina <hamy.ratoanina@toposware.com>
2023-07-27 18:20:03 -04:00
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
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
76b3eb304c more 2023-01-03 12:43:05 -08:00
Daniel Lubarov
fbb72e16bb warning 2023-01-03 12:29:14 -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
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
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
1f92d73177 Misc fixes 2022-12-02 14:31:18 -08:00
Daniel Lubarov
a63b73a851 Misc fixes 2022-12-02 13:56:52 -08:00
wborgeaud
668957176a PR feedback 2022-10-03 11:44:52 +02:00
wborgeaud
cb620bc55a Simplify num_ctl_zs 2022-09-29 16:32:41 +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
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
Daniel Lubarov
c9cfcecc9f Logic CTL for xor 2022-09-04 16:53:04 -07:00
Daniel Lubarov
2c77247d43 Keccak sponge STARK
It contains a row for each absorb step of the sponge.
2022-09-01 09:41:19 -07:00
wborgeaud
05c3c4d907 First pass 2022-08-26 10:12:45 +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
aa87f2c3ba Public memory 2022-08-25 20:19:18 -07:00
wborgeaud
9e9ff9872b Per table recursion 2022-08-25 22:04:28 +02:00
Daniel Lubarov
522cac5e15 Keccak memory stark 2022-08-24 09:29:17 -07:00
Daniel Lubarov
8e220ac623 Fix for CTL challenges
See this line -

```rust
challenges: ctl_data.challenges.challenges[i % config.num_challenges],
```

This doesn't work if we have multiple lookers from the same table; then `zs_columns` will contain multiple contiguous entries for the same challenge.

We could fix the index calculation, but it seems a bit error-prone. Seems easier to store the specific challenge as part of `zs_columns`.
2022-08-23 23:30:52 -07:00
Daniel Lubarov
782d7d0e18
Revert "Support accessing local row in CTLs" 2022-08-23 12:22:54 -07:00
Daniel Lubarov
00081890f3 feedback 2022-08-23 10:23:28 -07:00
Daniel Lubarov
a37dec9881 Support accessing previous row in CTLs 2022-08-22 15:20:10 -07:00
wborgeaud
d35d3e2095 PR feedback + underflow check 2022-07-11 19:53:00 +02:00
wborgeaud
5e27e7264d unwrap_or_else -> unwrap_or 2022-07-11 14:56:27 +02:00
wborgeaud
50ebf39d37 Comment 2022-07-11 14:24:12 +02:00
wborgeaud
3ff67e38dc Minor 2022-07-11 14:16:58 +02:00
wborgeaud
36c8aa34c1 Comments 2022-07-11 14:13:07 +02:00
wborgeaud
91fcf26289 Better CTL error 2022-07-11 11:07:16 +02:00
Daniel Lubarov
e73d01a037
packed_field -> packed (#584)
* `packed_field` -> `packed`

For cleaner imports; "field" is usually clear from context

* fix
2022-06-27 15:07:52 -07:00
Daniel Lubarov
3346d3f902
field_types -> types (#583)
* `field_types` -> `types`

Here too, I think "field" is usually clear from context, e.g. in `use plonky2::field::types::Field;`.

* fixes

* fmt
2022-06-27 12:24:09 -07:00
Daniel Lubarov
410e03349c
extension_field -> extension (#581)
It seems redundant in most contexts, e.g. `use plonky2::field::extension_field::Extendable;`. One could import `extension_field`, but it's not that common in Rust, and `field::extension` is now about as short.
2022-06-27 07:18:21 -07:00
wborgeaud
b9265ccf0e Sanity check 2022-06-16 02:15:40 +02:00