Skip to content

Commit f248e2e

Browse files
authored
Merge branch 'master' into jl/brillig_entry
2 parents ffe2817 + d8ef7f8 commit f248e2e

File tree

65 files changed

+168
-414
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+168
-414
lines changed

.github/scripts/run-external-repo-tests.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ sed -i '/^compiler_version/d' {Nargo.toml,./**/Nargo.toml}
2828
set -e
2929

3030
BEFORE=$SECONDS
31-
$NARGO test --silence-warnings --skip-brillig-constraints-check --pedantic-solving --format json $NARGO_ARGS | tee $OUTPUT_FILE
31+
$NARGO test --silence-warnings --skip-brillig-constraints-check --format json $NARGO_ARGS | tee $OUTPUT_FILE
3232
TIME=$(($SECONDS-$BEFORE))
3333

3434
if [ ! -s $OUTPUT_FILE ]; then

EXTERNAL_NOIR_LIBRARIES.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ libraries:
8989
repo: AztecProtocol/aztec-packages
9090
ref: *AZ_COMMIT
9191
path: noir-projects/noir-protocol-circuits/crates/private-kernel-lib
92-
timeout: 400
92+
timeout: 450
9393
critical: false
9494
protocol_circuits_types:
9595
repo: AztecProtocol/aztec-packages

acvm-repo/acvm/benches/arithmetic_solver.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ fn bench_bytecode<F: AcirField>(c: &mut Criterion, benchmark_name: &str, bytecod
7272
b.iter_batched(
7373
|| {
7474
let initial_witness = WitnessMap::from(BTreeMap::from([(Witness(0), F::one())]));
75-
ACVM::new(&StubbedBlackBoxSolver(true), bytecode, initial_witness, &[], &[])
75+
ACVM::new(&StubbedBlackBoxSolver, bytecode, initial_witness, &[], &[])
7676
},
7777
|mut vm| {
7878
let status = vm.solve();

acvm-repo/acvm/src/compiler/validator.rs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ mod tests {
476476
(Witness(3), FieldElement::from(5u128)),
477477
]));
478478

479-
let backend = Bn254BlackBoxSolver(false);
479+
let backend = Bn254BlackBoxSolver;
480480
assert!(validate_witness(&backend, witness_map, &circuit).is_ok());
481481
}
482482

@@ -501,7 +501,7 @@ mod tests {
501501
(Witness(3), FieldElement::from(6u128)), // Wrong value!
502502
]));
503503

504-
let backend = Bn254BlackBoxSolver(false);
504+
let backend = Bn254BlackBoxSolver;
505505
assert!(validate_witness(&backend, witness_map, &circuit).is_err());
506506
}
507507

@@ -522,7 +522,7 @@ mod tests {
522522
(Witness(3), FieldElement::from(12u128)),
523523
]));
524524

525-
let backend = Bn254BlackBoxSolver(false);
525+
let backend = Bn254BlackBoxSolver;
526526
assert!(validate_witness(&backend, witness_map, &circuit).is_ok());
527527
}
528528

@@ -538,7 +538,7 @@ mod tests {
538538
(Witness(1), FieldElement::from(255u128)), // Max 8-bit value
539539
]));
540540

541-
let backend = Bn254BlackBoxSolver(false);
541+
let backend = Bn254BlackBoxSolver;
542542
assert!(validate_witness(&backend, witness_map, &circuit).is_ok());
543543
}
544544

@@ -554,7 +554,7 @@ mod tests {
554554
(Witness(1), FieldElement::from(256u128)), // Too large for 8 bits
555555
]));
556556

557-
let backend = Bn254BlackBoxSolver(false);
557+
let backend = Bn254BlackBoxSolver;
558558
assert!(validate_witness(&backend, witness_map, &circuit).is_err());
559559
}
560560

@@ -574,7 +574,7 @@ mod tests {
574574
(Witness(3), FieldElement::from(0b1000u128)),
575575
]));
576576

577-
let backend = Bn254BlackBoxSolver(false);
577+
let backend = Bn254BlackBoxSolver;
578578
assert!(validate_witness(&backend, witness_map, &circuit).is_ok());
579579
}
580580

