-
Notifications
You must be signed in to change notification settings - Fork 199
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(acvm): Mark outputs of Opcode::Call solvable (#4708)
# Description ## Problem\* Resolves <!-- Link to GitHub Issue --> No issue as bug found while experimenting ## Summary\* We should mark the outputs of a call as solvable. Otherwise we can potentially have more than one linear term and the outputs of call will not be used by the transformers. The new test `fold_call_witness_condition` would previously error out with the following when `nargo info` was ran: ``` The backend encountered an error: "backend_binary: /home/runner/work/aztec-packages/aztec-packages/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_to_constraint_buf.hpp:57: poly_triple acir_format::serialize_arithmetic_gate(const Program::Expression &): Assertion `(arg.mul_terms.size() <= 1)' failed.\n" ``` Now it successfully calls nargo info on main (we still need to update fetching the info for every circuit). ## Additional Context ## Documentation\* Check one: - [ ] No documentation needed. - [ ] Documentation included in this PR. - [ ] **[For Experimental Features]** Documentation to be submitted in a separate PR. # PR Checklist\* - [ ] I have tested the changes locally. - [ ] I have formatted the changes with [Prettier](https://prettier.io/) and/or `cargo fmt` on default settings.
- Loading branch information
Showing
5 changed files
with
34 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
test_programs/execution_success/fold_call_witness_condition/Nargo.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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] |
5 changes: 5 additions & 0 deletions
5
test_programs/execution_success/fold_call_witness_condition/Prover.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
16 changes: 16 additions & 0 deletions
16
test_programs/execution_success/fold_call_witness_condition/src/main.nr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,3 +14,4 @@ signed_comparison | |
to_bytes_integration | ||
fold_basic | ||
fold_basic_nested_call | ||
fold_call_witness_condition |