diff --git a/.github/benchmark_projects.yml b/.github/benchmark_projects.yml index 45b8815e338..f92be6ca8b5 100644 --- a/.github/benchmark_projects.yml +++ b/.github/benchmark_projects.yml @@ -1,4 +1,4 @@ -define: &AZ_COMMIT ad837fe0687a4c9e58c43c7295ea31e39420060e +define: &AZ_COMMIT 42d5984235d2ffcaf5545e88e77eeb698e147416 projects: private-kernel-inner: repo: AztecProtocol/aztec-packages diff --git a/.github/critical_libraries_status/zkpassport/noir_rsa/.failures.jsonl b/.github/critical_libraries_status/zkpassport/noir_rsa/.failures.jsonl.does_not_compile similarity index 100% rename from .github/critical_libraries_status/zkpassport/noir_rsa/.failures.jsonl rename to .github/critical_libraries_status/zkpassport/noir_rsa/.failures.jsonl.does_not_compile diff --git a/EXTERNAL_NOIR_LIBRARIES.yml b/EXTERNAL_NOIR_LIBRARIES.yml index e4dce32fbb1..ceaa89ede59 100644 --- a/EXTERNAL_NOIR_LIBRARIES.yml +++ b/EXTERNAL_NOIR_LIBRARIES.yml @@ -1,4 +1,4 @@ -define: &AZ_COMMIT ad837fe0687a4c9e58c43c7295ea31e39420060e +define: &AZ_COMMIT 42d5984235d2ffcaf5545e88e77eeb698e147416 libraries: noir_check_shuffle: repo: noir-lang/noir_check_shuffle diff --git a/compiler/noirc_frontend/src/elaborator/types.rs b/compiler/noirc_frontend/src/elaborator/types.rs index dab31a30b24..f479f9e8865 100644 --- a/compiler/noirc_frontend/src/elaborator/types.rs +++ b/compiler/noirc_frontend/src/elaborator/types.rs @@ -1194,7 +1194,21 @@ impl Elaborator<'_> { match to { Type::Integer(sign, bits) => Type::Integer(sign, bits), Type::FieldElement => Type::FieldElement, - Type::Bool => Type::Bool, + Type::Bool => { + let from_is_numeric = match from_follow_bindings { + Type::Integer(..) | Type::FieldElement => true, + Type::TypeVariable(ref var) => var.is_integer() || var.is_integer_or_field(), + _ => false, + }; + if from_is_numeric { + self.push_err(TypeCheckError::CannotCastNumericToBool { + typ: from_follow_bindings, + location, + }); + } + + Type::Bool + } Type::Error => Type::Error, _ => { self.push_err(TypeCheckError::UnsupportedCast { location }); diff --git a/compiler/noirc_frontend/src/hir/type_check/errors.rs b/compiler/noirc_frontend/src/hir/type_check/errors.rs index 877664253ff..45c3c4bfba0 100644 --- a/compiler/noirc_frontend/src/hir/type_check/errors.rs +++ b/compiler/noirc_frontend/src/hir/type_check/errors.rs @@ -70,6 +70,8 @@ pub enum TypeCheckError { InvalidCast { from: Type, location: Location, reason: String }, #[error("Casting value of type {from} to a smaller type ({to})")] DownsizingCast { from: Type, to: Type, location: Location, reason: String }, + #[error("Cannot cast `{typ}` as `bool`")] + CannotCastNumericToBool { typ: Type, location: Location }, #[error("Expected a function, but found a(n) {found}")] ExpectedFunction { found: Type, location: Location }, #[error("Type {lhs_type} has no member named {field_name}")] @@ -258,6 +260,7 @@ impl TypeCheckError { | TypeCheckError::ArityMisMatch { location, .. } | TypeCheckError::InvalidCast { location, .. } | TypeCheckError::DownsizingCast { location, .. } + | TypeCheckError::CannotCastNumericToBool { location, .. } | TypeCheckError::ExpectedFunction { location, .. } | TypeCheckError::AccessUnknownMember { location, .. } | TypeCheckError::ParameterCountMismatch { location, .. } @@ -459,6 +462,10 @@ impl<'a> From<&'a TypeCheckError> for Diagnostic { TypeCheckError::DownsizingCast { location, reason, .. } => { Diagnostic::simple_warning(error.to_string(), reason.clone(), *location) } + TypeCheckError::CannotCastNumericToBool { typ: _, location } => { + let secondary = "compare with zero instead: ` != 0`".to_string(); + Diagnostic::simple_error(error.to_string(), secondary, *location) + } TypeCheckError::ExpectedFunction { location, .. } | TypeCheckError::AccessUnknownMember { location, .. } diff --git a/noir_stdlib/src/convert.nr b/noir_stdlib/src/convert.nr index b5390fd64e2..69f642670fc 100644 --- a/noir_stdlib/src/convert.nr +++ b/noir_stdlib/src/convert.nr @@ -175,15 +175,23 @@ comptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted { let mut impls = &[]; for type1 in types { for type2 in types { - let trait_impl = quote { + let body = if type1 == type2 { + quote { self } + } else if type1 == quote { bool } { + quote { self != 0 } + } else { + quote { self as $type1 } + }; + + impls = impls.push_back( + quote { impl AsPrimitive<$type1> for $type2 { fn as_(self) -> $type1 { - self as $type1 + $body } } - }; - - impls = impls.push_back(trait_impl); + }, + ); } } impls.join(quote {}) diff --git a/test_programs/compile_failure/cast_numeric_to_bool/Nargo.toml b/test_programs/compile_failure/cast_numeric_to_bool/Nargo.toml new file mode 100644 index 00000000000..0383ba62b3d --- /dev/null +++ b/test_programs/compile_failure/cast_numeric_to_bool/Nargo.toml @@ -0,0 +1,7 @@ +[package] +name = "cast_numeric_to_bool" +type = "bin" +authors = [""] +compiler_version = ">=0.33.0" + +[dependencies] diff --git a/test_programs/compile_failure/cast_numeric_to_bool/src/main.nr b/test_programs/compile_failure/cast_numeric_to_bool/src/main.nr new file mode 100644 index 00000000000..5c08ad53e74 --- /dev/null +++ b/test_programs/compile_failure/cast_numeric_to_bool/src/main.nr @@ -0,0 +1,10 @@ +fn main() { + let x = 1; + let _ = x as bool; + + let x: i32 = 1; + let _ = x as bool; + + let x: u64 = 1; + let _ = x as bool; +} diff --git a/test_programs/compile_success_empty/brillig_cast/src/main.nr b/test_programs/compile_success_empty/brillig_cast/src/main.nr index 7b523827398..8547ffb3eb3 100644 --- a/test_programs/compile_success_empty/brillig_cast/src/main.nr +++ b/test_programs/compile_success_empty/brillig_cast/src/main.nr @@ -4,7 +4,6 @@ fn main() { // Safety: testing context unsafe { - bool_casts(); field_casts(); uint_casts(); int_casts(); @@ -12,12 +11,6 @@ fn main() { } } -unconstrained fn bool_casts() { - assert(false == 0 as bool); - assert(true == 1 as bool); - assert(true == 3 as bool); -} - unconstrained fn field_casts() { assert(5 as u8 as Field == 5); assert(256 as u8 as Field == 0); @@ -39,6 +32,5 @@ unconstrained fn int_casts() { unconstrained fn mixed_casts() { assert(100 as u32 as i32 as u32 == 100); assert(257 as u8 as u32 == 1); - assert(1 as u8 as bool == true); assert(true as i8 == 1); } diff --git a/test_programs/execution_success/assert/src/main.nr b/test_programs/execution_success/assert/src/main.nr index b95665d502b..813c90932e1 100644 --- a/test_programs/execution_success/assert/src/main.nr +++ b/test_programs/execution_success/assert/src/main.nr @@ -1,6 +1,6 @@ fn main(x: Field) { assert(x == 1); - assert(1 == conditional(x as bool)); + assert(1 == conditional(x != 0)); } fn conditional(x: bool) -> Field { diff --git a/test_programs/execution_success/brillig_not/src/main.nr b/test_programs/execution_success/brillig_not/src/main.nr index e9e7c1bea81..1669c46c455 100644 --- a/test_programs/execution_success/brillig_not/src/main.nr +++ b/test_programs/execution_success/brillig_not/src/main.nr @@ -4,8 +4,8 @@ fn main(x: Field, y: Field) { // Safety: testing context unsafe { - assert(false == not_operator(x as bool)); - assert(true == not_operator(y as bool)); + assert(false == not_operator(x != 0)); + assert(true == not_operator(y != 0)); } } diff --git a/test_programs/execution_success/merkle_insert/src/main.nr b/test_programs/execution_success/merkle_insert/src/main.nr index 42a261ae6c6..4f0d9f4ad76 100644 --- a/test_programs/execution_success/merkle_insert/src/main.nr +++ b/test_programs/execution_success/merkle_insert/src/main.nr @@ -16,7 +16,7 @@ fn compute_merkle_root(leaf: Field, index: Field, hash_path: [Field; let index_bits: [u1; N] = index.to_le_bits(); let mut current = leaf; for i in 0..N { - let path_bit = index_bits[i] as bool; + let path_bit = index_bits[i] != 0; let (hash_left, hash_right) = if path_bit { (hash_path[i], current) } else { diff --git a/test_programs/execution_success/regression_8329/src/main.nr b/test_programs/execution_success/regression_8329/src/main.nr index 02106bddb08..a4f82c479c9 100644 --- a/test_programs/execution_success/regression_8329/src/main.nr +++ b/test_programs/execution_success/regression_8329/src/main.nr @@ -1,9 +1,9 @@ fn main(x: u1, y: u1, z: u1) -> pub u1 { let p = y - z; - if p as bool { + if p != 0 { let a = x / z; let b = a - z; - if b as bool { + if b != 0 { let _ = a / b; } } diff --git a/test_programs/execution_success/simple_shield/src/main.nr b/test_programs/execution_success/simple_shield/src/main.nr index 82b53dd2cc9..cf0feb42f55 100644 --- a/test_programs/execution_success/simple_shield/src/main.nr +++ b/test_programs/execution_success/simple_shield/src/main.nr @@ -29,7 +29,7 @@ fn compute_merkle_root(leaf: Field, index: Field, hash_path: [Field; let index_bits: [u1; N] = index.to_le_bits(); let mut current = leaf; for i in 0..N { - let path_bit = index_bits[i] as bool; + let path_bit = index_bits[i] != 0; let (hash_left, hash_right) = if path_bit { (hash_path[i], current) } else { diff --git a/tooling/nargo_cli/tests/snapshots/compile_failure/cast_numeric_to_bool/execute__tests__stderr.snap b/tooling/nargo_cli/tests/snapshots/compile_failure/cast_numeric_to_bool/execute__tests__stderr.snap new file mode 100644 index 00000000000..74b0e1d9914 --- /dev/null +++ b/tooling/nargo_cli/tests/snapshots/compile_failure/cast_numeric_to_bool/execute__tests__stderr.snap @@ -0,0 +1,26 @@ +--- +source: tooling/nargo_cli/tests/execute.rs +expression: stderr +--- +error: Cannot cast `Field` as `bool` + ┌─ src/main.nr:3:13 + │ +3 │ let _ = x as bool; + │ --------- compare with zero instead: ` != 0` + │ + +error: Cannot cast `i32` as `bool` + ┌─ src/main.nr:6:13 + │ +6 │ let _ = x as bool; + │ --------- compare with zero instead: ` != 0` + │ + +error: Cannot cast `u64` as `bool` + ┌─ src/main.nr:9:13 + │ +9 │ let _ = x as bool; + │ --------- compare with zero instead: ` != 0` + │ + +Aborting due to 3 previous errors diff --git a/tooling/nargo_cli/tests/snapshots/compile_success_empty/brillig_cast/execute__tests__expanded.snap b/tooling/nargo_cli/tests/snapshots/compile_success_empty/brillig_cast/execute__tests__expanded.snap index 5656f398d3c..18c3c64adef 100644 --- a/tooling/nargo_cli/tests/snapshots/compile_success_empty/brillig_cast/execute__tests__expanded.snap +++ b/tooling/nargo_cli/tests/snapshots/compile_success_empty/brillig_cast/execute__tests__expanded.snap @@ -5,7 +5,6 @@ expression: expanded_code fn main() { // Safety: comment added by `nargo expand` unsafe { - bool_casts(); field_casts(); uint_casts(); int_casts(); @@ -13,12 +12,6 @@ fn main() { } } -unconstrained fn bool_casts() { - assert(false == (0 as bool)); - assert(true == (1 as bool)); - assert(true == (3 as bool)); -} - unconstrained fn field_casts() { assert(((5 as u8) as Field) == 5); assert(((256 as u8) as Field) == 0); @@ -40,6 +33,5 @@ unconstrained fn int_casts() { unconstrained fn mixed_casts() { assert((((100 as u32) as i32) as u32) == 100); assert(((257 as u8) as u32) == 1); - assert(((1 as u8) as bool) == true); assert((true as i8) == 1); } diff --git a/tooling/nargo_cli/tests/snapshots/compile_success_empty/brillig_cast/execute__tests__force_brillig_false_inliner_0.snap b/tooling/nargo_cli/tests/snapshots/compile_success_empty/brillig_cast/execute__tests__force_brillig_false_inliner_0.snap index 551f01885da..c0d6bb03c1e 100644 --- a/tooling/nargo_cli/tests/snapshots/compile_success_empty/brillig_cast/execute__tests__force_brillig_false_inliner_0.snap +++ b/tooling/nargo_cli/tests/snapshots/compile_success_empty/brillig_cast/execute__tests__force_brillig_false_inliner_0.snap @@ -17,7 +17,7 @@ expression: artifact "public parameters indices : []", "return value indices : []" ], - "debug_symbols": "nZDRCoMwDEX/pc8+jNUh+CtjSKxRCqEtsRWG+O+LYlGEwdhTcnNzbiCz6rBNQ2Nd70dVP2fVsiWyQ0PeQLTeyXReCpVlExlRRurkCxWA0UVVu0RUqAkobUtjALfVCCzurVDoOqkS2FvCtVuKg759R6u73uFKH/jjd16XmS/1P/xx/8K/RIGxfP3YBGyhJdxln5w5ufEdspM/Htgb7BLjmrR5kv0B", + "debug_symbols": "nZDRCoMwDEX/pc99EIc4/ZUxpNYohdCW2ApD/PdFsVOEwdhTcnNzbiCz6KCNQ2Ns70ZRP2bRkkE0Q4NOq2Cc5em8SJFkEwiAR+LkM+UVgQ2ithFRiklh3JZGr+xWgyJ2MynAdlw5sDcIa7fIg86+o0WZ73BRVh+8+J2/3xJf5f/wx/0L/2SltKHrxyZFRrUIu+yj1Sc3vHxy0sc9OQ1dJFiTNo+z3w==", "file_map": {}, "names": [ "main" diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/4_sub/execute__tests__force_brillig_false_inliner_-9223372036854775808.snap b/tooling/nargo_cli/tests/snapshots/execution_success/4_sub/execute__tests__force_brillig_false_inliner_-9223372036854775808.snap index 605d58780d1..ce9d7f21208 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/4_sub/execute__tests__force_brillig_false_inliner_-9223372036854775808.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/4_sub/execute__tests__force_brillig_false_inliner_-9223372036854775808.snap @@ -64,7 +64,7 @@ expression: artifact "unconstrained func 1", "[Const { destination: Direct(21), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(20), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(0), size_address: Direct(21), offset_address: Direct(20) }, Const { destination: Direct(2), bit_size: Field, value: 0 }, BinaryFieldOp { destination: Direct(3), op: Equals, lhs: Direct(0), rhs: Direct(2) }, JumpIf { condition: Direct(3), location: 8 }, Const { destination: Direct(1), bit_size: Field, value: 1 }, BinaryFieldOp { destination: Direct(0), op: Div, lhs: Direct(1), rhs: Direct(0) }, Stop { return_data: HeapVector { pointer: Direct(20), size: Direct(21) } }]" ], - "debug_symbols": "vVNBjoQgEPwLZw/QKKhf2WwMKk5ICBpGNtkY/76IMo4HJps5zKVKaKtSrd0L6mXrbo0yw3hH9deCWqu0VrdGj52Y1Wj87bJmKB6b2Urpr9BT3asmYaWZUW2c1hn6EdqFl+6TMIFnYX0VZ0ia3rM3HJSW29OanWqclhLGDjEpT3lx1ZO0nrMiPww449XDgVYXB3iRAAPjMQMGDikPmvagkEcLCgV5OBB4LwUl7K1OKKlOD8hTHuyDnUCyk//+1TLp8GquqjhXgOEyV9/+JDplL5uAKKr9p8sDFgFZQB6wDFgFJHgnshPstOtJvvW8brGsEq2Wx5YNznRPSzf/TrES13KyYyd7Z+UWK9R80D8=", + "debug_symbols": "vVNBjoQgEPwLZw/QKIhf2WwMKk5ICBpGN9kY/76IMo4HJps5zKUaaKpSDd0L6lQz32pt++GOqq8FNU4bo2+1GVo56cH602XNUNzWk1PKH6GnvGeN0ik7ocrOxmToR5o5XLqP0oY4SeezOEPKdj56wV4bta3W7GTjNJUwdpBJedKLK5+k+ZwV+SHAGRcPBSouCvDCAQbGowcMHFIaNK1BQcQ38Mv8oUDgPReUsLcqoUScGpCnNNgHK4FkJf/91TKp8KqvROwrwHDpq2+/k612l0lAFFX+6fKARUAWkAcsA4qABO+B7AH2sPNJvtW8braclo1Rx5T1s22fhm76HWMmjuXohlZ1s1ObrZDzRv8A", "file_map": { "39": { "source": "use crate::convert::AsPrimitive;\n\n// docs:start:add-trait\npub trait Add {\n fn add(self, other: Self) -> Self;\n}\n// docs:end:add-trait\n\nimpl Add for Field {\n fn add(self, other: Field) -> Field {\n self + other\n }\n}\n\nimpl Add for u128 {\n fn add(self, other: u128) -> u128 {\n self + other\n }\n}\nimpl Add for u64 {\n fn add(self, other: u64) -> u64 {\n self + other\n }\n}\nimpl Add for u32 {\n fn add(self, other: u32) -> u32 {\n self + other\n }\n}\nimpl Add for u16 {\n fn add(self, other: u16) -> u16 {\n self + other\n }\n}\nimpl Add for u8 {\n fn add(self, other: u8) -> u8 {\n self + other\n }\n}\nimpl Add for u1 {\n fn add(self, other: u1) -> u1 {\n self + other\n }\n}\n\nimpl Add for i8 {\n fn add(self, other: i8) -> i8 {\n self + other\n }\n}\nimpl Add for i16 {\n fn add(self, other: i16) -> i16 {\n self + other\n }\n}\nimpl Add for i32 {\n fn add(self, other: i32) -> i32 {\n self + other\n }\n}\nimpl Add for i64 {\n fn add(self, other: i64) -> i64 {\n self + other\n }\n}\n\n// docs:start:sub-trait\npub trait Sub {\n fn sub(self, other: Self) -> Self;\n}\n// docs:end:sub-trait\n\nimpl Sub for Field {\n fn sub(self, other: Field) -> Field {\n self - other\n }\n}\n\nimpl Sub for u128 {\n fn sub(self, other: u128) -> u128 {\n self - other\n }\n}\nimpl Sub for u64 {\n fn sub(self, other: u64) -> u64 {\n self - other\n }\n}\nimpl Sub for u32 {\n fn sub(self, other: u32) -> u32 {\n self - other\n }\n}\nimpl Sub for u16 {\n fn sub(self, other: u16) -> u16 {\n self - other\n }\n}\nimpl Sub for u8 {\n fn sub(self, other: u8) -> u8 {\n self - other\n }\n}\nimpl Sub for u1 {\n fn sub(self, other: u1) -> u1 {\n self - other\n }\n}\n\nimpl Sub for i8 {\n fn sub(self, other: i8) -> i8 {\n self - other\n }\n}\nimpl Sub for i16 {\n fn sub(self, other: i16) -> i16 {\n self - other\n }\n}\nimpl Sub for i32 {\n fn sub(self, other: i32) -> i32 {\n self - other\n }\n}\nimpl Sub for i64 {\n fn sub(self, other: i64) -> i64 {\n self - other\n }\n}\n\n// docs:start:mul-trait\npub trait Mul {\n fn mul(self, other: Self) -> Self;\n}\n// docs:end:mul-trait\n\nimpl Mul for Field {\n fn mul(self, other: Field) -> Field {\n self * other\n }\n}\n\nimpl Mul for u128 {\n fn mul(self, other: u128) -> u128 {\n self * other\n }\n}\nimpl Mul for u64 {\n fn mul(self, other: u64) -> u64 {\n self * other\n }\n}\nimpl Mul for u32 {\n fn mul(self, other: u32) -> u32 {\n self * other\n }\n}\nimpl Mul for u16 {\n fn mul(self, other: u16) -> u16 {\n self * other\n }\n}\nimpl Mul for u8 {\n fn mul(self, other: u8) -> u8 {\n self * other\n }\n}\nimpl Mul for u1 {\n fn mul(self, other: u1) -> u1 {\n self * other\n }\n}\n\nimpl Mul for i8 {\n fn mul(self, other: i8) -> i8 {\n self * other\n }\n}\nimpl Mul for i16 {\n fn mul(self, other: i16) -> i16 {\n self * other\n }\n}\nimpl Mul for i32 {\n fn mul(self, other: i32) -> i32 {\n self * other\n }\n}\nimpl Mul for i64 {\n fn mul(self, other: i64) -> i64 {\n self * other\n }\n}\n\n// docs:start:div-trait\npub trait Div {\n fn div(self, other: Self) -> Self;\n}\n// docs:end:div-trait\n\nimpl Div for Field {\n fn div(self, other: Field) -> Field {\n self / other\n }\n}\n\nimpl Div for u128 {\n fn div(self, other: u128) -> u128 {\n self / other\n }\n}\nimpl Div for u64 {\n fn div(self, other: u64) -> u64 {\n self / other\n }\n}\nimpl Div for u32 {\n fn div(self, other: u32) -> u32 {\n self / other\n }\n}\nimpl Div for u16 {\n fn div(self, other: u16) -> u16 {\n self / other\n }\n}\nimpl Div for u8 {\n fn div(self, other: u8) -> u8 {\n self / other\n }\n}\nimpl Div for u1 {\n fn div(self, other: u1) -> u1 {\n self / other\n }\n}\n\nimpl Div for i8 {\n fn div(self, other: i8) -> i8 {\n self / other\n }\n}\nimpl Div for i16 {\n fn div(self, other: i16) -> i16 {\n self / other\n }\n}\nimpl Div for i32 {\n fn div(self, other: i32) -> i32 {\n self / other\n }\n}\nimpl Div for i64 {\n fn div(self, other: i64) -> i64 {\n self / other\n }\n}\n\n// docs:start:rem-trait\npub trait Rem {\n fn rem(self, other: Self) -> Self;\n}\n// docs:end:rem-trait\n\nimpl Rem for u128 {\n fn rem(self, other: u128) -> u128 {\n self % other\n }\n}\nimpl Rem for u64 {\n fn rem(self, other: u64) -> u64 {\n self % other\n }\n}\nimpl Rem for u32 {\n fn rem(self, other: u32) -> u32 {\n self % other\n }\n}\nimpl Rem for u16 {\n fn rem(self, other: u16) -> u16 {\n self % other\n }\n}\nimpl Rem for u8 {\n fn rem(self, other: u8) -> u8 {\n self % other\n }\n}\nimpl Rem for u1 {\n fn rem(self, other: u1) -> u1 {\n self % other\n }\n}\n\nimpl Rem for i8 {\n fn rem(self, other: i8) -> i8 {\n self % other\n }\n}\nimpl Rem for i16 {\n fn rem(self, other: i16) -> i16 {\n self % other\n }\n}\nimpl Rem for i32 {\n fn rem(self, other: i32) -> i32 {\n self % other\n }\n}\nimpl Rem for i64 {\n fn rem(self, other: i64) -> i64 {\n self % other\n }\n}\n\n// docs:start:neg-trait\npub trait Neg {\n fn neg(self) -> Self;\n}\n// docs:end:neg-trait\n\n// docs:start:neg-trait-impls\nimpl Neg for Field {\n fn neg(self) -> Field {\n -self\n }\n}\n\nimpl Neg for i8 {\n fn neg(self) -> i8 {\n -self\n }\n}\nimpl Neg for i16 {\n fn neg(self) -> i16 {\n -self\n }\n}\nimpl Neg for i32 {\n fn neg(self) -> i32 {\n -self\n }\n}\nimpl Neg for i64 {\n fn neg(self) -> i64 {\n -self\n }\n}\n// docs:end:neg-trait-impls\n\n// docs:start:wrapping-add-trait\npub trait WrappingAdd {\n fn wrapping_add(self, y: Self) -> Self;\n}\n// docs:end:wrapping-add-trait\n\nimpl WrappingAdd for u1 {\n fn wrapping_add(self: u1, y: u1) -> u1 {\n self ^ y\n }\n}\n\nimpl WrappingAdd for u8 {\n fn wrapping_add(self: u8, y: u8) -> u8 {\n wrapping_add_hlp(self, y)\n }\n}\n\nimpl WrappingAdd for u16 {\n fn wrapping_add(self: u16, y: u16) -> u16 {\n wrapping_add_hlp(self, y)\n }\n}\n\nimpl WrappingAdd for u32 {\n fn wrapping_add(self: u32, y: u32) -> u32 {\n wrapping_add_hlp(self, y)\n }\n}\n\nimpl WrappingAdd for u64 {\n fn wrapping_add(self: u64, y: u64) -> u64 {\n wrapping_add_hlp(self, y)\n }\n}\n\nimpl WrappingAdd for u128 {\n fn wrapping_add(self: u128, y: u128) -> u128 {\n wrapping_add_hlp(self, y)\n }\n}\n\nimpl WrappingAdd for i8 {\n fn wrapping_add(self: i8, y: i8) -> i8 {\n wrapping_add_hlp(self, y)\n }\n}\n\nimpl WrappingAdd for i16 {\n fn wrapping_add(self: i16, y: i16) -> i16 {\n wrapping_add_hlp(self, y)\n }\n}\n\nimpl WrappingAdd for i32 {\n fn wrapping_add(self: i32, y: i32) -> i32 {\n wrapping_add_hlp(self, y)\n }\n}\n\nimpl WrappingAdd for i64 {\n fn wrapping_add(self: i64, y: i64) -> i64 {\n wrapping_add_hlp(self, y)\n }\n}\nimpl WrappingAdd for Field {\n fn wrapping_add(self: Field, y: Field) -> Field {\n self + y\n }\n}\n\n// docs:start:wrapping-sub-trait\npub trait WrappingSub {\n fn wrapping_sub(self, y: Self) -> Self;\n}\n// docs:start:wrapping-sub-trait\n\nimpl WrappingSub for u1 {\n fn wrapping_sub(self: u1, y: u1) -> u1 {\n self ^ y\n }\n}\n\nimpl WrappingSub for u8 {\n fn wrapping_sub(self: u8, y: u8) -> u8 {\n wrapping_sub_hlp(self, y) as u8\n }\n}\n\nimpl WrappingSub for u16 {\n fn wrapping_sub(self: u16, y: u16) -> u16 {\n wrapping_sub_hlp(self, y) as u16\n }\n}\n\nimpl WrappingSub for u32 {\n fn wrapping_sub(self: u32, y: u32) -> u32 {\n wrapping_sub_hlp(self, y) as u32\n }\n}\nimpl WrappingSub for u64 {\n fn wrapping_sub(self: u64, y: u64) -> u64 {\n wrapping_sub_hlp(self, y) as u64\n }\n}\nimpl WrappingSub for u128 {\n fn wrapping_sub(self: u128, y: u128) -> u128 {\n wrapping_sub_hlp(self, y) as u128\n }\n}\n\nimpl WrappingSub for i8 {\n fn wrapping_sub(self: i8, y: i8) -> i8 {\n wrapping_sub_hlp(self, y) as i8\n }\n}\n\nimpl WrappingSub for i16 {\n fn wrapping_sub(self: i16, y: i16) -> i16 {\n wrapping_sub_hlp(self, y) as i16\n }\n}\n\nimpl WrappingSub for i32 {\n fn wrapping_sub(self: i32, y: i32) -> i32 {\n wrapping_sub_hlp(self, y) as i32\n }\n}\nimpl WrappingSub for i64 {\n fn wrapping_sub(self: i64, y: i64) -> i64 {\n wrapping_sub_hlp(self, y) as i64\n }\n}\nimpl WrappingSub for Field {\n fn wrapping_sub(self: Field, y: Field) -> Field {\n self - y\n }\n}\n\n// docs:start:wrapping-mul-trait\npub trait WrappingMul {\n fn wrapping_mul(self, y: Self) -> Self;\n}\n// docs:start:wrapping-mul-trait\n\nimpl WrappingMul for u1 {\n fn wrapping_mul(self: u1, y: u1) -> u1 {\n self & y\n }\n}\n\nimpl WrappingMul for u8 {\n fn wrapping_mul(self: u8, y: u8) -> u8 {\n wrapping_mul_hlp(self, y)\n }\n}\n\nimpl WrappingMul for u16 {\n fn wrapping_mul(self: u16, y: u16) -> u16 {\n wrapping_mul_hlp(self, y)\n }\n}\n\nimpl WrappingMul for u32 {\n fn wrapping_mul(self: u32, y: u32) -> u32 {\n wrapping_mul_hlp(self, y)\n }\n}\nimpl WrappingMul for u64 {\n fn wrapping_mul(self: u64, y: u64) -> u64 {\n wrapping_mul_hlp(self, y)\n }\n}\n\nimpl WrappingMul for i8 {\n fn wrapping_mul(self: i8, y: i8) -> i8 {\n wrapping_mul_hlp(self, y)\n }\n}\n\nimpl WrappingMul for i16 {\n fn wrapping_mul(self: i16, y: i16) -> i16 {\n wrapping_mul_hlp(self, y)\n }\n}\n\nimpl WrappingMul for i32 {\n fn wrapping_mul(self: i32, y: i32) -> i32 {\n wrapping_mul_hlp(self, y)\n }\n}\n\nimpl WrappingMul for i64 {\n fn wrapping_mul(self: i64, y: i64) -> i64 {\n wrapping_mul_hlp(self, y)\n }\n}\n\nimpl WrappingMul for u128 {\n fn wrapping_mul(self: u128, y: u128) -> u128 {\n wrapping_mul128_hlp(self, y)\n }\n}\nimpl WrappingMul for Field {\n fn wrapping_mul(self: Field, y: Field) -> Field {\n self * y\n }\n}\n\nfn wrapping_add_hlp(x: T, y: T) -> T\nwhere\n T: AsPrimitive,\n Field: AsPrimitive,\n{\n AsPrimitive::as_(x.as_() + y.as_())\n}\n\nfn wrapping_sub_hlp(x: T, y: T) -> Field\nwhere\n T: AsPrimitive,\n{\n //340282366920938463463374607431768211456 is 2^128, it is used to avoid underflow\n x.as_() + 340282366920938463463374607431768211456 - y.as_()\n}\n\nfn wrapping_mul_hlp(x: T, y: T) -> T\nwhere\n T: AsPrimitive,\n Field: AsPrimitive,\n{\n AsPrimitive::as_(x.as_() * y.as_())\n}\n\nglobal two_pow_64: u128 = 0x10000000000000000;\n/// Splits a 128 bits number into two 64 bits limbs\nunconstrained fn split64(x: u128) -> (u64, u64) {\n let lo = x as u64;\n let hi = (x / two_pow_64) as u64;\n (lo, hi)\n}\n\n/// Split a 128 bits number into two 64 bits limbs\n/// It will fail if the number is more than 128 bits\nfn split_into_64_bit_limbs(x: u128) -> (u64, u64) {\n // Safety: the limbs are constrained below\n let (x_lo, x_hi) = unsafe { split64(x) };\n assert(x as Field == x_lo as Field + x_hi as Field * two_pow_64 as Field);\n (x_lo, x_hi)\n}\n\n#[field(bn254)]\nfn wrapping_mul128_hlp(x: u128, y: u128) -> u128 {\n let (x_lo, x_hi) = split_into_64_bit_limbs(x);\n let (y_lo, y_hi) = split_into_64_bit_limbs(y);\n // Multiplication using the limbs:(x_lo + 2**64*x_hi)*(y_lo + 2**64*y_hi)=x_lo*y_lo+...\n // and skipping the terms over 2**128\n // Working with u64 limbs ensures that we cannot overflow the field modulus.\n let low = x_lo as Field * y_lo as Field;\n let lo = low as u64 as Field;\n let carry = (low - lo) / two_pow_64 as Field;\n let high = x_lo as Field * y_hi as Field + x_hi as Field * y_lo as Field + carry;\n let hi = high as u64 as Field;\n (lo + two_pow_64 as Field * hi) as u128\n}\n", diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/4_sub/execute__tests__force_brillig_false_inliner_0.snap b/tooling/nargo_cli/tests/snapshots/execution_success/4_sub/execute__tests__force_brillig_false_inliner_0.snap index 605d58780d1..ce9d7f21208 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/4_sub/execute__tests__force_brillig_false_inliner_0.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/4_sub/execute__tests__force_brillig_false_inliner_0.snap @@ -64,7 +64,7 @@ expression: artifact "unconstrained func 1", "[Const { destination: Direct(21), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(20), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(0), size_address: Direct(21), offset_address: Direct(20) }, Const { destination: Direct(2), bit_size: Field, value: 0 }, BinaryFieldOp { destination: Direct(3), op: Equals, lhs: Direct(0), rhs: Direct(2) }, JumpIf { condition: Direct(3), location: 8 }, Const { destination: Direct(1), bit_size: Field, value: 1 }, BinaryFieldOp { destination: Direct(0), op: Div, lhs: Direct(1), rhs: Direct(0) }, Stop { return_data: HeapVector { pointer: Direct(20), size: Direct(21) } }]" ], - "debug_symbols": "vVNBjoQgEPwLZw/QKKhf2WwMKk5ICBpGNtkY/76IMo4HJps5zKVKaKtSrd0L6mXrbo0yw3hH9deCWqu0VrdGj52Y1Wj87bJmKB6b2Urpr9BT3asmYaWZUW2c1hn6EdqFl+6TMIFnYX0VZ0ia3rM3HJSW29OanWqclhLGDjEpT3lx1ZO0nrMiPww449XDgVYXB3iRAAPjMQMGDikPmvagkEcLCgV5OBB4LwUl7K1OKKlOD8hTHuyDnUCyk//+1TLp8GquqjhXgOEyV9/+JDplL5uAKKr9p8sDFgFZQB6wDFgFJHgnshPstOtJvvW8brGsEq2Wx5YNznRPSzf/TrES13KyYyd7Z+UWK9R80D8=", + "debug_symbols": "vVNBjoQgEPwLZw/QKIhf2WwMKk5ICBpGN9kY/76IMo4HJps5zKUaaKpSDd0L6lQz32pt++GOqq8FNU4bo2+1GVo56cH602XNUNzWk1PKH6GnvGeN0ik7ocrOxmToR5o5XLqP0oY4SeezOEPKdj56wV4bta3W7GTjNJUwdpBJedKLK5+k+ZwV+SHAGRcPBSouCvDCAQbGowcMHFIaNK1BQcQ38Mv8oUDgPReUsLcqoUScGpCnNNgHK4FkJf/91TKp8KqvROwrwHDpq2+/k612l0lAFFX+6fKARUAWkAcsA4qABO+B7AH2sPNJvtW8braclo1Rx5T1s22fhm76HWMmjuXohlZ1s1ObrZDzRv8A", "file_map": { "39": { "source": "use crate::convert::AsPrimitive;\n\n// docs:start:add-trait\npub trait Add {\n fn add(self, other: Self) -> Self;\n}\n// docs:end:add-trait\n\nimpl Add for Field {\n fn add(self, other: Field) -> Field {\n self + other\n }\n}\n\nimpl Add for u128 {\n fn add(self, other: u128) -> u128 {\n self + other\n }\n}\nimpl Add for u64 {\n fn add(self, other: u64) -> u64 {\n self + other\n }\n}\nimpl Add for u32 {\n fn add(self, other: u32) -> u32 {\n self + other\n }\n}\nimpl Add for u16 {\n fn add(self, other: u16) -> u16 {\n self + other\n }\n}\nimpl Add for u8 {\n fn add(self, other: u8) -> u8 {\n self + other\n }\n}\nimpl Add for u1 {\n fn add(self, other: u1) -> u1 {\n self + other\n }\n}\n\nimpl Add for i8 {\n fn add(self, other: i8) -> i8 {\n self + other\n }\n}\nimpl Add for i16 {\n fn add(self, other: i16) -> i16 {\n self + other\n }\n}\nimpl Add for i32 {\n fn add(self, other: i32) -> i32 {\n self + other\n }\n}\nimpl Add for i64 {\n fn add(self, other: i64) -> i64 {\n self + other\n }\n}\n\n// docs:start:sub-trait\npub trait Sub {\n fn sub(self, other: Self) -> Self;\n}\n// docs:end:sub-trait\n\nimpl Sub for Field {\n fn sub(self, other: Field) -> Field {\n self - other\n }\n}\n\nimpl Sub for u128 {\n fn sub(self, other: u128) -> u128 {\n self - other\n }\n}\nimpl Sub for u64 {\n fn sub(self, other: u64) -> u64 {\n self - other\n }\n}\nimpl Sub for u32 {\n fn sub(self, other: u32) -> u32 {\n self - other\n }\n}\nimpl Sub for u16 {\n fn sub(self, other: u16) -> u16 {\n self - other\n }\n}\nimpl Sub for u8 {\n fn sub(self, other: u8) -> u8 {\n self - other\n }\n}\nimpl Sub for u1 {\n fn sub(self, other: u1) -> u1 {\n self - other\n }\n}\n\nimpl Sub for i8 {\n fn sub(self, other: i8) -> i8 {\n self - other\n }\n}\nimpl Sub for i16 {\n fn sub(self, other: i16) -> i16 {\n self - other\n }\n}\nimpl Sub for i32 {\n fn sub(self, other: i32) -> i32 {\n self - other\n }\n}\nimpl Sub for i64 {\n fn sub(self, other: i64) -> i64 {\n self - other\n }\n}\n\n// docs:start:mul-trait\npub trait Mul {\n fn mul(self, other: Self) -> Self;\n}\n// docs:end:mul-trait\n\nimpl Mul for Field {\n fn mul(self, other: Field) -> Field {\n self * other\n }\n}\n\nimpl Mul for u128 {\n fn mul(self, other: u128) -> u128 {\n self * other\n }\n}\nimpl Mul for u64 {\n fn mul(self, other: u64) -> u64 {\n self * other\n }\n}\nimpl Mul for u32 {\n fn mul(self, other: u32) -> u32 {\n self * other\n }\n}\nimpl Mul for u16 {\n fn mul(self, other: u16) -> u16 {\n self * other\n }\n}\nimpl Mul for u8 {\n fn mul(self, other: u8) -> u8 {\n self * other\n }\n}\nimpl Mul for u1 {\n fn mul(self, other: u1) -> u1 {\n self * other\n }\n}\n\nimpl Mul for i8 {\n fn mul(self, other: i8) -> i8 {\n self * other\n }\n}\nimpl Mul for i16 {\n fn mul(self, other: i16) -> i16 {\n self * other\n }\n}\nimpl Mul for i32 {\n fn mul(self, other: i32) -> i32 {\n self * other\n }\n}\nimpl Mul for i64 {\n fn mul(self, other: i64) -> i64 {\n self * other\n }\n}\n\n// docs:start:div-trait\npub trait Div {\n fn div(self, other: Self) -> Self;\n}\n// docs:end:div-trait\n\nimpl Div for Field {\n fn div(self, other: Field) -> Field {\n self / other\n }\n}\n\nimpl Div for u128 {\n fn div(self, other: u128) -> u128 {\n self / other\n }\n}\nimpl Div for u64 {\n fn div(self, other: u64) -> u64 {\n self / other\n }\n}\nimpl Div for u32 {\n fn div(self, other: u32) -> u32 {\n self / other\n }\n}\nimpl Div for u16 {\n fn div(self, other: u16) -> u16 {\n self / other\n }\n}\nimpl Div for u8 {\n fn div(self, other: u8) -> u8 {\n self / other\n }\n}\nimpl Div for u1 {\n fn div(self, other: u1) -> u1 {\n self / other\n }\n}\n\nimpl Div for i8 {\n fn div(self, other: i8) -> i8 {\n self / other\n }\n}\nimpl Div for i16 {\n fn div(self, other: i16) -> i16 {\n self / other\n }\n}\nimpl Div for i32 {\n fn div(self, other: i32) -> i32 {\n self / other\n }\n}\nimpl Div for i64 {\n fn div(self, other: i64) -> i64 {\n self / other\n }\n}\n\n// docs:start:rem-trait\npub trait Rem {\n fn rem(self, other: Self) -> Self;\n}\n// docs:end:rem-trait\n\nimpl Rem for u128 {\n fn rem(self, other: u128) -> u128 {\n self % other\n }\n}\nimpl Rem for u64 {\n fn rem(self, other: u64) -> u64 {\n self % other\n }\n}\nimpl Rem for u32 {\n fn rem(self, other: u32) -> u32 {\n self % other\n }\n}\nimpl Rem for u16 {\n fn rem(self, other: u16) -> u16 {\n self % other\n }\n}\nimpl Rem for u8 {\n fn rem(self, other: u8) -> u8 {\n self % other\n }\n}\nimpl Rem for u1 {\n fn rem(self, other: u1) -> u1 {\n self % other\n }\n}\n\nimpl Rem for i8 {\n fn rem(self, other: i8) -> i8 {\n self % other\n }\n}\nimpl Rem for i16 {\n fn rem(self, other: i16) -> i16 {\n self % other\n }\n}\nimpl Rem for i32 {\n fn rem(self, other: i32) -> i32 {\n self % other\n }\n}\nimpl Rem for i64 {\n fn rem(self, other: i64) -> i64 {\n self % other\n }\n}\n\n// docs:start:neg-trait\npub trait Neg {\n fn neg(self) -> Self;\n}\n// docs:end:neg-trait\n\n// docs:start:neg-trait-impls\nimpl Neg for Field {\n fn neg(self) -> Field {\n -self\n }\n}\n\nimpl Neg for i8 {\n fn neg(self) -> i8 {\n -self\n }\n}\nimpl Neg for i16 {\n fn neg(self) -> i16 {\n -self\n }\n}\nimpl Neg for i32 {\n fn neg(self) -> i32 {\n -self\n }\n}\nimpl Neg for i64 {\n fn neg(self) -> i64 {\n -self\n }\n}\n// docs:end:neg-trait-impls\n\n// docs:start:wrapping-add-trait\npub trait WrappingAdd {\n fn wrapping_add(self, y: Self) -> Self;\n}\n// docs:end:wrapping-add-trait\n\nimpl WrappingAdd for u1 {\n fn wrapping_add(self: u1, y: u1) -> u1 {\n self ^ y\n }\n}\n\nimpl WrappingAdd for u8 {\n fn wrapping_add(self: u8, y: u8) -> u8 {\n wrapping_add_hlp(self, y)\n }\n}\n\nimpl WrappingAdd for u16 {\n fn wrapping_add(self: u16, y: u16) -> u16 {\n wrapping_add_hlp(self, y)\n }\n}\n\nimpl WrappingAdd for u32 {\n fn wrapping_add(self: u32, y: u32) -> u32 {\n wrapping_add_hlp(self, y)\n }\n}\n\nimpl WrappingAdd for u64 {\n fn wrapping_add(self: u64, y: u64) -> u64 {\n wrapping_add_hlp(self, y)\n }\n}\n\nimpl WrappingAdd for u128 {\n fn wrapping_add(self: u128, y: u128) -> u128 {\n wrapping_add_hlp(self, y)\n }\n}\n\nimpl WrappingAdd for i8 {\n fn wrapping_add(self: i8, y: i8) -> i8 {\n wrapping_add_hlp(self, y)\n }\n}\n\nimpl WrappingAdd for i16 {\n fn wrapping_add(self: i16, y: i16) -> i16 {\n wrapping_add_hlp(self, y)\n }\n}\n\nimpl WrappingAdd for i32 {\n fn wrapping_add(self: i32, y: i32) -> i32 {\n wrapping_add_hlp(self, y)\n }\n}\n\nimpl WrappingAdd for i64 {\n fn wrapping_add(self: i64, y: i64) -> i64 {\n wrapping_add_hlp(self, y)\n }\n}\nimpl WrappingAdd for Field {\n fn wrapping_add(self: Field, y: Field) -> Field {\n self + y\n }\n}\n\n// docs:start:wrapping-sub-trait\npub trait WrappingSub {\n fn wrapping_sub(self, y: Self) -> Self;\n}\n// docs:start:wrapping-sub-trait\n\nimpl WrappingSub for u1 {\n fn wrapping_sub(self: u1, y: u1) -> u1 {\n self ^ y\n }\n}\n\nimpl WrappingSub for u8 {\n fn wrapping_sub(self: u8, y: u8) -> u8 {\n wrapping_sub_hlp(self, y) as u8\n }\n}\n\nimpl WrappingSub for u16 {\n fn wrapping_sub(self: u16, y: u16) -> u16 {\n wrapping_sub_hlp(self, y) as u16\n }\n}\n\nimpl WrappingSub for u32 {\n fn wrapping_sub(self: u32, y: u32) -> u32 {\n wrapping_sub_hlp(self, y) as u32\n }\n}\nimpl WrappingSub for u64 {\n fn wrapping_sub(self: u64, y: u64) -> u64 {\n wrapping_sub_hlp(self, y) as u64\n }\n}\nimpl WrappingSub for u128 {\n fn wrapping_sub(self: u128, y: u128) -> u128 {\n wrapping_sub_hlp(self, y) as u128\n }\n}\n\nimpl WrappingSub for i8 {\n fn wrapping_sub(self: i8, y: i8) -> i8 {\n wrapping_sub_hlp(self, y) as i8\n }\n}\n\nimpl WrappingSub for i16 {\n fn wrapping_sub(self: i16, y: i16) -> i16 {\n wrapping_sub_hlp(self, y) as i16\n }\n}\n\nimpl WrappingSub for i32 {\n fn wrapping_sub(self: i32, y: i32) -> i32 {\n wrapping_sub_hlp(self, y) as i32\n }\n}\nimpl WrappingSub for i64 {\n fn wrapping_sub(self: i64, y: i64) -> i64 {\n wrapping_sub_hlp(self, y) as i64\n }\n}\nimpl WrappingSub for Field {\n fn wrapping_sub(self: Field, y: Field) -> Field {\n self - y\n }\n}\n\n// docs:start:wrapping-mul-trait\npub trait WrappingMul {\n fn wrapping_mul(self, y: Self) -> Self;\n}\n// docs:start:wrapping-mul-trait\n\nimpl WrappingMul for u1 {\n fn wrapping_mul(self: u1, y: u1) -> u1 {\n self & y\n }\n}\n\nimpl WrappingMul for u8 {\n fn wrapping_mul(self: u8, y: u8) -> u8 {\n wrapping_mul_hlp(self, y)\n }\n}\n\nimpl WrappingMul for u16 {\n fn wrapping_mul(self: u16, y: u16) -> u16 {\n wrapping_mul_hlp(self, y)\n }\n}\n\nimpl WrappingMul for u32 {\n fn wrapping_mul(self: u32, y: u32) -> u32 {\n wrapping_mul_hlp(self, y)\n }\n}\nimpl WrappingMul for u64 {\n fn wrapping_mul(self: u64, y: u64) -> u64 {\n wrapping_mul_hlp(self, y)\n }\n}\n\nimpl WrappingMul for i8 {\n fn wrapping_mul(self: i8, y: i8) -> i8 {\n wrapping_mul_hlp(self, y)\n }\n}\n\nimpl WrappingMul for i16 {\n fn wrapping_mul(self: i16, y: i16) -> i16 {\n wrapping_mul_hlp(self, y)\n }\n}\n\nimpl WrappingMul for i32 {\n fn wrapping_mul(self: i32, y: i32) -> i32 {\n wrapping_mul_hlp(self, y)\n }\n}\n\nimpl WrappingMul for i64 {\n fn wrapping_mul(self: i64, y: i64) -> i64 {\n wrapping_mul_hlp(self, y)\n }\n}\n\nimpl WrappingMul for u128 {\n fn wrapping_mul(self: u128, y: u128) -> u128 {\n wrapping_mul128_hlp(self, y)\n }\n}\nimpl WrappingMul for Field {\n fn wrapping_mul(self: Field, y: Field) -> Field {\n self * y\n }\n}\n\nfn wrapping_add_hlp(x: T, y: T) -> T\nwhere\n T: AsPrimitive,\n Field: AsPrimitive,\n{\n AsPrimitive::as_(x.as_() + y.as_())\n}\n\nfn wrapping_sub_hlp(x: T, y: T) -> Field\nwhere\n T: AsPrimitive,\n{\n //340282366920938463463374607431768211456 is 2^128, it is used to avoid underflow\n x.as_() + 340282366920938463463374607431768211456 - y.as_()\n}\n\nfn wrapping_mul_hlp(x: T, y: T) -> T\nwhere\n T: AsPrimitive,\n Field: AsPrimitive,\n{\n AsPrimitive::as_(x.as_() * y.as_())\n}\n\nglobal two_pow_64: u128 = 0x10000000000000000;\n/// Splits a 128 bits number into two 64 bits limbs\nunconstrained fn split64(x: u128) -> (u64, u64) {\n let lo = x as u64;\n let hi = (x / two_pow_64) as u64;\n (lo, hi)\n}\n\n/// Split a 128 bits number into two 64 bits limbs\n/// It will fail if the number is more than 128 bits\nfn split_into_64_bit_limbs(x: u128) -> (u64, u64) {\n // Safety: the limbs are constrained below\n let (x_lo, x_hi) = unsafe { split64(x) };\n assert(x as Field == x_lo as Field + x_hi as Field * two_pow_64 as Field);\n (x_lo, x_hi)\n}\n\n#[field(bn254)]\nfn wrapping_mul128_hlp(x: u128, y: u128) -> u128 {\n let (x_lo, x_hi) = split_into_64_bit_limbs(x);\n let (y_lo, y_hi) = split_into_64_bit_limbs(y);\n // Multiplication using the limbs:(x_lo + 2**64*x_hi)*(y_lo + 2**64*y_hi)=x_lo*y_lo+...\n // and skipping the terms over 2**128\n // Working with u64 limbs ensures that we cannot overflow the field modulus.\n let low = x_lo as Field * y_lo as Field;\n let lo = low as u64 as Field;\n let carry = (low - lo) / two_pow_64 as Field;\n let high = x_lo as Field * y_hi as Field + x_hi as Field * y_lo as Field + carry;\n let hi = high as u64 as Field;\n (lo + two_pow_64 as Field * hi) as u128\n}\n", diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/4_sub/execute__tests__force_brillig_false_inliner_9223372036854775807.snap b/tooling/nargo_cli/tests/snapshots/execution_success/4_sub/execute__tests__force_brillig_false_inliner_9223372036854775807.snap index 605d58780d1..ce9d7f21208 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/4_sub/execute__tests__force_brillig_false_inliner_9223372036854775807.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/4_sub/execute__tests__force_brillig_false_inliner_9223372036854775807.snap @@ -64,7 +64,7 @@ expression: artifact "unconstrained func 1", "[Const { destination: Direct(21), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(20), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(0), size_address: Direct(21), offset_address: Direct(20) }, Const { destination: Direct(2), bit_size: Field, value: 0 }, BinaryFieldOp { destination: Direct(3), op: Equals, lhs: Direct(0), rhs: Direct(2) }, JumpIf { condition: Direct(3), location: 8 }, Const { destination: Direct(1), bit_size: Field, value: 1 }, BinaryFieldOp { destination: Direct(0), op: Div, lhs: Direct(1), rhs: Direct(0) }, Stop { return_data: HeapVector { pointer: Direct(20), size: Direct(21) } }]" ], - "debug_symbols": "vVNBjoQgEPwLZw/QKKhf2WwMKk5ICBpGNtkY/76IMo4HJps5zKVKaKtSrd0L6mXrbo0yw3hH9deCWqu0VrdGj52Y1Wj87bJmKB6b2Urpr9BT3asmYaWZUW2c1hn6EdqFl+6TMIFnYX0VZ0ia3rM3HJSW29OanWqclhLGDjEpT3lx1ZO0nrMiPww449XDgVYXB3iRAAPjMQMGDikPmvagkEcLCgV5OBB4LwUl7K1OKKlOD8hTHuyDnUCyk//+1TLp8GquqjhXgOEyV9/+JDplL5uAKKr9p8sDFgFZQB6wDFgFJHgnshPstOtJvvW8brGsEq2Wx5YNznRPSzf/TrES13KyYyd7Z+UWK9R80D8=", + "debug_symbols": "vVNBjoQgEPwLZw/QKIhf2WwMKk5ICBpGN9kY/76IMo4HJps5zKUaaKpSDd0L6lQz32pt++GOqq8FNU4bo2+1GVo56cH602XNUNzWk1PKH6GnvGeN0ik7ocrOxmToR5o5XLqP0oY4SeezOEPKdj56wV4bta3W7GTjNJUwdpBJedKLK5+k+ZwV+SHAGRcPBSouCvDCAQbGowcMHFIaNK1BQcQ38Mv8oUDgPReUsLcqoUScGpCnNNgHK4FkJf/91TKp8KqvROwrwHDpq2+/k612l0lAFFX+6fKARUAWkAcsA4qABO+B7AH2sPNJvtW8braclo1Rx5T1s22fhm76HWMmjuXohlZ1s1ObrZDzRv8A", "file_map": { "39": { "source": "use crate::convert::AsPrimitive;\n\n// docs:start:add-trait\npub trait Add {\n fn add(self, other: Self) -> Self;\n}\n// docs:end:add-trait\n\nimpl Add for Field {\n fn add(self, other: Field) -> Field {\n self + other\n }\n}\n\nimpl Add for u128 {\n fn add(self, other: u128) -> u128 {\n self + other\n }\n}\nimpl Add for u64 {\n fn add(self, other: u64) -> u64 {\n self + other\n }\n}\nimpl Add for u32 {\n fn add(self, other: u32) -> u32 {\n self + other\n }\n}\nimpl Add for u16 {\n fn add(self, other: u16) -> u16 {\n self + other\n }\n}\nimpl Add for u8 {\n fn add(self, other: u8) -> u8 {\n self + other\n }\n}\nimpl Add for u1 {\n fn add(self, other: u1) -> u1 {\n self + other\n }\n}\n\nimpl Add for i8 {\n fn add(self, other: i8) -> i8 {\n self + other\n }\n}\nimpl Add for i16 {\n fn add(self, other: i16) -> i16 {\n self + other\n }\n}\nimpl Add for i32 {\n fn add(self, other: i32) -> i32 {\n self + other\n }\n}\nimpl Add for i64 {\n fn add(self, other: i64) -> i64 {\n self + other\n }\n}\n\n// docs:start:sub-trait\npub trait Sub {\n fn sub(self, other: Self) -> Self;\n}\n// docs:end:sub-trait\n\nimpl Sub for Field {\n fn sub(self, other: Field) -> Field {\n self - other\n }\n}\n\nimpl Sub for u128 {\n fn sub(self, other: u128) -> u128 {\n self - other\n }\n}\nimpl Sub for u64 {\n fn sub(self, other: u64) -> u64 {\n self - other\n }\n}\nimpl Sub for u32 {\n fn sub(self, other: u32) -> u32 {\n self - other\n }\n}\nimpl Sub for u16 {\n fn sub(self, other: u16) -> u16 {\n self - other\n }\n}\nimpl Sub for u8 {\n fn sub(self, other: u8) -> u8 {\n self - other\n }\n}\nimpl Sub for u1 {\n fn sub(self, other: u1) -> u1 {\n self - other\n }\n}\n\nimpl Sub for i8 {\n fn sub(self, other: i8) -> i8 {\n self - other\n }\n}\nimpl Sub for i16 {\n fn sub(self, other: i16) -> i16 {\n self - other\n }\n}\nimpl Sub for i32 {\n fn sub(self, other: i32) -> i32 {\n self - other\n }\n}\nimpl Sub for i64 {\n fn sub(self, other: i64) -> i64 {\n self - other\n }\n}\n\n// docs:start:mul-trait\npub trait Mul {\n fn mul(self, other: Self) -> Self;\n}\n// docs:end:mul-trait\n\nimpl Mul for Field {\n fn mul(self, other: Field) -> Field {\n self * other\n }\n}\n\nimpl Mul for u128 {\n fn mul(self, other: u128) -> u128 {\n self * other\n }\n}\nimpl Mul for u64 {\n fn mul(self, other: u64) -> u64 {\n self * other\n }\n}\nimpl Mul for u32 {\n fn mul(self, other: u32) -> u32 {\n self * other\n }\n}\nimpl Mul for u16 {\n fn mul(self, other: u16) -> u16 {\n self * other\n }\n}\nimpl Mul for u8 {\n fn mul(self, other: u8) -> u8 {\n self * other\n }\n}\nimpl Mul for u1 {\n fn mul(self, other: u1) -> u1 {\n self * other\n }\n}\n\nimpl Mul for i8 {\n fn mul(self, other: i8) -> i8 {\n self * other\n }\n}\nimpl Mul for i16 {\n fn mul(self, other: i16) -> i16 {\n self * other\n }\n}\nimpl Mul for i32 {\n fn mul(self, other: i32) -> i32 {\n self * other\n }\n}\nimpl Mul for i64 {\n fn mul(self, other: i64) -> i64 {\n self * other\n }\n}\n\n// docs:start:div-trait\npub trait Div {\n fn div(self, other: Self) -> Self;\n}\n// docs:end:div-trait\n\nimpl Div for Field {\n fn div(self, other: Field) -> Field {\n self / other\n }\n}\n\nimpl Div for u128 {\n fn div(self, other: u128) -> u128 {\n self / other\n }\n}\nimpl Div for u64 {\n fn div(self, other: u64) -> u64 {\n self / other\n }\n}\nimpl Div for u32 {\n fn div(self, other: u32) -> u32 {\n self / other\n }\n}\nimpl Div for u16 {\n fn div(self, other: u16) -> u16 {\n self / other\n }\n}\nimpl Div for u8 {\n fn div(self, other: u8) -> u8 {\n self / other\n }\n}\nimpl Div for u1 {\n fn div(self, other: u1) -> u1 {\n self / other\n }\n}\n\nimpl Div for i8 {\n fn div(self, other: i8) -> i8 {\n self / other\n }\n}\nimpl Div for i16 {\n fn div(self, other: i16) -> i16 {\n self / other\n }\n}\nimpl Div for i32 {\n fn div(self, other: i32) -> i32 {\n self / other\n }\n}\nimpl Div for i64 {\n fn div(self, other: i64) -> i64 {\n self / other\n }\n}\n\n// docs:start:rem-trait\npub trait Rem {\n fn rem(self, other: Self) -> Self;\n}\n// docs:end:rem-trait\n\nimpl Rem for u128 {\n fn rem(self, other: u128) -> u128 {\n self % other\n }\n}\nimpl Rem for u64 {\n fn rem(self, other: u64) -> u64 {\n self % other\n }\n}\nimpl Rem for u32 {\n fn rem(self, other: u32) -> u32 {\n self % other\n }\n}\nimpl Rem for u16 {\n fn rem(self, other: u16) -> u16 {\n self % other\n }\n}\nimpl Rem for u8 {\n fn rem(self, other: u8) -> u8 {\n self % other\n }\n}\nimpl Rem for u1 {\n fn rem(self, other: u1) -> u1 {\n self % other\n }\n}\n\nimpl Rem for i8 {\n fn rem(self, other: i8) -> i8 {\n self % other\n }\n}\nimpl Rem for i16 {\n fn rem(self, other: i16) -> i16 {\n self % other\n }\n}\nimpl Rem for i32 {\n fn rem(self, other: i32) -> i32 {\n self % other\n }\n}\nimpl Rem for i64 {\n fn rem(self, other: i64) -> i64 {\n self % other\n }\n}\n\n// docs:start:neg-trait\npub trait Neg {\n fn neg(self) -> Self;\n}\n// docs:end:neg-trait\n\n// docs:start:neg-trait-impls\nimpl Neg for Field {\n fn neg(self) -> Field {\n -self\n }\n}\n\nimpl Neg for i8 {\n fn neg(self) -> i8 {\n -self\n }\n}\nimpl Neg for i16 {\n fn neg(self) -> i16 {\n -self\n }\n}\nimpl Neg for i32 {\n fn neg(self) -> i32 {\n -self\n }\n}\nimpl Neg for i64 {\n fn neg(self) -> i64 {\n -self\n }\n}\n// docs:end:neg-trait-impls\n\n// docs:start:wrapping-add-trait\npub trait WrappingAdd {\n fn wrapping_add(self, y: Self) -> Self;\n}\n// docs:end:wrapping-add-trait\n\nimpl WrappingAdd for u1 {\n fn wrapping_add(self: u1, y: u1) -> u1 {\n self ^ y\n }\n}\n\nimpl WrappingAdd for u8 {\n fn wrapping_add(self: u8, y: u8) -> u8 {\n wrapping_add_hlp(self, y)\n }\n}\n\nimpl WrappingAdd for u16 {\n fn wrapping_add(self: u16, y: u16) -> u16 {\n wrapping_add_hlp(self, y)\n }\n}\n\nimpl WrappingAdd for u32 {\n fn wrapping_add(self: u32, y: u32) -> u32 {\n wrapping_add_hlp(self, y)\n }\n}\n\nimpl WrappingAdd for u64 {\n fn wrapping_add(self: u64, y: u64) -> u64 {\n wrapping_add_hlp(self, y)\n }\n}\n\nimpl WrappingAdd for u128 {\n fn wrapping_add(self: u128, y: u128) -> u128 {\n wrapping_add_hlp(self, y)\n }\n}\n\nimpl WrappingAdd for i8 {\n fn wrapping_add(self: i8, y: i8) -> i8 {\n wrapping_add_hlp(self, y)\n }\n}\n\nimpl WrappingAdd for i16 {\n fn wrapping_add(self: i16, y: i16) -> i16 {\n wrapping_add_hlp(self, y)\n }\n}\n\nimpl WrappingAdd for i32 {\n fn wrapping_add(self: i32, y: i32) -> i32 {\n wrapping_add_hlp(self, y)\n }\n}\n\nimpl WrappingAdd for i64 {\n fn wrapping_add(self: i64, y: i64) -> i64 {\n wrapping_add_hlp(self, y)\n }\n}\nimpl WrappingAdd for Field {\n fn wrapping_add(self: Field, y: Field) -> Field {\n self + y\n }\n}\n\n// docs:start:wrapping-sub-trait\npub trait WrappingSub {\n fn wrapping_sub(self, y: Self) -> Self;\n}\n// docs:start:wrapping-sub-trait\n\nimpl WrappingSub for u1 {\n fn wrapping_sub(self: u1, y: u1) -> u1 {\n self ^ y\n }\n}\n\nimpl WrappingSub for u8 {\n fn wrapping_sub(self: u8, y: u8) -> u8 {\n wrapping_sub_hlp(self, y) as u8\n }\n}\n\nimpl WrappingSub for u16 {\n fn wrapping_sub(self: u16, y: u16) -> u16 {\n wrapping_sub_hlp(self, y) as u16\n }\n}\n\nimpl WrappingSub for u32 {\n fn wrapping_sub(self: u32, y: u32) -> u32 {\n wrapping_sub_hlp(self, y) as u32\n }\n}\nimpl WrappingSub for u64 {\n fn wrapping_sub(self: u64, y: u64) -> u64 {\n wrapping_sub_hlp(self, y) as u64\n }\n}\nimpl WrappingSub for u128 {\n fn wrapping_sub(self: u128, y: u128) -> u128 {\n wrapping_sub_hlp(self, y) as u128\n }\n}\n\nimpl WrappingSub for i8 {\n fn wrapping_sub(self: i8, y: i8) -> i8 {\n wrapping_sub_hlp(self, y) as i8\n }\n}\n\nimpl WrappingSub for i16 {\n fn wrapping_sub(self: i16, y: i16) -> i16 {\n wrapping_sub_hlp(self, y) as i16\n }\n}\n\nimpl WrappingSub for i32 {\n fn wrapping_sub(self: i32, y: i32) -> i32 {\n wrapping_sub_hlp(self, y) as i32\n }\n}\nimpl WrappingSub for i64 {\n fn wrapping_sub(self: i64, y: i64) -> i64 {\n wrapping_sub_hlp(self, y) as i64\n }\n}\nimpl WrappingSub for Field {\n fn wrapping_sub(self: Field, y: Field) -> Field {\n self - y\n }\n}\n\n// docs:start:wrapping-mul-trait\npub trait WrappingMul {\n fn wrapping_mul(self, y: Self) -> Self;\n}\n// docs:start:wrapping-mul-trait\n\nimpl WrappingMul for u1 {\n fn wrapping_mul(self: u1, y: u1) -> u1 {\n self & y\n }\n}\n\nimpl WrappingMul for u8 {\n fn wrapping_mul(self: u8, y: u8) -> u8 {\n wrapping_mul_hlp(self, y)\n }\n}\n\nimpl WrappingMul for u16 {\n fn wrapping_mul(self: u16, y: u16) -> u16 {\n wrapping_mul_hlp(self, y)\n }\n}\n\nimpl WrappingMul for u32 {\n fn wrapping_mul(self: u32, y: u32) -> u32 {\n wrapping_mul_hlp(self, y)\n }\n}\nimpl WrappingMul for u64 {\n fn wrapping_mul(self: u64, y: u64) -> u64 {\n wrapping_mul_hlp(self, y)\n }\n}\n\nimpl WrappingMul for i8 {\n fn wrapping_mul(self: i8, y: i8) -> i8 {\n wrapping_mul_hlp(self, y)\n }\n}\n\nimpl WrappingMul for i16 {\n fn wrapping_mul(self: i16, y: i16) -> i16 {\n wrapping_mul_hlp(self, y)\n }\n}\n\nimpl WrappingMul for i32 {\n fn wrapping_mul(self: i32, y: i32) -> i32 {\n wrapping_mul_hlp(self, y)\n }\n}\n\nimpl WrappingMul for i64 {\n fn wrapping_mul(self: i64, y: i64) -> i64 {\n wrapping_mul_hlp(self, y)\n }\n}\n\nimpl WrappingMul for u128 {\n fn wrapping_mul(self: u128, y: u128) -> u128 {\n wrapping_mul128_hlp(self, y)\n }\n}\nimpl WrappingMul for Field {\n fn wrapping_mul(self: Field, y: Field) -> Field {\n self * y\n }\n}\n\nfn wrapping_add_hlp(x: T, y: T) -> T\nwhere\n T: AsPrimitive,\n Field: AsPrimitive,\n{\n AsPrimitive::as_(x.as_() + y.as_())\n}\n\nfn wrapping_sub_hlp(x: T, y: T) -> Field\nwhere\n T: AsPrimitive,\n{\n //340282366920938463463374607431768211456 is 2^128, it is used to avoid underflow\n x.as_() + 340282366920938463463374607431768211456 - y.as_()\n}\n\nfn wrapping_mul_hlp(x: T, y: T) -> T\nwhere\n T: AsPrimitive,\n Field: AsPrimitive,\n{\n AsPrimitive::as_(x.as_() * y.as_())\n}\n\nglobal two_pow_64: u128 = 0x10000000000000000;\n/// Splits a 128 bits number into two 64 bits limbs\nunconstrained fn split64(x: u128) -> (u64, u64) {\n let lo = x as u64;\n let hi = (x / two_pow_64) as u64;\n (lo, hi)\n}\n\n/// Split a 128 bits number into two 64 bits limbs\n/// It will fail if the number is more than 128 bits\nfn split_into_64_bit_limbs(x: u128) -> (u64, u64) {\n // Safety: the limbs are constrained below\n let (x_lo, x_hi) = unsafe { split64(x) };\n assert(x as Field == x_lo as Field + x_hi as Field * two_pow_64 as Field);\n (x_lo, x_hi)\n}\n\n#[field(bn254)]\nfn wrapping_mul128_hlp(x: u128, y: u128) -> u128 {\n let (x_lo, x_hi) = split_into_64_bit_limbs(x);\n let (y_lo, y_hi) = split_into_64_bit_limbs(y);\n // Multiplication using the limbs:(x_lo + 2**64*x_hi)*(y_lo + 2**64*y_hi)=x_lo*y_lo+...\n // and skipping the terms over 2**128\n // Working with u64 limbs ensures that we cannot overflow the field modulus.\n let low = x_lo as Field * y_lo as Field;\n let lo = low as u64 as Field;\n let carry = (low - lo) / two_pow_64 as Field;\n let high = x_lo as Field * y_hi as Field + x_hi as Field * y_lo as Field + carry;\n let hi = high as u64 as Field;\n (lo + two_pow_64 as Field * hi) as u128\n}\n", diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/4_sub/execute__tests__force_brillig_true_inliner_-9223372036854775808.snap b/tooling/nargo_cli/tests/snapshots/execution_success/4_sub/execute__tests__force_brillig_true_inliner_-9223372036854775808.snap index 25aab164216..48f4faacd27 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/4_sub/execute__tests__force_brillig_true_inliner_-9223372036854775808.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/4_sub/execute__tests__force_brillig_true_inliner_-9223372036854775808.snap @@ -53,10 +53,10 @@ expression: artifact "unconstrained func 0", "[Const { destination: Direct(2), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(1), bit_size: Integer(U32), value: 32839 }, Const { destination: Direct(0), bit_size: Integer(U32), value: 3 }, Const { destination: Relative(4), bit_size: Integer(U32), value: 3 }, Const { destination: Relative(5), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(32836), size_address: Relative(4), offset_address: Relative(5) }, Cast { destination: Direct(32836), source: Direct(32836), bit_size: Integer(U32) }, Cast { destination: Direct(32837), source: Direct(32837), bit_size: Integer(U32) }, Cast { destination: Direct(32838), source: Direct(32838), bit_size: Integer(U32) }, Mov { destination: Relative(1), source: Direct(32836) }, Mov { destination: Relative(2), source: Direct(32837) }, Mov { destination: Relative(3), source: Direct(32838) }, Call { location: 17 }, Call { location: 18 }, Const { destination: Relative(1), bit_size: Integer(U32), value: 32839 }, Const { destination: Relative(2), bit_size: Integer(U32), value: 0 }, Stop { return_data: HeapVector { pointer: Relative(1), size: Relative(2) } }, Return, Call { location: 32 }, Cast { destination: Relative(4), source: Relative(1), bit_size: Field }, Const { destination: Relative(1), bit_size: Field, value: 340282366920938463463374607431768211456 }, BinaryFieldOp { destination: Relative(5), op: Add, lhs: Relative(4), rhs: Relative(1) }, Cast { destination: Relative(1), source: Relative(2), bit_size: Field }, BinaryFieldOp { destination: Relative(2), op: Sub, lhs: Relative(5), rhs: Relative(1) }, Cast { destination: Relative(4), source: Relative(2), bit_size: Integer(U32) }, Cast { destination: Relative(1), source: Relative(4), bit_size: Field }, Cast { destination: Relative(2), source: Relative(1), bit_size: Integer(U32) }, BinaryIntOp { destination: Relative(1), op: Equals, bit_size: U32, lhs: Relative(2), rhs: Relative(3) }, JumpIf { condition: Relative(1), location: 31 }, Const { destination: Relative(4), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(4) } }, 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: 37 }, IndirectConst { destination_pointer: Direct(1), bit_size: Integer(U64), value: 17843811134343075018 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return]" ], - "debug_symbols": "vZPBjoMgEED/hbMHGBSEX2mahlrakBA0VDfZNP77DlWrHmg2PfTCE3HeDHHmQS72PNxOLlzbO9GHBzlH5727nXzbmN61Ad8+CE0LU0SXBQHcVAg2AYiWCE50jSiJVohqgpggiWYUWc9UEzlNHMeCLLlOfbQ2pdokx5I6E23oiQ6D9wX5MX54fnTvTHiyNxFP0WjDBYnCq/M2PY3FGk3zoUyIOZjVa3i1j2f5eCmqchZIIdXLwNXOAG8qoCDkUgMFCTkHzzs4lIuCQ8VeBgafVcGZ+OgmnKnVAWXOIb54E8je5L9/tc4a3vWVWvoKKOz66og707i4G7MxmaIzZ2/n7XUIzea0/+2Wk2VMu9g29jJEm0ybWcX1wKHg8jimbH8=", + "debug_symbols": "vZPBjoMgEED/hbMHGBSEX2mahlrakBA0VDfZNP77DlWrHmg2PfTCA3HeDMo8yMWeh9vJhWt7J/rwIOfovHe3k28b07s24NMHoWlgiuiyIICLCsEmANESwYmuESXRClFNEBMk0Ywi65lqIqeJ41iQJdepj9amVJvkWFJnog090WHwviA/xg/Pl+6dCU/2JuIuGm24IFF4dd6m2Vis0TQfyoSYg1m9hlf7eJaPl6IqZ4EUUr0MXO0M8KYCCkIuNVCQkHPwvIODWr4BTsuXgcFnVXAmPjoJZ2p1QJlziC+eBLIn+e9frbOGd/dKLfcKKOzu1RFXpnFx12ZjMkVnzt7Oy+sQms1u/9stO0ubdrFt7GWINpk2vYrjgUPB5XFM2f4A", "file_map": { "12": { - "source": "// docs:start:from-trait\npub trait From {\n fn from(input: T) -> Self;\n}\n// docs:end:from-trait\n\nimpl From for T {\n fn from(input: T) -> T {\n input\n }\n}\n\n// docs:start:into-trait\npub trait Into {\n fn into(self) -> T;\n}\n\nimpl Into for U\nwhere\n T: From,\n{\n fn into(self) -> T {\n T::from(self)\n }\n}\n// docs:end:into-trait\n\n// docs:start:from-impls\n// Unsigned integers\n\nimpl From for u32 {\n fn from(value: u8) -> u32 {\n value as u32\n }\n}\n\nimpl From for u64 {\n fn from(value: u8) -> u64 {\n value as u64\n }\n}\nimpl From for u64 {\n fn from(value: u32) -> u64 {\n value as u64\n }\n}\n\nimpl From for u128 {\n fn from(value: u8) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u32) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u64) -> u128 {\n value as u128\n }\n}\n\nimpl From for Field {\n fn from(value: u8) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u32) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u64) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u128) -> Field {\n value as Field\n }\n}\n\n// Signed integers\n\nimpl From for i32 {\n fn from(value: i8) -> i32 {\n value as i32\n }\n}\n\nimpl From for i64 {\n fn from(value: i8) -> i64 {\n value as i64\n }\n}\nimpl From for i64 {\n fn from(value: i32) -> i64 {\n value as i64\n }\n}\n\n// Booleans\nimpl From for u8 {\n fn from(value: bool) -> u8 {\n value as u8\n }\n}\nimpl From for u32 {\n fn from(value: bool) -> u32 {\n value as u32\n }\n}\nimpl From for u64 {\n fn from(value: bool) -> u64 {\n value as u64\n }\n}\nimpl From for i8 {\n fn from(value: bool) -> i8 {\n value as i8\n }\n}\nimpl From for i32 {\n fn from(value: bool) -> i32 {\n value as i32\n }\n}\nimpl From for i64 {\n fn from(value: bool) -> i64 {\n value as i64\n }\n}\nimpl From for Field {\n fn from(value: bool) -> Field {\n value as Field\n }\n}\n// docs:end:from-impls\n\n/// A generic interface for casting between primitive types,\n/// equivalent of using the `as` keyword between values.\n///\n/// # Example\n///\n/// ```\n/// let x: Field = 1234567890;\n/// let y: u8 = x as u8;\n/// let z: u8 = x.as_();\n/// assert_eq(y, z);\n/// ```\npub trait AsPrimitive {\n /// The equivalent of doing `self as T`.\n fn as_(self) -> T;\n}\n\n#[generate_as_primitive_impls]\ncomptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted {\n let types = [\n quote { bool },\n quote { u8 },\n quote { u16 },\n quote { u32 },\n quote { u64 },\n quote { u128 },\n quote { i8 },\n quote { i16 },\n quote { i32 },\n quote { i64 },\n quote { Field },\n ];\n\n let mut impls = &[];\n for type1 in types {\n for type2 in types {\n let trait_impl = quote {\n impl AsPrimitive<$type1> for $type2 {\n fn as_(self) -> $type1 {\n self as $type1\n }\n }\n };\n\n impls = impls.push_back(trait_impl);\n }\n }\n impls.join(quote {})\n}\n", + "source": "// docs:start:from-trait\npub trait From {\n fn from(input: T) -> Self;\n}\n// docs:end:from-trait\n\nimpl From for T {\n fn from(input: T) -> T {\n input\n }\n}\n\n// docs:start:into-trait\npub trait Into {\n fn into(self) -> T;\n}\n\nimpl Into for U\nwhere\n T: From,\n{\n fn into(self) -> T {\n T::from(self)\n }\n}\n// docs:end:into-trait\n\n// docs:start:from-impls\n// Unsigned integers\n\nimpl From for u32 {\n fn from(value: u8) -> u32 {\n value as u32\n }\n}\n\nimpl From for u64 {\n fn from(value: u8) -> u64 {\n value as u64\n }\n}\nimpl From for u64 {\n fn from(value: u32) -> u64 {\n value as u64\n }\n}\n\nimpl From for u128 {\n fn from(value: u8) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u32) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u64) -> u128 {\n value as u128\n }\n}\n\nimpl From for Field {\n fn from(value: u8) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u32) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u64) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u128) -> Field {\n value as Field\n }\n}\n\n// Signed integers\n\nimpl From for i32 {\n fn from(value: i8) -> i32 {\n value as i32\n }\n}\n\nimpl From for i64 {\n fn from(value: i8) -> i64 {\n value as i64\n }\n}\nimpl From for i64 {\n fn from(value: i32) -> i64 {\n value as i64\n }\n}\n\n// Booleans\nimpl From for u8 {\n fn from(value: bool) -> u8 {\n value as u8\n }\n}\nimpl From for u32 {\n fn from(value: bool) -> u32 {\n value as u32\n }\n}\nimpl From for u64 {\n fn from(value: bool) -> u64 {\n value as u64\n }\n}\nimpl From for i8 {\n fn from(value: bool) -> i8 {\n value as i8\n }\n}\nimpl From for i32 {\n fn from(value: bool) -> i32 {\n value as i32\n }\n}\nimpl From for i64 {\n fn from(value: bool) -> i64 {\n value as i64\n }\n}\nimpl From for Field {\n fn from(value: bool) -> Field {\n value as Field\n }\n}\n// docs:end:from-impls\n\n/// A generic interface for casting between primitive types,\n/// equivalent of using the `as` keyword between values.\n///\n/// # Example\n///\n/// ```\n/// let x: Field = 1234567890;\n/// let y: u8 = x as u8;\n/// let z: u8 = x.as_();\n/// assert_eq(y, z);\n/// ```\npub trait AsPrimitive {\n /// The equivalent of doing `self as T`.\n fn as_(self) -> T;\n}\n\n#[generate_as_primitive_impls]\ncomptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted {\n let types = [\n quote { bool },\n quote { u8 },\n quote { u16 },\n quote { u32 },\n quote { u64 },\n quote { u128 },\n quote { i8 },\n quote { i16 },\n quote { i32 },\n quote { i64 },\n quote { Field },\n ];\n\n let mut impls = &[];\n for type1 in types {\n for type2 in types {\n let body = if type1 == type2 {\n quote { self }\n } else if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for $type2 {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n }\n impls.join(quote {})\n}\n", "path": "std/convert.nr" }, "39": { diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/4_sub/execute__tests__force_brillig_true_inliner_0.snap b/tooling/nargo_cli/tests/snapshots/execution_success/4_sub/execute__tests__force_brillig_true_inliner_0.snap index 25aab164216..48f4faacd27 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/4_sub/execute__tests__force_brillig_true_inliner_0.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/4_sub/execute__tests__force_brillig_true_inliner_0.snap @@ -53,10 +53,10 @@ expression: artifact "unconstrained func 0", "[Const { destination: Direct(2), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(1), bit_size: Integer(U32), value: 32839 }, Const { destination: Direct(0), bit_size: Integer(U32), value: 3 }, Const { destination: Relative(4), bit_size: Integer(U32), value: 3 }, Const { destination: Relative(5), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(32836), size_address: Relative(4), offset_address: Relative(5) }, Cast { destination: Direct(32836), source: Direct(32836), bit_size: Integer(U32) }, Cast { destination: Direct(32837), source: Direct(32837), bit_size: Integer(U32) }, Cast { destination: Direct(32838), source: Direct(32838), bit_size: Integer(U32) }, Mov { destination: Relative(1), source: Direct(32836) }, Mov { destination: Relative(2), source: Direct(32837) }, Mov { destination: Relative(3), source: Direct(32838) }, Call { location: 17 }, Call { location: 18 }, Const { destination: Relative(1), bit_size: Integer(U32), value: 32839 }, Const { destination: Relative(2), bit_size: Integer(U32), value: 0 }, Stop { return_data: HeapVector { pointer: Relative(1), size: Relative(2) } }, Return, Call { location: 32 }, Cast { destination: Relative(4), source: Relative(1), bit_size: Field }, Const { destination: Relative(1), bit_size: Field, value: 340282366920938463463374607431768211456 }, BinaryFieldOp { destination: Relative(5), op: Add, lhs: Relative(4), rhs: Relative(1) }, Cast { destination: Relative(1), source: Relative(2), bit_size: Field }, BinaryFieldOp { destination: Relative(2), op: Sub, lhs: Relative(5), rhs: Relative(1) }, Cast { destination: Relative(4), source: Relative(2), bit_size: Integer(U32) }, Cast { destination: Relative(1), source: Relative(4), bit_size: Field }, Cast { destination: Relative(2), source: Relative(1), bit_size: Integer(U32) }, BinaryIntOp { destination: Relative(1), op: Equals, bit_size: U32, lhs: Relative(2), rhs: Relative(3) }, JumpIf { condition: Relative(1), location: 31 }, Const { destination: Relative(4), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(4) } }, 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: 37 }, IndirectConst { destination_pointer: Direct(1), bit_size: Integer(U64), value: 17843811134343075018 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return]" ], - "debug_symbols": "vZPBjoMgEED/hbMHGBSEX2mahlrakBA0VDfZNP77DlWrHmg2PfTCE3HeDHHmQS72PNxOLlzbO9GHBzlH5727nXzbmN61Ad8+CE0LU0SXBQHcVAg2AYiWCE50jSiJVohqgpggiWYUWc9UEzlNHMeCLLlOfbQ2pdokx5I6E23oiQ6D9wX5MX54fnTvTHiyNxFP0WjDBYnCq/M2PY3FGk3zoUyIOZjVa3i1j2f5eCmqchZIIdXLwNXOAG8qoCDkUgMFCTkHzzs4lIuCQ8VeBgafVcGZ+OgmnKnVAWXOIb54E8je5L9/tc4a3vWVWvoKKOz66og707i4G7MxmaIzZ2/n7XUIzea0/+2Wk2VMu9g29jJEm0ybWcX1wKHg8jimbH8=", + "debug_symbols": "vZPBjoMgEED/hbMHGBSEX2mahlrakBA0VDfZNP77DlWrHmg2PfTCA3HeDMo8yMWeh9vJhWt7J/rwIOfovHe3k28b07s24NMHoWlgiuiyIICLCsEmANESwYmuESXRClFNEBMk0Ywi65lqIqeJ41iQJdepj9amVJvkWFJnog090WHwviA/xg/Pl+6dCU/2JuIuGm24IFF4dd6m2Vis0TQfyoSYg1m9hlf7eJaPl6IqZ4EUUr0MXO0M8KYCCkIuNVCQkHPwvIODWr4BTsuXgcFnVXAmPjoJZ2p1QJlziC+eBLIn+e9frbOGd/dKLfcKKOzu1RFXpnFx12ZjMkVnzt7Oy+sQms1u/9stO0ubdrFt7GWINpk2vYrjgUPB5XFM2f4A", "file_map": { "12": { - "source": "// docs:start:from-trait\npub trait From {\n fn from(input: T) -> Self;\n}\n// docs:end:from-trait\n\nimpl From for T {\n fn from(input: T) -> T {\n input\n }\n}\n\n// docs:start:into-trait\npub trait Into {\n fn into(self) -> T;\n}\n\nimpl Into for U\nwhere\n T: From,\n{\n fn into(self) -> T {\n T::from(self)\n }\n}\n// docs:end:into-trait\n\n// docs:start:from-impls\n// Unsigned integers\n\nimpl From for u32 {\n fn from(value: u8) -> u32 {\n value as u32\n }\n}\n\nimpl From for u64 {\n fn from(value: u8) -> u64 {\n value as u64\n }\n}\nimpl From for u64 {\n fn from(value: u32) -> u64 {\n value as u64\n }\n}\n\nimpl From for u128 {\n fn from(value: u8) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u32) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u64) -> u128 {\n value as u128\n }\n}\n\nimpl From for Field {\n fn from(value: u8) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u32) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u64) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u128) -> Field {\n value as Field\n }\n}\n\n// Signed integers\n\nimpl From for i32 {\n fn from(value: i8) -> i32 {\n value as i32\n }\n}\n\nimpl From for i64 {\n fn from(value: i8) -> i64 {\n value as i64\n }\n}\nimpl From for i64 {\n fn from(value: i32) -> i64 {\n value as i64\n }\n}\n\n// Booleans\nimpl From for u8 {\n fn from(value: bool) -> u8 {\n value as u8\n }\n}\nimpl From for u32 {\n fn from(value: bool) -> u32 {\n value as u32\n }\n}\nimpl From for u64 {\n fn from(value: bool) -> u64 {\n value as u64\n }\n}\nimpl From for i8 {\n fn from(value: bool) -> i8 {\n value as i8\n }\n}\nimpl From for i32 {\n fn from(value: bool) -> i32 {\n value as i32\n }\n}\nimpl From for i64 {\n fn from(value: bool) -> i64 {\n value as i64\n }\n}\nimpl From for Field {\n fn from(value: bool) -> Field {\n value as Field\n }\n}\n// docs:end:from-impls\n\n/// A generic interface for casting between primitive types,\n/// equivalent of using the `as` keyword between values.\n///\n/// # Example\n///\n/// ```\n/// let x: Field = 1234567890;\n/// let y: u8 = x as u8;\n/// let z: u8 = x.as_();\n/// assert_eq(y, z);\n/// ```\npub trait AsPrimitive {\n /// The equivalent of doing `self as T`.\n fn as_(self) -> T;\n}\n\n#[generate_as_primitive_impls]\ncomptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted {\n let types = [\n quote { bool },\n quote { u8 },\n quote { u16 },\n quote { u32 },\n quote { u64 },\n quote { u128 },\n quote { i8 },\n quote { i16 },\n quote { i32 },\n quote { i64 },\n quote { Field },\n ];\n\n let mut impls = &[];\n for type1 in types {\n for type2 in types {\n let trait_impl = quote {\n impl AsPrimitive<$type1> for $type2 {\n fn as_(self) -> $type1 {\n self as $type1\n }\n }\n };\n\n impls = impls.push_back(trait_impl);\n }\n }\n impls.join(quote {})\n}\n", + "source": "// docs:start:from-trait\npub trait From {\n fn from(input: T) -> Self;\n}\n// docs:end:from-trait\n\nimpl From for T {\n fn from(input: T) -> T {\n input\n }\n}\n\n// docs:start:into-trait\npub trait Into {\n fn into(self) -> T;\n}\n\nimpl Into for U\nwhere\n T: From,\n{\n fn into(self) -> T {\n T::from(self)\n }\n}\n// docs:end:into-trait\n\n// docs:start:from-impls\n// Unsigned integers\n\nimpl From for u32 {\n fn from(value: u8) -> u32 {\n value as u32\n }\n}\n\nimpl From for u64 {\n fn from(value: u8) -> u64 {\n value as u64\n }\n}\nimpl From for u64 {\n fn from(value: u32) -> u64 {\n value as u64\n }\n}\n\nimpl From for u128 {\n fn from(value: u8) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u32) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u64) -> u128 {\n value as u128\n }\n}\n\nimpl From for Field {\n fn from(value: u8) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u32) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u64) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u128) -> Field {\n value as Field\n }\n}\n\n// Signed integers\n\nimpl From for i32 {\n fn from(value: i8) -> i32 {\n value as i32\n }\n}\n\nimpl From for i64 {\n fn from(value: i8) -> i64 {\n value as i64\n }\n}\nimpl From for i64 {\n fn from(value: i32) -> i64 {\n value as i64\n }\n}\n\n// Booleans\nimpl From for u8 {\n fn from(value: bool) -> u8 {\n value as u8\n }\n}\nimpl From for u32 {\n fn from(value: bool) -> u32 {\n value as u32\n }\n}\nimpl From for u64 {\n fn from(value: bool) -> u64 {\n value as u64\n }\n}\nimpl From for i8 {\n fn from(value: bool) -> i8 {\n value as i8\n }\n}\nimpl From for i32 {\n fn from(value: bool) -> i32 {\n value as i32\n }\n}\nimpl From for i64 {\n fn from(value: bool) -> i64 {\n value as i64\n }\n}\nimpl From for Field {\n fn from(value: bool) -> Field {\n value as Field\n }\n}\n// docs:end:from-impls\n\n/// A generic interface for casting between primitive types,\n/// equivalent of using the `as` keyword between values.\n///\n/// # Example\n///\n/// ```\n/// let x: Field = 1234567890;\n/// let y: u8 = x as u8;\n/// let z: u8 = x.as_();\n/// assert_eq(y, z);\n/// ```\npub trait AsPrimitive {\n /// The equivalent of doing `self as T`.\n fn as_(self) -> T;\n}\n\n#[generate_as_primitive_impls]\ncomptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted {\n let types = [\n quote { bool },\n quote { u8 },\n quote { u16 },\n quote { u32 },\n quote { u64 },\n quote { u128 },\n quote { i8 },\n quote { i16 },\n quote { i32 },\n quote { i64 },\n quote { Field },\n ];\n\n let mut impls = &[];\n for type1 in types {\n for type2 in types {\n let body = if type1 == type2 {\n quote { self }\n } else if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for $type2 {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n }\n impls.join(quote {})\n}\n", "path": "std/convert.nr" }, "39": { diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/4_sub/execute__tests__force_brillig_true_inliner_9223372036854775807.snap b/tooling/nargo_cli/tests/snapshots/execution_success/4_sub/execute__tests__force_brillig_true_inliner_9223372036854775807.snap index 25aab164216..48f4faacd27 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/4_sub/execute__tests__force_brillig_true_inliner_9223372036854775807.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/4_sub/execute__tests__force_brillig_true_inliner_9223372036854775807.snap @@ -53,10 +53,10 @@ expression: artifact "unconstrained func 0", "[Const { destination: Direct(2), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(1), bit_size: Integer(U32), value: 32839 }, Const { destination: Direct(0), bit_size: Integer(U32), value: 3 }, Const { destination: Relative(4), bit_size: Integer(U32), value: 3 }, Const { destination: Relative(5), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(32836), size_address: Relative(4), offset_address: Relative(5) }, Cast { destination: Direct(32836), source: Direct(32836), bit_size: Integer(U32) }, Cast { destination: Direct(32837), source: Direct(32837), bit_size: Integer(U32) }, Cast { destination: Direct(32838), source: Direct(32838), bit_size: Integer(U32) }, Mov { destination: Relative(1), source: Direct(32836) }, Mov { destination: Relative(2), source: Direct(32837) }, Mov { destination: Relative(3), source: Direct(32838) }, Call { location: 17 }, Call { location: 18 }, Const { destination: Relative(1), bit_size: Integer(U32), value: 32839 }, Const { destination: Relative(2), bit_size: Integer(U32), value: 0 }, Stop { return_data: HeapVector { pointer: Relative(1), size: Relative(2) } }, Return, Call { location: 32 }, Cast { destination: Relative(4), source: Relative(1), bit_size: Field }, Const { destination: Relative(1), bit_size: Field, value: 340282366920938463463374607431768211456 }, BinaryFieldOp { destination: Relative(5), op: Add, lhs: Relative(4), rhs: Relative(1) }, Cast { destination: Relative(1), source: Relative(2), bit_size: Field }, BinaryFieldOp { destination: Relative(2), op: Sub, lhs: Relative(5), rhs: Relative(1) }, Cast { destination: Relative(4), source: Relative(2), bit_size: Integer(U32) }, Cast { destination: Relative(1), source: Relative(4), bit_size: Field }, Cast { destination: Relative(2), source: Relative(1), bit_size: Integer(U32) }, BinaryIntOp { destination: Relative(1), op: Equals, bit_size: U32, lhs: Relative(2), rhs: Relative(3) }, JumpIf { condition: Relative(1), location: 31 }, Const { destination: Relative(4), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(4) } }, 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: 37 }, IndirectConst { destination_pointer: Direct(1), bit_size: Integer(U64), value: 17843811134343075018 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return]" ], - "debug_symbols": "vZPBjoMgEED/hbMHGBSEX2mahlrakBA0VDfZNP77DlWrHmg2PfTCE3HeDHHmQS72PNxOLlzbO9GHBzlH5727nXzbmN61Ad8+CE0LU0SXBQHcVAg2AYiWCE50jSiJVohqgpggiWYUWc9UEzlNHMeCLLlOfbQ2pdokx5I6E23oiQ6D9wX5MX54fnTvTHiyNxFP0WjDBYnCq/M2PY3FGk3zoUyIOZjVa3i1j2f5eCmqchZIIdXLwNXOAG8qoCDkUgMFCTkHzzs4lIuCQ8VeBgafVcGZ+OgmnKnVAWXOIb54E8je5L9/tc4a3vWVWvoKKOz66og707i4G7MxmaIzZ2/n7XUIzea0/+2Wk2VMu9g29jJEm0ybWcX1wKHg8jimbH8=", + "debug_symbols": "vZPBjoMgEED/hbMHGBSEX2mahlrakBA0VDfZNP77DlWrHmg2PfTCA3HeDMo8yMWeh9vJhWt7J/rwIOfovHe3k28b07s24NMHoWlgiuiyIICLCsEmANESwYmuESXRClFNEBMk0Ywi65lqIqeJ41iQJdepj9amVJvkWFJnog090WHwviA/xg/Pl+6dCU/2JuIuGm24IFF4dd6m2Vis0TQfyoSYg1m9hlf7eJaPl6IqZ4EUUr0MXO0M8KYCCkIuNVCQkHPwvIODWr4BTsuXgcFnVXAmPjoJZ2p1QJlziC+eBLIn+e9frbOGd/dKLfcKKOzu1RFXpnFx12ZjMkVnzt7Oy+sQms1u/9stO0ubdrFt7GWINpk2vYrjgUPB5XFM2f4A", "file_map": { "12": { - "source": "// docs:start:from-trait\npub trait From {\n fn from(input: T) -> Self;\n}\n// docs:end:from-trait\n\nimpl From for T {\n fn from(input: T) -> T {\n input\n }\n}\n\n// docs:start:into-trait\npub trait Into {\n fn into(self) -> T;\n}\n\nimpl Into for U\nwhere\n T: From,\n{\n fn into(self) -> T {\n T::from(self)\n }\n}\n// docs:end:into-trait\n\n// docs:start:from-impls\n// Unsigned integers\n\nimpl From for u32 {\n fn from(value: u8) -> u32 {\n value as u32\n }\n}\n\nimpl From for u64 {\n fn from(value: u8) -> u64 {\n value as u64\n }\n}\nimpl From for u64 {\n fn from(value: u32) -> u64 {\n value as u64\n }\n}\n\nimpl From for u128 {\n fn from(value: u8) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u32) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u64) -> u128 {\n value as u128\n }\n}\n\nimpl From for Field {\n fn from(value: u8) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u32) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u64) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u128) -> Field {\n value as Field\n }\n}\n\n// Signed integers\n\nimpl From for i32 {\n fn from(value: i8) -> i32 {\n value as i32\n }\n}\n\nimpl From for i64 {\n fn from(value: i8) -> i64 {\n value as i64\n }\n}\nimpl From for i64 {\n fn from(value: i32) -> i64 {\n value as i64\n }\n}\n\n// Booleans\nimpl From for u8 {\n fn from(value: bool) -> u8 {\n value as u8\n }\n}\nimpl From for u32 {\n fn from(value: bool) -> u32 {\n value as u32\n }\n}\nimpl From for u64 {\n fn from(value: bool) -> u64 {\n value as u64\n }\n}\nimpl From for i8 {\n fn from(value: bool) -> i8 {\n value as i8\n }\n}\nimpl From for i32 {\n fn from(value: bool) -> i32 {\n value as i32\n }\n}\nimpl From for i64 {\n fn from(value: bool) -> i64 {\n value as i64\n }\n}\nimpl From for Field {\n fn from(value: bool) -> Field {\n value as Field\n }\n}\n// docs:end:from-impls\n\n/// A generic interface for casting between primitive types,\n/// equivalent of using the `as` keyword between values.\n///\n/// # Example\n///\n/// ```\n/// let x: Field = 1234567890;\n/// let y: u8 = x as u8;\n/// let z: u8 = x.as_();\n/// assert_eq(y, z);\n/// ```\npub trait AsPrimitive {\n /// The equivalent of doing `self as T`.\n fn as_(self) -> T;\n}\n\n#[generate_as_primitive_impls]\ncomptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted {\n let types = [\n quote { bool },\n quote { u8 },\n quote { u16 },\n quote { u32 },\n quote { u64 },\n quote { u128 },\n quote { i8 },\n quote { i16 },\n quote { i32 },\n quote { i64 },\n quote { Field },\n ];\n\n let mut impls = &[];\n for type1 in types {\n for type2 in types {\n let trait_impl = quote {\n impl AsPrimitive<$type1> for $type2 {\n fn as_(self) -> $type1 {\n self as $type1\n }\n }\n };\n\n impls = impls.push_back(trait_impl);\n }\n }\n impls.join(quote {})\n}\n", + "source": "// docs:start:from-trait\npub trait From {\n fn from(input: T) -> Self;\n}\n// docs:end:from-trait\n\nimpl From for T {\n fn from(input: T) -> T {\n input\n }\n}\n\n// docs:start:into-trait\npub trait Into {\n fn into(self) -> T;\n}\n\nimpl Into for U\nwhere\n T: From,\n{\n fn into(self) -> T {\n T::from(self)\n }\n}\n// docs:end:into-trait\n\n// docs:start:from-impls\n// Unsigned integers\n\nimpl From for u32 {\n fn from(value: u8) -> u32 {\n value as u32\n }\n}\n\nimpl From for u64 {\n fn from(value: u8) -> u64 {\n value as u64\n }\n}\nimpl From for u64 {\n fn from(value: u32) -> u64 {\n value as u64\n }\n}\n\nimpl From for u128 {\n fn from(value: u8) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u32) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u64) -> u128 {\n value as u128\n }\n}\n\nimpl From for Field {\n fn from(value: u8) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u32) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u64) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u128) -> Field {\n value as Field\n }\n}\n\n// Signed integers\n\nimpl From for i32 {\n fn from(value: i8) -> i32 {\n value as i32\n }\n}\n\nimpl From for i64 {\n fn from(value: i8) -> i64 {\n value as i64\n }\n}\nimpl From for i64 {\n fn from(value: i32) -> i64 {\n value as i64\n }\n}\n\n// Booleans\nimpl From for u8 {\n fn from(value: bool) -> u8 {\n value as u8\n }\n}\nimpl From for u32 {\n fn from(value: bool) -> u32 {\n value as u32\n }\n}\nimpl From for u64 {\n fn from(value: bool) -> u64 {\n value as u64\n }\n}\nimpl From for i8 {\n fn from(value: bool) -> i8 {\n value as i8\n }\n}\nimpl From for i32 {\n fn from(value: bool) -> i32 {\n value as i32\n }\n}\nimpl From for i64 {\n fn from(value: bool) -> i64 {\n value as i64\n }\n}\nimpl From for Field {\n fn from(value: bool) -> Field {\n value as Field\n }\n}\n// docs:end:from-impls\n\n/// A generic interface for casting between primitive types,\n/// equivalent of using the `as` keyword between values.\n///\n/// # Example\n///\n/// ```\n/// let x: Field = 1234567890;\n/// let y: u8 = x as u8;\n/// let z: u8 = x.as_();\n/// assert_eq(y, z);\n/// ```\npub trait AsPrimitive {\n /// The equivalent of doing `self as T`.\n fn as_(self) -> T;\n}\n\n#[generate_as_primitive_impls]\ncomptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted {\n let types = [\n quote { bool },\n quote { u8 },\n quote { u16 },\n quote { u32 },\n quote { u64 },\n quote { u128 },\n quote { i8 },\n quote { i16 },\n quote { i32 },\n quote { i64 },\n quote { Field },\n ];\n\n let mut impls = &[];\n for type1 in types {\n for type2 in types {\n let body = if type1 == type2 {\n quote { self }\n } else if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for $type2 {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n }\n impls.join(quote {})\n}\n", "path": "std/convert.nr" }, "39": { diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/5_over/execute__tests__force_brillig_false_inliner_-9223372036854775808.snap b/tooling/nargo_cli/tests/snapshots/execution_success/5_over/execute__tests__force_brillig_false_inliner_-9223372036854775808.snap index d69150bf375..f62b542761c 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/5_over/execute__tests__force_brillig_false_inliner_-9223372036854775808.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/5_over/execute__tests__force_brillig_false_inliner_-9223372036854775808.snap @@ -62,10 +62,10 @@ expression: artifact "unconstrained func 1", "[Const { destination: Direct(21), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(20), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(0), size_address: Direct(21), offset_address: Direct(20) }, Const { destination: Direct(2), bit_size: Field, value: 0 }, BinaryFieldOp { destination: Direct(3), op: Equals, lhs: Direct(0), rhs: Direct(2) }, JumpIf { condition: Direct(3), location: 8 }, Const { destination: Direct(1), bit_size: Field, value: 1 }, BinaryFieldOp { destination: Direct(0), op: Div, lhs: Direct(1), rhs: Direct(0) }, Stop { return_data: HeapVector { pointer: Direct(20), size: Direct(21) } }]" ], - "debug_symbols": "pVNBjoQgEPwLZw80iMp8ZbMxqDghIWgY3WRj/Pu2oK4e9DBzqQLaKrvS6Yk0uhqfpXFt9yKPr4lU3lhrnqXtajWYzuHrNCdku5aD1xqfyKGOql557QbycKO1CflRdgwfvXrlAg/KY5UmRLsGGQ1bY/VympN/Nb2WAktXMfBil4uzHq71Euj2dwlM7A5cnhzYTQc0FXzrAc/FlQe/9uAszVcLzgTsDsDe7CKn7yXh2cEDrjyyj5PcTVTsE83o1UTv9HLTMwof6sVJ/403VRt/2gHCyAMT84BpQBEwC5gHLALKgEAjQaQoB9QXSGggkUSkLFIeqVimgiwjM7oyLDwvgbxRldXrZrajqw+LOvz2W2Vb5d53tW5Gr5dAoYYR/wA=", + "debug_symbols": "pZNNjoQgEIXvwtoFP6LSV5lMDCp2SAgaWieZGO8+JYijC1x0b+oB5fesSqUW1Klmftba9sMLPb4W1DhtjH7WZmjlpAcLr8uaoXitJ6cUPKFTHqhROmUn9LCzMRn6kWb2H71Gab1O0kEWZ0jZDhQMe23UdlqzfxqnUULzHSasOnB+5UmaFwTHvwtC+eHAxMWB3lSAc85iDXCuUh4s7cGoiFXAMT8cCH2zihK/1wkrTh4k5VF83MndRPkx0QKnJnrHi8hTTD7k+YX/hptstbvsAKLoUWaI+Zj7yH0sfCx9rHwUPhIchAQJOAG+AgEDAcKDFEHKINU2FVARlOJdyabr1pDTsjFq38x+tu1pUaffMWbiKo9uaFU3O7U15HPQ4h8=", "file_map": { "12": { - "source": "// docs:start:from-trait\npub trait From {\n fn from(input: T) -> Self;\n}\n// docs:end:from-trait\n\nimpl From for T {\n fn from(input: T) -> T {\n input\n }\n}\n\n// docs:start:into-trait\npub trait Into {\n fn into(self) -> T;\n}\n\nimpl Into for U\nwhere\n T: From,\n{\n fn into(self) -> T {\n T::from(self)\n }\n}\n// docs:end:into-trait\n\n// docs:start:from-impls\n// Unsigned integers\n\nimpl From for u32 {\n fn from(value: u8) -> u32 {\n value as u32\n }\n}\n\nimpl From for u64 {\n fn from(value: u8) -> u64 {\n value as u64\n }\n}\nimpl From for u64 {\n fn from(value: u32) -> u64 {\n value as u64\n }\n}\n\nimpl From for u128 {\n fn from(value: u8) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u32) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u64) -> u128 {\n value as u128\n }\n}\n\nimpl From for Field {\n fn from(value: u8) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u32) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u64) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u128) -> Field {\n value as Field\n }\n}\n\n// Signed integers\n\nimpl From for i32 {\n fn from(value: i8) -> i32 {\n value as i32\n }\n}\n\nimpl From for i64 {\n fn from(value: i8) -> i64 {\n value as i64\n }\n}\nimpl From for i64 {\n fn from(value: i32) -> i64 {\n value as i64\n }\n}\n\n// Booleans\nimpl From for u8 {\n fn from(value: bool) -> u8 {\n value as u8\n }\n}\nimpl From for u32 {\n fn from(value: bool) -> u32 {\n value as u32\n }\n}\nimpl From for u64 {\n fn from(value: bool) -> u64 {\n value as u64\n }\n}\nimpl From for i8 {\n fn from(value: bool) -> i8 {\n value as i8\n }\n}\nimpl From for i32 {\n fn from(value: bool) -> i32 {\n value as i32\n }\n}\nimpl From for i64 {\n fn from(value: bool) -> i64 {\n value as i64\n }\n}\nimpl From for Field {\n fn from(value: bool) -> Field {\n value as Field\n }\n}\n// docs:end:from-impls\n\n/// A generic interface for casting between primitive types,\n/// equivalent of using the `as` keyword between values.\n///\n/// # Example\n///\n/// ```\n/// let x: Field = 1234567890;\n/// let y: u8 = x as u8;\n/// let z: u8 = x.as_();\n/// assert_eq(y, z);\n/// ```\npub trait AsPrimitive {\n /// The equivalent of doing `self as T`.\n fn as_(self) -> T;\n}\n\n#[generate_as_primitive_impls]\ncomptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted {\n let types = [\n quote { bool },\n quote { u8 },\n quote { u16 },\n quote { u32 },\n quote { u64 },\n quote { u128 },\n quote { i8 },\n quote { i16 },\n quote { i32 },\n quote { i64 },\n quote { Field },\n ];\n\n let mut impls = &[];\n for type1 in types {\n for type2 in types {\n let trait_impl = quote {\n impl AsPrimitive<$type1> for $type2 {\n fn as_(self) -> $type1 {\n self as $type1\n }\n }\n };\n\n impls = impls.push_back(trait_impl);\n }\n }\n impls.join(quote {})\n}\n", + "source": "// docs:start:from-trait\npub trait From {\n fn from(input: T) -> Self;\n}\n// docs:end:from-trait\n\nimpl From for T {\n fn from(input: T) -> T {\n input\n }\n}\n\n// docs:start:into-trait\npub trait Into {\n fn into(self) -> T;\n}\n\nimpl Into for U\nwhere\n T: From,\n{\n fn into(self) -> T {\n T::from(self)\n }\n}\n// docs:end:into-trait\n\n// docs:start:from-impls\n// Unsigned integers\n\nimpl From for u32 {\n fn from(value: u8) -> u32 {\n value as u32\n }\n}\n\nimpl From for u64 {\n fn from(value: u8) -> u64 {\n value as u64\n }\n}\nimpl From for u64 {\n fn from(value: u32) -> u64 {\n value as u64\n }\n}\n\nimpl From for u128 {\n fn from(value: u8) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u32) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u64) -> u128 {\n value as u128\n }\n}\n\nimpl From for Field {\n fn from(value: u8) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u32) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u64) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u128) -> Field {\n value as Field\n }\n}\n\n// Signed integers\n\nimpl From for i32 {\n fn from(value: i8) -> i32 {\n value as i32\n }\n}\n\nimpl From for i64 {\n fn from(value: i8) -> i64 {\n value as i64\n }\n}\nimpl From for i64 {\n fn from(value: i32) -> i64 {\n value as i64\n }\n}\n\n// Booleans\nimpl From for u8 {\n fn from(value: bool) -> u8 {\n value as u8\n }\n}\nimpl From for u32 {\n fn from(value: bool) -> u32 {\n value as u32\n }\n}\nimpl From for u64 {\n fn from(value: bool) -> u64 {\n value as u64\n }\n}\nimpl From for i8 {\n fn from(value: bool) -> i8 {\n value as i8\n }\n}\nimpl From for i32 {\n fn from(value: bool) -> i32 {\n value as i32\n }\n}\nimpl From for i64 {\n fn from(value: bool) -> i64 {\n value as i64\n }\n}\nimpl From for Field {\n fn from(value: bool) -> Field {\n value as Field\n }\n}\n// docs:end:from-impls\n\n/// A generic interface for casting between primitive types,\n/// equivalent of using the `as` keyword between values.\n///\n/// # Example\n///\n/// ```\n/// let x: Field = 1234567890;\n/// let y: u8 = x as u8;\n/// let z: u8 = x.as_();\n/// assert_eq(y, z);\n/// ```\npub trait AsPrimitive {\n /// The equivalent of doing `self as T`.\n fn as_(self) -> T;\n}\n\n#[generate_as_primitive_impls]\ncomptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted {\n let types = [\n quote { bool },\n quote { u8 },\n quote { u16 },\n quote { u32 },\n quote { u64 },\n quote { u128 },\n quote { i8 },\n quote { i16 },\n quote { i32 },\n quote { i64 },\n quote { Field },\n ];\n\n let mut impls = &[];\n for type1 in types {\n for type2 in types {\n let body = if type1 == type2 {\n quote { self }\n } else if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for $type2 {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n }\n impls.join(quote {})\n}\n", "path": "std/convert.nr" }, "39": { diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/5_over/execute__tests__force_brillig_false_inliner_0.snap b/tooling/nargo_cli/tests/snapshots/execution_success/5_over/execute__tests__force_brillig_false_inliner_0.snap index d69150bf375..f62b542761c 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/5_over/execute__tests__force_brillig_false_inliner_0.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/5_over/execute__tests__force_brillig_false_inliner_0.snap @@ -62,10 +62,10 @@ expression: artifact "unconstrained func 1", "[Const { destination: Direct(21), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(20), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(0), size_address: Direct(21), offset_address: Direct(20) }, Const { destination: Direct(2), bit_size: Field, value: 0 }, BinaryFieldOp { destination: Direct(3), op: Equals, lhs: Direct(0), rhs: Direct(2) }, JumpIf { condition: Direct(3), location: 8 }, Const { destination: Direct(1), bit_size: Field, value: 1 }, BinaryFieldOp { destination: Direct(0), op: Div, lhs: Direct(1), rhs: Direct(0) }, Stop { return_data: HeapVector { pointer: Direct(20), size: Direct(21) } }]" ], - "debug_symbols": "pVNBjoQgEPwLZw80iMp8ZbMxqDghIWgY3WRj/Pu2oK4e9DBzqQLaKrvS6Yk0uhqfpXFt9yKPr4lU3lhrnqXtajWYzuHrNCdku5aD1xqfyKGOql557QbycKO1CflRdgwfvXrlAg/KY5UmRLsGGQ1bY/VympN/Nb2WAktXMfBil4uzHq71Euj2dwlM7A5cnhzYTQc0FXzrAc/FlQe/9uAszVcLzgTsDsDe7CKn7yXh2cEDrjyyj5PcTVTsE83o1UTv9HLTMwof6sVJ/403VRt/2gHCyAMT84BpQBEwC5gHLALKgEAjQaQoB9QXSGggkUSkLFIeqVimgiwjM7oyLDwvgbxRldXrZrajqw+LOvz2W2Vb5d53tW5Gr5dAoYYR/wA=", + "debug_symbols": "pZNNjoQgEIXvwtoFP6LSV5lMDCp2SAgaWieZGO8+JYijC1x0b+oB5fesSqUW1Klmftba9sMLPb4W1DhtjH7WZmjlpAcLr8uaoXitJ6cUPKFTHqhROmUn9LCzMRn6kWb2H71Gab1O0kEWZ0jZDhQMe23UdlqzfxqnUULzHSasOnB+5UmaFwTHvwtC+eHAxMWB3lSAc85iDXCuUh4s7cGoiFXAMT8cCH2zihK/1wkrTh4k5VF83MndRPkx0QKnJnrHi8hTTD7k+YX/hptstbvsAKLoUWaI+Zj7yH0sfCx9rHwUPhIchAQJOAG+AgEDAcKDFEHKINU2FVARlOJdyabr1pDTsjFq38x+tu1pUaffMWbiKo9uaFU3O7U15HPQ4h8=", "file_map": { "12": { - "source": "// docs:start:from-trait\npub trait From {\n fn from(input: T) -> Self;\n}\n// docs:end:from-trait\n\nimpl From for T {\n fn from(input: T) -> T {\n input\n }\n}\n\n// docs:start:into-trait\npub trait Into {\n fn into(self) -> T;\n}\n\nimpl Into for U\nwhere\n T: From,\n{\n fn into(self) -> T {\n T::from(self)\n }\n}\n// docs:end:into-trait\n\n// docs:start:from-impls\n// Unsigned integers\n\nimpl From for u32 {\n fn from(value: u8) -> u32 {\n value as u32\n }\n}\n\nimpl From for u64 {\n fn from(value: u8) -> u64 {\n value as u64\n }\n}\nimpl From for u64 {\n fn from(value: u32) -> u64 {\n value as u64\n }\n}\n\nimpl From for u128 {\n fn from(value: u8) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u32) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u64) -> u128 {\n value as u128\n }\n}\n\nimpl From for Field {\n fn from(value: u8) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u32) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u64) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u128) -> Field {\n value as Field\n }\n}\n\n// Signed integers\n\nimpl From for i32 {\n fn from(value: i8) -> i32 {\n value as i32\n }\n}\n\nimpl From for i64 {\n fn from(value: i8) -> i64 {\n value as i64\n }\n}\nimpl From for i64 {\n fn from(value: i32) -> i64 {\n value as i64\n }\n}\n\n// Booleans\nimpl From for u8 {\n fn from(value: bool) -> u8 {\n value as u8\n }\n}\nimpl From for u32 {\n fn from(value: bool) -> u32 {\n value as u32\n }\n}\nimpl From for u64 {\n fn from(value: bool) -> u64 {\n value as u64\n }\n}\nimpl From for i8 {\n fn from(value: bool) -> i8 {\n value as i8\n }\n}\nimpl From for i32 {\n fn from(value: bool) -> i32 {\n value as i32\n }\n}\nimpl From for i64 {\n fn from(value: bool) -> i64 {\n value as i64\n }\n}\nimpl From for Field {\n fn from(value: bool) -> Field {\n value as Field\n }\n}\n// docs:end:from-impls\n\n/// A generic interface for casting between primitive types,\n/// equivalent of using the `as` keyword between values.\n///\n/// # Example\n///\n/// ```\n/// let x: Field = 1234567890;\n/// let y: u8 = x as u8;\n/// let z: u8 = x.as_();\n/// assert_eq(y, z);\n/// ```\npub trait AsPrimitive {\n /// The equivalent of doing `self as T`.\n fn as_(self) -> T;\n}\n\n#[generate_as_primitive_impls]\ncomptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted {\n let types = [\n quote { bool },\n quote { u8 },\n quote { u16 },\n quote { u32 },\n quote { u64 },\n quote { u128 },\n quote { i8 },\n quote { i16 },\n quote { i32 },\n quote { i64 },\n quote { Field },\n ];\n\n let mut impls = &[];\n for type1 in types {\n for type2 in types {\n let trait_impl = quote {\n impl AsPrimitive<$type1> for $type2 {\n fn as_(self) -> $type1 {\n self as $type1\n }\n }\n };\n\n impls = impls.push_back(trait_impl);\n }\n }\n impls.join(quote {})\n}\n", + "source": "// docs:start:from-trait\npub trait From {\n fn from(input: T) -> Self;\n}\n// docs:end:from-trait\n\nimpl From for T {\n fn from(input: T) -> T {\n input\n }\n}\n\n// docs:start:into-trait\npub trait Into {\n fn into(self) -> T;\n}\n\nimpl Into for U\nwhere\n T: From,\n{\n fn into(self) -> T {\n T::from(self)\n }\n}\n// docs:end:into-trait\n\n// docs:start:from-impls\n// Unsigned integers\n\nimpl From for u32 {\n fn from(value: u8) -> u32 {\n value as u32\n }\n}\n\nimpl From for u64 {\n fn from(value: u8) -> u64 {\n value as u64\n }\n}\nimpl From for u64 {\n fn from(value: u32) -> u64 {\n value as u64\n }\n}\n\nimpl From for u128 {\n fn from(value: u8) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u32) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u64) -> u128 {\n value as u128\n }\n}\n\nimpl From for Field {\n fn from(value: u8) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u32) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u64) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u128) -> Field {\n value as Field\n }\n}\n\n// Signed integers\n\nimpl From for i32 {\n fn from(value: i8) -> i32 {\n value as i32\n }\n}\n\nimpl From for i64 {\n fn from(value: i8) -> i64 {\n value as i64\n }\n}\nimpl From for i64 {\n fn from(value: i32) -> i64 {\n value as i64\n }\n}\n\n// Booleans\nimpl From for u8 {\n fn from(value: bool) -> u8 {\n value as u8\n }\n}\nimpl From for u32 {\n fn from(value: bool) -> u32 {\n value as u32\n }\n}\nimpl From for u64 {\n fn from(value: bool) -> u64 {\n value as u64\n }\n}\nimpl From for i8 {\n fn from(value: bool) -> i8 {\n value as i8\n }\n}\nimpl From for i32 {\n fn from(value: bool) -> i32 {\n value as i32\n }\n}\nimpl From for i64 {\n fn from(value: bool) -> i64 {\n value as i64\n }\n}\nimpl From for Field {\n fn from(value: bool) -> Field {\n value as Field\n }\n}\n// docs:end:from-impls\n\n/// A generic interface for casting between primitive types,\n/// equivalent of using the `as` keyword between values.\n///\n/// # Example\n///\n/// ```\n/// let x: Field = 1234567890;\n/// let y: u8 = x as u8;\n/// let z: u8 = x.as_();\n/// assert_eq(y, z);\n/// ```\npub trait AsPrimitive {\n /// The equivalent of doing `self as T`.\n fn as_(self) -> T;\n}\n\n#[generate_as_primitive_impls]\ncomptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted {\n let types = [\n quote { bool },\n quote { u8 },\n quote { u16 },\n quote { u32 },\n quote { u64 },\n quote { u128 },\n quote { i8 },\n quote { i16 },\n quote { i32 },\n quote { i64 },\n quote { Field },\n ];\n\n let mut impls = &[];\n for type1 in types {\n for type2 in types {\n let body = if type1 == type2 {\n quote { self }\n } else if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for $type2 {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n }\n impls.join(quote {})\n}\n", "path": "std/convert.nr" }, "39": { diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/5_over/execute__tests__force_brillig_false_inliner_9223372036854775807.snap b/tooling/nargo_cli/tests/snapshots/execution_success/5_over/execute__tests__force_brillig_false_inliner_9223372036854775807.snap index d69150bf375..f62b542761c 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/5_over/execute__tests__force_brillig_false_inliner_9223372036854775807.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/5_over/execute__tests__force_brillig_false_inliner_9223372036854775807.snap @@ -62,10 +62,10 @@ expression: artifact "unconstrained func 1", "[Const { destination: Direct(21), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(20), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(0), size_address: Direct(21), offset_address: Direct(20) }, Const { destination: Direct(2), bit_size: Field, value: 0 }, BinaryFieldOp { destination: Direct(3), op: Equals, lhs: Direct(0), rhs: Direct(2) }, JumpIf { condition: Direct(3), location: 8 }, Const { destination: Direct(1), bit_size: Field, value: 1 }, BinaryFieldOp { destination: Direct(0), op: Div, lhs: Direct(1), rhs: Direct(0) }, Stop { return_data: HeapVector { pointer: Direct(20), size: Direct(21) } }]" ], - "debug_symbols": "pVNBjoQgEPwLZw80iMp8ZbMxqDghIWgY3WRj/Pu2oK4e9DBzqQLaKrvS6Yk0uhqfpXFt9yKPr4lU3lhrnqXtajWYzuHrNCdku5aD1xqfyKGOql557QbycKO1CflRdgwfvXrlAg/KY5UmRLsGGQ1bY/VympN/Nb2WAktXMfBil4uzHq71Euj2dwlM7A5cnhzYTQc0FXzrAc/FlQe/9uAszVcLzgTsDsDe7CKn7yXh2cEDrjyyj5PcTVTsE83o1UTv9HLTMwof6sVJ/403VRt/2gHCyAMT84BpQBEwC5gHLALKgEAjQaQoB9QXSGggkUSkLFIeqVimgiwjM7oyLDwvgbxRldXrZrajqw+LOvz2W2Vb5d53tW5Gr5dAoYYR/wA=", + "debug_symbols": "pZNNjoQgEIXvwtoFP6LSV5lMDCp2SAgaWieZGO8+JYijC1x0b+oB5fesSqUW1Klmftba9sMLPb4W1DhtjH7WZmjlpAcLr8uaoXitJ6cUPKFTHqhROmUn9LCzMRn6kWb2H71Gab1O0kEWZ0jZDhQMe23UdlqzfxqnUULzHSasOnB+5UmaFwTHvwtC+eHAxMWB3lSAc85iDXCuUh4s7cGoiFXAMT8cCH2zihK/1wkrTh4k5VF83MndRPkx0QKnJnrHi8hTTD7k+YX/hptstbvsAKLoUWaI+Zj7yH0sfCx9rHwUPhIchAQJOAG+AgEDAcKDFEHKINU2FVARlOJdyabr1pDTsjFq38x+tu1pUaffMWbiKo9uaFU3O7U15HPQ4h8=", "file_map": { "12": { - "source": "// docs:start:from-trait\npub trait From {\n fn from(input: T) -> Self;\n}\n// docs:end:from-trait\n\nimpl From for T {\n fn from(input: T) -> T {\n input\n }\n}\n\n// docs:start:into-trait\npub trait Into {\n fn into(self) -> T;\n}\n\nimpl Into for U\nwhere\n T: From,\n{\n fn into(self) -> T {\n T::from(self)\n }\n}\n// docs:end:into-trait\n\n// docs:start:from-impls\n// Unsigned integers\n\nimpl From for u32 {\n fn from(value: u8) -> u32 {\n value as u32\n }\n}\n\nimpl From for u64 {\n fn from(value: u8) -> u64 {\n value as u64\n }\n}\nimpl From for u64 {\n fn from(value: u32) -> u64 {\n value as u64\n }\n}\n\nimpl From for u128 {\n fn from(value: u8) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u32) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u64) -> u128 {\n value as u128\n }\n}\n\nimpl From for Field {\n fn from(value: u8) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u32) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u64) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u128) -> Field {\n value as Field\n }\n}\n\n// Signed integers\n\nimpl From for i32 {\n fn from(value: i8) -> i32 {\n value as i32\n }\n}\n\nimpl From for i64 {\n fn from(value: i8) -> i64 {\n value as i64\n }\n}\nimpl From for i64 {\n fn from(value: i32) -> i64 {\n value as i64\n }\n}\n\n// Booleans\nimpl From for u8 {\n fn from(value: bool) -> u8 {\n value as u8\n }\n}\nimpl From for u32 {\n fn from(value: bool) -> u32 {\n value as u32\n }\n}\nimpl From for u64 {\n fn from(value: bool) -> u64 {\n value as u64\n }\n}\nimpl From for i8 {\n fn from(value: bool) -> i8 {\n value as i8\n }\n}\nimpl From for i32 {\n fn from(value: bool) -> i32 {\n value as i32\n }\n}\nimpl From for i64 {\n fn from(value: bool) -> i64 {\n value as i64\n }\n}\nimpl From for Field {\n fn from(value: bool) -> Field {\n value as Field\n }\n}\n// docs:end:from-impls\n\n/// A generic interface for casting between primitive types,\n/// equivalent of using the `as` keyword between values.\n///\n/// # Example\n///\n/// ```\n/// let x: Field = 1234567890;\n/// let y: u8 = x as u8;\n/// let z: u8 = x.as_();\n/// assert_eq(y, z);\n/// ```\npub trait AsPrimitive {\n /// The equivalent of doing `self as T`.\n fn as_(self) -> T;\n}\n\n#[generate_as_primitive_impls]\ncomptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted {\n let types = [\n quote { bool },\n quote { u8 },\n quote { u16 },\n quote { u32 },\n quote { u64 },\n quote { u128 },\n quote { i8 },\n quote { i16 },\n quote { i32 },\n quote { i64 },\n quote { Field },\n ];\n\n let mut impls = &[];\n for type1 in types {\n for type2 in types {\n let trait_impl = quote {\n impl AsPrimitive<$type1> for $type2 {\n fn as_(self) -> $type1 {\n self as $type1\n }\n }\n };\n\n impls = impls.push_back(trait_impl);\n }\n }\n impls.join(quote {})\n}\n", + "source": "// docs:start:from-trait\npub trait From {\n fn from(input: T) -> Self;\n}\n// docs:end:from-trait\n\nimpl From for T {\n fn from(input: T) -> T {\n input\n }\n}\n\n// docs:start:into-trait\npub trait Into {\n fn into(self) -> T;\n}\n\nimpl Into for U\nwhere\n T: From,\n{\n fn into(self) -> T {\n T::from(self)\n }\n}\n// docs:end:into-trait\n\n// docs:start:from-impls\n// Unsigned integers\n\nimpl From for u32 {\n fn from(value: u8) -> u32 {\n value as u32\n }\n}\n\nimpl From for u64 {\n fn from(value: u8) -> u64 {\n value as u64\n }\n}\nimpl From for u64 {\n fn from(value: u32) -> u64 {\n value as u64\n }\n}\n\nimpl From for u128 {\n fn from(value: u8) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u32) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u64) -> u128 {\n value as u128\n }\n}\n\nimpl From for Field {\n fn from(value: u8) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u32) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u64) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u128) -> Field {\n value as Field\n }\n}\n\n// Signed integers\n\nimpl From for i32 {\n fn from(value: i8) -> i32 {\n value as i32\n }\n}\n\nimpl From for i64 {\n fn from(value: i8) -> i64 {\n value as i64\n }\n}\nimpl From for i64 {\n fn from(value: i32) -> i64 {\n value as i64\n }\n}\n\n// Booleans\nimpl From for u8 {\n fn from(value: bool) -> u8 {\n value as u8\n }\n}\nimpl From for u32 {\n fn from(value: bool) -> u32 {\n value as u32\n }\n}\nimpl From for u64 {\n fn from(value: bool) -> u64 {\n value as u64\n }\n}\nimpl From for i8 {\n fn from(value: bool) -> i8 {\n value as i8\n }\n}\nimpl From for i32 {\n fn from(value: bool) -> i32 {\n value as i32\n }\n}\nimpl From for i64 {\n fn from(value: bool) -> i64 {\n value as i64\n }\n}\nimpl From for Field {\n fn from(value: bool) -> Field {\n value as Field\n }\n}\n// docs:end:from-impls\n\n/// A generic interface for casting between primitive types,\n/// equivalent of using the `as` keyword between values.\n///\n/// # Example\n///\n/// ```\n/// let x: Field = 1234567890;\n/// let y: u8 = x as u8;\n/// let z: u8 = x.as_();\n/// assert_eq(y, z);\n/// ```\npub trait AsPrimitive {\n /// The equivalent of doing `self as T`.\n fn as_(self) -> T;\n}\n\n#[generate_as_primitive_impls]\ncomptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted {\n let types = [\n quote { bool },\n quote { u8 },\n quote { u16 },\n quote { u32 },\n quote { u64 },\n quote { u128 },\n quote { i8 },\n quote { i16 },\n quote { i32 },\n quote { i64 },\n quote { Field },\n ];\n\n let mut impls = &[];\n for type1 in types {\n for type2 in types {\n let body = if type1 == type2 {\n quote { self }\n } else if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for $type2 {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n }\n impls.join(quote {})\n}\n", "path": "std/convert.nr" }, "39": { diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/5_over/execute__tests__force_brillig_true_inliner_-9223372036854775808.snap b/tooling/nargo_cli/tests/snapshots/execution_success/5_over/execute__tests__force_brillig_true_inliner_-9223372036854775808.snap index 48ebc3b159d..a271bf6d766 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/5_over/execute__tests__force_brillig_true_inliner_-9223372036854775808.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/5_over/execute__tests__force_brillig_true_inliner_-9223372036854775808.snap @@ -44,10 +44,10 @@ expression: artifact "unconstrained func 0", "[Const { destination: Direct(2), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(1), bit_size: Integer(U32), value: 32838 }, Const { destination: Direct(0), bit_size: Integer(U32), value: 3 }, Const { destination: Relative(3), bit_size: Integer(U32), value: 2 }, Const { destination: Relative(4), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(32836), size_address: Relative(3), offset_address: Relative(4) }, Cast { destination: Direct(32836), source: Direct(32836), bit_size: Integer(U32) }, Cast { destination: Direct(32837), source: Direct(32837), bit_size: Integer(U32) }, Mov { destination: Relative(1), source: Direct(32836) }, Mov { destination: Relative(2), source: Direct(32837) }, Call { location: 15 }, Call { location: 16 }, Const { destination: Relative(1), bit_size: Integer(U32), value: 32838 }, Const { destination: Relative(2), bit_size: Integer(U32), value: 0 }, Stop { return_data: HeapVector { pointer: Relative(1), size: Relative(2) } }, Return, Call { location: 36 }, Cast { destination: Relative(3), source: Relative(1), bit_size: Field }, BinaryFieldOp { destination: Relative(1), op: Mul, lhs: Relative(3), rhs: Relative(3) }, Cast { destination: Relative(4), source: Relative(1), bit_size: Integer(U32) }, Cast { destination: Relative(3), source: Relative(4), bit_size: Field }, Cast { destination: Relative(1), source: Relative(3), bit_size: Integer(U32) }, BinaryIntOp { destination: Relative(3), op: Equals, bit_size: U32, lhs: Relative(2), rhs: Relative(1) }, JumpIf { condition: Relative(3), location: 26 }, Const { destination: Relative(4), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(4) } }, Cast { destination: Relative(3), source: Relative(2), bit_size: Integer(U1) }, Cast { destination: Relative(1), source: Relative(3), bit_size: Integer(U32) }, Cast { destination: Relative(2), source: Relative(1), bit_size: Integer(U1) }, Const { destination: Relative(1), bit_size: Integer(U1), value: 0 }, BinaryIntOp { destination: Relative(3), op: LessThan, bit_size: U1, lhs: Relative(1), rhs: Relative(2) }, Const { destination: Relative(1), bit_size: Integer(U1), value: 1 }, JumpIf { condition: Relative(3), location: 35 }, Const { destination: Relative(2), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(2) } }, Return, Const { destination: Direct(32772), bit_size: Integer(U32), value: 30720 }, BinaryIntOp { destination: Direct(32771), op: LessThan, bit_size: U32, lhs: Direct(0), rhs: Direct(32772) }, JumpIf { condition: Direct(32771), location: 41 }, IndirectConst { destination_pointer: Direct(1), bit_size: Integer(U64), value: 17843811134343075018 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return]" ], - "debug_symbols": "pZPNroMgEIXfZdYuGH784VWapqGWNiQEDdWb3DS++4WCXl3oot3wgeM5HDKZF9z0dXxcjLt3T5CnF1y9sdY8LrZr1WA6F76+gMQFK5C8AKxBioAGZFUAJQmYQEHWASyBJ4iEEmQTUCXUCcEFSQGMZGImzWSZPHKaCphzXQavdYy1Chri98prN4B0o7UF/Cg7vn969sq9OSgfqsFRu1tgMLwbq+NuKv7VZF+KlGcxsnqRi60e9/UNkvn2BqlYHFizcaAHCQgXbM4Q9vWeB9v3YJRX2YJRgYsD0g9TVOSzl7By5YF7HuXXLznqqFg6WpK9jh7pm1lPCX6pFxv9OZxUa/xmGKfo5I26Wp2P99G1q+rw28+VeZh737X6NnodnVYTHdZT6ADH8xRv+wM=", + "debug_symbols": "pZPNroMgEIXfZdYu+BEVXqVpGmppQ0LQUL3JTeO736GIVxe6aDd84HgOh0zmBTdzHR8X6+/dE9TpBddgnbOPi+taPdjO49cXkLjQGlRZAG1ACYQEVRfASAJNYKAaBE8oE0RCBUoi6oQmAV0oKYCTmXQmm8lnlpHTVEDOdRmCMTHWKijG73UwfgDlR+cK+NFufP/07LV/c9ABq+ho/A2JhnfrTNxNxb+a7EspK2cx5c0iF1s93ddLSvLtkjKxOHC5cWAHCUgpeM6A+2bPg+97cCZzCtyWiwNlH6aoyWcv4dXKg+55VF+/5KijYuloRfY6eqSXWc8I/VIvNvoznnRrw2YYp+gUrL46Mx/vo29X1eG3z5U8zH3oWnMbg4lOq4nG9YQdKOl5irf9AQ==", "file_map": { "12": { - "source": "// docs:start:from-trait\npub trait From {\n fn from(input: T) -> Self;\n}\n// docs:end:from-trait\n\nimpl From for T {\n fn from(input: T) -> T {\n input\n }\n}\n\n// docs:start:into-trait\npub trait Into {\n fn into(self) -> T;\n}\n\nimpl Into for U\nwhere\n T: From,\n{\n fn into(self) -> T {\n T::from(self)\n }\n}\n// docs:end:into-trait\n\n// docs:start:from-impls\n// Unsigned integers\n\nimpl From for u32 {\n fn from(value: u8) -> u32 {\n value as u32\n }\n}\n\nimpl From for u64 {\n fn from(value: u8) -> u64 {\n value as u64\n }\n}\nimpl From for u64 {\n fn from(value: u32) -> u64 {\n value as u64\n }\n}\n\nimpl From for u128 {\n fn from(value: u8) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u32) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u64) -> u128 {\n value as u128\n }\n}\n\nimpl From for Field {\n fn from(value: u8) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u32) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u64) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u128) -> Field {\n value as Field\n }\n}\n\n// Signed integers\n\nimpl From for i32 {\n fn from(value: i8) -> i32 {\n value as i32\n }\n}\n\nimpl From for i64 {\n fn from(value: i8) -> i64 {\n value as i64\n }\n}\nimpl From for i64 {\n fn from(value: i32) -> i64 {\n value as i64\n }\n}\n\n// Booleans\nimpl From for u8 {\n fn from(value: bool) -> u8 {\n value as u8\n }\n}\nimpl From for u32 {\n fn from(value: bool) -> u32 {\n value as u32\n }\n}\nimpl From for u64 {\n fn from(value: bool) -> u64 {\n value as u64\n }\n}\nimpl From for i8 {\n fn from(value: bool) -> i8 {\n value as i8\n }\n}\nimpl From for i32 {\n fn from(value: bool) -> i32 {\n value as i32\n }\n}\nimpl From for i64 {\n fn from(value: bool) -> i64 {\n value as i64\n }\n}\nimpl From for Field {\n fn from(value: bool) -> Field {\n value as Field\n }\n}\n// docs:end:from-impls\n\n/// A generic interface for casting between primitive types,\n/// equivalent of using the `as` keyword between values.\n///\n/// # Example\n///\n/// ```\n/// let x: Field = 1234567890;\n/// let y: u8 = x as u8;\n/// let z: u8 = x.as_();\n/// assert_eq(y, z);\n/// ```\npub trait AsPrimitive {\n /// The equivalent of doing `self as T`.\n fn as_(self) -> T;\n}\n\n#[generate_as_primitive_impls]\ncomptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted {\n let types = [\n quote { bool },\n quote { u8 },\n quote { u16 },\n quote { u32 },\n quote { u64 },\n quote { u128 },\n quote { i8 },\n quote { i16 },\n quote { i32 },\n quote { i64 },\n quote { Field },\n ];\n\n let mut impls = &[];\n for type1 in types {\n for type2 in types {\n let trait_impl = quote {\n impl AsPrimitive<$type1> for $type2 {\n fn as_(self) -> $type1 {\n self as $type1\n }\n }\n };\n\n impls = impls.push_back(trait_impl);\n }\n }\n impls.join(quote {})\n}\n", + "source": "// docs:start:from-trait\npub trait From {\n fn from(input: T) -> Self;\n}\n// docs:end:from-trait\n\nimpl From for T {\n fn from(input: T) -> T {\n input\n }\n}\n\n// docs:start:into-trait\npub trait Into {\n fn into(self) -> T;\n}\n\nimpl Into for U\nwhere\n T: From,\n{\n fn into(self) -> T {\n T::from(self)\n }\n}\n// docs:end:into-trait\n\n// docs:start:from-impls\n// Unsigned integers\n\nimpl From for u32 {\n fn from(value: u8) -> u32 {\n value as u32\n }\n}\n\nimpl From for u64 {\n fn from(value: u8) -> u64 {\n value as u64\n }\n}\nimpl From for u64 {\n fn from(value: u32) -> u64 {\n value as u64\n }\n}\n\nimpl From for u128 {\n fn from(value: u8) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u32) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u64) -> u128 {\n value as u128\n }\n}\n\nimpl From for Field {\n fn from(value: u8) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u32) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u64) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u128) -> Field {\n value as Field\n }\n}\n\n// Signed integers\n\nimpl From for i32 {\n fn from(value: i8) -> i32 {\n value as i32\n }\n}\n\nimpl From for i64 {\n fn from(value: i8) -> i64 {\n value as i64\n }\n}\nimpl From for i64 {\n fn from(value: i32) -> i64 {\n value as i64\n }\n}\n\n// Booleans\nimpl From for u8 {\n fn from(value: bool) -> u8 {\n value as u8\n }\n}\nimpl From for u32 {\n fn from(value: bool) -> u32 {\n value as u32\n }\n}\nimpl From for u64 {\n fn from(value: bool) -> u64 {\n value as u64\n }\n}\nimpl From for i8 {\n fn from(value: bool) -> i8 {\n value as i8\n }\n}\nimpl From for i32 {\n fn from(value: bool) -> i32 {\n value as i32\n }\n}\nimpl From for i64 {\n fn from(value: bool) -> i64 {\n value as i64\n }\n}\nimpl From for Field {\n fn from(value: bool) -> Field {\n value as Field\n }\n}\n// docs:end:from-impls\n\n/// A generic interface for casting between primitive types,\n/// equivalent of using the `as` keyword between values.\n///\n/// # Example\n///\n/// ```\n/// let x: Field = 1234567890;\n/// let y: u8 = x as u8;\n/// let z: u8 = x.as_();\n/// assert_eq(y, z);\n/// ```\npub trait AsPrimitive {\n /// The equivalent of doing `self as T`.\n fn as_(self) -> T;\n}\n\n#[generate_as_primitive_impls]\ncomptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted {\n let types = [\n quote { bool },\n quote { u8 },\n quote { u16 },\n quote { u32 },\n quote { u64 },\n quote { u128 },\n quote { i8 },\n quote { i16 },\n quote { i32 },\n quote { i64 },\n quote { Field },\n ];\n\n let mut impls = &[];\n for type1 in types {\n for type2 in types {\n let body = if type1 == type2 {\n quote { self }\n } else if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for $type2 {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n }\n impls.join(quote {})\n}\n", "path": "std/convert.nr" }, "39": { diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/5_over/execute__tests__force_brillig_true_inliner_0.snap b/tooling/nargo_cli/tests/snapshots/execution_success/5_over/execute__tests__force_brillig_true_inliner_0.snap index 48ebc3b159d..a271bf6d766 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/5_over/execute__tests__force_brillig_true_inliner_0.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/5_over/execute__tests__force_brillig_true_inliner_0.snap @@ -44,10 +44,10 @@ expression: artifact "unconstrained func 0", "[Const { destination: Direct(2), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(1), bit_size: Integer(U32), value: 32838 }, Const { destination: Direct(0), bit_size: Integer(U32), value: 3 }, Const { destination: Relative(3), bit_size: Integer(U32), value: 2 }, Const { destination: Relative(4), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(32836), size_address: Relative(3), offset_address: Relative(4) }, Cast { destination: Direct(32836), source: Direct(32836), bit_size: Integer(U32) }, Cast { destination: Direct(32837), source: Direct(32837), bit_size: Integer(U32) }, Mov { destination: Relative(1), source: Direct(32836) }, Mov { destination: Relative(2), source: Direct(32837) }, Call { location: 15 }, Call { location: 16 }, Const { destination: Relative(1), bit_size: Integer(U32), value: 32838 }, Const { destination: Relative(2), bit_size: Integer(U32), value: 0 }, Stop { return_data: HeapVector { pointer: Relative(1), size: Relative(2) } }, Return, Call { location: 36 }, Cast { destination: Relative(3), source: Relative(1), bit_size: Field }, BinaryFieldOp { destination: Relative(1), op: Mul, lhs: Relative(3), rhs: Relative(3) }, Cast { destination: Relative(4), source: Relative(1), bit_size: Integer(U32) }, Cast { destination: Relative(3), source: Relative(4), bit_size: Field }, Cast { destination: Relative(1), source: Relative(3), bit_size: Integer(U32) }, BinaryIntOp { destination: Relative(3), op: Equals, bit_size: U32, lhs: Relative(2), rhs: Relative(1) }, JumpIf { condition: Relative(3), location: 26 }, Const { destination: Relative(4), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(4) } }, Cast { destination: Relative(3), source: Relative(2), bit_size: Integer(U1) }, Cast { destination: Relative(1), source: Relative(3), bit_size: Integer(U32) }, Cast { destination: Relative(2), source: Relative(1), bit_size: Integer(U1) }, Const { destination: Relative(1), bit_size: Integer(U1), value: 0 }, BinaryIntOp { destination: Relative(3), op: LessThan, bit_size: U1, lhs: Relative(1), rhs: Relative(2) }, Const { destination: Relative(1), bit_size: Integer(U1), value: 1 }, JumpIf { condition: Relative(3), location: 35 }, Const { destination: Relative(2), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(2) } }, Return, Const { destination: Direct(32772), bit_size: Integer(U32), value: 30720 }, BinaryIntOp { destination: Direct(32771), op: LessThan, bit_size: U32, lhs: Direct(0), rhs: Direct(32772) }, JumpIf { condition: Direct(32771), location: 41 }, IndirectConst { destination_pointer: Direct(1), bit_size: Integer(U64), value: 17843811134343075018 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return]" ], - "debug_symbols": "pZPNroMgEIXfZdYuGH784VWapqGWNiQEDdWb3DS++4WCXl3oot3wgeM5HDKZF9z0dXxcjLt3T5CnF1y9sdY8LrZr1WA6F76+gMQFK5C8AKxBioAGZFUAJQmYQEHWASyBJ4iEEmQTUCXUCcEFSQGMZGImzWSZPHKaCphzXQavdYy1Chri98prN4B0o7UF/Cg7vn969sq9OSgfqsFRu1tgMLwbq+NuKv7VZF+KlGcxsnqRi60e9/UNkvn2BqlYHFizcaAHCQgXbM4Q9vWeB9v3YJRX2YJRgYsD0g9TVOSzl7By5YF7HuXXLznqqFg6WpK9jh7pm1lPCX6pFxv9OZxUa/xmGKfo5I26Wp2P99G1q+rw28+VeZh737X6NnodnVYTHdZT6ADH8xRv+wM=", + "debug_symbols": "pZPNroMgEIXfZdYu+BEVXqVpGmppQ0LQUL3JTeO736GIVxe6aDd84HgOh0zmBTdzHR8X6+/dE9TpBddgnbOPi+taPdjO49cXkLjQGlRZAG1ACYQEVRfASAJNYKAaBE8oE0RCBUoi6oQmAV0oKYCTmXQmm8lnlpHTVEDOdRmCMTHWKijG73UwfgDlR+cK+NFufP/07LV/c9ABq+ho/A2JhnfrTNxNxb+a7EspK2cx5c0iF1s93ddLSvLtkjKxOHC5cWAHCUgpeM6A+2bPg+97cCZzCtyWiwNlH6aoyWcv4dXKg+55VF+/5KijYuloRfY6eqSXWc8I/VIvNvoznnRrw2YYp+gUrL46Mx/vo29X1eG3z5U8zH3oWnMbg4lOq4nG9YQdKOl5irf9AQ==", "file_map": { "12": { - "source": "// docs:start:from-trait\npub trait From {\n fn from(input: T) -> Self;\n}\n// docs:end:from-trait\n\nimpl From for T {\n fn from(input: T) -> T {\n input\n }\n}\n\n// docs:start:into-trait\npub trait Into {\n fn into(self) -> T;\n}\n\nimpl Into for U\nwhere\n T: From,\n{\n fn into(self) -> T {\n T::from(self)\n }\n}\n// docs:end:into-trait\n\n// docs:start:from-impls\n// Unsigned integers\n\nimpl From for u32 {\n fn from(value: u8) -> u32 {\n value as u32\n }\n}\n\nimpl From for u64 {\n fn from(value: u8) -> u64 {\n value as u64\n }\n}\nimpl From for u64 {\n fn from(value: u32) -> u64 {\n value as u64\n }\n}\n\nimpl From for u128 {\n fn from(value: u8) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u32) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u64) -> u128 {\n value as u128\n }\n}\n\nimpl From for Field {\n fn from(value: u8) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u32) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u64) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u128) -> Field {\n value as Field\n }\n}\n\n// Signed integers\n\nimpl From for i32 {\n fn from(value: i8) -> i32 {\n value as i32\n }\n}\n\nimpl From for i64 {\n fn from(value: i8) -> i64 {\n value as i64\n }\n}\nimpl From for i64 {\n fn from(value: i32) -> i64 {\n value as i64\n }\n}\n\n// Booleans\nimpl From for u8 {\n fn from(value: bool) -> u8 {\n value as u8\n }\n}\nimpl From for u32 {\n fn from(value: bool) -> u32 {\n value as u32\n }\n}\nimpl From for u64 {\n fn from(value: bool) -> u64 {\n value as u64\n }\n}\nimpl From for i8 {\n fn from(value: bool) -> i8 {\n value as i8\n }\n}\nimpl From for i32 {\n fn from(value: bool) -> i32 {\n value as i32\n }\n}\nimpl From for i64 {\n fn from(value: bool) -> i64 {\n value as i64\n }\n}\nimpl From for Field {\n fn from(value: bool) -> Field {\n value as Field\n }\n}\n// docs:end:from-impls\n\n/// A generic interface for casting between primitive types,\n/// equivalent of using the `as` keyword between values.\n///\n/// # Example\n///\n/// ```\n/// let x: Field = 1234567890;\n/// let y: u8 = x as u8;\n/// let z: u8 = x.as_();\n/// assert_eq(y, z);\n/// ```\npub trait AsPrimitive {\n /// The equivalent of doing `self as T`.\n fn as_(self) -> T;\n}\n\n#[generate_as_primitive_impls]\ncomptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted {\n let types = [\n quote { bool },\n quote { u8 },\n quote { u16 },\n quote { u32 },\n quote { u64 },\n quote { u128 },\n quote { i8 },\n quote { i16 },\n quote { i32 },\n quote { i64 },\n quote { Field },\n ];\n\n let mut impls = &[];\n for type1 in types {\n for type2 in types {\n let trait_impl = quote {\n impl AsPrimitive<$type1> for $type2 {\n fn as_(self) -> $type1 {\n self as $type1\n }\n }\n };\n\n impls = impls.push_back(trait_impl);\n }\n }\n impls.join(quote {})\n}\n", + "source": "// docs:start:from-trait\npub trait From {\n fn from(input: T) -> Self;\n}\n// docs:end:from-trait\n\nimpl From for T {\n fn from(input: T) -> T {\n input\n }\n}\n\n// docs:start:into-trait\npub trait Into {\n fn into(self) -> T;\n}\n\nimpl Into for U\nwhere\n T: From,\n{\n fn into(self) -> T {\n T::from(self)\n }\n}\n// docs:end:into-trait\n\n// docs:start:from-impls\n// Unsigned integers\n\nimpl From for u32 {\n fn from(value: u8) -> u32 {\n value as u32\n }\n}\n\nimpl From for u64 {\n fn from(value: u8) -> u64 {\n value as u64\n }\n}\nimpl From for u64 {\n fn from(value: u32) -> u64 {\n value as u64\n }\n}\n\nimpl From for u128 {\n fn from(value: u8) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u32) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u64) -> u128 {\n value as u128\n }\n}\n\nimpl From for Field {\n fn from(value: u8) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u32) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u64) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u128) -> Field {\n value as Field\n }\n}\n\n// Signed integers\n\nimpl From for i32 {\n fn from(value: i8) -> i32 {\n value as i32\n }\n}\n\nimpl From for i64 {\n fn from(value: i8) -> i64 {\n value as i64\n }\n}\nimpl From for i64 {\n fn from(value: i32) -> i64 {\n value as i64\n }\n}\n\n// Booleans\nimpl From for u8 {\n fn from(value: bool) -> u8 {\n value as u8\n }\n}\nimpl From for u32 {\n fn from(value: bool) -> u32 {\n value as u32\n }\n}\nimpl From for u64 {\n fn from(value: bool) -> u64 {\n value as u64\n }\n}\nimpl From for i8 {\n fn from(value: bool) -> i8 {\n value as i8\n }\n}\nimpl From for i32 {\n fn from(value: bool) -> i32 {\n value as i32\n }\n}\nimpl From for i64 {\n fn from(value: bool) -> i64 {\n value as i64\n }\n}\nimpl From for Field {\n fn from(value: bool) -> Field {\n value as Field\n }\n}\n// docs:end:from-impls\n\n/// A generic interface for casting between primitive types,\n/// equivalent of using the `as` keyword between values.\n///\n/// # Example\n///\n/// ```\n/// let x: Field = 1234567890;\n/// let y: u8 = x as u8;\n/// let z: u8 = x.as_();\n/// assert_eq(y, z);\n/// ```\npub trait AsPrimitive {\n /// The equivalent of doing `self as T`.\n fn as_(self) -> T;\n}\n\n#[generate_as_primitive_impls]\ncomptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted {\n let types = [\n quote { bool },\n quote { u8 },\n quote { u16 },\n quote { u32 },\n quote { u64 },\n quote { u128 },\n quote { i8 },\n quote { i16 },\n quote { i32 },\n quote { i64 },\n quote { Field },\n ];\n\n let mut impls = &[];\n for type1 in types {\n for type2 in types {\n let body = if type1 == type2 {\n quote { self }\n } else if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for $type2 {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n }\n impls.join(quote {})\n}\n", "path": "std/convert.nr" }, "39": { diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/5_over/execute__tests__force_brillig_true_inliner_9223372036854775807.snap b/tooling/nargo_cli/tests/snapshots/execution_success/5_over/execute__tests__force_brillig_true_inliner_9223372036854775807.snap index 48ebc3b159d..a271bf6d766 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/5_over/execute__tests__force_brillig_true_inliner_9223372036854775807.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/5_over/execute__tests__force_brillig_true_inliner_9223372036854775807.snap @@ -44,10 +44,10 @@ expression: artifact "unconstrained func 0", "[Const { destination: Direct(2), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(1), bit_size: Integer(U32), value: 32838 }, Const { destination: Direct(0), bit_size: Integer(U32), value: 3 }, Const { destination: Relative(3), bit_size: Integer(U32), value: 2 }, Const { destination: Relative(4), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(32836), size_address: Relative(3), offset_address: Relative(4) }, Cast { destination: Direct(32836), source: Direct(32836), bit_size: Integer(U32) }, Cast { destination: Direct(32837), source: Direct(32837), bit_size: Integer(U32) }, Mov { destination: Relative(1), source: Direct(32836) }, Mov { destination: Relative(2), source: Direct(32837) }, Call { location: 15 }, Call { location: 16 }, Const { destination: Relative(1), bit_size: Integer(U32), value: 32838 }, Const { destination: Relative(2), bit_size: Integer(U32), value: 0 }, Stop { return_data: HeapVector { pointer: Relative(1), size: Relative(2) } }, Return, Call { location: 36 }, Cast { destination: Relative(3), source: Relative(1), bit_size: Field }, BinaryFieldOp { destination: Relative(1), op: Mul, lhs: Relative(3), rhs: Relative(3) }, Cast { destination: Relative(4), source: Relative(1), bit_size: Integer(U32) }, Cast { destination: Relative(3), source: Relative(4), bit_size: Field }, Cast { destination: Relative(1), source: Relative(3), bit_size: Integer(U32) }, BinaryIntOp { destination: Relative(3), op: Equals, bit_size: U32, lhs: Relative(2), rhs: Relative(1) }, JumpIf { condition: Relative(3), location: 26 }, Const { destination: Relative(4), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(4) } }, Cast { destination: Relative(3), source: Relative(2), bit_size: Integer(U1) }, Cast { destination: Relative(1), source: Relative(3), bit_size: Integer(U32) }, Cast { destination: Relative(2), source: Relative(1), bit_size: Integer(U1) }, Const { destination: Relative(1), bit_size: Integer(U1), value: 0 }, BinaryIntOp { destination: Relative(3), op: LessThan, bit_size: U1, lhs: Relative(1), rhs: Relative(2) }, Const { destination: Relative(1), bit_size: Integer(U1), value: 1 }, JumpIf { condition: Relative(3), location: 35 }, Const { destination: Relative(2), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(2) } }, Return, Const { destination: Direct(32772), bit_size: Integer(U32), value: 30720 }, BinaryIntOp { destination: Direct(32771), op: LessThan, bit_size: U32, lhs: Direct(0), rhs: Direct(32772) }, JumpIf { condition: Direct(32771), location: 41 }, IndirectConst { destination_pointer: Direct(1), bit_size: Integer(U64), value: 17843811134343075018 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return]" ], - "debug_symbols": "pZPNroMgEIXfZdYuGH784VWapqGWNiQEDdWb3DS++4WCXl3oot3wgeM5HDKZF9z0dXxcjLt3T5CnF1y9sdY8LrZr1WA6F76+gMQFK5C8AKxBioAGZFUAJQmYQEHWASyBJ4iEEmQTUCXUCcEFSQGMZGImzWSZPHKaCphzXQavdYy1Chri98prN4B0o7UF/Cg7vn969sq9OSgfqsFRu1tgMLwbq+NuKv7VZF+KlGcxsnqRi60e9/UNkvn2BqlYHFizcaAHCQgXbM4Q9vWeB9v3YJRX2YJRgYsD0g9TVOSzl7By5YF7HuXXLznqqFg6WpK9jh7pm1lPCX6pFxv9OZxUa/xmGKfo5I26Wp2P99G1q+rw28+VeZh737X6NnodnVYTHdZT6ADH8xRv+wM=", + "debug_symbols": "pZPNroMgEIXfZdYu+BEVXqVpGmppQ0LQUL3JTeO736GIVxe6aDd84HgOh0zmBTdzHR8X6+/dE9TpBddgnbOPi+taPdjO49cXkLjQGlRZAG1ACYQEVRfASAJNYKAaBE8oE0RCBUoi6oQmAV0oKYCTmXQmm8lnlpHTVEDOdRmCMTHWKijG73UwfgDlR+cK+NFufP/07LV/c9ABq+ho/A2JhnfrTNxNxb+a7EspK2cx5c0iF1s93ddLSvLtkjKxOHC5cWAHCUgpeM6A+2bPg+97cCZzCtyWiwNlH6aoyWcv4dXKg+55VF+/5KijYuloRfY6eqSXWc8I/VIvNvoznnRrw2YYp+gUrL46Mx/vo29X1eG3z5U8zH3oWnMbg4lOq4nG9YQdKOl5irf9AQ==", "file_map": { "12": { - "source": "// docs:start:from-trait\npub trait From {\n fn from(input: T) -> Self;\n}\n// docs:end:from-trait\n\nimpl From for T {\n fn from(input: T) -> T {\n input\n }\n}\n\n// docs:start:into-trait\npub trait Into {\n fn into(self) -> T;\n}\n\nimpl Into for U\nwhere\n T: From,\n{\n fn into(self) -> T {\n T::from(self)\n }\n}\n// docs:end:into-trait\n\n// docs:start:from-impls\n// Unsigned integers\n\nimpl From for u32 {\n fn from(value: u8) -> u32 {\n value as u32\n }\n}\n\nimpl From for u64 {\n fn from(value: u8) -> u64 {\n value as u64\n }\n}\nimpl From for u64 {\n fn from(value: u32) -> u64 {\n value as u64\n }\n}\n\nimpl From for u128 {\n fn from(value: u8) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u32) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u64) -> u128 {\n value as u128\n }\n}\n\nimpl From for Field {\n fn from(value: u8) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u32) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u64) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u128) -> Field {\n value as Field\n }\n}\n\n// Signed integers\n\nimpl From for i32 {\n fn from(value: i8) -> i32 {\n value as i32\n }\n}\n\nimpl From for i64 {\n fn from(value: i8) -> i64 {\n value as i64\n }\n}\nimpl From for i64 {\n fn from(value: i32) -> i64 {\n value as i64\n }\n}\n\n// Booleans\nimpl From for u8 {\n fn from(value: bool) -> u8 {\n value as u8\n }\n}\nimpl From for u32 {\n fn from(value: bool) -> u32 {\n value as u32\n }\n}\nimpl From for u64 {\n fn from(value: bool) -> u64 {\n value as u64\n }\n}\nimpl From for i8 {\n fn from(value: bool) -> i8 {\n value as i8\n }\n}\nimpl From for i32 {\n fn from(value: bool) -> i32 {\n value as i32\n }\n}\nimpl From for i64 {\n fn from(value: bool) -> i64 {\n value as i64\n }\n}\nimpl From for Field {\n fn from(value: bool) -> Field {\n value as Field\n }\n}\n// docs:end:from-impls\n\n/// A generic interface for casting between primitive types,\n/// equivalent of using the `as` keyword between values.\n///\n/// # Example\n///\n/// ```\n/// let x: Field = 1234567890;\n/// let y: u8 = x as u8;\n/// let z: u8 = x.as_();\n/// assert_eq(y, z);\n/// ```\npub trait AsPrimitive {\n /// The equivalent of doing `self as T`.\n fn as_(self) -> T;\n}\n\n#[generate_as_primitive_impls]\ncomptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted {\n let types = [\n quote { bool },\n quote { u8 },\n quote { u16 },\n quote { u32 },\n quote { u64 },\n quote { u128 },\n quote { i8 },\n quote { i16 },\n quote { i32 },\n quote { i64 },\n quote { Field },\n ];\n\n let mut impls = &[];\n for type1 in types {\n for type2 in types {\n let trait_impl = quote {\n impl AsPrimitive<$type1> for $type2 {\n fn as_(self) -> $type1 {\n self as $type1\n }\n }\n };\n\n impls = impls.push_back(trait_impl);\n }\n }\n impls.join(quote {})\n}\n", + "source": "// docs:start:from-trait\npub trait From {\n fn from(input: T) -> Self;\n}\n// docs:end:from-trait\n\nimpl From for T {\n fn from(input: T) -> T {\n input\n }\n}\n\n// docs:start:into-trait\npub trait Into {\n fn into(self) -> T;\n}\n\nimpl Into for U\nwhere\n T: From,\n{\n fn into(self) -> T {\n T::from(self)\n }\n}\n// docs:end:into-trait\n\n// docs:start:from-impls\n// Unsigned integers\n\nimpl From for u32 {\n fn from(value: u8) -> u32 {\n value as u32\n }\n}\n\nimpl From for u64 {\n fn from(value: u8) -> u64 {\n value as u64\n }\n}\nimpl From for u64 {\n fn from(value: u32) -> u64 {\n value as u64\n }\n}\n\nimpl From for u128 {\n fn from(value: u8) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u32) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u64) -> u128 {\n value as u128\n }\n}\n\nimpl From for Field {\n fn from(value: u8) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u32) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u64) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u128) -> Field {\n value as Field\n }\n}\n\n// Signed integers\n\nimpl From for i32 {\n fn from(value: i8) -> i32 {\n value as i32\n }\n}\n\nimpl From for i64 {\n fn from(value: i8) -> i64 {\n value as i64\n }\n}\nimpl From for i64 {\n fn from(value: i32) -> i64 {\n value as i64\n }\n}\n\n// Booleans\nimpl From for u8 {\n fn from(value: bool) -> u8 {\n value as u8\n }\n}\nimpl From for u32 {\n fn from(value: bool) -> u32 {\n value as u32\n }\n}\nimpl From for u64 {\n fn from(value: bool) -> u64 {\n value as u64\n }\n}\nimpl From for i8 {\n fn from(value: bool) -> i8 {\n value as i8\n }\n}\nimpl From for i32 {\n fn from(value: bool) -> i32 {\n value as i32\n }\n}\nimpl From for i64 {\n fn from(value: bool) -> i64 {\n value as i64\n }\n}\nimpl From for Field {\n fn from(value: bool) -> Field {\n value as Field\n }\n}\n// docs:end:from-impls\n\n/// A generic interface for casting between primitive types,\n/// equivalent of using the `as` keyword between values.\n///\n/// # Example\n///\n/// ```\n/// let x: Field = 1234567890;\n/// let y: u8 = x as u8;\n/// let z: u8 = x.as_();\n/// assert_eq(y, z);\n/// ```\npub trait AsPrimitive {\n /// The equivalent of doing `self as T`.\n fn as_(self) -> T;\n}\n\n#[generate_as_primitive_impls]\ncomptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted {\n let types = [\n quote { bool },\n quote { u8 },\n quote { u16 },\n quote { u32 },\n quote { u64 },\n quote { u128 },\n quote { i8 },\n quote { i16 },\n quote { i32 },\n quote { i64 },\n quote { Field },\n ];\n\n let mut impls = &[];\n for type1 in types {\n for type2 in types {\n let body = if type1 == type2 {\n quote { self }\n } else if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for $type2 {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n }\n impls.join(quote {})\n}\n", "path": "std/convert.nr" }, "39": { diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/6_array/execute__tests__force_brillig_false_inliner_-9223372036854775808.snap b/tooling/nargo_cli/tests/snapshots/execution_success/6_array/execute__tests__force_brillig_false_inliner_-9223372036854775808.snap index cc1325ef576..81ba47544f3 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/6_array/execute__tests__force_brillig_false_inliner_-9223372036854775808.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/6_array/execute__tests__force_brillig_false_inliner_-9223372036854775808.snap @@ -510,10 +510,10 @@ expression: artifact "unconstrained func 1", "[Const { destination: Direct(21), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(20), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(0), size_address: Direct(21), offset_address: Direct(20) }, Const { destination: Direct(2), bit_size: Field, value: 0 }, BinaryFieldOp { destination: Direct(3), op: Equals, lhs: Direct(0), rhs: Direct(2) }, JumpIf { condition: Direct(3), location: 8 }, Const { destination: Direct(1), bit_size: Field, value: 1 }, BinaryFieldOp { destination: Direct(0), op: Div, lhs: Direct(1), rhs: Direct(0) }, Stop { return_data: HeapVector { pointer: Direct(20), size: Direct(21) } }]" ], - "debug_symbols": "vZndbhNJEEbfxde56KrqX15ltUImGGTJciKTIK0Q777T3XUSg2STHcNefQdm+rinamrGVr5tPu4+PH9+vz9+eviyeffXt82H0/5w2H9+f3i43z7tH47L/377frfhn++fTrvd8l+bs+PLqsftaXd82rw7Ph8Od5uv28PzOOnL4/Y48ml7Wo6Gu83u+HHJRfhpf9h1+n73ujpcXiq5+GIp8rI8vXm9SvP1qnHNeuXz1W78/HXro7A+ljXrc2Z90RXrrbDeal2xPpr5+mhr9h9zZX1pq9bTv9js0nq5Iig5RTeUfLYFaz8q5Mo9HPT1Lg7nffhZolcasfSfTmh6vZVEV+7DJF/cx1vrUS8qrrUkKC0528LPLcmXBU0CT5Qmmi5eRblWipjspRSxhJUSy2cSuShpN/f1bfW0iyOucnM9Va+WIp/VM9eLEru5FL/Yx9v6+gvJ2/qq+f+cV101bOnl5sgXh02v3J/59Q2UNV/cgl17h4dQXusZzp7D/02S2pkkXpTonxy2JFxJWvU+z8L7LJutWF9evo+UePHz7faHp7394ZkuDrvVm1thv+Mhbr/jIR7lT95XpXAlpa65L1pgSpuGFetry7etjzxnalrzPbFFhrulNd/zWuPzW1vzPVMkMhYi6ccn5d/Lv7b3+9MPv402osuD824jNiMud8gSaUZeVi5RZtR5ShuhYZyiMkPHKWoz4jwlzcjzlDKjzlPaCAvjFJMZOk4xmxHnKWlGnqeUGXWe0kbExbL0PS6W5f6NOmOxLM2IccZikUUTs2fxrJ5tZgqe4qme5hk93Zf6tpaSp+JZPdvMHDzFUz3NM3omT/fl7luuIlfPNrMET/FUT/OMnskze7qv1FGO0kZUv9rqV1v9aqtfbfWrrX611atXvXrVq1e9es19bfH1X0xNPc0zeibP7Fk8q2ebuTzkAQG8gMs3CSACCchAASrgfREJgACYxWspEoEEZKAAFfAOiQZAAAUw67wrpY/ISC+saAEq4LUVC4AAChgQgQRgNq+xWAWocqTKkSpHBQyIQAIygDlS5UiVE1VOVDlR5UT/Ev1L9I+hEqZKGCtJVDlT5UyVM1XOVDnTv0z/Mv1jvoQBEyZM+oj1nvQRG0mVC1UuVLlQ5UKVC/0r9K/QP4ZNmDZh3KRS5UqVK1WuVLlS5Ur/Kv1r9I+5EwZPmDxpVLlR5UaVG1VuVLl5/zQEQAAFDIiAV1lDBgpQAa+ySgAEUMCACGDu89d6Fk+vsopXWTUAAihgQAQSkIECYFavsloABFDAgAgkIAMFqEA391fimL/x3hSgvwn7u7PP34QIJCADBahAc+jzN0EAzAlzwpwwJ8wJc8KcMGfMGXPGnDFnzBlzxpwxZ8wZc8FcMBfMBXPB3CdwVKxP4ATMBXPBXDFXzBVzxVwxV/Zc2XPFXDFXzA1zw9wwN8wNc8PcMDfMDXNzs4UACKCAARFIQAYKUAHM4nediQCYBbNgFsyCWTALZsGs7FnZs2LuMzg+q8/gBMyKWTErZsVsmA2zYTb2bOzZMBtmw2yYDXPEHDEzg8YMGjNozKAxg8YMGjNozKAxg8YMGjNozKAxg8YMGjNoYwatQzf3L71jBjuMGRzfjQVQDhkQOZSAbs4dClA51BzGDPblYwYHKIcMiL68z+CEzKECsOfCnscMlg7d3DooYEAEEpCBAlSgOYwZHIC5YW6YG+aGuWFumBvm5uYYAiCAAgZEIAEZKEAFMAtmwSyYBbNgFsyCWTALZsGsmBWzYlbMilkxK2bFrJgV85jB/uP26/a033447L7Mv7F9ej7en/3J7emfR47wR7nH08P97uPzadd/go5jy4/SfwE=", + "debug_symbols": "vZndbttIDEbfxde5GJLzx77KYlGkqVsEMJLATQosir77ajQ8iVvAblZp9+o7rTTHI1KUbOTb7uP+w9Pn97d3n+6/7N799W334Xh7ONx+fn+4v7l+vL2/W/732/erHf98/3jc75f/2p0cX1Y9XB/3d4+7d3dPh8PV7uv14Wk96cvD9d2aj9fH5Wi62u3vPi65CD/dHvaDvl+9rE7nl0ptsViaPC8vr16v4rFeNW9Zr3y+2hs/f9v6LKzPbcv6WlnfdMN6a6y33jesz2axPtuW/efaWd9803r6l93OrZcLglZLDkOrJ1sw/1EhF+7hpC93cTrtw88SvdAIdcZowZdbWXTjPkzq2X28th79rOJSS5LSkpMt/NySel7gkiiFi5azV9EulSIXey5FbmmjxOqJRM5K/M19fV097eyIq7y5nqoXS1FP6ln7WYm9uRS/2Mfr+voLyev6qvX/nFfdNGzl+eaoZ4dNL9yf9eUNVLWe3YJdeoen1F7qmU6ew/9NUvxEks9K9E8OWxGupGx6n1fhfVbNNqxvz99HWj77+fb2h6e9/uFZzg679Te3wn7HQ9x+x0M8y5+8r1rjSlrfcl94Ykpd04b13evb1meeM71s+Z7omeH2suV7njuf777le6ZIpoMi5ccn5d/Lv65vbo8//DbaiS4Pzqud2Iy83CFLlBl1WblEm9HnKb6GpvUUlRm6nqI2I89Tyow6T2kz+jzF17C0nmIyQ9dTzGbkeUqZUecpbUafp/gaebEsfc+LZRmRrDMWy9KMnGcsFlk0uUa2yB7pM0uKlEiNtMgcGb4ytrWUvLTIHukza4qUSI20yBxZIsNXh2+5itojfWZLkRKpkRaZI0tkjQxf62s5mq/R42p7XG2Pq+1xtT2utsfV9qhej+r1qF6P6nn4fPGNX0yukRaZI0tkjWyRPdJnLg95QIAo4PJNAshAASrQgA5EX0QSIABmiVqKZKAAFWhAB6JDogkQQAHMOu9KGSOyZhRWtAEdiNqKJUAABQzIQAEwW9RYrANUOVPlTJWzAgZkoAAVwJypcqbKhSoXqlyocqF/hf4V+sdQCVMljJUUqlypcqXKlSpXqlzpX6V/lf4xX8KACRMmY8RGT8aIrUmVG1VuVLlR5UaVG/1r9K/RP4ZNmDZh3KRT5U6VO1XuVLlT5U7/Ov1z+sfcCYMnTJ44VXaq7FTZqbJTZY/+aUqAAAoYkIGosqYKNKADUWWVBAiggAEZwDzmz0e2yKiySlRZNQECKGBABgpQgQZg1qiyWgIEUMCADBSgAg3owDCPV+I6f+t7U4DxJhzvzjF/EzJQgAo0oAMeMOZvggCYC+aCuWAumAvmgrlgrpgr5oq5Yq6YK+aKuWKumCvmhrlhbpgb5oZ5TOBasTGBEzA3zA1zx9wxd8wdc8fc2XNnzx1zx9wxO2bH7Jgds2N2zI7ZMTtmD7OlBAiggAEZKEAFGtABzBJ3nYkAmAWzYBbMglkwC2bBrOxZ2bNiHjO4ftaYwQmYFbNiVsyK2TAbZsNs7NnYs2E2zIbZMBvmjDljZgaNGTRm0JhBYwaNGTRm0JhBYwaNGTRm0JhBYwaNGTRm0NYZtAHDPL70rjM4YJ3B9buxAMohAzKHCjDMdUADOoc8YJ3BsXydwRWUQwbkWD5mcELlUAPYc2PP6wy2AcPsAxQwIAMFqEADOuAB6wyugNkxO2bH7Jgds2N2zB7mnBIggAIGZKAAFWhABzALZsEsmAWzYBbMglkwC2bBrJgVs2JWzIpZMStmxayYFfM6g+PH7dfr4+31h8P+y/wb26enu5uTP7k9/vPAEf4o93C8v9l/fDrux0/Q9djyo/Rf", "file_map": { "12": { - "source": "// docs:start:from-trait\npub trait From {\n fn from(input: T) -> Self;\n}\n// docs:end:from-trait\n\nimpl From for T {\n fn from(input: T) -> T {\n input\n }\n}\n\n// docs:start:into-trait\npub trait Into {\n fn into(self) -> T;\n}\n\nimpl Into for U\nwhere\n T: From,\n{\n fn into(self) -> T {\n T::from(self)\n }\n}\n// docs:end:into-trait\n\n// docs:start:from-impls\n// Unsigned integers\n\nimpl From for u32 {\n fn from(value: u8) -> u32 {\n value as u32\n }\n}\n\nimpl From for u64 {\n fn from(value: u8) -> u64 {\n value as u64\n }\n}\nimpl From for u64 {\n fn from(value: u32) -> u64 {\n value as u64\n }\n}\n\nimpl From for u128 {\n fn from(value: u8) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u32) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u64) -> u128 {\n value as u128\n }\n}\n\nimpl From for Field {\n fn from(value: u8) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u32) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u64) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u128) -> Field {\n value as Field\n }\n}\n\n// Signed integers\n\nimpl From for i32 {\n fn from(value: i8) -> i32 {\n value as i32\n }\n}\n\nimpl From for i64 {\n fn from(value: i8) -> i64 {\n value as i64\n }\n}\nimpl From for i64 {\n fn from(value: i32) -> i64 {\n value as i64\n }\n}\n\n// Booleans\nimpl From for u8 {\n fn from(value: bool) -> u8 {\n value as u8\n }\n}\nimpl From for u32 {\n fn from(value: bool) -> u32 {\n value as u32\n }\n}\nimpl From for u64 {\n fn from(value: bool) -> u64 {\n value as u64\n }\n}\nimpl From for i8 {\n fn from(value: bool) -> i8 {\n value as i8\n }\n}\nimpl From for i32 {\n fn from(value: bool) -> i32 {\n value as i32\n }\n}\nimpl From for i64 {\n fn from(value: bool) -> i64 {\n value as i64\n }\n}\nimpl From for Field {\n fn from(value: bool) -> Field {\n value as Field\n }\n}\n// docs:end:from-impls\n\n/// A generic interface for casting between primitive types,\n/// equivalent of using the `as` keyword between values.\n///\n/// # Example\n///\n/// ```\n/// let x: Field = 1234567890;\n/// let y: u8 = x as u8;\n/// let z: u8 = x.as_();\n/// assert_eq(y, z);\n/// ```\npub trait AsPrimitive {\n /// The equivalent of doing `self as T`.\n fn as_(self) -> T;\n}\n\n#[generate_as_primitive_impls]\ncomptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted {\n let types = [\n quote { bool },\n quote { u8 },\n quote { u16 },\n quote { u32 },\n quote { u64 },\n quote { u128 },\n quote { i8 },\n quote { i16 },\n quote { i32 },\n quote { i64 },\n quote { Field },\n ];\n\n let mut impls = &[];\n for type1 in types {\n for type2 in types {\n let trait_impl = quote {\n impl AsPrimitive<$type1> for $type2 {\n fn as_(self) -> $type1 {\n self as $type1\n }\n }\n };\n\n impls = impls.push_back(trait_impl);\n }\n }\n impls.join(quote {})\n}\n", + "source": "// docs:start:from-trait\npub trait From {\n fn from(input: T) -> Self;\n}\n// docs:end:from-trait\n\nimpl From for T {\n fn from(input: T) -> T {\n input\n }\n}\n\n// docs:start:into-trait\npub trait Into {\n fn into(self) -> T;\n}\n\nimpl Into for U\nwhere\n T: From,\n{\n fn into(self) -> T {\n T::from(self)\n }\n}\n// docs:end:into-trait\n\n// docs:start:from-impls\n// Unsigned integers\n\nimpl From for u32 {\n fn from(value: u8) -> u32 {\n value as u32\n }\n}\n\nimpl From for u64 {\n fn from(value: u8) -> u64 {\n value as u64\n }\n}\nimpl From for u64 {\n fn from(value: u32) -> u64 {\n value as u64\n }\n}\n\nimpl From for u128 {\n fn from(value: u8) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u32) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u64) -> u128 {\n value as u128\n }\n}\n\nimpl From for Field {\n fn from(value: u8) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u32) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u64) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u128) -> Field {\n value as Field\n }\n}\n\n// Signed integers\n\nimpl From for i32 {\n fn from(value: i8) -> i32 {\n value as i32\n }\n}\n\nimpl From for i64 {\n fn from(value: i8) -> i64 {\n value as i64\n }\n}\nimpl From for i64 {\n fn from(value: i32) -> i64 {\n value as i64\n }\n}\n\n// Booleans\nimpl From for u8 {\n fn from(value: bool) -> u8 {\n value as u8\n }\n}\nimpl From for u32 {\n fn from(value: bool) -> u32 {\n value as u32\n }\n}\nimpl From for u64 {\n fn from(value: bool) -> u64 {\n value as u64\n }\n}\nimpl From for i8 {\n fn from(value: bool) -> i8 {\n value as i8\n }\n}\nimpl From for i32 {\n fn from(value: bool) -> i32 {\n value as i32\n }\n}\nimpl From for i64 {\n fn from(value: bool) -> i64 {\n value as i64\n }\n}\nimpl From for Field {\n fn from(value: bool) -> Field {\n value as Field\n }\n}\n// docs:end:from-impls\n\n/// A generic interface for casting between primitive types,\n/// equivalent of using the `as` keyword between values.\n///\n/// # Example\n///\n/// ```\n/// let x: Field = 1234567890;\n/// let y: u8 = x as u8;\n/// let z: u8 = x.as_();\n/// assert_eq(y, z);\n/// ```\npub trait AsPrimitive {\n /// The equivalent of doing `self as T`.\n fn as_(self) -> T;\n}\n\n#[generate_as_primitive_impls]\ncomptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted {\n let types = [\n quote { bool },\n quote { u8 },\n quote { u16 },\n quote { u32 },\n quote { u64 },\n quote { u128 },\n quote { i8 },\n quote { i16 },\n quote { i32 },\n quote { i64 },\n quote { Field },\n ];\n\n let mut impls = &[];\n for type1 in types {\n for type2 in types {\n let body = if type1 == type2 {\n quote { self }\n } else if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for $type2 {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n }\n impls.join(quote {})\n}\n", "path": "std/convert.nr" }, "39": { diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/6_array/execute__tests__force_brillig_false_inliner_0.snap b/tooling/nargo_cli/tests/snapshots/execution_success/6_array/execute__tests__force_brillig_false_inliner_0.snap index cc1325ef576..81ba47544f3 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/6_array/execute__tests__force_brillig_false_inliner_0.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/6_array/execute__tests__force_brillig_false_inliner_0.snap @@ -510,10 +510,10 @@ expression: artifact "unconstrained func 1", "[Const { destination: Direct(21), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(20), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(0), size_address: Direct(21), offset_address: Direct(20) }, Const { destination: Direct(2), bit_size: Field, value: 0 }, BinaryFieldOp { destination: Direct(3), op: Equals, lhs: Direct(0), rhs: Direct(2) }, JumpIf { condition: Direct(3), location: 8 }, Const { destination: Direct(1), bit_size: Field, value: 1 }, BinaryFieldOp { destination: Direct(0), op: Div, lhs: Direct(1), rhs: Direct(0) }, Stop { return_data: HeapVector { pointer: Direct(20), size: Direct(21) } }]" ], - "debug_symbols": "vZndbhNJEEbfxde56KrqX15ltUImGGTJciKTIK0Q777T3XUSg2STHcNefQdm+rinamrGVr5tPu4+PH9+vz9+eviyeffXt82H0/5w2H9+f3i43z7tH47L/377frfhn++fTrvd8l+bs+PLqsftaXd82rw7Ph8Od5uv28PzOOnL4/Y48ml7Wo6Gu83u+HHJRfhpf9h1+n73ujpcXiq5+GIp8rI8vXm9SvP1qnHNeuXz1W78/HXro7A+ljXrc2Z90RXrrbDeal2xPpr5+mhr9h9zZX1pq9bTv9js0nq5Iig5RTeUfLYFaz8q5Mo9HPT1Lg7nffhZolcasfSfTmh6vZVEV+7DJF/cx1vrUS8qrrUkKC0528LPLcmXBU0CT5Qmmi5eRblWipjspRSxhJUSy2cSuShpN/f1bfW0iyOucnM9Va+WIp/VM9eLEru5FL/Yx9v6+gvJ2/qq+f+cV101bOnl5sgXh02v3J/59Q2UNV/cgl17h4dQXusZzp7D/02S2pkkXpTonxy2JFxJWvU+z8L7LJutWF9evo+UePHz7faHp7394ZkuDrvVm1thv+Mhbr/jIR7lT95XpXAlpa65L1pgSpuGFetry7etjzxnalrzPbFFhrulNd/zWuPzW1vzPVMkMhYi6ccn5d/Lv7b3+9MPv402osuD824jNiMud8gSaUZeVi5RZtR5ShuhYZyiMkPHKWoz4jwlzcjzlDKjzlPaCAvjFJMZOk4xmxHnKWlGnqeUGXWe0kbExbL0PS6W5f6NOmOxLM2IccZikUUTs2fxrJ5tZgqe4qme5hk93Zf6tpaSp+JZPdvMHDzFUz3NM3omT/fl7luuIlfPNrMET/FUT/OMnskze7qv1FGO0kZUv9rqV1v9aqtfbfWrrX611atXvXrVq1e9es19bfH1X0xNPc0zeibP7Fk8q2ebuTzkAQG8gMs3CSACCchAASrgfREJgACYxWspEoEEZKAAFfAOiQZAAAUw67wrpY/ISC+saAEq4LUVC4AAChgQgQRgNq+xWAWocqTKkSpHBQyIQAIygDlS5UiVE1VOVDlR5UT/Ev1L9I+hEqZKGCtJVDlT5UyVM1XOVDnTv0z/Mv1jvoQBEyZM+oj1nvQRG0mVC1UuVLlQ5UKVC/0r9K/QP4ZNmDZh3KRS5UqVK1WuVLlS5Ur/Kv1r9I+5EwZPmDxpVLlR5UaVG1VuVLl5/zQEQAAFDIiAV1lDBgpQAa+ySgAEUMCACGDu89d6Fk+vsopXWTUAAihgQAQSkIECYFavsloABFDAgAgkIAMFqEA391fimL/x3hSgvwn7u7PP34QIJCADBahAc+jzN0EAzAlzwpwwJ8wJc8KcMGfMGXPGnDFnzBlzxpwxZ8wZc8FcMBfMBXPB3CdwVKxP4ATMBXPBXDFXzBVzxVwxV/Zc2XPFXDFXzA1zw9wwN8wNc8PcMDfMDXNzs4UACKCAARFIQAYKUAHM4nediQCYBbNgFsyCWTALZsGs7FnZs2LuMzg+q8/gBMyKWTErZsVsmA2zYTb2bOzZMBtmw2yYDXPEHDEzg8YMGjNozKAxg8YMGjNozKAxg8YMGjNozKAxg8YMGjNoYwatQzf3L71jBjuMGRzfjQVQDhkQOZSAbs4dClA51BzGDPblYwYHKIcMiL68z+CEzKECsOfCnscMlg7d3DooYEAEEpCBAlSgOYwZHIC5YW6YG+aGuWFumBvm5uYYAiCAAgZEIAEZKEAFMAtmwSyYBbNgFsyCWTALZsGsmBWzYlbMilkxK2bFrJgV85jB/uP26/a033447L7Mv7F9ej7en/3J7emfR47wR7nH08P97uPzadd/go5jy4/SfwE=", + "debug_symbols": "vZndbttIDEbfxde5GJLzx77KYlGkqVsEMJLATQosir77ajQ8iVvAblZp9+o7rTTHI1KUbOTb7uP+w9Pn97d3n+6/7N799W334Xh7ONx+fn+4v7l+vL2/W/732/erHf98/3jc75f/2p0cX1Y9XB/3d4+7d3dPh8PV7uv14Wk96cvD9d2aj9fH5Wi62u3vPi65CD/dHvaDvl+9rE7nl0ptsViaPC8vr16v4rFeNW9Zr3y+2hs/f9v6LKzPbcv6WlnfdMN6a6y33jesz2axPtuW/efaWd9803r6l93OrZcLglZLDkOrJ1sw/1EhF+7hpC93cTrtw88SvdAIdcZowZdbWXTjPkzq2X28th79rOJSS5LSkpMt/NySel7gkiiFi5azV9EulSIXey5FbmmjxOqJRM5K/M19fV097eyIq7y5nqoXS1FP6ln7WYm9uRS/2Mfr+voLyev6qvX/nFfdNGzl+eaoZ4dNL9yf9eUNVLWe3YJdeoen1F7qmU6ew/9NUvxEks9K9E8OWxGupGx6n1fhfVbNNqxvz99HWj77+fb2h6e9/uFZzg679Te3wn7HQ9x+x0M8y5+8r1rjSlrfcl94Ykpd04b13evb1meeM71s+Z7omeH2suV7njuf777le6ZIpoMi5ccn5d/Lv65vbo8//DbaiS4Pzqud2Iy83CFLlBl1WblEm9HnKb6GpvUUlRm6nqI2I89Tyow6T2kz+jzF17C0nmIyQ9dTzGbkeUqZUecpbUafp/gaebEsfc+LZRmRrDMWy9KMnGcsFlk0uUa2yB7pM0uKlEiNtMgcGb4ytrWUvLTIHukza4qUSI20yBxZIsNXh2+5itojfWZLkRKpkRaZI0tkjQxf62s5mq/R42p7XG2Pq+1xtT2utsfV9qhej+r1qF6P6nn4fPGNX0yukRaZI0tkjWyRPdJnLg95QIAo4PJNAshAASrQgA5EX0QSIABmiVqKZKAAFWhAB6JDogkQQAHMOu9KGSOyZhRWtAEdiNqKJUAABQzIQAEwW9RYrANUOVPlTJWzAgZkoAAVwJypcqbKhSoXqlyocqF/hf4V+sdQCVMljJUUqlypcqXKlSpXqlzpX6V/lf4xX8KACRMmY8RGT8aIrUmVG1VuVLlR5UaVG/1r9K/RP4ZNmDZh3KRT5U6VO1XuVLlT5U7/Ov1z+sfcCYMnTJ44VXaq7FTZqbJTZY/+aUqAAAoYkIGosqYKNKADUWWVBAiggAEZwDzmz0e2yKiySlRZNQECKGBABgpQgQZg1qiyWgIEUMCADBSgAg3owDCPV+I6f+t7U4DxJhzvzjF/EzJQgAo0oAMeMOZvggCYC+aCuWAumAvmgrlgrpgr5oq5Yq6YK+aKuWKumCvmhrlhbpgb5oZ5TOBasTGBEzA3zA1zx9wxd8wdc8fc2XNnzx1zx9wxO2bH7Jgds2N2zI7ZMTtmD7OlBAiggAEZKEAFGtABzBJ3nYkAmAWzYBbMglkwC2bBrOxZ2bNiHjO4ftaYwQmYFbNiVsyK2TAbZsNs7NnYs2E2zIbZMBvmjDljZgaNGTRm0JhBYwaNGTRm0JhBYwaNGTRm0JhBYwaNGTRm0NYZtAHDPL70rjM4YJ3B9buxAMohAzKHCjDMdUADOoc8YJ3BsXydwRWUQwbkWD5mcELlUAPYc2PP6wy2AcPsAxQwIAMFqEADOuAB6wyugNkxO2bH7Jgds2N2zB7mnBIggAIGZKAAFWhABzALZsEsmAWzYBbMglkwC2bBrJgVs2JWzIpZMStmxayYFfM6g+PH7dfr4+31h8P+y/wb26enu5uTP7k9/vPAEf4o93C8v9l/fDrux0/Q9djyo/Rf", "file_map": { "12": { - "source": "// docs:start:from-trait\npub trait From {\n fn from(input: T) -> Self;\n}\n// docs:end:from-trait\n\nimpl From for T {\n fn from(input: T) -> T {\n input\n }\n}\n\n// docs:start:into-trait\npub trait Into {\n fn into(self) -> T;\n}\n\nimpl Into for U\nwhere\n T: From,\n{\n fn into(self) -> T {\n T::from(self)\n }\n}\n// docs:end:into-trait\n\n// docs:start:from-impls\n// Unsigned integers\n\nimpl From for u32 {\n fn from(value: u8) -> u32 {\n value as u32\n }\n}\n\nimpl From for u64 {\n fn from(value: u8) -> u64 {\n value as u64\n }\n}\nimpl From for u64 {\n fn from(value: u32) -> u64 {\n value as u64\n }\n}\n\nimpl From for u128 {\n fn from(value: u8) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u32) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u64) -> u128 {\n value as u128\n }\n}\n\nimpl From for Field {\n fn from(value: u8) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u32) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u64) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u128) -> Field {\n value as Field\n }\n}\n\n// Signed integers\n\nimpl From for i32 {\n fn from(value: i8) -> i32 {\n value as i32\n }\n}\n\nimpl From for i64 {\n fn from(value: i8) -> i64 {\n value as i64\n }\n}\nimpl From for i64 {\n fn from(value: i32) -> i64 {\n value as i64\n }\n}\n\n// Booleans\nimpl From for u8 {\n fn from(value: bool) -> u8 {\n value as u8\n }\n}\nimpl From for u32 {\n fn from(value: bool) -> u32 {\n value as u32\n }\n}\nimpl From for u64 {\n fn from(value: bool) -> u64 {\n value as u64\n }\n}\nimpl From for i8 {\n fn from(value: bool) -> i8 {\n value as i8\n }\n}\nimpl From for i32 {\n fn from(value: bool) -> i32 {\n value as i32\n }\n}\nimpl From for i64 {\n fn from(value: bool) -> i64 {\n value as i64\n }\n}\nimpl From for Field {\n fn from(value: bool) -> Field {\n value as Field\n }\n}\n// docs:end:from-impls\n\n/// A generic interface for casting between primitive types,\n/// equivalent of using the `as` keyword between values.\n///\n/// # Example\n///\n/// ```\n/// let x: Field = 1234567890;\n/// let y: u8 = x as u8;\n/// let z: u8 = x.as_();\n/// assert_eq(y, z);\n/// ```\npub trait AsPrimitive {\n /// The equivalent of doing `self as T`.\n fn as_(self) -> T;\n}\n\n#[generate_as_primitive_impls]\ncomptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted {\n let types = [\n quote { bool },\n quote { u8 },\n quote { u16 },\n quote { u32 },\n quote { u64 },\n quote { u128 },\n quote { i8 },\n quote { i16 },\n quote { i32 },\n quote { i64 },\n quote { Field },\n ];\n\n let mut impls = &[];\n for type1 in types {\n for type2 in types {\n let trait_impl = quote {\n impl AsPrimitive<$type1> for $type2 {\n fn as_(self) -> $type1 {\n self as $type1\n }\n }\n };\n\n impls = impls.push_back(trait_impl);\n }\n }\n impls.join(quote {})\n}\n", + "source": "// docs:start:from-trait\npub trait From {\n fn from(input: T) -> Self;\n}\n// docs:end:from-trait\n\nimpl From for T {\n fn from(input: T) -> T {\n input\n }\n}\n\n// docs:start:into-trait\npub trait Into {\n fn into(self) -> T;\n}\n\nimpl Into for U\nwhere\n T: From,\n{\n fn into(self) -> T {\n T::from(self)\n }\n}\n// docs:end:into-trait\n\n// docs:start:from-impls\n// Unsigned integers\n\nimpl From for u32 {\n fn from(value: u8) -> u32 {\n value as u32\n }\n}\n\nimpl From for u64 {\n fn from(value: u8) -> u64 {\n value as u64\n }\n}\nimpl From for u64 {\n fn from(value: u32) -> u64 {\n value as u64\n }\n}\n\nimpl From for u128 {\n fn from(value: u8) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u32) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u64) -> u128 {\n value as u128\n }\n}\n\nimpl From for Field {\n fn from(value: u8) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u32) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u64) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u128) -> Field {\n value as Field\n }\n}\n\n// Signed integers\n\nimpl From for i32 {\n fn from(value: i8) -> i32 {\n value as i32\n }\n}\n\nimpl From for i64 {\n fn from(value: i8) -> i64 {\n value as i64\n }\n}\nimpl From for i64 {\n fn from(value: i32) -> i64 {\n value as i64\n }\n}\n\n// Booleans\nimpl From for u8 {\n fn from(value: bool) -> u8 {\n value as u8\n }\n}\nimpl From for u32 {\n fn from(value: bool) -> u32 {\n value as u32\n }\n}\nimpl From for u64 {\n fn from(value: bool) -> u64 {\n value as u64\n }\n}\nimpl From for i8 {\n fn from(value: bool) -> i8 {\n value as i8\n }\n}\nimpl From for i32 {\n fn from(value: bool) -> i32 {\n value as i32\n }\n}\nimpl From for i64 {\n fn from(value: bool) -> i64 {\n value as i64\n }\n}\nimpl From for Field {\n fn from(value: bool) -> Field {\n value as Field\n }\n}\n// docs:end:from-impls\n\n/// A generic interface for casting between primitive types,\n/// equivalent of using the `as` keyword between values.\n///\n/// # Example\n///\n/// ```\n/// let x: Field = 1234567890;\n/// let y: u8 = x as u8;\n/// let z: u8 = x.as_();\n/// assert_eq(y, z);\n/// ```\npub trait AsPrimitive {\n /// The equivalent of doing `self as T`.\n fn as_(self) -> T;\n}\n\n#[generate_as_primitive_impls]\ncomptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted {\n let types = [\n quote { bool },\n quote { u8 },\n quote { u16 },\n quote { u32 },\n quote { u64 },\n quote { u128 },\n quote { i8 },\n quote { i16 },\n quote { i32 },\n quote { i64 },\n quote { Field },\n ];\n\n let mut impls = &[];\n for type1 in types {\n for type2 in types {\n let body = if type1 == type2 {\n quote { self }\n } else if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for $type2 {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n }\n impls.join(quote {})\n}\n", "path": "std/convert.nr" }, "39": { diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/6_array/execute__tests__force_brillig_false_inliner_9223372036854775807.snap b/tooling/nargo_cli/tests/snapshots/execution_success/6_array/execute__tests__force_brillig_false_inliner_9223372036854775807.snap index cc1325ef576..81ba47544f3 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/6_array/execute__tests__force_brillig_false_inliner_9223372036854775807.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/6_array/execute__tests__force_brillig_false_inliner_9223372036854775807.snap @@ -510,10 +510,10 @@ expression: artifact "unconstrained func 1", "[Const { destination: Direct(21), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(20), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(0), size_address: Direct(21), offset_address: Direct(20) }, Const { destination: Direct(2), bit_size: Field, value: 0 }, BinaryFieldOp { destination: Direct(3), op: Equals, lhs: Direct(0), rhs: Direct(2) }, JumpIf { condition: Direct(3), location: 8 }, Const { destination: Direct(1), bit_size: Field, value: 1 }, BinaryFieldOp { destination: Direct(0), op: Div, lhs: Direct(1), rhs: Direct(0) }, Stop { return_data: HeapVector { pointer: Direct(20), size: Direct(21) } }]" ], - "debug_symbols": "vZndbhNJEEbfxde56KrqX15ltUImGGTJciKTIK0Q777T3XUSg2STHcNefQdm+rinamrGVr5tPu4+PH9+vz9+eviyeffXt82H0/5w2H9+f3i43z7tH47L/377frfhn++fTrvd8l+bs+PLqsftaXd82rw7Ph8Od5uv28PzOOnL4/Y48ml7Wo6Gu83u+HHJRfhpf9h1+n73ujpcXiq5+GIp8rI8vXm9SvP1qnHNeuXz1W78/HXro7A+ljXrc2Z90RXrrbDeal2xPpr5+mhr9h9zZX1pq9bTv9js0nq5Iig5RTeUfLYFaz8q5Mo9HPT1Lg7nffhZolcasfSfTmh6vZVEV+7DJF/cx1vrUS8qrrUkKC0528LPLcmXBU0CT5Qmmi5eRblWipjspRSxhJUSy2cSuShpN/f1bfW0iyOucnM9Va+WIp/VM9eLEru5FL/Yx9v6+gvJ2/qq+f+cV101bOnl5sgXh02v3J/59Q2UNV/cgl17h4dQXusZzp7D/02S2pkkXpTonxy2JFxJWvU+z8L7LJutWF9evo+UePHz7faHp7394ZkuDrvVm1thv+Mhbr/jIR7lT95XpXAlpa65L1pgSpuGFetry7etjzxnalrzPbFFhrulNd/zWuPzW1vzPVMkMhYi6ccn5d/Lv7b3+9MPv402osuD824jNiMud8gSaUZeVi5RZtR5ShuhYZyiMkPHKWoz4jwlzcjzlDKjzlPaCAvjFJMZOk4xmxHnKWlGnqeUGXWe0kbExbL0PS6W5f6NOmOxLM2IccZikUUTs2fxrJ5tZgqe4qme5hk93Zf6tpaSp+JZPdvMHDzFUz3NM3omT/fl7luuIlfPNrMET/FUT/OMnskze7qv1FGO0kZUv9rqV1v9aqtfbfWrrX611atXvXrVq1e9es19bfH1X0xNPc0zeibP7Fk8q2ebuTzkAQG8gMs3CSACCchAASrgfREJgACYxWspEoEEZKAAFfAOiQZAAAUw67wrpY/ISC+saAEq4LUVC4AAChgQgQRgNq+xWAWocqTKkSpHBQyIQAIygDlS5UiVE1VOVDlR5UT/Ev1L9I+hEqZKGCtJVDlT5UyVM1XOVDnTv0z/Mv1jvoQBEyZM+oj1nvQRG0mVC1UuVLlQ5UKVC/0r9K/QP4ZNmDZh3KRS5UqVK1WuVLlS5Ur/Kv1r9I+5EwZPmDxpVLlR5UaVG1VuVLl5/zQEQAAFDIiAV1lDBgpQAa+ySgAEUMCACGDu89d6Fk+vsopXWTUAAihgQAQSkIECYFavsloABFDAgAgkIAMFqEA391fimL/x3hSgvwn7u7PP34QIJCADBahAc+jzN0EAzAlzwpwwJ8wJc8KcMGfMGXPGnDFnzBlzxpwxZ8wZc8FcMBfMBXPB3CdwVKxP4ATMBXPBXDFXzBVzxVwxV/Zc2XPFXDFXzA1zw9wwN8wNc8PcMDfMDXNzs4UACKCAARFIQAYKUAHM4nediQCYBbNgFsyCWTALZsGs7FnZs2LuMzg+q8/gBMyKWTErZsVsmA2zYTb2bOzZMBtmw2yYDXPEHDEzg8YMGjNozKAxg8YMGjNozKAxg8YMGjNozKAxg8YMGjNoYwatQzf3L71jBjuMGRzfjQVQDhkQOZSAbs4dClA51BzGDPblYwYHKIcMiL68z+CEzKECsOfCnscMlg7d3DooYEAEEpCBAlSgOYwZHIC5YW6YG+aGuWFumBvm5uYYAiCAAgZEIAEZKEAFMAtmwSyYBbNgFsyCWTALZsGsmBWzYlbMilkxK2bFrJgV85jB/uP26/a033447L7Mv7F9ej7en/3J7emfR47wR7nH08P97uPzadd/go5jy4/SfwE=", + "debug_symbols": "vZndbttIDEbfxde5GJLzx77KYlGkqVsEMJLATQosir77ajQ8iVvAblZp9+o7rTTHI1KUbOTb7uP+w9Pn97d3n+6/7N799W334Xh7ONx+fn+4v7l+vL2/W/732/erHf98/3jc75f/2p0cX1Y9XB/3d4+7d3dPh8PV7uv14Wk96cvD9d2aj9fH5Wi62u3vPi65CD/dHvaDvl+9rE7nl0ptsViaPC8vr16v4rFeNW9Zr3y+2hs/f9v6LKzPbcv6WlnfdMN6a6y33jesz2axPtuW/efaWd9803r6l93OrZcLglZLDkOrJ1sw/1EhF+7hpC93cTrtw88SvdAIdcZowZdbWXTjPkzq2X28th79rOJSS5LSkpMt/NySel7gkiiFi5azV9EulSIXey5FbmmjxOqJRM5K/M19fV097eyIq7y5nqoXS1FP6ln7WYm9uRS/2Mfr+voLyev6qvX/nFfdNGzl+eaoZ4dNL9yf9eUNVLWe3YJdeoen1F7qmU6ew/9NUvxEks9K9E8OWxGupGx6n1fhfVbNNqxvz99HWj77+fb2h6e9/uFZzg679Te3wn7HQ9x+x0M8y5+8r1rjSlrfcl94Ykpd04b13evb1meeM71s+Z7omeH2suV7njuf777le6ZIpoMi5ccn5d/Lv65vbo8//DbaiS4Pzqud2Iy83CFLlBl1WblEm9HnKb6GpvUUlRm6nqI2I89Tyow6T2kz+jzF17C0nmIyQ9dTzGbkeUqZUecpbUafp/gaebEsfc+LZRmRrDMWy9KMnGcsFlk0uUa2yB7pM0uKlEiNtMgcGb4ytrWUvLTIHukza4qUSI20yBxZIsNXh2+5itojfWZLkRKpkRaZI0tkjQxf62s5mq/R42p7XG2Pq+1xtT2utsfV9qhej+r1qF6P6nn4fPGNX0yukRaZI0tkjWyRPdJnLg95QIAo4PJNAshAASrQgA5EX0QSIABmiVqKZKAAFWhAB6JDogkQQAHMOu9KGSOyZhRWtAEdiNqKJUAABQzIQAEwW9RYrANUOVPlTJWzAgZkoAAVwJypcqbKhSoXqlyocqF/hf4V+sdQCVMljJUUqlypcqXKlSpXqlzpX6V/lf4xX8KACRMmY8RGT8aIrUmVG1VuVLlR5UaVG/1r9K/RP4ZNmDZh3KRT5U6VO1XuVLlT5U7/Ov1z+sfcCYMnTJ44VXaq7FTZqbJTZY/+aUqAAAoYkIGosqYKNKADUWWVBAiggAEZwDzmz0e2yKiySlRZNQECKGBABgpQgQZg1qiyWgIEUMCADBSgAg3owDCPV+I6f+t7U4DxJhzvzjF/EzJQgAo0oAMeMOZvggCYC+aCuWAumAvmgrlgrpgr5oq5Yq6YK+aKuWKumCvmhrlhbpgb5oZ5TOBasTGBEzA3zA1zx9wxd8wdc8fc2XNnzx1zx9wxO2bH7Jgds2N2zI7ZMTtmD7OlBAiggAEZKEAFGtABzBJ3nYkAmAWzYBbMglkwC2bBrOxZ2bNiHjO4ftaYwQmYFbNiVsyK2TAbZsNs7NnYs2E2zIbZMBvmjDljZgaNGTRm0JhBYwaNGTRm0JhBYwaNGTRm0JhBYwaNGTRm0NYZtAHDPL70rjM4YJ3B9buxAMohAzKHCjDMdUADOoc8YJ3BsXydwRWUQwbkWD5mcELlUAPYc2PP6wy2AcPsAxQwIAMFqEADOuAB6wyugNkxO2bH7Jgds2N2zB7mnBIggAIGZKAAFWhABzALZsEsmAWzYBbMglkwC2bBrJgVs2JWzIpZMStmxayYFfM6g+PH7dfr4+31h8P+y/wb26enu5uTP7k9/vPAEf4o93C8v9l/fDrux0/Q9djyo/Rf", "file_map": { "12": { - "source": "// docs:start:from-trait\npub trait From {\n fn from(input: T) -> Self;\n}\n// docs:end:from-trait\n\nimpl From for T {\n fn from(input: T) -> T {\n input\n }\n}\n\n// docs:start:into-trait\npub trait Into {\n fn into(self) -> T;\n}\n\nimpl Into for U\nwhere\n T: From,\n{\n fn into(self) -> T {\n T::from(self)\n }\n}\n// docs:end:into-trait\n\n// docs:start:from-impls\n// Unsigned integers\n\nimpl From for u32 {\n fn from(value: u8) -> u32 {\n value as u32\n }\n}\n\nimpl From for u64 {\n fn from(value: u8) -> u64 {\n value as u64\n }\n}\nimpl From for u64 {\n fn from(value: u32) -> u64 {\n value as u64\n }\n}\n\nimpl From for u128 {\n fn from(value: u8) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u32) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u64) -> u128 {\n value as u128\n }\n}\n\nimpl From for Field {\n fn from(value: u8) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u32) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u64) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u128) -> Field {\n value as Field\n }\n}\n\n// Signed integers\n\nimpl From for i32 {\n fn from(value: i8) -> i32 {\n value as i32\n }\n}\n\nimpl From for i64 {\n fn from(value: i8) -> i64 {\n value as i64\n }\n}\nimpl From for i64 {\n fn from(value: i32) -> i64 {\n value as i64\n }\n}\n\n// Booleans\nimpl From for u8 {\n fn from(value: bool) -> u8 {\n value as u8\n }\n}\nimpl From for u32 {\n fn from(value: bool) -> u32 {\n value as u32\n }\n}\nimpl From for u64 {\n fn from(value: bool) -> u64 {\n value as u64\n }\n}\nimpl From for i8 {\n fn from(value: bool) -> i8 {\n value as i8\n }\n}\nimpl From for i32 {\n fn from(value: bool) -> i32 {\n value as i32\n }\n}\nimpl From for i64 {\n fn from(value: bool) -> i64 {\n value as i64\n }\n}\nimpl From for Field {\n fn from(value: bool) -> Field {\n value as Field\n }\n}\n// docs:end:from-impls\n\n/// A generic interface for casting between primitive types,\n/// equivalent of using the `as` keyword between values.\n///\n/// # Example\n///\n/// ```\n/// let x: Field = 1234567890;\n/// let y: u8 = x as u8;\n/// let z: u8 = x.as_();\n/// assert_eq(y, z);\n/// ```\npub trait AsPrimitive {\n /// The equivalent of doing `self as T`.\n fn as_(self) -> T;\n}\n\n#[generate_as_primitive_impls]\ncomptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted {\n let types = [\n quote { bool },\n quote { u8 },\n quote { u16 },\n quote { u32 },\n quote { u64 },\n quote { u128 },\n quote { i8 },\n quote { i16 },\n quote { i32 },\n quote { i64 },\n quote { Field },\n ];\n\n let mut impls = &[];\n for type1 in types {\n for type2 in types {\n let trait_impl = quote {\n impl AsPrimitive<$type1> for $type2 {\n fn as_(self) -> $type1 {\n self as $type1\n }\n }\n };\n\n impls = impls.push_back(trait_impl);\n }\n }\n impls.join(quote {})\n}\n", + "source": "// docs:start:from-trait\npub trait From {\n fn from(input: T) -> Self;\n}\n// docs:end:from-trait\n\nimpl From for T {\n fn from(input: T) -> T {\n input\n }\n}\n\n// docs:start:into-trait\npub trait Into {\n fn into(self) -> T;\n}\n\nimpl Into for U\nwhere\n T: From,\n{\n fn into(self) -> T {\n T::from(self)\n }\n}\n// docs:end:into-trait\n\n// docs:start:from-impls\n// Unsigned integers\n\nimpl From for u32 {\n fn from(value: u8) -> u32 {\n value as u32\n }\n}\n\nimpl From for u64 {\n fn from(value: u8) -> u64 {\n value as u64\n }\n}\nimpl From for u64 {\n fn from(value: u32) -> u64 {\n value as u64\n }\n}\n\nimpl From for u128 {\n fn from(value: u8) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u32) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u64) -> u128 {\n value as u128\n }\n}\n\nimpl From for Field {\n fn from(value: u8) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u32) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u64) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u128) -> Field {\n value as Field\n }\n}\n\n// Signed integers\n\nimpl From for i32 {\n fn from(value: i8) -> i32 {\n value as i32\n }\n}\n\nimpl From for i64 {\n fn from(value: i8) -> i64 {\n value as i64\n }\n}\nimpl From for i64 {\n fn from(value: i32) -> i64 {\n value as i64\n }\n}\n\n// Booleans\nimpl From for u8 {\n fn from(value: bool) -> u8 {\n value as u8\n }\n}\nimpl From for u32 {\n fn from(value: bool) -> u32 {\n value as u32\n }\n}\nimpl From for u64 {\n fn from(value: bool) -> u64 {\n value as u64\n }\n}\nimpl From for i8 {\n fn from(value: bool) -> i8 {\n value as i8\n }\n}\nimpl From for i32 {\n fn from(value: bool) -> i32 {\n value as i32\n }\n}\nimpl From for i64 {\n fn from(value: bool) -> i64 {\n value as i64\n }\n}\nimpl From for Field {\n fn from(value: bool) -> Field {\n value as Field\n }\n}\n// docs:end:from-impls\n\n/// A generic interface for casting between primitive types,\n/// equivalent of using the `as` keyword between values.\n///\n/// # Example\n///\n/// ```\n/// let x: Field = 1234567890;\n/// let y: u8 = x as u8;\n/// let z: u8 = x.as_();\n/// assert_eq(y, z);\n/// ```\npub trait AsPrimitive {\n /// The equivalent of doing `self as T`.\n fn as_(self) -> T;\n}\n\n#[generate_as_primitive_impls]\ncomptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted {\n let types = [\n quote { bool },\n quote { u8 },\n quote { u16 },\n quote { u32 },\n quote { u64 },\n quote { u128 },\n quote { i8 },\n quote { i16 },\n quote { i32 },\n quote { i64 },\n quote { Field },\n ];\n\n let mut impls = &[];\n for type1 in types {\n for type2 in types {\n let body = if type1 == type2 {\n quote { self }\n } else if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for $type2 {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n }\n impls.join(quote {})\n}\n", "path": "std/convert.nr" }, "39": { diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/6_array/execute__tests__force_brillig_true_inliner_-9223372036854775808.snap b/tooling/nargo_cli/tests/snapshots/execution_success/6_array/execute__tests__force_brillig_true_inliner_-9223372036854775808.snap index 086d356590f..9e67048cff1 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/6_array/execute__tests__force_brillig_true_inliner_-9223372036854775808.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/6_array/execute__tests__force_brillig_true_inliner_-9223372036854775808.snap @@ -90,10 +90,10 @@ expression: artifact "unconstrained func 0", "[Const { destination: Direct(2), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(1), bit_size: Integer(U32), value: 32848 }, Const { destination: Direct(0), bit_size: Integer(U32), value: 3 }, Const { destination: Relative(5), bit_size: Integer(U32), value: 12 }, Const { destination: Relative(6), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(32836), size_address: Relative(5), offset_address: Relative(6) }, Cast { destination: Direct(32836), source: Direct(32836), bit_size: Integer(U32) }, Cast { destination: Direct(32837), source: Direct(32837), bit_size: Integer(U32) }, Cast { destination: Direct(32838), source: Direct(32838), bit_size: Integer(U32) }, Cast { destination: Direct(32839), source: Direct(32839), bit_size: Integer(U32) }, Cast { destination: Direct(32840), source: Direct(32840), bit_size: Integer(U32) }, Cast { destination: Direct(32841), source: Direct(32841), bit_size: Integer(U32) }, Cast { destination: Direct(32842), source: Direct(32842), bit_size: Integer(U32) }, Cast { destination: Direct(32843), source: Direct(32843), bit_size: Integer(U32) }, Cast { destination: Direct(32844), source: Direct(32844), bit_size: Integer(U32) }, Cast { destination: Direct(32845), source: Direct(32845), bit_size: Integer(U32) }, Cast { destination: Direct(32846), source: Direct(32846), bit_size: Integer(U32) }, Cast { destination: Direct(32847), source: Direct(32847), bit_size: Integer(U32) }, Const { destination: Relative(1), bit_size: Integer(U32), value: 32836 }, Const { destination: Relative(6), bit_size: Integer(U32), value: 5 }, Mov { destination: Relative(5), source: Direct(1) }, Const { destination: Relative(7), bit_size: Integer(U32), value: 6 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(7) }, IndirectConst { destination_pointer: Relative(5), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(7), op: Add, bit_size: U32, lhs: Relative(5), rhs: Direct(2) }, Mov { destination: Direct(32771), source: Relative(1) }, Mov { destination: Direct(32772), source: Relative(7) }, Mov { destination: Direct(32773), source: Relative(6) }, Call { location: 49 }, Mov { destination: Relative(1), source: Relative(5) }, Const { destination: Relative(2), bit_size: Integer(U32), value: 32841 }, Const { destination: Relative(6), bit_size: Integer(U32), value: 5 }, Mov { destination: Relative(5), source: Direct(1) }, Const { destination: Relative(7), bit_size: Integer(U32), value: 6 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(7) }, IndirectConst { destination_pointer: Relative(5), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(7), op: Add, bit_size: U32, lhs: Relative(5), rhs: Direct(2) }, Mov { destination: Direct(32771), source: Relative(2) }, Mov { destination: Direct(32772), source: Relative(7) }, Mov { destination: Direct(32773), source: Relative(6) }, Call { location: 49 }, Mov { destination: Relative(2), source: Relative(5) }, Mov { destination: Relative(3), source: Direct(32846) }, Mov { destination: Relative(4), source: Direct(32847) }, Call { location: 60 }, Call { location: 61 }, Const { destination: Relative(1), bit_size: Integer(U32), value: 32848 }, Const { destination: Relative(2), bit_size: Integer(U32), value: 0 }, Stop { return_data: HeapVector { pointer: Relative(1), size: Relative(2) } }, BinaryIntOp { destination: Direct(32775), op: Add, bit_size: U32, lhs: Direct(32771), rhs: Direct(32773) }, Mov { destination: Direct(32776), source: Direct(32771) }, Mov { destination: Direct(32777), source: Direct(32772) }, BinaryIntOp { destination: Direct(32778), op: Equals, bit_size: U32, lhs: Direct(32776), rhs: Direct(32775) }, JumpIf { condition: Direct(32778), location: 59 }, Load { destination: Direct(32774), source_pointer: Direct(32776) }, Store { destination_pointer: Direct(32777), source: Direct(32774) }, BinaryIntOp { destination: Direct(32776), op: Add, bit_size: U32, lhs: Direct(32776), rhs: Direct(2) }, BinaryIntOp { destination: Direct(32777), op: Add, bit_size: U32, lhs: Direct(32777), rhs: Direct(2) }, Jump { location: 52 }, Return, Return, Call { location: 338 }, Mov { destination: Relative(6), source: Direct(1) }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Direct(2) }, Const { destination: Relative(7), bit_size: Integer(U32), value: 5 }, BinaryIntOp { destination: Relative(9), op: Add, bit_size: U32, lhs: Relative(2), rhs: Relative(7) }, Load { destination: Relative(8), source_pointer: Relative(9) }, Store { destination_pointer: Relative(6), source: Relative(8) }, Const { destination: Relative(9), bit_size: Integer(U32), value: 0 }, Const { destination: Relative(10), bit_size: Integer(U32), value: 1 }, Mov { destination: Relative(5), source: Relative(9) }, Jump { location: 72 }, BinaryIntOp { destination: Relative(3), op: LessThan, bit_size: U32, lhs: Relative(5), rhs: Relative(7) }, JumpIf { condition: Relative(3), location: 310 }, Jump { location: 75 }, Load { destination: Relative(5), source_pointer: Relative(6) }, BinaryIntOp { destination: Relative(11), op: Equals, bit_size: U32, lhs: Relative(5), rhs: Relative(9) }, JumpIf { condition: Relative(11), location: 80 }, Const { destination: Relative(12), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(12) } }, Const { destination: Relative(5), bit_size: Integer(U32), value: 2 }, BinaryIntOp { destination: Relative(11), op: Add, bit_size: U32, lhs: Relative(4), rhs: Relative(5) }, BinaryIntOp { destination: Relative(12), op: LessThanEquals, bit_size: U32, lhs: Relative(4), rhs: Relative(11) }, JumpIf { condition: Relative(12), location: 85 }, Call { location: 344 }, Const { destination: Relative(4), bit_size: Field, value: 340282366920938463463374607431768211456 }, Mov { destination: Relative(3), source: Relative(9) }, Jump { location: 88 }, BinaryIntOp { destination: Relative(11), op: LessThan, bit_size: U32, lhs: Relative(3), rhs: Relative(7) }, JumpIf { condition: Relative(11), location: 274 }, Jump { location: 91 }, Load { destination: Relative(11), source_pointer: Relative(6) }, Const { destination: Relative(12), bit_size: Integer(U32), value: 3814912846 }, BinaryIntOp { destination: Relative(13), op: Equals, bit_size: U32, lhs: Relative(11), rhs: Relative(12) }, JumpIf { condition: Relative(13), location: 97 }, Const { destination: Relative(14), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(14) } }, Store { destination_pointer: Relative(6), source: Relative(8) }, Const { destination: Relative(11), bit_size: Field, value: 2 }, Const { destination: Relative(12), bit_size: Integer(U32), value: 3 }, Mov { destination: Relative(3), source: Relative(9) }, Jump { location: 102 }, BinaryIntOp { destination: Relative(13), op: LessThan, bit_size: U32, lhs: Relative(3), rhs: Relative(7) }, JumpIf { condition: Relative(13), location: 231 }, Jump { location: 105 }, Load { destination: Relative(4), source_pointer: Relative(6) }, Const { destination: Relative(11), bit_size: Integer(U32), value: 41472 }, BinaryIntOp { destination: Relative(13), op: Equals, bit_size: U32, lhs: Relative(4), rhs: Relative(11) }, JumpIf { condition: Relative(13), location: 111 }, Const { destination: Relative(14), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(14) } }, Store { destination_pointer: Relative(6), source: Relative(8) }, Const { destination: Relative(4), bit_size: Integer(U1), value: 1 }, Mov { destination: Relative(3), source: Relative(9) }, Jump { location: 115 }, BinaryIntOp { destination: Relative(8), op: LessThan, bit_size: U32, lhs: Relative(3), rhs: Relative(12) }, JumpIf { condition: Relative(8), location: 177 }, Jump { location: 118 }, Load { destination: Relative(4), source_pointer: Relative(6) }, Const { destination: Relative(5), bit_size: Integer(U32), value: 11539 }, BinaryIntOp { destination: Relative(6), op: Equals, bit_size: U32, lhs: Relative(4), rhs: Relative(5) }, JumpIf { condition: Relative(6), location: 124 }, Const { destination: Relative(8), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(8) } }, Load { destination: Relative(4), source_pointer: Relative(1) }, Const { destination: Relative(5), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(6), op: Equals, bit_size: U32, lhs: Relative(5), rhs: Relative(4) }, Not { destination: Relative(6), source: Relative(6), bit_size: U1 }, JumpIf { condition: Relative(6), location: 130 }, Call { location: 347 }, BinaryIntOp { destination: Relative(4), op: Add, bit_size: U32, lhs: Relative(4), rhs: Direct(2) }, Store { destination_pointer: Relative(1), source: Relative(4) }, Load { destination: Relative(4), source_pointer: Relative(2) }, Const { destination: Relative(6), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(8), op: Equals, bit_size: U32, lhs: Relative(6), rhs: Relative(4) }, Not { destination: Relative(8), source: Relative(8), bit_size: U1 }, JumpIf { condition: Relative(8), location: 138 }, Call { location: 347 }, BinaryIntOp { destination: Relative(4), op: Add, bit_size: U32, lhs: Relative(4), rhs: Direct(2) }, Store { destination_pointer: Relative(2), source: Relative(4) }, Const { destination: Relative(4), bit_size: Integer(U1), value: 0 }, Mov { destination: Relative(3), source: Relative(9) }, Jump { location: 143 }, BinaryIntOp { destination: Relative(5), op: LessThan, bit_size: U32, lhs: Relative(3), rhs: Relative(7) }, JumpIf { condition: Relative(5), location: 147 }, Jump { location: 146 }, Return, BinaryIntOp { destination: Relative(8), op: Add, bit_size: U32, lhs: Relative(2), rhs: Direct(2) }, BinaryIntOp { destination: Relative(11), op: Add, bit_size: U32, lhs: Relative(8), rhs: Relative(3) }, Load { destination: Relative(6), source_pointer: Relative(11) }, Load { destination: Relative(8), source_pointer: Relative(1) }, Const { destination: Relative(11), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(12), op: Equals, bit_size: U32, lhs: Relative(11), rhs: Relative(8) }, Not { destination: Relative(12), source: Relative(12), bit_size: U1 }, JumpIf { condition: Relative(12), location: 156 }, Call { location: 347 }, BinaryIntOp { destination: Relative(8), op: Add, bit_size: U32, lhs: Relative(8), rhs: Direct(2) }, Store { destination_pointer: Relative(1), source: Relative(8) }, Mov { destination: Relative(5), source: Relative(9) }, Jump { location: 160 }, BinaryIntOp { destination: Relative(8), op: LessThan, bit_size: U32, lhs: Relative(5), rhs: Relative(7) }, JumpIf { condition: Relative(8), location: 166 }, Jump { location: 163 }, BinaryIntOp { destination: Relative(5), op: Add, bit_size: U32, lhs: Relative(3), rhs: Relative(10) }, Mov { destination: Relative(3), source: Relative(5) }, Jump { location: 143 }, BinaryIntOp { destination: Relative(11), op: Add, bit_size: U32, lhs: Relative(1), rhs: Direct(2) }, BinaryIntOp { destination: Relative(12), op: Add, bit_size: U32, lhs: Relative(11), rhs: Relative(5) }, Load { destination: Relative(8), source_pointer: Relative(12) }, BinaryIntOp { destination: Relative(11), op: Equals, bit_size: U32, lhs: Relative(8), rhs: Relative(6) }, BinaryIntOp { destination: Relative(8), op: Equals, bit_size: U1, lhs: Relative(11), rhs: Relative(4) }, JumpIf { condition: Relative(8), location: 174 }, Const { destination: Relative(12), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(12) } }, BinaryIntOp { destination: Relative(8), op: Add, bit_size: U32, lhs: Relative(5), rhs: Relative(10) }, Mov { destination: Relative(5), source: Relative(8) }, Jump { location: 160 }, Load { destination: Relative(11), source_pointer: Relative(6) }, BinaryIntOp { destination: Relative(14), op: Add, bit_size: U32, lhs: Relative(1), rhs: Direct(2) }, BinaryIntOp { destination: Relative(15), op: Add, bit_size: U32, lhs: Relative(14), rhs: Relative(3) }, Load { destination: Relative(13), source_pointer: Relative(15) }, BinaryIntOp { destination: Relative(15), op: Add, bit_size: U32, lhs: Relative(2), rhs: Direct(2) }, BinaryIntOp { destination: Relative(16), op: Add, bit_size: U32, lhs: Relative(15), rhs: Relative(3) }, Load { destination: Relative(14), source_pointer: Relative(16) }, BinaryIntOp { destination: Relative(15), op: Mul, bit_size: U32, lhs: Relative(13), rhs: Relative(14) }, Const { destination: Relative(17), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(16), op: Equals, bit_size: U32, lhs: Relative(17), rhs: Relative(14) }, JumpIf { condition: Relative(16), location: 192 }, BinaryIntOp { destination: Relative(19), op: Div, bit_size: U32, lhs: Relative(15), rhs: Relative(14) }, BinaryIntOp { destination: Relative(18), op: Equals, bit_size: U32, lhs: Relative(19), rhs: Relative(13) }, JumpIf { condition: Relative(18), location: 192 }, Call { location: 350 }, BinaryIntOp { destination: Relative(13), op: Add, bit_size: U32, lhs: Relative(11), rhs: Relative(15) }, BinaryIntOp { destination: Relative(14), op: LessThanEquals, bit_size: U32, lhs: Relative(11), rhs: Relative(13) }, JumpIf { condition: Relative(14), location: 196 }, Call { location: 344 }, Store { destination_pointer: Relative(6), source: Relative(13) }, Mov { destination: Relative(8), source: Relative(9) }, Jump { location: 199 }, BinaryIntOp { destination: Relative(11), op: LessThan, bit_size: U32, lhs: Relative(8), rhs: Relative(5) }, JumpIf { condition: Relative(11), location: 205 }, Jump { location: 202 }, BinaryIntOp { destination: Relative(8), op: Add, bit_size: U32, lhs: Relative(3), rhs: Relative(10) }, Mov { destination: Relative(3), source: Relative(8) }, Jump { location: 115 }, Load { destination: Relative(11), source_pointer: Relative(6) }, BinaryIntOp { destination: Relative(13), op: Add, bit_size: U32, lhs: Relative(3), rhs: Relative(8) }, BinaryIntOp { destination: Relative(14), op: LessThanEquals, bit_size: U32, lhs: Relative(3), rhs: Relative(13) }, JumpIf { condition: Relative(14), location: 210 }, Call { location: 344 }, BinaryIntOp { destination: Relative(14), op: LessThan, bit_size: U32, lhs: Relative(13), rhs: Relative(7) }, JumpIf { condition: Relative(14), location: 213 }, Call { location: 353 }, BinaryIntOp { destination: Relative(15), op: Add, bit_size: U32, lhs: Relative(1), rhs: Direct(2) }, BinaryIntOp { destination: Relative(16), op: Add, bit_size: U32, lhs: Relative(15), rhs: Relative(13) }, Load { destination: Relative(14), source_pointer: Relative(16) }, BinaryIntOp { destination: Relative(16), op: Add, bit_size: U32, lhs: Relative(2), rhs: Direct(2) }, BinaryIntOp { destination: Relative(17), op: Add, bit_size: U32, lhs: Relative(16), rhs: Relative(13) }, Load { destination: Relative(15), source_pointer: Relative(17) }, BinaryIntOp { destination: Relative(13), op: Sub, bit_size: U32, lhs: Relative(14), rhs: Relative(15) }, BinaryIntOp { destination: Relative(16), op: LessThanEquals, bit_size: U32, lhs: Relative(15), rhs: Relative(14) }, JumpIf { condition: Relative(16), location: 223 }, Call { location: 356 }, BinaryIntOp { destination: Relative(14), op: Add, bit_size: U32, lhs: Relative(11), rhs: Relative(13) }, BinaryIntOp { destination: Relative(15), op: LessThanEquals, bit_size: U32, lhs: Relative(11), rhs: Relative(14) }, JumpIf { condition: Relative(15), location: 227 }, Call { location: 344 }, Store { destination_pointer: Relative(6), source: Relative(14) }, BinaryIntOp { destination: Relative(11), op: Add, bit_size: U32, lhs: Relative(8), rhs: Relative(10) }, Mov { destination: Relative(8), source: Relative(11) }, Jump { location: 199 }, Load { destination: Relative(14), source_pointer: Relative(6) }, BinaryIntOp { destination: Relative(16), op: Add, bit_size: U32, lhs: Relative(1), rhs: Direct(2) }, BinaryIntOp { destination: Relative(17), op: Add, bit_size: U32, lhs: Relative(16), rhs: Relative(3) }, Load { destination: Relative(15), source_pointer: Relative(17) }, BinaryIntOp { destination: Relative(17), op: Add, bit_size: U32, lhs: Relative(2), rhs: Direct(2) }, BinaryIntOp { destination: Relative(18), op: Add, bit_size: U32, lhs: Relative(17), rhs: Relative(3) }, Load { destination: Relative(16), source_pointer: Relative(18) }, BinaryIntOp { destination: Relative(17), op: Mul, bit_size: U32, lhs: Relative(15), rhs: Relative(16) }, Const { destination: Relative(19), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(18), op: Equals, bit_size: U32, lhs: Relative(19), rhs: Relative(16) }, JumpIf { condition: Relative(18), location: 246 }, BinaryIntOp { destination: Relative(21), op: Div, bit_size: U32, lhs: Relative(17), rhs: Relative(16) }, BinaryIntOp { destination: Relative(20), op: Equals, bit_size: U32, lhs: Relative(21), rhs: Relative(15) }, JumpIf { condition: Relative(20), location: 246 }, Call { location: 350 }, BinaryIntOp { destination: Relative(15), op: Add, bit_size: U32, lhs: Relative(14), rhs: Relative(17) }, BinaryIntOp { destination: Relative(16), op: LessThanEquals, bit_size: U32, lhs: Relative(14), rhs: Relative(15) }, JumpIf { condition: Relative(16), location: 250 }, Call { location: 344 }, Store { destination_pointer: Relative(6), source: Relative(15) }, Cast { destination: Relative(14), source: Relative(3), bit_size: Field }, BinaryFieldOp { destination: Relative(15), op: Add, lhs: Relative(14), rhs: Relative(4) }, BinaryFieldOp { destination: Relative(14), op: Sub, lhs: Relative(15), rhs: Relative(11) }, Cast { destination: Relative(16), source: Relative(14), bit_size: Integer(U32) }, Cast { destination: Relative(15), source: Relative(16), bit_size: Field }, Mov { destination: Relative(13), source: Relative(9) }, Jump { location: 258 }, BinaryIntOp { destination: Relative(14), op: LessThan, bit_size: U32, lhs: Relative(13), rhs: Relative(12) }, JumpIf { condition: Relative(14), location: 264 }, Jump { location: 261 }, BinaryIntOp { destination: Relative(13), op: Add, bit_size: U32, lhs: Relative(3), rhs: Relative(10) }, Mov { destination: Relative(3), source: Relative(13) }, Jump { location: 102 }, Load { destination: Relative(14), source_pointer: Relative(6) }, Cast { destination: Relative(16), source: Relative(14), bit_size: Field }, BinaryFieldOp { destination: Relative(14), op: Mul, lhs: Relative(16), rhs: Relative(15) }, Cast { destination: Relative(17), source: Relative(14), bit_size: Integer(U32) }, Cast { destination: Relative(16), source: Relative(17), bit_size: Field }, Cast { destination: Relative(14), source: Relative(16), bit_size: Integer(U32) }, Store { destination_pointer: Relative(6), source: Relative(14) }, BinaryIntOp { destination: Relative(14), op: Add, bit_size: U32, lhs: Relative(13), rhs: Relative(10) }, Mov { destination: Relative(13), source: Relative(14) }, Jump { location: 258 }, Load { destination: Relative(11), source_pointer: Relative(6) }, Cast { destination: Relative(12), source: Relative(11), bit_size: Field }, BinaryFieldOp { destination: Relative(11), op: Mul, lhs: Relative(12), rhs: Relative(12) }, Cast { destination: Relative(14), source: Relative(11), bit_size: Integer(U32) }, Cast { destination: Relative(13), source: Relative(14), bit_size: Field }, BinaryIntOp { destination: Relative(14), op: Add, bit_size: U32, lhs: Relative(1), rhs: Direct(2) }, BinaryIntOp { destination: Relative(15), op: Add, bit_size: U32, lhs: Relative(14), rhs: Relative(3) }, Load { destination: Relative(11), source_pointer: Relative(15) }, Cast { destination: Relative(14), source: Relative(11), bit_size: Field }, BinaryFieldOp { destination: Relative(15), op: Mul, lhs: Relative(13), rhs: Relative(14) }, Cast { destination: Relative(14), source: Relative(15), bit_size: Integer(U32) }, Cast { destination: Relative(13), source: Relative(14), bit_size: Field }, BinaryIntOp { destination: Relative(15), op: Add, bit_size: U32, lhs: Relative(2), rhs: Direct(2) }, BinaryIntOp { destination: Relative(16), op: Add, bit_size: U32, lhs: Relative(15), rhs: Relative(3) }, Load { destination: Relative(14), source_pointer: Relative(16) }, BinaryIntOp { destination: Relative(15), op: Mul, bit_size: U32, lhs: Relative(11), rhs: Relative(14) }, Const { destination: Relative(17), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(16), op: Equals, bit_size: U32, lhs: Relative(17), rhs: Relative(14) }, JumpIf { condition: Relative(16), location: 297 }, BinaryIntOp { destination: Relative(19), op: Div, bit_size: U32, lhs: Relative(15), rhs: Relative(14) }, BinaryIntOp { destination: Relative(18), op: Equals, bit_size: U32, lhs: Relative(19), rhs: Relative(11) }, JumpIf { condition: Relative(18), location: 297 }, Call { location: 350 }, Cast { destination: Relative(11), source: Relative(15), bit_size: Field }, BinaryFieldOp { destination: Relative(14), op: Add, lhs: Relative(11), rhs: Relative(4) }, BinaryFieldOp { destination: Relative(11), op: Sub, lhs: Relative(14), rhs: Relative(13) }, Cast { destination: Relative(14), source: Relative(11), bit_size: Integer(U32) }, Cast { destination: Relative(13), source: Relative(14), bit_size: Field }, BinaryFieldOp { destination: Relative(11), op: Add, lhs: Relative(12), rhs: Relative(13) }, Cast { destination: Relative(13), source: Relative(11), bit_size: Integer(U32) }, Cast { destination: Relative(12), source: Relative(13), bit_size: Field }, Cast { destination: Relative(11), source: Relative(12), bit_size: Integer(U32) }, Store { destination_pointer: Relative(6), source: Relative(11) }, BinaryIntOp { destination: Relative(11), op: Add, bit_size: U32, lhs: Relative(3), rhs: Relative(10) }, Mov { destination: Relative(3), source: Relative(11) }, Jump { location: 88 }, Load { destination: Relative(3), source_pointer: Relative(6) }, BinaryIntOp { destination: Relative(11), op: Mul, bit_size: U32, lhs: Relative(3), rhs: Relative(3) }, Const { destination: Relative(13), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(12), op: Equals, bit_size: U32, lhs: Relative(13), rhs: Relative(3) }, JumpIf { condition: Relative(12), location: 319 }, BinaryIntOp { destination: Relative(15), op: Div, bit_size: U32, lhs: Relative(11), rhs: Relative(3) }, BinaryIntOp { destination: Relative(14), op: Equals, bit_size: U32, lhs: Relative(15), rhs: Relative(3) }, JumpIf { condition: Relative(14), location: 319 }, Call { location: 350 }, BinaryIntOp { destination: Relative(13), op: Add, bit_size: U32, lhs: Relative(2), rhs: Direct(2) }, BinaryIntOp { destination: Relative(14), op: Add, bit_size: U32, lhs: Relative(13), rhs: Relative(5) }, Load { destination: Relative(12), source_pointer: Relative(14) }, BinaryIntOp { destination: Relative(13), op: Mul, bit_size: U32, lhs: Relative(11), rhs: Relative(12) }, Const { destination: Relative(15), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(14), op: Equals, bit_size: U32, lhs: Relative(15), rhs: Relative(12) }, JumpIf { condition: Relative(14), location: 330 }, BinaryIntOp { destination: Relative(17), op: Div, bit_size: U32, lhs: Relative(13), rhs: Relative(12) }, BinaryIntOp { destination: Relative(16), op: Equals, bit_size: U32, lhs: Relative(17), rhs: Relative(11) }, JumpIf { condition: Relative(16), location: 330 }, Call { location: 350 }, BinaryIntOp { destination: Relative(11), op: Sub, bit_size: U32, lhs: Relative(3), rhs: Relative(13) }, BinaryIntOp { destination: Relative(12), op: LessThanEquals, bit_size: U32, lhs: Relative(13), rhs: Relative(3) }, JumpIf { condition: Relative(12), location: 334 }, Call { location: 356 }, Store { destination_pointer: Relative(6), source: Relative(11) }, BinaryIntOp { destination: Relative(3), op: Add, bit_size: U32, lhs: Relative(5), rhs: Relative(10) }, Mov { destination: Relative(5), source: Relative(3) }, Jump { location: 72 }, 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: 343 }, IndirectConst { destination_pointer: Direct(1), bit_size: Integer(U64), value: 17843811134343075018 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return, IndirectConst { destination_pointer: Direct(1), bit_size: Integer(U64), value: 5019202896831570965 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return, IndirectConst { destination_pointer: Direct(1), bit_size: Integer(U64), value: 12049594436772143978 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return, IndirectConst { destination_pointer: Direct(1), bit_size: Integer(U64), value: 7233212735005103307 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return, IndirectConst { destination_pointer: Direct(1), bit_size: Integer(U64), value: 14225679739041873922 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return, IndirectConst { destination_pointer: Direct(1), bit_size: Integer(U64), value: 2920182694213909827 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return]" ], - "debug_symbols": "tZnRThs9EIXfJde5sD322OZVqgoFCFWkKKAUfukX4t07Z71nkyJtGrxw0/lCPMeznrE93bytHrZ3r79ud4fHp9+rmx9vq7vjbr/f/brdP91vXnZPB/vr28rhH42rG79eaWpGm8mDyWF1E8zYd2LGvotmcjOlmTqYYlrJjG8mNCPNxGbMQderakOyGRtSzEgzsZnUjDZjE9X1yjsb6h0AMXoAogyATCiEOoJ3BJvQCwDuEYDBCYDBFpMPjuAJgSAELFQGJIISMqEQ6gjiCJ4A5QIQQiQkghIyoRDqCJHukWMix0SOSZgda5g8IRCEEAmJoIQ8glJHzSsgF8oxOo0phDqOyY7gCYFAnRwJecwOCisgyyitAVBcDaCDnKLAGggBOshySQQlZEIh1BGqI3gClBEGKrNBJCSCEqBjhRSGEh0g8S8Yo4BMKIQ6Akq0gScEAmbPgEhIBCgXQCYUApQtBQH13MATAkHGUId6HiARlJAJ404JQ/U6gOnIAEKIBBwTHqCETDAdCYA6QnQETwgEIURCIkBZAJlQCHUE1HwDKGPFUPOC9UHNCxYBNR8RM2q+AY4zhKq+HTIBB6NEAMYMgAMQq4Gaj1BGzTeoI6DmB/dMndyOv4BTNA1/MJmEp0HJJwij5BuYTMLg4TwdwBNwpiJ2lLwiZJS8Qgcl38CUFY+Okm9QCKasmAIl38ATAkEIkZAISoAy1rJCGfFgE2SLR5wpZw/wBFPOAjDlnACRkAg63AeCfQI7bApYiCggEIQQCYmghEwoBIQHYeyJBp4A5QIQQiQkghIyoRDqCDjj8ZTYJIMNo5XRxtGijN/f1yvewrcvx+0Wl/DZtWyX9fPmuD28rG4Or/v9evXfZv86DPr9vDkM9mVztG9tybeHB7Mm+Ljbb0Hv65O3m3e1Q3t0tqN5ck9X+wcno39wsccfO635x9zjr0r/HDr8JdNfSunxVy6+aM/6RWz/wT+qdvgnz/iT9MyfCuNPpSd/6hi/Ounwz4H1l2NP/Dmz/nLpmb+4MvoX31M/Rbh+pWv9S2X+anAd/jVW+qfa41+Zv1p79p912dzAhj0raF35dARZP96lEN2kkHp2UYkMoaSuLOLKHv3Lwvn7/MMy/+kUKKXn+et0C1RXuvz95N9VxT4s20Wn+bv8NUynYNAuf+5iFVk2f5+/L8v8p1tU62z+0EHPHuM67aCs+SQh9W+JdOkkCqdexp13Ax9F9MJ1HqadaI3faSvY3dAXh/Wjyx9GwrzItYtaZiUu5TVNeU2ztwP+azO/MR1PFtujaS4EHF/zSxGTTEsRz863jyKyOK+fiCO7zocRPRPxsyLLi/RS1zl1bdHPnlexLM9r/YK8Jrc8r/Ur8lq/IK9JvjWvwieJ0tPNndWFzPZySRfXRcoXl1LP8qHzdVEWL+U/4riuLv4hcl1dqP/WusD7lZbX3NNfRS0L/fkAsc72F5oW9weqX9AfaF6ciuvjuNAffEJkvj+4elHn+4N8qe+cXt9Y4zuvcPFGdPm0Q9xZeXxOJNUzkTgrEr9zmwXPIOyVes/LrOllSOh6mXA2/wf/n/Zpc787/vWr3zuUjrvN3X47fnx8Pdyfffvy/zO/4a+Gz8en++3D63ELpdNPh/Z684fdj6n+xA9v9kHsLbtEwUePj3ZpSCo/3xHKHw==", + "debug_symbols": "tZnRThs9EIXfJde5sD322OZVqgoFCFWkKKAUfukX4t07Z71nkyJtGrxw0/lCPMeznrE93bytHrZ3r79ud4fHp9+rmx9vq7vjbr/f/brdP91vXnZPB/vr28rhH42rG79eaWpGm8mDyWF1E8zYd2LGvotmcjOlmTqYYlrJjG8mNCPNxGbMQderakOyGRtSzEgzsZnUjDZjE9X1yjsb6h0AMXoAogyATCiEOoJ3BJvQCwDuEYDBCYDBFpMPjuAJgSAELFQGJIISMqEQ6gjiCJ4A5QIQQiQkghIyoRDqCJHukWMix0SOSZgda5g8IRCEEAmJoIQ8glJHzSsgF8oxOo0phDqOyY7gCYFAnRwJecwOCisgyyitAVBcDaCDnKLAGggBOshySQQlZEIh1BGqI3gClBEGKrNBJCSCEqBjhRSGEh0g8S8Yo4BMKIQ6Akq0gScEAmbPgEhIBCgXQCYUApQtBQH13MATAkHGUId6HiARlJAJ404JQ/U6gOnIAEKIBBwTHqCETDAdCYA6QnQETwgEIURCIkBZAJlQCHUE1HwDKGPFUPOC9UHNCxYBNR8RM2q+AY4zhKq+HTIBB6NEAMYMgAMQq4Gaj1BGzTeoI6DmB/dMndyOv4BTNA1/MJmEp0HJJwij5BuYTMLg4TwdwBNwpiJ2lLwiZJS8Qgcl38CUFY+Okm9QCKasmAIl38ATAkEIkZAISoAy1rJCGfFgE2SLR5wpZw/wBFPOAjDlnACRkAg63AeCfQI7bApYiCggEIQQCYmghEwoBIQHYeyJBp4A5QIQQiQkghIyoRDqCDjj8ZTYJIMNo5XRxtGijN/f1yvewrcvx+0Wl/DZtWyX9fPmuD28rG4Or/v9evXfZv86DPr9vDkM9mVztG9tybeHB7Mm+Ljbb0Hv65O3m3e1Q3t0tqN5ck9X+wcno39wsccfO635x9zjr0r/HDr8JdNfSunxVy6+aM/6RWz/wT+qdvgnz/iT9MyfCuNPpSd/6hi/Ounwz4H1l2NP/Dmz/nLpmb+4MvoX31M/Rbh+pWv9S2X+anAd/jVW+qfa41+Zv1p79p912dzAhj0raF35dARZP96lEN2kkHp2UYkMoaSuLOLKHv3Lwvn7/MMy/+kUKKXn+et0C1RXuvz95N9VxT4s20Wn+bv8NUynYNAuf+5iFVk2f5+/L8v8p1tU62z+0EHPHuM67aCs+SQh9W+JdOkkCqdexp13Ax9F9MJ1bk0x73PrfScJuxv64rB+dPnDSJgXuXZRy6zEpbymKa9p9nbAf23mN6bjetoeTXMh4PiaX4qYZFqKeHa+fRSRxXn9RBzZdT6M6JmInxVZXqSXus6pa4t+9ryKZXle6xfkNbnlea1fkdf6BXlN8q15FT5JlJ5u7qwuZLaXS7q4LlK+uJR6lg+dr4uyeCn/Ecd1dfEPkevqQv231gXer7S85p7+KmpZ6M/LLNbZ/kLT4v5A9Qv6A82LU3F9HBf6g0+IzPcHVy/qfH+QL/Wd0+sba3znFS7eiC6fdog7K4/PiaR6JhJnReJ3brPgGYS9Uu95mTW9DAldLxPO5v/g/9M+be53x79+9XuH0nG3udtvx4+Pr4f7s29f/n/mN/zV8Pn4dL99eD1uoXT66dBeb/6w+zHVn/jhzT6IvWWXKPjo8dEuDUnl5ztC+QM=", "file_map": { "12": { - "source": "// docs:start:from-trait\npub trait From {\n fn from(input: T) -> Self;\n}\n// docs:end:from-trait\n\nimpl From for T {\n fn from(input: T) -> T {\n input\n }\n}\n\n// docs:start:into-trait\npub trait Into {\n fn into(self) -> T;\n}\n\nimpl Into for U\nwhere\n T: From,\n{\n fn into(self) -> T {\n T::from(self)\n }\n}\n// docs:end:into-trait\n\n// docs:start:from-impls\n// Unsigned integers\n\nimpl From for u32 {\n fn from(value: u8) -> u32 {\n value as u32\n }\n}\n\nimpl From for u64 {\n fn from(value: u8) -> u64 {\n value as u64\n }\n}\nimpl From for u64 {\n fn from(value: u32) -> u64 {\n value as u64\n }\n}\n\nimpl From for u128 {\n fn from(value: u8) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u32) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u64) -> u128 {\n value as u128\n }\n}\n\nimpl From for Field {\n fn from(value: u8) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u32) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u64) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u128) -> Field {\n value as Field\n }\n}\n\n// Signed integers\n\nimpl From for i32 {\n fn from(value: i8) -> i32 {\n value as i32\n }\n}\n\nimpl From for i64 {\n fn from(value: i8) -> i64 {\n value as i64\n }\n}\nimpl From for i64 {\n fn from(value: i32) -> i64 {\n value as i64\n }\n}\n\n// Booleans\nimpl From for u8 {\n fn from(value: bool) -> u8 {\n value as u8\n }\n}\nimpl From for u32 {\n fn from(value: bool) -> u32 {\n value as u32\n }\n}\nimpl From for u64 {\n fn from(value: bool) -> u64 {\n value as u64\n }\n}\nimpl From for i8 {\n fn from(value: bool) -> i8 {\n value as i8\n }\n}\nimpl From for i32 {\n fn from(value: bool) -> i32 {\n value as i32\n }\n}\nimpl From for i64 {\n fn from(value: bool) -> i64 {\n value as i64\n }\n}\nimpl From for Field {\n fn from(value: bool) -> Field {\n value as Field\n }\n}\n// docs:end:from-impls\n\n/// A generic interface for casting between primitive types,\n/// equivalent of using the `as` keyword between values.\n///\n/// # Example\n///\n/// ```\n/// let x: Field = 1234567890;\n/// let y: u8 = x as u8;\n/// let z: u8 = x.as_();\n/// assert_eq(y, z);\n/// ```\npub trait AsPrimitive {\n /// The equivalent of doing `self as T`.\n fn as_(self) -> T;\n}\n\n#[generate_as_primitive_impls]\ncomptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted {\n let types = [\n quote { bool },\n quote { u8 },\n quote { u16 },\n quote { u32 },\n quote { u64 },\n quote { u128 },\n quote { i8 },\n quote { i16 },\n quote { i32 },\n quote { i64 },\n quote { Field },\n ];\n\n let mut impls = &[];\n for type1 in types {\n for type2 in types {\n let trait_impl = quote {\n impl AsPrimitive<$type1> for $type2 {\n fn as_(self) -> $type1 {\n self as $type1\n }\n }\n };\n\n impls = impls.push_back(trait_impl);\n }\n }\n impls.join(quote {})\n}\n", + "source": "// docs:start:from-trait\npub trait From {\n fn from(input: T) -> Self;\n}\n// docs:end:from-trait\n\nimpl From for T {\n fn from(input: T) -> T {\n input\n }\n}\n\n// docs:start:into-trait\npub trait Into {\n fn into(self) -> T;\n}\n\nimpl Into for U\nwhere\n T: From,\n{\n fn into(self) -> T {\n T::from(self)\n }\n}\n// docs:end:into-trait\n\n// docs:start:from-impls\n// Unsigned integers\n\nimpl From for u32 {\n fn from(value: u8) -> u32 {\n value as u32\n }\n}\n\nimpl From for u64 {\n fn from(value: u8) -> u64 {\n value as u64\n }\n}\nimpl From for u64 {\n fn from(value: u32) -> u64 {\n value as u64\n }\n}\n\nimpl From for u128 {\n fn from(value: u8) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u32) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u64) -> u128 {\n value as u128\n }\n}\n\nimpl From for Field {\n fn from(value: u8) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u32) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u64) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u128) -> Field {\n value as Field\n }\n}\n\n// Signed integers\n\nimpl From for i32 {\n fn from(value: i8) -> i32 {\n value as i32\n }\n}\n\nimpl From for i64 {\n fn from(value: i8) -> i64 {\n value as i64\n }\n}\nimpl From for i64 {\n fn from(value: i32) -> i64 {\n value as i64\n }\n}\n\n// Booleans\nimpl From for u8 {\n fn from(value: bool) -> u8 {\n value as u8\n }\n}\nimpl From for u32 {\n fn from(value: bool) -> u32 {\n value as u32\n }\n}\nimpl From for u64 {\n fn from(value: bool) -> u64 {\n value as u64\n }\n}\nimpl From for i8 {\n fn from(value: bool) -> i8 {\n value as i8\n }\n}\nimpl From for i32 {\n fn from(value: bool) -> i32 {\n value as i32\n }\n}\nimpl From for i64 {\n fn from(value: bool) -> i64 {\n value as i64\n }\n}\nimpl From for Field {\n fn from(value: bool) -> Field {\n value as Field\n }\n}\n// docs:end:from-impls\n\n/// A generic interface for casting between primitive types,\n/// equivalent of using the `as` keyword between values.\n///\n/// # Example\n///\n/// ```\n/// let x: Field = 1234567890;\n/// let y: u8 = x as u8;\n/// let z: u8 = x.as_();\n/// assert_eq(y, z);\n/// ```\npub trait AsPrimitive {\n /// The equivalent of doing `self as T`.\n fn as_(self) -> T;\n}\n\n#[generate_as_primitive_impls]\ncomptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted {\n let types = [\n quote { bool },\n quote { u8 },\n quote { u16 },\n quote { u32 },\n quote { u64 },\n quote { u128 },\n quote { i8 },\n quote { i16 },\n quote { i32 },\n quote { i64 },\n quote { Field },\n ];\n\n let mut impls = &[];\n for type1 in types {\n for type2 in types {\n let body = if type1 == type2 {\n quote { self }\n } else if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for $type2 {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n }\n impls.join(quote {})\n}\n", "path": "std/convert.nr" }, "39": { diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/6_array/execute__tests__force_brillig_true_inliner_0.snap b/tooling/nargo_cli/tests/snapshots/execution_success/6_array/execute__tests__force_brillig_true_inliner_0.snap index 086d356590f..9e67048cff1 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/6_array/execute__tests__force_brillig_true_inliner_0.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/6_array/execute__tests__force_brillig_true_inliner_0.snap @@ -90,10 +90,10 @@ expression: artifact "unconstrained func 0", "[Const { destination: Direct(2), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(1), bit_size: Integer(U32), value: 32848 }, Const { destination: Direct(0), bit_size: Integer(U32), value: 3 }, Const { destination: Relative(5), bit_size: Integer(U32), value: 12 }, Const { destination: Relative(6), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(32836), size_address: Relative(5), offset_address: Relative(6) }, Cast { destination: Direct(32836), source: Direct(32836), bit_size: Integer(U32) }, Cast { destination: Direct(32837), source: Direct(32837), bit_size: Integer(U32) }, Cast { destination: Direct(32838), source: Direct(32838), bit_size: Integer(U32) }, Cast { destination: Direct(32839), source: Direct(32839), bit_size: Integer(U32) }, Cast { destination: Direct(32840), source: Direct(32840), bit_size: Integer(U32) }, Cast { destination: Direct(32841), source: Direct(32841), bit_size: Integer(U32) }, Cast { destination: Direct(32842), source: Direct(32842), bit_size: Integer(U32) }, Cast { destination: Direct(32843), source: Direct(32843), bit_size: Integer(U32) }, Cast { destination: Direct(32844), source: Direct(32844), bit_size: Integer(U32) }, Cast { destination: Direct(32845), source: Direct(32845), bit_size: Integer(U32) }, Cast { destination: Direct(32846), source: Direct(32846), bit_size: Integer(U32) }, Cast { destination: Direct(32847), source: Direct(32847), bit_size: Integer(U32) }, Const { destination: Relative(1), bit_size: Integer(U32), value: 32836 }, Const { destination: Relative(6), bit_size: Integer(U32), value: 5 }, Mov { destination: Relative(5), source: Direct(1) }, Const { destination: Relative(7), bit_size: Integer(U32), value: 6 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(7) }, IndirectConst { destination_pointer: Relative(5), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(7), op: Add, bit_size: U32, lhs: Relative(5), rhs: Direct(2) }, Mov { destination: Direct(32771), source: Relative(1) }, Mov { destination: Direct(32772), source: Relative(7) }, Mov { destination: Direct(32773), source: Relative(6) }, Call { location: 49 }, Mov { destination: Relative(1), source: Relative(5) }, Const { destination: Relative(2), bit_size: Integer(U32), value: 32841 }, Const { destination: Relative(6), bit_size: Integer(U32), value: 5 }, Mov { destination: Relative(5), source: Direct(1) }, Const { destination: Relative(7), bit_size: Integer(U32), value: 6 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(7) }, IndirectConst { destination_pointer: Relative(5), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(7), op: Add, bit_size: U32, lhs: Relative(5), rhs: Direct(2) }, Mov { destination: Direct(32771), source: Relative(2) }, Mov { destination: Direct(32772), source: Relative(7) }, Mov { destination: Direct(32773), source: Relative(6) }, Call { location: 49 }, Mov { destination: Relative(2), source: Relative(5) }, Mov { destination: Relative(3), source: Direct(32846) }, Mov { destination: Relative(4), source: Direct(32847) }, Call { location: 60 }, Call { location: 61 }, Const { destination: Relative(1), bit_size: Integer(U32), value: 32848 }, Const { destination: Relative(2), bit_size: Integer(U32), value: 0 }, Stop { return_data: HeapVector { pointer: Relative(1), size: Relative(2) } }, BinaryIntOp { destination: Direct(32775), op: Add, bit_size: U32, lhs: Direct(32771), rhs: Direct(32773) }, Mov { destination: Direct(32776), source: Direct(32771) }, Mov { destination: Direct(32777), source: Direct(32772) }, BinaryIntOp { destination: Direct(32778), op: Equals, bit_size: U32, lhs: Direct(32776), rhs: Direct(32775) }, JumpIf { condition: Direct(32778), location: 59 }, Load { destination: Direct(32774), source_pointer: Direct(32776) }, Store { destination_pointer: Direct(32777), source: Direct(32774) }, BinaryIntOp { destination: Direct(32776), op: Add, bit_size: U32, lhs: Direct(32776), rhs: Direct(2) }, BinaryIntOp { destination: Direct(32777), op: Add, bit_size: U32, lhs: Direct(32777), rhs: Direct(2) }, Jump { location: 52 }, Return, Return, Call { location: 338 }, Mov { destination: Relative(6), source: Direct(1) }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Direct(2) }, Const { destination: Relative(7), bit_size: Integer(U32), value: 5 }, BinaryIntOp { destination: Relative(9), op: Add, bit_size: U32, lhs: Relative(2), rhs: Relative(7) }, Load { destination: Relative(8), source_pointer: Relative(9) }, Store { destination_pointer: Relative(6), source: Relative(8) }, Const { destination: Relative(9), bit_size: Integer(U32), value: 0 }, Const { destination: Relative(10), bit_size: Integer(U32), value: 1 }, Mov { destination: Relative(5), source: Relative(9) }, Jump { location: 72 }, BinaryIntOp { destination: Relative(3), op: LessThan, bit_size: U32, lhs: Relative(5), rhs: Relative(7) }, JumpIf { condition: Relative(3), location: 310 }, Jump { location: 75 }, Load { destination: Relative(5), source_pointer: Relative(6) }, BinaryIntOp { destination: Relative(11), op: Equals, bit_size: U32, lhs: Relative(5), rhs: Relative(9) }, JumpIf { condition: Relative(11), location: 80 }, Const { destination: Relative(12), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(12) } }, Const { destination: Relative(5), bit_size: Integer(U32), value: 2 }, BinaryIntOp { destination: Relative(11), op: Add, bit_size: U32, lhs: Relative(4), rhs: Relative(5) }, BinaryIntOp { destination: Relative(12), op: LessThanEquals, bit_size: U32, lhs: Relative(4), rhs: Relative(11) }, JumpIf { condition: Relative(12), location: 85 }, Call { location: 344 }, Const { destination: Relative(4), bit_size: Field, value: 340282366920938463463374607431768211456 }, Mov { destination: Relative(3), source: Relative(9) }, Jump { location: 88 }, BinaryIntOp { destination: Relative(11), op: LessThan, bit_size: U32, lhs: Relative(3), rhs: Relative(7) }, JumpIf { condition: Relative(11), location: 274 }, Jump { location: 91 }, Load { destination: Relative(11), source_pointer: Relative(6) }, Const { destination: Relative(12), bit_size: Integer(U32), value: 3814912846 }, BinaryIntOp { destination: Relative(13), op: Equals, bit_size: U32, lhs: Relative(11), rhs: Relative(12) }, JumpIf { condition: Relative(13), location: 97 }, Const { destination: Relative(14), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(14) } }, Store { destination_pointer: Relative(6), source: Relative(8) }, Const { destination: Relative(11), bit_size: Field, value: 2 }, Const { destination: Relative(12), bit_size: Integer(U32), value: 3 }, Mov { destination: Relative(3), source: Relative(9) }, Jump { location: 102 }, BinaryIntOp { destination: Relative(13), op: LessThan, bit_size: U32, lhs: Relative(3), rhs: Relative(7) }, JumpIf { condition: Relative(13), location: 231 }, Jump { location: 105 }, Load { destination: Relative(4), source_pointer: Relative(6) }, Const { destination: Relative(11), bit_size: Integer(U32), value: 41472 }, BinaryIntOp { destination: Relative(13), op: Equals, bit_size: U32, lhs: Relative(4), rhs: Relative(11) }, JumpIf { condition: Relative(13), location: 111 }, Const { destination: Relative(14), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(14) } }, Store { destination_pointer: Relative(6), source: Relative(8) }, Const { destination: Relative(4), bit_size: Integer(U1), value: 1 }, Mov { destination: Relative(3), source: Relative(9) }, Jump { location: 115 }, BinaryIntOp { destination: Relative(8), op: LessThan, bit_size: U32, lhs: Relative(3), rhs: Relative(12) }, JumpIf { condition: Relative(8), location: 177 }, Jump { location: 118 }, Load { destination: Relative(4), source_pointer: Relative(6) }, Const { destination: Relative(5), bit_size: Integer(U32), value: 11539 }, BinaryIntOp { destination: Relative(6), op: Equals, bit_size: U32, lhs: Relative(4), rhs: Relative(5) }, JumpIf { condition: Relative(6), location: 124 }, Const { destination: Relative(8), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(8) } }, Load { destination: Relative(4), source_pointer: Relative(1) }, Const { destination: Relative(5), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(6), op: Equals, bit_size: U32, lhs: Relative(5), rhs: Relative(4) }, Not { destination: Relative(6), source: Relative(6), bit_size: U1 }, JumpIf { condition: Relative(6), location: 130 }, Call { location: 347 }, BinaryIntOp { destination: Relative(4), op: Add, bit_size: U32, lhs: Relative(4), rhs: Direct(2) }, Store { destination_pointer: Relative(1), source: Relative(4) }, Load { destination: Relative(4), source_pointer: Relative(2) }, Const { destination: Relative(6), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(8), op: Equals, bit_size: U32, lhs: Relative(6), rhs: Relative(4) }, Not { destination: Relative(8), source: Relative(8), bit_size: U1 }, JumpIf { condition: Relative(8), location: 138 }, Call { location: 347 }, BinaryIntOp { destination: Relative(4), op: Add, bit_size: U32, lhs: Relative(4), rhs: Direct(2) }, Store { destination_pointer: Relative(2), source: Relative(4) }, Const { destination: Relative(4), bit_size: Integer(U1), value: 0 }, Mov { destination: Relative(3), source: Relative(9) }, Jump { location: 143 }, BinaryIntOp { destination: Relative(5), op: LessThan, bit_size: U32, lhs: Relative(3), rhs: Relative(7) }, JumpIf { condition: Relative(5), location: 147 }, Jump { location: 146 }, Return, BinaryIntOp { destination: Relative(8), op: Add, bit_size: U32, lhs: Relative(2), rhs: Direct(2) }, BinaryIntOp { destination: Relative(11), op: Add, bit_size: U32, lhs: Relative(8), rhs: Relative(3) }, Load { destination: Relative(6), source_pointer: Relative(11) }, Load { destination: Relative(8), source_pointer: Relative(1) }, Const { destination: Relative(11), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(12), op: Equals, bit_size: U32, lhs: Relative(11), rhs: Relative(8) }, Not { destination: Relative(12), source: Relative(12), bit_size: U1 }, JumpIf { condition: Relative(12), location: 156 }, Call { location: 347 }, BinaryIntOp { destination: Relative(8), op: Add, bit_size: U32, lhs: Relative(8), rhs: Direct(2) }, Store { destination_pointer: Relative(1), source: Relative(8) }, Mov { destination: Relative(5), source: Relative(9) }, Jump { location: 160 }, BinaryIntOp { destination: Relative(8), op: LessThan, bit_size: U32, lhs: Relative(5), rhs: Relative(7) }, JumpIf { condition: Relative(8), location: 166 }, Jump { location: 163 }, BinaryIntOp { destination: Relative(5), op: Add, bit_size: U32, lhs: Relative(3), rhs: Relative(10) }, Mov { destination: Relative(3), source: Relative(5) }, Jump { location: 143 }, BinaryIntOp { destination: Relative(11), op: Add, bit_size: U32, lhs: Relative(1), rhs: Direct(2) }, BinaryIntOp { destination: Relative(12), op: Add, bit_size: U32, lhs: Relative(11), rhs: Relative(5) }, Load { destination: Relative(8), source_pointer: Relative(12) }, BinaryIntOp { destination: Relative(11), op: Equals, bit_size: U32, lhs: Relative(8), rhs: Relative(6) }, BinaryIntOp { destination: Relative(8), op: Equals, bit_size: U1, lhs: Relative(11), rhs: Relative(4) }, JumpIf { condition: Relative(8), location: 174 }, Const { destination: Relative(12), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(12) } }, BinaryIntOp { destination: Relative(8), op: Add, bit_size: U32, lhs: Relative(5), rhs: Relative(10) }, Mov { destination: Relative(5), source: Relative(8) }, Jump { location: 160 }, Load { destination: Relative(11), source_pointer: Relative(6) }, BinaryIntOp { destination: Relative(14), op: Add, bit_size: U32, lhs: Relative(1), rhs: Direct(2) }, BinaryIntOp { destination: Relative(15), op: Add, bit_size: U32, lhs: Relative(14), rhs: Relative(3) }, Load { destination: Relative(13), source_pointer: Relative(15) }, BinaryIntOp { destination: Relative(15), op: Add, bit_size: U32, lhs: Relative(2), rhs: Direct(2) }, BinaryIntOp { destination: Relative(16), op: Add, bit_size: U32, lhs: Relative(15), rhs: Relative(3) }, Load { destination: Relative(14), source_pointer: Relative(16) }, BinaryIntOp { destination: Relative(15), op: Mul, bit_size: U32, lhs: Relative(13), rhs: Relative(14) }, Const { destination: Relative(17), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(16), op: Equals, bit_size: U32, lhs: Relative(17), rhs: Relative(14) }, JumpIf { condition: Relative(16), location: 192 }, BinaryIntOp { destination: Relative(19), op: Div, bit_size: U32, lhs: Relative(15), rhs: Relative(14) }, BinaryIntOp { destination: Relative(18), op: Equals, bit_size: U32, lhs: Relative(19), rhs: Relative(13) }, JumpIf { condition: Relative(18), location: 192 }, Call { location: 350 }, BinaryIntOp { destination: Relative(13), op: Add, bit_size: U32, lhs: Relative(11), rhs: Relative(15) }, BinaryIntOp { destination: Relative(14), op: LessThanEquals, bit_size: U32, lhs: Relative(11), rhs: Relative(13) }, JumpIf { condition: Relative(14), location: 196 }, Call { location: 344 }, Store { destination_pointer: Relative(6), source: Relative(13) }, Mov { destination: Relative(8), source: Relative(9) }, Jump { location: 199 }, BinaryIntOp { destination: Relative(11), op: LessThan, bit_size: U32, lhs: Relative(8), rhs: Relative(5) }, JumpIf { condition: Relative(11), location: 205 }, Jump { location: 202 }, BinaryIntOp { destination: Relative(8), op: Add, bit_size: U32, lhs: Relative(3), rhs: Relative(10) }, Mov { destination: Relative(3), source: Relative(8) }, Jump { location: 115 }, Load { destination: Relative(11), source_pointer: Relative(6) }, BinaryIntOp { destination: Relative(13), op: Add, bit_size: U32, lhs: Relative(3), rhs: Relative(8) }, BinaryIntOp { destination: Relative(14), op: LessThanEquals, bit_size: U32, lhs: Relative(3), rhs: Relative(13) }, JumpIf { condition: Relative(14), location: 210 }, Call { location: 344 }, BinaryIntOp { destination: Relative(14), op: LessThan, bit_size: U32, lhs: Relative(13), rhs: Relative(7) }, JumpIf { condition: Relative(14), location: 213 }, Call { location: 353 }, BinaryIntOp { destination: Relative(15), op: Add, bit_size: U32, lhs: Relative(1), rhs: Direct(2) }, BinaryIntOp { destination: Relative(16), op: Add, bit_size: U32, lhs: Relative(15), rhs: Relative(13) }, Load { destination: Relative(14), source_pointer: Relative(16) }, BinaryIntOp { destination: Relative(16), op: Add, bit_size: U32, lhs: Relative(2), rhs: Direct(2) }, BinaryIntOp { destination: Relative(17), op: Add, bit_size: U32, lhs: Relative(16), rhs: Relative(13) }, Load { destination: Relative(15), source_pointer: Relative(17) }, BinaryIntOp { destination: Relative(13), op: Sub, bit_size: U32, lhs: Relative(14), rhs: Relative(15) }, BinaryIntOp { destination: Relative(16), op: LessThanEquals, bit_size: U32, lhs: Relative(15), rhs: Relative(14) }, JumpIf { condition: Relative(16), location: 223 }, Call { location: 356 }, BinaryIntOp { destination: Relative(14), op: Add, bit_size: U32, lhs: Relative(11), rhs: Relative(13) }, BinaryIntOp { destination: Relative(15), op: LessThanEquals, bit_size: U32, lhs: Relative(11), rhs: Relative(14) }, JumpIf { condition: Relative(15), location: 227 }, Call { location: 344 }, Store { destination_pointer: Relative(6), source: Relative(14) }, BinaryIntOp { destination: Relative(11), op: Add, bit_size: U32, lhs: Relative(8), rhs: Relative(10) }, Mov { destination: Relative(8), source: Relative(11) }, Jump { location: 199 }, Load { destination: Relative(14), source_pointer: Relative(6) }, BinaryIntOp { destination: Relative(16), op: Add, bit_size: U32, lhs: Relative(1), rhs: Direct(2) }, BinaryIntOp { destination: Relative(17), op: Add, bit_size: U32, lhs: Relative(16), rhs: Relative(3) }, Load { destination: Relative(15), source_pointer: Relative(17) }, BinaryIntOp { destination: Relative(17), op: Add, bit_size: U32, lhs: Relative(2), rhs: Direct(2) }, BinaryIntOp { destination: Relative(18), op: Add, bit_size: U32, lhs: Relative(17), rhs: Relative(3) }, Load { destination: Relative(16), source_pointer: Relative(18) }, BinaryIntOp { destination: Relative(17), op: Mul, bit_size: U32, lhs: Relative(15), rhs: Relative(16) }, Const { destination: Relative(19), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(18), op: Equals, bit_size: U32, lhs: Relative(19), rhs: Relative(16) }, JumpIf { condition: Relative(18), location: 246 }, BinaryIntOp { destination: Relative(21), op: Div, bit_size: U32, lhs: Relative(17), rhs: Relative(16) }, BinaryIntOp { destination: Relative(20), op: Equals, bit_size: U32, lhs: Relative(21), rhs: Relative(15) }, JumpIf { condition: Relative(20), location: 246 }, Call { location: 350 }, BinaryIntOp { destination: Relative(15), op: Add, bit_size: U32, lhs: Relative(14), rhs: Relative(17) }, BinaryIntOp { destination: Relative(16), op: LessThanEquals, bit_size: U32, lhs: Relative(14), rhs: Relative(15) }, JumpIf { condition: Relative(16), location: 250 }, Call { location: 344 }, Store { destination_pointer: Relative(6), source: Relative(15) }, Cast { destination: Relative(14), source: Relative(3), bit_size: Field }, BinaryFieldOp { destination: Relative(15), op: Add, lhs: Relative(14), rhs: Relative(4) }, BinaryFieldOp { destination: Relative(14), op: Sub, lhs: Relative(15), rhs: Relative(11) }, Cast { destination: Relative(16), source: Relative(14), bit_size: Integer(U32) }, Cast { destination: Relative(15), source: Relative(16), bit_size: Field }, Mov { destination: Relative(13), source: Relative(9) }, Jump { location: 258 }, BinaryIntOp { destination: Relative(14), op: LessThan, bit_size: U32, lhs: Relative(13), rhs: Relative(12) }, JumpIf { condition: Relative(14), location: 264 }, Jump { location: 261 }, BinaryIntOp { destination: Relative(13), op: Add, bit_size: U32, lhs: Relative(3), rhs: Relative(10) }, Mov { destination: Relative(3), source: Relative(13) }, Jump { location: 102 }, Load { destination: Relative(14), source_pointer: Relative(6) }, Cast { destination: Relative(16), source: Relative(14), bit_size: Field }, BinaryFieldOp { destination: Relative(14), op: Mul, lhs: Relative(16), rhs: Relative(15) }, Cast { destination: Relative(17), source: Relative(14), bit_size: Integer(U32) }, Cast { destination: Relative(16), source: Relative(17), bit_size: Field }, Cast { destination: Relative(14), source: Relative(16), bit_size: Integer(U32) }, Store { destination_pointer: Relative(6), source: Relative(14) }, BinaryIntOp { destination: Relative(14), op: Add, bit_size: U32, lhs: Relative(13), rhs: Relative(10) }, Mov { destination: Relative(13), source: Relative(14) }, Jump { location: 258 }, Load { destination: Relative(11), source_pointer: Relative(6) }, Cast { destination: Relative(12), source: Relative(11), bit_size: Field }, BinaryFieldOp { destination: Relative(11), op: Mul, lhs: Relative(12), rhs: Relative(12) }, Cast { destination: Relative(14), source: Relative(11), bit_size: Integer(U32) }, Cast { destination: Relative(13), source: Relative(14), bit_size: Field }, BinaryIntOp { destination: Relative(14), op: Add, bit_size: U32, lhs: Relative(1), rhs: Direct(2) }, BinaryIntOp { destination: Relative(15), op: Add, bit_size: U32, lhs: Relative(14), rhs: Relative(3) }, Load { destination: Relative(11), source_pointer: Relative(15) }, Cast { destination: Relative(14), source: Relative(11), bit_size: Field }, BinaryFieldOp { destination: Relative(15), op: Mul, lhs: Relative(13), rhs: Relative(14) }, Cast { destination: Relative(14), source: Relative(15), bit_size: Integer(U32) }, Cast { destination: Relative(13), source: Relative(14), bit_size: Field }, BinaryIntOp { destination: Relative(15), op: Add, bit_size: U32, lhs: Relative(2), rhs: Direct(2) }, BinaryIntOp { destination: Relative(16), op: Add, bit_size: U32, lhs: Relative(15), rhs: Relative(3) }, Load { destination: Relative(14), source_pointer: Relative(16) }, BinaryIntOp { destination: Relative(15), op: Mul, bit_size: U32, lhs: Relative(11), rhs: Relative(14) }, Const { destination: Relative(17), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(16), op: Equals, bit_size: U32, lhs: Relative(17), rhs: Relative(14) }, JumpIf { condition: Relative(16), location: 297 }, BinaryIntOp { destination: Relative(19), op: Div, bit_size: U32, lhs: Relative(15), rhs: Relative(14) }, BinaryIntOp { destination: Relative(18), op: Equals, bit_size: U32, lhs: Relative(19), rhs: Relative(11) }, JumpIf { condition: Relative(18), location: 297 }, Call { location: 350 }, Cast { destination: Relative(11), source: Relative(15), bit_size: Field }, BinaryFieldOp { destination: Relative(14), op: Add, lhs: Relative(11), rhs: Relative(4) }, BinaryFieldOp { destination: Relative(11), op: Sub, lhs: Relative(14), rhs: Relative(13) }, Cast { destination: Relative(14), source: Relative(11), bit_size: Integer(U32) }, Cast { destination: Relative(13), source: Relative(14), bit_size: Field }, BinaryFieldOp { destination: Relative(11), op: Add, lhs: Relative(12), rhs: Relative(13) }, Cast { destination: Relative(13), source: Relative(11), bit_size: Integer(U32) }, Cast { destination: Relative(12), source: Relative(13), bit_size: Field }, Cast { destination: Relative(11), source: Relative(12), bit_size: Integer(U32) }, Store { destination_pointer: Relative(6), source: Relative(11) }, BinaryIntOp { destination: Relative(11), op: Add, bit_size: U32, lhs: Relative(3), rhs: Relative(10) }, Mov { destination: Relative(3), source: Relative(11) }, Jump { location: 88 }, Load { destination: Relative(3), source_pointer: Relative(6) }, BinaryIntOp { destination: Relative(11), op: Mul, bit_size: U32, lhs: Relative(3), rhs: Relative(3) }, Const { destination: Relative(13), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(12), op: Equals, bit_size: U32, lhs: Relative(13), rhs: Relative(3) }, JumpIf { condition: Relative(12), location: 319 }, BinaryIntOp { destination: Relative(15), op: Div, bit_size: U32, lhs: Relative(11), rhs: Relative(3) }, BinaryIntOp { destination: Relative(14), op: Equals, bit_size: U32, lhs: Relative(15), rhs: Relative(3) }, JumpIf { condition: Relative(14), location: 319 }, Call { location: 350 }, BinaryIntOp { destination: Relative(13), op: Add, bit_size: U32, lhs: Relative(2), rhs: Direct(2) }, BinaryIntOp { destination: Relative(14), op: Add, bit_size: U32, lhs: Relative(13), rhs: Relative(5) }, Load { destination: Relative(12), source_pointer: Relative(14) }, BinaryIntOp { destination: Relative(13), op: Mul, bit_size: U32, lhs: Relative(11), rhs: Relative(12) }, Const { destination: Relative(15), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(14), op: Equals, bit_size: U32, lhs: Relative(15), rhs: Relative(12) }, JumpIf { condition: Relative(14), location: 330 }, BinaryIntOp { destination: Relative(17), op: Div, bit_size: U32, lhs: Relative(13), rhs: Relative(12) }, BinaryIntOp { destination: Relative(16), op: Equals, bit_size: U32, lhs: Relative(17), rhs: Relative(11) }, JumpIf { condition: Relative(16), location: 330 }, Call { location: 350 }, BinaryIntOp { destination: Relative(11), op: Sub, bit_size: U32, lhs: Relative(3), rhs: Relative(13) }, BinaryIntOp { destination: Relative(12), op: LessThanEquals, bit_size: U32, lhs: Relative(13), rhs: Relative(3) }, JumpIf { condition: Relative(12), location: 334 }, Call { location: 356 }, Store { destination_pointer: Relative(6), source: Relative(11) }, BinaryIntOp { destination: Relative(3), op: Add, bit_size: U32, lhs: Relative(5), rhs: Relative(10) }, Mov { destination: Relative(5), source: Relative(3) }, Jump { location: 72 }, 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: 343 }, IndirectConst { destination_pointer: Direct(1), bit_size: Integer(U64), value: 17843811134343075018 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return, IndirectConst { destination_pointer: Direct(1), bit_size: Integer(U64), value: 5019202896831570965 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return, IndirectConst { destination_pointer: Direct(1), bit_size: Integer(U64), value: 12049594436772143978 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return, IndirectConst { destination_pointer: Direct(1), bit_size: Integer(U64), value: 7233212735005103307 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return, IndirectConst { destination_pointer: Direct(1), bit_size: Integer(U64), value: 14225679739041873922 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return, IndirectConst { destination_pointer: Direct(1), bit_size: Integer(U64), value: 2920182694213909827 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return]" ], - "debug_symbols": "tZnRThs9EIXfJde5sD322OZVqgoFCFWkKKAUfukX4t07Z71nkyJtGrxw0/lCPMeznrE93bytHrZ3r79ud4fHp9+rmx9vq7vjbr/f/brdP91vXnZPB/vr28rhH42rG79eaWpGm8mDyWF1E8zYd2LGvotmcjOlmTqYYlrJjG8mNCPNxGbMQderakOyGRtSzEgzsZnUjDZjE9X1yjsb6h0AMXoAogyATCiEOoJ3BJvQCwDuEYDBCYDBFpMPjuAJgSAELFQGJIISMqEQ6gjiCJ4A5QIQQiQkghIyoRDqCJHukWMix0SOSZgda5g8IRCEEAmJoIQ8glJHzSsgF8oxOo0phDqOyY7gCYFAnRwJecwOCisgyyitAVBcDaCDnKLAGggBOshySQQlZEIh1BGqI3gClBEGKrNBJCSCEqBjhRSGEh0g8S8Yo4BMKIQ6Akq0gScEAmbPgEhIBCgXQCYUApQtBQH13MATAkHGUId6HiARlJAJ404JQ/U6gOnIAEKIBBwTHqCETDAdCYA6QnQETwgEIURCIkBZAJlQCHUE1HwDKGPFUPOC9UHNCxYBNR8RM2q+AY4zhKq+HTIBB6NEAMYMgAMQq4Gaj1BGzTeoI6DmB/dMndyOv4BTNA1/MJmEp0HJJwij5BuYTMLg4TwdwBNwpiJ2lLwiZJS8Qgcl38CUFY+Okm9QCKasmAIl38ATAkEIkZAISoAy1rJCGfFgE2SLR5wpZw/wBFPOAjDlnACRkAg63AeCfQI7bApYiCggEIQQCYmghEwoBIQHYeyJBp4A5QIQQiQkghIyoRDqCDjj8ZTYJIMNo5XRxtGijN/f1yvewrcvx+0Wl/DZtWyX9fPmuD28rG4Or/v9evXfZv86DPr9vDkM9mVztG9tybeHB7Mm+Ljbb0Hv65O3m3e1Q3t0tqN5ck9X+wcno39wsccfO635x9zjr0r/HDr8JdNfSunxVy6+aM/6RWz/wT+qdvgnz/iT9MyfCuNPpSd/6hi/Ounwz4H1l2NP/Dmz/nLpmb+4MvoX31M/Rbh+pWv9S2X+anAd/jVW+qfa41+Zv1p79p912dzAhj0raF35dARZP96lEN2kkHp2UYkMoaSuLOLKHv3Lwvn7/MMy/+kUKKXn+et0C1RXuvz95N9VxT4s20Wn+bv8NUynYNAuf+5iFVk2f5+/L8v8p1tU62z+0EHPHuM67aCs+SQh9W+JdOkkCqdexp13Ax9F9MJ1HqadaI3faSvY3dAXh/Wjyx9GwrzItYtaZiUu5TVNeU2ztwP+azO/MR1PFtujaS4EHF/zSxGTTEsRz863jyKyOK+fiCO7zocRPRPxsyLLi/RS1zl1bdHPnlexLM9r/YK8Jrc8r/Ur8lq/IK9JvjWvwieJ0tPNndWFzPZySRfXRcoXl1LP8qHzdVEWL+U/4riuLv4hcl1dqP/WusD7lZbX3NNfRS0L/fkAsc72F5oW9weqX9AfaF6ciuvjuNAffEJkvj+4elHn+4N8qe+cXt9Y4zuvcPFGdPm0Q9xZeXxOJNUzkTgrEr9zmwXPIOyVes/LrOllSOh6mXA2/wf/n/Zpc787/vWr3zuUjrvN3X47fnx8Pdyfffvy/zO/4a+Gz8en++3D63ELpdNPh/Z684fdj6n+xA9v9kHsLbtEwUePj3ZpSCo/3xHKHw==", + "debug_symbols": "tZnRThs9EIXfJde5sD322OZVqgoFCFWkKKAUfukX4t07Z71nkyJtGrxw0/lCPMeznrE93bytHrZ3r79ud4fHp9+rmx9vq7vjbr/f/brdP91vXnZPB/vr28rhH42rG79eaWpGm8mDyWF1E8zYd2LGvotmcjOlmTqYYlrJjG8mNCPNxGbMQderakOyGRtSzEgzsZnUjDZjE9X1yjsb6h0AMXoAogyATCiEOoJ3BJvQCwDuEYDBCYDBFpMPjuAJgSAELFQGJIISMqEQ6gjiCJ4A5QIQQiQkghIyoRDqCJHukWMix0SOSZgda5g8IRCEEAmJoIQ8glJHzSsgF8oxOo0phDqOyY7gCYFAnRwJecwOCisgyyitAVBcDaCDnKLAGggBOshySQQlZEIh1BGqI3gClBEGKrNBJCSCEqBjhRSGEh0g8S8Yo4BMKIQ6Akq0gScEAmbPgEhIBCgXQCYUApQtBQH13MATAkHGUId6HiARlJAJ404JQ/U6gOnIAEKIBBwTHqCETDAdCYA6QnQETwgEIURCIkBZAJlQCHUE1HwDKGPFUPOC9UHNCxYBNR8RM2q+AY4zhKq+HTIBB6NEAMYMgAMQq4Gaj1BGzTeoI6DmB/dMndyOv4BTNA1/MJmEp0HJJwij5BuYTMLg4TwdwBNwpiJ2lLwiZJS8Qgcl38CUFY+Okm9QCKasmAIl38ATAkEIkZAISoAy1rJCGfFgE2SLR5wpZw/wBFPOAjDlnACRkAg63AeCfQI7bApYiCggEIQQCYmghEwoBIQHYeyJBp4A5QIQQiQkghIyoRDqCDjj8ZTYJIMNo5XRxtGijN/f1yvewrcvx+0Wl/DZtWyX9fPmuD28rG4Or/v9evXfZv86DPr9vDkM9mVztG9tybeHB7Mm+Ljbb0Hv65O3m3e1Q3t0tqN5ck9X+wcno39wsccfO635x9zjr0r/HDr8JdNfSunxVy6+aM/6RWz/wT+qdvgnz/iT9MyfCuNPpSd/6hi/Ounwz4H1l2NP/Dmz/nLpmb+4MvoX31M/Rbh+pWv9S2X+anAd/jVW+qfa41+Zv1p79p912dzAhj0raF35dARZP96lEN2kkHp2UYkMoaSuLOLKHv3Lwvn7/MMy/+kUKKXn+et0C1RXuvz95N9VxT4s20Wn+bv8NUynYNAuf+5iFVk2f5+/L8v8p1tU62z+0EHPHuM67aCs+SQh9W+JdOkkCqdexp13Ax9F9MJ1bk0x73PrfScJuxv64rB+dPnDSJgXuXZRy6zEpbymKa9p9nbAf23mN6bjetoeTXMh4PiaX4qYZFqKeHa+fRSRxXn9RBzZdT6M6JmInxVZXqSXus6pa4t+9ryKZXle6xfkNbnlea1fkdf6BXlN8q15FT5JlJ5u7qwuZLaXS7q4LlK+uJR6lg+dr4uyeCn/Ecd1dfEPkevqQv231gXer7S85p7+KmpZ6M/LLNbZ/kLT4v5A9Qv6A82LU3F9HBf6g0+IzPcHVy/qfH+QL/Wd0+sba3znFS7eiC6fdog7K4/PiaR6JhJnReJ3brPgGYS9Uu95mTW9DAldLxPO5v/g/9M+be53x79+9XuH0nG3udtvx4+Pr4f7s29f/n/mN/zV8Pn4dL99eD1uoXT66dBeb/6w+zHVn/jhzT6IvWWXKPjo8dEuDUnl5ztC+QM=", "file_map": { "12": { - "source": "// docs:start:from-trait\npub trait From {\n fn from(input: T) -> Self;\n}\n// docs:end:from-trait\n\nimpl From for T {\n fn from(input: T) -> T {\n input\n }\n}\n\n// docs:start:into-trait\npub trait Into {\n fn into(self) -> T;\n}\n\nimpl Into for U\nwhere\n T: From,\n{\n fn into(self) -> T {\n T::from(self)\n }\n}\n// docs:end:into-trait\n\n// docs:start:from-impls\n// Unsigned integers\n\nimpl From for u32 {\n fn from(value: u8) -> u32 {\n value as u32\n }\n}\n\nimpl From for u64 {\n fn from(value: u8) -> u64 {\n value as u64\n }\n}\nimpl From for u64 {\n fn from(value: u32) -> u64 {\n value as u64\n }\n}\n\nimpl From for u128 {\n fn from(value: u8) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u32) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u64) -> u128 {\n value as u128\n }\n}\n\nimpl From for Field {\n fn from(value: u8) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u32) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u64) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u128) -> Field {\n value as Field\n }\n}\n\n// Signed integers\n\nimpl From for i32 {\n fn from(value: i8) -> i32 {\n value as i32\n }\n}\n\nimpl From for i64 {\n fn from(value: i8) -> i64 {\n value as i64\n }\n}\nimpl From for i64 {\n fn from(value: i32) -> i64 {\n value as i64\n }\n}\n\n// Booleans\nimpl From for u8 {\n fn from(value: bool) -> u8 {\n value as u8\n }\n}\nimpl From for u32 {\n fn from(value: bool) -> u32 {\n value as u32\n }\n}\nimpl From for u64 {\n fn from(value: bool) -> u64 {\n value as u64\n }\n}\nimpl From for i8 {\n fn from(value: bool) -> i8 {\n value as i8\n }\n}\nimpl From for i32 {\n fn from(value: bool) -> i32 {\n value as i32\n }\n}\nimpl From for i64 {\n fn from(value: bool) -> i64 {\n value as i64\n }\n}\nimpl From for Field {\n fn from(value: bool) -> Field {\n value as Field\n }\n}\n// docs:end:from-impls\n\n/// A generic interface for casting between primitive types,\n/// equivalent of using the `as` keyword between values.\n///\n/// # Example\n///\n/// ```\n/// let x: Field = 1234567890;\n/// let y: u8 = x as u8;\n/// let z: u8 = x.as_();\n/// assert_eq(y, z);\n/// ```\npub trait AsPrimitive {\n /// The equivalent of doing `self as T`.\n fn as_(self) -> T;\n}\n\n#[generate_as_primitive_impls]\ncomptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted {\n let types = [\n quote { bool },\n quote { u8 },\n quote { u16 },\n quote { u32 },\n quote { u64 },\n quote { u128 },\n quote { i8 },\n quote { i16 },\n quote { i32 },\n quote { i64 },\n quote { Field },\n ];\n\n let mut impls = &[];\n for type1 in types {\n for type2 in types {\n let trait_impl = quote {\n impl AsPrimitive<$type1> for $type2 {\n fn as_(self) -> $type1 {\n self as $type1\n }\n }\n };\n\n impls = impls.push_back(trait_impl);\n }\n }\n impls.join(quote {})\n}\n", + "source": "// docs:start:from-trait\npub trait From {\n fn from(input: T) -> Self;\n}\n// docs:end:from-trait\n\nimpl From for T {\n fn from(input: T) -> T {\n input\n }\n}\n\n// docs:start:into-trait\npub trait Into {\n fn into(self) -> T;\n}\n\nimpl Into for U\nwhere\n T: From,\n{\n fn into(self) -> T {\n T::from(self)\n }\n}\n// docs:end:into-trait\n\n// docs:start:from-impls\n// Unsigned integers\n\nimpl From for u32 {\n fn from(value: u8) -> u32 {\n value as u32\n }\n}\n\nimpl From for u64 {\n fn from(value: u8) -> u64 {\n value as u64\n }\n}\nimpl From for u64 {\n fn from(value: u32) -> u64 {\n value as u64\n }\n}\n\nimpl From for u128 {\n fn from(value: u8) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u32) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u64) -> u128 {\n value as u128\n }\n}\n\nimpl From for Field {\n fn from(value: u8) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u32) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u64) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u128) -> Field {\n value as Field\n }\n}\n\n// Signed integers\n\nimpl From for i32 {\n fn from(value: i8) -> i32 {\n value as i32\n }\n}\n\nimpl From for i64 {\n fn from(value: i8) -> i64 {\n value as i64\n }\n}\nimpl From for i64 {\n fn from(value: i32) -> i64 {\n value as i64\n }\n}\n\n// Booleans\nimpl From for u8 {\n fn from(value: bool) -> u8 {\n value as u8\n }\n}\nimpl From for u32 {\n fn from(value: bool) -> u32 {\n value as u32\n }\n}\nimpl From for u64 {\n fn from(value: bool) -> u64 {\n value as u64\n }\n}\nimpl From for i8 {\n fn from(value: bool) -> i8 {\n value as i8\n }\n}\nimpl From for i32 {\n fn from(value: bool) -> i32 {\n value as i32\n }\n}\nimpl From for i64 {\n fn from(value: bool) -> i64 {\n value as i64\n }\n}\nimpl From for Field {\n fn from(value: bool) -> Field {\n value as Field\n }\n}\n// docs:end:from-impls\n\n/// A generic interface for casting between primitive types,\n/// equivalent of using the `as` keyword between values.\n///\n/// # Example\n///\n/// ```\n/// let x: Field = 1234567890;\n/// let y: u8 = x as u8;\n/// let z: u8 = x.as_();\n/// assert_eq(y, z);\n/// ```\npub trait AsPrimitive {\n /// The equivalent of doing `self as T`.\n fn as_(self) -> T;\n}\n\n#[generate_as_primitive_impls]\ncomptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted {\n let types = [\n quote { bool },\n quote { u8 },\n quote { u16 },\n quote { u32 },\n quote { u64 },\n quote { u128 },\n quote { i8 },\n quote { i16 },\n quote { i32 },\n quote { i64 },\n quote { Field },\n ];\n\n let mut impls = &[];\n for type1 in types {\n for type2 in types {\n let body = if type1 == type2 {\n quote { self }\n } else if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for $type2 {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n }\n impls.join(quote {})\n}\n", "path": "std/convert.nr" }, "39": { diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/6_array/execute__tests__force_brillig_true_inliner_9223372036854775807.snap b/tooling/nargo_cli/tests/snapshots/execution_success/6_array/execute__tests__force_brillig_true_inliner_9223372036854775807.snap index 086d356590f..9e67048cff1 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/6_array/execute__tests__force_brillig_true_inliner_9223372036854775807.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/6_array/execute__tests__force_brillig_true_inliner_9223372036854775807.snap @@ -90,10 +90,10 @@ expression: artifact "unconstrained func 0", "[Const { destination: Direct(2), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(1), bit_size: Integer(U32), value: 32848 }, Const { destination: Direct(0), bit_size: Integer(U32), value: 3 }, Const { destination: Relative(5), bit_size: Integer(U32), value: 12 }, Const { destination: Relative(6), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(32836), size_address: Relative(5), offset_address: Relative(6) }, Cast { destination: Direct(32836), source: Direct(32836), bit_size: Integer(U32) }, Cast { destination: Direct(32837), source: Direct(32837), bit_size: Integer(U32) }, Cast { destination: Direct(32838), source: Direct(32838), bit_size: Integer(U32) }, Cast { destination: Direct(32839), source: Direct(32839), bit_size: Integer(U32) }, Cast { destination: Direct(32840), source: Direct(32840), bit_size: Integer(U32) }, Cast { destination: Direct(32841), source: Direct(32841), bit_size: Integer(U32) }, Cast { destination: Direct(32842), source: Direct(32842), bit_size: Integer(U32) }, Cast { destination: Direct(32843), source: Direct(32843), bit_size: Integer(U32) }, Cast { destination: Direct(32844), source: Direct(32844), bit_size: Integer(U32) }, Cast { destination: Direct(32845), source: Direct(32845), bit_size: Integer(U32) }, Cast { destination: Direct(32846), source: Direct(32846), bit_size: Integer(U32) }, Cast { destination: Direct(32847), source: Direct(32847), bit_size: Integer(U32) }, Const { destination: Relative(1), bit_size: Integer(U32), value: 32836 }, Const { destination: Relative(6), bit_size: Integer(U32), value: 5 }, Mov { destination: Relative(5), source: Direct(1) }, Const { destination: Relative(7), bit_size: Integer(U32), value: 6 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(7) }, IndirectConst { destination_pointer: Relative(5), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(7), op: Add, bit_size: U32, lhs: Relative(5), rhs: Direct(2) }, Mov { destination: Direct(32771), source: Relative(1) }, Mov { destination: Direct(32772), source: Relative(7) }, Mov { destination: Direct(32773), source: Relative(6) }, Call { location: 49 }, Mov { destination: Relative(1), source: Relative(5) }, Const { destination: Relative(2), bit_size: Integer(U32), value: 32841 }, Const { destination: Relative(6), bit_size: Integer(U32), value: 5 }, Mov { destination: Relative(5), source: Direct(1) }, Const { destination: Relative(7), bit_size: Integer(U32), value: 6 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(7) }, IndirectConst { destination_pointer: Relative(5), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(7), op: Add, bit_size: U32, lhs: Relative(5), rhs: Direct(2) }, Mov { destination: Direct(32771), source: Relative(2) }, Mov { destination: Direct(32772), source: Relative(7) }, Mov { destination: Direct(32773), source: Relative(6) }, Call { location: 49 }, Mov { destination: Relative(2), source: Relative(5) }, Mov { destination: Relative(3), source: Direct(32846) }, Mov { destination: Relative(4), source: Direct(32847) }, Call { location: 60 }, Call { location: 61 }, Const { destination: Relative(1), bit_size: Integer(U32), value: 32848 }, Const { destination: Relative(2), bit_size: Integer(U32), value: 0 }, Stop { return_data: HeapVector { pointer: Relative(1), size: Relative(2) } }, BinaryIntOp { destination: Direct(32775), op: Add, bit_size: U32, lhs: Direct(32771), rhs: Direct(32773) }, Mov { destination: Direct(32776), source: Direct(32771) }, Mov { destination: Direct(32777), source: Direct(32772) }, BinaryIntOp { destination: Direct(32778), op: Equals, bit_size: U32, lhs: Direct(32776), rhs: Direct(32775) }, JumpIf { condition: Direct(32778), location: 59 }, Load { destination: Direct(32774), source_pointer: Direct(32776) }, Store { destination_pointer: Direct(32777), source: Direct(32774) }, BinaryIntOp { destination: Direct(32776), op: Add, bit_size: U32, lhs: Direct(32776), rhs: Direct(2) }, BinaryIntOp { destination: Direct(32777), op: Add, bit_size: U32, lhs: Direct(32777), rhs: Direct(2) }, Jump { location: 52 }, Return, Return, Call { location: 338 }, Mov { destination: Relative(6), source: Direct(1) }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Direct(2) }, Const { destination: Relative(7), bit_size: Integer(U32), value: 5 }, BinaryIntOp { destination: Relative(9), op: Add, bit_size: U32, lhs: Relative(2), rhs: Relative(7) }, Load { destination: Relative(8), source_pointer: Relative(9) }, Store { destination_pointer: Relative(6), source: Relative(8) }, Const { destination: Relative(9), bit_size: Integer(U32), value: 0 }, Const { destination: Relative(10), bit_size: Integer(U32), value: 1 }, Mov { destination: Relative(5), source: Relative(9) }, Jump { location: 72 }, BinaryIntOp { destination: Relative(3), op: LessThan, bit_size: U32, lhs: Relative(5), rhs: Relative(7) }, JumpIf { condition: Relative(3), location: 310 }, Jump { location: 75 }, Load { destination: Relative(5), source_pointer: Relative(6) }, BinaryIntOp { destination: Relative(11), op: Equals, bit_size: U32, lhs: Relative(5), rhs: Relative(9) }, JumpIf { condition: Relative(11), location: 80 }, Const { destination: Relative(12), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(12) } }, Const { destination: Relative(5), bit_size: Integer(U32), value: 2 }, BinaryIntOp { destination: Relative(11), op: Add, bit_size: U32, lhs: Relative(4), rhs: Relative(5) }, BinaryIntOp { destination: Relative(12), op: LessThanEquals, bit_size: U32, lhs: Relative(4), rhs: Relative(11) }, JumpIf { condition: Relative(12), location: 85 }, Call { location: 344 }, Const { destination: Relative(4), bit_size: Field, value: 340282366920938463463374607431768211456 }, Mov { destination: Relative(3), source: Relative(9) }, Jump { location: 88 }, BinaryIntOp { destination: Relative(11), op: LessThan, bit_size: U32, lhs: Relative(3), rhs: Relative(7) }, JumpIf { condition: Relative(11), location: 274 }, Jump { location: 91 }, Load { destination: Relative(11), source_pointer: Relative(6) }, Const { destination: Relative(12), bit_size: Integer(U32), value: 3814912846 }, BinaryIntOp { destination: Relative(13), op: Equals, bit_size: U32, lhs: Relative(11), rhs: Relative(12) }, JumpIf { condition: Relative(13), location: 97 }, Const { destination: Relative(14), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(14) } }, Store { destination_pointer: Relative(6), source: Relative(8) }, Const { destination: Relative(11), bit_size: Field, value: 2 }, Const { destination: Relative(12), bit_size: Integer(U32), value: 3 }, Mov { destination: Relative(3), source: Relative(9) }, Jump { location: 102 }, BinaryIntOp { destination: Relative(13), op: LessThan, bit_size: U32, lhs: Relative(3), rhs: Relative(7) }, JumpIf { condition: Relative(13), location: 231 }, Jump { location: 105 }, Load { destination: Relative(4), source_pointer: Relative(6) }, Const { destination: Relative(11), bit_size: Integer(U32), value: 41472 }, BinaryIntOp { destination: Relative(13), op: Equals, bit_size: U32, lhs: Relative(4), rhs: Relative(11) }, JumpIf { condition: Relative(13), location: 111 }, Const { destination: Relative(14), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(14) } }, Store { destination_pointer: Relative(6), source: Relative(8) }, Const { destination: Relative(4), bit_size: Integer(U1), value: 1 }, Mov { destination: Relative(3), source: Relative(9) }, Jump { location: 115 }, BinaryIntOp { destination: Relative(8), op: LessThan, bit_size: U32, lhs: Relative(3), rhs: Relative(12) }, JumpIf { condition: Relative(8), location: 177 }, Jump { location: 118 }, Load { destination: Relative(4), source_pointer: Relative(6) }, Const { destination: Relative(5), bit_size: Integer(U32), value: 11539 }, BinaryIntOp { destination: Relative(6), op: Equals, bit_size: U32, lhs: Relative(4), rhs: Relative(5) }, JumpIf { condition: Relative(6), location: 124 }, Const { destination: Relative(8), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(8) } }, Load { destination: Relative(4), source_pointer: Relative(1) }, Const { destination: Relative(5), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(6), op: Equals, bit_size: U32, lhs: Relative(5), rhs: Relative(4) }, Not { destination: Relative(6), source: Relative(6), bit_size: U1 }, JumpIf { condition: Relative(6), location: 130 }, Call { location: 347 }, BinaryIntOp { destination: Relative(4), op: Add, bit_size: U32, lhs: Relative(4), rhs: Direct(2) }, Store { destination_pointer: Relative(1), source: Relative(4) }, Load { destination: Relative(4), source_pointer: Relative(2) }, Const { destination: Relative(6), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(8), op: Equals, bit_size: U32, lhs: Relative(6), rhs: Relative(4) }, Not { destination: Relative(8), source: Relative(8), bit_size: U1 }, JumpIf { condition: Relative(8), location: 138 }, Call { location: 347 }, BinaryIntOp { destination: Relative(4), op: Add, bit_size: U32, lhs: Relative(4), rhs: Direct(2) }, Store { destination_pointer: Relative(2), source: Relative(4) }, Const { destination: Relative(4), bit_size: Integer(U1), value: 0 }, Mov { destination: Relative(3), source: Relative(9) }, Jump { location: 143 }, BinaryIntOp { destination: Relative(5), op: LessThan, bit_size: U32, lhs: Relative(3), rhs: Relative(7) }, JumpIf { condition: Relative(5), location: 147 }, Jump { location: 146 }, Return, BinaryIntOp { destination: Relative(8), op: Add, bit_size: U32, lhs: Relative(2), rhs: Direct(2) }, BinaryIntOp { destination: Relative(11), op: Add, bit_size: U32, lhs: Relative(8), rhs: Relative(3) }, Load { destination: Relative(6), source_pointer: Relative(11) }, Load { destination: Relative(8), source_pointer: Relative(1) }, Const { destination: Relative(11), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(12), op: Equals, bit_size: U32, lhs: Relative(11), rhs: Relative(8) }, Not { destination: Relative(12), source: Relative(12), bit_size: U1 }, JumpIf { condition: Relative(12), location: 156 }, Call { location: 347 }, BinaryIntOp { destination: Relative(8), op: Add, bit_size: U32, lhs: Relative(8), rhs: Direct(2) }, Store { destination_pointer: Relative(1), source: Relative(8) }, Mov { destination: Relative(5), source: Relative(9) }, Jump { location: 160 }, BinaryIntOp { destination: Relative(8), op: LessThan, bit_size: U32, lhs: Relative(5), rhs: Relative(7) }, JumpIf { condition: Relative(8), location: 166 }, Jump { location: 163 }, BinaryIntOp { destination: Relative(5), op: Add, bit_size: U32, lhs: Relative(3), rhs: Relative(10) }, Mov { destination: Relative(3), source: Relative(5) }, Jump { location: 143 }, BinaryIntOp { destination: Relative(11), op: Add, bit_size: U32, lhs: Relative(1), rhs: Direct(2) }, BinaryIntOp { destination: Relative(12), op: Add, bit_size: U32, lhs: Relative(11), rhs: Relative(5) }, Load { destination: Relative(8), source_pointer: Relative(12) }, BinaryIntOp { destination: Relative(11), op: Equals, bit_size: U32, lhs: Relative(8), rhs: Relative(6) }, BinaryIntOp { destination: Relative(8), op: Equals, bit_size: U1, lhs: Relative(11), rhs: Relative(4) }, JumpIf { condition: Relative(8), location: 174 }, Const { destination: Relative(12), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(12) } }, BinaryIntOp { destination: Relative(8), op: Add, bit_size: U32, lhs: Relative(5), rhs: Relative(10) }, Mov { destination: Relative(5), source: Relative(8) }, Jump { location: 160 }, Load { destination: Relative(11), source_pointer: Relative(6) }, BinaryIntOp { destination: Relative(14), op: Add, bit_size: U32, lhs: Relative(1), rhs: Direct(2) }, BinaryIntOp { destination: Relative(15), op: Add, bit_size: U32, lhs: Relative(14), rhs: Relative(3) }, Load { destination: Relative(13), source_pointer: Relative(15) }, BinaryIntOp { destination: Relative(15), op: Add, bit_size: U32, lhs: Relative(2), rhs: Direct(2) }, BinaryIntOp { destination: Relative(16), op: Add, bit_size: U32, lhs: Relative(15), rhs: Relative(3) }, Load { destination: Relative(14), source_pointer: Relative(16) }, BinaryIntOp { destination: Relative(15), op: Mul, bit_size: U32, lhs: Relative(13), rhs: Relative(14) }, Const { destination: Relative(17), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(16), op: Equals, bit_size: U32, lhs: Relative(17), rhs: Relative(14) }, JumpIf { condition: Relative(16), location: 192 }, BinaryIntOp { destination: Relative(19), op: Div, bit_size: U32, lhs: Relative(15), rhs: Relative(14) }, BinaryIntOp { destination: Relative(18), op: Equals, bit_size: U32, lhs: Relative(19), rhs: Relative(13) }, JumpIf { condition: Relative(18), location: 192 }, Call { location: 350 }, BinaryIntOp { destination: Relative(13), op: Add, bit_size: U32, lhs: Relative(11), rhs: Relative(15) }, BinaryIntOp { destination: Relative(14), op: LessThanEquals, bit_size: U32, lhs: Relative(11), rhs: Relative(13) }, JumpIf { condition: Relative(14), location: 196 }, Call { location: 344 }, Store { destination_pointer: Relative(6), source: Relative(13) }, Mov { destination: Relative(8), source: Relative(9) }, Jump { location: 199 }, BinaryIntOp { destination: Relative(11), op: LessThan, bit_size: U32, lhs: Relative(8), rhs: Relative(5) }, JumpIf { condition: Relative(11), location: 205 }, Jump { location: 202 }, BinaryIntOp { destination: Relative(8), op: Add, bit_size: U32, lhs: Relative(3), rhs: Relative(10) }, Mov { destination: Relative(3), source: Relative(8) }, Jump { location: 115 }, Load { destination: Relative(11), source_pointer: Relative(6) }, BinaryIntOp { destination: Relative(13), op: Add, bit_size: U32, lhs: Relative(3), rhs: Relative(8) }, BinaryIntOp { destination: Relative(14), op: LessThanEquals, bit_size: U32, lhs: Relative(3), rhs: Relative(13) }, JumpIf { condition: Relative(14), location: 210 }, Call { location: 344 }, BinaryIntOp { destination: Relative(14), op: LessThan, bit_size: U32, lhs: Relative(13), rhs: Relative(7) }, JumpIf { condition: Relative(14), location: 213 }, Call { location: 353 }, BinaryIntOp { destination: Relative(15), op: Add, bit_size: U32, lhs: Relative(1), rhs: Direct(2) }, BinaryIntOp { destination: Relative(16), op: Add, bit_size: U32, lhs: Relative(15), rhs: Relative(13) }, Load { destination: Relative(14), source_pointer: Relative(16) }, BinaryIntOp { destination: Relative(16), op: Add, bit_size: U32, lhs: Relative(2), rhs: Direct(2) }, BinaryIntOp { destination: Relative(17), op: Add, bit_size: U32, lhs: Relative(16), rhs: Relative(13) }, Load { destination: Relative(15), source_pointer: Relative(17) }, BinaryIntOp { destination: Relative(13), op: Sub, bit_size: U32, lhs: Relative(14), rhs: Relative(15) }, BinaryIntOp { destination: Relative(16), op: LessThanEquals, bit_size: U32, lhs: Relative(15), rhs: Relative(14) }, JumpIf { condition: Relative(16), location: 223 }, Call { location: 356 }, BinaryIntOp { destination: Relative(14), op: Add, bit_size: U32, lhs: Relative(11), rhs: Relative(13) }, BinaryIntOp { destination: Relative(15), op: LessThanEquals, bit_size: U32, lhs: Relative(11), rhs: Relative(14) }, JumpIf { condition: Relative(15), location: 227 }, Call { location: 344 }, Store { destination_pointer: Relative(6), source: Relative(14) }, BinaryIntOp { destination: Relative(11), op: Add, bit_size: U32, lhs: Relative(8), rhs: Relative(10) }, Mov { destination: Relative(8), source: Relative(11) }, Jump { location: 199 }, Load { destination: Relative(14), source_pointer: Relative(6) }, BinaryIntOp { destination: Relative(16), op: Add, bit_size: U32, lhs: Relative(1), rhs: Direct(2) }, BinaryIntOp { destination: Relative(17), op: Add, bit_size: U32, lhs: Relative(16), rhs: Relative(3) }, Load { destination: Relative(15), source_pointer: Relative(17) }, BinaryIntOp { destination: Relative(17), op: Add, bit_size: U32, lhs: Relative(2), rhs: Direct(2) }, BinaryIntOp { destination: Relative(18), op: Add, bit_size: U32, lhs: Relative(17), rhs: Relative(3) }, Load { destination: Relative(16), source_pointer: Relative(18) }, BinaryIntOp { destination: Relative(17), op: Mul, bit_size: U32, lhs: Relative(15), rhs: Relative(16) }, Const { destination: Relative(19), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(18), op: Equals, bit_size: U32, lhs: Relative(19), rhs: Relative(16) }, JumpIf { condition: Relative(18), location: 246 }, BinaryIntOp { destination: Relative(21), op: Div, bit_size: U32, lhs: Relative(17), rhs: Relative(16) }, BinaryIntOp { destination: Relative(20), op: Equals, bit_size: U32, lhs: Relative(21), rhs: Relative(15) }, JumpIf { condition: Relative(20), location: 246 }, Call { location: 350 }, BinaryIntOp { destination: Relative(15), op: Add, bit_size: U32, lhs: Relative(14), rhs: Relative(17) }, BinaryIntOp { destination: Relative(16), op: LessThanEquals, bit_size: U32, lhs: Relative(14), rhs: Relative(15) }, JumpIf { condition: Relative(16), location: 250 }, Call { location: 344 }, Store { destination_pointer: Relative(6), source: Relative(15) }, Cast { destination: Relative(14), source: Relative(3), bit_size: Field }, BinaryFieldOp { destination: Relative(15), op: Add, lhs: Relative(14), rhs: Relative(4) }, BinaryFieldOp { destination: Relative(14), op: Sub, lhs: Relative(15), rhs: Relative(11) }, Cast { destination: Relative(16), source: Relative(14), bit_size: Integer(U32) }, Cast { destination: Relative(15), source: Relative(16), bit_size: Field }, Mov { destination: Relative(13), source: Relative(9) }, Jump { location: 258 }, BinaryIntOp { destination: Relative(14), op: LessThan, bit_size: U32, lhs: Relative(13), rhs: Relative(12) }, JumpIf { condition: Relative(14), location: 264 }, Jump { location: 261 }, BinaryIntOp { destination: Relative(13), op: Add, bit_size: U32, lhs: Relative(3), rhs: Relative(10) }, Mov { destination: Relative(3), source: Relative(13) }, Jump { location: 102 }, Load { destination: Relative(14), source_pointer: Relative(6) }, Cast { destination: Relative(16), source: Relative(14), bit_size: Field }, BinaryFieldOp { destination: Relative(14), op: Mul, lhs: Relative(16), rhs: Relative(15) }, Cast { destination: Relative(17), source: Relative(14), bit_size: Integer(U32) }, Cast { destination: Relative(16), source: Relative(17), bit_size: Field }, Cast { destination: Relative(14), source: Relative(16), bit_size: Integer(U32) }, Store { destination_pointer: Relative(6), source: Relative(14) }, BinaryIntOp { destination: Relative(14), op: Add, bit_size: U32, lhs: Relative(13), rhs: Relative(10) }, Mov { destination: Relative(13), source: Relative(14) }, Jump { location: 258 }, Load { destination: Relative(11), source_pointer: Relative(6) }, Cast { destination: Relative(12), source: Relative(11), bit_size: Field }, BinaryFieldOp { destination: Relative(11), op: Mul, lhs: Relative(12), rhs: Relative(12) }, Cast { destination: Relative(14), source: Relative(11), bit_size: Integer(U32) }, Cast { destination: Relative(13), source: Relative(14), bit_size: Field }, BinaryIntOp { destination: Relative(14), op: Add, bit_size: U32, lhs: Relative(1), rhs: Direct(2) }, BinaryIntOp { destination: Relative(15), op: Add, bit_size: U32, lhs: Relative(14), rhs: Relative(3) }, Load { destination: Relative(11), source_pointer: Relative(15) }, Cast { destination: Relative(14), source: Relative(11), bit_size: Field }, BinaryFieldOp { destination: Relative(15), op: Mul, lhs: Relative(13), rhs: Relative(14) }, Cast { destination: Relative(14), source: Relative(15), bit_size: Integer(U32) }, Cast { destination: Relative(13), source: Relative(14), bit_size: Field }, BinaryIntOp { destination: Relative(15), op: Add, bit_size: U32, lhs: Relative(2), rhs: Direct(2) }, BinaryIntOp { destination: Relative(16), op: Add, bit_size: U32, lhs: Relative(15), rhs: Relative(3) }, Load { destination: Relative(14), source_pointer: Relative(16) }, BinaryIntOp { destination: Relative(15), op: Mul, bit_size: U32, lhs: Relative(11), rhs: Relative(14) }, Const { destination: Relative(17), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(16), op: Equals, bit_size: U32, lhs: Relative(17), rhs: Relative(14) }, JumpIf { condition: Relative(16), location: 297 }, BinaryIntOp { destination: Relative(19), op: Div, bit_size: U32, lhs: Relative(15), rhs: Relative(14) }, BinaryIntOp { destination: Relative(18), op: Equals, bit_size: U32, lhs: Relative(19), rhs: Relative(11) }, JumpIf { condition: Relative(18), location: 297 }, Call { location: 350 }, Cast { destination: Relative(11), source: Relative(15), bit_size: Field }, BinaryFieldOp { destination: Relative(14), op: Add, lhs: Relative(11), rhs: Relative(4) }, BinaryFieldOp { destination: Relative(11), op: Sub, lhs: Relative(14), rhs: Relative(13) }, Cast { destination: Relative(14), source: Relative(11), bit_size: Integer(U32) }, Cast { destination: Relative(13), source: Relative(14), bit_size: Field }, BinaryFieldOp { destination: Relative(11), op: Add, lhs: Relative(12), rhs: Relative(13) }, Cast { destination: Relative(13), source: Relative(11), bit_size: Integer(U32) }, Cast { destination: Relative(12), source: Relative(13), bit_size: Field }, Cast { destination: Relative(11), source: Relative(12), bit_size: Integer(U32) }, Store { destination_pointer: Relative(6), source: Relative(11) }, BinaryIntOp { destination: Relative(11), op: Add, bit_size: U32, lhs: Relative(3), rhs: Relative(10) }, Mov { destination: Relative(3), source: Relative(11) }, Jump { location: 88 }, Load { destination: Relative(3), source_pointer: Relative(6) }, BinaryIntOp { destination: Relative(11), op: Mul, bit_size: U32, lhs: Relative(3), rhs: Relative(3) }, Const { destination: Relative(13), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(12), op: Equals, bit_size: U32, lhs: Relative(13), rhs: Relative(3) }, JumpIf { condition: Relative(12), location: 319 }, BinaryIntOp { destination: Relative(15), op: Div, bit_size: U32, lhs: Relative(11), rhs: Relative(3) }, BinaryIntOp { destination: Relative(14), op: Equals, bit_size: U32, lhs: Relative(15), rhs: Relative(3) }, JumpIf { condition: Relative(14), location: 319 }, Call { location: 350 }, BinaryIntOp { destination: Relative(13), op: Add, bit_size: U32, lhs: Relative(2), rhs: Direct(2) }, BinaryIntOp { destination: Relative(14), op: Add, bit_size: U32, lhs: Relative(13), rhs: Relative(5) }, Load { destination: Relative(12), source_pointer: Relative(14) }, BinaryIntOp { destination: Relative(13), op: Mul, bit_size: U32, lhs: Relative(11), rhs: Relative(12) }, Const { destination: Relative(15), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(14), op: Equals, bit_size: U32, lhs: Relative(15), rhs: Relative(12) }, JumpIf { condition: Relative(14), location: 330 }, BinaryIntOp { destination: Relative(17), op: Div, bit_size: U32, lhs: Relative(13), rhs: Relative(12) }, BinaryIntOp { destination: Relative(16), op: Equals, bit_size: U32, lhs: Relative(17), rhs: Relative(11) }, JumpIf { condition: Relative(16), location: 330 }, Call { location: 350 }, BinaryIntOp { destination: Relative(11), op: Sub, bit_size: U32, lhs: Relative(3), rhs: Relative(13) }, BinaryIntOp { destination: Relative(12), op: LessThanEquals, bit_size: U32, lhs: Relative(13), rhs: Relative(3) }, JumpIf { condition: Relative(12), location: 334 }, Call { location: 356 }, Store { destination_pointer: Relative(6), source: Relative(11) }, BinaryIntOp { destination: Relative(3), op: Add, bit_size: U32, lhs: Relative(5), rhs: Relative(10) }, Mov { destination: Relative(5), source: Relative(3) }, Jump { location: 72 }, 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: 343 }, IndirectConst { destination_pointer: Direct(1), bit_size: Integer(U64), value: 17843811134343075018 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return, IndirectConst { destination_pointer: Direct(1), bit_size: Integer(U64), value: 5019202896831570965 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return, IndirectConst { destination_pointer: Direct(1), bit_size: Integer(U64), value: 12049594436772143978 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return, IndirectConst { destination_pointer: Direct(1), bit_size: Integer(U64), value: 7233212735005103307 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return, IndirectConst { destination_pointer: Direct(1), bit_size: Integer(U64), value: 14225679739041873922 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return, IndirectConst { destination_pointer: Direct(1), bit_size: Integer(U64), value: 2920182694213909827 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return]" ], - "debug_symbols": "tZnRThs9EIXfJde5sD322OZVqgoFCFWkKKAUfukX4t07Z71nkyJtGrxw0/lCPMeznrE93bytHrZ3r79ud4fHp9+rmx9vq7vjbr/f/brdP91vXnZPB/vr28rhH42rG79eaWpGm8mDyWF1E8zYd2LGvotmcjOlmTqYYlrJjG8mNCPNxGbMQderakOyGRtSzEgzsZnUjDZjE9X1yjsb6h0AMXoAogyATCiEOoJ3BJvQCwDuEYDBCYDBFpMPjuAJgSAELFQGJIISMqEQ6gjiCJ4A5QIQQiQkghIyoRDqCJHukWMix0SOSZgda5g8IRCEEAmJoIQ8glJHzSsgF8oxOo0phDqOyY7gCYFAnRwJecwOCisgyyitAVBcDaCDnKLAGggBOshySQQlZEIh1BGqI3gClBEGKrNBJCSCEqBjhRSGEh0g8S8Yo4BMKIQ6Akq0gScEAmbPgEhIBCgXQCYUApQtBQH13MATAkHGUId6HiARlJAJ404JQ/U6gOnIAEKIBBwTHqCETDAdCYA6QnQETwgEIURCIkBZAJlQCHUE1HwDKGPFUPOC9UHNCxYBNR8RM2q+AY4zhKq+HTIBB6NEAMYMgAMQq4Gaj1BGzTeoI6DmB/dMndyOv4BTNA1/MJmEp0HJJwij5BuYTMLg4TwdwBNwpiJ2lLwiZJS8Qgcl38CUFY+Okm9QCKasmAIl38ATAkEIkZAISoAy1rJCGfFgE2SLR5wpZw/wBFPOAjDlnACRkAg63AeCfQI7bApYiCggEIQQCYmghEwoBIQHYeyJBp4A5QIQQiQkghIyoRDqCDjj8ZTYJIMNo5XRxtGijN/f1yvewrcvx+0Wl/DZtWyX9fPmuD28rG4Or/v9evXfZv86DPr9vDkM9mVztG9tybeHB7Mm+Ljbb0Hv65O3m3e1Q3t0tqN5ck9X+wcno39wsccfO635x9zjr0r/HDr8JdNfSunxVy6+aM/6RWz/wT+qdvgnz/iT9MyfCuNPpSd/6hi/Ounwz4H1l2NP/Dmz/nLpmb+4MvoX31M/Rbh+pWv9S2X+anAd/jVW+qfa41+Zv1p79p912dzAhj0raF35dARZP96lEN2kkHp2UYkMoaSuLOLKHv3Lwvn7/MMy/+kUKKXn+et0C1RXuvz95N9VxT4s20Wn+bv8NUynYNAuf+5iFVk2f5+/L8v8p1tU62z+0EHPHuM67aCs+SQh9W+JdOkkCqdexp13Ax9F9MJ1HqadaI3faSvY3dAXh/Wjyx9GwrzItYtaZiUu5TVNeU2ztwP+azO/MR1PFtujaS4EHF/zSxGTTEsRz863jyKyOK+fiCO7zocRPRPxsyLLi/RS1zl1bdHPnlexLM9r/YK8Jrc8r/Ur8lq/IK9JvjWvwieJ0tPNndWFzPZySRfXRcoXl1LP8qHzdVEWL+U/4riuLv4hcl1dqP/WusD7lZbX3NNfRS0L/fkAsc72F5oW9weqX9AfaF6ciuvjuNAffEJkvj+4elHn+4N8qe+cXt9Y4zuvcPFGdPm0Q9xZeXxOJNUzkTgrEr9zmwXPIOyVes/LrOllSOh6mXA2/wf/n/Zpc787/vWr3zuUjrvN3X47fnx8Pdyfffvy/zO/4a+Gz8en++3D63ELpdNPh/Z684fdj6n+xA9v9kHsLbtEwUePj3ZpSCo/3xHKHw==", + "debug_symbols": "tZnRThs9EIXfJde5sD322OZVqgoFCFWkKKAUfukX4t07Z71nkyJtGrxw0/lCPMeznrE93bytHrZ3r79ud4fHp9+rmx9vq7vjbr/f/brdP91vXnZPB/vr28rhH42rG79eaWpGm8mDyWF1E8zYd2LGvotmcjOlmTqYYlrJjG8mNCPNxGbMQderakOyGRtSzEgzsZnUjDZjE9X1yjsb6h0AMXoAogyATCiEOoJ3BJvQCwDuEYDBCYDBFpMPjuAJgSAELFQGJIISMqEQ6gjiCJ4A5QIQQiQkghIyoRDqCJHukWMix0SOSZgda5g8IRCEEAmJoIQ8glJHzSsgF8oxOo0phDqOyY7gCYFAnRwJecwOCisgyyitAVBcDaCDnKLAGggBOshySQQlZEIh1BGqI3gClBEGKrNBJCSCEqBjhRSGEh0g8S8Yo4BMKIQ6Akq0gScEAmbPgEhIBCgXQCYUApQtBQH13MATAkHGUId6HiARlJAJ404JQ/U6gOnIAEKIBBwTHqCETDAdCYA6QnQETwgEIURCIkBZAJlQCHUE1HwDKGPFUPOC9UHNCxYBNR8RM2q+AY4zhKq+HTIBB6NEAMYMgAMQq4Gaj1BGzTeoI6DmB/dMndyOv4BTNA1/MJmEp0HJJwij5BuYTMLg4TwdwBNwpiJ2lLwiZJS8Qgcl38CUFY+Okm9QCKasmAIl38ATAkEIkZAISoAy1rJCGfFgE2SLR5wpZw/wBFPOAjDlnACRkAg63AeCfQI7bApYiCggEIQQCYmghEwoBIQHYeyJBp4A5QIQQiQkghIyoRDqCDjj8ZTYJIMNo5XRxtGijN/f1yvewrcvx+0Wl/DZtWyX9fPmuD28rG4Or/v9evXfZv86DPr9vDkM9mVztG9tybeHB7Mm+Ljbb0Hv65O3m3e1Q3t0tqN5ck9X+wcno39wsccfO635x9zjr0r/HDr8JdNfSunxVy6+aM/6RWz/wT+qdvgnz/iT9MyfCuNPpSd/6hi/Ounwz4H1l2NP/Dmz/nLpmb+4MvoX31M/Rbh+pWv9S2X+anAd/jVW+qfa41+Zv1p79p912dzAhj0raF35dARZP96lEN2kkHp2UYkMoaSuLOLKHv3Lwvn7/MMy/+kUKKXn+et0C1RXuvz95N9VxT4s20Wn+bv8NUynYNAuf+5iFVk2f5+/L8v8p1tU62z+0EHPHuM67aCs+SQh9W+JdOkkCqdexp13Ax9F9MJ1bk0x73PrfScJuxv64rB+dPnDSJgXuXZRy6zEpbymKa9p9nbAf23mN6bjetoeTXMh4PiaX4qYZFqKeHa+fRSRxXn9RBzZdT6M6JmInxVZXqSXus6pa4t+9ryKZXle6xfkNbnlea1fkdf6BXlN8q15FT5JlJ5u7qwuZLaXS7q4LlK+uJR6lg+dr4uyeCn/Ecd1dfEPkevqQv231gXer7S85p7+KmpZ6M/LLNbZ/kLT4v5A9Qv6A82LU3F9HBf6g0+IzPcHVy/qfH+QL/Wd0+sba3znFS7eiC6fdog7K4/PiaR6JhJnReJ3brPgGYS9Uu95mTW9DAldLxPO5v/g/9M+be53x79+9XuH0nG3udtvx4+Pr4f7s29f/n/mN/zV8Pn4dL99eD1uoXT66dBeb/6w+zHVn/jhzT6IvWWXKPjo8dEuDUnl5ztC+QM=", "file_map": { "12": { - "source": "// docs:start:from-trait\npub trait From {\n fn from(input: T) -> Self;\n}\n// docs:end:from-trait\n\nimpl From for T {\n fn from(input: T) -> T {\n input\n }\n}\n\n// docs:start:into-trait\npub trait Into {\n fn into(self) -> T;\n}\n\nimpl Into for U\nwhere\n T: From,\n{\n fn into(self) -> T {\n T::from(self)\n }\n}\n// docs:end:into-trait\n\n// docs:start:from-impls\n// Unsigned integers\n\nimpl From for u32 {\n fn from(value: u8) -> u32 {\n value as u32\n }\n}\n\nimpl From for u64 {\n fn from(value: u8) -> u64 {\n value as u64\n }\n}\nimpl From for u64 {\n fn from(value: u32) -> u64 {\n value as u64\n }\n}\n\nimpl From for u128 {\n fn from(value: u8) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u32) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u64) -> u128 {\n value as u128\n }\n}\n\nimpl From for Field {\n fn from(value: u8) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u32) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u64) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u128) -> Field {\n value as Field\n }\n}\n\n// Signed integers\n\nimpl From for i32 {\n fn from(value: i8) -> i32 {\n value as i32\n }\n}\n\nimpl From for i64 {\n fn from(value: i8) -> i64 {\n value as i64\n }\n}\nimpl From for i64 {\n fn from(value: i32) -> i64 {\n value as i64\n }\n}\n\n// Booleans\nimpl From for u8 {\n fn from(value: bool) -> u8 {\n value as u8\n }\n}\nimpl From for u32 {\n fn from(value: bool) -> u32 {\n value as u32\n }\n}\nimpl From for u64 {\n fn from(value: bool) -> u64 {\n value as u64\n }\n}\nimpl From for i8 {\n fn from(value: bool) -> i8 {\n value as i8\n }\n}\nimpl From for i32 {\n fn from(value: bool) -> i32 {\n value as i32\n }\n}\nimpl From for i64 {\n fn from(value: bool) -> i64 {\n value as i64\n }\n}\nimpl From for Field {\n fn from(value: bool) -> Field {\n value as Field\n }\n}\n// docs:end:from-impls\n\n/// A generic interface for casting between primitive types,\n/// equivalent of using the `as` keyword between values.\n///\n/// # Example\n///\n/// ```\n/// let x: Field = 1234567890;\n/// let y: u8 = x as u8;\n/// let z: u8 = x.as_();\n/// assert_eq(y, z);\n/// ```\npub trait AsPrimitive {\n /// The equivalent of doing `self as T`.\n fn as_(self) -> T;\n}\n\n#[generate_as_primitive_impls]\ncomptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted {\n let types = [\n quote { bool },\n quote { u8 },\n quote { u16 },\n quote { u32 },\n quote { u64 },\n quote { u128 },\n quote { i8 },\n quote { i16 },\n quote { i32 },\n quote { i64 },\n quote { Field },\n ];\n\n let mut impls = &[];\n for type1 in types {\n for type2 in types {\n let trait_impl = quote {\n impl AsPrimitive<$type1> for $type2 {\n fn as_(self) -> $type1 {\n self as $type1\n }\n }\n };\n\n impls = impls.push_back(trait_impl);\n }\n }\n impls.join(quote {})\n}\n", + "source": "// docs:start:from-trait\npub trait From {\n fn from(input: T) -> Self;\n}\n// docs:end:from-trait\n\nimpl From for T {\n fn from(input: T) -> T {\n input\n }\n}\n\n// docs:start:into-trait\npub trait Into {\n fn into(self) -> T;\n}\n\nimpl Into for U\nwhere\n T: From,\n{\n fn into(self) -> T {\n T::from(self)\n }\n}\n// docs:end:into-trait\n\n// docs:start:from-impls\n// Unsigned integers\n\nimpl From for u32 {\n fn from(value: u8) -> u32 {\n value as u32\n }\n}\n\nimpl From for u64 {\n fn from(value: u8) -> u64 {\n value as u64\n }\n}\nimpl From for u64 {\n fn from(value: u32) -> u64 {\n value as u64\n }\n}\n\nimpl From for u128 {\n fn from(value: u8) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u32) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u64) -> u128 {\n value as u128\n }\n}\n\nimpl From for Field {\n fn from(value: u8) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u32) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u64) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u128) -> Field {\n value as Field\n }\n}\n\n// Signed integers\n\nimpl From for i32 {\n fn from(value: i8) -> i32 {\n value as i32\n }\n}\n\nimpl From for i64 {\n fn from(value: i8) -> i64 {\n value as i64\n }\n}\nimpl From for i64 {\n fn from(value: i32) -> i64 {\n value as i64\n }\n}\n\n// Booleans\nimpl From for u8 {\n fn from(value: bool) -> u8 {\n value as u8\n }\n}\nimpl From for u32 {\n fn from(value: bool) -> u32 {\n value as u32\n }\n}\nimpl From for u64 {\n fn from(value: bool) -> u64 {\n value as u64\n }\n}\nimpl From for i8 {\n fn from(value: bool) -> i8 {\n value as i8\n }\n}\nimpl From for i32 {\n fn from(value: bool) -> i32 {\n value as i32\n }\n}\nimpl From for i64 {\n fn from(value: bool) -> i64 {\n value as i64\n }\n}\nimpl From for Field {\n fn from(value: bool) -> Field {\n value as Field\n }\n}\n// docs:end:from-impls\n\n/// A generic interface for casting between primitive types,\n/// equivalent of using the `as` keyword between values.\n///\n/// # Example\n///\n/// ```\n/// let x: Field = 1234567890;\n/// let y: u8 = x as u8;\n/// let z: u8 = x.as_();\n/// assert_eq(y, z);\n/// ```\npub trait AsPrimitive {\n /// The equivalent of doing `self as T`.\n fn as_(self) -> T;\n}\n\n#[generate_as_primitive_impls]\ncomptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted {\n let types = [\n quote { bool },\n quote { u8 },\n quote { u16 },\n quote { u32 },\n quote { u64 },\n quote { u128 },\n quote { i8 },\n quote { i16 },\n quote { i32 },\n quote { i64 },\n quote { Field },\n ];\n\n let mut impls = &[];\n for type1 in types {\n for type2 in types {\n let body = if type1 == type2 {\n quote { self }\n } else if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for $type2 {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n }\n impls.join(quote {})\n}\n", "path": "std/convert.nr" }, "39": { diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/assert/execute__tests__expanded.snap b/tooling/nargo_cli/tests/snapshots/execution_success/assert/execute__tests__expanded.snap index 368cc4bb469..d2e2b398db6 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/assert/execute__tests__expanded.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/assert/execute__tests__expanded.snap @@ -4,7 +4,7 @@ expression: expanded_code --- fn main(x: Field) { assert(x == 1); - assert(1 == conditional(x as bool)); + assert(1 == conditional(x != 0)); } fn conditional(x: bool) -> Field { diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/assert/execute__tests__force_brillig_false_inliner_-9223372036854775808.snap b/tooling/nargo_cli/tests/snapshots/execution_success/assert/execute__tests__force_brillig_false_inliner_-9223372036854775808.snap index 06110ba2f27..c7732a1ee33 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/assert/execute__tests__force_brillig_false_inliner_-9223372036854775808.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/assert/execute__tests__force_brillig_false_inliner_-9223372036854775808.snap @@ -39,7 +39,7 @@ expression: artifact "debug_symbols": "dY/RCoMwDEX/Jc99cMgY+CtjSK1RAiEtsR0M8d8XRTf3sKc0uT03uTP02JWxJRniBM19hk6JmcaWY/CZoth0XhwcbZsV0UZw0o1KXlEyNFKYHTw9l+3TlLxsNXs1tXKA0ls1w4EY19fivnT1H60vO1vfPvDV6Id1PpD+3AsVNJdlNVPyHeOeYSgSTpHyKx3KETppDNgXxdVu02zBGw==", "file_map": { "50": { - "source": "fn main(x: Field) {\n assert(x == 1);\n assert(1 == conditional(x as bool));\n}\n\nfn conditional(x: bool) -> Field {\n assert(x, f\"Expected x to be true but got {x}\");\n assert_eq(x, true, f\"Expected x to be true but got {x}\");\n 1\n}\n", + "source": "fn main(x: Field) {\n assert(x == 1);\n assert(1 == conditional(x != 0));\n}\n\nfn conditional(x: bool) -> Field {\n assert(x, f\"Expected x to be true but got {x}\");\n assert_eq(x, true, f\"Expected x to be true but got {x}\");\n 1\n}\n", "path": "" } }, diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/assert/execute__tests__force_brillig_false_inliner_0.snap b/tooling/nargo_cli/tests/snapshots/execution_success/assert/execute__tests__force_brillig_false_inliner_0.snap index 06110ba2f27..c7732a1ee33 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/assert/execute__tests__force_brillig_false_inliner_0.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/assert/execute__tests__force_brillig_false_inliner_0.snap @@ -39,7 +39,7 @@ expression: artifact "debug_symbols": "dY/RCoMwDEX/Jc99cMgY+CtjSK1RAiEtsR0M8d8XRTf3sKc0uT03uTP02JWxJRniBM19hk6JmcaWY/CZoth0XhwcbZsV0UZw0o1KXlEyNFKYHTw9l+3TlLxsNXs1tXKA0ls1w4EY19fivnT1H60vO1vfPvDV6Id1PpD+3AsVNJdlNVPyHeOeYSgSTpHyKx3KETppDNgXxdVu02zBGw==", "file_map": { "50": { - "source": "fn main(x: Field) {\n assert(x == 1);\n assert(1 == conditional(x as bool));\n}\n\nfn conditional(x: bool) -> Field {\n assert(x, f\"Expected x to be true but got {x}\");\n assert_eq(x, true, f\"Expected x to be true but got {x}\");\n 1\n}\n", + "source": "fn main(x: Field) {\n assert(x == 1);\n assert(1 == conditional(x != 0));\n}\n\nfn conditional(x: bool) -> Field {\n assert(x, f\"Expected x to be true but got {x}\");\n assert_eq(x, true, f\"Expected x to be true but got {x}\");\n 1\n}\n", "path": "" } }, diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/assert/execute__tests__force_brillig_false_inliner_9223372036854775807.snap b/tooling/nargo_cli/tests/snapshots/execution_success/assert/execute__tests__force_brillig_false_inliner_9223372036854775807.snap index 06110ba2f27..c7732a1ee33 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/assert/execute__tests__force_brillig_false_inliner_9223372036854775807.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/assert/execute__tests__force_brillig_false_inliner_9223372036854775807.snap @@ -39,7 +39,7 @@ expression: artifact "debug_symbols": "dY/RCoMwDEX/Jc99cMgY+CtjSK1RAiEtsR0M8d8XRTf3sKc0uT03uTP02JWxJRniBM19hk6JmcaWY/CZoth0XhwcbZsV0UZw0o1KXlEyNFKYHTw9l+3TlLxsNXs1tXKA0ls1w4EY19fivnT1H60vO1vfPvDV6Id1PpD+3AsVNJdlNVPyHeOeYSgSTpHyKx3KETppDNgXxdVu02zBGw==", "file_map": { "50": { - "source": "fn main(x: Field) {\n assert(x == 1);\n assert(1 == conditional(x as bool));\n}\n\nfn conditional(x: bool) -> Field {\n assert(x, f\"Expected x to be true but got {x}\");\n assert_eq(x, true, f\"Expected x to be true but got {x}\");\n 1\n}\n", + "source": "fn main(x: Field) {\n assert(x == 1);\n assert(1 == conditional(x != 0));\n}\n\nfn conditional(x: bool) -> Field {\n assert(x, f\"Expected x to be true but got {x}\");\n assert_eq(x, true, f\"Expected x to be true but got {x}\");\n 1\n}\n", "path": "" } }, diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/assert/execute__tests__force_brillig_true_inliner_-9223372036854775808.snap b/tooling/nargo_cli/tests/snapshots/execution_success/assert/execute__tests__force_brillig_true_inliner_-9223372036854775808.snap index eb354b47a71..88e96ec17c1 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/assert/execute__tests__force_brillig_true_inliner_-9223372036854775808.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/assert/execute__tests__force_brillig_true_inliner_-9223372036854775808.snap @@ -45,7 +45,7 @@ expression: artifact "debug_symbols": "dZDLDoMgEEX/ZdYsfNTa+CvGGMTRkBAgCE0aw7938NHaRTdzGS7nkpkVRhzC3Es9mQWadoXBSaXk3CsjuJdG0+0KWSr5DZqcQV7tct+l3uVBEiODE+u9Q0zUJYfSLXeoPTQ6KMXgyVXYHi2W6009d+RmDFCPpBQ4SYXpFNmXzv6jZX6wZf2BK6I76riQ7meumHKc5IPCo52CFhfXv+zpnHuxzggcg8OUdFkO1bbIWFF1Mf32Bg==", "file_map": { "50": { - "source": "fn main(x: Field) {\n assert(x == 1);\n assert(1 == conditional(x as bool));\n}\n\nfn conditional(x: bool) -> Field {\n assert(x, f\"Expected x to be true but got {x}\");\n assert_eq(x, true, f\"Expected x to be true but got {x}\");\n 1\n}\n", + "source": "fn main(x: Field) {\n assert(x == 1);\n assert(1 == conditional(x != 0));\n}\n\nfn conditional(x: bool) -> Field {\n assert(x, f\"Expected x to be true but got {x}\");\n assert_eq(x, true, f\"Expected x to be true but got {x}\");\n 1\n}\n", "path": "" } }, diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/assert/execute__tests__force_brillig_true_inliner_0.snap b/tooling/nargo_cli/tests/snapshots/execution_success/assert/execute__tests__force_brillig_true_inliner_0.snap index eb354b47a71..88e96ec17c1 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/assert/execute__tests__force_brillig_true_inliner_0.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/assert/execute__tests__force_brillig_true_inliner_0.snap @@ -45,7 +45,7 @@ expression: artifact "debug_symbols": "dZDLDoMgEEX/ZdYsfNTa+CvGGMTRkBAgCE0aw7938NHaRTdzGS7nkpkVRhzC3Es9mQWadoXBSaXk3CsjuJdG0+0KWSr5DZqcQV7tct+l3uVBEiODE+u9Q0zUJYfSLXeoPTQ6KMXgyVXYHi2W6009d+RmDFCPpBQ4SYXpFNmXzv6jZX6wZf2BK6I76riQ7meumHKc5IPCo52CFhfXv+zpnHuxzggcg8OUdFkO1bbIWFF1Mf32Bg==", "file_map": { "50": { - "source": "fn main(x: Field) {\n assert(x == 1);\n assert(1 == conditional(x as bool));\n}\n\nfn conditional(x: bool) -> Field {\n assert(x, f\"Expected x to be true but got {x}\");\n assert_eq(x, true, f\"Expected x to be true but got {x}\");\n 1\n}\n", + "source": "fn main(x: Field) {\n assert(x == 1);\n assert(1 == conditional(x != 0));\n}\n\nfn conditional(x: bool) -> Field {\n assert(x, f\"Expected x to be true but got {x}\");\n assert_eq(x, true, f\"Expected x to be true but got {x}\");\n 1\n}\n", "path": "" } }, diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/assert/execute__tests__force_brillig_true_inliner_9223372036854775807.snap b/tooling/nargo_cli/tests/snapshots/execution_success/assert/execute__tests__force_brillig_true_inliner_9223372036854775807.snap index eb354b47a71..88e96ec17c1 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/assert/execute__tests__force_brillig_true_inliner_9223372036854775807.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/assert/execute__tests__force_brillig_true_inliner_9223372036854775807.snap @@ -45,7 +45,7 @@ expression: artifact "debug_symbols": "dZDLDoMgEEX/ZdYsfNTa+CvGGMTRkBAgCE0aw7938NHaRTdzGS7nkpkVRhzC3Es9mQWadoXBSaXk3CsjuJdG0+0KWSr5DZqcQV7tct+l3uVBEiODE+u9Q0zUJYfSLXeoPTQ6KMXgyVXYHi2W6009d+RmDFCPpBQ4SYXpFNmXzv6jZX6wZf2BK6I76riQ7meumHKc5IPCo52CFhfXv+zpnHuxzggcg8OUdFkO1bbIWFF1Mf32Bg==", "file_map": { "50": { - "source": "fn main(x: Field) {\n assert(x == 1);\n assert(1 == conditional(x as bool));\n}\n\nfn conditional(x: bool) -> Field {\n assert(x, f\"Expected x to be true but got {x}\");\n assert_eq(x, true, f\"Expected x to be true but got {x}\");\n 1\n}\n", + "source": "fn main(x: Field) {\n assert(x == 1);\n assert(1 == conditional(x != 0));\n}\n\nfn conditional(x: bool) -> Field {\n assert(x, f\"Expected x to be true but got {x}\");\n assert_eq(x, true, f\"Expected x to be true but got {x}\");\n 1\n}\n", "path": "" } }, diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/brillig_not/execute__tests__expanded.snap b/tooling/nargo_cli/tests/snapshots/execution_success/brillig_not/execute__tests__expanded.snap index 426daef3c56..b8867c3fdb6 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/brillig_not/execute__tests__expanded.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/brillig_not/execute__tests__expanded.snap @@ -5,8 +5,8 @@ expression: expanded_code fn main(x: Field, y: Field) { // Safety: comment added by `nargo expand` unsafe { - assert(false == not_operator(x as bool)); - assert(true == not_operator(y as bool)); + assert(false == not_operator(x != 0)); + assert(true == not_operator(y != 0)); } } diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/brillig_not/execute__tests__force_brillig_false_inliner_-9223372036854775808.snap b/tooling/nargo_cli/tests/snapshots/execution_success/brillig_not/execute__tests__force_brillig_false_inliner_-9223372036854775808.snap index df486b7cc19..a41a50ae47e 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/brillig_not/execute__tests__force_brillig_false_inliner_-9223372036854775808.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/brillig_not/execute__tests__force_brillig_false_inliner_-9223372036854775808.snap @@ -32,47 +32,29 @@ expression: artifact }, "bytecode": [ "func 0", - "current witness index : _15", + "current witness index : _7", "private parameters indices : [_0, _1]", "public parameters indices : []", "return value indices : []", - "BRILLIG CALL func 1: inputs: [Single(Expression { mul_terms: [], linear_combinations: [(1, Witness(0))], q_c: 0 }), Single(Expression { mul_terms: [], linear_combinations: [], q_c: 2 })], outputs: [Simple(Witness(2)), Simple(Witness(3))]", - "BLACKBOX::RANGE [(_2, 253)] []", - "BLACKBOX::RANGE [(_3, 1)] []", - "EXPR [ (1, _0) (-2, _2) (-1, _3) 0 ]", - "EXPR [ (-1, _2) (-1, _4) 10944121435919637611123202872628637544274182200208017171849102093287904247808 ]", - "BLACKBOX::RANGE [(_4, 253)] []", - "BRILLIG CALL func 2: inputs: [Single(Expression { mul_terms: [], linear_combinations: [(-1, Witness(2))], q_c: 10944121435919637611123202872628637544274182200208017171849102093287904247808 })], outputs: [Simple(Witness(5))]", - "EXPR [ (-1, _2, _5) (10944121435919637611123202872628637544274182200208017171849102093287904247808, _5) (1, _6) -1 ]", - "EXPR [ (-1, _2, _6) (10944121435919637611123202872628637544274182200208017171849102093287904247808, _6) 0 ]", - "EXPR [ (1, _3, _6) (1, _6, _6) (-1, _7) 0 ]", - "BLACKBOX::RANGE [(_7, 1)] []", - "BRILLIG CALL func 0: inputs: [Single(Expression { mul_terms: [], linear_combinations: [(1, Witness(3))], q_c: 0 })], outputs: [Simple(Witness(8))]", - "EXPR [ (1, _8) 0 ]", - "BRILLIG CALL func 1: inputs: [Single(Expression { mul_terms: [], linear_combinations: [(1, Witness(1))], q_c: 0 }), Single(Expression { mul_terms: [], linear_combinations: [], q_c: 2 })], outputs: [Simple(Witness(9)), Simple(Witness(10))]", - "BLACKBOX::RANGE [(_9, 253)] []", - "BLACKBOX::RANGE [(_10, 1)] []", - "EXPR [ (1, _1) (-2, _9) (-1, _10) 0 ]", - "EXPR [ (-1, _9) (-1, _11) 10944121435919637611123202872628637544274182200208017171849102093287904247808 ]", - "BLACKBOX::RANGE [(_11, 253)] []", - "BRILLIG CALL func 2: inputs: [Single(Expression { mul_terms: [], linear_combinations: [(-1, Witness(9))], q_c: 10944121435919637611123202872628637544274182200208017171849102093287904247808 })], outputs: [Simple(Witness(12))]", - "EXPR [ (-1, _9, _12) (10944121435919637611123202872628637544274182200208017171849102093287904247808, _12) (1, _13) -1 ]", - "EXPR [ (-1, _9, _13) (10944121435919637611123202872628637544274182200208017171849102093287904247808, _13) 0 ]", - "EXPR [ (1, _10, _13) (1, _13, _13) (-1, _14) 0 ]", - "BLACKBOX::RANGE [(_14, 1)] []", - "BRILLIG CALL func 0: inputs: [Single(Expression { mul_terms: [], linear_combinations: [(1, Witness(10))], q_c: 0 })], outputs: [Simple(Witness(15))]", - "EXPR [ (1, _15) -1 ]", + "BRILLIG CALL func 1: inputs: [Single(Expression { mul_terms: [], linear_combinations: [(1, Witness(0))], q_c: 0 })], outputs: [Simple(Witness(2))]", + "EXPR [ (1, _0, _2) (1, _3) -1 ]", + "EXPR [ (1, _0, _3) 0 ]", + "BRILLIG CALL func 0: inputs: [Single(Expression { mul_terms: [], linear_combinations: [(-1, Witness(3))], q_c: 1 })], outputs: [Simple(Witness(4))]", + "EXPR [ (1, _4) 0 ]", + "BRILLIG CALL func 1: inputs: [Single(Expression { mul_terms: [], linear_combinations: [(1, Witness(1))], q_c: 0 })], outputs: [Simple(Witness(5))]", + "EXPR [ (1, _1, _5) (1, _6) -1 ]", + "EXPR [ (1, _1, _6) 0 ]", + "BRILLIG CALL func 0: inputs: [Single(Expression { mul_terms: [], linear_combinations: [(-1, Witness(6))], q_c: 1 })], outputs: [Simple(Witness(7))]", + "EXPR [ (1, _7) -1 ]", "unconstrained func 0", "[Const { destination: Direct(2), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(1), bit_size: Integer(U32), value: 32838 }, Const { destination: Direct(0), bit_size: Integer(U32), value: 3 }, Const { destination: Relative(2), bit_size: Integer(U32), value: 1 }, Const { destination: Relative(3), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(32836), size_address: Relative(2), offset_address: Relative(3) }, Cast { destination: Direct(32836), source: Direct(32836), bit_size: Integer(U1) }, Mov { destination: Relative(1), source: Direct(32836) }, Call { location: 14 }, Call { location: 15 }, Mov { destination: Direct(32837), source: Relative(1) }, Const { destination: Relative(2), bit_size: Integer(U32), value: 32837 }, Const { destination: Relative(3), bit_size: Integer(U32), value: 1 }, Stop { return_data: HeapVector { pointer: Relative(2), size: Relative(3) } }, Return, Call { location: 19 }, Not { destination: Relative(2), source: Relative(1), bit_size: U1 }, Mov { destination: Relative(1), source: Relative(2) }, Return, Const { destination: Direct(32772), bit_size: Integer(U32), value: 30720 }, BinaryIntOp { destination: Direct(32771), op: LessThan, bit_size: U32, lhs: Direct(0), rhs: Direct(32772) }, JumpIf { condition: Direct(32771), location: 24 }, IndirectConst { destination_pointer: Direct(1), bit_size: Integer(U64), value: 17843811134343075018 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return]", "unconstrained func 1", - "[Const { destination: Direct(10), bit_size: Integer(U32), value: 2 }, Const { destination: Direct(11), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(0), size_address: Direct(10), offset_address: Direct(11) }, BinaryFieldOp { destination: Direct(2), op: IntegerDiv, lhs: Direct(0), rhs: Direct(1) }, BinaryFieldOp { destination: Direct(1), op: Mul, lhs: Direct(2), rhs: Direct(1) }, BinaryFieldOp { destination: Direct(1), op: Sub, lhs: Direct(0), rhs: Direct(1) }, Mov { destination: Direct(0), source: Direct(2) }, Stop { return_data: HeapVector { pointer: Direct(11), size: Direct(10) } }]", - "unconstrained func 2", "[Const { destination: Direct(21), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(20), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(0), size_address: Direct(21), offset_address: Direct(20) }, Const { destination: Direct(2), bit_size: Field, value: 0 }, BinaryFieldOp { destination: Direct(3), op: Equals, lhs: Direct(0), rhs: Direct(2) }, JumpIf { condition: Direct(3), location: 8 }, Const { destination: Direct(1), bit_size: Field, value: 1 }, BinaryFieldOp { destination: Direct(0), op: Div, lhs: Direct(1), rhs: Direct(0) }, Stop { return_data: HeapVector { pointer: Direct(20), size: Direct(21) } }]" ], - "debug_symbols": "pZLRioMwEEX/Jc8+JGOi1V8pRaKmJRCipLqwiP++k0l1C6VQ7Ms96uQMmZiF9aadb4311+HO6vPC2mCds7fGDZ2e7ODx68J4DFGwWqxrxrZSMwVjYuVpLXYYdTB+YrWfncvYj3YzLbqP2hMnHbDKM2Z8j8SGV+tMfFqzf5u/V0HCQ4Yy33X1uS/k5sMhn4vdlwd8UcFXPhT5Pj8c8RV/c34XfNOdDS9/HzcsKIEyp5SUirKgLClPlFWyHjLauGmBOp69QF8hZIJKKBLKhFNCRQCeIBIgIXUB7FIgVLydcehgdetM3HmcbfbdNgi+Tr/jVtku+hiGzvRzMHHop9uOeRZVBvKyxoP5Aw==", + "debug_symbols": "pZLRqsMgDIbfJddeqO3sqa8yRrGtG4LY4vTAKH33RZndYAxGd/NrTL4YYxYYdR8vnXHn6QryuEDvjbXm0tlpUMFMDk8XoEmYAMnWlUBxdcFrnTwvsZhhVl67ANJFawn8Kxtz0HVWLq9BefRSAtqNuGLCs7E67VbypOlnlFftA+ai2fDD9zyrC8/pHp6yjWc7eNbyn3gu6PZ+sYevmw/9O6GlBuPffh8LZll51gpkRaAGiY08IEpAZG2y/oEUBNo0LakIb1RvdcqU7opuKInRDLe5eMrgzX4a9Bi9TkW8TB/qkbWE16c1FXoH", "file_map": { "50": { - "source": "// Tests a very simple Brillig function.\n//\n// The features being tested is not instruction on brillig\nfn main(x: Field, y: Field) {\n // Safety: testing context\n unsafe {\n assert(false == not_operator(x as bool));\n assert(true == not_operator(y as bool));\n }\n}\n\nunconstrained fn not_operator(x: bool) -> bool {\n !x\n}\n", + "source": "// Tests a very simple Brillig function.\n//\n// The features being tested is not instruction on brillig\nfn main(x: Field, y: Field) {\n // Safety: testing context\n unsafe {\n assert(false == not_operator(x != 0));\n assert(true == not_operator(y != 0));\n }\n}\n\nunconstrained fn not_operator(x: bool) -> bool {\n !x\n}\n", "path": "" } }, @@ -81,7 +63,6 @@ expression: artifact ], "brillig_names": [ "not_operator", - "directive_integer_quotient", "directive_invert" ] } diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/brillig_not/execute__tests__force_brillig_false_inliner_0.snap b/tooling/nargo_cli/tests/snapshots/execution_success/brillig_not/execute__tests__force_brillig_false_inliner_0.snap index df486b7cc19..a41a50ae47e 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/brillig_not/execute__tests__force_brillig_false_inliner_0.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/brillig_not/execute__tests__force_brillig_false_inliner_0.snap @@ -32,47 +32,29 @@ expression: artifact }, "bytecode": [ "func 0", - "current witness index : _15", + "current witness index : _7", "private parameters indices : [_0, _1]", "public parameters indices : []", "return value indices : []", - "BRILLIG CALL func 1: inputs: [Single(Expression { mul_terms: [], linear_combinations: [(1, Witness(0))], q_c: 0 }), Single(Expression { mul_terms: [], linear_combinations: [], q_c: 2 })], outputs: [Simple(Witness(2)), Simple(Witness(3))]", - "BLACKBOX::RANGE [(_2, 253)] []", - "BLACKBOX::RANGE [(_3, 1)] []", - "EXPR [ (1, _0) (-2, _2) (-1, _3) 0 ]", - "EXPR [ (-1, _2) (-1, _4) 10944121435919637611123202872628637544274182200208017171849102093287904247808 ]", - "BLACKBOX::RANGE [(_4, 253)] []", - "BRILLIG CALL func 2: inputs: [Single(Expression { mul_terms: [], linear_combinations: [(-1, Witness(2))], q_c: 10944121435919637611123202872628637544274182200208017171849102093287904247808 })], outputs: [Simple(Witness(5))]", - "EXPR [ (-1, _2, _5) (10944121435919637611123202872628637544274182200208017171849102093287904247808, _5) (1, _6) -1 ]", - "EXPR [ (-1, _2, _6) (10944121435919637611123202872628637544274182200208017171849102093287904247808, _6) 0 ]", - "EXPR [ (1, _3, _6) (1, _6, _6) (-1, _7) 0 ]", - "BLACKBOX::RANGE [(_7, 1)] []", - "BRILLIG CALL func 0: inputs: [Single(Expression { mul_terms: [], linear_combinations: [(1, Witness(3))], q_c: 0 })], outputs: [Simple(Witness(8))]", - "EXPR [ (1, _8) 0 ]", - "BRILLIG CALL func 1: inputs: [Single(Expression { mul_terms: [], linear_combinations: [(1, Witness(1))], q_c: 0 }), Single(Expression { mul_terms: [], linear_combinations: [], q_c: 2 })], outputs: [Simple(Witness(9)), Simple(Witness(10))]", - "BLACKBOX::RANGE [(_9, 253)] []", - "BLACKBOX::RANGE [(_10, 1)] []", - "EXPR [ (1, _1) (-2, _9) (-1, _10) 0 ]", - "EXPR [ (-1, _9) (-1, _11) 10944121435919637611123202872628637544274182200208017171849102093287904247808 ]", - "BLACKBOX::RANGE [(_11, 253)] []", - "BRILLIG CALL func 2: inputs: [Single(Expression { mul_terms: [], linear_combinations: [(-1, Witness(9))], q_c: 10944121435919637611123202872628637544274182200208017171849102093287904247808 })], outputs: [Simple(Witness(12))]", - "EXPR [ (-1, _9, _12) (10944121435919637611123202872628637544274182200208017171849102093287904247808, _12) (1, _13) -1 ]", - "EXPR [ (-1, _9, _13) (10944121435919637611123202872628637544274182200208017171849102093287904247808, _13) 0 ]", - "EXPR [ (1, _10, _13) (1, _13, _13) (-1, _14) 0 ]", - "BLACKBOX::RANGE [(_14, 1)] []", - "BRILLIG CALL func 0: inputs: [Single(Expression { mul_terms: [], linear_combinations: [(1, Witness(10))], q_c: 0 })], outputs: [Simple(Witness(15))]", - "EXPR [ (1, _15) -1 ]", + "BRILLIG CALL func 1: inputs: [Single(Expression { mul_terms: [], linear_combinations: [(1, Witness(0))], q_c: 0 })], outputs: [Simple(Witness(2))]", + "EXPR [ (1, _0, _2) (1, _3) -1 ]", + "EXPR [ (1, _0, _3) 0 ]", + "BRILLIG CALL func 0: inputs: [Single(Expression { mul_terms: [], linear_combinations: [(-1, Witness(3))], q_c: 1 })], outputs: [Simple(Witness(4))]", + "EXPR [ (1, _4) 0 ]", + "BRILLIG CALL func 1: inputs: [Single(Expression { mul_terms: [], linear_combinations: [(1, Witness(1))], q_c: 0 })], outputs: [Simple(Witness(5))]", + "EXPR [ (1, _1, _5) (1, _6) -1 ]", + "EXPR [ (1, _1, _6) 0 ]", + "BRILLIG CALL func 0: inputs: [Single(Expression { mul_terms: [], linear_combinations: [(-1, Witness(6))], q_c: 1 })], outputs: [Simple(Witness(7))]", + "EXPR [ (1, _7) -1 ]", "unconstrained func 0", "[Const { destination: Direct(2), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(1), bit_size: Integer(U32), value: 32838 }, Const { destination: Direct(0), bit_size: Integer(U32), value: 3 }, Const { destination: Relative(2), bit_size: Integer(U32), value: 1 }, Const { destination: Relative(3), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(32836), size_address: Relative(2), offset_address: Relative(3) }, Cast { destination: Direct(32836), source: Direct(32836), bit_size: Integer(U1) }, Mov { destination: Relative(1), source: Direct(32836) }, Call { location: 14 }, Call { location: 15 }, Mov { destination: Direct(32837), source: Relative(1) }, Const { destination: Relative(2), bit_size: Integer(U32), value: 32837 }, Const { destination: Relative(3), bit_size: Integer(U32), value: 1 }, Stop { return_data: HeapVector { pointer: Relative(2), size: Relative(3) } }, Return, Call { location: 19 }, Not { destination: Relative(2), source: Relative(1), bit_size: U1 }, Mov { destination: Relative(1), source: Relative(2) }, Return, Const { destination: Direct(32772), bit_size: Integer(U32), value: 30720 }, BinaryIntOp { destination: Direct(32771), op: LessThan, bit_size: U32, lhs: Direct(0), rhs: Direct(32772) }, JumpIf { condition: Direct(32771), location: 24 }, IndirectConst { destination_pointer: Direct(1), bit_size: Integer(U64), value: 17843811134343075018 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return]", "unconstrained func 1", - "[Const { destination: Direct(10), bit_size: Integer(U32), value: 2 }, Const { destination: Direct(11), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(0), size_address: Direct(10), offset_address: Direct(11) }, BinaryFieldOp { destination: Direct(2), op: IntegerDiv, lhs: Direct(0), rhs: Direct(1) }, BinaryFieldOp { destination: Direct(1), op: Mul, lhs: Direct(2), rhs: Direct(1) }, BinaryFieldOp { destination: Direct(1), op: Sub, lhs: Direct(0), rhs: Direct(1) }, Mov { destination: Direct(0), source: Direct(2) }, Stop { return_data: HeapVector { pointer: Direct(11), size: Direct(10) } }]", - "unconstrained func 2", "[Const { destination: Direct(21), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(20), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(0), size_address: Direct(21), offset_address: Direct(20) }, Const { destination: Direct(2), bit_size: Field, value: 0 }, BinaryFieldOp { destination: Direct(3), op: Equals, lhs: Direct(0), rhs: Direct(2) }, JumpIf { condition: Direct(3), location: 8 }, Const { destination: Direct(1), bit_size: Field, value: 1 }, BinaryFieldOp { destination: Direct(0), op: Div, lhs: Direct(1), rhs: Direct(0) }, Stop { return_data: HeapVector { pointer: Direct(20), size: Direct(21) } }]" ], - "debug_symbols": "pZLRioMwEEX/Jc8+JGOi1V8pRaKmJRCipLqwiP++k0l1C6VQ7Ms96uQMmZiF9aadb4311+HO6vPC2mCds7fGDZ2e7ODx68J4DFGwWqxrxrZSMwVjYuVpLXYYdTB+YrWfncvYj3YzLbqP2hMnHbDKM2Z8j8SGV+tMfFqzf5u/V0HCQ4Yy33X1uS/k5sMhn4vdlwd8UcFXPhT5Pj8c8RV/c34XfNOdDS9/HzcsKIEyp5SUirKgLClPlFWyHjLauGmBOp69QF8hZIJKKBLKhFNCRQCeIBIgIXUB7FIgVLydcehgdetM3HmcbfbdNgi+Tr/jVtku+hiGzvRzMHHop9uOeRZVBvKyxoP5Aw==", + "debug_symbols": "pZLRqsMgDIbfJddeqO3sqa8yRrGtG4LY4vTAKH33RZndYAxGd/NrTL4YYxYYdR8vnXHn6QryuEDvjbXm0tlpUMFMDk8XoEmYAMnWlUBxdcFrnTwvsZhhVl67ANJFawn8Kxtz0HVWLq9BefRSAtqNuGLCs7E67VbypOlnlFftA+ai2fDD9zyrC8/pHp6yjWc7eNbyn3gu6PZ+sYevmw/9O6GlBuPffh8LZll51gpkRaAGiY08IEpAZG2y/oEUBNo0LakIb1RvdcqU7opuKInRDLe5eMrgzX4a9Bi9TkW8TB/qkbWE16c1FXoH", "file_map": { "50": { - "source": "// Tests a very simple Brillig function.\n//\n// The features being tested is not instruction on brillig\nfn main(x: Field, y: Field) {\n // Safety: testing context\n unsafe {\n assert(false == not_operator(x as bool));\n assert(true == not_operator(y as bool));\n }\n}\n\nunconstrained fn not_operator(x: bool) -> bool {\n !x\n}\n", + "source": "// Tests a very simple Brillig function.\n//\n// The features being tested is not instruction on brillig\nfn main(x: Field, y: Field) {\n // Safety: testing context\n unsafe {\n assert(false == not_operator(x != 0));\n assert(true == not_operator(y != 0));\n }\n}\n\nunconstrained fn not_operator(x: bool) -> bool {\n !x\n}\n", "path": "" } }, @@ -81,7 +63,6 @@ expression: artifact ], "brillig_names": [ "not_operator", - "directive_integer_quotient", "directive_invert" ] } diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/brillig_not/execute__tests__force_brillig_false_inliner_9223372036854775807.snap b/tooling/nargo_cli/tests/snapshots/execution_success/brillig_not/execute__tests__force_brillig_false_inliner_9223372036854775807.snap index df486b7cc19..a41a50ae47e 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/brillig_not/execute__tests__force_brillig_false_inliner_9223372036854775807.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/brillig_not/execute__tests__force_brillig_false_inliner_9223372036854775807.snap @@ -32,47 +32,29 @@ expression: artifact }, "bytecode": [ "func 0", - "current witness index : _15", + "current witness index : _7", "private parameters indices : [_0, _1]", "public parameters indices : []", "return value indices : []", - "BRILLIG CALL func 1: inputs: [Single(Expression { mul_terms: [], linear_combinations: [(1, Witness(0))], q_c: 0 }), Single(Expression { mul_terms: [], linear_combinations: [], q_c: 2 })], outputs: [Simple(Witness(2)), Simple(Witness(3))]", - "BLACKBOX::RANGE [(_2, 253)] []", - "BLACKBOX::RANGE [(_3, 1)] []", - "EXPR [ (1, _0) (-2, _2) (-1, _3) 0 ]", - "EXPR [ (-1, _2) (-1, _4) 10944121435919637611123202872628637544274182200208017171849102093287904247808 ]", - "BLACKBOX::RANGE [(_4, 253)] []", - "BRILLIG CALL func 2: inputs: [Single(Expression { mul_terms: [], linear_combinations: [(-1, Witness(2))], q_c: 10944121435919637611123202872628637544274182200208017171849102093287904247808 })], outputs: [Simple(Witness(5))]", - "EXPR [ (-1, _2, _5) (10944121435919637611123202872628637544274182200208017171849102093287904247808, _5) (1, _6) -1 ]", - "EXPR [ (-1, _2, _6) (10944121435919637611123202872628637544274182200208017171849102093287904247808, _6) 0 ]", - "EXPR [ (1, _3, _6) (1, _6, _6) (-1, _7) 0 ]", - "BLACKBOX::RANGE [(_7, 1)] []", - "BRILLIG CALL func 0: inputs: [Single(Expression { mul_terms: [], linear_combinations: [(1, Witness(3))], q_c: 0 })], outputs: [Simple(Witness(8))]", - "EXPR [ (1, _8) 0 ]", - "BRILLIG CALL func 1: inputs: [Single(Expression { mul_terms: [], linear_combinations: [(1, Witness(1))], q_c: 0 }), Single(Expression { mul_terms: [], linear_combinations: [], q_c: 2 })], outputs: [Simple(Witness(9)), Simple(Witness(10))]", - "BLACKBOX::RANGE [(_9, 253)] []", - "BLACKBOX::RANGE [(_10, 1)] []", - "EXPR [ (1, _1) (-2, _9) (-1, _10) 0 ]", - "EXPR [ (-1, _9) (-1, _11) 10944121435919637611123202872628637544274182200208017171849102093287904247808 ]", - "BLACKBOX::RANGE [(_11, 253)] []", - "BRILLIG CALL func 2: inputs: [Single(Expression { mul_terms: [], linear_combinations: [(-1, Witness(9))], q_c: 10944121435919637611123202872628637544274182200208017171849102093287904247808 })], outputs: [Simple(Witness(12))]", - "EXPR [ (-1, _9, _12) (10944121435919637611123202872628637544274182200208017171849102093287904247808, _12) (1, _13) -1 ]", - "EXPR [ (-1, _9, _13) (10944121435919637611123202872628637544274182200208017171849102093287904247808, _13) 0 ]", - "EXPR [ (1, _10, _13) (1, _13, _13) (-1, _14) 0 ]", - "BLACKBOX::RANGE [(_14, 1)] []", - "BRILLIG CALL func 0: inputs: [Single(Expression { mul_terms: [], linear_combinations: [(1, Witness(10))], q_c: 0 })], outputs: [Simple(Witness(15))]", - "EXPR [ (1, _15) -1 ]", + "BRILLIG CALL func 1: inputs: [Single(Expression { mul_terms: [], linear_combinations: [(1, Witness(0))], q_c: 0 })], outputs: [Simple(Witness(2))]", + "EXPR [ (1, _0, _2) (1, _3) -1 ]", + "EXPR [ (1, _0, _3) 0 ]", + "BRILLIG CALL func 0: inputs: [Single(Expression { mul_terms: [], linear_combinations: [(-1, Witness(3))], q_c: 1 })], outputs: [Simple(Witness(4))]", + "EXPR [ (1, _4) 0 ]", + "BRILLIG CALL func 1: inputs: [Single(Expression { mul_terms: [], linear_combinations: [(1, Witness(1))], q_c: 0 })], outputs: [Simple(Witness(5))]", + "EXPR [ (1, _1, _5) (1, _6) -1 ]", + "EXPR [ (1, _1, _6) 0 ]", + "BRILLIG CALL func 0: inputs: [Single(Expression { mul_terms: [], linear_combinations: [(-1, Witness(6))], q_c: 1 })], outputs: [Simple(Witness(7))]", + "EXPR [ (1, _7) -1 ]", "unconstrained func 0", "[Const { destination: Direct(2), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(1), bit_size: Integer(U32), value: 32838 }, Const { destination: Direct(0), bit_size: Integer(U32), value: 3 }, Const { destination: Relative(2), bit_size: Integer(U32), value: 1 }, Const { destination: Relative(3), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(32836), size_address: Relative(2), offset_address: Relative(3) }, Cast { destination: Direct(32836), source: Direct(32836), bit_size: Integer(U1) }, Mov { destination: Relative(1), source: Direct(32836) }, Call { location: 14 }, Call { location: 15 }, Mov { destination: Direct(32837), source: Relative(1) }, Const { destination: Relative(2), bit_size: Integer(U32), value: 32837 }, Const { destination: Relative(3), bit_size: Integer(U32), value: 1 }, Stop { return_data: HeapVector { pointer: Relative(2), size: Relative(3) } }, Return, Call { location: 19 }, Not { destination: Relative(2), source: Relative(1), bit_size: U1 }, Mov { destination: Relative(1), source: Relative(2) }, Return, Const { destination: Direct(32772), bit_size: Integer(U32), value: 30720 }, BinaryIntOp { destination: Direct(32771), op: LessThan, bit_size: U32, lhs: Direct(0), rhs: Direct(32772) }, JumpIf { condition: Direct(32771), location: 24 }, IndirectConst { destination_pointer: Direct(1), bit_size: Integer(U64), value: 17843811134343075018 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return]", "unconstrained func 1", - "[Const { destination: Direct(10), bit_size: Integer(U32), value: 2 }, Const { destination: Direct(11), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(0), size_address: Direct(10), offset_address: Direct(11) }, BinaryFieldOp { destination: Direct(2), op: IntegerDiv, lhs: Direct(0), rhs: Direct(1) }, BinaryFieldOp { destination: Direct(1), op: Mul, lhs: Direct(2), rhs: Direct(1) }, BinaryFieldOp { destination: Direct(1), op: Sub, lhs: Direct(0), rhs: Direct(1) }, Mov { destination: Direct(0), source: Direct(2) }, Stop { return_data: HeapVector { pointer: Direct(11), size: Direct(10) } }]", - "unconstrained func 2", "[Const { destination: Direct(21), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(20), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(0), size_address: Direct(21), offset_address: Direct(20) }, Const { destination: Direct(2), bit_size: Field, value: 0 }, BinaryFieldOp { destination: Direct(3), op: Equals, lhs: Direct(0), rhs: Direct(2) }, JumpIf { condition: Direct(3), location: 8 }, Const { destination: Direct(1), bit_size: Field, value: 1 }, BinaryFieldOp { destination: Direct(0), op: Div, lhs: Direct(1), rhs: Direct(0) }, Stop { return_data: HeapVector { pointer: Direct(20), size: Direct(21) } }]" ], - "debug_symbols": "pZLRioMwEEX/Jc8+JGOi1V8pRaKmJRCipLqwiP++k0l1C6VQ7Ms96uQMmZiF9aadb4311+HO6vPC2mCds7fGDZ2e7ODx68J4DFGwWqxrxrZSMwVjYuVpLXYYdTB+YrWfncvYj3YzLbqP2hMnHbDKM2Z8j8SGV+tMfFqzf5u/V0HCQ4Yy33X1uS/k5sMhn4vdlwd8UcFXPhT5Pj8c8RV/c34XfNOdDS9/HzcsKIEyp5SUirKgLClPlFWyHjLauGmBOp69QF8hZIJKKBLKhFNCRQCeIBIgIXUB7FIgVLydcehgdetM3HmcbfbdNgi+Tr/jVtku+hiGzvRzMHHop9uOeRZVBvKyxoP5Aw==", + "debug_symbols": "pZLRqsMgDIbfJddeqO3sqa8yRrGtG4LY4vTAKH33RZndYAxGd/NrTL4YYxYYdR8vnXHn6QryuEDvjbXm0tlpUMFMDk8XoEmYAMnWlUBxdcFrnTwvsZhhVl67ANJFawn8Kxtz0HVWLq9BefRSAtqNuGLCs7E67VbypOlnlFftA+ai2fDD9zyrC8/pHp6yjWc7eNbyn3gu6PZ+sYevmw/9O6GlBuPffh8LZll51gpkRaAGiY08IEpAZG2y/oEUBNo0LakIb1RvdcqU7opuKInRDLe5eMrgzX4a9Bi9TkW8TB/qkbWE16c1FXoH", "file_map": { "50": { - "source": "// Tests a very simple Brillig function.\n//\n// The features being tested is not instruction on brillig\nfn main(x: Field, y: Field) {\n // Safety: testing context\n unsafe {\n assert(false == not_operator(x as bool));\n assert(true == not_operator(y as bool));\n }\n}\n\nunconstrained fn not_operator(x: bool) -> bool {\n !x\n}\n", + "source": "// Tests a very simple Brillig function.\n//\n// The features being tested is not instruction on brillig\nfn main(x: Field, y: Field) {\n // Safety: testing context\n unsafe {\n assert(false == not_operator(x != 0));\n assert(true == not_operator(y != 0));\n }\n}\n\nunconstrained fn not_operator(x: bool) -> bool {\n !x\n}\n", "path": "" } }, @@ -81,7 +63,6 @@ expression: artifact ], "brillig_names": [ "not_operator", - "directive_integer_quotient", "directive_invert" ] } diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/brillig_not/execute__tests__force_brillig_true_inliner_-9223372036854775808.snap b/tooling/nargo_cli/tests/snapshots/execution_success/brillig_not/execute__tests__force_brillig_true_inliner_-9223372036854775808.snap index 4006742d619..9dfa3efa0d9 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/brillig_not/execute__tests__force_brillig_true_inliner_-9223372036854775808.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/brillig_not/execute__tests__force_brillig_true_inliner_-9223372036854775808.snap @@ -38,12 +38,12 @@ expression: artifact "return value indices : []", "BRILLIG CALL func 0: inputs: [Single(Expression { mul_terms: [], linear_combinations: [(1, Witness(0))], q_c: 0 }), Single(Expression { mul_terms: [], linear_combinations: [(1, Witness(1))], q_c: 0 })], outputs: []", "unconstrained func 0", - "[Const { destination: Direct(2), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(1), bit_size: Integer(U32), value: 32838 }, Const { destination: Direct(0), bit_size: Integer(U32), value: 3 }, Const { destination: Relative(3), bit_size: Integer(U32), value: 2 }, Const { destination: Relative(4), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(32836), size_address: Relative(3), offset_address: Relative(4) }, Mov { destination: Relative(1), source: Direct(32836) }, Mov { destination: Relative(2), source: Direct(32837) }, Call { location: 13 }, Call { location: 14 }, Const { destination: Relative(1), bit_size: Integer(U32), value: 32838 }, Const { destination: Relative(2), bit_size: Integer(U32), value: 0 }, Stop { return_data: HeapVector { pointer: Relative(1), size: Relative(2) } }, Return, Call { location: 31 }, Cast { destination: Relative(4), source: Relative(1), bit_size: Integer(U1) }, Cast { destination: Relative(3), source: Relative(4), bit_size: Field }, Cast { destination: Relative(1), source: Relative(3), bit_size: Integer(U1) }, Const { destination: Relative(3), bit_size: Integer(U1), value: 1 }, JumpIf { condition: Relative(1), location: 22 }, Const { destination: Relative(4), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(4) } }, Cast { destination: Relative(3), source: Relative(2), bit_size: Integer(U1) }, Cast { destination: Relative(1), source: Relative(3), bit_size: Field }, Cast { destination: Relative(2), source: Relative(1), bit_size: Integer(U1) }, Const { destination: Relative(1), bit_size: Integer(U1), value: 0 }, BinaryIntOp { destination: Relative(3), op: Equals, bit_size: U1, lhs: Relative(2), rhs: Relative(1) }, JumpIf { condition: Relative(3), location: 30 }, Const { destination: Relative(4), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(4) } }, 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: 36 }, IndirectConst { destination_pointer: Direct(1), bit_size: Integer(U64), value: 17843811134343075018 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return]" + "[Const { destination: Direct(2), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(1), bit_size: Integer(U32), value: 32838 }, Const { destination: Direct(0), bit_size: Integer(U32), value: 3 }, Const { destination: Relative(3), bit_size: Integer(U32), value: 2 }, Const { destination: Relative(4), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(32836), size_address: Relative(3), offset_address: Relative(4) }, Mov { destination: Relative(1), source: Direct(32836) }, Mov { destination: Relative(2), source: Direct(32837) }, Call { location: 13 }, Call { location: 14 }, Const { destination: Relative(1), bit_size: Integer(U32), value: 32838 }, Const { destination: Relative(2), bit_size: Integer(U32), value: 0 }, Stop { return_data: HeapVector { pointer: Relative(1), size: Relative(2) } }, Return, Call { location: 27 }, Const { destination: Relative(3), bit_size: Field, value: 0 }, BinaryFieldOp { destination: Relative(4), op: Equals, lhs: Relative(1), rhs: Relative(3) }, Const { destination: Relative(1), bit_size: Integer(U1), value: 0 }, BinaryIntOp { destination: Relative(5), op: Equals, bit_size: U1, lhs: Relative(4), rhs: Relative(1) }, JumpIf { condition: Relative(5), location: 22 }, Const { destination: Relative(6), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(6) } }, BinaryFieldOp { destination: Relative(1), op: Equals, lhs: Relative(2), rhs: Relative(3) }, JumpIf { condition: Relative(1), location: 26 }, Const { destination: Relative(4), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(4) } }, 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: 32 }, IndirectConst { destination_pointer: Direct(1), bit_size: Integer(U64), value: 17843811134343075018 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return]" ], - "debug_symbols": "nZLNroMgEEbfZdYs5Kfa8ipNY1CxISFoKNzkxvDud5DqtYsmTTcccTjfTAILDLqL99a4cXqAvC7QeWOtubd26lUwk8O/C1R5oSeQlACtC5qCM0iGuKxgVQEtYCA5gheIAkwRiLqgKTgXYIpIicDWvA1e69z7MA3OOCuvXQDporUEfpSN66HHrNzKoDxWKwLaDUgMHI3V+SuRf7t6rzIqnjJjfNdPH/v0wnZffOGzmm9+w77xxd6/eZ3/hjvVG/9yvykneaM6q5/bMbr+UA2/81bZ3sfsp14P0eucdHgkuF45Jby+pdztDw==", + "debug_symbols": "nZHBisMgEIbfZc4e4tg2G1+llGASUwQxwerCEnz3HWPTpodC6cVPHb9/hFlg0F28tsaN0w3keYHOG2vNtbVTr4KZHN0uUOWFH0FyBvxUUINEwk9BswKrAl6AIAVBFBwKKEWkxGBr0Aavdc7fdaR/zMprF0C6aC2DX2Xj+ug2K7cyKE/VioF2A5ECR2N13iX2tKv3KvLDXUZ86sePfd7gw+df+CiazT/VL/6FTqo3/mUGKSd5ozqr78cxun5XDX/zVtlmOPup10P0OiftBknrGWsm8JJyt38=", "file_map": { "50": { - "source": "// Tests a very simple Brillig function.\n//\n// The features being tested is not instruction on brillig\nfn main(x: Field, y: Field) {\n // Safety: testing context\n unsafe {\n assert(false == not_operator(x as bool));\n assert(true == not_operator(y as bool));\n }\n}\n\nunconstrained fn not_operator(x: bool) -> bool {\n !x\n}\n", + "source": "// Tests a very simple Brillig function.\n//\n// The features being tested is not instruction on brillig\nfn main(x: Field, y: Field) {\n // Safety: testing context\n unsafe {\n assert(false == not_operator(x != 0));\n assert(true == not_operator(y != 0));\n }\n}\n\nunconstrained fn not_operator(x: bool) -> bool {\n !x\n}\n", "path": "" } }, diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/brillig_not/execute__tests__force_brillig_true_inliner_0.snap b/tooling/nargo_cli/tests/snapshots/execution_success/brillig_not/execute__tests__force_brillig_true_inliner_0.snap index 4006742d619..9dfa3efa0d9 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/brillig_not/execute__tests__force_brillig_true_inliner_0.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/brillig_not/execute__tests__force_brillig_true_inliner_0.snap @@ -38,12 +38,12 @@ expression: artifact "return value indices : []", "BRILLIG CALL func 0: inputs: [Single(Expression { mul_terms: [], linear_combinations: [(1, Witness(0))], q_c: 0 }), Single(Expression { mul_terms: [], linear_combinations: [(1, Witness(1))], q_c: 0 })], outputs: []", "unconstrained func 0", - "[Const { destination: Direct(2), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(1), bit_size: Integer(U32), value: 32838 }, Const { destination: Direct(0), bit_size: Integer(U32), value: 3 }, Const { destination: Relative(3), bit_size: Integer(U32), value: 2 }, Const { destination: Relative(4), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(32836), size_address: Relative(3), offset_address: Relative(4) }, Mov { destination: Relative(1), source: Direct(32836) }, Mov { destination: Relative(2), source: Direct(32837) }, Call { location: 13 }, Call { location: 14 }, Const { destination: Relative(1), bit_size: Integer(U32), value: 32838 }, Const { destination: Relative(2), bit_size: Integer(U32), value: 0 }, Stop { return_data: HeapVector { pointer: Relative(1), size: Relative(2) } }, Return, Call { location: 31 }, Cast { destination: Relative(4), source: Relative(1), bit_size: Integer(U1) }, Cast { destination: Relative(3), source: Relative(4), bit_size: Field }, Cast { destination: Relative(1), source: Relative(3), bit_size: Integer(U1) }, Const { destination: Relative(3), bit_size: Integer(U1), value: 1 }, JumpIf { condition: Relative(1), location: 22 }, Const { destination: Relative(4), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(4) } }, Cast { destination: Relative(3), source: Relative(2), bit_size: Integer(U1) }, Cast { destination: Relative(1), source: Relative(3), bit_size: Field }, Cast { destination: Relative(2), source: Relative(1), bit_size: Integer(U1) }, Const { destination: Relative(1), bit_size: Integer(U1), value: 0 }, BinaryIntOp { destination: Relative(3), op: Equals, bit_size: U1, lhs: Relative(2), rhs: Relative(1) }, JumpIf { condition: Relative(3), location: 30 }, Const { destination: Relative(4), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(4) } }, 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: 36 }, IndirectConst { destination_pointer: Direct(1), bit_size: Integer(U64), value: 17843811134343075018 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return]" + "[Const { destination: Direct(2), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(1), bit_size: Integer(U32), value: 32838 }, Const { destination: Direct(0), bit_size: Integer(U32), value: 3 }, Const { destination: Relative(3), bit_size: Integer(U32), value: 2 }, Const { destination: Relative(4), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(32836), size_address: Relative(3), offset_address: Relative(4) }, Mov { destination: Relative(1), source: Direct(32836) }, Mov { destination: Relative(2), source: Direct(32837) }, Call { location: 13 }, Call { location: 14 }, Const { destination: Relative(1), bit_size: Integer(U32), value: 32838 }, Const { destination: Relative(2), bit_size: Integer(U32), value: 0 }, Stop { return_data: HeapVector { pointer: Relative(1), size: Relative(2) } }, Return, Call { location: 27 }, Const { destination: Relative(3), bit_size: Field, value: 0 }, BinaryFieldOp { destination: Relative(4), op: Equals, lhs: Relative(1), rhs: Relative(3) }, Const { destination: Relative(1), bit_size: Integer(U1), value: 0 }, BinaryIntOp { destination: Relative(5), op: Equals, bit_size: U1, lhs: Relative(4), rhs: Relative(1) }, JumpIf { condition: Relative(5), location: 22 }, Const { destination: Relative(6), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(6) } }, BinaryFieldOp { destination: Relative(1), op: Equals, lhs: Relative(2), rhs: Relative(3) }, JumpIf { condition: Relative(1), location: 26 }, Const { destination: Relative(4), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(4) } }, 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: 32 }, IndirectConst { destination_pointer: Direct(1), bit_size: Integer(U64), value: 17843811134343075018 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return]" ], - "debug_symbols": "nZLNroMgEEbfZdYs5Kfa8ipNY1CxISFoKNzkxvDud5DqtYsmTTcccTjfTAILDLqL99a4cXqAvC7QeWOtubd26lUwk8O/C1R5oSeQlACtC5qCM0iGuKxgVQEtYCA5gheIAkwRiLqgKTgXYIpIicDWvA1e69z7MA3OOCuvXQDporUEfpSN66HHrNzKoDxWKwLaDUgMHI3V+SuRf7t6rzIqnjJjfNdPH/v0wnZffOGzmm9+w77xxd6/eZ3/hjvVG/9yvykneaM6q5/bMbr+UA2/81bZ3sfsp14P0eucdHgkuF45Jby+pdztDw==", + "debug_symbols": "nZHBisMgEIbfZc4e4tg2G1+llGASUwQxwerCEnz3HWPTpodC6cVPHb9/hFlg0F28tsaN0w3keYHOG2vNtbVTr4KZHN0uUOWFH0FyBvxUUINEwk9BswKrAl6AIAVBFBwKKEWkxGBr0Aavdc7fdaR/zMprF0C6aC2DX2Xj+ug2K7cyKE/VioF2A5ECR2N13iX2tKv3KvLDXUZ86sePfd7gw+df+CiazT/VL/6FTqo3/mUGKSd5ozqr78cxun5XDX/zVtlmOPup10P0OiftBknrGWsm8JJyt38=", "file_map": { "50": { - "source": "// Tests a very simple Brillig function.\n//\n// The features being tested is not instruction on brillig\nfn main(x: Field, y: Field) {\n // Safety: testing context\n unsafe {\n assert(false == not_operator(x as bool));\n assert(true == not_operator(y as bool));\n }\n}\n\nunconstrained fn not_operator(x: bool) -> bool {\n !x\n}\n", + "source": "// Tests a very simple Brillig function.\n//\n// The features being tested is not instruction on brillig\nfn main(x: Field, y: Field) {\n // Safety: testing context\n unsafe {\n assert(false == not_operator(x != 0));\n assert(true == not_operator(y != 0));\n }\n}\n\nunconstrained fn not_operator(x: bool) -> bool {\n !x\n}\n", "path": "" } }, diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/brillig_not/execute__tests__force_brillig_true_inliner_9223372036854775807.snap b/tooling/nargo_cli/tests/snapshots/execution_success/brillig_not/execute__tests__force_brillig_true_inliner_9223372036854775807.snap index 4006742d619..9dfa3efa0d9 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/brillig_not/execute__tests__force_brillig_true_inliner_9223372036854775807.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/brillig_not/execute__tests__force_brillig_true_inliner_9223372036854775807.snap @@ -38,12 +38,12 @@ expression: artifact "return value indices : []", "BRILLIG CALL func 0: inputs: [Single(Expression { mul_terms: [], linear_combinations: [(1, Witness(0))], q_c: 0 }), Single(Expression { mul_terms: [], linear_combinations: [(1, Witness(1))], q_c: 0 })], outputs: []", "unconstrained func 0", - "[Const { destination: Direct(2), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(1), bit_size: Integer(U32), value: 32838 }, Const { destination: Direct(0), bit_size: Integer(U32), value: 3 }, Const { destination: Relative(3), bit_size: Integer(U32), value: 2 }, Const { destination: Relative(4), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(32836), size_address: Relative(3), offset_address: Relative(4) }, Mov { destination: Relative(1), source: Direct(32836) }, Mov { destination: Relative(2), source: Direct(32837) }, Call { location: 13 }, Call { location: 14 }, Const { destination: Relative(1), bit_size: Integer(U32), value: 32838 }, Const { destination: Relative(2), bit_size: Integer(U32), value: 0 }, Stop { return_data: HeapVector { pointer: Relative(1), size: Relative(2) } }, Return, Call { location: 31 }, Cast { destination: Relative(4), source: Relative(1), bit_size: Integer(U1) }, Cast { destination: Relative(3), source: Relative(4), bit_size: Field }, Cast { destination: Relative(1), source: Relative(3), bit_size: Integer(U1) }, Const { destination: Relative(3), bit_size: Integer(U1), value: 1 }, JumpIf { condition: Relative(1), location: 22 }, Const { destination: Relative(4), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(4) } }, Cast { destination: Relative(3), source: Relative(2), bit_size: Integer(U1) }, Cast { destination: Relative(1), source: Relative(3), bit_size: Field }, Cast { destination: Relative(2), source: Relative(1), bit_size: Integer(U1) }, Const { destination: Relative(1), bit_size: Integer(U1), value: 0 }, BinaryIntOp { destination: Relative(3), op: Equals, bit_size: U1, lhs: Relative(2), rhs: Relative(1) }, JumpIf { condition: Relative(3), location: 30 }, Const { destination: Relative(4), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(4) } }, 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: 36 }, IndirectConst { destination_pointer: Direct(1), bit_size: Integer(U64), value: 17843811134343075018 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return]" + "[Const { destination: Direct(2), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(1), bit_size: Integer(U32), value: 32838 }, Const { destination: Direct(0), bit_size: Integer(U32), value: 3 }, Const { destination: Relative(3), bit_size: Integer(U32), value: 2 }, Const { destination: Relative(4), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(32836), size_address: Relative(3), offset_address: Relative(4) }, Mov { destination: Relative(1), source: Direct(32836) }, Mov { destination: Relative(2), source: Direct(32837) }, Call { location: 13 }, Call { location: 14 }, Const { destination: Relative(1), bit_size: Integer(U32), value: 32838 }, Const { destination: Relative(2), bit_size: Integer(U32), value: 0 }, Stop { return_data: HeapVector { pointer: Relative(1), size: Relative(2) } }, Return, Call { location: 27 }, Const { destination: Relative(3), bit_size: Field, value: 0 }, BinaryFieldOp { destination: Relative(4), op: Equals, lhs: Relative(1), rhs: Relative(3) }, Const { destination: Relative(1), bit_size: Integer(U1), value: 0 }, BinaryIntOp { destination: Relative(5), op: Equals, bit_size: U1, lhs: Relative(4), rhs: Relative(1) }, JumpIf { condition: Relative(5), location: 22 }, Const { destination: Relative(6), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(6) } }, BinaryFieldOp { destination: Relative(1), op: Equals, lhs: Relative(2), rhs: Relative(3) }, JumpIf { condition: Relative(1), location: 26 }, Const { destination: Relative(4), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(4) } }, 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: 32 }, IndirectConst { destination_pointer: Direct(1), bit_size: Integer(U64), value: 17843811134343075018 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return]" ], - "debug_symbols": "nZLNroMgEEbfZdYs5Kfa8ipNY1CxISFoKNzkxvDud5DqtYsmTTcccTjfTAILDLqL99a4cXqAvC7QeWOtubd26lUwk8O/C1R5oSeQlACtC5qCM0iGuKxgVQEtYCA5gheIAkwRiLqgKTgXYIpIicDWvA1e69z7MA3OOCuvXQDporUEfpSN66HHrNzKoDxWKwLaDUgMHI3V+SuRf7t6rzIqnjJjfNdPH/v0wnZffOGzmm9+w77xxd6/eZ3/hjvVG/9yvykneaM6q5/bMbr+UA2/81bZ3sfsp14P0eucdHgkuF45Jby+pdztDw==", + "debug_symbols": "nZHBisMgEIbfZc4e4tg2G1+llGASUwQxwerCEnz3HWPTpodC6cVPHb9/hFlg0F28tsaN0w3keYHOG2vNtbVTr4KZHN0uUOWFH0FyBvxUUINEwk9BswKrAl6AIAVBFBwKKEWkxGBr0Aavdc7fdaR/zMprF0C6aC2DX2Xj+ug2K7cyKE/VioF2A5ECR2N13iX2tKv3KvLDXUZ86sePfd7gw+df+CiazT/VL/6FTqo3/mUGKSd5ozqr78cxun5XDX/zVtlmOPup10P0OiftBknrGWsm8JJyt38=", "file_map": { "50": { - "source": "// Tests a very simple Brillig function.\n//\n// The features being tested is not instruction on brillig\nfn main(x: Field, y: Field) {\n // Safety: testing context\n unsafe {\n assert(false == not_operator(x as bool));\n assert(true == not_operator(y as bool));\n }\n}\n\nunconstrained fn not_operator(x: bool) -> bool {\n !x\n}\n", + "source": "// Tests a very simple Brillig function.\n//\n// The features being tested is not instruction on brillig\nfn main(x: Field, y: Field) {\n // Safety: testing context\n unsafe {\n assert(false == not_operator(x != 0));\n assert(true == not_operator(y != 0));\n }\n}\n\nunconstrained fn not_operator(x: bool) -> bool {\n !x\n}\n", "path": "" } }, diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/merkle_insert/execute__tests__expanded.snap b/tooling/nargo_cli/tests/snapshots/execution_success/merkle_insert/execute__tests__expanded.snap index c0387b5b44a..830dbbb41d5 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/merkle_insert/execute__tests__expanded.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/merkle_insert/execute__tests__expanded.snap @@ -19,7 +19,7 @@ fn compute_merkle_root(leaf: Field, index: Field, hash_path: [Field; let index_bits: [u1; N] = index.to_le_bits(); let mut current: Field = leaf; for i in 0..N { - let path_bit: bool = index_bits[i] as bool; + let path_bit: bool = index_bits[i] != 0; let (hash_left, hash_right): (Field, Field) = if path_bit { (hash_path[i], current) } else { diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/merkle_insert/execute__tests__force_brillig_false_inliner_-9223372036854775808.snap b/tooling/nargo_cli/tests/snapshots/execution_success/merkle_insert/execute__tests__force_brillig_false_inliner_-9223372036854775808.snap index 7d35461fbc5..ec0887864d7 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/merkle_insert/execute__tests__force_brillig_false_inliner_-9223372036854775808.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/merkle_insert/execute__tests__force_brillig_false_inliner_-9223372036854775808.snap @@ -119,7 +119,7 @@ expression: artifact "unconstrained func 1", "[Const { destination: Direct(5), bit_size: Integer(U32), value: 0 }, Const { destination: Direct(6), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(7), bit_size: Integer(U32), value: 3 }, CalldataCopy { destination_address: Direct(0), size_address: Direct(7), offset_address: Direct(5) }, Cast { destination: Direct(1), source: Direct(1), bit_size: Integer(U32) }, Const { destination: Direct(9), bit_size: Integer(U32), value: 10 }, BinaryIntOp { destination: Direct(7), op: Add, bit_size: U32, lhs: Direct(9), rhs: Direct(1) }, BinaryFieldOp { destination: Direct(3), op: IntegerDiv, lhs: Direct(0), rhs: Direct(2) }, BinaryFieldOp { destination: Direct(4), op: Mul, lhs: Direct(3), rhs: Direct(2) }, BinaryFieldOp { destination: Direct(4), op: Sub, lhs: Direct(0), rhs: Direct(4) }, Store { destination_pointer: Direct(9), source: Direct(4) }, BinaryIntOp { destination: Direct(9), op: Add, bit_size: U32, lhs: Direct(9), rhs: Direct(6) }, Mov { destination: Direct(0), source: Direct(3) }, BinaryIntOp { destination: Direct(8), op: LessThan, bit_size: U32, lhs: Direct(9), rhs: Direct(7) }, JumpIf { condition: Direct(8), location: 7 }, Const { destination: Direct(9), bit_size: Integer(U32), value: 10 }, Stop { return_data: HeapVector { pointer: Direct(9), size: Direct(1) } }]" ], - "debug_symbols": "pZZRjuMgDIbvwnMesA0EepXRqErbzChSlFaZdqRV1bsvBJO2WoVFyQsuJv9HMcbyXZzaw+173w1f5x+x+7iLw9j1ffe978/H5tqdB++9CxkGMGKHlYA6Git25I0TO1UJ9F+ox6MSSba/jm0bVC8cT780YztcxW649X0lfpv+Nn30c2mGyV6b0a/KSrTDyVsP/Or6Nvx6VE+1XJZaiSy2aGY51G96WNYbpVhvNK3RW0h6a1fp0+Frubh/5vxgHOsRn+HT7/HTy3o165XVS3qT2R/nAAIafJ7Alv4DbVIEdE0rTmCUTTdg1kSghvkGENfoNaUMlIt6yKQAok0nQHpNYveOwAzCYroFtBoWEZRJBJBzJoDGVQik9BgUGrcOgXozAuoSRC6cbo4FOliFIJAprQiA1iEUzAgH2xFqCZGrL7r+f33J6FHLOZL1kh5pY3nIAYrqQw5QVCCygJIKgfXmCoF2c4VAt7lCZBFlFSKPKKoQeURRhciGs6xC5BCFz7scseZ505zbRO/P89PPmmM3/tMY+tDBNOI00jSqadR+a59lJjQwlaijsdG4uAYyTsEz0O8NyH5iv2Kr2RpeZ1poQycd85B5CGyRLfE681BHHYam1ldM9DwK89DW+ueJLlqS0U/Ac88jn3BE7Ffs12wN+2ueW/7eRb+S0a+Yp5D9xHMVv1eBF27gtxm75tC3IdzhQm7DMUXfT69/LmklNe6X8XxsT7exDTf10r378cO/eXSfj3CbfwE=", + "debug_symbols": "pZbbjuIwDIbfJde9qJ0zrzIaoQKdUaWqoA6MtEK8+zqNU0CrZqP2JiZO/y/Ejq3cxak93L733fB1/hG7j7s4jF3fd9/7/nxsrt15IO9d1GEAI3ZYCbDROLGTZLzYqUogfaEej0ok2f46tm1QvXCIfmnGdriK3XDr+0r8Nv1t+ujn0gyTvTYjrdaVaIcTWQJ+dX0bfj2qp7pelroaWezQzHKwb3pY1hulWG+0XKN3kPTOrdKnw9t6cf/M+cF41iM+w6ff46eX9WrWK6eX9CazP84BBDT4PIEr/QfapAhoK1ecwCg9Z9Cu0NvapgyAX6PXcwb9oh4yVwDRuZRD+XqJ/TsCMwiHKQvoNCwiZOYiQD3fBNC4CoEyFYNC49chUG9GgC1B5MLp51igh1UICXW6FhJArkMomBEetiPUEiLXX7T9f3/J6HGuDvSL1YlyY3vIAYr6Qw5Q1CCygJIOgXZzh0C3uUOg39whsoiyDpFHFHWIPKKoQ2TDWdYhcojC8i5HrClvalMJIN+L45NmzbEb/3kYUuhgGnEa5TSqadS0Nd0yEx4wlbDRuGh8XIM6ToEYSHsDsl+yX7HVbA2vMy08Qycd85B5CGyRreR15qGOOgyPWuqYSDwZ5uFZS7WLPlpZR78EnhNP0oWTkv2K/ZqtYb/luePvffSrOvoV8xSyX/Jcxe9V4IUM/DZj1xz6NoQ7JOQ2HFP0aXr9c0kr6eF+Gc/H9nQb25Cpl9c7jR9U8+g/HyGbfwE=", "file_map": { "17": { "source": "use crate::field::field_less_than;\nuse crate::runtime::is_unconstrained;\n\n// The low and high decomposition of the field modulus\nglobal PLO: Field = 53438638232309528389504892708671455233;\nglobal PHI: Field = 64323764613183177041862057485226039389;\n\npub(crate) global TWO_POW_128: Field = 0x100000000000000000000000000000000;\n\n// Decomposes a single field into two 16 byte fields.\nfn compute_decomposition(x: Field) -> (Field, Field) {\n // Here's we're taking advantage of truncating 128 bit limbs from the input field\n // and then subtracting them from the input such the field division is equivalent to integer division.\n let low = (x as u128) as Field;\n let high = (x - low) / TWO_POW_128;\n\n (low, high)\n}\n\npub(crate) unconstrained fn decompose_hint(x: Field) -> (Field, Field) {\n compute_decomposition(x)\n}\n\nunconstrained fn lte_hint(x: Field, y: Field) -> bool {\n if x == y {\n true\n } else {\n field_less_than(x, y)\n }\n}\n\n// Assert that (alo > blo && ahi >= bhi) || (alo <= blo && ahi > bhi)\nfn assert_gt_limbs(a: (Field, Field), b: (Field, Field)) {\n let (alo, ahi) = a;\n let (blo, bhi) = b;\n // Safety: borrow is enforced to be boolean due to its type.\n // if borrow is 0, it asserts that (alo > blo && ahi >= bhi)\n // if borrow is 1, it asserts that (alo <= blo && ahi > bhi)\n unsafe {\n let borrow = lte_hint(alo, blo);\n\n let rlo = alo - blo - 1 + (borrow as Field) * TWO_POW_128;\n let rhi = ahi - bhi - (borrow as Field);\n\n rlo.assert_max_bit_size::<128>();\n rhi.assert_max_bit_size::<128>();\n }\n}\n\n/// Decompose a single field into two 16 byte fields.\npub fn decompose(x: Field) -> (Field, Field) {\n if is_unconstrained() {\n compute_decomposition(x)\n } else {\n // Safety: decomposition is properly checked below\n unsafe {\n // Take hints of the decomposition\n let (xlo, xhi) = decompose_hint(x);\n\n // Range check the limbs\n xlo.assert_max_bit_size::<128>();\n xhi.assert_max_bit_size::<128>();\n\n // Check that the decomposition is correct\n assert_eq(x, xlo + TWO_POW_128 * xhi);\n\n // Assert that the decomposition of P is greater than the decomposition of x\n assert_gt_limbs((PLO, PHI), (xlo, xhi));\n (xlo, xhi)\n }\n }\n}\n\npub fn assert_gt(a: Field, b: Field) {\n if is_unconstrained() {\n assert(\n // Safety: already unconstrained\n unsafe { field_less_than(b, a) },\n );\n } else {\n // Decompose a and b\n let a_limbs = decompose(a);\n let b_limbs = decompose(b);\n\n // Assert that a_limbs is greater than b_limbs\n assert_gt_limbs(a_limbs, b_limbs)\n }\n}\n\npub fn assert_lt(a: Field, b: Field) {\n assert_gt(b, a);\n}\n\npub fn gt(a: Field, b: Field) -> bool {\n if is_unconstrained() {\n // Safety: unsafe in unconstrained\n unsafe {\n field_less_than(b, a)\n }\n } else if a == b {\n false\n } else {\n // Safety: Take a hint of the comparison and verify it\n unsafe {\n if field_less_than(a, b) {\n assert_gt(b, a);\n false\n } else {\n assert_gt(a, b);\n true\n }\n }\n }\n}\n\npub fn lt(a: Field, b: Field) -> bool {\n gt(b, a)\n}\n\nmod tests {\n // TODO: Allow imports from \"super\"\n use crate::field::bn254::{assert_gt, decompose, gt, lte_hint, PHI, PLO, TWO_POW_128};\n\n #[test]\n fn check_decompose() {\n assert_eq(decompose(TWO_POW_128), (0, 1));\n assert_eq(decompose(TWO_POW_128 + 0x1234567890), (0x1234567890, 1));\n assert_eq(decompose(0x1234567890), (0x1234567890, 0));\n }\n\n #[test]\n unconstrained fn check_decompose_unconstrained() {\n assert_eq(decompose(TWO_POW_128), (0, 1));\n assert_eq(decompose(TWO_POW_128 + 0x1234567890), (0x1234567890, 1));\n assert_eq(decompose(0x1234567890), (0x1234567890, 0));\n }\n\n #[test]\n unconstrained fn check_lte_hint() {\n assert(lte_hint(0, 1));\n assert(lte_hint(0, 0x100));\n assert(lte_hint(0x100, TWO_POW_128 - 1));\n assert(!lte_hint(0 - 1, 0));\n\n assert(lte_hint(0, 0));\n assert(lte_hint(0x100, 0x100));\n assert(lte_hint(0 - 1, 0 - 1));\n }\n\n #[test]\n fn check_assert_gt() {\n assert_gt(1, 0);\n assert_gt(0x100, 0);\n assert_gt((0 - 1), (0 - 2));\n assert_gt(TWO_POW_128, 0);\n assert_gt(0 - 1, 0);\n }\n\n #[test]\n unconstrained fn check_assert_gt_unconstrained() {\n assert_gt(1, 0);\n assert_gt(0x100, 0);\n assert_gt((0 - 1), (0 - 2));\n assert_gt(TWO_POW_128, 0);\n assert_gt(0 - 1, 0);\n }\n\n #[test]\n fn check_gt() {\n assert(gt(1, 0));\n assert(gt(0x100, 0));\n assert(gt((0 - 1), (0 - 2)));\n assert(gt(TWO_POW_128, 0));\n assert(!gt(0, 0));\n assert(!gt(0, 0x100));\n assert(gt(0 - 1, 0 - 2));\n assert(!gt(0 - 2, 0 - 1));\n }\n\n #[test]\n unconstrained fn check_gt_unconstrained() {\n assert(gt(1, 0));\n assert(gt(0x100, 0));\n assert(gt((0 - 1), (0 - 2)));\n assert(gt(TWO_POW_128, 0));\n assert(!gt(0, 0));\n assert(!gt(0, 0x100));\n assert(gt(0 - 1, 0 - 2));\n assert(!gt(0 - 2, 0 - 1));\n }\n\n #[test]\n fn check_plo_phi() {\n assert_eq(PLO + PHI * TWO_POW_128, 0);\n let p_bytes = crate::field::modulus_le_bytes();\n let mut p_low: Field = 0;\n let mut p_high: Field = 0;\n\n let mut offset = 1;\n for i in 0..16 {\n p_low += (p_bytes[i] as Field) * offset;\n p_high += (p_bytes[i + 16] as Field) * offset;\n offset *= 256;\n }\n assert_eq(p_low, PLO);\n assert_eq(p_high, PHI);\n }\n}\n", @@ -134,7 +134,7 @@ expression: artifact "path": "std/hash/mod.nr" }, "50": { - "source": "fn main(\n old_root: Field,\n old_leaf: Field,\n old_hash_path: [Field; 3],\n new_root: pub Field,\n leaf: Field,\n index: Field,\n) {\n assert(old_root == compute_merkle_root(old_leaf, index, old_hash_path));\n\n let calculated_root = compute_merkle_root(leaf, index, old_hash_path);\n assert(new_root == calculated_root);\n}\n\nfn compute_merkle_root(leaf: Field, index: Field, hash_path: [Field; N]) -> Field {\n let index_bits: [u1; N] = index.to_le_bits();\n let mut current = leaf;\n for i in 0..N {\n let path_bit = index_bits[i] as bool;\n let (hash_left, hash_right) = if path_bit {\n (hash_path[i], current)\n } else {\n (current, hash_path[i])\n };\n current = std::hash::pedersen_hash([hash_left, hash_right]);\n }\n current\n}\n", + "source": "fn main(\n old_root: Field,\n old_leaf: Field,\n old_hash_path: [Field; 3],\n new_root: pub Field,\n leaf: Field,\n index: Field,\n) {\n assert(old_root == compute_merkle_root(old_leaf, index, old_hash_path));\n\n let calculated_root = compute_merkle_root(leaf, index, old_hash_path);\n assert(new_root == calculated_root);\n}\n\nfn compute_merkle_root(leaf: Field, index: Field, hash_path: [Field; N]) -> Field {\n let index_bits: [u1; N] = index.to_le_bits();\n let mut current = leaf;\n for i in 0..N {\n let path_bit = index_bits[i] != 0;\n let (hash_left, hash_right) = if path_bit {\n (hash_path[i], current)\n } else {\n (current, hash_path[i])\n };\n current = std::hash::pedersen_hash([hash_left, hash_right]);\n }\n current\n}\n", "path": "" } }, diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/merkle_insert/execute__tests__force_brillig_false_inliner_0.snap b/tooling/nargo_cli/tests/snapshots/execution_success/merkle_insert/execute__tests__force_brillig_false_inliner_0.snap index 7d35461fbc5..ec0887864d7 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/merkle_insert/execute__tests__force_brillig_false_inliner_0.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/merkle_insert/execute__tests__force_brillig_false_inliner_0.snap @@ -119,7 +119,7 @@ expression: artifact "unconstrained func 1", "[Const { destination: Direct(5), bit_size: Integer(U32), value: 0 }, Const { destination: Direct(6), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(7), bit_size: Integer(U32), value: 3 }, CalldataCopy { destination_address: Direct(0), size_address: Direct(7), offset_address: Direct(5) }, Cast { destination: Direct(1), source: Direct(1), bit_size: Integer(U32) }, Const { destination: Direct(9), bit_size: Integer(U32), value: 10 }, BinaryIntOp { destination: Direct(7), op: Add, bit_size: U32, lhs: Direct(9), rhs: Direct(1) }, BinaryFieldOp { destination: Direct(3), op: IntegerDiv, lhs: Direct(0), rhs: Direct(2) }, BinaryFieldOp { destination: Direct(4), op: Mul, lhs: Direct(3), rhs: Direct(2) }, BinaryFieldOp { destination: Direct(4), op: Sub, lhs: Direct(0), rhs: Direct(4) }, Store { destination_pointer: Direct(9), source: Direct(4) }, BinaryIntOp { destination: Direct(9), op: Add, bit_size: U32, lhs: Direct(9), rhs: Direct(6) }, Mov { destination: Direct(0), source: Direct(3) }, BinaryIntOp { destination: Direct(8), op: LessThan, bit_size: U32, lhs: Direct(9), rhs: Direct(7) }, JumpIf { condition: Direct(8), location: 7 }, Const { destination: Direct(9), bit_size: Integer(U32), value: 10 }, Stop { return_data: HeapVector { pointer: Direct(9), size: Direct(1) } }]" ], - "debug_symbols": "pZZRjuMgDIbvwnMesA0EepXRqErbzChSlFaZdqRV1bsvBJO2WoVFyQsuJv9HMcbyXZzaw+173w1f5x+x+7iLw9j1ffe978/H5tqdB++9CxkGMGKHlYA6Git25I0TO1UJ9F+ox6MSSba/jm0bVC8cT780YztcxW649X0lfpv+Nn30c2mGyV6b0a/KSrTDyVsP/Or6Nvx6VE+1XJZaiSy2aGY51G96WNYbpVhvNK3RW0h6a1fp0+Frubh/5vxgHOsRn+HT7/HTy3o165XVS3qT2R/nAAIafJ7Alv4DbVIEdE0rTmCUTTdg1kSghvkGENfoNaUMlIt6yKQAok0nQHpNYveOwAzCYroFtBoWEZRJBJBzJoDGVQik9BgUGrcOgXozAuoSRC6cbo4FOliFIJAprQiA1iEUzAgH2xFqCZGrL7r+f33J6FHLOZL1kh5pY3nIAYrqQw5QVCCygJIKgfXmCoF2c4VAt7lCZBFlFSKPKKoQeURRhciGs6xC5BCFz7scseZ505zbRO/P89PPmmM3/tMY+tDBNOI00jSqadR+a59lJjQwlaijsdG4uAYyTsEz0O8NyH5iv2Kr2RpeZ1poQycd85B5CGyRLfE681BHHYam1ldM9DwK89DW+ueJLlqS0U/Ac88jn3BE7Ffs12wN+2ueW/7eRb+S0a+Yp5D9xHMVv1eBF27gtxm75tC3IdzhQm7DMUXfT69/LmklNe6X8XxsT7exDTf10r378cO/eXSfj3CbfwE=", + "debug_symbols": "pZbbjuIwDIbfJde9qJ0zrzIaoQKdUaWqoA6MtEK8+zqNU0CrZqP2JiZO/y/Ejq3cxak93L733fB1/hG7j7s4jF3fd9/7/nxsrt15IO9d1GEAI3ZYCbDROLGTZLzYqUogfaEej0ok2f46tm1QvXCIfmnGdriK3XDr+0r8Nv1t+ujn0gyTvTYjrdaVaIcTWQJ+dX0bfj2qp7pelroaWezQzHKwb3pY1hulWG+0XKN3kPTOrdKnw9t6cf/M+cF41iM+w6ff46eX9WrWK6eX9CazP84BBDT4PIEr/QfapAhoK1ecwCg9Z9Cu0NvapgyAX6PXcwb9oh4yVwDRuZRD+XqJ/TsCMwiHKQvoNCwiZOYiQD3fBNC4CoEyFYNC49chUG9GgC1B5MLp51igh1UICXW6FhJArkMomBEetiPUEiLXX7T9f3/J6HGuDvSL1YlyY3vIAYr6Qw5Q1CCygJIOgXZzh0C3uUOg39whsoiyDpFHFHWIPKKoQ2TDWdYhcojC8i5HrClvalMJIN+L45NmzbEb/3kYUuhgGnEa5TSqadS0Nd0yEx4wlbDRuGh8XIM6ToEYSHsDsl+yX7HVbA2vMy08Qycd85B5CGyRreR15qGOOgyPWuqYSDwZ5uFZS7WLPlpZR78EnhNP0oWTkv2K/ZqtYb/luePvffSrOvoV8xSyX/Jcxe9V4IUM/DZj1xz6NoQ7JOQ2HFP0aXr9c0kr6eF+Gc/H9nQb25Cpl9c7jR9U8+g/HyGbfwE=", "file_map": { "17": { "source": "use crate::field::field_less_than;\nuse crate::runtime::is_unconstrained;\n\n// The low and high decomposition of the field modulus\nglobal PLO: Field = 53438638232309528389504892708671455233;\nglobal PHI: Field = 64323764613183177041862057485226039389;\n\npub(crate) global TWO_POW_128: Field = 0x100000000000000000000000000000000;\n\n// Decomposes a single field into two 16 byte fields.\nfn compute_decomposition(x: Field) -> (Field, Field) {\n // Here's we're taking advantage of truncating 128 bit limbs from the input field\n // and then subtracting them from the input such the field division is equivalent to integer division.\n let low = (x as u128) as Field;\n let high = (x - low) / TWO_POW_128;\n\n (low, high)\n}\n\npub(crate) unconstrained fn decompose_hint(x: Field) -> (Field, Field) {\n compute_decomposition(x)\n}\n\nunconstrained fn lte_hint(x: Field, y: Field) -> bool {\n if x == y {\n true\n } else {\n field_less_than(x, y)\n }\n}\n\n// Assert that (alo > blo && ahi >= bhi) || (alo <= blo && ahi > bhi)\nfn assert_gt_limbs(a: (Field, Field), b: (Field, Field)) {\n let (alo, ahi) = a;\n let (blo, bhi) = b;\n // Safety: borrow is enforced to be boolean due to its type.\n // if borrow is 0, it asserts that (alo > blo && ahi >= bhi)\n // if borrow is 1, it asserts that (alo <= blo && ahi > bhi)\n unsafe {\n let borrow = lte_hint(alo, blo);\n\n let rlo = alo - blo - 1 + (borrow as Field) * TWO_POW_128;\n let rhi = ahi - bhi - (borrow as Field);\n\n rlo.assert_max_bit_size::<128>();\n rhi.assert_max_bit_size::<128>();\n }\n}\n\n/// Decompose a single field into two 16 byte fields.\npub fn decompose(x: Field) -> (Field, Field) {\n if is_unconstrained() {\n compute_decomposition(x)\n } else {\n // Safety: decomposition is properly checked below\n unsafe {\n // Take hints of the decomposition\n let (xlo, xhi) = decompose_hint(x);\n\n // Range check the limbs\n xlo.assert_max_bit_size::<128>();\n xhi.assert_max_bit_size::<128>();\n\n // Check that the decomposition is correct\n assert_eq(x, xlo + TWO_POW_128 * xhi);\n\n // Assert that the decomposition of P is greater than the decomposition of x\n assert_gt_limbs((PLO, PHI), (xlo, xhi));\n (xlo, xhi)\n }\n }\n}\n\npub fn assert_gt(a: Field, b: Field) {\n if is_unconstrained() {\n assert(\n // Safety: already unconstrained\n unsafe { field_less_than(b, a) },\n );\n } else {\n // Decompose a and b\n let a_limbs = decompose(a);\n let b_limbs = decompose(b);\n\n // Assert that a_limbs is greater than b_limbs\n assert_gt_limbs(a_limbs, b_limbs)\n }\n}\n\npub fn assert_lt(a: Field, b: Field) {\n assert_gt(b, a);\n}\n\npub fn gt(a: Field, b: Field) -> bool {\n if is_unconstrained() {\n // Safety: unsafe in unconstrained\n unsafe {\n field_less_than(b, a)\n }\n } else if a == b {\n false\n } else {\n // Safety: Take a hint of the comparison and verify it\n unsafe {\n if field_less_than(a, b) {\n assert_gt(b, a);\n false\n } else {\n assert_gt(a, b);\n true\n }\n }\n }\n}\n\npub fn lt(a: Field, b: Field) -> bool {\n gt(b, a)\n}\n\nmod tests {\n // TODO: Allow imports from \"super\"\n use crate::field::bn254::{assert_gt, decompose, gt, lte_hint, PHI, PLO, TWO_POW_128};\n\n #[test]\n fn check_decompose() {\n assert_eq(decompose(TWO_POW_128), (0, 1));\n assert_eq(decompose(TWO_POW_128 + 0x1234567890), (0x1234567890, 1));\n assert_eq(decompose(0x1234567890), (0x1234567890, 0));\n }\n\n #[test]\n unconstrained fn check_decompose_unconstrained() {\n assert_eq(decompose(TWO_POW_128), (0, 1));\n assert_eq(decompose(TWO_POW_128 + 0x1234567890), (0x1234567890, 1));\n assert_eq(decompose(0x1234567890), (0x1234567890, 0));\n }\n\n #[test]\n unconstrained fn check_lte_hint() {\n assert(lte_hint(0, 1));\n assert(lte_hint(0, 0x100));\n assert(lte_hint(0x100, TWO_POW_128 - 1));\n assert(!lte_hint(0 - 1, 0));\n\n assert(lte_hint(0, 0));\n assert(lte_hint(0x100, 0x100));\n assert(lte_hint(0 - 1, 0 - 1));\n }\n\n #[test]\n fn check_assert_gt() {\n assert_gt(1, 0);\n assert_gt(0x100, 0);\n assert_gt((0 - 1), (0 - 2));\n assert_gt(TWO_POW_128, 0);\n assert_gt(0 - 1, 0);\n }\n\n #[test]\n unconstrained fn check_assert_gt_unconstrained() {\n assert_gt(1, 0);\n assert_gt(0x100, 0);\n assert_gt((0 - 1), (0 - 2));\n assert_gt(TWO_POW_128, 0);\n assert_gt(0 - 1, 0);\n }\n\n #[test]\n fn check_gt() {\n assert(gt(1, 0));\n assert(gt(0x100, 0));\n assert(gt((0 - 1), (0 - 2)));\n assert(gt(TWO_POW_128, 0));\n assert(!gt(0, 0));\n assert(!gt(0, 0x100));\n assert(gt(0 - 1, 0 - 2));\n assert(!gt(0 - 2, 0 - 1));\n }\n\n #[test]\n unconstrained fn check_gt_unconstrained() {\n assert(gt(1, 0));\n assert(gt(0x100, 0));\n assert(gt((0 - 1), (0 - 2)));\n assert(gt(TWO_POW_128, 0));\n assert(!gt(0, 0));\n assert(!gt(0, 0x100));\n assert(gt(0 - 1, 0 - 2));\n assert(!gt(0 - 2, 0 - 1));\n }\n\n #[test]\n fn check_plo_phi() {\n assert_eq(PLO + PHI * TWO_POW_128, 0);\n let p_bytes = crate::field::modulus_le_bytes();\n let mut p_low: Field = 0;\n let mut p_high: Field = 0;\n\n let mut offset = 1;\n for i in 0..16 {\n p_low += (p_bytes[i] as Field) * offset;\n p_high += (p_bytes[i + 16] as Field) * offset;\n offset *= 256;\n }\n assert_eq(p_low, PLO);\n assert_eq(p_high, PHI);\n }\n}\n", @@ -134,7 +134,7 @@ expression: artifact "path": "std/hash/mod.nr" }, "50": { - "source": "fn main(\n old_root: Field,\n old_leaf: Field,\n old_hash_path: [Field; 3],\n new_root: pub Field,\n leaf: Field,\n index: Field,\n) {\n assert(old_root == compute_merkle_root(old_leaf, index, old_hash_path));\n\n let calculated_root = compute_merkle_root(leaf, index, old_hash_path);\n assert(new_root == calculated_root);\n}\n\nfn compute_merkle_root(leaf: Field, index: Field, hash_path: [Field; N]) -> Field {\n let index_bits: [u1; N] = index.to_le_bits();\n let mut current = leaf;\n for i in 0..N {\n let path_bit = index_bits[i] as bool;\n let (hash_left, hash_right) = if path_bit {\n (hash_path[i], current)\n } else {\n (current, hash_path[i])\n };\n current = std::hash::pedersen_hash([hash_left, hash_right]);\n }\n current\n}\n", + "source": "fn main(\n old_root: Field,\n old_leaf: Field,\n old_hash_path: [Field; 3],\n new_root: pub Field,\n leaf: Field,\n index: Field,\n) {\n assert(old_root == compute_merkle_root(old_leaf, index, old_hash_path));\n\n let calculated_root = compute_merkle_root(leaf, index, old_hash_path);\n assert(new_root == calculated_root);\n}\n\nfn compute_merkle_root(leaf: Field, index: Field, hash_path: [Field; N]) -> Field {\n let index_bits: [u1; N] = index.to_le_bits();\n let mut current = leaf;\n for i in 0..N {\n let path_bit = index_bits[i] != 0;\n let (hash_left, hash_right) = if path_bit {\n (hash_path[i], current)\n } else {\n (current, hash_path[i])\n };\n current = std::hash::pedersen_hash([hash_left, hash_right]);\n }\n current\n}\n", "path": "" } }, diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/merkle_insert/execute__tests__force_brillig_false_inliner_9223372036854775807.snap b/tooling/nargo_cli/tests/snapshots/execution_success/merkle_insert/execute__tests__force_brillig_false_inliner_9223372036854775807.snap index 7d35461fbc5..ec0887864d7 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/merkle_insert/execute__tests__force_brillig_false_inliner_9223372036854775807.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/merkle_insert/execute__tests__force_brillig_false_inliner_9223372036854775807.snap @@ -119,7 +119,7 @@ expression: artifact "unconstrained func 1", "[Const { destination: Direct(5), bit_size: Integer(U32), value: 0 }, Const { destination: Direct(6), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(7), bit_size: Integer(U32), value: 3 }, CalldataCopy { destination_address: Direct(0), size_address: Direct(7), offset_address: Direct(5) }, Cast { destination: Direct(1), source: Direct(1), bit_size: Integer(U32) }, Const { destination: Direct(9), bit_size: Integer(U32), value: 10 }, BinaryIntOp { destination: Direct(7), op: Add, bit_size: U32, lhs: Direct(9), rhs: Direct(1) }, BinaryFieldOp { destination: Direct(3), op: IntegerDiv, lhs: Direct(0), rhs: Direct(2) }, BinaryFieldOp { destination: Direct(4), op: Mul, lhs: Direct(3), rhs: Direct(2) }, BinaryFieldOp { destination: Direct(4), op: Sub, lhs: Direct(0), rhs: Direct(4) }, Store { destination_pointer: Direct(9), source: Direct(4) }, BinaryIntOp { destination: Direct(9), op: Add, bit_size: U32, lhs: Direct(9), rhs: Direct(6) }, Mov { destination: Direct(0), source: Direct(3) }, BinaryIntOp { destination: Direct(8), op: LessThan, bit_size: U32, lhs: Direct(9), rhs: Direct(7) }, JumpIf { condition: Direct(8), location: 7 }, Const { destination: Direct(9), bit_size: Integer(U32), value: 10 }, Stop { return_data: HeapVector { pointer: Direct(9), size: Direct(1) } }]" ], - "debug_symbols": "pZZRjuMgDIbvwnMesA0EepXRqErbzChSlFaZdqRV1bsvBJO2WoVFyQsuJv9HMcbyXZzaw+173w1f5x+x+7iLw9j1ffe978/H5tqdB++9CxkGMGKHlYA6Git25I0TO1UJ9F+ox6MSSba/jm0bVC8cT780YztcxW649X0lfpv+Nn30c2mGyV6b0a/KSrTDyVsP/Or6Nvx6VE+1XJZaiSy2aGY51G96WNYbpVhvNK3RW0h6a1fp0+Frubh/5vxgHOsRn+HT7/HTy3o165XVS3qT2R/nAAIafJ7Alv4DbVIEdE0rTmCUTTdg1kSghvkGENfoNaUMlIt6yKQAok0nQHpNYveOwAzCYroFtBoWEZRJBJBzJoDGVQik9BgUGrcOgXozAuoSRC6cbo4FOliFIJAprQiA1iEUzAgH2xFqCZGrL7r+f33J6FHLOZL1kh5pY3nIAYrqQw5QVCCygJIKgfXmCoF2c4VAt7lCZBFlFSKPKKoQeURRhciGs6xC5BCFz7scseZ505zbRO/P89PPmmM3/tMY+tDBNOI00jSqadR+a59lJjQwlaijsdG4uAYyTsEz0O8NyH5iv2Kr2RpeZ1poQycd85B5CGyRLfE681BHHYam1ldM9DwK89DW+ueJLlqS0U/Ac88jn3BE7Ffs12wN+2ueW/7eRb+S0a+Yp5D9xHMVv1eBF27gtxm75tC3IdzhQm7DMUXfT69/LmklNe6X8XxsT7exDTf10r378cO/eXSfj3CbfwE=", + "debug_symbols": "pZbbjuIwDIbfJde9qJ0zrzIaoQKdUaWqoA6MtEK8+zqNU0CrZqP2JiZO/y/Ejq3cxak93L733fB1/hG7j7s4jF3fd9/7/nxsrt15IO9d1GEAI3ZYCbDROLGTZLzYqUogfaEej0ok2f46tm1QvXCIfmnGdriK3XDr+0r8Nv1t+ujn0gyTvTYjrdaVaIcTWQJ+dX0bfj2qp7pelroaWezQzHKwb3pY1hulWG+0XKN3kPTOrdKnw9t6cf/M+cF41iM+w6ff46eX9WrWK6eX9CazP84BBDT4PIEr/QfapAhoK1ecwCg9Z9Cu0NvapgyAX6PXcwb9oh4yVwDRuZRD+XqJ/TsCMwiHKQvoNCwiZOYiQD3fBNC4CoEyFYNC49chUG9GgC1B5MLp51igh1UICXW6FhJArkMomBEetiPUEiLXX7T9f3/J6HGuDvSL1YlyY3vIAYr6Qw5Q1CCygJIOgXZzh0C3uUOg39whsoiyDpFHFHWIPKKoQ2TDWdYhcojC8i5HrClvalMJIN+L45NmzbEb/3kYUuhgGnEa5TSqadS0Nd0yEx4wlbDRuGh8XIM6ToEYSHsDsl+yX7HVbA2vMy08Qycd85B5CGyRreR15qGOOgyPWuqYSDwZ5uFZS7WLPlpZR78EnhNP0oWTkv2K/ZqtYb/luePvffSrOvoV8xSyX/Jcxe9V4IUM/DZj1xz6NoQ7JOQ2HFP0aXr9c0kr6eF+Gc/H9nQb25Cpl9c7jR9U8+g/HyGbfwE=", "file_map": { "17": { "source": "use crate::field::field_less_than;\nuse crate::runtime::is_unconstrained;\n\n// The low and high decomposition of the field modulus\nglobal PLO: Field = 53438638232309528389504892708671455233;\nglobal PHI: Field = 64323764613183177041862057485226039389;\n\npub(crate) global TWO_POW_128: Field = 0x100000000000000000000000000000000;\n\n// Decomposes a single field into two 16 byte fields.\nfn compute_decomposition(x: Field) -> (Field, Field) {\n // Here's we're taking advantage of truncating 128 bit limbs from the input field\n // and then subtracting them from the input such the field division is equivalent to integer division.\n let low = (x as u128) as Field;\n let high = (x - low) / TWO_POW_128;\n\n (low, high)\n}\n\npub(crate) unconstrained fn decompose_hint(x: Field) -> (Field, Field) {\n compute_decomposition(x)\n}\n\nunconstrained fn lte_hint(x: Field, y: Field) -> bool {\n if x == y {\n true\n } else {\n field_less_than(x, y)\n }\n}\n\n// Assert that (alo > blo && ahi >= bhi) || (alo <= blo && ahi > bhi)\nfn assert_gt_limbs(a: (Field, Field), b: (Field, Field)) {\n let (alo, ahi) = a;\n let (blo, bhi) = b;\n // Safety: borrow is enforced to be boolean due to its type.\n // if borrow is 0, it asserts that (alo > blo && ahi >= bhi)\n // if borrow is 1, it asserts that (alo <= blo && ahi > bhi)\n unsafe {\n let borrow = lte_hint(alo, blo);\n\n let rlo = alo - blo - 1 + (borrow as Field) * TWO_POW_128;\n let rhi = ahi - bhi - (borrow as Field);\n\n rlo.assert_max_bit_size::<128>();\n rhi.assert_max_bit_size::<128>();\n }\n}\n\n/// Decompose a single field into two 16 byte fields.\npub fn decompose(x: Field) -> (Field, Field) {\n if is_unconstrained() {\n compute_decomposition(x)\n } else {\n // Safety: decomposition is properly checked below\n unsafe {\n // Take hints of the decomposition\n let (xlo, xhi) = decompose_hint(x);\n\n // Range check the limbs\n xlo.assert_max_bit_size::<128>();\n xhi.assert_max_bit_size::<128>();\n\n // Check that the decomposition is correct\n assert_eq(x, xlo + TWO_POW_128 * xhi);\n\n // Assert that the decomposition of P is greater than the decomposition of x\n assert_gt_limbs((PLO, PHI), (xlo, xhi));\n (xlo, xhi)\n }\n }\n}\n\npub fn assert_gt(a: Field, b: Field) {\n if is_unconstrained() {\n assert(\n // Safety: already unconstrained\n unsafe { field_less_than(b, a) },\n );\n } else {\n // Decompose a and b\n let a_limbs = decompose(a);\n let b_limbs = decompose(b);\n\n // Assert that a_limbs is greater than b_limbs\n assert_gt_limbs(a_limbs, b_limbs)\n }\n}\n\npub fn assert_lt(a: Field, b: Field) {\n assert_gt(b, a);\n}\n\npub fn gt(a: Field, b: Field) -> bool {\n if is_unconstrained() {\n // Safety: unsafe in unconstrained\n unsafe {\n field_less_than(b, a)\n }\n } else if a == b {\n false\n } else {\n // Safety: Take a hint of the comparison and verify it\n unsafe {\n if field_less_than(a, b) {\n assert_gt(b, a);\n false\n } else {\n assert_gt(a, b);\n true\n }\n }\n }\n}\n\npub fn lt(a: Field, b: Field) -> bool {\n gt(b, a)\n}\n\nmod tests {\n // TODO: Allow imports from \"super\"\n use crate::field::bn254::{assert_gt, decompose, gt, lte_hint, PHI, PLO, TWO_POW_128};\n\n #[test]\n fn check_decompose() {\n assert_eq(decompose(TWO_POW_128), (0, 1));\n assert_eq(decompose(TWO_POW_128 + 0x1234567890), (0x1234567890, 1));\n assert_eq(decompose(0x1234567890), (0x1234567890, 0));\n }\n\n #[test]\n unconstrained fn check_decompose_unconstrained() {\n assert_eq(decompose(TWO_POW_128), (0, 1));\n assert_eq(decompose(TWO_POW_128 + 0x1234567890), (0x1234567890, 1));\n assert_eq(decompose(0x1234567890), (0x1234567890, 0));\n }\n\n #[test]\n unconstrained fn check_lte_hint() {\n assert(lte_hint(0, 1));\n assert(lte_hint(0, 0x100));\n assert(lte_hint(0x100, TWO_POW_128 - 1));\n assert(!lte_hint(0 - 1, 0));\n\n assert(lte_hint(0, 0));\n assert(lte_hint(0x100, 0x100));\n assert(lte_hint(0 - 1, 0 - 1));\n }\n\n #[test]\n fn check_assert_gt() {\n assert_gt(1, 0);\n assert_gt(0x100, 0);\n assert_gt((0 - 1), (0 - 2));\n assert_gt(TWO_POW_128, 0);\n assert_gt(0 - 1, 0);\n }\n\n #[test]\n unconstrained fn check_assert_gt_unconstrained() {\n assert_gt(1, 0);\n assert_gt(0x100, 0);\n assert_gt((0 - 1), (0 - 2));\n assert_gt(TWO_POW_128, 0);\n assert_gt(0 - 1, 0);\n }\n\n #[test]\n fn check_gt() {\n assert(gt(1, 0));\n assert(gt(0x100, 0));\n assert(gt((0 - 1), (0 - 2)));\n assert(gt(TWO_POW_128, 0));\n assert(!gt(0, 0));\n assert(!gt(0, 0x100));\n assert(gt(0 - 1, 0 - 2));\n assert(!gt(0 - 2, 0 - 1));\n }\n\n #[test]\n unconstrained fn check_gt_unconstrained() {\n assert(gt(1, 0));\n assert(gt(0x100, 0));\n assert(gt((0 - 1), (0 - 2)));\n assert(gt(TWO_POW_128, 0));\n assert(!gt(0, 0));\n assert(!gt(0, 0x100));\n assert(gt(0 - 1, 0 - 2));\n assert(!gt(0 - 2, 0 - 1));\n }\n\n #[test]\n fn check_plo_phi() {\n assert_eq(PLO + PHI * TWO_POW_128, 0);\n let p_bytes = crate::field::modulus_le_bytes();\n let mut p_low: Field = 0;\n let mut p_high: Field = 0;\n\n let mut offset = 1;\n for i in 0..16 {\n p_low += (p_bytes[i] as Field) * offset;\n p_high += (p_bytes[i + 16] as Field) * offset;\n offset *= 256;\n }\n assert_eq(p_low, PLO);\n assert_eq(p_high, PHI);\n }\n}\n", @@ -134,7 +134,7 @@ expression: artifact "path": "std/hash/mod.nr" }, "50": { - "source": "fn main(\n old_root: Field,\n old_leaf: Field,\n old_hash_path: [Field; 3],\n new_root: pub Field,\n leaf: Field,\n index: Field,\n) {\n assert(old_root == compute_merkle_root(old_leaf, index, old_hash_path));\n\n let calculated_root = compute_merkle_root(leaf, index, old_hash_path);\n assert(new_root == calculated_root);\n}\n\nfn compute_merkle_root(leaf: Field, index: Field, hash_path: [Field; N]) -> Field {\n let index_bits: [u1; N] = index.to_le_bits();\n let mut current = leaf;\n for i in 0..N {\n let path_bit = index_bits[i] as bool;\n let (hash_left, hash_right) = if path_bit {\n (hash_path[i], current)\n } else {\n (current, hash_path[i])\n };\n current = std::hash::pedersen_hash([hash_left, hash_right]);\n }\n current\n}\n", + "source": "fn main(\n old_root: Field,\n old_leaf: Field,\n old_hash_path: [Field; 3],\n new_root: pub Field,\n leaf: Field,\n index: Field,\n) {\n assert(old_root == compute_merkle_root(old_leaf, index, old_hash_path));\n\n let calculated_root = compute_merkle_root(leaf, index, old_hash_path);\n assert(new_root == calculated_root);\n}\n\nfn compute_merkle_root(leaf: Field, index: Field, hash_path: [Field; N]) -> Field {\n let index_bits: [u1; N] = index.to_le_bits();\n let mut current = leaf;\n for i in 0..N {\n let path_bit = index_bits[i] != 0;\n let (hash_left, hash_right) = if path_bit {\n (hash_path[i], current)\n } else {\n (current, hash_path[i])\n };\n current = std::hash::pedersen_hash([hash_left, hash_right]);\n }\n current\n}\n", "path": "" } }, diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/merkle_insert/execute__tests__force_brillig_true_inliner_-9223372036854775808.snap b/tooling/nargo_cli/tests/snapshots/execution_success/merkle_insert/execute__tests__force_brillig_true_inliner_-9223372036854775808.snap index 4534d7221e1..d5702a7f133 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/merkle_insert/execute__tests__force_brillig_true_inliner_-9223372036854775808.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/merkle_insert/execute__tests__force_brillig_true_inliner_-9223372036854775808.snap @@ -76,7 +76,7 @@ expression: artifact "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(7), bit_size: Integer(U32), value: 8 }, Const { destination: Relative(8), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(32836), size_address: Relative(7), offset_address: Relative(8) }, Mov { destination: Relative(1), source: Direct(32836) }, Mov { destination: Relative(2), source: Direct(32837) }, Const { destination: Relative(3), bit_size: Integer(U32), value: 32838 }, Const { destination: Relative(8), bit_size: Integer(U32), value: 3 }, Mov { destination: Relative(7), source: Direct(1) }, Const { destination: Relative(9), bit_size: Integer(U32), value: 4 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(9) }, IndirectConst { destination_pointer: Relative(7), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(9), op: Add, bit_size: U32, lhs: Relative(7), rhs: Direct(2) }, Mov { destination: Direct(32771), source: Relative(3) }, Mov { destination: Direct(32772), source: Relative(9) }, Mov { destination: Direct(32773), source: Relative(8) }, Call { location: 28 }, Mov { destination: Relative(3), source: Relative(7) }, Mov { destination: Relative(4), source: Direct(32841) }, Mov { destination: Relative(5), source: Direct(32842) }, Mov { destination: Relative(6), source: Direct(32843) }, Call { location: 39 }, Call { location: 41 }, Const { destination: Relative(1), bit_size: Integer(U32), value: 32844 }, Const { destination: Relative(2), bit_size: Integer(U32), value: 0 }, Stop { return_data: HeapVector { pointer: Relative(1), size: Relative(2) } }, BinaryIntOp { destination: Direct(32775), op: Add, bit_size: U32, lhs: Direct(32771), rhs: Direct(32773) }, Mov { destination: Direct(32776), source: Direct(32771) }, Mov { destination: Direct(32777), source: Direct(32772) }, BinaryIntOp { destination: Direct(32778), op: Equals, bit_size: U32, lhs: Direct(32776), rhs: Direct(32775) }, JumpIf { condition: Direct(32778), location: 38 }, Load { destination: Direct(32774), source_pointer: Direct(32776) }, Store { destination_pointer: Direct(32777), source: Direct(32774) }, BinaryIntOp { destination: Direct(32776), op: Add, bit_size: U32, lhs: Direct(32776), rhs: Direct(2) }, BinaryIntOp { destination: Direct(32777), op: Add, bit_size: U32, lhs: Direct(32777), rhs: Direct(2) }, Jump { location: 31 }, Return, Const { destination: Direct(32835), bit_size: Field, value: 340282366920938463463374607431768211456 }, Return, Call { location: 77 }, Load { destination: Relative(7), source_pointer: Relative(3) }, Const { destination: Relative(8), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(9), op: Equals, bit_size: U32, lhs: Relative(8), rhs: Relative(7) }, Not { destination: Relative(9), source: Relative(9), bit_size: U1 }, JumpIf { condition: Relative(9), location: 48 }, Call { location: 83 }, BinaryIntOp { destination: Relative(7), op: Add, bit_size: U32, lhs: Relative(7), rhs: Direct(2) }, Store { destination_pointer: Relative(3), source: Relative(7) }, Const { destination: Relative(9), bit_size: Integer(U32), value: 10 }, Mov { destination: Relative(10), source: Direct(0) }, Mov { destination: Relative(11), source: Relative(2) }, Mov { destination: Relative(12), source: Relative(6) }, Mov { destination: Relative(13), source: Relative(3) }, BinaryIntOp { destination: Direct(0), op: Add, bit_size: U32, lhs: Direct(0), rhs: Relative(9) }, Call { location: 86 }, Mov { destination: Direct(0), source: Relative(0) }, Mov { destination: Relative(7), source: Relative(11) }, BinaryFieldOp { destination: Relative(2), op: Equals, lhs: Relative(1), rhs: Relative(7) }, JumpIf { condition: Relative(2), location: 63 }, Const { destination: Relative(9), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(9) } }, Const { destination: Relative(2), bit_size: Integer(U32), value: 9 }, Mov { destination: Relative(9), source: Direct(0) }, Mov { destination: Relative(10), source: Relative(5) }, Mov { destination: Relative(11), source: Relative(6) }, Mov { destination: Relative(12), source: Relative(3) }, BinaryIntOp { destination: Direct(0), op: Add, bit_size: U32, lhs: Direct(0), rhs: Relative(2) }, Call { location: 86 }, Mov { destination: Direct(0), source: Relative(0) }, Mov { destination: Relative(1), source: Relative(10) }, BinaryFieldOp { destination: Relative(2), op: Equals, lhs: Relative(4), rhs: Relative(1) }, JumpIf { condition: Relative(2), location: 76 }, Const { destination: Relative(3), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(3) } }, Return, Const { destination: Direct(32772), bit_size: Integer(U32), value: 30720 }, BinaryIntOp { destination: Direct(32771), op: LessThan, bit_size: U32, lhs: Direct(0), rhs: Direct(32772) }, JumpIf { condition: Direct(32771), location: 82 }, 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, Call { location: 77 }, Const { destination: Relative(6), bit_size: Integer(U32), value: 2 }, Const { destination: Relative(7), bit_size: Integer(U1), value: 1 }, Mov { destination: Relative(5), source: Direct(1) }, Const { destination: Relative(8), bit_size: Integer(U32), value: 4 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(8) }, IndirectConst { destination_pointer: Relative(5), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(8), op: Add, bit_size: U32, lhs: Relative(5), rhs: Direct(2) }, Const { destination: Relative(9), bit_size: Integer(U32), value: 3 }, BlackBox(ToRadix { input: Relative(2), radix: Relative(6), output_pointer: Relative(8), num_limbs: Relative(9), output_bits: Relative(7) }), Const { destination: Relative(10), bit_size: Integer(U32), value: 3 }, Mov { destination: Direct(32771), source: Relative(8) }, Mov { destination: Direct(32772), source: Relative(10) }, Call { location: 346 }, Mov { destination: Relative(2), source: Direct(1) }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Direct(2) }, Store { destination_pointer: Relative(2), source: Relative(1) }, Const { destination: Relative(1), bit_size: Integer(U32), value: 0 }, Const { destination: Relative(6), bit_size: Integer(U32), value: 3 }, Const { destination: Relative(7), bit_size: Field, value: 0 }, Const { destination: Relative(8), bit_size: Integer(U1), value: 1 }, Const { destination: Relative(9), bit_size: Integer(U1), value: 0 }, Const { destination: Relative(10), bit_size: Field, value: 3728882899078719075161482178784387565366481897740339799480980287259621149274 }, Const { destination: Relative(11), bit_size: Field, value: -9903063709032878667290627648209915537972247634463802596148419711785767431332 }, Const { destination: Relative(12), bit_size: Field, value: 2393473289045184898987089634332637236754766663897650125720167164137088869378 }, Const { destination: Relative(13), bit_size: Field, value: -7135402912423807765050323395026152633898511180575289670895350565966806597339 }, Const { destination: Relative(14), bit_size: Integer(U32), value: 2 }, Const { destination: Relative(15), bit_size: Field, value: 8680525429001239497728366687280168587232520577698044359798894838135247199343 }, Const { destination: Relative(16), bit_size: Integer(U32), value: 1 }, Const { destination: Relative(17), bit_size: Field, value: 2 }, Const { destination: Relative(18), bit_size: Integer(U32), value: 5 }, Const { destination: Relative(19), bit_size: Integer(U32), value: 6 }, Const { destination: Relative(20), bit_size: Field, value: -1094708040843609169356775910874053498301840173462935739639689208799068762676 }, Const { destination: Relative(21), bit_size: Integer(U32), value: 7 }, Const { destination: Relative(22), bit_size: Field, value: -718703907181967287621274717949248537252263842169639534402461291799004475262 }, Const { destination: Relative(23), bit_size: Integer(U32), value: 8 }, Const { destination: Relative(24), bit_size: Integer(U32), value: 9 }, Mov { destination: Relative(4), source: Relative(1) }, Jump { location: 125 }, BinaryIntOp { destination: Relative(25), op: LessThan, bit_size: U32, lhs: Relative(4), rhs: Relative(6) }, JumpIf { condition: Relative(25), location: 130 }, Jump { location: 128 }, Load { destination: Relative(1), source_pointer: Relative(2) }, Return, BinaryIntOp { destination: Relative(28), op: Add, bit_size: U32, lhs: Relative(5), rhs: Direct(2) }, BinaryIntOp { destination: Relative(29), op: Add, bit_size: U32, lhs: Relative(28), rhs: Relative(4) }, Load { destination: Relative(27), source_pointer: Relative(29) }, JumpIf { condition: Relative(27), location: 142 }, Jump { location: 135 }, Load { destination: Relative(27), source_pointer: Relative(2) }, BinaryIntOp { destination: Relative(29), op: Add, bit_size: U32, lhs: Relative(3), rhs: Direct(2) }, BinaryIntOp { destination: Relative(30), op: Add, bit_size: U32, lhs: Relative(29), rhs: Relative(4) }, Load { destination: Relative(28), source_pointer: Relative(30) }, Mov { destination: Relative(25), source: Relative(27) }, Mov { destination: Relative(26), source: Relative(28) }, Jump { location: 149 }, BinaryIntOp { destination: Relative(28), op: Add, bit_size: U32, lhs: Relative(3), rhs: Direct(2) }, BinaryIntOp { destination: Relative(29), op: Add, bit_size: U32, lhs: Relative(28), rhs: Relative(4) }, Load { destination: Relative(27), source_pointer: Relative(29) }, Load { destination: Relative(28), source_pointer: Relative(2) }, Mov { destination: Relative(25), source: Relative(27) }, Mov { destination: Relative(26), source: Relative(28) }, Jump { location: 149 }, Mov { destination: Relative(28), source: Direct(1) }, Const { destination: Relative(29), bit_size: Integer(U32), value: 3 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(29) }, IndirectConst { destination_pointer: Relative(28), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(29), op: Add, bit_size: U32, lhs: Relative(28), rhs: Direct(2) }, Mov { destination: Relative(30), source: Relative(29) }, Store { destination_pointer: Relative(30), source: Relative(25) }, BinaryIntOp { destination: Relative(30), op: Add, bit_size: U32, lhs: Relative(30), rhs: Direct(2) }, Store { destination_pointer: Relative(30), source: Relative(26) }, Mov { destination: Relative(25), source: Direct(1) }, Const { destination: Relative(26), bit_size: Integer(U32), value: 7 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(26) }, IndirectConst { destination_pointer: Relative(25), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(26), op: Add, bit_size: U32, lhs: Relative(25), rhs: Direct(2) }, Mov { destination: Relative(29), source: Relative(26) }, Store { destination_pointer: Relative(29), source: Relative(7) }, BinaryIntOp { destination: Relative(29), op: Add, bit_size: U32, lhs: Relative(29), rhs: Direct(2) }, Store { destination_pointer: Relative(29), source: Relative(7) }, BinaryIntOp { destination: Relative(29), op: Add, bit_size: U32, lhs: Relative(29), rhs: Direct(2) }, Store { destination_pointer: Relative(29), source: Relative(7) }, BinaryIntOp { destination: Relative(29), op: Add, bit_size: U32, lhs: Relative(29), rhs: Direct(2) }, Store { destination_pointer: Relative(29), source: Relative(7) }, BinaryIntOp { destination: Relative(29), op: Add, bit_size: U32, lhs: Relative(29), rhs: Direct(2) }, Store { destination_pointer: Relative(29), source: Relative(7) }, BinaryIntOp { destination: Relative(29), op: Add, bit_size: U32, lhs: Relative(29), rhs: Direct(2) }, Store { destination_pointer: Relative(29), source: Relative(7) }, Mov { destination: Relative(26), source: Direct(1) }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Direct(2) }, Store { destination_pointer: Relative(26), source: Relative(25) }, Mov { destination: Relative(25), source: Direct(1) }, Const { destination: Relative(29), bit_size: Integer(U32), value: 10 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(29) }, IndirectConst { destination_pointer: Relative(25), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(29), op: Add, bit_size: U32, lhs: Relative(25), rhs: Direct(2) }, Mov { destination: Relative(30), source: Relative(29) }, Store { destination_pointer: Relative(30), source: Relative(7) }, BinaryIntOp { destination: Relative(30), op: Add, bit_size: U32, lhs: Relative(30), rhs: Direct(2) }, Store { destination_pointer: Relative(30), source: Relative(7) }, BinaryIntOp { destination: Relative(30), op: Add, bit_size: U32, lhs: Relative(30), rhs: Direct(2) }, Store { destination_pointer: Relative(30), source: Relative(8) }, BinaryIntOp { destination: Relative(30), op: Add, bit_size: U32, lhs: Relative(30), rhs: Direct(2) }, Store { destination_pointer: Relative(30), source: Relative(7) }, BinaryIntOp { destination: Relative(30), op: Add, bit_size: U32, lhs: Relative(30), rhs: Direct(2) }, Store { destination_pointer: Relative(30), source: Relative(7) }, BinaryIntOp { destination: Relative(30), op: Add, bit_size: U32, lhs: Relative(30), rhs: Direct(2) }, Store { destination_pointer: Relative(30), source: Relative(8) }, BinaryIntOp { destination: Relative(30), op: Add, bit_size: U32, lhs: Relative(30), rhs: Direct(2) }, Store { destination_pointer: Relative(30), source: Relative(7) }, BinaryIntOp { destination: Relative(30), op: Add, bit_size: U32, lhs: Relative(30), rhs: Direct(2) }, Store { destination_pointer: Relative(30), source: Relative(7) }, BinaryIntOp { destination: Relative(30), op: Add, bit_size: U32, lhs: Relative(30), rhs: Direct(2) }, Store { destination_pointer: Relative(30), source: Relative(8) }, Mov { destination: Relative(29), source: Direct(1) }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Direct(2) }, Store { destination_pointer: Relative(29), source: Relative(25) }, Mov { destination: Relative(25), source: Direct(1) }, Const { destination: Relative(30), bit_size: Integer(U32), value: 7 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(30) }, IndirectConst { destination_pointer: Relative(25), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(30), op: Add, bit_size: U32, lhs: Relative(25), rhs: Direct(2) }, Mov { destination: Relative(31), source: Relative(30) }, Store { destination_pointer: Relative(31), source: Relative(10) }, BinaryIntOp { destination: Relative(31), op: Add, bit_size: U32, lhs: Relative(31), rhs: Direct(2) }, Store { destination_pointer: Relative(31), source: Relative(11) }, BinaryIntOp { destination: Relative(31), op: Add, bit_size: U32, lhs: Relative(31), rhs: Direct(2) }, Store { destination_pointer: Relative(31), source: Relative(9) }, BinaryIntOp { destination: Relative(31), op: Add, bit_size: U32, lhs: Relative(31), rhs: Direct(2) }, Store { destination_pointer: Relative(31), source: Relative(12) }, BinaryIntOp { destination: Relative(31), op: Add, bit_size: U32, lhs: Relative(31), rhs: Direct(2) }, Store { destination_pointer: Relative(31), source: Relative(13) }, BinaryIntOp { destination: Relative(31), op: Add, bit_size: U32, lhs: Relative(31), rhs: Direct(2) }, Store { destination_pointer: Relative(31), source: Relative(9) }, Mov { destination: Relative(27), source: Relative(1) }, Jump { location: 223 }, BinaryIntOp { destination: Relative(30), op: LessThan, bit_size: U32, lhs: Relative(27), rhs: Relative(14) }, JumpIf { condition: Relative(30), location: 276 }, Jump { location: 226 }, Load { destination: Relative(25), source_pointer: Relative(26) }, Mov { destination: Direct(32771), source: Relative(25) }, Const { destination: Direct(32772), bit_size: Integer(U32), value: 7 }, Call { location: 365 }, Mov { destination: Relative(27), source: Direct(32773) }, BinaryIntOp { destination: Relative(28), op: Add, bit_size: U32, lhs: Relative(27), rhs: Relative(18) }, Store { destination_pointer: Relative(28), source: Relative(17) }, Mov { destination: Direct(32771), source: Relative(27) }, Const { destination: Direct(32772), bit_size: Integer(U32), value: 7 }, Call { location: 365 }, Mov { destination: Relative(25), source: Direct(32773) }, BinaryIntOp { destination: Relative(28), op: Add, bit_size: U32, lhs: Relative(25), rhs: Relative(19) }, Store { destination_pointer: Relative(28), source: Relative(7) }, Store { destination_pointer: Relative(26), source: Relative(25) }, Load { destination: Relative(26), source_pointer: Relative(29) }, Mov { destination: Direct(32771), source: Relative(26) }, Const { destination: Direct(32772), bit_size: Integer(U32), value: 10 }, Call { location: 365 }, Mov { destination: Relative(27), source: Direct(32773) }, BinaryIntOp { destination: Relative(28), op: Add, bit_size: U32, lhs: Relative(27), rhs: Relative(21) }, Store { destination_pointer: Relative(28), source: Relative(20) }, Mov { destination: Direct(32771), source: Relative(27) }, Const { destination: Direct(32772), bit_size: Integer(U32), value: 10 }, Call { location: 365 }, Mov { destination: Relative(26), source: Direct(32773) }, BinaryIntOp { destination: Relative(28), op: Add, bit_size: U32, lhs: Relative(26), rhs: Relative(23) }, Store { destination_pointer: Relative(28), source: Relative(22) }, Mov { destination: Direct(32771), source: Relative(26) }, Const { destination: Direct(32772), bit_size: Integer(U32), value: 10 }, Call { location: 365 }, Mov { destination: Relative(27), source: Direct(32773) }, BinaryIntOp { destination: Relative(28), op: Add, bit_size: U32, lhs: Relative(27), rhs: Relative(24) }, Store { destination_pointer: Relative(28), source: Relative(9) }, Store { destination_pointer: Relative(29), source: Relative(27) }, Mov { destination: Relative(26), source: Direct(1) }, Const { destination: Relative(28), bit_size: Integer(U32), value: 4 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(28) }, IndirectConst { destination_pointer: Relative(26), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(28), op: Add, bit_size: U32, lhs: Relative(27), rhs: Direct(2) }, Const { destination: Relative(29), bit_size: Integer(U32), value: 9 }, BinaryIntOp { destination: Relative(30), op: Add, bit_size: U32, lhs: Relative(25), rhs: Direct(2) }, Const { destination: Relative(31), bit_size: Integer(U32), value: 6 }, BinaryIntOp { destination: Relative(32), op: Add, bit_size: U32, lhs: Relative(26), rhs: Direct(2) }, BlackBox(MultiScalarMul { points: HeapVector { pointer: Relative(28), size: Relative(29) }, scalars: HeapVector { pointer: Relative(30), size: Relative(31) }, outputs: HeapArray { pointer: Relative(32), size: 3 } }), BinaryIntOp { destination: Relative(27), op: Add, bit_size: U32, lhs: Relative(26), rhs: Relative(16) }, Load { destination: Relative(25), source_pointer: Relative(27) }, Store { destination_pointer: Relative(2), source: Relative(25) }, BinaryIntOp { destination: Relative(25), op: Add, bit_size: U32, lhs: Relative(4), rhs: Relative(16) }, Mov { destination: Relative(4), source: Relative(25) }, Jump { location: 125 }, BinaryIntOp { destination: Relative(31), op: Add, bit_size: U32, lhs: Relative(28), rhs: Direct(2) }, BinaryIntOp { destination: Relative(32), op: Add, bit_size: U32, lhs: Relative(31), rhs: Relative(27) }, Load { destination: Relative(30), source_pointer: Relative(32) }, Cast { destination: Relative(32), source: Relative(30), bit_size: Integer(U128) }, Cast { destination: Relative(31), source: Relative(32), bit_size: Field }, BinaryFieldOp { destination: Relative(32), op: Sub, lhs: Relative(30), rhs: Relative(31) }, BinaryFieldOp { destination: Relative(33), op: Mul, lhs: Relative(32), rhs: Relative(15) }, BinaryFieldOp { destination: Relative(32), op: Mul, lhs: Direct(32835), rhs: Relative(33) }, BinaryFieldOp { destination: Relative(34), op: Add, lhs: Relative(31), rhs: Relative(32) }, BinaryFieldOp { destination: Relative(32), op: Equals, lhs: Relative(30), rhs: Relative(34) }, JumpIf { condition: Relative(32), location: 289 }, Const { destination: Relative(35), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(35) } }, Load { destination: Relative(30), source_pointer: Relative(26) }, BinaryIntOp { destination: Relative(32), op: Mul, bit_size: U32, lhs: Relative(27), rhs: Relative(14) }, Mov { destination: Direct(32771), source: Relative(30) }, Const { destination: Direct(32772), bit_size: Integer(U32), value: 7 }, Call { location: 365 }, Mov { destination: Relative(34), source: Direct(32773) }, BinaryIntOp { destination: Relative(35), op: Add, bit_size: U32, lhs: Relative(34), rhs: Direct(2) }, BinaryIntOp { destination: Relative(36), op: Add, bit_size: U32, lhs: Relative(35), rhs: Relative(32) }, Store { destination_pointer: Relative(36), source: Relative(31) }, BinaryIntOp { destination: Relative(30), op: Add, bit_size: U32, lhs: Relative(32), rhs: Relative(16) }, Mov { destination: Direct(32771), source: Relative(34) }, Const { destination: Direct(32772), bit_size: Integer(U32), value: 7 }, Call { location: 365 }, Mov { destination: Relative(31), source: Direct(32773) }, BinaryIntOp { destination: Relative(32), op: Add, bit_size: U32, lhs: Relative(31), rhs: Direct(2) }, BinaryIntOp { destination: Relative(35), op: Add, bit_size: U32, lhs: Relative(32), rhs: Relative(30) }, Store { destination_pointer: Relative(35), source: Relative(33) }, Store { destination_pointer: Relative(26), source: Relative(31) }, BinaryIntOp { destination: Relative(30), op: Mul, bit_size: U32, lhs: Relative(27), rhs: Relative(6) }, BinaryIntOp { destination: Relative(32), op: Add, bit_size: U32, lhs: Relative(25), rhs: Direct(2) }, BinaryIntOp { destination: Relative(33), op: Add, bit_size: U32, lhs: Relative(32), rhs: Relative(30) }, Load { destination: Relative(31), source_pointer: Relative(33) }, BinaryIntOp { destination: Relative(32), op: Add, bit_size: U32, lhs: Relative(30), rhs: Relative(16) }, BinaryIntOp { destination: Relative(34), op: Add, bit_size: U32, lhs: Relative(25), rhs: Direct(2) }, BinaryIntOp { destination: Relative(35), op: Add, bit_size: U32, lhs: Relative(34), rhs: Relative(32) }, Load { destination: Relative(33), source_pointer: Relative(35) }, BinaryIntOp { destination: Relative(34), op: Add, bit_size: U32, lhs: Relative(30), rhs: Relative(14) }, BinaryIntOp { destination: Relative(36), op: Add, bit_size: U32, lhs: Relative(25), rhs: Direct(2) }, BinaryIntOp { destination: Relative(37), op: Add, bit_size: U32, lhs: Relative(36), rhs: Relative(34) }, Load { destination: Relative(35), source_pointer: Relative(37) }, Load { destination: Relative(34), source_pointer: Relative(29) }, Mov { destination: Direct(32771), source: Relative(34) }, Const { destination: Direct(32772), bit_size: Integer(U32), value: 10 }, Call { location: 365 }, Mov { destination: Relative(36), source: Direct(32773) }, BinaryIntOp { destination: Relative(37), op: Add, bit_size: U32, lhs: Relative(36), rhs: Direct(2) }, BinaryIntOp { destination: Relative(38), op: Add, bit_size: U32, lhs: Relative(37), rhs: Relative(30) }, Store { destination_pointer: Relative(38), source: Relative(31) }, Mov { destination: Direct(32771), source: Relative(36) }, Const { destination: Direct(32772), bit_size: Integer(U32), value: 10 }, Call { location: 365 }, Mov { destination: Relative(30), source: Direct(32773) }, BinaryIntOp { destination: Relative(31), op: Add, bit_size: U32, lhs: Relative(30), rhs: Direct(2) }, BinaryIntOp { destination: Relative(34), op: Add, bit_size: U32, lhs: Relative(31), rhs: Relative(32) }, Store { destination_pointer: Relative(34), source: Relative(33) }, BinaryIntOp { destination: Relative(31), op: Add, bit_size: U32, lhs: Relative(32), rhs: Relative(16) }, Mov { destination: Direct(32771), source: Relative(30) }, Const { destination: Direct(32772), bit_size: Integer(U32), value: 10 }, Call { location: 365 }, Mov { destination: Relative(32), source: Direct(32773) }, BinaryIntOp { destination: Relative(33), op: Add, bit_size: U32, lhs: Relative(32), rhs: Direct(2) }, BinaryIntOp { destination: Relative(34), op: Add, bit_size: U32, lhs: Relative(33), rhs: Relative(31) }, Store { destination_pointer: Relative(34), source: Relative(35) }, Store { destination_pointer: Relative(29), source: Relative(32) }, BinaryIntOp { destination: Relative(30), op: Add, bit_size: U32, lhs: Relative(27), rhs: Relative(16) }, Mov { destination: Relative(27), source: Relative(30) }, Jump { location: 223 }, Const { destination: Direct(32774), bit_size: Integer(U32), value: 2 }, BinaryIntOp { destination: Direct(32773), op: Div, bit_size: U32, lhs: Direct(32772), rhs: Direct(32774) }, Mov { destination: Direct(32776), source: Direct(32772) }, Const { destination: Direct(32777), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Direct(32778), op: LessThan, bit_size: U32, lhs: Direct(32777), rhs: Direct(32773) }, Not { destination: Direct(32778), source: Direct(32778), bit_size: U1 }, JumpIf { condition: Direct(32778), location: 364 }, BinaryIntOp { destination: Direct(32776), op: Sub, bit_size: U32, lhs: Direct(32776), rhs: Direct(2) }, BinaryIntOp { destination: Direct(32779), op: Add, bit_size: U32, lhs: Direct(32771), rhs: Direct(32777) }, Load { destination: Direct(32774), source_pointer: Direct(32779) }, BinaryIntOp { destination: Direct(32779), op: Add, bit_size: U32, lhs: Direct(32771), rhs: Direct(32776) }, Load { destination: Direct(32775), source_pointer: Direct(32779) }, BinaryIntOp { destination: Direct(32779), op: Add, bit_size: U32, lhs: Direct(32771), rhs: Direct(32777) }, Store { destination_pointer: Direct(32779), source: Direct(32775) }, BinaryIntOp { destination: Direct(32779), op: Add, bit_size: U32, lhs: Direct(32771), rhs: Direct(32776) }, Store { destination_pointer: Direct(32779), source: Direct(32774) }, BinaryIntOp { destination: Direct(32777), op: Add, bit_size: U32, lhs: Direct(32777), rhs: Direct(2) }, Jump { location: 350 }, Return, Load { destination: Direct(32774), source_pointer: Direct(32771) }, BinaryIntOp { destination: Direct(32775), op: Equals, bit_size: U32, lhs: Direct(32774), rhs: Direct(2) }, JumpIf { condition: Direct(32775), location: 369 }, Jump { location: 371 }, Mov { destination: Direct(32773), source: Direct(32771) }, Jump { location: 386 }, Mov { destination: Direct(32773), source: Direct(1) }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Direct(32772) }, BinaryIntOp { destination: Direct(32777), op: Add, bit_size: U32, lhs: Direct(32771), rhs: Direct(32772) }, Mov { destination: Direct(32778), source: Direct(32771) }, Mov { destination: Direct(32779), source: Direct(32773) }, BinaryIntOp { destination: Direct(32780), op: Equals, bit_size: U32, lhs: Direct(32778), rhs: Direct(32777) }, JumpIf { condition: Direct(32780), location: 383 }, Load { destination: Direct(32776), source_pointer: Direct(32778) }, Store { destination_pointer: Direct(32779), source: Direct(32776) }, BinaryIntOp { destination: Direct(32778), op: Add, bit_size: U32, lhs: Direct(32778), rhs: Direct(2) }, BinaryIntOp { destination: Direct(32779), op: Add, bit_size: U32, lhs: Direct(32779), rhs: Direct(2) }, Jump { location: 376 }, IndirectConst { destination_pointer: Direct(32773), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Direct(32774), op: Sub, bit_size: U32, lhs: Direct(32774), rhs: Direct(2) }, Jump { location: 386 }, Return]" ], - "debug_symbols": "pZjdbuJMDIbvJcccjO3x/PRWqqqiLV0hIVqx8EmfKu597ThvaFcCddMT3icQP/mZ8RD4GF42T6dfj9v969vv4e7+Y3g6bHe77a/H3dvz+rh929u7H0PyF7VXWg1KERwhETlCI0pEjWgRfbjj1VBSBEVwhFnEIkdoRImoES2ij1FTBEWYJVtIRI7QMZqVF4sW0cfoKYIiOEIicoRGlIiw9LD0sFAyjXrSlBzJVls9bfdmKbZf96QpeUq/XcnBbxg5VECbIPO0TxZABqA892nncYhGIAADBJABCsDRFUcfh0wc+gQ+bAEEYIAAMkABBVABMBeYK8wV5gpzhbnCXGGuMFeYq5uzQ5+gJQABGCCADFBAAVQAzA3mDnOHucPcYe4wd5g7zB3mDnOfzJwSgAAMEICbi4MCCqACGqBPQAlAAAYIAGaCmWAmmAlmgplhZvdUB69qDl7VHRqgT+BNEUAABgggAxRQADALzAJz9iUmOfgiQw4MEEAGKKAAKqAB+gTeXwEwK8wKs8KsMCvMCrPCrDCPyyI7EIABAsgABRRABTRAn8D7i8WBADwuS+ztNaZbfGJ5LwU0gFt8H++lALf4XfZeEr/L3kvi1+C9JH5I7yXxI3kvBVRAA7jZFkv2XhI/lvdSAAMEkAEKKIAKaIAeICkBCMAAAWSAAgrAzerQAH0C76UAAjBAABmggAKAmWAmmL2XpDgQgAECyAAFFEAFNECfQGAWmAVmgVlgFpgFZoFZYBaYM8wZ5gxzHs3n82rA88Tj8bDZ+OPEpwcMe+x4Xx82++Nwtz/tdqvhv/XuNO70+329H/O4PtinNt02+xdLE75udxun8+pSna6X2hfOVGzr1Vyu36/X+qN6WztQ3+uCeiHU21AsqM/z9eem1+r1xvXbkjkJyNam2UDtu2eg3vejQCUvuIKqqG+JF9RrwR3UKgvqS25TfSlLZkCdR7Dy1fNvN2aQLZ6YQtbxlxHoXwzEtyYhz7NYuS1SlIRhsC8kXqSoNCtqS1cVN2ajqK+W0Q7a87Kz6POK0FJapOglX5p62Vn0NJ9Ft7oFCvsSKrgX9pNimSLNqwuRLFNkmhWdfq5Ydjtb5nlQddmgNs4XxdUL4RuzM9M8qNl+gV1VlOsKW+Kw2H1u9fpVUG+tVriKorJI0DAYpbVlgnm9S9fP4NZtZMEpZHueXTQSzPpjBdVvKG5PKaJ5SjEtU9R55W6fHiD+SVEuZ/HXavVgW+vn7eHL3z5ndx2266fdZtp8Pe2fP316/P8dn+Bvo/fD2/Pm5XTYuOny35G93EvRlbTyYD93fSuXlZRsW/aIeG8/LaT5J76jXWlj3/D9mqyaPpz9FP8A", + "debug_symbols": "pZjbbuJKEEX/xc88dN36kl+JoogkZISESMSEIx1F/Pt0ubwNGQmUcV7Yy+BavnRXY/gcXjZPx1+P2/3r2+/h7v5zeDpsd7vtr8fd2/P6Y/u27+9+DslfrL/SajCK4AiJ0AiLyBEloka04Y5XQ04RFMER3SI9NMIickSJqBFtjJIiKKJbtIdEaISNUXt57lEj2hgtRVAER0iERlhEjghLC0sLC6WuMU+akiO51xbPvnvtKX2/5klT8pR+u5KD3zByKIA6gfK0jwpAASjXNu08DtEIBGCAABRgABzdcPRxyMShTeDDFkAABghAAQbIgAKAOcNcYC4wF5gLzAXmAnOBucBc3KwObYKaAARggAAUYIAMKACYK8wN5gZzg7nB3GBuMDeYG8wN5jaZOSUAARggADdnBwNkQAFUQJuAEoAADBAAzAQzwUwwE8wEM8PM7ikOXlUdvKo5VECbwJsigAAMEIACDJABMAvMArP6EpMcfJEhBwYIQAEGyIACqIA2gfdXAMwGs8FsMBvMBrPBbDAbzOOyyA4EYIAAFGCADCiACmgTeH+xOBCAx2WJvb3GdItPLO+lgApwi+/jvRTgFr/L3kvid9l7SfwavJfED+m9JH4k76WAAqgAN/fFkr2XxI/lvRTAAAEowAAZUAAV0AIkJQABGCAABRggA9xsDhXQJvBeCiAAAwSgAANkAMwEM8HsvSTZgQAMEIACDJABBVABbQKBWWAWmAVmgVlgFpgFZoFZYFaYFWaFWUfz6bQa8Dzx+HHYbPxx4uIBoz92vK8Pm/3HcLc/7nar4b/17jju9Pt9vR/zY33on/bpttm/9OzC1+1u43RanavT9dL+hTMV9/VqLrfv11v5UX1fO1DfyoJ6IdT3oVhQr/P1a7Vr9Xbj+vuSOQmor02zgep3z8C870eBiS64gjLfwdLagnrLqLciC+qz2lSfbckIlIQZVOjq+dcbM6gvnphCvePPI9C+GIhvTUKeZ7FxXaTICcPYv5B4kaLQrCg1XVXcmI1igsEQa7rsLNq8ItSUFila1nNTLzuLluazaBfT4h8U/Uso4170nxTLFGleXYhkmUJpVjT6uWLZ7azK86DaskGtrGfF1QvhG7NTaR5U7b/ArirydUVNuI562erlq6DcWq10Xq1kkaBiMHKtywTzep2un8Gt28iCU9D+PLtoJJjtxwoq31DcnlJE85RiWqYo88pdLx4g/kmRz2fx12r10LfWz9vDl799Tu46bNdPu820+XrcP198+vH/Oz7B30bvh7fnzcvxsHHT+b+j/nIv2VZS80P/uetbmleStW/1R8T7/tNCqn/iO/Yrrewbvl+VVbWHk5/iHw==", "file_map": { "17": { "source": "use crate::field::field_less_than;\nuse crate::runtime::is_unconstrained;\n\n// The low and high decomposition of the field modulus\nglobal PLO: Field = 53438638232309528389504892708671455233;\nglobal PHI: Field = 64323764613183177041862057485226039389;\n\npub(crate) global TWO_POW_128: Field = 0x100000000000000000000000000000000;\n\n// Decomposes a single field into two 16 byte fields.\nfn compute_decomposition(x: Field) -> (Field, Field) {\n // Here's we're taking advantage of truncating 128 bit limbs from the input field\n // and then subtracting them from the input such the field division is equivalent to integer division.\n let low = (x as u128) as Field;\n let high = (x - low) / TWO_POW_128;\n\n (low, high)\n}\n\npub(crate) unconstrained fn decompose_hint(x: Field) -> (Field, Field) {\n compute_decomposition(x)\n}\n\nunconstrained fn lte_hint(x: Field, y: Field) -> bool {\n if x == y {\n true\n } else {\n field_less_than(x, y)\n }\n}\n\n// Assert that (alo > blo && ahi >= bhi) || (alo <= blo && ahi > bhi)\nfn assert_gt_limbs(a: (Field, Field), b: (Field, Field)) {\n let (alo, ahi) = a;\n let (blo, bhi) = b;\n // Safety: borrow is enforced to be boolean due to its type.\n // if borrow is 0, it asserts that (alo > blo && ahi >= bhi)\n // if borrow is 1, it asserts that (alo <= blo && ahi > bhi)\n unsafe {\n let borrow = lte_hint(alo, blo);\n\n let rlo = alo - blo - 1 + (borrow as Field) * TWO_POW_128;\n let rhi = ahi - bhi - (borrow as Field);\n\n rlo.assert_max_bit_size::<128>();\n rhi.assert_max_bit_size::<128>();\n }\n}\n\n/// Decompose a single field into two 16 byte fields.\npub fn decompose(x: Field) -> (Field, Field) {\n if is_unconstrained() {\n compute_decomposition(x)\n } else {\n // Safety: decomposition is properly checked below\n unsafe {\n // Take hints of the decomposition\n let (xlo, xhi) = decompose_hint(x);\n\n // Range check the limbs\n xlo.assert_max_bit_size::<128>();\n xhi.assert_max_bit_size::<128>();\n\n // Check that the decomposition is correct\n assert_eq(x, xlo + TWO_POW_128 * xhi);\n\n // Assert that the decomposition of P is greater than the decomposition of x\n assert_gt_limbs((PLO, PHI), (xlo, xhi));\n (xlo, xhi)\n }\n }\n}\n\npub fn assert_gt(a: Field, b: Field) {\n if is_unconstrained() {\n assert(\n // Safety: already unconstrained\n unsafe { field_less_than(b, a) },\n );\n } else {\n // Decompose a and b\n let a_limbs = decompose(a);\n let b_limbs = decompose(b);\n\n // Assert that a_limbs is greater than b_limbs\n assert_gt_limbs(a_limbs, b_limbs)\n }\n}\n\npub fn assert_lt(a: Field, b: Field) {\n assert_gt(b, a);\n}\n\npub fn gt(a: Field, b: Field) -> bool {\n if is_unconstrained() {\n // Safety: unsafe in unconstrained\n unsafe {\n field_less_than(b, a)\n }\n } else if a == b {\n false\n } else {\n // Safety: Take a hint of the comparison and verify it\n unsafe {\n if field_less_than(a, b) {\n assert_gt(b, a);\n false\n } else {\n assert_gt(a, b);\n true\n }\n }\n }\n}\n\npub fn lt(a: Field, b: Field) -> bool {\n gt(b, a)\n}\n\nmod tests {\n // TODO: Allow imports from \"super\"\n use crate::field::bn254::{assert_gt, decompose, gt, lte_hint, PHI, PLO, TWO_POW_128};\n\n #[test]\n fn check_decompose() {\n assert_eq(decompose(TWO_POW_128), (0, 1));\n assert_eq(decompose(TWO_POW_128 + 0x1234567890), (0x1234567890, 1));\n assert_eq(decompose(0x1234567890), (0x1234567890, 0));\n }\n\n #[test]\n unconstrained fn check_decompose_unconstrained() {\n assert_eq(decompose(TWO_POW_128), (0, 1));\n assert_eq(decompose(TWO_POW_128 + 0x1234567890), (0x1234567890, 1));\n assert_eq(decompose(0x1234567890), (0x1234567890, 0));\n }\n\n #[test]\n unconstrained fn check_lte_hint() {\n assert(lte_hint(0, 1));\n assert(lte_hint(0, 0x100));\n assert(lte_hint(0x100, TWO_POW_128 - 1));\n assert(!lte_hint(0 - 1, 0));\n\n assert(lte_hint(0, 0));\n assert(lte_hint(0x100, 0x100));\n assert(lte_hint(0 - 1, 0 - 1));\n }\n\n #[test]\n fn check_assert_gt() {\n assert_gt(1, 0);\n assert_gt(0x100, 0);\n assert_gt((0 - 1), (0 - 2));\n assert_gt(TWO_POW_128, 0);\n assert_gt(0 - 1, 0);\n }\n\n #[test]\n unconstrained fn check_assert_gt_unconstrained() {\n assert_gt(1, 0);\n assert_gt(0x100, 0);\n assert_gt((0 - 1), (0 - 2));\n assert_gt(TWO_POW_128, 0);\n assert_gt(0 - 1, 0);\n }\n\n #[test]\n fn check_gt() {\n assert(gt(1, 0));\n assert(gt(0x100, 0));\n assert(gt((0 - 1), (0 - 2)));\n assert(gt(TWO_POW_128, 0));\n assert(!gt(0, 0));\n assert(!gt(0, 0x100));\n assert(gt(0 - 1, 0 - 2));\n assert(!gt(0 - 2, 0 - 1));\n }\n\n #[test]\n unconstrained fn check_gt_unconstrained() {\n assert(gt(1, 0));\n assert(gt(0x100, 0));\n assert(gt((0 - 1), (0 - 2)));\n assert(gt(TWO_POW_128, 0));\n assert(!gt(0, 0));\n assert(!gt(0, 0x100));\n assert(gt(0 - 1, 0 - 2));\n assert(!gt(0 - 2, 0 - 1));\n }\n\n #[test]\n fn check_plo_phi() {\n assert_eq(PLO + PHI * TWO_POW_128, 0);\n let p_bytes = crate::field::modulus_le_bytes();\n let mut p_low: Field = 0;\n let mut p_high: Field = 0;\n\n let mut offset = 1;\n for i in 0..16 {\n p_low += (p_bytes[i] as Field) * offset;\n p_high += (p_bytes[i + 16] as Field) * offset;\n offset *= 256;\n }\n assert_eq(p_low, PLO);\n assert_eq(p_high, PHI);\n }\n}\n", @@ -91,7 +91,7 @@ expression: artifact "path": "std/hash/mod.nr" }, "50": { - "source": "fn main(\n old_root: Field,\n old_leaf: Field,\n old_hash_path: [Field; 3],\n new_root: pub Field,\n leaf: Field,\n index: Field,\n) {\n assert(old_root == compute_merkle_root(old_leaf, index, old_hash_path));\n\n let calculated_root = compute_merkle_root(leaf, index, old_hash_path);\n assert(new_root == calculated_root);\n}\n\nfn compute_merkle_root(leaf: Field, index: Field, hash_path: [Field; N]) -> Field {\n let index_bits: [u1; N] = index.to_le_bits();\n let mut current = leaf;\n for i in 0..N {\n let path_bit = index_bits[i] as bool;\n let (hash_left, hash_right) = if path_bit {\n (hash_path[i], current)\n } else {\n (current, hash_path[i])\n };\n current = std::hash::pedersen_hash([hash_left, hash_right]);\n }\n current\n}\n", + "source": "fn main(\n old_root: Field,\n old_leaf: Field,\n old_hash_path: [Field; 3],\n new_root: pub Field,\n leaf: Field,\n index: Field,\n) {\n assert(old_root == compute_merkle_root(old_leaf, index, old_hash_path));\n\n let calculated_root = compute_merkle_root(leaf, index, old_hash_path);\n assert(new_root == calculated_root);\n}\n\nfn compute_merkle_root(leaf: Field, index: Field, hash_path: [Field; N]) -> Field {\n let index_bits: [u1; N] = index.to_le_bits();\n let mut current = leaf;\n for i in 0..N {\n let path_bit = index_bits[i] != 0;\n let (hash_left, hash_right) = if path_bit {\n (hash_path[i], current)\n } else {\n (current, hash_path[i])\n };\n current = std::hash::pedersen_hash([hash_left, hash_right]);\n }\n current\n}\n", "path": "" } }, diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/merkle_insert/execute__tests__force_brillig_true_inliner_0.snap b/tooling/nargo_cli/tests/snapshots/execution_success/merkle_insert/execute__tests__force_brillig_true_inliner_0.snap index 41051ae4eb2..9367d1cef36 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/merkle_insert/execute__tests__force_brillig_true_inliner_0.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/merkle_insert/execute__tests__force_brillig_true_inliner_0.snap @@ -76,7 +76,7 @@ expression: artifact "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(7), bit_size: Integer(U32), value: 8 }, Const { destination: Relative(8), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(32836), size_address: Relative(7), offset_address: Relative(8) }, Mov { destination: Relative(1), source: Direct(32836) }, Mov { destination: Relative(2), source: Direct(32837) }, Const { destination: Relative(3), bit_size: Integer(U32), value: 32838 }, Const { destination: Relative(8), bit_size: Integer(U32), value: 3 }, Mov { destination: Relative(7), source: Direct(1) }, Const { destination: Relative(9), bit_size: Integer(U32), value: 4 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(9) }, IndirectConst { destination_pointer: Relative(7), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(9), op: Add, bit_size: U32, lhs: Relative(7), rhs: Direct(2) }, Mov { destination: Direct(32771), source: Relative(3) }, Mov { destination: Direct(32772), source: Relative(9) }, Mov { destination: Direct(32773), source: Relative(8) }, Call { location: 28 }, Mov { destination: Relative(3), source: Relative(7) }, Mov { destination: Relative(4), source: Direct(32841) }, Mov { destination: Relative(5), source: Direct(32842) }, Mov { destination: Relative(6), source: Direct(32843) }, Call { location: 39 }, Call { location: 41 }, Const { destination: Relative(1), bit_size: Integer(U32), value: 32844 }, Const { destination: Relative(2), bit_size: Integer(U32), value: 0 }, Stop { return_data: HeapVector { pointer: Relative(1), size: Relative(2) } }, BinaryIntOp { destination: Direct(32775), op: Add, bit_size: U32, lhs: Direct(32771), rhs: Direct(32773) }, Mov { destination: Direct(32776), source: Direct(32771) }, Mov { destination: Direct(32777), source: Direct(32772) }, BinaryIntOp { destination: Direct(32778), op: Equals, bit_size: U32, lhs: Direct(32776), rhs: Direct(32775) }, JumpIf { condition: Direct(32778), location: 38 }, Load { destination: Direct(32774), source_pointer: Direct(32776) }, Store { destination_pointer: Direct(32777), source: Direct(32774) }, BinaryIntOp { destination: Direct(32776), op: Add, bit_size: U32, lhs: Direct(32776), rhs: Direct(2) }, BinaryIntOp { destination: Direct(32777), op: Add, bit_size: U32, lhs: Direct(32777), rhs: Direct(2) }, Jump { location: 31 }, Return, Const { destination: Direct(32835), bit_size: Field, value: 340282366920938463463374607431768211456 }, Return, Call { location: 77 }, Load { destination: Relative(7), source_pointer: Relative(3) }, Const { destination: Relative(8), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(9), op: Equals, bit_size: U32, lhs: Relative(8), rhs: Relative(7) }, Not { destination: Relative(9), source: Relative(9), bit_size: U1 }, JumpIf { condition: Relative(9), location: 48 }, Call { location: 83 }, BinaryIntOp { destination: Relative(7), op: Add, bit_size: U32, lhs: Relative(7), rhs: Direct(2) }, Store { destination_pointer: Relative(3), source: Relative(7) }, Const { destination: Relative(9), bit_size: Integer(U32), value: 10 }, Mov { destination: Relative(10), source: Direct(0) }, Mov { destination: Relative(11), source: Relative(2) }, Mov { destination: Relative(12), source: Relative(6) }, Mov { destination: Relative(13), source: Relative(3) }, BinaryIntOp { destination: Direct(0), op: Add, bit_size: U32, lhs: Direct(0), rhs: Relative(9) }, Call { location: 86 }, Mov { destination: Direct(0), source: Relative(0) }, Mov { destination: Relative(7), source: Relative(11) }, BinaryFieldOp { destination: Relative(2), op: Equals, lhs: Relative(1), rhs: Relative(7) }, JumpIf { condition: Relative(2), location: 63 }, Const { destination: Relative(9), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(9) } }, Const { destination: Relative(2), bit_size: Integer(U32), value: 9 }, Mov { destination: Relative(9), source: Direct(0) }, Mov { destination: Relative(10), source: Relative(5) }, Mov { destination: Relative(11), source: Relative(6) }, Mov { destination: Relative(12), source: Relative(3) }, BinaryIntOp { destination: Direct(0), op: Add, bit_size: U32, lhs: Direct(0), rhs: Relative(2) }, Call { location: 86 }, Mov { destination: Direct(0), source: Relative(0) }, Mov { destination: Relative(1), source: Relative(10) }, BinaryFieldOp { destination: Relative(2), op: Equals, lhs: Relative(4), rhs: Relative(1) }, JumpIf { condition: Relative(2), location: 76 }, Const { destination: Relative(3), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(3) } }, Return, Const { destination: Direct(32772), bit_size: Integer(U32), value: 30720 }, BinaryIntOp { destination: Direct(32771), op: LessThan, bit_size: U32, lhs: Direct(0), rhs: Direct(32772) }, JumpIf { condition: Direct(32771), location: 82 }, 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, Call { location: 77 }, Const { destination: Relative(6), bit_size: Integer(U32), value: 2 }, Const { destination: Relative(7), bit_size: Integer(U1), value: 1 }, Mov { destination: Relative(5), source: Direct(1) }, Const { destination: Relative(8), bit_size: Integer(U32), value: 4 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(8) }, IndirectConst { destination_pointer: Relative(5), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(8), op: Add, bit_size: U32, lhs: Relative(5), rhs: Direct(2) }, Const { destination: Relative(9), bit_size: Integer(U32), value: 3 }, BlackBox(ToRadix { input: Relative(2), radix: Relative(6), output_pointer: Relative(8), num_limbs: Relative(9), output_bits: Relative(7) }), Const { destination: Relative(10), bit_size: Integer(U32), value: 3 }, Mov { destination: Direct(32771), source: Relative(8) }, Mov { destination: Direct(32772), source: Relative(10) }, Call { location: 362 }, Mov { destination: Relative(2), source: Direct(1) }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Direct(2) }, Store { destination_pointer: Relative(2), source: Relative(1) }, Const { destination: Relative(1), bit_size: Field, value: 0 }, Mov { destination: Relative(6), source: Direct(1) }, Const { destination: Relative(7), bit_size: Integer(U32), value: 7 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(7) }, IndirectConst { destination_pointer: Relative(6), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(7), op: Add, bit_size: U32, lhs: Relative(6), rhs: Direct(2) }, Mov { destination: Relative(8), source: Relative(7) }, Store { destination_pointer: Relative(8), source: Relative(1) }, BinaryIntOp { destination: Relative(8), op: Add, bit_size: U32, lhs: Relative(8), rhs: Direct(2) }, Store { destination_pointer: Relative(8), source: Relative(1) }, BinaryIntOp { destination: Relative(8), op: Add, bit_size: U32, lhs: Relative(8), rhs: Direct(2) }, Store { destination_pointer: Relative(8), source: Relative(1) }, BinaryIntOp { destination: Relative(8), op: Add, bit_size: U32, lhs: Relative(8), rhs: Direct(2) }, Store { destination_pointer: Relative(8), source: Relative(1) }, BinaryIntOp { destination: Relative(8), op: Add, bit_size: U32, lhs: Relative(8), rhs: Direct(2) }, Store { destination_pointer: Relative(8), source: Relative(1) }, BinaryIntOp { destination: Relative(8), op: Add, bit_size: U32, lhs: Relative(8), rhs: Direct(2) }, Store { destination_pointer: Relative(8), source: Relative(1) }, Const { destination: Relative(7), bit_size: Integer(U1), value: 1 }, Mov { destination: Relative(8), source: Direct(1) }, Const { destination: Relative(9), bit_size: Integer(U32), value: 10 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(9) }, IndirectConst { destination_pointer: Relative(8), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(9), op: Add, bit_size: U32, lhs: Relative(8), rhs: Direct(2) }, Mov { destination: Relative(10), source: Relative(9) }, Store { destination_pointer: Relative(10), source: Relative(1) }, BinaryIntOp { destination: Relative(10), op: Add, bit_size: U32, lhs: Relative(10), rhs: Direct(2) }, Store { destination_pointer: Relative(10), source: Relative(1) }, BinaryIntOp { destination: Relative(10), op: Add, bit_size: U32, lhs: Relative(10), rhs: Direct(2) }, Store { destination_pointer: Relative(10), source: Relative(7) }, BinaryIntOp { destination: Relative(10), op: Add, bit_size: U32, lhs: Relative(10), rhs: Direct(2) }, Store { destination_pointer: Relative(10), source: Relative(1) }, BinaryIntOp { destination: Relative(10), op: Add, bit_size: U32, lhs: Relative(10), rhs: Direct(2) }, Store { destination_pointer: Relative(10), source: Relative(1) }, BinaryIntOp { destination: Relative(10), op: Add, bit_size: U32, lhs: Relative(10), rhs: Direct(2) }, Store { destination_pointer: Relative(10), source: Relative(7) }, BinaryIntOp { destination: Relative(10), op: Add, bit_size: U32, lhs: Relative(10), rhs: Direct(2) }, Store { destination_pointer: Relative(10), source: Relative(1) }, BinaryIntOp { destination: Relative(10), op: Add, bit_size: U32, lhs: Relative(10), rhs: Direct(2) }, Store { destination_pointer: Relative(10), source: Relative(1) }, BinaryIntOp { destination: Relative(10), op: Add, bit_size: U32, lhs: Relative(10), rhs: Direct(2) }, Store { destination_pointer: Relative(10), source: Relative(7) }, Const { destination: Relative(7), bit_size: Field, value: 3728882899078719075161482178784387565366481897740339799480980287259621149274 }, Const { destination: Relative(9), bit_size: Field, value: -9903063709032878667290627648209915537972247634463802596148419711785767431332 }, Const { destination: Relative(10), bit_size: Integer(U1), value: 0 }, Const { destination: Relative(11), bit_size: Field, value: 2393473289045184898987089634332637236754766663897650125720167164137088869378 }, Const { destination: Relative(12), bit_size: Field, value: -7135402912423807765050323395026152633898511180575289670895350565966806597339 }, Mov { destination: Relative(13), source: Direct(1) }, Const { destination: Relative(14), bit_size: Integer(U32), value: 7 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(14) }, IndirectConst { destination_pointer: Relative(13), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(14), op: Add, bit_size: U32, lhs: Relative(13), rhs: Direct(2) }, Mov { destination: Relative(15), source: Relative(14) }, Store { destination_pointer: Relative(15), source: Relative(7) }, BinaryIntOp { destination: Relative(15), op: Add, bit_size: U32, lhs: Relative(15), rhs: Direct(2) }, Store { destination_pointer: Relative(15), source: Relative(9) }, BinaryIntOp { destination: Relative(15), op: Add, bit_size: U32, lhs: Relative(15), rhs: Direct(2) }, Store { destination_pointer: Relative(15), source: Relative(10) }, BinaryIntOp { destination: Relative(15), op: Add, bit_size: U32, lhs: Relative(15), rhs: Direct(2) }, Store { destination_pointer: Relative(15), source: Relative(11) }, BinaryIntOp { destination: Relative(15), op: Add, bit_size: U32, lhs: Relative(15), rhs: Direct(2) }, Store { destination_pointer: Relative(15), source: Relative(12) }, BinaryIntOp { destination: Relative(15), op: Add, bit_size: U32, lhs: Relative(15), rhs: Direct(2) }, Store { destination_pointer: Relative(15), source: Relative(10) }, Const { destination: Relative(7), bit_size: Integer(U32), value: 0 }, Const { destination: Relative(9), bit_size: Integer(U32), value: 3 }, Const { destination: Relative(11), bit_size: Integer(U32), value: 2 }, Const { destination: Relative(12), bit_size: Field, value: 8680525429001239497728366687280168587232520577698044359798894838135247199343 }, Const { destination: Relative(14), bit_size: Integer(U32), value: 1 }, Const { destination: Relative(15), bit_size: Field, value: 2 }, Const { destination: Relative(16), bit_size: Integer(U32), value: 5 }, Const { destination: Relative(17), bit_size: Integer(U32), value: 6 }, Const { destination: Relative(18), bit_size: Field, value: -1094708040843609169356775910874053498301840173462935739639689208799068762676 }, Const { destination: Relative(19), bit_size: Integer(U32), value: 7 }, Const { destination: Relative(20), bit_size: Field, value: -718703907181967287621274717949248537252263842169639534402461291799004475262 }, Const { destination: Relative(21), bit_size: Integer(U32), value: 8 }, Const { destination: Relative(22), bit_size: Integer(U32), value: 9 }, Mov { destination: Relative(4), source: Relative(7) }, Jump { location: 182 }, BinaryIntOp { destination: Relative(23), op: LessThan, bit_size: U32, lhs: Relative(4), rhs: Relative(9) }, JumpIf { condition: Relative(23), location: 187 }, Jump { location: 185 }, Load { destination: Relative(1), source_pointer: Relative(2) }, Return, BinaryIntOp { destination: Relative(26), op: Add, bit_size: U32, lhs: Relative(5), rhs: Direct(2) }, BinaryIntOp { destination: Relative(27), op: Add, bit_size: U32, lhs: Relative(26), rhs: Relative(4) }, Load { destination: Relative(25), source_pointer: Relative(27) }, JumpIf { condition: Relative(25), location: 199 }, Jump { location: 192 }, Load { destination: Relative(25), source_pointer: Relative(2) }, BinaryIntOp { destination: Relative(27), op: Add, bit_size: U32, lhs: Relative(3), rhs: Direct(2) }, BinaryIntOp { destination: Relative(28), op: Add, bit_size: U32, lhs: Relative(27), rhs: Relative(4) }, Load { destination: Relative(26), source_pointer: Relative(28) }, Mov { destination: Relative(23), source: Relative(25) }, Mov { destination: Relative(24), source: Relative(26) }, Jump { location: 206 }, BinaryIntOp { destination: Relative(26), op: Add, bit_size: U32, lhs: Relative(3), rhs: Direct(2) }, BinaryIntOp { destination: Relative(27), op: Add, bit_size: U32, lhs: Relative(26), rhs: Relative(4) }, Load { destination: Relative(25), source_pointer: Relative(27) }, Load { destination: Relative(26), source_pointer: Relative(2) }, Mov { destination: Relative(23), source: Relative(25) }, Mov { destination: Relative(24), source: Relative(26) }, Jump { location: 206 }, Mov { destination: Relative(26), source: Direct(1) }, Const { destination: Relative(27), bit_size: Integer(U32), value: 3 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(27) }, IndirectConst { destination_pointer: Relative(26), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(27), op: Add, bit_size: U32, lhs: Relative(26), rhs: Direct(2) }, Mov { destination: Relative(28), source: Relative(27) }, Store { destination_pointer: Relative(28), source: Relative(23) }, BinaryIntOp { destination: Relative(28), op: Add, bit_size: U32, lhs: Relative(28), rhs: Direct(2) }, Store { destination_pointer: Relative(28), source: Relative(24) }, Load { destination: Relative(23), source_pointer: Relative(6) }, Const { destination: Relative(24), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(27), op: Equals, bit_size: U32, lhs: Relative(24), rhs: Relative(23) }, Not { destination: Relative(27), source: Relative(27), bit_size: U1 }, JumpIf { condition: Relative(27), location: 221 }, Call { location: 83 }, BinaryIntOp { destination: Relative(23), op: Add, bit_size: U32, lhs: Relative(23), rhs: Direct(2) }, Store { destination_pointer: Relative(6), source: Relative(23) }, Mov { destination: Relative(23), source: Direct(1) }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Direct(2) }, Store { destination_pointer: Relative(23), source: Relative(6) }, Load { destination: Relative(27), source_pointer: Relative(8) }, Const { destination: Relative(28), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(29), op: Equals, bit_size: U32, lhs: Relative(28), rhs: Relative(27) }, Not { destination: Relative(29), source: Relative(29), bit_size: U1 }, JumpIf { condition: Relative(29), location: 232 }, Call { location: 83 }, BinaryIntOp { destination: Relative(27), op: Add, bit_size: U32, lhs: Relative(27), rhs: Direct(2) }, Store { destination_pointer: Relative(8), source: Relative(27) }, Mov { destination: Relative(27), source: Direct(1) }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Direct(2) }, Store { destination_pointer: Relative(27), source: Relative(8) }, Mov { destination: Relative(25), source: Relative(7) }, Jump { location: 239 }, BinaryIntOp { destination: Relative(24), op: LessThan, bit_size: U32, lhs: Relative(25), rhs: Relative(11) }, JumpIf { condition: Relative(24), location: 292 }, Jump { location: 242 }, Load { destination: Relative(24), source_pointer: Relative(23) }, Mov { destination: Direct(32771), source: Relative(24) }, Const { destination: Direct(32772), bit_size: Integer(U32), value: 7 }, Call { location: 381 }, Mov { destination: Relative(25), source: Direct(32773) }, BinaryIntOp { destination: Relative(26), op: Add, bit_size: U32, lhs: Relative(25), rhs: Relative(16) }, Store { destination_pointer: Relative(26), source: Relative(15) }, Mov { destination: Direct(32771), source: Relative(25) }, Const { destination: Direct(32772), bit_size: Integer(U32), value: 7 }, Call { location: 381 }, Mov { destination: Relative(24), source: Direct(32773) }, BinaryIntOp { destination: Relative(26), op: Add, bit_size: U32, lhs: Relative(24), rhs: Relative(17) }, Store { destination_pointer: Relative(26), source: Relative(1) }, Store { destination_pointer: Relative(23), source: Relative(24) }, Load { destination: Relative(23), source_pointer: Relative(27) }, Mov { destination: Direct(32771), source: Relative(23) }, Const { destination: Direct(32772), bit_size: Integer(U32), value: 10 }, Call { location: 381 }, Mov { destination: Relative(25), source: Direct(32773) }, BinaryIntOp { destination: Relative(26), op: Add, bit_size: U32, lhs: Relative(25), rhs: Relative(19) }, Store { destination_pointer: Relative(26), source: Relative(18) }, Mov { destination: Direct(32771), source: Relative(25) }, Const { destination: Direct(32772), bit_size: Integer(U32), value: 10 }, Call { location: 381 }, Mov { destination: Relative(23), source: Direct(32773) }, BinaryIntOp { destination: Relative(26), op: Add, bit_size: U32, lhs: Relative(23), rhs: Relative(21) }, Store { destination_pointer: Relative(26), source: Relative(20) }, Mov { destination: Direct(32771), source: Relative(23) }, Const { destination: Direct(32772), bit_size: Integer(U32), value: 10 }, Call { location: 381 }, Mov { destination: Relative(25), source: Direct(32773) }, BinaryIntOp { destination: Relative(26), op: Add, bit_size: U32, lhs: Relative(25), rhs: Relative(22) }, Store { destination_pointer: Relative(26), source: Relative(10) }, Store { destination_pointer: Relative(27), source: Relative(25) }, Mov { destination: Relative(23), source: Direct(1) }, Const { destination: Relative(26), bit_size: Integer(U32), value: 4 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(26) }, IndirectConst { destination_pointer: Relative(23), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(26), op: Add, bit_size: U32, lhs: Relative(25), rhs: Direct(2) }, Const { destination: Relative(27), bit_size: Integer(U32), value: 9 }, BinaryIntOp { destination: Relative(28), op: Add, bit_size: U32, lhs: Relative(24), rhs: Direct(2) }, Const { destination: Relative(29), bit_size: Integer(U32), value: 6 }, BinaryIntOp { destination: Relative(30), op: Add, bit_size: U32, lhs: Relative(23), rhs: Direct(2) }, BlackBox(MultiScalarMul { points: HeapVector { pointer: Relative(26), size: Relative(27) }, scalars: HeapVector { pointer: Relative(28), size: Relative(29) }, outputs: HeapArray { pointer: Relative(30), size: 3 } }), BinaryIntOp { destination: Relative(25), op: Add, bit_size: U32, lhs: Relative(23), rhs: Relative(14) }, Load { destination: Relative(24), source_pointer: Relative(25) }, Store { destination_pointer: Relative(2), source: Relative(24) }, BinaryIntOp { destination: Relative(23), op: Add, bit_size: U32, lhs: Relative(4), rhs: Relative(14) }, Mov { destination: Relative(4), source: Relative(23) }, Jump { location: 182 }, BinaryIntOp { destination: Relative(28), op: Add, bit_size: U32, lhs: Relative(26), rhs: Direct(2) }, BinaryIntOp { destination: Relative(29), op: Add, bit_size: U32, lhs: Relative(28), rhs: Relative(25) }, Load { destination: Relative(24), source_pointer: Relative(29) }, Cast { destination: Relative(29), source: Relative(24), bit_size: Integer(U128) }, Cast { destination: Relative(28), source: Relative(29), bit_size: Field }, BinaryFieldOp { destination: Relative(29), op: Sub, lhs: Relative(24), rhs: Relative(28) }, BinaryFieldOp { destination: Relative(30), op: Mul, lhs: Relative(29), rhs: Relative(12) }, BinaryFieldOp { destination: Relative(29), op: Mul, lhs: Direct(32835), rhs: Relative(30) }, BinaryFieldOp { destination: Relative(31), op: Add, lhs: Relative(28), rhs: Relative(29) }, BinaryFieldOp { destination: Relative(29), op: Equals, lhs: Relative(24), rhs: Relative(31) }, JumpIf { condition: Relative(29), location: 305 }, Const { destination: Relative(32), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(32) } }, Load { destination: Relative(24), source_pointer: Relative(23) }, BinaryIntOp { destination: Relative(29), op: Mul, bit_size: U32, lhs: Relative(25), rhs: Relative(11) }, Mov { destination: Direct(32771), source: Relative(24) }, Const { destination: Direct(32772), bit_size: Integer(U32), value: 7 }, Call { location: 381 }, Mov { destination: Relative(31), source: Direct(32773) }, BinaryIntOp { destination: Relative(32), op: Add, bit_size: U32, lhs: Relative(31), rhs: Direct(2) }, BinaryIntOp { destination: Relative(33), op: Add, bit_size: U32, lhs: Relative(32), rhs: Relative(29) }, Store { destination_pointer: Relative(33), source: Relative(28) }, BinaryIntOp { destination: Relative(24), op: Add, bit_size: U32, lhs: Relative(29), rhs: Relative(14) }, Mov { destination: Direct(32771), source: Relative(31) }, Const { destination: Direct(32772), bit_size: Integer(U32), value: 7 }, Call { location: 381 }, Mov { destination: Relative(28), source: Direct(32773) }, BinaryIntOp { destination: Relative(29), op: Add, bit_size: U32, lhs: Relative(28), rhs: Direct(2) }, BinaryIntOp { destination: Relative(32), op: Add, bit_size: U32, lhs: Relative(29), rhs: Relative(24) }, Store { destination_pointer: Relative(32), source: Relative(30) }, Store { destination_pointer: Relative(23), source: Relative(28) }, BinaryIntOp { destination: Relative(24), op: Mul, bit_size: U32, lhs: Relative(25), rhs: Relative(9) }, BinaryIntOp { destination: Relative(29), op: Add, bit_size: U32, lhs: Relative(13), rhs: Direct(2) }, BinaryIntOp { destination: Relative(30), op: Add, bit_size: U32, lhs: Relative(29), rhs: Relative(24) }, Load { destination: Relative(28), source_pointer: Relative(30) }, BinaryIntOp { destination: Relative(29), op: Add, bit_size: U32, lhs: Relative(24), rhs: Relative(14) }, BinaryIntOp { destination: Relative(31), op: Add, bit_size: U32, lhs: Relative(13), rhs: Direct(2) }, BinaryIntOp { destination: Relative(32), op: Add, bit_size: U32, lhs: Relative(31), rhs: Relative(29) }, Load { destination: Relative(30), source_pointer: Relative(32) }, BinaryIntOp { destination: Relative(31), op: Add, bit_size: U32, lhs: Relative(24), rhs: Relative(11) }, BinaryIntOp { destination: Relative(33), op: Add, bit_size: U32, lhs: Relative(13), rhs: Direct(2) }, BinaryIntOp { destination: Relative(34), op: Add, bit_size: U32, lhs: Relative(33), rhs: Relative(31) }, Load { destination: Relative(32), source_pointer: Relative(34) }, Load { destination: Relative(31), source_pointer: Relative(27) }, Mov { destination: Direct(32771), source: Relative(31) }, Const { destination: Direct(32772), bit_size: Integer(U32), value: 10 }, Call { location: 381 }, Mov { destination: Relative(33), source: Direct(32773) }, BinaryIntOp { destination: Relative(34), op: Add, bit_size: U32, lhs: Relative(33), rhs: Direct(2) }, BinaryIntOp { destination: Relative(35), op: Add, bit_size: U32, lhs: Relative(34), rhs: Relative(24) }, Store { destination_pointer: Relative(35), source: Relative(28) }, Mov { destination: Direct(32771), source: Relative(33) }, Const { destination: Direct(32772), bit_size: Integer(U32), value: 10 }, Call { location: 381 }, Mov { destination: Relative(24), source: Direct(32773) }, BinaryIntOp { destination: Relative(28), op: Add, bit_size: U32, lhs: Relative(24), rhs: Direct(2) }, BinaryIntOp { destination: Relative(31), op: Add, bit_size: U32, lhs: Relative(28), rhs: Relative(29) }, Store { destination_pointer: Relative(31), source: Relative(30) }, BinaryIntOp { destination: Relative(28), op: Add, bit_size: U32, lhs: Relative(29), rhs: Relative(14) }, Mov { destination: Direct(32771), source: Relative(24) }, Const { destination: Direct(32772), bit_size: Integer(U32), value: 10 }, Call { location: 381 }, Mov { destination: Relative(29), source: Direct(32773) }, BinaryIntOp { destination: Relative(30), op: Add, bit_size: U32, lhs: Relative(29), rhs: Direct(2) }, BinaryIntOp { destination: Relative(31), op: Add, bit_size: U32, lhs: Relative(30), rhs: Relative(28) }, Store { destination_pointer: Relative(31), source: Relative(32) }, Store { destination_pointer: Relative(27), source: Relative(29) }, BinaryIntOp { destination: Relative(24), op: Add, bit_size: U32, lhs: Relative(25), rhs: Relative(14) }, Mov { destination: Relative(25), source: Relative(24) }, Jump { location: 239 }, Const { destination: Direct(32774), bit_size: Integer(U32), value: 2 }, BinaryIntOp { destination: Direct(32773), op: Div, bit_size: U32, lhs: Direct(32772), rhs: Direct(32774) }, Mov { destination: Direct(32776), source: Direct(32772) }, Const { destination: Direct(32777), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Direct(32778), op: LessThan, bit_size: U32, lhs: Direct(32777), rhs: Direct(32773) }, Not { destination: Direct(32778), source: Direct(32778), bit_size: U1 }, JumpIf { condition: Direct(32778), location: 380 }, BinaryIntOp { destination: Direct(32776), op: Sub, bit_size: U32, lhs: Direct(32776), rhs: Direct(2) }, BinaryIntOp { destination: Direct(32779), op: Add, bit_size: U32, lhs: Direct(32771), rhs: Direct(32777) }, Load { destination: Direct(32774), source_pointer: Direct(32779) }, BinaryIntOp { destination: Direct(32779), op: Add, bit_size: U32, lhs: Direct(32771), rhs: Direct(32776) }, Load { destination: Direct(32775), source_pointer: Direct(32779) }, BinaryIntOp { destination: Direct(32779), op: Add, bit_size: U32, lhs: Direct(32771), rhs: Direct(32777) }, Store { destination_pointer: Direct(32779), source: Direct(32775) }, BinaryIntOp { destination: Direct(32779), op: Add, bit_size: U32, lhs: Direct(32771), rhs: Direct(32776) }, Store { destination_pointer: Direct(32779), source: Direct(32774) }, BinaryIntOp { destination: Direct(32777), op: Add, bit_size: U32, lhs: Direct(32777), rhs: Direct(2) }, Jump { location: 366 }, Return, Load { destination: Direct(32774), source_pointer: Direct(32771) }, BinaryIntOp { destination: Direct(32775), op: Equals, bit_size: U32, lhs: Direct(32774), rhs: Direct(2) }, JumpIf { condition: Direct(32775), location: 385 }, Jump { location: 387 }, Mov { destination: Direct(32773), source: Direct(32771) }, Jump { location: 402 }, Mov { destination: Direct(32773), source: Direct(1) }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Direct(32772) }, BinaryIntOp { destination: Direct(32777), op: Add, bit_size: U32, lhs: Direct(32771), rhs: Direct(32772) }, Mov { destination: Direct(32778), source: Direct(32771) }, Mov { destination: Direct(32779), source: Direct(32773) }, BinaryIntOp { destination: Direct(32780), op: Equals, bit_size: U32, lhs: Direct(32778), rhs: Direct(32777) }, JumpIf { condition: Direct(32780), location: 399 }, Load { destination: Direct(32776), source_pointer: Direct(32778) }, Store { destination_pointer: Direct(32779), source: Direct(32776) }, BinaryIntOp { destination: Direct(32778), op: Add, bit_size: U32, lhs: Direct(32778), rhs: Direct(2) }, BinaryIntOp { destination: Direct(32779), op: Add, bit_size: U32, lhs: Direct(32779), rhs: Direct(2) }, Jump { location: 392 }, IndirectConst { destination_pointer: Direct(32773), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Direct(32774), op: Sub, bit_size: U32, lhs: Direct(32774), rhs: Direct(2) }, Jump { location: 402 }, Return]" ], - "debug_symbols": "pZjbTuNKEEX/Jc95cFV19YVfQQgFCKNIUUCZ5EhHKP8+Xa7aDowUizEv7BXiXtju3R2Hj9XL9un863F3eH37vbq7/1g9HXf7/e7X4/7teXPavR36bz9Wg/3Q/pPWKyUP9hCP5KEe2aN4VI+2uuP1Kg8e5MEe3SI9kod6ZI/iUT3aGGXwII9uST3EI3noGLUPzz2qRxujDR7kwR7ikTzUI3u4pbmluYWGrlFLiuTIbmqWKVIjc2SJrJHNk4ZIiuTI8FH4KHwUPgofhY/Cx+Fjm7LBgAECSAAFZEABVEALkAEAs8AsMAvMArPALDALzAJzgjnBnGBOMCeYk5nZIAMKoAJawFjfEQjAAAEkAMwKs8KsMCvMGeYMc4Y5w5xhzjBnmKsdLAb9rWJpfyoZVEALsKqSVczKStZBq6uDApofw1ZPBwIwIPvBbFV0qIAWYG10IAADBJAAXkmOSnJUkqOSHJXkqCQzRXKkRKbI8KGNjDYy2shoI6ONjDYy2shoI6ONjDYy2shj9/p957Fp1cBG2V8fmzaCAjKgACqgBYxNG4EADIBZYVaYrWls52NNYzKogBYwbp4jEIABAkgABWQAzBnmDHOBucBcYC4wF5gLzMXMbFAAFdAC6gAgAAMEkAAKMLMYFEAdVwfbWrC0pcDJQAAJYBabSNu9Hcxid9l2cLG7bKtE+jWIrRJhA/swEQMGCCABzKwG9uGUDAqgAlqALSAHAjBAAAmgAJgJZoKZYGaYGWaG2RaS2BnaSnJQQAYUQAW0AFtLDgRgAMwCs8Bsa0myQQFUQAuwnd2BAAwQQAIoAOYEc4I5wawwK8wKs8KsMCvMCrPCrDDraL5c1is8BT2ejtutPQR9eizqD0vvm+P2cFrdHc77/Xr132Z/Hg/6/b45jHnaHPu7vW7bw0vPLnzd7bdGl/V19HB7KOUWg/vOOQ3X74/X8qPxfS/D+FYWjBfC+F6NBePTdP2p6q3xOnP9fQsPQX+w4clA9btnUFRCUAe+dQZl5g72jQu3sK/A6xm0L4Y6Nwc8TaJyXWLIAy6ifzzwEkOhyVDqcMtANFMFta3Cu6At3VLMTIUKzkElLSiTZpRRiywYnxNmMucli6lMi6HwzSrNTkKbdoM6DEumseV0Xc9pkWGYzqH1Yf9u6J+GGT3o3w0WGYZpV+nfjRYZEk2GRj82LLqTNfE0m7poNiunq+HmVfDM/phoms7Uvw/dVOTbir4tYoP8vL2Vr4Iyt6xwFVllkaBiKnKtywTTwhxun8HcbWTBKaT+TL1oJpj1xwoq31DMNopoahTTIkOZPqzqp0eGfzHk6zn8tUc99Feb593xy3+nLuY67jZP+228fD0fnj+9e/r/He/gv1vvx7fn7cv5uDXT9V9c/ce99DalgR/6N2l7lXktdeiv+pPkff8uIdXesQP7hdbxMDuuyrrqw8VO8Q8=", + "debug_symbols": "pZjbTuM8FIXfpde98D75wKsghAqUUaWqoA780i/Eu493tldaRmrFhBvWVxp/JPGym/Kxeto+vP+63x2eX36vbm4/Vg/H3X6/+3W/f3ncvO1eDv23H6vkP6z/pPXKKIIjJEIjLCJHlIga0VY3vF7lFEERHNEt0kMjLCJHlIga0aYoKYIiukV7SIRG2BS1D889akSboqUIiuAIidAIi8gRYWlhaWGh1DXmSSN5ZDc1Tx1pI/PIMrKObJGURtJIHjl8NHw0fDR8NHw0fDR8PHzsU5YcGCAABRggAwqgAtoASQCYBWaBWWAWmAVmgVlgFpgVZoVZYVaYFWZ1MztkQAFUQBsw1XcCAjBAAAqA2WA2mA1mgznDnGHOMGeYM8wZ5gxz9YPFob9VPP1PqUMFtAFeVfKKeVnJO+h1DTBAi2PY6xlAAAbkOJi9igEV0AZ4GwMIwAABKCAqyaOSPCrJo5I8Ksmjksw0kkfKSB05fGgjo42MNjLayGgjo42MNjLayGgjo42MNvLUvX7feWpadfBR/tenpk1ggAwogApoA6amTUAABsBsMBvM3jT28/GmMTlUQBswbZ4TEIABAlCAATIA5gxzhrnAXGAuMBeYC8wF5uJmdiiACmgDagIQgAECUIAB3CwOBVCn1cG+Fjx9KbA6CEABbvGJ9N07wC1+l30HF7/LvkqkX4P4KhF28A8TcWCAABTgZnPwDyd1KIAKaAN8AQUQgAECUIABYCaYCWaCmWFmmBlmX0jiZ+grKcAAGVAAFdAG+FoKIAADYBaYBWZfS5IdCqAC2gDf2QMIwAABKMAAMCvMCrPCbDAbzAazwWwwG8wGs8FsMNtk/vxcr/AUdP923G79Iejssag/LL1ujtvD2+rm8L7fr1f/bfbv00G/XzeHKd82x/5ur9v28NSzC593+63T5/o0Ol0eSrmNwX3nnIfb98db+dH4vpdhfCsLxgthfK/GgvE6X79WuzTerlx/38KHoD/Y8Gyg+t0zKPMdKK1dOoNy5Q72jQu3sK/A0xm0L4Z6bQ54nkTjusSQk8CQlZcYCs2GUtMlA9GVKphvFdEFa3pJcWUqTHAOJrqgTJYxlVZkwfisuIBsS8pcEuax0MUqXZ2ENu8GNaUl09iyntazLjKk+Rza2VV839A/DTN60L8bLDKkeVfp340WGZRmQ6MfGxbdyao8z6Ytms3KejJcvAq+sj8qzdOp/fvQRUW+rKgJl1HPt7fyVVCuLSudl5UsElRMRa51mWDe49PlM7h2G1lwCtqfqRfNBLP9WEHlG4qrjSKaG8W0yFDmD6t69sjwL4Z8Ooe/9qi7/mrzuDt++e/Up7uOu83DfjtePr8fHs/effv/Fe/gv1uvx5fH7dP7ceum07+4+o9b6W3SxHf9m7S/yryWmvqr/iR5279LSPV3/MB+oXU6zI+rsq529+mn+Ac=", "file_map": { "17": { "source": "use crate::field::field_less_than;\nuse crate::runtime::is_unconstrained;\n\n// The low and high decomposition of the field modulus\nglobal PLO: Field = 53438638232309528389504892708671455233;\nglobal PHI: Field = 64323764613183177041862057485226039389;\n\npub(crate) global TWO_POW_128: Field = 0x100000000000000000000000000000000;\n\n// Decomposes a single field into two 16 byte fields.\nfn compute_decomposition(x: Field) -> (Field, Field) {\n // Here's we're taking advantage of truncating 128 bit limbs from the input field\n // and then subtracting them from the input such the field division is equivalent to integer division.\n let low = (x as u128) as Field;\n let high = (x - low) / TWO_POW_128;\n\n (low, high)\n}\n\npub(crate) unconstrained fn decompose_hint(x: Field) -> (Field, Field) {\n compute_decomposition(x)\n}\n\nunconstrained fn lte_hint(x: Field, y: Field) -> bool {\n if x == y {\n true\n } else {\n field_less_than(x, y)\n }\n}\n\n// Assert that (alo > blo && ahi >= bhi) || (alo <= blo && ahi > bhi)\nfn assert_gt_limbs(a: (Field, Field), b: (Field, Field)) {\n let (alo, ahi) = a;\n let (blo, bhi) = b;\n // Safety: borrow is enforced to be boolean due to its type.\n // if borrow is 0, it asserts that (alo > blo && ahi >= bhi)\n // if borrow is 1, it asserts that (alo <= blo && ahi > bhi)\n unsafe {\n let borrow = lte_hint(alo, blo);\n\n let rlo = alo - blo - 1 + (borrow as Field) * TWO_POW_128;\n let rhi = ahi - bhi - (borrow as Field);\n\n rlo.assert_max_bit_size::<128>();\n rhi.assert_max_bit_size::<128>();\n }\n}\n\n/// Decompose a single field into two 16 byte fields.\npub fn decompose(x: Field) -> (Field, Field) {\n if is_unconstrained() {\n compute_decomposition(x)\n } else {\n // Safety: decomposition is properly checked below\n unsafe {\n // Take hints of the decomposition\n let (xlo, xhi) = decompose_hint(x);\n\n // Range check the limbs\n xlo.assert_max_bit_size::<128>();\n xhi.assert_max_bit_size::<128>();\n\n // Check that the decomposition is correct\n assert_eq(x, xlo + TWO_POW_128 * xhi);\n\n // Assert that the decomposition of P is greater than the decomposition of x\n assert_gt_limbs((PLO, PHI), (xlo, xhi));\n (xlo, xhi)\n }\n }\n}\n\npub fn assert_gt(a: Field, b: Field) {\n if is_unconstrained() {\n assert(\n // Safety: already unconstrained\n unsafe { field_less_than(b, a) },\n );\n } else {\n // Decompose a and b\n let a_limbs = decompose(a);\n let b_limbs = decompose(b);\n\n // Assert that a_limbs is greater than b_limbs\n assert_gt_limbs(a_limbs, b_limbs)\n }\n}\n\npub fn assert_lt(a: Field, b: Field) {\n assert_gt(b, a);\n}\n\npub fn gt(a: Field, b: Field) -> bool {\n if is_unconstrained() {\n // Safety: unsafe in unconstrained\n unsafe {\n field_less_than(b, a)\n }\n } else if a == b {\n false\n } else {\n // Safety: Take a hint of the comparison and verify it\n unsafe {\n if field_less_than(a, b) {\n assert_gt(b, a);\n false\n } else {\n assert_gt(a, b);\n true\n }\n }\n }\n}\n\npub fn lt(a: Field, b: Field) -> bool {\n gt(b, a)\n}\n\nmod tests {\n // TODO: Allow imports from \"super\"\n use crate::field::bn254::{assert_gt, decompose, gt, lte_hint, PHI, PLO, TWO_POW_128};\n\n #[test]\n fn check_decompose() {\n assert_eq(decompose(TWO_POW_128), (0, 1));\n assert_eq(decompose(TWO_POW_128 + 0x1234567890), (0x1234567890, 1));\n assert_eq(decompose(0x1234567890), (0x1234567890, 0));\n }\n\n #[test]\n unconstrained fn check_decompose_unconstrained() {\n assert_eq(decompose(TWO_POW_128), (0, 1));\n assert_eq(decompose(TWO_POW_128 + 0x1234567890), (0x1234567890, 1));\n assert_eq(decompose(0x1234567890), (0x1234567890, 0));\n }\n\n #[test]\n unconstrained fn check_lte_hint() {\n assert(lte_hint(0, 1));\n assert(lte_hint(0, 0x100));\n assert(lte_hint(0x100, TWO_POW_128 - 1));\n assert(!lte_hint(0 - 1, 0));\n\n assert(lte_hint(0, 0));\n assert(lte_hint(0x100, 0x100));\n assert(lte_hint(0 - 1, 0 - 1));\n }\n\n #[test]\n fn check_assert_gt() {\n assert_gt(1, 0);\n assert_gt(0x100, 0);\n assert_gt((0 - 1), (0 - 2));\n assert_gt(TWO_POW_128, 0);\n assert_gt(0 - 1, 0);\n }\n\n #[test]\n unconstrained fn check_assert_gt_unconstrained() {\n assert_gt(1, 0);\n assert_gt(0x100, 0);\n assert_gt((0 - 1), (0 - 2));\n assert_gt(TWO_POW_128, 0);\n assert_gt(0 - 1, 0);\n }\n\n #[test]\n fn check_gt() {\n assert(gt(1, 0));\n assert(gt(0x100, 0));\n assert(gt((0 - 1), (0 - 2)));\n assert(gt(TWO_POW_128, 0));\n assert(!gt(0, 0));\n assert(!gt(0, 0x100));\n assert(gt(0 - 1, 0 - 2));\n assert(!gt(0 - 2, 0 - 1));\n }\n\n #[test]\n unconstrained fn check_gt_unconstrained() {\n assert(gt(1, 0));\n assert(gt(0x100, 0));\n assert(gt((0 - 1), (0 - 2)));\n assert(gt(TWO_POW_128, 0));\n assert(!gt(0, 0));\n assert(!gt(0, 0x100));\n assert(gt(0 - 1, 0 - 2));\n assert(!gt(0 - 2, 0 - 1));\n }\n\n #[test]\n fn check_plo_phi() {\n assert_eq(PLO + PHI * TWO_POW_128, 0);\n let p_bytes = crate::field::modulus_le_bytes();\n let mut p_low: Field = 0;\n let mut p_high: Field = 0;\n\n let mut offset = 1;\n for i in 0..16 {\n p_low += (p_bytes[i] as Field) * offset;\n p_high += (p_bytes[i + 16] as Field) * offset;\n offset *= 256;\n }\n assert_eq(p_low, PLO);\n assert_eq(p_high, PHI);\n }\n}\n", @@ -91,7 +91,7 @@ expression: artifact "path": "std/hash/mod.nr" }, "50": { - "source": "fn main(\n old_root: Field,\n old_leaf: Field,\n old_hash_path: [Field; 3],\n new_root: pub Field,\n leaf: Field,\n index: Field,\n) {\n assert(old_root == compute_merkle_root(old_leaf, index, old_hash_path));\n\n let calculated_root = compute_merkle_root(leaf, index, old_hash_path);\n assert(new_root == calculated_root);\n}\n\nfn compute_merkle_root(leaf: Field, index: Field, hash_path: [Field; N]) -> Field {\n let index_bits: [u1; N] = index.to_le_bits();\n let mut current = leaf;\n for i in 0..N {\n let path_bit = index_bits[i] as bool;\n let (hash_left, hash_right) = if path_bit {\n (hash_path[i], current)\n } else {\n (current, hash_path[i])\n };\n current = std::hash::pedersen_hash([hash_left, hash_right]);\n }\n current\n}\n", + "source": "fn main(\n old_root: Field,\n old_leaf: Field,\n old_hash_path: [Field; 3],\n new_root: pub Field,\n leaf: Field,\n index: Field,\n) {\n assert(old_root == compute_merkle_root(old_leaf, index, old_hash_path));\n\n let calculated_root = compute_merkle_root(leaf, index, old_hash_path);\n assert(new_root == calculated_root);\n}\n\nfn compute_merkle_root(leaf: Field, index: Field, hash_path: [Field; N]) -> Field {\n let index_bits: [u1; N] = index.to_le_bits();\n let mut current = leaf;\n for i in 0..N {\n let path_bit = index_bits[i] != 0;\n let (hash_left, hash_right) = if path_bit {\n (hash_path[i], current)\n } else {\n (current, hash_path[i])\n };\n current = std::hash::pedersen_hash([hash_left, hash_right]);\n }\n current\n}\n", "path": "" } }, diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/merkle_insert/execute__tests__force_brillig_true_inliner_9223372036854775807.snap b/tooling/nargo_cli/tests/snapshots/execution_success/merkle_insert/execute__tests__force_brillig_true_inliner_9223372036854775807.snap index b4b9ea17d3a..98d7e81877c 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/merkle_insert/execute__tests__force_brillig_true_inliner_9223372036854775807.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/merkle_insert/execute__tests__force_brillig_true_inliner_9223372036854775807.snap @@ -76,7 +76,7 @@ expression: artifact "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(7), bit_size: Integer(U32), value: 8 }, Const { destination: Relative(8), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(32836), size_address: Relative(7), offset_address: Relative(8) }, Mov { destination: Relative(1), source: Direct(32836) }, Mov { destination: Relative(2), source: Direct(32837) }, Const { destination: Relative(3), bit_size: Integer(U32), value: 32838 }, Const { destination: Relative(8), bit_size: Integer(U32), value: 3 }, Mov { destination: Relative(7), source: Direct(1) }, Const { destination: Relative(9), bit_size: Integer(U32), value: 4 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(9) }, IndirectConst { destination_pointer: Relative(7), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(9), op: Add, bit_size: U32, lhs: Relative(7), rhs: Direct(2) }, Mov { destination: Direct(32771), source: Relative(3) }, Mov { destination: Direct(32772), source: Relative(9) }, Mov { destination: Direct(32773), source: Relative(8) }, Call { location: 28 }, Mov { destination: Relative(3), source: Relative(7) }, Mov { destination: Relative(4), source: Direct(32841) }, Mov { destination: Relative(5), source: Direct(32842) }, Mov { destination: Relative(6), source: Direct(32843) }, Call { location: 39 }, Call { location: 41 }, Const { destination: Relative(1), bit_size: Integer(U32), value: 32844 }, Const { destination: Relative(2), bit_size: Integer(U32), value: 0 }, Stop { return_data: HeapVector { pointer: Relative(1), size: Relative(2) } }, BinaryIntOp { destination: Direct(32775), op: Add, bit_size: U32, lhs: Direct(32771), rhs: Direct(32773) }, Mov { destination: Direct(32776), source: Direct(32771) }, Mov { destination: Direct(32777), source: Direct(32772) }, BinaryIntOp { destination: Direct(32778), op: Equals, bit_size: U32, lhs: Direct(32776), rhs: Direct(32775) }, JumpIf { condition: Direct(32778), location: 38 }, Load { destination: Direct(32774), source_pointer: Direct(32776) }, Store { destination_pointer: Direct(32777), source: Direct(32774) }, BinaryIntOp { destination: Direct(32776), op: Add, bit_size: U32, lhs: Direct(32776), rhs: Direct(2) }, BinaryIntOp { destination: Direct(32777), op: Add, bit_size: U32, lhs: Direct(32777), rhs: Direct(2) }, Jump { location: 31 }, Return, Const { destination: Direct(32835), bit_size: Field, value: 340282366920938463463374607431768211456 }, Return, Call { location: 533 }, Load { destination: Relative(8), source_pointer: Relative(3) }, Const { destination: Relative(9), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(10), op: Equals, bit_size: U32, lhs: Relative(9), rhs: Relative(8) }, Not { destination: Relative(10), source: Relative(10), bit_size: U1 }, JumpIf { condition: Relative(10), location: 48 }, Call { location: 539 }, BinaryIntOp { destination: Relative(8), op: Add, bit_size: U32, lhs: Relative(8), rhs: Direct(2) }, Store { destination_pointer: Relative(3), source: Relative(8) }, Const { destination: Relative(10), bit_size: Integer(U32), value: 2 }, Const { destination: Relative(11), bit_size: Integer(U1), value: 1 }, Mov { destination: Relative(8), source: Direct(1) }, Const { destination: Relative(12), bit_size: Integer(U32), value: 4 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(12) }, IndirectConst { destination_pointer: Relative(8), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(12), op: Add, bit_size: U32, lhs: Relative(8), rhs: Direct(2) }, Const { destination: Relative(13), bit_size: Integer(U32), value: 3 }, BlackBox(ToRadix { input: Relative(6), radix: Relative(10), output_pointer: Relative(12), num_limbs: Relative(13), output_bits: Relative(11) }), Const { destination: Relative(14), bit_size: Integer(U32), value: 3 }, Mov { destination: Direct(32771), source: Relative(12) }, Mov { destination: Direct(32772), source: Relative(14) }, Call { location: 542 }, Mov { destination: Relative(6), source: Direct(1) }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Direct(2) }, Store { destination_pointer: Relative(6), source: Relative(2) }, Const { destination: Relative(2), bit_size: Field, value: 0 }, Mov { destination: Relative(10), source: Direct(1) }, Const { destination: Relative(11), bit_size: Integer(U32), value: 7 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(11) }, IndirectConst { destination_pointer: Relative(10), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(11), op: Add, bit_size: U32, lhs: Relative(10), rhs: Direct(2) }, Mov { destination: Relative(12), source: Relative(11) }, Store { destination_pointer: Relative(12), source: Relative(2) }, BinaryIntOp { destination: Relative(12), op: Add, bit_size: U32, lhs: Relative(12), rhs: Direct(2) }, Store { destination_pointer: Relative(12), source: Relative(2) }, BinaryIntOp { destination: Relative(12), op: Add, bit_size: U32, lhs: Relative(12), rhs: Direct(2) }, Store { destination_pointer: Relative(12), source: Relative(2) }, BinaryIntOp { destination: Relative(12), op: Add, bit_size: U32, lhs: Relative(12), rhs: Direct(2) }, Store { destination_pointer: Relative(12), source: Relative(2) }, BinaryIntOp { destination: Relative(12), op: Add, bit_size: U32, lhs: Relative(12), rhs: Direct(2) }, Store { destination_pointer: Relative(12), source: Relative(2) }, BinaryIntOp { destination: Relative(12), op: Add, bit_size: U32, lhs: Relative(12), rhs: Direct(2) }, Store { destination_pointer: Relative(12), source: Relative(2) }, Const { destination: Relative(11), bit_size: Integer(U1), value: 1 }, Mov { destination: Relative(12), source: Direct(1) }, Const { destination: Relative(13), bit_size: Integer(U32), value: 10 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(13) }, IndirectConst { destination_pointer: Relative(12), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(13), op: Add, bit_size: U32, lhs: Relative(12), rhs: Direct(2) }, Mov { destination: Relative(14), source: Relative(13) }, Store { destination_pointer: Relative(14), source: Relative(2) }, BinaryIntOp { destination: Relative(14), op: Add, bit_size: U32, lhs: Relative(14), rhs: Direct(2) }, Store { destination_pointer: Relative(14), source: Relative(2) }, BinaryIntOp { destination: Relative(14), op: Add, bit_size: U32, lhs: Relative(14), rhs: Direct(2) }, Store { destination_pointer: Relative(14), source: Relative(11) }, BinaryIntOp { destination: Relative(14), op: Add, bit_size: U32, lhs: Relative(14), rhs: Direct(2) }, Store { destination_pointer: Relative(14), source: Relative(2) }, BinaryIntOp { destination: Relative(14), op: Add, bit_size: U32, lhs: Relative(14), rhs: Direct(2) }, Store { destination_pointer: Relative(14), source: Relative(2) }, BinaryIntOp { destination: Relative(14), op: Add, bit_size: U32, lhs: Relative(14), rhs: Direct(2) }, Store { destination_pointer: Relative(14), source: Relative(11) }, BinaryIntOp { destination: Relative(14), op: Add, bit_size: U32, lhs: Relative(14), rhs: Direct(2) }, Store { destination_pointer: Relative(14), source: Relative(2) }, BinaryIntOp { destination: Relative(14), op: Add, bit_size: U32, lhs: Relative(14), rhs: Direct(2) }, Store { destination_pointer: Relative(14), source: Relative(2) }, BinaryIntOp { destination: Relative(14), op: Add, bit_size: U32, lhs: Relative(14), rhs: Direct(2) }, Store { destination_pointer: Relative(14), source: Relative(11) }, Const { destination: Relative(11), bit_size: Field, value: 3728882899078719075161482178784387565366481897740339799480980287259621149274 }, Const { destination: Relative(13), bit_size: Field, value: -9903063709032878667290627648209915537972247634463802596148419711785767431332 }, Const { destination: Relative(14), bit_size: Integer(U1), value: 0 }, Const { destination: Relative(15), bit_size: Field, value: 2393473289045184898987089634332637236754766663897650125720167164137088869378 }, Const { destination: Relative(16), bit_size: Field, value: -7135402912423807765050323395026152633898511180575289670895350565966806597339 }, Mov { destination: Relative(17), source: Direct(1) }, Const { destination: Relative(18), bit_size: Integer(U32), value: 7 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(18) }, IndirectConst { destination_pointer: Relative(17), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(18), op: Add, bit_size: U32, lhs: Relative(17), rhs: Direct(2) }, Mov { destination: Relative(19), source: Relative(18) }, Store { destination_pointer: Relative(19), source: Relative(11) }, BinaryIntOp { destination: Relative(19), op: Add, bit_size: U32, lhs: Relative(19), rhs: Direct(2) }, Store { destination_pointer: Relative(19), source: Relative(13) }, BinaryIntOp { destination: Relative(19), op: Add, bit_size: U32, lhs: Relative(19), rhs: Direct(2) }, Store { destination_pointer: Relative(19), source: Relative(14) }, BinaryIntOp { destination: Relative(19), op: Add, bit_size: U32, lhs: Relative(19), rhs: Direct(2) }, Store { destination_pointer: Relative(19), source: Relative(15) }, BinaryIntOp { destination: Relative(19), op: Add, bit_size: U32, lhs: Relative(19), rhs: Direct(2) }, Store { destination_pointer: Relative(19), source: Relative(16) }, BinaryIntOp { destination: Relative(19), op: Add, bit_size: U32, lhs: Relative(19), rhs: Direct(2) }, Store { destination_pointer: Relative(19), source: Relative(14) }, Const { destination: Relative(11), bit_size: Integer(U32), value: 0 }, Const { destination: Relative(13), bit_size: Integer(U32), value: 3 }, Const { destination: Relative(15), bit_size: Integer(U32), value: 2 }, Const { destination: Relative(16), bit_size: Field, value: 8680525429001239497728366687280168587232520577698044359798894838135247199343 }, Const { destination: Relative(18), bit_size: Integer(U32), value: 1 }, Const { destination: Relative(19), bit_size: Field, value: 2 }, Const { destination: Relative(20), bit_size: Integer(U32), value: 5 }, Const { destination: Relative(21), bit_size: Integer(U32), value: 6 }, Const { destination: Relative(22), bit_size: Field, value: -1094708040843609169356775910874053498301840173462935739639689208799068762676 }, Const { destination: Relative(23), bit_size: Integer(U32), value: 7 }, Const { destination: Relative(24), bit_size: Field, value: -718703907181967287621274717949248537252263842169639534402461291799004475262 }, Const { destination: Relative(25), bit_size: Integer(U32), value: 8 }, Const { destination: Relative(26), bit_size: Integer(U32), value: 9 }, Mov { destination: Relative(7), source: Relative(11) }, Jump { location: 145 }, BinaryIntOp { destination: Relative(9), op: LessThan, bit_size: U32, lhs: Relative(7), rhs: Relative(13) }, JumpIf { condition: Relative(9), location: 358 }, Jump { location: 148 }, Load { destination: Relative(9), source_pointer: Relative(6) }, BinaryFieldOp { destination: Relative(6), op: Equals, lhs: Relative(1), rhs: Relative(9) }, JumpIf { condition: Relative(6), location: 153 }, Const { destination: Relative(27), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(27) } }, Mov { destination: Relative(1), source: Direct(1) }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Direct(2) }, Store { destination_pointer: Relative(1), source: Relative(5) }, Load { destination: Relative(5), source_pointer: Relative(10) }, Const { destination: Relative(6), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(9), op: Equals, bit_size: U32, lhs: Relative(6), rhs: Relative(5) }, Not { destination: Relative(9), source: Relative(9), bit_size: U1 }, JumpIf { condition: Relative(9), location: 162 }, Call { location: 539 }, BinaryIntOp { destination: Relative(5), op: Add, bit_size: U32, lhs: Relative(5), rhs: Direct(2) }, Store { destination_pointer: Relative(10), source: Relative(5) }, Load { destination: Relative(5), source_pointer: Relative(12) }, Const { destination: Relative(9), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(27), op: Equals, bit_size: U32, lhs: Relative(9), rhs: Relative(5) }, Not { destination: Relative(27), source: Relative(27), bit_size: U1 }, JumpIf { condition: Relative(27), location: 170 }, Call { location: 539 }, BinaryIntOp { destination: Relative(5), op: Add, bit_size: U32, lhs: Relative(5), rhs: Direct(2) }, Store { destination_pointer: Relative(12), source: Relative(5) }, Mov { destination: Relative(7), source: Relative(11) }, Jump { location: 174 }, BinaryIntOp { destination: Relative(5), op: LessThan, bit_size: U32, lhs: Relative(7), rhs: Relative(13) }, JumpIf { condition: Relative(5), location: 183 }, Jump { location: 177 }, Load { destination: Relative(2), source_pointer: Relative(1) }, BinaryFieldOp { destination: Relative(1), op: Equals, lhs: Relative(4), rhs: Relative(2) }, JumpIf { condition: Relative(1), location: 182 }, Const { destination: Relative(3), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(3) } }, Return, BinaryIntOp { destination: Relative(27), op: Add, bit_size: U32, lhs: Relative(8), rhs: Direct(2) }, BinaryIntOp { destination: Relative(28), op: Add, bit_size: U32, lhs: Relative(27), rhs: Relative(7) }, Load { destination: Relative(9), source_pointer: Relative(28) }, JumpIf { condition: Relative(9), location: 195 }, Jump { location: 188 }, Load { destination: Relative(9), source_pointer: Relative(1) }, BinaryIntOp { destination: Relative(28), op: Add, bit_size: U32, lhs: Relative(3), rhs: Direct(2) }, BinaryIntOp { destination: Relative(29), op: Add, bit_size: U32, lhs: Relative(28), rhs: Relative(7) }, Load { destination: Relative(27), source_pointer: Relative(29) }, Mov { destination: Relative(5), source: Relative(9) }, Mov { destination: Relative(6), source: Relative(27) }, Jump { location: 202 }, BinaryIntOp { destination: Relative(27), op: Add, bit_size: U32, lhs: Relative(3), rhs: Direct(2) }, BinaryIntOp { destination: Relative(28), op: Add, bit_size: U32, lhs: Relative(27), rhs: Relative(7) }, Load { destination: Relative(9), source_pointer: Relative(28) }, Load { destination: Relative(27), source_pointer: Relative(1) }, Mov { destination: Relative(5), source: Relative(9) }, Mov { destination: Relative(6), source: Relative(27) }, Jump { location: 202 }, Mov { destination: Relative(27), source: Direct(1) }, Const { destination: Relative(28), bit_size: Integer(U32), value: 3 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(28) }, IndirectConst { destination_pointer: Relative(27), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(28), op: Add, bit_size: U32, lhs: Relative(27), rhs: Direct(2) }, Mov { destination: Relative(29), source: Relative(28) }, Store { destination_pointer: Relative(29), source: Relative(5) }, BinaryIntOp { destination: Relative(29), op: Add, bit_size: U32, lhs: Relative(29), rhs: Direct(2) }, Store { destination_pointer: Relative(29), source: Relative(6) }, Load { destination: Relative(5), source_pointer: Relative(10) }, Const { destination: Relative(6), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(28), op: Equals, bit_size: U32, lhs: Relative(6), rhs: Relative(5) }, Not { destination: Relative(28), source: Relative(28), bit_size: U1 }, JumpIf { condition: Relative(28), location: 217 }, Call { location: 539 }, BinaryIntOp { destination: Relative(5), op: Add, bit_size: U32, lhs: Relative(5), rhs: Direct(2) }, Store { destination_pointer: Relative(10), source: Relative(5) }, Mov { destination: Relative(5), source: Direct(1) }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Direct(2) }, Store { destination_pointer: Relative(5), source: Relative(10) }, Load { destination: Relative(28), source_pointer: Relative(12) }, Const { destination: Relative(29), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(30), op: Equals, bit_size: U32, lhs: Relative(29), rhs: Relative(28) }, Not { destination: Relative(30), source: Relative(30), bit_size: U1 }, JumpIf { condition: Relative(30), location: 228 }, Call { location: 539 }, BinaryIntOp { destination: Relative(28), op: Add, bit_size: U32, lhs: Relative(28), rhs: Direct(2) }, Store { destination_pointer: Relative(12), source: Relative(28) }, Mov { destination: Relative(28), source: Direct(1) }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Direct(2) }, Store { destination_pointer: Relative(28), source: Relative(12) }, Mov { destination: Relative(9), source: Relative(11) }, Jump { location: 235 }, BinaryIntOp { destination: Relative(6), op: LessThan, bit_size: U32, lhs: Relative(9), rhs: Relative(15) }, JumpIf { condition: Relative(6), location: 288 }, Jump { location: 238 }, Load { destination: Relative(6), source_pointer: Relative(5) }, Mov { destination: Direct(32771), source: Relative(6) }, Const { destination: Direct(32772), bit_size: Integer(U32), value: 7 }, Call { location: 561 }, Mov { destination: Relative(9), source: Direct(32773) }, BinaryIntOp { destination: Relative(27), op: Add, bit_size: U32, lhs: Relative(9), rhs: Relative(20) }, Store { destination_pointer: Relative(27), source: Relative(19) }, Mov { destination: Direct(32771), source: Relative(9) }, Const { destination: Direct(32772), bit_size: Integer(U32), value: 7 }, Call { location: 561 }, Mov { destination: Relative(6), source: Direct(32773) }, BinaryIntOp { destination: Relative(27), op: Add, bit_size: U32, lhs: Relative(6), rhs: Relative(21) }, Store { destination_pointer: Relative(27), source: Relative(2) }, Store { destination_pointer: Relative(5), source: Relative(6) }, Load { destination: Relative(5), source_pointer: Relative(28) }, Mov { destination: Direct(32771), source: Relative(5) }, Const { destination: Direct(32772), bit_size: Integer(U32), value: 10 }, Call { location: 561 }, Mov { destination: Relative(9), source: Direct(32773) }, BinaryIntOp { destination: Relative(27), op: Add, bit_size: U32, lhs: Relative(9), rhs: Relative(23) }, Store { destination_pointer: Relative(27), source: Relative(22) }, Mov { destination: Direct(32771), source: Relative(9) }, Const { destination: Direct(32772), bit_size: Integer(U32), value: 10 }, Call { location: 561 }, Mov { destination: Relative(5), source: Direct(32773) }, BinaryIntOp { destination: Relative(27), op: Add, bit_size: U32, lhs: Relative(5), rhs: Relative(25) }, Store { destination_pointer: Relative(27), source: Relative(24) }, Mov { destination: Direct(32771), source: Relative(5) }, Const { destination: Direct(32772), bit_size: Integer(U32), value: 10 }, Call { location: 561 }, Mov { destination: Relative(9), source: Direct(32773) }, BinaryIntOp { destination: Relative(27), op: Add, bit_size: U32, lhs: Relative(9), rhs: Relative(26) }, Store { destination_pointer: Relative(27), source: Relative(14) }, Store { destination_pointer: Relative(28), source: Relative(9) }, Mov { destination: Relative(5), source: Direct(1) }, Const { destination: Relative(27), bit_size: Integer(U32), value: 4 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(27) }, IndirectConst { destination_pointer: Relative(5), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(27), op: Add, bit_size: U32, lhs: Relative(9), rhs: Direct(2) }, Const { destination: Relative(28), bit_size: Integer(U32), value: 9 }, BinaryIntOp { destination: Relative(29), op: Add, bit_size: U32, lhs: Relative(6), rhs: Direct(2) }, Const { destination: Relative(30), bit_size: Integer(U32), value: 6 }, BinaryIntOp { destination: Relative(31), op: Add, bit_size: U32, lhs: Relative(5), rhs: Direct(2) }, BlackBox(MultiScalarMul { points: HeapVector { pointer: Relative(27), size: Relative(28) }, scalars: HeapVector { pointer: Relative(29), size: Relative(30) }, outputs: HeapArray { pointer: Relative(31), size: 3 } }), BinaryIntOp { destination: Relative(9), op: Add, bit_size: U32, lhs: Relative(5), rhs: Relative(18) }, Load { destination: Relative(6), source_pointer: Relative(9) }, Store { destination_pointer: Relative(1), source: Relative(6) }, BinaryIntOp { destination: Relative(5), op: Add, bit_size: U32, lhs: Relative(7), rhs: Relative(18) }, Mov { destination: Relative(7), source: Relative(5) }, Jump { location: 174 }, BinaryIntOp { destination: Relative(29), op: Add, bit_size: U32, lhs: Relative(27), rhs: Direct(2) }, BinaryIntOp { destination: Relative(30), op: Add, bit_size: U32, lhs: Relative(29), rhs: Relative(9) }, Load { destination: Relative(6), source_pointer: Relative(30) }, Cast { destination: Relative(30), source: Relative(6), bit_size: Integer(U128) }, Cast { destination: Relative(29), source: Relative(30), bit_size: Field }, BinaryFieldOp { destination: Relative(30), op: Sub, lhs: Relative(6), rhs: Relative(29) }, BinaryFieldOp { destination: Relative(31), op: Mul, lhs: Relative(30), rhs: Relative(16) }, BinaryFieldOp { destination: Relative(30), op: Mul, lhs: Direct(32835), rhs: Relative(31) }, BinaryFieldOp { destination: Relative(32), op: Add, lhs: Relative(29), rhs: Relative(30) }, BinaryFieldOp { destination: Relative(30), op: Equals, lhs: Relative(6), rhs: Relative(32) }, JumpIf { condition: Relative(30), location: 301 }, Const { destination: Relative(33), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(33) } }, Load { destination: Relative(6), source_pointer: Relative(5) }, BinaryIntOp { destination: Relative(30), op: Mul, bit_size: U32, lhs: Relative(9), rhs: Relative(15) }, Mov { destination: Direct(32771), source: Relative(6) }, Const { destination: Direct(32772), bit_size: Integer(U32), value: 7 }, Call { location: 561 }, Mov { destination: Relative(32), source: Direct(32773) }, BinaryIntOp { destination: Relative(33), op: Add, bit_size: U32, lhs: Relative(32), rhs: Direct(2) }, BinaryIntOp { destination: Relative(34), op: Add, bit_size: U32, lhs: Relative(33), rhs: Relative(30) }, Store { destination_pointer: Relative(34), source: Relative(29) }, BinaryIntOp { destination: Relative(6), op: Add, bit_size: U32, lhs: Relative(30), rhs: Relative(18) }, Mov { destination: Direct(32771), source: Relative(32) }, Const { destination: Direct(32772), bit_size: Integer(U32), value: 7 }, Call { location: 561 }, Mov { destination: Relative(29), source: Direct(32773) }, BinaryIntOp { destination: Relative(30), op: Add, bit_size: U32, lhs: Relative(29), rhs: Direct(2) }, BinaryIntOp { destination: Relative(33), op: Add, bit_size: U32, lhs: Relative(30), rhs: Relative(6) }, Store { destination_pointer: Relative(33), source: Relative(31) }, Store { destination_pointer: Relative(5), source: Relative(29) }, BinaryIntOp { destination: Relative(6), op: Mul, bit_size: U32, lhs: Relative(9), rhs: Relative(13) }, BinaryIntOp { destination: Relative(30), op: Add, bit_size: U32, lhs: Relative(17), rhs: Direct(2) }, BinaryIntOp { destination: Relative(31), op: Add, bit_size: U32, lhs: Relative(30), rhs: Relative(6) }, Load { destination: Relative(29), source_pointer: Relative(31) }, BinaryIntOp { destination: Relative(30), op: Add, bit_size: U32, lhs: Relative(6), rhs: Relative(18) }, BinaryIntOp { destination: Relative(32), op: Add, bit_size: U32, lhs: Relative(17), rhs: Direct(2) }, BinaryIntOp { destination: Relative(33), op: Add, bit_size: U32, lhs: Relative(32), rhs: Relative(30) }, Load { destination: Relative(31), source_pointer: Relative(33) }, BinaryIntOp { destination: Relative(32), op: Add, bit_size: U32, lhs: Relative(6), rhs: Relative(15) }, BinaryIntOp { destination: Relative(34), op: Add, bit_size: U32, lhs: Relative(17), rhs: Direct(2) }, BinaryIntOp { destination: Relative(35), op: Add, bit_size: U32, lhs: Relative(34), rhs: Relative(32) }, Load { destination: Relative(33), source_pointer: Relative(35) }, Load { destination: Relative(32), source_pointer: Relative(28) }, Mov { destination: Direct(32771), source: Relative(32) }, Const { destination: Direct(32772), bit_size: Integer(U32), value: 10 }, Call { location: 561 }, Mov { destination: Relative(34), source: Direct(32773) }, BinaryIntOp { destination: Relative(35), op: Add, bit_size: U32, lhs: Relative(34), rhs: Direct(2) }, BinaryIntOp { destination: Relative(36), op: Add, bit_size: U32, lhs: Relative(35), rhs: Relative(6) }, Store { destination_pointer: Relative(36), source: Relative(29) }, Mov { destination: Direct(32771), source: Relative(34) }, Const { destination: Direct(32772), bit_size: Integer(U32), value: 10 }, Call { location: 561 }, Mov { destination: Relative(6), source: Direct(32773) }, BinaryIntOp { destination: Relative(29), op: Add, bit_size: U32, lhs: Relative(6), rhs: Direct(2) }, BinaryIntOp { destination: Relative(32), op: Add, bit_size: U32, lhs: Relative(29), rhs: Relative(30) }, Store { destination_pointer: Relative(32), source: Relative(31) }, BinaryIntOp { destination: Relative(29), op: Add, bit_size: U32, lhs: Relative(30), rhs: Relative(18) }, Mov { destination: Direct(32771), source: Relative(6) }, Const { destination: Direct(32772), bit_size: Integer(U32), value: 10 }, Call { location: 561 }, Mov { destination: Relative(30), source: Direct(32773) }, BinaryIntOp { destination: Relative(31), op: Add, bit_size: U32, lhs: Relative(30), rhs: Direct(2) }, BinaryIntOp { destination: Relative(32), op: Add, bit_size: U32, lhs: Relative(31), rhs: Relative(29) }, Store { destination_pointer: Relative(32), source: Relative(33) }, Store { destination_pointer: Relative(28), source: Relative(30) }, BinaryIntOp { destination: Relative(6), op: Add, bit_size: U32, lhs: Relative(9), rhs: Relative(18) }, Mov { destination: Relative(9), source: Relative(6) }, Jump { location: 235 }, BinaryIntOp { destination: Relative(29), op: Add, bit_size: U32, lhs: Relative(8), rhs: Direct(2) }, BinaryIntOp { destination: Relative(30), op: Add, bit_size: U32, lhs: Relative(29), rhs: Relative(7) }, Load { destination: Relative(28), source_pointer: Relative(30) }, JumpIf { condition: Relative(28), location: 370 }, Jump { location: 363 }, Load { destination: Relative(28), source_pointer: Relative(6) }, BinaryIntOp { destination: Relative(30), op: Add, bit_size: U32, lhs: Relative(3), rhs: Direct(2) }, BinaryIntOp { destination: Relative(31), op: Add, bit_size: U32, lhs: Relative(30), rhs: Relative(7) }, Load { destination: Relative(29), source_pointer: Relative(31) }, Mov { destination: Relative(9), source: Relative(28) }, Mov { destination: Relative(27), source: Relative(29) }, Jump { location: 377 }, BinaryIntOp { destination: Relative(29), op: Add, bit_size: U32, lhs: Relative(3), rhs: Direct(2) }, BinaryIntOp { destination: Relative(30), op: Add, bit_size: U32, lhs: Relative(29), rhs: Relative(7) }, Load { destination: Relative(28), source_pointer: Relative(30) }, Load { destination: Relative(29), source_pointer: Relative(6) }, Mov { destination: Relative(9), source: Relative(28) }, Mov { destination: Relative(27), source: Relative(29) }, Jump { location: 377 }, Mov { destination: Relative(29), source: Direct(1) }, Const { destination: Relative(30), bit_size: Integer(U32), value: 3 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(30) }, IndirectConst { destination_pointer: Relative(29), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(30), op: Add, bit_size: U32, lhs: Relative(29), rhs: Direct(2) }, Mov { destination: Relative(31), source: Relative(30) }, Store { destination_pointer: Relative(31), source: Relative(9) }, BinaryIntOp { destination: Relative(31), op: Add, bit_size: U32, lhs: Relative(31), rhs: Direct(2) }, Store { destination_pointer: Relative(31), source: Relative(27) }, Load { destination: Relative(9), source_pointer: Relative(10) }, Const { destination: Relative(27), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(30), op: Equals, bit_size: U32, lhs: Relative(27), rhs: Relative(9) }, Not { destination: Relative(30), source: Relative(30), bit_size: U1 }, JumpIf { condition: Relative(30), location: 392 }, Call { location: 539 }, BinaryIntOp { destination: Relative(9), op: Add, bit_size: U32, lhs: Relative(9), rhs: Direct(2) }, Store { destination_pointer: Relative(10), source: Relative(9) }, Mov { destination: Relative(9), source: Direct(1) }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Direct(2) }, Store { destination_pointer: Relative(9), source: Relative(10) }, Load { destination: Relative(30), source_pointer: Relative(12) }, Const { destination: Relative(31), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(32), op: Equals, bit_size: U32, lhs: Relative(31), rhs: Relative(30) }, Not { destination: Relative(32), source: Relative(32), bit_size: U1 }, JumpIf { condition: Relative(32), location: 403 }, Call { location: 539 }, BinaryIntOp { destination: Relative(30), op: Add, bit_size: U32, lhs: Relative(30), rhs: Direct(2) }, Store { destination_pointer: Relative(12), source: Relative(30) }, Mov { destination: Relative(30), source: Direct(1) }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Direct(2) }, Store { destination_pointer: Relative(30), source: Relative(12) }, Mov { destination: Relative(28), source: Relative(11) }, Jump { location: 410 }, BinaryIntOp { destination: Relative(27), op: LessThan, bit_size: U32, lhs: Relative(28), rhs: Relative(15) }, JumpIf { condition: Relative(27), location: 463 }, Jump { location: 413 }, Load { destination: Relative(27), source_pointer: Relative(9) }, Mov { destination: Direct(32771), source: Relative(27) }, Const { destination: Direct(32772), bit_size: Integer(U32), value: 7 }, Call { location: 561 }, Mov { destination: Relative(28), source: Direct(32773) }, BinaryIntOp { destination: Relative(29), op: Add, bit_size: U32, lhs: Relative(28), rhs: Relative(20) }, Store { destination_pointer: Relative(29), source: Relative(19) }, Mov { destination: Direct(32771), source: Relative(28) }, Const { destination: Direct(32772), bit_size: Integer(U32), value: 7 }, Call { location: 561 }, Mov { destination: Relative(27), source: Direct(32773) }, BinaryIntOp { destination: Relative(29), op: Add, bit_size: U32, lhs: Relative(27), rhs: Relative(21) }, Store { destination_pointer: Relative(29), source: Relative(2) }, Store { destination_pointer: Relative(9), source: Relative(27) }, Load { destination: Relative(9), source_pointer: Relative(30) }, Mov { destination: Direct(32771), source: Relative(9) }, Const { destination: Direct(32772), bit_size: Integer(U32), value: 10 }, Call { location: 561 }, Mov { destination: Relative(28), source: Direct(32773) }, BinaryIntOp { destination: Relative(29), op: Add, bit_size: U32, lhs: Relative(28), rhs: Relative(23) }, Store { destination_pointer: Relative(29), source: Relative(22) }, Mov { destination: Direct(32771), source: Relative(28) }, Const { destination: Direct(32772), bit_size: Integer(U32), value: 10 }, Call { location: 561 }, Mov { destination: Relative(9), source: Direct(32773) }, BinaryIntOp { destination: Relative(29), op: Add, bit_size: U32, lhs: Relative(9), rhs: Relative(25) }, Store { destination_pointer: Relative(29), source: Relative(24) }, Mov { destination: Direct(32771), source: Relative(9) }, Const { destination: Direct(32772), bit_size: Integer(U32), value: 10 }, Call { location: 561 }, Mov { destination: Relative(28), source: Direct(32773) }, BinaryIntOp { destination: Relative(29), op: Add, bit_size: U32, lhs: Relative(28), rhs: Relative(26) }, Store { destination_pointer: Relative(29), source: Relative(14) }, Store { destination_pointer: Relative(30), source: Relative(28) }, Mov { destination: Relative(9), source: Direct(1) }, Const { destination: Relative(29), bit_size: Integer(U32), value: 4 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(29) }, IndirectConst { destination_pointer: Relative(9), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(29), op: Add, bit_size: U32, lhs: Relative(28), rhs: Direct(2) }, Const { destination: Relative(30), bit_size: Integer(U32), value: 9 }, BinaryIntOp { destination: Relative(31), op: Add, bit_size: U32, lhs: Relative(27), rhs: Direct(2) }, Const { destination: Relative(32), bit_size: Integer(U32), value: 6 }, BinaryIntOp { destination: Relative(33), op: Add, bit_size: U32, lhs: Relative(9), rhs: Direct(2) }, BlackBox(MultiScalarMul { points: HeapVector { pointer: Relative(29), size: Relative(30) }, scalars: HeapVector { pointer: Relative(31), size: Relative(32) }, outputs: HeapArray { pointer: Relative(33), size: 3 } }), BinaryIntOp { destination: Relative(28), op: Add, bit_size: U32, lhs: Relative(9), rhs: Relative(18) }, Load { destination: Relative(27), source_pointer: Relative(28) }, Store { destination_pointer: Relative(6), source: Relative(27) }, BinaryIntOp { destination: Relative(9), op: Add, bit_size: U32, lhs: Relative(7), rhs: Relative(18) }, Mov { destination: Relative(7), source: Relative(9) }, Jump { location: 145 }, BinaryIntOp { destination: Relative(31), op: Add, bit_size: U32, lhs: Relative(29), rhs: Direct(2) }, BinaryIntOp { destination: Relative(32), op: Add, bit_size: U32, lhs: Relative(31), rhs: Relative(28) }, Load { destination: Relative(27), source_pointer: Relative(32) }, Cast { destination: Relative(32), source: Relative(27), bit_size: Integer(U128) }, Cast { destination: Relative(31), source: Relative(32), bit_size: Field }, BinaryFieldOp { destination: Relative(32), op: Sub, lhs: Relative(27), rhs: Relative(31) }, BinaryFieldOp { destination: Relative(33), op: Mul, lhs: Relative(32), rhs: Relative(16) }, BinaryFieldOp { destination: Relative(32), op: Mul, lhs: Direct(32835), rhs: Relative(33) }, BinaryFieldOp { destination: Relative(34), op: Add, lhs: Relative(31), rhs: Relative(32) }, BinaryFieldOp { destination: Relative(32), op: Equals, lhs: Relative(27), rhs: Relative(34) }, JumpIf { condition: Relative(32), location: 476 }, Const { destination: Relative(35), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(35) } }, Load { destination: Relative(27), source_pointer: Relative(9) }, BinaryIntOp { destination: Relative(32), op: Mul, bit_size: U32, lhs: Relative(28), rhs: Relative(15) }, Mov { destination: Direct(32771), source: Relative(27) }, Const { destination: Direct(32772), bit_size: Integer(U32), value: 7 }, Call { location: 561 }, Mov { destination: Relative(34), source: Direct(32773) }, BinaryIntOp { destination: Relative(35), op: Add, bit_size: U32, lhs: Relative(34), rhs: Direct(2) }, BinaryIntOp { destination: Relative(36), op: Add, bit_size: U32, lhs: Relative(35), rhs: Relative(32) }, Store { destination_pointer: Relative(36), source: Relative(31) }, BinaryIntOp { destination: Relative(27), op: Add, bit_size: U32, lhs: Relative(32), rhs: Relative(18) }, Mov { destination: Direct(32771), source: Relative(34) }, Const { destination: Direct(32772), bit_size: Integer(U32), value: 7 }, Call { location: 561 }, Mov { destination: Relative(31), source: Direct(32773) }, BinaryIntOp { destination: Relative(32), op: Add, bit_size: U32, lhs: Relative(31), rhs: Direct(2) }, BinaryIntOp { destination: Relative(35), op: Add, bit_size: U32, lhs: Relative(32), rhs: Relative(27) }, Store { destination_pointer: Relative(35), source: Relative(33) }, Store { destination_pointer: Relative(9), source: Relative(31) }, BinaryIntOp { destination: Relative(27), op: Mul, bit_size: U32, lhs: Relative(28), rhs: Relative(13) }, BinaryIntOp { destination: Relative(32), op: Add, bit_size: U32, lhs: Relative(17), rhs: Direct(2) }, BinaryIntOp { destination: Relative(33), op: Add, bit_size: U32, lhs: Relative(32), rhs: Relative(27) }, Load { destination: Relative(31), source_pointer: Relative(33) }, BinaryIntOp { destination: Relative(32), op: Add, bit_size: U32, lhs: Relative(27), rhs: Relative(18) }, BinaryIntOp { destination: Relative(34), op: Add, bit_size: U32, lhs: Relative(17), rhs: Direct(2) }, BinaryIntOp { destination: Relative(35), op: Add, bit_size: U32, lhs: Relative(34), rhs: Relative(32) }, Load { destination: Relative(33), source_pointer: Relative(35) }, BinaryIntOp { destination: Relative(34), op: Add, bit_size: U32, lhs: Relative(27), rhs: Relative(15) }, BinaryIntOp { destination: Relative(36), op: Add, bit_size: U32, lhs: Relative(17), rhs: Direct(2) }, BinaryIntOp { destination: Relative(37), op: Add, bit_size: U32, lhs: Relative(36), rhs: Relative(34) }, Load { destination: Relative(35), source_pointer: Relative(37) }, Load { destination: Relative(34), source_pointer: Relative(30) }, Mov { destination: Direct(32771), source: Relative(34) }, Const { destination: Direct(32772), bit_size: Integer(U32), value: 10 }, Call { location: 561 }, Mov { destination: Relative(36), source: Direct(32773) }, BinaryIntOp { destination: Relative(37), op: Add, bit_size: U32, lhs: Relative(36), rhs: Direct(2) }, BinaryIntOp { destination: Relative(38), op: Add, bit_size: U32, lhs: Relative(37), rhs: Relative(27) }, Store { destination_pointer: Relative(38), source: Relative(31) }, Mov { destination: Direct(32771), source: Relative(36) }, Const { destination: Direct(32772), bit_size: Integer(U32), value: 10 }, Call { location: 561 }, Mov { destination: Relative(27), source: Direct(32773) }, BinaryIntOp { destination: Relative(31), op: Add, bit_size: U32, lhs: Relative(27), rhs: Direct(2) }, BinaryIntOp { destination: Relative(34), op: Add, bit_size: U32, lhs: Relative(31), rhs: Relative(32) }, Store { destination_pointer: Relative(34), source: Relative(33) }, BinaryIntOp { destination: Relative(31), op: Add, bit_size: U32, lhs: Relative(32), rhs: Relative(18) }, Mov { destination: Direct(32771), source: Relative(27) }, Const { destination: Direct(32772), bit_size: Integer(U32), value: 10 }, Call { location: 561 }, Mov { destination: Relative(32), source: Direct(32773) }, BinaryIntOp { destination: Relative(33), op: Add, bit_size: U32, lhs: Relative(32), rhs: Direct(2) }, BinaryIntOp { destination: Relative(34), op: Add, bit_size: U32, lhs: Relative(33), rhs: Relative(31) }, Store { destination_pointer: Relative(34), source: Relative(35) }, Store { destination_pointer: Relative(30), source: Relative(32) }, BinaryIntOp { destination: Relative(27), op: Add, bit_size: U32, lhs: Relative(28), rhs: Relative(18) }, Mov { destination: Relative(28), source: Relative(27) }, Jump { location: 410 }, 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: 538 }, 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, Const { destination: Direct(32774), bit_size: Integer(U32), value: 2 }, BinaryIntOp { destination: Direct(32773), op: Div, bit_size: U32, lhs: Direct(32772), rhs: Direct(32774) }, Mov { destination: Direct(32776), source: Direct(32772) }, Const { destination: Direct(32777), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Direct(32778), op: LessThan, bit_size: U32, lhs: Direct(32777), rhs: Direct(32773) }, Not { destination: Direct(32778), source: Direct(32778), bit_size: U1 }, JumpIf { condition: Direct(32778), location: 560 }, BinaryIntOp { destination: Direct(32776), op: Sub, bit_size: U32, lhs: Direct(32776), rhs: Direct(2) }, BinaryIntOp { destination: Direct(32779), op: Add, bit_size: U32, lhs: Direct(32771), rhs: Direct(32777) }, Load { destination: Direct(32774), source_pointer: Direct(32779) }, BinaryIntOp { destination: Direct(32779), op: Add, bit_size: U32, lhs: Direct(32771), rhs: Direct(32776) }, Load { destination: Direct(32775), source_pointer: Direct(32779) }, BinaryIntOp { destination: Direct(32779), op: Add, bit_size: U32, lhs: Direct(32771), rhs: Direct(32777) }, Store { destination_pointer: Direct(32779), source: Direct(32775) }, BinaryIntOp { destination: Direct(32779), op: Add, bit_size: U32, lhs: Direct(32771), rhs: Direct(32776) }, Store { destination_pointer: Direct(32779), source: Direct(32774) }, BinaryIntOp { destination: Direct(32777), op: Add, bit_size: U32, lhs: Direct(32777), rhs: Direct(2) }, Jump { location: 546 }, Return, Load { destination: Direct(32774), source_pointer: Direct(32771) }, BinaryIntOp { destination: Direct(32775), op: Equals, bit_size: U32, lhs: Direct(32774), rhs: Direct(2) }, JumpIf { condition: Direct(32775), location: 565 }, Jump { location: 567 }, Mov { destination: Direct(32773), source: Direct(32771) }, Jump { location: 582 }, Mov { destination: Direct(32773), source: Direct(1) }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Direct(32772) }, BinaryIntOp { destination: Direct(32777), op: Add, bit_size: U32, lhs: Direct(32771), rhs: Direct(32772) }, Mov { destination: Direct(32778), source: Direct(32771) }, Mov { destination: Direct(32779), source: Direct(32773) }, BinaryIntOp { destination: Direct(32780), op: Equals, bit_size: U32, lhs: Direct(32778), rhs: Direct(32777) }, JumpIf { condition: Direct(32780), location: 579 }, Load { destination: Direct(32776), source_pointer: Direct(32778) }, Store { destination_pointer: Direct(32779), source: Direct(32776) }, BinaryIntOp { destination: Direct(32778), op: Add, bit_size: U32, lhs: Direct(32778), rhs: Direct(2) }, BinaryIntOp { destination: Direct(32779), op: Add, bit_size: U32, lhs: Direct(32779), rhs: Direct(2) }, Jump { location: 572 }, IndirectConst { destination_pointer: Direct(32773), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Direct(32774), op: Sub, bit_size: U32, lhs: Direct(32774), rhs: Direct(2) }, Jump { location: 582 }, Return]" ], - "debug_symbols": "pZnbbttIDIbfJde50HDIOeyrFEWRpm4RwEgCN1lgUeTdd/4hfye5sNYr3YSfa+nTYUiKqv/c/Dh8f/317eHx59Pvm7++/Ln5fno4Hh9+fTs+3d+9PDw9jn/9c7Pgj42/+fbGkgfxkD2oB/NQPFQPzUOfobiluKW4pQyLjKAezMOwlBGqh+ahz1AXD8mDeMge1IN5cEt1S3VLdUtzS3NLc0tzSxuWOoJ5KB6qh+ahz9AXD8mDeMge3NLd0t3S3dLd0t2SliViiigRc0SNaBFLxBpx6Dpi95iWiCmiRMwRNaJFLBFrxPCl8En4JHwSPgmfhE/CJ+GT8En4JHw6tksLYHyhiOOLlAYg0RwSQQjjYCkDlGCEcbxUAJXQCD0AyeeQCELIBJhxQ5GGDoVQCY3QA5CQDokATwNgL1wgki/h0pF+E5CADomASsBdQf45GGHsLrgJyDsZBZKQeQ6JYLENUs2hEmJ3QWJhY0FmOSjBCIVQCY0QR5e0EOJmShJCJijBCIVQCY0QyySyEGhGsuGuCrLNQQlGKIRKaIRYJskLIRFozrj2DMCVKgBXagN0ISSCEDJBCUYohEpoBJqNZqMZqS64ZKS64MSQ6g5GKIRKaIQegFR3SAQh0FxoLjQXmgvNheZCc6W50oz+Kw2QCUowQiFUQiP0AJSDQyLA3AGZoF5NgrpwwPNlAfQA1IUDnjLYBl3ZAc8r3Gd05oz7jJLJuAqUTMZBUTIZx0LJOHSHjCbtAHMCDLMugExQghEKoRIaoQegmhwSgeZEc6I50ZxoTjQnmlFNijNENTkkghAyQQlGKIRKaASaM82ZZlSTCiATlGCEQqiERugBqDiHRKBZaVaalWalWWlWmpVmo9loNpqNZqPZaEZ9aQb0ANSXA/ZSAPYygBFKAEpmboOScRACd0dd+MaN0ANQFw6JIIRM4NEbj9588smtRmwRffjJfYmYIkrEHFEjWsTwxfiSY37JMcBoDDAaA4zGAKMxwGgMMBoDjMYAozHA6KyAAsA1zX/BNTWAEQqhEhqhB8x8n5AIQsgEmoVmoXnmewcMsy2AHoB8d0gEIWSCEoxQCJVAc6ZZaVaalWalWWlWmpVm5LslQCP0AOS7QyIIIROUYIRCgFkAjdDnuKazABBhyQAlGAEWLCSeJg6w4C7jaWK4y3OSxzXMWR6HnNM8jjTn+QlKMALMOPqc63GsOdlP6AFzup+QCELIBCUYoRBobjQ3mjvNneZOc6d5Vg/OcJbPhEKohEboDoYackgEIWSCEoxQCDAboBF6AKrLIRGEkAlKMEIh0JxoTjQLzUKz0Cw0C81Cs9AsNAvNQnOe5re32xu+jX57OR0OeBn98Ho6Xlqf706Hx5ebvx5fj8fbm7/vjq9zo9/Pd48zvtydxrcjyw6PP0Ycwp8PxwPo7fZ97+XyrmPQj53HcHre3T7vny7vr+f9R6Zd2l9Wji94RkzBeLGSsyG1a8+goiKnoC1y6Qz08v5jmG68BWM4eD+D/slgKwbDsOiGsdhbDGXhRYzZVbYYajobalsuGdplw5gSLAxjGNBLhpWVsMxTsKyXVmItF63+dy4ua+vAQhiT7sVclp3JvCa4KhfT/mRM+7Mx7U/HtTuxNxdy4lqOaXrLUlihwGreIijKlShl2ZQM50uocjkZVmu6n5tzW5ZNK9mLvteEblMs57PoY78NivHqV7iaKds2xXJOiPE/fdsUeJMLRU/7FdtuZ8N7VyyqbVvUJvquuHghee2xnc6LOt5BLlZ4Xknv0eHY6z42qvpZkNcKjFdRLG8SNC5GaW2b4Fyhy+UzWLuNknkK4z2rb1oJEdutSPUKxXpKpXROKUnbFPX83Gkfnr//S1Hez6JuGkGu6vp7m/7Onr+/5e/v+Psb/v5+v7/d7+/2+5v9/l6/v9Wb7m71ZjtbvZWdrX5VcE2rXxdc0epXb+N1rX5dcVWrX1dc1er3d/r9jX5jn/86Pt3dP5w+/U7/Btfp4e778RAff74+3n/49uWfZ37D3/mfT0/3hx+vpwNM7z/2jz9fbBzemnwdPx7i0yjS8dwYn8Z/6nwZv87khm/mhmN6MP84txy/kJimr284zX8B", + "debug_symbols": "pZnNbts6EIXfJesuxOEMf/oqRVGkqVsEMJLATS5wUeTdLw9njpMsrOtKm8znWvwkkTPUqP5z8+Pw/eXXt/uHn4+/bz5/+XPz/XR/PN7/+nZ8vLt9vn98GP/652bBHxt/86cbSx7EQ/agHsxD8VA9NA99huKW4pbiljIsMoJ6MA/DUkaoHpqHPkNdPCQP4iF7UA/mwS3VLdUt1S3NLc0tzS3NLW1Y6gjmoXioHpqHPkNfPCQP4iF7cEt3S3dLd0t3S3dLWpaIKaJEzBE1okUsEWvEoeuI3WNaIqaIEjFH1IgWsUSsEcOXwifhk/BJ+CR8Ej4Jn4RPwifhk/DpOC4tgPGFIo4vUhqARHNIBCGMk6UMUIIRxvlSAVRCI/QAJJ9DIgghE2DGhCINHQqhEhqhByAhHRIBngbAKNwgki/h1pF+E5CADomASsCsIP8cjDCGCyYBeSejQBIyzyERLI5BqjlUQgwXJBYOFmSWgxKMUAiV0AhxdkkLISZTkhAyQQlGKIRKaIRYJpGFQDOSDbMqyDYHJRihECqhEWKZJC+ERKA5494zAHeqANypDdCFkAhCyAQlGKEQKqERaDaajWakuuCWkeqCC0OqOxihECqhEXoAUt0hEYRAc6G50FxoLjQXmgvNleZKM/ZfaYBMUIIRCqESGqEHoBwcEgHmDsgE9WoS1IUDni8LoAegLhzwlMEx2JUd8LzCPGNnzphnlEzGXaBkMk6Kksk4F0rGoTtkbNIOMCfAMOsCyAQlGKEQKqERegCqySERaE40J5oTzYnmRHOiGdWkuEJUk0MiCCETlGCEQqiERqA505xpRjWpADJBCUYohEpohB6AinNIBJqVZqVZaVaalWalWWk2mo1mo9loNpqNZtSXZkAPQH05YJQCMMoARigBKJl5DErGQQgcjrrwgxuhB6AuHBJBCJnAszeevXnnk1uN2CJ685P7EjFFlIg5oka0iOGL9iVH/5KjgdFoYDQaGI0GRqOB0WhgNBoYjQZGo4HRWQEFgHua/4J7agAjFEIlNEIPmPk+IRGEkAk0C81C88z3DhhmWwA9APnukAhCyAQlGKEQKoHmTLPSrDQrzUqz0qw0K83Id0uARugByHeHRBBCJijBCIUAswAaoc92TWcBIMKSAUowAixYSDxNHGDBLONpYpjl2cnjHmYvj1PObh5nmv38BCUYAWacffb1ONfs7Cf0gNndT0gEIWSCEoxQCDQ3mhvNneZOc6e50zyrB1c4y2dCIVRCI3QHQw05JIIQMkEJRigEmA3QCD0A1eWQCELIBCUYoRBoTjQnmoVmoVloFpqFZqFZaBaahWahOU/z6+unG76Nfns+HQ54GX33ejpeWp9uT4eH55vPDy/H46ebf26PL/Og30+3DzM+357GtyPLDg8/RhzCn/fHA+j109vo5fLQ0ejH4NGcnofbx/Hp8ng9jx+Zdmm8rJxf8IyYgvFiJWdDatdeQTXefu390hXo5fGjmW6cgtEcvF1B/2CwFYOhWXTDWOwthrJkGorKFkNNZ0NtyyVDu2wYXYKFYTQDesmwshKWeQmW9dJKrOWi1f/PxWVtHZgJo9O9mMuyM5nXBFflYtqfjGl/Nqb96bg2E3tzISfO5OimtyyFFQqs5i2CoiyHYpuuoC5ch5ouJ8NqTffz5tyWZdNK9qJvNaHbFMv5Kvq7G/kLxXj1K1zNlG2bYjknxPifvm0KvMmFoqf9im3T2fDeFYtq2xa1ib4pLt5IXntsp/OijneQixWeV9K7LbyP9n6jqh8Fea3A9FxgeZOgcTFKa9sE5+16uXwFa9MomZcw3rP6ppUQsd2KVK9QrKdUSueUkrRNUc/Pnfbu+ftXivJ2FXVTC3LVrr9309+55+/f8vfv+Ps3/P37/f7tfv9uv3+z37/X79/qTXdv9WY7t3orO7f6VcE1W/264IqtfnUar9vq1xVXbfXriqu2+v07/f6NfuM+/3V8ur27P334nf4VrtP97ffjIT7+fHm4e/ft879P/Ia/8z+dHu8OP15OB5jefuwff77YOL01+Tp+PMSnUaTjuTE+jf/U+TJ+nckN38wDR/dg/nEeOX4hMU1fX3GZ/wE=", "file_map": { "17": { "source": "use crate::field::field_less_than;\nuse crate::runtime::is_unconstrained;\n\n// The low and high decomposition of the field modulus\nglobal PLO: Field = 53438638232309528389504892708671455233;\nglobal PHI: Field = 64323764613183177041862057485226039389;\n\npub(crate) global TWO_POW_128: Field = 0x100000000000000000000000000000000;\n\n// Decomposes a single field into two 16 byte fields.\nfn compute_decomposition(x: Field) -> (Field, Field) {\n // Here's we're taking advantage of truncating 128 bit limbs from the input field\n // and then subtracting them from the input such the field division is equivalent to integer division.\n let low = (x as u128) as Field;\n let high = (x - low) / TWO_POW_128;\n\n (low, high)\n}\n\npub(crate) unconstrained fn decompose_hint(x: Field) -> (Field, Field) {\n compute_decomposition(x)\n}\n\nunconstrained fn lte_hint(x: Field, y: Field) -> bool {\n if x == y {\n true\n } else {\n field_less_than(x, y)\n }\n}\n\n// Assert that (alo > blo && ahi >= bhi) || (alo <= blo && ahi > bhi)\nfn assert_gt_limbs(a: (Field, Field), b: (Field, Field)) {\n let (alo, ahi) = a;\n let (blo, bhi) = b;\n // Safety: borrow is enforced to be boolean due to its type.\n // if borrow is 0, it asserts that (alo > blo && ahi >= bhi)\n // if borrow is 1, it asserts that (alo <= blo && ahi > bhi)\n unsafe {\n let borrow = lte_hint(alo, blo);\n\n let rlo = alo - blo - 1 + (borrow as Field) * TWO_POW_128;\n let rhi = ahi - bhi - (borrow as Field);\n\n rlo.assert_max_bit_size::<128>();\n rhi.assert_max_bit_size::<128>();\n }\n}\n\n/// Decompose a single field into two 16 byte fields.\npub fn decompose(x: Field) -> (Field, Field) {\n if is_unconstrained() {\n compute_decomposition(x)\n } else {\n // Safety: decomposition is properly checked below\n unsafe {\n // Take hints of the decomposition\n let (xlo, xhi) = decompose_hint(x);\n\n // Range check the limbs\n xlo.assert_max_bit_size::<128>();\n xhi.assert_max_bit_size::<128>();\n\n // Check that the decomposition is correct\n assert_eq(x, xlo + TWO_POW_128 * xhi);\n\n // Assert that the decomposition of P is greater than the decomposition of x\n assert_gt_limbs((PLO, PHI), (xlo, xhi));\n (xlo, xhi)\n }\n }\n}\n\npub fn assert_gt(a: Field, b: Field) {\n if is_unconstrained() {\n assert(\n // Safety: already unconstrained\n unsafe { field_less_than(b, a) },\n );\n } else {\n // Decompose a and b\n let a_limbs = decompose(a);\n let b_limbs = decompose(b);\n\n // Assert that a_limbs is greater than b_limbs\n assert_gt_limbs(a_limbs, b_limbs)\n }\n}\n\npub fn assert_lt(a: Field, b: Field) {\n assert_gt(b, a);\n}\n\npub fn gt(a: Field, b: Field) -> bool {\n if is_unconstrained() {\n // Safety: unsafe in unconstrained\n unsafe {\n field_less_than(b, a)\n }\n } else if a == b {\n false\n } else {\n // Safety: Take a hint of the comparison and verify it\n unsafe {\n if field_less_than(a, b) {\n assert_gt(b, a);\n false\n } else {\n assert_gt(a, b);\n true\n }\n }\n }\n}\n\npub fn lt(a: Field, b: Field) -> bool {\n gt(b, a)\n}\n\nmod tests {\n // TODO: Allow imports from \"super\"\n use crate::field::bn254::{assert_gt, decompose, gt, lte_hint, PHI, PLO, TWO_POW_128};\n\n #[test]\n fn check_decompose() {\n assert_eq(decompose(TWO_POW_128), (0, 1));\n assert_eq(decompose(TWO_POW_128 + 0x1234567890), (0x1234567890, 1));\n assert_eq(decompose(0x1234567890), (0x1234567890, 0));\n }\n\n #[test]\n unconstrained fn check_decompose_unconstrained() {\n assert_eq(decompose(TWO_POW_128), (0, 1));\n assert_eq(decompose(TWO_POW_128 + 0x1234567890), (0x1234567890, 1));\n assert_eq(decompose(0x1234567890), (0x1234567890, 0));\n }\n\n #[test]\n unconstrained fn check_lte_hint() {\n assert(lte_hint(0, 1));\n assert(lte_hint(0, 0x100));\n assert(lte_hint(0x100, TWO_POW_128 - 1));\n assert(!lte_hint(0 - 1, 0));\n\n assert(lte_hint(0, 0));\n assert(lte_hint(0x100, 0x100));\n assert(lte_hint(0 - 1, 0 - 1));\n }\n\n #[test]\n fn check_assert_gt() {\n assert_gt(1, 0);\n assert_gt(0x100, 0);\n assert_gt((0 - 1), (0 - 2));\n assert_gt(TWO_POW_128, 0);\n assert_gt(0 - 1, 0);\n }\n\n #[test]\n unconstrained fn check_assert_gt_unconstrained() {\n assert_gt(1, 0);\n assert_gt(0x100, 0);\n assert_gt((0 - 1), (0 - 2));\n assert_gt(TWO_POW_128, 0);\n assert_gt(0 - 1, 0);\n }\n\n #[test]\n fn check_gt() {\n assert(gt(1, 0));\n assert(gt(0x100, 0));\n assert(gt((0 - 1), (0 - 2)));\n assert(gt(TWO_POW_128, 0));\n assert(!gt(0, 0));\n assert(!gt(0, 0x100));\n assert(gt(0 - 1, 0 - 2));\n assert(!gt(0 - 2, 0 - 1));\n }\n\n #[test]\n unconstrained fn check_gt_unconstrained() {\n assert(gt(1, 0));\n assert(gt(0x100, 0));\n assert(gt((0 - 1), (0 - 2)));\n assert(gt(TWO_POW_128, 0));\n assert(!gt(0, 0));\n assert(!gt(0, 0x100));\n assert(gt(0 - 1, 0 - 2));\n assert(!gt(0 - 2, 0 - 1));\n }\n\n #[test]\n fn check_plo_phi() {\n assert_eq(PLO + PHI * TWO_POW_128, 0);\n let p_bytes = crate::field::modulus_le_bytes();\n let mut p_low: Field = 0;\n let mut p_high: Field = 0;\n\n let mut offset = 1;\n for i in 0..16 {\n p_low += (p_bytes[i] as Field) * offset;\n p_high += (p_bytes[i + 16] as Field) * offset;\n offset *= 256;\n }\n assert_eq(p_low, PLO);\n assert_eq(p_high, PHI);\n }\n}\n", @@ -91,7 +91,7 @@ expression: artifact "path": "std/hash/mod.nr" }, "50": { - "source": "fn main(\n old_root: Field,\n old_leaf: Field,\n old_hash_path: [Field; 3],\n new_root: pub Field,\n leaf: Field,\n index: Field,\n) {\n assert(old_root == compute_merkle_root(old_leaf, index, old_hash_path));\n\n let calculated_root = compute_merkle_root(leaf, index, old_hash_path);\n assert(new_root == calculated_root);\n}\n\nfn compute_merkle_root(leaf: Field, index: Field, hash_path: [Field; N]) -> Field {\n let index_bits: [u1; N] = index.to_le_bits();\n let mut current = leaf;\n for i in 0..N {\n let path_bit = index_bits[i] as bool;\n let (hash_left, hash_right) = if path_bit {\n (hash_path[i], current)\n } else {\n (current, hash_path[i])\n };\n current = std::hash::pedersen_hash([hash_left, hash_right]);\n }\n current\n}\n", + "source": "fn main(\n old_root: Field,\n old_leaf: Field,\n old_hash_path: [Field; 3],\n new_root: pub Field,\n leaf: Field,\n index: Field,\n) {\n assert(old_root == compute_merkle_root(old_leaf, index, old_hash_path));\n\n let calculated_root = compute_merkle_root(leaf, index, old_hash_path);\n assert(new_root == calculated_root);\n}\n\nfn compute_merkle_root(leaf: Field, index: Field, hash_path: [Field; N]) -> Field {\n let index_bits: [u1; N] = index.to_le_bits();\n let mut current = leaf;\n for i in 0..N {\n let path_bit = index_bits[i] != 0;\n let (hash_left, hash_right) = if path_bit {\n (hash_path[i], current)\n } else {\n (current, hash_path[i])\n };\n current = std::hash::pedersen_hash([hash_left, hash_right]);\n }\n current\n}\n", "path": "" } }, diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/regression_8329/execute__tests__expanded.snap b/tooling/nargo_cli/tests/snapshots/execution_success/regression_8329/execute__tests__expanded.snap index 47a592b2f21..23fb484a048 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/regression_8329/execute__tests__expanded.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/regression_8329/execute__tests__expanded.snap @@ -4,10 +4,10 @@ expression: expanded_code --- fn main(x: u1, y: u1, z: u1) -> pub u1 { let p: u1 = y - z; - if p as bool { + if p != 0 { let a: u1 = x / z; let b: u1 = a - z; - if b as bool { + if b != 0 { let _: u1 = a / b; } }; diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/regression_8329/execute__tests__force_brillig_false_inliner_-9223372036854775808.snap b/tooling/nargo_cli/tests/snapshots/execution_success/regression_8329/execute__tests__force_brillig_false_inliner_-9223372036854775808.snap index f5483b779f3..13069d7c2b0 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/regression_8329/execute__tests__force_brillig_false_inliner_-9223372036854775808.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/regression_8329/execute__tests__force_brillig_false_inliner_-9223372036854775808.snap @@ -98,10 +98,10 @@ expression: artifact "unconstrained func 1", "[Const { destination: Direct(10), bit_size: Integer(U32), value: 2 }, Const { destination: Direct(11), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(0), size_address: Direct(10), offset_address: Direct(11) }, BinaryFieldOp { destination: Direct(2), op: IntegerDiv, lhs: Direct(0), rhs: Direct(1) }, BinaryFieldOp { destination: Direct(1), op: Mul, lhs: Direct(2), rhs: Direct(1) }, BinaryFieldOp { destination: Direct(1), op: Sub, lhs: Direct(0), rhs: Direct(1) }, Mov { destination: Direct(0), source: Direct(2) }, Stop { return_data: HeapVector { pointer: Direct(11), size: Direct(10) } }]" ], - "debug_symbols": "nZLbaoQwEIbfZa5zkYPxsK9SikSNSyBEyWqhiO/eMWO2uxeF4s18mvH7iZNsMNhuvbcujNMDbh8bdNF57+6tn3qzuCng6rYzyK/tEq3FJXjpozWbaMMCt7B6z+DL+DV99JhNSFxMxC5nYMOAxMDReXs87ezX5n+rWp2urp+y/rfd6NMWnF/QhaizL9UVv3z61RVf8uL0JW+u+DJPT8r38X3im+ldfDtuULhRBkWqGiUGZapVqnWqTaqCEwRBEhShIFCCwAjchagIGIL/JJoEyQmCIAmKUBA0oSRUBEqRlKIwBc9ZCQKmlAhMKfdjNNGZztvzOo9r6F9u9/I9506+/3Ocejus0R6jST0c1g8=", + "debug_symbols": "nZLBboQgEIbfhTMHBgR1X6VpDCpuSAgaVps0xnfvyGi7e2iy8TKfMH4/CczKetcu98bHYXyw28fK2uRD8PcmjJ2d/Rhxd904O5fNnJzDLfbUR2uyycWZ3eISAmdfNiz5p8dkY+ZsE3YFZy72SAwcfHD718b/bPG/qtXh6upX1m/btTzsurxgA+hDBymu+OY8Hsyl8+vq8KVQF3wJ5elL+eJ/4sp2Pr28NlN4JGdFrholzkyuZa5VrnWuIAhAkARFKAiUABiBTwglAUMKRJ0hBQEIkqAIBUETDKEkUIqkFIUp+E4KCJhiEJhitv1qkrdtcMc0D0vsnoZ7/p7Ozjn+Uxo71y/J7VeTe3hZPw==", "file_map": { "50": { - "source": "fn main(x: u1, y: u1, z: u1) -> pub u1 {\n let p = y - z;\n if p as bool {\n let a = x / z;\n let b = a - z;\n if b as bool {\n let _ = a / b;\n }\n }\n\n let u = x - z;\n let v = y - u;\n v\n}\n", + "source": "fn main(x: u1, y: u1, z: u1) -> pub u1 {\n let p = y - z;\n if p != 0 {\n let a = x / z;\n let b = a - z;\n if b != 0 {\n let _ = a / b;\n }\n }\n\n let u = x - z;\n let v = y - u;\n v\n}\n", "path": "" } }, diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/regression_8329/execute__tests__force_brillig_false_inliner_0.snap b/tooling/nargo_cli/tests/snapshots/execution_success/regression_8329/execute__tests__force_brillig_false_inliner_0.snap index f5483b779f3..13069d7c2b0 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/regression_8329/execute__tests__force_brillig_false_inliner_0.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/regression_8329/execute__tests__force_brillig_false_inliner_0.snap @@ -98,10 +98,10 @@ expression: artifact "unconstrained func 1", "[Const { destination: Direct(10), bit_size: Integer(U32), value: 2 }, Const { destination: Direct(11), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(0), size_address: Direct(10), offset_address: Direct(11) }, BinaryFieldOp { destination: Direct(2), op: IntegerDiv, lhs: Direct(0), rhs: Direct(1) }, BinaryFieldOp { destination: Direct(1), op: Mul, lhs: Direct(2), rhs: Direct(1) }, BinaryFieldOp { destination: Direct(1), op: Sub, lhs: Direct(0), rhs: Direct(1) }, Mov { destination: Direct(0), source: Direct(2) }, Stop { return_data: HeapVector { pointer: Direct(11), size: Direct(10) } }]" ], - "debug_symbols": "nZLbaoQwEIbfZa5zkYPxsK9SikSNSyBEyWqhiO/eMWO2uxeF4s18mvH7iZNsMNhuvbcujNMDbh8bdNF57+6tn3qzuCng6rYzyK/tEq3FJXjpozWbaMMCt7B6z+DL+DV99JhNSFxMxC5nYMOAxMDReXs87ezX5n+rWp2urp+y/rfd6NMWnF/QhaizL9UVv3z61RVf8uL0JW+u+DJPT8r38X3im+ldfDtuULhRBkWqGiUGZapVqnWqTaqCEwRBEhShIFCCwAjchagIGIL/JJoEyQmCIAmKUBA0oSRUBEqRlKIwBc9ZCQKmlAhMKfdjNNGZztvzOo9r6F9u9/I9506+/3Ocejus0R6jST0c1g8=", + "debug_symbols": "nZLBboQgEIbfhTMHBgR1X6VpDCpuSAgaVps0xnfvyGi7e2iy8TKfMH4/CczKetcu98bHYXyw28fK2uRD8PcmjJ2d/Rhxd904O5fNnJzDLfbUR2uyycWZ3eISAmdfNiz5p8dkY+ZsE3YFZy72SAwcfHD718b/bPG/qtXh6upX1m/btTzsurxgA+hDBymu+OY8Hsyl8+vq8KVQF3wJ5elL+eJ/4sp2Pr28NlN4JGdFrholzkyuZa5VrnWuIAhAkARFKAiUABiBTwglAUMKRJ0hBQEIkqAIBUETDKEkUIqkFIUp+E4KCJhiEJhitv1qkrdtcMc0D0vsnoZ7/p7Ozjn+Uxo71y/J7VeTe3hZPw==", "file_map": { "50": { - "source": "fn main(x: u1, y: u1, z: u1) -> pub u1 {\n let p = y - z;\n if p as bool {\n let a = x / z;\n let b = a - z;\n if b as bool {\n let _ = a / b;\n }\n }\n\n let u = x - z;\n let v = y - u;\n v\n}\n", + "source": "fn main(x: u1, y: u1, z: u1) -> pub u1 {\n let p = y - z;\n if p != 0 {\n let a = x / z;\n let b = a - z;\n if b != 0 {\n let _ = a / b;\n }\n }\n\n let u = x - z;\n let v = y - u;\n v\n}\n", "path": "" } }, diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/regression_8329/execute__tests__force_brillig_false_inliner_9223372036854775807.snap b/tooling/nargo_cli/tests/snapshots/execution_success/regression_8329/execute__tests__force_brillig_false_inliner_9223372036854775807.snap index f5483b779f3..13069d7c2b0 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/regression_8329/execute__tests__force_brillig_false_inliner_9223372036854775807.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/regression_8329/execute__tests__force_brillig_false_inliner_9223372036854775807.snap @@ -98,10 +98,10 @@ expression: artifact "unconstrained func 1", "[Const { destination: Direct(10), bit_size: Integer(U32), value: 2 }, Const { destination: Direct(11), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(0), size_address: Direct(10), offset_address: Direct(11) }, BinaryFieldOp { destination: Direct(2), op: IntegerDiv, lhs: Direct(0), rhs: Direct(1) }, BinaryFieldOp { destination: Direct(1), op: Mul, lhs: Direct(2), rhs: Direct(1) }, BinaryFieldOp { destination: Direct(1), op: Sub, lhs: Direct(0), rhs: Direct(1) }, Mov { destination: Direct(0), source: Direct(2) }, Stop { return_data: HeapVector { pointer: Direct(11), size: Direct(10) } }]" ], - "debug_symbols": "nZLbaoQwEIbfZa5zkYPxsK9SikSNSyBEyWqhiO/eMWO2uxeF4s18mvH7iZNsMNhuvbcujNMDbh8bdNF57+6tn3qzuCng6rYzyK/tEq3FJXjpozWbaMMCt7B6z+DL+DV99JhNSFxMxC5nYMOAxMDReXs87ezX5n+rWp2urp+y/rfd6NMWnF/QhaizL9UVv3z61RVf8uL0JW+u+DJPT8r38X3im+ldfDtuULhRBkWqGiUGZapVqnWqTaqCEwRBEhShIFCCwAjchagIGIL/JJoEyQmCIAmKUBA0oSRUBEqRlKIwBc9ZCQKmlAhMKfdjNNGZztvzOo9r6F9u9/I9506+/3Ocejus0R6jST0c1g8=", + "debug_symbols": "nZLBboQgEIbfhTMHBgR1X6VpDCpuSAgaVps0xnfvyGi7e2iy8TKfMH4/CczKetcu98bHYXyw28fK2uRD8PcmjJ2d/Rhxd904O5fNnJzDLfbUR2uyycWZ3eISAmdfNiz5p8dkY+ZsE3YFZy72SAwcfHD718b/bPG/qtXh6upX1m/btTzsurxgA+hDBymu+OY8Hsyl8+vq8KVQF3wJ5elL+eJ/4sp2Pr28NlN4JGdFrholzkyuZa5VrnWuIAhAkARFKAiUABiBTwglAUMKRJ0hBQEIkqAIBUETDKEkUIqkFIUp+E4KCJhiEJhitv1qkrdtcMc0D0vsnoZ7/p7Ozjn+Uxo71y/J7VeTe3hZPw==", "file_map": { "50": { - "source": "fn main(x: u1, y: u1, z: u1) -> pub u1 {\n let p = y - z;\n if p as bool {\n let a = x / z;\n let b = a - z;\n if b as bool {\n let _ = a / b;\n }\n }\n\n let u = x - z;\n let v = y - u;\n v\n}\n", + "source": "fn main(x: u1, y: u1, z: u1) -> pub u1 {\n let p = y - z;\n if p != 0 {\n let a = x / z;\n let b = a - z;\n if b != 0 {\n let _ = a / b;\n }\n }\n\n let u = x - z;\n let v = y - u;\n v\n}\n", "path": "" } }, diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/regression_8329/execute__tests__force_brillig_true_inliner_-9223372036854775808.snap b/tooling/nargo_cli/tests/snapshots/execution_success/regression_8329/execute__tests__force_brillig_true_inliner_-9223372036854775808.snap index 78deb741a9c..5363e38a550 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/regression_8329/execute__tests__force_brillig_true_inliner_-9223372036854775808.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/regression_8329/execute__tests__force_brillig_true_inliner_-9223372036854775808.snap @@ -64,10 +64,10 @@ expression: artifact "unconstrained func 0", "[Const { destination: Direct(2), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(1), bit_size: Integer(U32), value: 32840 }, Const { destination: Direct(0), bit_size: Integer(U32), value: 3 }, Const { destination: Relative(4), bit_size: Integer(U32), value: 3 }, Const { destination: Relative(5), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(32836), size_address: Relative(4), offset_address: Relative(5) }, Cast { destination: Direct(32836), source: Direct(32836), bit_size: Integer(U1) }, Cast { destination: Direct(32837), source: Direct(32837), bit_size: Integer(U1) }, Cast { destination: Direct(32838), source: Direct(32838), bit_size: Integer(U1) }, Mov { destination: Relative(1), source: Direct(32836) }, Mov { destination: Relative(2), source: Direct(32837) }, Mov { destination: Relative(3), source: Direct(32838) }, Call { location: 18 }, Call { location: 19 }, Mov { destination: Direct(32839), source: Relative(1) }, Const { destination: Relative(2), bit_size: Integer(U32), value: 32839 }, Const { destination: Relative(3), bit_size: Integer(U32), value: 1 }, Stop { return_data: HeapVector { pointer: Relative(2), size: Relative(3) } }, Return, Call { location: 44 }, BinaryIntOp { destination: Relative(4), op: Sub, bit_size: U1, lhs: Relative(2), rhs: Relative(3) }, BinaryIntOp { destination: Relative(5), op: LessThanEquals, bit_size: U1, lhs: Relative(3), rhs: Relative(2) }, JumpIf { condition: Relative(5), location: 24 }, Call { location: 50 }, JumpIf { condition: Relative(4), location: 26 }, Jump { location: 35 }, BinaryIntOp { destination: Relative(4), op: Div, bit_size: U1, lhs: Relative(1), rhs: Relative(3) }, BinaryIntOp { destination: Relative(5), op: Sub, bit_size: U1, lhs: Relative(4), rhs: Relative(3) }, BinaryIntOp { destination: Relative(6), op: LessThanEquals, bit_size: U1, lhs: Relative(3), rhs: Relative(4) }, JumpIf { condition: Relative(6), location: 31 }, Call { location: 50 }, JumpIf { condition: Relative(5), location: 33 }, Jump { location: 35 }, BinaryIntOp { destination: Relative(6), op: Div, bit_size: U1, lhs: Relative(4), rhs: Relative(5) }, Jump { location: 35 }, BinaryIntOp { destination: Relative(4), op: Sub, bit_size: U1, lhs: Relative(1), rhs: Relative(3) }, BinaryIntOp { destination: Relative(5), op: LessThanEquals, bit_size: U1, lhs: Relative(3), rhs: Relative(1) }, JumpIf { condition: Relative(5), location: 39 }, Call { location: 50 }, BinaryIntOp { destination: Relative(1), op: Sub, bit_size: U1, lhs: Relative(2), rhs: Relative(4) }, BinaryIntOp { destination: Relative(3), op: LessThanEquals, bit_size: U1, lhs: Relative(4), rhs: Relative(2) }, JumpIf { condition: Relative(3), location: 43 }, Call { location: 50 }, 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: 49 }, 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: 2920182694213909827 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return]" ], - "debug_symbols": "nZLbyoQgEIDfZa69UNNOrxIRVrYIYuHWDz/Ru++YtYeLhaWb+dTxGweZFXrdLrfGuGG8Q1mt0Hpjrbk1duzUbEaHpyvQEDhGRoCzCB6RRKRQckQGZYLII4odCY3AmwIhoZSINCKLyCNQSAkIGsEi8KF02wicHTWz1zo09NYiNj4pr90MpVusJfCn7LJfuk/K7ZyVxywloF2PxIKDsTqsNvKy6XdVJocr86csf7YLediM0gs6Y/np8+SKnz797IrPqTh8TosrPj9/j/PP76txpzrjPyZuC5W8Ua3Vx3ZYXPeWnf+nM3NO7OTHTveL16HSa2wZxkoIIoqaAMOZqiQlktdbePoB", + "debug_symbols": "nZLNjoQgDIDfpWcOgII/r2KMQcUJCUHD6CYb47tvEdmZOWyy8dIPKF/bQ3cYdb89OuOm+Ql1s0PvjbXm0dl5UKuZHb7uQEPgGBkBziJ4RBYhoeaIAuoMUUZUJzIagT9zhIBaIGREEVFGoCAJ5DSCRWAjeRwE0kTd6rUOA72NiIMvymu3Qu02awl8Kbudn56LcidX5TFLCWg3IrHgZKwOp4O8bPq3KrLLFeWvLP5tV/yyq+KGzZi4dMbpHV+m9kze6l+Vl89pdsPnrEg+5x9+izc1GP+xcEeo5I3qrb6u0+aGt+z6vaRMWtjFz4MeN69DpdfWMoxNnpO8agkwXKlGUCJ4e4TWPw==", "file_map": { "50": { - "source": "fn main(x: u1, y: u1, z: u1) -> pub u1 {\n let p = y - z;\n if p as bool {\n let a = x / z;\n let b = a - z;\n if b as bool {\n let _ = a / b;\n }\n }\n\n let u = x - z;\n let v = y - u;\n v\n}\n", + "source": "fn main(x: u1, y: u1, z: u1) -> pub u1 {\n let p = y - z;\n if p != 0 {\n let a = x / z;\n let b = a - z;\n if b != 0 {\n let _ = a / b;\n }\n }\n\n let u = x - z;\n let v = y - u;\n v\n}\n", "path": "" } }, diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/regression_8329/execute__tests__force_brillig_true_inliner_0.snap b/tooling/nargo_cli/tests/snapshots/execution_success/regression_8329/execute__tests__force_brillig_true_inliner_0.snap index 78deb741a9c..5363e38a550 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/regression_8329/execute__tests__force_brillig_true_inliner_0.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/regression_8329/execute__tests__force_brillig_true_inliner_0.snap @@ -64,10 +64,10 @@ expression: artifact "unconstrained func 0", "[Const { destination: Direct(2), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(1), bit_size: Integer(U32), value: 32840 }, Const { destination: Direct(0), bit_size: Integer(U32), value: 3 }, Const { destination: Relative(4), bit_size: Integer(U32), value: 3 }, Const { destination: Relative(5), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(32836), size_address: Relative(4), offset_address: Relative(5) }, Cast { destination: Direct(32836), source: Direct(32836), bit_size: Integer(U1) }, Cast { destination: Direct(32837), source: Direct(32837), bit_size: Integer(U1) }, Cast { destination: Direct(32838), source: Direct(32838), bit_size: Integer(U1) }, Mov { destination: Relative(1), source: Direct(32836) }, Mov { destination: Relative(2), source: Direct(32837) }, Mov { destination: Relative(3), source: Direct(32838) }, Call { location: 18 }, Call { location: 19 }, Mov { destination: Direct(32839), source: Relative(1) }, Const { destination: Relative(2), bit_size: Integer(U32), value: 32839 }, Const { destination: Relative(3), bit_size: Integer(U32), value: 1 }, Stop { return_data: HeapVector { pointer: Relative(2), size: Relative(3) } }, Return, Call { location: 44 }, BinaryIntOp { destination: Relative(4), op: Sub, bit_size: U1, lhs: Relative(2), rhs: Relative(3) }, BinaryIntOp { destination: Relative(5), op: LessThanEquals, bit_size: U1, lhs: Relative(3), rhs: Relative(2) }, JumpIf { condition: Relative(5), location: 24 }, Call { location: 50 }, JumpIf { condition: Relative(4), location: 26 }, Jump { location: 35 }, BinaryIntOp { destination: Relative(4), op: Div, bit_size: U1, lhs: Relative(1), rhs: Relative(3) }, BinaryIntOp { destination: Relative(5), op: Sub, bit_size: U1, lhs: Relative(4), rhs: Relative(3) }, BinaryIntOp { destination: Relative(6), op: LessThanEquals, bit_size: U1, lhs: Relative(3), rhs: Relative(4) }, JumpIf { condition: Relative(6), location: 31 }, Call { location: 50 }, JumpIf { condition: Relative(5), location: 33 }, Jump { location: 35 }, BinaryIntOp { destination: Relative(6), op: Div, bit_size: U1, lhs: Relative(4), rhs: Relative(5) }, Jump { location: 35 }, BinaryIntOp { destination: Relative(4), op: Sub, bit_size: U1, lhs: Relative(1), rhs: Relative(3) }, BinaryIntOp { destination: Relative(5), op: LessThanEquals, bit_size: U1, lhs: Relative(3), rhs: Relative(1) }, JumpIf { condition: Relative(5), location: 39 }, Call { location: 50 }, BinaryIntOp { destination: Relative(1), op: Sub, bit_size: U1, lhs: Relative(2), rhs: Relative(4) }, BinaryIntOp { destination: Relative(3), op: LessThanEquals, bit_size: U1, lhs: Relative(4), rhs: Relative(2) }, JumpIf { condition: Relative(3), location: 43 }, Call { location: 50 }, 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: 49 }, 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: 2920182694213909827 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return]" ], - "debug_symbols": "nZLbyoQgEIDfZa69UNNOrxIRVrYIYuHWDz/Ru++YtYeLhaWb+dTxGweZFXrdLrfGuGG8Q1mt0Hpjrbk1duzUbEaHpyvQEDhGRoCzCB6RRKRQckQGZYLII4odCY3AmwIhoZSINCKLyCNQSAkIGsEi8KF02wicHTWz1zo09NYiNj4pr90MpVusJfCn7LJfuk/K7ZyVxywloF2PxIKDsTqsNvKy6XdVJocr86csf7YLediM0gs6Y/np8+SKnz797IrPqTh8TosrPj9/j/PP76txpzrjPyZuC5W8Ua3Vx3ZYXPeWnf+nM3NO7OTHTveL16HSa2wZxkoIIoqaAMOZqiQlktdbePoB", + "debug_symbols": "nZLNjoQgDIDfpWcOgII/r2KMQcUJCUHD6CYb47tvEdmZOWyy8dIPKF/bQ3cYdb89OuOm+Ql1s0PvjbXm0dl5UKuZHb7uQEPgGBkBziJ4RBYhoeaIAuoMUUZUJzIagT9zhIBaIGREEVFGoCAJ5DSCRWAjeRwE0kTd6rUOA72NiIMvymu3Qu02awl8Kbudn56LcidX5TFLCWg3IrHgZKwOp4O8bPq3KrLLFeWvLP5tV/yyq+KGzZi4dMbpHV+m9kze6l+Vl89pdsPnrEg+5x9+izc1GP+xcEeo5I3qrb6u0+aGt+z6vaRMWtjFz4MeN69DpdfWMoxNnpO8agkwXKlGUCJ4e4TWPw==", "file_map": { "50": { - "source": "fn main(x: u1, y: u1, z: u1) -> pub u1 {\n let p = y - z;\n if p as bool {\n let a = x / z;\n let b = a - z;\n if b as bool {\n let _ = a / b;\n }\n }\n\n let u = x - z;\n let v = y - u;\n v\n}\n", + "source": "fn main(x: u1, y: u1, z: u1) -> pub u1 {\n let p = y - z;\n if p != 0 {\n let a = x / z;\n let b = a - z;\n if b != 0 {\n let _ = a / b;\n }\n }\n\n let u = x - z;\n let v = y - u;\n v\n}\n", "path": "" } }, diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/regression_8329/execute__tests__force_brillig_true_inliner_9223372036854775807.snap b/tooling/nargo_cli/tests/snapshots/execution_success/regression_8329/execute__tests__force_brillig_true_inliner_9223372036854775807.snap index 78deb741a9c..5363e38a550 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/regression_8329/execute__tests__force_brillig_true_inliner_9223372036854775807.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/regression_8329/execute__tests__force_brillig_true_inliner_9223372036854775807.snap @@ -64,10 +64,10 @@ expression: artifact "unconstrained func 0", "[Const { destination: Direct(2), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(1), bit_size: Integer(U32), value: 32840 }, Const { destination: Direct(0), bit_size: Integer(U32), value: 3 }, Const { destination: Relative(4), bit_size: Integer(U32), value: 3 }, Const { destination: Relative(5), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(32836), size_address: Relative(4), offset_address: Relative(5) }, Cast { destination: Direct(32836), source: Direct(32836), bit_size: Integer(U1) }, Cast { destination: Direct(32837), source: Direct(32837), bit_size: Integer(U1) }, Cast { destination: Direct(32838), source: Direct(32838), bit_size: Integer(U1) }, Mov { destination: Relative(1), source: Direct(32836) }, Mov { destination: Relative(2), source: Direct(32837) }, Mov { destination: Relative(3), source: Direct(32838) }, Call { location: 18 }, Call { location: 19 }, Mov { destination: Direct(32839), source: Relative(1) }, Const { destination: Relative(2), bit_size: Integer(U32), value: 32839 }, Const { destination: Relative(3), bit_size: Integer(U32), value: 1 }, Stop { return_data: HeapVector { pointer: Relative(2), size: Relative(3) } }, Return, Call { location: 44 }, BinaryIntOp { destination: Relative(4), op: Sub, bit_size: U1, lhs: Relative(2), rhs: Relative(3) }, BinaryIntOp { destination: Relative(5), op: LessThanEquals, bit_size: U1, lhs: Relative(3), rhs: Relative(2) }, JumpIf { condition: Relative(5), location: 24 }, Call { location: 50 }, JumpIf { condition: Relative(4), location: 26 }, Jump { location: 35 }, BinaryIntOp { destination: Relative(4), op: Div, bit_size: U1, lhs: Relative(1), rhs: Relative(3) }, BinaryIntOp { destination: Relative(5), op: Sub, bit_size: U1, lhs: Relative(4), rhs: Relative(3) }, BinaryIntOp { destination: Relative(6), op: LessThanEquals, bit_size: U1, lhs: Relative(3), rhs: Relative(4) }, JumpIf { condition: Relative(6), location: 31 }, Call { location: 50 }, JumpIf { condition: Relative(5), location: 33 }, Jump { location: 35 }, BinaryIntOp { destination: Relative(6), op: Div, bit_size: U1, lhs: Relative(4), rhs: Relative(5) }, Jump { location: 35 }, BinaryIntOp { destination: Relative(4), op: Sub, bit_size: U1, lhs: Relative(1), rhs: Relative(3) }, BinaryIntOp { destination: Relative(5), op: LessThanEquals, bit_size: U1, lhs: Relative(3), rhs: Relative(1) }, JumpIf { condition: Relative(5), location: 39 }, Call { location: 50 }, BinaryIntOp { destination: Relative(1), op: Sub, bit_size: U1, lhs: Relative(2), rhs: Relative(4) }, BinaryIntOp { destination: Relative(3), op: LessThanEquals, bit_size: U1, lhs: Relative(4), rhs: Relative(2) }, JumpIf { condition: Relative(3), location: 43 }, Call { location: 50 }, 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: 49 }, 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: 2920182694213909827 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return]" ], - "debug_symbols": "nZLbyoQgEIDfZa69UNNOrxIRVrYIYuHWDz/Ru++YtYeLhaWb+dTxGweZFXrdLrfGuGG8Q1mt0Hpjrbk1duzUbEaHpyvQEDhGRoCzCB6RRKRQckQGZYLII4odCY3AmwIhoZSINCKLyCNQSAkIGsEi8KF02wicHTWz1zo09NYiNj4pr90MpVusJfCn7LJfuk/K7ZyVxywloF2PxIKDsTqsNvKy6XdVJocr86csf7YLediM0gs6Y/np8+SKnz797IrPqTh8TosrPj9/j/PP76txpzrjPyZuC5W8Ua3Vx3ZYXPeWnf+nM3NO7OTHTveL16HSa2wZxkoIIoqaAMOZqiQlktdbePoB", + "debug_symbols": "nZLNjoQgDIDfpWcOgII/r2KMQcUJCUHD6CYb47tvEdmZOWyy8dIPKF/bQ3cYdb89OuOm+Ql1s0PvjbXm0dl5UKuZHb7uQEPgGBkBziJ4RBYhoeaIAuoMUUZUJzIagT9zhIBaIGREEVFGoCAJ5DSCRWAjeRwE0kTd6rUOA72NiIMvymu3Qu02awl8Kbudn56LcidX5TFLCWg3IrHgZKwOp4O8bPq3KrLLFeWvLP5tV/yyq+KGzZi4dMbpHV+m9kze6l+Vl89pdsPnrEg+5x9+izc1GP+xcEeo5I3qrb6u0+aGt+z6vaRMWtjFz4MeN69DpdfWMoxNnpO8agkwXKlGUCJ4e4TWPw==", "file_map": { "50": { - "source": "fn main(x: u1, y: u1, z: u1) -> pub u1 {\n let p = y - z;\n if p as bool {\n let a = x / z;\n let b = a - z;\n if b as bool {\n let _ = a / b;\n }\n }\n\n let u = x - z;\n let v = y - u;\n v\n}\n", + "source": "fn main(x: u1, y: u1, z: u1) -> pub u1 {\n let p = y - z;\n if p != 0 {\n let a = x / z;\n let b = a - z;\n if b != 0 {\n let _ = a / b;\n }\n }\n\n let u = x - z;\n let v = y - u;\n v\n}\n", "path": "" } }, diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/signed_division/execute__tests__force_brillig_false_inliner_-9223372036854775808.snap b/tooling/nargo_cli/tests/snapshots/execution_success/signed_division/execute__tests__force_brillig_false_inliner_-9223372036854775808.snap index f07c09a2506..d3e90a4ef6a 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/signed_division/execute__tests__force_brillig_false_inliner_-9223372036854775808.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/signed_division/execute__tests__force_brillig_false_inliner_-9223372036854775808.snap @@ -260,7 +260,7 @@ expression: artifact "unconstrained func 1", "[Const { destination: Direct(21), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(20), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(0), size_address: Direct(21), offset_address: Direct(20) }, Const { destination: Direct(2), bit_size: Field, value: 0 }, BinaryFieldOp { destination: Direct(3), op: Equals, lhs: Direct(0), rhs: Direct(2) }, JumpIf { condition: Direct(3), location: 8 }, Const { destination: Direct(1), bit_size: Field, value: 1 }, BinaryFieldOp { destination: Direct(0), op: Div, lhs: Direct(1), rhs: Direct(0) }, Stop { return_data: HeapVector { pointer: Direct(20), size: Direct(21) } }]" ], - "debug_symbols": "tddNTuNAEAXgu3idRVdV/xVXGY1QAIMiRUkUkpFGiLtPt6sehIVRFDMbv0dMfThuHMdvw9P4cH653+ye96/D3a+34eG42W43L/fb/eP6tNnv2qtv76sBP96fjuPYXhou9repw/o47k7D3e683a6GP+vtefql18N6N+VpfWx7w2oYd08tG/i82Y69va8+p8P8KCmGSdPHeLphnkO4YZ6lYj7T3LzMz1cuxYEqgT8E0S9C/OYdBCHFOQjCcc5I80abwlEIp8/3QXz9UXAuF0eR547i6nOhc8J3q1Ej3kYoc6uhi1eDwg8sB9Hi9fj+OK5cEP2fCyKCy0uSzC0IpeUrkn9iRcryFck/sCLXn4+bliTjZEi95RPvcv6WT1xRzEcKC+dv+fuRP+ZjWDaf6Jb5yphXXTSfQrxhPknCfMzL5tPXz9jf7af14+b45TvCIO0fejXEaZumbZ62ZdrWaavTloIFWbCFzZMBZAIZQWaQIWQKm8KmsClsCpvCprApbAqbwqaIKWKKNKWddWlKu91LtEgW2aJYVAudIgYLsmALU2I/lna7iskzexbP6qmWKXiSJ3uKp3sp9e8yLbNn8ayeapmDJ3myp3hGT/dy9/rqFc/qqZYleJIne4pn9Eye7hX3invFvepeda+6V92r7lX3qnvVvepedU+71xZRu9e+hSh7imf0TJ7Zs3hWT7WkEFAIhVEEJaIklIxSUCoKZIJMkAkyQSbI/ZLg2EuXUy8FpaKol35xWCEURhGUiJJQIDNkhsyQBbJAFsgCWSALZIEskAWyQI6QI+QIOUKOkPvVxLmXLpdeCkpFUS/9krJCKIwiKBEloUBOkBPkBDlDzpAz5Aw5Q86QM+QMOUPOkAvkArlALpAL5Olaq710WXspKBVFvUwX3FQIhVEEJaIkFMgVcoVcIStkhayQFbJCVsgKWSErZHWZQ0AhFEYRlIiS+nPBe7+1HTfrh+3oz7DP593jxSPt6e8Be/DQezjuH8en83Hst7ZpX7vZ/QM=", + "debug_symbols": "tddNbuJAEAXgu3jNoquq/ypXGY0iQpwICQEiMNIoyt2n21WPkIUjBJmN3wtOfTHuGOP34Xl8Or0+rrcvu7fh4df78HRYbzbr18fNbrU8rnfb9ur7x2LAj4/Hwzi2l4aL/W1qvzyM2+PwsD1tNovhz3Jzmn7pbb/cTnlcHtresBjG7XPLBr6sN2NvH4vP6TA/Soph0nQeTzfMcwg3zLNUzGeam5f5+cqlOFAl8FkQ/SLEb95BEFKcgyAc54w0bwifT0OrnwLx9UfBuVwcRZ47iqvPhc4J361GjXgbocytht69GhR+YDmI7l6P74/jygXR/7kgIuf3kWRuQSjdvyL5J1ak3L8i+QdW5PrzcdOSZJwMqbd84l3O3/KJK4r5SOHO+Vv+fuTzfAz3zSe6Zb4y5lXvmk8h3jCfJGE+5vvm09fP2N/tp+VqffjyHWGQ9g+9GOK0TdM2T9sybeu01WlLwYIs2MLmyQAygYwgM8gQMoVNYVPYFDaFTWFT2BQ2hU1hU8QUMUWa0s66NKXd7iVaJItsUSyqhU4RgwVZsIUpsR9Lu13F5Jk9i2f1VMsUPMmTPcXTvZT6d5mW2bN4Vk+1zMGTPNlTPKOne7l7ffWKZ/VUyxI8yZM9xTN6Jk/3invFveJeda+6V92r7lX3qnvVvepeda+6p91ri6jda99ClD3FM3omz+xZPKunWlIIKITCKIISURJKRikoFQUyQSbIBJkgE+R+SXDspcupl4JSUdRLvzisEAqjCEpESSiQGTJDZsgCWSALZIEskAWyQBbIAlkgR8gRcoQcIUfI/Wri3EuXSy8FpaKol35JWSEURhGUiJJQICfICXKCnCFnyBlyhpwhZ8gZcoacIWfIBXKBXCAXyAXydK3VXrqsvRSUiqJepgtuKoTCKIISURIK5Aq5Qq6QFbJCVsgKWSErZIWskBWyuswhoBAKowhKREn9ueCj39oO6+XTZvRn2JfTdnXxSHv8u8cePPTuD7vV+Hw6jP3WNu1rN7t/", "file_map": { "39": { "source": "use crate::convert::AsPrimitive;\n\n// docs:start:add-trait\npub trait Add {\n fn add(self, other: Self) -> Self;\n}\n// docs:end:add-trait\n\nimpl Add for Field {\n fn add(self, other: Field) -> Field {\n self + other\n }\n}\n\nimpl Add for u128 {\n fn add(self, other: u128) -> u128 {\n self + other\n }\n}\nimpl Add for u64 {\n fn add(self, other: u64) -> u64 {\n self + other\n }\n}\nimpl Add for u32 {\n fn add(self, other: u32) -> u32 {\n self + other\n }\n}\nimpl Add for u16 {\n fn add(self, other: u16) -> u16 {\n self + other\n }\n}\nimpl Add for u8 {\n fn add(self, other: u8) -> u8 {\n self + other\n }\n}\nimpl Add for u1 {\n fn add(self, other: u1) -> u1 {\n self + other\n }\n}\n\nimpl Add for i8 {\n fn add(self, other: i8) -> i8 {\n self + other\n }\n}\nimpl Add for i16 {\n fn add(self, other: i16) -> i16 {\n self + other\n }\n}\nimpl Add for i32 {\n fn add(self, other: i32) -> i32 {\n self + other\n }\n}\nimpl Add for i64 {\n fn add(self, other: i64) -> i64 {\n self + other\n }\n}\n\n// docs:start:sub-trait\npub trait Sub {\n fn sub(self, other: Self) -> Self;\n}\n// docs:end:sub-trait\n\nimpl Sub for Field {\n fn sub(self, other: Field) -> Field {\n self - other\n }\n}\n\nimpl Sub for u128 {\n fn sub(self, other: u128) -> u128 {\n self - other\n }\n}\nimpl Sub for u64 {\n fn sub(self, other: u64) -> u64 {\n self - other\n }\n}\nimpl Sub for u32 {\n fn sub(self, other: u32) -> u32 {\n self - other\n }\n}\nimpl Sub for u16 {\n fn sub(self, other: u16) -> u16 {\n self - other\n }\n}\nimpl Sub for u8 {\n fn sub(self, other: u8) -> u8 {\n self - other\n }\n}\nimpl Sub for u1 {\n fn sub(self, other: u1) -> u1 {\n self - other\n }\n}\n\nimpl Sub for i8 {\n fn sub(self, other: i8) -> i8 {\n self - other\n }\n}\nimpl Sub for i16 {\n fn sub(self, other: i16) -> i16 {\n self - other\n }\n}\nimpl Sub for i32 {\n fn sub(self, other: i32) -> i32 {\n self - other\n }\n}\nimpl Sub for i64 {\n fn sub(self, other: i64) -> i64 {\n self - other\n }\n}\n\n// docs:start:mul-trait\npub trait Mul {\n fn mul(self, other: Self) -> Self;\n}\n// docs:end:mul-trait\n\nimpl Mul for Field {\n fn mul(self, other: Field) -> Field {\n self * other\n }\n}\n\nimpl Mul for u128 {\n fn mul(self, other: u128) -> u128 {\n self * other\n }\n}\nimpl Mul for u64 {\n fn mul(self, other: u64) -> u64 {\n self * other\n }\n}\nimpl Mul for u32 {\n fn mul(self, other: u32) -> u32 {\n self * other\n }\n}\nimpl Mul for u16 {\n fn mul(self, other: u16) -> u16 {\n self * other\n }\n}\nimpl Mul for u8 {\n fn mul(self, other: u8) -> u8 {\n self * other\n }\n}\nimpl Mul for u1 {\n fn mul(self, other: u1) -> u1 {\n self * other\n }\n}\n\nimpl Mul for i8 {\n fn mul(self, other: i8) -> i8 {\n self * other\n }\n}\nimpl Mul for i16 {\n fn mul(self, other: i16) -> i16 {\n self * other\n }\n}\nimpl Mul for i32 {\n fn mul(self, other: i32) -> i32 {\n self * other\n }\n}\nimpl Mul for i64 {\n fn mul(self, other: i64) -> i64 {\n self * other\n }\n}\n\n// docs:start:div-trait\npub trait Div {\n fn div(self, other: Self) -> Self;\n}\n// docs:end:div-trait\n\nimpl Div for Field {\n fn div(self, other: Field) -> Field {\n self / other\n }\n}\n\nimpl Div for u128 {\n fn div(self, other: u128) -> u128 {\n self / other\n }\n}\nimpl Div for u64 {\n fn div(self, other: u64) -> u64 {\n self / other\n }\n}\nimpl Div for u32 {\n fn div(self, other: u32) -> u32 {\n self / other\n }\n}\nimpl Div for u16 {\n fn div(self, other: u16) -> u16 {\n self / other\n }\n}\nimpl Div for u8 {\n fn div(self, other: u8) -> u8 {\n self / other\n }\n}\nimpl Div for u1 {\n fn div(self, other: u1) -> u1 {\n self / other\n }\n}\n\nimpl Div for i8 {\n fn div(self, other: i8) -> i8 {\n self / other\n }\n}\nimpl Div for i16 {\n fn div(self, other: i16) -> i16 {\n self / other\n }\n}\nimpl Div for i32 {\n fn div(self, other: i32) -> i32 {\n self / other\n }\n}\nimpl Div for i64 {\n fn div(self, other: i64) -> i64 {\n self / other\n }\n}\n\n// docs:start:rem-trait\npub trait Rem {\n fn rem(self, other: Self) -> Self;\n}\n// docs:end:rem-trait\n\nimpl Rem for u128 {\n fn rem(self, other: u128) -> u128 {\n self % other\n }\n}\nimpl Rem for u64 {\n fn rem(self, other: u64) -> u64 {\n self % other\n }\n}\nimpl Rem for u32 {\n fn rem(self, other: u32) -> u32 {\n self % other\n }\n}\nimpl Rem for u16 {\n fn rem(self, other: u16) -> u16 {\n self % other\n }\n}\nimpl Rem for u8 {\n fn rem(self, other: u8) -> u8 {\n self % other\n }\n}\nimpl Rem for u1 {\n fn rem(self, other: u1) -> u1 {\n self % other\n }\n}\n\nimpl Rem for i8 {\n fn rem(self, other: i8) -> i8 {\n self % other\n }\n}\nimpl Rem for i16 {\n fn rem(self, other: i16) -> i16 {\n self % other\n }\n}\nimpl Rem for i32 {\n fn rem(self, other: i32) -> i32 {\n self % other\n }\n}\nimpl Rem for i64 {\n fn rem(self, other: i64) -> i64 {\n self % other\n }\n}\n\n// docs:start:neg-trait\npub trait Neg {\n fn neg(self) -> Self;\n}\n// docs:end:neg-trait\n\n// docs:start:neg-trait-impls\nimpl Neg for Field {\n fn neg(self) -> Field {\n -self\n }\n}\n\nimpl Neg for i8 {\n fn neg(self) -> i8 {\n -self\n }\n}\nimpl Neg for i16 {\n fn neg(self) -> i16 {\n -self\n }\n}\nimpl Neg for i32 {\n fn neg(self) -> i32 {\n -self\n }\n}\nimpl Neg for i64 {\n fn neg(self) -> i64 {\n -self\n }\n}\n// docs:end:neg-trait-impls\n\n// docs:start:wrapping-add-trait\npub trait WrappingAdd {\n fn wrapping_add(self, y: Self) -> Self;\n}\n// docs:end:wrapping-add-trait\n\nimpl WrappingAdd for u1 {\n fn wrapping_add(self: u1, y: u1) -> u1 {\n self ^ y\n }\n}\n\nimpl WrappingAdd for u8 {\n fn wrapping_add(self: u8, y: u8) -> u8 {\n wrapping_add_hlp(self, y)\n }\n}\n\nimpl WrappingAdd for u16 {\n fn wrapping_add(self: u16, y: u16) -> u16 {\n wrapping_add_hlp(self, y)\n }\n}\n\nimpl WrappingAdd for u32 {\n fn wrapping_add(self: u32, y: u32) -> u32 {\n wrapping_add_hlp(self, y)\n }\n}\n\nimpl WrappingAdd for u64 {\n fn wrapping_add(self: u64, y: u64) -> u64 {\n wrapping_add_hlp(self, y)\n }\n}\n\nimpl WrappingAdd for u128 {\n fn wrapping_add(self: u128, y: u128) -> u128 {\n wrapping_add_hlp(self, y)\n }\n}\n\nimpl WrappingAdd for i8 {\n fn wrapping_add(self: i8, y: i8) -> i8 {\n wrapping_add_hlp(self, y)\n }\n}\n\nimpl WrappingAdd for i16 {\n fn wrapping_add(self: i16, y: i16) -> i16 {\n wrapping_add_hlp(self, y)\n }\n}\n\nimpl WrappingAdd for i32 {\n fn wrapping_add(self: i32, y: i32) -> i32 {\n wrapping_add_hlp(self, y)\n }\n}\n\nimpl WrappingAdd for i64 {\n fn wrapping_add(self: i64, y: i64) -> i64 {\n wrapping_add_hlp(self, y)\n }\n}\nimpl WrappingAdd for Field {\n fn wrapping_add(self: Field, y: Field) -> Field {\n self + y\n }\n}\n\n// docs:start:wrapping-sub-trait\npub trait WrappingSub {\n fn wrapping_sub(self, y: Self) -> Self;\n}\n// docs:start:wrapping-sub-trait\n\nimpl WrappingSub for u1 {\n fn wrapping_sub(self: u1, y: u1) -> u1 {\n self ^ y\n }\n}\n\nimpl WrappingSub for u8 {\n fn wrapping_sub(self: u8, y: u8) -> u8 {\n wrapping_sub_hlp(self, y) as u8\n }\n}\n\nimpl WrappingSub for u16 {\n fn wrapping_sub(self: u16, y: u16) -> u16 {\n wrapping_sub_hlp(self, y) as u16\n }\n}\n\nimpl WrappingSub for u32 {\n fn wrapping_sub(self: u32, y: u32) -> u32 {\n wrapping_sub_hlp(self, y) as u32\n }\n}\nimpl WrappingSub for u64 {\n fn wrapping_sub(self: u64, y: u64) -> u64 {\n wrapping_sub_hlp(self, y) as u64\n }\n}\nimpl WrappingSub for u128 {\n fn wrapping_sub(self: u128, y: u128) -> u128 {\n wrapping_sub_hlp(self, y) as u128\n }\n}\n\nimpl WrappingSub for i8 {\n fn wrapping_sub(self: i8, y: i8) -> i8 {\n wrapping_sub_hlp(self, y) as i8\n }\n}\n\nimpl WrappingSub for i16 {\n fn wrapping_sub(self: i16, y: i16) -> i16 {\n wrapping_sub_hlp(self, y) as i16\n }\n}\n\nimpl WrappingSub for i32 {\n fn wrapping_sub(self: i32, y: i32) -> i32 {\n wrapping_sub_hlp(self, y) as i32\n }\n}\nimpl WrappingSub for i64 {\n fn wrapping_sub(self: i64, y: i64) -> i64 {\n wrapping_sub_hlp(self, y) as i64\n }\n}\nimpl WrappingSub for Field {\n fn wrapping_sub(self: Field, y: Field) -> Field {\n self - y\n }\n}\n\n// docs:start:wrapping-mul-trait\npub trait WrappingMul {\n fn wrapping_mul(self, y: Self) -> Self;\n}\n// docs:start:wrapping-mul-trait\n\nimpl WrappingMul for u1 {\n fn wrapping_mul(self: u1, y: u1) -> u1 {\n self & y\n }\n}\n\nimpl WrappingMul for u8 {\n fn wrapping_mul(self: u8, y: u8) -> u8 {\n wrapping_mul_hlp(self, y)\n }\n}\n\nimpl WrappingMul for u16 {\n fn wrapping_mul(self: u16, y: u16) -> u16 {\n wrapping_mul_hlp(self, y)\n }\n}\n\nimpl WrappingMul for u32 {\n fn wrapping_mul(self: u32, y: u32) -> u32 {\n wrapping_mul_hlp(self, y)\n }\n}\nimpl WrappingMul for u64 {\n fn wrapping_mul(self: u64, y: u64) -> u64 {\n wrapping_mul_hlp(self, y)\n }\n}\n\nimpl WrappingMul for i8 {\n fn wrapping_mul(self: i8, y: i8) -> i8 {\n wrapping_mul_hlp(self, y)\n }\n}\n\nimpl WrappingMul for i16 {\n fn wrapping_mul(self: i16, y: i16) -> i16 {\n wrapping_mul_hlp(self, y)\n }\n}\n\nimpl WrappingMul for i32 {\n fn wrapping_mul(self: i32, y: i32) -> i32 {\n wrapping_mul_hlp(self, y)\n }\n}\n\nimpl WrappingMul for i64 {\n fn wrapping_mul(self: i64, y: i64) -> i64 {\n wrapping_mul_hlp(self, y)\n }\n}\n\nimpl WrappingMul for u128 {\n fn wrapping_mul(self: u128, y: u128) -> u128 {\n wrapping_mul128_hlp(self, y)\n }\n}\nimpl WrappingMul for Field {\n fn wrapping_mul(self: Field, y: Field) -> Field {\n self * y\n }\n}\n\nfn wrapping_add_hlp(x: T, y: T) -> T\nwhere\n T: AsPrimitive,\n Field: AsPrimitive,\n{\n AsPrimitive::as_(x.as_() + y.as_())\n}\n\nfn wrapping_sub_hlp(x: T, y: T) -> Field\nwhere\n T: AsPrimitive,\n{\n //340282366920938463463374607431768211456 is 2^128, it is used to avoid underflow\n x.as_() + 340282366920938463463374607431768211456 - y.as_()\n}\n\nfn wrapping_mul_hlp(x: T, y: T) -> T\nwhere\n T: AsPrimitive,\n Field: AsPrimitive,\n{\n AsPrimitive::as_(x.as_() * y.as_())\n}\n\nglobal two_pow_64: u128 = 0x10000000000000000;\n/// Splits a 128 bits number into two 64 bits limbs\nunconstrained fn split64(x: u128) -> (u64, u64) {\n let lo = x as u64;\n let hi = (x / two_pow_64) as u64;\n (lo, hi)\n}\n\n/// Split a 128 bits number into two 64 bits limbs\n/// It will fail if the number is more than 128 bits\nfn split_into_64_bit_limbs(x: u128) -> (u64, u64) {\n // Safety: the limbs are constrained below\n let (x_lo, x_hi) = unsafe { split64(x) };\n assert(x as Field == x_lo as Field + x_hi as Field * two_pow_64 as Field);\n (x_lo, x_hi)\n}\n\n#[field(bn254)]\nfn wrapping_mul128_hlp(x: u128, y: u128) -> u128 {\n let (x_lo, x_hi) = split_into_64_bit_limbs(x);\n let (y_lo, y_hi) = split_into_64_bit_limbs(y);\n // Multiplication using the limbs:(x_lo + 2**64*x_hi)*(y_lo + 2**64*y_hi)=x_lo*y_lo+...\n // and skipping the terms over 2**128\n // Working with u64 limbs ensures that we cannot overflow the field modulus.\n let low = x_lo as Field * y_lo as Field;\n let lo = low as u64 as Field;\n let carry = (low - lo) / two_pow_64 as Field;\n let high = x_lo as Field * y_hi as Field + x_hi as Field * y_lo as Field + carry;\n let hi = high as u64 as Field;\n (lo + two_pow_64 as Field * hi) as u128\n}\n", diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/signed_division/execute__tests__force_brillig_false_inliner_0.snap b/tooling/nargo_cli/tests/snapshots/execution_success/signed_division/execute__tests__force_brillig_false_inliner_0.snap index f07c09a2506..d3e90a4ef6a 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/signed_division/execute__tests__force_brillig_false_inliner_0.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/signed_division/execute__tests__force_brillig_false_inliner_0.snap @@ -260,7 +260,7 @@ expression: artifact "unconstrained func 1", "[Const { destination: Direct(21), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(20), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(0), size_address: Direct(21), offset_address: Direct(20) }, Const { destination: Direct(2), bit_size: Field, value: 0 }, BinaryFieldOp { destination: Direct(3), op: Equals, lhs: Direct(0), rhs: Direct(2) }, JumpIf { condition: Direct(3), location: 8 }, Const { destination: Direct(1), bit_size: Field, value: 1 }, BinaryFieldOp { destination: Direct(0), op: Div, lhs: Direct(1), rhs: Direct(0) }, Stop { return_data: HeapVector { pointer: Direct(20), size: Direct(21) } }]" ], - "debug_symbols": "tddNTuNAEAXgu3idRVdV/xVXGY1QAIMiRUkUkpFGiLtPt6sehIVRFDMbv0dMfThuHMdvw9P4cH653+ye96/D3a+34eG42W43L/fb/eP6tNnv2qtv76sBP96fjuPYXhou9repw/o47k7D3e683a6GP+vtefql18N6N+VpfWx7w2oYd08tG/i82Y69va8+p8P8KCmGSdPHeLphnkO4YZ6lYj7T3LzMz1cuxYEqgT8E0S9C/OYdBCHFOQjCcc5I80abwlEIp8/3QXz9UXAuF0eR547i6nOhc8J3q1Ej3kYoc6uhi1eDwg8sB9Hi9fj+OK5cEP2fCyKCy0uSzC0IpeUrkn9iRcryFck/sCLXn4+bliTjZEi95RPvcv6WT1xRzEcKC+dv+fuRP+ZjWDaf6Jb5yphXXTSfQrxhPknCfMzL5tPXz9jf7af14+b45TvCIO0fejXEaZumbZ62ZdrWaavTloIFWbCFzZMBZAIZQWaQIWQKm8KmsClsCpvCprApbAqbwqaIKWKKNKWddWlKu91LtEgW2aJYVAudIgYLsmALU2I/lna7iskzexbP6qmWKXiSJ3uKp3sp9e8yLbNn8ayeapmDJ3myp3hGT/dy9/rqFc/qqZYleJIne4pn9Eye7hX3invFvepeda+6V92r7lX3qnvVvepedU+71xZRu9e+hSh7imf0TJ7Zs3hWT7WkEFAIhVEEJaIklIxSUCoKZIJMkAkyQSbI/ZLg2EuXUy8FpaKol35xWCEURhGUiJJQIDNkhsyQBbJAFsgCWSALZIEskAWyQI6QI+QIOUKOkPvVxLmXLpdeCkpFUS/9krJCKIwiKBEloUBOkBPkBDlDzpAz5Aw5Q86QM+QMOUPOkAvkArlALpAL5Olaq710WXspKBVFvUwX3FQIhVEEJaIkFMgVcoVcIStkhayQFbJCVsgKWSErZHWZQ0AhFEYRlIiS+nPBe7+1HTfrh+3oz7DP593jxSPt6e8Be/DQezjuH8en83Hst7ZpX7vZ/QM=", + "debug_symbols": "tddNbuJAEAXgu3jNoquq/ypXGY0iQpwICQEiMNIoyt2n21WPkIUjBJmN3wtOfTHuGOP34Xl8Or0+rrcvu7fh4df78HRYbzbr18fNbrU8rnfb9ur7x2LAj4/Hwzi2l4aL/W1qvzyM2+PwsD1tNovhz3Jzmn7pbb/cTnlcHtresBjG7XPLBr6sN2NvH4vP6TA/Soph0nQeTzfMcwg3zLNUzGeam5f5+cqlOFAl8FkQ/SLEb95BEFKcgyAc54w0bwifT0OrnwLx9UfBuVwcRZ47iqvPhc4J361GjXgbocytht69GhR+YDmI7l6P74/jygXR/7kgIuf3kWRuQSjdvyL5J1ak3L8i+QdW5PrzcdOSZJwMqbd84l3O3/KJK4r5SOHO+Vv+fuTzfAz3zSe6Zb4y5lXvmk8h3jCfJGE+5vvm09fP2N/tp+VqffjyHWGQ9g+9GOK0TdM2T9sybeu01WlLwYIs2MLmyQAygYwgM8gQMoVNYVPYFDaFTWFT2BQ2hU1hU8QUMUWa0s66NKXd7iVaJItsUSyqhU4RgwVZsIUpsR9Lu13F5Jk9i2f1VMsUPMmTPcXTvZT6d5mW2bN4Vk+1zMGTPNlTPKOne7l7ffWKZ/VUyxI8yZM9xTN6Jk/3invFveJeda+6V92r7lX3qnvVvepeda+6p91ri6jda99ClD3FM3omz+xZPKunWlIIKITCKIISURJKRikoFQUyQSbIBJkgE+R+SXDspcupl4JSUdRLvzisEAqjCEpESSiQGTJDZsgCWSALZIEskAWyQBbIAlkgR8gRcoQcIUfI/Wri3EuXSy8FpaKol35JWSEURhGUiJJQICfICXKCnCFnyBlyhpwhZ8gZcoacIWfIBXKBXCAXyAXydK3VXrqsvRSUiqJepgtuKoTCKIISURIK5Aq5Qq6QFbJCVsgKWSErZIWskBWyuswhoBAKowhKREn9ueCj39oO6+XTZvRn2JfTdnXxSHv8u8cePPTuD7vV+Hw6jP3WNu1rN7t/", "file_map": { "39": { "source": "use crate::convert::AsPrimitive;\n\n// docs:start:add-trait\npub trait Add {\n fn add(self, other: Self) -> Self;\n}\n// docs:end:add-trait\n\nimpl Add for Field {\n fn add(self, other: Field) -> Field {\n self + other\n }\n}\n\nimpl Add for u128 {\n fn add(self, other: u128) -> u128 {\n self + other\n }\n}\nimpl Add for u64 {\n fn add(self, other: u64) -> u64 {\n self + other\n }\n}\nimpl Add for u32 {\n fn add(self, other: u32) -> u32 {\n self + other\n }\n}\nimpl Add for u16 {\n fn add(self, other: u16) -> u16 {\n self + other\n }\n}\nimpl Add for u8 {\n fn add(self, other: u8) -> u8 {\n self + other\n }\n}\nimpl Add for u1 {\n fn add(self, other: u1) -> u1 {\n self + other\n }\n}\n\nimpl Add for i8 {\n fn add(self, other: i8) -> i8 {\n self + other\n }\n}\nimpl Add for i16 {\n fn add(self, other: i16) -> i16 {\n self + other\n }\n}\nimpl Add for i32 {\n fn add(self, other: i32) -> i32 {\n self + other\n }\n}\nimpl Add for i64 {\n fn add(self, other: i64) -> i64 {\n self + other\n }\n}\n\n// docs:start:sub-trait\npub trait Sub {\n fn sub(self, other: Self) -> Self;\n}\n// docs:end:sub-trait\n\nimpl Sub for Field {\n fn sub(self, other: Field) -> Field {\n self - other\n }\n}\n\nimpl Sub for u128 {\n fn sub(self, other: u128) -> u128 {\n self - other\n }\n}\nimpl Sub for u64 {\n fn sub(self, other: u64) -> u64 {\n self - other\n }\n}\nimpl Sub for u32 {\n fn sub(self, other: u32) -> u32 {\n self - other\n }\n}\nimpl Sub for u16 {\n fn sub(self, other: u16) -> u16 {\n self - other\n }\n}\nimpl Sub for u8 {\n fn sub(self, other: u8) -> u8 {\n self - other\n }\n}\nimpl Sub for u1 {\n fn sub(self, other: u1) -> u1 {\n self - other\n }\n}\n\nimpl Sub for i8 {\n fn sub(self, other: i8) -> i8 {\n self - other\n }\n}\nimpl Sub for i16 {\n fn sub(self, other: i16) -> i16 {\n self - other\n }\n}\nimpl Sub for i32 {\n fn sub(self, other: i32) -> i32 {\n self - other\n }\n}\nimpl Sub for i64 {\n fn sub(self, other: i64) -> i64 {\n self - other\n }\n}\n\n// docs:start:mul-trait\npub trait Mul {\n fn mul(self, other: Self) -> Self;\n}\n// docs:end:mul-trait\n\nimpl Mul for Field {\n fn mul(self, other: Field) -> Field {\n self * other\n }\n}\n\nimpl Mul for u128 {\n fn mul(self, other: u128) -> u128 {\n self * other\n }\n}\nimpl Mul for u64 {\n fn mul(self, other: u64) -> u64 {\n self * other\n }\n}\nimpl Mul for u32 {\n fn mul(self, other: u32) -> u32 {\n self * other\n }\n}\nimpl Mul for u16 {\n fn mul(self, other: u16) -> u16 {\n self * other\n }\n}\nimpl Mul for u8 {\n fn mul(self, other: u8) -> u8 {\n self * other\n }\n}\nimpl Mul for u1 {\n fn mul(self, other: u1) -> u1 {\n self * other\n }\n}\n\nimpl Mul for i8 {\n fn mul(self, other: i8) -> i8 {\n self * other\n }\n}\nimpl Mul for i16 {\n fn mul(self, other: i16) -> i16 {\n self * other\n }\n}\nimpl Mul for i32 {\n fn mul(self, other: i32) -> i32 {\n self * other\n }\n}\nimpl Mul for i64 {\n fn mul(self, other: i64) -> i64 {\n self * other\n }\n}\n\n// docs:start:div-trait\npub trait Div {\n fn div(self, other: Self) -> Self;\n}\n// docs:end:div-trait\n\nimpl Div for Field {\n fn div(self, other: Field) -> Field {\n self / other\n }\n}\n\nimpl Div for u128 {\n fn div(self, other: u128) -> u128 {\n self / other\n }\n}\nimpl Div for u64 {\n fn div(self, other: u64) -> u64 {\n self / other\n }\n}\nimpl Div for u32 {\n fn div(self, other: u32) -> u32 {\n self / other\n }\n}\nimpl Div for u16 {\n fn div(self, other: u16) -> u16 {\n self / other\n }\n}\nimpl Div for u8 {\n fn div(self, other: u8) -> u8 {\n self / other\n }\n}\nimpl Div for u1 {\n fn div(self, other: u1) -> u1 {\n self / other\n }\n}\n\nimpl Div for i8 {\n fn div(self, other: i8) -> i8 {\n self / other\n }\n}\nimpl Div for i16 {\n fn div(self, other: i16) -> i16 {\n self / other\n }\n}\nimpl Div for i32 {\n fn div(self, other: i32) -> i32 {\n self / other\n }\n}\nimpl Div for i64 {\n fn div(self, other: i64) -> i64 {\n self / other\n }\n}\n\n// docs:start:rem-trait\npub trait Rem {\n fn rem(self, other: Self) -> Self;\n}\n// docs:end:rem-trait\n\nimpl Rem for u128 {\n fn rem(self, other: u128) -> u128 {\n self % other\n }\n}\nimpl Rem for u64 {\n fn rem(self, other: u64) -> u64 {\n self % other\n }\n}\nimpl Rem for u32 {\n fn rem(self, other: u32) -> u32 {\n self % other\n }\n}\nimpl Rem for u16 {\n fn rem(self, other: u16) -> u16 {\n self % other\n }\n}\nimpl Rem for u8 {\n fn rem(self, other: u8) -> u8 {\n self % other\n }\n}\nimpl Rem for u1 {\n fn rem(self, other: u1) -> u1 {\n self % other\n }\n}\n\nimpl Rem for i8 {\n fn rem(self, other: i8) -> i8 {\n self % other\n }\n}\nimpl Rem for i16 {\n fn rem(self, other: i16) -> i16 {\n self % other\n }\n}\nimpl Rem for i32 {\n fn rem(self, other: i32) -> i32 {\n self % other\n }\n}\nimpl Rem for i64 {\n fn rem(self, other: i64) -> i64 {\n self % other\n }\n}\n\n// docs:start:neg-trait\npub trait Neg {\n fn neg(self) -> Self;\n}\n// docs:end:neg-trait\n\n// docs:start:neg-trait-impls\nimpl Neg for Field {\n fn neg(self) -> Field {\n -self\n }\n}\n\nimpl Neg for i8 {\n fn neg(self) -> i8 {\n -self\n }\n}\nimpl Neg for i16 {\n fn neg(self) -> i16 {\n -self\n }\n}\nimpl Neg for i32 {\n fn neg(self) -> i32 {\n -self\n }\n}\nimpl Neg for i64 {\n fn neg(self) -> i64 {\n -self\n }\n}\n// docs:end:neg-trait-impls\n\n// docs:start:wrapping-add-trait\npub trait WrappingAdd {\n fn wrapping_add(self, y: Self) -> Self;\n}\n// docs:end:wrapping-add-trait\n\nimpl WrappingAdd for u1 {\n fn wrapping_add(self: u1, y: u1) -> u1 {\n self ^ y\n }\n}\n\nimpl WrappingAdd for u8 {\n fn wrapping_add(self: u8, y: u8) -> u8 {\n wrapping_add_hlp(self, y)\n }\n}\n\nimpl WrappingAdd for u16 {\n fn wrapping_add(self: u16, y: u16) -> u16 {\n wrapping_add_hlp(self, y)\n }\n}\n\nimpl WrappingAdd for u32 {\n fn wrapping_add(self: u32, y: u32) -> u32 {\n wrapping_add_hlp(self, y)\n }\n}\n\nimpl WrappingAdd for u64 {\n fn wrapping_add(self: u64, y: u64) -> u64 {\n wrapping_add_hlp(self, y)\n }\n}\n\nimpl WrappingAdd for u128 {\n fn wrapping_add(self: u128, y: u128) -> u128 {\n wrapping_add_hlp(self, y)\n }\n}\n\nimpl WrappingAdd for i8 {\n fn wrapping_add(self: i8, y: i8) -> i8 {\n wrapping_add_hlp(self, y)\n }\n}\n\nimpl WrappingAdd for i16 {\n fn wrapping_add(self: i16, y: i16) -> i16 {\n wrapping_add_hlp(self, y)\n }\n}\n\nimpl WrappingAdd for i32 {\n fn wrapping_add(self: i32, y: i32) -> i32 {\n wrapping_add_hlp(self, y)\n }\n}\n\nimpl WrappingAdd for i64 {\n fn wrapping_add(self: i64, y: i64) -> i64 {\n wrapping_add_hlp(self, y)\n }\n}\nimpl WrappingAdd for Field {\n fn wrapping_add(self: Field, y: Field) -> Field {\n self + y\n }\n}\n\n// docs:start:wrapping-sub-trait\npub trait WrappingSub {\n fn wrapping_sub(self, y: Self) -> Self;\n}\n// docs:start:wrapping-sub-trait\n\nimpl WrappingSub for u1 {\n fn wrapping_sub(self: u1, y: u1) -> u1 {\n self ^ y\n }\n}\n\nimpl WrappingSub for u8 {\n fn wrapping_sub(self: u8, y: u8) -> u8 {\n wrapping_sub_hlp(self, y) as u8\n }\n}\n\nimpl WrappingSub for u16 {\n fn wrapping_sub(self: u16, y: u16) -> u16 {\n wrapping_sub_hlp(self, y) as u16\n }\n}\n\nimpl WrappingSub for u32 {\n fn wrapping_sub(self: u32, y: u32) -> u32 {\n wrapping_sub_hlp(self, y) as u32\n }\n}\nimpl WrappingSub for u64 {\n fn wrapping_sub(self: u64, y: u64) -> u64 {\n wrapping_sub_hlp(self, y) as u64\n }\n}\nimpl WrappingSub for u128 {\n fn wrapping_sub(self: u128, y: u128) -> u128 {\n wrapping_sub_hlp(self, y) as u128\n }\n}\n\nimpl WrappingSub for i8 {\n fn wrapping_sub(self: i8, y: i8) -> i8 {\n wrapping_sub_hlp(self, y) as i8\n }\n}\n\nimpl WrappingSub for i16 {\n fn wrapping_sub(self: i16, y: i16) -> i16 {\n wrapping_sub_hlp(self, y) as i16\n }\n}\n\nimpl WrappingSub for i32 {\n fn wrapping_sub(self: i32, y: i32) -> i32 {\n wrapping_sub_hlp(self, y) as i32\n }\n}\nimpl WrappingSub for i64 {\n fn wrapping_sub(self: i64, y: i64) -> i64 {\n wrapping_sub_hlp(self, y) as i64\n }\n}\nimpl WrappingSub for Field {\n fn wrapping_sub(self: Field, y: Field) -> Field {\n self - y\n }\n}\n\n// docs:start:wrapping-mul-trait\npub trait WrappingMul {\n fn wrapping_mul(self, y: Self) -> Self;\n}\n// docs:start:wrapping-mul-trait\n\nimpl WrappingMul for u1 {\n fn wrapping_mul(self: u1, y: u1) -> u1 {\n self & y\n }\n}\n\nimpl WrappingMul for u8 {\n fn wrapping_mul(self: u8, y: u8) -> u8 {\n wrapping_mul_hlp(self, y)\n }\n}\n\nimpl WrappingMul for u16 {\n fn wrapping_mul(self: u16, y: u16) -> u16 {\n wrapping_mul_hlp(self, y)\n }\n}\n\nimpl WrappingMul for u32 {\n fn wrapping_mul(self: u32, y: u32) -> u32 {\n wrapping_mul_hlp(self, y)\n }\n}\nimpl WrappingMul for u64 {\n fn wrapping_mul(self: u64, y: u64) -> u64 {\n wrapping_mul_hlp(self, y)\n }\n}\n\nimpl WrappingMul for i8 {\n fn wrapping_mul(self: i8, y: i8) -> i8 {\n wrapping_mul_hlp(self, y)\n }\n}\n\nimpl WrappingMul for i16 {\n fn wrapping_mul(self: i16, y: i16) -> i16 {\n wrapping_mul_hlp(self, y)\n }\n}\n\nimpl WrappingMul for i32 {\n fn wrapping_mul(self: i32, y: i32) -> i32 {\n wrapping_mul_hlp(self, y)\n }\n}\n\nimpl WrappingMul for i64 {\n fn wrapping_mul(self: i64, y: i64) -> i64 {\n wrapping_mul_hlp(self, y)\n }\n}\n\nimpl WrappingMul for u128 {\n fn wrapping_mul(self: u128, y: u128) -> u128 {\n wrapping_mul128_hlp(self, y)\n }\n}\nimpl WrappingMul for Field {\n fn wrapping_mul(self: Field, y: Field) -> Field {\n self * y\n }\n}\n\nfn wrapping_add_hlp(x: T, y: T) -> T\nwhere\n T: AsPrimitive,\n Field: AsPrimitive,\n{\n AsPrimitive::as_(x.as_() + y.as_())\n}\n\nfn wrapping_sub_hlp(x: T, y: T) -> Field\nwhere\n T: AsPrimitive,\n{\n //340282366920938463463374607431768211456 is 2^128, it is used to avoid underflow\n x.as_() + 340282366920938463463374607431768211456 - y.as_()\n}\n\nfn wrapping_mul_hlp(x: T, y: T) -> T\nwhere\n T: AsPrimitive,\n Field: AsPrimitive,\n{\n AsPrimitive::as_(x.as_() * y.as_())\n}\n\nglobal two_pow_64: u128 = 0x10000000000000000;\n/// Splits a 128 bits number into two 64 bits limbs\nunconstrained fn split64(x: u128) -> (u64, u64) {\n let lo = x as u64;\n let hi = (x / two_pow_64) as u64;\n (lo, hi)\n}\n\n/// Split a 128 bits number into two 64 bits limbs\n/// It will fail if the number is more than 128 bits\nfn split_into_64_bit_limbs(x: u128) -> (u64, u64) {\n // Safety: the limbs are constrained below\n let (x_lo, x_hi) = unsafe { split64(x) };\n assert(x as Field == x_lo as Field + x_hi as Field * two_pow_64 as Field);\n (x_lo, x_hi)\n}\n\n#[field(bn254)]\nfn wrapping_mul128_hlp(x: u128, y: u128) -> u128 {\n let (x_lo, x_hi) = split_into_64_bit_limbs(x);\n let (y_lo, y_hi) = split_into_64_bit_limbs(y);\n // Multiplication using the limbs:(x_lo + 2**64*x_hi)*(y_lo + 2**64*y_hi)=x_lo*y_lo+...\n // and skipping the terms over 2**128\n // Working with u64 limbs ensures that we cannot overflow the field modulus.\n let low = x_lo as Field * y_lo as Field;\n let lo = low as u64 as Field;\n let carry = (low - lo) / two_pow_64 as Field;\n let high = x_lo as Field * y_hi as Field + x_hi as Field * y_lo as Field + carry;\n let hi = high as u64 as Field;\n (lo + two_pow_64 as Field * hi) as u128\n}\n", diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/signed_division/execute__tests__force_brillig_false_inliner_9223372036854775807.snap b/tooling/nargo_cli/tests/snapshots/execution_success/signed_division/execute__tests__force_brillig_false_inliner_9223372036854775807.snap index f07c09a2506..d3e90a4ef6a 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/signed_division/execute__tests__force_brillig_false_inliner_9223372036854775807.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/signed_division/execute__tests__force_brillig_false_inliner_9223372036854775807.snap @@ -260,7 +260,7 @@ expression: artifact "unconstrained func 1", "[Const { destination: Direct(21), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(20), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(0), size_address: Direct(21), offset_address: Direct(20) }, Const { destination: Direct(2), bit_size: Field, value: 0 }, BinaryFieldOp { destination: Direct(3), op: Equals, lhs: Direct(0), rhs: Direct(2) }, JumpIf { condition: Direct(3), location: 8 }, Const { destination: Direct(1), bit_size: Field, value: 1 }, BinaryFieldOp { destination: Direct(0), op: Div, lhs: Direct(1), rhs: Direct(0) }, Stop { return_data: HeapVector { pointer: Direct(20), size: Direct(21) } }]" ], - "debug_symbols": "tddNTuNAEAXgu3idRVdV/xVXGY1QAIMiRUkUkpFGiLtPt6sehIVRFDMbv0dMfThuHMdvw9P4cH653+ye96/D3a+34eG42W43L/fb/eP6tNnv2qtv76sBP96fjuPYXhou9repw/o47k7D3e683a6GP+vtefql18N6N+VpfWx7w2oYd08tG/i82Y69va8+p8P8KCmGSdPHeLphnkO4YZ6lYj7T3LzMz1cuxYEqgT8E0S9C/OYdBCHFOQjCcc5I80abwlEIp8/3QXz9UXAuF0eR547i6nOhc8J3q1Ej3kYoc6uhi1eDwg8sB9Hi9fj+OK5cEP2fCyKCy0uSzC0IpeUrkn9iRcryFck/sCLXn4+bliTjZEi95RPvcv6WT1xRzEcKC+dv+fuRP+ZjWDaf6Jb5yphXXTSfQrxhPknCfMzL5tPXz9jf7af14+b45TvCIO0fejXEaZumbZ62ZdrWaavTloIFWbCFzZMBZAIZQWaQIWQKm8KmsClsCpvCprApbAqbwqaIKWKKNKWddWlKu91LtEgW2aJYVAudIgYLsmALU2I/lna7iskzexbP6qmWKXiSJ3uKp3sp9e8yLbNn8ayeapmDJ3myp3hGT/dy9/rqFc/qqZYleJIne4pn9Eye7hX3invFvepeda+6V92r7lX3qnvVvepedU+71xZRu9e+hSh7imf0TJ7Zs3hWT7WkEFAIhVEEJaIklIxSUCoKZIJMkAkyQSbI/ZLg2EuXUy8FpaKol35xWCEURhGUiJJQIDNkhsyQBbJAFsgCWSALZIEskAWyQI6QI+QIOUKOkPvVxLmXLpdeCkpFUS/9krJCKIwiKBEloUBOkBPkBDlDzpAz5Aw5Q86QM+QMOUPOkAvkArlALpAL5Olaq710WXspKBVFvUwX3FQIhVEEJaIkFMgVcoVcIStkhayQFbJCVsgKWSErZHWZQ0AhFEYRlIiS+nPBe7+1HTfrh+3oz7DP593jxSPt6e8Be/DQezjuH8en83Hst7ZpX7vZ/QM=", + "debug_symbols": "tddNbuJAEAXgu3jNoquq/ypXGY0iQpwICQEiMNIoyt2n21WPkIUjBJmN3wtOfTHuGOP34Xl8Or0+rrcvu7fh4df78HRYbzbr18fNbrU8rnfb9ur7x2LAj4/Hwzi2l4aL/W1qvzyM2+PwsD1tNovhz3Jzmn7pbb/cTnlcHtresBjG7XPLBr6sN2NvH4vP6TA/Soph0nQeTzfMcwg3zLNUzGeam5f5+cqlOFAl8FkQ/SLEb95BEFKcgyAc54w0bwifT0OrnwLx9UfBuVwcRZ47iqvPhc4J361GjXgbocytht69GhR+YDmI7l6P74/jygXR/7kgIuf3kWRuQSjdvyL5J1ak3L8i+QdW5PrzcdOSZJwMqbd84l3O3/KJK4r5SOHO+Vv+fuTzfAz3zSe6Zb4y5lXvmk8h3jCfJGE+5vvm09fP2N/tp+VqffjyHWGQ9g+9GOK0TdM2T9sybeu01WlLwYIs2MLmyQAygYwgM8gQMoVNYVPYFDaFTWFT2BQ2hU1hU8QUMUWa0s66NKXd7iVaJItsUSyqhU4RgwVZsIUpsR9Lu13F5Jk9i2f1VMsUPMmTPcXTvZT6d5mW2bN4Vk+1zMGTPNlTPKOne7l7ffWKZ/VUyxI8yZM9xTN6Jk/3invFveJeda+6V92r7lX3qnvVvepeda+6p91ri6jda99ClD3FM3omz+xZPKunWlIIKITCKIISURJKRikoFQUyQSbIBJkgE+R+SXDspcupl4JSUdRLvzisEAqjCEpESSiQGTJDZsgCWSALZIEskAWyQBbIAlkgR8gRcoQcIUfI/Wri3EuXSy8FpaKol35JWSEURhGUiJJQICfICXKCnCFnyBlyhpwhZ8gZcoacIWfIBXKBXCAXyAXydK3VXrqsvRSUiqJepgtuKoTCKIISURIK5Aq5Qq6QFbJCVsgKWSErZIWskBWyuswhoBAKowhKREn9ueCj39oO6+XTZvRn2JfTdnXxSHv8u8cePPTuD7vV+Hw6jP3WNu1rN7t/", "file_map": { "39": { "source": "use crate::convert::AsPrimitive;\n\n// docs:start:add-trait\npub trait Add {\n fn add(self, other: Self) -> Self;\n}\n// docs:end:add-trait\n\nimpl Add for Field {\n fn add(self, other: Field) -> Field {\n self + other\n }\n}\n\nimpl Add for u128 {\n fn add(self, other: u128) -> u128 {\n self + other\n }\n}\nimpl Add for u64 {\n fn add(self, other: u64) -> u64 {\n self + other\n }\n}\nimpl Add for u32 {\n fn add(self, other: u32) -> u32 {\n self + other\n }\n}\nimpl Add for u16 {\n fn add(self, other: u16) -> u16 {\n self + other\n }\n}\nimpl Add for u8 {\n fn add(self, other: u8) -> u8 {\n self + other\n }\n}\nimpl Add for u1 {\n fn add(self, other: u1) -> u1 {\n self + other\n }\n}\n\nimpl Add for i8 {\n fn add(self, other: i8) -> i8 {\n self + other\n }\n}\nimpl Add for i16 {\n fn add(self, other: i16) -> i16 {\n self + other\n }\n}\nimpl Add for i32 {\n fn add(self, other: i32) -> i32 {\n self + other\n }\n}\nimpl Add for i64 {\n fn add(self, other: i64) -> i64 {\n self + other\n }\n}\n\n// docs:start:sub-trait\npub trait Sub {\n fn sub(self, other: Self) -> Self;\n}\n// docs:end:sub-trait\n\nimpl Sub for Field {\n fn sub(self, other: Field) -> Field {\n self - other\n }\n}\n\nimpl Sub for u128 {\n fn sub(self, other: u128) -> u128 {\n self - other\n }\n}\nimpl Sub for u64 {\n fn sub(self, other: u64) -> u64 {\n self - other\n }\n}\nimpl Sub for u32 {\n fn sub(self, other: u32) -> u32 {\n self - other\n }\n}\nimpl Sub for u16 {\n fn sub(self, other: u16) -> u16 {\n self - other\n }\n}\nimpl Sub for u8 {\n fn sub(self, other: u8) -> u8 {\n self - other\n }\n}\nimpl Sub for u1 {\n fn sub(self, other: u1) -> u1 {\n self - other\n }\n}\n\nimpl Sub for i8 {\n fn sub(self, other: i8) -> i8 {\n self - other\n }\n}\nimpl Sub for i16 {\n fn sub(self, other: i16) -> i16 {\n self - other\n }\n}\nimpl Sub for i32 {\n fn sub(self, other: i32) -> i32 {\n self - other\n }\n}\nimpl Sub for i64 {\n fn sub(self, other: i64) -> i64 {\n self - other\n }\n}\n\n// docs:start:mul-trait\npub trait Mul {\n fn mul(self, other: Self) -> Self;\n}\n// docs:end:mul-trait\n\nimpl Mul for Field {\n fn mul(self, other: Field) -> Field {\n self * other\n }\n}\n\nimpl Mul for u128 {\n fn mul(self, other: u128) -> u128 {\n self * other\n }\n}\nimpl Mul for u64 {\n fn mul(self, other: u64) -> u64 {\n self * other\n }\n}\nimpl Mul for u32 {\n fn mul(self, other: u32) -> u32 {\n self * other\n }\n}\nimpl Mul for u16 {\n fn mul(self, other: u16) -> u16 {\n self * other\n }\n}\nimpl Mul for u8 {\n fn mul(self, other: u8) -> u8 {\n self * other\n }\n}\nimpl Mul for u1 {\n fn mul(self, other: u1) -> u1 {\n self * other\n }\n}\n\nimpl Mul for i8 {\n fn mul(self, other: i8) -> i8 {\n self * other\n }\n}\nimpl Mul for i16 {\n fn mul(self, other: i16) -> i16 {\n self * other\n }\n}\nimpl Mul for i32 {\n fn mul(self, other: i32) -> i32 {\n self * other\n }\n}\nimpl Mul for i64 {\n fn mul(self, other: i64) -> i64 {\n self * other\n }\n}\n\n// docs:start:div-trait\npub trait Div {\n fn div(self, other: Self) -> Self;\n}\n// docs:end:div-trait\n\nimpl Div for Field {\n fn div(self, other: Field) -> Field {\n self / other\n }\n}\n\nimpl Div for u128 {\n fn div(self, other: u128) -> u128 {\n self / other\n }\n}\nimpl Div for u64 {\n fn div(self, other: u64) -> u64 {\n self / other\n }\n}\nimpl Div for u32 {\n fn div(self, other: u32) -> u32 {\n self / other\n }\n}\nimpl Div for u16 {\n fn div(self, other: u16) -> u16 {\n self / other\n }\n}\nimpl Div for u8 {\n fn div(self, other: u8) -> u8 {\n self / other\n }\n}\nimpl Div for u1 {\n fn div(self, other: u1) -> u1 {\n self / other\n }\n}\n\nimpl Div for i8 {\n fn div(self, other: i8) -> i8 {\n self / other\n }\n}\nimpl Div for i16 {\n fn div(self, other: i16) -> i16 {\n self / other\n }\n}\nimpl Div for i32 {\n fn div(self, other: i32) -> i32 {\n self / other\n }\n}\nimpl Div for i64 {\n fn div(self, other: i64) -> i64 {\n self / other\n }\n}\n\n// docs:start:rem-trait\npub trait Rem {\n fn rem(self, other: Self) -> Self;\n}\n// docs:end:rem-trait\n\nimpl Rem for u128 {\n fn rem(self, other: u128) -> u128 {\n self % other\n }\n}\nimpl Rem for u64 {\n fn rem(self, other: u64) -> u64 {\n self % other\n }\n}\nimpl Rem for u32 {\n fn rem(self, other: u32) -> u32 {\n self % other\n }\n}\nimpl Rem for u16 {\n fn rem(self, other: u16) -> u16 {\n self % other\n }\n}\nimpl Rem for u8 {\n fn rem(self, other: u8) -> u8 {\n self % other\n }\n}\nimpl Rem for u1 {\n fn rem(self, other: u1) -> u1 {\n self % other\n }\n}\n\nimpl Rem for i8 {\n fn rem(self, other: i8) -> i8 {\n self % other\n }\n}\nimpl Rem for i16 {\n fn rem(self, other: i16) -> i16 {\n self % other\n }\n}\nimpl Rem for i32 {\n fn rem(self, other: i32) -> i32 {\n self % other\n }\n}\nimpl Rem for i64 {\n fn rem(self, other: i64) -> i64 {\n self % other\n }\n}\n\n// docs:start:neg-trait\npub trait Neg {\n fn neg(self) -> Self;\n}\n// docs:end:neg-trait\n\n// docs:start:neg-trait-impls\nimpl Neg for Field {\n fn neg(self) -> Field {\n -self\n }\n}\n\nimpl Neg for i8 {\n fn neg(self) -> i8 {\n -self\n }\n}\nimpl Neg for i16 {\n fn neg(self) -> i16 {\n -self\n }\n}\nimpl Neg for i32 {\n fn neg(self) -> i32 {\n -self\n }\n}\nimpl Neg for i64 {\n fn neg(self) -> i64 {\n -self\n }\n}\n// docs:end:neg-trait-impls\n\n// docs:start:wrapping-add-trait\npub trait WrappingAdd {\n fn wrapping_add(self, y: Self) -> Self;\n}\n// docs:end:wrapping-add-trait\n\nimpl WrappingAdd for u1 {\n fn wrapping_add(self: u1, y: u1) -> u1 {\n self ^ y\n }\n}\n\nimpl WrappingAdd for u8 {\n fn wrapping_add(self: u8, y: u8) -> u8 {\n wrapping_add_hlp(self, y)\n }\n}\n\nimpl WrappingAdd for u16 {\n fn wrapping_add(self: u16, y: u16) -> u16 {\n wrapping_add_hlp(self, y)\n }\n}\n\nimpl WrappingAdd for u32 {\n fn wrapping_add(self: u32, y: u32) -> u32 {\n wrapping_add_hlp(self, y)\n }\n}\n\nimpl WrappingAdd for u64 {\n fn wrapping_add(self: u64, y: u64) -> u64 {\n wrapping_add_hlp(self, y)\n }\n}\n\nimpl WrappingAdd for u128 {\n fn wrapping_add(self: u128, y: u128) -> u128 {\n wrapping_add_hlp(self, y)\n }\n}\n\nimpl WrappingAdd for i8 {\n fn wrapping_add(self: i8, y: i8) -> i8 {\n wrapping_add_hlp(self, y)\n }\n}\n\nimpl WrappingAdd for i16 {\n fn wrapping_add(self: i16, y: i16) -> i16 {\n wrapping_add_hlp(self, y)\n }\n}\n\nimpl WrappingAdd for i32 {\n fn wrapping_add(self: i32, y: i32) -> i32 {\n wrapping_add_hlp(self, y)\n }\n}\n\nimpl WrappingAdd for i64 {\n fn wrapping_add(self: i64, y: i64) -> i64 {\n wrapping_add_hlp(self, y)\n }\n}\nimpl WrappingAdd for Field {\n fn wrapping_add(self: Field, y: Field) -> Field {\n self + y\n }\n}\n\n// docs:start:wrapping-sub-trait\npub trait WrappingSub {\n fn wrapping_sub(self, y: Self) -> Self;\n}\n// docs:start:wrapping-sub-trait\n\nimpl WrappingSub for u1 {\n fn wrapping_sub(self: u1, y: u1) -> u1 {\n self ^ y\n }\n}\n\nimpl WrappingSub for u8 {\n fn wrapping_sub(self: u8, y: u8) -> u8 {\n wrapping_sub_hlp(self, y) as u8\n }\n}\n\nimpl WrappingSub for u16 {\n fn wrapping_sub(self: u16, y: u16) -> u16 {\n wrapping_sub_hlp(self, y) as u16\n }\n}\n\nimpl WrappingSub for u32 {\n fn wrapping_sub(self: u32, y: u32) -> u32 {\n wrapping_sub_hlp(self, y) as u32\n }\n}\nimpl WrappingSub for u64 {\n fn wrapping_sub(self: u64, y: u64) -> u64 {\n wrapping_sub_hlp(self, y) as u64\n }\n}\nimpl WrappingSub for u128 {\n fn wrapping_sub(self: u128, y: u128) -> u128 {\n wrapping_sub_hlp(self, y) as u128\n }\n}\n\nimpl WrappingSub for i8 {\n fn wrapping_sub(self: i8, y: i8) -> i8 {\n wrapping_sub_hlp(self, y) as i8\n }\n}\n\nimpl WrappingSub for i16 {\n fn wrapping_sub(self: i16, y: i16) -> i16 {\n wrapping_sub_hlp(self, y) as i16\n }\n}\n\nimpl WrappingSub for i32 {\n fn wrapping_sub(self: i32, y: i32) -> i32 {\n wrapping_sub_hlp(self, y) as i32\n }\n}\nimpl WrappingSub for i64 {\n fn wrapping_sub(self: i64, y: i64) -> i64 {\n wrapping_sub_hlp(self, y) as i64\n }\n}\nimpl WrappingSub for Field {\n fn wrapping_sub(self: Field, y: Field) -> Field {\n self - y\n }\n}\n\n// docs:start:wrapping-mul-trait\npub trait WrappingMul {\n fn wrapping_mul(self, y: Self) -> Self;\n}\n// docs:start:wrapping-mul-trait\n\nimpl WrappingMul for u1 {\n fn wrapping_mul(self: u1, y: u1) -> u1 {\n self & y\n }\n}\n\nimpl WrappingMul for u8 {\n fn wrapping_mul(self: u8, y: u8) -> u8 {\n wrapping_mul_hlp(self, y)\n }\n}\n\nimpl WrappingMul for u16 {\n fn wrapping_mul(self: u16, y: u16) -> u16 {\n wrapping_mul_hlp(self, y)\n }\n}\n\nimpl WrappingMul for u32 {\n fn wrapping_mul(self: u32, y: u32) -> u32 {\n wrapping_mul_hlp(self, y)\n }\n}\nimpl WrappingMul for u64 {\n fn wrapping_mul(self: u64, y: u64) -> u64 {\n wrapping_mul_hlp(self, y)\n }\n}\n\nimpl WrappingMul for i8 {\n fn wrapping_mul(self: i8, y: i8) -> i8 {\n wrapping_mul_hlp(self, y)\n }\n}\n\nimpl WrappingMul for i16 {\n fn wrapping_mul(self: i16, y: i16) -> i16 {\n wrapping_mul_hlp(self, y)\n }\n}\n\nimpl WrappingMul for i32 {\n fn wrapping_mul(self: i32, y: i32) -> i32 {\n wrapping_mul_hlp(self, y)\n }\n}\n\nimpl WrappingMul for i64 {\n fn wrapping_mul(self: i64, y: i64) -> i64 {\n wrapping_mul_hlp(self, y)\n }\n}\n\nimpl WrappingMul for u128 {\n fn wrapping_mul(self: u128, y: u128) -> u128 {\n wrapping_mul128_hlp(self, y)\n }\n}\nimpl WrappingMul for Field {\n fn wrapping_mul(self: Field, y: Field) -> Field {\n self * y\n }\n}\n\nfn wrapping_add_hlp(x: T, y: T) -> T\nwhere\n T: AsPrimitive,\n Field: AsPrimitive,\n{\n AsPrimitive::as_(x.as_() + y.as_())\n}\n\nfn wrapping_sub_hlp(x: T, y: T) -> Field\nwhere\n T: AsPrimitive,\n{\n //340282366920938463463374607431768211456 is 2^128, it is used to avoid underflow\n x.as_() + 340282366920938463463374607431768211456 - y.as_()\n}\n\nfn wrapping_mul_hlp(x: T, y: T) -> T\nwhere\n T: AsPrimitive,\n Field: AsPrimitive,\n{\n AsPrimitive::as_(x.as_() * y.as_())\n}\n\nglobal two_pow_64: u128 = 0x10000000000000000;\n/// Splits a 128 bits number into two 64 bits limbs\nunconstrained fn split64(x: u128) -> (u64, u64) {\n let lo = x as u64;\n let hi = (x / two_pow_64) as u64;\n (lo, hi)\n}\n\n/// Split a 128 bits number into two 64 bits limbs\n/// It will fail if the number is more than 128 bits\nfn split_into_64_bit_limbs(x: u128) -> (u64, u64) {\n // Safety: the limbs are constrained below\n let (x_lo, x_hi) = unsafe { split64(x) };\n assert(x as Field == x_lo as Field + x_hi as Field * two_pow_64 as Field);\n (x_lo, x_hi)\n}\n\n#[field(bn254)]\nfn wrapping_mul128_hlp(x: u128, y: u128) -> u128 {\n let (x_lo, x_hi) = split_into_64_bit_limbs(x);\n let (y_lo, y_hi) = split_into_64_bit_limbs(y);\n // Multiplication using the limbs:(x_lo + 2**64*x_hi)*(y_lo + 2**64*y_hi)=x_lo*y_lo+...\n // and skipping the terms over 2**128\n // Working with u64 limbs ensures that we cannot overflow the field modulus.\n let low = x_lo as Field * y_lo as Field;\n let lo = low as u64 as Field;\n let carry = (low - lo) / two_pow_64 as Field;\n let high = x_lo as Field * y_hi as Field + x_hi as Field * y_lo as Field + carry;\n let hi = high as u64 as Field;\n (lo + two_pow_64 as Field * hi) as u128\n}\n", diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/signed_division/execute__tests__force_brillig_true_inliner_-9223372036854775808.snap b/tooling/nargo_cli/tests/snapshots/execution_success/signed_division/execute__tests__force_brillig_true_inliner_-9223372036854775808.snap index 9ff8a59e2cb..e1bdc12f85e 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/signed_division/execute__tests__force_brillig_true_inliner_-9223372036854775808.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/signed_division/execute__tests__force_brillig_true_inliner_-9223372036854775808.snap @@ -57,10 +57,10 @@ expression: artifact "unconstrained func 0", "[Const { destination: Direct(2), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(1), bit_size: Integer(U32), value: 32839 }, Const { destination: Direct(0), bit_size: Integer(U32), value: 3 }, Const { destination: Relative(4), bit_size: Integer(U32), value: 3 }, Const { destination: Relative(5), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(32836), size_address: Relative(4), offset_address: Relative(5) }, Cast { destination: Direct(32836), source: Direct(32836), bit_size: Integer(U32) }, Cast { destination: Direct(32837), source: Direct(32837), bit_size: Integer(U32) }, Cast { destination: Direct(32838), source: Direct(32838), bit_size: Integer(U32) }, Mov { destination: Relative(1), source: Direct(32836) }, Mov { destination: Relative(2), source: Direct(32837) }, Mov { destination: Relative(3), source: Direct(32838) }, Call { location: 17 }, Call { location: 18 }, Const { destination: Relative(1), bit_size: Integer(U32), value: 32839 }, Const { destination: Relative(2), bit_size: Integer(U32), value: 0 }, Stop { return_data: HeapVector { pointer: Relative(1), size: Relative(2) } }, Return, Call { location: 194 }, Const { destination: Relative(10), bit_size: Integer(U32), value: 2147483647 }, BinaryIntOp { destination: Relative(5), op: LessThan, bit_size: U32, lhs: Relative(10), rhs: Relative(1) }, Const { destination: Relative(11), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(12), op: Sub, bit_size: U32, lhs: Relative(11), rhs: Relative(1) }, JumpIf { condition: Relative(5), location: 25 }, Jump { location: 27 }, Mov { destination: Relative(6), source: Relative(12) }, Jump { location: 29 }, Mov { destination: Relative(6), source: Relative(1) }, Jump { location: 29 }, Const { destination: Relative(10), bit_size: Integer(U32), value: 2147483647 }, BinaryIntOp { destination: Relative(7), op: LessThan, bit_size: U32, lhs: Relative(10), rhs: Relative(2) }, Const { destination: Relative(11), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(12), op: Sub, bit_size: U32, lhs: Relative(11), rhs: Relative(2) }, JumpIf { condition: Relative(7), location: 35 }, Jump { location: 37 }, Mov { destination: Relative(8), source: Relative(12) }, Jump { location: 39 }, Mov { destination: Relative(8), source: Relative(2) }, Jump { location: 39 }, BinaryIntOp { destination: Relative(4), op: Div, bit_size: U32, lhs: Relative(6), rhs: Relative(8) }, BinaryIntOp { destination: Relative(9), op: Xor, bit_size: U1, lhs: Relative(5), rhs: Relative(7) }, JumpIf { condition: Relative(9), location: 43 }, Jump { location: 45 }, Const { destination: Relative(10), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(4), op: Sub, bit_size: U32, lhs: Relative(10), rhs: Relative(4) }, BinaryIntOp { destination: Relative(5), op: Equals, bit_size: U32, lhs: Relative(4), rhs: Relative(3) }, JumpIf { condition: Relative(5), location: 49 }, Const { destination: Relative(6), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(6) } }, Cast { destination: Relative(4), source: Relative(1), bit_size: Field }, Const { destination: Relative(5), bit_size: Field, value: 340282366920938463463374607431768211456 }, BinaryFieldOp { destination: Relative(6), op: Sub, lhs: Relative(5), rhs: Relative(4) }, Cast { destination: Relative(7), source: Relative(6), bit_size: Integer(U32) }, Cast { destination: Relative(4), source: Relative(7), bit_size: Field }, Cast { destination: Relative(6), source: Relative(4), bit_size: Integer(U32) }, Cast { destination: Relative(7), source: Relative(3), bit_size: Field }, BinaryFieldOp { destination: Relative(8), op: Sub, lhs: Relative(5), rhs: Relative(7) }, Cast { destination: Relative(9), source: Relative(8), bit_size: Integer(U32) }, Cast { destination: Relative(7), source: Relative(9), bit_size: Field }, Cast { destination: Relative(8), source: Relative(7), bit_size: Integer(U32) }, Cast { destination: Relative(9), source: Relative(2), bit_size: Field }, BinaryFieldOp { destination: Relative(10), op: Sub, lhs: Relative(5), rhs: Relative(9) }, Cast { destination: Relative(9), source: Relative(10), bit_size: Integer(U32) }, Cast { destination: Relative(5), source: Relative(9), bit_size: Field }, Cast { destination: Relative(9), source: Relative(5), bit_size: Integer(U32) }, BinaryIntOp { destination: Relative(5), op: Add, bit_size: U32, lhs: Relative(1), rhs: Relative(6) }, Mov { destination: Relative(10), source: Relative(5) }, Cast { destination: Relative(5), source: Relative(10), bit_size: Integer(U32) }, Cast { destination: Relative(11), source: Relative(1), bit_size: Integer(U32) }, Cast { destination: Relative(12), source: Relative(4), bit_size: Integer(U32) }, Const { destination: Relative(4), bit_size: Integer(U32), value: 2147483648 }, BinaryIntOp { destination: Relative(13), op: LessThan, bit_size: U32, lhs: Relative(11), rhs: Relative(4) }, BinaryIntOp { destination: Relative(11), op: LessThan, bit_size: U32, lhs: Relative(12), rhs: Relative(4) }, BinaryIntOp { destination: Relative(12), op: Equals, bit_size: U1, lhs: Relative(13), rhs: Relative(11) }, BinaryIntOp { destination: Relative(11), op: LessThan, bit_size: U32, lhs: Relative(5), rhs: Relative(4) }, BinaryIntOp { destination: Relative(5), op: Equals, bit_size: U1, lhs: Relative(11), rhs: Relative(13) }, BinaryIntOp { destination: Relative(11), op: Mul, bit_size: U1, lhs: Relative(5), rhs: Relative(12) }, BinaryIntOp { destination: Relative(5), op: Equals, bit_size: U1, lhs: Relative(11), rhs: Relative(12) }, JumpIf { condition: Relative(5), location: 80 }, Call { location: 200 }, Const { destination: Relative(5), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(11), op: Equals, bit_size: U32, lhs: Relative(10), rhs: Relative(5) }, JumpIf { condition: Relative(11), location: 85 }, Const { destination: Relative(12), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(12) } }, BinaryIntOp { destination: Relative(10), op: Add, bit_size: U32, lhs: Relative(3), rhs: Relative(8) }, Mov { destination: Relative(11), source: Relative(10) }, Cast { destination: Relative(10), source: Relative(11), bit_size: Integer(U32) }, Cast { destination: Relative(12), source: Relative(3), bit_size: Integer(U32) }, Cast { destination: Relative(13), source: Relative(7), bit_size: Integer(U32) }, BinaryIntOp { destination: Relative(7), op: LessThan, bit_size: U32, lhs: Relative(12), rhs: Relative(4) }, BinaryIntOp { destination: Relative(12), op: LessThan, bit_size: U32, lhs: Relative(13), rhs: Relative(4) }, BinaryIntOp { destination: Relative(13), op: Equals, bit_size: U1, lhs: Relative(7), rhs: Relative(12) }, BinaryIntOp { destination: Relative(12), op: LessThan, bit_size: U32, lhs: Relative(10), rhs: Relative(4) }, BinaryIntOp { destination: Relative(4), op: Equals, bit_size: U1, lhs: Relative(12), rhs: Relative(7) }, BinaryIntOp { destination: Relative(7), op: Mul, bit_size: U1, lhs: Relative(4), rhs: Relative(13) }, BinaryIntOp { destination: Relative(4), op: Equals, bit_size: U1, lhs: Relative(7), rhs: Relative(13) }, JumpIf { condition: Relative(4), location: 99 }, Call { location: 200 }, BinaryIntOp { destination: Relative(4), op: Equals, bit_size: U32, lhs: Relative(11), rhs: Relative(5) }, JumpIf { condition: Relative(4), location: 103 }, Const { destination: Relative(7), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(7) } }, Const { destination: Relative(13), bit_size: Integer(U32), value: 2147483647 }, BinaryIntOp { destination: Relative(5), op: LessThan, bit_size: U32, lhs: Relative(13), rhs: Relative(6) }, Const { destination: Relative(14), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(15), op: Sub, bit_size: U32, lhs: Relative(14), rhs: Relative(6) }, JumpIf { condition: Relative(5), location: 109 }, Jump { location: 111 }, Mov { destination: Relative(7), source: Relative(15) }, Jump { location: 113 }, Mov { destination: Relative(7), source: Relative(6) }, Jump { location: 113 }, Const { destination: Relative(13), bit_size: Integer(U32), value: 2147483647 }, BinaryIntOp { destination: Relative(10), op: LessThan, bit_size: U32, lhs: Relative(13), rhs: Relative(2) }, Const { destination: Relative(14), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(15), op: Sub, bit_size: U32, lhs: Relative(14), rhs: Relative(2) }, JumpIf { condition: Relative(10), location: 119 }, Jump { location: 121 }, Mov { destination: Relative(11), source: Relative(15) }, Jump { location: 123 }, Mov { destination: Relative(11), source: Relative(2) }, Jump { location: 123 }, BinaryIntOp { destination: Relative(4), op: Div, bit_size: U32, lhs: Relative(7), rhs: Relative(11) }, BinaryIntOp { destination: Relative(12), op: Xor, bit_size: U1, lhs: Relative(5), rhs: Relative(10) }, JumpIf { condition: Relative(12), location: 127 }, Jump { location: 129 }, Const { destination: Relative(13), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(4), op: Sub, bit_size: U32, lhs: Relative(13), rhs: Relative(4) }, BinaryIntOp { destination: Relative(2), op: Equals, bit_size: U32, lhs: Relative(4), rhs: Relative(8) }, JumpIf { condition: Relative(2), location: 133 }, Const { destination: Relative(5), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(5) } }, Const { destination: Relative(12), bit_size: Integer(U32), value: 2147483647 }, BinaryIntOp { destination: Relative(4), op: LessThan, bit_size: U32, lhs: Relative(12), rhs: Relative(6) }, Const { destination: Relative(13), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(14), op: Sub, bit_size: U32, lhs: Relative(13), rhs: Relative(6) }, JumpIf { condition: Relative(4), location: 139 }, Jump { location: 141 }, Mov { destination: Relative(5), source: Relative(14) }, Jump { location: 143 }, Mov { destination: Relative(5), source: Relative(6) }, Jump { location: 143 }, Const { destination: Relative(12), bit_size: Integer(U32), value: 2147483647 }, BinaryIntOp { destination: Relative(7), op: LessThan, bit_size: U32, lhs: Relative(12), rhs: Relative(9) }, Const { destination: Relative(13), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(14), op: Sub, bit_size: U32, lhs: Relative(13), rhs: Relative(9) }, JumpIf { condition: Relative(7), location: 149 }, Jump { location: 151 }, Mov { destination: Relative(10), source: Relative(14) }, Jump { location: 153 }, Mov { destination: Relative(10), source: Relative(9) }, Jump { location: 153 }, BinaryIntOp { destination: Relative(2), op: Div, bit_size: U32, lhs: Relative(5), rhs: Relative(10) }, BinaryIntOp { destination: Relative(11), op: Xor, bit_size: U1, lhs: Relative(4), rhs: Relative(7) }, JumpIf { condition: Relative(11), location: 157 }, Jump { location: 159 }, Const { destination: Relative(12), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(2), op: Sub, bit_size: U32, lhs: Relative(12), rhs: Relative(2) }, BinaryIntOp { destination: Relative(4), op: Equals, bit_size: U32, lhs: Relative(2), rhs: Relative(3) }, JumpIf { condition: Relative(4), location: 163 }, Const { destination: Relative(5), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(5) } }, Const { destination: Relative(10), bit_size: Integer(U32), value: 2147483647 }, BinaryIntOp { destination: Relative(3), op: LessThan, bit_size: U32, lhs: Relative(10), rhs: Relative(1) }, Const { destination: Relative(11), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(12), op: Sub, bit_size: U32, lhs: Relative(11), rhs: Relative(1) }, JumpIf { condition: Relative(3), location: 169 }, Jump { location: 171 }, Mov { destination: Relative(4), source: Relative(12) }, Jump { location: 173 }, Mov { destination: Relative(4), source: Relative(1) }, Jump { location: 173 }, Const { destination: Relative(10), bit_size: Integer(U32), value: 2147483647 }, BinaryIntOp { destination: Relative(5), op: LessThan, bit_size: U32, lhs: Relative(10), rhs: Relative(9) }, Const { destination: Relative(11), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(12), op: Sub, bit_size: U32, lhs: Relative(11), rhs: Relative(9) }, JumpIf { condition: Relative(5), location: 179 }, Jump { location: 181 }, Mov { destination: Relative(6), source: Relative(12) }, Jump { location: 183 }, Mov { destination: Relative(6), source: Relative(9) }, Jump { location: 183 }, BinaryIntOp { destination: Relative(2), op: Div, bit_size: U32, lhs: Relative(4), rhs: Relative(6) }, BinaryIntOp { destination: Relative(7), op: Xor, bit_size: U1, lhs: Relative(3), rhs: Relative(5) }, JumpIf { condition: Relative(7), location: 187 }, Jump { location: 189 }, Const { destination: Relative(10), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(2), op: Sub, bit_size: U32, lhs: Relative(10), rhs: Relative(2) }, BinaryIntOp { destination: Relative(1), op: Equals, bit_size: U32, lhs: Relative(2), rhs: Relative(8) }, JumpIf { condition: Relative(1), location: 193 }, Const { destination: Relative(3), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(3) } }, Return, Const { destination: Direct(32772), bit_size: Integer(U32), value: 30720 }, BinaryIntOp { destination: Direct(32771), op: LessThan, bit_size: U32, lhs: Direct(0), rhs: Direct(32772) }, JumpIf { condition: Direct(32771), location: 199 }, IndirectConst { destination_pointer: Direct(1), bit_size: Integer(U64), value: 17843811134343075018 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return, IndirectConst { destination_pointer: Direct(1), bit_size: Integer(U64), value: 5019202896831570965 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return]" ], - "debug_symbols": "tZfNbupADIXfJWsWY3t++ypVVdE2rZAQIApXuqp49+vBPi1dpEKkd8N30uAPJ+4M5GN4GZ+Ob4+rzev2fbi7/xie9qv1evX2uN4+Lw+r7Ub/+jGE/kJtuKPFwMFABjaIIRqSIRuKoRrMImYRs4hZxCxiFjGLmEXMImYRs0SzRLNEs0SzRLNEtbAiG4qhGtSSF0NSS1GQQS1VIYZo6L1oRerNiLJ3E5XV2Yy5N6Tvz72jplQZB6U4o7N3pd3l7CzO6mzGEpzkZKc4o9N9xX3FfcV9xX21+/Q6KjnZKc7o7D69zpqdxVmdzdiCk5zsFGd0uq+5r7mvua91n94/CgGBEBihO1MPESEhZISCUBGaBwoIhMAIMBPMBDPBTDATzAQzw8wwM8wMM8PMMDPMDDPD3NcI6z8m9VVigRAYoZtLDxEhIWSEglARmoe+ciwQAiPAHGGOMEeYI8wR5ghzgjnBnGBOMCeYE8wJ5gRzgrmvLdY1RX1xWSAERujm1kNESAgZoSBUhObhvMzOgRAYAeYCc4G5wFxgLjAXmCvMFeYKc4W5wlxhrjBXmCvMfeWJ7iDUl54FQuAeTqfFgM378bAfx753X+zmusfvlvtxcxjuNsf1ejH8Wa6P5ze975abMw/LvZ5V5bh5UarwdbUeezotvqrDdKk258XU0md5uqGeQ7ihnqWiPtNUvUzXVy7FBVUCfxqkfTPEH64gSN//7R4E4TjlSNMOrUIXwunrOoiv74JzuegiT3Vx9b1oU4afplEjLiOUqWm02dOg8AvjIJo9j5/7uHIg7X8ORATLS5JMDYTS/Ink35hImT+R/AsTuf5+3DSSjJsh9ZYd77L+lh1XGuojhZn1t3x+5M/6GObVJ7qlvjLqW5tVn0K8oT5JQn3M8+rT9z32QY+Wz6v9tye6UzftV8un9eiHr8fN88XZw98dzuCJcLffPo8vx/3YTRePhfp6Ty0uqLWH/rNYD/Vbe8GBH0794/8B", + "debug_symbols": "tZddT+pAEIb/S6+52Jn99q8YYxCrIWmAVDjJieG/n1lmXsSLGtJ6bnheLPMw3XFX+9m99i+n9+ft7m3/0T08fnYv43YYtu/Pw36zPm73O/npZ+faC9XugVYdOwUpWOEVQREVSZEVRaEWrxavFq8WrxavFq8WrxavFq8Wr5aglqCWoJaglqCWIBYWJEVWFIVY0qqLYskCUoilCLwiKFovUhFbM17YugnCYqzK1BqSz6fWURWKjJ3QG4OxdSXdpWTMxmKsyuyMZGSjNwaj+bL5svmy+bL5SvPJfRQystEbg7H55D5LMmZjMVZldUYystEbg9F81XzVfNV8tflk/cg5BEJghOaMLQSEiJAQMkJBqBbIIRACI8BMMBPMBDPBTDATzAwzw8wwM8wMM8PMMDPMDHPbIyy/mNR2iQZCYIRmzi0EhIiQEDJCQagW2s7RQAiMAHOAOcAcYA4wB5gDzBHmCHOEOcIcYY4wR5gjzBHmtrdY9hS1zaWBEBihmWsLASEiJISMUBCqhcs2uwRCYASYM8wZ5gxzhjnDnGEuMBeYC8wF5gJzgbnAXGAuMLed5+UEobb1NBACt3A+rzoc3s/Hse/b2X1zmssZf1iP/e7YPexOw7Dq/qyH0+VDH4f17sLjepSroux3r0IRvm2HvqXz6qvaTZdKc1ZMNV7L44x6dm5GPfuC+kRT9X66vnDOJije8dXg6zdD+OEOnG/nv66B8xymHHHa4fm6DBK/DMT3d8Ep33SRprq4ey3qlOGnaZSA23B5ahp18TTI/cI4iBbP4+c+7hxI/Z8D8f56H9FPDYTi8omk35hIXj6R9AsTuX89Zo0kYTF8mXPi3dbPOXF9RX0gt7B+zvcHvtYHt6w+0pz6wqivdVF9dGFGffQR9SEtq4/fz9gnebfebMdvT3TnZhq365eht7dvp93m5urx7wFX8ER4GPeb/vU09s1081gor49Uw4pqfWr/Fstb+au9YsdP5/b1/wA=", "file_map": { "12": { - "source": "// docs:start:from-trait\npub trait From {\n fn from(input: T) -> Self;\n}\n// docs:end:from-trait\n\nimpl From for T {\n fn from(input: T) -> T {\n input\n }\n}\n\n// docs:start:into-trait\npub trait Into {\n fn into(self) -> T;\n}\n\nimpl Into for U\nwhere\n T: From,\n{\n fn into(self) -> T {\n T::from(self)\n }\n}\n// docs:end:into-trait\n\n// docs:start:from-impls\n// Unsigned integers\n\nimpl From for u32 {\n fn from(value: u8) -> u32 {\n value as u32\n }\n}\n\nimpl From for u64 {\n fn from(value: u8) -> u64 {\n value as u64\n }\n}\nimpl From for u64 {\n fn from(value: u32) -> u64 {\n value as u64\n }\n}\n\nimpl From for u128 {\n fn from(value: u8) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u32) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u64) -> u128 {\n value as u128\n }\n}\n\nimpl From for Field {\n fn from(value: u8) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u32) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u64) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u128) -> Field {\n value as Field\n }\n}\n\n// Signed integers\n\nimpl From for i32 {\n fn from(value: i8) -> i32 {\n value as i32\n }\n}\n\nimpl From for i64 {\n fn from(value: i8) -> i64 {\n value as i64\n }\n}\nimpl From for i64 {\n fn from(value: i32) -> i64 {\n value as i64\n }\n}\n\n// Booleans\nimpl From for u8 {\n fn from(value: bool) -> u8 {\n value as u8\n }\n}\nimpl From for u32 {\n fn from(value: bool) -> u32 {\n value as u32\n }\n}\nimpl From for u64 {\n fn from(value: bool) -> u64 {\n value as u64\n }\n}\nimpl From for i8 {\n fn from(value: bool) -> i8 {\n value as i8\n }\n}\nimpl From for i32 {\n fn from(value: bool) -> i32 {\n value as i32\n }\n}\nimpl From for i64 {\n fn from(value: bool) -> i64 {\n value as i64\n }\n}\nimpl From for Field {\n fn from(value: bool) -> Field {\n value as Field\n }\n}\n// docs:end:from-impls\n\n/// A generic interface for casting between primitive types,\n/// equivalent of using the `as` keyword between values.\n///\n/// # Example\n///\n/// ```\n/// let x: Field = 1234567890;\n/// let y: u8 = x as u8;\n/// let z: u8 = x.as_();\n/// assert_eq(y, z);\n/// ```\npub trait AsPrimitive {\n /// The equivalent of doing `self as T`.\n fn as_(self) -> T;\n}\n\n#[generate_as_primitive_impls]\ncomptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted {\n let types = [\n quote { bool },\n quote { u8 },\n quote { u16 },\n quote { u32 },\n quote { u64 },\n quote { u128 },\n quote { i8 },\n quote { i16 },\n quote { i32 },\n quote { i64 },\n quote { Field },\n ];\n\n let mut impls = &[];\n for type1 in types {\n for type2 in types {\n let trait_impl = quote {\n impl AsPrimitive<$type1> for $type2 {\n fn as_(self) -> $type1 {\n self as $type1\n }\n }\n };\n\n impls = impls.push_back(trait_impl);\n }\n }\n impls.join(quote {})\n}\n", + "source": "// docs:start:from-trait\npub trait From {\n fn from(input: T) -> Self;\n}\n// docs:end:from-trait\n\nimpl From for T {\n fn from(input: T) -> T {\n input\n }\n}\n\n// docs:start:into-trait\npub trait Into {\n fn into(self) -> T;\n}\n\nimpl Into for U\nwhere\n T: From,\n{\n fn into(self) -> T {\n T::from(self)\n }\n}\n// docs:end:into-trait\n\n// docs:start:from-impls\n// Unsigned integers\n\nimpl From for u32 {\n fn from(value: u8) -> u32 {\n value as u32\n }\n}\n\nimpl From for u64 {\n fn from(value: u8) -> u64 {\n value as u64\n }\n}\nimpl From for u64 {\n fn from(value: u32) -> u64 {\n value as u64\n }\n}\n\nimpl From for u128 {\n fn from(value: u8) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u32) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u64) -> u128 {\n value as u128\n }\n}\n\nimpl From for Field {\n fn from(value: u8) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u32) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u64) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u128) -> Field {\n value as Field\n }\n}\n\n// Signed integers\n\nimpl From for i32 {\n fn from(value: i8) -> i32 {\n value as i32\n }\n}\n\nimpl From for i64 {\n fn from(value: i8) -> i64 {\n value as i64\n }\n}\nimpl From for i64 {\n fn from(value: i32) -> i64 {\n value as i64\n }\n}\n\n// Booleans\nimpl From for u8 {\n fn from(value: bool) -> u8 {\n value as u8\n }\n}\nimpl From for u32 {\n fn from(value: bool) -> u32 {\n value as u32\n }\n}\nimpl From for u64 {\n fn from(value: bool) -> u64 {\n value as u64\n }\n}\nimpl From for i8 {\n fn from(value: bool) -> i8 {\n value as i8\n }\n}\nimpl From for i32 {\n fn from(value: bool) -> i32 {\n value as i32\n }\n}\nimpl From for i64 {\n fn from(value: bool) -> i64 {\n value as i64\n }\n}\nimpl From for Field {\n fn from(value: bool) -> Field {\n value as Field\n }\n}\n// docs:end:from-impls\n\n/// A generic interface for casting between primitive types,\n/// equivalent of using the `as` keyword between values.\n///\n/// # Example\n///\n/// ```\n/// let x: Field = 1234567890;\n/// let y: u8 = x as u8;\n/// let z: u8 = x.as_();\n/// assert_eq(y, z);\n/// ```\npub trait AsPrimitive {\n /// The equivalent of doing `self as T`.\n fn as_(self) -> T;\n}\n\n#[generate_as_primitive_impls]\ncomptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted {\n let types = [\n quote { bool },\n quote { u8 },\n quote { u16 },\n quote { u32 },\n quote { u64 },\n quote { u128 },\n quote { i8 },\n quote { i16 },\n quote { i32 },\n quote { i64 },\n quote { Field },\n ];\n\n let mut impls = &[];\n for type1 in types {\n for type2 in types {\n let body = if type1 == type2 {\n quote { self }\n } else if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for $type2 {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n }\n impls.join(quote {})\n}\n", "path": "std/convert.nr" }, "39": { diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/signed_division/execute__tests__force_brillig_true_inliner_0.snap b/tooling/nargo_cli/tests/snapshots/execution_success/signed_division/execute__tests__force_brillig_true_inliner_0.snap index 9ff8a59e2cb..e1bdc12f85e 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/signed_division/execute__tests__force_brillig_true_inliner_0.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/signed_division/execute__tests__force_brillig_true_inliner_0.snap @@ -57,10 +57,10 @@ expression: artifact "unconstrained func 0", "[Const { destination: Direct(2), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(1), bit_size: Integer(U32), value: 32839 }, Const { destination: Direct(0), bit_size: Integer(U32), value: 3 }, Const { destination: Relative(4), bit_size: Integer(U32), value: 3 }, Const { destination: Relative(5), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(32836), size_address: Relative(4), offset_address: Relative(5) }, Cast { destination: Direct(32836), source: Direct(32836), bit_size: Integer(U32) }, Cast { destination: Direct(32837), source: Direct(32837), bit_size: Integer(U32) }, Cast { destination: Direct(32838), source: Direct(32838), bit_size: Integer(U32) }, Mov { destination: Relative(1), source: Direct(32836) }, Mov { destination: Relative(2), source: Direct(32837) }, Mov { destination: Relative(3), source: Direct(32838) }, Call { location: 17 }, Call { location: 18 }, Const { destination: Relative(1), bit_size: Integer(U32), value: 32839 }, Const { destination: Relative(2), bit_size: Integer(U32), value: 0 }, Stop { return_data: HeapVector { pointer: Relative(1), size: Relative(2) } }, Return, Call { location: 194 }, Const { destination: Relative(10), bit_size: Integer(U32), value: 2147483647 }, BinaryIntOp { destination: Relative(5), op: LessThan, bit_size: U32, lhs: Relative(10), rhs: Relative(1) }, Const { destination: Relative(11), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(12), op: Sub, bit_size: U32, lhs: Relative(11), rhs: Relative(1) }, JumpIf { condition: Relative(5), location: 25 }, Jump { location: 27 }, Mov { destination: Relative(6), source: Relative(12) }, Jump { location: 29 }, Mov { destination: Relative(6), source: Relative(1) }, Jump { location: 29 }, Const { destination: Relative(10), bit_size: Integer(U32), value: 2147483647 }, BinaryIntOp { destination: Relative(7), op: LessThan, bit_size: U32, lhs: Relative(10), rhs: Relative(2) }, Const { destination: Relative(11), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(12), op: Sub, bit_size: U32, lhs: Relative(11), rhs: Relative(2) }, JumpIf { condition: Relative(7), location: 35 }, Jump { location: 37 }, Mov { destination: Relative(8), source: Relative(12) }, Jump { location: 39 }, Mov { destination: Relative(8), source: Relative(2) }, Jump { location: 39 }, BinaryIntOp { destination: Relative(4), op: Div, bit_size: U32, lhs: Relative(6), rhs: Relative(8) }, BinaryIntOp { destination: Relative(9), op: Xor, bit_size: U1, lhs: Relative(5), rhs: Relative(7) }, JumpIf { condition: Relative(9), location: 43 }, Jump { location: 45 }, Const { destination: Relative(10), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(4), op: Sub, bit_size: U32, lhs: Relative(10), rhs: Relative(4) }, BinaryIntOp { destination: Relative(5), op: Equals, bit_size: U32, lhs: Relative(4), rhs: Relative(3) }, JumpIf { condition: Relative(5), location: 49 }, Const { destination: Relative(6), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(6) } }, Cast { destination: Relative(4), source: Relative(1), bit_size: Field }, Const { destination: Relative(5), bit_size: Field, value: 340282366920938463463374607431768211456 }, BinaryFieldOp { destination: Relative(6), op: Sub, lhs: Relative(5), rhs: Relative(4) }, Cast { destination: Relative(7), source: Relative(6), bit_size: Integer(U32) }, Cast { destination: Relative(4), source: Relative(7), bit_size: Field }, Cast { destination: Relative(6), source: Relative(4), bit_size: Integer(U32) }, Cast { destination: Relative(7), source: Relative(3), bit_size: Field }, BinaryFieldOp { destination: Relative(8), op: Sub, lhs: Relative(5), rhs: Relative(7) }, Cast { destination: Relative(9), source: Relative(8), bit_size: Integer(U32) }, Cast { destination: Relative(7), source: Relative(9), bit_size: Field }, Cast { destination: Relative(8), source: Relative(7), bit_size: Integer(U32) }, Cast { destination: Relative(9), source: Relative(2), bit_size: Field }, BinaryFieldOp { destination: Relative(10), op: Sub, lhs: Relative(5), rhs: Relative(9) }, Cast { destination: Relative(9), source: Relative(10), bit_size: Integer(U32) }, Cast { destination: Relative(5), source: Relative(9), bit_size: Field }, Cast { destination: Relative(9), source: Relative(5), bit_size: Integer(U32) }, BinaryIntOp { destination: Relative(5), op: Add, bit_size: U32, lhs: Relative(1), rhs: Relative(6) }, Mov { destination: Relative(10), source: Relative(5) }, Cast { destination: Relative(5), source: Relative(10), bit_size: Integer(U32) }, Cast { destination: Relative(11), source: Relative(1), bit_size: Integer(U32) }, Cast { destination: Relative(12), source: Relative(4), bit_size: Integer(U32) }, Const { destination: Relative(4), bit_size: Integer(U32), value: 2147483648 }, BinaryIntOp { destination: Relative(13), op: LessThan, bit_size: U32, lhs: Relative(11), rhs: Relative(4) }, BinaryIntOp { destination: Relative(11), op: LessThan, bit_size: U32, lhs: Relative(12), rhs: Relative(4) }, BinaryIntOp { destination: Relative(12), op: Equals, bit_size: U1, lhs: Relative(13), rhs: Relative(11) }, BinaryIntOp { destination: Relative(11), op: LessThan, bit_size: U32, lhs: Relative(5), rhs: Relative(4) }, BinaryIntOp { destination: Relative(5), op: Equals, bit_size: U1, lhs: Relative(11), rhs: Relative(13) }, BinaryIntOp { destination: Relative(11), op: Mul, bit_size: U1, lhs: Relative(5), rhs: Relative(12) }, BinaryIntOp { destination: Relative(5), op: Equals, bit_size: U1, lhs: Relative(11), rhs: Relative(12) }, JumpIf { condition: Relative(5), location: 80 }, Call { location: 200 }, Const { destination: Relative(5), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(11), op: Equals, bit_size: U32, lhs: Relative(10), rhs: Relative(5) }, JumpIf { condition: Relative(11), location: 85 }, Const { destination: Relative(12), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(12) } }, BinaryIntOp { destination: Relative(10), op: Add, bit_size: U32, lhs: Relative(3), rhs: Relative(8) }, Mov { destination: Relative(11), source: Relative(10) }, Cast { destination: Relative(10), source: Relative(11), bit_size: Integer(U32) }, Cast { destination: Relative(12), source: Relative(3), bit_size: Integer(U32) }, Cast { destination: Relative(13), source: Relative(7), bit_size: Integer(U32) }, BinaryIntOp { destination: Relative(7), op: LessThan, bit_size: U32, lhs: Relative(12), rhs: Relative(4) }, BinaryIntOp { destination: Relative(12), op: LessThan, bit_size: U32, lhs: Relative(13), rhs: Relative(4) }, BinaryIntOp { destination: Relative(13), op: Equals, bit_size: U1, lhs: Relative(7), rhs: Relative(12) }, BinaryIntOp { destination: Relative(12), op: LessThan, bit_size: U32, lhs: Relative(10), rhs: Relative(4) }, BinaryIntOp { destination: Relative(4), op: Equals, bit_size: U1, lhs: Relative(12), rhs: Relative(7) }, BinaryIntOp { destination: Relative(7), op: Mul, bit_size: U1, lhs: Relative(4), rhs: Relative(13) }, BinaryIntOp { destination: Relative(4), op: Equals, bit_size: U1, lhs: Relative(7), rhs: Relative(13) }, JumpIf { condition: Relative(4), location: 99 }, Call { location: 200 }, BinaryIntOp { destination: Relative(4), op: Equals, bit_size: U32, lhs: Relative(11), rhs: Relative(5) }, JumpIf { condition: Relative(4), location: 103 }, Const { destination: Relative(7), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(7) } }, Const { destination: Relative(13), bit_size: Integer(U32), value: 2147483647 }, BinaryIntOp { destination: Relative(5), op: LessThan, bit_size: U32, lhs: Relative(13), rhs: Relative(6) }, Const { destination: Relative(14), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(15), op: Sub, bit_size: U32, lhs: Relative(14), rhs: Relative(6) }, JumpIf { condition: Relative(5), location: 109 }, Jump { location: 111 }, Mov { destination: Relative(7), source: Relative(15) }, Jump { location: 113 }, Mov { destination: Relative(7), source: Relative(6) }, Jump { location: 113 }, Const { destination: Relative(13), bit_size: Integer(U32), value: 2147483647 }, BinaryIntOp { destination: Relative(10), op: LessThan, bit_size: U32, lhs: Relative(13), rhs: Relative(2) }, Const { destination: Relative(14), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(15), op: Sub, bit_size: U32, lhs: Relative(14), rhs: Relative(2) }, JumpIf { condition: Relative(10), location: 119 }, Jump { location: 121 }, Mov { destination: Relative(11), source: Relative(15) }, Jump { location: 123 }, Mov { destination: Relative(11), source: Relative(2) }, Jump { location: 123 }, BinaryIntOp { destination: Relative(4), op: Div, bit_size: U32, lhs: Relative(7), rhs: Relative(11) }, BinaryIntOp { destination: Relative(12), op: Xor, bit_size: U1, lhs: Relative(5), rhs: Relative(10) }, JumpIf { condition: Relative(12), location: 127 }, Jump { location: 129 }, Const { destination: Relative(13), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(4), op: Sub, bit_size: U32, lhs: Relative(13), rhs: Relative(4) }, BinaryIntOp { destination: Relative(2), op: Equals, bit_size: U32, lhs: Relative(4), rhs: Relative(8) }, JumpIf { condition: Relative(2), location: 133 }, Const { destination: Relative(5), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(5) } }, Const { destination: Relative(12), bit_size: Integer(U32), value: 2147483647 }, BinaryIntOp { destination: Relative(4), op: LessThan, bit_size: U32, lhs: Relative(12), rhs: Relative(6) }, Const { destination: Relative(13), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(14), op: Sub, bit_size: U32, lhs: Relative(13), rhs: Relative(6) }, JumpIf { condition: Relative(4), location: 139 }, Jump { location: 141 }, Mov { destination: Relative(5), source: Relative(14) }, Jump { location: 143 }, Mov { destination: Relative(5), source: Relative(6) }, Jump { location: 143 }, Const { destination: Relative(12), bit_size: Integer(U32), value: 2147483647 }, BinaryIntOp { destination: Relative(7), op: LessThan, bit_size: U32, lhs: Relative(12), rhs: Relative(9) }, Const { destination: Relative(13), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(14), op: Sub, bit_size: U32, lhs: Relative(13), rhs: Relative(9) }, JumpIf { condition: Relative(7), location: 149 }, Jump { location: 151 }, Mov { destination: Relative(10), source: Relative(14) }, Jump { location: 153 }, Mov { destination: Relative(10), source: Relative(9) }, Jump { location: 153 }, BinaryIntOp { destination: Relative(2), op: Div, bit_size: U32, lhs: Relative(5), rhs: Relative(10) }, BinaryIntOp { destination: Relative(11), op: Xor, bit_size: U1, lhs: Relative(4), rhs: Relative(7) }, JumpIf { condition: Relative(11), location: 157 }, Jump { location: 159 }, Const { destination: Relative(12), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(2), op: Sub, bit_size: U32, lhs: Relative(12), rhs: Relative(2) }, BinaryIntOp { destination: Relative(4), op: Equals, bit_size: U32, lhs: Relative(2), rhs: Relative(3) }, JumpIf { condition: Relative(4), location: 163 }, Const { destination: Relative(5), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(5) } }, Const { destination: Relative(10), bit_size: Integer(U32), value: 2147483647 }, BinaryIntOp { destination: Relative(3), op: LessThan, bit_size: U32, lhs: Relative(10), rhs: Relative(1) }, Const { destination: Relative(11), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(12), op: Sub, bit_size: U32, lhs: Relative(11), rhs: Relative(1) }, JumpIf { condition: Relative(3), location: 169 }, Jump { location: 171 }, Mov { destination: Relative(4), source: Relative(12) }, Jump { location: 173 }, Mov { destination: Relative(4), source: Relative(1) }, Jump { location: 173 }, Const { destination: Relative(10), bit_size: Integer(U32), value: 2147483647 }, BinaryIntOp { destination: Relative(5), op: LessThan, bit_size: U32, lhs: Relative(10), rhs: Relative(9) }, Const { destination: Relative(11), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(12), op: Sub, bit_size: U32, lhs: Relative(11), rhs: Relative(9) }, JumpIf { condition: Relative(5), location: 179 }, Jump { location: 181 }, Mov { destination: Relative(6), source: Relative(12) }, Jump { location: 183 }, Mov { destination: Relative(6), source: Relative(9) }, Jump { location: 183 }, BinaryIntOp { destination: Relative(2), op: Div, bit_size: U32, lhs: Relative(4), rhs: Relative(6) }, BinaryIntOp { destination: Relative(7), op: Xor, bit_size: U1, lhs: Relative(3), rhs: Relative(5) }, JumpIf { condition: Relative(7), location: 187 }, Jump { location: 189 }, Const { destination: Relative(10), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(2), op: Sub, bit_size: U32, lhs: Relative(10), rhs: Relative(2) }, BinaryIntOp { destination: Relative(1), op: Equals, bit_size: U32, lhs: Relative(2), rhs: Relative(8) }, JumpIf { condition: Relative(1), location: 193 }, Const { destination: Relative(3), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(3) } }, Return, Const { destination: Direct(32772), bit_size: Integer(U32), value: 30720 }, BinaryIntOp { destination: Direct(32771), op: LessThan, bit_size: U32, lhs: Direct(0), rhs: Direct(32772) }, JumpIf { condition: Direct(32771), location: 199 }, IndirectConst { destination_pointer: Direct(1), bit_size: Integer(U64), value: 17843811134343075018 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return, IndirectConst { destination_pointer: Direct(1), bit_size: Integer(U64), value: 5019202896831570965 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return]" ], - "debug_symbols": "tZfNbupADIXfJWsWY3t++ypVVdE2rZAQIApXuqp49+vBPi1dpEKkd8N30uAPJ+4M5GN4GZ+Ob4+rzev2fbi7/xie9qv1evX2uN4+Lw+r7Ub/+jGE/kJtuKPFwMFABjaIIRqSIRuKoRrMImYRs4hZxCxiFjGLmEXMImYRs0SzRLNEs0SzRLNEtbAiG4qhGtSSF0NSS1GQQS1VIYZo6L1oRerNiLJ3E5XV2Yy5N6Tvz72jplQZB6U4o7N3pd3l7CzO6mzGEpzkZKc4o9N9xX3FfcV9xX21+/Q6KjnZKc7o7D69zpqdxVmdzdiCk5zsFGd0uq+5r7mvua91n94/CgGBEBihO1MPESEhZISCUBGaBwoIhMAIMBPMBDPBTDATzAQzw8wwM8wMM8PMMDPMDDPD3NcI6z8m9VVigRAYoZtLDxEhIWSEglARmoe+ciwQAiPAHGGOMEeYI8wR5ghzgjnBnGBOMCeYE8wJ5gRzgrmvLdY1RX1xWSAERujm1kNESAgZoSBUhObhvMzOgRAYAeYCc4G5wFxgLjAXmCvMFeYKc4W5wlxhrjBXmCvMfeWJ7iDUl54FQuAeTqfFgM378bAfx753X+zmusfvlvtxcxjuNsf1ejH8Wa6P5ze975abMw/LvZ5V5bh5UarwdbUeezotvqrDdKk258XU0md5uqGeQ7ihnqWiPtNUvUzXVy7FBVUCfxqkfTPEH64gSN//7R4E4TjlSNMOrUIXwunrOoiv74JzuegiT3Vx9b1oU4afplEjLiOUqWm02dOg8AvjIJo9j5/7uHIg7X8ORATLS5JMDYTS/Ink35hImT+R/AsTuf5+3DSSjJsh9ZYd77L+lh1XGuojhZn1t3x+5M/6GObVJ7qlvjLqW5tVn0K8oT5JQn3M8+rT9z32QY+Wz6v9tye6UzftV8un9eiHr8fN88XZw98dzuCJcLffPo8vx/3YTRePhfp6Ty0uqLWH/rNYD/Vbe8GBH0794/8B", + "debug_symbols": "tZddT+pAEIb/S6+52Jn99q8YYxCrIWmAVDjJieG/n1lmXsSLGtJ6bnheLPMw3XFX+9m99i+n9+ft7m3/0T08fnYv43YYtu/Pw36zPm73O/npZ+faC9XugVYdOwUpWOEVQREVSZEVRaEWrxavFq8WrxavFq8WrxavFq8Wr5aglqCWoJaglqCWIBYWJEVWFIVY0qqLYskCUoilCLwiKFovUhFbM17YugnCYqzK1BqSz6fWURWKjJ3QG4OxdSXdpWTMxmKsyuyMZGSjNwaj+bL5svmy+bL5SvPJfRQystEbg7H55D5LMmZjMVZldUYystEbg9F81XzVfNV8tflk/cg5BEJghOaMLQSEiJAQMkJBqBbIIRACI8BMMBPMBDPBTDATzAwzw8wwM8wMM8PMMDPMDHPbIyy/mNR2iQZCYIRmzi0EhIiQEDJCQagW2s7RQAiMAHOAOcAcYA4wB5gDzBHmCHOEOcIcYY4wR5gjzBHmtrdY9hS1zaWBEBihmWsLASEiJISMUBCqhcs2uwRCYASYM8wZ5gxzhjnDnGEuMBeYC8wF5gJzgbnAXGAuMLed5+UEobb1NBACt3A+rzoc3s/Hse/b2X1zmssZf1iP/e7YPexOw7Dq/qyH0+VDH4f17sLjepSroux3r0IRvm2HvqXz6qvaTZdKc1ZMNV7L44x6dm5GPfuC+kRT9X66vnDOJije8dXg6zdD+OEOnG/nv66B8xymHHHa4fm6DBK/DMT3d8Ep33SRprq4ey3qlOGnaZSA23B5ahp18TTI/cI4iBbP4+c+7hxI/Z8D8f56H9FPDYTi8omk35hIXj6R9AsTuX89Zo0kYTF8mXPi3dbPOXF9RX0gt7B+zvcHvtYHt6w+0pz6wqivdVF9dGFGffQR9SEtq4/fz9gnebfebMdvT3TnZhq365eht7dvp93m5urx7wFX8ER4GPeb/vU09s1081gor49Uw4pqfWr/Fstb+au9YsdP5/b1/wA=", "file_map": { "12": { - "source": "// docs:start:from-trait\npub trait From {\n fn from(input: T) -> Self;\n}\n// docs:end:from-trait\n\nimpl From for T {\n fn from(input: T) -> T {\n input\n }\n}\n\n// docs:start:into-trait\npub trait Into {\n fn into(self) -> T;\n}\n\nimpl Into for U\nwhere\n T: From,\n{\n fn into(self) -> T {\n T::from(self)\n }\n}\n// docs:end:into-trait\n\n// docs:start:from-impls\n// Unsigned integers\n\nimpl From for u32 {\n fn from(value: u8) -> u32 {\n value as u32\n }\n}\n\nimpl From for u64 {\n fn from(value: u8) -> u64 {\n value as u64\n }\n}\nimpl From for u64 {\n fn from(value: u32) -> u64 {\n value as u64\n }\n}\n\nimpl From for u128 {\n fn from(value: u8) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u32) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u64) -> u128 {\n value as u128\n }\n}\n\nimpl From for Field {\n fn from(value: u8) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u32) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u64) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u128) -> Field {\n value as Field\n }\n}\n\n// Signed integers\n\nimpl From for i32 {\n fn from(value: i8) -> i32 {\n value as i32\n }\n}\n\nimpl From for i64 {\n fn from(value: i8) -> i64 {\n value as i64\n }\n}\nimpl From for i64 {\n fn from(value: i32) -> i64 {\n value as i64\n }\n}\n\n// Booleans\nimpl From for u8 {\n fn from(value: bool) -> u8 {\n value as u8\n }\n}\nimpl From for u32 {\n fn from(value: bool) -> u32 {\n value as u32\n }\n}\nimpl From for u64 {\n fn from(value: bool) -> u64 {\n value as u64\n }\n}\nimpl From for i8 {\n fn from(value: bool) -> i8 {\n value as i8\n }\n}\nimpl From for i32 {\n fn from(value: bool) -> i32 {\n value as i32\n }\n}\nimpl From for i64 {\n fn from(value: bool) -> i64 {\n value as i64\n }\n}\nimpl From for Field {\n fn from(value: bool) -> Field {\n value as Field\n }\n}\n// docs:end:from-impls\n\n/// A generic interface for casting between primitive types,\n/// equivalent of using the `as` keyword between values.\n///\n/// # Example\n///\n/// ```\n/// let x: Field = 1234567890;\n/// let y: u8 = x as u8;\n/// let z: u8 = x.as_();\n/// assert_eq(y, z);\n/// ```\npub trait AsPrimitive {\n /// The equivalent of doing `self as T`.\n fn as_(self) -> T;\n}\n\n#[generate_as_primitive_impls]\ncomptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted {\n let types = [\n quote { bool },\n quote { u8 },\n quote { u16 },\n quote { u32 },\n quote { u64 },\n quote { u128 },\n quote { i8 },\n quote { i16 },\n quote { i32 },\n quote { i64 },\n quote { Field },\n ];\n\n let mut impls = &[];\n for type1 in types {\n for type2 in types {\n let trait_impl = quote {\n impl AsPrimitive<$type1> for $type2 {\n fn as_(self) -> $type1 {\n self as $type1\n }\n }\n };\n\n impls = impls.push_back(trait_impl);\n }\n }\n impls.join(quote {})\n}\n", + "source": "// docs:start:from-trait\npub trait From {\n fn from(input: T) -> Self;\n}\n// docs:end:from-trait\n\nimpl From for T {\n fn from(input: T) -> T {\n input\n }\n}\n\n// docs:start:into-trait\npub trait Into {\n fn into(self) -> T;\n}\n\nimpl Into for U\nwhere\n T: From,\n{\n fn into(self) -> T {\n T::from(self)\n }\n}\n// docs:end:into-trait\n\n// docs:start:from-impls\n// Unsigned integers\n\nimpl From for u32 {\n fn from(value: u8) -> u32 {\n value as u32\n }\n}\n\nimpl From for u64 {\n fn from(value: u8) -> u64 {\n value as u64\n }\n}\nimpl From for u64 {\n fn from(value: u32) -> u64 {\n value as u64\n }\n}\n\nimpl From for u128 {\n fn from(value: u8) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u32) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u64) -> u128 {\n value as u128\n }\n}\n\nimpl From for Field {\n fn from(value: u8) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u32) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u64) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u128) -> Field {\n value as Field\n }\n}\n\n// Signed integers\n\nimpl From for i32 {\n fn from(value: i8) -> i32 {\n value as i32\n }\n}\n\nimpl From for i64 {\n fn from(value: i8) -> i64 {\n value as i64\n }\n}\nimpl From for i64 {\n fn from(value: i32) -> i64 {\n value as i64\n }\n}\n\n// Booleans\nimpl From for u8 {\n fn from(value: bool) -> u8 {\n value as u8\n }\n}\nimpl From for u32 {\n fn from(value: bool) -> u32 {\n value as u32\n }\n}\nimpl From for u64 {\n fn from(value: bool) -> u64 {\n value as u64\n }\n}\nimpl From for i8 {\n fn from(value: bool) -> i8 {\n value as i8\n }\n}\nimpl From for i32 {\n fn from(value: bool) -> i32 {\n value as i32\n }\n}\nimpl From for i64 {\n fn from(value: bool) -> i64 {\n value as i64\n }\n}\nimpl From for Field {\n fn from(value: bool) -> Field {\n value as Field\n }\n}\n// docs:end:from-impls\n\n/// A generic interface for casting between primitive types,\n/// equivalent of using the `as` keyword between values.\n///\n/// # Example\n///\n/// ```\n/// let x: Field = 1234567890;\n/// let y: u8 = x as u8;\n/// let z: u8 = x.as_();\n/// assert_eq(y, z);\n/// ```\npub trait AsPrimitive {\n /// The equivalent of doing `self as T`.\n fn as_(self) -> T;\n}\n\n#[generate_as_primitive_impls]\ncomptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted {\n let types = [\n quote { bool },\n quote { u8 },\n quote { u16 },\n quote { u32 },\n quote { u64 },\n quote { u128 },\n quote { i8 },\n quote { i16 },\n quote { i32 },\n quote { i64 },\n quote { Field },\n ];\n\n let mut impls = &[];\n for type1 in types {\n for type2 in types {\n let body = if type1 == type2 {\n quote { self }\n } else if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for $type2 {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n }\n impls.join(quote {})\n}\n", "path": "std/convert.nr" }, "39": { diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/signed_division/execute__tests__force_brillig_true_inliner_9223372036854775807.snap b/tooling/nargo_cli/tests/snapshots/execution_success/signed_division/execute__tests__force_brillig_true_inliner_9223372036854775807.snap index 9ff8a59e2cb..e1bdc12f85e 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/signed_division/execute__tests__force_brillig_true_inliner_9223372036854775807.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/signed_division/execute__tests__force_brillig_true_inliner_9223372036854775807.snap @@ -57,10 +57,10 @@ expression: artifact "unconstrained func 0", "[Const { destination: Direct(2), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(1), bit_size: Integer(U32), value: 32839 }, Const { destination: Direct(0), bit_size: Integer(U32), value: 3 }, Const { destination: Relative(4), bit_size: Integer(U32), value: 3 }, Const { destination: Relative(5), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(32836), size_address: Relative(4), offset_address: Relative(5) }, Cast { destination: Direct(32836), source: Direct(32836), bit_size: Integer(U32) }, Cast { destination: Direct(32837), source: Direct(32837), bit_size: Integer(U32) }, Cast { destination: Direct(32838), source: Direct(32838), bit_size: Integer(U32) }, Mov { destination: Relative(1), source: Direct(32836) }, Mov { destination: Relative(2), source: Direct(32837) }, Mov { destination: Relative(3), source: Direct(32838) }, Call { location: 17 }, Call { location: 18 }, Const { destination: Relative(1), bit_size: Integer(U32), value: 32839 }, Const { destination: Relative(2), bit_size: Integer(U32), value: 0 }, Stop { return_data: HeapVector { pointer: Relative(1), size: Relative(2) } }, Return, Call { location: 194 }, Const { destination: Relative(10), bit_size: Integer(U32), value: 2147483647 }, BinaryIntOp { destination: Relative(5), op: LessThan, bit_size: U32, lhs: Relative(10), rhs: Relative(1) }, Const { destination: Relative(11), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(12), op: Sub, bit_size: U32, lhs: Relative(11), rhs: Relative(1) }, JumpIf { condition: Relative(5), location: 25 }, Jump { location: 27 }, Mov { destination: Relative(6), source: Relative(12) }, Jump { location: 29 }, Mov { destination: Relative(6), source: Relative(1) }, Jump { location: 29 }, Const { destination: Relative(10), bit_size: Integer(U32), value: 2147483647 }, BinaryIntOp { destination: Relative(7), op: LessThan, bit_size: U32, lhs: Relative(10), rhs: Relative(2) }, Const { destination: Relative(11), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(12), op: Sub, bit_size: U32, lhs: Relative(11), rhs: Relative(2) }, JumpIf { condition: Relative(7), location: 35 }, Jump { location: 37 }, Mov { destination: Relative(8), source: Relative(12) }, Jump { location: 39 }, Mov { destination: Relative(8), source: Relative(2) }, Jump { location: 39 }, BinaryIntOp { destination: Relative(4), op: Div, bit_size: U32, lhs: Relative(6), rhs: Relative(8) }, BinaryIntOp { destination: Relative(9), op: Xor, bit_size: U1, lhs: Relative(5), rhs: Relative(7) }, JumpIf { condition: Relative(9), location: 43 }, Jump { location: 45 }, Const { destination: Relative(10), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(4), op: Sub, bit_size: U32, lhs: Relative(10), rhs: Relative(4) }, BinaryIntOp { destination: Relative(5), op: Equals, bit_size: U32, lhs: Relative(4), rhs: Relative(3) }, JumpIf { condition: Relative(5), location: 49 }, Const { destination: Relative(6), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(6) } }, Cast { destination: Relative(4), source: Relative(1), bit_size: Field }, Const { destination: Relative(5), bit_size: Field, value: 340282366920938463463374607431768211456 }, BinaryFieldOp { destination: Relative(6), op: Sub, lhs: Relative(5), rhs: Relative(4) }, Cast { destination: Relative(7), source: Relative(6), bit_size: Integer(U32) }, Cast { destination: Relative(4), source: Relative(7), bit_size: Field }, Cast { destination: Relative(6), source: Relative(4), bit_size: Integer(U32) }, Cast { destination: Relative(7), source: Relative(3), bit_size: Field }, BinaryFieldOp { destination: Relative(8), op: Sub, lhs: Relative(5), rhs: Relative(7) }, Cast { destination: Relative(9), source: Relative(8), bit_size: Integer(U32) }, Cast { destination: Relative(7), source: Relative(9), bit_size: Field }, Cast { destination: Relative(8), source: Relative(7), bit_size: Integer(U32) }, Cast { destination: Relative(9), source: Relative(2), bit_size: Field }, BinaryFieldOp { destination: Relative(10), op: Sub, lhs: Relative(5), rhs: Relative(9) }, Cast { destination: Relative(9), source: Relative(10), bit_size: Integer(U32) }, Cast { destination: Relative(5), source: Relative(9), bit_size: Field }, Cast { destination: Relative(9), source: Relative(5), bit_size: Integer(U32) }, BinaryIntOp { destination: Relative(5), op: Add, bit_size: U32, lhs: Relative(1), rhs: Relative(6) }, Mov { destination: Relative(10), source: Relative(5) }, Cast { destination: Relative(5), source: Relative(10), bit_size: Integer(U32) }, Cast { destination: Relative(11), source: Relative(1), bit_size: Integer(U32) }, Cast { destination: Relative(12), source: Relative(4), bit_size: Integer(U32) }, Const { destination: Relative(4), bit_size: Integer(U32), value: 2147483648 }, BinaryIntOp { destination: Relative(13), op: LessThan, bit_size: U32, lhs: Relative(11), rhs: Relative(4) }, BinaryIntOp { destination: Relative(11), op: LessThan, bit_size: U32, lhs: Relative(12), rhs: Relative(4) }, BinaryIntOp { destination: Relative(12), op: Equals, bit_size: U1, lhs: Relative(13), rhs: Relative(11) }, BinaryIntOp { destination: Relative(11), op: LessThan, bit_size: U32, lhs: Relative(5), rhs: Relative(4) }, BinaryIntOp { destination: Relative(5), op: Equals, bit_size: U1, lhs: Relative(11), rhs: Relative(13) }, BinaryIntOp { destination: Relative(11), op: Mul, bit_size: U1, lhs: Relative(5), rhs: Relative(12) }, BinaryIntOp { destination: Relative(5), op: Equals, bit_size: U1, lhs: Relative(11), rhs: Relative(12) }, JumpIf { condition: Relative(5), location: 80 }, Call { location: 200 }, Const { destination: Relative(5), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(11), op: Equals, bit_size: U32, lhs: Relative(10), rhs: Relative(5) }, JumpIf { condition: Relative(11), location: 85 }, Const { destination: Relative(12), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(12) } }, BinaryIntOp { destination: Relative(10), op: Add, bit_size: U32, lhs: Relative(3), rhs: Relative(8) }, Mov { destination: Relative(11), source: Relative(10) }, Cast { destination: Relative(10), source: Relative(11), bit_size: Integer(U32) }, Cast { destination: Relative(12), source: Relative(3), bit_size: Integer(U32) }, Cast { destination: Relative(13), source: Relative(7), bit_size: Integer(U32) }, BinaryIntOp { destination: Relative(7), op: LessThan, bit_size: U32, lhs: Relative(12), rhs: Relative(4) }, BinaryIntOp { destination: Relative(12), op: LessThan, bit_size: U32, lhs: Relative(13), rhs: Relative(4) }, BinaryIntOp { destination: Relative(13), op: Equals, bit_size: U1, lhs: Relative(7), rhs: Relative(12) }, BinaryIntOp { destination: Relative(12), op: LessThan, bit_size: U32, lhs: Relative(10), rhs: Relative(4) }, BinaryIntOp { destination: Relative(4), op: Equals, bit_size: U1, lhs: Relative(12), rhs: Relative(7) }, BinaryIntOp { destination: Relative(7), op: Mul, bit_size: U1, lhs: Relative(4), rhs: Relative(13) }, BinaryIntOp { destination: Relative(4), op: Equals, bit_size: U1, lhs: Relative(7), rhs: Relative(13) }, JumpIf { condition: Relative(4), location: 99 }, Call { location: 200 }, BinaryIntOp { destination: Relative(4), op: Equals, bit_size: U32, lhs: Relative(11), rhs: Relative(5) }, JumpIf { condition: Relative(4), location: 103 }, Const { destination: Relative(7), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(7) } }, Const { destination: Relative(13), bit_size: Integer(U32), value: 2147483647 }, BinaryIntOp { destination: Relative(5), op: LessThan, bit_size: U32, lhs: Relative(13), rhs: Relative(6) }, Const { destination: Relative(14), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(15), op: Sub, bit_size: U32, lhs: Relative(14), rhs: Relative(6) }, JumpIf { condition: Relative(5), location: 109 }, Jump { location: 111 }, Mov { destination: Relative(7), source: Relative(15) }, Jump { location: 113 }, Mov { destination: Relative(7), source: Relative(6) }, Jump { location: 113 }, Const { destination: Relative(13), bit_size: Integer(U32), value: 2147483647 }, BinaryIntOp { destination: Relative(10), op: LessThan, bit_size: U32, lhs: Relative(13), rhs: Relative(2) }, Const { destination: Relative(14), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(15), op: Sub, bit_size: U32, lhs: Relative(14), rhs: Relative(2) }, JumpIf { condition: Relative(10), location: 119 }, Jump { location: 121 }, Mov { destination: Relative(11), source: Relative(15) }, Jump { location: 123 }, Mov { destination: Relative(11), source: Relative(2) }, Jump { location: 123 }, BinaryIntOp { destination: Relative(4), op: Div, bit_size: U32, lhs: Relative(7), rhs: Relative(11) }, BinaryIntOp { destination: Relative(12), op: Xor, bit_size: U1, lhs: Relative(5), rhs: Relative(10) }, JumpIf { condition: Relative(12), location: 127 }, Jump { location: 129 }, Const { destination: Relative(13), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(4), op: Sub, bit_size: U32, lhs: Relative(13), rhs: Relative(4) }, BinaryIntOp { destination: Relative(2), op: Equals, bit_size: U32, lhs: Relative(4), rhs: Relative(8) }, JumpIf { condition: Relative(2), location: 133 }, Const { destination: Relative(5), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(5) } }, Const { destination: Relative(12), bit_size: Integer(U32), value: 2147483647 }, BinaryIntOp { destination: Relative(4), op: LessThan, bit_size: U32, lhs: Relative(12), rhs: Relative(6) }, Const { destination: Relative(13), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(14), op: Sub, bit_size: U32, lhs: Relative(13), rhs: Relative(6) }, JumpIf { condition: Relative(4), location: 139 }, Jump { location: 141 }, Mov { destination: Relative(5), source: Relative(14) }, Jump { location: 143 }, Mov { destination: Relative(5), source: Relative(6) }, Jump { location: 143 }, Const { destination: Relative(12), bit_size: Integer(U32), value: 2147483647 }, BinaryIntOp { destination: Relative(7), op: LessThan, bit_size: U32, lhs: Relative(12), rhs: Relative(9) }, Const { destination: Relative(13), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(14), op: Sub, bit_size: U32, lhs: Relative(13), rhs: Relative(9) }, JumpIf { condition: Relative(7), location: 149 }, Jump { location: 151 }, Mov { destination: Relative(10), source: Relative(14) }, Jump { location: 153 }, Mov { destination: Relative(10), source: Relative(9) }, Jump { location: 153 }, BinaryIntOp { destination: Relative(2), op: Div, bit_size: U32, lhs: Relative(5), rhs: Relative(10) }, BinaryIntOp { destination: Relative(11), op: Xor, bit_size: U1, lhs: Relative(4), rhs: Relative(7) }, JumpIf { condition: Relative(11), location: 157 }, Jump { location: 159 }, Const { destination: Relative(12), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(2), op: Sub, bit_size: U32, lhs: Relative(12), rhs: Relative(2) }, BinaryIntOp { destination: Relative(4), op: Equals, bit_size: U32, lhs: Relative(2), rhs: Relative(3) }, JumpIf { condition: Relative(4), location: 163 }, Const { destination: Relative(5), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(5) } }, Const { destination: Relative(10), bit_size: Integer(U32), value: 2147483647 }, BinaryIntOp { destination: Relative(3), op: LessThan, bit_size: U32, lhs: Relative(10), rhs: Relative(1) }, Const { destination: Relative(11), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(12), op: Sub, bit_size: U32, lhs: Relative(11), rhs: Relative(1) }, JumpIf { condition: Relative(3), location: 169 }, Jump { location: 171 }, Mov { destination: Relative(4), source: Relative(12) }, Jump { location: 173 }, Mov { destination: Relative(4), source: Relative(1) }, Jump { location: 173 }, Const { destination: Relative(10), bit_size: Integer(U32), value: 2147483647 }, BinaryIntOp { destination: Relative(5), op: LessThan, bit_size: U32, lhs: Relative(10), rhs: Relative(9) }, Const { destination: Relative(11), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(12), op: Sub, bit_size: U32, lhs: Relative(11), rhs: Relative(9) }, JumpIf { condition: Relative(5), location: 179 }, Jump { location: 181 }, Mov { destination: Relative(6), source: Relative(12) }, Jump { location: 183 }, Mov { destination: Relative(6), source: Relative(9) }, Jump { location: 183 }, BinaryIntOp { destination: Relative(2), op: Div, bit_size: U32, lhs: Relative(4), rhs: Relative(6) }, BinaryIntOp { destination: Relative(7), op: Xor, bit_size: U1, lhs: Relative(3), rhs: Relative(5) }, JumpIf { condition: Relative(7), location: 187 }, Jump { location: 189 }, Const { destination: Relative(10), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(2), op: Sub, bit_size: U32, lhs: Relative(10), rhs: Relative(2) }, BinaryIntOp { destination: Relative(1), op: Equals, bit_size: U32, lhs: Relative(2), rhs: Relative(8) }, JumpIf { condition: Relative(1), location: 193 }, Const { destination: Relative(3), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(3) } }, Return, Const { destination: Direct(32772), bit_size: Integer(U32), value: 30720 }, BinaryIntOp { destination: Direct(32771), op: LessThan, bit_size: U32, lhs: Direct(0), rhs: Direct(32772) }, JumpIf { condition: Direct(32771), location: 199 }, IndirectConst { destination_pointer: Direct(1), bit_size: Integer(U64), value: 17843811134343075018 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return, IndirectConst { destination_pointer: Direct(1), bit_size: Integer(U64), value: 5019202896831570965 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return]" ], - "debug_symbols": "tZfNbupADIXfJWsWY3t++ypVVdE2rZAQIApXuqp49+vBPi1dpEKkd8N30uAPJ+4M5GN4GZ+Ob4+rzev2fbi7/xie9qv1evX2uN4+Lw+r7Ub/+jGE/kJtuKPFwMFABjaIIRqSIRuKoRrMImYRs4hZxCxiFjGLmEXMImYRs0SzRLNEs0SzRLNEtbAiG4qhGtSSF0NSS1GQQS1VIYZo6L1oRerNiLJ3E5XV2Yy5N6Tvz72jplQZB6U4o7N3pd3l7CzO6mzGEpzkZKc4o9N9xX3FfcV9xX21+/Q6KjnZKc7o7D69zpqdxVmdzdiCk5zsFGd0uq+5r7mvua91n94/CgGBEBihO1MPESEhZISCUBGaBwoIhMAIMBPMBDPBTDATzAQzw8wwM8wMM8PMMDPMDDPD3NcI6z8m9VVigRAYoZtLDxEhIWSEglARmoe+ciwQAiPAHGGOMEeYI8wR5ghzgjnBnGBOMCeYE8wJ5gRzgrmvLdY1RX1xWSAERujm1kNESAgZoSBUhObhvMzOgRAYAeYCc4G5wFxgLjAXmCvMFeYKc4W5wlxhrjBXmCvMfeWJ7iDUl54FQuAeTqfFgM378bAfx753X+zmusfvlvtxcxjuNsf1ejH8Wa6P5ze975abMw/LvZ5V5bh5UarwdbUeezotvqrDdKk258XU0md5uqGeQ7ihnqWiPtNUvUzXVy7FBVUCfxqkfTPEH64gSN//7R4E4TjlSNMOrUIXwunrOoiv74JzuegiT3Vx9b1oU4afplEjLiOUqWm02dOg8AvjIJo9j5/7uHIg7X8ORATLS5JMDYTS/Ink35hImT+R/AsTuf5+3DSSjJsh9ZYd77L+lh1XGuojhZn1t3x+5M/6GObVJ7qlvjLqW5tVn0K8oT5JQn3M8+rT9z32QY+Wz6v9tye6UzftV8un9eiHr8fN88XZw98dzuCJcLffPo8vx/3YTRePhfp6Ty0uqLWH/rNYD/Vbe8GBH0794/8B", + "debug_symbols": "tZddT+pAEIb/S6+52Jn99q8YYxCrIWmAVDjJieG/n1lmXsSLGtJ6bnheLPMw3XFX+9m99i+n9+ft7m3/0T08fnYv43YYtu/Pw36zPm73O/npZ+faC9XugVYdOwUpWOEVQREVSZEVRaEWrxavFq8WrxavFq8WrxavFq8Wr5aglqCWoJaglqCWIBYWJEVWFIVY0qqLYskCUoilCLwiKFovUhFbM17YugnCYqzK1BqSz6fWURWKjJ3QG4OxdSXdpWTMxmKsyuyMZGSjNwaj+bL5svmy+bL5SvPJfRQystEbg7H55D5LMmZjMVZldUYystEbg9F81XzVfNV8tflk/cg5BEJghOaMLQSEiJAQMkJBqBbIIRACI8BMMBPMBDPBTDATzAwzw8wwM8wMM8PMMDPMDHPbIyy/mNR2iQZCYIRmzi0EhIiQEDJCQagW2s7RQAiMAHOAOcAcYA4wB5gDzBHmCHOEOcIcYY4wR5gjzBHmtrdY9hS1zaWBEBihmWsLASEiJISMUBCqhcs2uwRCYASYM8wZ5gxzhjnDnGEuMBeYC8wF5gJzgbnAXGAuMLed5+UEobb1NBACt3A+rzoc3s/Hse/b2X1zmssZf1iP/e7YPexOw7Dq/qyH0+VDH4f17sLjepSroux3r0IRvm2HvqXz6qvaTZdKc1ZMNV7L44x6dm5GPfuC+kRT9X66vnDOJije8dXg6zdD+OEOnG/nv66B8xymHHHa4fm6DBK/DMT3d8Ep33SRprq4ey3qlOGnaZSA23B5ahp18TTI/cI4iBbP4+c+7hxI/Z8D8f56H9FPDYTi8omk35hIXj6R9AsTuX89Zo0kYTF8mXPi3dbPOXF9RX0gt7B+zvcHvtYHt6w+0pz6wqivdVF9dGFGffQR9SEtq4/fz9gnebfebMdvT3TnZhq365eht7dvp93m5urx7wFX8ER4GPeb/vU09s1081gor49Uw4pqfWr/Fstb+au9YsdP5/b1/wA=", "file_map": { "12": { - "source": "// docs:start:from-trait\npub trait From {\n fn from(input: T) -> Self;\n}\n// docs:end:from-trait\n\nimpl From for T {\n fn from(input: T) -> T {\n input\n }\n}\n\n// docs:start:into-trait\npub trait Into {\n fn into(self) -> T;\n}\n\nimpl Into for U\nwhere\n T: From,\n{\n fn into(self) -> T {\n T::from(self)\n }\n}\n// docs:end:into-trait\n\n// docs:start:from-impls\n// Unsigned integers\n\nimpl From for u32 {\n fn from(value: u8) -> u32 {\n value as u32\n }\n}\n\nimpl From for u64 {\n fn from(value: u8) -> u64 {\n value as u64\n }\n}\nimpl From for u64 {\n fn from(value: u32) -> u64 {\n value as u64\n }\n}\n\nimpl From for u128 {\n fn from(value: u8) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u32) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u64) -> u128 {\n value as u128\n }\n}\n\nimpl From for Field {\n fn from(value: u8) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u32) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u64) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u128) -> Field {\n value as Field\n }\n}\n\n// Signed integers\n\nimpl From for i32 {\n fn from(value: i8) -> i32 {\n value as i32\n }\n}\n\nimpl From for i64 {\n fn from(value: i8) -> i64 {\n value as i64\n }\n}\nimpl From for i64 {\n fn from(value: i32) -> i64 {\n value as i64\n }\n}\n\n// Booleans\nimpl From for u8 {\n fn from(value: bool) -> u8 {\n value as u8\n }\n}\nimpl From for u32 {\n fn from(value: bool) -> u32 {\n value as u32\n }\n}\nimpl From for u64 {\n fn from(value: bool) -> u64 {\n value as u64\n }\n}\nimpl From for i8 {\n fn from(value: bool) -> i8 {\n value as i8\n }\n}\nimpl From for i32 {\n fn from(value: bool) -> i32 {\n value as i32\n }\n}\nimpl From for i64 {\n fn from(value: bool) -> i64 {\n value as i64\n }\n}\nimpl From for Field {\n fn from(value: bool) -> Field {\n value as Field\n }\n}\n// docs:end:from-impls\n\n/// A generic interface for casting between primitive types,\n/// equivalent of using the `as` keyword between values.\n///\n/// # Example\n///\n/// ```\n/// let x: Field = 1234567890;\n/// let y: u8 = x as u8;\n/// let z: u8 = x.as_();\n/// assert_eq(y, z);\n/// ```\npub trait AsPrimitive {\n /// The equivalent of doing `self as T`.\n fn as_(self) -> T;\n}\n\n#[generate_as_primitive_impls]\ncomptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted {\n let types = [\n quote { bool },\n quote { u8 },\n quote { u16 },\n quote { u32 },\n quote { u64 },\n quote { u128 },\n quote { i8 },\n quote { i16 },\n quote { i32 },\n quote { i64 },\n quote { Field },\n ];\n\n let mut impls = &[];\n for type1 in types {\n for type2 in types {\n let trait_impl = quote {\n impl AsPrimitive<$type1> for $type2 {\n fn as_(self) -> $type1 {\n self as $type1\n }\n }\n };\n\n impls = impls.push_back(trait_impl);\n }\n }\n impls.join(quote {})\n}\n", + "source": "// docs:start:from-trait\npub trait From {\n fn from(input: T) -> Self;\n}\n// docs:end:from-trait\n\nimpl From for T {\n fn from(input: T) -> T {\n input\n }\n}\n\n// docs:start:into-trait\npub trait Into {\n fn into(self) -> T;\n}\n\nimpl Into for U\nwhere\n T: From,\n{\n fn into(self) -> T {\n T::from(self)\n }\n}\n// docs:end:into-trait\n\n// docs:start:from-impls\n// Unsigned integers\n\nimpl From for u32 {\n fn from(value: u8) -> u32 {\n value as u32\n }\n}\n\nimpl From for u64 {\n fn from(value: u8) -> u64 {\n value as u64\n }\n}\nimpl From for u64 {\n fn from(value: u32) -> u64 {\n value as u64\n }\n}\n\nimpl From for u128 {\n fn from(value: u8) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u32) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u64) -> u128 {\n value as u128\n }\n}\n\nimpl From for Field {\n fn from(value: u8) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u32) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u64) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u128) -> Field {\n value as Field\n }\n}\n\n// Signed integers\n\nimpl From for i32 {\n fn from(value: i8) -> i32 {\n value as i32\n }\n}\n\nimpl From for i64 {\n fn from(value: i8) -> i64 {\n value as i64\n }\n}\nimpl From for i64 {\n fn from(value: i32) -> i64 {\n value as i64\n }\n}\n\n// Booleans\nimpl From for u8 {\n fn from(value: bool) -> u8 {\n value as u8\n }\n}\nimpl From for u32 {\n fn from(value: bool) -> u32 {\n value as u32\n }\n}\nimpl From for u64 {\n fn from(value: bool) -> u64 {\n value as u64\n }\n}\nimpl From for i8 {\n fn from(value: bool) -> i8 {\n value as i8\n }\n}\nimpl From for i32 {\n fn from(value: bool) -> i32 {\n value as i32\n }\n}\nimpl From for i64 {\n fn from(value: bool) -> i64 {\n value as i64\n }\n}\nimpl From for Field {\n fn from(value: bool) -> Field {\n value as Field\n }\n}\n// docs:end:from-impls\n\n/// A generic interface for casting between primitive types,\n/// equivalent of using the `as` keyword between values.\n///\n/// # Example\n///\n/// ```\n/// let x: Field = 1234567890;\n/// let y: u8 = x as u8;\n/// let z: u8 = x.as_();\n/// assert_eq(y, z);\n/// ```\npub trait AsPrimitive {\n /// The equivalent of doing `self as T`.\n fn as_(self) -> T;\n}\n\n#[generate_as_primitive_impls]\ncomptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted {\n let types = [\n quote { bool },\n quote { u8 },\n quote { u16 },\n quote { u32 },\n quote { u64 },\n quote { u128 },\n quote { i8 },\n quote { i16 },\n quote { i32 },\n quote { i64 },\n quote { Field },\n ];\n\n let mut impls = &[];\n for type1 in types {\n for type2 in types {\n let body = if type1 == type2 {\n quote { self }\n } else if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for $type2 {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n }\n impls.join(quote {})\n}\n", "path": "std/convert.nr" }, "39": { diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/simple_shield/execute__tests__expanded.snap b/tooling/nargo_cli/tests/snapshots/execution_success/simple_shield/execute__tests__expanded.snap index 56333769e3d..bd4ff217a5f 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/simple_shield/execute__tests__expanded.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/simple_shield/execute__tests__expanded.snap @@ -28,7 +28,7 @@ fn compute_merkle_root(leaf: Field, index: Field, hash_path: [Field; let index_bits: [u1; N] = index.to_le_bits(); let mut current: Field = leaf; for i in 0..N { - let path_bit: bool = index_bits[i] as bool; + let path_bit: bool = index_bits[i] != 0; let (hash_left, hash_right): (Field, Field) = if path_bit { (hash_path[i], current) } else { diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/simple_shield/execute__tests__force_brillig_false_inliner_-9223372036854775808.snap b/tooling/nargo_cli/tests/snapshots/execution_success/simple_shield/execute__tests__force_brillig_false_inliner_-9223372036854775808.snap index 4f0043d2e99..e109217a8d8 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/simple_shield/execute__tests__force_brillig_false_inliner_-9223372036854775808.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/simple_shield/execute__tests__force_brillig_false_inliner_-9223372036854775808.snap @@ -129,7 +129,7 @@ expression: artifact "unconstrained func 1", "[Const { destination: Direct(5), bit_size: Integer(U32), value: 0 }, Const { destination: Direct(6), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(7), bit_size: Integer(U32), value: 3 }, CalldataCopy { destination_address: Direct(0), size_address: Direct(7), offset_address: Direct(5) }, Cast { destination: Direct(1), source: Direct(1), bit_size: Integer(U32) }, Const { destination: Direct(9), bit_size: Integer(U32), value: 10 }, BinaryIntOp { destination: Direct(7), op: Add, bit_size: U32, lhs: Direct(9), rhs: Direct(1) }, BinaryFieldOp { destination: Direct(3), op: IntegerDiv, lhs: Direct(0), rhs: Direct(2) }, BinaryFieldOp { destination: Direct(4), op: Mul, lhs: Direct(3), rhs: Direct(2) }, BinaryFieldOp { destination: Direct(4), op: Sub, lhs: Direct(0), rhs: Direct(4) }, Store { destination_pointer: Direct(9), source: Direct(4) }, BinaryIntOp { destination: Direct(9), op: Add, bit_size: U32, lhs: Direct(9), rhs: Direct(6) }, Mov { destination: Direct(0), source: Direct(3) }, BinaryIntOp { destination: Direct(8), op: LessThan, bit_size: U32, lhs: Direct(9), rhs: Direct(7) }, JumpIf { condition: Direct(8), location: 7 }, Const { destination: Direct(9), bit_size: Integer(U32), value: 10 }, Stop { return_data: HeapVector { pointer: Direct(9), size: Direct(1) } }]" ], - "debug_symbols": "pZjdbusgDMffhetc4A8I9FWmacq6bIoUpVXWTjqa+u7HLJC1OgeEkpu6TuJfwfhvGr7VW/96/XgZpvfTpzo8favXeRjH4eNlPB27y3Ca5Oq30uEDrDpgo6BdjFMHEuPVgRuF8gTfbo1KYS+Xue9D1B1H6Odu7qeLOkzXcWzUVzdefx76PHfTj710s9zVjeqnN7ECfB/GPny7Nb/ROh/qNMZgh3YNh/YhHvLxljnGW0Nb4h2keOc2xafJtzr7+4X58/r7hts13jzmz+TjjQabAPqOALaWwN67lWB8jtAWCManRWDLejeBcoRCHi2kOrKWc3mEAgAspJUAa8zvEPwjolAL8JtJ1JhHYCERoH1KBBjchEBKE2G0fhsCzW4EtDWIYjpdKm3J7KYVQW1SXSEgZBEujyBDKRckVbppFIDtOgpLOQTq3RKrR2zRWItJY63XOY0h7dYY8m6NodmtsSKiTmNlRJXGyogqjZXTWaWxEqJSYwS7NVYcRZ3GiHZrrB6xRWPOJoBHzGmM7G6NUbtbY+R2a6yIqNNYGVGlsTKiSmPldFZprISorG7m3dVdj9hS3aD1mgpts/93uZRN5BWBNisRdkUE/w8Brn4URGlBgIzeNBFeixOYtuXCUHr7ANP67OtD4X8aolu1TvdvYI+VZQpNDx2uG4Az2Q3A8O52UUTUtYsyoqpdlBFV7aKYTr/mAj1sQpDoLO2nALQNwbAiPOxHZHf1QrvwnnLd4lm87jjM/5x7SDVDEKWccYTO1ChaPF48Ezpoo8LRiHjhaESS7RbPLx7oxQWIvoBI1hyERMHnsLhiTfRt9NvQIpeTFvbxqMXHs5ZgIVqMVnhGnkfhGRk2mmhttG2876Lvw2uuTEgv1wmW64TRUrQc70ce2RgXeRR55BfLOlpY7nPkMS1xLLyfPeerm4fudexDqsNiXKdjyry4lz/ndCedSZ3n07F/u859WKW7gyn5fJKegf75FlbyLw==", + "debug_symbols": "pZjdbusgDMffhetc4A8I9FWmacq6bIoUpVXWTjqa+u7HLJC1OgeEkpu6TuJfwfhvGr7VW/96/XgZpvfTpzo8favXeRjH4eNlPB27y3Ca5Oq30uEDrDpgo6BdjFMHEuPVgRuF8gTfbo1KYS+Xue9D1B1H6Odu7qeLOkzXcWzUVzdefx76PHfTj710s9zVjeqnN7ECfB/GPny7Nb/ROh/qNMZgh3YNh/YhHvLxljnGW0Nb4h2keOc2xafJtzr7+4X58/r7hts13jzmz+TjjQabAPqOALaWwN67lWB8jtAWCManRWDLejeBcoRCHi2kOrKWc3mEAgAspJUAa8zvEPwjolAL8JtJ1JhHYCERoH1KBBjchEBKE2G0fhsCzW4EtDWIYjpdKm3J7KYVQW1SXSEgZBEujyBDKRckVbppFIDtOgpLOQTq3RKrR2zRWItJY63XOY0h7dYY8m6NodmtsSKiTmNlRJXGyogqjZXTWaWxEqJSYwS7NVYcRZ3GiHZrrB6xRWPOJoBHzGmM7G6NUbtbY+R2a6yIqNNYGVGlsTKiSmPldFZprISorG7m3dVdj9hS3aD1mgpts/93uZRN5BWBNisRdkUE/w8Brn4URGlBgIzeNBFet1Ng4k0Is5YFmNZmXx8K/9MQ3ap1un8De6wsU2h66HDdAJzJbgCGd7eLIqKuXZQRVe2ijKhqF8V0+jUX6GETgkRnaT8FoG0IhhXhYT8iu6sX2oX3lOsWz+J1x2H+59xDqhmCKOWMI3SmRtHi8eKZ0EEbFY5GxAtHI5Jst3h+8UAvLkD0BUSy5iAkCj6HxRVrom+j34YWuZy0sI9HLT6etQQL0WK0wjPyPArPyLDRRGujbeN9F30fXnNlQnq5TrBcJ4yWouV4P/LIxrjIo8gjv1jW0cJynyOPaYlj4f3sOV/dPHSvYx9SHRbjOh1T5sW9/DmnO+lM6jyfjv3bde7DKt0dTMnnk/QM9M+3sJJ/AQ==", "file_map": { "16": { "source": "use crate::cmp::Eq;\nuse crate::hash::Hash;\nuse crate::ops::arith::{Add, Neg, Sub};\n\n/// A point on the embedded elliptic curve\n/// By definition, the base field of the embedded curve is the scalar field of the proof system curve, i.e the Noir Field.\n/// x and y denotes the Weierstrass coordinates of the point, if is_infinite is false.\npub struct EmbeddedCurvePoint {\n pub x: Field,\n pub y: Field,\n pub is_infinite: bool,\n}\n\nimpl EmbeddedCurvePoint {\n /// Elliptic curve point doubling operation\n /// returns the doubled point of a point P, i.e P+P\n pub fn double(self) -> EmbeddedCurvePoint {\n embedded_curve_add(self, self)\n }\n\n /// Returns the null element of the curve; 'the point at infinity'\n pub fn point_at_infinity() -> EmbeddedCurvePoint {\n EmbeddedCurvePoint { x: 0, y: 0, is_infinite: true }\n }\n\n /// Returns the curve's generator point.\n pub fn generator() -> EmbeddedCurvePoint {\n // Generator point for the grumpkin curve (y^2 = x^3 - 17)\n EmbeddedCurvePoint {\n x: 1,\n y: 17631683881184975370165255887551781615748388533673675138860, // sqrt(-16)\n is_infinite: false,\n }\n }\n}\n\nimpl Add for EmbeddedCurvePoint {\n /// Adds two points P+Q, using the curve addition formula, and also handles point at infinity\n fn add(self, other: EmbeddedCurvePoint) -> EmbeddedCurvePoint {\n embedded_curve_add(self, other)\n }\n}\n\nimpl Sub for EmbeddedCurvePoint {\n /// Points subtraction operation, using addition and negation\n fn sub(self, other: EmbeddedCurvePoint) -> EmbeddedCurvePoint {\n self + other.neg()\n }\n}\n\nimpl Neg for EmbeddedCurvePoint {\n /// Negates a point P, i.e returns -P, by negating the y coordinate.\n /// If the point is at infinity, then the result is also at infinity.\n fn neg(self) -> EmbeddedCurvePoint {\n EmbeddedCurvePoint { x: self.x, y: -self.y, is_infinite: self.is_infinite }\n }\n}\n\nimpl Eq for EmbeddedCurvePoint {\n /// Checks whether two points are equal\n fn eq(self: Self, b: EmbeddedCurvePoint) -> bool {\n (self.is_infinite & b.is_infinite)\n | ((self.is_infinite == b.is_infinite) & (self.x == b.x) & (self.y == b.y))\n }\n}\n\nimpl Hash for EmbeddedCurvePoint {\n fn hash(self, state: &mut H)\n where\n H: crate::hash::Hasher,\n {\n if self.is_infinite {\n self.is_infinite.hash(state);\n } else {\n self.x.hash(state);\n self.y.hash(state);\n }\n }\n}\n\n/// Scalar for the embedded curve represented as low and high limbs\n/// By definition, the scalar field of the embedded curve is base field of the proving system curve.\n/// It may not fit into a Field element, so it is represented with two Field elements; its low and high limbs.\npub struct EmbeddedCurveScalar {\n pub lo: Field,\n pub hi: Field,\n}\n\nimpl EmbeddedCurveScalar {\n pub fn new(lo: Field, hi: Field) -> Self {\n EmbeddedCurveScalar { lo, hi }\n }\n\n #[field(bn254)]\n pub fn from_field(scalar: Field) -> EmbeddedCurveScalar {\n let (a, b) = crate::field::bn254::decompose(scalar);\n EmbeddedCurveScalar { lo: a, hi: b }\n }\n\n //Bytes to scalar: take the first (after the specified offset) 16 bytes of the input as the lo value, and the next 16 bytes as the hi value\n #[field(bn254)]\n pub(crate) fn from_bytes(bytes: [u8; 64], offset: u32) -> EmbeddedCurveScalar {\n let mut v = 1;\n let mut lo = 0 as Field;\n let mut hi = 0 as Field;\n for i in 0..16 {\n lo = lo + (bytes[offset + 31 - i] as Field) * v;\n hi = hi + (bytes[offset + 15 - i] as Field) * v;\n v = v * 256;\n }\n let sig_s = crate::embedded_curve_ops::EmbeddedCurveScalar { lo, hi };\n sig_s\n }\n}\n\nimpl Eq for EmbeddedCurveScalar {\n fn eq(self, other: Self) -> bool {\n (other.hi == self.hi) & (other.lo == self.lo)\n }\n}\n\nimpl Hash for EmbeddedCurveScalar {\n fn hash(self, state: &mut H)\n where\n H: crate::hash::Hasher,\n {\n self.hi.hash(state);\n self.lo.hash(state);\n }\n}\n\n// Computes a multi scalar multiplication over the embedded curve.\n// For bn254, We have Grumpkin and Baby JubJub.\n// For bls12-381, we have JubJub and Bandersnatch.\n//\n// The embedded curve being used is decided by the\n// underlying proof system.\n// docs:start:multi_scalar_mul\npub fn multi_scalar_mul(\n points: [EmbeddedCurvePoint; N],\n scalars: [EmbeddedCurveScalar; N],\n) -> EmbeddedCurvePoint\n// docs:end:multi_scalar_mul\n{\n multi_scalar_mul_array_return(points, scalars)[0]\n}\n\n#[foreign(multi_scalar_mul)]\npub(crate) fn multi_scalar_mul_array_return(\n points: [EmbeddedCurvePoint; N],\n scalars: [EmbeddedCurveScalar; N],\n) -> [EmbeddedCurvePoint; 1] {}\n\n// docs:start:fixed_base_scalar_mul\npub fn fixed_base_scalar_mul(scalar: EmbeddedCurveScalar) -> EmbeddedCurvePoint\n// docs:end:fixed_base_scalar_mul\n{\n multi_scalar_mul([EmbeddedCurvePoint::generator()], [scalar])\n}\n\n/// This function only assumes that the points are on the curve\n/// It handles corner cases around the infinity point causing some overhead compared to embedded_curve_add_not_nul and embedded_curve_add_unsafe\n// docs:start:embedded_curve_add\npub fn embedded_curve_add(\n point1: EmbeddedCurvePoint,\n point2: EmbeddedCurvePoint,\n) -> EmbeddedCurvePoint {\n // docs:end:embedded_curve_add\n if crate::runtime::is_unconstrained() {\n // `embedded_curve_add_unsafe` requires the inputs not to be the infinity point, so we check it here.\n // This is because `embedded_curve_add_unsafe` uses the `embedded_curve_add` opcode.\n // For efficiency, the backend does not check the inputs for the infinity point, but it assumes that they are not the infinity point\n // so that it can apply the ec addition formula directly.\n if point1.is_infinite {\n point2\n } else if point2.is_infinite {\n point1\n } else {\n embedded_curve_add_unsafe(point1, point2)\n }\n } else {\n // In a constrained context, we also need to check the inputs are not the infinity point because we also use `embedded_curve_add_unsafe`\n // However we also need to identify the case where the two inputs are the same, because then\n // the addition formula does not work and we need to use the doubling formula instead.\n // In unconstrained context, we can check directly if the input values are the same when solving the opcode, so it is not an issue.\n\n // x_coordinates_match is true if both abscissae are the same\n let x_coordinates_match = point1.x == point2.x;\n // y_coordinates_match is true if both ordinates are the same\n let y_coordinates_match = point1.y == point2.y;\n // double_predicate is true if both abscissae and ordinates are the same\n let double_predicate = (x_coordinates_match & y_coordinates_match);\n // If the abscissae are the same, but not the ordinates, then one point is the opposite of the other\n let infinity_predicate = (x_coordinates_match & !y_coordinates_match);\n let point1_1 = EmbeddedCurvePoint {\n x: point1.x + (x_coordinates_match as Field),\n y: point1.y,\n is_infinite: false,\n };\n let point2_1 = EmbeddedCurvePoint { x: point2.x, y: point2.y, is_infinite: false };\n // point1_1 is guaranteed to have a different abscissa than point2:\n // - if x_coordinates_match is 0, that means point1.x != point2.x, and point1_1.x = point1.x + 0\n // - if x_coordinates_match is 1, that means point1.x = point2.x, but point1_1.x = point1.x + 1 in this case\n // Because the abscissa is different, the addition formula is guaranteed to succeed, so we can safely use `embedded_curve_add_unsafe`\n // Note that this computation may be garbage: if x_coordinates_match is 1, or if one of the input is the point at infinity.\n let mut result = embedded_curve_add_unsafe(point1_1, point2_1);\n\n // `embedded_curve_add_unsafe` is doing a doubling if the input is the same variable, because in this case it is guaranteed (at 'compile time') that the input is the same.\n let double = embedded_curve_add_unsafe(point1, point1);\n // `embedded_curve_add_unsafe` would not perform doubling, even if the inputs point1 and point2 are the same, because it cannot know this without adding some logic (and some constraints)\n // However we did this logic when we computed `double_predicate`, so we set the result to 2*point1 if point1 and point2 are the same\n result = if double_predicate { double } else { result };\n\n // Same logic as above for unconstrained context, we set the proper result when one of the inputs is the infinity point\n if point1.is_infinite {\n result = point2;\n }\n if point2.is_infinite {\n result = point1;\n }\n\n // Finally, we set the is_infinity flag of the result:\n // Opposite points should sum into the infinity point, however, if one of them is point at infinity, their coordinates are not meaningful\n // so we should not use the fact that the inputs are opposite in this case:\n let mut result_is_infinity =\n infinity_predicate & (!point1.is_infinite & !point2.is_infinite);\n // However, if both of them are at infinity, then the result is also at infinity\n result.is_infinite = result_is_infinity | (point1.is_infinite & point2.is_infinite);\n result\n }\n}\n\n#[foreign(embedded_curve_add)]\nfn embedded_curve_add_array_return(\n _point1: EmbeddedCurvePoint,\n _point2: EmbeddedCurvePoint,\n) -> [EmbeddedCurvePoint; 1] {}\n\n/// This function assumes that:\n/// The points are on the curve, and\n/// The points don't share an x-coordinate, and\n/// Neither point is the infinity point.\n/// If it is used with correct input, the function ensures the correct non-zero result is returned.\n/// Except for points on the curve, the other assumptions are checked by the function. It will cause assertion failure if they are not respected.\npub fn embedded_curve_add_not_nul(\n point1: EmbeddedCurvePoint,\n point2: EmbeddedCurvePoint,\n) -> EmbeddedCurvePoint {\n assert(point1.x != point2.x);\n assert(!point1.is_infinite);\n assert(!point2.is_infinite);\n // Ensure is_infinite is comptime\n let point1_1 = EmbeddedCurvePoint { x: point1.x, y: point1.y, is_infinite: false };\n let point2_1 = EmbeddedCurvePoint { x: point2.x, y: point2.y, is_infinite: false };\n embedded_curve_add_unsafe(point1_1, point2_1)\n}\n\n/// Unsafe ec addition\n/// If the inputs are the same, it will perform a doubling, but only if point1 and point2 are the same variable.\n/// If they have the same value but are different variables, the result will be incorrect because in this case\n/// it assumes (but does not check) that the points' x-coordinates are not equal.\n/// It also assumes neither point is the infinity point.\npub fn embedded_curve_add_unsafe(\n point1: EmbeddedCurvePoint,\n point2: EmbeddedCurvePoint,\n) -> EmbeddedCurvePoint {\n embedded_curve_add_array_return(point1, point2)[0]\n}\n", @@ -148,7 +148,7 @@ expression: artifact "path": "std/hash/mod.nr" }, "50": { - "source": "fn main(\n // Public key of note\n // all notes have the same denomination\n priv_key: Field,\n // Merkle membership proof\n note_root: pub Field,\n index: Field,\n note_hash_path: [Field; 3],\n // Receiver public key\n to_pubkey_x: Field,\n to_pubkey_y: Field,\n) -> pub [Field; 2] {\n let priv_key_as_scalar = std::embedded_curve_ops::EmbeddedCurveScalar { lo: priv_key, hi: 0 };\n // Compute public key from private key to show ownership\n let pubkey = std::embedded_curve_ops::fixed_base_scalar_mul(priv_key_as_scalar);\n // Compute input note commitment\n let note_commitment = std::hash::pedersen_commitment([pubkey.x, pubkey.y]);\n // Compute input note nullifier\n let nullifier = std::hash::pedersen_commitment([note_commitment.x, index, priv_key]);\n // Compute output note nullifier\n let receiver_note_commitment = std::hash::pedersen_commitment([to_pubkey_x, to_pubkey_y]);\n // Check that the input note nullifier is in the root\n assert(note_root == compute_merkle_root(note_commitment.x, index, note_hash_path));\n\n [nullifier.x, receiver_note_commitment.x]\n}\n\nfn compute_merkle_root(leaf: Field, index: Field, hash_path: [Field; N]) -> Field {\n let index_bits: [u1; N] = index.to_le_bits();\n let mut current = leaf;\n for i in 0..N {\n let path_bit = index_bits[i] as bool;\n let (hash_left, hash_right) = if path_bit {\n (hash_path[i], current)\n } else {\n (current, hash_path[i])\n };\n current = std::hash::pedersen_hash([hash_left, hash_right]);\n }\n current\n}\n", + "source": "fn main(\n // Public key of note\n // all notes have the same denomination\n priv_key: Field,\n // Merkle membership proof\n note_root: pub Field,\n index: Field,\n note_hash_path: [Field; 3],\n // Receiver public key\n to_pubkey_x: Field,\n to_pubkey_y: Field,\n) -> pub [Field; 2] {\n let priv_key_as_scalar = std::embedded_curve_ops::EmbeddedCurveScalar { lo: priv_key, hi: 0 };\n // Compute public key from private key to show ownership\n let pubkey = std::embedded_curve_ops::fixed_base_scalar_mul(priv_key_as_scalar);\n // Compute input note commitment\n let note_commitment = std::hash::pedersen_commitment([pubkey.x, pubkey.y]);\n // Compute input note nullifier\n let nullifier = std::hash::pedersen_commitment([note_commitment.x, index, priv_key]);\n // Compute output note nullifier\n let receiver_note_commitment = std::hash::pedersen_commitment([to_pubkey_x, to_pubkey_y]);\n // Check that the input note nullifier is in the root\n assert(note_root == compute_merkle_root(note_commitment.x, index, note_hash_path));\n\n [nullifier.x, receiver_note_commitment.x]\n}\n\nfn compute_merkle_root(leaf: Field, index: Field, hash_path: [Field; N]) -> Field {\n let index_bits: [u1; N] = index.to_le_bits();\n let mut current = leaf;\n for i in 0..N {\n let path_bit = index_bits[i] != 0;\n let (hash_left, hash_right) = if path_bit {\n (hash_path[i], current)\n } else {\n (current, hash_path[i])\n };\n current = std::hash::pedersen_hash([hash_left, hash_right]);\n }\n current\n}\n", "path": "" } }, diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/simple_shield/execute__tests__force_brillig_false_inliner_0.snap b/tooling/nargo_cli/tests/snapshots/execution_success/simple_shield/execute__tests__force_brillig_false_inliner_0.snap index 4f0043d2e99..e109217a8d8 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/simple_shield/execute__tests__force_brillig_false_inliner_0.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/simple_shield/execute__tests__force_brillig_false_inliner_0.snap @@ -129,7 +129,7 @@ expression: artifact "unconstrained func 1", "[Const { destination: Direct(5), bit_size: Integer(U32), value: 0 }, Const { destination: Direct(6), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(7), bit_size: Integer(U32), value: 3 }, CalldataCopy { destination_address: Direct(0), size_address: Direct(7), offset_address: Direct(5) }, Cast { destination: Direct(1), source: Direct(1), bit_size: Integer(U32) }, Const { destination: Direct(9), bit_size: Integer(U32), value: 10 }, BinaryIntOp { destination: Direct(7), op: Add, bit_size: U32, lhs: Direct(9), rhs: Direct(1) }, BinaryFieldOp { destination: Direct(3), op: IntegerDiv, lhs: Direct(0), rhs: Direct(2) }, BinaryFieldOp { destination: Direct(4), op: Mul, lhs: Direct(3), rhs: Direct(2) }, BinaryFieldOp { destination: Direct(4), op: Sub, lhs: Direct(0), rhs: Direct(4) }, Store { destination_pointer: Direct(9), source: Direct(4) }, BinaryIntOp { destination: Direct(9), op: Add, bit_size: U32, lhs: Direct(9), rhs: Direct(6) }, Mov { destination: Direct(0), source: Direct(3) }, BinaryIntOp { destination: Direct(8), op: LessThan, bit_size: U32, lhs: Direct(9), rhs: Direct(7) }, JumpIf { condition: Direct(8), location: 7 }, Const { destination: Direct(9), bit_size: Integer(U32), value: 10 }, Stop { return_data: HeapVector { pointer: Direct(9), size: Direct(1) } }]" ], - "debug_symbols": "pZjdbusgDMffhetc4A8I9FWmacq6bIoUpVXWTjqa+u7HLJC1OgeEkpu6TuJfwfhvGr7VW/96/XgZpvfTpzo8favXeRjH4eNlPB27y3Ca5Oq30uEDrDpgo6BdjFMHEuPVgRuF8gTfbo1KYS+Xue9D1B1H6Odu7qeLOkzXcWzUVzdefx76PHfTj710s9zVjeqnN7ECfB/GPny7Nb/ROh/qNMZgh3YNh/YhHvLxljnGW0Nb4h2keOc2xafJtzr7+4X58/r7hts13jzmz+TjjQabAPqOALaWwN67lWB8jtAWCManRWDLejeBcoRCHi2kOrKWc3mEAgAspJUAa8zvEPwjolAL8JtJ1JhHYCERoH1KBBjchEBKE2G0fhsCzW4EtDWIYjpdKm3J7KYVQW1SXSEgZBEujyBDKRckVbppFIDtOgpLOQTq3RKrR2zRWItJY63XOY0h7dYY8m6NodmtsSKiTmNlRJXGyogqjZXTWaWxEqJSYwS7NVYcRZ3GiHZrrB6xRWPOJoBHzGmM7G6NUbtbY+R2a6yIqNNYGVGlsTKiSmPldFZprISorG7m3dVdj9hS3aD1mgpts/93uZRN5BWBNisRdkUE/w8Brn4URGlBgIzeNBFeixOYtuXCUHr7ANP67OtD4X8aolu1TvdvYI+VZQpNDx2uG4Az2Q3A8O52UUTUtYsyoqpdlBFV7aKYTr/mAj1sQpDoLO2nALQNwbAiPOxHZHf1QrvwnnLd4lm87jjM/5x7SDVDEKWccYTO1ChaPF48Ezpoo8LRiHjhaESS7RbPLx7oxQWIvoBI1hyERMHnsLhiTfRt9NvQIpeTFvbxqMXHs5ZgIVqMVnhGnkfhGRk2mmhttG2876Lvw2uuTEgv1wmW64TRUrQc70ce2RgXeRR55BfLOlpY7nPkMS1xLLyfPeerm4fudexDqsNiXKdjyry4lz/ndCedSZ3n07F/u859WKW7gyn5fJKegf75FlbyLw==", + "debug_symbols": "pZjdbusgDMffhetc4A8I9FWmacq6bIoUpVXWTjqa+u7HLJC1OgeEkpu6TuJfwfhvGr7VW/96/XgZpvfTpzo8favXeRjH4eNlPB27y3Ca5Oq30uEDrDpgo6BdjFMHEuPVgRuF8gTfbo1KYS+Xue9D1B1H6Odu7qeLOkzXcWzUVzdefx76PHfTj710s9zVjeqnN7ECfB/GPny7Nb/ROh/qNMZgh3YNh/YhHvLxljnGW0Nb4h2keOc2xafJtzr7+4X58/r7hts13jzmz+TjjQabAPqOALaWwN67lWB8jtAWCManRWDLejeBcoRCHi2kOrKWc3mEAgAspJUAa8zvEPwjolAL8JtJ1JhHYCERoH1KBBjchEBKE2G0fhsCzW4EtDWIYjpdKm3J7KYVQW1SXSEgZBEujyBDKRckVbppFIDtOgpLOQTq3RKrR2zRWItJY63XOY0h7dYY8m6NodmtsSKiTmNlRJXGyogqjZXTWaWxEqJSYwS7NVYcRZ3GiHZrrB6xRWPOJoBHzGmM7G6NUbtbY+R2a6yIqNNYGVGlsTKiSmPldFZprISorG7m3dVdj9hS3aD1mgpts/93uZRN5BWBNisRdkUE/w8Brn4URGlBgIzeNBFet1Ng4k0Is5YFmNZmXx8K/9MQ3ap1un8De6wsU2h66HDdAJzJbgCGd7eLIqKuXZQRVe2ijKhqF8V0+jUX6GETgkRnaT8FoG0IhhXhYT8iu6sX2oX3lOsWz+J1x2H+59xDqhmCKOWMI3SmRtHi8eKZ0EEbFY5GxAtHI5Jst3h+8UAvLkD0BUSy5iAkCj6HxRVrom+j34YWuZy0sI9HLT6etQQL0WK0wjPyPArPyLDRRGujbeN9F30fXnNlQnq5TrBcJ4yWouV4P/LIxrjIo8gjv1jW0cJynyOPaYlj4f3sOV/dPHSvYx9SHRbjOh1T5sW9/DmnO+lM6jyfjv3bde7DKt0dTMnnk/QM9M+3sJJ/AQ==", "file_map": { "16": { "source": "use crate::cmp::Eq;\nuse crate::hash::Hash;\nuse crate::ops::arith::{Add, Neg, Sub};\n\n/// A point on the embedded elliptic curve\n/// By definition, the base field of the embedded curve is the scalar field of the proof system curve, i.e the Noir Field.\n/// x and y denotes the Weierstrass coordinates of the point, if is_infinite is false.\npub struct EmbeddedCurvePoint {\n pub x: Field,\n pub y: Field,\n pub is_infinite: bool,\n}\n\nimpl EmbeddedCurvePoint {\n /// Elliptic curve point doubling operation\n /// returns the doubled point of a point P, i.e P+P\n pub fn double(self) -> EmbeddedCurvePoint {\n embedded_curve_add(self, self)\n }\n\n /// Returns the null element of the curve; 'the point at infinity'\n pub fn point_at_infinity() -> EmbeddedCurvePoint {\n EmbeddedCurvePoint { x: 0, y: 0, is_infinite: true }\n }\n\n /// Returns the curve's generator point.\n pub fn generator() -> EmbeddedCurvePoint {\n // Generator point for the grumpkin curve (y^2 = x^3 - 17)\n EmbeddedCurvePoint {\n x: 1,\n y: 17631683881184975370165255887551781615748388533673675138860, // sqrt(-16)\n is_infinite: false,\n }\n }\n}\n\nimpl Add for EmbeddedCurvePoint {\n /// Adds two points P+Q, using the curve addition formula, and also handles point at infinity\n fn add(self, other: EmbeddedCurvePoint) -> EmbeddedCurvePoint {\n embedded_curve_add(self, other)\n }\n}\n\nimpl Sub for EmbeddedCurvePoint {\n /// Points subtraction operation, using addition and negation\n fn sub(self, other: EmbeddedCurvePoint) -> EmbeddedCurvePoint {\n self + other.neg()\n }\n}\n\nimpl Neg for EmbeddedCurvePoint {\n /// Negates a point P, i.e returns -P, by negating the y coordinate.\n /// If the point is at infinity, then the result is also at infinity.\n fn neg(self) -> EmbeddedCurvePoint {\n EmbeddedCurvePoint { x: self.x, y: -self.y, is_infinite: self.is_infinite }\n }\n}\n\nimpl Eq for EmbeddedCurvePoint {\n /// Checks whether two points are equal\n fn eq(self: Self, b: EmbeddedCurvePoint) -> bool {\n (self.is_infinite & b.is_infinite)\n | ((self.is_infinite == b.is_infinite) & (self.x == b.x) & (self.y == b.y))\n }\n}\n\nimpl Hash for EmbeddedCurvePoint {\n fn hash(self, state: &mut H)\n where\n H: crate::hash::Hasher,\n {\n if self.is_infinite {\n self.is_infinite.hash(state);\n } else {\n self.x.hash(state);\n self.y.hash(state);\n }\n }\n}\n\n/// Scalar for the embedded curve represented as low and high limbs\n/// By definition, the scalar field of the embedded curve is base field of the proving system curve.\n/// It may not fit into a Field element, so it is represented with two Field elements; its low and high limbs.\npub struct EmbeddedCurveScalar {\n pub lo: Field,\n pub hi: Field,\n}\n\nimpl EmbeddedCurveScalar {\n pub fn new(lo: Field, hi: Field) -> Self {\n EmbeddedCurveScalar { lo, hi }\n }\n\n #[field(bn254)]\n pub fn from_field(scalar: Field) -> EmbeddedCurveScalar {\n let (a, b) = crate::field::bn254::decompose(scalar);\n EmbeddedCurveScalar { lo: a, hi: b }\n }\n\n //Bytes to scalar: take the first (after the specified offset) 16 bytes of the input as the lo value, and the next 16 bytes as the hi value\n #[field(bn254)]\n pub(crate) fn from_bytes(bytes: [u8; 64], offset: u32) -> EmbeddedCurveScalar {\n let mut v = 1;\n let mut lo = 0 as Field;\n let mut hi = 0 as Field;\n for i in 0..16 {\n lo = lo + (bytes[offset + 31 - i] as Field) * v;\n hi = hi + (bytes[offset + 15 - i] as Field) * v;\n v = v * 256;\n }\n let sig_s = crate::embedded_curve_ops::EmbeddedCurveScalar { lo, hi };\n sig_s\n }\n}\n\nimpl Eq for EmbeddedCurveScalar {\n fn eq(self, other: Self) -> bool {\n (other.hi == self.hi) & (other.lo == self.lo)\n }\n}\n\nimpl Hash for EmbeddedCurveScalar {\n fn hash(self, state: &mut H)\n where\n H: crate::hash::Hasher,\n {\n self.hi.hash(state);\n self.lo.hash(state);\n }\n}\n\n// Computes a multi scalar multiplication over the embedded curve.\n// For bn254, We have Grumpkin and Baby JubJub.\n// For bls12-381, we have JubJub and Bandersnatch.\n//\n// The embedded curve being used is decided by the\n// underlying proof system.\n// docs:start:multi_scalar_mul\npub fn multi_scalar_mul(\n points: [EmbeddedCurvePoint; N],\n scalars: [EmbeddedCurveScalar; N],\n) -> EmbeddedCurvePoint\n// docs:end:multi_scalar_mul\n{\n multi_scalar_mul_array_return(points, scalars)[0]\n}\n\n#[foreign(multi_scalar_mul)]\npub(crate) fn multi_scalar_mul_array_return(\n points: [EmbeddedCurvePoint; N],\n scalars: [EmbeddedCurveScalar; N],\n) -> [EmbeddedCurvePoint; 1] {}\n\n// docs:start:fixed_base_scalar_mul\npub fn fixed_base_scalar_mul(scalar: EmbeddedCurveScalar) -> EmbeddedCurvePoint\n// docs:end:fixed_base_scalar_mul\n{\n multi_scalar_mul([EmbeddedCurvePoint::generator()], [scalar])\n}\n\n/// This function only assumes that the points are on the curve\n/// It handles corner cases around the infinity point causing some overhead compared to embedded_curve_add_not_nul and embedded_curve_add_unsafe\n// docs:start:embedded_curve_add\npub fn embedded_curve_add(\n point1: EmbeddedCurvePoint,\n point2: EmbeddedCurvePoint,\n) -> EmbeddedCurvePoint {\n // docs:end:embedded_curve_add\n if crate::runtime::is_unconstrained() {\n // `embedded_curve_add_unsafe` requires the inputs not to be the infinity point, so we check it here.\n // This is because `embedded_curve_add_unsafe` uses the `embedded_curve_add` opcode.\n // For efficiency, the backend does not check the inputs for the infinity point, but it assumes that they are not the infinity point\n // so that it can apply the ec addition formula directly.\n if point1.is_infinite {\n point2\n } else if point2.is_infinite {\n point1\n } else {\n embedded_curve_add_unsafe(point1, point2)\n }\n } else {\n // In a constrained context, we also need to check the inputs are not the infinity point because we also use `embedded_curve_add_unsafe`\n // However we also need to identify the case where the two inputs are the same, because then\n // the addition formula does not work and we need to use the doubling formula instead.\n // In unconstrained context, we can check directly if the input values are the same when solving the opcode, so it is not an issue.\n\n // x_coordinates_match is true if both abscissae are the same\n let x_coordinates_match = point1.x == point2.x;\n // y_coordinates_match is true if both ordinates are the same\n let y_coordinates_match = point1.y == point2.y;\n // double_predicate is true if both abscissae and ordinates are the same\n let double_predicate = (x_coordinates_match & y_coordinates_match);\n // If the abscissae are the same, but not the ordinates, then one point is the opposite of the other\n let infinity_predicate = (x_coordinates_match & !y_coordinates_match);\n let point1_1 = EmbeddedCurvePoint {\n x: point1.x + (x_coordinates_match as Field),\n y: point1.y,\n is_infinite: false,\n };\n let point2_1 = EmbeddedCurvePoint { x: point2.x, y: point2.y, is_infinite: false };\n // point1_1 is guaranteed to have a different abscissa than point2:\n // - if x_coordinates_match is 0, that means point1.x != point2.x, and point1_1.x = point1.x + 0\n // - if x_coordinates_match is 1, that means point1.x = point2.x, but point1_1.x = point1.x + 1 in this case\n // Because the abscissa is different, the addition formula is guaranteed to succeed, so we can safely use `embedded_curve_add_unsafe`\n // Note that this computation may be garbage: if x_coordinates_match is 1, or if one of the input is the point at infinity.\n let mut result = embedded_curve_add_unsafe(point1_1, point2_1);\n\n // `embedded_curve_add_unsafe` is doing a doubling if the input is the same variable, because in this case it is guaranteed (at 'compile time') that the input is the same.\n let double = embedded_curve_add_unsafe(point1, point1);\n // `embedded_curve_add_unsafe` would not perform doubling, even if the inputs point1 and point2 are the same, because it cannot know this without adding some logic (and some constraints)\n // However we did this logic when we computed `double_predicate`, so we set the result to 2*point1 if point1 and point2 are the same\n result = if double_predicate { double } else { result };\n\n // Same logic as above for unconstrained context, we set the proper result when one of the inputs is the infinity point\n if point1.is_infinite {\n result = point2;\n }\n if point2.is_infinite {\n result = point1;\n }\n\n // Finally, we set the is_infinity flag of the result:\n // Opposite points should sum into the infinity point, however, if one of them is point at infinity, their coordinates are not meaningful\n // so we should not use the fact that the inputs are opposite in this case:\n let mut result_is_infinity =\n infinity_predicate & (!point1.is_infinite & !point2.is_infinite);\n // However, if both of them are at infinity, then the result is also at infinity\n result.is_infinite = result_is_infinity | (point1.is_infinite & point2.is_infinite);\n result\n }\n}\n\n#[foreign(embedded_curve_add)]\nfn embedded_curve_add_array_return(\n _point1: EmbeddedCurvePoint,\n _point2: EmbeddedCurvePoint,\n) -> [EmbeddedCurvePoint; 1] {}\n\n/// This function assumes that:\n/// The points are on the curve, and\n/// The points don't share an x-coordinate, and\n/// Neither point is the infinity point.\n/// If it is used with correct input, the function ensures the correct non-zero result is returned.\n/// Except for points on the curve, the other assumptions are checked by the function. It will cause assertion failure if they are not respected.\npub fn embedded_curve_add_not_nul(\n point1: EmbeddedCurvePoint,\n point2: EmbeddedCurvePoint,\n) -> EmbeddedCurvePoint {\n assert(point1.x != point2.x);\n assert(!point1.is_infinite);\n assert(!point2.is_infinite);\n // Ensure is_infinite is comptime\n let point1_1 = EmbeddedCurvePoint { x: point1.x, y: point1.y, is_infinite: false };\n let point2_1 = EmbeddedCurvePoint { x: point2.x, y: point2.y, is_infinite: false };\n embedded_curve_add_unsafe(point1_1, point2_1)\n}\n\n/// Unsafe ec addition\n/// If the inputs are the same, it will perform a doubling, but only if point1 and point2 are the same variable.\n/// If they have the same value but are different variables, the result will be incorrect because in this case\n/// it assumes (but does not check) that the points' x-coordinates are not equal.\n/// It also assumes neither point is the infinity point.\npub fn embedded_curve_add_unsafe(\n point1: EmbeddedCurvePoint,\n point2: EmbeddedCurvePoint,\n) -> EmbeddedCurvePoint {\n embedded_curve_add_array_return(point1, point2)[0]\n}\n", @@ -148,7 +148,7 @@ expression: artifact "path": "std/hash/mod.nr" }, "50": { - "source": "fn main(\n // Public key of note\n // all notes have the same denomination\n priv_key: Field,\n // Merkle membership proof\n note_root: pub Field,\n index: Field,\n note_hash_path: [Field; 3],\n // Receiver public key\n to_pubkey_x: Field,\n to_pubkey_y: Field,\n) -> pub [Field; 2] {\n let priv_key_as_scalar = std::embedded_curve_ops::EmbeddedCurveScalar { lo: priv_key, hi: 0 };\n // Compute public key from private key to show ownership\n let pubkey = std::embedded_curve_ops::fixed_base_scalar_mul(priv_key_as_scalar);\n // Compute input note commitment\n let note_commitment = std::hash::pedersen_commitment([pubkey.x, pubkey.y]);\n // Compute input note nullifier\n let nullifier = std::hash::pedersen_commitment([note_commitment.x, index, priv_key]);\n // Compute output note nullifier\n let receiver_note_commitment = std::hash::pedersen_commitment([to_pubkey_x, to_pubkey_y]);\n // Check that the input note nullifier is in the root\n assert(note_root == compute_merkle_root(note_commitment.x, index, note_hash_path));\n\n [nullifier.x, receiver_note_commitment.x]\n}\n\nfn compute_merkle_root(leaf: Field, index: Field, hash_path: [Field; N]) -> Field {\n let index_bits: [u1; N] = index.to_le_bits();\n let mut current = leaf;\n for i in 0..N {\n let path_bit = index_bits[i] as bool;\n let (hash_left, hash_right) = if path_bit {\n (hash_path[i], current)\n } else {\n (current, hash_path[i])\n };\n current = std::hash::pedersen_hash([hash_left, hash_right]);\n }\n current\n}\n", + "source": "fn main(\n // Public key of note\n // all notes have the same denomination\n priv_key: Field,\n // Merkle membership proof\n note_root: pub Field,\n index: Field,\n note_hash_path: [Field; 3],\n // Receiver public key\n to_pubkey_x: Field,\n to_pubkey_y: Field,\n) -> pub [Field; 2] {\n let priv_key_as_scalar = std::embedded_curve_ops::EmbeddedCurveScalar { lo: priv_key, hi: 0 };\n // Compute public key from private key to show ownership\n let pubkey = std::embedded_curve_ops::fixed_base_scalar_mul(priv_key_as_scalar);\n // Compute input note commitment\n let note_commitment = std::hash::pedersen_commitment([pubkey.x, pubkey.y]);\n // Compute input note nullifier\n let nullifier = std::hash::pedersen_commitment([note_commitment.x, index, priv_key]);\n // Compute output note nullifier\n let receiver_note_commitment = std::hash::pedersen_commitment([to_pubkey_x, to_pubkey_y]);\n // Check that the input note nullifier is in the root\n assert(note_root == compute_merkle_root(note_commitment.x, index, note_hash_path));\n\n [nullifier.x, receiver_note_commitment.x]\n}\n\nfn compute_merkle_root(leaf: Field, index: Field, hash_path: [Field; N]) -> Field {\n let index_bits: [u1; N] = index.to_le_bits();\n let mut current = leaf;\n for i in 0..N {\n let path_bit = index_bits[i] != 0;\n let (hash_left, hash_right) = if path_bit {\n (hash_path[i], current)\n } else {\n (current, hash_path[i])\n };\n current = std::hash::pedersen_hash([hash_left, hash_right]);\n }\n current\n}\n", "path": "" } }, diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/simple_shield/execute__tests__force_brillig_false_inliner_9223372036854775807.snap b/tooling/nargo_cli/tests/snapshots/execution_success/simple_shield/execute__tests__force_brillig_false_inliner_9223372036854775807.snap index 4f0043d2e99..e109217a8d8 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/simple_shield/execute__tests__force_brillig_false_inliner_9223372036854775807.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/simple_shield/execute__tests__force_brillig_false_inliner_9223372036854775807.snap @@ -129,7 +129,7 @@ expression: artifact "unconstrained func 1", "[Const { destination: Direct(5), bit_size: Integer(U32), value: 0 }, Const { destination: Direct(6), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(7), bit_size: Integer(U32), value: 3 }, CalldataCopy { destination_address: Direct(0), size_address: Direct(7), offset_address: Direct(5) }, Cast { destination: Direct(1), source: Direct(1), bit_size: Integer(U32) }, Const { destination: Direct(9), bit_size: Integer(U32), value: 10 }, BinaryIntOp { destination: Direct(7), op: Add, bit_size: U32, lhs: Direct(9), rhs: Direct(1) }, BinaryFieldOp { destination: Direct(3), op: IntegerDiv, lhs: Direct(0), rhs: Direct(2) }, BinaryFieldOp { destination: Direct(4), op: Mul, lhs: Direct(3), rhs: Direct(2) }, BinaryFieldOp { destination: Direct(4), op: Sub, lhs: Direct(0), rhs: Direct(4) }, Store { destination_pointer: Direct(9), source: Direct(4) }, BinaryIntOp { destination: Direct(9), op: Add, bit_size: U32, lhs: Direct(9), rhs: Direct(6) }, Mov { destination: Direct(0), source: Direct(3) }, BinaryIntOp { destination: Direct(8), op: LessThan, bit_size: U32, lhs: Direct(9), rhs: Direct(7) }, JumpIf { condition: Direct(8), location: 7 }, Const { destination: Direct(9), bit_size: Integer(U32), value: 10 }, Stop { return_data: HeapVector { pointer: Direct(9), size: Direct(1) } }]" ], - "debug_symbols": "pZjdbusgDMffhetc4A8I9FWmacq6bIoUpVXWTjqa+u7HLJC1OgeEkpu6TuJfwfhvGr7VW/96/XgZpvfTpzo8favXeRjH4eNlPB27y3Ca5Oq30uEDrDpgo6BdjFMHEuPVgRuF8gTfbo1KYS+Xue9D1B1H6Odu7qeLOkzXcWzUVzdefx76PHfTj710s9zVjeqnN7ECfB/GPny7Nb/ROh/qNMZgh3YNh/YhHvLxljnGW0Nb4h2keOc2xafJtzr7+4X58/r7hts13jzmz+TjjQabAPqOALaWwN67lWB8jtAWCManRWDLejeBcoRCHi2kOrKWc3mEAgAspJUAa8zvEPwjolAL8JtJ1JhHYCERoH1KBBjchEBKE2G0fhsCzW4EtDWIYjpdKm3J7KYVQW1SXSEgZBEujyBDKRckVbppFIDtOgpLOQTq3RKrR2zRWItJY63XOY0h7dYY8m6NodmtsSKiTmNlRJXGyogqjZXTWaWxEqJSYwS7NVYcRZ3GiHZrrB6xRWPOJoBHzGmM7G6NUbtbY+R2a6yIqNNYGVGlsTKiSmPldFZprISorG7m3dVdj9hS3aD1mgpts/93uZRN5BWBNisRdkUE/w8Brn4URGlBgIzeNBFeixOYtuXCUHr7ANP67OtD4X8aolu1TvdvYI+VZQpNDx2uG4Az2Q3A8O52UUTUtYsyoqpdlBFV7aKYTr/mAj1sQpDoLO2nALQNwbAiPOxHZHf1QrvwnnLd4lm87jjM/5x7SDVDEKWccYTO1ChaPF48Ezpoo8LRiHjhaESS7RbPLx7oxQWIvoBI1hyERMHnsLhiTfRt9NvQIpeTFvbxqMXHs5ZgIVqMVnhGnkfhGRk2mmhttG2876Lvw2uuTEgv1wmW64TRUrQc70ce2RgXeRR55BfLOlpY7nPkMS1xLLyfPeerm4fudexDqsNiXKdjyry4lz/ndCedSZ3n07F/u859WKW7gyn5fJKegf75FlbyLw==", + "debug_symbols": "pZjdbusgDMffhetc4A8I9FWmacq6bIoUpVXWTjqa+u7HLJC1OgeEkpu6TuJfwfhvGr7VW/96/XgZpvfTpzo8favXeRjH4eNlPB27y3Ca5Oq30uEDrDpgo6BdjFMHEuPVgRuF8gTfbo1KYS+Xue9D1B1H6Odu7qeLOkzXcWzUVzdefx76PHfTj710s9zVjeqnN7ECfB/GPny7Nb/ROh/qNMZgh3YNh/YhHvLxljnGW0Nb4h2keOc2xafJtzr7+4X58/r7hts13jzmz+TjjQabAPqOALaWwN67lWB8jtAWCManRWDLejeBcoRCHi2kOrKWc3mEAgAspJUAa8zvEPwjolAL8JtJ1JhHYCERoH1KBBjchEBKE2G0fhsCzW4EtDWIYjpdKm3J7KYVQW1SXSEgZBEujyBDKRckVbppFIDtOgpLOQTq3RKrR2zRWItJY63XOY0h7dYY8m6NodmtsSKiTmNlRJXGyogqjZXTWaWxEqJSYwS7NVYcRZ3GiHZrrB6xRWPOJoBHzGmM7G6NUbtbY+R2a6yIqNNYGVGlsTKiSmPldFZprISorG7m3dVdj9hS3aD1mgpts/93uZRN5BWBNisRdkUE/w8Brn4URGlBgIzeNBFet1Ng4k0Is5YFmNZmXx8K/9MQ3ap1un8De6wsU2h66HDdAJzJbgCGd7eLIqKuXZQRVe2ijKhqF8V0+jUX6GETgkRnaT8FoG0IhhXhYT8iu6sX2oX3lOsWz+J1x2H+59xDqhmCKOWMI3SmRtHi8eKZ0EEbFY5GxAtHI5Jst3h+8UAvLkD0BUSy5iAkCj6HxRVrom+j34YWuZy0sI9HLT6etQQL0WK0wjPyPArPyLDRRGujbeN9F30fXnNlQnq5TrBcJ4yWouV4P/LIxrjIo8gjv1jW0cJynyOPaYlj4f3sOV/dPHSvYx9SHRbjOh1T5sW9/DmnO+lM6jyfjv3bde7DKt0dTMnnk/QM9M+3sJJ/AQ==", "file_map": { "16": { "source": "use crate::cmp::Eq;\nuse crate::hash::Hash;\nuse crate::ops::arith::{Add, Neg, Sub};\n\n/// A point on the embedded elliptic curve\n/// By definition, the base field of the embedded curve is the scalar field of the proof system curve, i.e the Noir Field.\n/// x and y denotes the Weierstrass coordinates of the point, if is_infinite is false.\npub struct EmbeddedCurvePoint {\n pub x: Field,\n pub y: Field,\n pub is_infinite: bool,\n}\n\nimpl EmbeddedCurvePoint {\n /// Elliptic curve point doubling operation\n /// returns the doubled point of a point P, i.e P+P\n pub fn double(self) -> EmbeddedCurvePoint {\n embedded_curve_add(self, self)\n }\n\n /// Returns the null element of the curve; 'the point at infinity'\n pub fn point_at_infinity() -> EmbeddedCurvePoint {\n EmbeddedCurvePoint { x: 0, y: 0, is_infinite: true }\n }\n\n /// Returns the curve's generator point.\n pub fn generator() -> EmbeddedCurvePoint {\n // Generator point for the grumpkin curve (y^2 = x^3 - 17)\n EmbeddedCurvePoint {\n x: 1,\n y: 17631683881184975370165255887551781615748388533673675138860, // sqrt(-16)\n is_infinite: false,\n }\n }\n}\n\nimpl Add for EmbeddedCurvePoint {\n /// Adds two points P+Q, using the curve addition formula, and also handles point at infinity\n fn add(self, other: EmbeddedCurvePoint) -> EmbeddedCurvePoint {\n embedded_curve_add(self, other)\n }\n}\n\nimpl Sub for EmbeddedCurvePoint {\n /// Points subtraction operation, using addition and negation\n fn sub(self, other: EmbeddedCurvePoint) -> EmbeddedCurvePoint {\n self + other.neg()\n }\n}\n\nimpl Neg for EmbeddedCurvePoint {\n /// Negates a point P, i.e returns -P, by negating the y coordinate.\n /// If the point is at infinity, then the result is also at infinity.\n fn neg(self) -> EmbeddedCurvePoint {\n EmbeddedCurvePoint { x: self.x, y: -self.y, is_infinite: self.is_infinite }\n }\n}\n\nimpl Eq for EmbeddedCurvePoint {\n /// Checks whether two points are equal\n fn eq(self: Self, b: EmbeddedCurvePoint) -> bool {\n (self.is_infinite & b.is_infinite)\n | ((self.is_infinite == b.is_infinite) & (self.x == b.x) & (self.y == b.y))\n }\n}\n\nimpl Hash for EmbeddedCurvePoint {\n fn hash(self, state: &mut H)\n where\n H: crate::hash::Hasher,\n {\n if self.is_infinite {\n self.is_infinite.hash(state);\n } else {\n self.x.hash(state);\n self.y.hash(state);\n }\n }\n}\n\n/// Scalar for the embedded curve represented as low and high limbs\n/// By definition, the scalar field of the embedded curve is base field of the proving system curve.\n/// It may not fit into a Field element, so it is represented with two Field elements; its low and high limbs.\npub struct EmbeddedCurveScalar {\n pub lo: Field,\n pub hi: Field,\n}\n\nimpl EmbeddedCurveScalar {\n pub fn new(lo: Field, hi: Field) -> Self {\n EmbeddedCurveScalar { lo, hi }\n }\n\n #[field(bn254)]\n pub fn from_field(scalar: Field) -> EmbeddedCurveScalar {\n let (a, b) = crate::field::bn254::decompose(scalar);\n EmbeddedCurveScalar { lo: a, hi: b }\n }\n\n //Bytes to scalar: take the first (after the specified offset) 16 bytes of the input as the lo value, and the next 16 bytes as the hi value\n #[field(bn254)]\n pub(crate) fn from_bytes(bytes: [u8; 64], offset: u32) -> EmbeddedCurveScalar {\n let mut v = 1;\n let mut lo = 0 as Field;\n let mut hi = 0 as Field;\n for i in 0..16 {\n lo = lo + (bytes[offset + 31 - i] as Field) * v;\n hi = hi + (bytes[offset + 15 - i] as Field) * v;\n v = v * 256;\n }\n let sig_s = crate::embedded_curve_ops::EmbeddedCurveScalar { lo, hi };\n sig_s\n }\n}\n\nimpl Eq for EmbeddedCurveScalar {\n fn eq(self, other: Self) -> bool {\n (other.hi == self.hi) & (other.lo == self.lo)\n }\n}\n\nimpl Hash for EmbeddedCurveScalar {\n fn hash(self, state: &mut H)\n where\n H: crate::hash::Hasher,\n {\n self.hi.hash(state);\n self.lo.hash(state);\n }\n}\n\n// Computes a multi scalar multiplication over the embedded curve.\n// For bn254, We have Grumpkin and Baby JubJub.\n// For bls12-381, we have JubJub and Bandersnatch.\n//\n// The embedded curve being used is decided by the\n// underlying proof system.\n// docs:start:multi_scalar_mul\npub fn multi_scalar_mul(\n points: [EmbeddedCurvePoint; N],\n scalars: [EmbeddedCurveScalar; N],\n) -> EmbeddedCurvePoint\n// docs:end:multi_scalar_mul\n{\n multi_scalar_mul_array_return(points, scalars)[0]\n}\n\n#[foreign(multi_scalar_mul)]\npub(crate) fn multi_scalar_mul_array_return(\n points: [EmbeddedCurvePoint; N],\n scalars: [EmbeddedCurveScalar; N],\n) -> [EmbeddedCurvePoint; 1] {}\n\n// docs:start:fixed_base_scalar_mul\npub fn fixed_base_scalar_mul(scalar: EmbeddedCurveScalar) -> EmbeddedCurvePoint\n// docs:end:fixed_base_scalar_mul\n{\n multi_scalar_mul([EmbeddedCurvePoint::generator()], [scalar])\n}\n\n/// This function only assumes that the points are on the curve\n/// It handles corner cases around the infinity point causing some overhead compared to embedded_curve_add_not_nul and embedded_curve_add_unsafe\n// docs:start:embedded_curve_add\npub fn embedded_curve_add(\n point1: EmbeddedCurvePoint,\n point2: EmbeddedCurvePoint,\n) -> EmbeddedCurvePoint {\n // docs:end:embedded_curve_add\n if crate::runtime::is_unconstrained() {\n // `embedded_curve_add_unsafe` requires the inputs not to be the infinity point, so we check it here.\n // This is because `embedded_curve_add_unsafe` uses the `embedded_curve_add` opcode.\n // For efficiency, the backend does not check the inputs for the infinity point, but it assumes that they are not the infinity point\n // so that it can apply the ec addition formula directly.\n if point1.is_infinite {\n point2\n } else if point2.is_infinite {\n point1\n } else {\n embedded_curve_add_unsafe(point1, point2)\n }\n } else {\n // In a constrained context, we also need to check the inputs are not the infinity point because we also use `embedded_curve_add_unsafe`\n // However we also need to identify the case where the two inputs are the same, because then\n // the addition formula does not work and we need to use the doubling formula instead.\n // In unconstrained context, we can check directly if the input values are the same when solving the opcode, so it is not an issue.\n\n // x_coordinates_match is true if both abscissae are the same\n let x_coordinates_match = point1.x == point2.x;\n // y_coordinates_match is true if both ordinates are the same\n let y_coordinates_match = point1.y == point2.y;\n // double_predicate is true if both abscissae and ordinates are the same\n let double_predicate = (x_coordinates_match & y_coordinates_match);\n // If the abscissae are the same, but not the ordinates, then one point is the opposite of the other\n let infinity_predicate = (x_coordinates_match & !y_coordinates_match);\n let point1_1 = EmbeddedCurvePoint {\n x: point1.x + (x_coordinates_match as Field),\n y: point1.y,\n is_infinite: false,\n };\n let point2_1 = EmbeddedCurvePoint { x: point2.x, y: point2.y, is_infinite: false };\n // point1_1 is guaranteed to have a different abscissa than point2:\n // - if x_coordinates_match is 0, that means point1.x != point2.x, and point1_1.x = point1.x + 0\n // - if x_coordinates_match is 1, that means point1.x = point2.x, but point1_1.x = point1.x + 1 in this case\n // Because the abscissa is different, the addition formula is guaranteed to succeed, so we can safely use `embedded_curve_add_unsafe`\n // Note that this computation may be garbage: if x_coordinates_match is 1, or if one of the input is the point at infinity.\n let mut result = embedded_curve_add_unsafe(point1_1, point2_1);\n\n // `embedded_curve_add_unsafe` is doing a doubling if the input is the same variable, because in this case it is guaranteed (at 'compile time') that the input is the same.\n let double = embedded_curve_add_unsafe(point1, point1);\n // `embedded_curve_add_unsafe` would not perform doubling, even if the inputs point1 and point2 are the same, because it cannot know this without adding some logic (and some constraints)\n // However we did this logic when we computed `double_predicate`, so we set the result to 2*point1 if point1 and point2 are the same\n result = if double_predicate { double } else { result };\n\n // Same logic as above for unconstrained context, we set the proper result when one of the inputs is the infinity point\n if point1.is_infinite {\n result = point2;\n }\n if point2.is_infinite {\n result = point1;\n }\n\n // Finally, we set the is_infinity flag of the result:\n // Opposite points should sum into the infinity point, however, if one of them is point at infinity, their coordinates are not meaningful\n // so we should not use the fact that the inputs are opposite in this case:\n let mut result_is_infinity =\n infinity_predicate & (!point1.is_infinite & !point2.is_infinite);\n // However, if both of them are at infinity, then the result is also at infinity\n result.is_infinite = result_is_infinity | (point1.is_infinite & point2.is_infinite);\n result\n }\n}\n\n#[foreign(embedded_curve_add)]\nfn embedded_curve_add_array_return(\n _point1: EmbeddedCurvePoint,\n _point2: EmbeddedCurvePoint,\n) -> [EmbeddedCurvePoint; 1] {}\n\n/// This function assumes that:\n/// The points are on the curve, and\n/// The points don't share an x-coordinate, and\n/// Neither point is the infinity point.\n/// If it is used with correct input, the function ensures the correct non-zero result is returned.\n/// Except for points on the curve, the other assumptions are checked by the function. It will cause assertion failure if they are not respected.\npub fn embedded_curve_add_not_nul(\n point1: EmbeddedCurvePoint,\n point2: EmbeddedCurvePoint,\n) -> EmbeddedCurvePoint {\n assert(point1.x != point2.x);\n assert(!point1.is_infinite);\n assert(!point2.is_infinite);\n // Ensure is_infinite is comptime\n let point1_1 = EmbeddedCurvePoint { x: point1.x, y: point1.y, is_infinite: false };\n let point2_1 = EmbeddedCurvePoint { x: point2.x, y: point2.y, is_infinite: false };\n embedded_curve_add_unsafe(point1_1, point2_1)\n}\n\n/// Unsafe ec addition\n/// If the inputs are the same, it will perform a doubling, but only if point1 and point2 are the same variable.\n/// If they have the same value but are different variables, the result will be incorrect because in this case\n/// it assumes (but does not check) that the points' x-coordinates are not equal.\n/// It also assumes neither point is the infinity point.\npub fn embedded_curve_add_unsafe(\n point1: EmbeddedCurvePoint,\n point2: EmbeddedCurvePoint,\n) -> EmbeddedCurvePoint {\n embedded_curve_add_array_return(point1, point2)[0]\n}\n", @@ -148,7 +148,7 @@ expression: artifact "path": "std/hash/mod.nr" }, "50": { - "source": "fn main(\n // Public key of note\n // all notes have the same denomination\n priv_key: Field,\n // Merkle membership proof\n note_root: pub Field,\n index: Field,\n note_hash_path: [Field; 3],\n // Receiver public key\n to_pubkey_x: Field,\n to_pubkey_y: Field,\n) -> pub [Field; 2] {\n let priv_key_as_scalar = std::embedded_curve_ops::EmbeddedCurveScalar { lo: priv_key, hi: 0 };\n // Compute public key from private key to show ownership\n let pubkey = std::embedded_curve_ops::fixed_base_scalar_mul(priv_key_as_scalar);\n // Compute input note commitment\n let note_commitment = std::hash::pedersen_commitment([pubkey.x, pubkey.y]);\n // Compute input note nullifier\n let nullifier = std::hash::pedersen_commitment([note_commitment.x, index, priv_key]);\n // Compute output note nullifier\n let receiver_note_commitment = std::hash::pedersen_commitment([to_pubkey_x, to_pubkey_y]);\n // Check that the input note nullifier is in the root\n assert(note_root == compute_merkle_root(note_commitment.x, index, note_hash_path));\n\n [nullifier.x, receiver_note_commitment.x]\n}\n\nfn compute_merkle_root(leaf: Field, index: Field, hash_path: [Field; N]) -> Field {\n let index_bits: [u1; N] = index.to_le_bits();\n let mut current = leaf;\n for i in 0..N {\n let path_bit = index_bits[i] as bool;\n let (hash_left, hash_right) = if path_bit {\n (hash_path[i], current)\n } else {\n (current, hash_path[i])\n };\n current = std::hash::pedersen_hash([hash_left, hash_right]);\n }\n current\n}\n", + "source": "fn main(\n // Public key of note\n // all notes have the same denomination\n priv_key: Field,\n // Merkle membership proof\n note_root: pub Field,\n index: Field,\n note_hash_path: [Field; 3],\n // Receiver public key\n to_pubkey_x: Field,\n to_pubkey_y: Field,\n) -> pub [Field; 2] {\n let priv_key_as_scalar = std::embedded_curve_ops::EmbeddedCurveScalar { lo: priv_key, hi: 0 };\n // Compute public key from private key to show ownership\n let pubkey = std::embedded_curve_ops::fixed_base_scalar_mul(priv_key_as_scalar);\n // Compute input note commitment\n let note_commitment = std::hash::pedersen_commitment([pubkey.x, pubkey.y]);\n // Compute input note nullifier\n let nullifier = std::hash::pedersen_commitment([note_commitment.x, index, priv_key]);\n // Compute output note nullifier\n let receiver_note_commitment = std::hash::pedersen_commitment([to_pubkey_x, to_pubkey_y]);\n // Check that the input note nullifier is in the root\n assert(note_root == compute_merkle_root(note_commitment.x, index, note_hash_path));\n\n [nullifier.x, receiver_note_commitment.x]\n}\n\nfn compute_merkle_root(leaf: Field, index: Field, hash_path: [Field; N]) -> Field {\n let index_bits: [u1; N] = index.to_le_bits();\n let mut current = leaf;\n for i in 0..N {\n let path_bit = index_bits[i] != 0;\n let (hash_left, hash_right) = if path_bit {\n (hash_path[i], current)\n } else {\n (current, hash_path[i])\n };\n current = std::hash::pedersen_hash([hash_left, hash_right]);\n }\n current\n}\n", "path": "" } }, diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/simple_shield/execute__tests__force_brillig_true_inliner_-9223372036854775808.snap b/tooling/nargo_cli/tests/snapshots/execution_success/simple_shield/execute__tests__force_brillig_true_inliner_-9223372036854775808.snap index 1603914bbef..f4d71beecf4 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/simple_shield/execute__tests__force_brillig_true_inliner_-9223372036854775808.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/simple_shield/execute__tests__force_brillig_true_inliner_-9223372036854775808.snap @@ -85,7 +85,7 @@ expression: artifact "unconstrained func 0", "[Const { destination: Direct(2), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(1), bit_size: Integer(U32), value: 32857 }, Const { destination: Direct(0), bit_size: Integer(U32), value: 3 }, Const { destination: Relative(7), bit_size: Integer(U32), value: 8 }, Const { destination: Relative(8), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(32847), size_address: Relative(7), offset_address: Relative(8) }, Mov { destination: Relative(1), source: Direct(32847) }, Mov { destination: Relative(2), source: Direct(32848) }, Mov { destination: Relative(3), source: Direct(32849) }, Const { destination: Relative(4), bit_size: Integer(U32), value: 32850 }, Const { destination: Relative(8), bit_size: Integer(U32), value: 3 }, Mov { destination: Relative(7), source: Direct(1) }, Const { destination: Relative(9), bit_size: Integer(U32), value: 4 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(9) }, IndirectConst { destination_pointer: Relative(7), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(9), op: Add, bit_size: U32, lhs: Relative(7), rhs: Direct(2) }, Mov { destination: Direct(32771), source: Relative(4) }, Mov { destination: Direct(32772), source: Relative(9) }, Mov { destination: Direct(32773), source: Relative(8) }, Call { location: 35 }, Mov { destination: Relative(4), source: Relative(7) }, Mov { destination: Relative(5), source: Direct(32853) }, Mov { destination: Relative(6), source: Direct(32854) }, Call { location: 46 }, Call { location: 59 }, BinaryIntOp { destination: Relative(2), op: Add, bit_size: U32, lhs: Relative(1), rhs: Direct(2) }, Const { destination: Relative(3), bit_size: Integer(U32), value: 32855 }, Const { destination: Relative(4), bit_size: Integer(U32), value: 2 }, Mov { destination: Direct(32771), source: Relative(2) }, Mov { destination: Direct(32772), source: Relative(3) }, Mov { destination: Direct(32773), source: Relative(4) }, Call { location: 35 }, Const { destination: Relative(2), bit_size: Integer(U32), value: 32855 }, Const { destination: Relative(3), bit_size: Integer(U32), value: 2 }, Stop { return_data: HeapVector { pointer: Relative(2), size: Relative(3) } }, BinaryIntOp { destination: Direct(32775), op: Add, bit_size: U32, lhs: Direct(32771), rhs: Direct(32773) }, Mov { destination: Direct(32776), source: Direct(32771) }, Mov { destination: Direct(32777), source: Direct(32772) }, BinaryIntOp { destination: Direct(32778), op: Equals, bit_size: U32, lhs: Direct(32776), rhs: Direct(32775) }, JumpIf { condition: Direct(32778), location: 45 }, Load { destination: Direct(32774), source_pointer: Direct(32776) }, Store { destination_pointer: Direct(32777), source: Direct(32774) }, BinaryIntOp { destination: Direct(32776), op: Add, bit_size: U32, lhs: Direct(32776), rhs: Direct(2) }, BinaryIntOp { destination: Direct(32777), op: Add, bit_size: U32, lhs: Direct(32777), rhs: Direct(2) }, Jump { location: 38 }, Return, Const { destination: Direct(32835), bit_size: Field, value: 340282366920938463463374607431768211456 }, Const { destination: Direct(32836), bit_size: Integer(U1), value: 0 }, Const { destination: Direct(32837), bit_size: Integer(U32), value: 0 }, Const { destination: Direct(32838), bit_size: Field, value: 0 }, Const { destination: Direct(32839), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(32840), bit_size: Integer(U32), value: 2 }, Const { destination: Direct(32841), bit_size: Integer(U32), value: 3 }, Const { destination: Direct(32842), bit_size: Field, value: 2393473289045184898987089634332637236754766663897650125720167164137088869378 }, Const { destination: Direct(32843), bit_size: Field, value: 3728882899078719075161482178784387565366481897740339799480980287259621149274 }, Const { destination: Direct(32844), bit_size: Field, value: 8680525429001239497728366687280168587232520577698044359798894838135247199343 }, Const { destination: Direct(32845), bit_size: Field, value: -9903063709032878667290627648209915537972247634463802596148419711785767431332 }, Const { destination: Direct(32846), bit_size: Field, value: -7135402912423807765050323395026152633898511180575289670895350565966806597339 }, Return, Call { location: 407 }, Const { destination: Relative(8), bit_size: Field, value: 1 }, Const { destination: Relative(9), bit_size: Field, value: 17631683881184975370165255887551781615748388533673675138860 }, Mov { destination: Relative(10), source: Direct(1) }, Const { destination: Relative(11), bit_size: Integer(U32), value: 4 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(11) }, IndirectConst { destination_pointer: Relative(10), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(11), op: Add, bit_size: U32, lhs: Relative(10), rhs: Direct(2) }, Mov { destination: Relative(12), source: Relative(11) }, Store { destination_pointer: Relative(12), source: Relative(8) }, BinaryIntOp { destination: Relative(12), op: Add, bit_size: U32, lhs: Relative(12), rhs: Direct(2) }, Store { destination_pointer: Relative(12), source: Relative(9) }, BinaryIntOp { destination: Relative(12), op: Add, bit_size: U32, lhs: Relative(12), rhs: Direct(2) }, Store { destination_pointer: Relative(12), source: Direct(32836) }, Mov { destination: Relative(8), source: Direct(1) }, Const { destination: Relative(9), bit_size: Integer(U32), value: 3 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(9) }, IndirectConst { destination_pointer: Relative(8), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(9), op: Add, bit_size: U32, lhs: Relative(8), rhs: Direct(2) }, Mov { destination: Relative(11), source: Relative(9) }, Store { destination_pointer: Relative(11), source: Relative(1) }, BinaryIntOp { destination: Relative(11), op: Add, bit_size: U32, lhs: Relative(11), rhs: Direct(2) }, Store { destination_pointer: Relative(11), source: Direct(32838) }, Mov { destination: Relative(9), source: Direct(1) }, Const { destination: Relative(11), bit_size: Integer(U32), value: 4 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(11) }, IndirectConst { destination_pointer: Relative(9), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(11), op: Add, bit_size: U32, lhs: Relative(10), rhs: Direct(2) }, Const { destination: Relative(12), bit_size: Integer(U32), value: 3 }, BinaryIntOp { destination: Relative(13), op: Add, bit_size: U32, lhs: Relative(8), rhs: Direct(2) }, Const { destination: Relative(14), bit_size: Integer(U32), value: 2 }, BinaryIntOp { destination: Relative(15), op: Add, bit_size: U32, lhs: Relative(9), rhs: Direct(2) }, BlackBox(MultiScalarMul { points: HeapVector { pointer: Relative(11), size: Relative(12) }, scalars: HeapVector { pointer: Relative(13), size: Relative(14) }, outputs: HeapArray { pointer: Relative(15), size: 3 } }), BinaryIntOp { destination: Relative(10), op: Add, bit_size: U32, lhs: Relative(9), rhs: Direct(32839) }, Load { destination: Relative(8), source_pointer: Relative(10) }, BinaryIntOp { destination: Relative(11), op: Add, bit_size: U32, lhs: Relative(9), rhs: Direct(32840) }, Load { destination: Relative(10), source_pointer: Relative(11) }, Mov { destination: Relative(9), source: Direct(1) }, Const { destination: Relative(11), bit_size: Integer(U32), value: 3 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(11) }, IndirectConst { destination_pointer: Relative(9), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(11), op: Add, bit_size: U32, lhs: Relative(9), rhs: Direct(2) }, Mov { destination: Relative(12), source: Relative(11) }, Store { destination_pointer: Relative(12), source: Relative(8) }, BinaryIntOp { destination: Relative(12), op: Add, bit_size: U32, lhs: Relative(12), rhs: Direct(2) }, Store { destination_pointer: Relative(12), source: Relative(10) }, Mov { destination: Relative(8), source: Direct(1) }, Const { destination: Relative(10), bit_size: Integer(U32), value: 5 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(10) }, IndirectConst { destination_pointer: Relative(8), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(10), op: Add, bit_size: U32, lhs: Relative(8), rhs: Direct(2) }, Mov { destination: Relative(11), source: Relative(10) }, Store { destination_pointer: Relative(11), source: Direct(32838) }, BinaryIntOp { destination: Relative(11), op: Add, bit_size: U32, lhs: Relative(11), rhs: Direct(2) }, Store { destination_pointer: Relative(11), source: Direct(32838) }, BinaryIntOp { destination: Relative(11), op: Add, bit_size: U32, lhs: Relative(11), rhs: Direct(2) }, Store { destination_pointer: Relative(11), source: Direct(32838) }, BinaryIntOp { destination: Relative(11), op: Add, bit_size: U32, lhs: Relative(11), rhs: Direct(2) }, Store { destination_pointer: Relative(11), source: Direct(32838) }, Mov { destination: Relative(10), source: Direct(1) }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Direct(2) }, Store { destination_pointer: Relative(10), source: Relative(8) }, Mov { destination: Relative(7), source: Direct(32837) }, Jump { location: 123 }, BinaryIntOp { destination: Relative(8), op: LessThan, bit_size: U32, lhs: Relative(7), rhs: Direct(32840) }, JumpIf { condition: Relative(8), location: 373 }, Jump { location: 126 }, Mov { destination: Relative(8), source: Direct(1) }, Const { destination: Relative(9), bit_size: Integer(U32), value: 7 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(9) }, IndirectConst { destination_pointer: Relative(8), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(9), op: Add, bit_size: U32, lhs: Relative(8), rhs: Direct(2) }, Mov { destination: Relative(11), source: Relative(9) }, Store { destination_pointer: Relative(11), source: Direct(32843) }, BinaryIntOp { destination: Relative(11), op: Add, bit_size: U32, lhs: Relative(11), rhs: Direct(2) }, Store { destination_pointer: Relative(11), source: Direct(32845) }, BinaryIntOp { destination: Relative(11), op: Add, bit_size: U32, lhs: Relative(11), rhs: Direct(2) }, Store { destination_pointer: Relative(11), source: Direct(32836) }, BinaryIntOp { destination: Relative(11), op: Add, bit_size: U32, lhs: Relative(11), rhs: Direct(2) }, Store { destination_pointer: Relative(11), source: Direct(32842) }, BinaryIntOp { destination: Relative(11), op: Add, bit_size: U32, lhs: Relative(11), rhs: Direct(2) }, Store { destination_pointer: Relative(11), source: Direct(32846) }, BinaryIntOp { destination: Relative(11), op: Add, bit_size: U32, lhs: Relative(11), rhs: Direct(2) }, Store { destination_pointer: Relative(11), source: Direct(32836) }, Load { destination: Relative(9), source_pointer: Relative(10) }, Mov { destination: Relative(10), source: Direct(1) }, Const { destination: Relative(11), bit_size: Integer(U32), value: 4 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(11) }, IndirectConst { destination_pointer: Relative(10), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(11), op: Add, bit_size: U32, lhs: Relative(8), rhs: Direct(2) }, Const { destination: Relative(12), bit_size: Integer(U32), value: 6 }, BinaryIntOp { destination: Relative(13), op: Add, bit_size: U32, lhs: Relative(9), rhs: Direct(2) }, Const { destination: Relative(14), bit_size: Integer(U32), value: 4 }, BinaryIntOp { destination: Relative(15), op: Add, bit_size: U32, lhs: Relative(10), rhs: Direct(2) }, BlackBox(MultiScalarMul { points: HeapVector { pointer: Relative(11), size: Relative(12) }, scalars: HeapVector { pointer: Relative(13), size: Relative(14) }, outputs: HeapArray { pointer: Relative(15), size: 3 } }), BinaryIntOp { destination: Relative(11), op: Add, bit_size: U32, lhs: Relative(10), rhs: Direct(32839) }, Load { destination: Relative(9), source_pointer: Relative(11) }, Mov { destination: Relative(10), source: Direct(1) }, Const { destination: Relative(11), bit_size: Integer(U32), value: 4 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(11) }, IndirectConst { destination_pointer: Relative(10), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(11), op: Add, bit_size: U32, lhs: Relative(10), rhs: Direct(2) }, Mov { destination: Relative(12), source: Relative(11) }, Store { destination_pointer: Relative(12), source: Relative(9) }, BinaryIntOp { destination: Relative(12), op: Add, bit_size: U32, lhs: Relative(12), rhs: Direct(2) }, Store { destination_pointer: Relative(12), source: Relative(3) }, BinaryIntOp { destination: Relative(12), op: Add, bit_size: U32, lhs: Relative(12), rhs: Direct(2) }, Store { destination_pointer: Relative(12), source: Relative(1) }, Mov { destination: Relative(1), source: Direct(1) }, Const { destination: Relative(11), bit_size: Integer(U32), value: 7 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(11) }, IndirectConst { destination_pointer: Relative(1), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(11), op: Add, bit_size: U32, lhs: Relative(1), rhs: Direct(2) }, Mov { destination: Relative(12), source: Relative(11) }, Store { destination_pointer: Relative(12), source: Direct(32838) }, BinaryIntOp { destination: Relative(12), op: Add, bit_size: U32, lhs: Relative(12), rhs: Direct(2) }, Store { destination_pointer: Relative(12), source: Direct(32838) }, BinaryIntOp { destination: Relative(12), op: Add, bit_size: U32, lhs: Relative(12), rhs: Direct(2) }, Store { destination_pointer: Relative(12), source: Direct(32838) }, BinaryIntOp { destination: Relative(12), op: Add, bit_size: U32, lhs: Relative(12), rhs: Direct(2) }, Store { destination_pointer: Relative(12), source: Direct(32838) }, BinaryIntOp { destination: Relative(12), op: Add, bit_size: U32, lhs: Relative(12), rhs: Direct(2) }, Store { destination_pointer: Relative(12), source: Direct(32838) }, BinaryIntOp { destination: Relative(12), op: Add, bit_size: U32, lhs: Relative(12), rhs: Direct(2) }, Store { destination_pointer: Relative(12), source: Direct(32838) }, Mov { destination: Relative(11), source: Direct(1) }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Direct(2) }, Store { destination_pointer: Relative(11), source: Relative(1) }, Mov { destination: Relative(7), source: Direct(32837) }, Jump { location: 189 }, BinaryIntOp { destination: Relative(1), op: LessThan, bit_size: U32, lhs: Relative(7), rhs: Direct(32841) }, JumpIf { condition: Relative(1), location: 339 }, Jump { location: 192 }, Const { destination: Relative(7), bit_size: Field, value: -9101662836674550326256996212378706138142399878494295154626728833686305224889 }, Const { destination: Relative(10), bit_size: Field, value: 1658946642478826263901298755938807527017017780224674388532518006781615929512 }, Mov { destination: Relative(12), source: Direct(1) }, Const { destination: Relative(13), bit_size: Integer(U32), value: 10 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(13) }, IndirectConst { destination_pointer: Relative(12), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(13), op: Add, bit_size: U32, lhs: Relative(12), rhs: Direct(2) }, Mov { destination: Relative(14), source: Relative(13) }, Store { destination_pointer: Relative(14), source: Direct(32843) }, BinaryIntOp { destination: Relative(14), op: Add, bit_size: U32, lhs: Relative(14), rhs: Direct(2) }, Store { destination_pointer: Relative(14), source: Direct(32845) }, BinaryIntOp { destination: Relative(14), op: Add, bit_size: U32, lhs: Relative(14), rhs: Direct(2) }, Store { destination_pointer: Relative(14), source: Direct(32836) }, BinaryIntOp { destination: Relative(14), op: Add, bit_size: U32, lhs: Relative(14), rhs: Direct(2) }, Store { destination_pointer: Relative(14), source: Direct(32842) }, BinaryIntOp { destination: Relative(14), op: Add, bit_size: U32, lhs: Relative(14), rhs: Direct(2) }, Store { destination_pointer: Relative(14), source: Direct(32846) }, BinaryIntOp { destination: Relative(14), op: Add, bit_size: U32, lhs: Relative(14), rhs: Direct(2) }, Store { destination_pointer: Relative(14), source: Direct(32836) }, BinaryIntOp { destination: Relative(14), op: Add, bit_size: U32, lhs: Relative(14), rhs: Direct(2) }, Store { destination_pointer: Relative(14), source: Relative(7) }, BinaryIntOp { destination: Relative(14), op: Add, bit_size: U32, lhs: Relative(14), rhs: Direct(2) }, Store { destination_pointer: Relative(14), source: Relative(10) }, BinaryIntOp { destination: Relative(14), op: Add, bit_size: U32, lhs: Relative(14), rhs: Direct(2) }, Store { destination_pointer: Relative(14), source: Direct(32836) }, Load { destination: Relative(7), source_pointer: Relative(11) }, Mov { destination: Relative(10), source: Direct(1) }, Const { destination: Relative(11), bit_size: Integer(U32), value: 4 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(11) }, IndirectConst { destination_pointer: Relative(10), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(11), op: Add, bit_size: U32, lhs: Relative(12), rhs: Direct(2) }, Const { destination: Relative(13), bit_size: Integer(U32), value: 9 }, BinaryIntOp { destination: Relative(14), op: Add, bit_size: U32, lhs: Relative(7), rhs: Direct(2) }, Const { destination: Relative(15), bit_size: Integer(U32), value: 6 }, BinaryIntOp { destination: Relative(16), op: Add, bit_size: U32, lhs: Relative(10), rhs: Direct(2) }, BlackBox(MultiScalarMul { points: HeapVector { pointer: Relative(11), size: Relative(13) }, scalars: HeapVector { pointer: Relative(14), size: Relative(15) }, outputs: HeapArray { pointer: Relative(16), size: 3 } }), BinaryIntOp { destination: Relative(11), op: Add, bit_size: U32, lhs: Relative(10), rhs: Direct(32839) }, Load { destination: Relative(7), source_pointer: Relative(11) }, Mov { destination: Relative(10), source: Direct(1) }, Const { destination: Relative(11), bit_size: Integer(U32), value: 3 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(11) }, IndirectConst { destination_pointer: Relative(10), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(11), op: Add, bit_size: U32, lhs: Relative(10), rhs: Direct(2) }, Mov { destination: Relative(12), source: Relative(11) }, Store { destination_pointer: Relative(12), source: Relative(5) }, BinaryIntOp { destination: Relative(12), op: Add, bit_size: U32, lhs: Relative(12), rhs: Direct(2) }, Store { destination_pointer: Relative(12), source: Relative(6) }, Mov { destination: Relative(5), source: Direct(1) }, Const { destination: Relative(6), bit_size: Integer(U32), value: 5 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(6) }, IndirectConst { destination_pointer: Relative(5), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(6), op: Add, bit_size: U32, lhs: Relative(5), rhs: Direct(2) }, Mov { destination: Relative(11), source: Relative(6) }, Store { destination_pointer: Relative(11), source: Direct(32838) }, BinaryIntOp { destination: Relative(11), op: Add, bit_size: U32, lhs: Relative(11), rhs: Direct(2) }, Store { destination_pointer: Relative(11), source: Direct(32838) }, BinaryIntOp { destination: Relative(11), op: Add, bit_size: U32, lhs: Relative(11), rhs: Direct(2) }, Store { destination_pointer: Relative(11), source: Direct(32838) }, BinaryIntOp { destination: Relative(11), op: Add, bit_size: U32, lhs: Relative(11), rhs: Direct(2) }, Store { destination_pointer: Relative(11), source: Direct(32838) }, Mov { destination: Relative(6), source: Direct(1) }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Direct(2) }, Store { destination_pointer: Relative(6), source: Relative(5) }, Mov { destination: Relative(1), source: Direct(32837) }, Jump { location: 257 }, BinaryIntOp { destination: Relative(5), op: LessThan, bit_size: U32, lhs: Relative(1), rhs: Direct(32840) }, JumpIf { condition: Relative(5), location: 305 }, Jump { location: 260 }, Load { destination: Relative(1), source_pointer: Relative(8) }, Const { destination: Relative(5), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(10), op: Equals, bit_size: U32, lhs: Relative(5), rhs: Relative(1) }, Not { destination: Relative(10), source: Relative(10), bit_size: U1 }, JumpIf { condition: Relative(10), location: 266 }, Call { location: 413 }, BinaryIntOp { destination: Relative(1), op: Add, bit_size: U32, lhs: Relative(1), rhs: Direct(2) }, Store { destination_pointer: Relative(8), source: Relative(1) }, Load { destination: Relative(1), source_pointer: Relative(6) }, Mov { destination: Relative(6), source: Direct(1) }, Const { destination: Relative(10), bit_size: Integer(U32), value: 4 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(10) }, IndirectConst { destination_pointer: Relative(6), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(10), op: Add, bit_size: U32, lhs: Relative(8), rhs: Direct(2) }, Const { destination: Relative(11), bit_size: Integer(U32), value: 6 }, BinaryIntOp { destination: Relative(12), op: Add, bit_size: U32, lhs: Relative(1), rhs: Direct(2) }, Const { destination: Relative(13), bit_size: Integer(U32), value: 4 }, BinaryIntOp { destination: Relative(14), op: Add, bit_size: U32, lhs: Relative(6), rhs: Direct(2) }, BlackBox(MultiScalarMul { points: HeapVector { pointer: Relative(10), size: Relative(11) }, scalars: HeapVector { pointer: Relative(12), size: Relative(13) }, outputs: HeapArray { pointer: Relative(14), size: 3 } }), BinaryIntOp { destination: Relative(8), op: Add, bit_size: U32, lhs: Relative(6), rhs: Direct(32839) }, Load { destination: Relative(1), source_pointer: Relative(8) }, Const { destination: Relative(8), bit_size: Integer(U32), value: 10 }, Mov { destination: Relative(10), source: Direct(0) }, Mov { destination: Relative(11), source: Relative(9) }, Mov { destination: Relative(12), source: Relative(3) }, Mov { destination: Relative(13), source: Relative(4) }, BinaryIntOp { destination: Direct(0), op: Add, bit_size: U32, lhs: Direct(0), rhs: Relative(8) }, Call { location: 416 }, Mov { destination: Direct(0), source: Relative(0) }, Mov { destination: Relative(6), source: Relative(11) }, BinaryFieldOp { destination: Relative(3), op: Equals, lhs: Relative(2), rhs: Relative(6) }, JumpIf { condition: Relative(3), location: 294 }, Const { destination: Relative(4), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(4) } }, Mov { destination: Relative(2), source: Direct(1) }, Const { destination: Relative(3), bit_size: Integer(U32), value: 3 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(3) }, IndirectConst { destination_pointer: Relative(2), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(3), op: Add, bit_size: U32, lhs: Relative(2), rhs: Direct(2) }, Mov { destination: Relative(4), source: Relative(3) }, Store { destination_pointer: Relative(4), source: Relative(7) }, BinaryIntOp { destination: Relative(4), op: Add, bit_size: U32, lhs: Relative(4), rhs: Direct(2) }, Store { destination_pointer: Relative(4), source: Relative(1) }, Mov { destination: Relative(1), source: Relative(2) }, Return, BinaryIntOp { destination: Relative(11), op: Add, bit_size: U32, lhs: Relative(10), rhs: Direct(2) }, BinaryIntOp { destination: Relative(12), op: Add, bit_size: U32, lhs: Relative(11), rhs: Relative(1) }, Load { destination: Relative(5), source_pointer: Relative(12) }, Cast { destination: Relative(12), source: Relative(5), bit_size: Integer(U128) }, Cast { destination: Relative(11), source: Relative(12), bit_size: Field }, BinaryFieldOp { destination: Relative(12), op: Sub, lhs: Relative(5), rhs: Relative(11) }, BinaryFieldOp { destination: Relative(13), op: Mul, lhs: Relative(12), rhs: Direct(32844) }, BinaryFieldOp { destination: Relative(12), op: Mul, lhs: Direct(32835), rhs: Relative(13) }, BinaryFieldOp { destination: Relative(14), op: Add, lhs: Relative(11), rhs: Relative(12) }, BinaryFieldOp { destination: Relative(12), op: Equals, lhs: Relative(5), rhs: Relative(14) }, JumpIf { condition: Relative(12), location: 318 }, Const { destination: Relative(15), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(15) } }, Load { destination: Relative(5), source_pointer: Relative(6) }, BinaryIntOp { destination: Relative(12), op: Mul, bit_size: U32, lhs: Relative(1), rhs: Direct(32840) }, Mov { destination: Direct(32771), source: Relative(5) }, Const { destination: Direct(32772), bit_size: Integer(U32), value: 5 }, Call { location: 665 }, Mov { destination: Relative(14), source: Direct(32773) }, BinaryIntOp { destination: Relative(15), op: Add, bit_size: U32, lhs: Relative(14), rhs: Direct(2) }, BinaryIntOp { destination: Relative(16), op: Add, bit_size: U32, lhs: Relative(15), rhs: Relative(12) }, Store { destination_pointer: Relative(16), source: Relative(11) }, BinaryIntOp { destination: Relative(5), op: Add, bit_size: U32, lhs: Relative(12), rhs: Direct(32839) }, Mov { destination: Direct(32771), source: Relative(14) }, Const { destination: Direct(32772), bit_size: Integer(U32), value: 5 }, Call { location: 665 }, Mov { destination: Relative(11), source: Direct(32773) }, BinaryIntOp { destination: Relative(12), op: Add, bit_size: U32, lhs: Relative(11), rhs: Direct(2) }, BinaryIntOp { destination: Relative(15), op: Add, bit_size: U32, lhs: Relative(12), rhs: Relative(5) }, Store { destination_pointer: Relative(15), source: Relative(13) }, Store { destination_pointer: Relative(6), source: Relative(11) }, BinaryIntOp { destination: Relative(5), op: Add, bit_size: U32, lhs: Relative(1), rhs: Direct(32839) }, Mov { destination: Relative(1), source: Relative(5) }, Jump { location: 257 }, BinaryIntOp { destination: Relative(12), op: Add, bit_size: U32, lhs: Relative(10), rhs: Direct(2) }, BinaryIntOp { destination: Relative(13), op: Add, bit_size: U32, lhs: Relative(12), rhs: Relative(7) }, Load { destination: Relative(1), source_pointer: Relative(13) }, Cast { destination: Relative(13), source: Relative(1), bit_size: Integer(U128) }, Cast { destination: Relative(12), source: Relative(13), bit_size: Field }, BinaryFieldOp { destination: Relative(13), op: Sub, lhs: Relative(1), rhs: Relative(12) }, BinaryFieldOp { destination: Relative(14), op: Mul, lhs: Relative(13), rhs: Direct(32844) }, BinaryFieldOp { destination: Relative(13), op: Mul, lhs: Direct(32835), rhs: Relative(14) }, BinaryFieldOp { destination: Relative(15), op: Add, lhs: Relative(12), rhs: Relative(13) }, BinaryFieldOp { destination: Relative(13), op: Equals, lhs: Relative(1), rhs: Relative(15) }, JumpIf { condition: Relative(13), location: 352 }, Const { destination: Relative(16), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(16) } }, Load { destination: Relative(1), source_pointer: Relative(11) }, BinaryIntOp { destination: Relative(13), op: Mul, bit_size: U32, lhs: Relative(7), rhs: Direct(32840) }, Mov { destination: Direct(32771), source: Relative(1) }, Const { destination: Direct(32772), bit_size: Integer(U32), value: 7 }, Call { location: 665 }, Mov { destination: Relative(15), source: Direct(32773) }, BinaryIntOp { destination: Relative(16), op: Add, bit_size: U32, lhs: Relative(15), rhs: Direct(2) }, BinaryIntOp { destination: Relative(17), op: Add, bit_size: U32, lhs: Relative(16), rhs: Relative(13) }, Store { destination_pointer: Relative(17), source: Relative(12) }, BinaryIntOp { destination: Relative(1), op: Add, bit_size: U32, lhs: Relative(13), rhs: Direct(32839) }, Mov { destination: Direct(32771), source: Relative(15) }, Const { destination: Direct(32772), bit_size: Integer(U32), value: 7 }, Call { location: 665 }, Mov { destination: Relative(12), source: Direct(32773) }, BinaryIntOp { destination: Relative(13), op: Add, bit_size: U32, lhs: Relative(12), rhs: Direct(2) }, BinaryIntOp { destination: Relative(16), op: Add, bit_size: U32, lhs: Relative(13), rhs: Relative(1) }, Store { destination_pointer: Relative(16), source: Relative(14) }, Store { destination_pointer: Relative(11), source: Relative(12) }, BinaryIntOp { destination: Relative(1), op: Add, bit_size: U32, lhs: Relative(7), rhs: Direct(32839) }, Mov { destination: Relative(7), source: Relative(1) }, Jump { location: 189 }, BinaryIntOp { destination: Relative(11), op: Add, bit_size: U32, lhs: Relative(9), rhs: Direct(2) }, BinaryIntOp { destination: Relative(12), op: Add, bit_size: U32, lhs: Relative(11), rhs: Relative(7) }, Load { destination: Relative(8), source_pointer: Relative(12) }, Cast { destination: Relative(12), source: Relative(8), bit_size: Integer(U128) }, Cast { destination: Relative(11), source: Relative(12), bit_size: Field }, BinaryFieldOp { destination: Relative(12), op: Sub, lhs: Relative(8), rhs: Relative(11) }, BinaryFieldOp { destination: Relative(13), op: Mul, lhs: Relative(12), rhs: Direct(32844) }, BinaryFieldOp { destination: Relative(12), op: Mul, lhs: Direct(32835), rhs: Relative(13) }, BinaryFieldOp { destination: Relative(14), op: Add, lhs: Relative(11), rhs: Relative(12) }, BinaryFieldOp { destination: Relative(12), op: Equals, lhs: Relative(8), rhs: Relative(14) }, JumpIf { condition: Relative(12), location: 386 }, Const { destination: Relative(15), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(15) } }, Load { destination: Relative(8), source_pointer: Relative(10) }, BinaryIntOp { destination: Relative(12), op: Mul, bit_size: U32, lhs: Relative(7), rhs: Direct(32840) }, Mov { destination: Direct(32771), source: Relative(8) }, Const { destination: Direct(32772), bit_size: Integer(U32), value: 5 }, Call { location: 665 }, Mov { destination: Relative(14), source: Direct(32773) }, BinaryIntOp { destination: Relative(15), op: Add, bit_size: U32, lhs: Relative(14), rhs: Direct(2) }, BinaryIntOp { destination: Relative(16), op: Add, bit_size: U32, lhs: Relative(15), rhs: Relative(12) }, Store { destination_pointer: Relative(16), source: Relative(11) }, BinaryIntOp { destination: Relative(8), op: Add, bit_size: U32, lhs: Relative(12), rhs: Direct(32839) }, Mov { destination: Direct(32771), source: Relative(14) }, Const { destination: Direct(32772), bit_size: Integer(U32), value: 5 }, Call { location: 665 }, Mov { destination: Relative(11), source: Direct(32773) }, BinaryIntOp { destination: Relative(12), op: Add, bit_size: U32, lhs: Relative(11), rhs: Direct(2) }, BinaryIntOp { destination: Relative(15), op: Add, bit_size: U32, lhs: Relative(12), rhs: Relative(8) }, Store { destination_pointer: Relative(15), source: Relative(13) }, Store { destination_pointer: Relative(10), source: Relative(11) }, BinaryIntOp { destination: Relative(8), op: Add, bit_size: U32, lhs: Relative(7), rhs: Direct(32839) }, Mov { destination: Relative(7), source: Relative(8) }, Jump { location: 123 }, 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: 412 }, 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, Call { location: 407 }, Const { destination: Relative(6), bit_size: Integer(U32), value: 2 }, Const { destination: Relative(7), bit_size: Integer(U1), value: 1 }, Mov { destination: Relative(5), source: Direct(1) }, Const { destination: Relative(8), bit_size: Integer(U32), value: 4 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(8) }, IndirectConst { destination_pointer: Relative(5), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(8), op: Add, bit_size: U32, lhs: Relative(5), rhs: Direct(2) }, Const { destination: Relative(9), bit_size: Integer(U32), value: 3 }, BlackBox(ToRadix { input: Relative(2), radix: Relative(6), output_pointer: Relative(8), num_limbs: Relative(9), output_bits: Relative(7) }), Const { destination: Relative(10), bit_size: Integer(U32), value: 3 }, Mov { destination: Direct(32771), source: Relative(8) }, Mov { destination: Direct(32772), source: Relative(10) }, Call { location: 687 }, Mov { destination: Relative(2), source: Direct(1) }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Direct(2) }, Store { destination_pointer: Relative(2), source: Relative(1) }, Const { destination: Relative(1), bit_size: Integer(U1), value: 1 }, Const { destination: Relative(6), bit_size: Field, value: 2 }, Const { destination: Relative(7), bit_size: Integer(U32), value: 5 }, Const { destination: Relative(8), bit_size: Integer(U32), value: 6 }, Const { destination: Relative(9), bit_size: Field, value: -1094708040843609169356775910874053498301840173462935739639689208799068762676 }, Const { destination: Relative(10), bit_size: Integer(U32), value: 7 }, Const { destination: Relative(11), bit_size: Field, value: -718703907181967287621274717949248537252263842169639534402461291799004475262 }, Const { destination: Relative(12), bit_size: Integer(U32), value: 8 }, Const { destination: Relative(13), bit_size: Integer(U32), value: 9 }, Mov { destination: Relative(4), source: Direct(32837) }, Jump { location: 444 }, BinaryIntOp { destination: Relative(14), op: LessThan, bit_size: U32, lhs: Relative(4), rhs: Direct(32841) }, JumpIf { condition: Relative(14), location: 449 }, Jump { location: 447 }, Load { destination: Relative(1), source_pointer: Relative(2) }, Return, BinaryIntOp { destination: Relative(17), op: Add, bit_size: U32, lhs: Relative(5), rhs: Direct(2) }, BinaryIntOp { destination: Relative(18), op: Add, bit_size: U32, lhs: Relative(17), rhs: Relative(4) }, Load { destination: Relative(16), source_pointer: Relative(18) }, JumpIf { condition: Relative(16), location: 461 }, Jump { location: 454 }, Load { destination: Relative(16), source_pointer: Relative(2) }, BinaryIntOp { destination: Relative(18), op: Add, bit_size: U32, lhs: Relative(3), rhs: Direct(2) }, BinaryIntOp { destination: Relative(19), op: Add, bit_size: U32, lhs: Relative(18), rhs: Relative(4) }, Load { destination: Relative(17), source_pointer: Relative(19) }, Mov { destination: Relative(14), source: Relative(16) }, Mov { destination: Relative(15), source: Relative(17) }, Jump { location: 468 }, BinaryIntOp { destination: Relative(17), op: Add, bit_size: U32, lhs: Relative(3), rhs: Direct(2) }, BinaryIntOp { destination: Relative(18), op: Add, bit_size: U32, lhs: Relative(17), rhs: Relative(4) }, Load { destination: Relative(16), source_pointer: Relative(18) }, Load { destination: Relative(17), source_pointer: Relative(2) }, Mov { destination: Relative(14), source: Relative(16) }, Mov { destination: Relative(15), source: Relative(17) }, Jump { location: 468 }, Mov { destination: Relative(17), source: Direct(1) }, Const { destination: Relative(18), bit_size: Integer(U32), value: 3 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(18) }, IndirectConst { destination_pointer: Relative(17), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(18), op: Add, bit_size: U32, lhs: Relative(17), rhs: Direct(2) }, Mov { destination: Relative(19), source: Relative(18) }, Store { destination_pointer: Relative(19), source: Relative(14) }, BinaryIntOp { destination: Relative(19), op: Add, bit_size: U32, lhs: Relative(19), rhs: Direct(2) }, Store { destination_pointer: Relative(19), source: Relative(15) }, Mov { destination: Relative(14), source: Direct(1) }, Const { destination: Relative(15), bit_size: Integer(U32), value: 7 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(15) }, IndirectConst { destination_pointer: Relative(14), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(15), op: Add, bit_size: U32, lhs: Relative(14), rhs: Direct(2) }, Mov { destination: Relative(18), source: Relative(15) }, Store { destination_pointer: Relative(18), source: Direct(32838) }, BinaryIntOp { destination: Relative(18), op: Add, bit_size: U32, lhs: Relative(18), rhs: Direct(2) }, Store { destination_pointer: Relative(18), source: Direct(32838) }, BinaryIntOp { destination: Relative(18), op: Add, bit_size: U32, lhs: Relative(18), rhs: Direct(2) }, Store { destination_pointer: Relative(18), source: Direct(32838) }, BinaryIntOp { destination: Relative(18), op: Add, bit_size: U32, lhs: Relative(18), rhs: Direct(2) }, Store { destination_pointer: Relative(18), source: Direct(32838) }, BinaryIntOp { destination: Relative(18), op: Add, bit_size: U32, lhs: Relative(18), rhs: Direct(2) }, Store { destination_pointer: Relative(18), source: Direct(32838) }, BinaryIntOp { destination: Relative(18), op: Add, bit_size: U32, lhs: Relative(18), rhs: Direct(2) }, Store { destination_pointer: Relative(18), source: Direct(32838) }, Mov { destination: Relative(15), source: Direct(1) }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Direct(2) }, Store { destination_pointer: Relative(15), source: Relative(14) }, Mov { destination: Relative(14), source: Direct(1) }, Const { destination: Relative(18), bit_size: Integer(U32), value: 10 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(18) }, IndirectConst { destination_pointer: Relative(14), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(18), op: Add, bit_size: U32, lhs: Relative(14), rhs: Direct(2) }, Mov { destination: Relative(19), source: Relative(18) }, Store { destination_pointer: Relative(19), source: Direct(32838) }, BinaryIntOp { destination: Relative(19), op: Add, bit_size: U32, lhs: Relative(19), rhs: Direct(2) }, Store { destination_pointer: Relative(19), source: Direct(32838) }, BinaryIntOp { destination: Relative(19), op: Add, bit_size: U32, lhs: Relative(19), rhs: Direct(2) }, Store { destination_pointer: Relative(19), source: Relative(1) }, BinaryIntOp { destination: Relative(19), op: Add, bit_size: U32, lhs: Relative(19), rhs: Direct(2) }, Store { destination_pointer: Relative(19), source: Direct(32838) }, BinaryIntOp { destination: Relative(19), op: Add, bit_size: U32, lhs: Relative(19), rhs: Direct(2) }, Store { destination_pointer: Relative(19), source: Direct(32838) }, BinaryIntOp { destination: Relative(19), op: Add, bit_size: U32, lhs: Relative(19), rhs: Direct(2) }, Store { destination_pointer: Relative(19), source: Relative(1) }, BinaryIntOp { destination: Relative(19), op: Add, bit_size: U32, lhs: Relative(19), rhs: Direct(2) }, Store { destination_pointer: Relative(19), source: Direct(32838) }, BinaryIntOp { destination: Relative(19), op: Add, bit_size: U32, lhs: Relative(19), rhs: Direct(2) }, Store { destination_pointer: Relative(19), source: Direct(32838) }, BinaryIntOp { destination: Relative(19), op: Add, bit_size: U32, lhs: Relative(19), rhs: Direct(2) }, Store { destination_pointer: Relative(19), source: Relative(1) }, Mov { destination: Relative(18), source: Direct(1) }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Direct(2) }, Store { destination_pointer: Relative(18), source: Relative(14) }, Mov { destination: Relative(14), source: Direct(1) }, Const { destination: Relative(19), bit_size: Integer(U32), value: 7 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(19) }, IndirectConst { destination_pointer: Relative(14), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(19), op: Add, bit_size: U32, lhs: Relative(14), rhs: Direct(2) }, Mov { destination: Relative(20), source: Relative(19) }, Store { destination_pointer: Relative(20), source: Direct(32843) }, BinaryIntOp { destination: Relative(20), op: Add, bit_size: U32, lhs: Relative(20), rhs: Direct(2) }, Store { destination_pointer: Relative(20), source: Direct(32845) }, BinaryIntOp { destination: Relative(20), op: Add, bit_size: U32, lhs: Relative(20), rhs: Direct(2) }, Store { destination_pointer: Relative(20), source: Direct(32836) }, BinaryIntOp { destination: Relative(20), op: Add, bit_size: U32, lhs: Relative(20), rhs: Direct(2) }, Store { destination_pointer: Relative(20), source: Direct(32842) }, BinaryIntOp { destination: Relative(20), op: Add, bit_size: U32, lhs: Relative(20), rhs: Direct(2) }, Store { destination_pointer: Relative(20), source: Direct(32846) }, BinaryIntOp { destination: Relative(20), op: Add, bit_size: U32, lhs: Relative(20), rhs: Direct(2) }, Store { destination_pointer: Relative(20), source: Direct(32836) }, Mov { destination: Relative(16), source: Direct(32837) }, Jump { location: 542 }, BinaryIntOp { destination: Relative(19), op: LessThan, bit_size: U32, lhs: Relative(16), rhs: Direct(32840) }, JumpIf { condition: Relative(19), location: 595 }, Jump { location: 545 }, Load { destination: Relative(14), source_pointer: Relative(15) }, Mov { destination: Direct(32771), source: Relative(14) }, Const { destination: Direct(32772), bit_size: Integer(U32), value: 7 }, Call { location: 665 }, Mov { destination: Relative(16), source: Direct(32773) }, BinaryIntOp { destination: Relative(17), op: Add, bit_size: U32, lhs: Relative(16), rhs: Relative(7) }, Store { destination_pointer: Relative(17), source: Relative(6) }, Mov { destination: Direct(32771), source: Relative(16) }, Const { destination: Direct(32772), bit_size: Integer(U32), value: 7 }, Call { location: 665 }, Mov { destination: Relative(14), source: Direct(32773) }, BinaryIntOp { destination: Relative(17), op: Add, bit_size: U32, lhs: Relative(14), rhs: Relative(8) }, Store { destination_pointer: Relative(17), source: Direct(32838) }, Store { destination_pointer: Relative(15), source: Relative(14) }, Load { destination: Relative(15), source_pointer: Relative(18) }, Mov { destination: Direct(32771), source: Relative(15) }, Const { destination: Direct(32772), bit_size: Integer(U32), value: 10 }, Call { location: 665 }, Mov { destination: Relative(16), source: Direct(32773) }, BinaryIntOp { destination: Relative(17), op: Add, bit_size: U32, lhs: Relative(16), rhs: Relative(10) }, Store { destination_pointer: Relative(17), source: Relative(9) }, Mov { destination: Direct(32771), source: Relative(16) }, Const { destination: Direct(32772), bit_size: Integer(U32), value: 10 }, Call { location: 665 }, Mov { destination: Relative(15), source: Direct(32773) }, BinaryIntOp { destination: Relative(17), op: Add, bit_size: U32, lhs: Relative(15), rhs: Relative(12) }, Store { destination_pointer: Relative(17), source: Relative(11) }, Mov { destination: Direct(32771), source: Relative(15) }, Const { destination: Direct(32772), bit_size: Integer(U32), value: 10 }, Call { location: 665 }, Mov { destination: Relative(16), source: Direct(32773) }, BinaryIntOp { destination: Relative(17), op: Add, bit_size: U32, lhs: Relative(16), rhs: Relative(13) }, Store { destination_pointer: Relative(17), source: Direct(32836) }, Store { destination_pointer: Relative(18), source: Relative(16) }, Mov { destination: Relative(15), source: Direct(1) }, Const { destination: Relative(17), bit_size: Integer(U32), value: 4 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(17) }, IndirectConst { destination_pointer: Relative(15), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(17), op: Add, bit_size: U32, lhs: Relative(16), rhs: Direct(2) }, Const { destination: Relative(18), bit_size: Integer(U32), value: 9 }, BinaryIntOp { destination: Relative(19), op: Add, bit_size: U32, lhs: Relative(14), rhs: Direct(2) }, Const { destination: Relative(20), bit_size: Integer(U32), value: 6 }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(15), rhs: Direct(2) }, BlackBox(MultiScalarMul { points: HeapVector { pointer: Relative(17), size: Relative(18) }, scalars: HeapVector { pointer: Relative(19), size: Relative(20) }, outputs: HeapArray { pointer: Relative(21), size: 3 } }), BinaryIntOp { destination: Relative(16), op: Add, bit_size: U32, lhs: Relative(15), rhs: Direct(32839) }, Load { destination: Relative(14), source_pointer: Relative(16) }, Store { destination_pointer: Relative(2), source: Relative(14) }, BinaryIntOp { destination: Relative(14), op: Add, bit_size: U32, lhs: Relative(4), rhs: Direct(32839) }, Mov { destination: Relative(4), source: Relative(14) }, Jump { location: 444 }, BinaryIntOp { destination: Relative(20), op: Add, bit_size: U32, lhs: Relative(17), rhs: Direct(2) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(20), rhs: Relative(16) }, Load { destination: Relative(19), source_pointer: Relative(21) }, Cast { destination: Relative(21), source: Relative(19), bit_size: Integer(U128) }, Cast { destination: Relative(20), source: Relative(21), bit_size: Field }, BinaryFieldOp { destination: Relative(21), op: Sub, lhs: Relative(19), rhs: Relative(20) }, BinaryFieldOp { destination: Relative(22), op: Mul, lhs: Relative(21), rhs: Direct(32844) }, BinaryFieldOp { destination: Relative(21), op: Mul, lhs: Direct(32835), rhs: Relative(22) }, BinaryFieldOp { destination: Relative(23), op: Add, lhs: Relative(20), rhs: Relative(21) }, BinaryFieldOp { destination: Relative(21), op: Equals, lhs: Relative(19), rhs: Relative(23) }, JumpIf { condition: Relative(21), location: 608 }, Const { destination: Relative(24), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(24) } }, Load { destination: Relative(19), source_pointer: Relative(15) }, BinaryIntOp { destination: Relative(21), op: Mul, bit_size: U32, lhs: Relative(16), rhs: Direct(32840) }, Mov { destination: Direct(32771), source: Relative(19) }, Const { destination: Direct(32772), bit_size: Integer(U32), value: 7 }, Call { location: 665 }, Mov { destination: Relative(23), source: Direct(32773) }, BinaryIntOp { destination: Relative(24), op: Add, bit_size: U32, lhs: Relative(23), rhs: Direct(2) }, BinaryIntOp { destination: Relative(25), op: Add, bit_size: U32, lhs: Relative(24), rhs: Relative(21) }, Store { destination_pointer: Relative(25), source: Relative(20) }, BinaryIntOp { destination: Relative(19), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(32839) }, Mov { destination: Direct(32771), source: Relative(23) }, Const { destination: Direct(32772), bit_size: Integer(U32), value: 7 }, Call { location: 665 }, Mov { destination: Relative(20), source: Direct(32773) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(20), rhs: Direct(2) }, BinaryIntOp { destination: Relative(24), op: Add, bit_size: U32, lhs: Relative(21), rhs: Relative(19) }, Store { destination_pointer: Relative(24), source: Relative(22) }, Store { destination_pointer: Relative(15), source: Relative(20) }, BinaryIntOp { destination: Relative(19), op: Mul, bit_size: U32, lhs: Relative(16), rhs: Direct(32841) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(14), rhs: Direct(2) }, BinaryIntOp { destination: Relative(22), op: Add, bit_size: U32, lhs: Relative(21), rhs: Relative(19) }, Load { destination: Relative(20), source_pointer: Relative(22) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(19), rhs: Direct(32839) }, BinaryIntOp { destination: Relative(23), op: Add, bit_size: U32, lhs: Relative(14), rhs: Direct(2) }, BinaryIntOp { destination: Relative(24), op: Add, bit_size: U32, lhs: Relative(23), rhs: Relative(21) }, Load { destination: Relative(22), source_pointer: Relative(24) }, BinaryIntOp { destination: Relative(23), op: Add, bit_size: U32, lhs: Relative(19), rhs: Direct(32840) }, BinaryIntOp { destination: Relative(25), op: Add, bit_size: U32, lhs: Relative(14), rhs: Direct(2) }, BinaryIntOp { destination: Relative(26), op: Add, bit_size: U32, lhs: Relative(25), rhs: Relative(23) }, Load { destination: Relative(24), source_pointer: Relative(26) }, Load { destination: Relative(23), source_pointer: Relative(18) }, Mov { destination: Direct(32771), source: Relative(23) }, Const { destination: Direct(32772), bit_size: Integer(U32), value: 10 }, Call { location: 665 }, Mov { destination: Relative(25), source: Direct(32773) }, BinaryIntOp { destination: Relative(26), op: Add, bit_size: U32, lhs: Relative(25), rhs: Direct(2) }, BinaryIntOp { destination: Relative(27), op: Add, bit_size: U32, lhs: Relative(26), rhs: Relative(19) }, Store { destination_pointer: Relative(27), source: Relative(20) }, Mov { destination: Direct(32771), source: Relative(25) }, Const { destination: Direct(32772), bit_size: Integer(U32), value: 10 }, Call { location: 665 }, Mov { destination: Relative(19), source: Direct(32773) }, BinaryIntOp { destination: Relative(20), op: Add, bit_size: U32, lhs: Relative(19), rhs: Direct(2) }, BinaryIntOp { destination: Relative(23), op: Add, bit_size: U32, lhs: Relative(20), rhs: Relative(21) }, Store { destination_pointer: Relative(23), source: Relative(22) }, BinaryIntOp { destination: Relative(20), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(32839) }, Mov { destination: Direct(32771), source: Relative(19) }, Const { destination: Direct(32772), bit_size: Integer(U32), value: 10 }, Call { location: 665 }, Mov { destination: Relative(21), source: Direct(32773) }, BinaryIntOp { destination: Relative(22), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, BinaryIntOp { destination: Relative(23), op: Add, bit_size: U32, lhs: Relative(22), rhs: Relative(20) }, Store { destination_pointer: Relative(23), source: Relative(24) }, Store { destination_pointer: Relative(18), source: Relative(21) }, BinaryIntOp { destination: Relative(19), op: Add, bit_size: U32, lhs: Relative(16), rhs: Direct(32839) }, Mov { destination: Relative(16), source: Relative(19) }, Jump { location: 542 }, Load { destination: Direct(32774), source_pointer: Direct(32771) }, BinaryIntOp { destination: Direct(32775), op: Equals, bit_size: U32, lhs: Direct(32774), rhs: Direct(2) }, JumpIf { condition: Direct(32775), location: 669 }, Jump { location: 671 }, Mov { destination: Direct(32773), source: Direct(32771) }, Jump { location: 686 }, Mov { destination: Direct(32773), source: Direct(1) }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Direct(32772) }, BinaryIntOp { destination: Direct(32777), op: Add, bit_size: U32, lhs: Direct(32771), rhs: Direct(32772) }, Mov { destination: Direct(32778), source: Direct(32771) }, Mov { destination: Direct(32779), source: Direct(32773) }, BinaryIntOp { destination: Direct(32780), op: Equals, bit_size: U32, lhs: Direct(32778), rhs: Direct(32777) }, JumpIf { condition: Direct(32780), location: 683 }, Load { destination: Direct(32776), source_pointer: Direct(32778) }, Store { destination_pointer: Direct(32779), source: Direct(32776) }, BinaryIntOp { destination: Direct(32778), op: Add, bit_size: U32, lhs: Direct(32778), rhs: Direct(2) }, BinaryIntOp { destination: Direct(32779), op: Add, bit_size: U32, lhs: Direct(32779), rhs: Direct(2) }, Jump { location: 676 }, IndirectConst { destination_pointer: Direct(32773), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Direct(32774), op: Sub, bit_size: U32, lhs: Direct(32774), rhs: Direct(2) }, Jump { location: 686 }, Return, Const { destination: Direct(32774), bit_size: Integer(U32), value: 2 }, BinaryIntOp { destination: Direct(32773), op: Div, bit_size: U32, lhs: Direct(32772), rhs: Direct(32774) }, Mov { destination: Direct(32776), source: Direct(32772) }, Const { destination: Direct(32777), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Direct(32778), op: LessThan, bit_size: U32, lhs: Direct(32777), rhs: Direct(32773) }, Not { destination: Direct(32778), source: Direct(32778), bit_size: U1 }, JumpIf { condition: Direct(32778), location: 705 }, BinaryIntOp { destination: Direct(32776), op: Sub, bit_size: U32, lhs: Direct(32776), rhs: Direct(2) }, BinaryIntOp { destination: Direct(32779), op: Add, bit_size: U32, lhs: Direct(32771), rhs: Direct(32777) }, Load { destination: Direct(32774), source_pointer: Direct(32779) }, BinaryIntOp { destination: Direct(32779), op: Add, bit_size: U32, lhs: Direct(32771), rhs: Direct(32776) }, Load { destination: Direct(32775), source_pointer: Direct(32779) }, BinaryIntOp { destination: Direct(32779), op: Add, bit_size: U32, lhs: Direct(32771), rhs: Direct(32777) }, Store { destination_pointer: Direct(32779), source: Direct(32775) }, BinaryIntOp { destination: Direct(32779), op: Add, bit_size: U32, lhs: Direct(32771), rhs: Direct(32776) }, Store { destination_pointer: Direct(32779), source: Direct(32774) }, BinaryIntOp { destination: Direct(32777), op: Add, bit_size: U32, lhs: Direct(32777), rhs: Direct(2) }, Jump { location: 691 }, Return]" ], - "debug_symbols": "tZrdbtw4Ekbfxde+UPGvyHmVIAicxBkYMJzAYy+wCPzuy6/JIyeLba0gzdy4Ttut02zpK1Gi/PPm6/3n1z8/PTx9+/7XzR8fft58fn54fHz489Pj9y93Lw/fn/pvf94s+lH6z3B7U2yUMEocJY2SRymj+Ch1lHYpPiw+LD4sPiw+LD4sPiw+LD4sPix1WOqw1G5JvcRR0ih5lDKKj1JHaZfSllFslG7JvcRR0ih5lG6xXnyUOkq7FFuWWW3WMGucNc3aXVW1zOqz1lnbqLbMarOGWeOsadbps+mz6bPps+kL0xf69k1VX0YDCg5UoE2IC2BAACKQgAxgjpgj5og5YU6YE+Yk8yKQOQoyUAAHKtAm5AUwIAARkDkJMtDNRdVnrbO2URX7S7VZw6xx1jRrnnX6lH5zQQXaBPXAAAMCEIEEZKAAmB2zY66YK+aKuWKumCvmill9YYqKeiHoSKgbBiQgAwVwoAJtQFBrDDAgABFIQAYK4EAFMBtmw2yYDbNhNsyGWb1iTSBzELQJapcBBgQgAgnIQAEckDkK2oRLU2WBAQGIQAIyUAAHKiBzD1tQUw0wIAARSEAGCuBABTBnzBlzxpwxZ8zqodCDFC5zhXbvZba4QAAikIAMFMABjacK+nhiP0cE9c4AAwIQgQRkoAAOVEBmHS/1zgCZdbzUOwMikIAMFMCBCrQJmmdiEhgQgAgkIAMFcKACbUBcFsCAAMiTBQVwQJ4maBPUTWkRaC40gebUINCsGgWaV2VWNw0ogAMyF4FmWH2WummAAQGIQAIyUAAHKoA5Yo6YI+aIOWKOmCNm9U7SUNU7AwzQlYD2hnpngK4GtFvUO1m7Rb2TtVvUO1nfXb2TZVbvXEC9M8AAjdAFMuuz1DsDMlAAByrQJqi/BhgQAMwFc8FcMBfMBXPB7JjVTVlDVTcNyICmOO0NddMATZraLeqmot2ibiraLeqmou+ubioyq5sGJCADGmEVyKzPUjcNaBPUTQMMCEAEEpCBAmBumNs0p2UBDAhABKY5KfOlCSrQJijzAwwIQAQSkIECYA6YA2ZlvlSBAWGCIuqLoG/uJuhbeT8oSTkcYIDeHAX90z0JCuATFK3LexStARFgc+VnvLlNUH4GGBCACCSAT3c+XYnyIqhAm6BEDTAgABFIQAYKgLlirpgb5oa5YW6YG+aGuWFWolyRUKIGtAFZiRpgQAAikIAMFMCBCmA2zIbZMBtmw2yYDbNhNsyGOWAOmANmpdebIAEZKIADFWgTlN4BBgQAc8QcMUfMEXPEHDHrjF0Xge6JTKCboiBwoAJtgvpigAEBiEACMoA5Y86YdX6uvS+yzs81CQwIQAQSkIECOFCBNsExO2bH7Jgds2N2zI7ZMau/aj8/Z/XXAAMCEIEEZKAADlRA5t4gWf01wMapKV/66wLyKFrqpgEOdE+7vKcNKOqmpqUEdVOLgu5pSaB72yzoI2xFkIECOKARVoHMrjWNBTAgABFIQAYK4EAFMAfMAXPAHDAHzAGzuqlphOqmARVoE9RNAwwIQAQSkAHMEXPErG5qTYs5C2BAACKQgAwUwIEKYM6YM+aMOWPOmDPmjDljzpgz5oK5YC4X89vb7Q1rWZ9enu/vtZT1y+JWX/L6cfd8//Ry88fT6+Pj7c2/7h5fL2/668fd06W+3D33v/azy/3T11678NvD473o7fZ96+X6pklnpMvG/Wy0bp5/396ub99nj4Jg+cVgZa+hz0h1NeR2zRA3DFl9djH06X85bYjXDBv7sTflFJSSru3Hcn37vobDgejLNfl9BO03g28Yqi7jh6HmcshQl9VQ7YChr5OwH/uax1WDbezIfvvB1+j3FOnIIEz3+XMQJV4dRDidqP2KI5HyQKS8LVdbM5/OlJXTodpW7ErVlmJvrNrpWG2OYl+ugp3O1X7FkVzVgqCFcC1XIZ3OVcinc7Wt2JWrLcXOXGmV72SuNkexL1dxOT8DLv9krvrDJi4F+nOkqxcTG4amC+f/K9g+ouvlSF/OP3Q47P16pCuupjtunClSf17GvuwPeq4qNiaxunDyr+GX9vDfBRvBLInD2S9fDwnWK8NS6zEB/enL9RFs7cYQGUJfgWqHjkQI+bTCfIdiO1J17YzW8rEpcFewNyfifcFOfjrYqZ4Mdmong70p2BPsbcGOYG/uxn3B3lbsCva2YlewtyO1K9h+Otd+Ota5no51bidjXZaTsd4U7In1tmBHrDd3475Ybyt2xXpbsSvWfjrVW5dCIa2G/nj56npA3VSk/6WwunsQ0dYL5P7w9MD1mOW4Gvpi7BFDjL6OIS9HDGlNhKXohwx1HUNfbLpm8I2brhDqeo6J4fraytaVaX6/yu/PHw4p+lIyir7seUjhtiq8LlcV5+94tkfRON+GuiyHFG29iw3Nj42irWf90KwdUfS2os9jz/cxxbKsCovHFMlWRbPzimO7s6awHtR87KDWkN4VV79IPT+V17NTeTs7lbezU3k7O5XX81N5PT+V179hKt+M1LpW1dNlxxS+nrlr82OK8j6K/zpbfeyv7r48PP/2b81vcj0/3H1+vJ8vv70+ffnlry///sFf+LfoH8/fv9x/fX2+l+n9f6P7jw+l5NtSy8fbG9OrPh/6kvur/lzrQz+bJ7GeM35Ii98mC3qpd6Y+W/Q2+vimYf4H", + "debug_symbols": "tZrdbtw4Ekbfxde+UPGvyHmVIAicxBkYMJzAYy+wCPzuy6/JIyeLba0gzdykjuPWaTb1laim/PPm6/3n1z8/PTx9+/7XzR8fft58fn54fHz489Pj9y93Lw/fn/r//rxZ9E/p/4bbm2KjhFHiKGmUPEoZxUepo7RL8WHxYfFh8WHxYfFh8WHxYfFh8WGpw1KHpXZL6iWOkkbJo5RRfJQ6SruUtoxio3RL7iWOkkbJo3SL9eKj1FHapdiyzGqzhlnjrGnW7qqqZVaftc7aRrVlVps1zBpnTbNOn02fTZ9Nn01fmL7Qj2+q+jAaUHCgAm1CXAADAhCBBGQAc8QcMUfMCXPCnDAnmReBzFGQgQI4UIE2IS+AAQGIgMxJkIFuLqo+a521jarYX6rNGmaNs6ZZ86zTp/SbCyrQJqgHBhgQgAgkIAMFwOyYHXPFXDFXzBVzxVwxV8zqC1NU1AtBZ0LdMCABGSiAAxVoA4JaY4ABAYhAAjJQAAcqgNkwG2bDbJgNs2E2zOoVawKZg6BNULsMMCAAEUhABgrggMxR0CZcmioLDAhABBKQgQI4UAGZe9iCmmqAAQGIQAIyUAAHKoA5Y86YM+aMOWNWD4UepHBZKzS9l9XiAgGIQAIyUAAHNJ4q6OOJ/RoR1DsDDAhABBKQgQI4UAGZdb7UOwNk1vlS7wyIQAIyUAAHKtAmaJ2JSWBAACKQgAwUwIEKtAFxWQADAiBPFhTAAXmaoE1QN6VFoLXQBFpTg0CrahRoXZVZ3TSgAA7IXARaYfVe6qYBBgQgAgnIQAEcqADmiDlijpgj5og5Yo6Y1TtJQ1XvDDBAdwKaDfXOAN0NaFrUO1nTot7Jmhb1TtZnV+9kmdU7F1DvDDBAI3SBzHov9c6ADBTAgQq0CeqvAQYEAHPBXDAXzAVzwVwwO2Z1U9ZQ1U0DMqAlTrOhbhqgRVPTom4qmhZ1U9G0qJuKPru6qcisbhqQgAxohFUgs95L3TSgTVA3DTAgABFIQAYKgLlhbtOclgUwIAARmOakzJcmqECboMwPMCAAEUhABgqAOWAOmJX5UgUGhAmKqC+CfriboB/l/aQk5XCAAXpxFPR39yQogE9QtC6vUbQGRIDDlZ/x4jZB+RlgQAAikADe3Xl3JcqLoAJtghI1wIAARCABGSgA5oq5Ym6YG+aGuWFumBvmhlmJckVCiRrQBmQlaoABAYhAAjJQAAcqgNkwG2bDbJgNs2E2zIbZMBvmgDlgDpiVXm+CBGSgAA5UoE1QegcYEADMEXPEHDFHzBFzxKwrdl0E+k5kAn0pCgIHKtAmqC8GGBCACCQgA5gz5oxZ1+fa+yLr+lyTwIAARCABGSiAAxVoExyzY3bMjtkxO2bH7Jgds/qr9utzVn8NMCAAEUhABgrgQAVk7g2S1V8DbFya8qW/LiCPoqVuGuBA97TLa9qAom5q2kpQN7Uo6J6WBPpumwV9hK0IMlAABzTCKpDZtaexAAYEIAIJyEABHKgA5oA5YA6YA+aAOWBWNzWNUN00oAJtgrppgAEBiEACMoA5Yo6Y1U2taTNnAQwIQAQSkIECOFABzBlzxpwxZ8wZc8acMWfMGXPGXDAXzOVifnu7vWEv69PL8/29trJ+2dzqW14/7p7vn15u/nh6fXy8vfnX3ePr5UV//bh7utSXu+f+2351uX/62msXfnt4vBe93b4fvVw/NOmKdDm4X43Ww/Pvx9v14/vqURAsvxis7DX0FamuhtyuGeKGIavPLoa+/C+nDfGaYWMee1NOQSnp2jyW68f3PRxORN+uye8jaL8ZfMNQdRs/DDWXQ4a6rIZqBwx9n4R57HseVw22MZH96wcfo3+nSEcGYfqePwdR4tVBhNOJ2q84EikPRMrbcrU18+lMWTkdqm3FrlRtKfbGqp2O1eYo9uUq2Olc7VccyVUtCFoI13IV0ulchXw6V9uKXbnaUuzMlXb5TuZqcxT7chWX8yvg8k/mqj9s4lagP0e6ejOxYWi6cf6/gu0zut6O9O38Q6fD3u9HuuJquuPGlSL152XMZX/Qc1WxsYjVhYt/Db+0h/8u2AhmSZzOfvt6SLDeGZZajwnoT1+uj2BrGkNkCH0Hqh06EyHk0wrzHYrtSNW1M1rLx5bAXcHeXIj3BTv56WCnejLYqZ0M9qZgT7C3BTuCvTmN+4K9rdgV7G3FrmBvR2pXsP10rv10rHM9HevcTsa6LCdjvSnYE+ttwY5Yb07jvlhvK3bFeluxK9Z+OtVbt0IhrYb+ePnqfkDdVKT/pbC6exDR1hvk/vD0wP1Y7wWm0vo+7RFDjKuhP3M8Ykjr12BLMR0y1HUm+5ORawbf+NIVQl2vMTFc31vZujN9n8uO9ZCibyWj6NuehxRuq8LrclVx/hvP9iga19tQl+WQoq3fYkPzY6No61U/NGtHFL2t6PPY831MsSyrwuIxRbJV0ey84th01hTWk5qPndQa0rvi6gep55fyenYpb2eX8nZ2KW9nl/J6fimv55fy+jcs5ZuRWveqerrsmMLXK3dtfkxR3kfxX1erj/2nuy8Pz7/9WfObXM8Pd58f7+eP316fvvzy25d//+A3/Fn0j+fvX+6/vj7fy/T+t9H9nw+l5NtSy8fbG9NP/RmmL7n/1J9rfehX8yTWc8YPafHbZEE/6pWprxa9jT6+aZj/AQ==", "file_map": { "16": { "source": "use crate::cmp::Eq;\nuse crate::hash::Hash;\nuse crate::ops::arith::{Add, Neg, Sub};\n\n/// A point on the embedded elliptic curve\n/// By definition, the base field of the embedded curve is the scalar field of the proof system curve, i.e the Noir Field.\n/// x and y denotes the Weierstrass coordinates of the point, if is_infinite is false.\npub struct EmbeddedCurvePoint {\n pub x: Field,\n pub y: Field,\n pub is_infinite: bool,\n}\n\nimpl EmbeddedCurvePoint {\n /// Elliptic curve point doubling operation\n /// returns the doubled point of a point P, i.e P+P\n pub fn double(self) -> EmbeddedCurvePoint {\n embedded_curve_add(self, self)\n }\n\n /// Returns the null element of the curve; 'the point at infinity'\n pub fn point_at_infinity() -> EmbeddedCurvePoint {\n EmbeddedCurvePoint { x: 0, y: 0, is_infinite: true }\n }\n\n /// Returns the curve's generator point.\n pub fn generator() -> EmbeddedCurvePoint {\n // Generator point for the grumpkin curve (y^2 = x^3 - 17)\n EmbeddedCurvePoint {\n x: 1,\n y: 17631683881184975370165255887551781615748388533673675138860, // sqrt(-16)\n is_infinite: false,\n }\n }\n}\n\nimpl Add for EmbeddedCurvePoint {\n /// Adds two points P+Q, using the curve addition formula, and also handles point at infinity\n fn add(self, other: EmbeddedCurvePoint) -> EmbeddedCurvePoint {\n embedded_curve_add(self, other)\n }\n}\n\nimpl Sub for EmbeddedCurvePoint {\n /// Points subtraction operation, using addition and negation\n fn sub(self, other: EmbeddedCurvePoint) -> EmbeddedCurvePoint {\n self + other.neg()\n }\n}\n\nimpl Neg for EmbeddedCurvePoint {\n /// Negates a point P, i.e returns -P, by negating the y coordinate.\n /// If the point is at infinity, then the result is also at infinity.\n fn neg(self) -> EmbeddedCurvePoint {\n EmbeddedCurvePoint { x: self.x, y: -self.y, is_infinite: self.is_infinite }\n }\n}\n\nimpl Eq for EmbeddedCurvePoint {\n /// Checks whether two points are equal\n fn eq(self: Self, b: EmbeddedCurvePoint) -> bool {\n (self.is_infinite & b.is_infinite)\n | ((self.is_infinite == b.is_infinite) & (self.x == b.x) & (self.y == b.y))\n }\n}\n\nimpl Hash for EmbeddedCurvePoint {\n fn hash(self, state: &mut H)\n where\n H: crate::hash::Hasher,\n {\n if self.is_infinite {\n self.is_infinite.hash(state);\n } else {\n self.x.hash(state);\n self.y.hash(state);\n }\n }\n}\n\n/// Scalar for the embedded curve represented as low and high limbs\n/// By definition, the scalar field of the embedded curve is base field of the proving system curve.\n/// It may not fit into a Field element, so it is represented with two Field elements; its low and high limbs.\npub struct EmbeddedCurveScalar {\n pub lo: Field,\n pub hi: Field,\n}\n\nimpl EmbeddedCurveScalar {\n pub fn new(lo: Field, hi: Field) -> Self {\n EmbeddedCurveScalar { lo, hi }\n }\n\n #[field(bn254)]\n pub fn from_field(scalar: Field) -> EmbeddedCurveScalar {\n let (a, b) = crate::field::bn254::decompose(scalar);\n EmbeddedCurveScalar { lo: a, hi: b }\n }\n\n //Bytes to scalar: take the first (after the specified offset) 16 bytes of the input as the lo value, and the next 16 bytes as the hi value\n #[field(bn254)]\n pub(crate) fn from_bytes(bytes: [u8; 64], offset: u32) -> EmbeddedCurveScalar {\n let mut v = 1;\n let mut lo = 0 as Field;\n let mut hi = 0 as Field;\n for i in 0..16 {\n lo = lo + (bytes[offset + 31 - i] as Field) * v;\n hi = hi + (bytes[offset + 15 - i] as Field) * v;\n v = v * 256;\n }\n let sig_s = crate::embedded_curve_ops::EmbeddedCurveScalar { lo, hi };\n sig_s\n }\n}\n\nimpl Eq for EmbeddedCurveScalar {\n fn eq(self, other: Self) -> bool {\n (other.hi == self.hi) & (other.lo == self.lo)\n }\n}\n\nimpl Hash for EmbeddedCurveScalar {\n fn hash(self, state: &mut H)\n where\n H: crate::hash::Hasher,\n {\n self.hi.hash(state);\n self.lo.hash(state);\n }\n}\n\n// Computes a multi scalar multiplication over the embedded curve.\n// For bn254, We have Grumpkin and Baby JubJub.\n// For bls12-381, we have JubJub and Bandersnatch.\n//\n// The embedded curve being used is decided by the\n// underlying proof system.\n// docs:start:multi_scalar_mul\npub fn multi_scalar_mul(\n points: [EmbeddedCurvePoint; N],\n scalars: [EmbeddedCurveScalar; N],\n) -> EmbeddedCurvePoint\n// docs:end:multi_scalar_mul\n{\n multi_scalar_mul_array_return(points, scalars)[0]\n}\n\n#[foreign(multi_scalar_mul)]\npub(crate) fn multi_scalar_mul_array_return(\n points: [EmbeddedCurvePoint; N],\n scalars: [EmbeddedCurveScalar; N],\n) -> [EmbeddedCurvePoint; 1] {}\n\n// docs:start:fixed_base_scalar_mul\npub fn fixed_base_scalar_mul(scalar: EmbeddedCurveScalar) -> EmbeddedCurvePoint\n// docs:end:fixed_base_scalar_mul\n{\n multi_scalar_mul([EmbeddedCurvePoint::generator()], [scalar])\n}\n\n/// This function only assumes that the points are on the curve\n/// It handles corner cases around the infinity point causing some overhead compared to embedded_curve_add_not_nul and embedded_curve_add_unsafe\n// docs:start:embedded_curve_add\npub fn embedded_curve_add(\n point1: EmbeddedCurvePoint,\n point2: EmbeddedCurvePoint,\n) -> EmbeddedCurvePoint {\n // docs:end:embedded_curve_add\n if crate::runtime::is_unconstrained() {\n // `embedded_curve_add_unsafe` requires the inputs not to be the infinity point, so we check it here.\n // This is because `embedded_curve_add_unsafe` uses the `embedded_curve_add` opcode.\n // For efficiency, the backend does not check the inputs for the infinity point, but it assumes that they are not the infinity point\n // so that it can apply the ec addition formula directly.\n if point1.is_infinite {\n point2\n } else if point2.is_infinite {\n point1\n } else {\n embedded_curve_add_unsafe(point1, point2)\n }\n } else {\n // In a constrained context, we also need to check the inputs are not the infinity point because we also use `embedded_curve_add_unsafe`\n // However we also need to identify the case where the two inputs are the same, because then\n // the addition formula does not work and we need to use the doubling formula instead.\n // In unconstrained context, we can check directly if the input values are the same when solving the opcode, so it is not an issue.\n\n // x_coordinates_match is true if both abscissae are the same\n let x_coordinates_match = point1.x == point2.x;\n // y_coordinates_match is true if both ordinates are the same\n let y_coordinates_match = point1.y == point2.y;\n // double_predicate is true if both abscissae and ordinates are the same\n let double_predicate = (x_coordinates_match & y_coordinates_match);\n // If the abscissae are the same, but not the ordinates, then one point is the opposite of the other\n let infinity_predicate = (x_coordinates_match & !y_coordinates_match);\n let point1_1 = EmbeddedCurvePoint {\n x: point1.x + (x_coordinates_match as Field),\n y: point1.y,\n is_infinite: false,\n };\n let point2_1 = EmbeddedCurvePoint { x: point2.x, y: point2.y, is_infinite: false };\n // point1_1 is guaranteed to have a different abscissa than point2:\n // - if x_coordinates_match is 0, that means point1.x != point2.x, and point1_1.x = point1.x + 0\n // - if x_coordinates_match is 1, that means point1.x = point2.x, but point1_1.x = point1.x + 1 in this case\n // Because the abscissa is different, the addition formula is guaranteed to succeed, so we can safely use `embedded_curve_add_unsafe`\n // Note that this computation may be garbage: if x_coordinates_match is 1, or if one of the input is the point at infinity.\n let mut result = embedded_curve_add_unsafe(point1_1, point2_1);\n\n // `embedded_curve_add_unsafe` is doing a doubling if the input is the same variable, because in this case it is guaranteed (at 'compile time') that the input is the same.\n let double = embedded_curve_add_unsafe(point1, point1);\n // `embedded_curve_add_unsafe` would not perform doubling, even if the inputs point1 and point2 are the same, because it cannot know this without adding some logic (and some constraints)\n // However we did this logic when we computed `double_predicate`, so we set the result to 2*point1 if point1 and point2 are the same\n result = if double_predicate { double } else { result };\n\n // Same logic as above for unconstrained context, we set the proper result when one of the inputs is the infinity point\n if point1.is_infinite {\n result = point2;\n }\n if point2.is_infinite {\n result = point1;\n }\n\n // Finally, we set the is_infinity flag of the result:\n // Opposite points should sum into the infinity point, however, if one of them is point at infinity, their coordinates are not meaningful\n // so we should not use the fact that the inputs are opposite in this case:\n let mut result_is_infinity =\n infinity_predicate & (!point1.is_infinite & !point2.is_infinite);\n // However, if both of them are at infinity, then the result is also at infinity\n result.is_infinite = result_is_infinity | (point1.is_infinite & point2.is_infinite);\n result\n }\n}\n\n#[foreign(embedded_curve_add)]\nfn embedded_curve_add_array_return(\n _point1: EmbeddedCurvePoint,\n _point2: EmbeddedCurvePoint,\n) -> [EmbeddedCurvePoint; 1] {}\n\n/// This function assumes that:\n/// The points are on the curve, and\n/// The points don't share an x-coordinate, and\n/// Neither point is the infinity point.\n/// If it is used with correct input, the function ensures the correct non-zero result is returned.\n/// Except for points on the curve, the other assumptions are checked by the function. It will cause assertion failure if they are not respected.\npub fn embedded_curve_add_not_nul(\n point1: EmbeddedCurvePoint,\n point2: EmbeddedCurvePoint,\n) -> EmbeddedCurvePoint {\n assert(point1.x != point2.x);\n assert(!point1.is_infinite);\n assert(!point2.is_infinite);\n // Ensure is_infinite is comptime\n let point1_1 = EmbeddedCurvePoint { x: point1.x, y: point1.y, is_infinite: false };\n let point2_1 = EmbeddedCurvePoint { x: point2.x, y: point2.y, is_infinite: false };\n embedded_curve_add_unsafe(point1_1, point2_1)\n}\n\n/// Unsafe ec addition\n/// If the inputs are the same, it will perform a doubling, but only if point1 and point2 are the same variable.\n/// If they have the same value but are different variables, the result will be incorrect because in this case\n/// it assumes (but does not check) that the points' x-coordinates are not equal.\n/// It also assumes neither point is the infinity point.\npub fn embedded_curve_add_unsafe(\n point1: EmbeddedCurvePoint,\n point2: EmbeddedCurvePoint,\n) -> EmbeddedCurvePoint {\n embedded_curve_add_array_return(point1, point2)[0]\n}\n", @@ -104,7 +104,7 @@ expression: artifact "path": "std/hash/mod.nr" }, "50": { - "source": "fn main(\n // Public key of note\n // all notes have the same denomination\n priv_key: Field,\n // Merkle membership proof\n note_root: pub Field,\n index: Field,\n note_hash_path: [Field; 3],\n // Receiver public key\n to_pubkey_x: Field,\n to_pubkey_y: Field,\n) -> pub [Field; 2] {\n let priv_key_as_scalar = std::embedded_curve_ops::EmbeddedCurveScalar { lo: priv_key, hi: 0 };\n // Compute public key from private key to show ownership\n let pubkey = std::embedded_curve_ops::fixed_base_scalar_mul(priv_key_as_scalar);\n // Compute input note commitment\n let note_commitment = std::hash::pedersen_commitment([pubkey.x, pubkey.y]);\n // Compute input note nullifier\n let nullifier = std::hash::pedersen_commitment([note_commitment.x, index, priv_key]);\n // Compute output note nullifier\n let receiver_note_commitment = std::hash::pedersen_commitment([to_pubkey_x, to_pubkey_y]);\n // Check that the input note nullifier is in the root\n assert(note_root == compute_merkle_root(note_commitment.x, index, note_hash_path));\n\n [nullifier.x, receiver_note_commitment.x]\n}\n\nfn compute_merkle_root(leaf: Field, index: Field, hash_path: [Field; N]) -> Field {\n let index_bits: [u1; N] = index.to_le_bits();\n let mut current = leaf;\n for i in 0..N {\n let path_bit = index_bits[i] as bool;\n let (hash_left, hash_right) = if path_bit {\n (hash_path[i], current)\n } else {\n (current, hash_path[i])\n };\n current = std::hash::pedersen_hash([hash_left, hash_right]);\n }\n current\n}\n", + "source": "fn main(\n // Public key of note\n // all notes have the same denomination\n priv_key: Field,\n // Merkle membership proof\n note_root: pub Field,\n index: Field,\n note_hash_path: [Field; 3],\n // Receiver public key\n to_pubkey_x: Field,\n to_pubkey_y: Field,\n) -> pub [Field; 2] {\n let priv_key_as_scalar = std::embedded_curve_ops::EmbeddedCurveScalar { lo: priv_key, hi: 0 };\n // Compute public key from private key to show ownership\n let pubkey = std::embedded_curve_ops::fixed_base_scalar_mul(priv_key_as_scalar);\n // Compute input note commitment\n let note_commitment = std::hash::pedersen_commitment([pubkey.x, pubkey.y]);\n // Compute input note nullifier\n let nullifier = std::hash::pedersen_commitment([note_commitment.x, index, priv_key]);\n // Compute output note nullifier\n let receiver_note_commitment = std::hash::pedersen_commitment([to_pubkey_x, to_pubkey_y]);\n // Check that the input note nullifier is in the root\n assert(note_root == compute_merkle_root(note_commitment.x, index, note_hash_path));\n\n [nullifier.x, receiver_note_commitment.x]\n}\n\nfn compute_merkle_root(leaf: Field, index: Field, hash_path: [Field; N]) -> Field {\n let index_bits: [u1; N] = index.to_le_bits();\n let mut current = leaf;\n for i in 0..N {\n let path_bit = index_bits[i] != 0;\n let (hash_left, hash_right) = if path_bit {\n (hash_path[i], current)\n } else {\n (current, hash_path[i])\n };\n current = std::hash::pedersen_hash([hash_left, hash_right]);\n }\n current\n}\n", "path": "" } }, diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/simple_shield/execute__tests__force_brillig_true_inliner_0.snap b/tooling/nargo_cli/tests/snapshots/execution_success/simple_shield/execute__tests__force_brillig_true_inliner_0.snap index 0aea6ea13af..190c988edc2 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/simple_shield/execute__tests__force_brillig_true_inliner_0.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/simple_shield/execute__tests__force_brillig_true_inliner_0.snap @@ -85,7 +85,7 @@ expression: artifact "unconstrained func 0", "[Const { destination: Direct(2), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(1), bit_size: Integer(U32), value: 32846 }, Const { destination: Direct(0), bit_size: Integer(U32), value: 3 }, Const { destination: Relative(7), bit_size: Integer(U32), value: 8 }, Const { destination: Relative(8), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(32836), size_address: Relative(7), offset_address: Relative(8) }, Mov { destination: Relative(1), source: Direct(32836) }, Mov { destination: Relative(2), source: Direct(32837) }, Mov { destination: Relative(3), source: Direct(32838) }, Const { destination: Relative(4), bit_size: Integer(U32), value: 32839 }, Const { destination: Relative(8), bit_size: Integer(U32), value: 3 }, Mov { destination: Relative(7), source: Direct(1) }, Const { destination: Relative(9), bit_size: Integer(U32), value: 4 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(9) }, IndirectConst { destination_pointer: Relative(7), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(9), op: Add, bit_size: U32, lhs: Relative(7), rhs: Direct(2) }, Mov { destination: Direct(32771), source: Relative(4) }, Mov { destination: Direct(32772), source: Relative(9) }, Mov { destination: Direct(32773), source: Relative(8) }, Call { location: 35 }, Mov { destination: Relative(4), source: Relative(7) }, Mov { destination: Relative(5), source: Direct(32842) }, Mov { destination: Relative(6), source: Direct(32843) }, Call { location: 46 }, Call { location: 48 }, BinaryIntOp { destination: Relative(2), op: Add, bit_size: U32, lhs: Relative(1), rhs: Direct(2) }, Const { destination: Relative(3), bit_size: Integer(U32), value: 32844 }, Const { destination: Relative(4), bit_size: Integer(U32), value: 2 }, Mov { destination: Direct(32771), source: Relative(2) }, Mov { destination: Direct(32772), source: Relative(3) }, Mov { destination: Direct(32773), source: Relative(4) }, Call { location: 35 }, Const { destination: Relative(2), bit_size: Integer(U32), value: 32844 }, Const { destination: Relative(3), bit_size: Integer(U32), value: 2 }, Stop { return_data: HeapVector { pointer: Relative(2), size: Relative(3) } }, BinaryIntOp { destination: Direct(32775), op: Add, bit_size: U32, lhs: Direct(32771), rhs: Direct(32773) }, Mov { destination: Direct(32776), source: Direct(32771) }, Mov { destination: Direct(32777), source: Direct(32772) }, BinaryIntOp { destination: Direct(32778), op: Equals, bit_size: U32, lhs: Direct(32776), rhs: Direct(32775) }, JumpIf { condition: Direct(32778), location: 45 }, Load { destination: Direct(32774), source_pointer: Direct(32776) }, Store { destination_pointer: Direct(32777), source: Direct(32774) }, BinaryIntOp { destination: Direct(32776), op: Add, bit_size: U32, lhs: Direct(32776), rhs: Direct(2) }, BinaryIntOp { destination: Direct(32777), op: Add, bit_size: U32, lhs: Direct(32777), rhs: Direct(2) }, Jump { location: 38 }, Return, Const { destination: Direct(32835), bit_size: Field, value: 340282366920938463463374607431768211456 }, Return, Call { location: 651 }, Const { destination: Relative(8), bit_size: Field, value: 1 }, Const { destination: Relative(9), bit_size: Field, value: 17631683881184975370165255887551781615748388533673675138860 }, Const { destination: Relative(10), bit_size: Integer(U1), value: 0 }, Mov { destination: Relative(11), source: Direct(1) }, Const { destination: Relative(12), bit_size: Integer(U32), value: 4 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(12) }, IndirectConst { destination_pointer: Relative(11), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(12), op: Add, bit_size: U32, lhs: Relative(11), rhs: Direct(2) }, Mov { destination: Relative(13), source: Relative(12) }, Store { destination_pointer: Relative(13), source: Relative(8) }, BinaryIntOp { destination: Relative(13), op: Add, bit_size: U32, lhs: Relative(13), rhs: Direct(2) }, Store { destination_pointer: Relative(13), source: Relative(9) }, BinaryIntOp { destination: Relative(13), op: Add, bit_size: U32, lhs: Relative(13), rhs: Direct(2) }, Store { destination_pointer: Relative(13), source: Relative(10) }, Const { destination: Relative(8), bit_size: Field, value: 0 }, Mov { destination: Relative(9), source: Direct(1) }, Const { destination: Relative(12), bit_size: Integer(U32), value: 3 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(12) }, IndirectConst { destination_pointer: Relative(9), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(12), op: Add, bit_size: U32, lhs: Relative(9), rhs: Direct(2) }, Mov { destination: Relative(13), source: Relative(12) }, Store { destination_pointer: Relative(13), source: Relative(1) }, BinaryIntOp { destination: Relative(13), op: Add, bit_size: U32, lhs: Relative(13), rhs: Direct(2) }, Store { destination_pointer: Relative(13), source: Relative(8) }, Mov { destination: Relative(12), source: Direct(1) }, Const { destination: Relative(13), bit_size: Integer(U32), value: 4 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(13) }, IndirectConst { destination_pointer: Relative(12), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(13), op: Add, bit_size: U32, lhs: Relative(11), rhs: Direct(2) }, Const { destination: Relative(14), bit_size: Integer(U32), value: 3 }, BinaryIntOp { destination: Relative(15), op: Add, bit_size: U32, lhs: Relative(9), rhs: Direct(2) }, Const { destination: Relative(16), bit_size: Integer(U32), value: 2 }, BinaryIntOp { destination: Relative(17), op: Add, bit_size: U32, lhs: Relative(12), rhs: Direct(2) }, BlackBox(MultiScalarMul { points: HeapVector { pointer: Relative(13), size: Relative(14) }, scalars: HeapVector { pointer: Relative(15), size: Relative(16) }, outputs: HeapArray { pointer: Relative(17), size: 3 } }), Const { destination: Relative(9), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(13), op: Add, bit_size: U32, lhs: Relative(12), rhs: Relative(9) }, Load { destination: Relative(11), source_pointer: Relative(13) }, Const { destination: Relative(13), bit_size: Integer(U32), value: 2 }, BinaryIntOp { destination: Relative(15), op: Add, bit_size: U32, lhs: Relative(12), rhs: Relative(13) }, Load { destination: Relative(14), source_pointer: Relative(15) }, Mov { destination: Relative(12), source: Direct(1) }, Const { destination: Relative(15), bit_size: Integer(U32), value: 3 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(15) }, IndirectConst { destination_pointer: Relative(12), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(15), op: Add, bit_size: U32, lhs: Relative(12), rhs: Direct(2) }, Mov { destination: Relative(16), source: Relative(15) }, Store { destination_pointer: Relative(16), source: Relative(11) }, BinaryIntOp { destination: Relative(16), op: Add, bit_size: U32, lhs: Relative(16), rhs: Direct(2) }, Store { destination_pointer: Relative(16), source: Relative(14) }, Mov { destination: Relative(11), source: Direct(1) }, Const { destination: Relative(14), bit_size: Integer(U32), value: 5 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(14) }, IndirectConst { destination_pointer: Relative(11), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(14), op: Add, bit_size: U32, lhs: Relative(11), rhs: Direct(2) }, Mov { destination: Relative(15), source: Relative(14) }, Store { destination_pointer: Relative(15), source: Relative(8) }, BinaryIntOp { destination: Relative(15), op: Add, bit_size: U32, lhs: Relative(15), rhs: Direct(2) }, Store { destination_pointer: Relative(15), source: Relative(8) }, BinaryIntOp { destination: Relative(15), op: Add, bit_size: U32, lhs: Relative(15), rhs: Direct(2) }, Store { destination_pointer: Relative(15), source: Relative(8) }, BinaryIntOp { destination: Relative(15), op: Add, bit_size: U32, lhs: Relative(15), rhs: Direct(2) }, Store { destination_pointer: Relative(15), source: Relative(8) }, Mov { destination: Relative(14), source: Direct(1) }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Direct(2) }, Store { destination_pointer: Relative(14), source: Relative(11) }, Const { destination: Relative(11), bit_size: Integer(U32), value: 0 }, Const { destination: Relative(15), bit_size: Field, value: 8680525429001239497728366687280168587232520577698044359798894838135247199343 }, Mov { destination: Relative(7), source: Relative(11) }, Jump { location: 118 }, BinaryIntOp { destination: Relative(16), op: LessThan, bit_size: U32, lhs: Relative(7), rhs: Relative(13) }, JumpIf { condition: Relative(16), location: 617 }, Jump { location: 121 }, Const { destination: Relative(12), bit_size: Field, value: 3728882899078719075161482178784387565366481897740339799480980287259621149274 }, Const { destination: Relative(16), bit_size: Field, value: -9903063709032878667290627648209915537972247634463802596148419711785767431332 }, Const { destination: Relative(17), bit_size: Field, value: 2393473289045184898987089634332637236754766663897650125720167164137088869378 }, Const { destination: Relative(18), bit_size: Field, value: -7135402912423807765050323395026152633898511180575289670895350565966806597339 }, Mov { destination: Relative(19), source: Direct(1) }, Const { destination: Relative(20), bit_size: Integer(U32), value: 7 }, 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(12) }, 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(10) }, 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(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(10) }, Load { destination: Relative(20), source_pointer: Relative(14) }, Mov { destination: Relative(14), source: Direct(1) }, Const { destination: Relative(21), bit_size: Integer(U32), value: 4 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(21) }, IndirectConst { destination_pointer: Relative(14), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(19), rhs: Direct(2) }, Const { destination: Relative(22), bit_size: Integer(U32), value: 6 }, BinaryIntOp { destination: Relative(23), op: Add, bit_size: U32, lhs: Relative(20), rhs: Direct(2) }, Const { destination: Relative(24), bit_size: Integer(U32), value: 4 }, BinaryIntOp { destination: Relative(25), op: Add, bit_size: U32, lhs: Relative(14), rhs: Direct(2) }, BlackBox(MultiScalarMul { points: HeapVector { pointer: Relative(21), size: Relative(22) }, scalars: HeapVector { pointer: Relative(23), size: Relative(24) }, outputs: HeapArray { pointer: Relative(25), size: 3 } }), BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(14), rhs: Relative(9) }, Load { destination: Relative(20), source_pointer: Relative(21) }, Mov { destination: Relative(14), source: Direct(1) }, Const { destination: Relative(21), bit_size: Integer(U32), value: 4 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(21) }, IndirectConst { destination_pointer: Relative(14), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(14), rhs: Direct(2) }, Mov { destination: Relative(22), source: Relative(21) }, Store { destination_pointer: Relative(22), source: Relative(20) }, BinaryIntOp { destination: Relative(22), op: Add, bit_size: U32, lhs: Relative(22), rhs: Direct(2) }, Store { destination_pointer: Relative(22), source: Relative(3) }, BinaryIntOp { destination: Relative(22), op: Add, bit_size: U32, lhs: Relative(22), rhs: Direct(2) }, Store { destination_pointer: Relative(22), source: Relative(1) }, Mov { destination: Relative(1), source: Direct(1) }, Const { destination: Relative(21), bit_size: Integer(U32), value: 7 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(21) }, IndirectConst { destination_pointer: Relative(1), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(1), rhs: Direct(2) }, Mov { destination: Relative(22), source: Relative(21) }, Store { destination_pointer: Relative(22), source: Relative(8) }, BinaryIntOp { destination: Relative(22), op: Add, bit_size: U32, lhs: Relative(22), rhs: Direct(2) }, Store { destination_pointer: Relative(22), source: Relative(8) }, BinaryIntOp { destination: Relative(22), op: Add, bit_size: U32, lhs: Relative(22), rhs: Direct(2) }, Store { destination_pointer: Relative(22), source: Relative(8) }, BinaryIntOp { destination: Relative(22), op: Add, bit_size: U32, lhs: Relative(22), rhs: Direct(2) }, Store { destination_pointer: Relative(22), source: Relative(8) }, BinaryIntOp { destination: Relative(22), op: Add, bit_size: U32, lhs: Relative(22), rhs: Direct(2) }, Store { destination_pointer: Relative(22), source: Relative(8) }, BinaryIntOp { destination: Relative(22), op: Add, bit_size: U32, lhs: Relative(22), rhs: Direct(2) }, Store { destination_pointer: Relative(22), source: Relative(8) }, Mov { destination: Relative(21), source: Direct(1) }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(1) }, Const { destination: Relative(1), bit_size: Integer(U32), value: 3 }, Mov { destination: Relative(7), source: Relative(11) }, Jump { location: 189 }, BinaryIntOp { destination: Relative(22), op: LessThan, bit_size: U32, lhs: Relative(7), rhs: Relative(1) }, JumpIf { condition: Relative(22), location: 583 }, Jump { location: 192 }, Const { destination: Relative(14), bit_size: Field, value: -9101662836674550326256996212378706138142399878494295154626728833686305224889 }, Const { destination: Relative(22), bit_size: Field, value: 1658946642478826263901298755938807527017017780224674388532518006781615929512 }, Mov { destination: Relative(23), source: Direct(1) }, Const { destination: Relative(24), bit_size: Integer(U32), value: 10 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(24) }, IndirectConst { destination_pointer: Relative(23), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(24), op: Add, bit_size: U32, lhs: Relative(23), rhs: Direct(2) }, Mov { destination: Relative(25), source: Relative(24) }, Store { destination_pointer: Relative(25), source: Relative(12) }, BinaryIntOp { destination: Relative(25), op: Add, bit_size: U32, lhs: Relative(25), rhs: Direct(2) }, Store { destination_pointer: Relative(25), source: Relative(16) }, BinaryIntOp { destination: Relative(25), op: Add, bit_size: U32, lhs: Relative(25), rhs: Direct(2) }, Store { destination_pointer: Relative(25), source: Relative(10) }, BinaryIntOp { destination: Relative(25), op: Add, bit_size: U32, lhs: Relative(25), rhs: Direct(2) }, Store { destination_pointer: Relative(25), source: Relative(17) }, BinaryIntOp { destination: Relative(25), op: Add, bit_size: U32, lhs: Relative(25), rhs: Direct(2) }, Store { destination_pointer: Relative(25), source: Relative(18) }, BinaryIntOp { destination: Relative(25), op: Add, bit_size: U32, lhs: Relative(25), rhs: Direct(2) }, Store { destination_pointer: Relative(25), source: Relative(10) }, BinaryIntOp { destination: Relative(25), op: Add, bit_size: U32, lhs: Relative(25), rhs: Direct(2) }, Store { destination_pointer: Relative(25), source: Relative(14) }, BinaryIntOp { destination: Relative(25), op: Add, bit_size: U32, lhs: Relative(25), rhs: Direct(2) }, Store { destination_pointer: Relative(25), source: Relative(22) }, BinaryIntOp { destination: Relative(25), op: Add, bit_size: U32, lhs: Relative(25), rhs: Direct(2) }, Store { destination_pointer: Relative(25), source: Relative(10) }, Load { destination: Relative(12), source_pointer: Relative(21) }, Mov { destination: Relative(14), source: Direct(1) }, Const { destination: Relative(16), bit_size: Integer(U32), value: 4 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(16) }, IndirectConst { destination_pointer: Relative(14), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(16), op: Add, bit_size: U32, lhs: Relative(23), rhs: Direct(2) }, Const { destination: Relative(17), bit_size: Integer(U32), value: 9 }, BinaryIntOp { destination: Relative(18), op: Add, bit_size: U32, lhs: Relative(12), rhs: Direct(2) }, Const { destination: Relative(21), bit_size: Integer(U32), value: 6 }, BinaryIntOp { destination: Relative(22), op: Add, bit_size: U32, lhs: Relative(14), rhs: Direct(2) }, BlackBox(MultiScalarMul { points: HeapVector { pointer: Relative(16), size: Relative(17) }, scalars: HeapVector { pointer: Relative(18), size: Relative(21) }, outputs: HeapArray { pointer: Relative(22), size: 3 } }), BinaryIntOp { destination: Relative(16), op: Add, bit_size: U32, lhs: Relative(14), rhs: Relative(9) }, Load { destination: Relative(12), source_pointer: Relative(16) }, Mov { destination: Relative(14), source: Direct(1) }, Const { destination: Relative(16), bit_size: Integer(U32), value: 3 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(16) }, IndirectConst { destination_pointer: Relative(14), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(16), op: Add, bit_size: U32, lhs: Relative(14), rhs: Direct(2) }, Mov { destination: Relative(17), source: Relative(16) }, Store { destination_pointer: Relative(17), source: Relative(5) }, BinaryIntOp { destination: Relative(17), op: Add, bit_size: U32, lhs: Relative(17), rhs: Direct(2) }, Store { destination_pointer: Relative(17), source: Relative(6) }, Mov { destination: Relative(5), source: Direct(1) }, Const { destination: Relative(6), bit_size: Integer(U32), value: 5 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(6) }, IndirectConst { destination_pointer: Relative(5), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(6), op: Add, bit_size: U32, lhs: Relative(5), rhs: Direct(2) }, Mov { destination: Relative(16), source: Relative(6) }, Store { destination_pointer: Relative(16), source: Relative(8) }, BinaryIntOp { destination: Relative(16), op: Add, bit_size: U32, lhs: Relative(16), rhs: Direct(2) }, Store { destination_pointer: Relative(16), source: Relative(8) }, BinaryIntOp { destination: Relative(16), op: Add, bit_size: U32, lhs: Relative(16), rhs: Direct(2) }, Store { destination_pointer: Relative(16), source: Relative(8) }, BinaryIntOp { destination: Relative(16), op: Add, bit_size: U32, lhs: Relative(16), rhs: Direct(2) }, Store { destination_pointer: Relative(16), source: Relative(8) }, Mov { destination: Relative(6), source: Direct(1) }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Direct(2) }, Store { destination_pointer: Relative(6), source: Relative(5) }, Mov { destination: Relative(7), source: Relative(11) }, Jump { location: 257 }, BinaryIntOp { destination: Relative(5), op: LessThan, bit_size: U32, lhs: Relative(7), rhs: Relative(13) }, JumpIf { condition: Relative(5), location: 549 }, Jump { location: 260 }, Load { destination: Relative(7), source_pointer: Relative(19) }, Const { destination: Relative(14), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(16), op: Equals, bit_size: U32, lhs: Relative(14), rhs: Relative(7) }, Not { destination: Relative(16), source: Relative(16), bit_size: U1 }, JumpIf { condition: Relative(16), location: 266 }, Call { location: 657 }, BinaryIntOp { destination: Relative(7), op: Add, bit_size: U32, lhs: Relative(7), rhs: Direct(2) }, Store { destination_pointer: Relative(19), source: Relative(7) }, Load { destination: Relative(7), source_pointer: Relative(6) }, Mov { destination: Relative(6), source: Direct(1) }, Const { destination: Relative(16), bit_size: Integer(U32), value: 4 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(16) }, IndirectConst { destination_pointer: Relative(6), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(16), op: Add, bit_size: U32, lhs: Relative(19), rhs: Direct(2) }, Const { destination: Relative(17), bit_size: Integer(U32), value: 6 }, BinaryIntOp { destination: Relative(18), op: Add, bit_size: U32, lhs: Relative(7), rhs: Direct(2) }, Const { destination: Relative(21), bit_size: Integer(U32), value: 4 }, BinaryIntOp { destination: Relative(22), op: Add, bit_size: U32, lhs: Relative(6), rhs: Direct(2) }, BlackBox(MultiScalarMul { points: HeapVector { pointer: Relative(16), size: Relative(17) }, scalars: HeapVector { pointer: Relative(18), size: Relative(21) }, outputs: HeapArray { pointer: Relative(22), size: 3 } }), BinaryIntOp { destination: Relative(16), op: Add, bit_size: U32, lhs: Relative(6), rhs: Relative(9) }, Load { destination: Relative(7), source_pointer: Relative(16) }, Const { destination: Relative(16), bit_size: Integer(U32), value: 2 }, Const { destination: Relative(17), bit_size: Integer(U1), value: 1 }, Mov { destination: Relative(6), source: Direct(1) }, Const { destination: Relative(18), bit_size: Integer(U32), value: 4 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(18) }, IndirectConst { destination_pointer: Relative(6), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(18), op: Add, bit_size: U32, lhs: Relative(6), rhs: Direct(2) }, Const { destination: Relative(21), bit_size: Integer(U32), value: 3 }, BlackBox(ToRadix { input: Relative(3), radix: Relative(16), output_pointer: Relative(18), num_limbs: Relative(21), output_bits: Relative(17) }), Const { destination: Relative(22), bit_size: Integer(U32), value: 3 }, Mov { destination: Direct(32771), source: Relative(18) }, Mov { destination: Direct(32772), source: Relative(22) }, Call { location: 660 }, Mov { destination: Relative(3), source: Direct(1) }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Direct(2) }, Store { destination_pointer: Relative(3), source: Relative(20) }, Mov { destination: Relative(16), source: Direct(1) }, Const { destination: Relative(17), bit_size: Integer(U32), value: 7 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(17) }, IndirectConst { destination_pointer: Relative(16), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(17), op: Add, bit_size: U32, lhs: Relative(16), rhs: Direct(2) }, Mov { destination: Relative(18), source: Relative(17) }, Store { destination_pointer: Relative(18), source: Relative(8) }, BinaryIntOp { destination: Relative(18), op: Add, bit_size: U32, lhs: Relative(18), rhs: Direct(2) }, Store { destination_pointer: Relative(18), source: Relative(8) }, BinaryIntOp { destination: Relative(18), op: Add, bit_size: U32, lhs: Relative(18), rhs: Direct(2) }, Store { destination_pointer: Relative(18), source: Relative(8) }, BinaryIntOp { destination: Relative(18), op: Add, bit_size: U32, lhs: Relative(18), rhs: Direct(2) }, Store { destination_pointer: Relative(18), source: Relative(8) }, BinaryIntOp { destination: Relative(18), op: Add, bit_size: U32, lhs: Relative(18), rhs: Direct(2) }, Store { destination_pointer: Relative(18), source: Relative(8) }, BinaryIntOp { destination: Relative(18), op: Add, bit_size: U32, lhs: Relative(18), rhs: Direct(2) }, Store { destination_pointer: Relative(18), source: Relative(8) }, Const { destination: Relative(17), bit_size: Integer(U1), value: 1 }, Mov { destination: Relative(18), source: Direct(1) }, Const { destination: Relative(20), bit_size: Integer(U32), value: 10 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(20) }, IndirectConst { destination_pointer: Relative(18), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(20), op: Add, bit_size: U32, lhs: Relative(18), rhs: Direct(2) }, Mov { destination: Relative(21), source: Relative(20) }, 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(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(8) }, 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(8) }, 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) }, Load { destination: Relative(17), source_pointer: Relative(19) }, Const { destination: Relative(20), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(21), op: Equals, bit_size: U32, lhs: Relative(20), rhs: Relative(17) }, Not { destination: Relative(21), source: Relative(21), bit_size: U1 }, JumpIf { condition: Relative(21), location: 344 }, Call { location: 657 }, BinaryIntOp { destination: Relative(17), op: Add, bit_size: U32, lhs: Relative(17), rhs: Direct(2) }, Store { destination_pointer: Relative(19), source: Relative(17) }, Const { destination: Relative(17), bit_size: Field, value: 2 }, Const { destination: Relative(21), bit_size: Integer(U32), value: 5 }, Const { destination: Relative(22), bit_size: Integer(U32), value: 6 }, Const { destination: Relative(23), bit_size: Field, value: -1094708040843609169356775910874053498301840173462935739639689208799068762676 }, Const { destination: Relative(24), bit_size: Integer(U32), value: 7 }, Const { destination: Relative(25), bit_size: Field, value: -718703907181967287621274717949248537252263842169639534402461291799004475262 }, Const { destination: Relative(26), bit_size: Integer(U32), value: 8 }, Const { destination: Relative(27), bit_size: Integer(U32), value: 9 }, Mov { destination: Relative(5), source: Relative(11) }, Jump { location: 356 }, BinaryIntOp { destination: Relative(14), op: LessThan, bit_size: U32, lhs: Relative(5), rhs: Relative(1) }, JumpIf { condition: Relative(14), location: 374 }, Jump { location: 359 }, Load { destination: Relative(1), source_pointer: Relative(3) }, BinaryFieldOp { destination: Relative(3), op: Equals, lhs: Relative(2), rhs: Relative(1) }, JumpIf { condition: Relative(3), location: 364 }, Const { destination: Relative(4), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(4) } }, Mov { destination: Relative(1), source: Direct(1) }, Const { destination: Relative(2), bit_size: Integer(U32), value: 3 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(2) }, IndirectConst { destination_pointer: Relative(1), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(2), op: Add, bit_size: U32, lhs: Relative(1), rhs: Direct(2) }, Mov { destination: Relative(3), source: Relative(2) }, Store { destination_pointer: Relative(3), source: Relative(12) }, BinaryIntOp { destination: Relative(3), op: Add, bit_size: U32, lhs: Relative(3), rhs: Direct(2) }, Store { destination_pointer: Relative(3), source: Relative(7) }, Return, BinaryIntOp { destination: Relative(29), op: Add, bit_size: U32, lhs: Relative(6), rhs: Direct(2) }, BinaryIntOp { destination: Relative(30), op: Add, bit_size: U32, lhs: Relative(29), rhs: Relative(5) }, Load { destination: Relative(28), source_pointer: Relative(30) }, JumpIf { condition: Relative(28), location: 386 }, Jump { location: 379 }, Load { destination: Relative(28), source_pointer: Relative(3) }, BinaryIntOp { destination: Relative(30), op: Add, bit_size: U32, lhs: Relative(4), rhs: Direct(2) }, BinaryIntOp { destination: Relative(31), op: Add, bit_size: U32, lhs: Relative(30), rhs: Relative(5) }, Load { destination: Relative(29), source_pointer: Relative(31) }, Mov { destination: Relative(14), source: Relative(28) }, Mov { destination: Relative(20), source: Relative(29) }, Jump { location: 393 }, BinaryIntOp { destination: Relative(29), op: Add, bit_size: U32, lhs: Relative(4), rhs: Direct(2) }, BinaryIntOp { destination: Relative(30), op: Add, bit_size: U32, lhs: Relative(29), rhs: Relative(5) }, Load { destination: Relative(28), source_pointer: Relative(30) }, Load { destination: Relative(29), source_pointer: Relative(3) }, Mov { destination: Relative(14), source: Relative(28) }, Mov { destination: Relative(20), source: Relative(29) }, Jump { location: 393 }, Mov { destination: Relative(29), source: Direct(1) }, Const { destination: Relative(30), bit_size: Integer(U32), value: 3 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(30) }, IndirectConst { destination_pointer: Relative(29), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(30), op: Add, bit_size: U32, lhs: Relative(29), rhs: Direct(2) }, Mov { destination: Relative(31), source: Relative(30) }, Store { destination_pointer: Relative(31), source: Relative(14) }, BinaryIntOp { destination: Relative(31), op: Add, bit_size: U32, lhs: Relative(31), rhs: Direct(2) }, Store { destination_pointer: Relative(31), source: Relative(20) }, Load { destination: Relative(14), source_pointer: Relative(16) }, Const { destination: Relative(20), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(30), op: Equals, bit_size: U32, lhs: Relative(20), rhs: Relative(14) }, Not { destination: Relative(30), source: Relative(30), bit_size: U1 }, JumpIf { condition: Relative(30), location: 408 }, Call { location: 657 }, BinaryIntOp { destination: Relative(14), op: Add, bit_size: U32, lhs: Relative(14), rhs: Direct(2) }, Store { destination_pointer: Relative(16), source: Relative(14) }, Mov { destination: Relative(14), source: Direct(1) }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Direct(2) }, Store { destination_pointer: Relative(14), source: Relative(16) }, Load { destination: Relative(30), source_pointer: Relative(18) }, Const { destination: Relative(31), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(32), op: Equals, bit_size: U32, lhs: Relative(31), rhs: Relative(30) }, Not { destination: Relative(32), source: Relative(32), bit_size: U1 }, JumpIf { condition: Relative(32), location: 419 }, Call { location: 657 }, BinaryIntOp { destination: Relative(30), op: Add, bit_size: U32, lhs: Relative(30), rhs: Direct(2) }, Store { destination_pointer: Relative(18), source: Relative(30) }, Mov { destination: Relative(30), source: Direct(1) }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Direct(2) }, Store { destination_pointer: Relative(30), source: Relative(18) }, Mov { destination: Relative(28), source: Relative(11) }, Jump { location: 426 }, BinaryIntOp { destination: Relative(20), op: LessThan, bit_size: U32, lhs: Relative(28), rhs: Relative(13) }, JumpIf { condition: Relative(20), location: 479 }, Jump { location: 429 }, Load { destination: Relative(20), source_pointer: Relative(14) }, Mov { destination: Direct(32771), source: Relative(20) }, Const { destination: Direct(32772), bit_size: Integer(U32), value: 7 }, Call { location: 679 }, Mov { destination: Relative(28), source: Direct(32773) }, BinaryIntOp { destination: Relative(29), op: Add, bit_size: U32, lhs: Relative(28), rhs: Relative(21) }, Store { destination_pointer: Relative(29), source: Relative(17) }, Mov { destination: Direct(32771), source: Relative(28) }, Const { destination: Direct(32772), bit_size: Integer(U32), value: 7 }, Call { location: 679 }, Mov { destination: Relative(20), source: Direct(32773) }, BinaryIntOp { destination: Relative(29), op: Add, bit_size: U32, lhs: Relative(20), rhs: Relative(22) }, Store { destination_pointer: Relative(29), source: Relative(8) }, Store { destination_pointer: Relative(14), source: Relative(20) }, Load { destination: Relative(14), source_pointer: Relative(30) }, Mov { destination: Direct(32771), source: Relative(14) }, Const { destination: Direct(32772), bit_size: Integer(U32), value: 10 }, Call { location: 679 }, Mov { destination: Relative(28), source: Direct(32773) }, BinaryIntOp { destination: Relative(29), op: Add, bit_size: U32, lhs: Relative(28), rhs: Relative(24) }, Store { destination_pointer: Relative(29), source: Relative(23) }, Mov { destination: Direct(32771), source: Relative(28) }, Const { destination: Direct(32772), bit_size: Integer(U32), value: 10 }, Call { location: 679 }, Mov { destination: Relative(14), source: Direct(32773) }, BinaryIntOp { destination: Relative(29), op: Add, bit_size: U32, lhs: Relative(14), rhs: Relative(26) }, Store { destination_pointer: Relative(29), source: Relative(25) }, Mov { destination: Direct(32771), source: Relative(14) }, Const { destination: Direct(32772), bit_size: Integer(U32), value: 10 }, Call { location: 679 }, Mov { destination: Relative(28), source: Direct(32773) }, BinaryIntOp { destination: Relative(29), op: Add, bit_size: U32, lhs: Relative(28), rhs: Relative(27) }, Store { destination_pointer: Relative(29), source: Relative(10) }, Store { destination_pointer: Relative(30), source: Relative(28) }, Mov { destination: Relative(14), source: Direct(1) }, Const { destination: Relative(29), bit_size: Integer(U32), value: 4 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(29) }, IndirectConst { destination_pointer: Relative(14), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(29), op: Add, bit_size: U32, lhs: Relative(28), rhs: Direct(2) }, Const { destination: Relative(30), bit_size: Integer(U32), value: 9 }, BinaryIntOp { destination: Relative(31), op: Add, bit_size: U32, lhs: Relative(20), rhs: Direct(2) }, Const { destination: Relative(32), bit_size: Integer(U32), value: 6 }, BinaryIntOp { destination: Relative(33), op: Add, bit_size: U32, lhs: Relative(14), rhs: Direct(2) }, BlackBox(MultiScalarMul { points: HeapVector { pointer: Relative(29), size: Relative(30) }, scalars: HeapVector { pointer: Relative(31), size: Relative(32) }, outputs: HeapArray { pointer: Relative(33), size: 3 } }), BinaryIntOp { destination: Relative(28), op: Add, bit_size: U32, lhs: Relative(14), rhs: Relative(9) }, Load { destination: Relative(20), source_pointer: Relative(28) }, Store { destination_pointer: Relative(3), source: Relative(20) }, BinaryIntOp { destination: Relative(14), op: Add, bit_size: U32, lhs: Relative(5), rhs: Relative(9) }, Mov { destination: Relative(5), source: Relative(14) }, Jump { location: 356 }, BinaryIntOp { destination: Relative(31), op: Add, bit_size: U32, lhs: Relative(29), rhs: Direct(2) }, BinaryIntOp { destination: Relative(32), op: Add, bit_size: U32, lhs: Relative(31), rhs: Relative(28) }, Load { destination: Relative(20), source_pointer: Relative(32) }, Cast { destination: Relative(32), source: Relative(20), bit_size: Integer(U128) }, Cast { destination: Relative(31), source: Relative(32), bit_size: Field }, BinaryFieldOp { destination: Relative(32), op: Sub, lhs: Relative(20), rhs: Relative(31) }, BinaryFieldOp { destination: Relative(33), op: Mul, lhs: Relative(32), rhs: Relative(15) }, BinaryFieldOp { destination: Relative(32), op: Mul, lhs: Direct(32835), rhs: Relative(33) }, BinaryFieldOp { destination: Relative(34), op: Add, lhs: Relative(31), rhs: Relative(32) }, BinaryFieldOp { destination: Relative(32), op: Equals, lhs: Relative(20), rhs: Relative(34) }, JumpIf { condition: Relative(32), location: 492 }, Const { destination: Relative(35), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(35) } }, Load { destination: Relative(20), source_pointer: Relative(14) }, BinaryIntOp { destination: Relative(32), op: Mul, bit_size: U32, lhs: Relative(28), rhs: Relative(13) }, Mov { destination: Direct(32771), source: Relative(20) }, Const { destination: Direct(32772), bit_size: Integer(U32), value: 7 }, Call { location: 679 }, Mov { destination: Relative(34), source: Direct(32773) }, BinaryIntOp { destination: Relative(35), op: Add, bit_size: U32, lhs: Relative(34), rhs: Direct(2) }, BinaryIntOp { destination: Relative(36), op: Add, bit_size: U32, lhs: Relative(35), rhs: Relative(32) }, Store { destination_pointer: Relative(36), source: Relative(31) }, BinaryIntOp { destination: Relative(20), op: Add, bit_size: U32, lhs: Relative(32), rhs: Relative(9) }, Mov { destination: Direct(32771), source: Relative(34) }, Const { destination: Direct(32772), bit_size: Integer(U32), value: 7 }, Call { location: 679 }, Mov { destination: Relative(31), source: Direct(32773) }, BinaryIntOp { destination: Relative(32), op: Add, bit_size: U32, lhs: Relative(31), rhs: Direct(2) }, BinaryIntOp { destination: Relative(35), op: Add, bit_size: U32, lhs: Relative(32), rhs: Relative(20) }, Store { destination_pointer: Relative(35), source: Relative(33) }, Store { destination_pointer: Relative(14), source: Relative(31) }, BinaryIntOp { destination: Relative(20), op: Mul, bit_size: U32, lhs: Relative(28), rhs: Relative(1) }, BinaryIntOp { destination: Relative(32), op: Add, bit_size: U32, lhs: Relative(19), rhs: Direct(2) }, BinaryIntOp { destination: Relative(33), op: Add, bit_size: U32, lhs: Relative(32), rhs: Relative(20) }, Load { destination: Relative(31), source_pointer: Relative(33) }, BinaryIntOp { destination: Relative(32), op: Add, bit_size: U32, lhs: Relative(20), rhs: Relative(9) }, BinaryIntOp { destination: Relative(34), op: Add, bit_size: U32, lhs: Relative(19), rhs: Direct(2) }, BinaryIntOp { destination: Relative(35), op: Add, bit_size: U32, lhs: Relative(34), rhs: Relative(32) }, Load { destination: Relative(33), source_pointer: Relative(35) }, BinaryIntOp { destination: Relative(34), op: Add, bit_size: U32, lhs: Relative(20), rhs: Relative(13) }, BinaryIntOp { destination: Relative(36), op: Add, bit_size: U32, lhs: Relative(19), rhs: Direct(2) }, BinaryIntOp { destination: Relative(37), op: Add, bit_size: U32, lhs: Relative(36), rhs: Relative(34) }, Load { destination: Relative(35), source_pointer: Relative(37) }, Load { destination: Relative(34), source_pointer: Relative(30) }, Mov { destination: Direct(32771), source: Relative(34) }, Const { destination: Direct(32772), bit_size: Integer(U32), value: 10 }, Call { location: 679 }, Mov { destination: Relative(36), source: Direct(32773) }, BinaryIntOp { destination: Relative(37), op: Add, bit_size: U32, lhs: Relative(36), rhs: Direct(2) }, BinaryIntOp { destination: Relative(38), op: Add, bit_size: U32, lhs: Relative(37), rhs: Relative(20) }, Store { destination_pointer: Relative(38), source: Relative(31) }, Mov { destination: Direct(32771), source: Relative(36) }, Const { destination: Direct(32772), bit_size: Integer(U32), value: 10 }, Call { location: 679 }, Mov { destination: Relative(20), source: Direct(32773) }, BinaryIntOp { destination: Relative(31), op: Add, bit_size: U32, lhs: Relative(20), rhs: Direct(2) }, BinaryIntOp { destination: Relative(34), op: Add, bit_size: U32, lhs: Relative(31), rhs: Relative(32) }, Store { destination_pointer: Relative(34), source: Relative(33) }, BinaryIntOp { destination: Relative(31), op: Add, bit_size: U32, lhs: Relative(32), rhs: Relative(9) }, Mov { destination: Direct(32771), source: Relative(20) }, Const { destination: Direct(32772), bit_size: Integer(U32), value: 10 }, Call { location: 679 }, Mov { destination: Relative(32), source: Direct(32773) }, BinaryIntOp { destination: Relative(33), op: Add, bit_size: U32, lhs: Relative(32), rhs: Direct(2) }, BinaryIntOp { destination: Relative(34), op: Add, bit_size: U32, lhs: Relative(33), rhs: Relative(31) }, Store { destination_pointer: Relative(34), source: Relative(35) }, Store { destination_pointer: Relative(30), source: Relative(32) }, BinaryIntOp { destination: Relative(20), op: Add, bit_size: U32, lhs: Relative(28), rhs: Relative(9) }, Mov { destination: Relative(28), source: Relative(20) }, Jump { location: 426 }, BinaryIntOp { destination: Relative(16), op: Add, bit_size: U32, lhs: Relative(14), rhs: Direct(2) }, BinaryIntOp { destination: Relative(17), op: Add, bit_size: U32, lhs: Relative(16), rhs: Relative(7) }, Load { destination: Relative(5), source_pointer: Relative(17) }, Cast { destination: Relative(17), source: Relative(5), bit_size: Integer(U128) }, Cast { destination: Relative(16), source: Relative(17), bit_size: Field }, BinaryFieldOp { destination: Relative(17), op: Sub, lhs: Relative(5), rhs: Relative(16) }, BinaryFieldOp { destination: Relative(18), op: Mul, lhs: Relative(17), rhs: Relative(15) }, BinaryFieldOp { destination: Relative(17), op: Mul, lhs: Direct(32835), rhs: Relative(18) }, BinaryFieldOp { destination: Relative(21), op: Add, lhs: Relative(16), rhs: Relative(17) }, BinaryFieldOp { destination: Relative(17), op: Equals, lhs: Relative(5), rhs: Relative(21) }, JumpIf { condition: Relative(17), location: 562 }, Const { destination: Relative(22), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(22) } }, Load { destination: Relative(5), source_pointer: Relative(6) }, BinaryIntOp { destination: Relative(17), op: Mul, bit_size: U32, lhs: Relative(7), rhs: Relative(13) }, Mov { destination: Direct(32771), source: Relative(5) }, Const { destination: Direct(32772), bit_size: Integer(U32), value: 5 }, Call { location: 679 }, Mov { destination: Relative(21), source: Direct(32773) }, BinaryIntOp { destination: Relative(22), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, BinaryIntOp { destination: Relative(23), op: Add, bit_size: U32, lhs: Relative(22), rhs: Relative(17) }, Store { destination_pointer: Relative(23), source: Relative(16) }, BinaryIntOp { destination: Relative(5), op: Add, bit_size: U32, lhs: Relative(17), rhs: Relative(9) }, Mov { destination: Direct(32771), source: Relative(21) }, Const { destination: Direct(32772), bit_size: Integer(U32), value: 5 }, Call { location: 679 }, Mov { destination: Relative(16), source: Direct(32773) }, BinaryIntOp { destination: Relative(17), op: Add, bit_size: U32, lhs: Relative(16), rhs: Direct(2) }, BinaryIntOp { destination: Relative(22), op: Add, bit_size: U32, lhs: Relative(17), rhs: Relative(5) }, Store { destination_pointer: Relative(22), source: Relative(18) }, Store { destination_pointer: Relative(6), source: Relative(16) }, BinaryIntOp { destination: Relative(5), op: Add, bit_size: U32, lhs: Relative(7), rhs: Relative(9) }, Mov { destination: Relative(7), source: Relative(5) }, Jump { location: 257 }, BinaryIntOp { destination: Relative(23), op: Add, bit_size: U32, lhs: Relative(14), rhs: Direct(2) }, BinaryIntOp { destination: Relative(24), op: Add, bit_size: U32, lhs: Relative(23), rhs: Relative(7) }, Load { destination: Relative(22), source_pointer: Relative(24) }, Cast { destination: Relative(24), source: Relative(22), bit_size: Integer(U128) }, Cast { destination: Relative(23), source: Relative(24), bit_size: Field }, BinaryFieldOp { destination: Relative(24), op: Sub, lhs: Relative(22), rhs: Relative(23) }, BinaryFieldOp { destination: Relative(25), op: Mul, lhs: Relative(24), rhs: Relative(15) }, BinaryFieldOp { destination: Relative(24), op: Mul, lhs: Direct(32835), rhs: Relative(25) }, BinaryFieldOp { destination: Relative(26), op: Add, lhs: Relative(23), rhs: Relative(24) }, BinaryFieldOp { destination: Relative(24), op: Equals, lhs: Relative(22), rhs: Relative(26) }, JumpIf { condition: Relative(24), location: 596 }, Const { destination: Relative(27), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(27) } }, Load { destination: Relative(22), source_pointer: Relative(21) }, BinaryIntOp { destination: Relative(24), op: Mul, bit_size: U32, lhs: Relative(7), rhs: Relative(13) }, Mov { destination: Direct(32771), source: Relative(22) }, Const { destination: Direct(32772), bit_size: Integer(U32), value: 7 }, Call { location: 679 }, Mov { destination: Relative(26), source: Direct(32773) }, BinaryIntOp { destination: Relative(27), op: Add, bit_size: U32, lhs: Relative(26), rhs: Direct(2) }, BinaryIntOp { destination: Relative(28), op: Add, bit_size: U32, lhs: Relative(27), rhs: Relative(24) }, Store { destination_pointer: Relative(28), source: Relative(23) }, BinaryIntOp { destination: Relative(22), op: Add, bit_size: U32, lhs: Relative(24), rhs: Relative(9) }, Mov { destination: Direct(32771), source: Relative(26) }, Const { destination: Direct(32772), bit_size: Integer(U32), value: 7 }, Call { location: 679 }, Mov { destination: Relative(23), source: Direct(32773) }, BinaryIntOp { destination: Relative(24), op: Add, bit_size: U32, lhs: Relative(23), rhs: Direct(2) }, BinaryIntOp { destination: Relative(27), op: Add, bit_size: U32, lhs: Relative(24), rhs: Relative(22) }, Store { destination_pointer: Relative(27), source: Relative(25) }, Store { destination_pointer: Relative(21), source: Relative(23) }, BinaryIntOp { destination: Relative(22), op: Add, bit_size: U32, lhs: Relative(7), rhs: Relative(9) }, Mov { destination: Relative(7), source: Relative(22) }, Jump { location: 189 }, BinaryIntOp { destination: Relative(17), op: Add, bit_size: U32, lhs: Relative(12), rhs: Direct(2) }, BinaryIntOp { destination: Relative(18), op: Add, bit_size: U32, lhs: Relative(17), rhs: Relative(7) }, Load { destination: Relative(16), source_pointer: Relative(18) }, Cast { destination: Relative(18), source: Relative(16), bit_size: Integer(U128) }, Cast { destination: Relative(17), source: Relative(18), bit_size: Field }, BinaryFieldOp { destination: Relative(18), op: Sub, lhs: Relative(16), rhs: Relative(17) }, BinaryFieldOp { destination: Relative(19), op: Mul, lhs: Relative(18), rhs: Relative(15) }, BinaryFieldOp { destination: Relative(18), op: Mul, lhs: Direct(32835), rhs: Relative(19) }, BinaryFieldOp { destination: Relative(20), op: Add, lhs: Relative(17), rhs: Relative(18) }, BinaryFieldOp { destination: Relative(18), op: Equals, lhs: Relative(16), rhs: Relative(20) }, JumpIf { condition: Relative(18), location: 630 }, Const { destination: Relative(21), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(21) } }, Load { destination: Relative(16), source_pointer: Relative(14) }, BinaryIntOp { destination: Relative(18), op: Mul, bit_size: U32, lhs: Relative(7), rhs: Relative(13) }, Mov { destination: Direct(32771), source: Relative(16) }, Const { destination: Direct(32772), bit_size: Integer(U32), value: 5 }, Call { location: 679 }, Mov { destination: Relative(20), source: Direct(32773) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(20), rhs: Direct(2) }, BinaryIntOp { destination: Relative(22), op: Add, bit_size: U32, lhs: Relative(21), rhs: Relative(18) }, Store { destination_pointer: Relative(22), source: Relative(17) }, BinaryIntOp { destination: Relative(16), op: Add, bit_size: U32, lhs: Relative(18), rhs: Relative(9) }, Mov { destination: Direct(32771), source: Relative(20) }, Const { destination: Direct(32772), bit_size: Integer(U32), value: 5 }, Call { location: 679 }, Mov { destination: Relative(17), source: Direct(32773) }, BinaryIntOp { destination: Relative(18), op: Add, bit_size: U32, lhs: Relative(17), rhs: Direct(2) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(18), rhs: Relative(16) }, Store { destination_pointer: Relative(21), source: Relative(19) }, Store { destination_pointer: Relative(14), source: Relative(17) }, BinaryIntOp { destination: Relative(16), op: Add, bit_size: U32, lhs: Relative(7), rhs: Relative(9) }, Mov { destination: Relative(7), source: Relative(16) }, Jump { location: 118 }, 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: 656 }, 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, Const { destination: Direct(32774), bit_size: Integer(U32), value: 2 }, BinaryIntOp { destination: Direct(32773), op: Div, bit_size: U32, lhs: Direct(32772), rhs: Direct(32774) }, Mov { destination: Direct(32776), source: Direct(32772) }, Const { destination: Direct(32777), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Direct(32778), op: LessThan, bit_size: U32, lhs: Direct(32777), rhs: Direct(32773) }, Not { destination: Direct(32778), source: Direct(32778), bit_size: U1 }, JumpIf { condition: Direct(32778), location: 678 }, BinaryIntOp { destination: Direct(32776), op: Sub, bit_size: U32, lhs: Direct(32776), rhs: Direct(2) }, BinaryIntOp { destination: Direct(32779), op: Add, bit_size: U32, lhs: Direct(32771), rhs: Direct(32777) }, Load { destination: Direct(32774), source_pointer: Direct(32779) }, BinaryIntOp { destination: Direct(32779), op: Add, bit_size: U32, lhs: Direct(32771), rhs: Direct(32776) }, Load { destination: Direct(32775), source_pointer: Direct(32779) }, BinaryIntOp { destination: Direct(32779), op: Add, bit_size: U32, lhs: Direct(32771), rhs: Direct(32777) }, Store { destination_pointer: Direct(32779), source: Direct(32775) }, BinaryIntOp { destination: Direct(32779), op: Add, bit_size: U32, lhs: Direct(32771), rhs: Direct(32776) }, Store { destination_pointer: Direct(32779), source: Direct(32774) }, BinaryIntOp { destination: Direct(32777), op: Add, bit_size: U32, lhs: Direct(32777), rhs: Direct(2) }, Jump { location: 664 }, Return, Load { destination: Direct(32774), source_pointer: Direct(32771) }, BinaryIntOp { destination: Direct(32775), op: Equals, bit_size: U32, lhs: Direct(32774), rhs: Direct(2) }, JumpIf { condition: Direct(32775), location: 683 }, Jump { location: 685 }, Mov { destination: Direct(32773), source: Direct(32771) }, Jump { location: 700 }, Mov { destination: Direct(32773), source: Direct(1) }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Direct(32772) }, BinaryIntOp { destination: Direct(32777), op: Add, bit_size: U32, lhs: Direct(32771), rhs: Direct(32772) }, Mov { destination: Direct(32778), source: Direct(32771) }, Mov { destination: Direct(32779), source: Direct(32773) }, BinaryIntOp { destination: Direct(32780), op: Equals, bit_size: U32, lhs: Direct(32778), rhs: Direct(32777) }, JumpIf { condition: Direct(32780), location: 697 }, Load { destination: Direct(32776), source_pointer: Direct(32778) }, Store { destination_pointer: Direct(32779), source: Direct(32776) }, BinaryIntOp { destination: Direct(32778), op: Add, bit_size: U32, lhs: Direct(32778), rhs: Direct(2) }, BinaryIntOp { destination: Direct(32779), op: Add, bit_size: U32, lhs: Direct(32779), rhs: Direct(2) }, Jump { location: 690 }, IndirectConst { destination_pointer: Direct(32773), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Direct(32774), op: Sub, bit_size: U32, lhs: Direct(32774), rhs: Direct(2) }, Jump { location: 700 }, Return]" ], - "debug_symbols": "tZrdbtu4Fkbfxde5EMnNv75KURRpmw4CBGmRaQ9wUOTdh582l9MCY0GQMDfdy7W9TFPfFiU6vy5fHj79/Ovj4/PXb39f3r3/dfn08vj09PjXx6dvn+9/PH57Hv/767LoH+uXd/HukhcvwUv0kryYl+yleKlemhe3FLcUtxS3FLcUtxS3FLcUtxS3FLdUt1S3VLfUYbFRzEv2UrxUL81LX0tbvAQv0cuw5FHMS/ZSvFQvzcuwhLtLX7wEL9FL8mJespfipXoZljZKX0tYllnDrHHWNKvNmmcts9ZZ26zTF6YvTF+YvjB9Yby+jxo17iCIQAIMyEABKtCAPiEtAOaEOWFOmBPmhDlhTpgTZsNsmE3mRSBzEhiQgQJUoAF9grLtEIAIyGwCA4a5qJZZ66xt1u5VUV9rmDXOmma1WadPgQ9VUIEG9AkKvkMAIpAAAzKAuWKumCvmhrlhbpgb5oa5YV57QHFS7qOOhJLvYEAGClCBBnSHqDZwCEAEEmBABgpQgQZgDpgD5oA5YA6YA+aAOWjqukDmKOgT4gIEIAIJMCADBaiAzEnQJ6y9lAUBiEACDMhAASrQAJlH2KJ6ySEAEUiAARkoQAUagDljzpgz5ow5Y17XiBGkuK4Lmt51ZVghAgkwIAMFqIDG0wRjPGmcI6JaxiEAEUiAARkoQAUaILOOl1rGQWZNr1rGIQEGZKAAFWhAn6A1xQFzx9wxq7+SCTJQAJk1Ceovh+6Q1F8OAYhAAgzIQAEq0ADMAXPAHDAHzOqv1AUZKEAFGtAnqL8cAhCBBGCOmCPmiDlijpgT5oQ5YU6YE+aEOWFOmNVfFgR9gvrLIQARSIABeYKWFIsCjXA0SFJfWBIEIAIJMCADBahAA/qEirlirpjXSygTZKAAevuIX1ovnjTC9fJphQgUXlOBBvB2xXh9sWLskIECVKAB3cGWBQjADJsRYyPGRoyNGBsxNmJsxNiIsRFjI8YWZiSMGBsxNmJsxNiIsRFjI8ZGjI0YGzE2hdaqQN9UH6qImp5SRB0ikAADMlCACjSgTzDMhtkwK6J5EegyOAgyUIAKNKBP0BLgEIAIJABzxpwxZ8wZc8ZcMBfMBbPaIUeBARkoQAUa0CeoHRwCEAGZk8CA7O1p6zKxgjyjQUx94RAAeXQo11uLFeTRPGtRKJpntUzRt1DLFH2oWqbos9QyK2hRcAiAzFmgS0p9lrrJIQMFqEADukNWNzkEIAIJMCADBahAAzCrm0oWBCACCTAgAwWoQAP6hIg5Yo6Y1U2lCAzIQAEq0IA+QR3nEIAIYE6YE+aEOWFOmBNmw2yYDbNhNsyG2TCrv0rVbfYCBGB4ahAkYHjqek8+PDUJhqfqoKi/qiZK/VVlVn+toP5yCIBG2AQy67PUXw4ZKEAFGtAnqL8cAhABzBVzxVwxV8wVc8XcMKu/qoaq/nLIgO6W182ICuh+WdOi/mqaFvVX07Sov5q+u/qryaz+cjAgAxphF8isz1pv7FfoDmW9t18hABFIgAEZKEAFGoA5YA6YA+aAOWBWN7UuaECfoG7qSRCA4ekmGJ6eBcPTi2CMsFfBGGGXWd3k0IA+Qd3UF4HM+ix1k0MCDMhAASrQgD5B3eSA2TAbZsNsmA2zYbbV/Pp6d2Hv6+OPl4cHbX39thk2tsi+3788PP+4vHv++fR0d/nf/dPP9UV/f79/XuuP+5fx7PiuD89fRh3Cr49PD6LXu7d3L7ffOtaM+eZs9fr2/Of7w+33j/N3QbD8Zghlr2GsCe1qyP2WIW0YslKzGsZKvJw2pFuGjXkcTTAFpditeSy33z+2bDgQY3cmv42g/2GoG4amddkNLZdDhrZcDS0cMIztEeZxbHXcNISNiUw58TXGLYkdGUTQ7f0cREk3BxFPJ2q/4kikaiRStS83WzOfzlQop0O1rdiVqi3F3lj107HaHMW+XMVwOlf7FUdy1QqCHuOtXEU7nauYT+dqW7ErV1uKnbnS5t7JXG2OYl+u0nJ+BVz+y1yN35O4FBg/Fd28mEgb6/D4/eeqGLuxNxW2qbB/U4S2fxQ5XZM1rvlvjmLrXBEbFzVj//xmvtPWMpbfYjFuGQ8pxrU+inGlekhRw1VR23JLYedX9M0jksL1iIzN3ltHZGMQvaez2UypXseQl0MKi9ez3tgmO6Zo11GMK+ebis1DqnsQP6RtWQ6lol/XkLHzb8cUy3UUPfQjipEEzhZjvz8fUyzLVRHSMYWFq6KH84pj09ksXg9qPnZQW7Q3xc0vkjeWsrGVzUEdG9U3Tzh548zZFr5H+/28Wf8UbHyNcj3/l5wOCa63xKW1YwIyVZfbI9iaxpgYwtie74eORLyeao4rQt2h2I7U9UpxpCscU9TrMth6PaYob6Oox67R3rY54hIPKcLbPsdQ3DxblXa6vUo/2V51Odlem4I97bUt2NFem9O4r722Fbvaa1uxq722I9Wul8u9H7rB3xnszRv8fcGu/XSw23Iy2C2cDPamYE+wtwU7gr05jfuCva3YFextxa5gb0dqV7Dr6VzX07Huy+lY93Ay1j2ejPWmYE+stwU7Yr05jftiva3YFettxa5Y12Op/jAe3X9+fPnjj6Ff5Xp5vP/09DAffv35/Pm3Z3/8/zvP8MfU31++fX748vPlQaa3v6ge/7wvo2vrsny4uwQ9KstdqW08Gr9cvR+36Jb1zPrCHO5KLnq4vnJc7JbcP7xqmP8A", + "debug_symbols": "tZrdbtu4Fkbfxde5EMnNv75KURRpmw4CBGmRaQ9wUOTdh582l9MCY0GQMDfdy7W9TFPfFiU6vy5fHj79/Ovj4/PXb39f3r3/dfn08vj09PjXx6dvn+9/PH57Hv/767LoH+uXd/HukhcvwUv0kryYl+yleKlemhe3FLcUtxS3FLcUtxS3FLcUtxS3FLdUt1S3VLfUYbFRzEv2UrxUL81LX0tbvAQv0cuw5FHMS/ZSvFQvzcuwhLtLX7wEL9FL8mJespfipXoZljZKX0tYllnDrHHWNKvNmmcts9ZZ26zTF6YvTF+YvjB9Yby+jxo17iCIQAIMyEABKtCAPiEtAOaEOWFOmBPmhDlhTpgTZsNsmE3mRSBzEhiQgQJUoAF9grLtEIAIyGwCA4a5qJZZ66xt1u5VUV9rmDXOmma1WadPgQ9VUIEG9AkKvkMAIpAAAzKAuWKumCvmhrlhbpgb5oa5YV57QHFS7qOOhJLvYEAGClCBBnSHqDZwCEAEEmBABgpQgQZgDpgD5oA5YA6YA+aAOWjqukDmKOgT4gIEIAIJMCADBaiAzEnQJ6y9lAUBiEACDMhAASrQAJlH2KJ6ySEAEUiAARkoQAUagDljzpgz5ow5Y17XiBGkuK4Lmt51ZVghAgkwIAMFqIDG0wRjPGmcI6JaxiEAEUiAARkoQAUaILOOl1rGQWZNr1rGIQEGZKAAFWhAn6A1xQFzx9wxq7+SCTJQAJk1Ceovh+6Q1F8OAYhAAgzIQAEq0ADMAXPAHDAHzOqv1AUZKEAFGtAnqL8cAhCBBGCOmCPmiDlijpgT5oQ5YU6YE+aEOWFOmNVfFgR9gvrLIQARSIABeYKWFIsCjXA0SFJfWBIEIAIJMCADBahAA/qEirlirpjXSygTZKAAevuIX1ovnjTC9fJphQgUXlOBBvB2xXh9sWLskIECVKAB3cGWBQjADJsRYyPGRoyNGBsxNmJsxNiIsRFjI8YWZiSMGBsxNmJsxNiIsRFjI8ZGjI0YGzE2hdaqQN9UH6qImp5SRB0ikAADMlCACjSgTzDMhtkwK6J5EegyOAgyUIAKNKBP0BLgEIAIJABzxpwxZ8wZc8ZcMBfMBbPaIUeBARkoQAUa0CeoHRwCEAGZk8CA7O1p6zKxgjyjQUx94RAAeXQo11uLFeTRPGtRKJpntUzRt1DLFH2oWqbos9QyK2hRcAiAzFmgS0p9lrrJIQMFqEADukNWNzkEIAIJMCADBahAAzCrm0oWBCACCTAgAwWoQAP6hIg5Yo6Y1U2lCAzIQAEq0IA+QR3nEIAIYE6YE+aEOWFOmBNmw2yYDbNhNsyG2TCrv0rVbfYCBGB4ahAkYHjqek8+PDUJhqfqoKi/qiZK/VVlVn+toP5yCIBG2AQy67PUXw4ZKEAFGtAnqL8cAhABzBVzxVwxV8wVc8XcMKu/qoaq/nLIgO6W182ICuh+WdOi/mqaFvVX07Sov5q+u/qryaz+cjAgAxphF8isz1pv7FfoDmW9t18hABFIgAEZKEAFGoA5YA6YA+aAOWBWN7UuaECfoG7qSRCA4ekmGJ6eBcPTi2CMsFfBGGGXWd3k0IA+Qd3UF4HM+ix1k0MCDMhAASrQgD5B3eSA2TAbZsNsmA2zYbbV/Pp6d2Hv6+OPl4cHbX39thk2tsi+3788PP+4vHv++fR0d/nf/dPP9UV/f79/XuuP+5fx7PiuD89fRh3Cr49PD6LXu7d3L7ffOtaM+eZs9fr2/Of7w+33j/N3QbD8Zghlr2GsCe1qyP2WIW0YslKzGsZKvJw2pFuGjXkcTTAFpditeSy33z+2bDgQY3cmv42g/2GoG4amddkNLZdDhrZcDS0cMIztEeZxbHXcNISNiUw58TXGLYkdGUTQ7f0cREk3BxFPJ2q/4kikaiRStS83WzOfzlQop0O1rdiVqi3F3lj107HaHMW+XMVwOlf7FUdy1QqCHuOtXEU7nauYT+dqW7ErV1uKnbnS5t7JXG2OYl+u0nJ+BVz+y1yN35O4FBg/Fd28mEgb6/D4/eeqGLuxNxW2qbB/U4S2fxT5ekDGLy3l5ii2zhWxcVEz9s9v5jttLWNvoxjYDinGtT6KcaV6SFHDVVHbckth51f0zSOSwrXXx2bvrSOyMYje09lspnRNRcrLIYVdl/Tx86EdU7RrvMdGy03F5iHVPYgf0rYsh1LRr2vI2Pm3Y4rlOooe+hHFSAJni7Hfn48pluWqCOmYwsJV0cN5xbHpbBavBzUfO6gt2pvi5hfJG0vZ2MrmoI6N6psnnLxx5mwL36P9ft6sfwo2vka5nv9LTocE11vi0toxAZmqy+0RbE1jTAxhbM/3Q0cixnxaEeoOxXakrleKI13hmKJel8HW6zFFeRtFPXaN9rbNEZd4SBHe9jmG4ubZqrTT7VX6yfaqy8n22hTsaa9twY722pzGfe21rdjVXtuKXe21Hal2vVzu/dAN/s5gb97g7wt27aeD3ZaTwW7hZLA3BXuCvS3YEezNadwX7G3FrmBvK3YFeztSu4JdT+e6no51X07HuoeTse7xZKw3BXtivS3YEevNadwX623FrlhvK3bFuh5L9Yfx6P7z48sffwz9KtfL4/2np4f58OvP58+/Pfvj/995hj+m/v7y7fPDl58vDzK9/UX1+Od9GV1bl+XD3SXoUVnuSm3j0fjl6v24RbesZ9YX5nBXctHD9ZXjYrfk/uFVw/wH", "file_map": { "16": { "source": "use crate::cmp::Eq;\nuse crate::hash::Hash;\nuse crate::ops::arith::{Add, Neg, Sub};\n\n/// A point on the embedded elliptic curve\n/// By definition, the base field of the embedded curve is the scalar field of the proof system curve, i.e the Noir Field.\n/// x and y denotes the Weierstrass coordinates of the point, if is_infinite is false.\npub struct EmbeddedCurvePoint {\n pub x: Field,\n pub y: Field,\n pub is_infinite: bool,\n}\n\nimpl EmbeddedCurvePoint {\n /// Elliptic curve point doubling operation\n /// returns the doubled point of a point P, i.e P+P\n pub fn double(self) -> EmbeddedCurvePoint {\n embedded_curve_add(self, self)\n }\n\n /// Returns the null element of the curve; 'the point at infinity'\n pub fn point_at_infinity() -> EmbeddedCurvePoint {\n EmbeddedCurvePoint { x: 0, y: 0, is_infinite: true }\n }\n\n /// Returns the curve's generator point.\n pub fn generator() -> EmbeddedCurvePoint {\n // Generator point for the grumpkin curve (y^2 = x^3 - 17)\n EmbeddedCurvePoint {\n x: 1,\n y: 17631683881184975370165255887551781615748388533673675138860, // sqrt(-16)\n is_infinite: false,\n }\n }\n}\n\nimpl Add for EmbeddedCurvePoint {\n /// Adds two points P+Q, using the curve addition formula, and also handles point at infinity\n fn add(self, other: EmbeddedCurvePoint) -> EmbeddedCurvePoint {\n embedded_curve_add(self, other)\n }\n}\n\nimpl Sub for EmbeddedCurvePoint {\n /// Points subtraction operation, using addition and negation\n fn sub(self, other: EmbeddedCurvePoint) -> EmbeddedCurvePoint {\n self + other.neg()\n }\n}\n\nimpl Neg for EmbeddedCurvePoint {\n /// Negates a point P, i.e returns -P, by negating the y coordinate.\n /// If the point is at infinity, then the result is also at infinity.\n fn neg(self) -> EmbeddedCurvePoint {\n EmbeddedCurvePoint { x: self.x, y: -self.y, is_infinite: self.is_infinite }\n }\n}\n\nimpl Eq for EmbeddedCurvePoint {\n /// Checks whether two points are equal\n fn eq(self: Self, b: EmbeddedCurvePoint) -> bool {\n (self.is_infinite & b.is_infinite)\n | ((self.is_infinite == b.is_infinite) & (self.x == b.x) & (self.y == b.y))\n }\n}\n\nimpl Hash for EmbeddedCurvePoint {\n fn hash(self, state: &mut H)\n where\n H: crate::hash::Hasher,\n {\n if self.is_infinite {\n self.is_infinite.hash(state);\n } else {\n self.x.hash(state);\n self.y.hash(state);\n }\n }\n}\n\n/// Scalar for the embedded curve represented as low and high limbs\n/// By definition, the scalar field of the embedded curve is base field of the proving system curve.\n/// It may not fit into a Field element, so it is represented with two Field elements; its low and high limbs.\npub struct EmbeddedCurveScalar {\n pub lo: Field,\n pub hi: Field,\n}\n\nimpl EmbeddedCurveScalar {\n pub fn new(lo: Field, hi: Field) -> Self {\n EmbeddedCurveScalar { lo, hi }\n }\n\n #[field(bn254)]\n pub fn from_field(scalar: Field) -> EmbeddedCurveScalar {\n let (a, b) = crate::field::bn254::decompose(scalar);\n EmbeddedCurveScalar { lo: a, hi: b }\n }\n\n //Bytes to scalar: take the first (after the specified offset) 16 bytes of the input as the lo value, and the next 16 bytes as the hi value\n #[field(bn254)]\n pub(crate) fn from_bytes(bytes: [u8; 64], offset: u32) -> EmbeddedCurveScalar {\n let mut v = 1;\n let mut lo = 0 as Field;\n let mut hi = 0 as Field;\n for i in 0..16 {\n lo = lo + (bytes[offset + 31 - i] as Field) * v;\n hi = hi + (bytes[offset + 15 - i] as Field) * v;\n v = v * 256;\n }\n let sig_s = crate::embedded_curve_ops::EmbeddedCurveScalar { lo, hi };\n sig_s\n }\n}\n\nimpl Eq for EmbeddedCurveScalar {\n fn eq(self, other: Self) -> bool {\n (other.hi == self.hi) & (other.lo == self.lo)\n }\n}\n\nimpl Hash for EmbeddedCurveScalar {\n fn hash(self, state: &mut H)\n where\n H: crate::hash::Hasher,\n {\n self.hi.hash(state);\n self.lo.hash(state);\n }\n}\n\n// Computes a multi scalar multiplication over the embedded curve.\n// For bn254, We have Grumpkin and Baby JubJub.\n// For bls12-381, we have JubJub and Bandersnatch.\n//\n// The embedded curve being used is decided by the\n// underlying proof system.\n// docs:start:multi_scalar_mul\npub fn multi_scalar_mul(\n points: [EmbeddedCurvePoint; N],\n scalars: [EmbeddedCurveScalar; N],\n) -> EmbeddedCurvePoint\n// docs:end:multi_scalar_mul\n{\n multi_scalar_mul_array_return(points, scalars)[0]\n}\n\n#[foreign(multi_scalar_mul)]\npub(crate) fn multi_scalar_mul_array_return(\n points: [EmbeddedCurvePoint; N],\n scalars: [EmbeddedCurveScalar; N],\n) -> [EmbeddedCurvePoint; 1] {}\n\n// docs:start:fixed_base_scalar_mul\npub fn fixed_base_scalar_mul(scalar: EmbeddedCurveScalar) -> EmbeddedCurvePoint\n// docs:end:fixed_base_scalar_mul\n{\n multi_scalar_mul([EmbeddedCurvePoint::generator()], [scalar])\n}\n\n/// This function only assumes that the points are on the curve\n/// It handles corner cases around the infinity point causing some overhead compared to embedded_curve_add_not_nul and embedded_curve_add_unsafe\n// docs:start:embedded_curve_add\npub fn embedded_curve_add(\n point1: EmbeddedCurvePoint,\n point2: EmbeddedCurvePoint,\n) -> EmbeddedCurvePoint {\n // docs:end:embedded_curve_add\n if crate::runtime::is_unconstrained() {\n // `embedded_curve_add_unsafe` requires the inputs not to be the infinity point, so we check it here.\n // This is because `embedded_curve_add_unsafe` uses the `embedded_curve_add` opcode.\n // For efficiency, the backend does not check the inputs for the infinity point, but it assumes that they are not the infinity point\n // so that it can apply the ec addition formula directly.\n if point1.is_infinite {\n point2\n } else if point2.is_infinite {\n point1\n } else {\n embedded_curve_add_unsafe(point1, point2)\n }\n } else {\n // In a constrained context, we also need to check the inputs are not the infinity point because we also use `embedded_curve_add_unsafe`\n // However we also need to identify the case where the two inputs are the same, because then\n // the addition formula does not work and we need to use the doubling formula instead.\n // In unconstrained context, we can check directly if the input values are the same when solving the opcode, so it is not an issue.\n\n // x_coordinates_match is true if both abscissae are the same\n let x_coordinates_match = point1.x == point2.x;\n // y_coordinates_match is true if both ordinates are the same\n let y_coordinates_match = point1.y == point2.y;\n // double_predicate is true if both abscissae and ordinates are the same\n let double_predicate = (x_coordinates_match & y_coordinates_match);\n // If the abscissae are the same, but not the ordinates, then one point is the opposite of the other\n let infinity_predicate = (x_coordinates_match & !y_coordinates_match);\n let point1_1 = EmbeddedCurvePoint {\n x: point1.x + (x_coordinates_match as Field),\n y: point1.y,\n is_infinite: false,\n };\n let point2_1 = EmbeddedCurvePoint { x: point2.x, y: point2.y, is_infinite: false };\n // point1_1 is guaranteed to have a different abscissa than point2:\n // - if x_coordinates_match is 0, that means point1.x != point2.x, and point1_1.x = point1.x + 0\n // - if x_coordinates_match is 1, that means point1.x = point2.x, but point1_1.x = point1.x + 1 in this case\n // Because the abscissa is different, the addition formula is guaranteed to succeed, so we can safely use `embedded_curve_add_unsafe`\n // Note that this computation may be garbage: if x_coordinates_match is 1, or if one of the input is the point at infinity.\n let mut result = embedded_curve_add_unsafe(point1_1, point2_1);\n\n // `embedded_curve_add_unsafe` is doing a doubling if the input is the same variable, because in this case it is guaranteed (at 'compile time') that the input is the same.\n let double = embedded_curve_add_unsafe(point1, point1);\n // `embedded_curve_add_unsafe` would not perform doubling, even if the inputs point1 and point2 are the same, because it cannot know this without adding some logic (and some constraints)\n // However we did this logic when we computed `double_predicate`, so we set the result to 2*point1 if point1 and point2 are the same\n result = if double_predicate { double } else { result };\n\n // Same logic as above for unconstrained context, we set the proper result when one of the inputs is the infinity point\n if point1.is_infinite {\n result = point2;\n }\n if point2.is_infinite {\n result = point1;\n }\n\n // Finally, we set the is_infinity flag of the result:\n // Opposite points should sum into the infinity point, however, if one of them is point at infinity, their coordinates are not meaningful\n // so we should not use the fact that the inputs are opposite in this case:\n let mut result_is_infinity =\n infinity_predicate & (!point1.is_infinite & !point2.is_infinite);\n // However, if both of them are at infinity, then the result is also at infinity\n result.is_infinite = result_is_infinity | (point1.is_infinite & point2.is_infinite);\n result\n }\n}\n\n#[foreign(embedded_curve_add)]\nfn embedded_curve_add_array_return(\n _point1: EmbeddedCurvePoint,\n _point2: EmbeddedCurvePoint,\n) -> [EmbeddedCurvePoint; 1] {}\n\n/// This function assumes that:\n/// The points are on the curve, and\n/// The points don't share an x-coordinate, and\n/// Neither point is the infinity point.\n/// If it is used with correct input, the function ensures the correct non-zero result is returned.\n/// Except for points on the curve, the other assumptions are checked by the function. It will cause assertion failure if they are not respected.\npub fn embedded_curve_add_not_nul(\n point1: EmbeddedCurvePoint,\n point2: EmbeddedCurvePoint,\n) -> EmbeddedCurvePoint {\n assert(point1.x != point2.x);\n assert(!point1.is_infinite);\n assert(!point2.is_infinite);\n // Ensure is_infinite is comptime\n let point1_1 = EmbeddedCurvePoint { x: point1.x, y: point1.y, is_infinite: false };\n let point2_1 = EmbeddedCurvePoint { x: point2.x, y: point2.y, is_infinite: false };\n embedded_curve_add_unsafe(point1_1, point2_1)\n}\n\n/// Unsafe ec addition\n/// If the inputs are the same, it will perform a doubling, but only if point1 and point2 are the same variable.\n/// If they have the same value but are different variables, the result will be incorrect because in this case\n/// it assumes (but does not check) that the points' x-coordinates are not equal.\n/// It also assumes neither point is the infinity point.\npub fn embedded_curve_add_unsafe(\n point1: EmbeddedCurvePoint,\n point2: EmbeddedCurvePoint,\n) -> EmbeddedCurvePoint {\n embedded_curve_add_array_return(point1, point2)[0]\n}\n", @@ -104,7 +104,7 @@ expression: artifact "path": "std/hash/mod.nr" }, "50": { - "source": "fn main(\n // Public key of note\n // all notes have the same denomination\n priv_key: Field,\n // Merkle membership proof\n note_root: pub Field,\n index: Field,\n note_hash_path: [Field; 3],\n // Receiver public key\n to_pubkey_x: Field,\n to_pubkey_y: Field,\n) -> pub [Field; 2] {\n let priv_key_as_scalar = std::embedded_curve_ops::EmbeddedCurveScalar { lo: priv_key, hi: 0 };\n // Compute public key from private key to show ownership\n let pubkey = std::embedded_curve_ops::fixed_base_scalar_mul(priv_key_as_scalar);\n // Compute input note commitment\n let note_commitment = std::hash::pedersen_commitment([pubkey.x, pubkey.y]);\n // Compute input note nullifier\n let nullifier = std::hash::pedersen_commitment([note_commitment.x, index, priv_key]);\n // Compute output note nullifier\n let receiver_note_commitment = std::hash::pedersen_commitment([to_pubkey_x, to_pubkey_y]);\n // Check that the input note nullifier is in the root\n assert(note_root == compute_merkle_root(note_commitment.x, index, note_hash_path));\n\n [nullifier.x, receiver_note_commitment.x]\n}\n\nfn compute_merkle_root(leaf: Field, index: Field, hash_path: [Field; N]) -> Field {\n let index_bits: [u1; N] = index.to_le_bits();\n let mut current = leaf;\n for i in 0..N {\n let path_bit = index_bits[i] as bool;\n let (hash_left, hash_right) = if path_bit {\n (hash_path[i], current)\n } else {\n (current, hash_path[i])\n };\n current = std::hash::pedersen_hash([hash_left, hash_right]);\n }\n current\n}\n", + "source": "fn main(\n // Public key of note\n // all notes have the same denomination\n priv_key: Field,\n // Merkle membership proof\n note_root: pub Field,\n index: Field,\n note_hash_path: [Field; 3],\n // Receiver public key\n to_pubkey_x: Field,\n to_pubkey_y: Field,\n) -> pub [Field; 2] {\n let priv_key_as_scalar = std::embedded_curve_ops::EmbeddedCurveScalar { lo: priv_key, hi: 0 };\n // Compute public key from private key to show ownership\n let pubkey = std::embedded_curve_ops::fixed_base_scalar_mul(priv_key_as_scalar);\n // Compute input note commitment\n let note_commitment = std::hash::pedersen_commitment([pubkey.x, pubkey.y]);\n // Compute input note nullifier\n let nullifier = std::hash::pedersen_commitment([note_commitment.x, index, priv_key]);\n // Compute output note nullifier\n let receiver_note_commitment = std::hash::pedersen_commitment([to_pubkey_x, to_pubkey_y]);\n // Check that the input note nullifier is in the root\n assert(note_root == compute_merkle_root(note_commitment.x, index, note_hash_path));\n\n [nullifier.x, receiver_note_commitment.x]\n}\n\nfn compute_merkle_root(leaf: Field, index: Field, hash_path: [Field; N]) -> Field {\n let index_bits: [u1; N] = index.to_le_bits();\n let mut current = leaf;\n for i in 0..N {\n let path_bit = index_bits[i] != 0;\n let (hash_left, hash_right) = if path_bit {\n (hash_path[i], current)\n } else {\n (current, hash_path[i])\n };\n current = std::hash::pedersen_hash([hash_left, hash_right]);\n }\n current\n}\n", "path": "" } }, diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/simple_shield/execute__tests__force_brillig_true_inliner_9223372036854775807.snap b/tooling/nargo_cli/tests/snapshots/execution_success/simple_shield/execute__tests__force_brillig_true_inliner_9223372036854775807.snap index 0aea6ea13af..190c988edc2 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/simple_shield/execute__tests__force_brillig_true_inliner_9223372036854775807.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/simple_shield/execute__tests__force_brillig_true_inliner_9223372036854775807.snap @@ -85,7 +85,7 @@ expression: artifact "unconstrained func 0", "[Const { destination: Direct(2), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(1), bit_size: Integer(U32), value: 32846 }, Const { destination: Direct(0), bit_size: Integer(U32), value: 3 }, Const { destination: Relative(7), bit_size: Integer(U32), value: 8 }, Const { destination: Relative(8), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(32836), size_address: Relative(7), offset_address: Relative(8) }, Mov { destination: Relative(1), source: Direct(32836) }, Mov { destination: Relative(2), source: Direct(32837) }, Mov { destination: Relative(3), source: Direct(32838) }, Const { destination: Relative(4), bit_size: Integer(U32), value: 32839 }, Const { destination: Relative(8), bit_size: Integer(U32), value: 3 }, Mov { destination: Relative(7), source: Direct(1) }, Const { destination: Relative(9), bit_size: Integer(U32), value: 4 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(9) }, IndirectConst { destination_pointer: Relative(7), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(9), op: Add, bit_size: U32, lhs: Relative(7), rhs: Direct(2) }, Mov { destination: Direct(32771), source: Relative(4) }, Mov { destination: Direct(32772), source: Relative(9) }, Mov { destination: Direct(32773), source: Relative(8) }, Call { location: 35 }, Mov { destination: Relative(4), source: Relative(7) }, Mov { destination: Relative(5), source: Direct(32842) }, Mov { destination: Relative(6), source: Direct(32843) }, Call { location: 46 }, Call { location: 48 }, BinaryIntOp { destination: Relative(2), op: Add, bit_size: U32, lhs: Relative(1), rhs: Direct(2) }, Const { destination: Relative(3), bit_size: Integer(U32), value: 32844 }, Const { destination: Relative(4), bit_size: Integer(U32), value: 2 }, Mov { destination: Direct(32771), source: Relative(2) }, Mov { destination: Direct(32772), source: Relative(3) }, Mov { destination: Direct(32773), source: Relative(4) }, Call { location: 35 }, Const { destination: Relative(2), bit_size: Integer(U32), value: 32844 }, Const { destination: Relative(3), bit_size: Integer(U32), value: 2 }, Stop { return_data: HeapVector { pointer: Relative(2), size: Relative(3) } }, BinaryIntOp { destination: Direct(32775), op: Add, bit_size: U32, lhs: Direct(32771), rhs: Direct(32773) }, Mov { destination: Direct(32776), source: Direct(32771) }, Mov { destination: Direct(32777), source: Direct(32772) }, BinaryIntOp { destination: Direct(32778), op: Equals, bit_size: U32, lhs: Direct(32776), rhs: Direct(32775) }, JumpIf { condition: Direct(32778), location: 45 }, Load { destination: Direct(32774), source_pointer: Direct(32776) }, Store { destination_pointer: Direct(32777), source: Direct(32774) }, BinaryIntOp { destination: Direct(32776), op: Add, bit_size: U32, lhs: Direct(32776), rhs: Direct(2) }, BinaryIntOp { destination: Direct(32777), op: Add, bit_size: U32, lhs: Direct(32777), rhs: Direct(2) }, Jump { location: 38 }, Return, Const { destination: Direct(32835), bit_size: Field, value: 340282366920938463463374607431768211456 }, Return, Call { location: 651 }, Const { destination: Relative(8), bit_size: Field, value: 1 }, Const { destination: Relative(9), bit_size: Field, value: 17631683881184975370165255887551781615748388533673675138860 }, Const { destination: Relative(10), bit_size: Integer(U1), value: 0 }, Mov { destination: Relative(11), source: Direct(1) }, Const { destination: Relative(12), bit_size: Integer(U32), value: 4 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(12) }, IndirectConst { destination_pointer: Relative(11), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(12), op: Add, bit_size: U32, lhs: Relative(11), rhs: Direct(2) }, Mov { destination: Relative(13), source: Relative(12) }, Store { destination_pointer: Relative(13), source: Relative(8) }, BinaryIntOp { destination: Relative(13), op: Add, bit_size: U32, lhs: Relative(13), rhs: Direct(2) }, Store { destination_pointer: Relative(13), source: Relative(9) }, BinaryIntOp { destination: Relative(13), op: Add, bit_size: U32, lhs: Relative(13), rhs: Direct(2) }, Store { destination_pointer: Relative(13), source: Relative(10) }, Const { destination: Relative(8), bit_size: Field, value: 0 }, Mov { destination: Relative(9), source: Direct(1) }, Const { destination: Relative(12), bit_size: Integer(U32), value: 3 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(12) }, IndirectConst { destination_pointer: Relative(9), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(12), op: Add, bit_size: U32, lhs: Relative(9), rhs: Direct(2) }, Mov { destination: Relative(13), source: Relative(12) }, Store { destination_pointer: Relative(13), source: Relative(1) }, BinaryIntOp { destination: Relative(13), op: Add, bit_size: U32, lhs: Relative(13), rhs: Direct(2) }, Store { destination_pointer: Relative(13), source: Relative(8) }, Mov { destination: Relative(12), source: Direct(1) }, Const { destination: Relative(13), bit_size: Integer(U32), value: 4 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(13) }, IndirectConst { destination_pointer: Relative(12), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(13), op: Add, bit_size: U32, lhs: Relative(11), rhs: Direct(2) }, Const { destination: Relative(14), bit_size: Integer(U32), value: 3 }, BinaryIntOp { destination: Relative(15), op: Add, bit_size: U32, lhs: Relative(9), rhs: Direct(2) }, Const { destination: Relative(16), bit_size: Integer(U32), value: 2 }, BinaryIntOp { destination: Relative(17), op: Add, bit_size: U32, lhs: Relative(12), rhs: Direct(2) }, BlackBox(MultiScalarMul { points: HeapVector { pointer: Relative(13), size: Relative(14) }, scalars: HeapVector { pointer: Relative(15), size: Relative(16) }, outputs: HeapArray { pointer: Relative(17), size: 3 } }), Const { destination: Relative(9), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(13), op: Add, bit_size: U32, lhs: Relative(12), rhs: Relative(9) }, Load { destination: Relative(11), source_pointer: Relative(13) }, Const { destination: Relative(13), bit_size: Integer(U32), value: 2 }, BinaryIntOp { destination: Relative(15), op: Add, bit_size: U32, lhs: Relative(12), rhs: Relative(13) }, Load { destination: Relative(14), source_pointer: Relative(15) }, Mov { destination: Relative(12), source: Direct(1) }, Const { destination: Relative(15), bit_size: Integer(U32), value: 3 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(15) }, IndirectConst { destination_pointer: Relative(12), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(15), op: Add, bit_size: U32, lhs: Relative(12), rhs: Direct(2) }, Mov { destination: Relative(16), source: Relative(15) }, Store { destination_pointer: Relative(16), source: Relative(11) }, BinaryIntOp { destination: Relative(16), op: Add, bit_size: U32, lhs: Relative(16), rhs: Direct(2) }, Store { destination_pointer: Relative(16), source: Relative(14) }, Mov { destination: Relative(11), source: Direct(1) }, Const { destination: Relative(14), bit_size: Integer(U32), value: 5 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(14) }, IndirectConst { destination_pointer: Relative(11), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(14), op: Add, bit_size: U32, lhs: Relative(11), rhs: Direct(2) }, Mov { destination: Relative(15), source: Relative(14) }, Store { destination_pointer: Relative(15), source: Relative(8) }, BinaryIntOp { destination: Relative(15), op: Add, bit_size: U32, lhs: Relative(15), rhs: Direct(2) }, Store { destination_pointer: Relative(15), source: Relative(8) }, BinaryIntOp { destination: Relative(15), op: Add, bit_size: U32, lhs: Relative(15), rhs: Direct(2) }, Store { destination_pointer: Relative(15), source: Relative(8) }, BinaryIntOp { destination: Relative(15), op: Add, bit_size: U32, lhs: Relative(15), rhs: Direct(2) }, Store { destination_pointer: Relative(15), source: Relative(8) }, Mov { destination: Relative(14), source: Direct(1) }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Direct(2) }, Store { destination_pointer: Relative(14), source: Relative(11) }, Const { destination: Relative(11), bit_size: Integer(U32), value: 0 }, Const { destination: Relative(15), bit_size: Field, value: 8680525429001239497728366687280168587232520577698044359798894838135247199343 }, Mov { destination: Relative(7), source: Relative(11) }, Jump { location: 118 }, BinaryIntOp { destination: Relative(16), op: LessThan, bit_size: U32, lhs: Relative(7), rhs: Relative(13) }, JumpIf { condition: Relative(16), location: 617 }, Jump { location: 121 }, Const { destination: Relative(12), bit_size: Field, value: 3728882899078719075161482178784387565366481897740339799480980287259621149274 }, Const { destination: Relative(16), bit_size: Field, value: -9903063709032878667290627648209915537972247634463802596148419711785767431332 }, Const { destination: Relative(17), bit_size: Field, value: 2393473289045184898987089634332637236754766663897650125720167164137088869378 }, Const { destination: Relative(18), bit_size: Field, value: -7135402912423807765050323395026152633898511180575289670895350565966806597339 }, Mov { destination: Relative(19), source: Direct(1) }, Const { destination: Relative(20), bit_size: Integer(U32), value: 7 }, 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(12) }, 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(10) }, 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(21), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(10) }, Load { destination: Relative(20), source_pointer: Relative(14) }, Mov { destination: Relative(14), source: Direct(1) }, Const { destination: Relative(21), bit_size: Integer(U32), value: 4 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(21) }, IndirectConst { destination_pointer: Relative(14), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(19), rhs: Direct(2) }, Const { destination: Relative(22), bit_size: Integer(U32), value: 6 }, BinaryIntOp { destination: Relative(23), op: Add, bit_size: U32, lhs: Relative(20), rhs: Direct(2) }, Const { destination: Relative(24), bit_size: Integer(U32), value: 4 }, BinaryIntOp { destination: Relative(25), op: Add, bit_size: U32, lhs: Relative(14), rhs: Direct(2) }, BlackBox(MultiScalarMul { points: HeapVector { pointer: Relative(21), size: Relative(22) }, scalars: HeapVector { pointer: Relative(23), size: Relative(24) }, outputs: HeapArray { pointer: Relative(25), size: 3 } }), BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(14), rhs: Relative(9) }, Load { destination: Relative(20), source_pointer: Relative(21) }, Mov { destination: Relative(14), source: Direct(1) }, Const { destination: Relative(21), bit_size: Integer(U32), value: 4 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(21) }, IndirectConst { destination_pointer: Relative(14), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(14), rhs: Direct(2) }, Mov { destination: Relative(22), source: Relative(21) }, Store { destination_pointer: Relative(22), source: Relative(20) }, BinaryIntOp { destination: Relative(22), op: Add, bit_size: U32, lhs: Relative(22), rhs: Direct(2) }, Store { destination_pointer: Relative(22), source: Relative(3) }, BinaryIntOp { destination: Relative(22), op: Add, bit_size: U32, lhs: Relative(22), rhs: Direct(2) }, Store { destination_pointer: Relative(22), source: Relative(1) }, Mov { destination: Relative(1), source: Direct(1) }, Const { destination: Relative(21), bit_size: Integer(U32), value: 7 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(21) }, IndirectConst { destination_pointer: Relative(1), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(1), rhs: Direct(2) }, Mov { destination: Relative(22), source: Relative(21) }, Store { destination_pointer: Relative(22), source: Relative(8) }, BinaryIntOp { destination: Relative(22), op: Add, bit_size: U32, lhs: Relative(22), rhs: Direct(2) }, Store { destination_pointer: Relative(22), source: Relative(8) }, BinaryIntOp { destination: Relative(22), op: Add, bit_size: U32, lhs: Relative(22), rhs: Direct(2) }, Store { destination_pointer: Relative(22), source: Relative(8) }, BinaryIntOp { destination: Relative(22), op: Add, bit_size: U32, lhs: Relative(22), rhs: Direct(2) }, Store { destination_pointer: Relative(22), source: Relative(8) }, BinaryIntOp { destination: Relative(22), op: Add, bit_size: U32, lhs: Relative(22), rhs: Direct(2) }, Store { destination_pointer: Relative(22), source: Relative(8) }, BinaryIntOp { destination: Relative(22), op: Add, bit_size: U32, lhs: Relative(22), rhs: Direct(2) }, Store { destination_pointer: Relative(22), source: Relative(8) }, Mov { destination: Relative(21), source: Direct(1) }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Direct(2) }, Store { destination_pointer: Relative(21), source: Relative(1) }, Const { destination: Relative(1), bit_size: Integer(U32), value: 3 }, Mov { destination: Relative(7), source: Relative(11) }, Jump { location: 189 }, BinaryIntOp { destination: Relative(22), op: LessThan, bit_size: U32, lhs: Relative(7), rhs: Relative(1) }, JumpIf { condition: Relative(22), location: 583 }, Jump { location: 192 }, Const { destination: Relative(14), bit_size: Field, value: -9101662836674550326256996212378706138142399878494295154626728833686305224889 }, Const { destination: Relative(22), bit_size: Field, value: 1658946642478826263901298755938807527017017780224674388532518006781615929512 }, Mov { destination: Relative(23), source: Direct(1) }, Const { destination: Relative(24), bit_size: Integer(U32), value: 10 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(24) }, IndirectConst { destination_pointer: Relative(23), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(24), op: Add, bit_size: U32, lhs: Relative(23), rhs: Direct(2) }, Mov { destination: Relative(25), source: Relative(24) }, Store { destination_pointer: Relative(25), source: Relative(12) }, BinaryIntOp { destination: Relative(25), op: Add, bit_size: U32, lhs: Relative(25), rhs: Direct(2) }, Store { destination_pointer: Relative(25), source: Relative(16) }, BinaryIntOp { destination: Relative(25), op: Add, bit_size: U32, lhs: Relative(25), rhs: Direct(2) }, Store { destination_pointer: Relative(25), source: Relative(10) }, BinaryIntOp { destination: Relative(25), op: Add, bit_size: U32, lhs: Relative(25), rhs: Direct(2) }, Store { destination_pointer: Relative(25), source: Relative(17) }, BinaryIntOp { destination: Relative(25), op: Add, bit_size: U32, lhs: Relative(25), rhs: Direct(2) }, Store { destination_pointer: Relative(25), source: Relative(18) }, BinaryIntOp { destination: Relative(25), op: Add, bit_size: U32, lhs: Relative(25), rhs: Direct(2) }, Store { destination_pointer: Relative(25), source: Relative(10) }, BinaryIntOp { destination: Relative(25), op: Add, bit_size: U32, lhs: Relative(25), rhs: Direct(2) }, Store { destination_pointer: Relative(25), source: Relative(14) }, BinaryIntOp { destination: Relative(25), op: Add, bit_size: U32, lhs: Relative(25), rhs: Direct(2) }, Store { destination_pointer: Relative(25), source: Relative(22) }, BinaryIntOp { destination: Relative(25), op: Add, bit_size: U32, lhs: Relative(25), rhs: Direct(2) }, Store { destination_pointer: Relative(25), source: Relative(10) }, Load { destination: Relative(12), source_pointer: Relative(21) }, Mov { destination: Relative(14), source: Direct(1) }, Const { destination: Relative(16), bit_size: Integer(U32), value: 4 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(16) }, IndirectConst { destination_pointer: Relative(14), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(16), op: Add, bit_size: U32, lhs: Relative(23), rhs: Direct(2) }, Const { destination: Relative(17), bit_size: Integer(U32), value: 9 }, BinaryIntOp { destination: Relative(18), op: Add, bit_size: U32, lhs: Relative(12), rhs: Direct(2) }, Const { destination: Relative(21), bit_size: Integer(U32), value: 6 }, BinaryIntOp { destination: Relative(22), op: Add, bit_size: U32, lhs: Relative(14), rhs: Direct(2) }, BlackBox(MultiScalarMul { points: HeapVector { pointer: Relative(16), size: Relative(17) }, scalars: HeapVector { pointer: Relative(18), size: Relative(21) }, outputs: HeapArray { pointer: Relative(22), size: 3 } }), BinaryIntOp { destination: Relative(16), op: Add, bit_size: U32, lhs: Relative(14), rhs: Relative(9) }, Load { destination: Relative(12), source_pointer: Relative(16) }, Mov { destination: Relative(14), source: Direct(1) }, Const { destination: Relative(16), bit_size: Integer(U32), value: 3 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(16) }, IndirectConst { destination_pointer: Relative(14), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(16), op: Add, bit_size: U32, lhs: Relative(14), rhs: Direct(2) }, Mov { destination: Relative(17), source: Relative(16) }, Store { destination_pointer: Relative(17), source: Relative(5) }, BinaryIntOp { destination: Relative(17), op: Add, bit_size: U32, lhs: Relative(17), rhs: Direct(2) }, Store { destination_pointer: Relative(17), source: Relative(6) }, Mov { destination: Relative(5), source: Direct(1) }, Const { destination: Relative(6), bit_size: Integer(U32), value: 5 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(6) }, IndirectConst { destination_pointer: Relative(5), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(6), op: Add, bit_size: U32, lhs: Relative(5), rhs: Direct(2) }, Mov { destination: Relative(16), source: Relative(6) }, Store { destination_pointer: Relative(16), source: Relative(8) }, BinaryIntOp { destination: Relative(16), op: Add, bit_size: U32, lhs: Relative(16), rhs: Direct(2) }, Store { destination_pointer: Relative(16), source: Relative(8) }, BinaryIntOp { destination: Relative(16), op: Add, bit_size: U32, lhs: Relative(16), rhs: Direct(2) }, Store { destination_pointer: Relative(16), source: Relative(8) }, BinaryIntOp { destination: Relative(16), op: Add, bit_size: U32, lhs: Relative(16), rhs: Direct(2) }, Store { destination_pointer: Relative(16), source: Relative(8) }, Mov { destination: Relative(6), source: Direct(1) }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Direct(2) }, Store { destination_pointer: Relative(6), source: Relative(5) }, Mov { destination: Relative(7), source: Relative(11) }, Jump { location: 257 }, BinaryIntOp { destination: Relative(5), op: LessThan, bit_size: U32, lhs: Relative(7), rhs: Relative(13) }, JumpIf { condition: Relative(5), location: 549 }, Jump { location: 260 }, Load { destination: Relative(7), source_pointer: Relative(19) }, Const { destination: Relative(14), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(16), op: Equals, bit_size: U32, lhs: Relative(14), rhs: Relative(7) }, Not { destination: Relative(16), source: Relative(16), bit_size: U1 }, JumpIf { condition: Relative(16), location: 266 }, Call { location: 657 }, BinaryIntOp { destination: Relative(7), op: Add, bit_size: U32, lhs: Relative(7), rhs: Direct(2) }, Store { destination_pointer: Relative(19), source: Relative(7) }, Load { destination: Relative(7), source_pointer: Relative(6) }, Mov { destination: Relative(6), source: Direct(1) }, Const { destination: Relative(16), bit_size: Integer(U32), value: 4 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(16) }, IndirectConst { destination_pointer: Relative(6), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(16), op: Add, bit_size: U32, lhs: Relative(19), rhs: Direct(2) }, Const { destination: Relative(17), bit_size: Integer(U32), value: 6 }, BinaryIntOp { destination: Relative(18), op: Add, bit_size: U32, lhs: Relative(7), rhs: Direct(2) }, Const { destination: Relative(21), bit_size: Integer(U32), value: 4 }, BinaryIntOp { destination: Relative(22), op: Add, bit_size: U32, lhs: Relative(6), rhs: Direct(2) }, BlackBox(MultiScalarMul { points: HeapVector { pointer: Relative(16), size: Relative(17) }, scalars: HeapVector { pointer: Relative(18), size: Relative(21) }, outputs: HeapArray { pointer: Relative(22), size: 3 } }), BinaryIntOp { destination: Relative(16), op: Add, bit_size: U32, lhs: Relative(6), rhs: Relative(9) }, Load { destination: Relative(7), source_pointer: Relative(16) }, Const { destination: Relative(16), bit_size: Integer(U32), value: 2 }, Const { destination: Relative(17), bit_size: Integer(U1), value: 1 }, Mov { destination: Relative(6), source: Direct(1) }, Const { destination: Relative(18), bit_size: Integer(U32), value: 4 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(18) }, IndirectConst { destination_pointer: Relative(6), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(18), op: Add, bit_size: U32, lhs: Relative(6), rhs: Direct(2) }, Const { destination: Relative(21), bit_size: Integer(U32), value: 3 }, BlackBox(ToRadix { input: Relative(3), radix: Relative(16), output_pointer: Relative(18), num_limbs: Relative(21), output_bits: Relative(17) }), Const { destination: Relative(22), bit_size: Integer(U32), value: 3 }, Mov { destination: Direct(32771), source: Relative(18) }, Mov { destination: Direct(32772), source: Relative(22) }, Call { location: 660 }, Mov { destination: Relative(3), source: Direct(1) }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Direct(2) }, Store { destination_pointer: Relative(3), source: Relative(20) }, Mov { destination: Relative(16), source: Direct(1) }, Const { destination: Relative(17), bit_size: Integer(U32), value: 7 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(17) }, IndirectConst { destination_pointer: Relative(16), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(17), op: Add, bit_size: U32, lhs: Relative(16), rhs: Direct(2) }, Mov { destination: Relative(18), source: Relative(17) }, Store { destination_pointer: Relative(18), source: Relative(8) }, BinaryIntOp { destination: Relative(18), op: Add, bit_size: U32, lhs: Relative(18), rhs: Direct(2) }, Store { destination_pointer: Relative(18), source: Relative(8) }, BinaryIntOp { destination: Relative(18), op: Add, bit_size: U32, lhs: Relative(18), rhs: Direct(2) }, Store { destination_pointer: Relative(18), source: Relative(8) }, BinaryIntOp { destination: Relative(18), op: Add, bit_size: U32, lhs: Relative(18), rhs: Direct(2) }, Store { destination_pointer: Relative(18), source: Relative(8) }, BinaryIntOp { destination: Relative(18), op: Add, bit_size: U32, lhs: Relative(18), rhs: Direct(2) }, Store { destination_pointer: Relative(18), source: Relative(8) }, BinaryIntOp { destination: Relative(18), op: Add, bit_size: U32, lhs: Relative(18), rhs: Direct(2) }, Store { destination_pointer: Relative(18), source: Relative(8) }, Const { destination: Relative(17), bit_size: Integer(U1), value: 1 }, Mov { destination: Relative(18), source: Direct(1) }, Const { destination: Relative(20), bit_size: Integer(U32), value: 10 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(20) }, IndirectConst { destination_pointer: Relative(18), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(20), op: Add, bit_size: U32, lhs: Relative(18), rhs: Direct(2) }, Mov { destination: Relative(21), source: Relative(20) }, 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(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(8) }, 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(8) }, 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) }, Load { destination: Relative(17), source_pointer: Relative(19) }, Const { destination: Relative(20), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(21), op: Equals, bit_size: U32, lhs: Relative(20), rhs: Relative(17) }, Not { destination: Relative(21), source: Relative(21), bit_size: U1 }, JumpIf { condition: Relative(21), location: 344 }, Call { location: 657 }, BinaryIntOp { destination: Relative(17), op: Add, bit_size: U32, lhs: Relative(17), rhs: Direct(2) }, Store { destination_pointer: Relative(19), source: Relative(17) }, Const { destination: Relative(17), bit_size: Field, value: 2 }, Const { destination: Relative(21), bit_size: Integer(U32), value: 5 }, Const { destination: Relative(22), bit_size: Integer(U32), value: 6 }, Const { destination: Relative(23), bit_size: Field, value: -1094708040843609169356775910874053498301840173462935739639689208799068762676 }, Const { destination: Relative(24), bit_size: Integer(U32), value: 7 }, Const { destination: Relative(25), bit_size: Field, value: -718703907181967287621274717949248537252263842169639534402461291799004475262 }, Const { destination: Relative(26), bit_size: Integer(U32), value: 8 }, Const { destination: Relative(27), bit_size: Integer(U32), value: 9 }, Mov { destination: Relative(5), source: Relative(11) }, Jump { location: 356 }, BinaryIntOp { destination: Relative(14), op: LessThan, bit_size: U32, lhs: Relative(5), rhs: Relative(1) }, JumpIf { condition: Relative(14), location: 374 }, Jump { location: 359 }, Load { destination: Relative(1), source_pointer: Relative(3) }, BinaryFieldOp { destination: Relative(3), op: Equals, lhs: Relative(2), rhs: Relative(1) }, JumpIf { condition: Relative(3), location: 364 }, Const { destination: Relative(4), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(4) } }, Mov { destination: Relative(1), source: Direct(1) }, Const { destination: Relative(2), bit_size: Integer(U32), value: 3 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(2) }, IndirectConst { destination_pointer: Relative(1), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(2), op: Add, bit_size: U32, lhs: Relative(1), rhs: Direct(2) }, Mov { destination: Relative(3), source: Relative(2) }, Store { destination_pointer: Relative(3), source: Relative(12) }, BinaryIntOp { destination: Relative(3), op: Add, bit_size: U32, lhs: Relative(3), rhs: Direct(2) }, Store { destination_pointer: Relative(3), source: Relative(7) }, Return, BinaryIntOp { destination: Relative(29), op: Add, bit_size: U32, lhs: Relative(6), rhs: Direct(2) }, BinaryIntOp { destination: Relative(30), op: Add, bit_size: U32, lhs: Relative(29), rhs: Relative(5) }, Load { destination: Relative(28), source_pointer: Relative(30) }, JumpIf { condition: Relative(28), location: 386 }, Jump { location: 379 }, Load { destination: Relative(28), source_pointer: Relative(3) }, BinaryIntOp { destination: Relative(30), op: Add, bit_size: U32, lhs: Relative(4), rhs: Direct(2) }, BinaryIntOp { destination: Relative(31), op: Add, bit_size: U32, lhs: Relative(30), rhs: Relative(5) }, Load { destination: Relative(29), source_pointer: Relative(31) }, Mov { destination: Relative(14), source: Relative(28) }, Mov { destination: Relative(20), source: Relative(29) }, Jump { location: 393 }, BinaryIntOp { destination: Relative(29), op: Add, bit_size: U32, lhs: Relative(4), rhs: Direct(2) }, BinaryIntOp { destination: Relative(30), op: Add, bit_size: U32, lhs: Relative(29), rhs: Relative(5) }, Load { destination: Relative(28), source_pointer: Relative(30) }, Load { destination: Relative(29), source_pointer: Relative(3) }, Mov { destination: Relative(14), source: Relative(28) }, Mov { destination: Relative(20), source: Relative(29) }, Jump { location: 393 }, Mov { destination: Relative(29), source: Direct(1) }, Const { destination: Relative(30), bit_size: Integer(U32), value: 3 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(30) }, IndirectConst { destination_pointer: Relative(29), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(30), op: Add, bit_size: U32, lhs: Relative(29), rhs: Direct(2) }, Mov { destination: Relative(31), source: Relative(30) }, Store { destination_pointer: Relative(31), source: Relative(14) }, BinaryIntOp { destination: Relative(31), op: Add, bit_size: U32, lhs: Relative(31), rhs: Direct(2) }, Store { destination_pointer: Relative(31), source: Relative(20) }, Load { destination: Relative(14), source_pointer: Relative(16) }, Const { destination: Relative(20), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(30), op: Equals, bit_size: U32, lhs: Relative(20), rhs: Relative(14) }, Not { destination: Relative(30), source: Relative(30), bit_size: U1 }, JumpIf { condition: Relative(30), location: 408 }, Call { location: 657 }, BinaryIntOp { destination: Relative(14), op: Add, bit_size: U32, lhs: Relative(14), rhs: Direct(2) }, Store { destination_pointer: Relative(16), source: Relative(14) }, Mov { destination: Relative(14), source: Direct(1) }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Direct(2) }, Store { destination_pointer: Relative(14), source: Relative(16) }, Load { destination: Relative(30), source_pointer: Relative(18) }, Const { destination: Relative(31), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(32), op: Equals, bit_size: U32, lhs: Relative(31), rhs: Relative(30) }, Not { destination: Relative(32), source: Relative(32), bit_size: U1 }, JumpIf { condition: Relative(32), location: 419 }, Call { location: 657 }, BinaryIntOp { destination: Relative(30), op: Add, bit_size: U32, lhs: Relative(30), rhs: Direct(2) }, Store { destination_pointer: Relative(18), source: Relative(30) }, Mov { destination: Relative(30), source: Direct(1) }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Direct(2) }, Store { destination_pointer: Relative(30), source: Relative(18) }, Mov { destination: Relative(28), source: Relative(11) }, Jump { location: 426 }, BinaryIntOp { destination: Relative(20), op: LessThan, bit_size: U32, lhs: Relative(28), rhs: Relative(13) }, JumpIf { condition: Relative(20), location: 479 }, Jump { location: 429 }, Load { destination: Relative(20), source_pointer: Relative(14) }, Mov { destination: Direct(32771), source: Relative(20) }, Const { destination: Direct(32772), bit_size: Integer(U32), value: 7 }, Call { location: 679 }, Mov { destination: Relative(28), source: Direct(32773) }, BinaryIntOp { destination: Relative(29), op: Add, bit_size: U32, lhs: Relative(28), rhs: Relative(21) }, Store { destination_pointer: Relative(29), source: Relative(17) }, Mov { destination: Direct(32771), source: Relative(28) }, Const { destination: Direct(32772), bit_size: Integer(U32), value: 7 }, Call { location: 679 }, Mov { destination: Relative(20), source: Direct(32773) }, BinaryIntOp { destination: Relative(29), op: Add, bit_size: U32, lhs: Relative(20), rhs: Relative(22) }, Store { destination_pointer: Relative(29), source: Relative(8) }, Store { destination_pointer: Relative(14), source: Relative(20) }, Load { destination: Relative(14), source_pointer: Relative(30) }, Mov { destination: Direct(32771), source: Relative(14) }, Const { destination: Direct(32772), bit_size: Integer(U32), value: 10 }, Call { location: 679 }, Mov { destination: Relative(28), source: Direct(32773) }, BinaryIntOp { destination: Relative(29), op: Add, bit_size: U32, lhs: Relative(28), rhs: Relative(24) }, Store { destination_pointer: Relative(29), source: Relative(23) }, Mov { destination: Direct(32771), source: Relative(28) }, Const { destination: Direct(32772), bit_size: Integer(U32), value: 10 }, Call { location: 679 }, Mov { destination: Relative(14), source: Direct(32773) }, BinaryIntOp { destination: Relative(29), op: Add, bit_size: U32, lhs: Relative(14), rhs: Relative(26) }, Store { destination_pointer: Relative(29), source: Relative(25) }, Mov { destination: Direct(32771), source: Relative(14) }, Const { destination: Direct(32772), bit_size: Integer(U32), value: 10 }, Call { location: 679 }, Mov { destination: Relative(28), source: Direct(32773) }, BinaryIntOp { destination: Relative(29), op: Add, bit_size: U32, lhs: Relative(28), rhs: Relative(27) }, Store { destination_pointer: Relative(29), source: Relative(10) }, Store { destination_pointer: Relative(30), source: Relative(28) }, Mov { destination: Relative(14), source: Direct(1) }, Const { destination: Relative(29), bit_size: Integer(U32), value: 4 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(29) }, IndirectConst { destination_pointer: Relative(14), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(29), op: Add, bit_size: U32, lhs: Relative(28), rhs: Direct(2) }, Const { destination: Relative(30), bit_size: Integer(U32), value: 9 }, BinaryIntOp { destination: Relative(31), op: Add, bit_size: U32, lhs: Relative(20), rhs: Direct(2) }, Const { destination: Relative(32), bit_size: Integer(U32), value: 6 }, BinaryIntOp { destination: Relative(33), op: Add, bit_size: U32, lhs: Relative(14), rhs: Direct(2) }, BlackBox(MultiScalarMul { points: HeapVector { pointer: Relative(29), size: Relative(30) }, scalars: HeapVector { pointer: Relative(31), size: Relative(32) }, outputs: HeapArray { pointer: Relative(33), size: 3 } }), BinaryIntOp { destination: Relative(28), op: Add, bit_size: U32, lhs: Relative(14), rhs: Relative(9) }, Load { destination: Relative(20), source_pointer: Relative(28) }, Store { destination_pointer: Relative(3), source: Relative(20) }, BinaryIntOp { destination: Relative(14), op: Add, bit_size: U32, lhs: Relative(5), rhs: Relative(9) }, Mov { destination: Relative(5), source: Relative(14) }, Jump { location: 356 }, BinaryIntOp { destination: Relative(31), op: Add, bit_size: U32, lhs: Relative(29), rhs: Direct(2) }, BinaryIntOp { destination: Relative(32), op: Add, bit_size: U32, lhs: Relative(31), rhs: Relative(28) }, Load { destination: Relative(20), source_pointer: Relative(32) }, Cast { destination: Relative(32), source: Relative(20), bit_size: Integer(U128) }, Cast { destination: Relative(31), source: Relative(32), bit_size: Field }, BinaryFieldOp { destination: Relative(32), op: Sub, lhs: Relative(20), rhs: Relative(31) }, BinaryFieldOp { destination: Relative(33), op: Mul, lhs: Relative(32), rhs: Relative(15) }, BinaryFieldOp { destination: Relative(32), op: Mul, lhs: Direct(32835), rhs: Relative(33) }, BinaryFieldOp { destination: Relative(34), op: Add, lhs: Relative(31), rhs: Relative(32) }, BinaryFieldOp { destination: Relative(32), op: Equals, lhs: Relative(20), rhs: Relative(34) }, JumpIf { condition: Relative(32), location: 492 }, Const { destination: Relative(35), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(35) } }, Load { destination: Relative(20), source_pointer: Relative(14) }, BinaryIntOp { destination: Relative(32), op: Mul, bit_size: U32, lhs: Relative(28), rhs: Relative(13) }, Mov { destination: Direct(32771), source: Relative(20) }, Const { destination: Direct(32772), bit_size: Integer(U32), value: 7 }, Call { location: 679 }, Mov { destination: Relative(34), source: Direct(32773) }, BinaryIntOp { destination: Relative(35), op: Add, bit_size: U32, lhs: Relative(34), rhs: Direct(2) }, BinaryIntOp { destination: Relative(36), op: Add, bit_size: U32, lhs: Relative(35), rhs: Relative(32) }, Store { destination_pointer: Relative(36), source: Relative(31) }, BinaryIntOp { destination: Relative(20), op: Add, bit_size: U32, lhs: Relative(32), rhs: Relative(9) }, Mov { destination: Direct(32771), source: Relative(34) }, Const { destination: Direct(32772), bit_size: Integer(U32), value: 7 }, Call { location: 679 }, Mov { destination: Relative(31), source: Direct(32773) }, BinaryIntOp { destination: Relative(32), op: Add, bit_size: U32, lhs: Relative(31), rhs: Direct(2) }, BinaryIntOp { destination: Relative(35), op: Add, bit_size: U32, lhs: Relative(32), rhs: Relative(20) }, Store { destination_pointer: Relative(35), source: Relative(33) }, Store { destination_pointer: Relative(14), source: Relative(31) }, BinaryIntOp { destination: Relative(20), op: Mul, bit_size: U32, lhs: Relative(28), rhs: Relative(1) }, BinaryIntOp { destination: Relative(32), op: Add, bit_size: U32, lhs: Relative(19), rhs: Direct(2) }, BinaryIntOp { destination: Relative(33), op: Add, bit_size: U32, lhs: Relative(32), rhs: Relative(20) }, Load { destination: Relative(31), source_pointer: Relative(33) }, BinaryIntOp { destination: Relative(32), op: Add, bit_size: U32, lhs: Relative(20), rhs: Relative(9) }, BinaryIntOp { destination: Relative(34), op: Add, bit_size: U32, lhs: Relative(19), rhs: Direct(2) }, BinaryIntOp { destination: Relative(35), op: Add, bit_size: U32, lhs: Relative(34), rhs: Relative(32) }, Load { destination: Relative(33), source_pointer: Relative(35) }, BinaryIntOp { destination: Relative(34), op: Add, bit_size: U32, lhs: Relative(20), rhs: Relative(13) }, BinaryIntOp { destination: Relative(36), op: Add, bit_size: U32, lhs: Relative(19), rhs: Direct(2) }, BinaryIntOp { destination: Relative(37), op: Add, bit_size: U32, lhs: Relative(36), rhs: Relative(34) }, Load { destination: Relative(35), source_pointer: Relative(37) }, Load { destination: Relative(34), source_pointer: Relative(30) }, Mov { destination: Direct(32771), source: Relative(34) }, Const { destination: Direct(32772), bit_size: Integer(U32), value: 10 }, Call { location: 679 }, Mov { destination: Relative(36), source: Direct(32773) }, BinaryIntOp { destination: Relative(37), op: Add, bit_size: U32, lhs: Relative(36), rhs: Direct(2) }, BinaryIntOp { destination: Relative(38), op: Add, bit_size: U32, lhs: Relative(37), rhs: Relative(20) }, Store { destination_pointer: Relative(38), source: Relative(31) }, Mov { destination: Direct(32771), source: Relative(36) }, Const { destination: Direct(32772), bit_size: Integer(U32), value: 10 }, Call { location: 679 }, Mov { destination: Relative(20), source: Direct(32773) }, BinaryIntOp { destination: Relative(31), op: Add, bit_size: U32, lhs: Relative(20), rhs: Direct(2) }, BinaryIntOp { destination: Relative(34), op: Add, bit_size: U32, lhs: Relative(31), rhs: Relative(32) }, Store { destination_pointer: Relative(34), source: Relative(33) }, BinaryIntOp { destination: Relative(31), op: Add, bit_size: U32, lhs: Relative(32), rhs: Relative(9) }, Mov { destination: Direct(32771), source: Relative(20) }, Const { destination: Direct(32772), bit_size: Integer(U32), value: 10 }, Call { location: 679 }, Mov { destination: Relative(32), source: Direct(32773) }, BinaryIntOp { destination: Relative(33), op: Add, bit_size: U32, lhs: Relative(32), rhs: Direct(2) }, BinaryIntOp { destination: Relative(34), op: Add, bit_size: U32, lhs: Relative(33), rhs: Relative(31) }, Store { destination_pointer: Relative(34), source: Relative(35) }, Store { destination_pointer: Relative(30), source: Relative(32) }, BinaryIntOp { destination: Relative(20), op: Add, bit_size: U32, lhs: Relative(28), rhs: Relative(9) }, Mov { destination: Relative(28), source: Relative(20) }, Jump { location: 426 }, BinaryIntOp { destination: Relative(16), op: Add, bit_size: U32, lhs: Relative(14), rhs: Direct(2) }, BinaryIntOp { destination: Relative(17), op: Add, bit_size: U32, lhs: Relative(16), rhs: Relative(7) }, Load { destination: Relative(5), source_pointer: Relative(17) }, Cast { destination: Relative(17), source: Relative(5), bit_size: Integer(U128) }, Cast { destination: Relative(16), source: Relative(17), bit_size: Field }, BinaryFieldOp { destination: Relative(17), op: Sub, lhs: Relative(5), rhs: Relative(16) }, BinaryFieldOp { destination: Relative(18), op: Mul, lhs: Relative(17), rhs: Relative(15) }, BinaryFieldOp { destination: Relative(17), op: Mul, lhs: Direct(32835), rhs: Relative(18) }, BinaryFieldOp { destination: Relative(21), op: Add, lhs: Relative(16), rhs: Relative(17) }, BinaryFieldOp { destination: Relative(17), op: Equals, lhs: Relative(5), rhs: Relative(21) }, JumpIf { condition: Relative(17), location: 562 }, Const { destination: Relative(22), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(22) } }, Load { destination: Relative(5), source_pointer: Relative(6) }, BinaryIntOp { destination: Relative(17), op: Mul, bit_size: U32, lhs: Relative(7), rhs: Relative(13) }, Mov { destination: Direct(32771), source: Relative(5) }, Const { destination: Direct(32772), bit_size: Integer(U32), value: 5 }, Call { location: 679 }, Mov { destination: Relative(21), source: Direct(32773) }, BinaryIntOp { destination: Relative(22), op: Add, bit_size: U32, lhs: Relative(21), rhs: Direct(2) }, BinaryIntOp { destination: Relative(23), op: Add, bit_size: U32, lhs: Relative(22), rhs: Relative(17) }, Store { destination_pointer: Relative(23), source: Relative(16) }, BinaryIntOp { destination: Relative(5), op: Add, bit_size: U32, lhs: Relative(17), rhs: Relative(9) }, Mov { destination: Direct(32771), source: Relative(21) }, Const { destination: Direct(32772), bit_size: Integer(U32), value: 5 }, Call { location: 679 }, Mov { destination: Relative(16), source: Direct(32773) }, BinaryIntOp { destination: Relative(17), op: Add, bit_size: U32, lhs: Relative(16), rhs: Direct(2) }, BinaryIntOp { destination: Relative(22), op: Add, bit_size: U32, lhs: Relative(17), rhs: Relative(5) }, Store { destination_pointer: Relative(22), source: Relative(18) }, Store { destination_pointer: Relative(6), source: Relative(16) }, BinaryIntOp { destination: Relative(5), op: Add, bit_size: U32, lhs: Relative(7), rhs: Relative(9) }, Mov { destination: Relative(7), source: Relative(5) }, Jump { location: 257 }, BinaryIntOp { destination: Relative(23), op: Add, bit_size: U32, lhs: Relative(14), rhs: Direct(2) }, BinaryIntOp { destination: Relative(24), op: Add, bit_size: U32, lhs: Relative(23), rhs: Relative(7) }, Load { destination: Relative(22), source_pointer: Relative(24) }, Cast { destination: Relative(24), source: Relative(22), bit_size: Integer(U128) }, Cast { destination: Relative(23), source: Relative(24), bit_size: Field }, BinaryFieldOp { destination: Relative(24), op: Sub, lhs: Relative(22), rhs: Relative(23) }, BinaryFieldOp { destination: Relative(25), op: Mul, lhs: Relative(24), rhs: Relative(15) }, BinaryFieldOp { destination: Relative(24), op: Mul, lhs: Direct(32835), rhs: Relative(25) }, BinaryFieldOp { destination: Relative(26), op: Add, lhs: Relative(23), rhs: Relative(24) }, BinaryFieldOp { destination: Relative(24), op: Equals, lhs: Relative(22), rhs: Relative(26) }, JumpIf { condition: Relative(24), location: 596 }, Const { destination: Relative(27), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(27) } }, Load { destination: Relative(22), source_pointer: Relative(21) }, BinaryIntOp { destination: Relative(24), op: Mul, bit_size: U32, lhs: Relative(7), rhs: Relative(13) }, Mov { destination: Direct(32771), source: Relative(22) }, Const { destination: Direct(32772), bit_size: Integer(U32), value: 7 }, Call { location: 679 }, Mov { destination: Relative(26), source: Direct(32773) }, BinaryIntOp { destination: Relative(27), op: Add, bit_size: U32, lhs: Relative(26), rhs: Direct(2) }, BinaryIntOp { destination: Relative(28), op: Add, bit_size: U32, lhs: Relative(27), rhs: Relative(24) }, Store { destination_pointer: Relative(28), source: Relative(23) }, BinaryIntOp { destination: Relative(22), op: Add, bit_size: U32, lhs: Relative(24), rhs: Relative(9) }, Mov { destination: Direct(32771), source: Relative(26) }, Const { destination: Direct(32772), bit_size: Integer(U32), value: 7 }, Call { location: 679 }, Mov { destination: Relative(23), source: Direct(32773) }, BinaryIntOp { destination: Relative(24), op: Add, bit_size: U32, lhs: Relative(23), rhs: Direct(2) }, BinaryIntOp { destination: Relative(27), op: Add, bit_size: U32, lhs: Relative(24), rhs: Relative(22) }, Store { destination_pointer: Relative(27), source: Relative(25) }, Store { destination_pointer: Relative(21), source: Relative(23) }, BinaryIntOp { destination: Relative(22), op: Add, bit_size: U32, lhs: Relative(7), rhs: Relative(9) }, Mov { destination: Relative(7), source: Relative(22) }, Jump { location: 189 }, BinaryIntOp { destination: Relative(17), op: Add, bit_size: U32, lhs: Relative(12), rhs: Direct(2) }, BinaryIntOp { destination: Relative(18), op: Add, bit_size: U32, lhs: Relative(17), rhs: Relative(7) }, Load { destination: Relative(16), source_pointer: Relative(18) }, Cast { destination: Relative(18), source: Relative(16), bit_size: Integer(U128) }, Cast { destination: Relative(17), source: Relative(18), bit_size: Field }, BinaryFieldOp { destination: Relative(18), op: Sub, lhs: Relative(16), rhs: Relative(17) }, BinaryFieldOp { destination: Relative(19), op: Mul, lhs: Relative(18), rhs: Relative(15) }, BinaryFieldOp { destination: Relative(18), op: Mul, lhs: Direct(32835), rhs: Relative(19) }, BinaryFieldOp { destination: Relative(20), op: Add, lhs: Relative(17), rhs: Relative(18) }, BinaryFieldOp { destination: Relative(18), op: Equals, lhs: Relative(16), rhs: Relative(20) }, JumpIf { condition: Relative(18), location: 630 }, Const { destination: Relative(21), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(21) } }, Load { destination: Relative(16), source_pointer: Relative(14) }, BinaryIntOp { destination: Relative(18), op: Mul, bit_size: U32, lhs: Relative(7), rhs: Relative(13) }, Mov { destination: Direct(32771), source: Relative(16) }, Const { destination: Direct(32772), bit_size: Integer(U32), value: 5 }, Call { location: 679 }, Mov { destination: Relative(20), source: Direct(32773) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(20), rhs: Direct(2) }, BinaryIntOp { destination: Relative(22), op: Add, bit_size: U32, lhs: Relative(21), rhs: Relative(18) }, Store { destination_pointer: Relative(22), source: Relative(17) }, BinaryIntOp { destination: Relative(16), op: Add, bit_size: U32, lhs: Relative(18), rhs: Relative(9) }, Mov { destination: Direct(32771), source: Relative(20) }, Const { destination: Direct(32772), bit_size: Integer(U32), value: 5 }, Call { location: 679 }, Mov { destination: Relative(17), source: Direct(32773) }, BinaryIntOp { destination: Relative(18), op: Add, bit_size: U32, lhs: Relative(17), rhs: Direct(2) }, BinaryIntOp { destination: Relative(21), op: Add, bit_size: U32, lhs: Relative(18), rhs: Relative(16) }, Store { destination_pointer: Relative(21), source: Relative(19) }, Store { destination_pointer: Relative(14), source: Relative(17) }, BinaryIntOp { destination: Relative(16), op: Add, bit_size: U32, lhs: Relative(7), rhs: Relative(9) }, Mov { destination: Relative(7), source: Relative(16) }, Jump { location: 118 }, 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: 656 }, 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, Const { destination: Direct(32774), bit_size: Integer(U32), value: 2 }, BinaryIntOp { destination: Direct(32773), op: Div, bit_size: U32, lhs: Direct(32772), rhs: Direct(32774) }, Mov { destination: Direct(32776), source: Direct(32772) }, Const { destination: Direct(32777), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Direct(32778), op: LessThan, bit_size: U32, lhs: Direct(32777), rhs: Direct(32773) }, Not { destination: Direct(32778), source: Direct(32778), bit_size: U1 }, JumpIf { condition: Direct(32778), location: 678 }, BinaryIntOp { destination: Direct(32776), op: Sub, bit_size: U32, lhs: Direct(32776), rhs: Direct(2) }, BinaryIntOp { destination: Direct(32779), op: Add, bit_size: U32, lhs: Direct(32771), rhs: Direct(32777) }, Load { destination: Direct(32774), source_pointer: Direct(32779) }, BinaryIntOp { destination: Direct(32779), op: Add, bit_size: U32, lhs: Direct(32771), rhs: Direct(32776) }, Load { destination: Direct(32775), source_pointer: Direct(32779) }, BinaryIntOp { destination: Direct(32779), op: Add, bit_size: U32, lhs: Direct(32771), rhs: Direct(32777) }, Store { destination_pointer: Direct(32779), source: Direct(32775) }, BinaryIntOp { destination: Direct(32779), op: Add, bit_size: U32, lhs: Direct(32771), rhs: Direct(32776) }, Store { destination_pointer: Direct(32779), source: Direct(32774) }, BinaryIntOp { destination: Direct(32777), op: Add, bit_size: U32, lhs: Direct(32777), rhs: Direct(2) }, Jump { location: 664 }, Return, Load { destination: Direct(32774), source_pointer: Direct(32771) }, BinaryIntOp { destination: Direct(32775), op: Equals, bit_size: U32, lhs: Direct(32774), rhs: Direct(2) }, JumpIf { condition: Direct(32775), location: 683 }, Jump { location: 685 }, Mov { destination: Direct(32773), source: Direct(32771) }, Jump { location: 700 }, Mov { destination: Direct(32773), source: Direct(1) }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Direct(32772) }, BinaryIntOp { destination: Direct(32777), op: Add, bit_size: U32, lhs: Direct(32771), rhs: Direct(32772) }, Mov { destination: Direct(32778), source: Direct(32771) }, Mov { destination: Direct(32779), source: Direct(32773) }, BinaryIntOp { destination: Direct(32780), op: Equals, bit_size: U32, lhs: Direct(32778), rhs: Direct(32777) }, JumpIf { condition: Direct(32780), location: 697 }, Load { destination: Direct(32776), source_pointer: Direct(32778) }, Store { destination_pointer: Direct(32779), source: Direct(32776) }, BinaryIntOp { destination: Direct(32778), op: Add, bit_size: U32, lhs: Direct(32778), rhs: Direct(2) }, BinaryIntOp { destination: Direct(32779), op: Add, bit_size: U32, lhs: Direct(32779), rhs: Direct(2) }, Jump { location: 690 }, IndirectConst { destination_pointer: Direct(32773), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Direct(32774), op: Sub, bit_size: U32, lhs: Direct(32774), rhs: Direct(2) }, Jump { location: 700 }, Return]" ], - "debug_symbols": "tZrdbtu4Fkbfxde5EMnNv75KURRpmw4CBGmRaQ9wUOTdh582l9MCY0GQMDfdy7W9TFPfFiU6vy5fHj79/Ovj4/PXb39f3r3/dfn08vj09PjXx6dvn+9/PH57Hv/767LoH+uXd/HukhcvwUv0kryYl+yleKlemhe3FLcUtxS3FLcUtxS3FLcUtxS3FLdUt1S3VLfUYbFRzEv2UrxUL81LX0tbvAQv0cuw5FHMS/ZSvFQvzcuwhLtLX7wEL9FL8mJespfipXoZljZKX0tYllnDrHHWNKvNmmcts9ZZ26zTF6YvTF+YvjB9Yby+jxo17iCIQAIMyEABKtCAPiEtAOaEOWFOmBPmhDlhTpgTZsNsmE3mRSBzEhiQgQJUoAF9grLtEIAIyGwCA4a5qJZZ66xt1u5VUV9rmDXOmma1WadPgQ9VUIEG9AkKvkMAIpAAAzKAuWKumCvmhrlhbpgb5oa5YV57QHFS7qOOhJLvYEAGClCBBnSHqDZwCEAEEmBABgpQgQZgDpgD5oA5YA6YA+aAOWjqukDmKOgT4gIEIAIJMCADBaiAzEnQJ6y9lAUBiEACDMhAASrQAJlH2KJ6ySEAEUiAARkoQAUagDljzpgz5ow5Y17XiBGkuK4Lmt51ZVghAgkwIAMFqIDG0wRjPGmcI6JaxiEAEUiAARkoQAUaILOOl1rGQWZNr1rGIQEGZKAAFWhAn6A1xQFzx9wxq7+SCTJQAJk1Ceovh+6Q1F8OAYhAAgzIQAEq0ADMAXPAHDAHzOqv1AUZKEAFGtAnqL8cAhCBBGCOmCPmiDlijpgT5oQ5YU6YE+aEOWFOmNVfFgR9gvrLIQARSIABeYKWFIsCjXA0SFJfWBIEIAIJMCADBahAA/qEirlirpjXSygTZKAAevuIX1ovnjTC9fJphQgUXlOBBvB2xXh9sWLskIECVKAB3cGWBQjADJsRYyPGRoyNGBsxNmJsxNiIsRFjI8YWZiSMGBsxNmJsxNiIsRFjI8ZGjI0YGzE2hdaqQN9UH6qImp5SRB0ikAADMlCACjSgTzDMhtkwK6J5EegyOAgyUIAKNKBP0BLgEIAIJABzxpwxZ8wZc8ZcMBfMBbPaIUeBARkoQAUa0CeoHRwCEAGZk8CA7O1p6zKxgjyjQUx94RAAeXQo11uLFeTRPGtRKJpntUzRt1DLFH2oWqbos9QyK2hRcAiAzFmgS0p9lrrJIQMFqEADukNWNzkEIAIJMCADBahAAzCrm0oWBCACCTAgAwWoQAP6hIg5Yo6Y1U2lCAzIQAEq0IA+QR3nEIAIYE6YE+aEOWFOmBNmw2yYDbNhNsyG2TCrv0rVbfYCBGB4ahAkYHjqek8+PDUJhqfqoKi/qiZK/VVlVn+toP5yCIBG2AQy67PUXw4ZKEAFGtAnqL8cAhABzBVzxVwxV8wVc8XcMKu/qoaq/nLIgO6W182ICuh+WdOi/mqaFvVX07Sov5q+u/qryaz+cjAgAxphF8isz1pv7FfoDmW9t18hABFIgAEZKEAFGoA5YA6YA+aAOWBWN7UuaECfoG7qSRCA4ekmGJ6eBcPTi2CMsFfBGGGXWd3k0IA+Qd3UF4HM+ix1k0MCDMhAASrQgD5B3eSA2TAbZsNsmA2zYbbV/Pp6d2Hv6+OPl4cHbX39thk2tsi+3788PP+4vHv++fR0d/nf/dPP9UV/f79/XuuP+5fx7PiuD89fRh3Cr49PD6LXu7d3L7ffOtaM+eZs9fr2/Of7w+33j/N3QbD8Zghlr2GsCe1qyP2WIW0YslKzGsZKvJw2pFuGjXkcTTAFpditeSy33z+2bDgQY3cmv42g/2GoG4amddkNLZdDhrZcDS0cMIztEeZxbHXcNISNiUw58TXGLYkdGUTQ7f0cREk3BxFPJ2q/4kikaiRStS83WzOfzlQop0O1rdiVqi3F3lj107HaHMW+XMVwOlf7FUdy1QqCHuOtXEU7nauYT+dqW7ErV1uKnbnS5t7JXG2OYl+u0nJ+BVz+y1yN35O4FBg/Fd28mEgb6/D4/eeqGLuxNxW2qbB/U4S2fxQ5XZM1rvlvjmLrXBEbFzVj//xmvtPWMpbfYjFuGQ8pxrU+inGlekhRw1VR23JLYedX9M0jksL1iIzN3ltHZGMQvaez2UypXseQl0MKi9ez3tgmO6Zo11GMK+ebis1DqnsQP6RtWQ6lol/XkLHzb8cUy3UUPfQjipEEzhZjvz8fUyzLVRHSMYWFq6KH84pj09ksXg9qPnZQW7Q3xc0vkjeWsrGVzUEdG9U3Tzh548zZFr5H+/28Wf8UbHyNcj3/l5wOCa63xKW1YwIyVZfbI9iaxpgYwtie74eORLyeao4rQt2h2I7U9UpxpCscU9TrMth6PaYob6Oox67R3rY54hIPKcLbPsdQ3DxblXa6vUo/2V51Odlem4I97bUt2NFem9O4r722Fbvaa1uxq722I9Wul8u9H7rB3xnszRv8fcGu/XSw23Iy2C2cDPamYE+wtwU7gr05jfuCva3YFextxa5gb0dqV7Dr6VzX07Huy+lY93Ay1j2ejPWmYE+stwU7Yr05jftiva3YFettxa5Y12Op/jAe3X9+fPnjj6Ff5Xp5vP/09DAffv35/Pm3Z3/8/zvP8MfU31++fX748vPlQaa3v6ge/7wvo2vrsny4uwQ9KstdqW08Gr9cvR+36Jb1zPrCHO5KLnq4vnJc7JbcP7xqmP8A", + "debug_symbols": "tZrdbtu4Fkbfxde5EMnNv75KURRpmw4CBGmRaQ9wUOTdh582l9MCY0GQMDfdy7W9TFPfFiU6vy5fHj79/Ovj4/PXb39f3r3/dfn08vj09PjXx6dvn+9/PH57Hv/767LoH+uXd/HukhcvwUv0kryYl+yleKlemhe3FLcUtxS3FLcUtxS3FLcUtxS3FLdUt1S3VLfUYbFRzEv2UrxUL81LX0tbvAQv0cuw5FHMS/ZSvFQvzcuwhLtLX7wEL9FL8mJespfipXoZljZKX0tYllnDrHHWNKvNmmcts9ZZ26zTF6YvTF+YvjB9Yby+jxo17iCIQAIMyEABKtCAPiEtAOaEOWFOmBPmhDlhTpgTZsNsmE3mRSBzEhiQgQJUoAF9grLtEIAIyGwCA4a5qJZZ66xt1u5VUV9rmDXOmma1WadPgQ9VUIEG9AkKvkMAIpAAAzKAuWKumCvmhrlhbpgb5oa5YV57QHFS7qOOhJLvYEAGClCBBnSHqDZwCEAEEmBABgpQgQZgDpgD5oA5YA6YA+aAOWjqukDmKOgT4gIEIAIJMCADBaiAzEnQJ6y9lAUBiEACDMhAASrQAJlH2KJ6ySEAEUiAARkoQAUagDljzpgz5ow5Y17XiBGkuK4Lmt51ZVghAgkwIAMFqIDG0wRjPGmcI6JaxiEAEUiAARkoQAUaILOOl1rGQWZNr1rGIQEGZKAAFWhAn6A1xQFzx9wxq7+SCTJQAJk1Ceovh+6Q1F8OAYhAAgzIQAEq0ADMAXPAHDAHzOqv1AUZKEAFGtAnqL8cAhCBBGCOmCPmiDlijpgT5oQ5YU6YE+aEOWFOmNVfFgR9gvrLIQARSIABeYKWFIsCjXA0SFJfWBIEIAIJMCADBahAA/qEirlirpjXSygTZKAAevuIX1ovnjTC9fJphQgUXlOBBvB2xXh9sWLskIECVKAB3cGWBQjADJsRYyPGRoyNGBsxNmJsxNiIsRFjI8YWZiSMGBsxNmJsxNiIsRFjI8ZGjI0YGzE2hdaqQN9UH6qImp5SRB0ikAADMlCACjSgTzDMhtkwK6J5EegyOAgyUIAKNKBP0BLgEIAIJABzxpwxZ8wZc8ZcMBfMBbPaIUeBARkoQAUa0CeoHRwCEAGZk8CA7O1p6zKxgjyjQUx94RAAeXQo11uLFeTRPGtRKJpntUzRt1DLFH2oWqbos9QyK2hRcAiAzFmgS0p9lrrJIQMFqEADukNWNzkEIAIJMCADBahAAzCrm0oWBCACCTAgAwWoQAP6hIg5Yo6Y1U2lCAzIQAEq0IA+QR3nEIAIYE6YE+aEOWFOmBNmw2yYDbNhNsyG2TCrv0rVbfYCBGB4ahAkYHjqek8+PDUJhqfqoKi/qiZK/VVlVn+toP5yCIBG2AQy67PUXw4ZKEAFGtAnqL8cAhABzBVzxVwxV8wVc8XcMKu/qoaq/nLIgO6W182ICuh+WdOi/mqaFvVX07Sov5q+u/qryaz+cjAgAxphF8isz1pv7FfoDmW9t18hABFIgAEZKEAFGoA5YA6YA+aAOWBWN7UuaECfoG7qSRCA4ekmGJ6eBcPTi2CMsFfBGGGXWd3k0IA+Qd3UF4HM+ix1k0MCDMhAASrQgD5B3eSA2TAbZsNsmA2zYbbV/Pp6d2Hv6+OPl4cHbX39thk2tsi+3788PP+4vHv++fR0d/nf/dPP9UV/f79/XuuP+5fx7PiuD89fRh3Cr49PD6LXu7d3L7ffOtaM+eZs9fr2/Of7w+33j/N3QbD8Zghlr2GsCe1qyP2WIW0YslKzGsZKvJw2pFuGjXkcTTAFpditeSy33z+2bDgQY3cmv42g/2GoG4amddkNLZdDhrZcDS0cMIztEeZxbHXcNISNiUw58TXGLYkdGUTQ7f0cREk3BxFPJ2q/4kikaiRStS83WzOfzlQop0O1rdiVqi3F3lj107HaHMW+XMVwOlf7FUdy1QqCHuOtXEU7nauYT+dqW7ErV1uKnbnS5t7JXG2OYl+u0nJ+BVz+y1yN35O4FBg/Fd28mEgb6/D4/eeqGLuxNxW2qbB/U4S2fxT5ekDGLy3l5ii2zhWxcVEz9s9v5jttLWNvoxjYDinGtT6KcaV6SFHDVVHbckth51f0zSOSwrXXx2bvrSOyMYje09lspnRNRcrLIYVdl/Tx86EdU7RrvMdGy03F5iHVPYgf0rYsh1LRr2vI2Pm3Y4rlOooe+hHFSAJni7Hfn48pluWqCOmYwsJV0cN5xbHpbBavBzUfO6gt2pvi5hfJG0vZ2MrmoI6N6psnnLxx5mwL36P9ft6sfwo2vka5nv9LTocE11vi0toxAZmqy+0RbE1jTAxhbM/3Q0cixnxaEeoOxXakrleKI13hmKJel8HW6zFFeRtFPXaN9rbNEZd4SBHe9jmG4ubZqrTT7VX6yfaqy8n22hTsaa9twY722pzGfe21rdjVXtuKXe21Hal2vVzu/dAN/s5gb97g7wt27aeD3ZaTwW7hZLA3BXuCvS3YEezNadwX7G3FrmBvK3YFeztSu4JdT+e6no51X07HuoeTse7xZKw3BXtivS3YEevNadwX623FrlhvK3bFuh5L9Yfx6P7z48sffwz9KtfL4/2np4f58OvP58+/Pfvj/995hj+m/v7y7fPDl58vDzK9/UX1+Od9GV1bl+XD3SXoUVnuSm3j0fjl6v24RbesZ9YX5nBXctHD9ZXjYrfk/uFVw/wH", "file_map": { "16": { "source": "use crate::cmp::Eq;\nuse crate::hash::Hash;\nuse crate::ops::arith::{Add, Neg, Sub};\n\n/// A point on the embedded elliptic curve\n/// By definition, the base field of the embedded curve is the scalar field of the proof system curve, i.e the Noir Field.\n/// x and y denotes the Weierstrass coordinates of the point, if is_infinite is false.\npub struct EmbeddedCurvePoint {\n pub x: Field,\n pub y: Field,\n pub is_infinite: bool,\n}\n\nimpl EmbeddedCurvePoint {\n /// Elliptic curve point doubling operation\n /// returns the doubled point of a point P, i.e P+P\n pub fn double(self) -> EmbeddedCurvePoint {\n embedded_curve_add(self, self)\n }\n\n /// Returns the null element of the curve; 'the point at infinity'\n pub fn point_at_infinity() -> EmbeddedCurvePoint {\n EmbeddedCurvePoint { x: 0, y: 0, is_infinite: true }\n }\n\n /// Returns the curve's generator point.\n pub fn generator() -> EmbeddedCurvePoint {\n // Generator point for the grumpkin curve (y^2 = x^3 - 17)\n EmbeddedCurvePoint {\n x: 1,\n y: 17631683881184975370165255887551781615748388533673675138860, // sqrt(-16)\n is_infinite: false,\n }\n }\n}\n\nimpl Add for EmbeddedCurvePoint {\n /// Adds two points P+Q, using the curve addition formula, and also handles point at infinity\n fn add(self, other: EmbeddedCurvePoint) -> EmbeddedCurvePoint {\n embedded_curve_add(self, other)\n }\n}\n\nimpl Sub for EmbeddedCurvePoint {\n /// Points subtraction operation, using addition and negation\n fn sub(self, other: EmbeddedCurvePoint) -> EmbeddedCurvePoint {\n self + other.neg()\n }\n}\n\nimpl Neg for EmbeddedCurvePoint {\n /// Negates a point P, i.e returns -P, by negating the y coordinate.\n /// If the point is at infinity, then the result is also at infinity.\n fn neg(self) -> EmbeddedCurvePoint {\n EmbeddedCurvePoint { x: self.x, y: -self.y, is_infinite: self.is_infinite }\n }\n}\n\nimpl Eq for EmbeddedCurvePoint {\n /// Checks whether two points are equal\n fn eq(self: Self, b: EmbeddedCurvePoint) -> bool {\n (self.is_infinite & b.is_infinite)\n | ((self.is_infinite == b.is_infinite) & (self.x == b.x) & (self.y == b.y))\n }\n}\n\nimpl Hash for EmbeddedCurvePoint {\n fn hash(self, state: &mut H)\n where\n H: crate::hash::Hasher,\n {\n if self.is_infinite {\n self.is_infinite.hash(state);\n } else {\n self.x.hash(state);\n self.y.hash(state);\n }\n }\n}\n\n/// Scalar for the embedded curve represented as low and high limbs\n/// By definition, the scalar field of the embedded curve is base field of the proving system curve.\n/// It may not fit into a Field element, so it is represented with two Field elements; its low and high limbs.\npub struct EmbeddedCurveScalar {\n pub lo: Field,\n pub hi: Field,\n}\n\nimpl EmbeddedCurveScalar {\n pub fn new(lo: Field, hi: Field) -> Self {\n EmbeddedCurveScalar { lo, hi }\n }\n\n #[field(bn254)]\n pub fn from_field(scalar: Field) -> EmbeddedCurveScalar {\n let (a, b) = crate::field::bn254::decompose(scalar);\n EmbeddedCurveScalar { lo: a, hi: b }\n }\n\n //Bytes to scalar: take the first (after the specified offset) 16 bytes of the input as the lo value, and the next 16 bytes as the hi value\n #[field(bn254)]\n pub(crate) fn from_bytes(bytes: [u8; 64], offset: u32) -> EmbeddedCurveScalar {\n let mut v = 1;\n let mut lo = 0 as Field;\n let mut hi = 0 as Field;\n for i in 0..16 {\n lo = lo + (bytes[offset + 31 - i] as Field) * v;\n hi = hi + (bytes[offset + 15 - i] as Field) * v;\n v = v * 256;\n }\n let sig_s = crate::embedded_curve_ops::EmbeddedCurveScalar { lo, hi };\n sig_s\n }\n}\n\nimpl Eq for EmbeddedCurveScalar {\n fn eq(self, other: Self) -> bool {\n (other.hi == self.hi) & (other.lo == self.lo)\n }\n}\n\nimpl Hash for EmbeddedCurveScalar {\n fn hash(self, state: &mut H)\n where\n H: crate::hash::Hasher,\n {\n self.hi.hash(state);\n self.lo.hash(state);\n }\n}\n\n// Computes a multi scalar multiplication over the embedded curve.\n// For bn254, We have Grumpkin and Baby JubJub.\n// For bls12-381, we have JubJub and Bandersnatch.\n//\n// The embedded curve being used is decided by the\n// underlying proof system.\n// docs:start:multi_scalar_mul\npub fn multi_scalar_mul(\n points: [EmbeddedCurvePoint; N],\n scalars: [EmbeddedCurveScalar; N],\n) -> EmbeddedCurvePoint\n// docs:end:multi_scalar_mul\n{\n multi_scalar_mul_array_return(points, scalars)[0]\n}\n\n#[foreign(multi_scalar_mul)]\npub(crate) fn multi_scalar_mul_array_return(\n points: [EmbeddedCurvePoint; N],\n scalars: [EmbeddedCurveScalar; N],\n) -> [EmbeddedCurvePoint; 1] {}\n\n// docs:start:fixed_base_scalar_mul\npub fn fixed_base_scalar_mul(scalar: EmbeddedCurveScalar) -> EmbeddedCurvePoint\n// docs:end:fixed_base_scalar_mul\n{\n multi_scalar_mul([EmbeddedCurvePoint::generator()], [scalar])\n}\n\n/// This function only assumes that the points are on the curve\n/// It handles corner cases around the infinity point causing some overhead compared to embedded_curve_add_not_nul and embedded_curve_add_unsafe\n// docs:start:embedded_curve_add\npub fn embedded_curve_add(\n point1: EmbeddedCurvePoint,\n point2: EmbeddedCurvePoint,\n) -> EmbeddedCurvePoint {\n // docs:end:embedded_curve_add\n if crate::runtime::is_unconstrained() {\n // `embedded_curve_add_unsafe` requires the inputs not to be the infinity point, so we check it here.\n // This is because `embedded_curve_add_unsafe` uses the `embedded_curve_add` opcode.\n // For efficiency, the backend does not check the inputs for the infinity point, but it assumes that they are not the infinity point\n // so that it can apply the ec addition formula directly.\n if point1.is_infinite {\n point2\n } else if point2.is_infinite {\n point1\n } else {\n embedded_curve_add_unsafe(point1, point2)\n }\n } else {\n // In a constrained context, we also need to check the inputs are not the infinity point because we also use `embedded_curve_add_unsafe`\n // However we also need to identify the case where the two inputs are the same, because then\n // the addition formula does not work and we need to use the doubling formula instead.\n // In unconstrained context, we can check directly if the input values are the same when solving the opcode, so it is not an issue.\n\n // x_coordinates_match is true if both abscissae are the same\n let x_coordinates_match = point1.x == point2.x;\n // y_coordinates_match is true if both ordinates are the same\n let y_coordinates_match = point1.y == point2.y;\n // double_predicate is true if both abscissae and ordinates are the same\n let double_predicate = (x_coordinates_match & y_coordinates_match);\n // If the abscissae are the same, but not the ordinates, then one point is the opposite of the other\n let infinity_predicate = (x_coordinates_match & !y_coordinates_match);\n let point1_1 = EmbeddedCurvePoint {\n x: point1.x + (x_coordinates_match as Field),\n y: point1.y,\n is_infinite: false,\n };\n let point2_1 = EmbeddedCurvePoint { x: point2.x, y: point2.y, is_infinite: false };\n // point1_1 is guaranteed to have a different abscissa than point2:\n // - if x_coordinates_match is 0, that means point1.x != point2.x, and point1_1.x = point1.x + 0\n // - if x_coordinates_match is 1, that means point1.x = point2.x, but point1_1.x = point1.x + 1 in this case\n // Because the abscissa is different, the addition formula is guaranteed to succeed, so we can safely use `embedded_curve_add_unsafe`\n // Note that this computation may be garbage: if x_coordinates_match is 1, or if one of the input is the point at infinity.\n let mut result = embedded_curve_add_unsafe(point1_1, point2_1);\n\n // `embedded_curve_add_unsafe` is doing a doubling if the input is the same variable, because in this case it is guaranteed (at 'compile time') that the input is the same.\n let double = embedded_curve_add_unsafe(point1, point1);\n // `embedded_curve_add_unsafe` would not perform doubling, even if the inputs point1 and point2 are the same, because it cannot know this without adding some logic (and some constraints)\n // However we did this logic when we computed `double_predicate`, so we set the result to 2*point1 if point1 and point2 are the same\n result = if double_predicate { double } else { result };\n\n // Same logic as above for unconstrained context, we set the proper result when one of the inputs is the infinity point\n if point1.is_infinite {\n result = point2;\n }\n if point2.is_infinite {\n result = point1;\n }\n\n // Finally, we set the is_infinity flag of the result:\n // Opposite points should sum into the infinity point, however, if one of them is point at infinity, their coordinates are not meaningful\n // so we should not use the fact that the inputs are opposite in this case:\n let mut result_is_infinity =\n infinity_predicate & (!point1.is_infinite & !point2.is_infinite);\n // However, if both of them are at infinity, then the result is also at infinity\n result.is_infinite = result_is_infinity | (point1.is_infinite & point2.is_infinite);\n result\n }\n}\n\n#[foreign(embedded_curve_add)]\nfn embedded_curve_add_array_return(\n _point1: EmbeddedCurvePoint,\n _point2: EmbeddedCurvePoint,\n) -> [EmbeddedCurvePoint; 1] {}\n\n/// This function assumes that:\n/// The points are on the curve, and\n/// The points don't share an x-coordinate, and\n/// Neither point is the infinity point.\n/// If it is used with correct input, the function ensures the correct non-zero result is returned.\n/// Except for points on the curve, the other assumptions are checked by the function. It will cause assertion failure if they are not respected.\npub fn embedded_curve_add_not_nul(\n point1: EmbeddedCurvePoint,\n point2: EmbeddedCurvePoint,\n) -> EmbeddedCurvePoint {\n assert(point1.x != point2.x);\n assert(!point1.is_infinite);\n assert(!point2.is_infinite);\n // Ensure is_infinite is comptime\n let point1_1 = EmbeddedCurvePoint { x: point1.x, y: point1.y, is_infinite: false };\n let point2_1 = EmbeddedCurvePoint { x: point2.x, y: point2.y, is_infinite: false };\n embedded_curve_add_unsafe(point1_1, point2_1)\n}\n\n/// Unsafe ec addition\n/// If the inputs are the same, it will perform a doubling, but only if point1 and point2 are the same variable.\n/// If they have the same value but are different variables, the result will be incorrect because in this case\n/// it assumes (but does not check) that the points' x-coordinates are not equal.\n/// It also assumes neither point is the infinity point.\npub fn embedded_curve_add_unsafe(\n point1: EmbeddedCurvePoint,\n point2: EmbeddedCurvePoint,\n) -> EmbeddedCurvePoint {\n embedded_curve_add_array_return(point1, point2)[0]\n}\n", @@ -104,7 +104,7 @@ expression: artifact "path": "std/hash/mod.nr" }, "50": { - "source": "fn main(\n // Public key of note\n // all notes have the same denomination\n priv_key: Field,\n // Merkle membership proof\n note_root: pub Field,\n index: Field,\n note_hash_path: [Field; 3],\n // Receiver public key\n to_pubkey_x: Field,\n to_pubkey_y: Field,\n) -> pub [Field; 2] {\n let priv_key_as_scalar = std::embedded_curve_ops::EmbeddedCurveScalar { lo: priv_key, hi: 0 };\n // Compute public key from private key to show ownership\n let pubkey = std::embedded_curve_ops::fixed_base_scalar_mul(priv_key_as_scalar);\n // Compute input note commitment\n let note_commitment = std::hash::pedersen_commitment([pubkey.x, pubkey.y]);\n // Compute input note nullifier\n let nullifier = std::hash::pedersen_commitment([note_commitment.x, index, priv_key]);\n // Compute output note nullifier\n let receiver_note_commitment = std::hash::pedersen_commitment([to_pubkey_x, to_pubkey_y]);\n // Check that the input note nullifier is in the root\n assert(note_root == compute_merkle_root(note_commitment.x, index, note_hash_path));\n\n [nullifier.x, receiver_note_commitment.x]\n}\n\nfn compute_merkle_root(leaf: Field, index: Field, hash_path: [Field; N]) -> Field {\n let index_bits: [u1; N] = index.to_le_bits();\n let mut current = leaf;\n for i in 0..N {\n let path_bit = index_bits[i] as bool;\n let (hash_left, hash_right) = if path_bit {\n (hash_path[i], current)\n } else {\n (current, hash_path[i])\n };\n current = std::hash::pedersen_hash([hash_left, hash_right]);\n }\n current\n}\n", + "source": "fn main(\n // Public key of note\n // all notes have the same denomination\n priv_key: Field,\n // Merkle membership proof\n note_root: pub Field,\n index: Field,\n note_hash_path: [Field; 3],\n // Receiver public key\n to_pubkey_x: Field,\n to_pubkey_y: Field,\n) -> pub [Field; 2] {\n let priv_key_as_scalar = std::embedded_curve_ops::EmbeddedCurveScalar { lo: priv_key, hi: 0 };\n // Compute public key from private key to show ownership\n let pubkey = std::embedded_curve_ops::fixed_base_scalar_mul(priv_key_as_scalar);\n // Compute input note commitment\n let note_commitment = std::hash::pedersen_commitment([pubkey.x, pubkey.y]);\n // Compute input note nullifier\n let nullifier = std::hash::pedersen_commitment([note_commitment.x, index, priv_key]);\n // Compute output note nullifier\n let receiver_note_commitment = std::hash::pedersen_commitment([to_pubkey_x, to_pubkey_y]);\n // Check that the input note nullifier is in the root\n assert(note_root == compute_merkle_root(note_commitment.x, index, note_hash_path));\n\n [nullifier.x, receiver_note_commitment.x]\n}\n\nfn compute_merkle_root(leaf: Field, index: Field, hash_path: [Field; N]) -> Field {\n let index_bits: [u1; N] = index.to_le_bits();\n let mut current = leaf;\n for i in 0..N {\n let path_bit = index_bits[i] != 0;\n let (hash_left, hash_right) = if path_bit {\n (hash_path[i], current)\n } else {\n (current, hash_path[i])\n };\n current = std::hash::pedersen_hash([hash_left, hash_right]);\n }\n current\n}\n", "path": "" } }, diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/wrapping_operations/execute__tests__force_brillig_false_inliner_-9223372036854775808.snap b/tooling/nargo_cli/tests/snapshots/execution_success/wrapping_operations/execute__tests__force_brillig_false_inliner_-9223372036854775808.snap index 9bf3fb89dfc..4e3095967a8 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/wrapping_operations/execute__tests__force_brillig_false_inliner_-9223372036854775808.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/wrapping_operations/execute__tests__force_brillig_false_inliner_-9223372036854775808.snap @@ -77,10 +77,10 @@ expression: artifact "unconstrained func 1", "[Const { destination: Direct(21), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(20), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(0), size_address: Direct(21), offset_address: Direct(20) }, Const { destination: Direct(2), bit_size: Field, value: 0 }, BinaryFieldOp { destination: Direct(3), op: Equals, lhs: Direct(0), rhs: Direct(2) }, JumpIf { condition: Direct(3), location: 8 }, Const { destination: Direct(1), bit_size: Field, value: 1 }, BinaryFieldOp { destination: Direct(0), op: Div, lhs: Direct(1), rhs: Direct(0) }, Stop { return_data: HeapVector { pointer: Direct(20), size: Direct(21) } }]" ], - "debug_symbols": "tZXdjoIwEIXfpddcdKb/vspmY1CrISFoEEw2xnffUgbUizEuZm/mAOV8dKalcxW7uOkP66rZH89i9XUVm7aq6+qwro/bsquOTXp6vRViul13bYzpkXgYT65T2camE6umr+tCXMq6zy+dT2WTtSvbNCoLEZtd0gTcV3Ucrm7F3S15awDygjSz2zzbgbc7LQ0BnFb376vwRECeABKtm+eADjmG4hkK9YRQaGAmAC6bhQL7cSYKWcbb9WQJby0oKG5BX9gB5xQ0cP7A+62cE7CS3xDwagpSOjvXUXpgIfDxlvjDPIJamIwJDxDNQvTHyby5rGHJtrBq8jvHnhOOB3hvNRG894Gtgn9VSm3mWUjt5EKIsg8QdnOh/Nf1uNfTP5+73+mu3FbtU6MQmM6DQqgcdY4mR5ujy9HnGHIEOQqMMtoh+VNpIAEg/aRgSC2pI/WkYVSUpECKpIqUeDjwUm0x8TD9muhIPWkYVUlSIEVSRapJDenAG9rCpWyrclNHap37vtk+dNLu5zSNTL321B63cde3cShmHkvl/QU=", + "debug_symbols": "tZXdjoIwEIXfpddcdKalP/sqm41BrRsSggbBZGN89x3KgHoxxtXszXxAOYfOtHTOapvWw/eqbnf7o/r4PKt1VzdN/b1q9puqr/ctPT1fCjXfrvouJXqkbsZJdai61Pbqox2aplCnqhnyS8dD1Wb2VUejulCp3RLJcFc3aby6FFe1lqURWAu6XNTlvRxkube6ZANvzfX7Jt45oOwAGp1f5oAeJQ8jexiMcwno0i4OgK/NwoB7OxODosfT9RQdnlpQMNKCPpADLilYkPRR1ju9JOC0vCHg0RS09m6pow4gmsDbW+IP84jmxWTKeGNiRRP7djJPLmt8ZVs4M+u9F88JLxuE4Cw7hBCiWIXwqJS2XGahrdcvmhh3YyJuLtT/uh7Xeob7c/eL7qpN3d01CoV0HhTK5GhzLHN0OfocQ44xR9ATYMIkB9JTaYAMgH5SKJmO6ZmBGSeiZgITmYbJfjj6UW2R/JB+TfTMwIwTjWYCE5mGaZklc/Qb28Kp6upq3SRunbuh3dx00v7nMI/MvfbQ7TdpO3RpLGYeo/L+Ag==", "file_map": { "12": { - "source": "// docs:start:from-trait\npub trait From {\n fn from(input: T) -> Self;\n}\n// docs:end:from-trait\n\nimpl From for T {\n fn from(input: T) -> T {\n input\n }\n}\n\n// docs:start:into-trait\npub trait Into {\n fn into(self) -> T;\n}\n\nimpl Into for U\nwhere\n T: From,\n{\n fn into(self) -> T {\n T::from(self)\n }\n}\n// docs:end:into-trait\n\n// docs:start:from-impls\n// Unsigned integers\n\nimpl From for u32 {\n fn from(value: u8) -> u32 {\n value as u32\n }\n}\n\nimpl From for u64 {\n fn from(value: u8) -> u64 {\n value as u64\n }\n}\nimpl From for u64 {\n fn from(value: u32) -> u64 {\n value as u64\n }\n}\n\nimpl From for u128 {\n fn from(value: u8) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u32) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u64) -> u128 {\n value as u128\n }\n}\n\nimpl From for Field {\n fn from(value: u8) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u32) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u64) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u128) -> Field {\n value as Field\n }\n}\n\n// Signed integers\n\nimpl From for i32 {\n fn from(value: i8) -> i32 {\n value as i32\n }\n}\n\nimpl From for i64 {\n fn from(value: i8) -> i64 {\n value as i64\n }\n}\nimpl From for i64 {\n fn from(value: i32) -> i64 {\n value as i64\n }\n}\n\n// Booleans\nimpl From for u8 {\n fn from(value: bool) -> u8 {\n value as u8\n }\n}\nimpl From for u32 {\n fn from(value: bool) -> u32 {\n value as u32\n }\n}\nimpl From for u64 {\n fn from(value: bool) -> u64 {\n value as u64\n }\n}\nimpl From for i8 {\n fn from(value: bool) -> i8 {\n value as i8\n }\n}\nimpl From for i32 {\n fn from(value: bool) -> i32 {\n value as i32\n }\n}\nimpl From for i64 {\n fn from(value: bool) -> i64 {\n value as i64\n }\n}\nimpl From for Field {\n fn from(value: bool) -> Field {\n value as Field\n }\n}\n// docs:end:from-impls\n\n/// A generic interface for casting between primitive types,\n/// equivalent of using the `as` keyword between values.\n///\n/// # Example\n///\n/// ```\n/// let x: Field = 1234567890;\n/// let y: u8 = x as u8;\n/// let z: u8 = x.as_();\n/// assert_eq(y, z);\n/// ```\npub trait AsPrimitive {\n /// The equivalent of doing `self as T`.\n fn as_(self) -> T;\n}\n\n#[generate_as_primitive_impls]\ncomptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted {\n let types = [\n quote { bool },\n quote { u8 },\n quote { u16 },\n quote { u32 },\n quote { u64 },\n quote { u128 },\n quote { i8 },\n quote { i16 },\n quote { i32 },\n quote { i64 },\n quote { Field },\n ];\n\n let mut impls = &[];\n for type1 in types {\n for type2 in types {\n let trait_impl = quote {\n impl AsPrimitive<$type1> for $type2 {\n fn as_(self) -> $type1 {\n self as $type1\n }\n }\n };\n\n impls = impls.push_back(trait_impl);\n }\n }\n impls.join(quote {})\n}\n", + "source": "// docs:start:from-trait\npub trait From {\n fn from(input: T) -> Self;\n}\n// docs:end:from-trait\n\nimpl From for T {\n fn from(input: T) -> T {\n input\n }\n}\n\n// docs:start:into-trait\npub trait Into {\n fn into(self) -> T;\n}\n\nimpl Into for U\nwhere\n T: From,\n{\n fn into(self) -> T {\n T::from(self)\n }\n}\n// docs:end:into-trait\n\n// docs:start:from-impls\n// Unsigned integers\n\nimpl From for u32 {\n fn from(value: u8) -> u32 {\n value as u32\n }\n}\n\nimpl From for u64 {\n fn from(value: u8) -> u64 {\n value as u64\n }\n}\nimpl From for u64 {\n fn from(value: u32) -> u64 {\n value as u64\n }\n}\n\nimpl From for u128 {\n fn from(value: u8) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u32) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u64) -> u128 {\n value as u128\n }\n}\n\nimpl From for Field {\n fn from(value: u8) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u32) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u64) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u128) -> Field {\n value as Field\n }\n}\n\n// Signed integers\n\nimpl From for i32 {\n fn from(value: i8) -> i32 {\n value as i32\n }\n}\n\nimpl From for i64 {\n fn from(value: i8) -> i64 {\n value as i64\n }\n}\nimpl From for i64 {\n fn from(value: i32) -> i64 {\n value as i64\n }\n}\n\n// Booleans\nimpl From for u8 {\n fn from(value: bool) -> u8 {\n value as u8\n }\n}\nimpl From for u32 {\n fn from(value: bool) -> u32 {\n value as u32\n }\n}\nimpl From for u64 {\n fn from(value: bool) -> u64 {\n value as u64\n }\n}\nimpl From for i8 {\n fn from(value: bool) -> i8 {\n value as i8\n }\n}\nimpl From for i32 {\n fn from(value: bool) -> i32 {\n value as i32\n }\n}\nimpl From for i64 {\n fn from(value: bool) -> i64 {\n value as i64\n }\n}\nimpl From for Field {\n fn from(value: bool) -> Field {\n value as Field\n }\n}\n// docs:end:from-impls\n\n/// A generic interface for casting between primitive types,\n/// equivalent of using the `as` keyword between values.\n///\n/// # Example\n///\n/// ```\n/// let x: Field = 1234567890;\n/// let y: u8 = x as u8;\n/// let z: u8 = x.as_();\n/// assert_eq(y, z);\n/// ```\npub trait AsPrimitive {\n /// The equivalent of doing `self as T`.\n fn as_(self) -> T;\n}\n\n#[generate_as_primitive_impls]\ncomptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted {\n let types = [\n quote { bool },\n quote { u8 },\n quote { u16 },\n quote { u32 },\n quote { u64 },\n quote { u128 },\n quote { i8 },\n quote { i16 },\n quote { i32 },\n quote { i64 },\n quote { Field },\n ];\n\n let mut impls = &[];\n for type1 in types {\n for type2 in types {\n let body = if type1 == type2 {\n quote { self }\n } else if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for $type2 {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n }\n impls.join(quote {})\n}\n", "path": "std/convert.nr" }, "39": { diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/wrapping_operations/execute__tests__force_brillig_false_inliner_0.snap b/tooling/nargo_cli/tests/snapshots/execution_success/wrapping_operations/execute__tests__force_brillig_false_inliner_0.snap index 9bf3fb89dfc..4e3095967a8 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/wrapping_operations/execute__tests__force_brillig_false_inliner_0.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/wrapping_operations/execute__tests__force_brillig_false_inliner_0.snap @@ -77,10 +77,10 @@ expression: artifact "unconstrained func 1", "[Const { destination: Direct(21), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(20), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(0), size_address: Direct(21), offset_address: Direct(20) }, Const { destination: Direct(2), bit_size: Field, value: 0 }, BinaryFieldOp { destination: Direct(3), op: Equals, lhs: Direct(0), rhs: Direct(2) }, JumpIf { condition: Direct(3), location: 8 }, Const { destination: Direct(1), bit_size: Field, value: 1 }, BinaryFieldOp { destination: Direct(0), op: Div, lhs: Direct(1), rhs: Direct(0) }, Stop { return_data: HeapVector { pointer: Direct(20), size: Direct(21) } }]" ], - "debug_symbols": "tZXdjoIwEIXfpddcdKb/vspmY1CrISFoEEw2xnffUgbUizEuZm/mAOV8dKalcxW7uOkP66rZH89i9XUVm7aq6+qwro/bsquOTXp6vRViul13bYzpkXgYT65T2camE6umr+tCXMq6zy+dT2WTtSvbNCoLEZtd0gTcV3Ucrm7F3S15awDygjSz2zzbgbc7LQ0BnFb376vwRECeABKtm+eADjmG4hkK9YRQaGAmAC6bhQL7cSYKWcbb9WQJby0oKG5BX9gB5xQ0cP7A+62cE7CS3xDwagpSOjvXUXpgIfDxlvjDPIJamIwJDxDNQvTHyby5rGHJtrBq8jvHnhOOB3hvNRG894Gtgn9VSm3mWUjt5EKIsg8QdnOh/Nf1uNfTP5+73+mu3FbtU6MQmM6DQqgcdY4mR5ujy9HnGHIEOQqMMtoh+VNpIAEg/aRgSC2pI/WkYVSUpECKpIqUeDjwUm0x8TD9muhIPWkYVUlSIEVSRapJDenAG9rCpWyrclNHap37vtk+dNLu5zSNTL321B63cde3cShmHkvl/QU=", + "debug_symbols": "tZXdjoIwEIXfpddcdKalP/sqm41BrRsSggbBZGN89x3KgHoxxtXszXxAOYfOtHTOapvWw/eqbnf7o/r4PKt1VzdN/b1q9puqr/ctPT1fCjXfrvouJXqkbsZJdai61Pbqox2aplCnqhnyS8dD1Wb2VUejulCp3RLJcFc3aby6FFe1lqURWAu6XNTlvRxkube6ZANvzfX7Jt45oOwAGp1f5oAeJQ8jexiMcwno0i4OgK/NwoB7OxODosfT9RQdnlpQMNKCPpADLilYkPRR1ju9JOC0vCHg0RS09m6pow4gmsDbW+IP84jmxWTKeGNiRRP7djJPLmt8ZVs4M+u9F88JLxuE4Cw7hBCiWIXwqJS2XGahrdcvmhh3YyJuLtT/uh7Xeob7c/eL7qpN3d01CoV0HhTK5GhzLHN0OfocQ44xR9ATYMIkB9JTaYAMgH5SKJmO6ZmBGSeiZgITmYbJfjj6UW2R/JB+TfTMwIwTjWYCE5mGaZklc/Qb28Kp6upq3SRunbuh3dx00v7nMI/MvfbQ7TdpO3RpLGYeo/L+Ag==", "file_map": { "12": { - "source": "// docs:start:from-trait\npub trait From {\n fn from(input: T) -> Self;\n}\n// docs:end:from-trait\n\nimpl From for T {\n fn from(input: T) -> T {\n input\n }\n}\n\n// docs:start:into-trait\npub trait Into {\n fn into(self) -> T;\n}\n\nimpl Into for U\nwhere\n T: From,\n{\n fn into(self) -> T {\n T::from(self)\n }\n}\n// docs:end:into-trait\n\n// docs:start:from-impls\n// Unsigned integers\n\nimpl From for u32 {\n fn from(value: u8) -> u32 {\n value as u32\n }\n}\n\nimpl From for u64 {\n fn from(value: u8) -> u64 {\n value as u64\n }\n}\nimpl From for u64 {\n fn from(value: u32) -> u64 {\n value as u64\n }\n}\n\nimpl From for u128 {\n fn from(value: u8) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u32) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u64) -> u128 {\n value as u128\n }\n}\n\nimpl From for Field {\n fn from(value: u8) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u32) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u64) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u128) -> Field {\n value as Field\n }\n}\n\n// Signed integers\n\nimpl From for i32 {\n fn from(value: i8) -> i32 {\n value as i32\n }\n}\n\nimpl From for i64 {\n fn from(value: i8) -> i64 {\n value as i64\n }\n}\nimpl From for i64 {\n fn from(value: i32) -> i64 {\n value as i64\n }\n}\n\n// Booleans\nimpl From for u8 {\n fn from(value: bool) -> u8 {\n value as u8\n }\n}\nimpl From for u32 {\n fn from(value: bool) -> u32 {\n value as u32\n }\n}\nimpl From for u64 {\n fn from(value: bool) -> u64 {\n value as u64\n }\n}\nimpl From for i8 {\n fn from(value: bool) -> i8 {\n value as i8\n }\n}\nimpl From for i32 {\n fn from(value: bool) -> i32 {\n value as i32\n }\n}\nimpl From for i64 {\n fn from(value: bool) -> i64 {\n value as i64\n }\n}\nimpl From for Field {\n fn from(value: bool) -> Field {\n value as Field\n }\n}\n// docs:end:from-impls\n\n/// A generic interface for casting between primitive types,\n/// equivalent of using the `as` keyword between values.\n///\n/// # Example\n///\n/// ```\n/// let x: Field = 1234567890;\n/// let y: u8 = x as u8;\n/// let z: u8 = x.as_();\n/// assert_eq(y, z);\n/// ```\npub trait AsPrimitive {\n /// The equivalent of doing `self as T`.\n fn as_(self) -> T;\n}\n\n#[generate_as_primitive_impls]\ncomptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted {\n let types = [\n quote { bool },\n quote { u8 },\n quote { u16 },\n quote { u32 },\n quote { u64 },\n quote { u128 },\n quote { i8 },\n quote { i16 },\n quote { i32 },\n quote { i64 },\n quote { Field },\n ];\n\n let mut impls = &[];\n for type1 in types {\n for type2 in types {\n let trait_impl = quote {\n impl AsPrimitive<$type1> for $type2 {\n fn as_(self) -> $type1 {\n self as $type1\n }\n }\n };\n\n impls = impls.push_back(trait_impl);\n }\n }\n impls.join(quote {})\n}\n", + "source": "// docs:start:from-trait\npub trait From {\n fn from(input: T) -> Self;\n}\n// docs:end:from-trait\n\nimpl From for T {\n fn from(input: T) -> T {\n input\n }\n}\n\n// docs:start:into-trait\npub trait Into {\n fn into(self) -> T;\n}\n\nimpl Into for U\nwhere\n T: From,\n{\n fn into(self) -> T {\n T::from(self)\n }\n}\n// docs:end:into-trait\n\n// docs:start:from-impls\n// Unsigned integers\n\nimpl From for u32 {\n fn from(value: u8) -> u32 {\n value as u32\n }\n}\n\nimpl From for u64 {\n fn from(value: u8) -> u64 {\n value as u64\n }\n}\nimpl From for u64 {\n fn from(value: u32) -> u64 {\n value as u64\n }\n}\n\nimpl From for u128 {\n fn from(value: u8) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u32) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u64) -> u128 {\n value as u128\n }\n}\n\nimpl From for Field {\n fn from(value: u8) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u32) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u64) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u128) -> Field {\n value as Field\n }\n}\n\n// Signed integers\n\nimpl From for i32 {\n fn from(value: i8) -> i32 {\n value as i32\n }\n}\n\nimpl From for i64 {\n fn from(value: i8) -> i64 {\n value as i64\n }\n}\nimpl From for i64 {\n fn from(value: i32) -> i64 {\n value as i64\n }\n}\n\n// Booleans\nimpl From for u8 {\n fn from(value: bool) -> u8 {\n value as u8\n }\n}\nimpl From for u32 {\n fn from(value: bool) -> u32 {\n value as u32\n }\n}\nimpl From for u64 {\n fn from(value: bool) -> u64 {\n value as u64\n }\n}\nimpl From for i8 {\n fn from(value: bool) -> i8 {\n value as i8\n }\n}\nimpl From for i32 {\n fn from(value: bool) -> i32 {\n value as i32\n }\n}\nimpl From for i64 {\n fn from(value: bool) -> i64 {\n value as i64\n }\n}\nimpl From for Field {\n fn from(value: bool) -> Field {\n value as Field\n }\n}\n// docs:end:from-impls\n\n/// A generic interface for casting between primitive types,\n/// equivalent of using the `as` keyword between values.\n///\n/// # Example\n///\n/// ```\n/// let x: Field = 1234567890;\n/// let y: u8 = x as u8;\n/// let z: u8 = x.as_();\n/// assert_eq(y, z);\n/// ```\npub trait AsPrimitive {\n /// The equivalent of doing `self as T`.\n fn as_(self) -> T;\n}\n\n#[generate_as_primitive_impls]\ncomptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted {\n let types = [\n quote { bool },\n quote { u8 },\n quote { u16 },\n quote { u32 },\n quote { u64 },\n quote { u128 },\n quote { i8 },\n quote { i16 },\n quote { i32 },\n quote { i64 },\n quote { Field },\n ];\n\n let mut impls = &[];\n for type1 in types {\n for type2 in types {\n let body = if type1 == type2 {\n quote { self }\n } else if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for $type2 {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n }\n impls.join(quote {})\n}\n", "path": "std/convert.nr" }, "39": { diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/wrapping_operations/execute__tests__force_brillig_false_inliner_9223372036854775807.snap b/tooling/nargo_cli/tests/snapshots/execution_success/wrapping_operations/execute__tests__force_brillig_false_inliner_9223372036854775807.snap index 9bf3fb89dfc..4e3095967a8 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/wrapping_operations/execute__tests__force_brillig_false_inliner_9223372036854775807.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/wrapping_operations/execute__tests__force_brillig_false_inliner_9223372036854775807.snap @@ -77,10 +77,10 @@ expression: artifact "unconstrained func 1", "[Const { destination: Direct(21), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(20), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(0), size_address: Direct(21), offset_address: Direct(20) }, Const { destination: Direct(2), bit_size: Field, value: 0 }, BinaryFieldOp { destination: Direct(3), op: Equals, lhs: Direct(0), rhs: Direct(2) }, JumpIf { condition: Direct(3), location: 8 }, Const { destination: Direct(1), bit_size: Field, value: 1 }, BinaryFieldOp { destination: Direct(0), op: Div, lhs: Direct(1), rhs: Direct(0) }, Stop { return_data: HeapVector { pointer: Direct(20), size: Direct(21) } }]" ], - "debug_symbols": "tZXdjoIwEIXfpddcdKb/vspmY1CrISFoEEw2xnffUgbUizEuZm/mAOV8dKalcxW7uOkP66rZH89i9XUVm7aq6+qwro/bsquOTXp6vRViul13bYzpkXgYT65T2camE6umr+tCXMq6zy+dT2WTtSvbNCoLEZtd0gTcV3Ucrm7F3S15awDygjSz2zzbgbc7LQ0BnFb376vwRECeABKtm+eADjmG4hkK9YRQaGAmAC6bhQL7cSYKWcbb9WQJby0oKG5BX9gB5xQ0cP7A+62cE7CS3xDwagpSOjvXUXpgIfDxlvjDPIJamIwJDxDNQvTHyby5rGHJtrBq8jvHnhOOB3hvNRG894Gtgn9VSm3mWUjt5EKIsg8QdnOh/Nf1uNfTP5+73+mu3FbtU6MQmM6DQqgcdY4mR5ujy9HnGHIEOQqMMtoh+VNpIAEg/aRgSC2pI/WkYVSUpECKpIqUeDjwUm0x8TD9muhIPWkYVUlSIEVSRapJDenAG9rCpWyrclNHap37vtk+dNLu5zSNTL321B63cde3cShmHkvl/QU=", + "debug_symbols": "tZXdjoIwEIXfpddcdKalP/sqm41BrRsSggbBZGN89x3KgHoxxtXszXxAOYfOtHTOapvWw/eqbnf7o/r4PKt1VzdN/b1q9puqr/ctPT1fCjXfrvouJXqkbsZJdai61Pbqox2aplCnqhnyS8dD1Wb2VUejulCp3RLJcFc3aby6FFe1lqURWAu6XNTlvRxkube6ZANvzfX7Jt45oOwAGp1f5oAeJQ8jexiMcwno0i4OgK/NwoB7OxODosfT9RQdnlpQMNKCPpADLilYkPRR1ju9JOC0vCHg0RS09m6pow4gmsDbW+IP84jmxWTKeGNiRRP7djJPLmt8ZVs4M+u9F88JLxuE4Cw7hBCiWIXwqJS2XGahrdcvmhh3YyJuLtT/uh7Xeob7c/eL7qpN3d01CoV0HhTK5GhzLHN0OfocQ44xR9ATYMIkB9JTaYAMgH5SKJmO6ZmBGSeiZgITmYbJfjj6UW2R/JB+TfTMwIwTjWYCE5mGaZklc/Qb28Kp6upq3SRunbuh3dx00v7nMI/MvfbQ7TdpO3RpLGYeo/L+Ag==", "file_map": { "12": { - "source": "// docs:start:from-trait\npub trait From {\n fn from(input: T) -> Self;\n}\n// docs:end:from-trait\n\nimpl From for T {\n fn from(input: T) -> T {\n input\n }\n}\n\n// docs:start:into-trait\npub trait Into {\n fn into(self) -> T;\n}\n\nimpl Into for U\nwhere\n T: From,\n{\n fn into(self) -> T {\n T::from(self)\n }\n}\n// docs:end:into-trait\n\n// docs:start:from-impls\n// Unsigned integers\n\nimpl From for u32 {\n fn from(value: u8) -> u32 {\n value as u32\n }\n}\n\nimpl From for u64 {\n fn from(value: u8) -> u64 {\n value as u64\n }\n}\nimpl From for u64 {\n fn from(value: u32) -> u64 {\n value as u64\n }\n}\n\nimpl From for u128 {\n fn from(value: u8) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u32) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u64) -> u128 {\n value as u128\n }\n}\n\nimpl From for Field {\n fn from(value: u8) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u32) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u64) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u128) -> Field {\n value as Field\n }\n}\n\n// Signed integers\n\nimpl From for i32 {\n fn from(value: i8) -> i32 {\n value as i32\n }\n}\n\nimpl From for i64 {\n fn from(value: i8) -> i64 {\n value as i64\n }\n}\nimpl From for i64 {\n fn from(value: i32) -> i64 {\n value as i64\n }\n}\n\n// Booleans\nimpl From for u8 {\n fn from(value: bool) -> u8 {\n value as u8\n }\n}\nimpl From for u32 {\n fn from(value: bool) -> u32 {\n value as u32\n }\n}\nimpl From for u64 {\n fn from(value: bool) -> u64 {\n value as u64\n }\n}\nimpl From for i8 {\n fn from(value: bool) -> i8 {\n value as i8\n }\n}\nimpl From for i32 {\n fn from(value: bool) -> i32 {\n value as i32\n }\n}\nimpl From for i64 {\n fn from(value: bool) -> i64 {\n value as i64\n }\n}\nimpl From for Field {\n fn from(value: bool) -> Field {\n value as Field\n }\n}\n// docs:end:from-impls\n\n/// A generic interface for casting between primitive types,\n/// equivalent of using the `as` keyword between values.\n///\n/// # Example\n///\n/// ```\n/// let x: Field = 1234567890;\n/// let y: u8 = x as u8;\n/// let z: u8 = x.as_();\n/// assert_eq(y, z);\n/// ```\npub trait AsPrimitive {\n /// The equivalent of doing `self as T`.\n fn as_(self) -> T;\n}\n\n#[generate_as_primitive_impls]\ncomptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted {\n let types = [\n quote { bool },\n quote { u8 },\n quote { u16 },\n quote { u32 },\n quote { u64 },\n quote { u128 },\n quote { i8 },\n quote { i16 },\n quote { i32 },\n quote { i64 },\n quote { Field },\n ];\n\n let mut impls = &[];\n for type1 in types {\n for type2 in types {\n let trait_impl = quote {\n impl AsPrimitive<$type1> for $type2 {\n fn as_(self) -> $type1 {\n self as $type1\n }\n }\n };\n\n impls = impls.push_back(trait_impl);\n }\n }\n impls.join(quote {})\n}\n", + "source": "// docs:start:from-trait\npub trait From {\n fn from(input: T) -> Self;\n}\n// docs:end:from-trait\n\nimpl From for T {\n fn from(input: T) -> T {\n input\n }\n}\n\n// docs:start:into-trait\npub trait Into {\n fn into(self) -> T;\n}\n\nimpl Into for U\nwhere\n T: From,\n{\n fn into(self) -> T {\n T::from(self)\n }\n}\n// docs:end:into-trait\n\n// docs:start:from-impls\n// Unsigned integers\n\nimpl From for u32 {\n fn from(value: u8) -> u32 {\n value as u32\n }\n}\n\nimpl From for u64 {\n fn from(value: u8) -> u64 {\n value as u64\n }\n}\nimpl From for u64 {\n fn from(value: u32) -> u64 {\n value as u64\n }\n}\n\nimpl From for u128 {\n fn from(value: u8) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u32) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u64) -> u128 {\n value as u128\n }\n}\n\nimpl From for Field {\n fn from(value: u8) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u32) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u64) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u128) -> Field {\n value as Field\n }\n}\n\n// Signed integers\n\nimpl From for i32 {\n fn from(value: i8) -> i32 {\n value as i32\n }\n}\n\nimpl From for i64 {\n fn from(value: i8) -> i64 {\n value as i64\n }\n}\nimpl From for i64 {\n fn from(value: i32) -> i64 {\n value as i64\n }\n}\n\n// Booleans\nimpl From for u8 {\n fn from(value: bool) -> u8 {\n value as u8\n }\n}\nimpl From for u32 {\n fn from(value: bool) -> u32 {\n value as u32\n }\n}\nimpl From for u64 {\n fn from(value: bool) -> u64 {\n value as u64\n }\n}\nimpl From for i8 {\n fn from(value: bool) -> i8 {\n value as i8\n }\n}\nimpl From for i32 {\n fn from(value: bool) -> i32 {\n value as i32\n }\n}\nimpl From for i64 {\n fn from(value: bool) -> i64 {\n value as i64\n }\n}\nimpl From for Field {\n fn from(value: bool) -> Field {\n value as Field\n }\n}\n// docs:end:from-impls\n\n/// A generic interface for casting between primitive types,\n/// equivalent of using the `as` keyword between values.\n///\n/// # Example\n///\n/// ```\n/// let x: Field = 1234567890;\n/// let y: u8 = x as u8;\n/// let z: u8 = x.as_();\n/// assert_eq(y, z);\n/// ```\npub trait AsPrimitive {\n /// The equivalent of doing `self as T`.\n fn as_(self) -> T;\n}\n\n#[generate_as_primitive_impls]\ncomptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted {\n let types = [\n quote { bool },\n quote { u8 },\n quote { u16 },\n quote { u32 },\n quote { u64 },\n quote { u128 },\n quote { i8 },\n quote { i16 },\n quote { i32 },\n quote { i64 },\n quote { Field },\n ];\n\n let mut impls = &[];\n for type1 in types {\n for type2 in types {\n let body = if type1 == type2 {\n quote { self }\n } else if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for $type2 {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n }\n impls.join(quote {})\n}\n", "path": "std/convert.nr" }, "39": { diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/wrapping_operations/execute__tests__force_brillig_true_inliner_-9223372036854775808.snap b/tooling/nargo_cli/tests/snapshots/execution_success/wrapping_operations/execute__tests__force_brillig_true_inliner_-9223372036854775808.snap index 05629e5db3e..811a1aadba9 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/wrapping_operations/execute__tests__force_brillig_true_inliner_-9223372036854775808.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/wrapping_operations/execute__tests__force_brillig_true_inliner_-9223372036854775808.snap @@ -44,10 +44,10 @@ expression: artifact "unconstrained func 0", "[Const { destination: Direct(2), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(1), bit_size: Integer(U32), value: 32838 }, Const { destination: Direct(0), bit_size: Integer(U32), value: 3 }, Const { destination: Relative(3), bit_size: Integer(U32), value: 2 }, Const { destination: Relative(4), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(32836), size_address: Relative(3), offset_address: Relative(4) }, Cast { destination: Direct(32836), source: Direct(32836), bit_size: Integer(U8) }, Cast { destination: Direct(32837), source: Direct(32837), bit_size: Integer(U8) }, Mov { destination: Relative(1), source: Direct(32836) }, Mov { destination: Relative(2), source: Direct(32837) }, Call { location: 15 }, Call { location: 16 }, Const { destination: Relative(1), bit_size: Integer(U32), value: 32838 }, Const { destination: Relative(2), bit_size: Integer(U32), value: 0 }, Stop { return_data: HeapVector { pointer: Relative(1), size: Relative(2) } }, Return, Call { location: 48 }, Cast { destination: Relative(3), source: Relative(1), bit_size: Field }, Const { destination: Relative(4), bit_size: Field, value: 340282366920938463463374607431768211456 }, BinaryFieldOp { destination: Relative(5), op: Add, lhs: Relative(3), rhs: Relative(4) }, Const { destination: Relative(3), bit_size: Field, value: 1 }, BinaryFieldOp { destination: Relative(4), op: Sub, lhs: Relative(5), rhs: Relative(3) }, Cast { destination: Relative(6), source: Relative(4), bit_size: Integer(U8) }, Cast { destination: Relative(5), source: Relative(6), bit_size: Field }, Cast { destination: Relative(4), source: Relative(5), bit_size: Integer(U8) }, BinaryIntOp { destination: Relative(5), op: Equals, bit_size: U8, lhs: Relative(4), rhs: Relative(2) }, JumpIf { condition: Relative(5), location: 29 }, Const { destination: Relative(6), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(6) } }, Cast { destination: Relative(4), source: Relative(2), bit_size: Field }, BinaryFieldOp { destination: Relative(2), op: Add, lhs: Relative(4), rhs: Relative(3) }, Cast { destination: Relative(5), source: Relative(2), bit_size: Integer(U8) }, Cast { destination: Relative(3), source: Relative(5), bit_size: Field }, Cast { destination: Relative(2), source: Relative(3), bit_size: Integer(U8) }, BinaryIntOp { destination: Relative(3), op: Equals, bit_size: U8, lhs: Relative(2), rhs: Relative(1) }, JumpIf { condition: Relative(3), location: 38 }, Const { destination: Relative(5), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(5) } }, BinaryFieldOp { destination: Relative(1), op: Mul, lhs: Relative(4), rhs: Relative(4) }, Cast { destination: Relative(3), source: Relative(1), bit_size: Integer(U8) }, Cast { destination: Relative(2), source: Relative(3), bit_size: Field }, Cast { destination: Relative(1), source: Relative(2), bit_size: Integer(U8) }, Const { destination: Relative(2), bit_size: Integer(U8), value: 1 }, BinaryIntOp { destination: Relative(3), op: Equals, bit_size: U8, lhs: Relative(1), rhs: Relative(2) }, JumpIf { condition: Relative(3), location: 47 }, Const { destination: Relative(4), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(4) } }, 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: 53 }, IndirectConst { destination_pointer: Direct(1), bit_size: Integer(U64), value: 17843811134343075018 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return]" ], - "debug_symbols": "tZXNjoIwEIDfpWcOnU5/eZWNMajVkBA0CJtsDO++gxTEwxgXsxc+oMzXmWlDb+IQd91pW9bH81XkXzexa8qqKk/b6rwv2vJc09ubkMMFnMh1JsCL3BDCHYqGLAFGKJE7Ao7QI4zIPcGOcCP8CLKAygSSBpBIHiAtqkRMJBXQBGgSbaJLJB0EIvkUZELLREgkn6J5NCbqRJNoB/Z9Jqa6t20T41D2ohHUnkvRxLoVed1VVSa+i6q7f3S9FPWdbdHQqMxErA9EEh7LKg53ffaIlnxogBQL0szR5jkc+HCnpUkCp/ExP4Yng+INIJV1cw7KKc6BvAOVnhSoDMwGUOuyQLAfV4KKdbzdT9bw1oICcgv6IhzUXIIGLj7w8VbOBVjJbwh4lYKUzs59lB5YCXy8Jf6QR8CVxZiwkGhWoj8u5s1lDWu2hcUp3jn2P+F4gfdWJ4P3PrBd8K9aqc2chdROrpSgXUjYzaXkv67Ho5/++b+7oadiXzZPJ2I/mJqy2FUxPR67er8YbX8u08h0ol6a8z4euiYOpsWxStcv7TODm36Y7Rc=", + "debug_symbols": "tZXNjoIwEIDfpWcOnU5/eZWNMajVkBA0CJtsDO++gxTEwxgXsxc+oMzXmWlDb+IQd91pW9bH81XkXzexa8qqKk/b6rwv2vJc09ubkMMFnMh1JsCL3BDCHYqGLAFGKJE7Ao7QI4zIPcGOcCP8CLKAygSSBpBIHiAtqkRMJBXQBGgSbaJLJB0EIvkUZELLREgkn6J5NCbqRJNoB/Z9Jqa6t20T41D2ohHUnkvRxLoVed1VVSa+i6q7f3S9FPWdbdHQqMxErA9EEh7LKg53ffaIlnxogBQL0szR5jkc+HCnpUkCp/ExP4Yng+INIJV1cw7KKc6BvANVmFpAt3o2gFqXBYL9uBJUrOPtfrKGtxYUkFvQF+Gg5hI0cPGBj7dyLsBKfkPAqxSkdHbuo/TASuDjLfGHPAKuLMaEhUSzEv1xMW8ua1izLSxO8c6x/wnHC7y3Ohm894Htgn/VSm3mLKR2cqUE7ULCbi4l/3U9Hv30z//dDT0V+7J5OhH7wdSUxa6K6fHY1fvFaPtzmUamE/XSnPfx0DVxMC2OVbp+aZ8Z3PTDbL8=", "file_map": { "12": { - "source": "// docs:start:from-trait\npub trait From {\n fn from(input: T) -> Self;\n}\n// docs:end:from-trait\n\nimpl From for T {\n fn from(input: T) -> T {\n input\n }\n}\n\n// docs:start:into-trait\npub trait Into {\n fn into(self) -> T;\n}\n\nimpl Into for U\nwhere\n T: From,\n{\n fn into(self) -> T {\n T::from(self)\n }\n}\n// docs:end:into-trait\n\n// docs:start:from-impls\n// Unsigned integers\n\nimpl From for u32 {\n fn from(value: u8) -> u32 {\n value as u32\n }\n}\n\nimpl From for u64 {\n fn from(value: u8) -> u64 {\n value as u64\n }\n}\nimpl From for u64 {\n fn from(value: u32) -> u64 {\n value as u64\n }\n}\n\nimpl From for u128 {\n fn from(value: u8) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u32) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u64) -> u128 {\n value as u128\n }\n}\n\nimpl From for Field {\n fn from(value: u8) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u32) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u64) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u128) -> Field {\n value as Field\n }\n}\n\n// Signed integers\n\nimpl From for i32 {\n fn from(value: i8) -> i32 {\n value as i32\n }\n}\n\nimpl From for i64 {\n fn from(value: i8) -> i64 {\n value as i64\n }\n}\nimpl From for i64 {\n fn from(value: i32) -> i64 {\n value as i64\n }\n}\n\n// Booleans\nimpl From for u8 {\n fn from(value: bool) -> u8 {\n value as u8\n }\n}\nimpl From for u32 {\n fn from(value: bool) -> u32 {\n value as u32\n }\n}\nimpl From for u64 {\n fn from(value: bool) -> u64 {\n value as u64\n }\n}\nimpl From for i8 {\n fn from(value: bool) -> i8 {\n value as i8\n }\n}\nimpl From for i32 {\n fn from(value: bool) -> i32 {\n value as i32\n }\n}\nimpl From for i64 {\n fn from(value: bool) -> i64 {\n value as i64\n }\n}\nimpl From for Field {\n fn from(value: bool) -> Field {\n value as Field\n }\n}\n// docs:end:from-impls\n\n/// A generic interface for casting between primitive types,\n/// equivalent of using the `as` keyword between values.\n///\n/// # Example\n///\n/// ```\n/// let x: Field = 1234567890;\n/// let y: u8 = x as u8;\n/// let z: u8 = x.as_();\n/// assert_eq(y, z);\n/// ```\npub trait AsPrimitive {\n /// The equivalent of doing `self as T`.\n fn as_(self) -> T;\n}\n\n#[generate_as_primitive_impls]\ncomptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted {\n let types = [\n quote { bool },\n quote { u8 },\n quote { u16 },\n quote { u32 },\n quote { u64 },\n quote { u128 },\n quote { i8 },\n quote { i16 },\n quote { i32 },\n quote { i64 },\n quote { Field },\n ];\n\n let mut impls = &[];\n for type1 in types {\n for type2 in types {\n let trait_impl = quote {\n impl AsPrimitive<$type1> for $type2 {\n fn as_(self) -> $type1 {\n self as $type1\n }\n }\n };\n\n impls = impls.push_back(trait_impl);\n }\n }\n impls.join(quote {})\n}\n", + "source": "// docs:start:from-trait\npub trait From {\n fn from(input: T) -> Self;\n}\n// docs:end:from-trait\n\nimpl From for T {\n fn from(input: T) -> T {\n input\n }\n}\n\n// docs:start:into-trait\npub trait Into {\n fn into(self) -> T;\n}\n\nimpl Into for U\nwhere\n T: From,\n{\n fn into(self) -> T {\n T::from(self)\n }\n}\n// docs:end:into-trait\n\n// docs:start:from-impls\n// Unsigned integers\n\nimpl From for u32 {\n fn from(value: u8) -> u32 {\n value as u32\n }\n}\n\nimpl From for u64 {\n fn from(value: u8) -> u64 {\n value as u64\n }\n}\nimpl From for u64 {\n fn from(value: u32) -> u64 {\n value as u64\n }\n}\n\nimpl From for u128 {\n fn from(value: u8) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u32) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u64) -> u128 {\n value as u128\n }\n}\n\nimpl From for Field {\n fn from(value: u8) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u32) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u64) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u128) -> Field {\n value as Field\n }\n}\n\n// Signed integers\n\nimpl From for i32 {\n fn from(value: i8) -> i32 {\n value as i32\n }\n}\n\nimpl From for i64 {\n fn from(value: i8) -> i64 {\n value as i64\n }\n}\nimpl From for i64 {\n fn from(value: i32) -> i64 {\n value as i64\n }\n}\n\n// Booleans\nimpl From for u8 {\n fn from(value: bool) -> u8 {\n value as u8\n }\n}\nimpl From for u32 {\n fn from(value: bool) -> u32 {\n value as u32\n }\n}\nimpl From for u64 {\n fn from(value: bool) -> u64 {\n value as u64\n }\n}\nimpl From for i8 {\n fn from(value: bool) -> i8 {\n value as i8\n }\n}\nimpl From for i32 {\n fn from(value: bool) -> i32 {\n value as i32\n }\n}\nimpl From for i64 {\n fn from(value: bool) -> i64 {\n value as i64\n }\n}\nimpl From for Field {\n fn from(value: bool) -> Field {\n value as Field\n }\n}\n// docs:end:from-impls\n\n/// A generic interface for casting between primitive types,\n/// equivalent of using the `as` keyword between values.\n///\n/// # Example\n///\n/// ```\n/// let x: Field = 1234567890;\n/// let y: u8 = x as u8;\n/// let z: u8 = x.as_();\n/// assert_eq(y, z);\n/// ```\npub trait AsPrimitive {\n /// The equivalent of doing `self as T`.\n fn as_(self) -> T;\n}\n\n#[generate_as_primitive_impls]\ncomptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted {\n let types = [\n quote { bool },\n quote { u8 },\n quote { u16 },\n quote { u32 },\n quote { u64 },\n quote { u128 },\n quote { i8 },\n quote { i16 },\n quote { i32 },\n quote { i64 },\n quote { Field },\n ];\n\n let mut impls = &[];\n for type1 in types {\n for type2 in types {\n let body = if type1 == type2 {\n quote { self }\n } else if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for $type2 {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n }\n impls.join(quote {})\n}\n", "path": "std/convert.nr" }, "39": { diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/wrapping_operations/execute__tests__force_brillig_true_inliner_0.snap b/tooling/nargo_cli/tests/snapshots/execution_success/wrapping_operations/execute__tests__force_brillig_true_inliner_0.snap index 05629e5db3e..811a1aadba9 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/wrapping_operations/execute__tests__force_brillig_true_inliner_0.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/wrapping_operations/execute__tests__force_brillig_true_inliner_0.snap @@ -44,10 +44,10 @@ expression: artifact "unconstrained func 0", "[Const { destination: Direct(2), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(1), bit_size: Integer(U32), value: 32838 }, Const { destination: Direct(0), bit_size: Integer(U32), value: 3 }, Const { destination: Relative(3), bit_size: Integer(U32), value: 2 }, Const { destination: Relative(4), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(32836), size_address: Relative(3), offset_address: Relative(4) }, Cast { destination: Direct(32836), source: Direct(32836), bit_size: Integer(U8) }, Cast { destination: Direct(32837), source: Direct(32837), bit_size: Integer(U8) }, Mov { destination: Relative(1), source: Direct(32836) }, Mov { destination: Relative(2), source: Direct(32837) }, Call { location: 15 }, Call { location: 16 }, Const { destination: Relative(1), bit_size: Integer(U32), value: 32838 }, Const { destination: Relative(2), bit_size: Integer(U32), value: 0 }, Stop { return_data: HeapVector { pointer: Relative(1), size: Relative(2) } }, Return, Call { location: 48 }, Cast { destination: Relative(3), source: Relative(1), bit_size: Field }, Const { destination: Relative(4), bit_size: Field, value: 340282366920938463463374607431768211456 }, BinaryFieldOp { destination: Relative(5), op: Add, lhs: Relative(3), rhs: Relative(4) }, Const { destination: Relative(3), bit_size: Field, value: 1 }, BinaryFieldOp { destination: Relative(4), op: Sub, lhs: Relative(5), rhs: Relative(3) }, Cast { destination: Relative(6), source: Relative(4), bit_size: Integer(U8) }, Cast { destination: Relative(5), source: Relative(6), bit_size: Field }, Cast { destination: Relative(4), source: Relative(5), bit_size: Integer(U8) }, BinaryIntOp { destination: Relative(5), op: Equals, bit_size: U8, lhs: Relative(4), rhs: Relative(2) }, JumpIf { condition: Relative(5), location: 29 }, Const { destination: Relative(6), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(6) } }, Cast { destination: Relative(4), source: Relative(2), bit_size: Field }, BinaryFieldOp { destination: Relative(2), op: Add, lhs: Relative(4), rhs: Relative(3) }, Cast { destination: Relative(5), source: Relative(2), bit_size: Integer(U8) }, Cast { destination: Relative(3), source: Relative(5), bit_size: Field }, Cast { destination: Relative(2), source: Relative(3), bit_size: Integer(U8) }, BinaryIntOp { destination: Relative(3), op: Equals, bit_size: U8, lhs: Relative(2), rhs: Relative(1) }, JumpIf { condition: Relative(3), location: 38 }, Const { destination: Relative(5), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(5) } }, BinaryFieldOp { destination: Relative(1), op: Mul, lhs: Relative(4), rhs: Relative(4) }, Cast { destination: Relative(3), source: Relative(1), bit_size: Integer(U8) }, Cast { destination: Relative(2), source: Relative(3), bit_size: Field }, Cast { destination: Relative(1), source: Relative(2), bit_size: Integer(U8) }, Const { destination: Relative(2), bit_size: Integer(U8), value: 1 }, BinaryIntOp { destination: Relative(3), op: Equals, bit_size: U8, lhs: Relative(1), rhs: Relative(2) }, JumpIf { condition: Relative(3), location: 47 }, Const { destination: Relative(4), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(4) } }, 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: 53 }, IndirectConst { destination_pointer: Direct(1), bit_size: Integer(U64), value: 17843811134343075018 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return]" ], - "debug_symbols": "tZXNjoIwEIDfpWcOnU5/eZWNMajVkBA0CJtsDO++gxTEwxgXsxc+oMzXmWlDb+IQd91pW9bH81XkXzexa8qqKk/b6rwv2vJc09ubkMMFnMh1JsCL3BDCHYqGLAFGKJE7Ao7QI4zIPcGOcCP8CLKAygSSBpBIHiAtqkRMJBXQBGgSbaJLJB0EIvkUZELLREgkn6J5NCbqRJNoB/Z9Jqa6t20T41D2ohHUnkvRxLoVed1VVSa+i6q7f3S9FPWdbdHQqMxErA9EEh7LKg53ffaIlnxogBQL0szR5jkc+HCnpUkCp/ExP4Yng+INIJV1cw7KKc6BvAOVnhSoDMwGUOuyQLAfV4KKdbzdT9bw1oICcgv6IhzUXIIGLj7w8VbOBVjJbwh4lYKUzs59lB5YCXy8Jf6QR8CVxZiwkGhWoj8u5s1lDWu2hcUp3jn2P+F4gfdWJ4P3PrBd8K9aqc2chdROrpSgXUjYzaXkv67Ho5/++b+7oadiXzZPJ2I/mJqy2FUxPR67er8YbX8u08h0ol6a8z4euiYOpsWxStcv7TODm36Y7Rc=", + "debug_symbols": "tZXNjoIwEIDfpWcOnU5/eZWNMajVkBA0CJtsDO++gxTEwxgXsxc+oMzXmWlDb+IQd91pW9bH81XkXzexa8qqKk/b6rwv2vJc09ubkMMFnMh1JsCL3BDCHYqGLAFGKJE7Ao7QI4zIPcGOcCP8CLKAygSSBpBIHiAtqkRMJBXQBGgSbaJLJB0EIvkUZELLREgkn6J5NCbqRJNoB/Z9Jqa6t20T41D2ohHUnkvRxLoVed1VVSa+i6q7f3S9FPWdbdHQqMxErA9EEh7LKg53ffaIlnxogBQL0szR5jkc+HCnpUkCp/ExP4Yng+INIJV1cw7KKc6BvANVmFpAt3o2gFqXBYL9uBJUrOPtfrKGtxYUkFvQF+Gg5hI0cPGBj7dyLsBKfkPAqxSkdHbuo/TASuDjLfGHPAKuLMaEhUSzEv1xMW8ua1izLSxO8c6x/wnHC7y3Ohm894Htgn/VSm3mLKR2cqUE7ULCbi4l/3U9Hv30z//dDT0V+7J5OhH7wdSUxa6K6fHY1fvFaPtzmUamE/XSnPfx0DVxMC2OVbp+aZ8Z3PTDbL8=", "file_map": { "12": { - "source": "// docs:start:from-trait\npub trait From {\n fn from(input: T) -> Self;\n}\n// docs:end:from-trait\n\nimpl From for T {\n fn from(input: T) -> T {\n input\n }\n}\n\n// docs:start:into-trait\npub trait Into {\n fn into(self) -> T;\n}\n\nimpl Into for U\nwhere\n T: From,\n{\n fn into(self) -> T {\n T::from(self)\n }\n}\n// docs:end:into-trait\n\n// docs:start:from-impls\n// Unsigned integers\n\nimpl From for u32 {\n fn from(value: u8) -> u32 {\n value as u32\n }\n}\n\nimpl From for u64 {\n fn from(value: u8) -> u64 {\n value as u64\n }\n}\nimpl From for u64 {\n fn from(value: u32) -> u64 {\n value as u64\n }\n}\n\nimpl From for u128 {\n fn from(value: u8) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u32) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u64) -> u128 {\n value as u128\n }\n}\n\nimpl From for Field {\n fn from(value: u8) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u32) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u64) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u128) -> Field {\n value as Field\n }\n}\n\n// Signed integers\n\nimpl From for i32 {\n fn from(value: i8) -> i32 {\n value as i32\n }\n}\n\nimpl From for i64 {\n fn from(value: i8) -> i64 {\n value as i64\n }\n}\nimpl From for i64 {\n fn from(value: i32) -> i64 {\n value as i64\n }\n}\n\n// Booleans\nimpl From for u8 {\n fn from(value: bool) -> u8 {\n value as u8\n }\n}\nimpl From for u32 {\n fn from(value: bool) -> u32 {\n value as u32\n }\n}\nimpl From for u64 {\n fn from(value: bool) -> u64 {\n value as u64\n }\n}\nimpl From for i8 {\n fn from(value: bool) -> i8 {\n value as i8\n }\n}\nimpl From for i32 {\n fn from(value: bool) -> i32 {\n value as i32\n }\n}\nimpl From for i64 {\n fn from(value: bool) -> i64 {\n value as i64\n }\n}\nimpl From for Field {\n fn from(value: bool) -> Field {\n value as Field\n }\n}\n// docs:end:from-impls\n\n/// A generic interface for casting between primitive types,\n/// equivalent of using the `as` keyword between values.\n///\n/// # Example\n///\n/// ```\n/// let x: Field = 1234567890;\n/// let y: u8 = x as u8;\n/// let z: u8 = x.as_();\n/// assert_eq(y, z);\n/// ```\npub trait AsPrimitive {\n /// The equivalent of doing `self as T`.\n fn as_(self) -> T;\n}\n\n#[generate_as_primitive_impls]\ncomptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted {\n let types = [\n quote { bool },\n quote { u8 },\n quote { u16 },\n quote { u32 },\n quote { u64 },\n quote { u128 },\n quote { i8 },\n quote { i16 },\n quote { i32 },\n quote { i64 },\n quote { Field },\n ];\n\n let mut impls = &[];\n for type1 in types {\n for type2 in types {\n let trait_impl = quote {\n impl AsPrimitive<$type1> for $type2 {\n fn as_(self) -> $type1 {\n self as $type1\n }\n }\n };\n\n impls = impls.push_back(trait_impl);\n }\n }\n impls.join(quote {})\n}\n", + "source": "// docs:start:from-trait\npub trait From {\n fn from(input: T) -> Self;\n}\n// docs:end:from-trait\n\nimpl From for T {\n fn from(input: T) -> T {\n input\n }\n}\n\n// docs:start:into-trait\npub trait Into {\n fn into(self) -> T;\n}\n\nimpl Into for U\nwhere\n T: From,\n{\n fn into(self) -> T {\n T::from(self)\n }\n}\n// docs:end:into-trait\n\n// docs:start:from-impls\n// Unsigned integers\n\nimpl From for u32 {\n fn from(value: u8) -> u32 {\n value as u32\n }\n}\n\nimpl From for u64 {\n fn from(value: u8) -> u64 {\n value as u64\n }\n}\nimpl From for u64 {\n fn from(value: u32) -> u64 {\n value as u64\n }\n}\n\nimpl From for u128 {\n fn from(value: u8) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u32) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u64) -> u128 {\n value as u128\n }\n}\n\nimpl From for Field {\n fn from(value: u8) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u32) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u64) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u128) -> Field {\n value as Field\n }\n}\n\n// Signed integers\n\nimpl From for i32 {\n fn from(value: i8) -> i32 {\n value as i32\n }\n}\n\nimpl From for i64 {\n fn from(value: i8) -> i64 {\n value as i64\n }\n}\nimpl From for i64 {\n fn from(value: i32) -> i64 {\n value as i64\n }\n}\n\n// Booleans\nimpl From for u8 {\n fn from(value: bool) -> u8 {\n value as u8\n }\n}\nimpl From for u32 {\n fn from(value: bool) -> u32 {\n value as u32\n }\n}\nimpl From for u64 {\n fn from(value: bool) -> u64 {\n value as u64\n }\n}\nimpl From for i8 {\n fn from(value: bool) -> i8 {\n value as i8\n }\n}\nimpl From for i32 {\n fn from(value: bool) -> i32 {\n value as i32\n }\n}\nimpl From for i64 {\n fn from(value: bool) -> i64 {\n value as i64\n }\n}\nimpl From for Field {\n fn from(value: bool) -> Field {\n value as Field\n }\n}\n// docs:end:from-impls\n\n/// A generic interface for casting between primitive types,\n/// equivalent of using the `as` keyword between values.\n///\n/// # Example\n///\n/// ```\n/// let x: Field = 1234567890;\n/// let y: u8 = x as u8;\n/// let z: u8 = x.as_();\n/// assert_eq(y, z);\n/// ```\npub trait AsPrimitive {\n /// The equivalent of doing `self as T`.\n fn as_(self) -> T;\n}\n\n#[generate_as_primitive_impls]\ncomptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted {\n let types = [\n quote { bool },\n quote { u8 },\n quote { u16 },\n quote { u32 },\n quote { u64 },\n quote { u128 },\n quote { i8 },\n quote { i16 },\n quote { i32 },\n quote { i64 },\n quote { Field },\n ];\n\n let mut impls = &[];\n for type1 in types {\n for type2 in types {\n let body = if type1 == type2 {\n quote { self }\n } else if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for $type2 {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n }\n impls.join(quote {})\n}\n", "path": "std/convert.nr" }, "39": { diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/wrapping_operations/execute__tests__force_brillig_true_inliner_9223372036854775807.snap b/tooling/nargo_cli/tests/snapshots/execution_success/wrapping_operations/execute__tests__force_brillig_true_inliner_9223372036854775807.snap index 05629e5db3e..811a1aadba9 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/wrapping_operations/execute__tests__force_brillig_true_inliner_9223372036854775807.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/wrapping_operations/execute__tests__force_brillig_true_inliner_9223372036854775807.snap @@ -44,10 +44,10 @@ expression: artifact "unconstrained func 0", "[Const { destination: Direct(2), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(1), bit_size: Integer(U32), value: 32838 }, Const { destination: Direct(0), bit_size: Integer(U32), value: 3 }, Const { destination: Relative(3), bit_size: Integer(U32), value: 2 }, Const { destination: Relative(4), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(32836), size_address: Relative(3), offset_address: Relative(4) }, Cast { destination: Direct(32836), source: Direct(32836), bit_size: Integer(U8) }, Cast { destination: Direct(32837), source: Direct(32837), bit_size: Integer(U8) }, Mov { destination: Relative(1), source: Direct(32836) }, Mov { destination: Relative(2), source: Direct(32837) }, Call { location: 15 }, Call { location: 16 }, Const { destination: Relative(1), bit_size: Integer(U32), value: 32838 }, Const { destination: Relative(2), bit_size: Integer(U32), value: 0 }, Stop { return_data: HeapVector { pointer: Relative(1), size: Relative(2) } }, Return, Call { location: 48 }, Cast { destination: Relative(3), source: Relative(1), bit_size: Field }, Const { destination: Relative(4), bit_size: Field, value: 340282366920938463463374607431768211456 }, BinaryFieldOp { destination: Relative(5), op: Add, lhs: Relative(3), rhs: Relative(4) }, Const { destination: Relative(3), bit_size: Field, value: 1 }, BinaryFieldOp { destination: Relative(4), op: Sub, lhs: Relative(5), rhs: Relative(3) }, Cast { destination: Relative(6), source: Relative(4), bit_size: Integer(U8) }, Cast { destination: Relative(5), source: Relative(6), bit_size: Field }, Cast { destination: Relative(4), source: Relative(5), bit_size: Integer(U8) }, BinaryIntOp { destination: Relative(5), op: Equals, bit_size: U8, lhs: Relative(4), rhs: Relative(2) }, JumpIf { condition: Relative(5), location: 29 }, Const { destination: Relative(6), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(6) } }, Cast { destination: Relative(4), source: Relative(2), bit_size: Field }, BinaryFieldOp { destination: Relative(2), op: Add, lhs: Relative(4), rhs: Relative(3) }, Cast { destination: Relative(5), source: Relative(2), bit_size: Integer(U8) }, Cast { destination: Relative(3), source: Relative(5), bit_size: Field }, Cast { destination: Relative(2), source: Relative(3), bit_size: Integer(U8) }, BinaryIntOp { destination: Relative(3), op: Equals, bit_size: U8, lhs: Relative(2), rhs: Relative(1) }, JumpIf { condition: Relative(3), location: 38 }, Const { destination: Relative(5), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(5) } }, BinaryFieldOp { destination: Relative(1), op: Mul, lhs: Relative(4), rhs: Relative(4) }, Cast { destination: Relative(3), source: Relative(1), bit_size: Integer(U8) }, Cast { destination: Relative(2), source: Relative(3), bit_size: Field }, Cast { destination: Relative(1), source: Relative(2), bit_size: Integer(U8) }, Const { destination: Relative(2), bit_size: Integer(U8), value: 1 }, BinaryIntOp { destination: Relative(3), op: Equals, bit_size: U8, lhs: Relative(1), rhs: Relative(2) }, JumpIf { condition: Relative(3), location: 47 }, Const { destination: Relative(4), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(4) } }, 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: 53 }, IndirectConst { destination_pointer: Direct(1), bit_size: Integer(U64), value: 17843811134343075018 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return]" ], - "debug_symbols": "tZXNjoIwEIDfpWcOnU5/eZWNMajVkBA0CJtsDO++gxTEwxgXsxc+oMzXmWlDb+IQd91pW9bH81XkXzexa8qqKk/b6rwv2vJc09ubkMMFnMh1JsCL3BDCHYqGLAFGKJE7Ao7QI4zIPcGOcCP8CLKAygSSBpBIHiAtqkRMJBXQBGgSbaJLJB0EIvkUZELLREgkn6J5NCbqRJNoB/Z9Jqa6t20T41D2ohHUnkvRxLoVed1VVSa+i6q7f3S9FPWdbdHQqMxErA9EEh7LKg53ffaIlnxogBQL0szR5jkc+HCnpUkCp/ExP4Yng+INIJV1cw7KKc6BvAOVnhSoDMwGUOuyQLAfV4KKdbzdT9bw1oICcgv6IhzUXIIGLj7w8VbOBVjJbwh4lYKUzs59lB5YCXy8Jf6QR8CVxZiwkGhWoj8u5s1lDWu2hcUp3jn2P+F4gfdWJ4P3PrBd8K9aqc2chdROrpSgXUjYzaXkv67Ho5/++b+7oadiXzZPJ2I/mJqy2FUxPR67er8YbX8u08h0ol6a8z4euiYOpsWxStcv7TODm36Y7Rc=", + "debug_symbols": "tZXNjoIwEIDfpWcOnU5/eZWNMajVkBA0CJtsDO++gxTEwxgXsxc+oMzXmWlDb+IQd91pW9bH81XkXzexa8qqKk/b6rwv2vJc09ubkMMFnMh1JsCL3BDCHYqGLAFGKJE7Ao7QI4zIPcGOcCP8CLKAygSSBpBIHiAtqkRMJBXQBGgSbaJLJB0EIvkUZELLREgkn6J5NCbqRJNoB/Z9Jqa6t20T41D2ohHUnkvRxLoVed1VVSa+i6q7f3S9FPWdbdHQqMxErA9EEh7LKg53ffaIlnxogBQL0szR5jkc+HCnpUkCp/ExP4Yng+INIJV1cw7KKc6BvANVmFpAt3o2gFqXBYL9uBJUrOPtfrKGtxYUkFvQF+Gg5hI0cPGBj7dyLsBKfkPAqxSkdHbuo/TASuDjLfGHPAKuLMaEhUSzEv1xMW8ua1izLSxO8c6x/wnHC7y3Ohm894Htgn/VSm3mLKR2cqUE7ULCbi4l/3U9Hv30z//dDT0V+7J5OhH7wdSUxa6K6fHY1fvFaPtzmUamE/XSnPfx0DVxMC2OVbp+aZ8Z3PTDbL8=", "file_map": { "12": { - "source": "// docs:start:from-trait\npub trait From {\n fn from(input: T) -> Self;\n}\n// docs:end:from-trait\n\nimpl From for T {\n fn from(input: T) -> T {\n input\n }\n}\n\n// docs:start:into-trait\npub trait Into {\n fn into(self) -> T;\n}\n\nimpl Into for U\nwhere\n T: From,\n{\n fn into(self) -> T {\n T::from(self)\n }\n}\n// docs:end:into-trait\n\n// docs:start:from-impls\n// Unsigned integers\n\nimpl From for u32 {\n fn from(value: u8) -> u32 {\n value as u32\n }\n}\n\nimpl From for u64 {\n fn from(value: u8) -> u64 {\n value as u64\n }\n}\nimpl From for u64 {\n fn from(value: u32) -> u64 {\n value as u64\n }\n}\n\nimpl From for u128 {\n fn from(value: u8) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u32) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u64) -> u128 {\n value as u128\n }\n}\n\nimpl From for Field {\n fn from(value: u8) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u32) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u64) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u128) -> Field {\n value as Field\n }\n}\n\n// Signed integers\n\nimpl From for i32 {\n fn from(value: i8) -> i32 {\n value as i32\n }\n}\n\nimpl From for i64 {\n fn from(value: i8) -> i64 {\n value as i64\n }\n}\nimpl From for i64 {\n fn from(value: i32) -> i64 {\n value as i64\n }\n}\n\n// Booleans\nimpl From for u8 {\n fn from(value: bool) -> u8 {\n value as u8\n }\n}\nimpl From for u32 {\n fn from(value: bool) -> u32 {\n value as u32\n }\n}\nimpl From for u64 {\n fn from(value: bool) -> u64 {\n value as u64\n }\n}\nimpl From for i8 {\n fn from(value: bool) -> i8 {\n value as i8\n }\n}\nimpl From for i32 {\n fn from(value: bool) -> i32 {\n value as i32\n }\n}\nimpl From for i64 {\n fn from(value: bool) -> i64 {\n value as i64\n }\n}\nimpl From for Field {\n fn from(value: bool) -> Field {\n value as Field\n }\n}\n// docs:end:from-impls\n\n/// A generic interface for casting between primitive types,\n/// equivalent of using the `as` keyword between values.\n///\n/// # Example\n///\n/// ```\n/// let x: Field = 1234567890;\n/// let y: u8 = x as u8;\n/// let z: u8 = x.as_();\n/// assert_eq(y, z);\n/// ```\npub trait AsPrimitive {\n /// The equivalent of doing `self as T`.\n fn as_(self) -> T;\n}\n\n#[generate_as_primitive_impls]\ncomptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted {\n let types = [\n quote { bool },\n quote { u8 },\n quote { u16 },\n quote { u32 },\n quote { u64 },\n quote { u128 },\n quote { i8 },\n quote { i16 },\n quote { i32 },\n quote { i64 },\n quote { Field },\n ];\n\n let mut impls = &[];\n for type1 in types {\n for type2 in types {\n let trait_impl = quote {\n impl AsPrimitive<$type1> for $type2 {\n fn as_(self) -> $type1 {\n self as $type1\n }\n }\n };\n\n impls = impls.push_back(trait_impl);\n }\n }\n impls.join(quote {})\n}\n", + "source": "// docs:start:from-trait\npub trait From {\n fn from(input: T) -> Self;\n}\n// docs:end:from-trait\n\nimpl From for T {\n fn from(input: T) -> T {\n input\n }\n}\n\n// docs:start:into-trait\npub trait Into {\n fn into(self) -> T;\n}\n\nimpl Into for U\nwhere\n T: From,\n{\n fn into(self) -> T {\n T::from(self)\n }\n}\n// docs:end:into-trait\n\n// docs:start:from-impls\n// Unsigned integers\n\nimpl From for u32 {\n fn from(value: u8) -> u32 {\n value as u32\n }\n}\n\nimpl From for u64 {\n fn from(value: u8) -> u64 {\n value as u64\n }\n}\nimpl From for u64 {\n fn from(value: u32) -> u64 {\n value as u64\n }\n}\n\nimpl From for u128 {\n fn from(value: u8) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u32) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u64) -> u128 {\n value as u128\n }\n}\n\nimpl From for Field {\n fn from(value: u8) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u32) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u64) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u128) -> Field {\n value as Field\n }\n}\n\n// Signed integers\n\nimpl From for i32 {\n fn from(value: i8) -> i32 {\n value as i32\n }\n}\n\nimpl From for i64 {\n fn from(value: i8) -> i64 {\n value as i64\n }\n}\nimpl From for i64 {\n fn from(value: i32) -> i64 {\n value as i64\n }\n}\n\n// Booleans\nimpl From for u8 {\n fn from(value: bool) -> u8 {\n value as u8\n }\n}\nimpl From for u32 {\n fn from(value: bool) -> u32 {\n value as u32\n }\n}\nimpl From for u64 {\n fn from(value: bool) -> u64 {\n value as u64\n }\n}\nimpl From for i8 {\n fn from(value: bool) -> i8 {\n value as i8\n }\n}\nimpl From for i32 {\n fn from(value: bool) -> i32 {\n value as i32\n }\n}\nimpl From for i64 {\n fn from(value: bool) -> i64 {\n value as i64\n }\n}\nimpl From for Field {\n fn from(value: bool) -> Field {\n value as Field\n }\n}\n// docs:end:from-impls\n\n/// A generic interface for casting between primitive types,\n/// equivalent of using the `as` keyword between values.\n///\n/// # Example\n///\n/// ```\n/// let x: Field = 1234567890;\n/// let y: u8 = x as u8;\n/// let z: u8 = x.as_();\n/// assert_eq(y, z);\n/// ```\npub trait AsPrimitive {\n /// The equivalent of doing `self as T`.\n fn as_(self) -> T;\n}\n\n#[generate_as_primitive_impls]\ncomptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted {\n let types = [\n quote { bool },\n quote { u8 },\n quote { u16 },\n quote { u32 },\n quote { u64 },\n quote { u128 },\n quote { i8 },\n quote { i16 },\n quote { i32 },\n quote { i64 },\n quote { Field },\n ];\n\n let mut impls = &[];\n for type1 in types {\n for type2 in types {\n let body = if type1 == type2 {\n quote { self }\n } else if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for $type2 {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n }\n impls.join(quote {})\n}\n", "path": "std/convert.nr" }, "39": {