Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
344 changes: 148 additions & 196 deletions Cargo.lock

Large diffs are not rendered by default.

17 changes: 11 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[workspace]
members = [
"crates/cyclotomic-rings",
"crates/rings",
"crates/latticefold",
"crates/latticefold-plus",
]
Expand All @@ -11,25 +11,30 @@ edition = "2021"
license = "Apache-2.0 OR MIT"

[workspace.dependencies]
# Workspace
latticefold-rings = { path = "crates/rings", default-features = false }
latticefold = { path = "crates/latticefold", default-features = false }

# stark-rings
stark-rings = { git = "https://github.com/NethermindEth/stark-rings.git", branch = "main", default-features = false }
stark-rings-linalg = { git = "https://github.com/NethermindEth/stark-rings.git", branch = "main", default-features = false }
stark-rings-poly = { git = "https://github.com/NethermindEth/stark-rings.git", branch = "main", default-features = false }

# External
ark-crypto-primitives = { version = "0.4.0", default-features = false, features = [
"sponge",
] }
ark-ff = { version = "0.4.2", default-features = false }
ark-serialize = { version = "0.4.2", features = ["derive"] }
ark-std = { version = "0.4.0", default-features = false }
criterion = "0.5.1"
cyclotomic-rings = { path = "crates/cyclotomic-rings", default-features = false }
latticefold = { path = "crates/latticefold", default-features = false }
num-bigint = { version = "0.4.5", default-features = false }
num-traits = { version = "0.2.19", default-features = false }
proc-macro2 = "1.0.92"
quote = "1.0.37"
rand = { version = "0.8.5", default-features = false }
rayon = "1.10.0"
serde = { version = "1.0.216", features = ["derive"] }
stark-rings = { git = "https://github.com/NethermindEth/stark-rings.git", branch = "main", default-features = false }
stark-rings-linalg = { git = "https://github.com/NethermindEth/stark-rings.git", branch = "main", default-features = false }
stark-rings-poly = { git = "https://github.com/NethermindEth/stark-rings.git", branch = "main", default-features = false }
thiserror = { version = "2.0.3", default-features = false }
toml = "0.8.19"
[workspace.metadata.docs.rs]
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ latticefold = { git = "https://github.com/NethermindEth/latticefold.git", packag
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](latticefold-plus/README.md).
- `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.
- `cyclotomic-rings`: contains the trait definition of a ring suitable to be used in the LatticeFold protocol, a few ready-to-use rings and small challenge set machinery.

## Performance report
The performance report for this library can be found [here](https://nethermind.notion.site/Latticefold-and-lattice-based-operations-performance-report-153360fc38d080ac930cdeeffed69559).
Expand Down
5 changes: 3 additions & 2 deletions crates/latticefold-plus/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ license.workspace = true

[features]
default = ["std"]
std = ["ark-std/std", "cyclotomic-rings/std", "rand/std"]
std = ["ark-std/std", "latticefold-rings/std", "rand/std"]
parallel = [
"dep:rayon",
"std",
Expand All @@ -21,12 +21,13 @@ getrandom = ["ark-std/getrandom"]
dhat-heap = []

[dependencies]
latticefold-rings = { workspace = true }

ark-crypto-primitives = { workspace = true }
ark-ff = { workspace = true }
ark-serialize = { workspace = true }
ark-std = { workspace = true }
criterion = { workspace = true }
cyclotomic-rings = { workspace = true }
hashbrown = "0.15"
latticefold = { workspace = true }
num-bigint = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion crates/latticefold-plus/benches/e2e.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
use ark_ff::PrimeField;
use ark_std::time::Duration;
use criterion::{black_box, criterion_group, criterion_main, Criterion};
use cyclotomic_rings::rings::FrogPoseidonConfig as PC;
use latticefold::arith::r1cs::R1CS;
use latticefold_plus::{
lin::LinParameters,
Expand All @@ -16,6 +15,7 @@ use latticefold_plus::{
transcript::PoseidonTranscript,
utils::estimate_bound,
};
use latticefold_rings::rings::FrogPoseidonConfig as PC;
use rand::prelude::*;
use stark_rings::{cyclotomic_ring::models::frog_ring::RqPoly as R, PolyRing, Ring};
use stark_rings_linalg::{Matrix, SparseMatrix};
Expand Down
12 changes: 6 additions & 6 deletions crates/latticefold-plus/src/cm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use stark_rings_poly::mle::DenseMultilinearExtension;

use crate::{
rgchk::{Dcom, Rg},
utils::{short_challenge, tensor, tensor_product},
utils::{small_challenge, tensor, tensor_product},
};

#[derive(Clone, Debug)]
Expand Down Expand Up @@ -67,13 +67,13 @@ where
let dcom = self.rg.range_check(M, transcript);

let s = (0..3)
.map(|_| short_challenge(128, transcript))
.map(|_| small_challenge(128, transcript))
.collect::<Vec<R>>();

let s_prime = (0..k)
.map(|_| {
(0..d)
.map(|_| short_challenge(128, transcript))
.map(|_| small_challenge(128, transcript))
.collect::<Vec<R>>()
})
.collect::<Vec<_>>();
Expand Down Expand Up @@ -359,13 +359,13 @@ where
self.dcom.verify(transcript).unwrap();

let s = (0..3)
.map(|_| short_challenge(128, transcript))
.map(|_| small_challenge(128, transcript))
.collect::<Vec<R>>();

let s_prime = (0..k)
.map(|_| {
(0..d)
.map(|_| short_challenge(128, transcript))
.map(|_| small_challenge(128, transcript))
.collect::<Vec<R>>()
})
.collect::<Vec<_>>();
Expand Down Expand Up @@ -609,7 +609,7 @@ where
mod tests {
use ark_ff::PrimeField;
use ark_std::Zero;
use cyclotomic_rings::rings::FrogPoseidonConfig as PC;
use latticefold_rings::rings::FrogPoseidonConfig as PC;
use stark_rings::cyclotomic_ring::models::frog_ring::RqPoly as R;
use stark_rings_linalg::{Matrix, SparseMatrix};

Expand Down
2 changes: 1 addition & 1 deletion crates/latticefold-plus/src/decomp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ impl<R: PolyRing> DecompProof<R> {
mod tests {
use ark_ff::PrimeField;
use ark_std::One;
use cyclotomic_rings::rings::FrogPoseidonConfig as PC;
use latticefold::arith::r1cs::R1CS;
use latticefold_rings::rings::FrogPoseidonConfig as PC;
use stark_rings::{
balanced_decomposition::GadgetDecompose, cyclotomic_ring::models::frog_ring::RqPoly as R,
};
Expand Down
2 changes: 1 addition & 1 deletion crates/latticefold-plus/src/lin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ where
mod tests {
use ark_ff::PrimeField;
use ark_std::One;
use cyclotomic_rings::rings::FrogPoseidonConfig as PC;
use latticefold::arith::r1cs::R1CS;
use latticefold_rings::rings::FrogPoseidonConfig as PC;
use stark_rings::{
balanced_decomposition::GadgetDecompose, cyclotomic_ring::models::frog_ring::RqPoly as R,
PolyRing,
Expand Down
2 changes: 1 addition & 1 deletion crates/latticefold-plus/src/mlin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ where
mod tests {
use ark_ff::PrimeField;
use ark_std::One;
use cyclotomic_rings::rings::FrogPoseidonConfig as PC;
use latticefold::arith::r1cs::R1CS;
use latticefold_rings::rings::FrogPoseidonConfig as PC;
use stark_rings::{cyclotomic_ring::models::frog_ring::RqPoly as R, PolyRing};
use stark_rings_linalg::SparseMatrix;

Expand Down
2 changes: 1 addition & 1 deletion crates/latticefold-plus/src/plus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@ where
#[cfg(test)]
mod tests {
use ark_ff::PrimeField;
use cyclotomic_rings::rings::FrogPoseidonConfig as PC;
use latticefold::arith::r1cs::R1CS;
use latticefold_rings::rings::FrogPoseidonConfig as PC;
use rand::prelude::*;
use stark_rings::{cyclotomic_ring::models::frog_ring::RqPoly as R, PolyRing, Ring};
use stark_rings_linalg::SparseMatrix;
Expand Down
2 changes: 1 addition & 1 deletion crates/latticefold-plus/src/r1cs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ pub fn r1cs_decomposed_square<R: Decompose + Ring>(
#[cfg(test)]
mod tests {
use ark_std::One;
use cyclotomic_rings::rings::GoldilocksPoseidonConfig as PC;
use latticefold_rings::rings::GoldilocksPoseidonConfig as PC;
use stark_rings::{
balanced_decomposition::GadgetDecompose, cyclotomic_ring::models::goldilocks::RqPoly as R,
};
Expand Down
2 changes: 1 addition & 1 deletion crates/latticefold-plus/src/rgchk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ fn absorb_evaluations<R: OverField>(evals: &[DcomEvals<R>], transcript: &mut imp
mod tests {
use ark_ff::PrimeField;
use ark_std::{log2, Zero};
use cyclotomic_rings::rings::FrogPoseidonConfig as PC;
use latticefold_rings::rings::FrogPoseidonConfig as PC;
use stark_rings::cyclotomic_ring::models::frog_ring::RqPoly as R;

use super::*;
Expand Down
2 changes: 1 addition & 1 deletion crates/latticefold-plus/src/setchk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ fn absorb_evaluations<R: OverField>(
#[cfg(test)]
mod tests {
use ark_std::One;
use cyclotomic_rings::rings::FrogPoseidonConfig as PC;
use latticefold_rings::rings::FrogPoseidonConfig as PC;
use stark_rings::{cyclotomic_ring::models::frog_ring::RqPoly as R, unit_monomial};
use stark_rings_linalg::SparseMatrix;

Expand Down
2 changes: 1 addition & 1 deletion crates/latticefold-plus/src/transcript.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ use ark_crypto_primitives::sponge::{
CryptographicSponge,
};
use ark_ff::{Field, PrimeField};
use cyclotomic_rings::rings::GetPoseidonParams;
use latticefold::transcript::Transcript;
use latticefold_rings::rings::GetPoseidonParams;
use stark_rings::OverField;

/// Transcript using Poseidon sponge
Expand Down
2 changes: 1 addition & 1 deletion crates/latticefold-plus/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ where
result
}

pub fn short_challenge<R: OverField>(lambda: usize, transcript: &mut impl Transcript<R>) -> R {
pub fn small_challenge<R: OverField>(lambda: usize, transcript: &mut impl Transcript<R>) -> R {
let u = 2usize.pow(lambda as u32 / R::dimension() as u32);
let bytes = transcript.squeeze_bytes(R::dimension());

Expand Down
4 changes: 2 additions & 2 deletions crates/latticefold/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ license.workspace = true

[features]
default = ["std"]
std = ["ark-std/std", "cyclotomic-rings/std", "rand/std"]
std = ["ark-std/std", "latticefold-rings/std", "rand/std"]
parallel = [
"dep:rayon",
"std",
Expand All @@ -25,7 +25,7 @@ ark-crypto-primitives = { workspace = true }
ark-ff = { workspace = true }
ark-serialize = { workspace = true }
ark-std = { workspace = true }
cyclotomic-rings = { workspace = true }
latticefold-rings = { workspace = true }
num-bigint = { workspace = true }
num-traits = { workspace = true }
rand = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion crates/latticefold/benches/ajtai.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ use criterion::{
criterion_group, criterion_main, AxisScale, BatchSize::SmallInput, BenchmarkId, Criterion,
PlotConfiguration,
};
use cyclotomic_rings::rings::{BabyBearRingNTT, FrogRingNTT, GoldilocksRingNTT, StarkRingNTT};
use env::ENV;
use latticefold::commitment::AjtaiCommitmentScheme;
use latticefold_rings::rings::{BabyBearRingNTT, FrogRingNTT, GoldilocksRingNTT, StarkRingNTT};
use stark_rings::cyclotomic_ring::{CRT, ICRT};

mod env;
Expand Down
Loading
Loading