1522 Commits

Author SHA1 Message Date
Jakub Nabaglo
2aa46e148c
Optimize + test log2 functions (#434)
* Speed up log2 functions

* Move tests to `util` crate

* Trick
2022-01-16 15:15:25 -08:00
Sebastien La Duca
fe5a30ede1
make HashOutTarget internals public (#430) 2022-01-13 12:12:59 -08:00
Daniel Lubarov
0ff8365827 timing 2022-01-12 19:07:33 -08:00
Daniel Lubarov
9f09a2aace
Add Merkle tree benchmark (#429)
And one for a single Keccak hash
2022-01-12 16:25:12 -08:00
Daniel Lubarov
9ecdc4d30f note about toolchain 2022-01-11 19:36:32 -08:00
Daniel Lubarov
6c25fb9717 wording 2022-01-09 09:53:54 -08:00
Daniel Lubarov
ac59f2bc45 readme updates 2022-01-09 09:52:19 -08:00
Daniel Lubarov
3ab0a37af3
No longer need to store number of PP polynomials (#424)
* No longer need to store number of PP polynomials

It's unused after the refactoring we did.

* PR feedback
2022-01-09 09:44:13 -08:00
Daniel Lubarov
bde6114428
Replace AlgebraicConfig with GenericConfig (#425)
It works fine if we bound recursion methods with `C::Hasher: AlgebraicHasher<F>`. This bound feels natural to me - it's like saying "the recursion methods assume the inner hasher has a circuit implementation".
2022-01-09 08:33:12 -08:00
Daniel Lubarov
8ec78fc0c1 tweak len 2022-01-08 23:44:12 -08:00
Daniel Lubarov
3fc5ff4fff
Remove old binaries (#423)
FFTs became proper benches, while recursion became tests. We might consider having either bins or benches for recursion in the future, but the code in this old recursion bin won't be useful, so might as well delete it for now.
2022-01-07 10:24:54 -08:00
Daniel Lubarov
f48d8c92bd
Finish making FRI generic (#422)
* Finish making FRI generic

* fix quotient poly factor

* Bound quotient degree factor
2022-01-06 23:04:33 -08:00
Jakub Nabaglo
4e532f04fa
AVX2 Poseidon S-box optimizations (#421) 2022-01-06 15:50:56 -08:00
Daniel Lubarov
bf30fed701
Make FRI more generic (#419)
* Make FRI more generic

* PR feedback
2022-01-06 11:40:08 -08:00
Jakub Nabaglo
f072d09ae4
AVX-512 packed Goldilocks (#400)
* WIP AVX-512 Goldilocks

* Fix tests

* fmt

* Hamish PR comment
2022-01-06 09:19:32 -08:00
Jakub Nabaglo
a6e1f7ccad
Aarch64: Minor optimization to Poseidon full layers (#420)
* Aarch64: Minor optimization to Poseidon full layers

* Daniel PR comment
2022-01-06 09:16:54 -08:00
Jakub Nabaglo
5825893845
Remove feature(asm_sym) (#418) 2022-01-06 08:37:34 -08:00
Daniel Lubarov
4f2ac97b0a consistent order 2022-01-04 00:01:53 -08:00
Daniel Lubarov
1d576f2046 licensing note 2022-01-03 10:00:15 -08:00
Daniel Lubarov
3de8d36c3a
Use single-point opening expressions (#416)
I.e. instead of opening `Z` at `zeta` and `g zeta` by running FRI on a quotient involving an interpolant, we just run FRI on two separate opening expressions, one for `zeta` and one for `g zeta`.

A few motivations for this:
- I think this will make it slightly easier to generalize our FRI code to work with STARKs. I.e. if we have an object representing the structure of polynomial openings in an IOP, that object will be slightly simpler.
- It's less code. We could potentially remove some more code, e.g. the generality of `compute_quotient` is no longer needed, but I left it for now.
- It saves 3 gates!
2022-01-03 08:34:44 -08:00
Daniel Lubarov
6991257da5
Simpler Keccak pseudo-permutation (#415)
* Simpler Keccak pseudo-permutation

After rejecting a value, I think it's a little simpler to continue the hash chain vs retrying with an incremented nonce.

* PR feedback

* fix byte order
2022-01-02 21:36:41 -08:00
Daniel Lubarov
23f0e49c87
Separate some circuit logic from FRI code (#414)
My goal is to make the FRI code independent of circuit objects like `CommonCircuitData`, so that it can be reused by STARK code which won't involve those objects.

A few changes here:

- Move `rate_bits` and `cap_height` into `FriConfig`.
- Move `degree_bits` into `FriParameters` (since it's instance size specific).
- Make `FriParams` contain `FriConfig`, so FRI methods can take just the former and access fields in both.
- Replace `CommonCircuitConfig` with `FriParams` in FRI prover methods.

The FRI verifier methods still involve circuit objects, as they have PLONK logic in `fri_combine_initial`. Will think about how to deal with that after this.
2022-01-02 11:26:26 -08:00
wborgeaud
a452da523b
Merge pull request #407 from mir-protocol/challenger_outer_hash
Use the outer hash in the challenger
2022-01-02 10:24:29 +01:00
wborgeaud
7b03ebe1b8 PR feedback 2022-01-02 10:16:35 +01:00
Daniel Lubarov
0a5a224900 import 2022-01-01 11:05:46 -08:00
Daniel Lubarov
cf6713e737 Remove accidental redundant struct 2022-01-01 09:48:20 -08:00
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
wborgeaud
77a2fc6100 Comment for KeccakPermutation 2021-12-29 16:58:31 +01:00
wborgeaud
df2b6e76b7 Move permutations to their specific files 2021-12-29 16:54:27 +01:00
wborgeaud
a0a42e4bef Move hashes to their specific files 2021-12-29 16:51:46 +01:00
wborgeaud
314a5845b7 Use outer hash in Challenger 2021-12-29 16:41:43 +01: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