Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(acvm): Mark outputs of Opcode::Call solvable #4708

Merged
merged 6 commits into from
Apr 3, 2024
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
6 changes: 5 additions & 1 deletion acvm-repo/acvm/src/compiler/transformers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[package]
name = "fold_call_witness_condition"
type = "bin"
authors = [""]
compiler_version = ">=0.26.0"

[dependencies]
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
}
1 change: 1 addition & 0 deletions tooling/debugger/ignored-tests.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ signed_comparison
to_bytes_integration
fold_basic
fold_basic_nested_call
fold_call_witness_condition
Loading