Skip to content

okx/plonky2

 
 

description

this repo is a fork of https://github.com/0xPolygonZero/plonky2. several optimizations were implemented to boost the computation speed.

optimizations

  • precompute of fft twiddle factors
  • cuda implementation of Goldilocks Field NTT (feature cuda)

dependencies

git submodule update --init --recursive

run examples

  • cuda NTT
cargo run --release -p plonky2_field --features=cuda --example fft

Running

To see recursion performance, one can run this bench, which generates a chain of three recursion proofs:

RUSTFLAGS=-Ctarget-cpu=native cargo run --release --example bench_recursion -- -vv

Jemalloc

Plonky2 prefers the Jemalloc memory allocator due to its superior performance. To use it, include jemallocator = "0.5.0" in your Cargo.toml and add the following lines to your main.rs:

use jemallocator::Jemalloc;

#[global_allocator]
static GLOBAL: Jemalloc = Jemalloc;

Jemalloc is known to cause crashes when a binary compiled for x86 is run on an Apple silicon-based Mac under Rosetta 2. If you are experiencing crashes on your Apple silicon Mac, run rustc --print target-libdir. The output should contain aarch64-apple-darwin. If the output contains x86_64-apple-darwin, then you are running the Rust toolchain for x86; we recommend switching to the native ARM version.

Contributing guidelines

See CONTRIBUTING.md.

Licenses

All crates of this monorepo are licensed under either of

at your option.

Security

This code has not yet been audited, and should not be used in any production systems.

While Plonky2 is configurable, its defaults generally target 100 bits of security. The default FRI configuration targets 100 bits of conjectured security based on the conjecture in ethSTARK.

Plonky2's default hash function is Poseidon, configured with 8 full rounds, 22 partial rounds, a width of 12 field elements (each ~64 bits), and an S-box of x^7. BBLP22 suggests that this configuration may have around 95 bits of security, falling a bit short of our 100 bit target.

Links

Actively maintained

No longer maintained

  • System Zero, a zkVM built on top of Starky
  • Waksman, Plonky2 gadgets for permutation checking using Waksman networks
  • Insertion, Plonky2 gadgets for insertion into a list
  • u32, Plonky2 gadgets for u32 arithmetic
  • ECDSA, Plonky2 gadgets for the ECDSA algorithm

About

No description, website, or topics provided.

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Rust 99.2%
  • Python 0.4%
  • Circom 0.1%
  • C 0.1%
  • Shell 0.1%
  • HTML 0.1%