Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into kw/add-bb-backend-i…
Browse files Browse the repository at this point in the history
…nterface-impl
  • Loading branch information
kevaundray committed Oct 1, 2023
2 parents d8ddde0 + b039e2a commit 69b47e2
Show file tree
Hide file tree
Showing 65 changed files with 901 additions and 251 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/formatting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
timeout-minutes: 30
env:
RUSTFLAGS: -Dwarnings

strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -53,7 +53,7 @@ jobs:
name: eslint
runs-on: ubuntu-latest
timeout-minutes: 30

steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-nargo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ jobs:
- name: Test built artifact
if: matrix.target == 'x86_64-apple-darwin'
run: |
cp ./target/${{ matrix.target }}/release/nargo ~/.cargo/bin/
cp ./target/${{ matrix.target }}/release/nargo ~/.cargo/bin/
yarn workspace release-tests test
- name: Upload binaries to release tag
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-noir_wasm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ jobs:
cp -r ./compiler/wasm/downloaded/nodejs ./compiler/wasm
cp -r ./compiler/wasm/downloaded/web ./compiler/wasm
yarn workspace @noir-lang/source-resolver build
- name: Run node tests
run: yarn workspace @noir-lang/noir_wasm test:node

Expand Down
7 changes: 3 additions & 4 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions acvm-repo/acir/src/circuit/black_box_functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,12 @@ mod tests {
fn consistent_function_names() {
for bb_func in BlackBoxFunc::iter() {
let resolved_func = BlackBoxFunc::lookup(bb_func.name()).unwrap_or_else(|| {
panic!("BlackBoxFunc::lookup couldn't find black box function {}", bb_func)
panic!("BlackBoxFunc::lookup couldn't find black box function {bb_func}")
});
assert_eq!(
resolved_func, bb_func,
"BlackBoxFunc::lookup returns unexpected BlackBoxFunc"
)
);
}
}
}
4 changes: 2 additions & 2 deletions acvm-repo/acir/src/circuit/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ impl std::fmt::Display for Circuit {
write_public_inputs(f, &self.return_values)?;

for opcode in &self.opcodes {
writeln!(f, "{opcode}")?
writeln!(f, "{opcode}")?;
}
Ok(())
}
Expand Down Expand Up @@ -236,7 +236,7 @@ mod tests {
}

let (circ, got_circ) = read_write(circuit);
assert_eq!(circ, got_circ)
assert_eq!(circ, got_circ);
}

#[test]
Expand Down
4 changes: 2 additions & 2 deletions acvm-repo/acir/src/circuit/opcodes/black_box_function_call.rs
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ fn get_inputs_string(inputs: &[FunctionInput]) -> String {
result += &format!("(_{}, num_bits: {})", inp.witness.witness_index(), inp.num_bits);
// Add a comma, unless it is the last entry
if index != inputs.len() - 1 {
result += ", "
result += ", ";
}
}
result
Expand Down Expand Up @@ -358,7 +358,7 @@ fn get_outputs_string(outputs: &[Witness]) -> String {
result += &format!("_{}", output.witness_index());
// Add a comma, unless it is the last entry
if index != outputs.len() - 1 {
result += ", "
result += ", ";
}
}
result
Expand Down
4 changes: 3 additions & 1 deletion acvm-repo/acir/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#![warn(unused_crate_dependencies)]
#![forbid(unsafe_code)]
#![warn(unreachable_pub)]
#![warn(clippy::semicolon_if_nothing_returned)]
#![cfg_attr(not(test), warn(unused_crate_dependencies, unused_extern_crates))]

// Arbitrary Circuit Intermediate Representation

