Skip to content

Commit 438dcab

Browse files
author
AztecBot
committed
feat!: type-check trait default methods (noir-lang/noir#6645)
feat: `--pedantic-solving` flag (noir-lang/noir#6716) feat!: update `aes128_encrypt` to return an array (noir-lang/noir#6973) fix: wrong module to lookup trait when using crate or super (noir-lang/noir#6974) fix: Start RC at 1 again (noir-lang/noir#6958) feat!: turn TypeIsMorePrivateThenItem into an error (noir-lang/noir#6953) fix: don't fail parsing macro if there are parser warnings (noir-lang/noir#6969) fix: error on missing function parameters (noir-lang/noir#6967) feat: don't report warnings for dependencies (noir-lang/noir#6926) chore: simplify boolean in a mul of a mul (noir-lang/noir#6951) feat(ssa): Immediately simplify away RefCount instructions in ACIR functions (noir-lang/noir#6893) chore: Move comment as part of #6945 (noir-lang/noir#6959) chore: Separate unconstrained functions during monomorphization (noir-lang/noir#6894) feat!: turn CannotReexportItemWithLessVisibility into an error (noir-lang/noir#6952) feat: lock on Nargo.toml on several nargo commands (noir-lang/noir#6941) feat: don't simplify SSA instructions when creating them from a string (noir-lang/noir#6948) chore: add reproduction case for bignum test failure (noir-lang/noir#6464) chore: bump `noir-gates-diff` (noir-lang/noir#6949) feat(test): Enable the test fuzzer for Wasm (noir-lang/noir#6835) chore: also print test output to stdout in CI (noir-lang/noir#6930) fix: Non-determinism from under constrained checks (noir-lang/noir#6945) chore: use logs for benchmarking (noir-lang/noir#6911) chore: bump `noir-gates-diff` (noir-lang/noir#6944) chore: bump `noir-gates-diff` (noir-lang/noir#6943) fix: Show output of `test_program_is_idempotent` on failure (noir-lang/noir#6942) chore: delete a bunch of dead code from `noirc_evaluator` (noir-lang/noir#6939) feat: require trait function calls (`Foo::bar()`) to have the trait in scope (imported) (noir-lang/noir#6882) chore: Bump arkworks to version `0.5.0` (noir-lang/noir#6871)
2 parents 051613b + 5badb7a commit 438dcab

File tree

83 files changed

+1475
-502
lines changed

Some content is hidden

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

83 files changed

+1475
-502
lines changed

.noir-sync-commit

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
7cc8dbfe670aeaf9ec84f30265417658f5465d11
1+
8bb3908281d531160db7d7898c67fb2647792e6e

noir/noir-repo/.github/workflows/reports.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ jobs:
299299
fail-fast: false
300300
matrix:
301301
include:
302-
- project: { repo: AztecProtocol/aztec-packages, path: noir-projects/noir-contracts, is_library: true }
302+
# - project: { repo: AztecProtocol/aztec-packages, path: noir-projects/noir-contracts, is_library: true }
303303
- project: { repo: AztecProtocol/aztec-packages, path: noir-projects/noir-protocol-circuits/crates/private-kernel-inner, take_average: true }
304304
- project: { repo: AztecProtocol/aztec-packages, path: noir-projects/noir-protocol-circuits/crates/private-kernel-tail, take_average: true }
305305
- project: { repo: AztecProtocol/aztec-packages, path: noir-projects/noir-protocol-circuits/crates/private-kernel-reset, take_average: true }

noir/noir-repo/.github/workflows/test-js-packages.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,7 @@ jobs:
597597
- name: Run nargo test
598598
working-directory: ./test-repo/${{ matrix.project.path }}
599599
run: |
600-
nargo test --silence-warnings --skip-brillig-constraints-check --format json ${{ matrix.project.nargo_args }} | tee ${{ github.workspace }}/noir-repo/.github/critical_libraries_status/${{ matrix.project.repo }}/${{ matrix.project.path }}.actual.jsonl
600+
nargo test --silence-warnings --pedantic-solving --skip-brillig-constraints-check --format json ${{ matrix.project.nargo_args }} | tee ${{ github.workspace }}/noir-repo/.github/critical_libraries_status/${{ matrix.project.repo }}/${{ matrix.project.path }}.actual.jsonl
601601
env:
602602
NARGO_IGNORE_TEST_FAILURES_FROM_FOREIGN_CALLS: true
603603

noir/noir-repo/Cargo.lock

+46
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

noir/noir-repo/acvm-repo/acvm/src/pwg/blackbox/bigint.rs

+8-1
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,16 @@ use crate::pwg::OpcodeResolutionError;
1212
/// - When it encounters a bigint operation opcode, it performs the operation on the stored values
1313
/// and store the result using the provided ID.
1414
/// - When it gets a to_bytes opcode, it simply looks up the value and resolves the output witness accordingly.
15-
#[derive(Default)]
1615
pub(crate) struct AcvmBigIntSolver {
1716
bigint_solver: BigIntSolver,
1817
}
1918

2019
impl AcvmBigIntSolver {
20+
pub(crate) fn with_pedantic_solving(pedantic_solving: bool) -> AcvmBigIntSolver {
21+
let bigint_solver = BigIntSolver::with_pedantic_solving(pedantic_solving);
22+
AcvmBigIntSolver { bigint_solver }
23+
}
24+
2125
pub(crate) fn bigint_from_bytes<F: AcirField>(
2226
&mut self,
2327
inputs: &[FunctionInput<F>],
@@ -39,6 +43,9 @@ impl AcvmBigIntSolver {
3943
outputs: &[Witness],
4044
initial_witness: &mut WitnessMap<F>,
4145
) -> Result<(), OpcodeResolutionError<F>> {
46+
if self.bigint_solver.pedantic_solving() && outputs.len() != 32 {
47+
panic!("--pedantic-solving: bigint_to_bytes: outputs.len() != 32: {}", outputs.len());
48+
}
4249
let mut bytes = self.bigint_solver.bigint_to_bytes(input)?;
4350
while bytes.len() < outputs.len() {
4451
bytes.push(0);

noir/noir-repo/acvm-repo/acvm/src/pwg/blackbox/logic.rs

+8-4
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,14 @@ pub(super) fn and<F: AcirField>(
1414
lhs: &FunctionInput<F>,
1515
rhs: &FunctionInput<F>,
1616
output: &Witness,
17+
pedantic_solving: bool,
1718
) -> Result<(), OpcodeResolutionError<F>> {
1819
assert_eq!(
1920
lhs.num_bits(),
2021
rhs.num_bits(),
2122
"number of bits specified for each input must be the same"
2223
);
23-
solve_logic_opcode(initial_witness, lhs, rhs, *output, |left, right| {
24+
solve_logic_opcode(initial_witness, lhs, rhs, *output, pedantic_solving, |left, right| {
2425
bit_and(left, right, lhs.num_bits())
2526
})
2627
}
@@ -32,13 +33,14 @@ pub(super) fn xor<F: AcirField>(
3233
lhs: &FunctionInput<F>,
3334
rhs: &FunctionInput<F>,
3435
output: &Witness,
36+
pedantic_solving: bool,
3537
) -> Result<(), OpcodeResolutionError<F>> {
3638
assert_eq!(
3739
lhs.num_bits(),
3840
rhs.num_bits(),
3941
"number of bits specified for each input must be the same"
4042
);
41-
solve_logic_opcode(initial_witness, lhs, rhs, *output, |left, right| {
43+
solve_logic_opcode(initial_witness, lhs, rhs, *output, pedantic_solving, |left, right| {
4244
bit_xor(left, right, lhs.num_bits())
4345
})
4446
}
@@ -49,11 +51,13 @@ fn solve_logic_opcode<F: AcirField>(
4951
a: &FunctionInput<F>,
5052
b: &FunctionInput<F>,
5153
result: Witness,
54+
pedantic_solving: bool,
5255
logic_op: impl Fn(F, F) -> F,
5356
) -> Result<(), OpcodeResolutionError<F>> {
54-
// TODO(https://github.com/noir-lang/noir/issues/5985): re-enable these once we figure out how to combine these with existing
57+
// TODO(https://github.com/noir-lang/noir/issues/5985): re-enable these by
58+
// default once we figure out how to combine these with existing
5559
// noirc_frontend/noirc_evaluator overflow error messages
56-
let skip_bitsize_checks = true;
60+
let skip_bitsize_checks = !pedantic_solving;
5761
let w_l_value = input_to_value(initial_witness, *a, skip_bitsize_checks)?;
5862
let w_r_value = input_to_value(initial_witness, *b, skip_bitsize_checks)?;
5963
let assignment = logic_op(w_l_value, w_r_value);

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

+9-3
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,15 @@ pub(crate) fn solve<F: AcirField>(
7676
BlackBoxFuncCall::AES128Encrypt { inputs, iv, key, outputs } => {
7777
solve_aes128_encryption_opcode(initial_witness, inputs, iv, key, outputs)
7878
}
79-
BlackBoxFuncCall::AND { lhs, rhs, output } => and(initial_witness, lhs, rhs, output),
80-
BlackBoxFuncCall::XOR { lhs, rhs, output } => xor(initial_witness, lhs, rhs, output),
81-
BlackBoxFuncCall::RANGE { input } => solve_range_opcode(initial_witness, input),
79+
BlackBoxFuncCall::AND { lhs, rhs, output } => {
80+
and(initial_witness, lhs, rhs, output, backend.pedantic_solving())
81+
}
82+
BlackBoxFuncCall::XOR { lhs, rhs, output } => {
83+
xor(initial_witness, lhs, rhs, output, backend.pedantic_solving())
84+
}
85+
BlackBoxFuncCall::RANGE { input } => {
86+
solve_range_opcode(initial_witness, input, backend.pedantic_solving())
87+
}
8288
BlackBoxFuncCall::Blake2s { inputs, outputs } => {
8389
solve_generic_256_hash_opcode(initial_witness, inputs, None, outputs, blake2s)
8490
}

noir/noir-repo/acvm-repo/acvm/src/pwg/blackbox/range.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@ use acir::{circuit::opcodes::FunctionInput, native_types::WitnessMap, AcirField}
77
pub(crate) fn solve_range_opcode<F: AcirField>(
88
initial_witness: &WitnessMap<F>,
99
input: &FunctionInput<F>,
10+
pedantic_solving: bool,
1011
) -> Result<(), OpcodeResolutionError<F>> {
1112
// TODO(https://github.com/noir-lang/noir/issues/5985):
12-
// re-enable bitsize checks
13-
let skip_bitsize_checks = true;
13+
// re-enable bitsize checks by default
14+
let skip_bitsize_checks = !pedantic_solving;
1415
let w_value = input_to_value(initial_witness, *input, skip_bitsize_checks)?;
1516
if w_value.num_bits() > input.num_bits() {
1617
return Err(OpcodeResolutionError::UnsatisfiedConstrain {

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

+25-5
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ impl<F: AcirField> MemoryOpSolver<F> {
6666
op: &MemOp<F>,
6767
initial_witness: &mut WitnessMap<F>,
6868
predicate: &Option<Expression<F>>,
69+
pedantic_solving: bool,
6970
) -> Result<(), OpcodeResolutionError<F>> {
7071
let operation = get_value(&op.operation, initial_witness)?;
7172

@@ -83,7 +84,9 @@ impl<F: AcirField> MemoryOpSolver<F> {
8384
let is_read_operation = operation.is_zero();
8485

8586
// Fetch whether or not the predicate is false (e.g. equal to zero)
86-
let skip_operation = is_predicate_false(initial_witness, predicate)?;
87+
let opcode_location = ErrorLocation::Unresolved;
88+
let skip_operation =
89+
is_predicate_false(initial_witness, predicate, pedantic_solving, &opcode_location)?;
8790

8891
if is_read_operation {
8992
// `value_read = arr[memory_index]`
@@ -131,6 +134,9 @@ mod tests {
131134

132135
use super::MemoryOpSolver;
133136

137+
// use pedantic_solving for tests
138+
const PEDANTIC_SOLVING: bool = true;
139+
134140
#[test]
135141
fn test_solver() {
136142
let mut initial_witness = WitnessMap::from(BTreeMap::from_iter([
@@ -150,7 +156,9 @@ mod tests {
150156
block_solver.init(&init, &initial_witness).unwrap();
151157

152158
for op in trace {
153-
block_solver.solve_memory_op(&op, &mut initial_witness, &None).unwrap();
159+
block_solver
160+
.solve_memory_op(&op, &mut initial_witness, &None, PEDANTIC_SOLVING)
161+
.unwrap();
154162
}
155163

156164
assert_eq!(initial_witness[&Witness(4)], FieldElement::from(2u128));
@@ -175,7 +183,9 @@ mod tests {
175183
let mut err = None;
176184
for op in invalid_trace {
177185
if err.is_none() {
178-
err = block_solver.solve_memory_op(&op, &mut initial_witness, &None).err();
186+
err = block_solver
187+
.solve_memory_op(&op, &mut initial_witness, &None, PEDANTIC_SOLVING)
188+
.err();
179189
}
180190
}
181191

@@ -209,7 +219,12 @@ mod tests {
209219
for op in invalid_trace {
210220
if err.is_none() {
211221
err = block_solver
212-
.solve_memory_op(&op, &mut initial_witness, &Some(Expression::zero()))
222+
.solve_memory_op(
223+
&op,
224+
&mut initial_witness,
225+
&Some(Expression::zero()),
226+
PEDANTIC_SOLVING,
227+
)
213228
.err();
214229
}
215230
}
@@ -241,7 +256,12 @@ mod tests {
241256
for op in invalid_trace {
242257
if err.is_none() {
243258
err = block_solver
244-
.solve_memory_op(&op, &mut initial_witness, &Some(Expression::zero()))
259+
.solve_memory_op(
260+
&op,
261+
&mut initial_witness,
262+
&Some(Expression::zero()),
263+
PEDANTIC_SOLVING,
264+
)
245265
.err();
246266
}
247267
}

0 commit comments

Comments
 (0)