-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
initial implemetation of Sumcheck protocol (#7)
- Loading branch information
1 parent
9d4d178
commit fbd4009
Showing
18 changed files
with
1,614 additions
and
1 deletion.
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,4 +1,6 @@ | ||
[workspace] | ||
members = [ | ||
"hyperplonk" | ||
"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,8 @@ | ||
[package] | ||
name = "pcs" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] |
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,3 @@ | ||
KZG based multilinear polynomial commitment | ||
----- | ||
|
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,8 @@ | ||
#[cfg(test)] | ||
mod tests { | ||
#[test] | ||
fn it_works() { | ||
let result = 2 + 2; | ||
assert_eq!(result, 4); | ||
} | ||
} |
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,32 @@ | ||
[package] | ||
name = "poly-iop" | ||
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 } | ||
merlin = { version = "3.0.0", default-features = false } | ||
displaydoc = { version = "0.2.3", default-features = false } | ||
|
||
rayon = { version = "1.5.2", default-features = false, optional = true } | ||
|
||
[features] | ||
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,7 @@ | ||
Poly IOP | ||
----- | ||
|
||
Implements the following protocols | ||
|
||
- [ ] sum checks | ||
- [ ] zero checks |
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,27 @@ | ||
//! Error module. | ||
use ark_std::string::String; | ||
use displaydoc::Display; | ||
|
||
/// A `enum` specifying the possible failure modes of the PolyIOP. | ||
#[derive(Display, Debug)] | ||
pub enum PolyIOPErrors { | ||
/// Invalid Prover | ||
InvalidProver(String), | ||
/// Invalid Verifier | ||
InvalidVerifier(String), | ||
/// Invalid Proof | ||
InvalidProof(String), | ||
/// Invalid parameters | ||
InvalidParameters(String), | ||
/// Invalid Transcript | ||
InvalidTranscript(String), | ||
/// An error during (de)serialization | ||
SerializationError(ark_serialize::SerializationError), | ||
} | ||
|
||
impl From<ark_serialize::SerializationError> for PolyIOPErrors { | ||
fn from(e: ark_serialize::SerializationError) -> Self { | ||
Self::SerializationError(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,23 @@ | ||
#![allow(dead_code)] | ||
|
||
use std::marker::PhantomData; | ||
|
||
use ark_ff::PrimeField; | ||
|
||
mod errors; | ||
mod structs; | ||
mod sum_check; | ||
mod transcript; | ||
mod utils; | ||
mod virtual_poly; | ||
// mod zero_check; | ||
|
||
pub use virtual_poly::VirtualPolynomial; | ||
|
||
/// Struct for PolyIOP protocol. | ||
/// It is instantiated with | ||
/// - SumCheck protocol. | ||
/// - ZeroCheck protocol. (WIP) | ||
pub struct PolyIOP<F: PrimeField> { | ||
phantom: PhantomData<F>, | ||
} |
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,40 @@ | ||
//! Structs for polynomials and extensions. | ||
use ark_ff::PrimeField; | ||
use std::marker::PhantomData; | ||
|
||
#[derive(Clone, Debug, Default, PartialEq)] | ||
/// Auxiliary information about the multilinear polynomial | ||
pub struct DomainInfo<F: PrimeField> { | ||
/// max number of multiplicands in each product | ||
pub max_degree: usize, | ||
/// number of variables of the polynomial | ||
pub num_variables: usize, | ||
/// Associated field | ||
#[doc(hidden)] | ||
pub(crate) phantom: PhantomData<F>, | ||
} | ||
|
||
/// Subclaim when verifier is convinced | ||
pub struct SubClaim<F: PrimeField> { | ||
/// the multi-dimensional point that this multilinear extension is evaluated | ||
/// to | ||
pub point: Vec<F>, | ||
/// the expected evaluation | ||
pub expected_evaluation: F, | ||
} | ||
|
||
/// An IOP proof is a list of messages from prover to verifier | ||
/// through the interactive protocol. | ||
/// It is a shared struct for both sumcheck and zerocheck protocols. | ||
#[derive(Clone, Debug, Default, PartialEq)] | ||
pub struct IOPProof<F: PrimeField> { | ||
pub proofs: Vec<IOPProverMessage<F>>, | ||
} | ||
|
||
/// A message from the prover to the verifier at a given round | ||
/// is a list of evaluations. | ||
#[derive(Clone, Debug, Default, PartialEq)] | ||
pub struct IOPProverMessage<F: PrimeField> { | ||
pub(crate) evaluations: Vec<F>, | ||
} |
Oops, something went wrong.