diff --git a/compiler/noirc_evaluator/src/ssa/opt/mem2reg.rs b/compiler/noirc_evaluator/src/ssa/opt/mem2reg.rs index 15dc2a66b87..a4e5f7dd8be 100644 --- a/compiler/noirc_evaluator/src/ssa/opt/mem2reg.rs +++ b/compiler/noirc_evaluator/src/ssa/opt/mem2reg.rs @@ -137,9 +137,9 @@ struct PerFunctionContext<'f> { /// If a value is not used in anymore loads we can remove the last store to that value. last_loads: HashMap, - /// Track whether a reference was passed into another entry point + /// Track whether a reference was passed into another instruction (e.g. Call) /// This is needed to determine whether we can remove a store. - calls_reference_input: HashSet, + instruction_input_references: HashSet, /// Track whether a reference has been aliased, and store the respective /// instruction that aliased that reference. @@ -159,8 +159,8 @@ impl<'f> PerFunctionContext<'f> { blocks: BTreeMap::new(), instructions_to_remove: HashSet::default(), last_loads: HashMap::default(), - calls_reference_input: HashSet::default(), aliased_references: HashMap::default(), + instruction_input_references: HashSet::default(), } } @@ -239,26 +239,27 @@ impl<'f> PerFunctionContext<'f> { return true; } - let allocation_aliases_parameter = - aliases.any(|alias| self.calls_reference_input.contains(&alias)); - if allocation_aliases_parameter == Some(true) { + let allocation_aliases_instr_input = + aliases.any(|alias| self.instruction_input_references.contains(&alias)); + if allocation_aliases_instr_input == Some(true) { return true; } - let allocation_aliases_parameter = + let allocation_aliases_terminator_args = aliases.any(|alias| all_terminator_values.contains(&alias)); - if allocation_aliases_parameter == Some(true) { + if allocation_aliases_terminator_args == Some(true) { return true; } - let allocation_aliases_parameter = aliases.any(|alias| { + let all_aliases_set_for_removal = aliases.any(|alias| { if let Some(alias_instructions) = self.aliased_references.get(&alias) { self.instructions_to_remove.is_disjoint(alias_instructions) } else { false } }); - if allocation_aliases_parameter == Some(true) { + + if all_aliases_set_for_removal == Some(true) { return true; } } @@ -384,7 +385,6 @@ impl<'f> PerFunctionContext<'f> { if let Some(aliases) = references.aliases.get(expression) { let allocation_aliases_parameter = aliases.any(|alias| reference_parameters.contains(&alias)); - // If `allocation_aliases_parameter` is known to be false if allocation_aliases_parameter == Some(false) { self.instructions_to_remove.insert(*instruction); @@ -459,16 +459,11 @@ impl<'f> PerFunctionContext<'f> { self.instructions_to_remove.insert(*last_store); } - if self.inserter.function.dfg.value_is_reference(value) { - if let Some(expression) = references.expressions.get(&value) { - if let Some(aliases) = references.aliases.get(expression) { - aliases.for_each(|alias| { - self.aliased_references - .entry(alias) - .or_default() - .insert(instruction); - }); - } + if let Some(expression) = references.expressions.get(&value) { + if let Some(aliases) = references.aliases.get(expression) { + aliases.for_each(|alias| { + self.aliased_references.entry(alias).or_default().insert(instruction); + }); } } @@ -526,18 +521,20 @@ impl<'f> PerFunctionContext<'f> { } } Instruction::Call { arguments, .. } => { + // We want to fetch all aliases of each argument to be marked unknown as an array + // containing references internally can potentially be aliased by those references. + let mut all_aliases = Vec::new(); for arg in arguments { - if self.inserter.function.dfg.value_is_reference(*arg) { - if let Some(expression) = references.expressions.get(arg) { - if let Some(aliases) = references.aliases.get(expression) { - aliases.for_each(|alias| { - self.calls_reference_input.insert(alias); - }); - } + if let Some(expression) = references.expressions.get(arg) { + if let Some(aliases) = references.aliases.get(expression) { + aliases.for_each(|alias| { + self.instruction_input_references.insert(alias); + all_aliases.push(alias); + }); } } } - self.mark_all_unknown(arguments, references); + self.mark_all_unknown(&all_aliases, references); } Instruction::MakeArray { elements, typ } => { // If `array` is an array constant that contains reference types, then insert each element @@ -547,7 +544,7 @@ impl<'f> PerFunctionContext<'f> { let expr = Expression::ArrayElement(Box::new(Expression::Other(array))); references.expressions.insert(array, expr.clone()); - let aliases = references.aliases.entry(expr).or_default(); + let aliases = references.aliases.entry(expr).or_insert(AliasSet::known_empty()); for element in elements { aliases.insert(*element); @@ -1234,4 +1231,69 @@ mod tests { // We expect the program to be unchanged assert_normalized_ssa_equals(ssa, src); } + + #[test] + fn keep_last_store_in_make_array_used_in_call_single_block() { + // This checks that when an array containing references is used in a call + // that we do not remove the original stores to those internal references + let src = r" + brillig(inline) fn main f0 { + b0(): + v0 = allocate -> &mut Field + store Field 1 at v0 + v3 = make_array [u32 0, v0] : [(u32, &mut Field); 1] + v5 = call f1(v3) -> Field + v6 = load v0 -> Field // make sure this isn't optimized to Field 1 + return v3 + } + brillig(inline) fn foo f1 { + b0(v0: [(u32, &mut Field); 1]): + v2 = array_get v0, index u32 1 -> &mut Field + v3 = load v2 -> Field + store Field 77 at v2 + return v3 + } + "; + + let ssa = Ssa::from_str(src).unwrap(); + let ssa = ssa.mem2reg(); + assert_normalized_ssa_equals(ssa, src); + } + + #[test] + fn keep_last_store_used_in_make_array_used_as_reference() { + let src = r" + acir(inline) fn main f0 { + b0(): + v2 = allocate -> &mut u1 + store u1 0 at v2 + v4 = make_array [v2] : [&mut u1; 1] + v5 = allocate -> &mut [&mut u1; 1] + store v4 at v5 + jmp b1(u32 0) + b1(v0: u32): + v7 = eq v0, u32 0 + jmpif v7 then: b2, else: b3 + b2(): + v14 = unchecked_add v0, u32 1 + jmp b1(v14) + b3(): + v8 = load v5 -> [&mut u1; 1] + v9 = array_get v8, index u32 0 -> &mut u1 + v10 = load v9 -> u1 + jmpif v10 then: b4, else: b5 + b4(): + jmp b6(Field 0) + b5(): + jmp b6(Field 1) + b6(v1: Field): + return v1 + } + "; + + let ssa = Ssa::from_str(src).unwrap(); + let ssa = ssa.mem2reg(); + + assert_normalized_ssa_equals(ssa, src); + } } diff --git a/test_programs/execution_success/regression_8739/Nargo.toml b/test_programs/execution_success/regression_8739/Nargo.toml new file mode 100644 index 00000000000..00e55a7b5dd --- /dev/null +++ b/test_programs/execution_success/regression_8739/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "regression_8739" +type = "bin" +authors = [""] + +[dependencies] \ No newline at end of file diff --git a/test_programs/execution_success/regression_8739/src/main.nr b/test_programs/execution_success/regression_8739/src/main.nr new file mode 100644 index 00000000000..2838166facd --- /dev/null +++ b/test_programs/execution_success/regression_8739/src/main.nr @@ -0,0 +1,15 @@ +fn main() { + // Safety: testing context + unsafe { + func_2() + } +} +unconstrained fn func_2() { + let mut a: [&mut bool; 1] = [&mut true]; + let mut idx_b: u32 = 0; + while *a[0] { + if idx_b == 0 { + break; + } + } +} diff --git a/test_programs/execution_success/regression_8755/Nargo.toml b/test_programs/execution_success/regression_8755/Nargo.toml new file mode 100644 index 00000000000..3cd2742f84c --- /dev/null +++ b/test_programs/execution_success/regression_8755/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "regression_8755" +type = "bin" +authors = [""] + +[dependencies] \ No newline at end of file diff --git a/test_programs/execution_success/regression_8755/src/main.nr b/test_programs/execution_success/regression_8755/src/main.nr new file mode 100644 index 00000000000..a6720a12728 --- /dev/null +++ b/test_programs/execution_success/regression_8755/src/main.nr @@ -0,0 +1,14 @@ +unconstrained fn main() -> pub Field { + func_2([(0, &mut -292434322542114415011969994633470574393)]) +} +unconstrained fn func_2(mut b: [(u32, &mut Field); 1]) -> Field { + let mut idx_e: u32 = 0; + loop { + if idx_e == 1 { + break; + } else { + idx_e = idx_e + 1; + } + } + (157653526363045079447323020681982670581 / *b[0].1) +} diff --git a/test_programs/execution_success/regression_8761/Nargo.toml b/test_programs/execution_success/regression_8761/Nargo.toml new file mode 100644 index 00000000000..fe3b4b19d94 --- /dev/null +++ b/test_programs/execution_success/regression_8761/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "regression_8761" +type = "bin" +authors = [""] + +[dependencies] \ No newline at end of file diff --git a/test_programs/execution_success/regression_8761/src/main.nr b/test_programs/execution_success/regression_8761/src/main.nr new file mode 100644 index 00000000000..9691286f614 --- /dev/null +++ b/test_programs/execution_success/regression_8761/src/main.nr @@ -0,0 +1,11 @@ +fn main() -> pub Field { + let mut d: [&mut bool; 1] = [(&mut false)]; + + for _ in 0..1 {} // Without this it compiles + + if *d[0] { + 0 + } else { + 1 + } +} diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/regression_8739/execute__tests__expanded.snap b/tooling/nargo_cli/tests/snapshots/execution_success/regression_8739/execute__tests__expanded.snap new file mode 100644 index 00000000000..e16cfe20a5b --- /dev/null +++ b/tooling/nargo_cli/tests/snapshots/execution_success/regression_8739/execute__tests__expanded.snap @@ -0,0 +1,20 @@ +--- +source: tooling/nargo_cli/tests/execute.rs +expression: expanded_code +--- +fn main() { + // Safety: comment added by `nargo expand` + unsafe { + func_2() + } +} + +unconstrained fn func_2() { + let mut a: [&mut bool; 1] = [&mut true]; + let mut idx_b: u32 = 0; + while *a[0] { + if idx_b == 0 { + break; + } + } +} diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/regression_8739/execute__tests__force_brillig_false_inliner_-9223372036854775808.snap b/tooling/nargo_cli/tests/snapshots/execution_success/regression_8739/execute__tests__force_brillig_false_inliner_-9223372036854775808.snap new file mode 100644 index 00000000000..4705b1c3742 --- /dev/null +++ b/tooling/nargo_cli/tests/snapshots/execution_success/regression_8739/execute__tests__force_brillig_false_inliner_-9223372036854775808.snap @@ -0,0 +1,26 @@ +--- +source: tooling/nargo_cli/tests/execute.rs +expression: artifact +--- +{ + "noir_version": "[noir_version]", + "hash": "[hash]", + "abi": { + "parameters": [], + "return_type": null, + "error_types": {} + }, + "bytecode": [ + "func 0", + "current witness index : _0", + "private parameters indices : []", + "public parameters indices : []", + "return value indices : []" + ], + "debug_symbols": "ndFLCsMgEAbgu7h2Ee0jTa9SSjBmEgRRMRooIXfvJGibFgolq3Hm95uFTqSFJva1Mp0dyPU2kcYrrVVfaytFUNbgdJopyW0dPACOyCZH5YQHE8jVRK0pGYWO66XBCbPWIDymBSVgWqy4sFMaltNM37r4Tc/HZEv+wqe/NSurxNml2OOrQ/ZVucNzxpLnnH34O3ZCKv/93qPwSjQaUttFIzdpeLic5P9y3kpoo4dl05rh7ic=", + "file_map": {}, + "names": [ + "main" + ], + "brillig_names": [] +} diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/regression_8739/execute__tests__force_brillig_false_inliner_0.snap b/tooling/nargo_cli/tests/snapshots/execution_success/regression_8739/execute__tests__force_brillig_false_inliner_0.snap new file mode 100644 index 00000000000..4705b1c3742 --- /dev/null +++ b/tooling/nargo_cli/tests/snapshots/execution_success/regression_8739/execute__tests__force_brillig_false_inliner_0.snap @@ -0,0 +1,26 @@ +--- +source: tooling/nargo_cli/tests/execute.rs +expression: artifact +--- +{ + "noir_version": "[noir_version]", + "hash": "[hash]", + "abi": { + "parameters": [], + "return_type": null, + "error_types": {} + }, + "bytecode": [ + "func 0", + "current witness index : _0", + "private parameters indices : []", + "public parameters indices : []", + "return value indices : []" + ], + "debug_symbols": "ndFLCsMgEAbgu7h2Ee0jTa9SSjBmEgRRMRooIXfvJGibFgolq3Hm95uFTqSFJva1Mp0dyPU2kcYrrVVfaytFUNbgdJopyW0dPACOyCZH5YQHE8jVRK0pGYWO66XBCbPWIDymBSVgWqy4sFMaltNM37r4Tc/HZEv+wqe/NSurxNml2OOrQ/ZVucNzxpLnnH34O3ZCKv/93qPwSjQaUttFIzdpeLic5P9y3kpoo4dl05rh7ic=", + "file_map": {}, + "names": [ + "main" + ], + "brillig_names": [] +} diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/regression_8739/execute__tests__force_brillig_false_inliner_9223372036854775807.snap b/tooling/nargo_cli/tests/snapshots/execution_success/regression_8739/execute__tests__force_brillig_false_inliner_9223372036854775807.snap new file mode 100644 index 00000000000..4705b1c3742 --- /dev/null +++ b/tooling/nargo_cli/tests/snapshots/execution_success/regression_8739/execute__tests__force_brillig_false_inliner_9223372036854775807.snap @@ -0,0 +1,26 @@ +--- +source: tooling/nargo_cli/tests/execute.rs +expression: artifact +--- +{ + "noir_version": "[noir_version]", + "hash": "[hash]", + "abi": { + "parameters": [], + "return_type": null, + "error_types": {} + }, + "bytecode": [ + "func 0", + "current witness index : _0", + "private parameters indices : []", + "public parameters indices : []", + "return value indices : []" + ], + "debug_symbols": "ndFLCsMgEAbgu7h2Ee0jTa9SSjBmEgRRMRooIXfvJGibFgolq3Hm95uFTqSFJva1Mp0dyPU2kcYrrVVfaytFUNbgdJopyW0dPACOyCZH5YQHE8jVRK0pGYWO66XBCbPWIDymBSVgWqy4sFMaltNM37r4Tc/HZEv+wqe/NSurxNml2OOrQ/ZVucNzxpLnnH34O3ZCKv/93qPwSjQaUttFIzdpeLic5P9y3kpoo4dl05rh7ic=", + "file_map": {}, + "names": [ + "main" + ], + "brillig_names": [] +} diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/regression_8739/execute__tests__force_brillig_true_inliner_-9223372036854775808.snap b/tooling/nargo_cli/tests/snapshots/execution_success/regression_8739/execute__tests__force_brillig_true_inliner_-9223372036854775808.snap new file mode 100644 index 00000000000..57e5a6ad8c7 --- /dev/null +++ b/tooling/nargo_cli/tests/snapshots/execution_success/regression_8739/execute__tests__force_brillig_true_inliner_-9223372036854775808.snap @@ -0,0 +1,41 @@ +--- +source: tooling/nargo_cli/tests/execute.rs +expression: artifact +--- +{ + "noir_version": "[noir_version]", + "hash": "[hash]", + "abi": { + "parameters": [], + "return_type": null, + "error_types": { + "17843811134343075018": { + "error_kind": "string", + "string": "Stack too deep" + } + } + }, + "bytecode": [ + "func 0", + "current witness index : _0", + "private parameters indices : []", + "public parameters indices : []", + "return value indices : []", + "BRILLIG CALL func 0: inputs: [], outputs: []", + "unconstrained func 0", + "[Const { destination: Direct(2), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(1), bit_size: Integer(U32), value: 32836 }, Const { destination: Direct(0), bit_size: Integer(U32), value: 3 }, Const { destination: Relative(1), bit_size: Integer(U32), value: 0 }, Const { destination: Relative(2), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(32836), size_address: Relative(1), offset_address: Relative(2) }, Call { location: 11 }, Call { location: 12 }, Const { destination: Relative(1), bit_size: Integer(U32), value: 32836 }, Const { destination: Relative(2), bit_size: Integer(U32), value: 0 }, Stop { return_data: HeapVector { pointer: Relative(1), size: Relative(2) } }, Return, Call { location: 19 }, Const { destination: Relative(1), bit_size: Integer(U32), value: 2 }, Mov { destination: Relative(2), source: Direct(0) }, BinaryIntOp { destination: Direct(0), op: Add, bit_size: U32, lhs: Direct(0), rhs: Relative(1) }, Call { location: 25 }, Mov { destination: Direct(0), source: Relative(0) }, Return, Const { destination: Direct(32772), bit_size: Integer(U32), value: 30720 }, BinaryIntOp { destination: Direct(32771), op: LessThan, bit_size: U32, lhs: Direct(0), rhs: Direct(32772) }, JumpIf { condition: Direct(32771), location: 24 }, IndirectConst { destination_pointer: Direct(1), bit_size: Integer(U64), value: 17843811134343075018 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return, Call { location: 19 }, Mov { destination: Relative(1), source: Direct(1) }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Direct(2) }, Const { destination: Relative(2), bit_size: Integer(U1), value: 1 }, Store { destination_pointer: Relative(1), source: Relative(2) }, Mov { destination: Relative(2), source: Direct(1) }, Const { destination: Relative(3), bit_size: Integer(U32), value: 2 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(3) }, IndirectConst { destination_pointer: Relative(2), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(3), op: Add, bit_size: U32, lhs: Relative(2), rhs: Direct(2) }, Mov { destination: Relative(4), source: Relative(3) }, Store { destination_pointer: Relative(4), source: Relative(1) }, Mov { destination: Relative(1), source: Direct(1) }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Direct(2) }, Store { destination_pointer: Relative(1), source: Relative(2) }, Mov { destination: Relative(2), source: Direct(1) }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Direct(2) }, Const { destination: Relative(3), bit_size: Integer(U32), value: 0 }, Store { destination_pointer: Relative(2), source: Relative(3) }, Const { destination: Relative(4), bit_size: Integer(U32), value: 1 }, Jump { location: 46 }, Load { destination: Relative(5), source_pointer: Relative(1) }, BinaryIntOp { destination: Relative(7), op: Add, bit_size: U32, lhs: Relative(5), rhs: Relative(4) }, Load { destination: Relative(6), source_pointer: Relative(7) }, Load { destination: Relative(5), source_pointer: Relative(6) }, JumpIf { condition: Relative(5), location: 52 }, Jump { location: 58 }, Load { destination: Relative(5), source_pointer: Relative(2) }, BinaryIntOp { destination: Relative(6), op: Equals, bit_size: U32, lhs: Relative(5), rhs: Relative(3) }, JumpIf { condition: Relative(6), location: 57 }, Jump { location: 56 }, Jump { location: 46 }, Jump { location: 58 }, Return]" + ], + "debug_symbols": "nZJNioQwEEbvknUWJuVfvErTSNTYBEKUtA4M4t2nYsUZezHQ9CbPsvI+KamNDaZbH6314/RkzW1jXbDO2Ufrpl4vdvL4dmNZPASwRnAmckJBKAnVAUmVTFVNUAcgIwiCJFAmUCZQJlAKUApQClBKjikSIQiSAISSgB4gaoI6UEgC3sz3nbNzvHYJxsTpLvPiX5h1MH5hjV+d4+xLu/W49Jy1P7jogN2MM+MHJAaO1pn4tPM/O/tfLfPkVvJXLt62RaWSLursE1/B6avqA18KkXwpxYt/x0r3Nrzszx6TgtWdM6kcV99fusv3fHbO/ZvD1JthDSYmXZYQz5tQXOb3PX7tBw==", + "file_map": { + "50": { + "source": "fn main() {\n // Safety: testing context\n unsafe {\n func_2()\n }\n}\nunconstrained fn func_2() {\n let mut a: [&mut bool; 1] = [&mut true];\n let mut idx_b: u32 = 0;\n while *a[0] {\n if idx_b == 0 {\n break;\n }\n }\n}\n", + "path": "" + } + }, + "names": [ + "main" + ], + "brillig_names": [ + "main" + ] +} diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/regression_8739/execute__tests__force_brillig_true_inliner_0.snap b/tooling/nargo_cli/tests/snapshots/execution_success/regression_8739/execute__tests__force_brillig_true_inliner_0.snap new file mode 100644 index 00000000000..57e5a6ad8c7 --- /dev/null +++ b/tooling/nargo_cli/tests/snapshots/execution_success/regression_8739/execute__tests__force_brillig_true_inliner_0.snap @@ -0,0 +1,41 @@ +--- +source: tooling/nargo_cli/tests/execute.rs +expression: artifact +--- +{ + "noir_version": "[noir_version]", + "hash": "[hash]", + "abi": { + "parameters": [], + "return_type": null, + "error_types": { + "17843811134343075018": { + "error_kind": "string", + "string": "Stack too deep" + } + } + }, + "bytecode": [ + "func 0", + "current witness index : _0", + "private parameters indices : []", + "public parameters indices : []", + "return value indices : []", + "BRILLIG CALL func 0: inputs: [], outputs: []", + "unconstrained func 0", + "[Const { destination: Direct(2), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(1), bit_size: Integer(U32), value: 32836 }, Const { destination: Direct(0), bit_size: Integer(U32), value: 3 }, Const { destination: Relative(1), bit_size: Integer(U32), value: 0 }, Const { destination: Relative(2), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(32836), size_address: Relative(1), offset_address: Relative(2) }, Call { location: 11 }, Call { location: 12 }, Const { destination: Relative(1), bit_size: Integer(U32), value: 32836 }, Const { destination: Relative(2), bit_size: Integer(U32), value: 0 }, Stop { return_data: HeapVector { pointer: Relative(1), size: Relative(2) } }, Return, Call { location: 19 }, Const { destination: Relative(1), bit_size: Integer(U32), value: 2 }, Mov { destination: Relative(2), source: Direct(0) }, BinaryIntOp { destination: Direct(0), op: Add, bit_size: U32, lhs: Direct(0), rhs: Relative(1) }, Call { location: 25 }, Mov { destination: Direct(0), source: Relative(0) }, Return, Const { destination: Direct(32772), bit_size: Integer(U32), value: 30720 }, BinaryIntOp { destination: Direct(32771), op: LessThan, bit_size: U32, lhs: Direct(0), rhs: Direct(32772) }, JumpIf { condition: Direct(32771), location: 24 }, IndirectConst { destination_pointer: Direct(1), bit_size: Integer(U64), value: 17843811134343075018 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return, Call { location: 19 }, Mov { destination: Relative(1), source: Direct(1) }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Direct(2) }, Const { destination: Relative(2), bit_size: Integer(U1), value: 1 }, Store { destination_pointer: Relative(1), source: Relative(2) }, Mov { destination: Relative(2), source: Direct(1) }, Const { destination: Relative(3), bit_size: Integer(U32), value: 2 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(3) }, IndirectConst { destination_pointer: Relative(2), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(3), op: Add, bit_size: U32, lhs: Relative(2), rhs: Direct(2) }, Mov { destination: Relative(4), source: Relative(3) }, Store { destination_pointer: Relative(4), source: Relative(1) }, Mov { destination: Relative(1), source: Direct(1) }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Direct(2) }, Store { destination_pointer: Relative(1), source: Relative(2) }, Mov { destination: Relative(2), source: Direct(1) }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Direct(2) }, Const { destination: Relative(3), bit_size: Integer(U32), value: 0 }, Store { destination_pointer: Relative(2), source: Relative(3) }, Const { destination: Relative(4), bit_size: Integer(U32), value: 1 }, Jump { location: 46 }, Load { destination: Relative(5), source_pointer: Relative(1) }, BinaryIntOp { destination: Relative(7), op: Add, bit_size: U32, lhs: Relative(5), rhs: Relative(4) }, Load { destination: Relative(6), source_pointer: Relative(7) }, Load { destination: Relative(5), source_pointer: Relative(6) }, JumpIf { condition: Relative(5), location: 52 }, Jump { location: 58 }, Load { destination: Relative(5), source_pointer: Relative(2) }, BinaryIntOp { destination: Relative(6), op: Equals, bit_size: U32, lhs: Relative(5), rhs: Relative(3) }, JumpIf { condition: Relative(6), location: 57 }, Jump { location: 56 }, Jump { location: 46 }, Jump { location: 58 }, Return]" + ], + "debug_symbols": "nZJNioQwEEbvknUWJuVfvErTSNTYBEKUtA4M4t2nYsUZezHQ9CbPsvI+KamNDaZbH6314/RkzW1jXbDO2Ufrpl4vdvL4dmNZPASwRnAmckJBKAnVAUmVTFVNUAcgIwiCJFAmUCZQJlAKUApQClBKjikSIQiSAISSgB4gaoI6UEgC3sz3nbNzvHYJxsTpLvPiX5h1MH5hjV+d4+xLu/W49Jy1P7jogN2MM+MHJAaO1pn4tPM/O/tfLfPkVvJXLt62RaWSLursE1/B6avqA18KkXwpxYt/x0r3Nrzszx6TgtWdM6kcV99fusv3fHbO/ZvD1JthDSYmXZYQz5tQXOb3PX7tBw==", + "file_map": { + "50": { + "source": "fn main() {\n // Safety: testing context\n unsafe {\n func_2()\n }\n}\nunconstrained fn func_2() {\n let mut a: [&mut bool; 1] = [&mut true];\n let mut idx_b: u32 = 0;\n while *a[0] {\n if idx_b == 0 {\n break;\n }\n }\n}\n", + "path": "" + } + }, + "names": [ + "main" + ], + "brillig_names": [ + "main" + ] +} diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/regression_8739/execute__tests__force_brillig_true_inliner_9223372036854775807.snap b/tooling/nargo_cli/tests/snapshots/execution_success/regression_8739/execute__tests__force_brillig_true_inliner_9223372036854775807.snap new file mode 100644 index 00000000000..4d16bef0df9 --- /dev/null +++ b/tooling/nargo_cli/tests/snapshots/execution_success/regression_8739/execute__tests__force_brillig_true_inliner_9223372036854775807.snap @@ -0,0 +1,41 @@ +--- +source: tooling/nargo_cli/tests/execute.rs +expression: artifact +--- +{ + "noir_version": "[noir_version]", + "hash": "[hash]", + "abi": { + "parameters": [], + "return_type": null, + "error_types": { + "17843811134343075018": { + "error_kind": "string", + "string": "Stack too deep" + } + } + }, + "bytecode": [ + "func 0", + "current witness index : _0", + "private parameters indices : []", + "public parameters indices : []", + "return value indices : []", + "BRILLIG CALL func 0: inputs: [], outputs: []", + "unconstrained func 0", + "[Const { destination: Direct(2), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(1), bit_size: Integer(U32), value: 32836 }, Const { destination: Direct(0), bit_size: Integer(U32), value: 3 }, Const { destination: Relative(1), bit_size: Integer(U32), value: 0 }, Const { destination: Relative(2), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(32836), size_address: Relative(1), offset_address: Relative(2) }, Call { location: 11 }, Call { location: 12 }, Const { destination: Relative(1), bit_size: Integer(U32), value: 32836 }, Const { destination: Relative(2), bit_size: Integer(U32), value: 0 }, Stop { return_data: HeapVector { pointer: Relative(1), size: Relative(2) } }, Return, Call { location: 46 }, Mov { destination: Relative(1), source: Direct(1) }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Direct(2) }, Const { destination: Relative(2), bit_size: Integer(U1), value: 1 }, Store { destination_pointer: Relative(1), source: Relative(2) }, Mov { destination: Relative(2), source: Direct(1) }, Const { destination: Relative(3), bit_size: Integer(U32), value: 2 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(3) }, IndirectConst { destination_pointer: Relative(2), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(3), op: Add, bit_size: U32, lhs: Relative(2), rhs: Direct(2) }, Mov { destination: Relative(4), source: Relative(3) }, Store { destination_pointer: Relative(4), source: Relative(1) }, Mov { destination: Relative(1), source: Direct(1) }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Direct(2) }, Store { destination_pointer: Relative(1), source: Relative(2) }, Mov { destination: Relative(2), source: Direct(1) }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Direct(2) }, Const { destination: Relative(3), bit_size: Integer(U32), value: 0 }, Store { destination_pointer: Relative(2), source: Relative(3) }, Const { destination: Relative(4), bit_size: Integer(U32), value: 1 }, Jump { location: 33 }, Load { destination: Relative(5), source_pointer: Relative(1) }, BinaryIntOp { destination: Relative(7), op: Add, bit_size: U32, lhs: Relative(5), rhs: Relative(4) }, Load { destination: Relative(6), source_pointer: Relative(7) }, Load { destination: Relative(5), source_pointer: Relative(6) }, JumpIf { condition: Relative(5), location: 39 }, Jump { location: 45 }, Load { destination: Relative(5), source_pointer: Relative(2) }, BinaryIntOp { destination: Relative(6), op: Equals, bit_size: U32, lhs: Relative(5), rhs: Relative(3) }, JumpIf { condition: Relative(6), location: 44 }, Jump { location: 43 }, Jump { location: 33 }, Jump { location: 45 }, Return, Const { destination: Direct(32772), bit_size: Integer(U32), value: 30720 }, BinaryIntOp { destination: Direct(32771), op: LessThan, bit_size: U32, lhs: Direct(0), rhs: Direct(32772) }, JumpIf { condition: Direct(32771), location: 51 }, IndirectConst { destination_pointer: Direct(1), bit_size: Integer(U64), value: 17843811134343075018 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return]" + ], + "debug_symbols": "tZLNroMgEEbfhTULGH/xVZrGoGJDQtBQvcmN8d3v4OitLrpp0g0HGM4HJLOwzjTzo7a+H56sui2sCdY5+6jd0OrJDh53FybiIBNWAWcyJWSEnFAQSoLaAIIgCUCgFKAUoBSgFMCUBFES1IZEEBICeikiI+QEtSHFk9m6cna8vZ6CMfHpp8/gF0cdjJ9Y5WfnOPvRbt4OPUftN046YFVwZnyHxMDeOhNnK3/Z4r2ap7tbwL+cXW35LVsWatdlKT7xVXL4qvjAByl3H0Be/DuudGvDpbXWmBSsbpzZl/3s21N1+h2PytGaYxha083BxKRTf+J4S3Oeyfsab/sD", + "file_map": { + "50": { + "source": "fn main() {\n // Safety: testing context\n unsafe {\n func_2()\n }\n}\nunconstrained fn func_2() {\n let mut a: [&mut bool; 1] = [&mut true];\n let mut idx_b: u32 = 0;\n while *a[0] {\n if idx_b == 0 {\n break;\n }\n }\n}\n", + "path": "" + } + }, + "names": [ + "main" + ], + "brillig_names": [ + "main" + ] +} diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/regression_8739/execute__tests__stdout.snap b/tooling/nargo_cli/tests/snapshots/execution_success/regression_8739/execute__tests__stdout.snap new file mode 100644 index 00000000000..e86e3de90e1 --- /dev/null +++ b/tooling/nargo_cli/tests/snapshots/execution_success/regression_8739/execute__tests__stdout.snap @@ -0,0 +1,5 @@ +--- +source: tooling/nargo_cli/tests/execute.rs +expression: stdout +--- + diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/regression_8755/execute__tests__expanded.snap b/tooling/nargo_cli/tests/snapshots/execution_success/regression_8755/execute__tests__expanded.snap new file mode 100644 index 00000000000..c034dea9aaa --- /dev/null +++ b/tooling/nargo_cli/tests/snapshots/execution_success/regression_8755/execute__tests__expanded.snap @@ -0,0 +1,19 @@ +--- +source: tooling/nargo_cli/tests/execute.rs +expression: expanded_code +--- +unconstrained fn main() -> pub Field { + func_2([(0, &mut -292434322542114415011969994633470574393)]) +} + +unconstrained fn func_2(mut b: [(u32, &mut Field); 1]) -> Field { + let mut idx_e: u32 = 0; + loop { + if idx_e == 1 { + break; + } else { + idx_e = idx_e + 1; + } + } + 157653526363045079447323020681982670581 / *b[0].1 +} diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/regression_8755/execute__tests__force_brillig_false_inliner_-9223372036854775808.snap b/tooling/nargo_cli/tests/snapshots/execution_success/regression_8755/execute__tests__force_brillig_false_inliner_-9223372036854775808.snap new file mode 100644 index 00000000000..9b9164ef4de --- /dev/null +++ b/tooling/nargo_cli/tests/snapshots/execution_success/regression_8755/execute__tests__force_brillig_false_inliner_-9223372036854775808.snap @@ -0,0 +1,50 @@ +--- +source: tooling/nargo_cli/tests/execute.rs +expression: artifact +--- +{ + "noir_version": "[noir_version]", + "hash": "[hash]", + "abi": { + "parameters": [], + "return_type": { + "abi_type": { + "kind": "field" + }, + "visibility": "public" + }, + "error_types": { + "5019202896831570965": { + "error_kind": "string", + "string": "attempt to add with overflow" + }, + "17843811134343075018": { + "error_kind": "string", + "string": "Stack too deep" + } + } + }, + "bytecode": [ + "func 0", + "current witness index : _0", + "private parameters indices : []", + "public parameters indices : []", + "return value indices : [_0]", + "BRILLIG CALL func 0: inputs: [], outputs: [Simple(Witness(0))]", + "unconstrained func 0", + "[Const { destination: Direct(2), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(1), bit_size: Integer(U32), value: 32837 }, Const { destination: Direct(0), bit_size: Integer(U32), value: 3 }, Const { destination: Relative(1), bit_size: Integer(U32), value: 0 }, Const { destination: Relative(2), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(32836), size_address: Relative(1), offset_address: Relative(2) }, Call { location: 12 }, Call { location: 14 }, Mov { destination: Direct(32836), source: Relative(1) }, Const { destination: Relative(2), bit_size: Integer(U32), value: 32836 }, Const { destination: Relative(3), bit_size: Integer(U32), value: 1 }, Stop { return_data: HeapVector { pointer: Relative(2), size: Relative(3) } }, Const { destination: Direct(32835), bit_size: Integer(U32), value: 0 }, Return, Call { location: 36 }, Mov { destination: Relative(1), source: Direct(1) }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Direct(2) }, Const { destination: Relative(2), bit_size: Field, value: -292434322542114415011969994633470574393 }, Store { destination_pointer: Relative(1), source: Relative(2) }, Mov { destination: Relative(2), source: Direct(1) }, Const { destination: Relative(3), bit_size: Integer(U32), value: 3 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(3) }, IndirectConst { destination_pointer: Relative(2), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(3), op: Add, bit_size: U32, lhs: Relative(2), rhs: Direct(2) }, Mov { destination: Relative(4), source: Relative(3) }, Store { destination_pointer: Relative(4), source: Direct(32835) }, BinaryIntOp { destination: Relative(4), op: Add, bit_size: U32, lhs: Relative(4), rhs: Direct(2) }, Store { destination_pointer: Relative(4), source: Relative(1) }, Const { destination: Relative(3), bit_size: Integer(U32), value: 4 }, Mov { destination: Relative(4), source: Direct(0) }, Mov { destination: Relative(5), source: Relative(2) }, BinaryIntOp { destination: Direct(0), op: Add, bit_size: U32, lhs: Direct(0), rhs: Relative(3) }, Call { location: 42 }, Mov { destination: Direct(0), source: Relative(0) }, Mov { destination: Relative(1), source: Relative(5) }, Return, Const { destination: Direct(32772), bit_size: Integer(U32), value: 30720 }, BinaryIntOp { destination: Direct(32771), op: LessThan, bit_size: U32, lhs: Direct(0), rhs: Direct(32772) }, JumpIf { condition: Direct(32771), location: 41 }, IndirectConst { destination_pointer: Direct(1), bit_size: Integer(U64), value: 17843811134343075018 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return, Call { location: 36 }, Mov { destination: Relative(2), source: Direct(1) }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Direct(2) }, Store { destination_pointer: Relative(2), source: Relative(1) }, Mov { destination: Relative(1), source: Direct(1) }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Direct(2) }, Store { destination_pointer: Relative(1), source: Direct(32835) }, Const { destination: Relative(3), bit_size: Integer(U32), value: 1 }, Jump { location: 51 }, Load { destination: Relative(4), source_pointer: Relative(1) }, BinaryIntOp { destination: Relative(5), op: Equals, bit_size: U32, lhs: Relative(4), rhs: Relative(3) }, JumpIf { condition: Relative(5), location: 62 }, Jump { location: 55 }, Load { destination: Relative(4), source_pointer: Relative(1) }, BinaryIntOp { destination: Relative(5), op: Add, bit_size: U32, lhs: Relative(4), rhs: Relative(3) }, BinaryIntOp { destination: Relative(6), op: LessThanEquals, bit_size: U32, lhs: Relative(4), rhs: Relative(5) }, JumpIf { condition: Relative(6), location: 60 }, Call { location: 71 }, Store { destination_pointer: Relative(1), source: Relative(5) }, Jump { location: 51 }, Load { destination: Relative(1), source_pointer: Relative(2) }, Const { destination: Relative(2), bit_size: Integer(U32), value: 2 }, BinaryIntOp { destination: Relative(4), op: Add, bit_size: U32, lhs: Relative(1), rhs: Relative(2) }, Load { destination: Relative(3), source_pointer: Relative(4) }, Load { destination: Relative(1), source_pointer: Relative(3) }, Const { destination: Relative(2), bit_size: Field, value: 157653526363045079447323020681982670581 }, BinaryFieldOp { destination: Relative(3), op: Div, lhs: Relative(2), rhs: Relative(1) }, Mov { destination: Relative(1), source: Relative(3) }, Return, IndirectConst { destination_pointer: Direct(1), bit_size: Integer(U64), value: 5019202896831570965 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return]" + ], + "debug_symbols": "pdPNioMwEAfwd8k5h3xH+yqllNSmJRCipLqwFN99x4zZ2sPCYi/+jPE/QwLzJFd/me7nkG79gxyOT3LJIcZwP8e+c2PoE3x9ErY8uCYHTgk3iEUapC0IhnBEIBJRCFYRWEVgFQFVBNAWJEM4IhCJqILClVpXGoGaErBIU9AcgSoK0Aj8qQGLNEhbMAyBgAGgkQUUohGDQLwBIN7MMyX1ys5j9n65sc0dws0OLvs0kkOaYqTky8Wp/PQYXCqOLsMuo8SnKwgFbyH65W2mrzT7O2pqlrNXWv87ruRvXO6I89bWfNvsyAsh1ryQYk++5Wte7jq+FPX80uzpL42pefthf/ve/wQr14X8NpPzUikHd4l+Xd6m1G12x++h7tSZHnLf+euU/VJpM9jwPEpDFT/BJMO8HC2nVp7mpfUP", + "file_map": { + "50": { + "source": "unconstrained fn main() -> pub Field {\n func_2([(0, &mut -292434322542114415011969994633470574393)])\n}\nunconstrained fn func_2(mut b: [(u32, &mut Field); 1]) -> Field {\n let mut idx_e: u32 = 0;\n loop {\n if idx_e == 1 {\n break;\n } else {\n idx_e = idx_e + 1;\n }\n }\n (157653526363045079447323020681982670581 / *b[0].1)\n}\n", + "path": "" + } + }, + "names": [ + "main" + ], + "brillig_names": [ + "main" + ] +} diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/regression_8755/execute__tests__force_brillig_false_inliner_0.snap b/tooling/nargo_cli/tests/snapshots/execution_success/regression_8755/execute__tests__force_brillig_false_inliner_0.snap new file mode 100644 index 00000000000..83309e464cd --- /dev/null +++ b/tooling/nargo_cli/tests/snapshots/execution_success/regression_8755/execute__tests__force_brillig_false_inliner_0.snap @@ -0,0 +1,50 @@ +--- +source: tooling/nargo_cli/tests/execute.rs +expression: artifact +--- +{ + "noir_version": "[noir_version]", + "hash": "[hash]", + "abi": { + "parameters": [], + "return_type": { + "abi_type": { + "kind": "field" + }, + "visibility": "public" + }, + "error_types": { + "5019202896831570965": { + "error_kind": "string", + "string": "attempt to add with overflow" + }, + "17843811134343075018": { + "error_kind": "string", + "string": "Stack too deep" + } + } + }, + "bytecode": [ + "func 0", + "current witness index : _0", + "private parameters indices : []", + "public parameters indices : []", + "return value indices : [_0]", + "BRILLIG CALL func 0: inputs: [], outputs: [Simple(Witness(0))]", + "unconstrained func 0", + "[Const { destination: Direct(2), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(1), bit_size: Integer(U32), value: 32837 }, Const { destination: Direct(0), bit_size: Integer(U32), value: 3 }, Const { destination: Relative(1), bit_size: Integer(U32), value: 0 }, Const { destination: Relative(2), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(32836), size_address: Relative(1), offset_address: Relative(2) }, Call { location: 12 }, Call { location: 13 }, Mov { destination: Direct(32836), source: Relative(1) }, Const { destination: Relative(2), bit_size: Integer(U32), value: 32836 }, Const { destination: Relative(3), bit_size: Integer(U32), value: 1 }, Stop { return_data: HeapVector { pointer: Relative(2), size: Relative(3) } }, Return, Call { location: 56 }, Mov { destination: Relative(1), source: Direct(1) }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Direct(2) }, Const { destination: Relative(2), bit_size: Field, value: -292434322542114415011969994633470574393 }, Store { destination_pointer: Relative(1), source: Relative(2) }, Const { destination: Relative(2), bit_size: Integer(U32), value: 0 }, Mov { destination: Relative(3), source: Direct(1) }, Const { destination: Relative(4), bit_size: Integer(U32), value: 3 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(4) }, IndirectConst { destination_pointer: Relative(3), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(4), op: Add, bit_size: U32, lhs: Relative(3), rhs: Direct(2) }, Mov { destination: Relative(5), source: Relative(4) }, Store { destination_pointer: Relative(5), source: Relative(2) }, BinaryIntOp { destination: Relative(5), op: Add, bit_size: U32, lhs: Relative(5), rhs: Direct(2) }, Store { destination_pointer: Relative(5), source: Relative(1) }, Mov { destination: Relative(1), source: Direct(1) }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Direct(2) }, Store { destination_pointer: Relative(1), source: Relative(3) }, Mov { destination: Relative(3), source: Direct(1) }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Direct(2) }, Store { destination_pointer: Relative(3), source: Relative(2) }, Const { destination: Relative(2), bit_size: Integer(U32), value: 1 }, Jump { location: 36 }, Load { destination: Relative(4), source_pointer: Relative(3) }, BinaryIntOp { destination: Relative(5), op: Equals, bit_size: U32, lhs: Relative(4), rhs: Relative(2) }, JumpIf { condition: Relative(5), location: 47 }, Jump { location: 40 }, Load { destination: Relative(4), source_pointer: Relative(3) }, BinaryIntOp { destination: Relative(5), op: Add, bit_size: U32, lhs: Relative(4), rhs: Relative(2) }, BinaryIntOp { destination: Relative(6), op: LessThanEquals, bit_size: U32, lhs: Relative(4), rhs: Relative(5) }, JumpIf { condition: Relative(6), location: 45 }, Call { location: 62 }, Store { destination_pointer: Relative(3), source: Relative(5) }, Jump { location: 36 }, Load { destination: Relative(2), source_pointer: Relative(1) }, Const { destination: Relative(1), bit_size: Integer(U32), value: 2 }, BinaryIntOp { destination: Relative(4), op: Add, bit_size: U32, lhs: Relative(2), rhs: Relative(1) }, Load { destination: Relative(3), source_pointer: Relative(4) }, Load { destination: Relative(1), source_pointer: Relative(3) }, Const { destination: Relative(2), bit_size: Field, value: 157653526363045079447323020681982670581 }, BinaryFieldOp { destination: Relative(3), op: Div, lhs: Relative(2), rhs: Relative(1) }, Mov { destination: Relative(1), source: Relative(3) }, Return, Const { destination: Direct(32772), bit_size: Integer(U32), value: 30720 }, BinaryIntOp { destination: Direct(32771), op: LessThan, bit_size: U32, lhs: Direct(0), rhs: Direct(32772) }, JumpIf { condition: Direct(32771), location: 61 }, IndirectConst { destination_pointer: Direct(1), bit_size: Integer(U64), value: 17843811134343075018 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return, IndirectConst { destination_pointer: Direct(1), bit_size: Integer(U64), value: 5019202896831570965 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return]" + ], + "debug_symbols": "tZPBjoMgEIbfhTMHGBRLX6VpGmppQ0LQUN1kY3z3HR3Z2oObjZu98Inw/RMmmYHd3LV/XHy8N092PA3smnwI/nEJTW0730T8OzAxLbJgR8mZLAmaUBEOBDMDBEESgKAIlAKUApQClAKYohBmhhIETCkQQFAETUCv5KwQBLypEUBQhIJQElCoEFjogDAzSkGQBNQNAnUzjpzlRly65NzUh1VnsF+tTS527Bj7EDj7sKGfLz1bG2d2NuGp4MzFGxID7z646WvkL1tsqzq7Urzs8td6ob51taXDv+nSVNk3hx0+ACw+KNjjG7n4art7P/gK8vuV3lNfaZ396o/1q/f6Z9zZ2qe3QR2npOTtNbhle+9jvTrtPtt8kge9TU3tbn1yU9Jq2nE9lZpreca5xtE4aeC6OI9T6S8=", + "file_map": { + "50": { + "source": "unconstrained fn main() -> pub Field {\n func_2([(0, &mut -292434322542114415011969994633470574393)])\n}\nunconstrained fn func_2(mut b: [(u32, &mut Field); 1]) -> Field {\n let mut idx_e: u32 = 0;\n loop {\n if idx_e == 1 {\n break;\n } else {\n idx_e = idx_e + 1;\n }\n }\n (157653526363045079447323020681982670581 / *b[0].1)\n}\n", + "path": "" + } + }, + "names": [ + "main" + ], + "brillig_names": [ + "main" + ] +} diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/regression_8755/execute__tests__force_brillig_false_inliner_9223372036854775807.snap b/tooling/nargo_cli/tests/snapshots/execution_success/regression_8755/execute__tests__force_brillig_false_inliner_9223372036854775807.snap new file mode 100644 index 00000000000..83309e464cd --- /dev/null +++ b/tooling/nargo_cli/tests/snapshots/execution_success/regression_8755/execute__tests__force_brillig_false_inliner_9223372036854775807.snap @@ -0,0 +1,50 @@ +--- +source: tooling/nargo_cli/tests/execute.rs +expression: artifact +--- +{ + "noir_version": "[noir_version]", + "hash": "[hash]", + "abi": { + "parameters": [], + "return_type": { + "abi_type": { + "kind": "field" + }, + "visibility": "public" + }, + "error_types": { + "5019202896831570965": { + "error_kind": "string", + "string": "attempt to add with overflow" + }, + "17843811134343075018": { + "error_kind": "string", + "string": "Stack too deep" + } + } + }, + "bytecode": [ + "func 0", + "current witness index : _0", + "private parameters indices : []", + "public parameters indices : []", + "return value indices : [_0]", + "BRILLIG CALL func 0: inputs: [], outputs: [Simple(Witness(0))]", + "unconstrained func 0", + "[Const { destination: Direct(2), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(1), bit_size: Integer(U32), value: 32837 }, Const { destination: Direct(0), bit_size: Integer(U32), value: 3 }, Const { destination: Relative(1), bit_size: Integer(U32), value: 0 }, Const { destination: Relative(2), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(32836), size_address: Relative(1), offset_address: Relative(2) }, Call { location: 12 }, Call { location: 13 }, Mov { destination: Direct(32836), source: Relative(1) }, Const { destination: Relative(2), bit_size: Integer(U32), value: 32836 }, Const { destination: Relative(3), bit_size: Integer(U32), value: 1 }, Stop { return_data: HeapVector { pointer: Relative(2), size: Relative(3) } }, Return, Call { location: 56 }, Mov { destination: Relative(1), source: Direct(1) }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Direct(2) }, Const { destination: Relative(2), bit_size: Field, value: -292434322542114415011969994633470574393 }, Store { destination_pointer: Relative(1), source: Relative(2) }, Const { destination: Relative(2), bit_size: Integer(U32), value: 0 }, Mov { destination: Relative(3), source: Direct(1) }, Const { destination: Relative(4), bit_size: Integer(U32), value: 3 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(4) }, IndirectConst { destination_pointer: Relative(3), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(4), op: Add, bit_size: U32, lhs: Relative(3), rhs: Direct(2) }, Mov { destination: Relative(5), source: Relative(4) }, Store { destination_pointer: Relative(5), source: Relative(2) }, BinaryIntOp { destination: Relative(5), op: Add, bit_size: U32, lhs: Relative(5), rhs: Direct(2) }, Store { destination_pointer: Relative(5), source: Relative(1) }, Mov { destination: Relative(1), source: Direct(1) }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Direct(2) }, Store { destination_pointer: Relative(1), source: Relative(3) }, Mov { destination: Relative(3), source: Direct(1) }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Direct(2) }, Store { destination_pointer: Relative(3), source: Relative(2) }, Const { destination: Relative(2), bit_size: Integer(U32), value: 1 }, Jump { location: 36 }, Load { destination: Relative(4), source_pointer: Relative(3) }, BinaryIntOp { destination: Relative(5), op: Equals, bit_size: U32, lhs: Relative(4), rhs: Relative(2) }, JumpIf { condition: Relative(5), location: 47 }, Jump { location: 40 }, Load { destination: Relative(4), source_pointer: Relative(3) }, BinaryIntOp { destination: Relative(5), op: Add, bit_size: U32, lhs: Relative(4), rhs: Relative(2) }, BinaryIntOp { destination: Relative(6), op: LessThanEquals, bit_size: U32, lhs: Relative(4), rhs: Relative(5) }, JumpIf { condition: Relative(6), location: 45 }, Call { location: 62 }, Store { destination_pointer: Relative(3), source: Relative(5) }, Jump { location: 36 }, Load { destination: Relative(2), source_pointer: Relative(1) }, Const { destination: Relative(1), bit_size: Integer(U32), value: 2 }, BinaryIntOp { destination: Relative(4), op: Add, bit_size: U32, lhs: Relative(2), rhs: Relative(1) }, Load { destination: Relative(3), source_pointer: Relative(4) }, Load { destination: Relative(1), source_pointer: Relative(3) }, Const { destination: Relative(2), bit_size: Field, value: 157653526363045079447323020681982670581 }, BinaryFieldOp { destination: Relative(3), op: Div, lhs: Relative(2), rhs: Relative(1) }, Mov { destination: Relative(1), source: Relative(3) }, Return, Const { destination: Direct(32772), bit_size: Integer(U32), value: 30720 }, BinaryIntOp { destination: Direct(32771), op: LessThan, bit_size: U32, lhs: Direct(0), rhs: Direct(32772) }, JumpIf { condition: Direct(32771), location: 61 }, IndirectConst { destination_pointer: Direct(1), bit_size: Integer(U64), value: 17843811134343075018 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return, IndirectConst { destination_pointer: Direct(1), bit_size: Integer(U64), value: 5019202896831570965 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return]" + ], + "debug_symbols": "tZPBjoMgEIbfhTMHGBRLX6VpGmppQ0LQUN1kY3z3HR3Z2oObjZu98Inw/RMmmYHd3LV/XHy8N092PA3smnwI/nEJTW0730T8OzAxLbJgR8mZLAmaUBEOBDMDBEESgKAIlAKUApQClAKYohBmhhIETCkQQFAETUCv5KwQBLypEUBQhIJQElCoEFjogDAzSkGQBNQNAnUzjpzlRly65NzUh1VnsF+tTS527Bj7EDj7sKGfLz1bG2d2NuGp4MzFGxID7z646WvkL1tsqzq7Urzs8td6ob51taXDv+nSVNk3hx0+ACw+KNjjG7n4art7P/gK8vuV3lNfaZ396o/1q/f6Z9zZ2qe3QR2npOTtNbhle+9jvTrtPtt8kge9TU3tbn1yU9Jq2nE9lZpreca5xtE4aeC6OI9T6S8=", + "file_map": { + "50": { + "source": "unconstrained fn main() -> pub Field {\n func_2([(0, &mut -292434322542114415011969994633470574393)])\n}\nunconstrained fn func_2(mut b: [(u32, &mut Field); 1]) -> Field {\n let mut idx_e: u32 = 0;\n loop {\n if idx_e == 1 {\n break;\n } else {\n idx_e = idx_e + 1;\n }\n }\n (157653526363045079447323020681982670581 / *b[0].1)\n}\n", + "path": "" + } + }, + "names": [ + "main" + ], + "brillig_names": [ + "main" + ] +} diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/regression_8755/execute__tests__force_brillig_true_inliner_-9223372036854775808.snap b/tooling/nargo_cli/tests/snapshots/execution_success/regression_8755/execute__tests__force_brillig_true_inliner_-9223372036854775808.snap new file mode 100644 index 00000000000..9b9164ef4de --- /dev/null +++ b/tooling/nargo_cli/tests/snapshots/execution_success/regression_8755/execute__tests__force_brillig_true_inliner_-9223372036854775808.snap @@ -0,0 +1,50 @@ +--- +source: tooling/nargo_cli/tests/execute.rs +expression: artifact +--- +{ + "noir_version": "[noir_version]", + "hash": "[hash]", + "abi": { + "parameters": [], + "return_type": { + "abi_type": { + "kind": "field" + }, + "visibility": "public" + }, + "error_types": { + "5019202896831570965": { + "error_kind": "string", + "string": "attempt to add with overflow" + }, + "17843811134343075018": { + "error_kind": "string", + "string": "Stack too deep" + } + } + }, + "bytecode": [ + "func 0", + "current witness index : _0", + "private parameters indices : []", + "public parameters indices : []", + "return value indices : [_0]", + "BRILLIG CALL func 0: inputs: [], outputs: [Simple(Witness(0))]", + "unconstrained func 0", + "[Const { destination: Direct(2), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(1), bit_size: Integer(U32), value: 32837 }, Const { destination: Direct(0), bit_size: Integer(U32), value: 3 }, Const { destination: Relative(1), bit_size: Integer(U32), value: 0 }, Const { destination: Relative(2), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(32836), size_address: Relative(1), offset_address: Relative(2) }, Call { location: 12 }, Call { location: 14 }, Mov { destination: Direct(32836), source: Relative(1) }, Const { destination: Relative(2), bit_size: Integer(U32), value: 32836 }, Const { destination: Relative(3), bit_size: Integer(U32), value: 1 }, Stop { return_data: HeapVector { pointer: Relative(2), size: Relative(3) } }, Const { destination: Direct(32835), bit_size: Integer(U32), value: 0 }, Return, Call { location: 36 }, Mov { destination: Relative(1), source: Direct(1) }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Direct(2) }, Const { destination: Relative(2), bit_size: Field, value: -292434322542114415011969994633470574393 }, Store { destination_pointer: Relative(1), source: Relative(2) }, Mov { destination: Relative(2), source: Direct(1) }, Const { destination: Relative(3), bit_size: Integer(U32), value: 3 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(3) }, IndirectConst { destination_pointer: Relative(2), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(3), op: Add, bit_size: U32, lhs: Relative(2), rhs: Direct(2) }, Mov { destination: Relative(4), source: Relative(3) }, Store { destination_pointer: Relative(4), source: Direct(32835) }, BinaryIntOp { destination: Relative(4), op: Add, bit_size: U32, lhs: Relative(4), rhs: Direct(2) }, Store { destination_pointer: Relative(4), source: Relative(1) }, Const { destination: Relative(3), bit_size: Integer(U32), value: 4 }, Mov { destination: Relative(4), source: Direct(0) }, Mov { destination: Relative(5), source: Relative(2) }, BinaryIntOp { destination: Direct(0), op: Add, bit_size: U32, lhs: Direct(0), rhs: Relative(3) }, Call { location: 42 }, Mov { destination: Direct(0), source: Relative(0) }, Mov { destination: Relative(1), source: Relative(5) }, Return, Const { destination: Direct(32772), bit_size: Integer(U32), value: 30720 }, BinaryIntOp { destination: Direct(32771), op: LessThan, bit_size: U32, lhs: Direct(0), rhs: Direct(32772) }, JumpIf { condition: Direct(32771), location: 41 }, IndirectConst { destination_pointer: Direct(1), bit_size: Integer(U64), value: 17843811134343075018 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return, Call { location: 36 }, Mov { destination: Relative(2), source: Direct(1) }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Direct(2) }, Store { destination_pointer: Relative(2), source: Relative(1) }, Mov { destination: Relative(1), source: Direct(1) }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Direct(2) }, Store { destination_pointer: Relative(1), source: Direct(32835) }, Const { destination: Relative(3), bit_size: Integer(U32), value: 1 }, Jump { location: 51 }, Load { destination: Relative(4), source_pointer: Relative(1) }, BinaryIntOp { destination: Relative(5), op: Equals, bit_size: U32, lhs: Relative(4), rhs: Relative(3) }, JumpIf { condition: Relative(5), location: 62 }, Jump { location: 55 }, Load { destination: Relative(4), source_pointer: Relative(1) }, BinaryIntOp { destination: Relative(5), op: Add, bit_size: U32, lhs: Relative(4), rhs: Relative(3) }, BinaryIntOp { destination: Relative(6), op: LessThanEquals, bit_size: U32, lhs: Relative(4), rhs: Relative(5) }, JumpIf { condition: Relative(6), location: 60 }, Call { location: 71 }, Store { destination_pointer: Relative(1), source: Relative(5) }, Jump { location: 51 }, Load { destination: Relative(1), source_pointer: Relative(2) }, Const { destination: Relative(2), bit_size: Integer(U32), value: 2 }, BinaryIntOp { destination: Relative(4), op: Add, bit_size: U32, lhs: Relative(1), rhs: Relative(2) }, Load { destination: Relative(3), source_pointer: Relative(4) }, Load { destination: Relative(1), source_pointer: Relative(3) }, Const { destination: Relative(2), bit_size: Field, value: 157653526363045079447323020681982670581 }, BinaryFieldOp { destination: Relative(3), op: Div, lhs: Relative(2), rhs: Relative(1) }, Mov { destination: Relative(1), source: Relative(3) }, Return, IndirectConst { destination_pointer: Direct(1), bit_size: Integer(U64), value: 5019202896831570965 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return]" + ], + "debug_symbols": "pdPNioMwEAfwd8k5h3xH+yqllNSmJRCipLqwFN99x4zZ2sPCYi/+jPE/QwLzJFd/me7nkG79gxyOT3LJIcZwP8e+c2PoE3x9ErY8uCYHTgk3iEUapC0IhnBEIBJRCFYRWEVgFQFVBNAWJEM4IhCJqILClVpXGoGaErBIU9AcgSoK0Aj8qQGLNEhbMAyBgAGgkQUUohGDQLwBIN7MMyX1ys5j9n65sc0dws0OLvs0kkOaYqTky8Wp/PQYXCqOLsMuo8SnKwgFbyH65W2mrzT7O2pqlrNXWv87ruRvXO6I89bWfNvsyAsh1ryQYk++5Wte7jq+FPX80uzpL42pefthf/ve/wQr14X8NpPzUikHd4l+Xd6m1G12x++h7tSZHnLf+euU/VJpM9jwPEpDFT/BJMO8HC2nVp7mpfUP", + "file_map": { + "50": { + "source": "unconstrained fn main() -> pub Field {\n func_2([(0, &mut -292434322542114415011969994633470574393)])\n}\nunconstrained fn func_2(mut b: [(u32, &mut Field); 1]) -> Field {\n let mut idx_e: u32 = 0;\n loop {\n if idx_e == 1 {\n break;\n } else {\n idx_e = idx_e + 1;\n }\n }\n (157653526363045079447323020681982670581 / *b[0].1)\n}\n", + "path": "" + } + }, + "names": [ + "main" + ], + "brillig_names": [ + "main" + ] +} diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/regression_8755/execute__tests__force_brillig_true_inliner_0.snap b/tooling/nargo_cli/tests/snapshots/execution_success/regression_8755/execute__tests__force_brillig_true_inliner_0.snap new file mode 100644 index 00000000000..83309e464cd --- /dev/null +++ b/tooling/nargo_cli/tests/snapshots/execution_success/regression_8755/execute__tests__force_brillig_true_inliner_0.snap @@ -0,0 +1,50 @@ +--- +source: tooling/nargo_cli/tests/execute.rs +expression: artifact +--- +{ + "noir_version": "[noir_version]", + "hash": "[hash]", + "abi": { + "parameters": [], + "return_type": { + "abi_type": { + "kind": "field" + }, + "visibility": "public" + }, + "error_types": { + "5019202896831570965": { + "error_kind": "string", + "string": "attempt to add with overflow" + }, + "17843811134343075018": { + "error_kind": "string", + "string": "Stack too deep" + } + } + }, + "bytecode": [ + "func 0", + "current witness index : _0", + "private parameters indices : []", + "public parameters indices : []", + "return value indices : [_0]", + "BRILLIG CALL func 0: inputs: [], outputs: [Simple(Witness(0))]", + "unconstrained func 0", + "[Const { destination: Direct(2), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(1), bit_size: Integer(U32), value: 32837 }, Const { destination: Direct(0), bit_size: Integer(U32), value: 3 }, Const { destination: Relative(1), bit_size: Integer(U32), value: 0 }, Const { destination: Relative(2), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(32836), size_address: Relative(1), offset_address: Relative(2) }, Call { location: 12 }, Call { location: 13 }, Mov { destination: Direct(32836), source: Relative(1) }, Const { destination: Relative(2), bit_size: Integer(U32), value: 32836 }, Const { destination: Relative(3), bit_size: Integer(U32), value: 1 }, Stop { return_data: HeapVector { pointer: Relative(2), size: Relative(3) } }, Return, Call { location: 56 }, Mov { destination: Relative(1), source: Direct(1) }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Direct(2) }, Const { destination: Relative(2), bit_size: Field, value: -292434322542114415011969994633470574393 }, Store { destination_pointer: Relative(1), source: Relative(2) }, Const { destination: Relative(2), bit_size: Integer(U32), value: 0 }, Mov { destination: Relative(3), source: Direct(1) }, Const { destination: Relative(4), bit_size: Integer(U32), value: 3 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(4) }, IndirectConst { destination_pointer: Relative(3), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(4), op: Add, bit_size: U32, lhs: Relative(3), rhs: Direct(2) }, Mov { destination: Relative(5), source: Relative(4) }, Store { destination_pointer: Relative(5), source: Relative(2) }, BinaryIntOp { destination: Relative(5), op: Add, bit_size: U32, lhs: Relative(5), rhs: Direct(2) }, Store { destination_pointer: Relative(5), source: Relative(1) }, Mov { destination: Relative(1), source: Direct(1) }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Direct(2) }, Store { destination_pointer: Relative(1), source: Relative(3) }, Mov { destination: Relative(3), source: Direct(1) }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Direct(2) }, Store { destination_pointer: Relative(3), source: Relative(2) }, Const { destination: Relative(2), bit_size: Integer(U32), value: 1 }, Jump { location: 36 }, Load { destination: Relative(4), source_pointer: Relative(3) }, BinaryIntOp { destination: Relative(5), op: Equals, bit_size: U32, lhs: Relative(4), rhs: Relative(2) }, JumpIf { condition: Relative(5), location: 47 }, Jump { location: 40 }, Load { destination: Relative(4), source_pointer: Relative(3) }, BinaryIntOp { destination: Relative(5), op: Add, bit_size: U32, lhs: Relative(4), rhs: Relative(2) }, BinaryIntOp { destination: Relative(6), op: LessThanEquals, bit_size: U32, lhs: Relative(4), rhs: Relative(5) }, JumpIf { condition: Relative(6), location: 45 }, Call { location: 62 }, Store { destination_pointer: Relative(3), source: Relative(5) }, Jump { location: 36 }, Load { destination: Relative(2), source_pointer: Relative(1) }, Const { destination: Relative(1), bit_size: Integer(U32), value: 2 }, BinaryIntOp { destination: Relative(4), op: Add, bit_size: U32, lhs: Relative(2), rhs: Relative(1) }, Load { destination: Relative(3), source_pointer: Relative(4) }, Load { destination: Relative(1), source_pointer: Relative(3) }, Const { destination: Relative(2), bit_size: Field, value: 157653526363045079447323020681982670581 }, BinaryFieldOp { destination: Relative(3), op: Div, lhs: Relative(2), rhs: Relative(1) }, Mov { destination: Relative(1), source: Relative(3) }, Return, Const { destination: Direct(32772), bit_size: Integer(U32), value: 30720 }, BinaryIntOp { destination: Direct(32771), op: LessThan, bit_size: U32, lhs: Direct(0), rhs: Direct(32772) }, JumpIf { condition: Direct(32771), location: 61 }, IndirectConst { destination_pointer: Direct(1), bit_size: Integer(U64), value: 17843811134343075018 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return, IndirectConst { destination_pointer: Direct(1), bit_size: Integer(U64), value: 5019202896831570965 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return]" + ], + "debug_symbols": "tZPBjoMgEIbfhTMHGBRLX6VpGmppQ0LQUN1kY3z3HR3Z2oObjZu98Inw/RMmmYHd3LV/XHy8N092PA3smnwI/nEJTW0730T8OzAxLbJgR8mZLAmaUBEOBDMDBEESgKAIlAKUApQClAKYohBmhhIETCkQQFAETUCv5KwQBLypEUBQhIJQElCoEFjogDAzSkGQBNQNAnUzjpzlRly65NzUh1VnsF+tTS527Bj7EDj7sKGfLz1bG2d2NuGp4MzFGxID7z646WvkL1tsqzq7Urzs8td6ob51taXDv+nSVNk3hx0+ACw+KNjjG7n4art7P/gK8vuV3lNfaZ396o/1q/f6Z9zZ2qe3QR2npOTtNbhle+9jvTrtPtt8kge9TU3tbn1yU9Jq2nE9lZpreca5xtE4aeC6OI9T6S8=", + "file_map": { + "50": { + "source": "unconstrained fn main() -> pub Field {\n func_2([(0, &mut -292434322542114415011969994633470574393)])\n}\nunconstrained fn func_2(mut b: [(u32, &mut Field); 1]) -> Field {\n let mut idx_e: u32 = 0;\n loop {\n if idx_e == 1 {\n break;\n } else {\n idx_e = idx_e + 1;\n }\n }\n (157653526363045079447323020681982670581 / *b[0].1)\n}\n", + "path": "" + } + }, + "names": [ + "main" + ], + "brillig_names": [ + "main" + ] +} diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/regression_8755/execute__tests__force_brillig_true_inliner_9223372036854775807.snap b/tooling/nargo_cli/tests/snapshots/execution_success/regression_8755/execute__tests__force_brillig_true_inliner_9223372036854775807.snap new file mode 100644 index 00000000000..83309e464cd --- /dev/null +++ b/tooling/nargo_cli/tests/snapshots/execution_success/regression_8755/execute__tests__force_brillig_true_inliner_9223372036854775807.snap @@ -0,0 +1,50 @@ +--- +source: tooling/nargo_cli/tests/execute.rs +expression: artifact +--- +{ + "noir_version": "[noir_version]", + "hash": "[hash]", + "abi": { + "parameters": [], + "return_type": { + "abi_type": { + "kind": "field" + }, + "visibility": "public" + }, + "error_types": { + "5019202896831570965": { + "error_kind": "string", + "string": "attempt to add with overflow" + }, + "17843811134343075018": { + "error_kind": "string", + "string": "Stack too deep" + } + } + }, + "bytecode": [ + "func 0", + "current witness index : _0", + "private parameters indices : []", + "public parameters indices : []", + "return value indices : [_0]", + "BRILLIG CALL func 0: inputs: [], outputs: [Simple(Witness(0))]", + "unconstrained func 0", + "[Const { destination: Direct(2), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(1), bit_size: Integer(U32), value: 32837 }, Const { destination: Direct(0), bit_size: Integer(U32), value: 3 }, Const { destination: Relative(1), bit_size: Integer(U32), value: 0 }, Const { destination: Relative(2), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(32836), size_address: Relative(1), offset_address: Relative(2) }, Call { location: 12 }, Call { location: 13 }, Mov { destination: Direct(32836), source: Relative(1) }, Const { destination: Relative(2), bit_size: Integer(U32), value: 32836 }, Const { destination: Relative(3), bit_size: Integer(U32), value: 1 }, Stop { return_data: HeapVector { pointer: Relative(2), size: Relative(3) } }, Return, Call { location: 56 }, Mov { destination: Relative(1), source: Direct(1) }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Direct(2) }, Const { destination: Relative(2), bit_size: Field, value: -292434322542114415011969994633470574393 }, Store { destination_pointer: Relative(1), source: Relative(2) }, Const { destination: Relative(2), bit_size: Integer(U32), value: 0 }, Mov { destination: Relative(3), source: Direct(1) }, Const { destination: Relative(4), bit_size: Integer(U32), value: 3 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(4) }, IndirectConst { destination_pointer: Relative(3), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(4), op: Add, bit_size: U32, lhs: Relative(3), rhs: Direct(2) }, Mov { destination: Relative(5), source: Relative(4) }, Store { destination_pointer: Relative(5), source: Relative(2) }, BinaryIntOp { destination: Relative(5), op: Add, bit_size: U32, lhs: Relative(5), rhs: Direct(2) }, Store { destination_pointer: Relative(5), source: Relative(1) }, Mov { destination: Relative(1), source: Direct(1) }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Direct(2) }, Store { destination_pointer: Relative(1), source: Relative(3) }, Mov { destination: Relative(3), source: Direct(1) }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Direct(2) }, Store { destination_pointer: Relative(3), source: Relative(2) }, Const { destination: Relative(2), bit_size: Integer(U32), value: 1 }, Jump { location: 36 }, Load { destination: Relative(4), source_pointer: Relative(3) }, BinaryIntOp { destination: Relative(5), op: Equals, bit_size: U32, lhs: Relative(4), rhs: Relative(2) }, JumpIf { condition: Relative(5), location: 47 }, Jump { location: 40 }, Load { destination: Relative(4), source_pointer: Relative(3) }, BinaryIntOp { destination: Relative(5), op: Add, bit_size: U32, lhs: Relative(4), rhs: Relative(2) }, BinaryIntOp { destination: Relative(6), op: LessThanEquals, bit_size: U32, lhs: Relative(4), rhs: Relative(5) }, JumpIf { condition: Relative(6), location: 45 }, Call { location: 62 }, Store { destination_pointer: Relative(3), source: Relative(5) }, Jump { location: 36 }, Load { destination: Relative(2), source_pointer: Relative(1) }, Const { destination: Relative(1), bit_size: Integer(U32), value: 2 }, BinaryIntOp { destination: Relative(4), op: Add, bit_size: U32, lhs: Relative(2), rhs: Relative(1) }, Load { destination: Relative(3), source_pointer: Relative(4) }, Load { destination: Relative(1), source_pointer: Relative(3) }, Const { destination: Relative(2), bit_size: Field, value: 157653526363045079447323020681982670581 }, BinaryFieldOp { destination: Relative(3), op: Div, lhs: Relative(2), rhs: Relative(1) }, Mov { destination: Relative(1), source: Relative(3) }, Return, Const { destination: Direct(32772), bit_size: Integer(U32), value: 30720 }, BinaryIntOp { destination: Direct(32771), op: LessThan, bit_size: U32, lhs: Direct(0), rhs: Direct(32772) }, JumpIf { condition: Direct(32771), location: 61 }, IndirectConst { destination_pointer: Direct(1), bit_size: Integer(U64), value: 17843811134343075018 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return, IndirectConst { destination_pointer: Direct(1), bit_size: Integer(U64), value: 5019202896831570965 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return]" + ], + "debug_symbols": "tZPBjoMgEIbfhTMHGBRLX6VpGmppQ0LQUN1kY3z3HR3Z2oObjZu98Inw/RMmmYHd3LV/XHy8N092PA3smnwI/nEJTW0730T8OzAxLbJgR8mZLAmaUBEOBDMDBEESgKAIlAKUApQClAKYohBmhhIETCkQQFAETUCv5KwQBLypEUBQhIJQElCoEFjogDAzSkGQBNQNAnUzjpzlRly65NzUh1VnsF+tTS527Bj7EDj7sKGfLz1bG2d2NuGp4MzFGxID7z646WvkL1tsqzq7Urzs8td6ob51taXDv+nSVNk3hx0+ACw+KNjjG7n4art7P/gK8vuV3lNfaZ396o/1q/f6Z9zZ2qe3QR2npOTtNbhle+9jvTrtPtt8kge9TU3tbn1yU9Jq2nE9lZpreca5xtE4aeC6OI9T6S8=", + "file_map": { + "50": { + "source": "unconstrained fn main() -> pub Field {\n func_2([(0, &mut -292434322542114415011969994633470574393)])\n}\nunconstrained fn func_2(mut b: [(u32, &mut Field); 1]) -> Field {\n let mut idx_e: u32 = 0;\n loop {\n if idx_e == 1 {\n break;\n } else {\n idx_e = idx_e + 1;\n }\n }\n (157653526363045079447323020681982670581 / *b[0].1)\n}\n", + "path": "" + } + }, + "names": [ + "main" + ], + "brillig_names": [ + "main" + ] +} diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/regression_8755/execute__tests__stdout.snap b/tooling/nargo_cli/tests/snapshots/execution_success/regression_8755/execute__tests__stdout.snap new file mode 100644 index 00000000000..f654b66efcd --- /dev/null +++ b/tooling/nargo_cli/tests/snapshots/execution_success/regression_8755/execute__tests__stdout.snap @@ -0,0 +1,5 @@ +--- +source: tooling/nargo_cli/tests/execute.rs +expression: stdout +--- +[regression_8755] Circuit output: Field(4740911027145274801807009652820289697178104761561901561018492048924696890497) diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/regression_8761/execute__tests__expanded.snap b/tooling/nargo_cli/tests/snapshots/execution_success/regression_8761/execute__tests__expanded.snap new file mode 100644 index 00000000000..b4a77ceca6b --- /dev/null +++ b/tooling/nargo_cli/tests/snapshots/execution_success/regression_8761/execute__tests__expanded.snap @@ -0,0 +1,13 @@ +--- +source: tooling/nargo_cli/tests/execute.rs +expression: expanded_code +--- +fn main() -> pub Field { + let mut d: [&mut bool; 1] = [&mut false]; + for _ in 0..1 {} + if *d[0] { + 0 + } else { + 1 + } +} diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/regression_8761/execute__tests__force_brillig_false_inliner_-9223372036854775808.snap b/tooling/nargo_cli/tests/snapshots/execution_success/regression_8761/execute__tests__force_brillig_false_inliner_-9223372036854775808.snap new file mode 100644 index 00000000000..ab9046096f8 --- /dev/null +++ b/tooling/nargo_cli/tests/snapshots/execution_success/regression_8761/execute__tests__force_brillig_false_inliner_-9223372036854775808.snap @@ -0,0 +1,32 @@ +--- +source: tooling/nargo_cli/tests/execute.rs +expression: artifact +--- +{ + "noir_version": "[noir_version]", + "hash": "[hash]", + "abi": { + "parameters": [], + "return_type": { + "abi_type": { + "kind": "field" + }, + "visibility": "public" + }, + "error_types": {} + }, + "bytecode": [ + "func 0", + "current witness index : _0", + "private parameters indices : []", + "public parameters indices : []", + "return value indices : [_0]", + "EXPR [ (1, _0) -1 ]" + ], + "debug_symbols": "XY5BCsQwCEXv4rqLWfcqw1BsaosgJtikMITefWyYQOlK/3/6tcJCc9km1jXuML4rzMYivE0SA2aO6m49B+hyykbkFty4byU00gyjFpEBDpTShvaE2mpGc/oagHTx6oErC13d+XGBge158UBjnIX+ci0abjR/Uyf942Qx0FKMrqTGPPsH", + "file_map": {}, + "names": [ + "main" + ], + "brillig_names": [] +} diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/regression_8761/execute__tests__force_brillig_false_inliner_0.snap b/tooling/nargo_cli/tests/snapshots/execution_success/regression_8761/execute__tests__force_brillig_false_inliner_0.snap new file mode 100644 index 00000000000..ab9046096f8 --- /dev/null +++ b/tooling/nargo_cli/tests/snapshots/execution_success/regression_8761/execute__tests__force_brillig_false_inliner_0.snap @@ -0,0 +1,32 @@ +--- +source: tooling/nargo_cli/tests/execute.rs +expression: artifact +--- +{ + "noir_version": "[noir_version]", + "hash": "[hash]", + "abi": { + "parameters": [], + "return_type": { + "abi_type": { + "kind": "field" + }, + "visibility": "public" + }, + "error_types": {} + }, + "bytecode": [ + "func 0", + "current witness index : _0", + "private parameters indices : []", + "public parameters indices : []", + "return value indices : [_0]", + "EXPR [ (1, _0) -1 ]" + ], + "debug_symbols": "XY5BCsQwCEXv4rqLWfcqw1BsaosgJtikMITefWyYQOlK/3/6tcJCc9km1jXuML4rzMYivE0SA2aO6m49B+hyykbkFty4byU00gyjFpEBDpTShvaE2mpGc/oagHTx6oErC13d+XGBge158UBjnIX+ci0abjR/Uyf942Qx0FKMrqTGPPsH", + "file_map": {}, + "names": [ + "main" + ], + "brillig_names": [] +} diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/regression_8761/execute__tests__force_brillig_false_inliner_9223372036854775807.snap b/tooling/nargo_cli/tests/snapshots/execution_success/regression_8761/execute__tests__force_brillig_false_inliner_9223372036854775807.snap new file mode 100644 index 00000000000..ab9046096f8 --- /dev/null +++ b/tooling/nargo_cli/tests/snapshots/execution_success/regression_8761/execute__tests__force_brillig_false_inliner_9223372036854775807.snap @@ -0,0 +1,32 @@ +--- +source: tooling/nargo_cli/tests/execute.rs +expression: artifact +--- +{ + "noir_version": "[noir_version]", + "hash": "[hash]", + "abi": { + "parameters": [], + "return_type": { + "abi_type": { + "kind": "field" + }, + "visibility": "public" + }, + "error_types": {} + }, + "bytecode": [ + "func 0", + "current witness index : _0", + "private parameters indices : []", + "public parameters indices : []", + "return value indices : [_0]", + "EXPR [ (1, _0) -1 ]" + ], + "debug_symbols": "XY5BCsQwCEXv4rqLWfcqw1BsaosgJtikMITefWyYQOlK/3/6tcJCc9km1jXuML4rzMYivE0SA2aO6m49B+hyykbkFty4byU00gyjFpEBDpTShvaE2mpGc/oagHTx6oErC13d+XGBge158UBjnIX+ci0abjR/Uyf942Qx0FKMrqTGPPsH", + "file_map": {}, + "names": [ + "main" + ], + "brillig_names": [] +} diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/regression_8761/execute__tests__force_brillig_true_inliner_-9223372036854775808.snap b/tooling/nargo_cli/tests/snapshots/execution_success/regression_8761/execute__tests__force_brillig_true_inliner_-9223372036854775808.snap new file mode 100644 index 00000000000..6d588f6b890 --- /dev/null +++ b/tooling/nargo_cli/tests/snapshots/execution_success/regression_8761/execute__tests__force_brillig_true_inliner_-9223372036854775808.snap @@ -0,0 +1,41 @@ +--- +source: tooling/nargo_cli/tests/execute.rs +expression: artifact +--- +{ + "noir_version": "[noir_version]", + "hash": "[hash]", + "abi": { + "parameters": [], + "return_type": { + "abi_type": { + "kind": "field" + }, + "visibility": "public" + }, + "error_types": { + "17843811134343075018": { + "error_kind": "string", + "string": "Stack too deep" + } + } + }, + "bytecode": [ + "func 0", + "current witness index : _0", + "private parameters indices : []", + "public parameters indices : []", + "return value indices : [_0]", + "BRILLIG CALL func 0: inputs: [], outputs: [Simple(Witness(0))]", + "unconstrained func 0", + "[Const { destination: Direct(2), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(1), bit_size: Integer(U32), value: 32837 }, Const { destination: Direct(0), bit_size: Integer(U32), value: 3 }, Const { destination: Relative(1), bit_size: Integer(U32), value: 0 }, Const { destination: Relative(2), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(32836), size_address: Relative(1), offset_address: Relative(2) }, Call { location: 12 }, Call { location: 13 }, Mov { destination: Direct(32836), source: Relative(1) }, Const { destination: Relative(2), bit_size: Integer(U32), value: 32836 }, Const { destination: Relative(3), bit_size: Integer(U32), value: 1 }, Stop { return_data: HeapVector { pointer: Relative(2), size: Relative(3) } }, Return, Call { location: 16 }, Const { destination: Relative(1), bit_size: Field, value: 1 }, Return, Const { destination: Direct(32772), bit_size: Integer(U32), value: 30720 }, BinaryIntOp { destination: Direct(32771), op: LessThan, bit_size: U32, lhs: Direct(0), rhs: Direct(32772) }, JumpIf { condition: Direct(32771), location: 21 }, IndirectConst { destination_pointer: Direct(1), bit_size: Integer(U64), value: 17843811134343075018 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return]" + ], + "debug_symbols": "XY7BCoRACIbfxfMcag976FUiwiaLAXEGmwmW6N3XiQ1iL+rvp/4eMNNU1jHIEjfo+gMmDcxhHTl6zCGKdY/TwS3HrETWgge3rYRKkqGTwuxgRy7X0JZQrpxRjTYOSGbLdnAJTLU6BxPog/477qgBJ6afXIr4B82fdJP746TR01yU6qXKoKmhtdi3b/dqh7O6fQE=", + "file_map": {}, + "names": [ + "main" + ], + "brillig_names": [ + "main" + ] +} diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/regression_8761/execute__tests__force_brillig_true_inliner_0.snap b/tooling/nargo_cli/tests/snapshots/execution_success/regression_8761/execute__tests__force_brillig_true_inliner_0.snap new file mode 100644 index 00000000000..6d588f6b890 --- /dev/null +++ b/tooling/nargo_cli/tests/snapshots/execution_success/regression_8761/execute__tests__force_brillig_true_inliner_0.snap @@ -0,0 +1,41 @@ +--- +source: tooling/nargo_cli/tests/execute.rs +expression: artifact +--- +{ + "noir_version": "[noir_version]", + "hash": "[hash]", + "abi": { + "parameters": [], + "return_type": { + "abi_type": { + "kind": "field" + }, + "visibility": "public" + }, + "error_types": { + "17843811134343075018": { + "error_kind": "string", + "string": "Stack too deep" + } + } + }, + "bytecode": [ + "func 0", + "current witness index : _0", + "private parameters indices : []", + "public parameters indices : []", + "return value indices : [_0]", + "BRILLIG CALL func 0: inputs: [], outputs: [Simple(Witness(0))]", + "unconstrained func 0", + "[Const { destination: Direct(2), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(1), bit_size: Integer(U32), value: 32837 }, Const { destination: Direct(0), bit_size: Integer(U32), value: 3 }, Const { destination: Relative(1), bit_size: Integer(U32), value: 0 }, Const { destination: Relative(2), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(32836), size_address: Relative(1), offset_address: Relative(2) }, Call { location: 12 }, Call { location: 13 }, Mov { destination: Direct(32836), source: Relative(1) }, Const { destination: Relative(2), bit_size: Integer(U32), value: 32836 }, Const { destination: Relative(3), bit_size: Integer(U32), value: 1 }, Stop { return_data: HeapVector { pointer: Relative(2), size: Relative(3) } }, Return, Call { location: 16 }, Const { destination: Relative(1), bit_size: Field, value: 1 }, Return, Const { destination: Direct(32772), bit_size: Integer(U32), value: 30720 }, BinaryIntOp { destination: Direct(32771), op: LessThan, bit_size: U32, lhs: Direct(0), rhs: Direct(32772) }, JumpIf { condition: Direct(32771), location: 21 }, IndirectConst { destination_pointer: Direct(1), bit_size: Integer(U64), value: 17843811134343075018 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return]" + ], + "debug_symbols": "XY7BCoRACIbfxfMcag976FUiwiaLAXEGmwmW6N3XiQ1iL+rvp/4eMNNU1jHIEjfo+gMmDcxhHTl6zCGKdY/TwS3HrETWgge3rYRKkqGTwuxgRy7X0JZQrpxRjTYOSGbLdnAJTLU6BxPog/477qgBJ6afXIr4B82fdJP746TR01yU6qXKoKmhtdi3b/dqh7O6fQE=", + "file_map": {}, + "names": [ + "main" + ], + "brillig_names": [ + "main" + ] +} diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/regression_8761/execute__tests__force_brillig_true_inliner_9223372036854775807.snap b/tooling/nargo_cli/tests/snapshots/execution_success/regression_8761/execute__tests__force_brillig_true_inliner_9223372036854775807.snap new file mode 100644 index 00000000000..6d588f6b890 --- /dev/null +++ b/tooling/nargo_cli/tests/snapshots/execution_success/regression_8761/execute__tests__force_brillig_true_inliner_9223372036854775807.snap @@ -0,0 +1,41 @@ +--- +source: tooling/nargo_cli/tests/execute.rs +expression: artifact +--- +{ + "noir_version": "[noir_version]", + "hash": "[hash]", + "abi": { + "parameters": [], + "return_type": { + "abi_type": { + "kind": "field" + }, + "visibility": "public" + }, + "error_types": { + "17843811134343075018": { + "error_kind": "string", + "string": "Stack too deep" + } + } + }, + "bytecode": [ + "func 0", + "current witness index : _0", + "private parameters indices : []", + "public parameters indices : []", + "return value indices : [_0]", + "BRILLIG CALL func 0: inputs: [], outputs: [Simple(Witness(0))]", + "unconstrained func 0", + "[Const { destination: Direct(2), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(1), bit_size: Integer(U32), value: 32837 }, Const { destination: Direct(0), bit_size: Integer(U32), value: 3 }, Const { destination: Relative(1), bit_size: Integer(U32), value: 0 }, Const { destination: Relative(2), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(32836), size_address: Relative(1), offset_address: Relative(2) }, Call { location: 12 }, Call { location: 13 }, Mov { destination: Direct(32836), source: Relative(1) }, Const { destination: Relative(2), bit_size: Integer(U32), value: 32836 }, Const { destination: Relative(3), bit_size: Integer(U32), value: 1 }, Stop { return_data: HeapVector { pointer: Relative(2), size: Relative(3) } }, Return, Call { location: 16 }, Const { destination: Relative(1), bit_size: Field, value: 1 }, Return, Const { destination: Direct(32772), bit_size: Integer(U32), value: 30720 }, BinaryIntOp { destination: Direct(32771), op: LessThan, bit_size: U32, lhs: Direct(0), rhs: Direct(32772) }, JumpIf { condition: Direct(32771), location: 21 }, IndirectConst { destination_pointer: Direct(1), bit_size: Integer(U64), value: 17843811134343075018 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return]" + ], + "debug_symbols": "XY7BCoRACIbfxfMcag976FUiwiaLAXEGmwmW6N3XiQ1iL+rvp/4eMNNU1jHIEjfo+gMmDcxhHTl6zCGKdY/TwS3HrETWgge3rYRKkqGTwuxgRy7X0JZQrpxRjTYOSGbLdnAJTLU6BxPog/477qgBJ6afXIr4B82fdJP746TR01yU6qXKoKmhtdi3b/dqh7O6fQE=", + "file_map": {}, + "names": [ + "main" + ], + "brillig_names": [ + "main" + ] +} diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/regression_8761/execute__tests__stdout.snap b/tooling/nargo_cli/tests/snapshots/execution_success/regression_8761/execute__tests__stdout.snap new file mode 100644 index 00000000000..09389a8d96b --- /dev/null +++ b/tooling/nargo_cli/tests/snapshots/execution_success/regression_8761/execute__tests__stdout.snap @@ -0,0 +1,5 @@ +--- +source: tooling/nargo_cli/tests/execute.rs +expression: stdout +--- +[regression_8761] Circuit output: Field(1)