Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multivariate marlin #50

Merged
merged 22 commits into from
Jan 21, 2021
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Update for arkworks + tweaks
ryanleh committed Oct 23, 2020
commit fc8151c680fceea52bfb39fa3f80969b6c971c6b
32 changes: 22 additions & 10 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "poly-commit"
version = "0.1.1-alpha.0"
name = "ark-poly-commit"
version = "0.1.0"
authors = [
"Alessandro Chiesa <alexch@berkeley.edu>",
"Mary Maller <mary.maller.15@ucl.ac.uk>",
@@ -9,20 +9,24 @@ authors = [
"Pratyush Mishra <pratyush@berkeley.edu>",
"Noah Vesely <noah.vesely.18@ucl.ac.uk>",
"Nicholas Ward <npward@berkeley.edu>",
"arkworks contributors"
]
description = "A library for constructing polynomial commitment schemes for use in zkSNARKs"
repository = "https://github.com/scipr-lab/poly-commit"
documentation = "https://docs.rs/poly-commit/"
repository = "https://github.com/arkworks-rs/poly-commit"
documentation = "https://docs.rs/ark-poly-commit/"
keywords = ["cryptography", "polynomial commitments", "elliptic curves", "pairing"]
categories = ["cryptography"]
include = ["Cargo.toml", "src", "README.md", "LICENSE-APACHE", "LICENSE-MIT"]
license = "MIT/Apache-2.0"
edition = "2018"

[dependencies]
algebra-core = { git = "https://github.com/ryanleh/zexe", branch="multivariate-support", default-features = false }
ff-fft = { git = "https://github.com/ryanleh/zexe", branch="multivariate-support", default-features = false }
bench-utils = { git = "https://github.com/scipr-lab/zexe", version = "0.1.1-alpha.0" }
ark-serialize = { git = "https://github.com/arkworks-rs/algebra", default-features = false, features = [ "derive" ] }
ark-ff = { git = "https://github.com/arkworks-rs/algebra", default-features = false }
ark-ec = { git = "https://github.com/arkworks-rs/algebra", default-features = false }
ark-std = { git = "https://github.com/arkworks-rs/utils", default-features = false }
ark-poly = { git = "https://github.com/arkworks-rs/algebra", default-features = false }
bench-utils = { git = "https://github.com/arkworks-rs/utils" }
rand_core = { version = "0.5", default-features = false }
digest = "0.8"
rayon = { version = "1", optional = true }
@@ -31,9 +35,17 @@ combinations = { git = "https://github.com/ryanleh/uniquecombinations", version

[dev-dependencies]
rand = { version = "0.7", default-features = false }
algebra = { git = "https://github.com/ryanleh/zexe", branch="multivariate-support", default-features = false, features = ["ed_on_bls12_381", "bls12_381", "bls12_377"] }
ark-ed-on-bls12-381 = { git = "https://github.com/arkworks-rs/curves", default-features = false }
ark-bls12-381 = { git = "https://github.com/arkworks-rs/curves", default-features = false, features = [ "curve" ] }
ark-bls12-377 = { git = "https://github.com/arkworks-rs/curves", default-features = false, features = [ "curve" ] }
blake2 = { version = "0.8", default-features = false }

[patch.'https://github.com/arkworks-rs/algebra']
ark-serialize = { git = "https://github.com/ryanleh/algebra", branch = "multivariate-support", default-features = false }
ark-ff = { git = "https://github.com/ryanleh/algebra", branch = "multivariate-support", default-features = false }
ark-ec = { git = "https://github.com/ryanleh/algebra", branch = "multivariate-support", default-features = false }
ark-poly = { git = "https://github.com/ryanleh/algebra", branch = "multivariate-support", default-features = false }

[profile.release]
opt-level = 3
lto = "thin"
@@ -48,6 +60,6 @@ debug = true

[features]
default = ["std", "parallel"]
std = [ "algebra-core/std", "ff-fft/std", ]
std = [ "ark-ff/std", "ark-ec/std", "ark-poly/std", "ark-std/std", "ark-serialize/std" ]
print-trace = [ "bench-utils/print-trace" ]
parallel = [ "std", "algebra-core/parallel", "ff-fft/parallel", "rayon" ]
parallel = [ "std", "ark-ff/parallel", "ark-ec/parallel", "ark-poly/parallel", "ark-std/parallel", "rayon" ]
9 changes: 9 additions & 0 deletions scripts/install-hook.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/env bash
# This script will install the provided directory ../.hooks as the hook
# directory for the present repo. See there for hooks, including a pre-commit
# hook that runs rustfmt on files before a commit.

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
HOOKS_DIR="${DIR}/../.hooks"

git config core.hooksPath "$HOOKS_DIR"
14 changes: 7 additions & 7 deletions src/data_structures.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::{Cow, Polynomial, String, Vec};
use algebra_core::Field;
use core::{
use ark_ff::Field;
use ark_std::{
borrow::Borrow,
marker::PhantomData,
ops::{AddAssign, MulAssign, SubAssign},
@@ -41,7 +41,7 @@ pub trait PCVerifierKey: Clone + core::fmt::Debug {

/// Defines the minimal interface of commitments for any polynomial
/// commitment scheme.
pub trait PCCommitment: Clone + algebra_core::ToBytes {
pub trait PCCommitment: Clone + ark_ff::ToBytes {
/// Outputs a non-hiding commitment to the zero polynomial.
fn empty() -> Self;

@@ -73,7 +73,7 @@ pub trait PCRandomness: Clone {

/// Defines the minimal interface of evaluation proofs for any polynomial
/// commitment scheme.
pub trait PCProof: Clone + algebra_core::ToBytes {
pub trait PCProof: Clone + ark_ff::ToBytes {
/// Size in bytes
fn size_in_bytes(&self) -> usize;
}
@@ -142,7 +142,7 @@ impl<'a, F: Field, P: Polynomial<F>> LabeledPolynomial<'a, F, P> {
}

/// Evaluate the polynomial in `self`.
pub fn evaluate(&self, point: &P::Domain) -> F {
pub fn evaluate(&self, point: &P::Point) -> F {
self.polynomial.evaluate(point)
}

@@ -201,9 +201,9 @@ impl<C: PCCommitment> LabeledCommitment<C> {
}
}

impl<C: PCCommitment> algebra_core::ToBytes for LabeledCommitment<C> {
impl<C: PCCommitment> ark_ff::ToBytes for LabeledCommitment<C> {
#[inline]
fn write<W: algebra_core::io::Write>(&self, writer: W) -> algebra_core::io::Result<()> {
fn write<W: ark_std::io::Write>(&self, writer: W) -> ark_std::io::Result<()> {
self.commitment.write(writer)
}
}
2 changes: 1 addition & 1 deletion src/error.rs
Original file line number Diff line number Diff line change
@@ -194,4 +194,4 @@ impl core::fmt::Display for Error {
}
}

impl algebra_core::Error for Error {}
impl ark_std::error::Error for Error {}
12 changes: 7 additions & 5 deletions src/ipa_pc/data_structures.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
use crate::*;
use crate::{PCCommitterKey, PCVerifierKey, Vec};
use algebra_core::{AffineCurve, Field, ToBytes, UniformRand, Zero};
use ark_ec::AffineCurve;
use ark_ff::{Field, ToBytes, UniformRand, Zero};
use ark_std::vec;
use rand_core::RngCore;

/// `UniversalParams` are the universal parameters for the inner product arg scheme.
@@ -105,13 +107,13 @@ impl<G: AffineCurve> PCCommitment for Commitment<G> {
}

fn size_in_bytes(&self) -> usize {
algebra_core::to_bytes![G::zero()].unwrap().len() / 2
ark_ff::to_bytes![G::zero()].unwrap().len() / 2
}
}

impl<G: AffineCurve> ToBytes for Commitment<G> {
#[inline]
fn write<W: algebra_core::io::Write>(&self, mut writer: W) -> algebra_core::io::Result<()> {
fn write<W: ark_std::io::Write>(&self, mut writer: W) -> ark_std::io::Result<()> {
self.comm.write(&mut writer)?;
let shifted_exists = self.shifted_comm.is_some();
shifted_exists.write(&mut writer)?;
@@ -192,13 +194,13 @@ pub struct Proof<G: AffineCurve> {

impl<G: AffineCurve> PCProof for Proof<G> {
fn size_in_bytes(&self) -> usize {
algebra_core::to_bytes![self].unwrap().len()
ark_ff::to_bytes![self].unwrap().len()
}
}

impl<G: AffineCurve> ToBytes for Proof<G> {
#[inline]
fn write<W: algebra_core::io::Write>(&self, mut writer: W) -> algebra_core::io::Result<()> {
fn write<W: ark_std::io::Write>(&self, mut writer: W) -> ark_std::io::Result<()> {
self.l_vec.write(&mut writer)?;
self.r_vec.write(&mut writer)?;
self.final_comm_key.write(&mut writer)?;
Loading