From 31a1c02c5bb47ece6cc58826b4d68653e605b6f9 Mon Sep 17 00:00:00 2001 From: Maxim Vezenov Date: Fri, 13 Jun 2025 17:01:49 +0000 Subject: [PATCH] add regression tests for compilation failures --- .../regression_8741/Nargo.toml | 6 ++ .../regression_8741/src/main.nr | 5 ++ .../regression_8748/Nargo.toml | 6 ++ .../regression_8748/src/main.nr | 11 ++++ .../regression_8729/Nargo.toml | 6 ++ .../regression_8729/Prover.toml | 1 + .../regression_8729/src/main.nr | 19 +++++++ .../execute__tests__stderr.snap | 12 ++++ .../execute__tests__stderr.snap | 12 ++++ .../execute__tests__expanded.snap | 21 +++++++ ...ig_false_inliner_-9223372036854775808.snap | 56 +++++++++++++++++++ ..._tests__force_brillig_false_inliner_0.snap | 56 +++++++++++++++++++ ...lig_false_inliner_9223372036854775807.snap | 56 +++++++++++++++++++ ...lig_true_inliner_-9223372036854775808.snap | 54 ++++++++++++++++++ ...__tests__force_brillig_true_inliner_0.snap | 54 ++++++++++++++++++ ...llig_true_inliner_9223372036854775807.snap | 54 ++++++++++++++++++ .../execute__tests__stdout.snap | 6 ++ 17 files changed, 435 insertions(+) create mode 100644 test_programs/compile_failure/regression_8741/Nargo.toml create mode 100644 test_programs/compile_failure/regression_8741/src/main.nr create mode 100644 test_programs/compile_failure/regression_8748/Nargo.toml create mode 100644 test_programs/compile_failure/regression_8748/src/main.nr create mode 100644 test_programs/execution_success/regression_8729/Nargo.toml create mode 100644 test_programs/execution_success/regression_8729/Prover.toml create mode 100644 test_programs/execution_success/regression_8729/src/main.nr create mode 100644 tooling/nargo_cli/tests/snapshots/compile_failure/regression_8741/execute__tests__stderr.snap create mode 100644 tooling/nargo_cli/tests/snapshots/compile_failure/regression_8748/execute__tests__stderr.snap create mode 100644 tooling/nargo_cli/tests/snapshots/execution_success/regression_8729/execute__tests__expanded.snap create mode 100644 tooling/nargo_cli/tests/snapshots/execution_success/regression_8729/execute__tests__force_brillig_false_inliner_-9223372036854775808.snap create mode 100644 tooling/nargo_cli/tests/snapshots/execution_success/regression_8729/execute__tests__force_brillig_false_inliner_0.snap create mode 100644 tooling/nargo_cli/tests/snapshots/execution_success/regression_8729/execute__tests__force_brillig_false_inliner_9223372036854775807.snap create mode 100644 tooling/nargo_cli/tests/snapshots/execution_success/regression_8729/execute__tests__force_brillig_true_inliner_-9223372036854775808.snap create mode 100644 tooling/nargo_cli/tests/snapshots/execution_success/regression_8729/execute__tests__force_brillig_true_inliner_0.snap create mode 100644 tooling/nargo_cli/tests/snapshots/execution_success/regression_8729/execute__tests__force_brillig_true_inliner_9223372036854775807.snap create mode 100644 tooling/nargo_cli/tests/snapshots/execution_success/regression_8729/execute__tests__stdout.snap diff --git a/test_programs/compile_failure/regression_8741/Nargo.toml b/test_programs/compile_failure/regression_8741/Nargo.toml new file mode 100644 index 00000000000..db052655c0e --- /dev/null +++ b/test_programs/compile_failure/regression_8741/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "regression_8741" +type = "bin" +authors = [""] + +[dependencies] \ No newline at end of file diff --git a/test_programs/compile_failure/regression_8741/src/main.nr b/test_programs/compile_failure/regression_8741/src/main.nr new file mode 100644 index 00000000000..6bf8ac574c0 --- /dev/null +++ b/test_programs/compile_failure/regression_8741/src/main.nr @@ -0,0 +1,5 @@ +fn main(c: bool) -> pub bool { + let mut e: &mut bool = (&mut false); + if c { e = (&mut true); }; + *e +} diff --git a/test_programs/compile_failure/regression_8748/Nargo.toml b/test_programs/compile_failure/regression_8748/Nargo.toml new file mode 100644 index 00000000000..2e94d987e91 --- /dev/null +++ b/test_programs/compile_failure/regression_8748/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "regression_8748" +type = "bin" +authors = [""] + +[dependencies] \ No newline at end of file diff --git a/test_programs/compile_failure/regression_8748/src/main.nr b/test_programs/compile_failure/regression_8748/src/main.nr new file mode 100644 index 00000000000..fda2fff48a1 --- /dev/null +++ b/test_programs/compile_failure/regression_8748/src/main.nr @@ -0,0 +1,11 @@ +fn main(c: bool) { + let mut a: [&mut bool; 2] = [&mut false, &mut true]; + + if (c) { + a = [a[1], a[0]]; + a[0] = &mut true; + }; + + a = [&mut true, a[1]]; + a[1] = &mut false; +} diff --git a/test_programs/execution_success/regression_8729/Nargo.toml b/test_programs/execution_success/regression_8729/Nargo.toml new file mode 100644 index 00000000000..11872a0fcc4 --- /dev/null +++ b/test_programs/execution_success/regression_8729/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "regression_8729" +type = "bin" +authors = [""] + +[dependencies] \ No newline at end of file diff --git a/test_programs/execution_success/regression_8729/Prover.toml b/test_programs/execution_success/regression_8729/Prover.toml new file mode 100644 index 00000000000..f6e14bb6b20 --- /dev/null +++ b/test_programs/execution_success/regression_8729/Prover.toml @@ -0,0 +1 @@ +return = 0 \ No newline at end of file diff --git a/test_programs/execution_success/regression_8729/src/main.nr b/test_programs/execution_success/regression_8729/src/main.nr new file mode 100644 index 00000000000..72bc1512125 --- /dev/null +++ b/test_programs/execution_success/regression_8729/src/main.nr @@ -0,0 +1,19 @@ +global G_A: [(bool, bool, str<4>); 3] = + [(false, true, "LZUT"), (false, true, "MFFA"), (false, true, "XPHT")]; + +fn main() -> pub Field { + let mut a: ((str<4>, Field, str<4>, str<3>, bool), [&mut u8; 2]) = ( + (G_A[2].2, (unsafe { func_4() } as Field), G_A[1].2, "TWC", false), [(&mut 57), (&mut 219)], + ); + for idx_d in 0..1 { + // a.0 = a.0; + } + a.0 = (a.0.2, 0, a.0.0, a.0.3, ((128 % (*a.1[0])) == (*a.1[1]))); + 0 +} + +unconstrained fn func_4() -> bool { + let mut a = G_A[1].2; + println(a); + true +} diff --git a/tooling/nargo_cli/tests/snapshots/compile_failure/regression_8741/execute__tests__stderr.snap b/tooling/nargo_cli/tests/snapshots/compile_failure/regression_8741/execute__tests__stderr.snap new file mode 100644 index 00000000000..7bab392cad8 --- /dev/null +++ b/tooling/nargo_cli/tests/snapshots/compile_failure/regression_8741/execute__tests__stderr.snap @@ -0,0 +1,12 @@ +--- +source: tooling/nargo_cli/tests/execute.rs +expression: stderr +--- +error: Cannot assign to a mutable variable which contains a reference internally + ┌─ src/main.nr:3:17 + │ +3 │ if c { e = (&mut true); }; + │ --------- Assigned expression has the type `&mut bool` + │ + +Aborting due to 1 previous error diff --git a/tooling/nargo_cli/tests/snapshots/compile_failure/regression_8748/execute__tests__stderr.snap b/tooling/nargo_cli/tests/snapshots/compile_failure/regression_8748/execute__tests__stderr.snap new file mode 100644 index 00000000000..aa442c61aee --- /dev/null +++ b/tooling/nargo_cli/tests/snapshots/compile_failure/regression_8748/execute__tests__stderr.snap @@ -0,0 +1,12 @@ +--- +source: tooling/nargo_cli/tests/execute.rs +expression: stderr +--- +error: Cannot assign to a mutable variable which contains a reference internally + ┌─ src/main.nr:5:13 + │ +5 │ a = [a[1], a[0]]; + │ ------------ Assigned expression has the type `[&mut bool; 2]`, which contains a reference type internally + │ + +Aborting due to 1 previous error diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/regression_8729/execute__tests__expanded.snap b/tooling/nargo_cli/tests/snapshots/execution_success/regression_8729/execute__tests__expanded.snap new file mode 100644 index 00000000000..97a690c4407 --- /dev/null +++ b/tooling/nargo_cli/tests/snapshots/execution_success/regression_8729/execute__tests__expanded.snap @@ -0,0 +1,21 @@ +--- +source: tooling/nargo_cli/tests/execute.rs +expression: expanded_code +--- +global G_A: [(bool, bool, str<4>); 3] = + [(false, true, "LZUT"), (false, true, "MFFA"), (false, true, "XPHT")]; + +fn main() -> pub Field { + // Safety: comment added by `nargo expand` + let mut a: ((str<4>, Field, str<4>, str<3>, bool), [&mut u8; 2]) = + ((G_A[2].2, unsafe { func_4() } as Field, G_A[1].2, "TWC", false), [&mut 57, &mut 219]); + for idx_d in 0..1 {} + a.0 = (a.0.2, 0, a.0.0, a.0.3, (128 % *a.1[0]) == *a.1[1]); + 0 +} + +unconstrained fn func_4() -> bool { + let mut a: str<4> = G_A[1].2; + println(a); + true +} diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/regression_8729/execute__tests__force_brillig_false_inliner_-9223372036854775808.snap b/tooling/nargo_cli/tests/snapshots/execution_success/regression_8729/execute__tests__force_brillig_false_inliner_-9223372036854775808.snap new file mode 100644 index 00000000000..557089d6617 --- /dev/null +++ b/tooling/nargo_cli/tests/snapshots/execution_success/regression_8729/execute__tests__force_brillig_false_inliner_-9223372036854775808.snap @@ -0,0 +1,56 @@ +--- +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": { + "12049594436772143978": { + "error_kind": "string", + "string": "array ref-count underflow detected" + }, + "17843811134343075018": { + "error_kind": "string", + "string": "Stack too deep" + } + } + }, + "bytecode": [ + "func 0", + "current witness index : _1", + "private parameters indices : []", + "public parameters indices : []", + "return value indices : [_0]", + "BRILLIG CALL func 0: inputs: [], outputs: [Simple(Witness(1))]", + "BLACKBOX::RANGE [(_1, 1)] []", + "EXPR [ (1, _0) 0 ]", + "unconstrained func 0", + "[Const { destination: Direct(2), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(1), bit_size: Integer(U32), value: 32844 }, 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(32843), size_address: Relative(1), offset_address: Relative(2) }, Call { location: 12 }, Call { location: 31 }, Mov { destination: Direct(32843), source: Relative(1) }, Const { destination: Relative(2), bit_size: Integer(U32), value: 32843 }, 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(U1), value: 0 }, Const { destination: Direct(32836), bit_size: Integer(U1), value: 1 }, Const { destination: Direct(32837), bit_size: Integer(U8), value: 77 }, Const { destination: Direct(32838), bit_size: Integer(U8), value: 70 }, Const { destination: Direct(32839), bit_size: Integer(U8), value: 65 }, Mov { destination: Direct(32840), source: Direct(1) }, Const { destination: Direct(32841), bit_size: Integer(U32), value: 5 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Direct(32841) }, IndirectConst { destination_pointer: Direct(32840), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Direct(32841), op: Add, bit_size: U32, lhs: Direct(32840), rhs: Direct(2) }, Mov { destination: Direct(32842), source: Direct(32841) }, Store { destination_pointer: Direct(32842), source: Direct(32837) }, BinaryIntOp { destination: Direct(32842), op: Add, bit_size: U32, lhs: Direct(32842), rhs: Direct(2) }, Store { destination_pointer: Direct(32842), source: Direct(32838) }, BinaryIntOp { destination: Direct(32842), op: Add, bit_size: U32, lhs: Direct(32842), rhs: Direct(2) }, Store { destination_pointer: Direct(32842), source: Direct(32838) }, BinaryIntOp { destination: Direct(32842), op: Add, bit_size: U32, lhs: Direct(32842), rhs: Direct(2) }, Store { destination_pointer: Direct(32842), source: Direct(32839) }, Return, Call { location: 123 }, Load { destination: Relative(1), source_pointer: Direct(32840) }, Const { destination: Relative(2), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(3), op: Equals, bit_size: U32, lhs: Relative(2), rhs: Relative(1) }, Not { destination: Relative(3), source: Relative(3), bit_size: U1 }, JumpIf { condition: Relative(3), location: 38 }, Call { location: 129 }, BinaryIntOp { destination: Relative(1), op: Add, bit_size: U32, lhs: Relative(1), rhs: Direct(2) }, Store { destination_pointer: Direct(32840), source: Relative(1) }, Const { destination: Relative(1), bit_size: Integer(U8), value: 123 }, Const { destination: Relative(3), bit_size: Integer(U8), value: 34 }, Const { destination: Relative(4), bit_size: Integer(U8), value: 107 }, Const { destination: Relative(5), bit_size: Integer(U8), value: 105 }, Const { destination: Relative(6), bit_size: Integer(U8), value: 110 }, Const { destination: Relative(7), bit_size: Integer(U8), value: 100 }, Const { destination: Relative(8), bit_size: Integer(U8), value: 58 }, Const { destination: Relative(9), bit_size: Integer(U8), value: 115 }, Const { destination: Relative(10), bit_size: Integer(U8), value: 116 }, Const { destination: Relative(11), bit_size: Integer(U8), value: 114 }, Const { destination: Relative(12), bit_size: Integer(U8), value: 103 }, Const { destination: Relative(13), bit_size: Integer(U8), value: 44 }, Const { destination: Relative(14), bit_size: Integer(U8), value: 108 }, Const { destination: Relative(15), bit_size: Integer(U8), value: 101 }, Const { destination: Relative(16), bit_size: Integer(U8), value: 104 }, Const { destination: Relative(17), bit_size: Integer(U8), value: 52 }, Const { destination: Relative(18), bit_size: Integer(U8), value: 125 }, Mov { destination: Relative(19), source: Direct(1) }, Const { destination: Relative(20), bit_size: Integer(U32), value: 29 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(20) }, IndirectConst { destination_pointer: Relative(19), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(20), op: Add, bit_size: U32, lhs: Relative(19), rhs: Direct(2) }, Mov { destination: Relative(21), source: Relative(20) }, Store { destination_pointer: Relative(21), source: Relative(1) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(3) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(4) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(5) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(6) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(7) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(3) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(8) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(3) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(9) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(10) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(11) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(5) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(6) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(12) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(3) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(13) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(3) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(14) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(15) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(6) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(12) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(10) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(16) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(3) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(8) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(17) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(18) }, BinaryIntOp { destination: Relative(1), op: Add, bit_size: U32, lhs: Direct(32840), rhs: Direct(2) }, BinaryIntOp { destination: Relative(3), op: Add, bit_size: U32, lhs: Relative(19), rhs: Direct(2) }, ForeignCall { function: \"print\", destinations: [], destination_value_types: [], inputs: [MemoryAddress(Direct(32836)), HeapArray(HeapArray { pointer: Relative(1), size: 4 }), HeapArray(HeapArray { pointer: Relative(3), size: 28 }), MemoryAddress(Direct(32835))], input_value_types: [Simple(Integer(U1)), Array { value_types: [Simple(Integer(U8))], size: 4 }, Array { value_types: [Simple(Integer(U8))], size: 28 }, Simple(Integer(U1))] }, Mov { destination: Relative(1), source: Direct(32836) }, 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: 128 }, 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: 12049594436772143978 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return]" + ], + "debug_symbols": "tdTRSsMwFMbxd8l1L3qSniRnryJjdFuUQulGbQUZfXeTfqfqkIk33uxv7b4fuoXezDkd55dDNzxfXs3u6WaOY9f33cuhv5zaqbsM+bc3U5cXZ82OKuMc0iCMeCQgEZE1TV43OYRYxCENwohHAhIRWcNQGApDYSgMhaEwFIbCUBiKh+KheCgeiofioXgoHoqH4qEEKAFKgBKgBCgBSoASoAQoAUqEEqFEKBFKhBKhRCgRSoQSoQgUgSJQBIpAESgCRaAIFIFCda0lrdU6baNlrdcGbdSqR+qReqQeqUfqkXqkHqlH2eNSQW32eFkqs53LwzSmVI7lt4Oaj++1HdMwmd0w931l3tp+Xt/0em2HtVM75rt1ZdJwzs3gc9en8tNSfa3rx1OuWcdM9Dnnv+9Jtr2VR3v7eB+FdC/Wfe6tvdu7/9uHJug+xPrR/pf/3zZO95bvP799vmpP3fjj0ePz959fl4KOXXvsU7lTtvNw2t6YL6f363Zne4pdx8spnecxFfTrUVZO5xNZV5GN+3LK1kupyNF+KX/JBw==", + "file_map": { + "22": { + "source": "pub mod hash;\npub mod aes128;\npub mod array;\npub mod slice;\npub mod ecdsa_secp256k1;\npub mod ecdsa_secp256r1;\npub mod embedded_curve_ops;\npub mod field;\npub mod collections;\npub mod compat;\npub mod convert;\npub mod option;\npub mod string;\npub mod test;\npub mod cmp;\npub mod ops;\npub mod default;\npub mod prelude;\npub mod runtime;\npub mod meta;\npub mod append;\npub mod mem;\npub mod panic;\npub mod hint;\n\nuse convert::AsPrimitive;\n\n// Oracle calls are required to be wrapped in an unconstrained function\n// Thus, the only argument to the `println` oracle is expected to always be an ident\n#[oracle(print)]\nunconstrained fn print_oracle(with_newline: bool, input: T) {}\n\nunconstrained fn print_unconstrained(with_newline: bool, input: T) {\n print_oracle(with_newline, input);\n}\n\npub fn println(input: T) {\n // Safety: a print statement cannot be constrained\n unsafe {\n print_unconstrained(true, input);\n }\n}\n\npub fn print(input: T) {\n // Safety: a print statement cannot be constrained\n unsafe {\n print_unconstrained(false, input);\n }\n}\n\npub fn verify_proof(\n verification_key: [Field; N],\n proof: [Field; M],\n public_inputs: [Field; K],\n key_hash: Field,\n) {\n verify_proof_internal(verification_key, proof, public_inputs, key_hash, 0);\n}\n\npub fn verify_proof_with_type(\n verification_key: [Field; N],\n proof: [Field; M],\n public_inputs: [Field; K],\n key_hash: Field,\n proof_type: u32,\n) {\n if !crate::runtime::is_unconstrained() {\n crate::assert_constant(proof_type);\n }\n verify_proof_internal(verification_key, proof, public_inputs, key_hash, proof_type);\n}\n\n#[foreign(recursive_aggregation)]\nfn verify_proof_internal(\n verification_key: [Field; N],\n proof: [Field; M],\n public_inputs: [Field; K],\n key_hash: Field,\n proof_type: u32,\n) {}\n\n// Asserts that the given value is known at compile-time.\n// Useful for debugging for-loop bounds.\n#[builtin(assert_constant)]\npub fn assert_constant(x: T) {}\n\n// Asserts that the given value is both true and known at compile-time.\n// The message can be a string, a format string, or any value, as long as it is known at compile-time\n#[builtin(static_assert)]\npub fn static_assert(predicate: bool, message: T) {}\n\n#[deprecated(\"wrapping operations should be done with the Wrapping traits. E.g: x.wrapping_add(y)\")]\npub fn wrapping_add(x: T, y: T) -> T\nwhere\n T: AsPrimitive,\n Field: AsPrimitive,\n{\n AsPrimitive::as_(x.as_() + y.as_())\n}\n#[deprecated(\"wrapping operations should be done with the Wrapping traits. E.g: x.wrapping_sub(y)\")]\npub fn wrapping_sub(x: T, y: T) -> T\nwhere\n T: AsPrimitive,\n Field: AsPrimitive,\n{\n //340282366920938463463374607431768211456 is 2^128, it is used to avoid underflow\n AsPrimitive::as_(x.as_() + 340282366920938463463374607431768211456 - y.as_())\n}\n#[deprecated(\"wrapping operations should be done with the Wrapping traits. E.g: x.wrapping_mul(y)\")]\npub fn wrapping_mul(x: T, y: T) -> T\nwhere\n T: AsPrimitive,\n Field: AsPrimitive,\n{\n AsPrimitive::as_(x.as_() * y.as_())\n}\n\n#[builtin(as_witness)]\npub fn as_witness(x: Field) {}\n\nmod tests {\n use super::ops::arith::WrappingMul;\n\n #[test(should_fail_with = \"custom message\")]\n fn test_static_assert_custom_message() {\n super::static_assert(1 == 2, \"custom message\");\n }\n\n #[test]\n fn test_wrapping_mul() {\n let zero: u128 = 0;\n let one: u128 = 1;\n let two_pow_64: u128 = 0x10000000000000000;\n let u128_max: u128 = 0xffffffffffffffffffffffffffffffff;\n\n // 1*0==0\n assert_eq(zero, zero.wrapping_mul(one));\n\n // 0*1==0\n assert_eq(zero, one.wrapping_mul(zero));\n\n // 1*1==1\n assert_eq(one, one.wrapping_mul(one));\n\n // 0 * ( 1 << 64 ) == 0\n assert_eq(zero, zero.wrapping_mul(two_pow_64));\n\n // ( 1 << 64 ) * 0 == 0\n assert_eq(zero, two_pow_64.wrapping_mul(zero));\n\n // 1 * ( 1 << 64 ) == 1 << 64\n assert_eq(two_pow_64, two_pow_64.wrapping_mul(one));\n\n // ( 1 << 64 ) * 1 == 1 << 64\n assert_eq(two_pow_64, one.wrapping_mul(two_pow_64));\n\n // ( 1 << 64 ) * ( 1 << 64 ) == 1 << 64\n assert_eq(zero, two_pow_64.wrapping_mul(two_pow_64));\n // -1 * -1 == 1\n assert_eq(one, u128_max.wrapping_mul(u128_max));\n }\n}\n", + "path": "std/lib.nr" + }, + "50": { + "source": "global G_A: [(bool, bool, str<4>); 3] =\n [(false, true, \"LZUT\"), (false, true, \"MFFA\"), (false, true, \"XPHT\")];\n\nfn main() -> pub Field {\n let mut a: ((str<4>, Field, str<4>, str<3>, bool), [&mut u8; 2]) = (\n (G_A[2].2, (unsafe { func_4() } as Field), G_A[1].2, \"TWC\", false), [(&mut 57), (&mut 219)],\n );\n for idx_d in 0..1 {\n // a.0 = a.0;\n }\n a.0 = (a.0.2, 0, a.0.0, a.0.3, ((128 % (*a.1[0])) == (*a.1[1])));\n 0\n}\n\nunconstrained fn func_4() -> bool {\n let mut a = G_A[1].2;\n println(a);\n true\n}\n", + "path": "" + } + }, + "names": [ + "main" + ], + "brillig_names": [ + "func_4" + ] +} diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/regression_8729/execute__tests__force_brillig_false_inliner_0.snap b/tooling/nargo_cli/tests/snapshots/execution_success/regression_8729/execute__tests__force_brillig_false_inliner_0.snap new file mode 100644 index 00000000000..557089d6617 --- /dev/null +++ b/tooling/nargo_cli/tests/snapshots/execution_success/regression_8729/execute__tests__force_brillig_false_inliner_0.snap @@ -0,0 +1,56 @@ +--- +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": { + "12049594436772143978": { + "error_kind": "string", + "string": "array ref-count underflow detected" + }, + "17843811134343075018": { + "error_kind": "string", + "string": "Stack too deep" + } + } + }, + "bytecode": [ + "func 0", + "current witness index : _1", + "private parameters indices : []", + "public parameters indices : []", + "return value indices : [_0]", + "BRILLIG CALL func 0: inputs: [], outputs: [Simple(Witness(1))]", + "BLACKBOX::RANGE [(_1, 1)] []", + "EXPR [ (1, _0) 0 ]", + "unconstrained func 0", + "[Const { destination: Direct(2), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(1), bit_size: Integer(U32), value: 32844 }, 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(32843), size_address: Relative(1), offset_address: Relative(2) }, Call { location: 12 }, Call { location: 31 }, Mov { destination: Direct(32843), source: Relative(1) }, Const { destination: Relative(2), bit_size: Integer(U32), value: 32843 }, 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(U1), value: 0 }, Const { destination: Direct(32836), bit_size: Integer(U1), value: 1 }, Const { destination: Direct(32837), bit_size: Integer(U8), value: 77 }, Const { destination: Direct(32838), bit_size: Integer(U8), value: 70 }, Const { destination: Direct(32839), bit_size: Integer(U8), value: 65 }, Mov { destination: Direct(32840), source: Direct(1) }, Const { destination: Direct(32841), bit_size: Integer(U32), value: 5 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Direct(32841) }, IndirectConst { destination_pointer: Direct(32840), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Direct(32841), op: Add, bit_size: U32, lhs: Direct(32840), rhs: Direct(2) }, Mov { destination: Direct(32842), source: Direct(32841) }, Store { destination_pointer: Direct(32842), source: Direct(32837) }, BinaryIntOp { destination: Direct(32842), op: Add, bit_size: U32, lhs: Direct(32842), rhs: Direct(2) }, Store { destination_pointer: Direct(32842), source: Direct(32838) }, BinaryIntOp { destination: Direct(32842), op: Add, bit_size: U32, lhs: Direct(32842), rhs: Direct(2) }, Store { destination_pointer: Direct(32842), source: Direct(32838) }, BinaryIntOp { destination: Direct(32842), op: Add, bit_size: U32, lhs: Direct(32842), rhs: Direct(2) }, Store { destination_pointer: Direct(32842), source: Direct(32839) }, Return, Call { location: 123 }, Load { destination: Relative(1), source_pointer: Direct(32840) }, Const { destination: Relative(2), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(3), op: Equals, bit_size: U32, lhs: Relative(2), rhs: Relative(1) }, Not { destination: Relative(3), source: Relative(3), bit_size: U1 }, JumpIf { condition: Relative(3), location: 38 }, Call { location: 129 }, BinaryIntOp { destination: Relative(1), op: Add, bit_size: U32, lhs: Relative(1), rhs: Direct(2) }, Store { destination_pointer: Direct(32840), source: Relative(1) }, Const { destination: Relative(1), bit_size: Integer(U8), value: 123 }, Const { destination: Relative(3), bit_size: Integer(U8), value: 34 }, Const { destination: Relative(4), bit_size: Integer(U8), value: 107 }, Const { destination: Relative(5), bit_size: Integer(U8), value: 105 }, Const { destination: Relative(6), bit_size: Integer(U8), value: 110 }, Const { destination: Relative(7), bit_size: Integer(U8), value: 100 }, Const { destination: Relative(8), bit_size: Integer(U8), value: 58 }, Const { destination: Relative(9), bit_size: Integer(U8), value: 115 }, Const { destination: Relative(10), bit_size: Integer(U8), value: 116 }, Const { destination: Relative(11), bit_size: Integer(U8), value: 114 }, Const { destination: Relative(12), bit_size: Integer(U8), value: 103 }, Const { destination: Relative(13), bit_size: Integer(U8), value: 44 }, Const { destination: Relative(14), bit_size: Integer(U8), value: 108 }, Const { destination: Relative(15), bit_size: Integer(U8), value: 101 }, Const { destination: Relative(16), bit_size: Integer(U8), value: 104 }, Const { destination: Relative(17), bit_size: Integer(U8), value: 52 }, Const { destination: Relative(18), bit_size: Integer(U8), value: 125 }, Mov { destination: Relative(19), source: Direct(1) }, Const { destination: Relative(20), bit_size: Integer(U32), value: 29 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(20) }, IndirectConst { destination_pointer: Relative(19), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(20), op: Add, bit_size: U32, lhs: Relative(19), rhs: Direct(2) }, Mov { destination: Relative(21), source: Relative(20) }, Store { destination_pointer: Relative(21), source: Relative(1) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(3) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(4) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(5) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(6) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(7) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(3) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(8) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(3) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(9) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(10) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(11) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(5) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(6) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(12) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(3) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(13) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(3) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(14) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(15) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(6) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(12) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(10) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(16) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(3) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(8) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(17) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(18) }, BinaryIntOp { destination: Relative(1), op: Add, bit_size: U32, lhs: Direct(32840), rhs: Direct(2) }, BinaryIntOp { destination: Relative(3), op: Add, bit_size: U32, lhs: Relative(19), rhs: Direct(2) }, ForeignCall { function: \"print\", destinations: [], destination_value_types: [], inputs: [MemoryAddress(Direct(32836)), HeapArray(HeapArray { pointer: Relative(1), size: 4 }), HeapArray(HeapArray { pointer: Relative(3), size: 28 }), MemoryAddress(Direct(32835))], input_value_types: [Simple(Integer(U1)), Array { value_types: [Simple(Integer(U8))], size: 4 }, Array { value_types: [Simple(Integer(U8))], size: 28 }, Simple(Integer(U1))] }, Mov { destination: Relative(1), source: Direct(32836) }, 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: 128 }, 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: 12049594436772143978 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return]" + ], + "debug_symbols": "tdTRSsMwFMbxd8l1L3qSniRnryJjdFuUQulGbQUZfXeTfqfqkIk33uxv7b4fuoXezDkd55dDNzxfXs3u6WaOY9f33cuhv5zaqbsM+bc3U5cXZ82OKuMc0iCMeCQgEZE1TV43OYRYxCENwohHAhIRWcNQGApDYSgMhaEwFIbCUBiKh+KheCgeiofioXgoHoqH4qEEKAFKgBKgBCgBSoASoAQoAUqEEqFEKBFKhBKhRCgRSoQSoQgUgSJQBIpAESgCRaAIFIFCda0lrdU6baNlrdcGbdSqR+qReqQeqUfqkXqkHqlH2eNSQW32eFkqs53LwzSmVI7lt4Oaj++1HdMwmd0w931l3tp+Xt/0em2HtVM75rt1ZdJwzs3gc9en8tNSfa3rx1OuWcdM9Dnnv+9Jtr2VR3v7eB+FdC/Wfe6tvdu7/9uHJug+xPrR/pf/3zZO95bvP799vmpP3fjj0ePz959fl4KOXXvsU7lTtvNw2t6YL6f363Zne4pdx8spnecxFfTrUVZO5xNZV5GN+3LK1kupyNF+KX/JBw==", + "file_map": { + "22": { + "source": "pub mod hash;\npub mod aes128;\npub mod array;\npub mod slice;\npub mod ecdsa_secp256k1;\npub mod ecdsa_secp256r1;\npub mod embedded_curve_ops;\npub mod field;\npub mod collections;\npub mod compat;\npub mod convert;\npub mod option;\npub mod string;\npub mod test;\npub mod cmp;\npub mod ops;\npub mod default;\npub mod prelude;\npub mod runtime;\npub mod meta;\npub mod append;\npub mod mem;\npub mod panic;\npub mod hint;\n\nuse convert::AsPrimitive;\n\n// Oracle calls are required to be wrapped in an unconstrained function\n// Thus, the only argument to the `println` oracle is expected to always be an ident\n#[oracle(print)]\nunconstrained fn print_oracle(with_newline: bool, input: T) {}\n\nunconstrained fn print_unconstrained(with_newline: bool, input: T) {\n print_oracle(with_newline, input);\n}\n\npub fn println(input: T) {\n // Safety: a print statement cannot be constrained\n unsafe {\n print_unconstrained(true, input);\n }\n}\n\npub fn print(input: T) {\n // Safety: a print statement cannot be constrained\n unsafe {\n print_unconstrained(false, input);\n }\n}\n\npub fn verify_proof(\n verification_key: [Field; N],\n proof: [Field; M],\n public_inputs: [Field; K],\n key_hash: Field,\n) {\n verify_proof_internal(verification_key, proof, public_inputs, key_hash, 0);\n}\n\npub fn verify_proof_with_type(\n verification_key: [Field; N],\n proof: [Field; M],\n public_inputs: [Field; K],\n key_hash: Field,\n proof_type: u32,\n) {\n if !crate::runtime::is_unconstrained() {\n crate::assert_constant(proof_type);\n }\n verify_proof_internal(verification_key, proof, public_inputs, key_hash, proof_type);\n}\n\n#[foreign(recursive_aggregation)]\nfn verify_proof_internal(\n verification_key: [Field; N],\n proof: [Field; M],\n public_inputs: [Field; K],\n key_hash: Field,\n proof_type: u32,\n) {}\n\n// Asserts that the given value is known at compile-time.\n// Useful for debugging for-loop bounds.\n#[builtin(assert_constant)]\npub fn assert_constant(x: T) {}\n\n// Asserts that the given value is both true and known at compile-time.\n// The message can be a string, a format string, or any value, as long as it is known at compile-time\n#[builtin(static_assert)]\npub fn static_assert(predicate: bool, message: T) {}\n\n#[deprecated(\"wrapping operations should be done with the Wrapping traits. E.g: x.wrapping_add(y)\")]\npub fn wrapping_add(x: T, y: T) -> T\nwhere\n T: AsPrimitive,\n Field: AsPrimitive,\n{\n AsPrimitive::as_(x.as_() + y.as_())\n}\n#[deprecated(\"wrapping operations should be done with the Wrapping traits. E.g: x.wrapping_sub(y)\")]\npub fn wrapping_sub(x: T, y: T) -> T\nwhere\n T: AsPrimitive,\n Field: AsPrimitive,\n{\n //340282366920938463463374607431768211456 is 2^128, it is used to avoid underflow\n AsPrimitive::as_(x.as_() + 340282366920938463463374607431768211456 - y.as_())\n}\n#[deprecated(\"wrapping operations should be done with the Wrapping traits. E.g: x.wrapping_mul(y)\")]\npub fn wrapping_mul(x: T, y: T) -> T\nwhere\n T: AsPrimitive,\n Field: AsPrimitive,\n{\n AsPrimitive::as_(x.as_() * y.as_())\n}\n\n#[builtin(as_witness)]\npub fn as_witness(x: Field) {}\n\nmod tests {\n use super::ops::arith::WrappingMul;\n\n #[test(should_fail_with = \"custom message\")]\n fn test_static_assert_custom_message() {\n super::static_assert(1 == 2, \"custom message\");\n }\n\n #[test]\n fn test_wrapping_mul() {\n let zero: u128 = 0;\n let one: u128 = 1;\n let two_pow_64: u128 = 0x10000000000000000;\n let u128_max: u128 = 0xffffffffffffffffffffffffffffffff;\n\n // 1*0==0\n assert_eq(zero, zero.wrapping_mul(one));\n\n // 0*1==0\n assert_eq(zero, one.wrapping_mul(zero));\n\n // 1*1==1\n assert_eq(one, one.wrapping_mul(one));\n\n // 0 * ( 1 << 64 ) == 0\n assert_eq(zero, zero.wrapping_mul(two_pow_64));\n\n // ( 1 << 64 ) * 0 == 0\n assert_eq(zero, two_pow_64.wrapping_mul(zero));\n\n // 1 * ( 1 << 64 ) == 1 << 64\n assert_eq(two_pow_64, two_pow_64.wrapping_mul(one));\n\n // ( 1 << 64 ) * 1 == 1 << 64\n assert_eq(two_pow_64, one.wrapping_mul(two_pow_64));\n\n // ( 1 << 64 ) * ( 1 << 64 ) == 1 << 64\n assert_eq(zero, two_pow_64.wrapping_mul(two_pow_64));\n // -1 * -1 == 1\n assert_eq(one, u128_max.wrapping_mul(u128_max));\n }\n}\n", + "path": "std/lib.nr" + }, + "50": { + "source": "global G_A: [(bool, bool, str<4>); 3] =\n [(false, true, \"LZUT\"), (false, true, \"MFFA\"), (false, true, \"XPHT\")];\n\nfn main() -> pub Field {\n let mut a: ((str<4>, Field, str<4>, str<3>, bool), [&mut u8; 2]) = (\n (G_A[2].2, (unsafe { func_4() } as Field), G_A[1].2, \"TWC\", false), [(&mut 57), (&mut 219)],\n );\n for idx_d in 0..1 {\n // a.0 = a.0;\n }\n a.0 = (a.0.2, 0, a.0.0, a.0.3, ((128 % (*a.1[0])) == (*a.1[1])));\n 0\n}\n\nunconstrained fn func_4() -> bool {\n let mut a = G_A[1].2;\n println(a);\n true\n}\n", + "path": "" + } + }, + "names": [ + "main" + ], + "brillig_names": [ + "func_4" + ] +} diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/regression_8729/execute__tests__force_brillig_false_inliner_9223372036854775807.snap b/tooling/nargo_cli/tests/snapshots/execution_success/regression_8729/execute__tests__force_brillig_false_inliner_9223372036854775807.snap new file mode 100644 index 00000000000..557089d6617 --- /dev/null +++ b/tooling/nargo_cli/tests/snapshots/execution_success/regression_8729/execute__tests__force_brillig_false_inliner_9223372036854775807.snap @@ -0,0 +1,56 @@ +--- +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": { + "12049594436772143978": { + "error_kind": "string", + "string": "array ref-count underflow detected" + }, + "17843811134343075018": { + "error_kind": "string", + "string": "Stack too deep" + } + } + }, + "bytecode": [ + "func 0", + "current witness index : _1", + "private parameters indices : []", + "public parameters indices : []", + "return value indices : [_0]", + "BRILLIG CALL func 0: inputs: [], outputs: [Simple(Witness(1))]", + "BLACKBOX::RANGE [(_1, 1)] []", + "EXPR [ (1, _0) 0 ]", + "unconstrained func 0", + "[Const { destination: Direct(2), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(1), bit_size: Integer(U32), value: 32844 }, 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(32843), size_address: Relative(1), offset_address: Relative(2) }, Call { location: 12 }, Call { location: 31 }, Mov { destination: Direct(32843), source: Relative(1) }, Const { destination: Relative(2), bit_size: Integer(U32), value: 32843 }, 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(U1), value: 0 }, Const { destination: Direct(32836), bit_size: Integer(U1), value: 1 }, Const { destination: Direct(32837), bit_size: Integer(U8), value: 77 }, Const { destination: Direct(32838), bit_size: Integer(U8), value: 70 }, Const { destination: Direct(32839), bit_size: Integer(U8), value: 65 }, Mov { destination: Direct(32840), source: Direct(1) }, Const { destination: Direct(32841), bit_size: Integer(U32), value: 5 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Direct(32841) }, IndirectConst { destination_pointer: Direct(32840), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Direct(32841), op: Add, bit_size: U32, lhs: Direct(32840), rhs: Direct(2) }, Mov { destination: Direct(32842), source: Direct(32841) }, Store { destination_pointer: Direct(32842), source: Direct(32837) }, BinaryIntOp { destination: Direct(32842), op: Add, bit_size: U32, lhs: Direct(32842), rhs: Direct(2) }, Store { destination_pointer: Direct(32842), source: Direct(32838) }, BinaryIntOp { destination: Direct(32842), op: Add, bit_size: U32, lhs: Direct(32842), rhs: Direct(2) }, Store { destination_pointer: Direct(32842), source: Direct(32838) }, BinaryIntOp { destination: Direct(32842), op: Add, bit_size: U32, lhs: Direct(32842), rhs: Direct(2) }, Store { destination_pointer: Direct(32842), source: Direct(32839) }, Return, Call { location: 123 }, Load { destination: Relative(1), source_pointer: Direct(32840) }, Const { destination: Relative(2), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(3), op: Equals, bit_size: U32, lhs: Relative(2), rhs: Relative(1) }, Not { destination: Relative(3), source: Relative(3), bit_size: U1 }, JumpIf { condition: Relative(3), location: 38 }, Call { location: 129 }, BinaryIntOp { destination: Relative(1), op: Add, bit_size: U32, lhs: Relative(1), rhs: Direct(2) }, Store { destination_pointer: Direct(32840), source: Relative(1) }, Const { destination: Relative(1), bit_size: Integer(U8), value: 123 }, Const { destination: Relative(3), bit_size: Integer(U8), value: 34 }, Const { destination: Relative(4), bit_size: Integer(U8), value: 107 }, Const { destination: Relative(5), bit_size: Integer(U8), value: 105 }, Const { destination: Relative(6), bit_size: Integer(U8), value: 110 }, Const { destination: Relative(7), bit_size: Integer(U8), value: 100 }, Const { destination: Relative(8), bit_size: Integer(U8), value: 58 }, Const { destination: Relative(9), bit_size: Integer(U8), value: 115 }, Const { destination: Relative(10), bit_size: Integer(U8), value: 116 }, Const { destination: Relative(11), bit_size: Integer(U8), value: 114 }, Const { destination: Relative(12), bit_size: Integer(U8), value: 103 }, Const { destination: Relative(13), bit_size: Integer(U8), value: 44 }, Const { destination: Relative(14), bit_size: Integer(U8), value: 108 }, Const { destination: Relative(15), bit_size: Integer(U8), value: 101 }, Const { destination: Relative(16), bit_size: Integer(U8), value: 104 }, Const { destination: Relative(17), bit_size: Integer(U8), value: 52 }, Const { destination: Relative(18), bit_size: Integer(U8), value: 125 }, Mov { destination: Relative(19), source: Direct(1) }, Const { destination: Relative(20), bit_size: Integer(U32), value: 29 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(20) }, IndirectConst { destination_pointer: Relative(19), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(20), op: Add, bit_size: U32, lhs: Relative(19), rhs: Direct(2) }, Mov { destination: Relative(21), source: Relative(20) }, Store { destination_pointer: Relative(21), source: Relative(1) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(3) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(4) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(5) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(6) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(7) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(3) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(8) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(3) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(9) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(10) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(11) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(5) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(6) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(12) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(3) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(13) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(3) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(14) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(15) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(6) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(12) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(10) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(16) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(3) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(8) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(17) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(18) }, BinaryIntOp { destination: Relative(1), op: Add, bit_size: U32, lhs: Direct(32840), rhs: Direct(2) }, BinaryIntOp { destination: Relative(3), op: Add, bit_size: U32, lhs: Relative(19), rhs: Direct(2) }, ForeignCall { function: \"print\", destinations: [], destination_value_types: [], inputs: [MemoryAddress(Direct(32836)), HeapArray(HeapArray { pointer: Relative(1), size: 4 }), HeapArray(HeapArray { pointer: Relative(3), size: 28 }), MemoryAddress(Direct(32835))], input_value_types: [Simple(Integer(U1)), Array { value_types: [Simple(Integer(U8))], size: 4 }, Array { value_types: [Simple(Integer(U8))], size: 28 }, Simple(Integer(U1))] }, Mov { destination: Relative(1), source: Direct(32836) }, 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: 128 }, 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: 12049594436772143978 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return]" + ], + "debug_symbols": "tdTRSsMwFMbxd8l1L3qSniRnryJjdFuUQulGbQUZfXeTfqfqkIk33uxv7b4fuoXezDkd55dDNzxfXs3u6WaOY9f33cuhv5zaqbsM+bc3U5cXZ82OKuMc0iCMeCQgEZE1TV43OYRYxCENwohHAhIRWcNQGApDYSgMhaEwFIbCUBiKh+KheCgeiofioXgoHoqH4qEEKAFKgBKgBCgBSoASoAQoAUqEEqFEKBFKhBKhRCgRSoQSoQgUgSJQBIpAESgCRaAIFIFCda0lrdU6baNlrdcGbdSqR+qReqQeqUfqkXqkHqlH2eNSQW32eFkqs53LwzSmVI7lt4Oaj++1HdMwmd0w931l3tp+Xt/0em2HtVM75rt1ZdJwzs3gc9en8tNSfa3rx1OuWcdM9Dnnv+9Jtr2VR3v7eB+FdC/Wfe6tvdu7/9uHJug+xPrR/pf/3zZO95bvP799vmpP3fjj0ePz959fl4KOXXvsU7lTtvNw2t6YL6f363Zne4pdx8spnecxFfTrUVZO5xNZV5GN+3LK1kupyNF+KX/JBw==", + "file_map": { + "22": { + "source": "pub mod hash;\npub mod aes128;\npub mod array;\npub mod slice;\npub mod ecdsa_secp256k1;\npub mod ecdsa_secp256r1;\npub mod embedded_curve_ops;\npub mod field;\npub mod collections;\npub mod compat;\npub mod convert;\npub mod option;\npub mod string;\npub mod test;\npub mod cmp;\npub mod ops;\npub mod default;\npub mod prelude;\npub mod runtime;\npub mod meta;\npub mod append;\npub mod mem;\npub mod panic;\npub mod hint;\n\nuse convert::AsPrimitive;\n\n// Oracle calls are required to be wrapped in an unconstrained function\n// Thus, the only argument to the `println` oracle is expected to always be an ident\n#[oracle(print)]\nunconstrained fn print_oracle(with_newline: bool, input: T) {}\n\nunconstrained fn print_unconstrained(with_newline: bool, input: T) {\n print_oracle(with_newline, input);\n}\n\npub fn println(input: T) {\n // Safety: a print statement cannot be constrained\n unsafe {\n print_unconstrained(true, input);\n }\n}\n\npub fn print(input: T) {\n // Safety: a print statement cannot be constrained\n unsafe {\n print_unconstrained(false, input);\n }\n}\n\npub fn verify_proof(\n verification_key: [Field; N],\n proof: [Field; M],\n public_inputs: [Field; K],\n key_hash: Field,\n) {\n verify_proof_internal(verification_key, proof, public_inputs, key_hash, 0);\n}\n\npub fn verify_proof_with_type(\n verification_key: [Field; N],\n proof: [Field; M],\n public_inputs: [Field; K],\n key_hash: Field,\n proof_type: u32,\n) {\n if !crate::runtime::is_unconstrained() {\n crate::assert_constant(proof_type);\n }\n verify_proof_internal(verification_key, proof, public_inputs, key_hash, proof_type);\n}\n\n#[foreign(recursive_aggregation)]\nfn verify_proof_internal(\n verification_key: [Field; N],\n proof: [Field; M],\n public_inputs: [Field; K],\n key_hash: Field,\n proof_type: u32,\n) {}\n\n// Asserts that the given value is known at compile-time.\n// Useful for debugging for-loop bounds.\n#[builtin(assert_constant)]\npub fn assert_constant(x: T) {}\n\n// Asserts that the given value is both true and known at compile-time.\n// The message can be a string, a format string, or any value, as long as it is known at compile-time\n#[builtin(static_assert)]\npub fn static_assert(predicate: bool, message: T) {}\n\n#[deprecated(\"wrapping operations should be done with the Wrapping traits. E.g: x.wrapping_add(y)\")]\npub fn wrapping_add(x: T, y: T) -> T\nwhere\n T: AsPrimitive,\n Field: AsPrimitive,\n{\n AsPrimitive::as_(x.as_() + y.as_())\n}\n#[deprecated(\"wrapping operations should be done with the Wrapping traits. E.g: x.wrapping_sub(y)\")]\npub fn wrapping_sub(x: T, y: T) -> T\nwhere\n T: AsPrimitive,\n Field: AsPrimitive,\n{\n //340282366920938463463374607431768211456 is 2^128, it is used to avoid underflow\n AsPrimitive::as_(x.as_() + 340282366920938463463374607431768211456 - y.as_())\n}\n#[deprecated(\"wrapping operations should be done with the Wrapping traits. E.g: x.wrapping_mul(y)\")]\npub fn wrapping_mul(x: T, y: T) -> T\nwhere\n T: AsPrimitive,\n Field: AsPrimitive,\n{\n AsPrimitive::as_(x.as_() * y.as_())\n}\n\n#[builtin(as_witness)]\npub fn as_witness(x: Field) {}\n\nmod tests {\n use super::ops::arith::WrappingMul;\n\n #[test(should_fail_with = \"custom message\")]\n fn test_static_assert_custom_message() {\n super::static_assert(1 == 2, \"custom message\");\n }\n\n #[test]\n fn test_wrapping_mul() {\n let zero: u128 = 0;\n let one: u128 = 1;\n let two_pow_64: u128 = 0x10000000000000000;\n let u128_max: u128 = 0xffffffffffffffffffffffffffffffff;\n\n // 1*0==0\n assert_eq(zero, zero.wrapping_mul(one));\n\n // 0*1==0\n assert_eq(zero, one.wrapping_mul(zero));\n\n // 1*1==1\n assert_eq(one, one.wrapping_mul(one));\n\n // 0 * ( 1 << 64 ) == 0\n assert_eq(zero, zero.wrapping_mul(two_pow_64));\n\n // ( 1 << 64 ) * 0 == 0\n assert_eq(zero, two_pow_64.wrapping_mul(zero));\n\n // 1 * ( 1 << 64 ) == 1 << 64\n assert_eq(two_pow_64, two_pow_64.wrapping_mul(one));\n\n // ( 1 << 64 ) * 1 == 1 << 64\n assert_eq(two_pow_64, one.wrapping_mul(two_pow_64));\n\n // ( 1 << 64 ) * ( 1 << 64 ) == 1 << 64\n assert_eq(zero, two_pow_64.wrapping_mul(two_pow_64));\n // -1 * -1 == 1\n assert_eq(one, u128_max.wrapping_mul(u128_max));\n }\n}\n", + "path": "std/lib.nr" + }, + "50": { + "source": "global G_A: [(bool, bool, str<4>); 3] =\n [(false, true, \"LZUT\"), (false, true, \"MFFA\"), (false, true, \"XPHT\")];\n\nfn main() -> pub Field {\n let mut a: ((str<4>, Field, str<4>, str<3>, bool), [&mut u8; 2]) = (\n (G_A[2].2, (unsafe { func_4() } as Field), G_A[1].2, \"TWC\", false), [(&mut 57), (&mut 219)],\n );\n for idx_d in 0..1 {\n // a.0 = a.0;\n }\n a.0 = (a.0.2, 0, a.0.0, a.0.3, ((128 % (*a.1[0])) == (*a.1[1])));\n 0\n}\n\nunconstrained fn func_4() -> bool {\n let mut a = G_A[1].2;\n println(a);\n true\n}\n", + "path": "" + } + }, + "names": [ + "main" + ], + "brillig_names": [ + "func_4" + ] +} diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/regression_8729/execute__tests__force_brillig_true_inliner_-9223372036854775808.snap b/tooling/nargo_cli/tests/snapshots/execution_success/regression_8729/execute__tests__force_brillig_true_inliner_-9223372036854775808.snap new file mode 100644 index 00000000000..e06f94b449a --- /dev/null +++ b/tooling/nargo_cli/tests/snapshots/execution_success/regression_8729/execute__tests__force_brillig_true_inliner_-9223372036854775808.snap @@ -0,0 +1,54 @@ +--- +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": { + "12049594436772143978": { + "error_kind": "string", + "string": "array ref-count underflow detected" + }, + "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: 32844 }, 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(32843), size_address: Relative(1), offset_address: Relative(2) }, Call { location: 12 }, Call { location: 31 }, Mov { destination: Direct(32843), source: Relative(1) }, Const { destination: Relative(2), bit_size: Integer(U32), value: 32843 }, 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(U1), value: 0 }, Const { destination: Direct(32836), bit_size: Integer(U1), value: 1 }, Const { destination: Direct(32837), bit_size: Integer(U8), value: 77 }, Const { destination: Direct(32838), bit_size: Integer(U8), value: 70 }, Const { destination: Direct(32839), bit_size: Integer(U8), value: 65 }, Mov { destination: Direct(32840), source: Direct(1) }, Const { destination: Direct(32841), bit_size: Integer(U32), value: 5 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Direct(32841) }, IndirectConst { destination_pointer: Direct(32840), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Direct(32841), op: Add, bit_size: U32, lhs: Direct(32840), rhs: Direct(2) }, Mov { destination: Direct(32842), source: Direct(32841) }, Store { destination_pointer: Direct(32842), source: Direct(32837) }, BinaryIntOp { destination: Direct(32842), op: Add, bit_size: U32, lhs: Direct(32842), rhs: Direct(2) }, Store { destination_pointer: Direct(32842), source: Direct(32838) }, BinaryIntOp { destination: Direct(32842), op: Add, bit_size: U32, lhs: Direct(32842), rhs: Direct(2) }, Store { destination_pointer: Direct(32842), source: Direct(32838) }, BinaryIntOp { destination: Direct(32842), op: Add, bit_size: U32, lhs: Direct(32842), rhs: Direct(2) }, Store { destination_pointer: Direct(32842), source: Direct(32839) }, Return, Call { location: 131 }, Load { destination: Relative(1), source_pointer: Direct(32840) }, Const { destination: Relative(2), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(3), op: Equals, bit_size: U32, lhs: Relative(2), rhs: Relative(1) }, Not { destination: Relative(3), source: Relative(3), bit_size: U1 }, JumpIf { condition: Relative(3), location: 38 }, Call { location: 137 }, BinaryIntOp { destination: Relative(1), op: Add, bit_size: U32, lhs: Relative(1), rhs: Direct(2) }, Store { destination_pointer: Direct(32840), source: Relative(1) }, Const { destination: Relative(1), bit_size: Integer(U8), value: 123 }, Const { destination: Relative(3), bit_size: Integer(U8), value: 34 }, Const { destination: Relative(4), bit_size: Integer(U8), value: 107 }, Const { destination: Relative(5), bit_size: Integer(U8), value: 105 }, Const { destination: Relative(6), bit_size: Integer(U8), value: 110 }, Const { destination: Relative(7), bit_size: Integer(U8), value: 100 }, Const { destination: Relative(8), bit_size: Integer(U8), value: 58 }, Const { destination: Relative(9), bit_size: Integer(U8), value: 115 }, Const { destination: Relative(10), bit_size: Integer(U8), value: 116 }, Const { destination: Relative(11), bit_size: Integer(U8), value: 114 }, Const { destination: Relative(12), bit_size: Integer(U8), value: 103 }, Const { destination: Relative(13), bit_size: Integer(U8), value: 44 }, Const { destination: Relative(14), bit_size: Integer(U8), value: 108 }, Const { destination: Relative(15), bit_size: Integer(U8), value: 101 }, Const { destination: Relative(16), bit_size: Integer(U8), value: 104 }, Const { destination: Relative(17), bit_size: Integer(U8), value: 52 }, Const { destination: Relative(18), bit_size: Integer(U8), value: 125 }, Mov { destination: Relative(19), source: Direct(1) }, Const { destination: Relative(20), bit_size: Integer(U32), value: 29 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(20) }, IndirectConst { destination_pointer: Relative(19), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(20), op: Add, bit_size: U32, lhs: Relative(19), rhs: Direct(2) }, Mov { destination: Relative(21), source: Relative(20) }, Store { destination_pointer: Relative(21), source: Relative(1) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(3) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(4) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(5) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(6) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(7) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(3) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(8) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(3) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(9) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(10) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(11) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(5) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(6) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(12) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(3) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(13) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(3) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(14) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(15) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(6) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(12) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(10) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(16) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(3) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(8) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(17) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(18) }, BinaryIntOp { destination: Relative(1), op: Add, bit_size: U32, lhs: Direct(32840), rhs: Direct(2) }, BinaryIntOp { destination: Relative(3), op: Add, bit_size: U32, lhs: Relative(19), rhs: Direct(2) }, ForeignCall { function: \"print\", destinations: [], destination_value_types: [], inputs: [MemoryAddress(Direct(32836)), HeapArray(HeapArray { pointer: Relative(1), size: 4 }), HeapArray(HeapArray { pointer: Relative(3), size: 28 }), MemoryAddress(Direct(32835))], input_value_types: [Simple(Integer(U1)), Array { value_types: [Simple(Integer(U8))], size: 4 }, Array { value_types: [Simple(Integer(U8))], size: 28 }, Simple(Integer(U1))] }, Load { destination: Relative(1), source_pointer: Direct(32840) }, Const { destination: Relative(3), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(4), op: Equals, bit_size: U32, lhs: Relative(3), rhs: Relative(1) }, Not { destination: Relative(4), source: Relative(4), bit_size: U1 }, JumpIf { condition: Relative(4), location: 127 }, Call { location: 137 }, BinaryIntOp { destination: Relative(1), op: Add, bit_size: U32, lhs: Relative(1), rhs: Direct(2) }, Store { destination_pointer: Direct(32840), source: Relative(1) }, Const { destination: Relative(1), bit_size: Field, value: 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: 136 }, 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: 12049594436772143978 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return]" + ], + "debug_symbols": "tdRBTsMwEIXhu3idRcb2eOxeBVVV2qYoUpRWIUFCVe6OnTcFuggLJDb8hPC+qpWbuzm3x/n10A2X65vZvdzNcez6vns99NdTM3XXIf/1buryw1mzs5VxDvEIIwERJCJpjc9rziHEIg7xCCMBESQiaQ1DYSgMhaEwFIbCUBgKQ2EoAUqAEqAEKAFKgBKgBCgBSoAiUASKQBEoAkWgCBSBIlAESoQSoUQoEUqEEqFEKBFKhBKhJCgJSoKSoCQoCUqCkqAkKAkK1bWWtFbrtF7L2qAVbdSqR+qReqQeqUfqkXqkHqlH2QulCbW1NntSarVO67WsDVrRZk+WpTKPc32YxrYtx/rHQc/H/9aM7TCZ3TD3fWXem35e/+nt1gxrp2bMd+vKtMM5N4OXrm/Lb0v1va63p9Y7HVumrzk/72l7zzXrnulPe0qPvU1be7e9j4l0n6z72lv7tPf/txcvupdYb+1/+fydt7p33j29/32+ak7d+PToW4o0ds2xb/XyMg+nH3enj9vjzuPReRuvp/Y8j22Rvp+f5SvxQo4qcmFfjvZ6Kfky7Zfy8p8=", + "file_map": { + "22": { + "source": "pub mod hash;\npub mod aes128;\npub mod array;\npub mod slice;\npub mod ecdsa_secp256k1;\npub mod ecdsa_secp256r1;\npub mod embedded_curve_ops;\npub mod field;\npub mod collections;\npub mod compat;\npub mod convert;\npub mod option;\npub mod string;\npub mod test;\npub mod cmp;\npub mod ops;\npub mod default;\npub mod prelude;\npub mod runtime;\npub mod meta;\npub mod append;\npub mod mem;\npub mod panic;\npub mod hint;\n\nuse convert::AsPrimitive;\n\n// Oracle calls are required to be wrapped in an unconstrained function\n// Thus, the only argument to the `println` oracle is expected to always be an ident\n#[oracle(print)]\nunconstrained fn print_oracle(with_newline: bool, input: T) {}\n\nunconstrained fn print_unconstrained(with_newline: bool, input: T) {\n print_oracle(with_newline, input);\n}\n\npub fn println(input: T) {\n // Safety: a print statement cannot be constrained\n unsafe {\n print_unconstrained(true, input);\n }\n}\n\npub fn print(input: T) {\n // Safety: a print statement cannot be constrained\n unsafe {\n print_unconstrained(false, input);\n }\n}\n\npub fn verify_proof(\n verification_key: [Field; N],\n proof: [Field; M],\n public_inputs: [Field; K],\n key_hash: Field,\n) {\n verify_proof_internal(verification_key, proof, public_inputs, key_hash, 0);\n}\n\npub fn verify_proof_with_type(\n verification_key: [Field; N],\n proof: [Field; M],\n public_inputs: [Field; K],\n key_hash: Field,\n proof_type: u32,\n) {\n if !crate::runtime::is_unconstrained() {\n crate::assert_constant(proof_type);\n }\n verify_proof_internal(verification_key, proof, public_inputs, key_hash, proof_type);\n}\n\n#[foreign(recursive_aggregation)]\nfn verify_proof_internal(\n verification_key: [Field; N],\n proof: [Field; M],\n public_inputs: [Field; K],\n key_hash: Field,\n proof_type: u32,\n) {}\n\n// Asserts that the given value is known at compile-time.\n// Useful for debugging for-loop bounds.\n#[builtin(assert_constant)]\npub fn assert_constant(x: T) {}\n\n// Asserts that the given value is both true and known at compile-time.\n// The message can be a string, a format string, or any value, as long as it is known at compile-time\n#[builtin(static_assert)]\npub fn static_assert(predicate: bool, message: T) {}\n\n#[deprecated(\"wrapping operations should be done with the Wrapping traits. E.g: x.wrapping_add(y)\")]\npub fn wrapping_add(x: T, y: T) -> T\nwhere\n T: AsPrimitive,\n Field: AsPrimitive,\n{\n AsPrimitive::as_(x.as_() + y.as_())\n}\n#[deprecated(\"wrapping operations should be done with the Wrapping traits. E.g: x.wrapping_sub(y)\")]\npub fn wrapping_sub(x: T, y: T) -> T\nwhere\n T: AsPrimitive,\n Field: AsPrimitive,\n{\n //340282366920938463463374607431768211456 is 2^128, it is used to avoid underflow\n AsPrimitive::as_(x.as_() + 340282366920938463463374607431768211456 - y.as_())\n}\n#[deprecated(\"wrapping operations should be done with the Wrapping traits. E.g: x.wrapping_mul(y)\")]\npub fn wrapping_mul(x: T, y: T) -> T\nwhere\n T: AsPrimitive,\n Field: AsPrimitive,\n{\n AsPrimitive::as_(x.as_() * y.as_())\n}\n\n#[builtin(as_witness)]\npub fn as_witness(x: Field) {}\n\nmod tests {\n use super::ops::arith::WrappingMul;\n\n #[test(should_fail_with = \"custom message\")]\n fn test_static_assert_custom_message() {\n super::static_assert(1 == 2, \"custom message\");\n }\n\n #[test]\n fn test_wrapping_mul() {\n let zero: u128 = 0;\n let one: u128 = 1;\n let two_pow_64: u128 = 0x10000000000000000;\n let u128_max: u128 = 0xffffffffffffffffffffffffffffffff;\n\n // 1*0==0\n assert_eq(zero, zero.wrapping_mul(one));\n\n // 0*1==0\n assert_eq(zero, one.wrapping_mul(zero));\n\n // 1*1==1\n assert_eq(one, one.wrapping_mul(one));\n\n // 0 * ( 1 << 64 ) == 0\n assert_eq(zero, zero.wrapping_mul(two_pow_64));\n\n // ( 1 << 64 ) * 0 == 0\n assert_eq(zero, two_pow_64.wrapping_mul(zero));\n\n // 1 * ( 1 << 64 ) == 1 << 64\n assert_eq(two_pow_64, two_pow_64.wrapping_mul(one));\n\n // ( 1 << 64 ) * 1 == 1 << 64\n assert_eq(two_pow_64, one.wrapping_mul(two_pow_64));\n\n // ( 1 << 64 ) * ( 1 << 64 ) == 1 << 64\n assert_eq(zero, two_pow_64.wrapping_mul(two_pow_64));\n // -1 * -1 == 1\n assert_eq(one, u128_max.wrapping_mul(u128_max));\n }\n}\n", + "path": "std/lib.nr" + }, + "50": { + "source": "global G_A: [(bool, bool, str<4>); 3] =\n [(false, true, \"LZUT\"), (false, true, \"MFFA\"), (false, true, \"XPHT\")];\n\nfn main() -> pub Field {\n let mut a: ((str<4>, Field, str<4>, str<3>, bool), [&mut u8; 2]) = (\n (G_A[2].2, (unsafe { func_4() } as Field), G_A[1].2, \"TWC\", false), [(&mut 57), (&mut 219)],\n );\n for idx_d in 0..1 {\n // a.0 = a.0;\n }\n a.0 = (a.0.2, 0, a.0.0, a.0.3, ((128 % (*a.1[0])) == (*a.1[1])));\n 0\n}\n\nunconstrained fn func_4() -> bool {\n let mut a = G_A[1].2;\n println(a);\n true\n}\n", + "path": "" + } + }, + "names": [ + "main" + ], + "brillig_names": [ + "main" + ] +} diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/regression_8729/execute__tests__force_brillig_true_inliner_0.snap b/tooling/nargo_cli/tests/snapshots/execution_success/regression_8729/execute__tests__force_brillig_true_inliner_0.snap new file mode 100644 index 00000000000..e06f94b449a --- /dev/null +++ b/tooling/nargo_cli/tests/snapshots/execution_success/regression_8729/execute__tests__force_brillig_true_inliner_0.snap @@ -0,0 +1,54 @@ +--- +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": { + "12049594436772143978": { + "error_kind": "string", + "string": "array ref-count underflow detected" + }, + "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: 32844 }, 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(32843), size_address: Relative(1), offset_address: Relative(2) }, Call { location: 12 }, Call { location: 31 }, Mov { destination: Direct(32843), source: Relative(1) }, Const { destination: Relative(2), bit_size: Integer(U32), value: 32843 }, 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(U1), value: 0 }, Const { destination: Direct(32836), bit_size: Integer(U1), value: 1 }, Const { destination: Direct(32837), bit_size: Integer(U8), value: 77 }, Const { destination: Direct(32838), bit_size: Integer(U8), value: 70 }, Const { destination: Direct(32839), bit_size: Integer(U8), value: 65 }, Mov { destination: Direct(32840), source: Direct(1) }, Const { destination: Direct(32841), bit_size: Integer(U32), value: 5 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Direct(32841) }, IndirectConst { destination_pointer: Direct(32840), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Direct(32841), op: Add, bit_size: U32, lhs: Direct(32840), rhs: Direct(2) }, Mov { destination: Direct(32842), source: Direct(32841) }, Store { destination_pointer: Direct(32842), source: Direct(32837) }, BinaryIntOp { destination: Direct(32842), op: Add, bit_size: U32, lhs: Direct(32842), rhs: Direct(2) }, Store { destination_pointer: Direct(32842), source: Direct(32838) }, BinaryIntOp { destination: Direct(32842), op: Add, bit_size: U32, lhs: Direct(32842), rhs: Direct(2) }, Store { destination_pointer: Direct(32842), source: Direct(32838) }, BinaryIntOp { destination: Direct(32842), op: Add, bit_size: U32, lhs: Direct(32842), rhs: Direct(2) }, Store { destination_pointer: Direct(32842), source: Direct(32839) }, Return, Call { location: 131 }, Load { destination: Relative(1), source_pointer: Direct(32840) }, Const { destination: Relative(2), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(3), op: Equals, bit_size: U32, lhs: Relative(2), rhs: Relative(1) }, Not { destination: Relative(3), source: Relative(3), bit_size: U1 }, JumpIf { condition: Relative(3), location: 38 }, Call { location: 137 }, BinaryIntOp { destination: Relative(1), op: Add, bit_size: U32, lhs: Relative(1), rhs: Direct(2) }, Store { destination_pointer: Direct(32840), source: Relative(1) }, Const { destination: Relative(1), bit_size: Integer(U8), value: 123 }, Const { destination: Relative(3), bit_size: Integer(U8), value: 34 }, Const { destination: Relative(4), bit_size: Integer(U8), value: 107 }, Const { destination: Relative(5), bit_size: Integer(U8), value: 105 }, Const { destination: Relative(6), bit_size: Integer(U8), value: 110 }, Const { destination: Relative(7), bit_size: Integer(U8), value: 100 }, Const { destination: Relative(8), bit_size: Integer(U8), value: 58 }, Const { destination: Relative(9), bit_size: Integer(U8), value: 115 }, Const { destination: Relative(10), bit_size: Integer(U8), value: 116 }, Const { destination: Relative(11), bit_size: Integer(U8), value: 114 }, Const { destination: Relative(12), bit_size: Integer(U8), value: 103 }, Const { destination: Relative(13), bit_size: Integer(U8), value: 44 }, Const { destination: Relative(14), bit_size: Integer(U8), value: 108 }, Const { destination: Relative(15), bit_size: Integer(U8), value: 101 }, Const { destination: Relative(16), bit_size: Integer(U8), value: 104 }, Const { destination: Relative(17), bit_size: Integer(U8), value: 52 }, Const { destination: Relative(18), bit_size: Integer(U8), value: 125 }, Mov { destination: Relative(19), source: Direct(1) }, Const { destination: Relative(20), bit_size: Integer(U32), value: 29 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(20) }, IndirectConst { destination_pointer: Relative(19), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(20), op: Add, bit_size: U32, lhs: Relative(19), rhs: Direct(2) }, Mov { destination: Relative(21), source: Relative(20) }, Store { destination_pointer: Relative(21), source: Relative(1) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(3) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(4) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(5) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(6) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(7) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(3) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(8) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(3) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(9) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(10) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(11) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(5) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(6) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(12) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(3) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(13) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(3) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(14) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(15) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(6) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(12) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(10) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(16) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(3) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(8) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(17) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(18) }, BinaryIntOp { destination: Relative(1), op: Add, bit_size: U32, lhs: Direct(32840), rhs: Direct(2) }, BinaryIntOp { destination: Relative(3), op: Add, bit_size: U32, lhs: Relative(19), rhs: Direct(2) }, ForeignCall { function: \"print\", destinations: [], destination_value_types: [], inputs: [MemoryAddress(Direct(32836)), HeapArray(HeapArray { pointer: Relative(1), size: 4 }), HeapArray(HeapArray { pointer: Relative(3), size: 28 }), MemoryAddress(Direct(32835))], input_value_types: [Simple(Integer(U1)), Array { value_types: [Simple(Integer(U8))], size: 4 }, Array { value_types: [Simple(Integer(U8))], size: 28 }, Simple(Integer(U1))] }, Load { destination: Relative(1), source_pointer: Direct(32840) }, Const { destination: Relative(3), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(4), op: Equals, bit_size: U32, lhs: Relative(3), rhs: Relative(1) }, Not { destination: Relative(4), source: Relative(4), bit_size: U1 }, JumpIf { condition: Relative(4), location: 127 }, Call { location: 137 }, BinaryIntOp { destination: Relative(1), op: Add, bit_size: U32, lhs: Relative(1), rhs: Direct(2) }, Store { destination_pointer: Direct(32840), source: Relative(1) }, Const { destination: Relative(1), bit_size: Field, value: 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: 136 }, 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: 12049594436772143978 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return]" + ], + "debug_symbols": "tdRBTsMwEIXhu3idRcb2eOxeBVVV2qYoUpRWIUFCVe6OnTcFuggLJDb8hPC+qpWbuzm3x/n10A2X65vZvdzNcez6vns99NdTM3XXIf/1buryw1mzs5VxDvEIIwERJCJpjc9rziHEIg7xCCMBESQiaQ1DYSgMhaEwFIbCUBgKQ2EoAUqAEqAEKAFKgBKgBCgBSoAiUASKQBEoAkWgCBSBIlAESoQSoUQoEUqEEqFEKBFKhBKhJCgJSoKSoCQoCUqCkqAkKAkK1bWWtFbrtF7L2qAVbdSqR+qReqQeqUfqkXqkHqlH2QulCbW1NntSarVO67WsDVrRZk+WpTKPc32YxrYtx/rHQc/H/9aM7TCZ3TD3fWXem35e/+nt1gxrp2bMd+vKtMM5N4OXrm/Lb0v1va63p9Y7HVumrzk/72l7zzXrnulPe0qPvU1be7e9j4l0n6z72lv7tPf/txcvupdYb+1/+fydt7p33j29/32+ak7d+PToW4o0ds2xb/XyMg+nH3enj9vjzuPReRuvp/Y8j22Rvp+f5SvxQo4qcmFfjvZ6Kfky7Zfy8p8=", + "file_map": { + "22": { + "source": "pub mod hash;\npub mod aes128;\npub mod array;\npub mod slice;\npub mod ecdsa_secp256k1;\npub mod ecdsa_secp256r1;\npub mod embedded_curve_ops;\npub mod field;\npub mod collections;\npub mod compat;\npub mod convert;\npub mod option;\npub mod string;\npub mod test;\npub mod cmp;\npub mod ops;\npub mod default;\npub mod prelude;\npub mod runtime;\npub mod meta;\npub mod append;\npub mod mem;\npub mod panic;\npub mod hint;\n\nuse convert::AsPrimitive;\n\n// Oracle calls are required to be wrapped in an unconstrained function\n// Thus, the only argument to the `println` oracle is expected to always be an ident\n#[oracle(print)]\nunconstrained fn print_oracle(with_newline: bool, input: T) {}\n\nunconstrained fn print_unconstrained(with_newline: bool, input: T) {\n print_oracle(with_newline, input);\n}\n\npub fn println(input: T) {\n // Safety: a print statement cannot be constrained\n unsafe {\n print_unconstrained(true, input);\n }\n}\n\npub fn print(input: T) {\n // Safety: a print statement cannot be constrained\n unsafe {\n print_unconstrained(false, input);\n }\n}\n\npub fn verify_proof(\n verification_key: [Field; N],\n proof: [Field; M],\n public_inputs: [Field; K],\n key_hash: Field,\n) {\n verify_proof_internal(verification_key, proof, public_inputs, key_hash, 0);\n}\n\npub fn verify_proof_with_type(\n verification_key: [Field; N],\n proof: [Field; M],\n public_inputs: [Field; K],\n key_hash: Field,\n proof_type: u32,\n) {\n if !crate::runtime::is_unconstrained() {\n crate::assert_constant(proof_type);\n }\n verify_proof_internal(verification_key, proof, public_inputs, key_hash, proof_type);\n}\n\n#[foreign(recursive_aggregation)]\nfn verify_proof_internal(\n verification_key: [Field; N],\n proof: [Field; M],\n public_inputs: [Field; K],\n key_hash: Field,\n proof_type: u32,\n) {}\n\n// Asserts that the given value is known at compile-time.\n// Useful for debugging for-loop bounds.\n#[builtin(assert_constant)]\npub fn assert_constant(x: T) {}\n\n// Asserts that the given value is both true and known at compile-time.\n// The message can be a string, a format string, or any value, as long as it is known at compile-time\n#[builtin(static_assert)]\npub fn static_assert(predicate: bool, message: T) {}\n\n#[deprecated(\"wrapping operations should be done with the Wrapping traits. E.g: x.wrapping_add(y)\")]\npub fn wrapping_add(x: T, y: T) -> T\nwhere\n T: AsPrimitive,\n Field: AsPrimitive,\n{\n AsPrimitive::as_(x.as_() + y.as_())\n}\n#[deprecated(\"wrapping operations should be done with the Wrapping traits. E.g: x.wrapping_sub(y)\")]\npub fn wrapping_sub(x: T, y: T) -> T\nwhere\n T: AsPrimitive,\n Field: AsPrimitive,\n{\n //340282366920938463463374607431768211456 is 2^128, it is used to avoid underflow\n AsPrimitive::as_(x.as_() + 340282366920938463463374607431768211456 - y.as_())\n}\n#[deprecated(\"wrapping operations should be done with the Wrapping traits. E.g: x.wrapping_mul(y)\")]\npub fn wrapping_mul(x: T, y: T) -> T\nwhere\n T: AsPrimitive,\n Field: AsPrimitive,\n{\n AsPrimitive::as_(x.as_() * y.as_())\n}\n\n#[builtin(as_witness)]\npub fn as_witness(x: Field) {}\n\nmod tests {\n use super::ops::arith::WrappingMul;\n\n #[test(should_fail_with = \"custom message\")]\n fn test_static_assert_custom_message() {\n super::static_assert(1 == 2, \"custom message\");\n }\n\n #[test]\n fn test_wrapping_mul() {\n let zero: u128 = 0;\n let one: u128 = 1;\n let two_pow_64: u128 = 0x10000000000000000;\n let u128_max: u128 = 0xffffffffffffffffffffffffffffffff;\n\n // 1*0==0\n assert_eq(zero, zero.wrapping_mul(one));\n\n // 0*1==0\n assert_eq(zero, one.wrapping_mul(zero));\n\n // 1*1==1\n assert_eq(one, one.wrapping_mul(one));\n\n // 0 * ( 1 << 64 ) == 0\n assert_eq(zero, zero.wrapping_mul(two_pow_64));\n\n // ( 1 << 64 ) * 0 == 0\n assert_eq(zero, two_pow_64.wrapping_mul(zero));\n\n // 1 * ( 1 << 64 ) == 1 << 64\n assert_eq(two_pow_64, two_pow_64.wrapping_mul(one));\n\n // ( 1 << 64 ) * 1 == 1 << 64\n assert_eq(two_pow_64, one.wrapping_mul(two_pow_64));\n\n // ( 1 << 64 ) * ( 1 << 64 ) == 1 << 64\n assert_eq(zero, two_pow_64.wrapping_mul(two_pow_64));\n // -1 * -1 == 1\n assert_eq(one, u128_max.wrapping_mul(u128_max));\n }\n}\n", + "path": "std/lib.nr" + }, + "50": { + "source": "global G_A: [(bool, bool, str<4>); 3] =\n [(false, true, \"LZUT\"), (false, true, \"MFFA\"), (false, true, \"XPHT\")];\n\nfn main() -> pub Field {\n let mut a: ((str<4>, Field, str<4>, str<3>, bool), [&mut u8; 2]) = (\n (G_A[2].2, (unsafe { func_4() } as Field), G_A[1].2, \"TWC\", false), [(&mut 57), (&mut 219)],\n );\n for idx_d in 0..1 {\n // a.0 = a.0;\n }\n a.0 = (a.0.2, 0, a.0.0, a.0.3, ((128 % (*a.1[0])) == (*a.1[1])));\n 0\n}\n\nunconstrained fn func_4() -> bool {\n let mut a = G_A[1].2;\n println(a);\n true\n}\n", + "path": "" + } + }, + "names": [ + "main" + ], + "brillig_names": [ + "main" + ] +} diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/regression_8729/execute__tests__force_brillig_true_inliner_9223372036854775807.snap b/tooling/nargo_cli/tests/snapshots/execution_success/regression_8729/execute__tests__force_brillig_true_inliner_9223372036854775807.snap new file mode 100644 index 00000000000..e06f94b449a --- /dev/null +++ b/tooling/nargo_cli/tests/snapshots/execution_success/regression_8729/execute__tests__force_brillig_true_inliner_9223372036854775807.snap @@ -0,0 +1,54 @@ +--- +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": { + "12049594436772143978": { + "error_kind": "string", + "string": "array ref-count underflow detected" + }, + "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: 32844 }, 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(32843), size_address: Relative(1), offset_address: Relative(2) }, Call { location: 12 }, Call { location: 31 }, Mov { destination: Direct(32843), source: Relative(1) }, Const { destination: Relative(2), bit_size: Integer(U32), value: 32843 }, 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(U1), value: 0 }, Const { destination: Direct(32836), bit_size: Integer(U1), value: 1 }, Const { destination: Direct(32837), bit_size: Integer(U8), value: 77 }, Const { destination: Direct(32838), bit_size: Integer(U8), value: 70 }, Const { destination: Direct(32839), bit_size: Integer(U8), value: 65 }, Mov { destination: Direct(32840), source: Direct(1) }, Const { destination: Direct(32841), bit_size: Integer(U32), value: 5 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Direct(32841) }, IndirectConst { destination_pointer: Direct(32840), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Direct(32841), op: Add, bit_size: U32, lhs: Direct(32840), rhs: Direct(2) }, Mov { destination: Direct(32842), source: Direct(32841) }, Store { destination_pointer: Direct(32842), source: Direct(32837) }, BinaryIntOp { destination: Direct(32842), op: Add, bit_size: U32, lhs: Direct(32842), rhs: Direct(2) }, Store { destination_pointer: Direct(32842), source: Direct(32838) }, BinaryIntOp { destination: Direct(32842), op: Add, bit_size: U32, lhs: Direct(32842), rhs: Direct(2) }, Store { destination_pointer: Direct(32842), source: Direct(32838) }, BinaryIntOp { destination: Direct(32842), op: Add, bit_size: U32, lhs: Direct(32842), rhs: Direct(2) }, Store { destination_pointer: Direct(32842), source: Direct(32839) }, Return, Call { location: 131 }, Load { destination: Relative(1), source_pointer: Direct(32840) }, Const { destination: Relative(2), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(3), op: Equals, bit_size: U32, lhs: Relative(2), rhs: Relative(1) }, Not { destination: Relative(3), source: Relative(3), bit_size: U1 }, JumpIf { condition: Relative(3), location: 38 }, Call { location: 137 }, BinaryIntOp { destination: Relative(1), op: Add, bit_size: U32, lhs: Relative(1), rhs: Direct(2) }, Store { destination_pointer: Direct(32840), source: Relative(1) }, Const { destination: Relative(1), bit_size: Integer(U8), value: 123 }, Const { destination: Relative(3), bit_size: Integer(U8), value: 34 }, Const { destination: Relative(4), bit_size: Integer(U8), value: 107 }, Const { destination: Relative(5), bit_size: Integer(U8), value: 105 }, Const { destination: Relative(6), bit_size: Integer(U8), value: 110 }, Const { destination: Relative(7), bit_size: Integer(U8), value: 100 }, Const { destination: Relative(8), bit_size: Integer(U8), value: 58 }, Const { destination: Relative(9), bit_size: Integer(U8), value: 115 }, Const { destination: Relative(10), bit_size: Integer(U8), value: 116 }, Const { destination: Relative(11), bit_size: Integer(U8), value: 114 }, Const { destination: Relative(12), bit_size: Integer(U8), value: 103 }, Const { destination: Relative(13), bit_size: Integer(U8), value: 44 }, Const { destination: Relative(14), bit_size: Integer(U8), value: 108 }, Const { destination: Relative(15), bit_size: Integer(U8), value: 101 }, Const { destination: Relative(16), bit_size: Integer(U8), value: 104 }, Const { destination: Relative(17), bit_size: Integer(U8), value: 52 }, Const { destination: Relative(18), bit_size: Integer(U8), value: 125 }, Mov { destination: Relative(19), source: Direct(1) }, Const { destination: Relative(20), bit_size: Integer(U32), value: 29 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(20) }, IndirectConst { destination_pointer: Relative(19), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(20), op: Add, bit_size: U32, lhs: Relative(19), rhs: Direct(2) }, Mov { destination: Relative(21), source: Relative(20) }, Store { destination_pointer: Relative(21), source: Relative(1) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(3) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(4) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(5) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(6) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(7) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(3) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(8) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(3) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(9) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(10) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(11) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(5) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(6) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(12) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(3) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(13) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(3) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(14) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(15) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(6) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(12) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(10) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(16) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(3) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(8) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(17) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(18) }, BinaryIntOp { destination: Relative(1), op: Add, bit_size: U32, lhs: Direct(32840), rhs: Direct(2) }, BinaryIntOp { destination: Relative(3), op: Add, bit_size: U32, lhs: Relative(19), rhs: Direct(2) }, ForeignCall { function: \"print\", destinations: [], destination_value_types: [], inputs: [MemoryAddress(Direct(32836)), HeapArray(HeapArray { pointer: Relative(1), size: 4 }), HeapArray(HeapArray { pointer: Relative(3), size: 28 }), MemoryAddress(Direct(32835))], input_value_types: [Simple(Integer(U1)), Array { value_types: [Simple(Integer(U8))], size: 4 }, Array { value_types: [Simple(Integer(U8))], size: 28 }, Simple(Integer(U1))] }, Load { destination: Relative(1), source_pointer: Direct(32840) }, Const { destination: Relative(3), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(4), op: Equals, bit_size: U32, lhs: Relative(3), rhs: Relative(1) }, Not { destination: Relative(4), source: Relative(4), bit_size: U1 }, JumpIf { condition: Relative(4), location: 127 }, Call { location: 137 }, BinaryIntOp { destination: Relative(1), op: Add, bit_size: U32, lhs: Relative(1), rhs: Direct(2) }, Store { destination_pointer: Direct(32840), source: Relative(1) }, Const { destination: Relative(1), bit_size: Field, value: 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: 136 }, 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: 12049594436772143978 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return]" + ], + "debug_symbols": "tdRBTsMwEIXhu3idRcb2eOxeBVVV2qYoUpRWIUFCVe6OnTcFuggLJDb8hPC+qpWbuzm3x/n10A2X65vZvdzNcez6vns99NdTM3XXIf/1buryw1mzs5VxDvEIIwERJCJpjc9rziHEIg7xCCMBESQiaQ1DYSgMhaEwFIbCUBgKQ2EoAUqAEqAEKAFKgBKgBCgBSoAiUASKQBEoAkWgCBSBIlAESoQSoUQoEUqEEqFEKBFKhBKhJCgJSoKSoCQoCUqCkqAkKAkK1bWWtFbrtF7L2qAVbdSqR+qReqQeqUfqkXqkHqlH2QulCbW1NntSarVO67WsDVrRZk+WpTKPc32YxrYtx/rHQc/H/9aM7TCZ3TD3fWXem35e/+nt1gxrp2bMd+vKtMM5N4OXrm/Lb0v1va63p9Y7HVumrzk/72l7zzXrnulPe0qPvU1be7e9j4l0n6z72lv7tPf/txcvupdYb+1/+fydt7p33j29/32+ak7d+PToW4o0ds2xb/XyMg+nH3enj9vjzuPReRuvp/Y8j22Rvp+f5SvxQo4qcmFfjvZ6Kfky7Zfy8p8=", + "file_map": { + "22": { + "source": "pub mod hash;\npub mod aes128;\npub mod array;\npub mod slice;\npub mod ecdsa_secp256k1;\npub mod ecdsa_secp256r1;\npub mod embedded_curve_ops;\npub mod field;\npub mod collections;\npub mod compat;\npub mod convert;\npub mod option;\npub mod string;\npub mod test;\npub mod cmp;\npub mod ops;\npub mod default;\npub mod prelude;\npub mod runtime;\npub mod meta;\npub mod append;\npub mod mem;\npub mod panic;\npub mod hint;\n\nuse convert::AsPrimitive;\n\n// Oracle calls are required to be wrapped in an unconstrained function\n// Thus, the only argument to the `println` oracle is expected to always be an ident\n#[oracle(print)]\nunconstrained fn print_oracle(with_newline: bool, input: T) {}\n\nunconstrained fn print_unconstrained(with_newline: bool, input: T) {\n print_oracle(with_newline, input);\n}\n\npub fn println(input: T) {\n // Safety: a print statement cannot be constrained\n unsafe {\n print_unconstrained(true, input);\n }\n}\n\npub fn print(input: T) {\n // Safety: a print statement cannot be constrained\n unsafe {\n print_unconstrained(false, input);\n }\n}\n\npub fn verify_proof(\n verification_key: [Field; N],\n proof: [Field; M],\n public_inputs: [Field; K],\n key_hash: Field,\n) {\n verify_proof_internal(verification_key, proof, public_inputs, key_hash, 0);\n}\n\npub fn verify_proof_with_type(\n verification_key: [Field; N],\n proof: [Field; M],\n public_inputs: [Field; K],\n key_hash: Field,\n proof_type: u32,\n) {\n if !crate::runtime::is_unconstrained() {\n crate::assert_constant(proof_type);\n }\n verify_proof_internal(verification_key, proof, public_inputs, key_hash, proof_type);\n}\n\n#[foreign(recursive_aggregation)]\nfn verify_proof_internal(\n verification_key: [Field; N],\n proof: [Field; M],\n public_inputs: [Field; K],\n key_hash: Field,\n proof_type: u32,\n) {}\n\n// Asserts that the given value is known at compile-time.\n// Useful for debugging for-loop bounds.\n#[builtin(assert_constant)]\npub fn assert_constant(x: T) {}\n\n// Asserts that the given value is both true and known at compile-time.\n// The message can be a string, a format string, or any value, as long as it is known at compile-time\n#[builtin(static_assert)]\npub fn static_assert(predicate: bool, message: T) {}\n\n#[deprecated(\"wrapping operations should be done with the Wrapping traits. E.g: x.wrapping_add(y)\")]\npub fn wrapping_add(x: T, y: T) -> T\nwhere\n T: AsPrimitive,\n Field: AsPrimitive,\n{\n AsPrimitive::as_(x.as_() + y.as_())\n}\n#[deprecated(\"wrapping operations should be done with the Wrapping traits. E.g: x.wrapping_sub(y)\")]\npub fn wrapping_sub(x: T, y: T) -> T\nwhere\n T: AsPrimitive,\n Field: AsPrimitive,\n{\n //340282366920938463463374607431768211456 is 2^128, it is used to avoid underflow\n AsPrimitive::as_(x.as_() + 340282366920938463463374607431768211456 - y.as_())\n}\n#[deprecated(\"wrapping operations should be done with the Wrapping traits. E.g: x.wrapping_mul(y)\")]\npub fn wrapping_mul(x: T, y: T) -> T\nwhere\n T: AsPrimitive,\n Field: AsPrimitive,\n{\n AsPrimitive::as_(x.as_() * y.as_())\n}\n\n#[builtin(as_witness)]\npub fn as_witness(x: Field) {}\n\nmod tests {\n use super::ops::arith::WrappingMul;\n\n #[test(should_fail_with = \"custom message\")]\n fn test_static_assert_custom_message() {\n super::static_assert(1 == 2, \"custom message\");\n }\n\n #[test]\n fn test_wrapping_mul() {\n let zero: u128 = 0;\n let one: u128 = 1;\n let two_pow_64: u128 = 0x10000000000000000;\n let u128_max: u128 = 0xffffffffffffffffffffffffffffffff;\n\n // 1*0==0\n assert_eq(zero, zero.wrapping_mul(one));\n\n // 0*1==0\n assert_eq(zero, one.wrapping_mul(zero));\n\n // 1*1==1\n assert_eq(one, one.wrapping_mul(one));\n\n // 0 * ( 1 << 64 ) == 0\n assert_eq(zero, zero.wrapping_mul(two_pow_64));\n\n // ( 1 << 64 ) * 0 == 0\n assert_eq(zero, two_pow_64.wrapping_mul(zero));\n\n // 1 * ( 1 << 64 ) == 1 << 64\n assert_eq(two_pow_64, two_pow_64.wrapping_mul(one));\n\n // ( 1 << 64 ) * 1 == 1 << 64\n assert_eq(two_pow_64, one.wrapping_mul(two_pow_64));\n\n // ( 1 << 64 ) * ( 1 << 64 ) == 1 << 64\n assert_eq(zero, two_pow_64.wrapping_mul(two_pow_64));\n // -1 * -1 == 1\n assert_eq(one, u128_max.wrapping_mul(u128_max));\n }\n}\n", + "path": "std/lib.nr" + }, + "50": { + "source": "global G_A: [(bool, bool, str<4>); 3] =\n [(false, true, \"LZUT\"), (false, true, \"MFFA\"), (false, true, \"XPHT\")];\n\nfn main() -> pub Field {\n let mut a: ((str<4>, Field, str<4>, str<3>, bool), [&mut u8; 2]) = (\n (G_A[2].2, (unsafe { func_4() } as Field), G_A[1].2, \"TWC\", false), [(&mut 57), (&mut 219)],\n );\n for idx_d in 0..1 {\n // a.0 = a.0;\n }\n a.0 = (a.0.2, 0, a.0.0, a.0.3, ((128 % (*a.1[0])) == (*a.1[1])));\n 0\n}\n\nunconstrained fn func_4() -> bool {\n let mut a = G_A[1].2;\n println(a);\n true\n}\n", + "path": "" + } + }, + "names": [ + "main" + ], + "brillig_names": [ + "main" + ] +} diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/regression_8729/execute__tests__stdout.snap b/tooling/nargo_cli/tests/snapshots/execution_success/regression_8729/execute__tests__stdout.snap new file mode 100644 index 00000000000..bd461af73f3 --- /dev/null +++ b/tooling/nargo_cli/tests/snapshots/execution_success/regression_8729/execute__tests__stdout.snap @@ -0,0 +1,6 @@ +--- +source: tooling/nargo_cli/tests/execute.rs +expression: stdout +--- +MFFA +[regression_8729] Circuit output: Field(0)