From 7555586339512eec861a592f509e8f938d29a9ca Mon Sep 17 00:00:00 2001 From: andrea Date: Fri, 25 Oct 2024 12:36:11 -0700 Subject: [PATCH] Change the dependency on `bellperson` to `ironfish-bellperson` --- ironfish-proofs/Cargo.toml | 2 +- ironfish-proofs/src/circuit/ecc.rs | 16 ++++++++-------- ironfish-proofs/src/circuit/pedersen_hash.rs | 10 +++++----- ironfish-proofs/src/circuit/sapling.rs | 18 +++++++++--------- .../src/circuit/sprout/commitment.rs | 6 +++--- ironfish-proofs/src/circuit/sprout/input.rs | 6 +++--- ironfish-proofs/src/circuit/sprout/mod.rs | 10 +++++----- ironfish-proofs/src/circuit/sprout/output.rs | 4 ++-- ironfish-proofs/src/circuit/sprout/prfs.rs | 6 +++--- ironfish-proofs/src/lib.rs | 2 +- ironfish-proofs/src/prover.rs | 2 +- ironfish-proofs/src/sapling/prover.rs | 2 +- ironfish-proofs/src/sapling/verifier.rs | 2 +- ironfish-proofs/src/sapling/verifier/single.rs | 2 +- ironfish-proofs/src/sprout.rs | 2 +- 15 files changed, 45 insertions(+), 45 deletions(-) diff --git a/ironfish-proofs/Cargo.toml b/ironfish-proofs/Cargo.toml index 63bcd7a154..ca6801a1a0 100644 --- a/ironfish-proofs/Cargo.toml +++ b/ironfish-proofs/Cargo.toml @@ -15,7 +15,7 @@ categories = ["cryptography::cryptocurrencies"] all-features = true [dependencies] -bellperson = { git = "https://github.com/iron-fish/bellperson.git", branch = "blstrs", features = ["groth16"] } +ironfish-bellperson = { version = "0.1.0", features = ["groth16"] } blake2b_simd = "1" blstrs = { version = "0.6.0", features = ["__private_bench"] } byteorder = "1" diff --git a/ironfish-proofs/src/circuit/ecc.rs b/ironfish-proofs/src/circuit/ecc.rs index cbd827dd9f..ff84d5978c 100644 --- a/ironfish-proofs/src/circuit/ecc.rs +++ b/ironfish-proofs/src/circuit/ecc.rs @@ -2,15 +2,15 @@ use std::ops::{AddAssign, MulAssign, Neg, SubAssign}; -use bellperson::{ConstraintSystem, SynthesisError}; +use ironfish_bellperson::{ConstraintSystem, SynthesisError}; -use bellperson::gadgets::Assignment; +use ironfish_bellperson::gadgets::Assignment; -use bellperson::gadgets::num::{AllocatedNum, Num}; +use ironfish_bellperson::gadgets::num::{AllocatedNum, Num}; -use bellperson::gadgets::lookup::lookup3_xy; +use ironfish_bellperson::gadgets::lookup::lookup3_xy; -use bellperson::gadgets::boolean::Boolean; +use ironfish_bellperson::gadgets::boolean::Boolean; use ff::Field; use group::Curve; @@ -620,17 +620,17 @@ impl MontgomeryPoint { #[cfg(test)] mod test { - use bellperson::ConstraintSystem; + use ironfish_bellperson::ConstraintSystem; use ff::{Field, PrimeField, PrimeFieldBits}; use group::{Curve, Group}; use rand_core::{RngCore, SeedableRng}; use rand_xorshift::XorShiftRng; - use bellperson::gadgets::test::*; + use ironfish_bellperson::gadgets::test::*; use super::{fixed_base_multiplication, AllocatedNum, EdwardsPoint, MontgomeryPoint}; use crate::constants::{to_montgomery_coords, NOTE_COMMITMENT_RANDOMNESS_GENERATOR}; - use bellperson::gadgets::boolean::{AllocatedBit, Boolean}; + use ironfish_bellperson::gadgets::boolean::{AllocatedBit, Boolean}; #[test] #[allow(clippy::many_single_char_names)] diff --git a/ironfish-proofs/src/circuit/pedersen_hash.rs b/ironfish-proofs/src/circuit/pedersen_hash.rs index 60adaa8939..5c535700d0 100644 --- a/ironfish-proofs/src/circuit/pedersen_hash.rs +++ b/ironfish-proofs/src/circuit/pedersen_hash.rs @@ -1,9 +1,9 @@ //! Gadget for Zcash's Pedersen hash. use super::ecc::{EdwardsPoint, MontgomeryPoint}; -use bellperson::gadgets::boolean::Boolean; -use bellperson::gadgets::lookup::*; -use bellperson::{ConstraintSystem, SynthesisError}; +use ironfish_bellperson::gadgets::boolean::Boolean; +use ironfish_bellperson::gadgets::lookup::*; +use ironfish_bellperson::{ConstraintSystem, SynthesisError}; pub use ironfish_primitives::sapling::pedersen_hash::Personalization; use crate::constants::PEDERSEN_CIRCUIT_GENERATORS; @@ -105,8 +105,8 @@ where #[cfg(test)] mod test { use super::*; - use bellperson::gadgets::boolean::{AllocatedBit, Boolean}; - use bellperson::gadgets::test::*; + use ironfish_bellperson::gadgets::boolean::{AllocatedBit, Boolean}; + use ironfish_bellperson::gadgets::test::*; use ff::PrimeField; use group::Curve; use rand_core::{RngCore, SeedableRng}; diff --git a/ironfish-proofs/src/circuit/sapling.rs b/ironfish-proofs/src/circuit/sapling.rs index 33cef57ba0..db5cb9a8a4 100644 --- a/ironfish-proofs/src/circuit/sapling.rs +++ b/ironfish-proofs/src/circuit/sapling.rs @@ -4,7 +4,7 @@ use ff::Field; use ff::PrimeField; use group::Curve; -use bellperson::{Circuit, ConstraintSystem, SynthesisError}; +use ironfish_bellperson::{Circuit, ConstraintSystem, SynthesisError}; use ironfish_primitives::constants; @@ -19,11 +19,11 @@ use crate::constants::{ PROOF_GENERATION_KEY_GENERATOR, SPENDING_KEY_GENERATOR, VALUE_COMMITMENT_RANDOMNESS_GENERATOR, VALUE_COMMITMENT_VALUE_GENERATOR, }; -use bellperson::gadgets::blake2s; -use bellperson::gadgets::boolean; -use bellperson::gadgets::multipack; -use bellperson::gadgets::num; -use bellperson::gadgets::Assignment; +use ironfish_bellperson::gadgets::blake2s; +use ironfish_bellperson::gadgets::boolean; +use ironfish_bellperson::gadgets::multipack; +use ironfish_bellperson::gadgets::num; +use ironfish_bellperson::gadgets::Assignment; #[cfg(test)] use ff::PrimeFieldBits; @@ -517,7 +517,7 @@ impl Circuit for Output { #[test] fn test_input_circuit_with_blstrs() { - use bellperson::gadgets::test::*; + use ironfish_bellperson::gadgets::test::*; use ff::Field; use group::Group; use rand_core::{RngCore, SeedableRng}; @@ -661,7 +661,7 @@ fn test_input_circuit_with_blstrs() { #[test] fn test_input_circuit_with_blstrs_external_test_vectors() { - use bellperson::gadgets::test::*; + use ironfish_bellperson::gadgets::test::*; use ff::Field; use group::Group; use rand_core::{RngCore, SeedableRng}; @@ -839,7 +839,7 @@ fn test_input_circuit_with_blstrs_external_test_vectors() { #[test] fn test_output_circuit_with_blstrs() { - use bellperson::gadgets::test::*; + use ironfish_bellperson::gadgets::test::*; use ff::Field; use group::Group; use rand_core::{RngCore, SeedableRng}; diff --git a/ironfish-proofs/src/circuit/sprout/commitment.rs b/ironfish-proofs/src/circuit/sprout/commitment.rs index ce4367cc81..312e1a8a5e 100644 --- a/ironfish-proofs/src/circuit/sprout/commitment.rs +++ b/ironfish-proofs/src/circuit/sprout/commitment.rs @@ -1,6 +1,6 @@ -use bellperson::gadgets::boolean::Boolean; -use bellperson::gadgets::sha256::sha256; -use bellperson::{ConstraintSystem, SynthesisError}; +use ironfish_bellperson::gadgets::boolean::Boolean; +use ironfish_bellperson::gadgets::sha256::sha256; +use ironfish_bellperson::{ConstraintSystem, SynthesisError}; use ff::PrimeField; pub fn note_comm( diff --git a/ironfish-proofs/src/circuit/sprout/input.rs b/ironfish-proofs/src/circuit/sprout/input.rs index a7ce2f1fee..87ce9e4b3c 100644 --- a/ironfish-proofs/src/circuit/sprout/input.rs +++ b/ironfish-proofs/src/circuit/sprout/input.rs @@ -1,6 +1,6 @@ -use bellperson::gadgets::boolean::{AllocatedBit, Boolean}; -use bellperson::gadgets::sha256::sha256_block_no_padding; -use bellperson::{ConstraintSystem, SynthesisError}; +use ironfish_bellperson::gadgets::boolean::{AllocatedBit, Boolean}; +use ironfish_bellperson::gadgets::sha256::sha256_block_no_padding; +use ironfish_bellperson::{ConstraintSystem, SynthesisError}; use ff::PrimeField; use super::commitment::note_comm; diff --git a/ironfish-proofs/src/circuit/sprout/mod.rs b/ironfish-proofs/src/circuit/sprout/mod.rs index afd423b1ad..8902973ee4 100644 --- a/ironfish-proofs/src/circuit/sprout/mod.rs +++ b/ironfish-proofs/src/circuit/sprout/mod.rs @@ -10,9 +10,9 @@ //! [`libsnark`]: https://github.com/scipr-lab/libsnark //! [BCTV14]: https://eprint.iacr.org/2013/879 -use bellperson::gadgets::boolean::{AllocatedBit, Boolean}; -use bellperson::gadgets::multipack::pack_into_inputs; -use bellperson::{Circuit, ConstraintSystem, LinearCombination, SynthesisError}; +use ironfish_bellperson::gadgets::boolean::{AllocatedBit, Boolean}; +use ironfish_bellperson::gadgets::multipack::pack_into_inputs; +use ironfish_bellperson::{Circuit, ConstraintSystem, LinearCombination, SynthesisError}; use ff::PrimeField; mod commitment; @@ -336,7 +336,7 @@ where #[test] #[ignore] fn test_sprout_constraints() { - use bellperson::gadgets::test::*; + use ironfish_bellperson::gadgets::test::*; use blstrs::Scalar; use byteorder::{LittleEndian, ReadBytesExt, WriteBytesExt}; @@ -460,7 +460,7 @@ fn test_sprout_constraints() { .write_u64::(vpub_new.unwrap()) .unwrap(); - use bellperson::gadgets::multipack; + use ironfish_bellperson::gadgets::multipack; let expected_inputs = multipack::bytes_to_bits(&expected_inputs); let expected_inputs = multipack::compute_multipacking(&expected_inputs); diff --git a/ironfish-proofs/src/circuit/sprout/output.rs b/ironfish-proofs/src/circuit/sprout/output.rs index 2ec089da30..f7c85f3fcc 100644 --- a/ironfish-proofs/src/circuit/sprout/output.rs +++ b/ironfish-proofs/src/circuit/sprout/output.rs @@ -1,5 +1,5 @@ -use bellperson::gadgets::boolean::Boolean; -use bellperson::{ConstraintSystem, SynthesisError}; +use ironfish_bellperson::gadgets::boolean::Boolean; +use ironfish_bellperson::{ConstraintSystem, SynthesisError}; use ff::PrimeField; use super::commitment::note_comm; diff --git a/ironfish-proofs/src/circuit/sprout/prfs.rs b/ironfish-proofs/src/circuit/sprout/prfs.rs index da5ba55b83..c2f57f9eef 100644 --- a/ironfish-proofs/src/circuit/sprout/prfs.rs +++ b/ironfish-proofs/src/circuit/sprout/prfs.rs @@ -1,6 +1,6 @@ -use bellperson::gadgets::boolean::Boolean; -use bellperson::gadgets::sha256::sha256_block_no_padding; -use bellperson::{ConstraintSystem, SynthesisError}; +use ironfish_bellperson::gadgets::boolean::Boolean; +use ironfish_bellperson::gadgets::sha256::sha256_block_no_padding; +use ironfish_bellperson::{ConstraintSystem, SynthesisError}; use ff::PrimeField; #[allow(clippy::many_single_char_names)] diff --git a/ironfish-proofs/src/lib.rs b/ironfish-proofs/src/lib.rs index 25668d6084..3632e375e2 100644 --- a/ironfish-proofs/src/lib.rs +++ b/ironfish-proofs/src/lib.rs @@ -9,7 +9,7 @@ // Temporary until we have addressed all Result cases. #![allow(clippy::result_unit_err)] -use bellperson::groth16::{prepare_verifying_key, Parameters, PreparedVerifyingKey, VerifyingKey}; +use ironfish_bellperson::groth16::{prepare_verifying_key, Parameters, PreparedVerifyingKey, VerifyingKey}; use blstrs::Bls12; use std::fs::File; use std::io::{self, BufReader}; diff --git a/ironfish-proofs/src/prover.rs b/ironfish-proofs/src/prover.rs index a2319912cc..33fb246274 100644 --- a/ironfish-proofs/src/prover.rs +++ b/ironfish-proofs/src/prover.rs @@ -1,6 +1,6 @@ //! Abstractions over the proving system and parameters for ease of use. -use bellperson::groth16::{Parameters, PreparedVerifyingKey}; +use ironfish_bellperson::groth16::{Parameters, PreparedVerifyingKey}; use blstrs::Bls12; use std::path::Path; use ironfish_primitives::{ diff --git a/ironfish-proofs/src/sapling/prover.rs b/ironfish-proofs/src/sapling/prover.rs index 156b87a135..f6613d1095 100644 --- a/ironfish-proofs/src/sapling/prover.rs +++ b/ironfish-proofs/src/sapling/prover.rs @@ -1,4 +1,4 @@ -use bellperson::{ +use ironfish_bellperson::{ gadgets::multipack, groth16::{create_random_proof, verify_proof, Parameters, PreparedVerifyingKey, Proof}, }; diff --git a/ironfish-proofs/src/sapling/verifier.rs b/ironfish-proofs/src/sapling/verifier.rs index 1db2b3e6ea..db6460f4b1 100644 --- a/ironfish-proofs/src/sapling/verifier.rs +++ b/ironfish-proofs/src/sapling/verifier.rs @@ -1,4 +1,4 @@ -use bellperson::{gadgets::multipack, groth16::Proof}; +use ironfish_bellperson::{gadgets::multipack, groth16::Proof}; use blstrs::Bls12; use ff::Field; use group::{Curve, GroupEncoding}; diff --git a/ironfish-proofs/src/sapling/verifier/single.rs b/ironfish-proofs/src/sapling/verifier/single.rs index 6f809b86e6..1f3d28c5fc 100644 --- a/ironfish-proofs/src/sapling/verifier/single.rs +++ b/ironfish-proofs/src/sapling/verifier/single.rs @@ -1,4 +1,4 @@ -use bellperson::groth16::{verify_proof, PreparedVerifyingKey, Proof}; +use ironfish_bellperson::groth16::{verify_proof, PreparedVerifyingKey, Proof}; use blstrs::Bls12; use ironfish_primitives::{ constants::{SPENDING_KEY_GENERATOR, VALUE_COMMITMENT_RANDOMNESS_GENERATOR}, diff --git a/ironfish-proofs/src/sprout.rs b/ironfish-proofs/src/sprout.rs index b2b692f4ca..e2c85bf990 100644 --- a/ironfish-proofs/src/sprout.rs +++ b/ironfish-proofs/src/sprout.rs @@ -1,6 +1,6 @@ //! APIs for creating and verifying Sprout proofs. -use bellperson::{ +use ironfish_bellperson::{ gadgets::multipack, groth16::{self, create_random_proof, Parameters, PreparedVerifyingKey, Proof}, };