diff --git a/acvm-repo/acvm/src/compiler/transformers/mod.rs b/acvm-repo/acvm/src/compiler/transformers/mod.rs index 1ba261b09a3..003cd4279a1 100644 --- a/acvm-repo/acvm/src/compiler/transformers/mod.rs +++ b/acvm-repo/acvm/src/compiler/transformers/mod.rs @@ -142,7 +142,11 @@ pub(super) fn transform_internal( new_acir_opcode_positions.push(acir_opcode_positions[index]); transformed_opcodes.push(opcode); } - Opcode::Call { .. } => { + Opcode::Call { ref outputs, .. } => { + for witness in outputs { + transformer.mark_solvable(*witness); + } + // `Call` does not write values to the `WitnessMap` // A separate ACIR function should have its own respective `WitnessMap` new_acir_opcode_positions.push(acir_opcode_positions[index]); diff --git a/test_programs/execution_success/fold_call_witness_condition/Nargo.toml b/test_programs/execution_success/fold_call_witness_condition/Nargo.toml new file mode 100644 index 00000000000..cedaea348c5 --- /dev/null +++ b/test_programs/execution_success/fold_call_witness_condition/Nargo.toml @@ -0,0 +1,7 @@ +[package] +name = "fold_call_witness_condition" +type = "bin" +authors = [""] +compiler_version = ">=0.26.0" + +[dependencies] \ No newline at end of file diff --git a/test_programs/execution_success/fold_call_witness_condition/Prover.toml b/test_programs/execution_success/fold_call_witness_condition/Prover.toml new file mode 100644 index 00000000000..8481ce25648 --- /dev/null +++ b/test_programs/execution_success/fold_call_witness_condition/Prover.toml @@ -0,0 +1,5 @@ +# TODO(https://github.com/noir-lang/noir/issues/4707): Change these inputs to fail the assertion in `fn return_value` +# and change `enable` to false. For now we need the inputs to pass as we do not handle predicates with ACIR calls +x = "5" +y = "10" +enable = true \ No newline at end of file diff --git a/test_programs/execution_success/fold_call_witness_condition/src/main.nr b/test_programs/execution_success/fold_call_witness_condition/src/main.nr new file mode 100644 index 00000000000..5dc75e4a99f --- /dev/null +++ b/test_programs/execution_success/fold_call_witness_condition/src/main.nr @@ -0,0 +1,16 @@ +global NUM_RESULTS = 2; +fn main(x: Field, y: pub Field, enable: bool) -> pub [Field; NUM_RESULTS] { + let mut result = [0; NUM_RESULTS]; + for i in 0..NUM_RESULTS { + if enable { + result[i] = return_value(x, y); + } + } + result +} + +#[fold] +fn return_value(x: Field, y: Field) -> Field { + assert(x != y); + x +} diff --git a/tooling/debugger/ignored-tests.txt b/tooling/debugger/ignored-tests.txt index 5a42ef36e7e..4507aeb8545 100644 --- a/tooling/debugger/ignored-tests.txt +++ b/tooling/debugger/ignored-tests.txt @@ -14,3 +14,4 @@ signed_comparison to_bytes_integration fold_basic fold_basic_nested_call +fold_call_witness_condition