Expand Down
6 changes: 3 additions & 3 deletions acvm-repo/acir/src/native_types/expression/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ impl Expression {

/// Adds a new linear term to the `Expression`.
pub fn push_addition_term(&mut self, coefficient: FieldElement, variable: Witness) {
self.linear_combinations.push((coefficient, variable))
self.linear_combinations.push((coefficient, variable));
}

/// Adds a new quadratic term to the `Expression`.
Expand All @@ -82,7 +82,7 @@ impl Expression {
lhs: Witness,
rhs: Witness,
) {
self.mul_terms.push((coefficient, lhs, rhs))
self.mul_terms.push((coefficient, lhs, rhs));
}

/// Returns `true` if the expression represents a constant polynomial.
Expand Down Expand Up @@ -394,5 +394,5 @@ fn add_mul_smoketest() {
linear_combinations: vec![(FieldElement::from(40u128), Witness(4))],
q_c: FieldElement::from(10u128)
}
)
);
}
10 changes: 5 additions & 5 deletions acvm-repo/acir_field/src/generic_ark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ impl<F: PrimeField> std::fmt::Debug for FieldElement<F> {

impl<F: PrimeField> std::hash::Hash for FieldElement<F> {
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
state.write(&self.to_be_bytes())
state.write(&self.to_be_bytes());
}
}

