Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,14 @@ noirc_abi = { path = "tooling/noirc_abi" }
bb_abstraction_leaks = { path = "tooling/bb_abstraction_leaks" }
acvm_cli = { path = "tooling/acvm_cli" }

# Arkworks
ark-bn254 = { version = "^0.4.0", default-features = false, features = ["curve"] }
ark-bls12-381 = { version = "^0.4.0", default-features = false, features = ["curve"] }
grumpkin = { version = "0.1.0", package = "noir_grumpkin", features = ["std"] }
ark-ec = { version = "^0.4.0", default-features = false }
ark-ff = { version = "^0.4.0", default-features = false }
ark-std = { version = "^0.4.0", default-features = false }

# Misc utils crates
iter-extended = { path = "utils/iter-extended" }

Expand Down
6 changes: 3 additions & 3 deletions acvm-repo/acir_field/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ hex.workspace = true
num-bigint.workspace = true
serde.workspace = true

ark-bn254 = { version = "^0.4.0", default-features = false, features = ["curve"] }
ark-bls12-381 = { version = "^0.4.0", optional = true, default-features = false, features = ["curve"] }
ark-ff = { version = "^0.4.0", default-features = false }
ark-bn254.workspace = true
ark-bls12-381 = { workspace = true, optional = true }
ark-ff.workspace = true

cfg-if = "1.0.0"

Expand Down
14 changes: 5 additions & 9 deletions acvm-repo/bn254_blackbox_solver/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ acvm_blackbox_solver.workspace = true
hex.workspace = true
lazy_static = "1.4"

# BN254 fixed base scalar multiplication solver
grumpkin = { version = "0.1.0", package = "noir_grumpkin", features = ["std"] }
ark-ec = { version = "^0.4.0", default-features = false }
ark-ff = { version = "^0.4.0", default-features = false }
ark-bn254.workspace = true
grumpkin.workspace = true
ark-ec.workspace = true
ark-ff.workspace = true
num-bigint.workspace = true

[dev-dependencies]
ark-std = { version = "^0.4.0", default-features = false }
ark-std.workspace = true
criterion = "0.5.0"
pprof = { version = "0.12", features = [
"flamegraph",
Expand All @@ -36,7 +36,3 @@ pprof = { version = "0.12", features = [
[[bench]]
name = "criterion"
harness = false

[features]
default = ["bn254"]
bn254 = ["acir/bn254"]
3 changes: 2 additions & 1 deletion acvm-repo/bn254_blackbox_solver/src/embedded_curve_ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ use ark_ec::AffineRepr;
use ark_ff::MontConfig;
use num_bigint::BigUint;

use crate::FieldElement;
use acir::AcirField;
use acir::BlackBoxFunc;
use acir::{AcirField, FieldElement};

use crate::BlackBoxResolutionError;

Expand Down
5 changes: 4 additions & 1 deletion acvm-repo/bn254_blackbox_solver/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#![warn(clippy::semicolon_if_nothing_returned)]
#![cfg_attr(not(test), warn(unused_crate_dependencies, unused_extern_crates))]

use acir::FieldElement;
use acvm_blackbox_solver::{BlackBoxFunctionSolver, BlackBoxResolutionError};

mod embedded_curve_ops;
Expand All @@ -15,6 +14,10 @@ use ark_ec::AffineRepr;
pub use embedded_curve_ops::{embedded_curve_add, multi_scalar_mul};
pub use poseidon2::poseidon2_permutation;

// Temporary hack, this ensure that we always use a bn254 field here
// without polluting the feature flags of the `acir_field` crate.
type FieldElement = acir::acir_field::GenericFieldElement<ark_bn254::Fr>;

#[derive(Default)]
pub struct Bn254BlackBoxSolver;

Expand Down
3 changes: 2 additions & 1 deletion acvm-repo/bn254_blackbox_solver/src/pedersen/commitment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,13 @@ pub(crate) fn commit_native_with_index(
#[cfg(test)]
mod test {

use acir::{AcirField, FieldElement};
use acir::AcirField;
use ark_ec::short_weierstrass::Affine;
use ark_std::{One, Zero};
use grumpkin::Fq;

use crate::pedersen::commitment::commit_native_with_index;
use crate::FieldElement;

#[test]
fn commitment() {
Expand Down
3 changes: 2 additions & 1 deletion acvm-repo/bn254_blackbox_solver/src/pedersen/hash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ fn length_generator() -> &'static Affine<GrumpkinParameters> {
pub(crate) mod test {

use super::*;
use crate::FieldElement;

use acir::{AcirField, FieldElement};
use acir::AcirField;
use ark_std::One;
use grumpkin::Fq;

Expand Down
8 changes: 5 additions & 3 deletions acvm-repo/bn254_blackbox_solver/src/poseidon2.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
use acir::{AcirField, FieldElement};
use acir::AcirField;
use acvm_blackbox_solver::BlackBoxResolutionError;
use lazy_static::lazy_static;

use crate::FieldElement;

pub fn poseidon2_permutation(
inputs: &[FieldElement],
len: u32,
Expand Down Expand Up @@ -543,9 +545,9 @@ impl<'a> Poseidon2<'a> {

#[cfg(test)]
mod test {
use acir::{AcirField, FieldElement};
use acir::AcirField;

use super::{field_from_hex, poseidon2_permutation};
use super::{field_from_hex, poseidon2_permutation, FieldElement};

#[test]
fn smoke_test() {
Expand Down
3 changes: 2 additions & 1 deletion acvm-repo/bn254_blackbox_solver/src/schnorr/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,10 @@ fn schnorr_generate_challenge(

#[cfg(test)]
mod schnorr_tests {
use acir::{AcirField, FieldElement};
use acir::AcirField;

use super::verify_signature;
use crate::FieldElement;

#[test]
fn verifies_valid_signature() {
Expand Down