diff --git a/CHANGELOG.md b/CHANGELOG.md index e0c0b43dd..aeadb134a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), - [\#197](https://github.com/Manta-Network/manta-rs/pull/197) Add ECLAIR utilities for next circuit upgrade ### Changed +- [\#236](https://github.com/Manta-Network/manta-rs/pull/236) Moved `RatioProof` from `manta-trusted-setup` to `manta-crypto` - [\#180](https://github.com/Manta-Network/manta-rs/pull/180) Start moving to new `arkworks` backend for `manta-crypto` - [\#191](https://github.com/Manta-Network/manta-rs/pull/191) Move HTTP Utilities to `manta-util` diff --git a/manta-crypto/src/arkworks/mod.rs b/manta-crypto/src/arkworks/mod.rs index 454070ac3..c959806b7 100644 --- a/manta-crypto/src/arkworks/mod.rs +++ b/manta-crypto/src/arkworks/mod.rs @@ -26,3 +26,4 @@ pub mod constraint; pub mod ff; pub mod pairing; pub mod rand; +pub mod ratio; diff --git a/manta-trusted-setup/src/ratio.rs b/manta-crypto/src/arkworks/ratio.rs similarity index 99% rename from manta-trusted-setup/src/ratio.rs rename to manta-crypto/src/arkworks/ratio.rs index 41fc38aa8..24f13e354 100644 --- a/manta-trusted-setup/src/ratio.rs +++ b/manta-crypto/src/arkworks/ratio.rs @@ -16,7 +16,7 @@ //! Ratio Proofs -use manta_crypto::{ +use crate::{ arkworks::{ ec::{AffineCurve, ProjectiveCurve}, ff::{PrimeField, UniformRand, Zero}, diff --git a/manta-trusted-setup/src/groth16/kzg.rs b/manta-trusted-setup/src/groth16/kzg.rs index 8c766e047..66265daae 100644 --- a/manta-trusted-setup/src/groth16/kzg.rs +++ b/manta-trusted-setup/src/groth16/kzg.rs @@ -16,16 +16,14 @@ //! KZG Trusted Setup for Groth16 -use crate::{ - ratio::{HashToGroup, RatioProof}, - util::{power_pairs, scalar_mul, Deserializer, NonZero, Serializer}, -}; +use crate::util::{power_pairs, scalar_mul, Deserializer, NonZero, Serializer}; use alloc::{vec, vec::Vec}; use core::{iter, ops::Mul}; use manta_crypto::{ arkworks::{ ff::{One, UniformRand}, pairing::{Pairing, PairingEngineExt}, + ratio::{HashToGroup, RatioProof}, serialize::{CanonicalDeserialize, CanonicalSerialize, Read, SerializationError, Write}, }, rand::{CryptoRng, RngCore, Sample}, diff --git a/manta-trusted-setup/src/groth16/mpc.rs b/manta-trusted-setup/src/groth16/mpc.rs index 26ea71815..29a15a909 100644 --- a/manta-trusted-setup/src/groth16/mpc.rs +++ b/manta-trusted-setup/src/groth16/mpc.rs @@ -18,7 +18,6 @@ use crate::{ groth16::kzg::{self, Accumulator}, - ratio::{HashToGroup, RatioProof}, util::{batch_into_projective, batch_mul_fixed_scalar, merge_pairs_affine}, }; use alloc::{vec, vec::Vec}; @@ -29,6 +28,7 @@ use manta_crypto::{ ec::{AffineCurve, PairingEngine, ProjectiveCurve}, ff::{Field, PrimeField, UniformRand, Zero}, pairing::{Pairing, PairingEngineExt}, + ratio::{HashToGroup, RatioProof}, relations::r1cs::{ConstraintSynthesizer, ConstraintSystem, SynthesisError}, }, rand::{CryptoRng, RngCore}, diff --git a/manta-trusted-setup/src/groth16/ppot/hashing.rs b/manta-trusted-setup/src/groth16/ppot/hashing.rs index 923dd44b1..038d8a8cf 100644 --- a/manta-trusted-setup/src/groth16/ppot/hashing.rs +++ b/manta-trusted-setup/src/groth16/ppot/hashing.rs @@ -18,7 +18,6 @@ use crate::{ groth16::{kzg::G1, ppot::kzg::PerpetualPowersOfTauCeremony}, - ratio::HashToGroup, util::{hash_to_group, BlakeHasher, Serializer}, }; use ark_bn254::{Fq, Fq2, G1Affine, G2Affine}; @@ -27,6 +26,7 @@ use manta_crypto::{ arkworks::{ ec::{short_weierstrass_jacobian::GroupAffine, ProjectiveCurve, SWModelParameters}, ff::{BigInteger256, Fp256, FpParameters, Zero}, + ratio::HashToGroup, }, rand::{RngCore, Sample}, }; diff --git a/manta-trusted-setup/src/groth16/test/mod.rs b/manta-trusted-setup/src/groth16/test/mod.rs index bd929d018..0f3f99d0f 100644 --- a/manta-trusted-setup/src/groth16/test/mod.rs +++ b/manta-trusted-setup/src/groth16/test/mod.rs @@ -22,7 +22,6 @@ use crate::{ mpc::{self, contribute, initialize, verify_transform, verify_transform_all, Proof, State}, }, mpc::{ChallengeType, ProofType, StateType, Transcript}, - ratio::test::assert_valid_ratio_proof, util::{BlakeHasher, HasDistribution, KZGBlakeHasher}, }; use alloc::vec::Vec; @@ -36,6 +35,7 @@ use manta_crypto::{ ff::{field_new, UniformRand}, pairing::{test::assert_valid_pairing_ratio, Pairing}, r1cs_std::eq::EqGadget, + ratio::test::assert_valid_ratio_proof, serialize::CanonicalSerialize, }, eclair::alloc::{ diff --git a/manta-trusted-setup/src/lib.rs b/manta-trusted-setup/src/lib.rs index 60f92c197..84dabb22a 100644 --- a/manta-trusted-setup/src/lib.rs +++ b/manta-trusted-setup/src/lib.rs @@ -25,5 +25,4 @@ extern crate alloc; pub mod groth16; pub mod mpc; -pub mod ratio; pub mod util; diff --git a/manta-trusted-setup/src/util.rs b/manta-trusted-setup/src/util.rs index 0f4e25bd8..4f95c1b86 100644 --- a/manta-trusted-setup/src/util.rs +++ b/manta-trusted-setup/src/util.rs @@ -16,7 +16,7 @@ //! Utilities -use crate::{groth16::kzg, ratio::HashToGroup}; +use crate::groth16::kzg; use alloc::{boxed::Box, vec::Vec}; use ark_std::{ error, @@ -29,6 +29,7 @@ use manta_crypto::{ ec::{wnaf::WnafContext, AffineCurve, ProjectiveCurve}, ff::{BigInteger, PrimeField, UniformRand, Zero}, pairing::Pairing, + ratio::HashToGroup, serialize::{CanonicalSerialize, Read, SerializationError, Write}, }, rand::{ChaCha20Rng, OsRng, Sample, SeedableRng},