* Simplify and refactor GMiMC benchmark. * Refactor/combine GMiMC and Rescue hash benchmarks. * Remove old Rescue bench; rename GMiMC bench. * Add from_canonical_u128 for fields. * Initial version of Poseidon. * Partial implementation of fast Poseidon. * Complete (but broken) implementation of fast partial rounds. * Fix index calculation. * Add basic tests. * Fix constants; fix bugs in fast partial round calculation. * Rename main functions. * Add test vectors. * Use x^7 for s-box monomial. * Fix s-box application in fast version. * Make WIDTH a parameter. * Working version with both widths. * Updated the constants so they use x^3; added test vectors. * Expand bench_hash to cover both widths and report relative slowdown. * Remove references to MaybeUninit. * First draft of refactoring the two Poseidon widths. * Tidy up use of conversion to/from raw data. * Add some comments. * Refactor tests. * Apply cargo fmt changes. * Have `Field`s implement `PoseidonInterface` (#209) * Have `Field`s implement `PoseidonInterface` Rather than having a sort of "dummy struct" implement `PoseidonInterface` with the field as a generic param. I think this seems more natural and type-safe. The type safety does come at a price -- it would be harder to do dynamic things such as taking `WIDTH` as a command line option -- but I think that's alright. * Fix missed conflicts. * cargo fmt fixes. * Fix to accommodate changes in latest nightly. Co-authored-by: Hamish Ivey-Law <426294+unzvfu@users.noreply.github.com> Co-authored-by: Hamish Ivey-Law <hamish@ivey-law.name> * Sanity check number of rounds. Co-authored-by: Daniel Lubarov <daniel@lubarov.com>
plonky2
plonky2 is an implementation of recursive arguments based on Plonk and FRI. It uses FRI to check systems of polynomial constraints, similar to the DEEP-ALI method described in the DEEP-FRI paper. It is the successor of plonky, which was based on Plonk and Halo.
plonky2 is largely focused on recursion performance. We use custom gates to mitigate the bottlenecks of FRI verification, such as hashing and interpolation. We also encode witness data in a ~64 bit field, so field operations take just a few cycles. To achieve 128-bit security, we repeat certain checks, and run certain parts of the argument in an extension field.
Running
To see recursion performance, one can run this test, which generates a chain of three recursion proofs:
RUST_LOG=debug RUSTFLAGS=-Ctarget-cpu=native cargo test --release test_recursive_recursive_verifier -- --ignored
Disclaimer
This code has not been thoroughly reviewed or tested, and should not be used in any production systems.