@@ -594,7 +594,7 @@ mod tests {
594594
(Witness(3), FieldElement::from(0b1111u128)), // Wrong!
595595
]));
596596

597-
let backend = Bn254BlackBoxSolver(false);
597+
let backend = Bn254BlackBoxSolver;
598598
assert!(validate_witness(&backend, witness_map, &circuit).is_err());
599599
}
600600

@@ -614,7 +614,7 @@ mod tests {
614614
(Witness(3), FieldElement::from(0b0110u128)),
615615
]));
616616

617-
let backend = Bn254BlackBoxSolver(false);
617+
let backend = Bn254BlackBoxSolver;
618618
assert!(validate_witness(&backend, witness_map, &circuit).is_ok());
619619
}
620620

@@ -634,7 +634,7 @@ mod tests {
634634
(Witness(3), FieldElement::from(0b1111u128)), // Wrong!
635635
]));
636636

637-
let backend = Bn254BlackBoxSolver(false);
637+
let backend = Bn254BlackBoxSolver;
638638
assert!(validate_witness(&backend, witness_map, &circuit).is_err());
639639
}
640640

@@ -651,7 +651,7 @@ mod tests {
651651
// Empty witness map - missing w1
652652
let witness_map = WitnessMap::default();
653653

654-
let backend = Bn254BlackBoxSolver(false);
654+
let backend = Bn254BlackBoxSolver;
655655
// The expression evaluates with missing witness, but won't be zero
656656
// so this should fail
657657
assert!(validate_witness(&backend, witness_map, &circuit).is_err());
@@ -674,7 +674,7 @@ mod tests {
674674
(Witness(3), FieldElement::from(3u128)),
675675
]));
676676

677-
let backend = Bn254BlackBoxSolver(false);
677+
let backend = Bn254BlackBoxSolver;
678678
assert!(validate_witness(&backend, witness_map, &circuit).is_ok());
679679
}
680680

@@ -695,7 +695,7 @@ mod tests {
695695
(Witness(3), FieldElement::from(3u128)),
696696
]));
697697

698-
let backend = Bn254BlackBoxSolver(false);
698+
let backend = Bn254BlackBoxSolver;
699699
assert!(validate_witness(&backend, witness_map, &circuit).is_err());
700700
}
701701

@@ -716,7 +716,7 @@ mod tests {
716716
(Witness(2), FieldElement::from(2u128)),
717717
]));
718718

719-
let backend = Bn254BlackBoxSolver(false);
719+
let backend = Bn254BlackBoxSolver;
720720
assert!(validate_witness(&backend, witness_map, &circuit).is_err());
721721
}
722722

@@ -741,7 +741,7 @@ mod tests {
741741
let witness_map =
742742
WitnessMap::from(BTreeMap::from_iter([(Witness(4), FieldElement::zero())]));
743743

744-
let backend = Bn254BlackBoxSolver(false);
744+
let backend = Bn254BlackBoxSolver;
745745
assert!(validate_witness(&backend, witness_map, &circuit).is_ok());
746746
}
747747

@@ -771,7 +771,7 @@ mod tests {
771771
(Witness(3), FieldElement::from(42u128)), // Should match value at index 0
772772
]));
773773

774-
let backend = Bn254BlackBoxSolver(false);
774+
let backend = Bn254BlackBoxSolver;
775775
assert!(validate_witness(&backend, witness_map, &circuit).is_ok());
776776
}
777777

@@ -799,7 +799,7 @@ mod tests {
799799
(Witness(3), FieldElement::from(99u128)), // Wrong! Should be 42
800800
]));
801801

802-
let backend = Bn254BlackBoxSolver(false);
802+
let backend = Bn254BlackBoxSolver;
803803
assert!(validate_witness(&backend, witness_map, &circuit).is_err());
804804
}
805805

@@ -835,7 +835,7 @@ mod tests {
835835
(Witness(4), FieldElement::from(100u128)), // Read should get written value
836836
]));
837837

838-
let backend = Bn254BlackBoxSolver(false);
838+
let backend = Bn254BlackBoxSolver;
839839
assert!(validate_witness(&backend, witness_map, &circuit).is_ok());
840840
}
841841

