1492 Commits

Author SHA1 Message Date
Jakub Nabaglo
8d093a8440
Decrease CI scratch disk space (#412)
* Decrease CI scratch disk space

* Daniel PR review
2021-12-30 18:22:35 -08:00
Jakub Nabaglo
ea43053532
Square trait (#409)
* `Squarable` trait

* Minor style

* Further minor style (Squarable -> Square to match Rust convention)
2021-12-30 12:11:02 -08:00
Jakub Nabaglo
5a379f15e7
Rename PackedField constants ZERO -> ZEROS, ONE -> ONES (#408) 2021-12-29 16:56:38 -08:00
Daniel Lubarov
c126641c5d
Split into crates (#406)
* Split into crates

I kept other changes to a minimum, so 95% of this is just moving things. One complication that came up is that since `PrimeField` is now outside the plonky2 crate, these two impls now conflict:
```
impl<F: PrimeField> From<HashOut<F>> for Vec<u8> { ... }
impl<F: PrimeField> From<HashOut<F>> for Vec<F> { ... }
```
with this note:
```
note: upstream crates may add a new impl of trait `plonky2_field::field_types::PrimeField` for type `u8` in future versions
```
I worked around this by adding a `GenericHashOut` trait with methods like `to_bytes()` instead of overloading `From`/`Into`. Personally I prefer the explicitness anyway.

* Move out permutation network stuff also

* Fix imports

* Fix import

* Also move out insertion

* Comment

* fmt

* PR feedback
2021-12-28 11:51:13 -08:00
Jakub Nabaglo
107ba3ab05
Fix build on 32-bit Intel (#405) 2021-12-21 12:00:33 -08:00
Daniel Lubarov
04dce92a3a
Print timing for a regular Poseidon recursive proof (#403)
* Print timing for a regular Poseidon recursive proof

Rather than the Keccak-256 proof. I kept it but hid the timing since it's less important to us. Alternatively we could test Keccak-256 only in the size-optimized test, since that's basically testing a bridge proof. Let me know if you have a preference.

* Remove Keccak proof per PR discussion
2021-12-20 18:52:55 -08:00
Jakub Nabaglo
d4a0a8661e
Packed evaluation for most gates (#395)
* Most gates support packed evaluation

* ComparisonGate

* Minor: outdated todo marker

* Revert superfluous change

* Post-merge fixes

* Daniel comments

* Minor: Markdown in comments
2021-12-20 15:08:07 -08:00
Jakub Nabaglo
bbbb57caa6
Simplify AVX2 Goldilocks (#399)
* Simplify AVX2 Goldilocks

* Fixes

* Lints

* Docs

* Minor doc

* Minor: typo
2021-12-20 13:41:42 -08:00
wborgeaud
2fc1a6156a
Merge pull request #404 from mir-protocol/gmimc_config
GMiMC config
2021-12-20 19:23:58 +01:00
wborgeaud
514cca7ebb PR feedback 2021-12-20 19:13:12 +01:00
wborgeaud
fd03a187ce Minor 2021-12-20 16:46:31 +01:00
wborgeaud
2e4bea59ee Multi-hash test 2021-12-20 16:16:05 +01:00
wborgeaud
156fd45b83 Add GMiMC config 2021-12-20 16:07:14 +01:00
wborgeaud
30cf4cd0a8
Merge pull request #398 from mir-protocol/injective_hash_conversion
Use 7 bytes to represent a field element to avoid collisions in hash conversion
2021-12-20 09:22:53 +01:00
wborgeaud
0538511c9d Comment for why 7 bytes 2021-12-20 09:22:23 +01:00
Jakub Nabaglo
e9fafa5131 Faster Goldilocks mul by forcing a branch 2021-12-18 15:28:47 -08:00
Jakub Nabaglo
c4549c4cc5
Silence Clippy on main (#402)
* Silence Clippy on main

* Fix a `unnecessary_to_owned`
2021-12-18 14:30:35 -08:00
wborgeaud
d594b8fc2d Convert chunks of 7 bytes instead of 8 2021-12-17 08:46:07 +01:00
wborgeaud
7d574c8620
Merge pull request #341 from mir-protocol/generic_configuration
Generic configuration trait
2021-12-17 08:34:10 +01:00
Jakub Nabaglo
433f358455
Fix build on AVX2 (#397) 2021-12-16 15:51:38 -08:00
Jakub Nabaglo
81c6f6c7bf Merge remote-tracking branch 'origin/main' into generic_configuration 2021-12-16 13:28:49 -08:00
Jakub Nabaglo
eb7615f7cc Change gate evaluation memory layout (#390) 2021-12-16 12:37:33 -08:00
wborgeaud
23a902e1e0 Fix nits 2021-12-16 15:58:38 +01:00
wborgeaud
7a2afb5119 Clippy 2021-12-16 15:30:40 +01:00
wborgeaud
288a0b7cf8 Fix merge conflicts 2021-12-16 15:20:45 +01:00
wborgeaud
bdbc8b6931 Merge branch 'main' into generic_configuration
# Conflicts:
#	src/field/extension_field/mod.rs
#	src/fri/recursive_verifier.rs
#	src/gadgets/arithmetic.rs
#	src/gadgets/arithmetic_extension.rs
#	src/gadgets/hash.rs
#	src/gadgets/interpolation.rs
#	src/gadgets/random_access.rs
#	src/gadgets/sorting.rs
#	src/gates/arithmetic_u32.rs
#	src/gates/gate_tree.rs
#	src/gates/interpolation.rs
#	src/gates/poseidon.rs
#	src/gates/poseidon_mds.rs
#	src/gates/random_access.rs
#	src/hash/hashing.rs
#	src/hash/merkle_proofs.rs
#	src/hash/poseidon.rs
#	src/iop/challenger.rs
#	src/iop/generator.rs
#	src/iop/witness.rs
#	src/plonk/circuit_data.rs
#	src/plonk/proof.rs
#	src/plonk/prover.rs
#	src/plonk/recursive_verifier.rs
#	src/util/partial_products.rs
#	src/util/reducing.rs
2021-12-16 14:54:38 +01:00
Jakub Nabaglo
357eea8df5
Fix build on main (#396) 2021-12-15 21:59:16 -08:00
wborgeaud
68e3befc08
Merge pull request #391 from mir-protocol/prime_field
Remove `PrimeField` type from the `Field` trait
2021-12-14 18:32:38 +01:00
wborgeaud
9211bcfed5 Move characteristic to its own fn 2021-12-14 17:12:14 +01:00
wborgeaud
6cb4f56af5
Merge pull request #392 from mir-protocol/remove_polynomial_file
Remove `polynomial.rs`
2021-12-13 20:15:07 +01:00
wborgeaud
a446aa056e
Merge pull request #393 from mir-protocol/remove_bits_fn
Replace `bits()` function with `BITS` const
2021-12-13 20:14:50 +01:00
wborgeaud
6863eea74e New clippy lints 2021-12-13 16:51:36 +01:00
wborgeaud
920d5995c7 Replace bits() fn with BITS const 2021-12-13 16:46:49 +01:00
wborgeaud
073fe7a6d9 New clippy lints 2021-12-13 16:40:00 +01:00
wborgeaud
c1698bb99d Remove polynomial.rs (+clippy lints) 2021-12-13 16:39:07 +01:00
wborgeaud
1d215d5d59 Remove dbg 2021-12-13 16:23:39 +01:00
wborgeaud
fb168b5d93 Replace characteristic with option 2021-12-13 16:20:39 +01:00
wborgeaud
e6c3f35431 working 2021-12-13 14:35:05 +01:00
wborgeaud
aed4de0293
Merge pull request #389 from mir-protocol/deoptimize_tests
Compiler optimizes away some tests
2021-12-07 09:20:59 +01:00
wborgeaud
6a50c0fc4e Clippy 2021-12-07 08:56:27 +01:00
wborgeaud
5061b2d110 Use rand_arr instead of rand_vec 2021-12-07 08:13:39 +01:00
wborgeaud
dad35ae621 Fix tests 2021-12-06 16:00:22 +01:00
Daniel Lubarov
58e1febde7
Update size-optimized recursion test (#388)
I think it should start with `standard_recursion_config`, since the goal of the test is to start with a regular speed-optimized recursive proof and shrink it.

The final proof is a bit larger now, mainly because of the update to 100 bits, and partly (less importantly) because it starts with the now-standard arity 16. We could maybe switch from arity 16 to 8 somewhere in the chain, but I think that might require another proof layer, and didn't want to complicate it too much.
2021-12-06 00:04:01 -08:00
Jakub Nabaglo
d6a0a2e772
Run CI on optimized build (#384)
* Run CI on optimized build

* Enable overflow checks
2021-12-03 13:23:43 -08:00
Jakub Nabaglo
bb029db2a7
Type tweaks for packed types (#387)
* PackedField tweaks

* AVX2 changes

* FFT fixes

* tests

* test fixes

* Lints

* Rename things for clarity

* Minor interleave fixes

* Minor interleave fixes the sequel

* Rebase fixes

* Docs

* Daniel PR comments
2021-12-03 13:12:19 -08:00
wborgeaud
04c1ea2531
Merge pull request #386 from mir-protocol/fix_recursive_fri_config
Fix recursive circuit config
2021-12-03 09:24:32 +01:00
wborgeaud
2a81ec1728 Fix recursive FRI config 2021-12-03 08:49:19 +01:00
Jakub Nabaglo
aff71943c3
Minor optimizations to AVX2 multiplication (#378)
* Minor optimizations to AVX2 multiplication

* Typos (thx Hamish!)
2021-12-02 18:33:43 -08:00
Jakub Nabaglo
5eaa1ad529
Require a PrimeField to be its own PrimeField (#383) 2021-12-02 16:14:47 -08:00
wborgeaud
c6ac8e1b3e
Merge pull request #380 from mir-protocol/variable_num_u32_ops
Variable number of operations in `U32ArithmeticGate` and `U32SubtractionGate`
2021-12-02 19:00:08 +01:00