arnaucube
arnaucube/ark-r1cs-stdPublic Self-hosted repository
Import AdditiveGroup. (#122)

Co-authored-by: mmagician <marcin.gorny.94@protonmail.com>
Co-authored-by: Pratyush Mishra <pratyushmishra@berkeley.edu>
Michele Orrù maker@python.it
Sat, 19 Aug 2023 21:53:45 +0200
commit

529c8dc29e1126c3b8c3fc65c846f28f93bd6561

parent

f85e92d685a87cf1d6008dfe1c772237565749d5

M Cargo.toml → Cargo.toml

@@ -10,7 +10,8 @@ keywords = ["zero-knowledge", "cryptography", "zkSNARK", "SNARK", "r1cs"]

categories = ["cryptography"] include = ["Cargo.toml", "src", "README.md", "LICENSE-APACHE", "LICENSE-MIT"] license = "MIT/Apache-2.0" -edition = "2018" +edition = "2021" +resolver = "2" [dependencies] ark-ff = { version = "0.4.0", default-features = false }

@@ -20,8 +21,8 @@ ark-relations = { version = "0.4.0", default-features = false }

derivative = { version = "2", features = ["use_core"] } tracing = { version = "0.1", default-features = false, features = [ "attributes" ] } -num-bigint = {version = "0.4", default-features = false } -num-traits = {version = "0.2", default-features = false } +num-bigint = { version = "0.4", default-features = false } +num-traits = { version = "0.2", default-features = false } num-integer = { version = "0.1.44", default-features = false } [dev-dependencies]

@@ -70,3 +71,17 @@ lto = "thin"

incremental = true debug-assertions = true debug = true + +[patch.crates-io] +ark-ff = { git = "https://github.com/arkworks-rs/algebra/" } +ark-ec = { 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-test-curves = { git = "https://github.com/arkworks-rs/algebra/" } +ark-bls12-377 = { git = "https://github.com/arkworks-rs/curves/" } +ark-bls12-381 = { git = "https://github.com/arkworks-rs/curves/" } +ark-mnt4-298 = { git = "https://github.com/arkworks-rs/curves/" } +ark-mnt4-753 = { git = "https://github.com/arkworks-rs/curves/" } +ark-mnt6-298 = { git = "https://github.com/arkworks-rs/curves/" } +ark-mnt6-753 = { git = "https://github.com/arkworks-rs/curves/" } +ark-pallas = { git = "https://github.com/arkworks-rs/curves/" }
M src/bits/boolean.rs → src/bits/boolean.rs

@@ -956,7 +956,9 @@ #[cfg(test)]

mod test { use super::{AllocatedBool, Boolean}; use crate::prelude::*; - use ark_ff::{BitIteratorBE, BitIteratorLE, Field, One, PrimeField, UniformRand, Zero}; + use ark_ff::{ + AdditiveGroup, BitIteratorBE, BitIteratorLE, Field, One, PrimeField, UniformRand, Zero, + }; use ark_relations::r1cs::{ConstraintSystem, Namespace, SynthesisError}; use ark_test_curves::bls12_381::Fr;
M src/groups/curves/short_weierstrass/mod.rs → src/groups/curves/short_weierstrass/mod.rs

@@ -4,7 +4,7 @@ Affine as SWAffine, Projective as SWProjective, SWCurveConfig as SWModelParameters,

}, AffineRepr, CurveGroup, }; -use ark_ff::{BigInteger, BitIteratorBE, Field, One, PrimeField, Zero}; +use ark_ff::{AdditiveGroup, BigInteger, BitIteratorBE, Field, One, PrimeField, Zero}; use ark_relations::r1cs::{ConstraintSystemRef, Namespace, SynthesisError}; use ark_std::{borrow::Borrow, marker::PhantomData, ops::Mul}; use non_zero_affine::NonZeroAffineVar;

@@ -838,7 +838,7 @@

let (mut ge, iter) = if cofactor_weight < modulus_minus_1_weight { let ge = Self::new_variable_omit_prime_order_check( ark_relations::ns!(cs, "Witness without subgroup check with cofactor mul"), - || f().map(|g| g.borrow().into_affine().mul_by_cofactor_inv().into()), + || f().map(|g| g.into_affine().mul_by_cofactor_inv().into()), mode, )?; (
M src/groups/curves/short_weierstrass/non_zero_affine.rs → src/groups/curves/short_weierstrass/non_zero_affine.rs

@@ -1,5 +1,5 @@

use super::*; -use ark_ec::Group; +use ark_ec::AdditiveGroup; use ark_std::ops::Add; /// An affine representation of a prime order curve point that is guaranteed
M src/groups/curves/twisted_edwards/mod.rs → src/groups/curves/twisted_edwards/mod.rs

@@ -3,7 +3,7 @@ twisted_edwards::{

Affine as TEAffine, MontCurveConfig as MontgomeryModelParameter, Projective as TEProjective, TECurveConfig as TEModelParameters, }, - AffineRepr, CurveGroup, Group, + AdditiveGroup, AffineRepr, CurveGroup, }; use ark_ff::{BigInteger, BitIteratorBE, Field, One, PrimeField, Zero}; use ark_relations::r1cs::{ConstraintSystemRef, Namespace, SynthesisError};

@@ -337,7 +337,6 @@ .borrow()

.iter() .zip(segment_powers.borrow()) { - let base_power = base_power.borrow(); let mut acc_power = *base_power; let mut coords = vec![]; for _ in 0..4 {

@@ -609,7 +608,7 @@

let (mut ge, iter) = if cofactor_weight < modulus_minus_1_weight { let ge = Self::new_variable_omit_prime_order_check( ark_relations::ns!(cs, "Witness without subgroup check with cofactor mul"), - || f().map(|g| g.borrow().into_affine().mul_by_cofactor_inv().into()), + || f().map(|g| g.into_affine().mul_by_cofactor_inv().into()), mode, )?; (