@@ -859,7 +859,7 @@ mod tests {
859859
// Empty witness map
860860
let witness_map = WitnessMap::default();
861861

862-
let backend = Bn254BlackBoxSolver(false);
862+
let backend = Bn254BlackBoxSolver;
863863
assert!(validate_witness(&backend, witness_map, &circuit).is_ok());
864864
}
865865
}

acvm-repo/acvm/src/pwg/brillig.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ mod tests {
377377
let inputs =
378378
vec![BrilligInputs::Single(w1), BrilligInputs::Single(w2), BrilligInputs::Single(w3)];
379379

380-
let backend = acvm_blackbox_solver::StubbedBlackBoxSolver(false);
380+
let backend = acvm_blackbox_solver::StubbedBlackBoxSolver;
381381
let bytecode = vec![
382382
Opcode::Const {
383383
destination: MemoryAddress::Direct(21),

acvm-repo/acvm/src/pwg/memory_op.rs

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ impl<F: AcirField> MemoryOpSolver<F> {
106106
&mut self,
107107
op: &MemOp<F>,
108108
initial_witness: &mut WitnessMap<F>,
109-
pedantic_solving: bool,
110109
) -> Result<(), OpcodeResolutionError<F>> {
111110
let operation = get_value(&op.operation, initial_witness)?;
112111

@@ -122,15 +121,13 @@ impl<F: AcirField> MemoryOpSolver<F> {
122121

123122
// `operation == 0` implies a read operation. (`operation == 1` implies write operation).
124123
let is_read_operation = operation.is_zero();
125-
if pedantic_solving {
126-
// We expect that the 'operation' should resolve to either 0 or 1.
127-
if !is_read_operation && !operation.is_one() {
128-
let opcode_location = ErrorLocation::Unresolved;
129-
return Err(OpcodeResolutionError::MemoryOperationLargerThanOne {
130-
opcode_location,
131-
operation,
132-
});
133-
}
124+
// We expect that the 'operation' should resolve to either 0 or 1.
125+
if !is_read_operation && !operation.is_one() {
126+
let opcode_location = ErrorLocation::Unresolved;
127+
return Err(OpcodeResolutionError::MemoryOperationLargerThanOne {
128+
opcode_location,
129+
operation,
130+
});
134131
}
135132

136133
if is_read_operation {
@@ -187,8 +184,7 @@ mod tests {
187184
let mut block_solver = MemoryOpSolver::new(&init, &initial_witness).unwrap();
188185

189186
for op in trace {
190-
let pedantic_solving = true;
191-
block_solver.solve_memory_op(&op, &mut initial_witness, pedantic_solving).unwrap();
187+
block_solver.solve_memory_op(&op, &mut initial_witness).unwrap();
192188
}
193189

194190
assert_eq!(initial_witness[&Witness(4)], FieldElement::from(2u128));
@@ -212,9 +208,7 @@ mod tests {
212208
let mut err = None;
213209
for op in invalid_trace {
214210
if err.is_none() {
215-
let pedantic_solving = true;
216-
err =
217-
block_solver.solve_memory_op(&op, &mut initial_witness, pedantic_solving).err();
211+
err = block_solver.solve_memory_op(&op, &mut initial_witness).err();
218212
}
219213
}
220214

acvm-repo/acvm/src/pwg/mod.rs

Lines changed: 12 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ impl<'a, F: AcirField, B: BlackBoxFunctionSolver<F>> ACVM<'a, F, B> {
504504
.block_solvers
505505
.get_mut(block_id)
506506
.expect("Memory block should have been initialized before use");
507-
solver.solve_memory_op(op, &mut self.witness_map, self.backend.pedantic_solving())
507+
solver.solve_memory_op(op, &mut self.witness_map)
508508
}
509509
Opcode::BrilligCall { id, inputs, outputs, predicate } => {
510510
match self.solve_brillig_call_opcode(id, inputs, outputs, predicate) {
@@ -612,12 +612,7 @@ impl<'a, F: AcirField, B: BlackBoxFunctionSolver<F>> ACVM<'a, F, B> {
612612
) -> Result<Option<ForeignCallWaitInfo<F>>, OpcodeResolutionError<F>> {
613613
let opcode_location =
614614
ErrorLocation::Resolved(OpcodeLocation::Acir(self.instruction_pointer()));
615-
if is_predicate_false(
616-
&self.witness_map,
617-
predicate,
618-
self.backend.pedantic_solving(),
619-
&opcode_location,
620-
)? {
615+
if is_predicate_false(&self.witness_map, predicate, &opcode_location)? {
621616
return BrilligSolver::<F, B>::zero_out_brillig_outputs(&mut self.witness_map, outputs)
622617
.map(|_| None);
623618
}
@@ -696,12 +691,7 @@ impl<'a, F: AcirField, B: BlackBoxFunctionSolver<F>> ACVM<'a, F, B> {
696691
let opcode_location =
697692
ErrorLocation::Resolved(OpcodeLocation::Acir(self.instruction_pointer()));
698693
let witness = &mut self.witness_map;
699-
let should_skip = match is_predicate_false(
700-
witness,
701-
predicate,
702-
self.backend.pedantic_solving(),
703-
&opcode_location,
704-
) {
694+
let should_skip = match is_predicate_false(witness, predicate, &opcode_location) {
705695
Ok(result) => result,
706696
Err(err) => return StepResult::Status(self.handle_opcode_resolution(Err(err))),
707697
};
@@ -754,12 +744,7 @@ impl<'a, F: AcirField, B: BlackBoxFunctionSolver<F>> ACVM<'a, F, B> {
754744
return Err(OpcodeResolutionError::AcirMainCallAttempted { opcode_location });
755745
}
756746

757-
if is_predicate_false(
758-
&self.witness_map,
759-
predicate,
760-
self.backend.pedantic_solving(),
761-
&opcode_location,
762-
)? {
747+
if is_predicate_false(&self.witness_map, predicate, &opcode_location)? {
763748
// Zero out the outputs if we have a false predicate
764749
for output in outputs {
765750
insert_value(output, F::zero(), &mut self.witness_map)?;
@@ -898,21 +883,17 @@ fn any_witness_from_expression<F>(expr: &Expression<F>) -> Option<Witness> {
898883
pub(crate) fn is_predicate_false<F: AcirField>(
899884
witness: &WitnessMap<F>,
900885
predicate: &Expression<F>,
901-
pedantic_solving: bool,
902886
opcode_location: &ErrorLocation,
903887
) -> Result<bool, OpcodeResolutionError<F>> {
904888
let pred_value = get_value(predicate, witness)?;
905889
let predicate_is_false = pred_value.is_zero();
906-
if pedantic_solving {
907-
// We expect that the predicate should resolve to either 0 or 1.
908-
if !predicate_is_false && !pred_value.is_one() {
909-
let opcode_location = *opcode_location;
910-
return Err(OpcodeResolutionError::PredicateLargerThanOne {
911-
opcode_location,
912-
pred_value,
913-
});
914-
}
890+
891+
// We expect that the predicate should resolve to either 0 or 1.
892+
if !predicate_is_false && !pred_value.is_one() {
893+
let opcode_location = *opcode_location;
894+
return Err(OpcodeResolutionError::PredicateLargerThanOne { opcode_location, pred_value });
915895
}
896+
916897
Ok(predicate_is_false)
917898
}
918899

@@ -947,7 +928,7 @@ mod tests {
947928
(Witness(2), FieldElement::from(1u128)),
948929
(Witness(3), FieldElement::from(2u128)),
949930
]));
950-
let backend = acvm_blackbox_solver::StubbedBlackBoxSolver(false);
931+
let backend = acvm_blackbox_solver::StubbedBlackBoxSolver;
951932

952933
let src = "
953934
BLACKBOX::RANGE input: w1, bits: 32
@@ -967,7 +948,7 @@ mod tests {
967948
fn errors_when_calling_function_zero() {
968949
let initial_witness =
969950
WitnessMap::from(BTreeMap::from_iter([(Witness(1), FieldElement::from(1u128))]));
970-
let backend = acvm_blackbox_solver::StubbedBlackBoxSolver(false);
951+
let backend = acvm_blackbox_solver::StubbedBlackBoxSolver;
971952

972953
let src = "
973954
CALL func: 0, predicate: 1, inputs: [w1], outputs: [w2]

0 commit comments

Comments
 (0)