Skip to content

Commit

Permalink
Test to see
Browse files Browse the repository at this point in the history
  • Loading branch information
autquis committed Apr 7, 2024
1 parent 58a2843 commit acdbaae
Show file tree
Hide file tree
Showing 22 changed files with 85 additions and 73 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ incremental = true
debug = true

[patch.crates-io]
ark-std ={ git = "https://github.com/arkworks-rs/std"}
ark-ff = { git = "https://github.com/arkworks-rs/algebra/" }
ark-ec = { git = "https://github.com/arkworks-rs/algebra/" }
ark-serialize = { git = "https://github.com/arkworks-rs/algebra/" }
Expand Down
4 changes: 2 additions & 2 deletions poly-commit/src/constraints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ use ark_poly::Polynomial;
use ark_r1cs_std::fields::emulated_fp::EmulatedFpVar;
use ark_r1cs_std::{fields::fp::FpVar, prelude::*};
use ark_relations::r1cs::{ConstraintSystemRef, Namespace, Result as R1CSResult, SynthesisError};
use ark_std::string::*;
use ark_std::vec::*;
use ark_std::{borrow::Borrow, cmp::Eq, cmp::PartialEq, hash::Hash};
#[cfg(not(feature = "std"))]
use ark_std::{string::String, vec::Vec};
use hashbrown::{HashMap, HashSet};

/// Define the minimal interface of prepared allocated structures.
Expand Down
4 changes: 2 additions & 2 deletions poly-commit/src/data_structures.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ use crate::Polynomial;
use ark_ff::{Field, PrimeField, ToConstraintField};
use ark_serialize::{CanonicalDeserialize, CanonicalSerialize};
use ark_std::rand::RngCore;
use ark_std::string::*;
use ark_std::vec::*;
use ark_std::{
borrow::Borrow,
marker::PhantomData,
ops::{AddAssign, MulAssign, SubAssign},
};
#[cfg(not(feature = "std"))]
use ark_std::{string::String, vec::Vec};

/// Labels a `LabeledPolynomial` or a `LabeledCommitment`.
pub type PolynomialLabel = String;
Expand Down
3 changes: 2 additions & 1 deletion poly-commit/src/error.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use ark_std::string::*;
#[cfg(not(feature = "std"))]
use ark_std::string::String;

/// The error type for `PolynomialCommitment`.
#[derive(Debug)]
Expand Down
10 changes: 6 additions & 4 deletions poly-commit/src/ipa_pc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@ use crate::{BTreeMap, BTreeSet, CHALLENGE_SIZE};
use crate::{BatchLCProof, DenseUVPolynomial, Error, Evaluations, QuerySet};
use crate::{LabeledCommitment, LabeledPolynomial, LinearCombination};
use crate::{PCCommitmentState, PCCommitterKey, PCUniversalParams, PolynomialCommitment};
use ark_std::string::*;
use ark_std::vec::*;

use ark_ec::{AffineRepr, CurveGroup, VariableBaseMSM};
use ark_ff::{Field, One, PrimeField, UniformRand, Zero};
use ark_serialize::CanonicalSerialize;
use ark_std::rand::RngCore;
use ark_std::{convert::TryInto, format, marker::PhantomData, ops::Mul, vec};
use ark_std::{convert::TryInto, format, marker::PhantomData, ops::Mul};
#[cfg(not(feature = "std"))]
use ark_std::{
string::{String, ToString},
vec::Vec,
};

mod data_structures;
pub use data_structures::*;
Expand Down
7 changes: 3 additions & 4 deletions poly-commit/src/kzg10/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,10 @@ use ark_ec::{pairing::Pairing, CurveGroup};
use ark_ec::{scalar_mul::ScalarMul, VariableBaseMSM};
use ark_ff::{One, PrimeField, UniformRand, Zero};
use ark_poly::DenseUVPolynomial;
use ark_std::string::*;
use ark_std::vec::*;
use ark_std::{format, marker::PhantomData, ops::Div, ops::Mul, vec};

use ark_std::rand::RngCore;
use ark_std::{format, marker::PhantomData, ops::Div, ops::Mul};
#[cfg(not(feature = "std"))]
use ark_std::{string::ToString, vec::Vec};
#[cfg(feature = "parallel")]
use rayon::prelude::*;

Expand Down
7 changes: 5 additions & 2 deletions poly-commit/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,11 @@ use ark_std::{
fmt::Debug,
hash::Hash,
iter::FromIterator,
string::*,
vec::*,
};
#[cfg(not(feature = "std"))]
use ark_std::{
string::{String, ToString},
vec::Vec,
};

