From 3e699e7476dc0eeda775b582f5d31eeb9813e76f Mon Sep 17 00:00:00 2001 From: autquis Date: Sun, 7 Apr 2024 16:47:36 +0200 Subject: [PATCH] Further test --- Cargo.toml | 1 + poly-commit/src/constraints.rs | 2 ++ poly-commit/src/data_structures.rs | 2 ++ poly-commit/src/error.rs | 3 +++ poly-commit/src/ipa_pc/mod.rs | 2 ++ poly-commit/src/kzg10/mod.rs | 5 +++-- poly-commit/src/lib.rs | 5 +++++ poly-commit/src/marlin/marlin_pc/data_structures.rs | 6 +++--- poly-commit/src/marlin/marlin_pc/mod.rs | 2 ++ .../src/marlin/marlin_pst13_pc/combinations.rs | 4 ++-- .../src/marlin/marlin_pst13_pc/data_structures.rs | 2 ++ poly-commit/src/marlin/marlin_pst13_pc/mod.rs | 12 +++++++----- poly-commit/src/marlin/mod.rs | 2 ++ poly-commit/src/multilinear_pc/data_structures.rs | 2 ++ poly-commit/src/multilinear_pc/mod.rs | 4 ++++ poly-commit/src/sonic_pc/data_structures.rs | 2 ++ poly-commit/src/sonic_pc/mod.rs | 2 ++ poly-commit/src/streaming_kzg/data_structures.rs | 2 ++ poly-commit/src/streaming_kzg/mod.rs | 2 ++ poly-commit/src/streaming_kzg/space.rs | 2 ++ poly-commit/src/streaming_kzg/tests.rs | 2 ++ poly-commit/src/streaming_kzg/time.rs | 2 ++ 22 files changed, 56 insertions(+), 12 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index bc7f3243..e215af57 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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/" } diff --git a/poly-commit/src/constraints.rs b/poly-commit/src/constraints.rs index 1943a69f..834b6a68 100644 --- a/poly-commit/src/constraints.rs +++ b/poly-commit/src/constraints.rs @@ -8,6 +8,8 @@ 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::{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. diff --git a/poly-commit/src/data_structures.rs b/poly-commit/src/data_structures.rs index c9ab92a8..1b25d693 100644 --- a/poly-commit/src/data_structures.rs +++ b/poly-commit/src/data_structures.rs @@ -7,6 +7,8 @@ use ark_std::{ 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; diff --git a/poly-commit/src/error.rs b/poly-commit/src/error.rs index dcd755a4..6534aaae 100644 --- a/poly-commit/src/error.rs +++ b/poly-commit/src/error.rs @@ -1,3 +1,6 @@ +#[cfg(not(feature = "std"))] +use ark_std::string::String; + /// The error type for `PolynomialCommitment`. #[derive(Debug)] pub enum Error { diff --git a/poly-commit/src/ipa_pc/mod.rs b/poly-commit/src/ipa_pc/mod.rs index 8540d0bb..413cdca5 100644 --- a/poly-commit/src/ipa_pc/mod.rs +++ b/poly-commit/src/ipa_pc/mod.rs @@ -7,6 +7,8 @@ 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}; +#[cfg(not(feature = "std"))] +use ark_std::{string::{String, ToString}, vec::Vec}; mod data_structures; pub use data_structures::*; diff --git a/poly-commit/src/kzg10/mod.rs b/poly-commit/src/kzg10/mod.rs index e0d8e28b..ad1675aa 100644 --- a/poly-commit/src/kzg10/mod.rs +++ b/poly-commit/src/kzg10/mod.rs @@ -11,9 +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::{format, marker::PhantomData, ops::Div, ops::Mul}; - 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::*; diff --git a/poly-commit/src/lib.rs b/poly-commit/src/lib.rs index e1379b76..cc024164 100644 --- a/poly-commit/src/lib.rs +++ b/poly-commit/src/lib.rs @@ -27,6 +27,11 @@ use ark_std::{ hash::Hash, iter::FromIterator, }; +#[cfg(not(feature = "std"))] +use ark_std::{ + string::{String, ToString}, + vec::Vec, +}; /// Data structures used by a polynomial commitment scheme. pub mod data_structures; diff --git a/poly-commit/src/marlin/marlin_pc/data_structures.rs b/poly-commit/src/marlin/marlin_pc/data_structures.rs index 398eeceb..3ed690ca 100644 --- a/poly-commit/src/marlin/marlin_pc/data_structures.rs +++ b/poly-commit/src/marlin/marlin_pc/data_structures.rs @@ -1,3 +1,4 @@ +use crate::kzg10; use crate::{ DenseUVPolynomial, PCCommitment, PCCommitmentState, PCCommitterKey, PCPreparedCommitment, PCPreparedVerifierKey, PCVerifierKey, @@ -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 = kzg10::UniversalParams; diff --git a/poly-commit/src/marlin/marlin_pc/mod.rs b/poly-commit/src/marlin/marlin_pc/mod.rs index 4001e796..04293e7f 100644 --- a/poly-commit/src/marlin/marlin_pc/mod.rs +++ b/poly-commit/src/marlin/marlin_pc/mod.rs @@ -10,6 +10,8 @@ use ark_ff::Zero; use ark_poly::DenseUVPolynomial; use ark_std::rand::RngCore; 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; diff --git a/poly-commit/src/marlin/marlin_pst13_pc/combinations.rs b/poly-commit/src/marlin/marlin_pst13_pc/combinations.rs index 9c009a4f..bc76ea99 100644 --- a/poly-commit/src/marlin/marlin_pst13_pc/combinations.rs +++ b/poly-commit/src/marlin/marlin_pst13_pc/combinations.rs @@ -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 where diff --git a/poly-commit/src/marlin/marlin_pst13_pc/data_structures.rs b/poly-commit/src/marlin/marlin_pst13_pc/data_structures.rs index da17bade..389ce69d 100644 --- a/poly-commit/src/marlin/marlin_pst13_pc/data_structures.rs +++ b/poly-commit/src/marlin/marlin_pst13_pc/data_structures.rs @@ -7,6 +7,8 @@ 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, diff --git a/poly-commit/src/marlin/marlin_pst13_pc/mod.rs b/poly-commit/src/marlin/marlin_pst13_pc/mod.rs index 9f5b7a40..787cf0a5 100644 --- a/poly-commit/src/marlin/marlin_pst13_pc/mod.rs +++ b/poly-commit/src/marlin/marlin_pst13_pc/mod.rs @@ -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, @@ -15,6 +16,10 @@ use ark_ec::{ use ark_ff::{One, PrimeField, UniformRand, Zero}; use ark_poly::{multivariate::Term, DenseMVPolynomial}; 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::*; @@ -22,10 +27,6 @@ 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] @@ -704,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<::ScalarField, SparseTerm>; diff --git a/poly-commit/src/marlin/mod.rs b/poly-commit/src/marlin/mod.rs index 1507ae06..4a9b6176 100644 --- a/poly-commit/src/marlin/mod.rs +++ b/poly-commit/src/marlin/mod.rs @@ -10,6 +10,8 @@ use ark_ec::AffineRepr; use ark_ec::CurveGroup; use ark_ff::{One, Zero}; 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 diff --git a/poly-commit/src/multilinear_pc/data_structures.rs b/poly-commit/src/multilinear_pc/data_structures.rs index 760c2869..c70aae08 100644 --- a/poly-commit/src/multilinear_pc/data_structures.rs +++ b/poly-commit/src/multilinear_pc/data_structures.rs @@ -1,5 +1,7 @@ use ark_ec::pairing::Pairing; use ark_serialize::{CanonicalDeserialize, CanonicalSerialize}; +#[cfg(not(feature = "std"))] +use ark_std::vec::Vec; #[allow(type_alias_bounds)] /// Evaluations over {0,1}^n for G1 pub type EvaluationHyperCubeOnG1 = Vec; diff --git a/poly-commit/src/multilinear_pc/mod.rs b/poly-commit/src/multilinear_pc/mod.rs index 88294427..f75558a1 100644 --- a/poly-commit/src/multilinear_pc/mod.rs +++ b/poly-commit/src/multilinear_pc/mod.rs @@ -8,6 +8,8 @@ use ark_ec::{ }; use ark_ff::{Field, One, PrimeField, Zero}; use ark_poly::{DenseMultilinearExtension, MultilinearExtension}; +#[cfg(not(feature = "std"))] +use ark_std::vec::Vec; use ark_std::{ collections::LinkedList, iter::FromIterator, marker::PhantomData, ops::Mul, rand::RngCore, UniformRand, @@ -241,6 +243,8 @@ mod tests { use ark_poly::{DenseMultilinearExtension, MultilinearExtension, SparseMultilinearExtension}; use ark_std::rand::RngCore; use ark_std::test_rng; + #[cfg(not(feature = "std"))] + use ark_std::vec::Vec; type E = Bls12_381; type Fr = ::ScalarField; diff --git a/poly-commit/src/sonic_pc/data_structures.rs b/poly-commit/src/sonic_pc/data_structures.rs index bcfdf925..92049b04 100644 --- a/poly-commit/src/sonic_pc/data_structures.rs +++ b/poly-commit/src/sonic_pc/data_structures.rs @@ -6,6 +6,8 @@ use ark_serialize::{ CanonicalDeserialize, CanonicalSerialize, Compress, SerializationError, Valid, Validate, }; use ark_std::io::{Read, Write}; +#[cfg(not(feature = "std"))] +use ark_std::vec::Vec; /// `UniversalParams` are the universal parameters for the KZG10 scheme. pub type UniversalParams = kzg10::UniversalParams; diff --git a/poly-commit/src/sonic_pc/mod.rs b/poly-commit/src/sonic_pc/mod.rs index 84b2549a..9f7cdbc0 100644 --- a/poly-commit/src/sonic_pc/mod.rs +++ b/poly-commit/src/sonic_pc/mod.rs @@ -7,6 +7,8 @@ use ark_crypto_primitives::sponge::CryptographicSponge; use ark_ec::{pairing::Pairing, AffineRepr, CurveGroup}; use ark_ff::{One, UniformRand, Zero}; 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; pub use data_structures::*; diff --git a/poly-commit/src/streaming_kzg/data_structures.rs b/poly-commit/src/streaming_kzg/data_structures.rs index 8594d6bc..7a09141a 100644 --- a/poly-commit/src/streaming_kzg/data_structures.rs +++ b/poly-commit/src/streaming_kzg/data_structures.rs @@ -2,6 +2,8 @@ use crate::streaming_kzg::ceil_div; use ark_ff::Field; use ark_std::borrow::Borrow; 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 diff --git a/poly-commit/src/streaming_kzg/mod.rs b/poly-commit/src/streaming_kzg/mod.rs index ff0ee6e1..14d686c2 100644 --- a/poly-commit/src/streaming_kzg/mod.rs +++ b/poly-commit/src/streaming_kzg/mod.rs @@ -88,6 +88,8 @@ mod time; use ark_ec::CurveGroup; use ark_serialize::{CanonicalSerialize, Compress}; +#[cfg(not(feature = "std"))] +use ark_std::vec::Vec; pub use data_structures::*; pub use space::CommitterKeyStream; pub use time::CommitterKey; diff --git a/poly-commit/src/streaming_kzg/space.rs b/poly-commit/src/streaming_kzg/space.rs index e8ac3d21..4fa2a9eb 100644 --- a/poly-commit/src/streaming_kzg/space.rs +++ b/poly-commit/src/streaming_kzg/space.rs @@ -8,6 +8,8 @@ use ark_std::collections::VecDeque; 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}; diff --git a/poly-commit/src/streaming_kzg/tests.rs b/poly-commit/src/streaming_kzg/tests.rs index c399cef7..8d5da658 100644 --- a/poly-commit/src/streaming_kzg/tests.rs +++ b/poly-commit/src/streaming_kzg/tests.rs @@ -9,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. diff --git a/poly-commit/src/streaming_kzg/time.rs b/poly-commit/src/streaming_kzg/time.rs index b6aa3d14..ff14d6cd 100644 --- a/poly-commit/src/streaming_kzg/time.rs +++ b/poly-commit/src/streaming_kzg/time.rs @@ -5,6 +5,8 @@ use ark_ec::scalar_mul::ScalarMul; use ark_ec::CurveGroup; use ark_ff::Zero; use ark_poly::{univariate::DensePolynomial, DenseUVPolynomial}; +#[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::{