Expand Down Expand Up @@ -295,7 +295,7 @@ impl<F: PrimeField> FieldElement<F> {
fn byte_to_bit(byte: u8) -> Vec<bool> {
let mut bits = Vec::with_capacity(8);
for index in (0..=7).rev() {
bits.push((byte & (1 << index)) >> index == 1)
bits.push((byte & (1 << index)) >> index == 1);
}
bits
}
Expand Down Expand Up @@ -341,7 +341,7 @@ impl<F: PrimeField> FieldElement<F> {

let and_byte_arr: Vec<_> = lhs_bytes
.into_iter()
.zip(rhs_bytes.into_iter())
.zip(rhs_bytes)
.map(|(lhs, rhs)| if is_xor { lhs ^ rhs } else { lhs & rhs })
.collect();

Expand Down Expand Up @@ -433,13 +433,13 @@ mod tests {
for (i, string) in hex_strings.into_iter().enumerate() {
let minus_i_field_element =
-crate::generic_ark::FieldElement::<ark_bn254::Fr>::from(i as i128);
assert_eq!(minus_i_field_element.to_hex(), string)
assert_eq!(minus_i_field_element.to_hex(), string);
}
}
#[test]
fn max_num_bits_smoke() {
let max_num_bits_bn254 = crate::generic_ark::FieldElement::<ark_bn254::Fr>::max_num_bits();
assert_eq!(max_num_bits_bn254, 254)
assert_eq!(max_num_bits_bn254, 254);
}
}

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

cfg_if::cfg_if! {
if #[cfg(feature = "bn254")] {
Expand Down
8 changes: 4 additions & 4 deletions acvm-repo/acvm/src/compiler/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ pub fn compile(
for opcode in acir.opcodes {
match opcode {
Opcode::Arithmetic(arith_expr) => {
opcodes.push(Opcode::Arithmetic(GeneralOptimizer::optimize(arith_expr)))
opcodes.push(Opcode::Arithmetic(GeneralOptimizer::optimize(arith_expr)));
}
other_opcode => opcodes.push(other_opcode),
};
Expand Down Expand Up @@ -168,7 +168,7 @@ pub fn compile(
match func {
acir::circuit::opcodes::BlackBoxFuncCall::AND { output, .. }
| acir::circuit::opcodes::BlackBoxFuncCall::XOR { output, .. } => {
transformer.mark_solvable(*output)
transformer.mark_solvable(*output);
}
acir::circuit::opcodes::BlackBoxFuncCall::RANGE { .. } => (),
acir::circuit::opcodes::BlackBoxFuncCall::SHA256 { outputs, .. }
Expand All @@ -192,7 +192,7 @@ pub fn compile(
}
| acir::circuit::opcodes::BlackBoxFuncCall::Pedersen { outputs, .. } => {
transformer.mark_solvable(outputs.0);
transformer.mark_solvable(outputs.1)
transformer.mark_solvable(outputs.1);
}
acir::circuit::opcodes::BlackBoxFuncCall::HashToField128Security {
output,
Expand All @@ -201,7 +201,7 @@ pub fn compile(
| acir::circuit::opcodes::BlackBoxFuncCall::EcdsaSecp256k1 { output, .. }
| acir::circuit::opcodes::BlackBoxFuncCall::EcdsaSecp256r1 { output, .. }
| acir::circuit::opcodes::BlackBoxFuncCall::SchnorrVerify { output, .. } => {
transformer.mark_solvable(*output)
transformer.mark_solvable(*output);
}
}

Expand Down
2 changes: 1 addition & 1 deletion acvm-repo/acvm/src/compiler/optimizers/general.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ fn simplify_mul_terms(mut gate: Expression) -> Expression {

// Canonicalize the ordering of the multiplication, lets just order by variable name
for (scale, w_l, w_r) in gate.mul_terms.clone().into_iter() {
let mut pair = vec![w_l, w_r];
let mut pair = [w_l, w_r];
// Sort using rust sort algorithm
pair.sort();

Expand Down
2 changes: 1 addition & 1 deletion acvm-repo/acvm/src/compiler/optimizers/redundant_range.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,6 @@ mod tests {
let acir_opcode_positions = circuit.opcodes.iter().enumerate().map(|(i, _)| i).collect();
let optimizer = RangeOptimizer::new(circuit);
let (optimized_circuit, _) = optimizer.replace_redundant_ranges(acir_opcode_positions);
assert_eq!(optimized_circuit.opcodes.len(), 5)
assert_eq!(optimized_circuit.opcodes.len(), 5);
}
}
4 changes: 3 additions & 1 deletion acvm-repo/acvm/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#![warn(unused_crate_dependencies)]
#![forbid(unsafe_code)]
#![warn(unreachable_pub)]
#![warn(clippy::semicolon_if_nothing_returned)]
#![cfg_attr(not(test), warn(unused_crate_dependencies, unused_extern_crates))]

pub mod compiler;
pub mod pwg;
Expand Down
2 changes: 1 addition & 1 deletion acvm-repo/acvm/src/pwg/blackbox/range.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::{
use acir::{circuit::opcodes::FunctionInput, native_types::WitnessMap};

pub(super) fn solve_range_opcode(
initial_witness: &mut WitnessMap,
initial_witness: &WitnessMap,
input: &FunctionInput,
) -> Result<(), OpcodeResolutionError> {
let w_value = witness_to_value(initial_witness, input.witness)?;
Expand Down
4 changes: 2 additions & 2 deletions acvm-repo/acvm/src/pwg/brillig.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,11 @@ impl BrilligSolver {
for output in &brillig.outputs {
match output {
BrilligOutputs::Simple(witness) => {
insert_value(witness, FieldElement::zero(), initial_witness)?
insert_value(witness, FieldElement::zero(), initial_witness)?;
}
BrilligOutputs::Array(witness_arr) => {
for witness in witness_arr {
insert_value(witness, FieldElement::zero(), initial_witness)?
insert_value(witness, FieldElement::zero(), initial_witness)?;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion acvm-repo/acvm/src/pwg/directives/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ pub(super) fn solve_directives(
None => FieldElement::zero(),
};

insert_value(witness, value, initial_witness)?
insert_value(witness, value, initial_witness)?;
}

Ok(())
Expand Down
2 changes: 1 addition & 1 deletion acvm-repo/acvm/src/pwg/directives/sorting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ mod tests {
result.push(*out1.last().unwrap());
result.push(*out2.last().unwrap());
} else {
result.push(*out2.last().unwrap())
result.push(*out2.last().unwrap());
}
result
}
Expand Down
1 change: 0 additions & 1 deletion acvm-repo/acvm_js/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"name": "@noir-lang/acvm_js",
"version": "0.27.4",
"private": true,
"repository": {
"type": "git",
"url": "https://github.com/noir-lang/acvm.git"
Expand Down
Loading

0 comments on commit 69b47e2

Please sign in to comment.