Skip to content

Commit

Permalink
Change the dependency on bellperson to ironfish-bellperson
Browse files Browse the repository at this point in the history
  • Loading branch information
andiflabs committed Oct 25, 2024
1 parent db2dd3e commit 7555586
Show file tree
Hide file tree
Showing 15 changed files with 45 additions and 45 deletions.
2 changes: 1 addition & 1 deletion ironfish-proofs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
16 changes: 8 additions & 8 deletions ironfish-proofs/src/circuit/ecc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)]
Expand Down
10 changes: 5 additions & 5 deletions ironfish-proofs/src/circuit/pedersen_hash.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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};
Expand Down
18 changes: 9 additions & 9 deletions ironfish-proofs/src/circuit/sapling.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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;
Expand Down Expand Up @@ -517,7 +517,7 @@ impl Circuit<blstrs::Scalar> 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};
Expand Down Expand Up @@ -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};
Expand Down Expand Up @@ -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};
Expand Down
6 changes: 3 additions & 3 deletions ironfish-proofs/src/circuit/sprout/commitment.rs
Original file line number Diff line number Diff line change
@@ -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<Scalar, CS>(
Expand Down
6 changes: 3 additions & 3 deletions ironfish-proofs/src/circuit/sprout/input.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
10 changes: 5 additions & 5 deletions ironfish-proofs/src/circuit/sprout/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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};
Expand Down Expand Up @@ -460,7 +460,7 @@ fn test_sprout_constraints() {
.write_u64::<LittleEndian>(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);
Expand Down
4 changes: 2 additions & 2 deletions ironfish-proofs/src/circuit/sprout/output.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
6 changes: 3 additions & 3 deletions ironfish-proofs/src/circuit/sprout/prfs.rs
Original file line number Diff line number Diff line change
@@ -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)]
Expand Down
2 changes: 1 addition & 1 deletion ironfish-proofs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// Temporary until we have addressed all Result<T, ()> 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};
Expand Down
2 changes: 1 addition & 1 deletion ironfish-proofs/src/prover.rs
Original file line number Diff line number Diff line change
@@ -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::{
Expand Down
2 changes: 1 addition & 1 deletion ironfish-proofs/src/sapling/prover.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use bellperson::{
use ironfish_bellperson::{
gadgets::multipack,
groth16::{create_random_proof, verify_proof, Parameters, PreparedVerifyingKey, Proof},
};
Expand Down
2 changes: 1 addition & 1 deletion ironfish-proofs/src/sapling/verifier.rs
Original file line number Diff line number Diff line change
@@ -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};
Expand Down
2 changes: 1 addition & 1 deletion ironfish-proofs/src/sapling/verifier/single.rs
Original file line number Diff line number Diff line change
@@ -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},
Expand Down
2 changes: 1 addition & 1 deletion ironfish-proofs/src/sprout.rs
Original file line number Diff line number Diff line change
@@ -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},
};
Expand Down

0 comments on commit 7555586

Please sign in to comment.