-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
initial integration of hyperplonk snark(#39)
- Loading branch information
1 parent
229148e
commit a6ea6ac
Showing
38 changed files
with
1,943 additions
and
441 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
[workspace] | ||
members = [ | ||
"arithmetic", | ||
"hyperplonk", | ||
"pcs", | ||
"poly-iop", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
[package] | ||
name = "arithmetic" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
|
||
ark-ff = { version = "^0.3.0", default-features = false } | ||
ark-std = { version = "^0.3.0", default-features = false } | ||
ark-poly = { version = "^0.3.0", default-features = false } | ||
ark-serialize = { version = "^0.3.0", default-features = false } | ||
ark-bls12-381 = { version = "0.3.0", default-features = false, features = [ "curve" ] } | ||
|
||
rand_chacha = { version = "0.3.0", default-features = false } | ||
displaydoc = { version = "0.2.3", default-features = false } | ||
rayon = { version = "1.5.2", default-features = false, optional = true } | ||
|
||
[dev-dependencies] | ||
ark-ec = { version = "^0.3.0", default-features = false } | ||
|
||
[features] | ||
# default = [ "parallel", "print-trace" ] | ||
default = [ "parallel" ] | ||
parallel = [ | ||
"rayon", | ||
"ark-std/parallel", | ||
"ark-ff/parallel", | ||
"ark-poly/parallel" | ||
] | ||
print-trace = [ | ||
"ark-std/print-trace" | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
//! Error module. | ||
use ark_std::string::String; | ||
use displaydoc::Display; | ||
|
||
/// A `enum` specifying the possible failure modes of the arithmetics. | ||
#[derive(Display, Debug)] | ||
pub enum ArithErrors { | ||
/// Invalid parameters: {0} | ||
InvalidParameters(String), | ||
/// Should not arrive to this point | ||
ShouldNotArrive, | ||
/// An error during (de)serialization: {0} | ||
SerializationErrors(ark_serialize::SerializationError), | ||
} | ||
|
||
impl From<ark_serialize::SerializationError> for ArithErrors { | ||
fn from(e: ark_serialize::SerializationError) -> Self { | ||
Self::SerializationErrors(e) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
mod errors; | ||
mod multilinear_polynomial; | ||
mod virtual_polynomial; | ||
|
||
pub use errors::ArithErrors; | ||
pub use multilinear_polynomial::{random_zero_mle_list, DenseMultilinearExtension}; | ||
pub use virtual_polynomial::{build_eq_x_r, VPAuxInfo, VirtualPolynomial}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
use ark_ff::PrimeField; | ||
use ark_std::{end_timer, rand::RngCore, start_timer}; | ||
use std::rc::Rc; | ||
|
||
pub use ark_poly::DenseMultilinearExtension; | ||
|
||
// Build a randomize list of mle-s whose sum is zero. | ||
pub fn random_zero_mle_list<F: PrimeField, R: RngCore>( | ||
nv: usize, | ||
degree: usize, | ||
rng: &mut R, | ||
) -> Vec<Rc<DenseMultilinearExtension<F>>> { | ||
let start = start_timer!(|| "sample random zero mle list"); | ||
|
||
let mut multiplicands = Vec::with_capacity(degree); | ||
for _ in 0..degree { | ||
multiplicands.push(Vec::with_capacity(1 << nv)) | ||
} | ||
for _ in 0..(1 << nv) { | ||
multiplicands[0].push(F::zero()); | ||
for e in multiplicands.iter_mut().skip(1) { | ||
e.push(F::rand(rng)); | ||
} | ||
} | ||
|
||
let list = multiplicands | ||
.into_iter() | ||
.map(|x| Rc::new(DenseMultilinearExtension::from_evaluations_vec(nv, x))) | ||
.collect(); | ||
|
||
end_timer!(start); | ||
list | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.