MCPcopy Index your code
hub / github.com/NethermindEth/latticefold

github.com/NethermindEth/latticefold @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
647 symbols 1,320 edges 80 files 207 documented · 32%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

LatticeFold

A proof-of-concept implementation of the LatticeFold and LatticeFold+ folding schemes engineered by Nethermind based on the works LatticeFold: A Lattice-based Folding Scheme and its Applications to Succinct Proof Systems and LatticeFold+: Faster, Simpler, Shorter Lattice-Based Folding for Succinct Proof Systems by Dan Boneh and Binyi Chen.

DISCLAIMER: This is a proof-of-concept prototype, and in particular has not received careful code review. This implementation is provided "as is" and NOT ready for production use. Use at your own risk.

Benchmarks

To run the benchmarks on your local machine, simply execute cargo bench. This will take around 48 hours. Use cargo bench --bench to measure relevant parts of the protocol as well as the Ajtai commitment scheme, and comment the prime fields you don't want to measure.

Building

The rust-toolchain file pins the version of the Rust toolchain, which the LatticeFold library builds with, to the specific version nightly-2025-03-06.

One can install the nightly-2025-03-06 toolchain by invoking:

rustup install nightly-2025-03-06

After that, use cargo, the standard Rust build tool, to build the library:

git clone https://github.com/NethermindEth/latticefold.git
cd latticefold
cargo build --release

Usage

Import the library:

[dependencies]
latticefold = { git = "https://github.com/NethermindEth/latticefold.git", package = "latticefold" }

Available packages: - latticefold: main crate, contains the non-interactive folding scheme implementation, together with the Ajtai commitment scheme, R1CS/CCS structures, Fiat-Shamir transcript machinery, etc. - latticefold-plus: an improved version of LatticeFold. Currently a work-in-progress implementation. See more. - cyclotomic-rings: contains the trait definition of a ring suitable to be used in the LatticeFold protocol, a few ready-to-use rings and short challenge set machinery.

Performance report

The performance report for this library can be found here.

Examples

Check latticefold/examples/README.md for examples.

Frontends

Currently, the only way to define a circuit to be folded is by specifying it as a rank-1 constraint system (R1CS) or a customizable constraint system (CCS).

License

The crates in this repository are licensed under either of the following licenses, at your discretion.

Unless you explicitly state otherwise, any contribution submitted for inclusion in this library by you shall be dual licensed as above (as defined in the Apache v2 License), without any additional terms or conditions.

Acknowledgments

Extension points exported contracts — how you extend this code

ProverBenchmark (Interface)
Trait defining the structure of a prover benchmark for a cryptographic protocol. Implementors specify how to set up inp [19 …
crates/latticefold-plus/benches/utils/helpers.rs
DecompositionParams (Interface)
Decomposition parameters. Convenient to enforce them compile-time. Contains both gadget matrix data and Latticefold deco [7 …
crates/latticefold/src/decomposition_parameters.rs
SuitableRing (Interface)
An umbrella trait of a ring suitable to be used in the LatticeFold protocol. The ring is assumed to be of the form $$\m [4 …
crates/cyclotomic-rings/src/rings.rs
VerifierBenchmark (Interface)
Trait defining the structure of a verifier benchmark for a cryptographic protocol. Similar to `ProverBenchmark` but for [7 …
crates/latticefold-plus/benches/utils/helpers.rs
Instance (Interface)
A trait for defining the behaviour of a satisfying instance of a constraint system # Types - `R: Ring` - the ring in wh [2 …
crates/latticefold/src/arith.rs
GetPoseidonParams (Interface)
A trait for types with an associated Poseidon sponge configuration. [4 implementers]
crates/cyclotomic-rings/src/rings.rs
Linearize (Interface)
(no doc) [1 implementers]
crates/latticefold-plus/src/lin.rs
Evaluate (Interface)
(no doc) [4 implementers]
crates/latticefold/src/utils/mle_helpers.rs

Core symbols most depended-on inside this repo

len
called by 133
crates/latticefold/src/commitment/homomorphic_commitment.rs
absorb_slice
called by 36
crates/latticefold/src/transcript.rs
create_transcript
called by 35
crates/latticefold-plus/benches/utils/helpers.rs
evaluate
called by 33
crates/latticefold/src/arith/r1cs.rs
add_term
called by 25
crates/latticefold/src/arith/r1cs.rs
bench_rng
called by 22
crates/latticefold-plus/benches/utils/helpers.rs
verify
called by 20
crates/latticefold-plus/src/cm.rs
create_ajtai_matrix
called by 17
crates/latticefold-plus/benches/utils/helpers.rs

Shape

Function 268
Method 227
Class 116
Interface 21
Enum 15

Languages

Rust100%

Modules by API surface

crates/latticefold/src/arith/r1cs.rs49 symbols
crates/latticefold/src/arith.rs30 symbols
crates/latticefold-plus/benches/utils/helpers.rs27 symbols
crates/latticefold-plus/benches/mlin.rs19 symbols
crates/latticefold/benches/utils.rs17 symbols
crates/latticefold-plus/benches/rgchk.rs17 symbols
crates/latticefold/src/nifs/folding/tests/mod.rs16 symbols
crates/latticefold-plus/benches/decomp.rs16 symbols
crates/latticefold-plus/benches/setchk.rs15 symbols
crates/latticefold-plus/benches/e2e.rs15 symbols
crates/latticefold/src/nifs/folding.rs14 symbols
crates/latticefold/src/nifs/decomposition/tests/mod.rs14 symbols

For agents

$ claude mcp add latticefold \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact