From 953740b843326f02cb45d1c370e836cfefee38b1 Mon Sep 17 00:00:00 2001 From: dmpierre Date: Wed, 27 Aug 2025 15:02:00 +0200 Subject: [PATCH] chore: update deps and imports --- Cargo.toml | 33 ++++++++++++------- aggregator/Cargo.toml | 2 +- aggregator/src/circuit.rs | 6 ++-- client/Cargo.toml | 2 +- client/src/circuits/mod.rs | 4 +-- client/src/lib.rs | 2 +- client/tests/web.rs | 4 +-- mock-contract/Cargo.toml | 2 +- plasma-fold/Cargo.toml | 2 +- plasma-fold/src/circuits/gadgets/mod.rs | 4 +-- .../src/datastructures/block/constraints.rs | 6 ++-- .../src/datastructures/keypair/constraints.rs | 4 +-- .../src/datastructures/noncemap/mod.rs | 2 +- .../src/datastructures/publickeymap/mod.rs | 2 +- .../datastructures/transaction/constraints.rs | 12 ++----- .../src/datastructures/transaction/mod.rs | 2 +- .../src/datastructures/user/constraints.rs | 6 ++-- .../src/datastructures/utxo/constraints.rs | 2 +- .../src/primitives/accumulator/constraints.rs | 7 ++-- plasma-fold/src/primitives/crh/constraints.rs | 10 +++--- plasma-fold/src/primitives/crh/mod.rs | 4 +-- plasma-fold/src/primitives/schnorr.rs | 6 ++-- .../src/primitives/sparsemt/constraints.rs | 6 ++-- 23 files changed, 69 insertions(+), 61 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index f14f18d..c0f02f0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,18 +3,29 @@ resolver = "2" members = [ "aggregator","plasma-fold", "client", "mock-contract" ] [workspace.dependencies] -folding-schemes = { git = "https://github.com/privacy-scaling-explorations/sonobe", rev = "fc91430" } -ark-ff = { version = "0.5.0" } -ark-bn254 = { version = "0.5.0" } -ark-grumpkin = { version = "0.5.0" } -ark-r1cs-std = { version = "0.5.0" } -ark-relations = { version = "0.5.0" } -ark-crypto-primitives = { version = "0.5.0" } -ark-std = "0.5.0" -ark-serialize = "0.5.0" -ark-ec = "0.5.0" +folding-schemes = { git = "https://github.com/privacy-scaling-explorations/sonobe", rev = "9b7dd34" } +ark-ff = { version = "^0.5.0"} +ark-bn254 = { version = "^0.5.0"} +ark-grumpkin = { version = "^0.5.0"} +ark-r1cs-std = { version = "^0.5.0" } +ark-relations = { version = "^0.5.0"} +ark-crypto-primitives = { version = "^0.5.0" } +ark-std = { version = "^0.5.0"} +ark-serialize = { version = "^0.5.0"} +ark-ec = { version = "^0.5.0" } num = "0.4.0" thiserror = "2.0.12" [patch.crates-io] -ark-r1cs-std = { git = "https://github.com/yelhousni/r1cs-std", rev = "440ca3" } +ark-ff = { git = "https://github.com/arkworks-rs/algebra" } +ark-bn254 = { git = "https://github.com/arkworks-rs/algebra" } +ark-grumpkin = { git = "https://github.com/arkworks-rs/algebra" } +ark-r1cs-std = { git = "https://github.com/flyingnobita/r1cs-std_yelhousni", rev = "b4bab0c" } # "perf/sw-updated" branch +ark-relations = { git = "https://github.com/arkworks-rs/snark" } +ark-crypto-primitives = { git = "https://github.com/flyingnobita/crypto-primitives", rev = "f559264" } +ark-std = { git = "https://github.com/arkworks-rs/std" } +ark-serialize = { git = "https://github.com/arkworks-rs/algebra" } +ark-ec = { git = "https://github.com/arkworks-rs/algebra" } +ark-snark = { git = "https://github.com/arkworks-rs/snark" } +ark-groth16 = { git = "https://github.com/arkworks-rs/groth16", rev = "b3b4a15" } + diff --git a/aggregator/Cargo.toml b/aggregator/Cargo.toml index d0a9017..9a666a3 100644 --- a/aggregator/Cargo.toml +++ b/aggregator/Cargo.toml @@ -10,7 +10,7 @@ folding-schemes = { workspace = true } ark-r1cs-std = { workspace = true } ark-ff = { workspace = true } ark-relations = { workspace = true } -ark-crypto-primitives = { workspace = true, features = ["r1cs", "crh", "sponge"] } +ark-crypto-primitives = { workspace = true, features = ["constraints", "crh", "sponge"] } ark-bn254 = { workspace = true, features = ["r1cs"] } ark-grumpkin = { workspace = true, features = ["r1cs"] } ark-std = { workspace = true } diff --git a/aggregator/src/circuit.rs b/aggregator/src/circuit.rs index d9aad20..65f88b9 100644 --- a/aggregator/src/circuit.rs +++ b/aggregator/src/circuit.rs @@ -15,9 +15,9 @@ use ark_r1cs_std::{ groups::CurveVar, prelude::Boolean, uint8::UInt8, - R1CSVar, + GR1CSVar, }; -use ark_relations::r1cs::{ConstraintSystemRef, Namespace, SynthesisError}; +use ark_relations::gr1cs::{ConstraintSystemRef, Namespace, SynthesisError}; use folding_schemes::frontend::FCircuit; use plasma_fold::{ datastructures::{ @@ -443,7 +443,7 @@ mod tests { use ark_bn254::{Fr, G1Projective as Projective}; use ark_ff::UniformRand; use ark_grumpkin::{constraints::GVar, Projective as Projective2}; - use ark_relations::r1cs::ConstraintSystem; + use ark_relations::gr1cs::ConstraintSystem; use ark_serialize::CanonicalSerialize; use ark_std::rand::thread_rng; use folding_schemes::{ diff --git a/client/Cargo.toml b/client/Cargo.toml index dc95821..0b14910 100644 --- a/client/Cargo.toml +++ b/client/Cargo.toml @@ -15,7 +15,7 @@ plasma-fold = { path = "../plasma-fold/" } ark-ec = { workspace = true } ark-ff = { workspace = true } ark-std = { workspace = true } -ark-crypto-primitives = { workspace = true, features = ["r1cs", "crh", "sponge"] } +ark-crypto-primitives = { workspace = true, features = ["constraints", "crh", "sponge"] } ark-bn254 = { workspace = true } console_error_panic_hook = { version = "0.1.7", optional = true } ark-grumpkin = { workspace = true } diff --git a/client/src/circuits/mod.rs b/client/src/circuits/mod.rs index 6d0fbfa..0e03fec 100644 --- a/client/src/circuits/mod.rs +++ b/client/src/circuits/mod.rs @@ -8,7 +8,7 @@ use ark_crypto_primitives::{ }; use ark_ec::CurveGroup; use ark_r1cs_std::{alloc::AllocVar, prelude::Boolean, select::CondSelectGadget}; -use ark_relations::r1cs::{ConstraintSystemRef, SynthesisError}; +use ark_relations::gr1cs::{ConstraintSystemRef, SynthesisError}; use core::cmp::Ordering; use folding_schemes::folding::traits::Dummy; use plasma_fold::{ @@ -142,7 +142,7 @@ impl< > AllocVar, F> for UserAuxVar { fn new_variable>>( - cs: impl Into>, + cs: impl Into>, f: impl FnOnce() -> Result, mode: ark_r1cs_std::prelude::AllocationMode, ) -> Result { diff --git a/client/src/lib.rs b/client/src/lib.rs index a209d8d..16bbc19 100644 --- a/client/src/lib.rs +++ b/client/src/lib.rs @@ -16,7 +16,7 @@ use ark_crypto_primitives::{ use ark_ec::CurveGroup; use ark_ff::PrimeField; use ark_r1cs_std::{alloc::AllocVar, fields::fp::FpVar, groups::CurveVar}; -use ark_relations::r1cs::{ConstraintSystemRef, SynthesisError}; +use ark_relations::gr1cs::{ConstraintSystemRef, SynthesisError}; use circuits::{UserAux, UserAuxVar, UserCircuit}; use folding_schemes::{frontend::FCircuit, Error}; use plasma_fold::primitives::accumulator::constraints::{ diff --git a/client/tests/web.rs b/client/tests/web.rs index 29854e6..08de17b 100644 --- a/client/tests/web.rs +++ b/client/tests/web.rs @@ -15,8 +15,8 @@ use ark_crypto_primitives::{ }; use ark_ff::{AdditiveGroup, Field}; use ark_grumpkin::{constraints::GVar, Projective}; -use ark_r1cs_std::{alloc::AllocVar, fields::fp::FpVar, R1CSVar}; -use ark_relations::r1cs::{ConstraintSystem, ConstraintSystemRef}; +use ark_r1cs_std::{alloc::AllocVar, fields::fp::FpVar, GR1CSVar}; +use ark_relations::gr1cs::{ConstraintSystem, ConstraintSystemRef}; use ark_std::rand::thread_rng; use client::ClientCircuitSha; use client::{ diff --git a/mock-contract/Cargo.toml b/mock-contract/Cargo.toml index f50d8c0..f54e881 100644 --- a/mock-contract/Cargo.toml +++ b/mock-contract/Cargo.toml @@ -9,7 +9,7 @@ folding-schemes = { workspace = true } ark-r1cs-std = { workspace = true } ark-ff = { workspace = true } ark-relations = { workspace = true } -ark-crypto-primitives = { workspace = true, features = ["r1cs", "crh", "sponge"] } +ark-crypto-primitives = { workspace = true, features = ["constraints", "crh", "sponge"] } ark-bn254 = { workspace = true, features = ["r1cs"] } ark-grumpkin = { workspace = true, features = ["r1cs"] } ark-std = { workspace = true } diff --git a/plasma-fold/Cargo.toml b/plasma-fold/Cargo.toml index 0dd8326..70f001d 100644 --- a/plasma-fold/Cargo.toml +++ b/plasma-fold/Cargo.toml @@ -8,7 +8,7 @@ folding-schemes = { workspace = true } ark-r1cs-std = { workspace = true } ark-ff = { workspace = true } ark-relations = { workspace = true } -ark-crypto-primitives = { workspace = true, features = ["r1cs", "crh", "sponge"] } +ark-crypto-primitives = { workspace = true, features = ["constraints", "crh", "sponge"] } ark-bn254 = { workspace = true, features = ["r1cs"] } ark-grumpkin = { workspace = true, features = ["r1cs"] } ark-std = { workspace = true } diff --git a/plasma-fold/src/circuits/gadgets/mod.rs b/plasma-fold/src/circuits/gadgets/mod.rs index 6f07dd0..167de4d 100644 --- a/plasma-fold/src/circuits/gadgets/mod.rs +++ b/plasma-fold/src/circuits/gadgets/mod.rs @@ -7,7 +7,7 @@ use ark_r1cs_std::alloc::AllocVar; use ark_r1cs_std::eq::EqGadget; use ark_r1cs_std::fields::fp::FpVar; use ark_r1cs_std::prelude::Boolean; -use ark_relations::r1cs::SynthesisError; +use ark_relations::gr1cs::SynthesisError; use std::marker::PhantomData; use ark_crypto_primitives::merkle_tree::Config; @@ -56,7 +56,7 @@ impl< > AllocVar, F> for TreeUpdateProofVar { fn new_variable>>( - cs: impl Into>, + cs: impl Into>, f: impl FnOnce() -> Result, mode: ark_r1cs_std::prelude::AllocationMode, ) -> Result { diff --git a/plasma-fold/src/datastructures/block/constraints.rs b/plasma-fold/src/datastructures/block/constraints.rs index f020851..db6f196 100644 --- a/plasma-fold/src/datastructures/block/constraints.rs +++ b/plasma-fold/src/datastructures/block/constraints.rs @@ -13,10 +13,10 @@ pub struct BlockVar { impl AllocVar, F> for BlockVar { fn new_variable>>( - cs: impl Into>, - f: impl FnOnce() -> Result, + cs: impl Into>, + f: impl FnOnce() -> Result, mode: ark_r1cs_std::prelude::AllocationMode, - ) -> Result { + ) -> Result { let cs = cs.into().cs(); let res = f()?; let block = res.borrow(); diff --git a/plasma-fold/src/datastructures/keypair/constraints.rs b/plasma-fold/src/datastructures/keypair/constraints.rs index a2b02df..8891fad 100644 --- a/plasma-fold/src/datastructures/keypair/constraints.rs +++ b/plasma-fold/src/datastructures/keypair/constraints.rs @@ -5,8 +5,8 @@ use ark_r1cs_std::alloc::AllocVar; use ark_r1cs_std::alloc::AllocationMode; use ark_r1cs_std::select::CondSelectGadget; use ark_r1cs_std::{fields::fp::FpVar, groups::CurveVar, prelude::Boolean}; -use ark_relations::r1cs::Namespace; -use ark_relations::r1cs::SynthesisError; +use ark_relations::gr1cs::Namespace; +use ark_relations::gr1cs::SynthesisError; use std::borrow::Borrow; use std::marker::PhantomData; diff --git a/plasma-fold/src/datastructures/noncemap/mod.rs b/plasma-fold/src/datastructures/noncemap/mod.rs index 5b98145..02b8093 100644 --- a/plasma-fold/src/datastructures/noncemap/mod.rs +++ b/plasma-fold/src/datastructures/noncemap/mod.rs @@ -51,7 +51,7 @@ pub mod tests { use ark_crypto_primitives::crh::poseidon::constraints::CRHParametersVar; use ark_r1cs_std::{alloc::AllocVar, fields::fp::FpVar, uint64::UInt64}; - use ark_relations::r1cs::ConstraintSystem; + use ark_relations::gr1cs::ConstraintSystem; use ark_std::rand::{thread_rng, Rng}; use folding_schemes::transcript::poseidon::poseidon_canonical_config; diff --git a/plasma-fold/src/datastructures/publickeymap/mod.rs b/plasma-fold/src/datastructures/publickeymap/mod.rs index ed1002b..3b5bed6 100644 --- a/plasma-fold/src/datastructures/publickeymap/mod.rs +++ b/plasma-fold/src/datastructures/publickeymap/mod.rs @@ -35,7 +35,7 @@ pub mod tests { use ark_ff::UniformRand; use ark_grumpkin::{constraints::GVar, Projective}; use ark_r1cs_std::{alloc::AllocVar, fields::fp::FpVar}; - use ark_relations::r1cs::ConstraintSystem; + use ark_relations::gr1cs::ConstraintSystem; use ark_std::rand::{thread_rng, Rng}; use folding_schemes::transcript::poseidon::poseidon_canonical_config; diff --git a/plasma-fold/src/datastructures/transaction/constraints.rs b/plasma-fold/src/datastructures/transaction/constraints.rs index 01ba1be..2dfea0b 100644 --- a/plasma-fold/src/datastructures/transaction/constraints.rs +++ b/plasma-fold/src/datastructures/transaction/constraints.rs @@ -13,7 +13,7 @@ use ark_r1cs_std::{ fields::{fp::FpVar, FieldVar}, groups::CurveVar, }; -use ark_relations::r1cs::{ConstraintSystemRef, Namespace, SynthesisError}; +use ark_relations::gr1cs::{ConstraintSystemRef, Namespace, SynthesisError}; use ark_std::borrow::Borrow; use crate::{ @@ -66,10 +66,7 @@ impl, CVar: CurveVar> ) -> Result { let cs = cs.into().cs(); let f = f()?; - let Transaction { - inputs, - outputs, - } = f.borrow(); + let Transaction { inputs, outputs } = f.borrow(); Ok(Self { inputs: Vec::new_variable(cs.clone(), || Ok(&inputs[..]), mode)? .try_into() @@ -108,10 +105,7 @@ impl, CVar: CurveVar> impl, CVar: CurveVar> TransactionVar { - pub fn enforce_valid( - &self, - sender: &PublicKeyVar, - ) -> Result<(), SynthesisError> { + pub fn enforce_valid(&self, sender: &PublicKeyVar) -> Result<(), SynthesisError> { for i in &self.inputs { i.pk.key .conditional_enforce_equal(&sender.key, &!&i.is_dummy)?; diff --git a/plasma-fold/src/datastructures/transaction/mod.rs b/plasma-fold/src/datastructures/transaction/mod.rs index 75b495a..3b87c2d 100644 --- a/plasma-fold/src/datastructures/transaction/mod.rs +++ b/plasma-fold/src/datastructures/transaction/mod.rs @@ -165,7 +165,7 @@ pub mod tests { alloc::AllocVar, fields::{fp::FpVar, FieldVar}, }; - use ark_relations::r1cs::ConstraintSystem; + use ark_relations::gr1cs::ConstraintSystem; use ark_std::rand::thread_rng; use folding_schemes::transcript::poseidon::poseidon_canonical_config; const W: usize = 32; diff --git a/plasma-fold/src/datastructures/user/constraints.rs b/plasma-fold/src/datastructures/user/constraints.rs index f3fbe2f..bb53bcb 100644 --- a/plasma-fold/src/datastructures/user/constraints.rs +++ b/plasma-fold/src/datastructures/user/constraints.rs @@ -11,10 +11,10 @@ pub struct UserVar { // z_i is a vec of FpVar in sonobe impl AllocVar, C::ScalarField> for UserVar { fn new_variable>>( - cs: impl Into>, - f: impl FnOnce() -> Result, + cs: impl Into>, + f: impl FnOnce() -> Result, mode: ark_r1cs_std::prelude::AllocationMode, - ) -> Result { + ) -> Result { let res = f()?; let user = res.borrow(); let cs = cs.into().cs(); diff --git a/plasma-fold/src/datastructures/utxo/constraints.rs b/plasma-fold/src/datastructures/utxo/constraints.rs index b61b3f5..c102a27 100644 --- a/plasma-fold/src/datastructures/utxo/constraints.rs +++ b/plasma-fold/src/datastructures/utxo/constraints.rs @@ -13,7 +13,7 @@ use ark_r1cs_std::{ groups::CurveVar, prelude::Boolean, }; -use ark_relations::r1cs::{Namespace, SynthesisError}; +use ark_relations::gr1cs::{Namespace, SynthesisError}; use crate::{ datastructures::keypair::constraints::PublicKeyVar, diff --git a/plasma-fold/src/primitives/accumulator/constraints.rs b/plasma-fold/src/primitives/accumulator/constraints.rs index 219c560..4d79a27 100644 --- a/plasma-fold/src/primitives/accumulator/constraints.rs +++ b/plasma-fold/src/primitives/accumulator/constraints.rs @@ -2,7 +2,10 @@ use std::marker::PhantomData; use ark_crypto_primitives::{ crh::{ - poseidon::{constraints::{CRHParametersVar, TwoToOneCRHGadget}, TwoToOneCRH}, + poseidon::{ + constraints::{CRHParametersVar, TwoToOneCRHGadget}, + TwoToOneCRH, + }, sha256::{ constraints::{Sha256Gadget, UnitVar}, Sha256, @@ -13,7 +16,7 @@ use ark_crypto_primitives::{ }; use ark_ff::PrimeField; use ark_r1cs_std::{convert::ToConstraintFieldGadget, fields::fp::FpVar, prelude::ToBytesGadget}; -use ark_relations::r1cs::SynthesisError; +use ark_relations::gr1cs::SynthesisError; pub trait Accumulator> { fn update( diff --git a/plasma-fold/src/primitives/crh/constraints.rs b/plasma-fold/src/primitives/crh/constraints.rs index 75342cd..93bc28b 100644 --- a/plasma-fold/src/primitives/crh/constraints.rs +++ b/plasma-fold/src/primitives/crh/constraints.rs @@ -55,7 +55,7 @@ impl, CVar: CurveVar> fn evaluate( parameters: &Self::ParametersVar, input: &Self::InputVar, - ) -> Result { + ) -> Result { let elements: Vec> = input.try_into()?; CRHGadget::evaluate(parameters, &elements) } @@ -69,7 +69,7 @@ impl CRHSchemeGadget, F> for NonceVarCRH fn evaluate( parameters: &Self::ParametersVar, input: &Self::InputVar, - ) -> Result { + ) -> Result { CRHGadget::evaluate(parameters, [input.to_fp()?].as_slice()) } } @@ -92,7 +92,7 @@ impl, CVar: CurveVar Result { + ) -> Result { let key = input.key.to_constraint_field()?; CRHGadget::evaluate(parameters, &key) } @@ -114,7 +114,7 @@ impl, CVar: CurveVar> fn evaluate( parameters: &Self::ParametersVar, input: &Self::InputVar, - ) -> Result { + ) -> Result { let bool_as_fp: FpVar = input.is_dummy.clone().into(); let pk_point = input.pk.key.to_constraint_field()?; let mut input = Vec::from([input.amount.clone(), bool_as_fp]); @@ -137,7 +137,7 @@ impl CRHSchemeGadget, F> for BlockVarCRH fn evaluate( parameters: &Self::ParametersVar, input: &Self::InputVar, - ) -> Result { + ) -> Result { CRHGadget::evaluate( parameters, &[ diff --git a/plasma-fold/src/primitives/crh/mod.rs b/plasma-fold/src/primitives/crh/mod.rs index fec8496..36f6271 100644 --- a/plasma-fold/src/primitives/crh/mod.rs +++ b/plasma-fold/src/primitives/crh/mod.rs @@ -181,8 +181,8 @@ pub mod tests { }; use ark_ff::UniformRand; use ark_grumpkin::{constraints::GVar, Projective}; - use ark_r1cs_std::{alloc::AllocVar, R1CSVar}; - use ark_relations::r1cs::ConstraintSystem; + use ark_r1cs_std::{alloc::AllocVar, GR1CSVar}; + use ark_relations::gr1cs::ConstraintSystem; use ark_std::rand::thread_rng; use folding_schemes::transcript::poseidon::poseidon_canonical_config; diff --git a/plasma-fold/src/primitives/schnorr.rs b/plasma-fold/src/primitives/schnorr.rs index 7725dbb..bd19e3f 100644 --- a/plasma-fold/src/primitives/schnorr.rs +++ b/plasma-fold/src/primitives/schnorr.rs @@ -16,9 +16,9 @@ use ark_r1cs_std::{ convert::ToBitsGadget, fields::fp::FpVar, prelude::{Boolean, CurveVar, EqGadget, FieldVar}, - R1CSVar, + GR1CSVar, }; -use ark_relations::r1cs::SynthesisError; +use ark_relations::gr1cs::SynthesisError; use ark_std::{cmp::max, rand::Rng, UniformRand}; pub struct Schnorr {} @@ -208,7 +208,7 @@ mod tests { use ark_ff::{BigInteger, UniformRand}; use ark_grumpkin::{constraints::GVar, Projective}; use ark_r1cs_std::prelude::AllocVar; - use ark_relations::r1cs::ConstraintSystem; + use ark_relations::gr1cs::ConstraintSystem; use ark_std::rand::thread_rng; use num::{BigUint, Zero}; diff --git a/plasma-fold/src/primitives/sparsemt/constraints.rs b/plasma-fold/src/primitives/sparsemt/constraints.rs index 768925a..021b5c1 100644 --- a/plasma-fold/src/primitives/sparsemt/constraints.rs +++ b/plasma-fold/src/primitives/sparsemt/constraints.rs @@ -12,10 +12,10 @@ use ark_r1cs_std::{ eq::EqGadget, fields::fp::FpVar, prelude::Boolean, - R1CSVar, + GR1CSVar, }; use ark_r1cs_std::{prelude::ToBitsGadget, select::CondSelectGadget}; -use ark_relations::r1cs::{ConstraintSystemRef, Namespace, SynthesisError}; +use ark_relations::gr1cs::{ConstraintSystemRef, Namespace, SynthesisError}; use std::{borrow::Borrow, ops::Not}; use super::{MerkleSparseTreePath, MerkleSparseTreeTwoPaths, SparseConfig}; @@ -400,7 +400,7 @@ mod test { use ark_crypto_primitives::crh::CRHScheme; use ark_grumpkin::constraints::GVar; use ark_grumpkin::Projective; - use ark_relations::r1cs::ConstraintSystem; + use ark_relations::gr1cs::ConstraintSystem; use folding_schemes::transcript::poseidon::poseidon_canonical_config; use super::*;