From aa0b627aad5b6ff7f00b162b3b323461d2621c1c Mon Sep 17 00:00:00 2001 From: Pratyush Mishra Date: Mon, 19 Oct 2020 20:29:30 -0700 Subject: [PATCH] Update to `arkworks` libraries --- Cargo.toml | 26 +++++++++++------- scripts/install-hook.sh | 9 +++++++ src/data_structures.rs | 12 ++++----- src/error.rs | 2 +- src/ipa_pc/data_structures.rs | 12 +++++---- src/ipa_pc/mod.rs | 46 +++++++++++++++----------------- src/kzg10/data_structures.rs | 15 ++++++----- src/kzg10/mod.rs | 21 ++++++++------- src/lib.rs | 25 +++++------------ src/marlin_pc/data_structures.rs | 7 ++--- src/marlin_pc/mod.rs | 9 ++++--- src/sonic_pc/data_structures.rs | 2 +- src/sonic_pc/mod.rs | 8 +++--- 13 files changed, 102 insertions(+), 92 deletions(-) create mode 100755 scripts/install-hook.sh diff --git a/Cargo.toml b/Cargo.toml index 5c8dd380..f13bdc4c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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 ", "Mary Maller ", @@ -9,10 +9,11 @@ authors = [ "Pratyush Mishra ", "Noah Vesely ", "Nicholas Ward ", + "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"] @@ -20,9 +21,12 @@ license = "MIT/Apache-2.0" edition = "2018" [dependencies] -algebra-core = { git = "https://github.com/scipr-lab/zexe", version = "0.1.1-alpha.0", default-features = false } -ff-fft = { git = "https://github.com/scipr-lab/zexe", version = "0.1.1-alpha.0", 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 } @@ -30,7 +34,9 @@ derivative = { version = "2", features = [ "use_core" ] } [dev-dependencies] rand = { version = "0.7", default-features = false } -algebra = { git = "https://github.com/scipr-lab/zexe", version = "0.1.1-alpha.0", 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 } [profile.release] @@ -47,6 +53,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" ] diff --git a/scripts/install-hook.sh b/scripts/install-hook.sh new file mode 100755 index 00000000..eafcf818 --- /dev/null +++ b/scripts/install-hook.sh @@ -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" diff --git a/src/data_structures.rs b/src/data_structures.rs index df25cd1b..c62ae65e 100644 --- a/src/data_structures.rs +++ b/src/data_structures.rs @@ -1,8 +1,8 @@ use crate::{Cow, String, Vec}; -use algebra_core::Field; +use ark_ff::Field; +pub use ark_poly::DensePolynomial as Polynomial; use core::borrow::Borrow; use core::ops::{AddAssign, MulAssign, SubAssign}; -pub use ff_fft::DensePolynomial as Polynomial; use rand_core::RngCore; /// Labels a `LabeledPolynomial` or a `LabeledCommitment`. @@ -39,7 +39,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; @@ -65,7 +65,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; } @@ -186,9 +186,9 @@ impl LabeledCommitment { } } -impl algebra_core::ToBytes for LabeledCommitment { +impl ark_ff::ToBytes for LabeledCommitment { #[inline] - fn write(&self, writer: W) -> algebra_core::io::Result<()> { + fn write(&self, writer: W) -> ark_std::io::Result<()> { self.commitment.write(writer) } } diff --git a/src/error.rs b/src/error.rs index 5bef28f6..af65c9ea 100644 --- a/src/error.rs +++ b/src/error.rs @@ -160,4 +160,4 @@ impl core::fmt::Display for Error { } } -impl algebra_core::Error for Error {} +impl ark_std::error::Error for Error {} diff --git a/src/ipa_pc/data_structures.rs b/src/ipa_pc/data_structures.rs index 09a318cf..b5efd58e 100644 --- a/src/ipa_pc/data_structures.rs +++ b/src/ipa_pc/data_structures.rs @@ -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 PCCommitment for Commitment { } 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 ToBytes for Commitment { #[inline] - fn write(&self, mut writer: W) -> algebra_core::io::Result<()> { + fn 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 { impl PCProof for Proof { fn size_in_bytes(&self) -> usize { - algebra_core::to_bytes![self].unwrap().len() + ark_ff::to_bytes![self].unwrap().len() } } impl ToBytes for Proof { #[inline] - fn write(&self, mut writer: W) -> algebra_core::io::Result<()> { + fn 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)?; diff --git a/src/ipa_pc/mod.rs b/src/ipa_pc/mod.rs index 19ad3980..1a08a90c 100644 --- a/src/ipa_pc/mod.rs +++ b/src/ipa_pc/mod.rs @@ -3,10 +3,9 @@ use crate::{BatchLCProof, Error, Evaluations, QuerySet}; use crate::{LabeledCommitment, LabeledPolynomial, LinearCombination}; use crate::{PCCommitterKey, PCRandomness, PCUniversalParams, Polynomial, PolynomialCommitment}; -use algebra_core::{ - to_bytes, AffineCurve, Field, One, PrimeField, ProjectiveCurve, UniformRand, VariableBaseMSM, - Zero, -}; +use ark_ec::{msm::VariableBaseMSM, AffineCurve, ProjectiveCurve}; +use ark_ff::{to_bytes, Field, One, PrimeField, UniformRand, Zero}; +use ark_std::{format, vec}; use core::{convert::TryInto, marker::PhantomData}; use rand_core::RngCore; @@ -48,7 +47,7 @@ impl InnerProductArgPC { hiding_generator: Option, randomizer: Option, ) -> G::Projective { - let scalars_bigint = ff_fft::cfg_iter!(scalars) + let scalars_bigint = ark_std::cfg_iter!(scalars) .map(|s| s.into_repr()) .collect::>(); @@ -66,7 +65,7 @@ impl InnerProductArgPC { let mut i = 0u64; let mut challenge = None; while challenge.is_none() { - let hash_input = algebra_core::to_bytes![bytes, i].unwrap(); + let hash_input = ark_ff::to_bytes![bytes, i].unwrap(); let hash = D::digest(&hash_input); challenge = ::from_random_bytes(&hash); @@ -78,7 +77,7 @@ impl InnerProductArgPC { #[inline] fn inner_product(l: &[G::ScalarField], r: &[G::ScalarField]) -> G::ScalarField { - ff_fft::cfg_iter!(l).zip(r).map(|(li, ri)| *li * ri).sum() + ark_std::cfg_iter!(l).zip(r).map(|(li, ri)| *li * ri).sum() } /// The succinct portion of `PC::check`. This algorithm runs in time @@ -96,7 +95,7 @@ impl InnerProductArgPC { let d = vk.supported_degree(); // `log_d` is ceil(log2 (d + 1)), which is the number of steps to compute all of the challenges - let log_d = algebra_core::log2(d + 1) as usize; + let log_d = ark_std::log2(d + 1) as usize; let mut combined_commitment_proj = G::Projective::zero(); let mut combined_v = G::ScalarField::zero(); @@ -131,8 +130,7 @@ impl InnerProductArgPC { let rand = proof.rand.unwrap(); let hiding_challenge = Self::compute_random_oracle_challenge( - &algebra_core::to_bytes![combined_commitment, point, combined_v, hiding_comm] - .unwrap(), + &ark_ff::to_bytes![combined_commitment, point, combined_v, hiding_comm].unwrap(), ); combined_commitment_proj += &(hiding_comm.mul(hiding_challenge) - &vk.s.mul(rand)); combined_commitment = combined_commitment_proj.into_affine(); @@ -141,7 +139,7 @@ impl InnerProductArgPC { // Challenge for each round let mut round_challenges = Vec::with_capacity(log_d); let mut round_challenge = Self::compute_random_oracle_challenge( - &algebra_core::to_bytes![combined_commitment, point, combined_v].unwrap(), + &ark_ff::to_bytes![combined_commitment, point, combined_v].unwrap(), ); let h_prime = vk.h.mul(round_challenge); @@ -153,7 +151,7 @@ impl InnerProductArgPC { for (l, r) in l_iter.zip(r_iter) { round_challenge = Self::compute_random_oracle_challenge( - &algebra_core::to_bytes![round_challenge, l, r].unwrap(), + &ark_ff::to_bytes![round_challenge, l, r].unwrap(), ); round_challenges.push(round_challenge); round_commitment_proj += @@ -284,7 +282,7 @@ impl InnerProductArgPC { } fn sample_generators(num_generators: usize) -> Vec { - let generators: Vec<_> = ff_fft::cfg_into_iter!(0..num_generators) + let generators: Vec<_> = ark_std::cfg_into_iter!(0..num_generators) .map(|i| { let i = i as u64; let mut hash = D::digest(&to_bytes![&Self::PROTOCOL_NAME, i].unwrap()); @@ -530,7 +528,7 @@ impl PolynomialCommitment for InnerPr let d = ck.supported_degree(); // `log_d` is ceil(log2 (d + 1)), which is the number of steps to compute all of the challenges - let log_d = algebra_core::log2(d + 1) as usize; + let log_d = ark_std::log2(d + 1) as usize; let mut combined_commitment; let mut hiding_commitment = None; @@ -558,7 +556,7 @@ impl PolynomialCommitment for InnerPr combined_commitment = batch.pop().unwrap(); let hiding_challenge = Self::compute_random_oracle_challenge( - &algebra_core::to_bytes![ + &ark_ff::to_bytes![ combined_commitment, point, combined_v, @@ -587,7 +585,7 @@ impl PolynomialCommitment for InnerPr // ith challenge let mut round_challenge = Self::compute_random_oracle_challenge( - &algebra_core::to_bytes![combined_commitment, point, combined_v].unwrap(), + &ark_ff::to_bytes![combined_commitment, point, combined_v].unwrap(), ); let h_prime = ck.h.mul(round_challenge).into_affine(); @@ -641,19 +639,19 @@ impl PolynomialCommitment for InnerPr r_vec.push(lr[1]); round_challenge = Self::compute_random_oracle_challenge( - &algebra_core::to_bytes![round_challenge, lr[0], lr[1]].unwrap(), + &ark_ff::to_bytes![round_challenge, lr[0], lr[1]].unwrap(), ); let round_challenge_inv = round_challenge.inverse().unwrap(); - ff_fft::cfg_iter_mut!(coeffs_l) + ark_std::cfg_iter_mut!(coeffs_l) .zip(coeffs_r) - .for_each(|(c_l, c_r)| *c_l += &(round_challenge_inv * &c_r)); + .for_each(|(c_l, c_r)| *c_l += &(round_challenge_inv * &*c_r)); - ff_fft::cfg_iter_mut!(z_l) + ark_std::cfg_iter_mut!(z_l) .zip(z_r) - .for_each(|(z_l, z_r)| *z_l += &(round_challenge * &z_r)); + .for_each(|(z_l, z_r)| *z_l += &(round_challenge * &*z_r)); - ff_fft::cfg_iter_mut!(key_proj_l) + ark_std::cfg_iter_mut!(key_proj_l) .zip(key_r) .for_each(|(k_l, k_r)| *k_l += &(k_r.mul(round_challenge))); @@ -695,7 +693,7 @@ impl PolynomialCommitment for InnerPr let d = vk.supported_degree(); // `log_d` is ceil(log2 (d + 1)), which is the number of steps to compute all of the challenges - let log_d = algebra_core::log2(d + 1) as usize; + let log_d = ark_std::log2(d + 1) as usize; if proof.l_vec.len() != proof.r_vec.len() || proof.l_vec.len() != log_d { return Err(Error::IncorrectInputLength( @@ -1016,7 +1014,7 @@ mod tests { use super::InnerProductArgPC; - use algebra::ed_on_bls12_381::EdwardsAffine; + use ark_ed_on_bls12_381::EdwardsAffine; use blake2::Blake2s; type PC = InnerProductArgPC; diff --git a/src/kzg10/data_structures.rs b/src/kzg10/data_structures.rs index 67208159..0d117997 100644 --- a/src/kzg10/data_structures.rs +++ b/src/kzg10/data_structures.rs @@ -1,5 +1,6 @@ use crate::*; -use algebra_core::{AffineCurve, PairingEngine, PrimeField, ProjectiveCurve, ToBytes, Zero}; +use ark_ec::{AffineCurve, PairingEngine, ProjectiveCurve}; +use ark_ff::{PrimeField, ToBytes, Zero}; use core::ops::{Add, AddAssign}; /// `UniversalParams` are the universal parameters for the KZG10 scheme. @@ -75,7 +76,7 @@ pub struct VerifierKey { impl ToBytes for VerifierKey { #[inline] - fn write(&self, mut writer: W) -> algebra_core::io::Result<()> { + fn write(&self, mut writer: W) -> ark_std::io::Result<()> { self.g.write(&mut writer)?; self.gamma_g.write(&mut writer)?; self.h.write(&mut writer)?; @@ -103,7 +104,7 @@ pub struct Commitment( impl ToBytes for Commitment { #[inline] - fn write(&self, writer: W) -> algebra_core::io::Result<()> { + fn write(&self, writer: W) -> ark_std::io::Result<()> { self.0.write(writer) } } @@ -119,7 +120,7 @@ impl PCCommitment for Commitment { } fn size_in_bytes(&self) -> usize { - algebra_core::to_bytes![E::G1Affine::zero()].unwrap().len() / 2 + ark_ff::to_bytes![E::G1Affine::zero()].unwrap().len() / 2 } } @@ -233,17 +234,17 @@ pub struct Proof { impl PCProof for Proof { fn size_in_bytes(&self) -> usize { let hiding_size = if self.random_v.is_some() { - algebra_core::to_bytes![E::Fr::zero()].unwrap().len() + ark_ff::to_bytes![E::Fr::zero()].unwrap().len() } else { 0 }; - algebra_core::to_bytes![E::G1Affine::zero()].unwrap().len() / 2 + hiding_size + ark_ff::to_bytes![E::G1Affine::zero()].unwrap().len() / 2 + hiding_size } } impl ToBytes for Proof { #[inline] - fn write(&self, mut writer: W) -> algebra_core::io::Result<()> { + fn write(&self, mut writer: W) -> ark_std::io::Result<()> { self.w.write(&mut writer)?; self.random_v .as_ref() diff --git a/src/kzg10/mod.rs b/src/kzg10/mod.rs index 93d39ed0..5da40022 100644 --- a/src/kzg10/mod.rs +++ b/src/kzg10/mod.rs @@ -6,14 +6,15 @@ //! This construction achieves extractability in the algebraic group model (AGM). use crate::{BTreeMap, Error, LabeledPolynomial, PCRandomness, Polynomial, ToString, Vec}; -use algebra_core::msm::{FixedBaseMSM, VariableBaseMSM}; -use algebra_core::{ - AffineCurve, Group, One, PairingEngine, PrimeField, ProjectiveCurve, UniformRand, Zero, -}; +use ark_ec::msm::{FixedBaseMSM, VariableBaseMSM}; +use ark_ec::{group::Group, AffineCurve, PairingEngine, ProjectiveCurve}; +use ark_ff::{One, PrimeField, UniformRand, Zero}; + use rand_core::RngCore; #[cfg(feature = "parallel")] use rayon::prelude::*; +use ark_std::{format, vec}; use core::marker::PhantomData; mod data_structures; @@ -341,7 +342,7 @@ impl KZG10 { let mut temp = w.mul(*z); temp.add_assign_mixed(&c.0); let c = temp; - g_multiplier += &(randomizer * &v); + g_multiplier += &(randomizer * v); if let Some(random_v) = proof.random_v { gamma_g_multiplier += &(randomizer * &random_v); } @@ -457,7 +458,7 @@ fn skip_leading_zeros_and_convert_to_bigints( fn convert_to_bigints(p: &[F]) -> Vec { let to_bigint_time = start_timer!(|| "Converting polynomial coeffs to bigints"); - let coeffs = ff_fft::cfg_iter!(p) + let coeffs = ark_std::cfg_iter!(p) .map(|s| s.into_repr()) .collect::>(); end_timer!(to_bigint_time); @@ -470,10 +471,10 @@ mod tests { use crate::kzg10::*; use crate::*; - use algebra::bls12_381::Fr; - use algebra::test_rng; - use algebra::Bls12_377; - use algebra::Bls12_381; + use ark_bls12_377::Bls12_377; + use ark_bls12_381::Bls12_381; + use ark_bls12_381::Fr; + use ark_ff::test_rng; type KZG_Bls12_381 = KZG10; diff --git a/src/lib.rs b/src/lib.rs index b1a9e486..581a4de0 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -15,27 +15,14 @@ extern crate derivative; #[macro_use] extern crate bench_utils; -use algebra_core::Field; -use core::iter::FromIterator; -pub use ff_fft::DensePolynomial as Polynomial; +use ark_ff::Field; +pub use ark_poly::DensePolynomial as Polynomial; use rand_core::RngCore; -#[cfg(not(feature = "std"))] -#[macro_use] -extern crate alloc; - -#[cfg(not(feature = "std"))] -use alloc::{ - borrow::Cow, - collections::{BTreeMap, BTreeSet}, - string::{String, ToString}, - vec::Vec, -}; - -#[cfg(feature = "std")] -use std::{ +use ark_std::{ borrow::Cow, collections::{BTreeMap, BTreeSet}, + iter::FromIterator, string::{String, ToString}, vec::Vec, }; @@ -131,7 +118,7 @@ pub trait PolynomialCommitment: Sized { /// The evaluation proof for a query set. type BatchProof: Clone + From> + Into>; /// The error type for the scheme. - type Error: algebra_core::Error + From; + type Error: ark_std::error::Error + From; /// Constructs public parameters when given as input the maximum degree `degree` /// for the polynomial commitment scheme. @@ -477,7 +464,7 @@ fn lc_query_set_to_poly_query_set<'a, F: 'a + Field>( #[cfg(test)] pub mod tests { use crate::*; - use algebra::{test_rng, Field}; + use ark_ff::{test_rng, Field}; use rand::{distributions::Distribution, Rng}; #[derive(Default)] diff --git a/src/marlin_pc/data_structures.rs b/src/marlin_pc/data_structures.rs index 6da9377f..68d00964 100644 --- a/src/marlin_pc/data_structures.rs +++ b/src/marlin_pc/data_structures.rs @@ -1,5 +1,6 @@ use crate::{PCCommitment, PCCommitterKey, PCRandomness, PCVerifierKey, Vec}; -use algebra_core::{PairingEngine, ToBytes}; +use ark_ec::PairingEngine; +use ark_ff::ToBytes; use core::ops::{Add, AddAssign}; use rand_core::RngCore; @@ -128,7 +129,7 @@ impl PCVerifierKey for VerifierKey { impl ToBytes for VerifierKey { #[inline] - fn write(&self, mut writer: W) -> algebra_core::io::Result<()> { + fn write(&self, mut writer: W) -> ark_std::io::Result<()> { self.vk.write(&mut writer)?; if let Some(degree_bounds_and_shift_powers) = &self.degree_bounds_and_shift_powers { writer.write_all(°ree_bounds_and_shift_powers.len().to_le_bytes())?; @@ -165,7 +166,7 @@ pub struct Commitment { impl ToBytes for Commitment { #[inline] - fn write(&self, mut writer: W) -> algebra_core::io::Result<()> { + fn 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)?; diff --git a/src/marlin_pc/mod.rs b/src/marlin_pc/mod.rs index 96c47ee5..753ba7c2 100644 --- a/src/marlin_pc/mod.rs +++ b/src/marlin_pc/mod.rs @@ -4,7 +4,9 @@ use crate::{BatchLCProof, Error, Evaluations, QuerySet}; use crate::{LabeledCommitment, LabeledPolynomial, LinearCombination}; use crate::{PCRandomness, PCUniversalParams, Polynomial, PolynomialCommitment}; -use algebra_core::{AffineCurve, Field, One, PairingEngine, ProjectiveCurve, Zero}; +use ark_ec::{AffineCurve, PairingEngine, ProjectiveCurve}; +use ark_ff::{Field, One, Zero}; +use ark_std::vec; use core::{convert::TryInto, marker::PhantomData}; use rand_core::RngCore; @@ -704,8 +706,9 @@ mod tests { #![allow(non_camel_case_types)] use super::MarlinKZG10; - use algebra::Bls12_377; - use algebra::Bls12_381; + + use ark_bls12_377::Bls12_377; + use ark_bls12_381::Bls12_381; type PC = MarlinKZG10; type PC_Bls12_381 = PC; diff --git a/src/sonic_pc/data_structures.rs b/src/sonic_pc/data_structures.rs index c4030f32..6b5f3a4e 100644 --- a/src/sonic_pc/data_structures.rs +++ b/src/sonic_pc/data_structures.rs @@ -1,6 +1,6 @@ use crate::kzg10; use crate::{BTreeMap, PCCommitterKey, PCVerifierKey, Vec}; -use algebra_core::PairingEngine; +use ark_ec::PairingEngine; /// `UniversalParams` are the universal parameters for the KZG10 scheme. pub type UniversalParams = kzg10::UniversalParams; diff --git a/src/sonic_pc/mod.rs b/src/sonic_pc/mod.rs index 4e0e615c..ed6b5b19 100644 --- a/src/sonic_pc/mod.rs +++ b/src/sonic_pc/mod.rs @@ -4,7 +4,9 @@ use crate::{BatchLCProof, Error, Evaluations, QuerySet}; use crate::{LabeledCommitment, LabeledPolynomial, LinearCombination}; use crate::{PCRandomness, PCUniversalParams, Polynomial, PolynomialCommitment}; -use algebra_core::{AffineCurve, One, PairingEngine, ProjectiveCurve, UniformRand, Zero}; +use ark_ec::{AffineCurve, PairingEngine, ProjectiveCurve}; +use ark_ff::{One, UniformRand, Zero}; +use ark_std::vec; use core::{convert::TryInto, marker::PhantomData}; use rand_core::RngCore; @@ -659,8 +661,8 @@ mod tests { #![allow(non_camel_case_types)] use super::SonicKZG10; - use algebra::Bls12_377; - use algebra::Bls12_381; + use ark_bls12_377::Bls12_377; + use ark_bls12_381::Bls12_381; type PC = SonicKZG10; type PC_Bls12_377 = PC;