diff --git a/noir-projects/aztec-nr/aztec/src/macros/internals_functions_generation/external/public.nr b/noir-projects/aztec-nr/aztec/src/macros/internals_functions_generation/external/public.nr index 0eaf0adea0ea..cd67cabb8c1c 100644 --- a/noir-projects/aztec-nr/aztec/src/macros/internals_functions_generation/external/public.nr +++ b/noir-projects/aztec-nr/aztec/src/macros/internals_functions_generation/external/public.nr @@ -6,9 +6,52 @@ use crate::macros::{ }, }; +/// Generates the per-contract helper that builds public `self`. +/// +/// Each public external function calls this helper instead of inlining the construction, so the same preamble does not +/// appear duplicated in every public function body. We let Noir's inliner decide whether to inline the helper at each +/// call site rather than forcing it via macro expansion. +/// +/// The helper is generic over the calldata length `N` because `PublicContext::new` takes a closure that reads `N` +/// fields from calldata. Noir monomorphizes one copy per distinct `N`, so public functions with the same number of +/// serialized args reuse the same compiled code. +pub(crate) comptime fn generate_public_self_creator(m: Module) -> Quoted { + let (storage_type, storage_init) = if module_has_storage(m) { + (quote { Storage }, quote { let storage = Storage::init(context); }) + } else { + // Contract does not have Storage defined, so we set storage to the unit type `()`. ContractSelfPublic requires + // a storage struct in its constructor. Using an Option type would lead to worse developer experience and + // higher constraint counts so we use the unit type `()` instead. + (quote { () }, quote { let storage = (); }) + }; + + quote { + #[contract_library_method] + unconstrained fn __aztec_nr_internals__create_public_self() -> aztec::contract_self::ContractSelfPublic< + $storage_type, + CallSelf, + CallSelfStatic, + CallInternal, + > { + // Unlike in the private case, in public the `context` does not need to receive the hash of the original + // params. + let context = aztec::context::PublicContext::new(|| { + // We start from 1 because we skip the selector for the dispatch function. + let serialized_args : [Field; N] = aztec::oracle::avm::calldata_copy(1, N); + aztec::hash::hash_args(serialized_args) + }); + $storage_init + let self_address = context.this_address(); + let call_self: CallSelf = CallSelf { address: self_address, context }; + let call_self_static: CallSelfStatic = CallSelfStatic { address: self_address, context }; + let internal: CallInternal = CallInternal { context }; + aztec::contract_self::ContractSelfPublic::new(context, storage, call_self, call_self_static, internal) + } + } +} + pub(crate) comptime fn generate_public_external(f: FunctionDefinition) -> Quoted { let module_has_initializer = module_has_initializer(f.module()); - let module_has_storage = module_has_storage(f.module()); // Public functions undergo a lot of transformations from their Aztec.nr form. let original_params = f.parameters(); @@ -28,35 +71,9 @@ pub(crate) comptime fn generate_public_external(f: FunctionDefinition) -> Quoted .join(quote {+}) }; - let storage_init = if module_has_storage { - quote { - let storage = Storage::init(context); - } - } else { - // Contract does not have Storage defined, so we set storage to the unit type `()`. ContractSelfPublic requires - // a storage struct in its constructor. Using an Option type would lead to worse developer experience and - // higher constraint counts so we use the unit type `()` instead. - quote { - let storage = (); - } - }; - - // Unlike in the private case, in public the `context` does not need to receive the hash of the original params. let contract_self_creation = quote { #[allow(unused_variables)] - let mut self = { - let context = aztec::context::PublicContext::new(|| { - // We start from 1 because we skip the selector for the dispatch function. - let serialized_args : [Field; $args_len_quote] = aztec::oracle::avm::calldata_copy(1, $args_len_quote); - aztec::hash::hash_args(serialized_args) - }); - $storage_init - let self_address = context.this_address(); - let call_self: CallSelf = CallSelf { address: self_address, context }; - let call_self_static: CallSelfStatic = CallSelfStatic { address: self_address, context }; - let internal: CallInternal = CallInternal { context }; - aztec::contract_self::ContractSelfPublic::new(context, storage, call_self, call_self_static, internal) - }; + let mut self = __aztec_nr_internals__create_public_self::<$args_len_quote>(); }; let original_function_name = f.name(); diff --git a/noir-projects/aztec-nr/aztec/src/macros/internals_functions_generation/mod.nr b/noir-projects/aztec-nr/aztec/src/macros/internals_functions_generation/mod.nr index 58f0290c4e8e..030fc37c36ee 100644 --- a/noir-projects/aztec-nr/aztec/src/macros/internals_functions_generation/mod.nr +++ b/noir-projects/aztec-nr/aztec/src/macros/internals_functions_generation/mod.nr @@ -12,7 +12,9 @@ pub(crate) mod internal; use abi_export::create_fn_abi_export; use external::{ - private::generate_private_external, public::generate_public_external, utility::generate_utility_external, + private::generate_private_external, + public::{generate_public_external, generate_public_self_creator}, + utility::generate_utility_external, }; use internal::{generate_private_internal, generate_public_internal}; @@ -47,6 +49,15 @@ pub(crate) comptime fn process_functions(m: Module) -> Quoted { let transformed_utility_functions = utility_functions.map(|function| generate_utility_external(function)).join(quote {}); + // Emit a contract-level helper that constructs `self` for public functions. Each transformed public function calls + // this helper rather than inlining the preamble. The helper is only useful for public external functions, so we + // skip emitting it when the contract has none. + let public_self_creator = if public_functions.len() > 0 { + generate_public_self_creator(m) + } else { + quote {} + }; + // Now that we have generated quotes of the new functions based on the original function definitions, we replace // the original functions' bodies with `static_assert(false, ...)` to prevent them from being called directly from // within the contract. We also need to set the return type to `()` to avoid compilation errors. @@ -84,6 +95,7 @@ pub(crate) comptime fn process_functions(m: Module) -> Quoted { // We return the new functions' quotes to be injected into the contract. quote { + $public_self_creator $transformed_private_functions $transformed_public_functions $transformed_utility_functions diff --git a/noir-projects/contract-snapshots/tests/snapshots/compile_failure/authorize_once_from_wrong_type/snapshots__stderr.snap b/noir-projects/contract-snapshots/tests/snapshots/compile_failure/authorize_once_from_wrong_type/snapshots__stderr.snap index d41d90c9c38b..16b1da78250d 100644 --- a/noir-projects/contract-snapshots/tests/snapshots/compile_failure/authorize_once_from_wrong_type/snapshots__stderr.snap +++ b/noir-projects/contract-snapshots/tests/snapshots/compile_failure/authorize_once_from_wrong_type/snapshots__stderr.snap @@ -14,13 +14,13 @@ error: Argument from in function foo must be of type AztecAddress, but is of typ 2: aztec at /noir-projects/aztec-nr/aztec/src/macros/aztec.nr:97:21 3: process_functions - at /noir-projects/aztec-nr/aztec/src/macros/internals_functions_generation/mod.nr:46:9 + at /noir-projects/aztec-nr/aztec/src/macros/internals_functions_generation/mod.nr:48:9 4: [T]::map at std/vector.nr:67:33 5: process_functions - at /noir-projects/aztec-nr/aztec/src/macros/internals_functions_generation/mod.nr:46:41 + at /noir-projects/aztec-nr/aztec/src/macros/internals_functions_generation/mod.nr:48:41 6: generate_public_external - at /noir-projects/aztec-nr/aztec/src/macros/internals_functions_generation/external/public.nr:97:9 + at /noir-projects/aztec-nr/aztec/src/macros/internals_functions_generation/external/public.nr:114:9 7: create_authorize_once_check at /noir-projects/aztec-nr/aztec/src/macros/internals_functions_generation/external/helpers.nr:72:9 diff --git a/noir-projects/contract-snapshots/tests/snapshots/compile_failure/authorize_once_missing_from_param/snapshots__stderr.snap b/noir-projects/contract-snapshots/tests/snapshots/compile_failure/authorize_once_missing_from_param/snapshots__stderr.snap index 83939084f7a4..e91d74670519 100644 --- a/noir-projects/contract-snapshots/tests/snapshots/compile_failure/authorize_once_missing_from_param/snapshots__stderr.snap +++ b/noir-projects/contract-snapshots/tests/snapshots/compile_failure/authorize_once_missing_from_param/snapshots__stderr.snap @@ -14,13 +14,13 @@ error: Function foo does not have a from parameter. Please specify which one to 2: aztec at /noir-projects/aztec-nr/aztec/src/macros/aztec.nr:97:21 3: process_functions - at /noir-projects/aztec-nr/aztec/src/macros/internals_functions_generation/mod.nr:46:9 + at /noir-projects/aztec-nr/aztec/src/macros/internals_functions_generation/mod.nr:48:9 4: [T]::map at std/vector.nr:67:33 5: process_functions - at /noir-projects/aztec-nr/aztec/src/macros/internals_functions_generation/mod.nr:46:41 + at /noir-projects/aztec-nr/aztec/src/macros/internals_functions_generation/mod.nr:48:41 6: generate_public_external - at /noir-projects/aztec-nr/aztec/src/macros/internals_functions_generation/external/public.nr:97:9 + at /noir-projects/aztec-nr/aztec/src/macros/internals_functions_generation/external/public.nr:114:9 7: create_authorize_once_check at /noir-projects/aztec-nr/aztec/src/macros/internals_functions_generation/external/helpers.nr:67:9 diff --git a/noir-projects/contract-snapshots/tests/snapshots/compile_failure/authorize_once_missing_nonce_param/snapshots__stderr.snap b/noir-projects/contract-snapshots/tests/snapshots/compile_failure/authorize_once_missing_nonce_param/snapshots__stderr.snap index b0a19e34e8cc..550d3fd5e887 100644 --- a/noir-projects/contract-snapshots/tests/snapshots/compile_failure/authorize_once_missing_nonce_param/snapshots__stderr.snap +++ b/noir-projects/contract-snapshots/tests/snapshots/compile_failure/authorize_once_missing_nonce_param/snapshots__stderr.snap @@ -14,13 +14,13 @@ error: Function foo does not have a authwit_nonce. Please specify which one to u 2: aztec at /noir-projects/aztec-nr/aztec/src/macros/aztec.nr:97:21 3: process_functions - at /noir-projects/aztec-nr/aztec/src/macros/internals_functions_generation/mod.nr:46:9 + at /noir-projects/aztec-nr/aztec/src/macros/internals_functions_generation/mod.nr:48:9 4: [T]::map at std/vector.nr:67:33 5: process_functions - at /noir-projects/aztec-nr/aztec/src/macros/internals_functions_generation/mod.nr:46:41 + at /noir-projects/aztec-nr/aztec/src/macros/internals_functions_generation/mod.nr:48:41 6: generate_public_external - at /noir-projects/aztec-nr/aztec/src/macros/internals_functions_generation/external/public.nr:97:9 + at /noir-projects/aztec-nr/aztec/src/macros/internals_functions_generation/external/public.nr:114:9 7: create_authorize_once_check at /noir-projects/aztec-nr/aztec/src/macros/internals_functions_generation/external/helpers.nr:81:9 diff --git a/noir-projects/contract-snapshots/tests/snapshots/compile_failure/authorize_once_nonce_wrong_type/snapshots__stderr.snap b/noir-projects/contract-snapshots/tests/snapshots/compile_failure/authorize_once_nonce_wrong_type/snapshots__stderr.snap index d2e4063624a2..cc49e0eac228 100644 --- a/noir-projects/contract-snapshots/tests/snapshots/compile_failure/authorize_once_nonce_wrong_type/snapshots__stderr.snap +++ b/noir-projects/contract-snapshots/tests/snapshots/compile_failure/authorize_once_nonce_wrong_type/snapshots__stderr.snap @@ -14,13 +14,13 @@ error: Argument authwit_nonce in function foo must be of type Field, but is of t 2: aztec at /noir-projects/aztec-nr/aztec/src/macros/aztec.nr:97:21 3: process_functions - at /noir-projects/aztec-nr/aztec/src/macros/internals_functions_generation/mod.nr:46:9 + at /noir-projects/aztec-nr/aztec/src/macros/internals_functions_generation/mod.nr:48:9 4: [T]::map at std/vector.nr:67:33 5: process_functions - at /noir-projects/aztec-nr/aztec/src/macros/internals_functions_generation/mod.nr:46:41 + at /noir-projects/aztec-nr/aztec/src/macros/internals_functions_generation/mod.nr:48:41 6: generate_public_external - at /noir-projects/aztec-nr/aztec/src/macros/internals_functions_generation/external/public.nr:97:9 + at /noir-projects/aztec-nr/aztec/src/macros/internals_functions_generation/external/public.nr:114:9 7: create_authorize_once_check at /noir-projects/aztec-nr/aztec/src/macros/internals_functions_generation/external/helpers.nr:86:9 diff --git a/noir-projects/contract-snapshots/tests/snapshots/expand/amm_contract/snapshots__expanded.snap b/noir-projects/contract-snapshots/tests/snapshots/expand/amm_contract/snapshots__expanded.snap index c6bf49b4c73a..c8c61c578431 100644 --- a/noir-projects/contract-snapshots/tests/snapshots/expand/amm_contract/snapshots__expanded.snap +++ b/noir-projects/contract-snapshots/tests/snapshots/expand/amm_contract/snapshots__expanded.snap @@ -2437,19 +2437,22 @@ pub contract AMM { self.context.finish() } + #[contract_library_method] + unconstrained fn __aztec_nr_internals__create_public_self() -> aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> { + let context: aztec::context::PublicContext = aztec::context::PublicContext::new(|| -> Field { + let serialized_args: [Field; N] = aztec::oracle::avm::calldata_copy(1_u32, N); + aztec::hash::hash_args(serialized_args) + }); + let storage: Storage = Storage::::init(context); + let self_address: AztecAddress = context.this_address(); + let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; + let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; + let internal: CallInternal = CallInternal:: { context: context}; + aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) + } + unconstrained fn __aztec_nr_internals___add_liquidity(config: Config, refund_token0_partial_note: PartialUintNote, refund_token1_partial_note: PartialUintNote, liquidity_partial_note: PartialUintNote, amount0_max: u128, amount1_max: u128, amount0_min: u128, amount1_min: u128) { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: aztec::context::PublicContext = aztec::context::PublicContext::new(|| -> Field { - let serialized_args: [Field; 10] = aztec::oracle::avm::calldata_copy(1_u32, ((((((>::N + ::N) + ::N) + ::N) + ::N) + ::N) + ::N) + ::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<10>(); assert(self.msg_sender() == self.address, "Function _add_liquidity can only be called by the same contract"); { let token0: Token::Token = Token::at(config.token0); @@ -2481,18 +2484,7 @@ pub contract AMM { } unconstrained fn __aztec_nr_internals___remove_liquidity(config: Config, liquidity: u128, token0_partial_note: PartialUintNote, token1_partial_note: PartialUintNote, amount0_min: u128, amount1_min: u128) { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: aztec::context::PublicContext = aztec::context::PublicContext::new(|| -> Field { - let serialized_args: [Field; 8] = aztec::oracle::avm::calldata_copy(1_u32, ((((>::N + ::N) + ::N) + ::N) + ::N) + ::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<8>(); assert(self.msg_sender() == self.address, "Function _remove_liquidity can only be called by the same contract"); { let token0: Token::Token = Token::at(config.token0); @@ -2511,18 +2503,7 @@ pub contract AMM { } unconstrained fn __aztec_nr_internals___swap_exact_tokens_for_tokens(token_in: AztecAddress, token_out: AztecAddress, amount_in: u128, amount_out_min: u128, token_out_partial_note: PartialUintNote) { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: aztec::context::PublicContext = aztec::context::PublicContext::new(|| -> Field { - let serialized_args: [Field; 5] = aztec::oracle::avm::calldata_copy(1_u32, (((::N + ::N) + ::N) + ::N) + ::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<5>(); assert(self.msg_sender() == self.address, "Function _swap_exact_tokens_for_tokens can only be called by the same contract"); { let balance_in_plus_amount_in: u128 = self.view(Token::at(token_in).balance_of_public(self.address)); @@ -2535,18 +2516,7 @@ pub contract AMM { } unconstrained fn __aztec_nr_internals___swap_tokens_for_exact_tokens(token_in: AztecAddress, token_out: AztecAddress, amount_in_max: u128, amount_out: u128, change_token_in_partial_note: PartialUintNote, token_out_partial_note: PartialUintNote) { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: aztec::context::PublicContext = aztec::context::PublicContext::new(|| -> Field { - let serialized_args: [Field; 6] = aztec::oracle::avm::calldata_copy(1_u32, ((((::N + ::N) + ::N) + ::N) + ::N) + ::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<6>(); assert(self.msg_sender() == self.address, "Function _swap_tokens_for_exact_tokens can only be called by the same contract"); { let balance_in_plus_amount_in_max: u128 = self.view(Token::at(token_in).balance_of_public(self.address)); @@ -2563,18 +2533,7 @@ pub contract AMM { } unconstrained fn __aztec_nr_internals__constructor(token0: AztecAddress, token1: AztecAddress, liquidity_token: AztecAddress) { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: aztec::context::PublicContext = aztec::context::PublicContext::new(|| -> Field { - let serialized_args: [Field; 3] = aztec::oracle::avm::calldata_copy(1_u32, (::N + ::N) + ::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<3>(); aztec::macros::functions::initialization_utils::assert_initialization_matches_address_preimage_public(self.context); { self.storage.config.initialize(Config { token0: token0, token1: token1, liquidity_token: liquidity_token}); diff --git a/noir-projects/contract-snapshots/tests/snapshots/expand/avm_gadgets_test_contract/snapshots__expanded.snap b/noir-projects/contract-snapshots/tests/snapshots/expand/avm_gadgets_test_contract/snapshots__expanded.snap index d5cac0bf229d..485012d47992 100644 --- a/noir-projects/contract-snapshots/tests/snapshots/expand/avm_gadgets_test_contract/snapshots__expanded.snap +++ b/noir-projects/contract-snapshots/tests/snapshots/expand/avm_gadgets_test_contract/snapshots__expanded.snap @@ -1174,415 +1174,176 @@ contract AvmGadgetsTest { return_type: [u8; 32], } + #[contract_library_method] + unconstrained fn __aztec_nr_internals__create_public_self() -> aztec::contract_self::contract_self_public::ContractSelfPublic<(), CallSelf, CallSelfStatic, CallInternal> { + let context: aztec::context::PublicContext = aztec::context::PublicContext::new(|| -> Field { + let serialized_args: [Field; N] = aztec::oracle::avm::calldata_copy(1_u32, N); + aztec::hash::hash_args(serialized_args) + }); + let storage: () = (); + let self_address: aztec::protocol::address::AztecAddress = context.this_address(); + let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; + let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; + let internal: CallInternal = CallInternal:: { context: context}; + aztec::contract_self::contract_self_public::ContractSelfPublic::<(), CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) + } + unconstrained fn __aztec_nr_internals__keccak_f1600(data: [u64; 25]) -> pub [u64; 25] { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic<(), CallSelf, CallSelfStatic, CallInternal> = { - let context: aztec::context::PublicContext = aztec::context::PublicContext::new(|| -> Field { - let serialized_args: [Field; 25 * 1] = aztec::oracle::avm::calldata_copy(1_u32, <[u64; 25] as aztec::protocol::traits::Serialize>::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: () = (); - let self_address: aztec::protocol::address::AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::<(), CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic<(), CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<25 * 1>(); { std::hash::keccakf1600(data) } } unconstrained fn __aztec_nr_internals__keccak_hash(data: [u8; 10]) -> pub [u8; 32] { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic<(), CallSelf, CallSelfStatic, CallInternal> = { - let context: aztec::context::PublicContext = aztec::context::PublicContext::new(|| -> Field { - let serialized_args: [Field; 10 * 1] = aztec::oracle::avm::calldata_copy(1_u32, <[u8; 10] as aztec::protocol::traits::Serialize>::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: () = (); - let self_address: aztec::protocol::address::AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::<(), CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic<(), CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<10 * 1>(); { keccak256::keccak256(data, data.len()) } } unconstrained fn __aztec_nr_internals__keccak_hash_1400(data: [u8; 1400]) -> pub [u8; 32] { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic<(), CallSelf, CallSelfStatic, CallInternal> = { - let context: aztec::context::PublicContext = aztec::context::PublicContext::new(|| -> Field { - let serialized_args: [Field; 1400 * 1] = aztec::oracle::avm::calldata_copy(1_u32, <[u8; 1400] as aztec::protocol::traits::Serialize>::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: () = (); - let self_address: aztec::protocol::address::AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::<(), CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic<(), CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<1400 * 1>(); { keccak256::keccak256(data, data.len()) } } unconstrained fn __aztec_nr_internals__pedersen_hash(data: [Field; 10]) -> pub Field { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic<(), CallSelf, CallSelfStatic, CallInternal> = { - let context: aztec::context::PublicContext = aztec::context::PublicContext::new(|| -> Field { - let serialized_args: [Field; 10 * 1] = aztec::oracle::avm::calldata_copy(1_u32, <[Field; 10] as aztec::protocol::traits::Serialize>::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: () = (); - let self_address: aztec::protocol::address::AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::<(), CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic<(), CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<10 * 1>(); { std::hash::pedersen_hash(data) } } unconstrained fn __aztec_nr_internals__pedersen_hash_with_index(data: [Field; 10]) -> pub Field { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic<(), CallSelf, CallSelfStatic, CallInternal> = { - let context: aztec::context::PublicContext = aztec::context::PublicContext::new(|| -> Field { - let serialized_args: [Field; 10 * 1] = aztec::oracle::avm::calldata_copy(1_u32, <[Field; 10] as aztec::protocol::traits::Serialize>::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: () = (); - let self_address: aztec::protocol::address::AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::<(), CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic<(), CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<10 * 1>(); { std::hash::pedersen_hash_with_separator(data, 20_u32) } } unconstrained fn __aztec_nr_internals__poseidon2_hash(data: [Field; 10]) -> pub Field { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic<(), CallSelf, CallSelfStatic, CallInternal> = { - let context: aztec::context::PublicContext = aztec::context::PublicContext::new(|| -> Field { - let serialized_args: [Field; 10 * 1] = aztec::oracle::avm::calldata_copy(1_u32, <[Field; 10] as aztec::protocol::traits::Serialize>::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: () = (); - let self_address: aztec::protocol::address::AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::<(), CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic<(), CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<10 * 1>(); { poseidon::poseidon2::Poseidon2::hash(data, data.len()) } } unconstrained fn __aztec_nr_internals__poseidon2_hash_1000fields(data: [Field; 1000]) -> pub Field { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic<(), CallSelf, CallSelfStatic, CallInternal> = { - let context: aztec::context::PublicContext = aztec::context::PublicContext::new(|| -> Field { - let serialized_args: [Field; 1000 * 1] = aztec::oracle::avm::calldata_copy(1_u32, <[Field; 1000] as aztec::protocol::traits::Serialize>::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: () = (); - let self_address: aztec::protocol::address::AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::<(), CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic<(), CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<1000 * 1>(); { poseidon::poseidon2::Poseidon2::hash(data, data.len()) } } unconstrained fn __aztec_nr_internals__sha256_hash_10(data: [u8; 10]) -> pub [u8; 32] { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic<(), CallSelf, CallSelfStatic, CallInternal> = { - let context: aztec::context::PublicContext = aztec::context::PublicContext::new(|| -> Field { - let serialized_args: [Field; 10 * 1] = aztec::oracle::avm::calldata_copy(1_u32, <[u8; 10] as aztec::protocol::traits::Serialize>::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: () = (); - let self_address: aztec::protocol::address::AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::<(), CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic<(), CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<10 * 1>(); { sha256::sha256_var(data, data.len()) } } unconstrained fn __aztec_nr_internals__sha256_hash_100(data: [u8; 100]) -> pub [u8; 32] { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic<(), CallSelf, CallSelfStatic, CallInternal> = { - let context: aztec::context::PublicContext = aztec::context::PublicContext::new(|| -> Field { - let serialized_args: [Field; 100 * 1] = aztec::oracle::avm::calldata_copy(1_u32, <[u8; 100] as aztec::protocol::traits::Serialize>::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: () = (); - let self_address: aztec::protocol::address::AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::<(), CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic<(), CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<100 * 1>(); { sha256::sha256_var(data, data.len()) } } unconstrained fn __aztec_nr_internals__sha256_hash_1024(data: [u8; 1024]) -> pub [u8; 32] { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic<(), CallSelf, CallSelfStatic, CallInternal> = { - let context: aztec::context::PublicContext = aztec::context::PublicContext::new(|| -> Field { - let serialized_args: [Field; 1024 * 1] = aztec::oracle::avm::calldata_copy(1_u32, <[u8; 1024] as aztec::protocol::traits::Serialize>::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: () = (); - let self_address: aztec::protocol::address::AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::<(), CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic<(), CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<1024 * 1>(); { sha256::sha256_var(data, data.len()) } } unconstrained fn __aztec_nr_internals__sha256_hash_1536(data: [u8; 1536]) -> pub [u8; 32] { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic<(), CallSelf, CallSelfStatic, CallInternal> = { - let context: aztec::context::PublicContext = aztec::context::PublicContext::new(|| -> Field { - let serialized_args: [Field; 1536 * 1] = aztec::oracle::avm::calldata_copy(1_u32, <[u8; 1536] as aztec::protocol::traits::Serialize>::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: () = (); - let self_address: aztec::protocol::address::AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::<(), CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic<(), CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<1536 * 1>(); { sha256::sha256_var(data, data.len()) } } unconstrained fn __aztec_nr_internals__sha256_hash_20(data: [u8; 20]) -> pub [u8; 32] { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic<(), CallSelf, CallSelfStatic, CallInternal> = { - let context: aztec::context::PublicContext = aztec::context::PublicContext::new(|| -> Field { - let serialized_args: [Field; 20 * 1] = aztec::oracle::avm::calldata_copy(1_u32, <[u8; 20] as aztec::protocol::traits::Serialize>::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: () = (); - let self_address: aztec::protocol::address::AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::<(), CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic<(), CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<20 * 1>(); { sha256::sha256_var(data, data.len()) } } unconstrained fn __aztec_nr_internals__sha256_hash_255(data: [u8; 255]) -> pub [u8; 32] { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic<(), CallSelf, CallSelfStatic, CallInternal> = { - let context: aztec::context::PublicContext = aztec::context::PublicContext::new(|| -> Field { - let serialized_args: [Field; 255 * 1] = aztec::oracle::avm::calldata_copy(1_u32, <[u8; 255] as aztec::protocol::traits::Serialize>::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: () = (); - let self_address: aztec::protocol::address::AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::<(), CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic<(), CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<255 * 1>(); { sha256::sha256_var(data, data.len()) } } unconstrained fn __aztec_nr_internals__sha256_hash_256(data: [u8; 256]) -> pub [u8; 32] { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic<(), CallSelf, CallSelfStatic, CallInternal> = { - let context: aztec::context::PublicContext = aztec::context::PublicContext::new(|| -> Field { - let serialized_args: [Field; 256 * 1] = aztec::oracle::avm::calldata_copy(1_u32, <[u8; 256] as aztec::protocol::traits::Serialize>::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: () = (); - let self_address: aztec::protocol::address::AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::<(), CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic<(), CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<256 * 1>(); { sha256::sha256_var(data, data.len()) } } unconstrained fn __aztec_nr_internals__sha256_hash_30(data: [u8; 30]) -> pub [u8; 32] { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic<(), CallSelf, CallSelfStatic, CallInternal> = { - let context: aztec::context::PublicContext = aztec::context::PublicContext::new(|| -> Field { - let serialized_args: [Field; 30 * 1] = aztec::oracle::avm::calldata_copy(1_u32, <[u8; 30] as aztec::protocol::traits::Serialize>::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: () = (); - let self_address: aztec::protocol::address::AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::<(), CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic<(), CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<30 * 1>(); { sha256::sha256_var(data, data.len()) } } unconstrained fn __aztec_nr_internals__sha256_hash_40(data: [u8; 40]) -> pub [u8; 32] { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic<(), CallSelf, CallSelfStatic, CallInternal> = { - let context: aztec::context::PublicContext = aztec::context::PublicContext::new(|| -> Field { - let serialized_args: [Field; 40 * 1] = aztec::oracle::avm::calldata_copy(1_u32, <[u8; 40] as aztec::protocol::traits::Serialize>::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: () = (); - let self_address: aztec::protocol::address::AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::<(), CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic<(), CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<40 * 1>(); { sha256::sha256_var(data, data.len()) } } unconstrained fn __aztec_nr_internals__sha256_hash_50(data: [u8; 50]) -> pub [u8; 32] { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic<(), CallSelf, CallSelfStatic, CallInternal> = { - let context: aztec::context::PublicContext = aztec::context::PublicContext::new(|| -> Field { - let serialized_args: [Field; 50 * 1] = aztec::oracle::avm::calldata_copy(1_u32, <[u8; 50] as aztec::protocol::traits::Serialize>::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: () = (); - let self_address: aztec::protocol::address::AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::<(), CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic<(), CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<50 * 1>(); { sha256::sha256_var(data, data.len()) } } unconstrained fn __aztec_nr_internals__sha256_hash_511(data: [u8; 511]) -> pub [u8; 32] { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic<(), CallSelf, CallSelfStatic, CallInternal> = { - let context: aztec::context::PublicContext = aztec::context::PublicContext::new(|| -> Field { - let serialized_args: [Field; 511 * 1] = aztec::oracle::avm::calldata_copy(1_u32, <[u8; 511] as aztec::protocol::traits::Serialize>::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: () = (); - let self_address: aztec::protocol::address::AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::<(), CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic<(), CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<511 * 1>(); { sha256::sha256_var(data, data.len()) } } unconstrained fn __aztec_nr_internals__sha256_hash_512(data: [u8; 512]) -> pub [u8; 32] { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic<(), CallSelf, CallSelfStatic, CallInternal> = { - let context: aztec::context::PublicContext = aztec::context::PublicContext::new(|| -> Field { - let serialized_args: [Field; 512 * 1] = aztec::oracle::avm::calldata_copy(1_u32, <[u8; 512] as aztec::protocol::traits::Serialize>::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: () = (); - let self_address: aztec::protocol::address::AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::<(), CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic<(), CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<512 * 1>(); { sha256::sha256_var(data, data.len()) } } unconstrained fn __aztec_nr_internals__sha256_hash_60(data: [u8; 60]) -> pub [u8; 32] { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic<(), CallSelf, CallSelfStatic, CallInternal> = { - let context: aztec::context::PublicContext = aztec::context::PublicContext::new(|| -> Field { - let serialized_args: [Field; 60 * 1] = aztec::oracle::avm::calldata_copy(1_u32, <[u8; 60] as aztec::protocol::traits::Serialize>::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: () = (); - let self_address: aztec::protocol::address::AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::<(), CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic<(), CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<60 * 1>(); { sha256::sha256_var(data, data.len()) } } unconstrained fn __aztec_nr_internals__sha256_hash_70(data: [u8; 70]) -> pub [u8; 32] { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic<(), CallSelf, CallSelfStatic, CallInternal> = { - let context: aztec::context::PublicContext = aztec::context::PublicContext::new(|| -> Field { - let serialized_args: [Field; 70 * 1] = aztec::oracle::avm::calldata_copy(1_u32, <[u8; 70] as aztec::protocol::traits::Serialize>::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: () = (); - let self_address: aztec::protocol::address::AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::<(), CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic<(), CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<70 * 1>(); { sha256::sha256_var(data, data.len()) } } unconstrained fn __aztec_nr_internals__sha256_hash_80(data: [u8; 80]) -> pub [u8; 32] { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic<(), CallSelf, CallSelfStatic, CallInternal> = { - let context: aztec::context::PublicContext = aztec::context::PublicContext::new(|| -> Field { - let serialized_args: [Field; 80 * 1] = aztec::oracle::avm::calldata_copy(1_u32, <[u8; 80] as aztec::protocol::traits::Serialize>::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: () = (); - let self_address: aztec::protocol::address::AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::<(), CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic<(), CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<80 * 1>(); { sha256::sha256_var(data, data.len()) } } unconstrained fn __aztec_nr_internals__sha256_hash_90(data: [u8; 90]) -> pub [u8; 32] { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic<(), CallSelf, CallSelfStatic, CallInternal> = { - let context: aztec::context::PublicContext = aztec::context::PublicContext::new(|| -> Field { - let serialized_args: [Field; 90 * 1] = aztec::oracle::avm::calldata_copy(1_u32, <[u8; 90] as aztec::protocol::traits::Serialize>::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: () = (); - let self_address: aztec::protocol::address::AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::<(), CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic<(), CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<90 * 1>(); { sha256::sha256_var(data, data.len()) } diff --git a/noir-projects/contract-snapshots/tests/snapshots/expand/avm_test_contract/snapshots__expanded.snap b/noir-projects/contract-snapshots/tests/snapshots/expand/avm_test_contract/snapshots__expanded.snap index 41d81107f04e..6522da57d5bb 100644 --- a/noir-projects/contract-snapshots/tests/snapshots/expand/avm_test_contract/snapshots__expanded.snap +++ b/noir-projects/contract-snapshots/tests/snapshots/expand/avm_test_contract/snapshots__expanded.snap @@ -5999,73 +5999,43 @@ pub contract AvmTest { self.context.finish() } + #[contract_library_method] + unconstrained fn __aztec_nr_internals__create_public_self() -> aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> { + let context: PublicContext = PublicContext::new(|| -> Field { + let serialized_args: [Field; N] = aztec::oracle::avm::calldata_copy(1_u32, N); + aztec::hash::hash_args(serialized_args) + }); + let storage: Storage = Storage::::init(context); + let self_address: AztecAddress = context.this_address(); + let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; + let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; + let internal: CallInternal = CallInternal:: { context: context}; + aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) + } + unconstrained fn __aztec_nr_internals__add_args_return(arg_a: Field, arg_b: Field) -> pub Field { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: PublicContext = PublicContext::new(|| -> Field { - let serialized_args: [Field; 2] = aztec::oracle::avm::calldata_copy(1_u32, ::N + ::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<2>(); { add(arg_a, arg_b) } } unconstrained fn __aztec_nr_internals__add_storage_map(to: AztecAddress, amount: u32) -> pub Field { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: PublicContext = PublicContext::new(|| -> Field { - let serialized_args: [Field; 2] = aztec::oracle::avm::calldata_copy(1_u32, ::N + ::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<2>(); { _add_storage_map(self.storage, to, amount) } } unconstrained fn __aztec_nr_internals__add_u128(a: u128, b: u128) -> pub u128 { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: PublicContext = PublicContext::new(|| -> Field { - let serialized_args: [Field; 2] = aztec::oracle::avm::calldata_copy(1_u32, ::N + ::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<2>(); { a + b } } unconstrained fn __aztec_nr_internals__assert_calldata_copy(args: [Field; 3], with_selector: bool) { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: PublicContext = PublicContext::new(|| -> Field { - let serialized_args: [Field; 4] = aztec::oracle::avm::calldata_copy(1_u32, <[Field; 3] as Serialize>::N + ::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<4>(); { let offset: u32 = with_selector as u32; let cd: [Field; 3] = aztec::oracle::avm::calldata_copy(offset, 3_u32); @@ -6074,18 +6044,7 @@ pub contract AvmTest { } unconstrained fn __aztec_nr_internals__assert_calldata_copy_large(args: [Field; 300], with_selector: bool) { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: PublicContext = PublicContext::new(|| -> Field { - let serialized_args: [Field; 301] = aztec::oracle::avm::calldata_copy(1_u32, <[Field; 300] as Serialize>::N + ::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<301>(); { let offset: u32 = with_selector as u32; let cd: [Field; 300] = aztec::oracle::avm::calldata_copy(offset, 300_u32); @@ -6094,36 +6053,14 @@ pub contract AvmTest { } unconstrained fn __aztec_nr_internals__assert_nullifier_exists(nullifier: Field) { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: PublicContext = PublicContext::new(|| -> Field { - let serialized_args: [Field; 1] = aztec::oracle::avm::calldata_copy(1_u32, ::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<1>(); { assert(self.context.nullifier_exists_unsafe(nullifier, self.address), "Nullifier doesn't exist!"); } } unconstrained fn __aztec_nr_internals__assert_same(arg_a: Field, arg_b: Field) -> pub Field { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: PublicContext = PublicContext::new(|| -> Field { - let serialized_args: [Field; 2] = aztec::oracle::avm::calldata_copy(1_u32, ::N + ::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<2>(); { assert(arg_a == arg_b, "Values are not equal"); 1_Field @@ -6131,36 +6068,14 @@ pub contract AvmTest { } unconstrained fn __aztec_nr_internals__assertion_failure() { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: PublicContext = PublicContext::new(|| -> Field { - let serialized_args: [Field; 0] = aztec::oracle::avm::calldata_copy(1_u32, 0_u32); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<0>(); { helper_with_failed_assertion() } } unconstrained fn __aztec_nr_internals__bulk_testing(args_field: [Field; 10], args_u8: [u8; 10], get_instance_for_address: AztecAddress, expected_deployer: AztecAddress, expected_class_id: ContractClassId, expected_initialization_hash: Field, skip_strictly_limited_side_effects: bool) { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: PublicContext = PublicContext::new(|| -> Field { - let serialized_args: [Field; 25] = aztec::oracle::avm::calldata_copy(1_u32, (((((<[Field; 10] as Serialize>::N + <[u8; 10] as Serialize>::N) + ::N) + ::N) + ::N) + ::N) + ::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<25>(); { aztec::oracle::logging::debug_log("biwise_ops"); let num: u32 = self.context.block_number(); @@ -6249,72 +6164,28 @@ pub contract AvmTest { } unconstrained fn __aztec_nr_internals__call_auth_registry() { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: PublicContext = PublicContext::new(|| -> Field { - let serialized_args: [Field; 0] = aztec::oracle::avm::calldata_copy(1_u32, 0_u32); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<0>(); { let _: bool = AuthRegistry::at(CANONICAL_AUTH_REGISTRY_ADDRESS).is_reject_all(self.address).view(self.context); } } unconstrained fn __aztec_nr_internals__call_fee_juice() { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: PublicContext = PublicContext::new(|| -> Field { - let serialized_args: [Field; 0] = aztec::oracle::avm::calldata_copy(1_u32, 0_u32); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<0>(); { _call_fee_juice(self.context, self.address); } } unconstrained fn __aztec_nr_internals__call_instance_registry() { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: PublicContext = PublicContext::new(|| -> Field { - let serialized_args: [Field; 0] = aztec::oracle::avm::calldata_copy(1_u32, 0_u32); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<0>(); { let _: u64 = self.view(ContractInstanceRegistry::at(CONTRACT_INSTANCE_REGISTRY_CONTRACT_ADDRESS).get_update_delay()); } } unconstrained fn __aztec_nr_internals__conditional_move(x: [Field; 1], y: [Field; 1], b: bool) -> pub [Field; 1] { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: PublicContext = PublicContext::new(|| -> Field { - let serialized_args: [Field; 3] = aztec::oracle::avm::calldata_copy(1_u32, (<[Field; 1] as Serialize>::N + <[Field; 1] as Serialize>::N) + ::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<3>(); { if b { x @@ -6325,18 +6196,7 @@ pub contract AvmTest { } unconstrained fn __aztec_nr_internals__create_different_nullifier_in_nested_call(nestedAddress: AztecAddress, nullifier: Field) { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: PublicContext = PublicContext::new(|| -> Field { - let serialized_args: [Field; 2] = aztec::oracle::avm::calldata_copy(1_u32, ::N + ::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<2>(); { self.context.push_nullifier(nullifier); self.call(AvmTest::at(nestedAddress).new_nullifier(nullifier + 1_Field)); @@ -6344,18 +6204,7 @@ pub contract AvmTest { } unconstrained fn __aztec_nr_internals__create_same_nullifier_in_nested_call(nestedAddress: AztecAddress, nullifier: Field) { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: PublicContext = PublicContext::new(|| -> Field { - let serialized_args: [Field; 2] = aztec::oracle::avm::calldata_copy(1_u32, ::N + ::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<2>(); { self.context.push_nullifier(nullifier); self.call(AvmTest::at(nestedAddress).new_nullifier(nullifier)); @@ -6363,18 +6212,7 @@ pub contract AvmTest { } unconstrained fn __aztec_nr_internals__debug_logging() { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: PublicContext = PublicContext::new(|| -> Field { - let serialized_args: [Field; 0] = aztec::oracle::avm::calldata_copy(1_u32, 0_u32); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<0>(); { aztec::oracle::logging::debug_log("just text"); aztec::oracle::logging::debug_log_format("second: {1}", [1_Field, 2_Field, 3_Field, 4_Field]); @@ -6386,54 +6224,21 @@ pub contract AvmTest { } unconstrained fn __aztec_nr_internals__divide_by_zero(denominator: u8) -> pub u8 { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: PublicContext = PublicContext::new(|| -> Field { - let serialized_args: [Field; 1] = aztec::oracle::avm::calldata_copy(1_u32, ::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<1>(); { 1_u8 / denominator } } unconstrained fn __aztec_nr_internals__elliptic_curve_add(lhs: Point, rhs: Point) -> pub Point { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: PublicContext = PublicContext::new(|| -> Field { - let serialized_args: [Field; 6] = aztec::oracle::avm::calldata_copy(1_u32, ::N + ::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<6>(); { lhs + rhs } } unconstrained fn __aztec_nr_internals__elliptic_curve_add_and_double() -> pub Point { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: PublicContext = PublicContext::new(|| -> Field { - let serialized_args: [Field; 0] = aztec::oracle::avm::calldata_copy(1_u32, 0_u32); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<0>(); { let g: Point = Point { x: GRUMPKIN_ONE_X, y: GRUMPKIN_ONE_Y, is_infinite: false}; let doubled: Point = g + g; @@ -6443,18 +6248,7 @@ pub contract AvmTest { } unconstrained fn __aztec_nr_internals__emit_nullifier_and_check(nullifier: Field) { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: PublicContext = PublicContext::new(|| -> Field { - let serialized_args: [Field; 1] = aztec::oracle::avm::calldata_copy(1_u32, ::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<1>(); { self.context.push_nullifier(nullifier); let exists: bool = self.context.nullifier_exists_unsafe(nullifier, self.address); @@ -6463,72 +6257,28 @@ pub contract AvmTest { } unconstrained fn __aztec_nr_internals__emit_public_log() { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: PublicContext = PublicContext::new(|| -> Field { - let serialized_args: [Field; 0] = aztec::oracle::avm::calldata_copy(1_u32, 0_u32); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<0>(); { _emit_public_log(self.context); } } unconstrained fn __aztec_nr_internals__external_call_to_assertion_failure() { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: PublicContext = PublicContext::new(|| -> Field { - let serialized_args: [Field; 0] = aztec::oracle::avm::calldata_copy(1_u32, 0_u32); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<0>(); { self.call_self.assertion_failure(); } } unconstrained fn __aztec_nr_internals__external_call_to_divide_by_zero() { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: PublicContext = PublicContext::new(|| -> Field { - let serialized_args: [Field; 0] = aztec::oracle::avm::calldata_copy(1_u32, 0_u32); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<0>(); { let _: u8 = self.call_self.divide_by_zero(0_u8); } } unconstrained fn __aztec_nr_internals__external_call_to_divide_by_zero_recovers() { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: PublicContext = PublicContext::new(|| -> Field { - let serialized_args: [Field; 0] = aztec::oracle::avm::calldata_copy(1_u32, 0_u32); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<0>(); { let l2_gas_left: u32 = self.context.l2_gas_left(); let da_gas_left: u32 = self.context.da_gas_left(); @@ -6541,288 +6291,112 @@ pub contract AvmTest { } unconstrained fn __aztec_nr_internals__fn_w_large_calldata(_arr: [Field; 300]) -> pub Field { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: PublicContext = PublicContext::new(|| -> Field { - let serialized_args: [Field; 300 * 1] = aztec::oracle::avm::calldata_copy(1_u32, <[Field; 300] as Serialize>::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<300 * 1>(); { 5_Field } } unconstrained fn __aztec_nr_internals__get_address() -> pub AztecAddress { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: PublicContext = PublicContext::new(|| -> Field { - let serialized_args: [Field; 0] = aztec::oracle::avm::calldata_copy(1_u32, 0_u32); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<0>(); { _get_address(self.address) } } unconstrained fn __aztec_nr_internals__get_args_hash(_a: u8, _fields: [Field; 3]) -> pub Field { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: PublicContext = PublicContext::new(|| -> Field { - let serialized_args: [Field; 4] = aztec::oracle::avm::calldata_copy(1_u32, ::N + <[Field; 3] as Serialize>::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<4>(); { self.context.get_args_hash() } } unconstrained fn __aztec_nr_internals__get_block_number() -> pub u32 { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: PublicContext = PublicContext::new(|| -> Field { - let serialized_args: [Field; 0] = aztec::oracle::avm::calldata_copy(1_u32, 0_u32); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<0>(); { _get_block_number(self.context) } } unconstrained fn __aztec_nr_internals__get_chain_id() -> pub Field { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: PublicContext = PublicContext::new(|| -> Field { - let serialized_args: [Field; 0] = aztec::oracle::avm::calldata_copy(1_u32, 0_u32); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<0>(); { _get_chain_id(self.context) } } unconstrained fn __aztec_nr_internals__get_da_gas_left() -> pub u32 { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: PublicContext = PublicContext::new(|| -> Field { - let serialized_args: [Field; 0] = aztec::oracle::avm::calldata_copy(1_u32, 0_u32); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<0>(); { _get_da_gas_left(self.context) } } unconstrained fn __aztec_nr_internals__get_fee_per_da_gas() -> pub u128 { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: PublicContext = PublicContext::new(|| -> Field { - let serialized_args: [Field; 0] = aztec::oracle::avm::calldata_copy(1_u32, 0_u32); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<0>(); { _get_fee_per_da_gas(self.context) } } unconstrained fn __aztec_nr_internals__get_fee_per_l2_gas() -> pub u128 { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: PublicContext = PublicContext::new(|| -> Field { - let serialized_args: [Field; 0] = aztec::oracle::avm::calldata_copy(1_u32, 0_u32); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<0>(); { _get_fee_per_l2_gas(self.context) } } unconstrained fn __aztec_nr_internals__get_l2_gas_left() -> pub u32 { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: PublicContext = PublicContext::new(|| -> Field { - let serialized_args: [Field; 0] = aztec::oracle::avm::calldata_copy(1_u32, 0_u32); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<0>(); { _get_l2_gas_left(self.context) } } unconstrained fn __aztec_nr_internals__get_sender() -> pub AztecAddress { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: PublicContext = PublicContext::new(|| -> Field { - let serialized_args: [Field; 0] = aztec::oracle::avm::calldata_copy(1_u32, 0_u32); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<0>(); { _get_sender(self.context) } } unconstrained fn __aztec_nr_internals__get_timestamp() -> pub u64 { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: PublicContext = PublicContext::new(|| -> Field { - let serialized_args: [Field; 0] = aztec::oracle::avm::calldata_copy(1_u32, 0_u32); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<0>(); { _get_timestamp(self.context) } } unconstrained fn __aztec_nr_internals__get_transaction_fee() -> pub Field { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: PublicContext = PublicContext::new(|| -> Field { - let serialized_args: [Field; 0] = aztec::oracle::avm::calldata_copy(1_u32, 0_u32); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<0>(); { _get_transaction_fee(self.context) } } unconstrained fn __aztec_nr_internals__get_version() -> pub Field { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: PublicContext = PublicContext::new(|| -> Field { - let serialized_args: [Field; 0] = aztec::oracle::avm::calldata_copy(1_u32, 0_u32); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<0>(); { _get_version(self.context) } } unconstrained fn __aztec_nr_internals__l1_to_l2_msg_exists(msg_hash: Field, msg_leaf_index: Field) -> pub bool { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: PublicContext = PublicContext::new(|| -> Field { - let serialized_args: [Field; 2] = aztec::oracle::avm::calldata_copy(1_u32, ::N + ::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<2>(); { _l1_to_l2_msg_exists(self.context, msg_hash, msg_leaf_index) } } unconstrained fn __aztec_nr_internals__modulo2(a: u64) -> pub u64 { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: PublicContext = PublicContext::new(|| -> Field { - let serialized_args: [Field; 1] = aztec::oracle::avm::calldata_copy(1_u32, ::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<1>(); { a % 2_u64 } } unconstrained fn __aztec_nr_internals__n_new_l2_to_l1_msgs(num: u32) { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: PublicContext = PublicContext::new(|| -> Field { - let serialized_args: [Field; 1] = aztec::oracle::avm::calldata_copy(1_u32, ::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<1>(); { for i in 0_u32..num { self.context.message_portal(EthAddress::from_field(i as Field), i as Field) @@ -6831,18 +6405,7 @@ pub contract AvmTest { } unconstrained fn __aztec_nr_internals__n_new_note_hashes(num: u32) { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: PublicContext = PublicContext::new(|| -> Field { - let serialized_args: [Field; 1] = aztec::oracle::avm::calldata_copy(1_u32, ::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<1>(); { for i in 0_u32..num { self.context.push_note_hash(i as Field); @@ -6851,18 +6414,7 @@ pub contract AvmTest { } unconstrained fn __aztec_nr_internals__n_new_nullifiers(num: u32) { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: PublicContext = PublicContext::new(|| -> Field { - let serialized_args: [Field; 1] = aztec::oracle::avm::calldata_copy(1_u32, ::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<1>(); { for i in 0_u32..num { self.context.push_nullifier(i as Field); @@ -6871,18 +6423,7 @@ pub contract AvmTest { } unconstrained fn __aztec_nr_internals__n_new_public_logs(num: u32) { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: PublicContext = PublicContext::new(|| -> Field { - let serialized_args: [Field; 1] = aztec::oracle::avm::calldata_copy(1_u32, ::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<1>(); { for i in 0_u32..num { self.context.emit_public_log_unsafe(0_Field, [i as Field]); @@ -6891,18 +6432,7 @@ pub contract AvmTest { } unconstrained fn __aztec_nr_internals__n_storage_writes(num: u32) { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: PublicContext = PublicContext::new(|| -> Field { - let serialized_args: [Field; 1] = aztec::oracle::avm::calldata_copy(1_u32, ::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<1>(); { for i in 0_u32..num { self.storage.map.at(AztecAddress::from_field(i as Field)).write(i); @@ -6911,54 +6441,21 @@ pub contract AvmTest { } unconstrained fn __aztec_nr_internals__nested_call_large_calldata(arr: [Field; 300]) -> pub Field { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: PublicContext = PublicContext::new(|| -> Field { - let serialized_args: [Field; 300 * 1] = aztec::oracle::avm::calldata_copy(1_u32, <[Field; 300] as Serialize>::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<300 * 1>(); { self.call_self.fn_w_large_calldata(arr) } } unconstrained fn __aztec_nr_internals__nested_call_to_add(arg_a: Field, arg_b: Field) -> pub Field { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: PublicContext = PublicContext::new(|| -> Field { - let serialized_args: [Field; 2] = aztec::oracle::avm::calldata_copy(1_u32, ::N + ::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<2>(); { _nested_call_to_add(self.context, self.address, arg_a, arg_b) } } unconstrained fn __aztec_nr_internals__nested_call_to_add_n_times_different_addresses(addrs: [AztecAddress; 23]) { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: PublicContext = PublicContext::new(|| -> Field { - let serialized_args: [Field; 23 * 1] = aztec::oracle::avm::calldata_copy(1_u32, <[AztecAddress; 23] as Serialize>::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<23 * 1>(); { for i in 0_u32..MAX_PUBLIC_CALLS_TO_UNIQUE_CONTRACT_CLASS_IDS + 2_u32 { let addr: AztecAddress = addrs[i]; @@ -6970,54 +6467,21 @@ pub contract AvmTest { } unconstrained fn __aztec_nr_internals__nested_call_to_add_with_gas(arg_a: Field, arg_b: Field, l2_gas: u32, da_gas: u32) -> pub Field { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: PublicContext = PublicContext::new(|| -> Field { - let serialized_args: [Field; 4] = aztec::oracle::avm::calldata_copy(1_u32, ((::N + ::N) + ::N) + ::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<4>(); { self.call(AvmTest::at(self.address).add_args_return(arg_a, arg_b).with_gas(GasOpts::new(l2_gas, da_gas))) } } unconstrained fn __aztec_nr_internals__nested_call_to_assert_same(arg_a: Field, arg_b: Field) -> pub Field { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: PublicContext = PublicContext::new(|| -> Field { - let serialized_args: [Field; 2] = aztec::oracle::avm::calldata_copy(1_u32, ::N + ::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<2>(); { self.call_self.assert_same(arg_a, arg_b) } } unconstrained fn __aztec_nr_internals__nested_call_to_nothing() { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: PublicContext = PublicContext::new(|| -> Field { - let serialized_args: [Field; 0] = aztec::oracle::avm::calldata_copy(1_u32, 0_u32); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<0>(); { let garbageAddress: AztecAddress = AztecAddress::from_field(42_Field); self.call(AvmTest::at(garbageAddress).nested_call_to_nothing()) @@ -7025,18 +6489,7 @@ pub contract AvmTest { } unconstrained fn __aztec_nr_internals__nested_call_to_nothing_recovers() { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: PublicContext = PublicContext::new(|| -> Field { - let serialized_args: [Field; 0] = aztec::oracle::avm::calldata_copy(1_u32, 0_u32); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<0>(); { let garbageAddress: AztecAddress = AztecAddress::from_field(42_Field); call(1_u32, 1_u32, garbageAddress, []); @@ -7046,36 +6499,14 @@ pub contract AvmTest { } unconstrained fn __aztec_nr_internals__nested_static_call_to_add(arg_a: Field, arg_b: Field) -> pub Field { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: PublicContext = PublicContext::new(|| -> Field { - let serialized_args: [Field; 2] = aztec::oracle::avm::calldata_copy(1_u32, ::N + ::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<2>(); { _nested_static_call_to_add(self.context, self.address, arg_a, arg_b) } } unconstrained fn __aztec_nr_internals__nested_static_call_to_set_storage() { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: PublicContext = PublicContext::new(|| -> Field { - let serialized_args: [Field; 0] = aztec::oracle::avm::calldata_copy(1_u32, 0_u32); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<0>(); { let selector: FunctionSelector = FunctionSelector { inner: 2230419055_u32}; let args: [Field; 1] = [20_Field as Field]; @@ -7084,72 +6515,28 @@ pub contract AvmTest { } unconstrained fn __aztec_nr_internals__new_note_hash(note_hash: Field) { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: PublicContext = PublicContext::new(|| -> Field { - let serialized_args: [Field; 1] = aztec::oracle::avm::calldata_copy(1_u32, ::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<1>(); { _new_note_hash(self.context, note_hash); } } unconstrained fn __aztec_nr_internals__new_nullifier(nullifier: Field) { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: PublicContext = PublicContext::new(|| -> Field { - let serialized_args: [Field; 1] = aztec::oracle::avm::calldata_copy(1_u32, ::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<1>(); { _new_nullifier(self.context, nullifier); } } unconstrained fn __aztec_nr_internals__note_hash_exists(note_hash: Field, leaf_index: u64) -> pub bool { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: PublicContext = PublicContext::new(|| -> Field { - let serialized_args: [Field; 2] = aztec::oracle::avm::calldata_copy(1_u32, ::N + ::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<2>(); { _note_hash_exists(self.context, note_hash, leaf_index) } } unconstrained fn __aztec_nr_internals__nullifier_collision(nullifier: Field) { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: PublicContext = PublicContext::new(|| -> Field { - let serialized_args: [Field; 1] = aztec::oracle::avm::calldata_copy(1_u32, ::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<1>(); { self.context.push_nullifier(nullifier); self.context.push_nullifier(nullifier); @@ -7157,36 +6544,14 @@ pub contract AvmTest { } unconstrained fn __aztec_nr_internals__nullifier_exists(nullifier: Field) -> pub bool { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: PublicContext = PublicContext::new(|| -> Field { - let serialized_args: [Field; 1] = aztec::oracle::avm::calldata_copy(1_u32, ::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<1>(); { _nullifier_exists(self.context, self.address, nullifier) } } unconstrained fn __aztec_nr_internals__pedersen_commit(x: Field, y: Field) -> pub Point { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: PublicContext = PublicContext::new(|| -> Field { - let serialized_args: [Field; 2] = aztec::oracle::avm::calldata_copy(1_u32, ::N + ::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<2>(); { let commitment: std::embedded_curve_ops::EmbeddedCurvePoint = std::hash::pedersen_commitment_with_separator([x, y], 20_u32); commitment.into() @@ -7194,108 +6559,42 @@ pub contract AvmTest { } unconstrained fn __aztec_nr_internals__raw_l2_to_l1_msg(recipient: EthAddress, content: Field) { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: PublicContext = PublicContext::new(|| -> Field { - let serialized_args: [Field; 2] = aztec::oracle::avm::calldata_copy(1_u32, ::N + ::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<2>(); { self.context.message_portal(recipient, content) } } unconstrained fn __aztec_nr_internals__read_assert_storage_single(a: Field) { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: PublicContext = PublicContext::new(|| -> Field { - let serialized_args: [Field; 1] = aztec::oracle::avm::calldata_copy(1_u32, ::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<1>(); { assert(a == self.storage.single.read(), "Storage value does not match input"); } } unconstrained fn __aztec_nr_internals__read_storage_list() -> pub [Field; 2] { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: PublicContext = PublicContext::new(|| -> Field { - let serialized_args: [Field; 0] = aztec::oracle::avm::calldata_copy(1_u32, 0_u32); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<0>(); { _read_storage_list(self.storage) } } unconstrained fn __aztec_nr_internals__read_storage_map(address: AztecAddress) -> pub u32 { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: PublicContext = PublicContext::new(|| -> Field { - let serialized_args: [Field; 1] = aztec::oracle::avm::calldata_copy(1_u32, ::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<1>(); { _read_storage_map(self.storage, address) } } unconstrained fn __aztec_nr_internals__read_storage_single() -> pub Field { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: PublicContext = PublicContext::new(|| -> Field { - let serialized_args: [Field; 0] = aztec::oracle::avm::calldata_copy(1_u32, 0_u32); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<0>(); { _read_storage_single(self.storage) } } unconstrained fn __aztec_nr_internals__return_oracle() -> pub [Field; 3] { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: PublicContext = PublicContext::new(|| -> Field { - let serialized_args: [Field; 0] = aztec::oracle::avm::calldata_copy(1_u32, 0_u32); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<0>(); { avm_return([1_Field, 2_Field, 3_Field].as_slice()); [4_Field, 5_Field, 6_Field] @@ -7303,18 +6602,7 @@ pub contract AvmTest { } unconstrained fn __aztec_nr_internals__returndata_copy_oracle() { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: PublicContext = PublicContext::new(|| -> Field { - let serialized_args: [Field; 0] = aztec::oracle::avm::calldata_copy(1_u32, 0_u32); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<0>(); { let _: [Field; 3] = self.call_self.return_oracle(); let returndatasize: u32 = returndata_size(); @@ -7324,18 +6612,7 @@ pub contract AvmTest { } unconstrained fn __aztec_nr_internals__revert_oracle() -> pub [Field; 3] { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: PublicContext = PublicContext::new(|| -> Field { - let serialized_args: [Field; 0] = aztec::oracle::avm::calldata_copy(1_u32, 0_u32); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<0>(); { revert([1_Field, 2_Field, 3_Field].as_slice()); [4_Field, 5_Field, 6_Field] @@ -7343,144 +6620,56 @@ pub contract AvmTest { } unconstrained fn __aztec_nr_internals__send_l2_to_l1_msg(recipient: EthAddress, content: Field) { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: PublicContext = PublicContext::new(|| -> Field { - let serialized_args: [Field; 2] = aztec::oracle::avm::calldata_copy(1_u32, ::N + ::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<2>(); { _send_l2_to_l1_msg(self.context, recipient, content); } } unconstrained fn __aztec_nr_internals__set_opcode_big_field() -> pub Field { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: PublicContext = PublicContext::new(|| -> Field { - let serialized_args: [Field; 0] = aztec::oracle::avm::calldata_copy(1_u32, 0_u32); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<0>(); { big_field_136_bits } } unconstrained fn __aztec_nr_internals__set_opcode_really_big_field() -> pub Field { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: PublicContext = PublicContext::new(|| -> Field { - let serialized_args: [Field; 0] = aztec::oracle::avm::calldata_copy(1_u32, 0_u32); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<0>(); { big_field_254_bits } } unconstrained fn __aztec_nr_internals__set_opcode_small_field() -> pub Field { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: PublicContext = PublicContext::new(|| -> Field { - let serialized_args: [Field; 0] = aztec::oracle::avm::calldata_copy(1_u32, 0_u32); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<0>(); { big_field_128_bits } } unconstrained fn __aztec_nr_internals__set_opcode_u32() -> pub u32 { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: PublicContext = PublicContext::new(|| -> Field { - let serialized_args: [Field; 0] = aztec::oracle::avm::calldata_copy(1_u32, 0_u32); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<0>(); { 1_u32 << 30_u32 } } unconstrained fn __aztec_nr_internals__set_opcode_u64() -> pub u64 { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: PublicContext = PublicContext::new(|| -> Field { - let serialized_args: [Field; 0] = aztec::oracle::avm::calldata_copy(1_u32, 0_u32); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<0>(); { 1_u64 << 60_u64 } } unconstrained fn __aztec_nr_internals__set_opcode_u8() -> pub u8 { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: PublicContext = PublicContext::new(|| -> Field { - let serialized_args: [Field; 0] = aztec::oracle::avm::calldata_copy(1_u32, 0_u32); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<0>(); { 8_u8 } } unconstrained fn __aztec_nr_internals__set_opcode_u8_view() -> pub u8 { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: PublicContext = PublicContext::new(|| -> Field { - let serialized_args: [Field; 0] = aztec::oracle::avm::calldata_copy(1_u32, 0_u32); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<0>(); assert(self.context.is_static_call(), "Function set_opcode_u8_view can only be called statically"); { 8_u8 @@ -7488,18 +6677,7 @@ pub contract AvmTest { } unconstrained fn __aztec_nr_internals__set_read_storage_single(a: Field) -> pub Field { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: PublicContext = PublicContext::new(|| -> Field { - let serialized_args: [Field; 1] = aztec::oracle::avm::calldata_copy(1_u32, ::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<1>(); { self.storage.single.write(a); self.storage.single.read() @@ -7507,72 +6685,28 @@ pub contract AvmTest { } unconstrained fn __aztec_nr_internals__set_storage_list(a: Field, b: Field) { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: PublicContext = PublicContext::new(|| -> Field { - let serialized_args: [Field; 2] = aztec::oracle::avm::calldata_copy(1_u32, ::N + ::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<2>(); { _set_storage_list(self.storage, a, b); } } unconstrained fn __aztec_nr_internals__set_storage_map(to: AztecAddress, amount: u32) -> pub Field { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: PublicContext = PublicContext::new(|| -> Field { - let serialized_args: [Field; 2] = aztec::oracle::avm::calldata_copy(1_u32, ::N + ::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<2>(); { _set_storage_map(self.storage, to, amount) } } unconstrained fn __aztec_nr_internals__set_storage_single(a: Field) { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: PublicContext = PublicContext::new(|| -> Field { - let serialized_args: [Field; 1] = aztec::oracle::avm::calldata_copy(1_u32, ::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<1>(); { _set_storage_single(self.storage, a); } } unconstrained fn __aztec_nr_internals__test_get_contract_instance(address: AztecAddress) { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: PublicContext = PublicContext::new(|| -> Field { - let serialized_args: [Field; 1] = aztec::oracle::avm::calldata_copy(1_u32, ::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<1>(); { let deployer: Option = get_contract_instance_deployer_avm(address); let class_id: Option = get_contract_instance_class_id_avm(address); @@ -7587,72 +6721,28 @@ pub contract AvmTest { } unconstrained fn __aztec_nr_internals__test_get_contract_instance_matches(address: AztecAddress, expected_deployer: AztecAddress, expected_class_id: ContractClassId, expected_initialization_hash: Field) { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: PublicContext = PublicContext::new(|| -> Field { - let serialized_args: [Field; 4] = aztec::oracle::avm::calldata_copy(1_u32, ((::N + ::N) + ::N) + ::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<4>(); { _test_get_contract_instance_matches(address, expected_deployer, expected_class_id, expected_initialization_hash); } } unconstrained fn __aztec_nr_internals__to_le_bits(input: Field) -> pub [bool; 16] { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: PublicContext = PublicContext::new(|| -> Field { - let serialized_args: [Field; 1] = aztec::oracle::avm::calldata_copy(1_u32, ::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<1>(); { _to_le_bits(input) } } unconstrained fn __aztec_nr_internals__to_le_bytes(input: Field) -> pub [u8; 10] { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: PublicContext = PublicContext::new(|| -> Field { - let serialized_args: [Field; 1] = aztec::oracle::avm::calldata_copy(1_u32, ::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<1>(); { _to_le_bytes(input) } } unconstrained fn __aztec_nr_internals__u128_addition_overflow() -> pub u128 { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: PublicContext = PublicContext::new(|| -> Field { - let serialized_args: [Field; 0] = aztec::oracle::avm::calldata_copy(1_u32, 0_u32); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<0>(); { let max_u128: u128 = 340282366920938463463374607431768211455_u128; let one: u128 = 1_u128; @@ -7661,18 +6751,7 @@ pub contract AvmTest { } unconstrained fn __aztec_nr_internals__variable_base_msm(scalar_lo: Field, scalar_hi: Field, scalar2_lo: Field, scalar2_hi: Field) -> pub Point { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: PublicContext = PublicContext::new(|| -> Field { - let serialized_args: [Field; 4] = aztec::oracle::avm::calldata_copy(1_u32, ((::N + ::N) + ::N) + ::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<4>(); { let g: Point = Point { x: GRUMPKIN_ONE_X, y: GRUMPKIN_ONE_Y, is_infinite: false}; let triple_g: std::embedded_curve_ops::EmbeddedCurvePoint = multi_scalar_mul([g.to_embedded(), g.to_embedded()], [Scalar { lo: scalar_lo, hi: scalar_hi}, Scalar { lo: scalar2_lo, hi: scalar2_hi}]); diff --git a/noir-projects/contract-snapshots/tests/snapshots/expand/public_fns_with_emit_repro_contract/snapshots__expanded.snap b/noir-projects/contract-snapshots/tests/snapshots/expand/public_fns_with_emit_repro_contract/snapshots__expanded.snap index 8c2e06830b9d..f51522828ebc 100644 --- a/noir-projects/contract-snapshots/tests/snapshots/expand/public_fns_with_emit_repro_contract/snapshots__expanded.snap +++ b/noir-projects/contract-snapshots/tests/snapshots/expand/public_fns_with_emit_repro_contract/snapshots__expanded.snap @@ -865,19 +865,22 @@ pub contract PublicFnsWithEmitRepro { parameters: fn_15_parameters, } + #[contract_library_method] + unconstrained fn __aztec_nr_internals__create_public_self() -> aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> { + let context: aztec::context::PublicContext = aztec::context::PublicContext::new(|| -> Field { + let serialized_args: [Field; N] = aztec::oracle::avm::calldata_copy(1_u32, N); + aztec::hash::hash_args(serialized_args) + }); + let storage: Storage = Storage::::init(context); + let self_address: aztec::protocol::address::AztecAddress = context.this_address(); + let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; + let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; + let internal: CallInternal = CallInternal:: { context: context}; + aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) + } + unconstrained fn __aztec_nr_internals__fn_01(v: u64) { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: aztec::context::PublicContext = aztec::context::PublicContext::new(|| -> Field { - let serialized_args: [Field; 1] = aztec::oracle::avm::calldata_copy(1_u32, ::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: aztec::protocol::address::AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<1>(); { let old: u64 = self.storage.value.read(); self.storage.value.write((old + v) + 1_u64); @@ -886,18 +889,7 @@ pub contract PublicFnsWithEmitRepro { } unconstrained fn __aztec_nr_internals__fn_02(v: u64) { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: aztec::context::PublicContext = aztec::context::PublicContext::new(|| -> Field { - let serialized_args: [Field; 1] = aztec::oracle::avm::calldata_copy(1_u32, ::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: aztec::protocol::address::AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<1>(); { let old: u64 = self.storage.value.read(); self.storage.value.write((old + v) + 2_u64); @@ -906,18 +898,7 @@ pub contract PublicFnsWithEmitRepro { } unconstrained fn __aztec_nr_internals__fn_03(v: u64) { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: aztec::context::PublicContext = aztec::context::PublicContext::new(|| -> Field { - let serialized_args: [Field; 1] = aztec::oracle::avm::calldata_copy(1_u32, ::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: aztec::protocol::address::AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<1>(); { let old: u64 = self.storage.value.read(); self.storage.value.write((old + v) + 3_u64); @@ -926,18 +907,7 @@ pub contract PublicFnsWithEmitRepro { } unconstrained fn __aztec_nr_internals__fn_04(v: u64) { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: aztec::context::PublicContext = aztec::context::PublicContext::new(|| -> Field { - let serialized_args: [Field; 1] = aztec::oracle::avm::calldata_copy(1_u32, ::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: aztec::protocol::address::AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<1>(); { let old: u64 = self.storage.value.read(); self.storage.value.write((old + v) + 4_u64); @@ -946,18 +916,7 @@ pub contract PublicFnsWithEmitRepro { } unconstrained fn __aztec_nr_internals__fn_05(v: u64) { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: aztec::context::PublicContext = aztec::context::PublicContext::new(|| -> Field { - let serialized_args: [Field; 1] = aztec::oracle::avm::calldata_copy(1_u32, ::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: aztec::protocol::address::AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<1>(); { let old: u64 = self.storage.value.read(); self.storage.value.write((old + v) + 5_u64); @@ -966,18 +925,7 @@ pub contract PublicFnsWithEmitRepro { } unconstrained fn __aztec_nr_internals__fn_06(v: u64) { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: aztec::context::PublicContext = aztec::context::PublicContext::new(|| -> Field { - let serialized_args: [Field; 1] = aztec::oracle::avm::calldata_copy(1_u32, ::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: aztec::protocol::address::AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<1>(); { let old: u64 = self.storage.value.read(); self.storage.value.write((old + v) + 6_u64); @@ -986,18 +934,7 @@ pub contract PublicFnsWithEmitRepro { } unconstrained fn __aztec_nr_internals__fn_07(v: u64) { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: aztec::context::PublicContext = aztec::context::PublicContext::new(|| -> Field { - let serialized_args: [Field; 1] = aztec::oracle::avm::calldata_copy(1_u32, ::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: aztec::protocol::address::AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<1>(); { let old: u64 = self.storage.value.read(); self.storage.value.write((old + v) + 7_u64); @@ -1006,18 +943,7 @@ pub contract PublicFnsWithEmitRepro { } unconstrained fn __aztec_nr_internals__fn_08(v: u64) { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: aztec::context::PublicContext = aztec::context::PublicContext::new(|| -> Field { - let serialized_args: [Field; 1] = aztec::oracle::avm::calldata_copy(1_u32, ::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: aztec::protocol::address::AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<1>(); { let old: u64 = self.storage.value.read(); self.storage.value.write((old + v) + 8_u64); @@ -1026,18 +952,7 @@ pub contract PublicFnsWithEmitRepro { } unconstrained fn __aztec_nr_internals__fn_09(v: u64) { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: aztec::context::PublicContext = aztec::context::PublicContext::new(|| -> Field { - let serialized_args: [Field; 1] = aztec::oracle::avm::calldata_copy(1_u32, ::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: aztec::protocol::address::AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<1>(); { let old: u64 = self.storage.value.read(); self.storage.value.write((old + v) + 9_u64); @@ -1046,18 +961,7 @@ pub contract PublicFnsWithEmitRepro { } unconstrained fn __aztec_nr_internals__fn_10(v: u64) { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: aztec::context::PublicContext = aztec::context::PublicContext::new(|| -> Field { - let serialized_args: [Field; 1] = aztec::oracle::avm::calldata_copy(1_u32, ::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: aztec::protocol::address::AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<1>(); { let old: u64 = self.storage.value.read(); self.storage.value.write((old + v) + 10_u64); @@ -1066,18 +970,7 @@ pub contract PublicFnsWithEmitRepro { } unconstrained fn __aztec_nr_internals__fn_11(v: u64) { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: aztec::context::PublicContext = aztec::context::PublicContext::new(|| -> Field { - let serialized_args: [Field; 1] = aztec::oracle::avm::calldata_copy(1_u32, ::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: aztec::protocol::address::AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<1>(); { let old: u64 = self.storage.value.read(); self.storage.value.write((old + v) + 11_u64); @@ -1086,18 +979,7 @@ pub contract PublicFnsWithEmitRepro { } unconstrained fn __aztec_nr_internals__fn_12(v: u64) { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: aztec::context::PublicContext = aztec::context::PublicContext::new(|| -> Field { - let serialized_args: [Field; 1] = aztec::oracle::avm::calldata_copy(1_u32, ::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: aztec::protocol::address::AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<1>(); { let old: u64 = self.storage.value.read(); self.storage.value.write((old + v) + 12_u64); @@ -1106,18 +988,7 @@ pub contract PublicFnsWithEmitRepro { } unconstrained fn __aztec_nr_internals__fn_13(v: u64) { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: aztec::context::PublicContext = aztec::context::PublicContext::new(|| -> Field { - let serialized_args: [Field; 1] = aztec::oracle::avm::calldata_copy(1_u32, ::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: aztec::protocol::address::AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<1>(); { let old: u64 = self.storage.value.read(); self.storage.value.write((old + v) + 13_u64); @@ -1126,18 +997,7 @@ pub contract PublicFnsWithEmitRepro { } unconstrained fn __aztec_nr_internals__fn_14(v: u64) { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: aztec::context::PublicContext = aztec::context::PublicContext::new(|| -> Field { - let serialized_args: [Field; 1] = aztec::oracle::avm::calldata_copy(1_u32, ::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: aztec::protocol::address::AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<1>(); { let old: u64 = self.storage.value.read(); self.storage.value.write((old + v) + 14_u64); @@ -1146,18 +1006,7 @@ pub contract PublicFnsWithEmitRepro { } unconstrained fn __aztec_nr_internals__fn_15(v: u64) { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: aztec::context::PublicContext = aztec::context::PublicContext::new(|| -> Field { - let serialized_args: [Field; 1] = aztec::oracle::avm::calldata_copy(1_u32, ::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: aztec::protocol::address::AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<1>(); { let old: u64 = self.storage.value.read(); self.storage.value.write((old + v) + 15_u64); diff --git a/noir-projects/contract-snapshots/tests/snapshots/expand/storage_proof_test_contract/snapshots__expanded.snap b/noir-projects/contract-snapshots/tests/snapshots/expand/storage_proof_test_contract/snapshots__expanded.snap index 48e78156173a..c53983f3697f 100644 --- a/noir-projects/contract-snapshots/tests/snapshots/expand/storage_proof_test_contract/snapshots__expanded.snap +++ b/noir-projects/contract-snapshots/tests/snapshots/expand/storage_proof_test_contract/snapshots__expanded.snap @@ -792,19 +792,22 @@ contract StorageProofTest { self.context.finish() } + #[contract_library_method] + unconstrained fn __aztec_nr_internals__create_public_self() -> aztec::contract_self::contract_self_public::ContractSelfPublic<(), CallSelf, CallSelfStatic, CallInternal> { + let context: aztec::context::PublicContext = aztec::context::PublicContext::new(|| -> Field { + let serialized_args: [Field; N] = aztec::oracle::avm::calldata_copy(1_u32, N); + aztec::hash::hash_args(serialized_args) + }); + let storage: () = (); + let self_address: AztecAddress = context.this_address(); + let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; + let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; + let internal: CallInternal = CallInternal:: { context: context}; + aztec::contract_self::contract_self_public::ContractSelfPublic::<(), CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) + } + unconstrained fn __aztec_nr_internals__account_proof(account: Account, root: [u64; 4], nodes: [Node; 15], node_length: u32) { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic<(), CallSelf, CallSelfStatic, CallInternal> = { - let context: aztec::context::PublicContext = aztec::context::PublicContext::new(|| -> Field { - let serialized_args: [Field; 1290] = aztec::oracle::avm::calldata_copy(1_u32, ((>::N + <[u64; 4] as Serialize>::N) + <[Node; 15] as Serialize>::N) + ::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: () = (); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::<(), CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic<(), CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<1290>(); assert(self.context.is_static_call(), "Function account_proof can only be called statically"); { let trie_key: [u8; 32] = KeccakHasher::hash_bytes(account.address, 20_u32); diff --git a/noir-projects/contract-snapshots/tests/snapshots/expand/token_contract/snapshots__expanded.snap b/noir-projects/contract-snapshots/tests/snapshots/expand/token_contract/snapshots__expanded.snap index 6ff219ba67af..4b8a1ce18747 100644 --- a/noir-projects/contract-snapshots/tests/snapshots/expand/token_contract/snapshots__expanded.snap +++ b/noir-projects/contract-snapshots/tests/snapshots/expand/token_contract/snapshots__expanded.snap @@ -3773,19 +3773,22 @@ pub contract Token { self.context.finish() } + #[contract_library_method] + unconstrained fn __aztec_nr_internals__create_public_self() -> aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> { + let context: aztec::context::PublicContext = aztec::context::PublicContext::new(|| -> Field { + let serialized_args: [Field; N] = aztec::oracle::avm::calldata_copy(1_u32, N); + aztec::hash::hash_args(serialized_args) + }); + let storage: Storage = Storage::::init(context); + let self_address: AztecAddress = context.this_address(); + let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; + let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; + let internal: CallInternal = CallInternal:: { context: context}; + aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) + } + unconstrained fn __aztec_nr_internals___finalize_mint_to_private_unsafe(minter_and_completer: AztecAddress, amount: u128, partial_note: PartialUintNote) { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: aztec::context::PublicContext = aztec::context::PublicContext::new(|| -> Field { - let serialized_args: [Field; 3] = aztec::oracle::avm::calldata_copy(1_u32, (::N + ::N) + ::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<3>(); assert(self.msg_sender() == self.address, "Function _finalize_mint_to_private_unsafe can only be called by the same contract"); { assert(self.storage.minters.at(minter_and_completer).read(), "caller is not minter"); @@ -3794,18 +3797,7 @@ pub contract Token { } unconstrained fn __aztec_nr_internals___finalize_transfer_to_private_unsafe(from_and_completer: AztecAddress, amount: u128, partial_note: PartialUintNote) { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: aztec::context::PublicContext = aztec::context::PublicContext::new(|| -> Field { - let serialized_args: [Field; 3] = aztec::oracle::avm::calldata_copy(1_u32, (::N + ::N) + ::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<3>(); assert(self.msg_sender() == self.address, "Function _finalize_transfer_to_private_unsafe can only be called by the same contract"); { self.internal._finalize_transfer_to_private(from_and_completer, amount, partial_note); @@ -3813,18 +3805,7 @@ pub contract Token { } unconstrained fn __aztec_nr_internals___increase_public_balance(to: AztecAddress, amount: u128) { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: aztec::context::PublicContext = aztec::context::PublicContext::new(|| -> Field { - let serialized_args: [Field; 2] = aztec::oracle::avm::calldata_copy(1_u32, ::N + ::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<2>(); assert(self.msg_sender() == self.address, "Function _increase_public_balance can only be called by the same contract"); { let to_balance: PublicMutable = self.storage.public_balances.at(to); @@ -3834,18 +3815,7 @@ pub contract Token { } unconstrained fn __aztec_nr_internals___reduce_total_supply(amount: u128) { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: aztec::context::PublicContext = aztec::context::PublicContext::new(|| -> Field { - let serialized_args: [Field; 1] = aztec::oracle::avm::calldata_copy(1_u32, ::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<1>(); assert(self.msg_sender() == self.address, "Function _reduce_total_supply can only be called by the same contract"); { let new_supply: u128 = self.storage.total_supply.read().sub(amount); @@ -3854,18 +3824,7 @@ pub contract Token { } unconstrained fn __aztec_nr_internals__balance_of_public(owner: AztecAddress) -> pub u128 { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: aztec::context::PublicContext = aztec::context::PublicContext::new(|| -> Field { - let serialized_args: [Field; 1] = aztec::oracle::avm::calldata_copy(1_u32, ::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<1>(); aztec::macros::functions::initialization_utils::assert_is_initialized_public(self.context); assert(self.context.is_static_call(), "Function balance_of_public can only be called statically"); { @@ -3874,18 +3833,7 @@ pub contract Token { } unconstrained fn __aztec_nr_internals__burn_public(from: AztecAddress, amount: u128, authwit_nonce: Field) { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: aztec::context::PublicContext = aztec::context::PublicContext::new(|| -> Field { - let serialized_args: [Field; 3] = aztec::oracle::avm::calldata_copy(1_u32, (::N + ::N) + ::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<3>(); aztec::macros::functions::initialization_utils::assert_is_initialized_public(self.context); if !from.eq(self.msg_sender()) { aztec::authwit::auth::assert_current_call_valid_authwit_public(self.context, from); @@ -3901,18 +3849,7 @@ pub contract Token { } unconstrained fn __aztec_nr_internals__constructor(admin: AztecAddress, name: str<31>, symbol: str<31>, decimals: u8) { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: aztec::context::PublicContext = aztec::context::PublicContext::new(|| -> Field { - let serialized_args: [Field; 64] = aztec::oracle::avm::calldata_copy(1_u32, ((::N + as aztec::protocol::traits::Serialize>::N) + as aztec::protocol::traits::Serialize>::N) + ::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<64>(); aztec::macros::functions::initialization_utils::assert_initialization_matches_address_preimage_public(self.context); { assert(!admin.is_zero(), "invalid admin"); @@ -3926,18 +3863,7 @@ pub contract Token { } unconstrained fn __aztec_nr_internals__finalize_mint_to_private(amount: u128, partial_note: PartialUintNote) { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: aztec::context::PublicContext = aztec::context::PublicContext::new(|| -> Field { - let serialized_args: [Field; 2] = aztec::oracle::avm::calldata_copy(1_u32, ::N + ::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<2>(); aztec::macros::functions::initialization_utils::assert_is_initialized_public(self.context); { let minter_and_completer: AztecAddress = self.msg_sender(); @@ -3947,18 +3873,7 @@ pub contract Token { } unconstrained fn __aztec_nr_internals__finalize_transfer_to_private(amount: u128, partial_note: PartialUintNote) { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: aztec::context::PublicContext = aztec::context::PublicContext::new(|| -> Field { - let serialized_args: [Field; 2] = aztec::oracle::avm::calldata_copy(1_u32, ::N + ::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<2>(); aztec::macros::functions::initialization_utils::assert_is_initialized_public(self.context); { let from_and_completer: AztecAddress = self.msg_sender(); @@ -3967,18 +3882,7 @@ pub contract Token { } unconstrained fn __aztec_nr_internals__get_admin() -> pub Field { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: aztec::context::PublicContext = aztec::context::PublicContext::new(|| -> Field { - let serialized_args: [Field; 0] = aztec::oracle::avm::calldata_copy(1_u32, 0_u32); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<0>(); aztec::macros::functions::initialization_utils::assert_is_initialized_public(self.context); assert(self.context.is_static_call(), "Function get_admin can only be called statically"); { @@ -3987,18 +3891,7 @@ pub contract Token { } unconstrained fn __aztec_nr_internals__is_minter(minter: AztecAddress) -> pub bool { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: aztec::context::PublicContext = aztec::context::PublicContext::new(|| -> Field { - let serialized_args: [Field; 1] = aztec::oracle::avm::calldata_copy(1_u32, ::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<1>(); aztec::macros::functions::initialization_utils::assert_is_initialized_public(self.context); assert(self.context.is_static_call(), "Function is_minter can only be called statically"); { @@ -4007,18 +3900,7 @@ pub contract Token { } unconstrained fn __aztec_nr_internals__mint_to_public(to: AztecAddress, amount: u128) { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: aztec::context::PublicContext = aztec::context::PublicContext::new(|| -> Field { - let serialized_args: [Field; 2] = aztec::oracle::avm::calldata_copy(1_u32, ::N + ::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<2>(); aztec::macros::functions::initialization_utils::assert_is_initialized_public(self.context); { assert(self.storage.minters.at(self.msg_sender()).read(), "caller is not minter"); @@ -4030,18 +3912,7 @@ pub contract Token { } unconstrained fn __aztec_nr_internals__public_get_decimals() -> pub u8 { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: aztec::context::PublicContext = aztec::context::PublicContext::new(|| -> Field { - let serialized_args: [Field; 0] = aztec::oracle::avm::calldata_copy(1_u32, 0_u32); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<0>(); aztec::macros::functions::initialization_utils::assert_is_initialized_public(self.context); assert(self.context.is_static_call(), "Function public_get_decimals can only be called statically"); { @@ -4050,18 +3921,7 @@ pub contract Token { } unconstrained fn __aztec_nr_internals__public_get_name() -> pub FieldCompressedString { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: aztec::context::PublicContext = aztec::context::PublicContext::new(|| -> Field { - let serialized_args: [Field; 0] = aztec::oracle::avm::calldata_copy(1_u32, 0_u32); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<0>(); aztec::macros::functions::initialization_utils::assert_is_initialized_public(self.context); assert(self.context.is_static_call(), "Function public_get_name can only be called statically"); { @@ -4070,18 +3930,7 @@ pub contract Token { } unconstrained fn __aztec_nr_internals__public_get_symbol() -> pub FieldCompressedString { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: aztec::context::PublicContext = aztec::context::PublicContext::new(|| -> Field { - let serialized_args: [Field; 0] = aztec::oracle::avm::calldata_copy(1_u32, 0_u32); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<0>(); aztec::macros::functions::initialization_utils::assert_is_initialized_public(self.context); assert(self.context.is_static_call(), "Function public_get_symbol can only be called statically"); { @@ -4090,18 +3939,7 @@ pub contract Token { } unconstrained fn __aztec_nr_internals__set_admin(new_admin: AztecAddress) { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: aztec::context::PublicContext = aztec::context::PublicContext::new(|| -> Field { - let serialized_args: [Field; 1] = aztec::oracle::avm::calldata_copy(1_u32, ::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<1>(); aztec::macros::functions::initialization_utils::assert_is_initialized_public(self.context); { assert(self.storage.admin.read().eq(self.msg_sender()), "caller is not admin"); @@ -4110,18 +3948,7 @@ pub contract Token { } unconstrained fn __aztec_nr_internals__set_minter(minter: AztecAddress, approve: bool) { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: aztec::context::PublicContext = aztec::context::PublicContext::new(|| -> Field { - let serialized_args: [Field; 2] = aztec::oracle::avm::calldata_copy(1_u32, ::N + ::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<2>(); aztec::macros::functions::initialization_utils::assert_is_initialized_public(self.context); { assert(self.storage.admin.read().eq(self.msg_sender()), "caller is not admin"); @@ -4130,18 +3957,7 @@ pub contract Token { } unconstrained fn __aztec_nr_internals__total_supply() -> pub u128 { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: aztec::context::PublicContext = aztec::context::PublicContext::new(|| -> Field { - let serialized_args: [Field; 0] = aztec::oracle::avm::calldata_copy(1_u32, 0_u32); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<0>(); aztec::macros::functions::initialization_utils::assert_is_initialized_public(self.context); assert(self.context.is_static_call(), "Function total_supply can only be called statically"); { @@ -4150,18 +3966,7 @@ pub contract Token { } unconstrained fn __aztec_nr_internals__transfer_in_public(from: AztecAddress, to: AztecAddress, amount: u128, authwit_nonce: Field) { - let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = { - let context: aztec::context::PublicContext = aztec::context::PublicContext::new(|| -> Field { - let serialized_args: [Field; 4] = aztec::oracle::avm::calldata_copy(1_u32, ((::N + ::N) + ::N) + ::N); - aztec::hash::hash_args(serialized_args) - }); - let storage: Storage = Storage::::init(context); - let self_address: AztecAddress = context.this_address(); - let call_self: CallSelf = CallSelf:: { address: self_address, context: context}; - let call_self_static: CallSelfStatic = CallSelfStatic:: { address: self_address, context: context}; - let internal: CallInternal = CallInternal:: { context: context}; - aztec::contract_self::contract_self_public::ContractSelfPublic::, CallSelf, CallSelfStatic, CallInternal>::new(context, storage, call_self, call_self_static, internal) - }; + let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic, CallSelf, CallSelfStatic, CallInternal> = __aztec_nr_internals__create_public_self::<4>(); aztec::macros::functions::initialization_utils::assert_is_initialized_public(self.context); if !from.eq(self.msg_sender()) { aztec::authwit::auth::assert_current_call_valid_authwit_public(self.context, from);