/// Data structures used by a polynomial commitment scheme.
Expand Down
6 changes: 3 additions & 3 deletions poly-commit/src/marlin/marlin_pc/data_structures.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use crate::kzg10;
use crate::{
DenseUVPolynomial, PCCommitment, PCCommitmentState, PCCommitterKey, PCPreparedCommitment,
PCPreparedVerifierKey, PCVerifierKey,
Expand All @@ -8,9 +9,8 @@ use ark_ff::{Field, PrimeField, ToConstraintField};
use ark_serialize::{CanonicalDeserialize, CanonicalSerialize};
use ark_std::ops::{Add, AddAssign};
use ark_std::rand::RngCore;
use ark_std::vec::*;

use crate::kzg10;
#[cfg(not(feature = "std"))]
use ark_std::vec::Vec;
/// `UniversalParams` are the universal parameters for the KZG10 scheme.
pub type UniversalParams<E> = kzg10::UniversalParams<E>;

Expand Down
7 changes: 3 additions & 4 deletions poly-commit/src/marlin/marlin_pc/mod.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
use crate::{kzg10, marlin::Marlin, PCCommitterKey, CHALLENGE_SIZE};
use crate::{BTreeMap, BTreeSet};
use ark_std::string::*;
use ark_std::vec::*;

use crate::{BatchLCProof, Error, Evaluations, QuerySet};
use crate::{LabeledCommitment, LabeledPolynomial, LinearCombination};
use crate::{PCCommitmentState, PCUniversalParams, PolynomialCommitment};
Expand All @@ -12,7 +9,9 @@ use ark_ec::CurveGroup;
use ark_ff::Zero;
use ark_poly::DenseUVPolynomial;
use ark_std::rand::RngCore;
use ark_std::{marker::PhantomData, ops::Div, vec};
use ark_std::{marker::PhantomData, ops::Div};
#[cfg(not(feature = "std"))]
use ark_std::{string::ToString, vec::Vec};

mod data_structures;
use ark_crypto_primitives::sponge::CryptographicSponge;
Expand Down
4 changes: 2 additions & 2 deletions poly-commit/src/marlin/marlin_pst13_pc/combinations.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Compute all combinations of values in a given list
//! Credit: https://github.com/meltinglava/uniquecombinations/
use ark_std::vec::*;

#[cfg(not(feature = "std"))]
use ark_std::vec::Vec;
/// Compute all combinations of values in a given list.
pub(crate) struct Combinations<T>
where
Expand Down
12 changes: 6 additions & 6 deletions poly-commit/src/marlin/marlin_pst13_pc/data_structures.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@ use crate::{
};
use ark_ec::pairing::Pairing;
use ark_poly::DenseMVPolynomial;
use ark_serialize::{
CanonicalDeserialize, CanonicalSerialize, Compress, SerializationError, Valid, Validate,
};
#[cfg(not(feature = "std"))]
use ark_std::vec::Vec;
use ark_std::{
io::{Read, Write},
marker::PhantomData,
ops::{Add, AddAssign, Index},
rand::RngCore,
};

use ark_serialize::{
CanonicalDeserialize, CanonicalSerialize, Compress, SerializationError, Valid, Validate,
};
use ark_std::rand::RngCore;
use ark_std::vec::*;

/// `UniversalParams` are the universal parameters for the MarlinPST13 scheme.
#[derive(Derivative)]
#[derivative(Default(bound = ""), Clone(bound = ""), Debug(bound = ""))]
Expand Down
17 changes: 8 additions & 9 deletions poly-commit/src/marlin/marlin_pst13_pc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use crate::{
use crate::{BatchLCProof, Error, Evaluations, QuerySet};
use crate::{LabeledCommitment, LabeledPolynomial, LinearCombination};
use crate::{PCCommitmentState, PCUniversalParams, PolynomialCommitment};
use ark_crypto_primitives::sponge::CryptographicSponge;
use ark_ec::AffineRepr;
use ark_ec::{
pairing::Pairing,
Expand All @@ -14,21 +15,18 @@ use ark_ec::{
};
use ark_ff::{One, PrimeField, UniformRand, Zero};
use ark_poly::{multivariate::Term, DenseMVPolynomial};
use ark_std::rand::RngCore;
use ark_std::string::*;
use ark_std::vec::*;
use ark_std::{marker::PhantomData, ops::Index, ops::Mul, vec};
use ark_std::{marker::PhantomData, ops::Index, ops::Mul, rand::RngCore};
#[cfg(not(feature = "std"))]
use ark_std::{string::ToString, vec::Vec};
#[cfg(feature = "parallel")]
use rayon::prelude::*;

mod data_structures;
pub use data_structures::*;

mod combinations;
use combinations::*;

use ark_crypto_primitives::sponge::CryptographicSponge;
#[cfg(feature = "parallel")]
use rayon::prelude::*;

/// Multivariate polynomial commitment based on the construction in [[PST13]][pst]
/// with batching and (optional) hiding property inspired by the univariate scheme
/// in [[CHMMVW20, "Marlin"]][marlin]
Expand Down Expand Up @@ -707,7 +705,8 @@ mod tests {
multivariate::{SparsePolynomial as SparsePoly, SparseTerm},
DenseMVPolynomial,
};
use ark_std::vec::*;
#[cfg(not(feature = "std"))]
use ark_std::vec::Vec;
use rand_chacha::ChaCha20Rng;

type MVPoly_381 = SparsePoly<<Bls12_381 as Pairing>::ScalarField, SparseTerm>;
Expand Down
7 changes: 5 additions & 2 deletions poly-commit/src/marlin/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@ use ark_ec::pairing::Pairing;
use ark_ec::AffineRepr;
use ark_ec::CurveGroup;
use ark_ff::{One, Zero};
use ark_std::string::*;
use ark_std::vec::*;
use ark_std::{convert::TryInto, hash::Hash, ops::AddAssign, ops::Mul};
#[cfg(not(feature = "std"))]
use ark_std::{
string::{String, ToString},
vec::Vec,
};

/// Polynomial commitment scheme from [[KZG10]][kzg] that enforces
/// strict degree bounds and (optionally) enables hiding commitments by
Expand Down
3 changes: 2 additions & 1 deletion poly-commit/src/multilinear_pc/data_structures.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use ark_ec::pairing::Pairing;
use ark_serialize::{CanonicalDeserialize, CanonicalSerialize};
use ark_std::vec::*;
#[cfg(not(feature = "std"))]
use ark_std::vec::Vec;
#[allow(type_alias_bounds)]
/// Evaluations over {0,1}^n for G1
pub type EvaluationHyperCubeOnG1<E: Pairing> = Vec<E::G1Affine>;
Expand Down
28 changes: 14 additions & 14 deletions poly-commit/src/multilinear_pc/mod.rs
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
use crate::multilinear_pc::data_structures::{
Commitment, CommitterKey, Proof, UniversalParams, VerifierKey,
};
use ark_ec::scalar_mul::BatchMulPreprocessing;
use ark_ec::AffineRepr;
use ark_ec::{pairing::Pairing, CurveGroup};
use ark_ec::{scalar_mul::ScalarMul, VariableBaseMSM};
use ark_ff::{Field, PrimeField};
use ark_ff::{One, Zero};
use ark_ec::{
pairing::Pairing,
scalar_mul::{BatchMulPreprocessing, ScalarMul},
AffineRepr, CurveGroup, VariableBaseMSM,
};
use ark_ff::{Field, One, PrimeField, Zero};
use ark_poly::{DenseMultilinearExtension, MultilinearExtension};
use ark_std::collections::LinkedList;
use ark_std::iter::FromIterator;
use ark_std::marker::PhantomData;
use ark_std::ops::Mul;
use ark_std::rand::RngCore;
use ark_std::vec::*;
use ark_std::UniformRand;
#[cfg(not(feature = "std"))]
use ark_std::vec::Vec;
use ark_std::{
collections::LinkedList, iter::FromIterator, marker::PhantomData, ops::Mul, rand::RngCore,
UniformRand,
};

/// data structures used by multilinear extension commitment scheme
pub mod data_structures;
Expand Down Expand Up @@ -244,7 +243,8 @@ mod tests {
use ark_poly::{DenseMultilinearExtension, MultilinearExtension, SparseMultilinearExtension};
use ark_std::rand::RngCore;
use ark_std::test_rng;
use ark_std::vec::*;
#[cfg(not(feature = "std"))]
use ark_std::vec::Vec;
type E = Bls12_381;
type Fr = <E as Pairing>::ScalarField;

Expand Down
3 changes: 2 additions & 1 deletion poly-commit/src/sonic_pc/data_structures.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ use ark_serialize::{
CanonicalDeserialize, CanonicalSerialize, Compress, SerializationError, Valid, Validate,
};
use ark_std::io::{Read, Write};
use ark_std::vec::*;
#[cfg(not(feature = "std"))]
use ark_std::vec::Vec;

/// `UniversalParams` are the universal parameters for the KZG10 scheme.
pub type UniversalParams<E> = kzg10::UniversalParams<E>;
Expand Down
17 changes: 8 additions & 9 deletions poly-commit/src/sonic_pc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,17 @@ use crate::{BTreeMap, BTreeSet};
use crate::{BatchLCProof, DenseUVPolynomial, Error, Evaluations, QuerySet};
use crate::{LabeledCommitment, LabeledPolynomial, LinearCombination};
use crate::{PCCommitmentState, PCUniversalParams, PolynomialCommitment};
use ark_ec::AffineRepr;
use ark_ec::CurveGroup;
use ark_std::string::*;
use ark_std::vec::*;

use ark_ec::pairing::Pairing;
use ark_crypto_primitives::sponge::CryptographicSponge;
use ark_ec::{pairing::Pairing, AffineRepr, CurveGroup};
use ark_ff::{One, UniformRand, Zero};
use ark_std::rand::RngCore;
use ark_std::{convert::TryInto, marker::PhantomData, ops::Div, ops::Mul, vec};
use ark_std::{convert::TryInto, marker::PhantomData, ops::Div, ops::Mul, rand::RngCore};
#[cfg(not(feature = "std"))]
use ark_std::{
string::{String, ToString},
vec::Vec,
};

mod data_structures;
use ark_crypto_primitives::sponge::CryptographicSponge;
pub use data_structures::*;

/// Polynomial commitment based on [[KZG10]][kzg], with degree enforcement and
Expand Down
6 changes: 3 additions & 3 deletions poly-commit/src/streaming_kzg/data_structures.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use crate::streaming_kzg::ceil_div;
use ark_ff::Field;
use ark_std::borrow::Borrow;
use ark_std::vec::*;

use crate::streaming_kzg::ceil_div;
use ark_std::iterable::Iterable;
#[cfg(not(feature = "std"))]
use ark_std::vec::Vec;

/// A `Streamer` folding a vector of coefficients
/// with the given challenges, and producing a stream of items
Expand Down
3 changes: 2 additions & 1 deletion poly-commit/src/streaming_kzg/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ mod time;

use ark_ec::CurveGroup;
use ark_serialize::{CanonicalSerialize, Compress};
use ark_std::vec::*;
#[cfg(not(feature = "std"))]
use ark_std::vec::Vec;
pub use data_structures::*;
pub use space::CommitterKeyStream;
pub use time::CommitterKey;
Expand Down
3 changes: 2 additions & 1 deletion poly-commit/src/streaming_kzg/space.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ use ark_ff::{PrimeField, Zero};
use ark_poly::Polynomial;
use ark_std::borrow::Borrow;
use ark_std::collections::VecDeque;
use ark_std::vec::*;

use crate::streaming_kzg::{ceil_div, vanishing_polynomial, FoldedPolynomialTree};
use ark_ec::scalar_mul::variable_base::{ChunkedPippenger, HashMapPippenger, VariableBaseMSM};
use ark_std::iterable::{Iterable, Reverse};
#[cfg(not(feature = "std"))]
use ark_std::vec::Vec;

use super::{time::CommitterKey, VerifierKey};
use super::{Commitment, EvaluationProof};
Expand Down
3 changes: 2 additions & 1 deletion poly-commit/src/streaming_kzg/tests.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use ark_bls12_381::{Bls12_381, Fr};
use ark_poly::univariate::DensePolynomial;
use ark_poly::DenseUVPolynomial;
use ark_std::vec::*;
use ark_std::{UniformRand, Zero};

use crate::streaming_kzg::space::CommitterKeyStream;
Expand All @@ -10,6 +9,8 @@ use crate::streaming_kzg::{vanishing_polynomial, VerifierKey};
use ark_ff::Field;
use ark_std::borrow::Borrow;
use ark_std::iterable::{Iterable, Reverse};
#[cfg(not(feature = "std"))]
use ark_std::vec::Vec;

/// Polynomial evaluation, assuming that the
/// coefficients are in little-endian.
Expand Down
3 changes: 2 additions & 1 deletion poly-commit/src/streaming_kzg/time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ use ark_ec::scalar_mul::ScalarMul;
use ark_ec::CurveGroup;
use ark_ff::Zero;
use ark_poly::{univariate::DensePolynomial, DenseUVPolynomial};
use ark_std::vec::*;
#[cfg(not(feature = "std"))]
use ark_std::vec::Vec;
use ark_std::{borrow::Borrow, ops::Div, ops::Mul, rand::RngCore, UniformRand};

use crate::streaming_kzg::{
Expand Down

0 comments on commit acdbaae

Please sign in to comment.