Skip to content

Commit

Permalink
Upgrade dependencies to 0.4 (#112)
Browse files Browse the repository at this point in the history
* intermediate commit

* building passing

* tests passing

* cargo fmt

* Address comments

* Improve checks

* Format

* Fix CI for no-std

* Update CHANGELOG

* Fix no-std

Co-authored-by: Marcin Gorny <[email protected]>

* Revert CI change

* Fix CI for merge groups

---------

Co-authored-by: nikkolasg <[email protected]>
Co-authored-by: Nicolas Gailly <[email protected]>
Co-authored-by: Marcin Gorny <[email protected]>
  • Loading branch information
4 people authored Feb 15, 2023
1 parent 88c97d2 commit 7be889a
Show file tree
Hide file tree
Showing 23 changed files with 980 additions and 1,266 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: CI
on:
merge_group:
pull_request:
push:
branches:
Expand Down
13 changes: 7 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@

### Breaking changes

- [\#82](https://github.com/arkworks-rs/poly-commit/pull/82) Function parameter `opening_challenge: F` for `open`,
`check`, has been changed from `F` to `opening_challenges: &mut ChallengeGenerator`.
- [\#112](https://github.com/arkworks-rs/poly-commit/pull/112) Upgrade all dependencies to `0.4`.
- [\#82](https://github.com/arkworks-rs/poly-commit/pull/82) Argument `opening_challenge: F` for `open`,
`check`, has been changed from `F` to `opening_challenges: &mut ChallengeGenerator`.

### Features

- [\#82](https://github.com/arkworks-rs/poly-commit/pull/82) Add multivariate opening challenge strategy. Integrate with sponge API.
- [\#82](https://github.com/arkworks-rs/poly-commit/pull/82) Add multivariate opening challenge strategy. Integrate with sponge API.

### Improvements

Expand All @@ -19,14 +20,14 @@

### Breaking changes

- [\#78](https://github.com/arkworks-rs/poly-commit/pull/78) Fix MarlinPC's CommitterKey to return the correct `supported_degree`.
- [\#78](https://github.com/arkworks-rs/poly-commit/pull/78) Fix `MarlinPC`'s `CommitterKey` to return the correct `supported_degree`.

### Features

### Improvements

### Bug fixes

## v0.2.0
## v0.2.0

- initial release of `ark-poly-commit`.
- Initial release of `ark-poly-commit`.
63 changes: 20 additions & 43 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
[package]
name = "ark-poly-commit"
version = "0.3.0"
authors = [
"Alessandro Chiesa <[email protected]>",
"Mary Maller <[email protected]>",
"Yuncong Hu <[email protected]>",
"William Lin",
"Pratyush Mishra <[email protected]>",
"Noah Vesely <[email protected]>",
"Nicholas Ward <[email protected]>",
"arkworks contributors"
]
version = "0.4.0"
description = "A library for constructing polynomial commitment schemes for use in zkSNARKs"
repository = "https://github.com/arkworks-rs/poly-commit"
documentation = "https://docs.rs/ark-poly-commit/"
Expand All @@ -21,26 +11,26 @@ license = "MIT/Apache-2.0"
edition = "2018"

[dependencies]
ark-serialize = { version = "^0.3.0", default-features = false, features = [ "derive" ] }
ark-ff = { version = "^0.3.0", default-features = false }
ark-ec = { version = "^0.3.0", default-features = false }
ark-poly = {version = "^0.3.0", default-features = false }
ark-sponge = {version = "^0.3.0", default-features = false}

ark-std = { version = "^0.3.0", default-features = false }
ark-relations = { version = "^0.3.0", default-features = false, optional = true }
ark-r1cs-std = { version = "^0.3.0", default-features = false, optional = true }
hashbrown = { version = "0.9", optional = true }

digest = "0.9"
rayon = { version = "1", optional = true }
ark-serialize = { version = "^0.4.0", default-features = false, features = [ "derive" ] }
ark-ff = { version = "^0.4.0", default-features = false }
ark-ec = { version = "^0.4.0", default-features = false }
ark-poly = {version = "^0.4.0", default-features = false }
ark-crypto-primitives = {version = "^0.4.0", default-features = false, features = ["sponge"] }
ark-std = { version = "^0.4.0", default-features = false }

ark-relations = { version = "^0.4.0", default-features = false, optional = true }
ark-r1cs-std = { version = "^0.4.0", default-features = false, optional = true }
hashbrown = { version = "0.13", default-features = false, optional = true }

digest = "0.10"
derivative = { version = "2", features = [ "use_core" ] }
rayon = { version = "1", optional = true }

[dev-dependencies]
ark-ed-on-bls12-381 = { version = "^0.3.0", default-features = false }
ark-bls12-381 = { version = "^0.3.0", default-features = false, features = [ "curve" ] }
ark-bls12-377 = { version = "^0.3.0", default-features = false, features = [ "curve" ] }
blake2 = { version = "0.9", default-features = false }
ark-ed-on-bls12-381 = { version = "^0.4.0", default-features = false }
ark-bls12-381 = { version = "^0.4.0", default-features = false, features = [ "curve" ] }
ark-bls12-377 = { version = "^0.4.0", default-features = false, features = [ "curve" ] }
blake2 = { version = "0.10", default-features = false }
rand_chacha = { version = "0.3.0", default-features = false }

[profile.release]
Expand All @@ -55,22 +45,9 @@ debug-assertions = true
incremental = true
debug = true

# To be removed in the new release.
[patch.crates-io]
ark-std = { git = "https://github.com/arkworks-rs/std" }
ark-ec = { git = "https://github.com/arkworks-rs/algebra" }
ark-ff = { git = "https://github.com/arkworks-rs/algebra" }
ark-poly = { git = "https://github.com/arkworks-rs/algebra" }
ark-serialize = { git = "https://github.com/arkworks-rs/algebra" }
ark-bls12-381 = { git = "https://github.com/arkworks-rs/curves" }
ark-bls12-377 = { git = "https://github.com/arkworks-rs/curves" }
ark-ed-on-bls12-381 = { git = "https://github.com/arkworks-rs/curves" }
ark-r1cs-std = { git = "https://github.com/arkworks-rs/r1cs-std" }
ark-sponge = { git = "https://github.com/arkworks-rs/sponge" }

[features]
default = [ "std", "parallel" ]
std = [ "ark-ff/std", "ark-ec/std", "ark-poly/std", "ark-std/std", "ark-relations/std", "ark-serialize/std", "ark-sponge/std"]
r1cs = [ "ark-relations", "ark-r1cs-std", "hashbrown", "ark-sponge/r1cs"]
std = [ "ark-ff/std", "ark-ec/std", "ark-poly/std", "ark-std/std", "ark-relations/std", "ark-serialize/std", "ark-crypto-primitives/std"]
r1cs = [ "ark-relations", "ark-r1cs-std", "hashbrown", "ark-crypto-primitives/r1cs"]
print-trace = [ "ark-std/print-trace" ]
parallel = [ "std", "ark-ff/parallel", "ark-ec/parallel", "ark-poly/parallel", "ark-std/parallel", "rayon" ]
2 changes: 1 addition & 1 deletion src/challenge.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use ark_crypto_primitives::sponge::{CryptographicSponge, FieldElementSize};
use ark_ff::PrimeField;
use ark_sponge::{CryptographicSponge, FieldElementSize};

/// `ChallengeGenerator` generates opening challenges using multivariate or univariate strategy.
/// For multivariate strategy, each challenge is freshly squeezed from a sponge.
Expand Down
2 changes: 1 addition & 1 deletion src/constraints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ use crate::{
data_structures::LabeledCommitment, BatchLCProof, LCTerm, LinearCombination,
PolynomialCommitment, String, Vec,
};
use ark_crypto_primitives::sponge::CryptographicSponge;
use ark_ff::PrimeField;
use ark_poly::Polynomial;
use ark_r1cs_std::fields::nonnative::NonNativeFieldVar;
use ark_r1cs_std::{fields::fp::FpVar, prelude::*};
use ark_relations::r1cs::{ConstraintSystemRef, Namespace, Result as R1CSResult, SynthesisError};
use ark_sponge::CryptographicSponge;
use ark_std::{borrow::Borrow, cmp::Eq, cmp::PartialEq, hash::Hash, marker::Sized};
use hashbrown::{HashMap, HashSet};

Expand Down
25 changes: 4 additions & 21 deletions src/data_structures.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
use crate::{Polynomial, Rc, String, Vec};
use crate::{Polynomial, String, Vec};
use ark_ff::{Field, PrimeField, ToConstraintField};
use ark_serialize::{CanonicalDeserialize, CanonicalSerialize, SerializationError};
use ark_serialize::{CanonicalDeserialize, CanonicalSerialize};
use ark_std::rand::RngCore;
use ark_std::{
borrow::Borrow,
io::{Read, Write},
marker::PhantomData,
ops::{AddAssign, MulAssign, SubAssign},
};
Expand Down Expand Up @@ -62,12 +61,6 @@ pub trait PCCommitment: Clone + CanonicalSerialize + CanonicalDeserialize {

/// Does this commitment have a degree bound?
fn has_degree_bound(&self) -> bool;

/// Size in bytes
#[deprecated(since = "0.4.0", note = "Please use `.serialized_size()` instead.")]
fn size_in_bytes(&self) -> usize {
self.serialized_size()
}
}

/// Defines the minimal interface of prepared commitments for any polynomial
Expand Down Expand Up @@ -96,16 +89,6 @@ pub trait PCRandomness: Clone + CanonicalSerialize + CanonicalDeserialize {
) -> Self;
}

/// Defines the minimal interface of evaluation proofs for any polynomial
/// commitment scheme.
pub trait PCProof: Clone + CanonicalSerialize + CanonicalDeserialize {
/// Size in bytes
#[deprecated(since = "0.4.0", note = "Please use `.serialized_size()` instead.")]
fn size_in_bytes(&self) -> usize {
self.serialized_size()
}
}

/// A proof of satisfaction of linear combinations.
#[derive(Clone, CanonicalSerialize, CanonicalDeserialize)]
pub struct BatchLCProof<F: PrimeField, T: Clone + CanonicalSerialize + CanonicalDeserialize> {
Expand All @@ -121,7 +104,7 @@ pub struct BatchLCProof<F: PrimeField, T: Clone + CanonicalSerialize + Canonical
#[derive(Debug, Clone, CanonicalSerialize, CanonicalDeserialize)]
pub struct LabeledPolynomial<F: Field, P: Polynomial<F>> {
label: PolynomialLabel,
polynomial: Rc<P>,
polynomial: P,
degree_bound: Option<usize>,
hiding_bound: Option<usize>,
_field: PhantomData<F>,
Expand All @@ -145,7 +128,7 @@ impl<'a, F: Field, P: Polynomial<F>> LabeledPolynomial<F, P> {
) -> Self {
Self {
label,
polynomial: Rc::new(polynomial),
polynomial: polynomial,
degree_bound,
hiding_bound,
_field: PhantomData,
Expand Down
35 changes: 15 additions & 20 deletions src/ipa_pc/data_structures.rs
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
use crate::*;
use crate::{PCCommitterKey, PCVerifierKey, Vec};
use ark_ec::AffineCurve;
use ark_ec::AffineRepr;
use ark_ff::{Field, UniformRand, Zero};
use ark_serialize::{CanonicalDeserialize, CanonicalSerialize, SerializationError};
use ark_serialize::{CanonicalDeserialize, CanonicalSerialize};
use ark_std::rand::RngCore;
use ark_std::{
io::{Read, Write},
vec,
};
use ark_std::vec;

/// `UniversalParams` are the universal parameters for the inner product arg scheme.
#[derive(Derivative, CanonicalSerialize, CanonicalDeserialize)]
#[derivative(Default(bound = ""), Clone(bound = ""), Debug(bound = ""))]
pub struct UniversalParams<G: AffineCurve> {
pub struct UniversalParams<G: AffineRepr> {
/// The key used to commit to polynomials.
pub comm_key: Vec<G>,

Expand All @@ -23,7 +20,7 @@ pub struct UniversalParams<G: AffineCurve> {
pub s: G,
}

impl<G: AffineCurve> PCUniversalParams for UniversalParams<G> {
impl<G: AffineRepr> PCUniversalParams for UniversalParams<G> {
fn max_degree(&self) -> usize {
self.comm_key.len() - 1
}
Expand All @@ -38,7 +35,7 @@ impl<G: AffineCurve> PCUniversalParams for UniversalParams<G> {
Clone(bound = ""),
Debug(bound = "")
)]
pub struct CommitterKey<G: AffineCurve> {
pub struct CommitterKey<G: AffineRepr> {
/// The key used to commit to polynomials.
pub comm_key: Vec<G>,

Expand All @@ -54,7 +51,7 @@ pub struct CommitterKey<G: AffineCurve> {
pub max_degree: usize,
}

impl<G: AffineCurve> PCCommitterKey for CommitterKey<G> {
impl<G: AffineRepr> PCCommitterKey for CommitterKey<G> {
fn max_degree(&self) -> usize {
self.max_degree
}
Expand All @@ -66,7 +63,7 @@ impl<G: AffineCurve> PCCommitterKey for CommitterKey<G> {
/// `VerifierKey` is used to check evaluation proofs for a given commitment.
pub type VerifierKey<G> = CommitterKey<G>;

impl<G: AffineCurve> PCVerifierKey for VerifierKey<G> {
impl<G: AffineRepr> PCVerifierKey for VerifierKey<G> {
fn max_degree(&self) -> usize {
self.max_degree
}
Expand All @@ -79,7 +76,7 @@ impl<G: AffineCurve> PCVerifierKey for VerifierKey<G> {
/// Nothing to do to prepare this verifier key (for now).
pub type PreparedVerifierKey<G> = VerifierKey<G>;

impl<G: AffineCurve> PCPreparedVerifierKey<VerifierKey<G>> for PreparedVerifierKey<G> {
impl<G: AffineRepr> PCPreparedVerifierKey<VerifierKey<G>> for PreparedVerifierKey<G> {
/// prepare `PreparedVerifierKey` from `VerifierKey`
fn prepare(vk: &VerifierKey<G>) -> Self {
vk.clone()
Expand All @@ -97,7 +94,7 @@ impl<G: AffineCurve> PCPreparedVerifierKey<VerifierKey<G>> for PreparedVerifierK
PartialEq(bound = ""),
Eq(bound = "")
)]
pub struct Commitment<G: AffineCurve> {
pub struct Commitment<G: AffineRepr> {
/// A Pedersen commitment to the polynomial.
pub comm: G,

Expand All @@ -107,7 +104,7 @@ pub struct Commitment<G: AffineCurve> {
pub shifted_comm: Option<G>,
}

impl<G: AffineCurve> PCCommitment for Commitment<G> {
impl<G: AffineRepr> PCCommitment for Commitment<G> {
#[inline]
fn empty() -> Self {
Commitment {
Expand All @@ -124,7 +121,7 @@ impl<G: AffineCurve> PCCommitment for Commitment<G> {
/// Nothing to do to prepare this commitment (for now).
pub type PreparedCommitment<E> = Commitment<E>;

impl<G: AffineCurve> PCPreparedCommitment<Commitment<G>> for PreparedCommitment<G> {
impl<G: AffineRepr> PCPreparedCommitment<Commitment<G>> for PreparedCommitment<G> {
/// prepare `PreparedCommitment` from `Commitment`
fn prepare(vk: &Commitment<G>) -> Self {
vk.clone()
Expand All @@ -141,15 +138,15 @@ impl<G: AffineCurve> PCPreparedCommitment<Commitment<G>> for PreparedCommitment<
PartialEq(bound = ""),
Eq(bound = "")
)]
pub struct Randomness<G: AffineCurve> {
pub struct Randomness<G: AffineRepr> {
/// Randomness is some scalar field element.
pub rand: G::ScalarField,

/// Randomness applied to the shifted commitment is some scalar field element.
pub shifted_rand: Option<G::ScalarField>,
}

impl<G: AffineCurve> PCRandomness for Randomness<G> {
impl<G: AffineRepr> PCRandomness for Randomness<G> {
fn empty() -> Self {
Self {
rand: G::ScalarField::zero(),
Expand Down Expand Up @@ -177,7 +174,7 @@ impl<G: AffineCurve> PCRandomness for Randomness<G> {
Clone(bound = ""),
Debug(bound = "")
)]
pub struct Proof<G: AffineCurve> {
pub struct Proof<G: AffineRepr> {
/// Vector of left elements for each of the log_d iterations in `open`
pub l_vec: Vec<G>,

Expand All @@ -199,8 +196,6 @@ pub struct Proof<G: AffineCurve> {
pub rand: Option<G::ScalarField>,
}

impl<G: AffineCurve> PCProof for Proof<G> {}

/// `SuccinctCheckPolynomial` is a succinctly-representated polynomial
/// generated from the `log_d` random oracle challenges generated in `open`.
/// It has the special property that can be evaluated in `O(log_d)` time.
Expand Down
Loading

0 comments on commit 7be889a

Please sign in to comment.