@aztec/protocol-contracts 0.33.0 → 0.34.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dest/artifacts/ContractClassRegisterer.json +1 -1
- package/dest/artifacts/ContractInstanceDeployer.json +1 -1
- package/dest/artifacts/GasToken.json +1 -1
- package/dest/artifacts/MultiCallEntrypoint.json +1 -1
- package/package.json +4 -4
- package/src/artifacts/ContractClassRegisterer.json +1 -1
- package/src/artifacts/ContractInstanceDeployer.json +1 -1
- package/src/artifacts/GasToken.json +1 -1
- package/src/artifacts/MultiCallEntrypoint.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"noir_version":"0.26.0+bdc49d8e1897105afd5ee87ac62b5afb93744d61","name":"ContractInstanceDeployer","functions":[{"name":"deploy","is_unconstrained":false,"custom_attributes":["aztec(private)"],"abi":{"parameters":[{"name":"inputs","type":{"kind":"struct","path":"aztec::context::inputs::private_context_inputs::PrivateContextInputs","fields":[{"name":"call_context","type":{"kind":"struct","path":"aztec::protocol_types::abis::call_context::CallContext","fields":[{"name":"msg_sender","type":{"kind":"struct","path":"aztec::protocol_types::address::aztec_address::AztecAddress","fields":[{"name":"inner","type":{"kind":"field"}}]}},{"name":"storage_contract_address","type":{"kind":"struct","path":"aztec::protocol_types::address::aztec_address::AztecAddress","fields":[{"name":"inner","type":{"kind":"field"}}]}},{"name":"portal_contract_address","type":{"kind":"struct","path":"aztec::protocol_types::address::eth_address::EthAddress","fields":[{"name":"inner","type":{"kind":"field"}}]}},{"name":"function_selector","type":{"kind":"struct","path":"aztec::protocol_types::abis::function_selector::FunctionSelector","fields":[{"name":"inner","type":{"kind":"integer","sign":"unsigned","width":32}}]}},{"name":"is_delegate_call","type":{"kind":"boolean"}},{"name":"is_static_call","type":{"kind":"boolean"}},{"name":"side_effect_counter","type":{"kind":"integer","sign":"unsigned","width":32}}]}},{"name":"historical_header","type":{"kind":"struct","path":"aztec::protocol_types::header::Header","fields":[{"name":"last_archive","type":{"kind":"struct","path":"aztec::protocol_types::abis::append_only_tree_snapshot::AppendOnlyTreeSnapshot","fields":[{"name":"root","type":{"kind":"field"}},{"name":"next_available_leaf_index","type":{"kind":"integer","sign":"unsigned","width":32}}]}},{"name":"content_commitment","type":{"kind":"struct","path":"aztec::protocol_types::content_commitment::ContentCommitment","fields":[{"name":"tx_tree_height","type":{"kind":"field"}},{"name":"txs_effects_hash","type":{"kind":"field"}},{"name":"in_hash","type":{"kind":"field"}},{"name":"out_hash","type":{"kind":"field"}}]}},{"name":"state","type":{"kind":"struct","path":"aztec::protocol_types::state_reference::StateReference","fields":[{"name":"l1_to_l2_message_tree","type":{"kind":"struct","path":"aztec::protocol_types::abis::append_only_tree_snapshot::AppendOnlyTreeSnapshot","fields":[{"name":"root","type":{"kind":"field"}},{"name":"next_available_leaf_index","type":{"kind":"integer","sign":"unsigned","width":32}}]}},{"name":"partial","type":{"kind":"struct","path":"aztec::protocol_types::partial_state_reference::PartialStateReference","fields":[{"name":"note_hash_tree","type":{"kind":"struct","path":"aztec::protocol_types::abis::append_only_tree_snapshot::AppendOnlyTreeSnapshot","fields":[{"name":"root","type":{"kind":"field"}},{"name":"next_available_leaf_index","type":{"kind":"integer","sign":"unsigned","width":32}}]}},{"name":"nullifier_tree","type":{"kind":"struct","path":"aztec::protocol_types::abis::append_only_tree_snapshot::AppendOnlyTreeSnapshot","fields":[{"name":"root","type":{"kind":"field"}},{"name":"next_available_leaf_index","type":{"kind":"integer","sign":"unsigned","width":32}}]}},{"name":"public_data_tree","type":{"kind":"struct","path":"aztec::protocol_types::abis::append_only_tree_snapshot::AppendOnlyTreeSnapshot","fields":[{"name":"root","type":{"kind":"field"}},{"name":"next_available_leaf_index","type":{"kind":"integer","sign":"unsigned","width":32}}]}}]}}]}},{"name":"global_variables","type":{"kind":"struct","path":"aztec::protocol_types::abis::global_variables::GlobalVariables","fields":[{"name":"chain_id","type":{"kind":"field"}},{"name":"version","type":{"kind":"field"}},{"name":"block_number","type":{"kind":"field"}},{"name":"timestamp","type":{"kind":"integer","sign":"unsigned","width":64}},{"name":"coinbase","type":{"kind":"struct","path":"aztec::protocol_types::address::eth_address::EthAddress","fields":[{"name":"inner","type":{"kind":"field"}}]}},{"name":"fee_recipient","type":{"kind":"struct","path":"aztec::protocol_types::address::aztec_address::AztecAddress","fields":[{"name":"inner","type":{"kind":"field"}}]}}]}}]}},{"name":"private_global_variables","type":{"kind":"struct","path":"aztec::context::globals::private_global_variables::PrivateGlobalVariables","fields":[{"name":"chain_id","type":{"kind":"field"}},{"name":"version","type":{"kind":"field"}}]}},{"name":"start_side_effect_counter","type":{"kind":"integer","sign":"unsigned","width":32}}]},"visibility":"private"},{"name":"salt","type":{"kind":"field"},"visibility":"private"},{"name":"contract_class_id","type":{"kind":"struct","path":"aztec::protocol_types::contract_class_id::ContractClassId","fields":[{"name":"inner","type":{"kind":"field"}}]},"visibility":"private"},{"name":"initialization_hash","type":{"kind":"field"},"visibility":"private"},{"name":"portal_contract_address","type":{"kind":"struct","path":"aztec::protocol_types::address::eth_address::EthAddress","fields":[{"name":"inner","type":{"kind":"field"}}]},"visibility":"private"},{"name":"public_keys_hash","type":{"kind":"struct","path":"aztec::protocol_types::address::public_keys_hash::PublicKeysHash","fields":[{"name":"inner","type":{"kind":"field"}}]},"visibility":"private"},{"name":"universal_deploy","type":{"kind":"boolean"},"visibility":"private"}],"param_witnesses":{"contract_class_id":[{"start":31,"end":32}],"initialization_hash":[{"start":32,"end":33}],"inputs":[{"start":0,"end":30}],"portal_contract_address":[{"start":33,"end":34}],"public_keys_hash":[{"start":34,"end":35}],"salt":[{"start":30,"end":31}],"universal_deploy":[{"start":35,"end":36}]},"return_type":{"abi_type":{"kind":"struct","path":"aztec::protocol_types::abis::private_circuit_public_inputs::PrivateCircuitPublicInputs","fields":[{"name":"call_context","type":{"kind":"struct","path":"aztec::protocol_types::abis::call_context::CallContext","fields":[{"name":"msg_sender","type":{"kind":"struct","path":"aztec::protocol_types::address::aztec_address::AztecAddress","fields":[{"name":"inner","type":{"kind":"field"}}]}},{"name":"storage_contract_address","type":{"kind":"struct","path":"aztec::protocol_types::address::aztec_address::AztecAddress","fields":[{"name":"inner","type":{"kind":"field"}}]}},{"name":"portal_contract_address","type":{"kind":"struct","path":"aztec::protocol_types::address::eth_address::EthAddress","fields":[{"name":"inner","type":{"kind":"field"}}]}},{"name":"function_selector","type":{"kind":"struct","path":"aztec::protocol_types::abis::function_selector::FunctionSelector","fields":[{"name":"inner","type":{"kind":"integer","sign":"unsigned","width":32}}]}},{"name":"is_delegate_call","type":{"kind":"boolean"}},{"name":"is_static_call","type":{"kind":"boolean"}},{"name":"side_effect_counter","type":{"kind":"integer","sign":"unsigned","width":32}}]}},{"name":"args_hash","type":{"kind":"field"}},{"name":"return_values","type":{"kind":"array","length":4,"type":{"kind":"field"}}},{"name":"min_revertible_side_effect_counter","type":{"kind":"integer","sign":"unsigned","width":32}},{"name":"max_block_number","type":{"kind":"struct","path":"aztec::protocol_types::abis::max_block_number::MaxBlockNumber","fields":[{"name":"_opt","type":{"kind":"struct","path":"std::option::Option","fields":[{"name":"_is_some","type":{"kind":"boolean"}},{"name":"_value","type":{"kind":"integer","sign":"unsigned","width":32}}]}}]}},{"name":"note_hash_read_requests","type":{"kind":"array","length":32,"type":{"kind":"struct","path":"aztec::protocol_types::abis::side_effect::SideEffect","fields":[{"name":"value","type":{"kind":"field"}},{"name":"counter","type":{"kind":"integer","sign":"unsigned","width":32}}]}}},{"name":"nullifier_read_requests","type":{"kind":"array","length":2,"type":{"kind":"struct","path":"aztec::protocol_types::abis::read_request::ReadRequest","fields":[{"name":"value","type":{"kind":"field"}},{"name":"counter","type":{"kind":"integer","sign":"unsigned","width":32}}]}}},{"name":"nullifier_key_validation_requests","type":{"kind":"array","length":1,"type":{"kind":"struct","path":"aztec::protocol_types::abis::nullifier_key_validation_request::NullifierKeyValidationRequest","fields":[{"name":"public_key","type":{"kind":"struct","path":"aztec::protocol_types::grumpkin_point::GrumpkinPoint","fields":[{"name":"x","type":{"kind":"field"}},{"name":"y","type":{"kind":"field"}}]}},{"name":"secret_key","type":{"kind":"struct","path":"aztec::protocol_types::grumpkin_private_key::GrumpkinPrivateKey","fields":[{"name":"high","type":{"kind":"field"}},{"name":"low","type":{"kind":"field"}}]}}]}}},{"name":"new_note_hashes","type":{"kind":"array","length":16,"type":{"kind":"struct","path":"aztec::protocol_types::abis::side_effect::SideEffect","fields":[{"name":"value","type":{"kind":"field"}},{"name":"counter","type":{"kind":"integer","sign":"unsigned","width":32}}]}}},{"name":"new_nullifiers","type":{"kind":"array","length":16,"type":{"kind":"struct","path":"aztec::protocol_types::abis::side_effect::SideEffectLinkedToNoteHash","fields":[{"name":"value","type":{"kind":"field"}},{"name":"note_hash","type":{"kind":"field"}},{"name":"counter","type":{"kind":"integer","sign":"unsigned","width":32}}]}}},{"name":"private_call_stack_hashes","type":{"kind":"array","length":4,"type":{"kind":"field"}}},{"name":"public_call_stack_hashes","type":{"kind":"array","length":4,"type":{"kind":"field"}}},{"name":"new_l2_to_l1_msgs","type":{"kind":"array","length":2,"type":{"kind":"struct","path":"aztec::protocol_types::messaging::l2_to_l1_message::L2ToL1Message","fields":[{"name":"recipient","type":{"kind":"struct","path":"aztec::protocol_types::address::eth_address::EthAddress","fields":[{"name":"inner","type":{"kind":"field"}}]}},{"name":"content","type":{"kind":"field"}}]}}},{"name":"start_side_effect_counter","type":{"kind":"integer","sign":"unsigned","width":32}},{"name":"end_side_effect_counter","type":{"kind":"integer","sign":"unsigned","width":32}},{"name":"encrypted_logs_hash","type":{"kind":"field"}},{"name":"unencrypted_logs_hash","type":{"kind":"field"}},{"name":"encrypted_log_preimages_length","type":{"kind":"field"}},{"name":"unencrypted_log_preimages_length","type":{"kind":"field"}},{"name":"historical_header","type":{"kind":"struct","path":"aztec::protocol_types::header::Header","fields":[{"name":"last_archive","type":{"kind":"struct","path":"aztec::protocol_types::abis::append_only_tree_snapshot::AppendOnlyTreeSnapshot","fields":[{"name":"root","type":{"kind":"field"}},{"name":"next_available_leaf_index","type":{"kind":"integer","sign":"unsigned","width":32}}]}},{"name":"content_commitment","type":{"kind":"struct","path":"aztec::protocol_types::content_commitment::ContentCommitment","fields":[{"name":"tx_tree_height","type":{"kind":"field"}},{"name":"txs_effects_hash","type":{"kind":"field"}},{"name":"in_hash","type":{"kind":"field"}},{"name":"out_hash","type":{"kind":"field"}}]}},{"name":"state","type":{"kind":"struct","path":"aztec::protocol_types::state_reference::StateReference","fields":[{"name":"l1_to_l2_message_tree","type":{"kind":"struct","path":"aztec::protocol_types::abis::append_only_tree_snapshot::AppendOnlyTreeSnapshot","fields":[{"name":"root","type":{"kind":"field"}},{"name":"next_available_leaf_index","type":{"kind":"integer","sign":"unsigned","width":32}}]}},{"name":"partial","type":{"kind":"struct","path":"aztec::protocol_types::partial_state_reference::PartialStateReference","fields":[{"name":"note_hash_tree","type":{"kind":"struct","path":"aztec::protocol_types::abis::append_only_tree_snapshot::AppendOnlyTreeSnapshot","fields":[{"name":"root","type":{"kind":"field"}},{"name":"next_available_leaf_index","type":{"kind":"integer","sign":"unsigned","width":32}}]}},{"name":"nullifier_tree","type":{"kind":"struct","path":"aztec::protocol_types::abis::append_only_tree_snapshot::AppendOnlyTreeSnapshot","fields":[{"name":"root","type":{"kind":"field"}},{"name":"next_available_leaf_index","type":{"kind":"integer","sign":"unsigned","width":32}}]}},{"name":"public_data_tree","type":{"kind":"struct","path":"aztec::protocol_types::abis::append_only_tree_snapshot::AppendOnlyTreeSnapshot","fields":[{"name":"root","type":{"kind":"field"}},{"name":"next_available_leaf_index","type":{"kind":"integer","sign":"unsigned","width":32}}]}}]}}]}},{"name":"global_variables","type":{"kind":"struct","path":"aztec::protocol_types::abis::global_variables::GlobalVariables","fields":[{"name":"chain_id","type":{"kind":"field"}},{"name":"version","type":{"kind":"field"}},{"name":"block_number","type":{"kind":"field"}},{"name":"timestamp","type":{"kind":"integer","sign":"unsigned","width":64}},{"name":"coinbase","type":{"kind":"struct","path":"aztec::protocol_types::address::eth_address::EthAddress","fields":[{"name":"inner","type":{"kind":"field"}}]}},{"name":"fee_recipient","type":{"kind":"struct","path":"aztec::protocol_types::address::aztec_address::AztecAddress","fields":[{"name":"inner","type":{"kind":"field"}}]}}]}}]}},{"name":"chain_id","type":{"kind":"field"}},{"name":"version","type":{"kind":"field"}}]},"visibility":"public"},"return_witnesses":[49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255]},"bytecode":"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","debug_symbols":"1ZbfasIwFMbfJddFzp+cJKevMrzonANBqmg3GNJ3XztNW1lGUJnQqxDyfTm/JCcnOZntblU1m119NOXJIJny5WSO+6ruu8emOjSmhMKs67eubQvzvtmuTUli2+KXjoCjlEBoUCNiQs0EdFEziWbUVkOcW8DaUa3aLguDPFdw+0RwZhfBWd2D4PIIuBBEFCE7ogROiBGGDUcgHEn6FSe4aZjZj1rrf6jdLKn9LKk1Ra0aYRB9Dj04vIhVJvlqJaH1EjdEw5TF3p7bBLMlx4fJ/UjucuSIKnFmVs6oc+zJx2caggQz8KhuKIiIcJWStwMlHxVkFyKQRZ8B6m6Iv6itikwvXx/B/nuEZJlG7zVGCOE6I3pTskpi0Lhb3ZlQ7iSEOaodTKqOO2Mt+I8g49p1WlM0RJ/P+phSvnCnT+/zWbjH5xaYvMIIQ6oiyiSxQdpl1/usDpvqdbvuv3H94Ee9ir+6rtt87c8j7Tc="},{"name":"compute_note_hash_and_nullifier","is_unconstrained":true,"custom_attributes":[],"abi":{"parameters":[{"name":"contract_address","type":{"kind":"struct","path":"aztec::protocol_types::address::aztec_address::AztecAddress","fields":[{"name":"inner","type":{"kind":"field"}}]},"visibility":"private"},{"name":"nonce","type":{"kind":"field"},"visibility":"private"},{"name":"storage_slot","type":{"kind":"field"},"visibility":"private"},{"name":"note_type_id","type":{"kind":"field"},"visibility":"private"},{"name":"serialized_note","type":{"kind":"array","length":20,"type":{"kind":"field"}},"visibility":"private"}],"param_witnesses":{"contract_address":[{"start":0,"end":1}],"nonce":[{"start":1,"end":2}],"note_type_id":[{"start":3,"end":4}],"serialized_note":[{"start":4,"end":24}],"storage_slot":[{"start":2,"end":3}]},"return_type":{"abi_type":{"kind":"array","length":4,"type":{"kind":"field"}},"visibility":"public"},"return_witnesses":[24,25,26,27]},"bytecode":"H4sIAAAAAAAA/+2YzW7CMAyA0xL6B+3+2PiZtPW4YytxmHbqQ+wFEKs0LjDRbo8/rYZYNWHsMvdgCUtR0jQ4n+2SOHHUXu6b4ph2ryl9dSz4vjB19j/JGXVlXXI6QjhdIZw9Rk5gG6luv1PdgV+5GfsCGD0BjL4AxkAAYyiAMRLAOBDAOBTAGAtgTAQwXghgvBTAeCWA8VoA440AxpEAxlsBjHcCGMeMjA5h1KY9acq0KTO1P7O/mP5AtVJwMczzJeTsOPlEHQrkJi4+6Lavh9ykD/ld0od3DD3d2uCx25DNQa/PrdfkZuh3j/jEs2ICc89In2a3MX8OiD/Z9Gad+W73baN/8Ozqk2f0VWjajHcwOZ3bMSUkcyoTI2xPyVgch/5wSYxBIM/E+Id//E5bv0vIGO8X+wvFa79v8fgWc98wgUCuMtGtX2w2zvsx0Bvx6z2IubZiEpF+HPNo6kvTN+SPw5yuH4rYTKUg7SHx/YCfJ+/Izl1MY6PrW/GuIYnlq8DyVULGxMR/SQf+c8i8qJtygJyZz8ynmAfq8D+OffQ91q5lC827cHyojtcTVoNwQpoYOgYO3sGCChsJbGi+ajeNiBgbG2C4WIDFFjYbOHjCwQ4OTnAwgcR/TOY4lQzThBnlwdRPpn59X1XpcrOut4tlnb5tyipdb+r0syrTj+3qa1GX8FxW6ge2C+5aGhsAAA==","debug_symbols":"nZBLCoAgFEX38sYS0j+3Eg1eZSCIiloQ4t5TogXk7H44kxNA6g290MoBC0Crugc2B3AGVR6cR+uB1WNHgKs9pYlGAoeQPOWujQvJ0FACjSXQVAA19CeU2oVW4Cp51pLPU22fpVT9bd4nPg=="}],"outputs":{"structs":{"functions":[{"kind":"struct","path":"ContractInstanceDeployer::deploy_abi","fields":[{"name":"parameters","type":{"kind":"struct","path":"ContractInstanceDeployer::deploy_parameters","fields":[{"name":"salt","type":{"kind":"field"}},{"name":"contract_class_id","type":{"kind":"struct","path":"aztec::protocol_types::contract_class_id::ContractClassId","fields":[{"name":"inner","type":{"kind":"field"}}]}},{"name":"initialization_hash","type":{"kind":"field"}},{"name":"portal_contract_address","type":{"kind":"struct","path":"aztec::protocol_types::address::eth_address::EthAddress","fields":[{"name":"inner","type":{"kind":"field"}}]}},{"name":"public_keys_hash","type":{"kind":"struct","path":"aztec::protocol_types::address::public_keys_hash::PublicKeysHash","fields":[{"name":"inner","type":{"kind":"field"}}]}},{"name":"universal_deploy","type":{"kind":"boolean"}}]}}]}]},"globals":{}},"file_map":{"83":{"source":"use crate::{\n context::{inputs::PrivateContextInputs, interface::ContextInterface},\n key::nullifier_key::validate_nullifier_key_against_address, messaging::process_l1_to_l2_message,\n hash::hash_args_array,\n oracle::{\n arguments, call_private_function::call_private_function_internal,\n enqueue_public_function_call::enqueue_public_function_call_internal, context::get_portal_address,\n header::get_header_at, nullifier_key::{get_nullifier_key_pair, NullifierKeyPair}\n}\n};\nuse dep::protocol_types::{\n abis::{\n call_context::CallContext, function_data::FunctionData, function_selector::FunctionSelector,\n max_block_number::MaxBlockNumber, nullifier_key_validation_request::NullifierKeyValidationRequest,\n private_call_stack_item::PrivateCallStackItem,\n private_circuit_public_inputs::PrivateCircuitPublicInputs,\n public_call_stack_item::PublicCallStackItem,\n public_circuit_public_inputs::PublicCircuitPublicInputs, read_request::ReadRequest,\n side_effect::{SideEffect, SideEffectLinkedToNoteHash}\n},\n address::{AztecAddress, EthAddress},\n constants::{\n MAX_NEW_NOTE_HASHES_PER_CALL, MAX_NEW_L2_TO_L1_MSGS_PER_CALL, MAX_NEW_NULLIFIERS_PER_CALL,\n MAX_PRIVATE_CALL_STACK_LENGTH_PER_CALL, MAX_PUBLIC_CALL_STACK_LENGTH_PER_CALL,\n MAX_PUBLIC_DATA_READS_PER_CALL, MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_CALL,\n MAX_NOTE_HASH_READ_REQUESTS_PER_CALL, MAX_NULLIFIER_READ_REQUESTS_PER_CALL,\n MAX_NULLIFIER_NON_EXISTENT_READ_REQUESTS_PER_CALL, MAX_NULLIFIER_KEY_VALIDATION_REQUESTS_PER_CALL,\n RETURN_VALUES_LENGTH\n},\n contrakt::{storage_read::StorageRead, storage_update_request::StorageUpdateRequest},\n grumpkin_private_key::GrumpkinPrivateKey, header::Header,\n messaging::l2_to_l1_message::L2ToL1Message, utils::reader::Reader, traits::is_empty\n};\n\n// TODO(https://github.com/AztecProtocol/aztec-packages/issues/1165)\n// use dep::std::collections::vec::Vec;\n\n// When finished, one can call .finish() to convert back to the abi\nstruct PrivateContext {\n // docs:start:private-context\n inputs: PrivateContextInputs,\n side_effect_counter: u32,\n\n min_revertible_side_effect_counter: u32,\n\n args_hash : Field,\n return_values : BoundedVec<Field, RETURN_VALUES_LENGTH>,\n\n max_block_number: MaxBlockNumber,\n\n note_hash_read_requests: BoundedVec<SideEffect, MAX_NOTE_HASH_READ_REQUESTS_PER_CALL>,\n nullifier_read_requests: BoundedVec<ReadRequest, MAX_NULLIFIER_READ_REQUESTS_PER_CALL>,\n nullifier_key_validation_requests: BoundedVec<NullifierKeyValidationRequest, MAX_NULLIFIER_KEY_VALIDATION_REQUESTS_PER_CALL>,\n\n new_note_hashes: BoundedVec<SideEffect, MAX_NEW_NOTE_HASHES_PER_CALL>,\n new_nullifiers: BoundedVec<SideEffectLinkedToNoteHash, MAX_NEW_NULLIFIERS_PER_CALL>,\n\n private_call_stack_hashes : BoundedVec<Field, MAX_PRIVATE_CALL_STACK_LENGTH_PER_CALL>,\n public_call_stack_hashes : BoundedVec<Field, MAX_PUBLIC_CALL_STACK_LENGTH_PER_CALL>,\n new_l2_to_l1_msgs : BoundedVec<L2ToL1Message, MAX_NEW_L2_TO_L1_MSGS_PER_CALL>,\n // docs:end:private-context\n\n // Header of a block whose state is used during private execution (not the block the transaction is included in).\n historical_header: Header,\n\n // TODO(https://github.com/AztecProtocol/aztec-packages/issues/1165)\n // encrypted_logs_preimages: Vec<Field>,\n // unencrypted_logs_preimages: Vec<Field>,\n\n nullifier_key: Option<NullifierKeyPair>,\n}\n\nimpl ContextInterface for PrivateContext {\n fn msg_sender(self) -> AztecAddress {\n self.inputs.call_context.msg_sender\n }\n\n fn this_address(self) -> AztecAddress {\n self.inputs.call_context.storage_contract_address\n }\n\n fn this_portal_address(self) -> EthAddress {\n self.inputs.call_context.portal_contract_address\n }\n\n fn chain_id(self) -> Field {\n self.inputs.private_global_variables.chain_id\n }\n\n fn version(self) -> Field {\n self.inputs.private_global_variables.version\n }\n\n fn selector(self) -> FunctionSelector {\n self.inputs.call_context.function_selector\n }\n\n fn get_args_hash(self) -> Field {\n self.args_hash\n }\n\n // Returns the header of a block whose state is used during private execution (not the block the transaction is\n // included in).\n fn get_header(self) -> Header {\n self.historical_header\n }\n\n fn push_new_note_hash(&mut self, note_hash: Field) {\n let side_effect = SideEffect { value: note_hash, counter: self.side_effect_counter };\n self.new_note_hashes.push(side_effect);\n self.side_effect_counter = self.side_effect_counter + 1;\n }\n\n fn push_new_nullifier(&mut self, nullifier: Field, nullified_commitment: Field) {\n let side_effect = SideEffectLinkedToNoteHash { value: nullifier, note_hash: nullified_commitment, counter: self.side_effect_counter };\n self.new_nullifiers.push(side_effect);\n self.side_effect_counter = self.side_effect_counter + 1;\n }\n}\n\nimpl PrivateContext {\n pub fn new(inputs: PrivateContextInputs, args_hash: Field) -> PrivateContext {\n let side_effect_counter = inputs.start_side_effect_counter;\n let mut min_revertible_side_effect_counter = 0;\n if is_empty(inputs.call_context.msg_sender) {\n min_revertible_side_effect_counter = side_effect_counter;\n }\n PrivateContext {\n inputs,\n side_effect_counter,\n min_revertible_side_effect_counter,\n args_hash,\n return_values: BoundedVec::new(),\n max_block_number: MaxBlockNumber::default(),\n note_hash_read_requests: BoundedVec::new(),\n nullifier_read_requests: BoundedVec::new(),\n nullifier_key_validation_requests: BoundedVec::new(),\n new_note_hashes: BoundedVec::new(),\n new_nullifiers: BoundedVec::new(),\n historical_header: inputs.historical_header,\n private_call_stack_hashes: BoundedVec::new(),\n public_call_stack_hashes: BoundedVec::new(),\n new_l2_to_l1_msgs: BoundedVec::new(),\n // TODO(https://github.com/AztecProtocol/aztec-packages/issues/1165)\n // encrypted_logs_preimages: Vec::new(),\n // unencrypted_logs_preimages: Vec::new(),\n nullifier_key: Option::none()\n }\n }\n\n // Returns the header of an arbitrary block whose block number is less than or equal to the block number\n // of historical header.\n pub fn get_header_at(self, block_number: u32) -> Header {\n get_header_at(block_number, self)\n }\n\n pub fn finish(self) -> PrivateCircuitPublicInputs {\n // TODO(https://github.com/AztecProtocol/aztec-packages/issues/1165)\n let encrypted_logs_hash = 0;\n let unencrypted_logs_hash = 0;\n let encrypted_log_preimages_length = 0;\n let unencrypted_log_preimages_length = 0;\n\n let priv_circuit_pub_inputs = PrivateCircuitPublicInputs {\n call_context: self.inputs.call_context,\n args_hash: self.args_hash,\n return_values: self.return_values.storage,\n min_revertible_side_effect_counter: self.min_revertible_side_effect_counter,\n max_block_number: self.max_block_number,\n note_hash_read_requests: self.note_hash_read_requests.storage,\n nullifier_read_requests: self.nullifier_read_requests.storage,\n nullifier_key_validation_requests: self.nullifier_key_validation_requests.storage,\n new_note_hashes: self.new_note_hashes.storage,\n new_nullifiers: self.new_nullifiers.storage,\n private_call_stack_hashes: self.private_call_stack_hashes.storage,\n public_call_stack_hashes: self.public_call_stack_hashes.storage,\n new_l2_to_l1_msgs: self.new_l2_to_l1_msgs.storage,\n start_side_effect_counter: self.inputs.start_side_effect_counter,\n end_side_effect_counter: self.side_effect_counter,\n encrypted_logs_hash,\n unencrypted_logs_hash,\n encrypted_log_preimages_length,\n unencrypted_log_preimages_length,\n historical_header: self.historical_header,\n chain_id: self.inputs.private_global_variables.chain_id,\n version: self.inputs.private_global_variables.version\n };\n priv_circuit_pub_inputs\n }\n\n pub fn capture_min_revertible_side_effect_counter(&mut self) {\n self.min_revertible_side_effect_counter = self.side_effect_counter;\n }\n\n // docs:start:max-block-number\n pub fn request_max_block_number(&mut self, max_block_number: u32) {\n // docs:end:max-block-number\n self.max_block_number = MaxBlockNumber::min_with_u32(self.max_block_number, max_block_number);\n }\n\n pub fn push_note_hash_read_request(&mut self, note_hash: Field) {\n let side_effect = SideEffect { value: note_hash, counter: self.side_effect_counter };\n self.note_hash_read_requests.push(side_effect);\n self.side_effect_counter = self.side_effect_counter + 1;\n }\n\n pub fn push_nullifier_read_request(&mut self, nullifier: Field) {\n let request = ReadRequest { value: nullifier, counter: self.side_effect_counter };\n self.nullifier_read_requests.push(request);\n self.side_effect_counter = self.side_effect_counter + 1;\n }\n\n pub fn request_nullifier_secret_key(&mut self, account: AztecAddress) -> GrumpkinPrivateKey {\n let key_pair = if self.nullifier_key.is_none() {\n let key_pair = get_nullifier_key_pair(account);\n validate_nullifier_key_against_address(account, key_pair.public_key);\n let request = NullifierKeyValidationRequest { public_key: key_pair.public_key, secret_key: key_pair.secret_key };\n self.nullifier_key_validation_requests.push(request);\n self.nullifier_key = Option::some(key_pair);\n key_pair\n } else {\n let key_pair = self.nullifier_key.unwrap_unchecked();\n // If MAX_NULLIFIER_KEY_VALIDATION_REQUESTS_PER_CALL is larger than 1, need to update the way the key pair is cached.\n assert(MAX_NULLIFIER_KEY_VALIDATION_REQUESTS_PER_CALL == 1);\n assert(\n key_pair.account == account, \"Cannot query nullifier key for more than one account per call\"\n );\n key_pair\n };\n key_pair.secret_key\n }\n\n // docs:start:context_message_portal\n pub fn message_portal(&mut self, recipient: EthAddress, content: Field) {\n // docs:end:context_message_portal\n let message = L2ToL1Message { recipient, content };\n self.new_l2_to_l1_msgs.push(message);\n }\n\n // docs:start:context_consume_l1_to_l2_message\n // docs:start:consume_l1_to_l2_message\n pub fn consume_l1_to_l2_message(&mut self, content: Field, secret: Field, sender: EthAddress) {\n // docs:end:context_consume_l1_to_l2_message\n let nullifier = process_l1_to_l2_message(\n self.historical_header.state.l1_to_l2_message_tree.root,\n self.this_address(),\n sender,\n self.chain_id(),\n self.version(),\n content,\n secret\n );\n\n // Push nullifier (and the \"commitment\" corresponding to this can be \"empty\")\n self.push_new_nullifier(nullifier, 0)\n }\n // docs:end:consume_l1_to_l2_message\n\n pub fn accumulate_encrypted_logs<N>(&mut self, log: [Field; N]) {\n let _void1 = self.inputs;\n let _void2 = log;\n // TODO(https://github.com/AztecProtocol/aztec-packages/issues/1165)\n }\n\n pub fn accumulate_unencrypted_logs<T>(&mut self, log: T) {\n let _void1 = self.inputs;\n let _void2 = log;\n // TODO(https://github.com/AztecProtocol/aztec-packages/issues/1165)\n }\n\n pub fn call_private_function<ARGS_COUNT>(\n &mut self,\n contract_address: AztecAddress,\n function_selector: FunctionSelector,\n args: [Field; ARGS_COUNT]\n ) -> [Field; RETURN_VALUES_LENGTH] {\n let args_hash = hash_args_array(args);\n assert(args_hash == arguments::pack_arguments(args));\n self.call_private_function_with_packed_args(contract_address, function_selector, args_hash, false, false)\n }\n\n pub fn static_call_private_function<ARGS_COUNT>(\n &mut self,\n contract_address: AztecAddress,\n function_selector: FunctionSelector,\n args: [Field; ARGS_COUNT]\n ) -> [Field; RETURN_VALUES_LENGTH] {\n let args_hash = hash_args_array(args);\n assert(args_hash == arguments::pack_arguments(args));\n self.call_private_function_with_packed_args(contract_address, function_selector, args_hash, true, false)\n }\n\n pub fn delegate_call_private_function<ARGS_COUNT>(\n &mut self,\n contract_address: AztecAddress,\n function_selector: FunctionSelector,\n args: [Field; ARGS_COUNT]\n ) -> [Field; RETURN_VALUES_LENGTH] {\n let args_hash = hash_args_array(args);\n assert(args_hash == arguments::pack_arguments(args));\n self.call_private_function_with_packed_args(contract_address, function_selector, args_hash, false, true)\n }\n\n pub fn call_private_function_no_args(\n &mut self,\n contract_address: AztecAddress,\n function_selector: FunctionSelector\n ) -> [Field; RETURN_VALUES_LENGTH] {\n self.call_private_function_with_packed_args(contract_address, function_selector, 0, false, false)\n }\n\n pub fn static_call_private_function_no_args(\n &mut self,\n contract_address: AztecAddress,\n function_selector: FunctionSelector\n ) -> [Field; RETURN_VALUES_LENGTH] {\n self.call_private_function_with_packed_args(contract_address, function_selector, 0, true, false)\n }\n\n pub fn delegate_call_private_function_no_args<ARGS_COUNT>(\n &mut self,\n contract_address: AztecAddress,\n function_selector: FunctionSelector\n ) -> [Field; RETURN_VALUES_LENGTH] {\n self.call_private_function_with_packed_args(contract_address, function_selector, 0, false, true)\n }\n\n pub fn call_private_function_with_packed_args(\n &mut self,\n contract_address: AztecAddress,\n function_selector: FunctionSelector,\n args_hash: Field,\n is_static_call: bool,\n is_delegate_call: bool\n ) -> [Field; RETURN_VALUES_LENGTH] {\n let mut is_static_call = is_static_call | self.inputs.call_context.is_static_call;\n let item = call_private_function_internal(\n contract_address,\n function_selector,\n args_hash,\n self.side_effect_counter,\n is_static_call,\n is_delegate_call\n );\n\n assert_eq(item.public_inputs.call_context.side_effect_counter, self.side_effect_counter);\n assert_eq(item.public_inputs.start_side_effect_counter, self.side_effect_counter);\n self.side_effect_counter = item.public_inputs.end_side_effect_counter + 1;\n\n assert(contract_address.eq(item.contract_address));\n assert(function_selector.eq(item.function_data.selector));\n\n assert(args_hash == item.public_inputs.args_hash);\n\n // Assert that the call context of the enqueued call generated by the oracle matches our request.\n assert(item.public_inputs.call_context.is_delegate_call == is_delegate_call);\n assert(item.public_inputs.call_context.is_static_call == is_static_call);\n\n if (is_delegate_call) {\n // For delegate calls, we also constrain the execution context address for the nested call to be equal to our address.\n assert(\n item.public_inputs.call_context.storage_contract_address.eq(self.inputs.call_context.storage_contract_address)\n );\n assert(item.public_inputs.call_context.msg_sender.eq(self.inputs.call_context.msg_sender));\n } else {\n // For non-delegate calls, we also constrain the execution context address for the nested call to be equal to the address we called.\n assert(item.public_inputs.call_context.storage_contract_address.eq(contract_address));\n assert(\n item.public_inputs.call_context.msg_sender.eq(self.inputs.call_context.storage_contract_address)\n );\n }\n\n self.private_call_stack_hashes.push(item.hash());\n\n item.public_inputs.return_values\n }\n\n pub fn call_public_function<ARGS_COUNT>(\n &mut self,\n contract_address: AztecAddress,\n function_selector: FunctionSelector,\n args: [Field; ARGS_COUNT]\n ) {\n let args_hash = hash_args_array(args);\n assert(args_hash == arguments::pack_arguments(args));\n self.call_public_function_with_packed_args(contract_address, function_selector, args_hash, false, false)\n }\n\n pub fn static_call_public_function<ARGS_COUNT>(\n &mut self,\n contract_address: AztecAddress,\n function_selector: FunctionSelector,\n args: [Field; ARGS_COUNT]\n ) {\n let args_hash = hash_args_array(args);\n assert(args_hash == arguments::pack_arguments(args));\n self.call_public_function_with_packed_args(contract_address, function_selector, args_hash, true, false)\n }\n\n pub fn delegate_call_public_function<ARGS_COUNT>(\n &mut self,\n contract_address: AztecAddress,\n function_selector: FunctionSelector,\n args: [Field; ARGS_COUNT]\n ) {\n let args_hash = hash_args_array(args);\n assert(args_hash == arguments::pack_arguments(args));\n self.call_public_function_with_packed_args(contract_address, function_selector, args_hash, false, true)\n }\n\n pub fn call_public_function_no_args(\n &mut self,\n contract_address: AztecAddress,\n function_selector: FunctionSelector\n ) {\n self.call_public_function_with_packed_args(contract_address, function_selector, 0, false, false)\n }\n\n pub fn static_call_public_function_no_args(\n &mut self,\n contract_address: AztecAddress,\n function_selector: FunctionSelector\n ) {\n self.call_public_function_with_packed_args(contract_address, function_selector, 0, true, false)\n }\n\n pub fn delegate_call_public_function_no_args(\n &mut self,\n contract_address: AztecAddress,\n function_selector: FunctionSelector\n ) {\n self.call_public_function_with_packed_args(contract_address, function_selector, 0, false, true)\n }\n\n pub fn call_public_function_with_packed_args(\n &mut self,\n contract_address: AztecAddress,\n function_selector: FunctionSelector,\n args_hash: Field,\n is_static_call: bool,\n is_delegate_call: bool\n ) {\n let mut is_static_call = is_static_call | self.inputs.call_context.is_static_call;\n let fields = enqueue_public_function_call_internal(\n contract_address,\n function_selector,\n args_hash,\n self.side_effect_counter,\n is_static_call,\n is_delegate_call\n );\n\n let mut reader = Reader::new(fields);\n\n // Note: Not using PublicCirclePublicInputs::deserialize here, because everything below args_hash is 0 and\n // there is no more data in fields because there is only ENQUEUE_PUBLIC_FUNCTION_CALL_RETURN_SIZE fields!\n let item = PublicCallStackItem {\n contract_address: AztecAddress::from_field(reader.read()),\n function_data: reader.read_struct(FunctionData::deserialize),\n public_inputs: PublicCircuitPublicInputs {\n call_context: reader.read_struct(CallContext::deserialize),\n args_hash: reader.read(),\n return_values: [0; RETURN_VALUES_LENGTH],\n nullifier_read_requests: [ReadRequest::empty(); MAX_NULLIFIER_READ_REQUESTS_PER_CALL],\n nullifier_non_existent_read_requests: [ReadRequest::empty(); MAX_NULLIFIER_NON_EXISTENT_READ_REQUESTS_PER_CALL],\n contract_storage_update_requests: [StorageUpdateRequest::empty(); MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_CALL],\n contract_storage_reads: [StorageRead::empty(); MAX_PUBLIC_DATA_READS_PER_CALL],\n public_call_stack_hashes: [0; MAX_PUBLIC_CALL_STACK_LENGTH_PER_CALL],\n new_note_hashes: [SideEffect::empty(); MAX_NEW_NOTE_HASHES_PER_CALL],\n new_nullifiers: [SideEffectLinkedToNoteHash::empty(); MAX_NEW_NULLIFIERS_PER_CALL],\n new_l2_to_l1_msgs: [L2ToL1Message::empty(); MAX_NEW_L2_TO_L1_MSGS_PER_CALL],\n start_side_effect_counter: 0,\n end_side_effect_counter: 0,\n unencrypted_logs_hash: 0,\n unencrypted_log_preimages_length: 0,\n historical_header: Header::empty(),\n prover_address: AztecAddress::zero(),\n revert_code: 0\n },\n is_execution_request: true\n };\n reader.finish();\n\n assert(contract_address.eq(item.contract_address));\n assert(function_selector.eq(item.function_data.selector));\n\n assert_eq(item.public_inputs.call_context.side_effect_counter, self.side_effect_counter);\n // We increment the sideffect counter by one, to account for the call itself being a side effect.\n self.side_effect_counter = self.side_effect_counter + 1;\n\n assert(args_hash == item.public_inputs.args_hash);\n\n // Assert that the call context of the enqueued call generated by the oracle matches our request.\n assert(item.public_inputs.call_context.is_delegate_call == is_delegate_call);\n assert(item.public_inputs.call_context.is_static_call == is_static_call);\n\n if (is_delegate_call) {\n // For delegate calls, we also constrain the execution context address for the nested call to be equal to our address.\n assert(\n item.public_inputs.call_context.storage_contract_address.eq(self.inputs.call_context.storage_contract_address)\n );\n assert(item.public_inputs.call_context.msg_sender.eq(self.inputs.call_context.msg_sender));\n } else {\n // For non-delegate calls, we also constrain the execution context address for the nested call to be equal to the address we called.\n assert(item.public_inputs.call_context.storage_contract_address.eq(contract_address));\n assert(\n item.public_inputs.call_context.msg_sender.eq(self.inputs.call_context.storage_contract_address)\n );\n }\n\n self.public_call_stack_hashes.push(item.hash());\n }\n}\n","path":"/usr/src/noir-projects/aztec-nr/aztec/src/context/private_context.nr"},"86":{"source":"use crate::context::{PrivateContext, PublicContext};\nuse crate::oracle;\nuse dep::protocol_types::{address::AztecAddress, grumpkin_point::GrumpkinPoint};\n\npub fn emit_encrypted_log<N>(\n context: &mut PrivateContext,\n contract_address: AztecAddress,\n storage_slot: Field,\n note_type_id: Field,\n encryption_pub_key: GrumpkinPoint,\n log: [Field; N]\n) {\n let _ = oracle::logs::emit_encrypted_log(\n contract_address,\n storage_slot,\n note_type_id,\n encryption_pub_key,\n log\n );\n context.accumulate_encrypted_logs(log);\n}\n\npub fn emit_unencrypted_log<T>(context: &mut PublicContext, log: T) {\n let contract_address = context.this_address();\n let event_selector = 5; // TODO: compute actual event selector.\n let _ = oracle::logs::emit_unencrypted_log(contract_address, event_selector, log);\n // context.accumulate_unencrypted_logs(log);\n}\n\n// TODO: We might want to remove this since emitting unencrypted logs from private functions is violating privacy.\n// --> might be a better approach to force devs to make a public function call that emits the log if needed then\n// it would be less easy to accidentally leak information.\n// If we decide to keep this function around would make sense to wait for traits and then merge it with emit_unencrypted_log.\npub fn emit_unencrypted_log_from_private<T>(context: &mut PrivateContext, log: T) {\n let contract_address = context.this_address();\n let event_selector = 5; // TODO: compute actual event selector.\n let _ = oracle::logs::emit_unencrypted_log(contract_address, event_selector, log);\n // context.accumulate_unencrypted_logs(log);\n}\n","path":"/usr/src/noir-projects/aztec-nr/aztec/src/log.nr"},"105":{"source":"use dep::protocol_types::{address::AztecAddress, grumpkin_point::GrumpkinPoint};\n\n// TODO: Should take encrypted data.\n#[oracle(emitEncryptedLog)]\nfn emit_encrypted_log_oracle<N>(\n _contract_address: AztecAddress,\n _storage_slot: Field,\n _note_type_id: Field,\n _encryption_pub_key: GrumpkinPoint,\n _preimage: [Field; N]\n) -> Field {}\n\nunconstrained pub fn emit_encrypted_log<N>(\n contract_address: AztecAddress,\n storage_slot: Field,\n note_type_id: Field,\n encryption_pub_key: GrumpkinPoint,\n preimage: [Field; N]\n) -> Field {\n emit_encrypted_log_oracle(\n contract_address,\n storage_slot,\n note_type_id,\n encryption_pub_key,\n preimage\n )\n}\n\n#[oracle(emitUnencryptedLog)]\nfn emit_unencrypted_log_oracle<T>(\n _contract_address: AztecAddress,\n _event_selector: Field,\n _message: T\n) -> Field {}\n\nunconstrained pub fn emit_unencrypted_log<T>(\n contract_address: AztecAddress,\n event_selector: Field,\n message: T\n) -> Field {\n // https://github.com/AztecProtocol/aztec-packages/issues/885\n emit_unencrypted_log_oracle(contract_address, event_selector, message)\n}\n","path":"/usr/src/noir-projects/aztec-nr/aztec/src/oracle/logs.nr"},"111":{"source":"use dep::protocol_types::{\n address::{AztecAddress, EthAddress},\n constants::{\n GENERATOR_INDEX__L1_TO_L2_MESSAGE_SECRET, GENERATOR_INDEX__NULLIFIER, ARGS_HASH_CHUNK_COUNT,\n GENERATOR_INDEX__FUNCTION_ARGS, ARGS_HASH_CHUNK_LENGTH\n},\n traits::Hash, hash::{pedersen_hash, silo_nullifier}\n};\n\nuse dep::protocol_types::hash::sha256_to_field;\n\npub fn compute_secret_hash(secret: Field) -> Field {\n // TODO(#1205) This is probably not the right index to use\n pedersen_hash([secret], GENERATOR_INDEX__L1_TO_L2_MESSAGE_SECRET)\n}\n\npub fn compute_message_hash(\n sender: EthAddress,\n chain_id: Field,\n recipient: AztecAddress,\n version: Field,\n content: Field,\n secret_hash: Field\n) -> Field {\n let mut hash_bytes = [0 as u8; 192];\n let sender_bytes = sender.to_field().to_be_bytes(32);\n let chain_id_bytes = chain_id.to_be_bytes(32);\n let recipient_bytes = recipient.to_field().to_be_bytes(32);\n let version_bytes = version.to_be_bytes(32);\n let content_bytes = content.to_be_bytes(32);\n let secret_hash_bytes = secret_hash.to_be_bytes(32);\n\n for i in 0..32 {\n hash_bytes[i] = sender_bytes[i];\n hash_bytes[i + 32] = chain_id_bytes[i];\n hash_bytes[i + 64] = recipient_bytes[i];\n hash_bytes[i + 96] = version_bytes[i];\n hash_bytes[i + 128] = content_bytes[i];\n hash_bytes[i + 160] = secret_hash_bytes[i];\n }\n\n sha256_to_field(hash_bytes)\n}\n\n// The nullifier of a l1 to l2 message is the hash of the message salted with the secret and index of the message hash\n// in the L1 to L2 message tree\npub fn compute_message_nullifier(message_hash: Field, secret: Field, leaf_index: Field) -> Field {\n pedersen_hash(\n [message_hash, secret, leaf_index],\n GENERATOR_INDEX__NULLIFIER\n )\n}\n\npub fn compute_siloed_nullifier(address: AztecAddress, nullifier: Field) -> Field {\n silo_nullifier(address, nullifier)\n}\n\nstruct ArgsHasher {\n fields: [Field],\n}\n\nimpl Hash for ArgsHasher {\n fn hash(self) -> Field {\n hash_args(self.fields)\n }\n}\n\nimpl ArgsHasher {\n pub fn new() -> Self {\n Self { fields: [] }\n }\n\n pub fn add(&mut self, field: Field) {\n self.fields = self.fields.push_back(field);\n }\n\n pub fn add_multiple<N>(&mut self, fields: [Field; N]) {\n for i in 0..N {\n self.fields = self.fields.push_back(fields[i]);\n }\n }\n}\n\npub fn hash_args_array<N>(args: [Field; N]) -> Field {\n hash_args(args.as_slice())\n}\n\npub fn hash_args(args: [Field]) -> Field {\n if args.len() == 0 {\n 0\n } else {\n let mut chunks_hashes = [0; ARGS_HASH_CHUNK_COUNT];\n for i in 0..ARGS_HASH_CHUNK_COUNT {\n let mut chunk_hash = 0;\n let start_chunk_index = i * ARGS_HASH_CHUNK_LENGTH;\n if start_chunk_index < args.len() {\n let mut chunk_args = [0; ARGS_HASH_CHUNK_LENGTH];\n for j in 0..ARGS_HASH_CHUNK_LENGTH {\n let item_index = i * ARGS_HASH_CHUNK_LENGTH + j;\n if item_index < args.len() {\n chunk_args[j] = args[item_index];\n }\n }\n chunk_hash = pedersen_hash(chunk_args, GENERATOR_INDEX__FUNCTION_ARGS);\n }\n chunks_hashes[i] = chunk_hash;\n }\n pedersen_hash(chunks_hashes, GENERATOR_INDEX__FUNCTION_ARGS)\n }\n}\n\n#[test]\nfn compute_var_args_hash() {\n let mut input = ArgsHasher::new();\n for i in 0..800 {\n input.add(i as Field);\n }\n let hash = input.hash();\n assert(hash == 0x05a1023fef839ac88731f49ae983e172c1b600a3c8f3393ad0ac25d819ac0f0f);\n}\n","path":"/usr/src/noir-projects/aztec-nr/aztec/src/hash.nr"},"144":{"source":"use crate::{\n address::{eth_address::EthAddress, aztec_address::AztecAddress},\n constants::GENERATOR_INDEX__PARTIAL_ADDRESS, hash::pedersen_hash, traits::ToField\n};\n\n// Salted initialization hash. Used in the computation of a partial address.\nstruct SaltedInitializationHash {\n inner: Field\n}\n\nimpl ToField for SaltedInitializationHash {\n fn to_field(self) -> Field {\n self.inner\n }\n}\n\nimpl SaltedInitializationHash {\n pub fn from_field(field: Field) -> Self {\n Self { inner: field }\n }\n\n pub fn compute(\n salt: Field,\n initialization_hash: Field,\n portal_contract_address: EthAddress,\n deployer: AztecAddress\n ) -> Self {\n SaltedInitializationHash::from_field(\n pedersen_hash(\n [\n salt,\n initialization_hash,\n deployer.to_field(),\n portal_contract_address.to_field()\n ],\n GENERATOR_INDEX__PARTIAL_ADDRESS\n )\n )\n }\n\n pub fn assert_is_zero(self) {\n assert(self.to_field() == 0);\n }\n}\n","path":"/usr/src/noir-projects/noir-protocol-circuits/crates/types/src/address/salted_initialization_hash.nr"},"145":{"source":"use crate::{\n address::{\n eth_address::EthAddress, salted_initialization_hash::SaltedInitializationHash,\n aztec_address::AztecAddress\n},\n constants::GENERATOR_INDEX__PARTIAL_ADDRESS, contract_class_id::ContractClassId,\n hash::pedersen_hash, traits::ToField\n};\n\n// Partial address\nstruct PartialAddress {\n inner : Field\n}\n\nimpl ToField for PartialAddress {\n fn to_field(self) -> Field {\n self.inner\n }\n}\n\nimpl PartialAddress {\n pub fn from_field(field: Field) -> Self {\n Self { inner: field }\n }\n\n pub fn compute(\n contract_class_id: ContractClassId,\n salt: Field,\n initialization_hash: Field,\n portal_contract_address: EthAddress,\n deployer: AztecAddress\n ) -> Self {\n PartialAddress::compute_from_salted_initialization_hash(\n contract_class_id,\n SaltedInitializationHash::compute(salt, initialization_hash, portal_contract_address, deployer)\n )\n }\n\n pub fn compute_from_salted_initialization_hash(\n contract_class_id: ContractClassId,\n salted_initialization_hash: SaltedInitializationHash\n ) -> Self {\n PartialAddress::from_field(\n pedersen_hash(\n [\n contract_class_id.to_field(),\n salted_initialization_hash.to_field()\n ],\n GENERATOR_INDEX__PARTIAL_ADDRESS\n )\n )\n }\n\n pub fn to_field(self) -> Field {\n self.inner\n }\n\n pub fn assert_is_zero(self) {\n assert(self.to_field() == 0);\n }\n}\n","path":"/usr/src/noir-projects/noir-protocol-circuits/crates/types/src/address/partial_address.nr"},"147":{"source":"use crate::{\n crate::address::{eth_address::EthAddress, partial_address::PartialAddress, public_keys_hash::PublicKeysHash},\n constants::{AZTEC_ADDRESS_LENGTH, GENERATOR_INDEX__CONTRACT_ADDRESS},\n contract_class_id::ContractClassId, hash::pedersen_hash, grumpkin_point::GrumpkinPoint,\n traits::{Empty, ToField, Serialize, Deserialize}, utils\n};\n\n// Aztec address\nstruct AztecAddress {\n inner : Field\n}\n\nimpl Eq for AztecAddress {\n fn eq(self, other : Self) -> bool {\n self.to_field() == other.to_field()\n }\n}\n\nimpl Empty for AztecAddress {\n fn empty() -> Self {\n Self {\n inner : 0\n }\n }\n}\n\nimpl ToField for AztecAddress {\n fn to_field(self) -> Field {\n self.inner\n }\n}\n\nimpl Serialize<AZTEC_ADDRESS_LENGTH> for AztecAddress {\n fn serialize(self: Self) -> [Field; AZTEC_ADDRESS_LENGTH] {\n [self.to_field()]\n }\n}\n\nimpl Deserialize<AZTEC_ADDRESS_LENGTH> for AztecAddress {\n fn deserialize(fields: [Field; AZTEC_ADDRESS_LENGTH]) -> Self {\n AztecAddress::from_field(fields[0])\n }\n}\n\nimpl AztecAddress {\n pub fn zero() -> Self {\n Self { inner: 0 }\n }\n\n pub fn from_field(field: Field) -> Self {\n Self { inner: field }\n }\n\n pub fn compute_from_public_key(\n pub_key: GrumpkinPoint,\n contract_class_id: ContractClassId,\n salt: Field,\n initialization_hash: Field,\n portal_contract_address: EthAddress,\n deployer: AztecAddress\n ) -> AztecAddress {\n AztecAddress::compute(\n PublicKeysHash::compute(pub_key),\n PartialAddress::compute(\n contract_class_id,\n salt,\n initialization_hash,\n portal_contract_address,\n deployer\n )\n )\n }\n\n pub fn compute(pub_keys_hash: PublicKeysHash, partial_address: PartialAddress) -> AztecAddress {\n AztecAddress::from_field(\n pedersen_hash(\n [pub_keys_hash.to_field(), partial_address.to_field()],\n GENERATOR_INDEX__CONTRACT_ADDRESS\n )\n )\n }\n\n pub fn is_zero(self) -> bool {\n self.inner == 0\n }\n\n pub fn assert_is_zero(self) {\n assert(self.to_field() == 0);\n }\n\n pub fn conditional_assign(predicate: bool, lhs: Self, rhs: Self) -> Self {\n let result = utils::conditional_assign(predicate, rhs.to_field(), lhs.to_field());\n Self { inner: result }\n }\n}\n\n#[test]\nfn compute_address() {\n let point = GrumpkinPoint { x: 1, y: 2 };\n let contract_address_salt = 3;\n let contract_class_id = ContractClassId::from_field(4);\n let initialization_hash = 5;\n let portal_contract_address = EthAddress::from_field(6);\n let deployer = AztecAddress::from_field(7);\n\n let address = AztecAddress::compute_from_public_key(\n point,\n contract_class_id,\n contract_address_salt,\n initialization_hash,\n portal_contract_address,\n deployer\n );\n\n let expected_computed_address_from_preimage = 0x027ea2b41ced2ec9a98305984e96dd28518536a4628883ccdc06e38aa8997220;\n assert(address.to_field() == expected_computed_address_from_preimage);\n}\n\n#[test]\nfn compute_address_from_partial_and_pubkey() {\n let point = GrumpkinPoint { x: 1, y: 2 };\n let partial_address = PartialAddress::from_field(3);\n\n let address = AztecAddress::compute(PublicKeysHash::compute(point), partial_address);\n let expected_computed_address_from_partial_and_pubkey = 0x0447f893197175723deb223696e2e96dbba1e707ee8507766373558877e74197;\n assert(address.to_field() == expected_computed_address_from_partial_and_pubkey);\n}\n","path":"/usr/src/noir-projects/noir-protocol-circuits/crates/types/src/address/aztec_address.nr"},"152":{"source":"use dep::std::cmp::Eq;\n\n// Trait: is_empty\n//\n// The general is_empty trait checks if a data type is is empty,\n// and it defines empty for the basic data types as 0.\n//\n// If a Field is equal to zero, then it is regarded as zero.\n// We will go with this definition for now, however it can be problematic \n// if a value can actually be zero. In a future refactor, we can \n// use the optional type for safety. Doing it now would lead to a worse devex\n// and would make it harder to sync up with the cpp code.\n// Preferred over Default trait to convey intent, as default doesn't necessarily mean empty.\ntrait Empty {\n fn empty() -> Self;\n}\n\nimpl Empty for Field { fn empty() -> Self {0} }\n\nimpl Empty for u1 { fn empty() -> Self {0} }\nimpl Empty for u8 { fn empty() -> Self {0} }\nimpl Empty for u32 { fn empty() -> Self {0} }\nimpl Empty for u64 { fn empty() -> Self {0} }\nimpl Empty for U128 { fn empty() -> Self {U128::from_integer(0)} }\n\npub fn is_empty<T>(item: T) -> bool where T: Empty + Eq {\n item.eq(T::empty())\n}\n\npub fn is_empty_array<T, N>(array: [T; N]) -> bool where T: Empty + Eq {\n array.all(|elem| is_empty(elem))\n}\n\ntrait Hash {\n fn hash(self) -> Field;\n}\n\ntrait ToField {\n fn to_field(self) -> Field;\n}\n\nimpl ToField for Field {\n fn to_field(self) -> Field {\n self\n }\n}\n\nimpl ToField for bool { fn to_field(self) -> Field { self as Field } }\nimpl ToField for u1 { fn to_field(self) -> Field { self as Field } }\nimpl ToField for u8 { fn to_field(self) -> Field { self as Field } }\nimpl ToField for u32 { fn to_field(self) -> Field { self as Field } }\nimpl ToField for u64 { fn to_field(self) -> Field { self as Field } }\nimpl ToField for U128 {\n fn to_field(self) -> Field {\n self.to_integer()\n }\n}\n\ntrait FromField {\n fn from_field(value: Field) -> Self;\n}\n\nimpl FromField for Field {\n fn from_field(value: Field) -> Self {\n value\n }\n}\n\nimpl FromField for bool { fn from_field(value: Field) -> Self { value as bool } }\nimpl FromField for u1 { fn from_field(value: Field) -> Self { value as u1 } }\nimpl FromField for u8 { fn from_field(value: Field) -> Self { value as u8 } }\nimpl FromField for u32 { fn from_field(value: Field) -> Self { value as u32 } }\nimpl FromField for u64 { fn from_field(value: Field) -> Self { value as u64 } }\nimpl FromField for U128 {\n fn from_field(value: Field) -> Self {\n U128::from_integer(value)\n }\n}\n\n// docs:start:serialize\ntrait Serialize<N> {\n fn serialize(self) -> [Field; N];\n}\n// docs:end:serialize\n\n// docs:start:deserialize\ntrait Deserialize<N> {\n fn deserialize(fields: [Field; N]) -> Self;\n}\n// docs:end:deserialize\n","path":"/usr/src/noir-projects/noir-protocol-circuits/crates/types/src/traits.nr"},"198":{"source":"// Utility function to console.log data in the acir simulator\n// WARNING: sometimes when using debug logs the ACVM errors with: `thrown: \"solver opcode resolution error: cannot solve opcode: expression has too many unknowns x155\"`\n\n#[oracle(debugLog)]\nfn debug_log_oracle<T, N>(_msg: T, _num_args: Field) -> Field {}\n#[oracle(debugLog)]\nfn debug_log_format_oracle<T, N>(_msg: T, _args: [Field; N], _num_args: Field) -> Field {}\n#[oracle(debugLog)]\nfn debug_log_field_oracle(_field: Field) -> Field {}\n#[oracle(debugLog)]\nfn debug_log_array_oracle<T, N>(_arbitrary_array: [T; N]) -> Field {}\n#[oracle(debugLogWithPrefix)]\nfn debug_log_array_with_prefix_oracle<S, T, N>(_prefix: S, _arbitrary_array: [T; N]) -> Field {}\n\n/// NOTE: call this with a str<N> msg of length > 1\n/// Example:\n/// `debug_log(\"blah blah this is a debug string\");`\nunconstrained pub fn debug_log<T>(msg: T) {\n assert(debug_log_oracle(msg, 0) == 0);\n}\n\n/// NOTE: call this with a str<N> msg of form\n/// \"some string with {0} and {1} ... {N}\"\n/// and an array of N field which will be formatted\n/// into the string in the simulator.\n/// Example:\n/// debug_log_format(\"get_2(slot:{0}) =>\\n\\t0:{1}\\n\\t1:{2}\", [storage_slot, note0_hash, note1_hash]);\nunconstrained pub fn debug_log_format<T, N>(msg: T, args: [Field; N]) {\n assert(debug_log_format_oracle(msg, args, args.len() as Field) == 0);\n}\n\n/// Example:\n/// `debug_log_field(my_field);`\nunconstrained pub fn debug_log_field(field: Field) {\n assert(debug_log_field_oracle(field) == 0);\n}\n\n/// Example:\n/// `debug_log_array(my_array);`\nunconstrained fn debug_log_array<T, N>(arbitrary_array: [T; N]) {\n assert(debug_log_array_oracle(arbitrary_array) == 0);\n}\n\n/// Example:\n/// `debug_log_array_with_prefix(\"Prefix\", my_array);`\nunconstrained pub fn debug_log_array_with_prefix<S, T, N>(prefix: S, arbitrary_array: [T; N]) {\n assert(debug_log_array_with_prefix_oracle(prefix, arbitrary_array) == 0);\n}\n","path":"/usr/src/noir-projects/noir-protocol-circuits/crates/types/src/debug_log.nr"},"199":{"source":"use crate::address::{AztecAddress, EthAddress};\nuse crate::mocked::VerificationKey;\nuse crate::abis::function_selector::FunctionSelector;\nuse crate::abis::contract_class_function_leaf_preimage::ContractClassFunctionLeafPreimage;\nuse crate::contract_class_id::ContractClassId;\nuse crate::utils::{uint256::U256, field::field_from_bytes_32_trunc};\nuse crate::constants::{\n FUNCTION_TREE_HEIGHT, GENERATOR_INDEX__SILOED_NOTE_HASH, GENERATOR_INDEX__OUTER_NULLIFIER,\n GENERATOR_INDEX__VK, GENERATOR_INDEX__CONSTRUCTOR, GENERATOR_INDEX__PARTIAL_ADDRESS,\n GENERATOR_INDEX__CONTRACT_ADDRESS, GENERATOR_INDEX__NOTE_HASH_NONCE,\n GENERATOR_INDEX__UNIQUE_NOTE_HASH\n};\nuse crate::traits::Hash;\nuse crate::messaging::l2_to_l1_message::L2ToL1Message;\nuse crate::merkle_tree::root::root_from_sibling_path;\nuse dep::std::hash::{pedersen_hash_with_separator, sha256};\n\npub fn sha256_to_field<N>(bytes_to_hash: [u8; N]) -> Field {\n let sha256_hashed = sha256(bytes_to_hash);\n let hash_in_a_field = field_from_bytes_32_trunc(sha256_hashed);\n\n hash_in_a_field\n}\n\npub fn private_functions_root_from_siblings(\n selector: FunctionSelector,\n vk_hash: Field,\n function_leaf_index: Field,\n function_leaf_sibling_path: [Field; FUNCTION_TREE_HEIGHT]\n) -> Field {\n let function_leaf_preimage = ContractClassFunctionLeafPreimage { selector, vk_hash };\n let function_leaf = function_leaf_preimage.hash();\n root_from_sibling_path(function_leaf, function_leaf_index, function_leaf_sibling_path)\n}\n\npub fn silo_note_hash(address: AztecAddress, inner_commitment: Field) -> Field {\n pedersen_hash(\n [\n address.to_field(),\n inner_commitment\n ],\n GENERATOR_INDEX__SILOED_NOTE_HASH\n )\n}\n\npub fn silo_nullifier(address: AztecAddress, nullifier: Field) -> Field {\n pedersen_hash(\n [\n address.to_field(),\n nullifier\n ],\n GENERATOR_INDEX__OUTER_NULLIFIER\n )\n}\n\npub fn merkle_hash(left: Field, right: Field) -> Field {\n pedersen_hash([left, right], 0)\n}\n\npub fn stdlib_recursion_verification_key_compress_native_vk(_vk: VerificationKey) -> Field {\n // Original cpp code\n // stdlib::recursion::verification_key<CT::bn254>::compress_native(private_call.vk, GeneratorIndex::VK);\n // The above cpp method is only ever called on verification key, so it has been special cased here\n let _hash_index = GENERATOR_INDEX__VK;\n 0\n}\n\npub fn compute_l2_to_l1_hash(\n contract_address: AztecAddress,\n rollup_version_id: Field,\n chain_id: Field,\n message: L2ToL1Message\n) -> Field {\n let mut bytes: BoundedVec<u8, 160> = BoundedVec::new();\n\n let inputs = [\n contract_address.to_field(), rollup_version_id, message.recipient.to_field(), chain_id, message.content\n ];\n for i in 0..inputs.len() {\n // TODO are bytes be in fr.to_buffer() ?\n let item_bytes = inputs[i].to_be_bytes(32);\n for j in 0..32 {\n bytes.push(item_bytes[j]);\n }\n }\n\n sha256_to_field(bytes.storage)\n}\n\n// Computes sha256 hash of 2 input hashes.\n//\n// NB: This method now takes in two 31 byte fields - it assumes that any input\n// is the result of a sha_to_field hash and => is truncated\n//\n// TODO(Jan and David): This is used for the encrypted_log hashes.\n// Can we check to see if we can just use hash_to_field or pedersen_compress here?\n//\npub fn accumulate_sha256(input: [Field; 2]) -> Field {\n // This is a note about the cpp code, since it takes an array of Fields\n // instead of a U128.\n // 4 Field elements when converted to bytes will usually \n // occupy 4 * 32 = 128 bytes.\n // However, this function is making the assumption that each Field \n // only occupies 128 bits.\n //\n // TODO(David): This does not seem to be getting guaranteed anywhere in the code?\n\n // Concatentate two fields into 32x2 = 64 bytes\n // accumulate_sha256 assumes that the inputs are pre-truncated 31 byte numbers\n let mut hash_input_flattened = [0; 64];\n for offset in 0..input.len() {\n let input_as_bytes = input[offset].to_be_bytes(32);\n for byte_index in 0..32 {\n hash_input_flattened[offset * 32 + byte_index] = input_as_bytes[byte_index];\n }\n }\n\n sha256_to_field(hash_input_flattened)\n}\n\npub fn compute_logs_hash(previous_log_hash: Field, current_log_hash: Field) -> Field {\n accumulate_sha256(\n [\n previous_log_hash,\n current_log_hash\n ]\n )\n}\n\npub fn compute_note_hash_nonce(first_nullifier: Field, commitment_index: u64) -> Field {\n pedersen_hash(\n [\n first_nullifier,\n commitment_index as Field\n ],\n GENERATOR_INDEX__NOTE_HASH_NONCE\n )\n}\n\npub fn compute_unique_siloed_note_hash(nonce: Field, siloed_note_hash: Field) -> Field {\n pedersen_hash(\n [\n nonce,\n siloed_note_hash\n ],\n GENERATOR_INDEX__UNIQUE_NOTE_HASH\n )\n}\n\npub fn pedersen_hash<N>(inputs: [Field; N], hash_index: u32) -> Field {\n dep::std::hash::pedersen_hash_with_separator(inputs, hash_index)\n}\n\n#[test]\nfn smoke_sha256_to_field() {\n let full_buffer = [\n 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,\n 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,\n 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,\n 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,\n 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99,\n 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119,\n 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139,\n 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159\n ];\n let result = sha256_to_field(full_buffer);\n\n assert(result == 0x448ebbc9e1a31220a2f3830c18eef61b9bd070e5084b7fa2a359fe729184c7);\n\n // to show correctness of the current ver (truncate one byte) vs old ver (mod full bytes):\n let result_bytes = sha256(full_buffer);\n let truncated_field = crate::utils::field::field_from_bytes_32_trunc(result_bytes);\n assert(truncated_field == result);\n let mod_res = result + (result_bytes[31] as Field);\n assert(mod_res == 0x448ebbc9e1a31220a2f3830c18eef61b9bd070e5084b7fa2a359fe729184e0);\n}\n\n#[test]\nfn compute_l2_l1_hash() {\n // All zeroes\n let hash_result = compute_l2_to_l1_hash(AztecAddress::from_field(0), 0, 0, L2ToL1Message::empty());\n assert(hash_result == 0xb393978842a0fa3d3e1470196f098f473f9678e72463cb65ec4ab5581856c2);\n\n // Non-zero case\n let message = L2ToL1Message { recipient: EthAddress::from_field(3), content: 5 };\n let hash_result = compute_l2_to_l1_hash(AztecAddress::from_field(1), 2, 4, message);\n assert(hash_result == 0x3f88c1044a05e5340ed20466276500f6d45ca5603913b9091e957161734e16);\n}\n","path":"/usr/src/noir-projects/noir-protocol-circuits/crates/types/src/hash.nr"},"254":{"source":"mod events;\n\ncontract ContractInstanceDeployer {\n use dep::aztec::protocol_types::{\n address::{AztecAddress, EthAddress, PublicKeysHash, PartialAddress},\n contract_class_id::ContractClassId, constants::DEPLOYER_CONTRACT_INSTANCE_DEPLOYED_MAGIC_VALUE,\n traits::Serialize\n };\n\n use dep::aztec::log::{emit_unencrypted_log, emit_unencrypted_log_from_private};\n\n use crate::events::{instance_deployed::ContractInstanceDeployed};\n\n #[aztec(private)]\n fn deploy(\n salt: Field,\n contract_class_id: ContractClassId,\n initialization_hash: Field,\n portal_contract_address: EthAddress,\n public_keys_hash: PublicKeysHash,\n universal_deploy: bool\n ) {\n // TODO(@spalladino): assert nullifier_exists silo(contract_class_id, ContractClassRegisterer)\n\n let deployer = if universal_deploy {\n AztecAddress::zero()\n } else {\n context.msg_sender()\n };\n\n let partial_address = PartialAddress::compute(\n contract_class_id,\n salt,\n initialization_hash,\n portal_contract_address,\n deployer\n );\n\n let address = AztecAddress::compute(public_keys_hash, partial_address);\n\n // Emit the address as a nullifier to be able to prove that this instance has been (not) deployed\n context.push_new_nullifier(address.to_field(), 0);\n\n // Broadcast the event\n let event = ContractInstanceDeployed {\n contract_class_id,\n address,\n public_keys_hash,\n portal_contract_address,\n initialization_hash,\n salt,\n deployer,\n version: 1\n };\n let event_payload = event.serialize();\n dep::aztec::oracle::debug_log::debug_log_array_with_prefix(\"ContractInstanceDeployed\", event_payload);\n emit_unencrypted_log_from_private(&mut context, event_payload);\n }\n}\n","path":"/usr/src/noir-projects/noir-contracts/contracts/contract_instance_deployer_contract/src/main.nr"}}}
|
|
1
|
+
{"noir_version":"0.26.0+425566d21af1be0580432962b7065cb172e5eb16","name":"ContractInstanceDeployer","functions":[{"name":"compute_note_hash_and_nullifier","is_unconstrained":true,"custom_attributes":[],"abi":{"parameters":[{"name":"contract_address","type":{"kind":"struct","path":"aztec::protocol_types::address::aztec_address::AztecAddress","fields":[{"name":"inner","type":{"kind":"field"}}]},"visibility":"private"},{"name":"nonce","type":{"kind":"field"},"visibility":"private"},{"name":"storage_slot","type":{"kind":"field"},"visibility":"private"},{"name":"note_type_id","type":{"kind":"field"},"visibility":"private"},{"name":"serialized_note","type":{"kind":"array","length":20,"type":{"kind":"field"}},"visibility":"private"}],"param_witnesses":{"contract_address":[{"start":0,"end":1}],"nonce":[{"start":1,"end":2}],"note_type_id":[{"start":3,"end":4}],"serialized_note":[{"start":4,"end":24}],"storage_slot":[{"start":2,"end":3}]},"return_type":{"abi_type":{"kind":"array","length":4,"type":{"kind":"field"}},"visibility":"public"},"return_witnesses":[24,25,26,27]},"bytecode":"H4sIAAAAAAAA/+2YzW7CMAyA0xL6B+3+2PiZtPW4YytxmHbqQ+wFEKs0LjDRbo8/rYZYNWHsMvdgCUtR0jQ4n+2SOHHUXu6b4ph2ryl9dSz4vjB19j/JGXVlXXI6QjhdIZw9Rk5gG6luv1PdgV+5GfsCGD0BjL4AxkAAYyiAMRLAOBDAOBTAGAtgTAQwXghgvBTAeCWA8VoA440AxpEAxlsBjHcCGMeMjA5h1KY9acq0KTO1P7O/mP5AtVJwMczzJeTsOPlEHQrkJi4+6Lavh9ykD/ld0od3DD3d2uCx25DNQa/PrdfkZuh3j/jEs2ICc89In2a3MX8OiD/Z9Gad+W73baN/8Ozqk2f0VWjajHcwOZ3bMSUkcyoTI2xPyVgch/5wSYxBIM/E+Id//E5bv0vIGO8X+wvFa79v8fgWc98wgUCuMtGtX2w2zvsx0Bvx6z2IubZiEpF+HPNo6kvTN+SPw5yuH4rYTKUg7SHx/YCfJ+/Izl1MY6PrW/GuIYnlq8DyVULGxMR/SQf+c8i8qJtygJyZz8ynmAfq8D+OffQ91q5lC827cHyojtcTVoNwQpoYOgYO3sGCChsJbGi+ajeNiBgbG2C4WIDFFjYbOHjCwQ4OTnAwgcR/TOY4lQzThBnlwdRPpn59X1XpcrOut4tlnb5tyipdb+r0syrTj+3qa1GX8FxW6ge2C+5aGhsAAA==","debug_symbols":"nZBLCoAgFEX38sYS0j+3Eg1eZSCIiloQ4t5TogXk7H44kxNA6g290MoBC0Crugc2B3AGVR6cR+uB1WNHgKs9pYlGAoeQPOWujQvJ0FACjSXQVAA19CeU2oVW4Cp51pLPU22fpVT9bd4nPg=="},{"name":"deploy","is_unconstrained":false,"custom_attributes":["aztec(private)"],"abi":{"parameters":[{"name":"inputs","type":{"kind":"struct","path":"aztec::context::inputs::private_context_inputs::PrivateContextInputs","fields":[{"name":"call_context","type":{"kind":"struct","path":"aztec::protocol_types::abis::call_context::CallContext","fields":[{"name":"msg_sender","type":{"kind":"struct","path":"aztec::protocol_types::address::aztec_address::AztecAddress","fields":[{"name":"inner","type":{"kind":"field"}}]}},{"name":"storage_contract_address","type":{"kind":"struct","path":"aztec::protocol_types::address::aztec_address::AztecAddress","fields":[{"name":"inner","type":{"kind":"field"}}]}},{"name":"portal_contract_address","type":{"kind":"struct","path":"aztec::protocol_types::address::eth_address::EthAddress","fields":[{"name":"inner","type":{"kind":"field"}}]}},{"name":"function_selector","type":{"kind":"struct","path":"aztec::protocol_types::abis::function_selector::FunctionSelector","fields":[{"name":"inner","type":{"kind":"integer","sign":"unsigned","width":32}}]}},{"name":"is_delegate_call","type":{"kind":"boolean"}},{"name":"is_static_call","type":{"kind":"boolean"}},{"name":"side_effect_counter","type":{"kind":"integer","sign":"unsigned","width":32}}]}},{"name":"historical_header","type":{"kind":"struct","path":"aztec::protocol_types::header::Header","fields":[{"name":"last_archive","type":{"kind":"struct","path":"aztec::protocol_types::abis::append_only_tree_snapshot::AppendOnlyTreeSnapshot","fields":[{"name":"root","type":{"kind":"field"}},{"name":"next_available_leaf_index","type":{"kind":"integer","sign":"unsigned","width":32}}]}},{"name":"content_commitment","type":{"kind":"struct","path":"aztec::protocol_types::content_commitment::ContentCommitment","fields":[{"name":"tx_tree_height","type":{"kind":"field"}},{"name":"txs_effects_hash","type":{"kind":"field"}},{"name":"in_hash","type":{"kind":"field"}},{"name":"out_hash","type":{"kind":"field"}}]}},{"name":"state","type":{"kind":"struct","path":"aztec::protocol_types::state_reference::StateReference","fields":[{"name":"l1_to_l2_message_tree","type":{"kind":"struct","path":"aztec::protocol_types::abis::append_only_tree_snapshot::AppendOnlyTreeSnapshot","fields":[{"name":"root","type":{"kind":"field"}},{"name":"next_available_leaf_index","type":{"kind":"integer","sign":"unsigned","width":32}}]}},{"name":"partial","type":{"kind":"struct","path":"aztec::protocol_types::partial_state_reference::PartialStateReference","fields":[{"name":"note_hash_tree","type":{"kind":"struct","path":"aztec::protocol_types::abis::append_only_tree_snapshot::AppendOnlyTreeSnapshot","fields":[{"name":"root","type":{"kind":"field"}},{"name":"next_available_leaf_index","type":{"kind":"integer","sign":"unsigned","width":32}}]}},{"name":"nullifier_tree","type":{"kind":"struct","path":"aztec::protocol_types::abis::append_only_tree_snapshot::AppendOnlyTreeSnapshot","fields":[{"name":"root","type":{"kind":"field"}},{"name":"next_available_leaf_index","type":{"kind":"integer","sign":"unsigned","width":32}}]}},{"name":"public_data_tree","type":{"kind":"struct","path":"aztec::protocol_types::abis::append_only_tree_snapshot::AppendOnlyTreeSnapshot","fields":[{"name":"root","type":{"kind":"field"}},{"name":"next_available_leaf_index","type":{"kind":"integer","sign":"unsigned","width":32}}]}}]}}]}},{"name":"global_variables","type":{"kind":"struct","path":"aztec::protocol_types::abis::global_variables::GlobalVariables","fields":[{"name":"chain_id","type":{"kind":"field"}},{"name":"version","type":{"kind":"field"}},{"name":"block_number","type":{"kind":"field"}},{"name":"timestamp","type":{"kind":"integer","sign":"unsigned","width":64}},{"name":"coinbase","type":{"kind":"struct","path":"aztec::protocol_types::address::eth_address::EthAddress","fields":[{"name":"inner","type":{"kind":"field"}}]}},{"name":"fee_recipient","type":{"kind":"struct","path":"aztec::protocol_types::address::aztec_address::AztecAddress","fields":[{"name":"inner","type":{"kind":"field"}}]}}]}}]}},{"name":"private_global_variables","type":{"kind":"struct","path":"aztec::context::globals::private_global_variables::PrivateGlobalVariables","fields":[{"name":"chain_id","type":{"kind":"field"}},{"name":"version","type":{"kind":"field"}}]}},{"name":"start_side_effect_counter","type":{"kind":"integer","sign":"unsigned","width":32}}]},"visibility":"private"},{"name":"salt","type":{"kind":"field"},"visibility":"private"},{"name":"contract_class_id","type":{"kind":"struct","path":"aztec::protocol_types::contract_class_id::ContractClassId","fields":[{"name":"inner","type":{"kind":"field"}}]},"visibility":"private"},{"name":"initialization_hash","type":{"kind":"field"},"visibility":"private"},{"name":"portal_contract_address","type":{"kind":"struct","path":"aztec::protocol_types::address::eth_address::EthAddress","fields":[{"name":"inner","type":{"kind":"field"}}]},"visibility":"private"},{"name":"public_keys_hash","type":{"kind":"struct","path":"aztec::protocol_types::address::public_keys_hash::PublicKeysHash","fields":[{"name":"inner","type":{"kind":"field"}}]},"visibility":"private"},{"name":"universal_deploy","type":{"kind":"boolean"},"visibility":"private"}],"param_witnesses":{"contract_class_id":[{"start":31,"end":32}],"initialization_hash":[{"start":32,"end":33}],"inputs":[{"start":0,"end":30}],"portal_contract_address":[{"start":33,"end":34}],"public_keys_hash":[{"start":34,"end":35}],"salt":[{"start":30,"end":31}],"universal_deploy":[{"start":35,"end":36}]},"return_type":{"abi_type":{"kind":"struct","path":"aztec::protocol_types::abis::private_circuit_public_inputs::PrivateCircuitPublicInputs","fields":[{"name":"call_context","type":{"kind":"struct","path":"aztec::protocol_types::abis::call_context::CallContext","fields":[{"name":"msg_sender","type":{"kind":"struct","path":"aztec::protocol_types::address::aztec_address::AztecAddress","fields":[{"name":"inner","type":{"kind":"field"}}]}},{"name":"storage_contract_address","type":{"kind":"struct","path":"aztec::protocol_types::address::aztec_address::AztecAddress","fields":[{"name":"inner","type":{"kind":"field"}}]}},{"name":"portal_contract_address","type":{"kind":"struct","path":"aztec::protocol_types::address::eth_address::EthAddress","fields":[{"name":"inner","type":{"kind":"field"}}]}},{"name":"function_selector","type":{"kind":"struct","path":"aztec::protocol_types::abis::function_selector::FunctionSelector","fields":[{"name":"inner","type":{"kind":"integer","sign":"unsigned","width":32}}]}},{"name":"is_delegate_call","type":{"kind":"boolean"}},{"name":"is_static_call","type":{"kind":"boolean"}},{"name":"side_effect_counter","type":{"kind":"integer","sign":"unsigned","width":32}}]}},{"name":"args_hash","type":{"kind":"field"}},{"name":"return_values","type":{"kind":"array","length":4,"type":{"kind":"field"}}},{"name":"min_revertible_side_effect_counter","type":{"kind":"integer","sign":"unsigned","width":32}},{"name":"max_block_number","type":{"kind":"struct","path":"aztec::protocol_types::abis::max_block_number::MaxBlockNumber","fields":[{"name":"_opt","type":{"kind":"struct","path":"std::option::Option","fields":[{"name":"_is_some","type":{"kind":"boolean"}},{"name":"_value","type":{"kind":"integer","sign":"unsigned","width":32}}]}}]}},{"name":"note_hash_read_requests","type":{"kind":"array","length":32,"type":{"kind":"struct","path":"aztec::protocol_types::abis::side_effect::SideEffect","fields":[{"name":"value","type":{"kind":"field"}},{"name":"counter","type":{"kind":"integer","sign":"unsigned","width":32}}]}}},{"name":"nullifier_read_requests","type":{"kind":"array","length":2,"type":{"kind":"struct","path":"aztec::protocol_types::abis::read_request::ReadRequest","fields":[{"name":"value","type":{"kind":"field"}},{"name":"counter","type":{"kind":"integer","sign":"unsigned","width":32}}]}}},{"name":"nullifier_key_validation_requests","type":{"kind":"array","length":1,"type":{"kind":"struct","path":"aztec::protocol_types::abis::nullifier_key_validation_request::NullifierKeyValidationRequest","fields":[{"name":"public_key","type":{"kind":"struct","path":"aztec::protocol_types::grumpkin_point::GrumpkinPoint","fields":[{"name":"x","type":{"kind":"field"}},{"name":"y","type":{"kind":"field"}}]}},{"name":"secret_key","type":{"kind":"struct","path":"aztec::protocol_types::grumpkin_private_key::GrumpkinPrivateKey","fields":[{"name":"high","type":{"kind":"field"}},{"name":"low","type":{"kind":"field"}}]}}]}}},{"name":"new_note_hashes","type":{"kind":"array","length":16,"type":{"kind":"struct","path":"aztec::protocol_types::abis::side_effect::SideEffect","fields":[{"name":"value","type":{"kind":"field"}},{"name":"counter","type":{"kind":"integer","sign":"unsigned","width":32}}]}}},{"name":"new_nullifiers","type":{"kind":"array","length":16,"type":{"kind":"struct","path":"aztec::protocol_types::abis::side_effect::SideEffectLinkedToNoteHash","fields":[{"name":"value","type":{"kind":"field"}},{"name":"note_hash","type":{"kind":"field"}},{"name":"counter","type":{"kind":"integer","sign":"unsigned","width":32}}]}}},{"name":"private_call_stack_hashes","type":{"kind":"array","length":4,"type":{"kind":"field"}}},{"name":"public_call_stack_hashes","type":{"kind":"array","length":4,"type":{"kind":"field"}}},{"name":"new_l2_to_l1_msgs","type":{"kind":"array","length":2,"type":{"kind":"struct","path":"aztec::protocol_types::messaging::l2_to_l1_message::L2ToL1Message","fields":[{"name":"recipient","type":{"kind":"struct","path":"aztec::protocol_types::address::eth_address::EthAddress","fields":[{"name":"inner","type":{"kind":"field"}}]}},{"name":"content","type":{"kind":"field"}}]}}},{"name":"start_side_effect_counter","type":{"kind":"integer","sign":"unsigned","width":32}},{"name":"end_side_effect_counter","type":{"kind":"integer","sign":"unsigned","width":32}},{"name":"encrypted_logs_hash","type":{"kind":"field"}},{"name":"unencrypted_logs_hash","type":{"kind":"field"}},{"name":"encrypted_log_preimages_length","type":{"kind":"field"}},{"name":"unencrypted_log_preimages_length","type":{"kind":"field"}},{"name":"historical_header","type":{"kind":"struct","path":"aztec::protocol_types::header::Header","fields":[{"name":"last_archive","type":{"kind":"struct","path":"aztec::protocol_types::abis::append_only_tree_snapshot::AppendOnlyTreeSnapshot","fields":[{"name":"root","type":{"kind":"field"}},{"name":"next_available_leaf_index","type":{"kind":"integer","sign":"unsigned","width":32}}]}},{"name":"content_commitment","type":{"kind":"struct","path":"aztec::protocol_types::content_commitment::ContentCommitment","fields":[{"name":"tx_tree_height","type":{"kind":"field"}},{"name":"txs_effects_hash","type":{"kind":"field"}},{"name":"in_hash","type":{"kind":"field"}},{"name":"out_hash","type":{"kind":"field"}}]}},{"name":"state","type":{"kind":"struct","path":"aztec::protocol_types::state_reference::StateReference","fields":[{"name":"l1_to_l2_message_tree","type":{"kind":"struct","path":"aztec::protocol_types::abis::append_only_tree_snapshot::AppendOnlyTreeSnapshot","fields":[{"name":"root","type":{"kind":"field"}},{"name":"next_available_leaf_index","type":{"kind":"integer","sign":"unsigned","width":32}}]}},{"name":"partial","type":{"kind":"struct","path":"aztec::protocol_types::partial_state_reference::PartialStateReference","fields":[{"name":"note_hash_tree","type":{"kind":"struct","path":"aztec::protocol_types::abis::append_only_tree_snapshot::AppendOnlyTreeSnapshot","fields":[{"name":"root","type":{"kind":"field"}},{"name":"next_available_leaf_index","type":{"kind":"integer","sign":"unsigned","width":32}}]}},{"name":"nullifier_tree","type":{"kind":"struct","path":"aztec::protocol_types::abis::append_only_tree_snapshot::AppendOnlyTreeSnapshot","fields":[{"name":"root","type":{"kind":"field"}},{"name":"next_available_leaf_index","type":{"kind":"integer","sign":"unsigned","width":32}}]}},{"name":"public_data_tree","type":{"kind":"struct","path":"aztec::protocol_types::abis::append_only_tree_snapshot::AppendOnlyTreeSnapshot","fields":[{"name":"root","type":{"kind":"field"}},{"name":"next_available_leaf_index","type":{"kind":"integer","sign":"unsigned","width":32}}]}}]}}]}},{"name":"global_variables","type":{"kind":"struct","path":"aztec::protocol_types::abis::global_variables::GlobalVariables","fields":[{"name":"chain_id","type":{"kind":"field"}},{"name":"version","type":{"kind":"field"}},{"name":"block_number","type":{"kind":"field"}},{"name":"timestamp","type":{"kind":"integer","sign":"unsigned","width":64}},{"name":"coinbase","type":{"kind":"struct","path":"aztec::protocol_types::address::eth_address::EthAddress","fields":[{"name":"inner","type":{"kind":"field"}}]}},{"name":"fee_recipient","type":{"kind":"struct","path":"aztec::protocol_types::address::aztec_address::AztecAddress","fields":[{"name":"inner","type":{"kind":"field"}}]}}]}}]}},{"name":"chain_id","type":{"kind":"field"}},{"name":"version","type":{"kind":"field"}}]},"visibility":"public"},"return_witnesses":[49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255]},"bytecode":"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","debug_symbols":"1ZbfasIwFMbfJddFzp+cJKevMrzonANBqmg3GNJ3XztNW1lGUJnQqxDyfTm/JCcnOZntblU1m119NOXJIJny5WSO+6ruu8emOjSmhMKs67eubQvzvtmuTUli2+KXjoCjlEBoUCNiQs0EdFEziWbUVkOcW8DaUa3aLguDPFdw+0RwZhfBWd2D4PIIuBBEFCE7ogROiBGGDUcgHEn6FSe4aZjZj1rrf6jdLKn9LKk1Ra0aYRB9Dj04vIhVJvlqJaH1EjdEw5TF3p7bBLMlx4fJ/UjucuSIKnFmVs6oc+zJx2caggQz8KhuKIiIcJWStwMlHxVkFyKQRZ8B6m6Iv6itikwvXx/B/nuEZJlG7zVGCOE6I3pTskpi0Lhb3ZlQ7iSEOaodTKqOO2Mt+I8g49p1WlM0RJ/P+phSvnCnT+/zWbjH5xaYvMIIQ6oiyiSxQdpl1/usDpvqdbvuv3H94Ee9ir+6rtt87c8j7Tc="}],"outputs":{"structs":{"functions":[{"kind":"struct","path":"ContractInstanceDeployer::deploy_abi","fields":[{"name":"parameters","type":{"kind":"struct","path":"ContractInstanceDeployer::deploy_parameters","fields":[{"name":"salt","type":{"kind":"field"}},{"name":"contract_class_id","type":{"kind":"struct","path":"aztec::protocol_types::contract_class_id::ContractClassId","fields":[{"name":"inner","type":{"kind":"field"}}]}},{"name":"initialization_hash","type":{"kind":"field"}},{"name":"portal_contract_address","type":{"kind":"struct","path":"aztec::protocol_types::address::eth_address::EthAddress","fields":[{"name":"inner","type":{"kind":"field"}}]}},{"name":"public_keys_hash","type":{"kind":"struct","path":"aztec::protocol_types::address::public_keys_hash::PublicKeysHash","fields":[{"name":"inner","type":{"kind":"field"}}]}},{"name":"universal_deploy","type":{"kind":"boolean"}}]}}]}]},"globals":{}},"file_map":{"83":{"source":"use crate::{\n context::{inputs::PrivateContextInputs, interface::ContextInterface},\n key::nullifier_key::validate_nullifier_key_against_address, messaging::process_l1_to_l2_message,\n hash::hash_args_array,\n oracle::{\n arguments, call_private_function::call_private_function_internal,\n enqueue_public_function_call::enqueue_public_function_call_internal, context::get_portal_address,\n header::get_header_at, nullifier_key::{get_nullifier_key_pair, NullifierKeyPair}\n}\n};\nuse dep::protocol_types::{\n abis::{\n call_context::CallContext, function_data::FunctionData, function_selector::FunctionSelector,\n max_block_number::MaxBlockNumber, nullifier_key_validation_request::NullifierKeyValidationRequest,\n private_call_stack_item::PrivateCallStackItem,\n private_circuit_public_inputs::PrivateCircuitPublicInputs,\n public_call_stack_item::PublicCallStackItem,\n public_circuit_public_inputs::PublicCircuitPublicInputs, read_request::ReadRequest,\n side_effect::{SideEffect, SideEffectLinkedToNoteHash}\n},\n address::{AztecAddress, EthAddress},\n constants::{\n MAX_NEW_NOTE_HASHES_PER_CALL, MAX_NEW_L2_TO_L1_MSGS_PER_CALL, MAX_NEW_NULLIFIERS_PER_CALL,\n MAX_PRIVATE_CALL_STACK_LENGTH_PER_CALL, MAX_PUBLIC_CALL_STACK_LENGTH_PER_CALL,\n MAX_PUBLIC_DATA_READS_PER_CALL, MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_CALL,\n MAX_NOTE_HASH_READ_REQUESTS_PER_CALL, MAX_NULLIFIER_READ_REQUESTS_PER_CALL,\n MAX_NULLIFIER_NON_EXISTENT_READ_REQUESTS_PER_CALL, MAX_NULLIFIER_KEY_VALIDATION_REQUESTS_PER_CALL,\n RETURN_VALUES_LENGTH\n},\n contrakt::{storage_read::StorageRead, storage_update_request::StorageUpdateRequest},\n grumpkin_private_key::GrumpkinPrivateKey, header::Header,\n messaging::l2_to_l1_message::L2ToL1Message, utils::reader::Reader, traits::is_empty\n};\n\n// TODO(https://github.com/AztecProtocol/aztec-packages/issues/1165)\n// use dep::std::collections::vec::Vec;\n\n// When finished, one can call .finish() to convert back to the abi\nstruct PrivateContext {\n // docs:start:private-context\n inputs: PrivateContextInputs,\n side_effect_counter: u32,\n\n min_revertible_side_effect_counter: u32,\n\n args_hash : Field,\n return_values : BoundedVec<Field, RETURN_VALUES_LENGTH>,\n\n max_block_number: MaxBlockNumber,\n\n note_hash_read_requests: BoundedVec<SideEffect, MAX_NOTE_HASH_READ_REQUESTS_PER_CALL>,\n nullifier_read_requests: BoundedVec<ReadRequest, MAX_NULLIFIER_READ_REQUESTS_PER_CALL>,\n nullifier_key_validation_requests: BoundedVec<NullifierKeyValidationRequest, MAX_NULLIFIER_KEY_VALIDATION_REQUESTS_PER_CALL>,\n\n new_note_hashes: BoundedVec<SideEffect, MAX_NEW_NOTE_HASHES_PER_CALL>,\n new_nullifiers: BoundedVec<SideEffectLinkedToNoteHash, MAX_NEW_NULLIFIERS_PER_CALL>,\n\n private_call_stack_hashes : BoundedVec<Field, MAX_PRIVATE_CALL_STACK_LENGTH_PER_CALL>,\n public_call_stack_hashes : BoundedVec<Field, MAX_PUBLIC_CALL_STACK_LENGTH_PER_CALL>,\n new_l2_to_l1_msgs : BoundedVec<L2ToL1Message, MAX_NEW_L2_TO_L1_MSGS_PER_CALL>,\n // docs:end:private-context\n\n // Header of a block whose state is used during private execution (not the block the transaction is included in).\n historical_header: Header,\n\n // TODO(https://github.com/AztecProtocol/aztec-packages/issues/1165)\n // encrypted_logs_preimages: Vec<Field>,\n // unencrypted_logs_preimages: Vec<Field>,\n\n nullifier_key: Option<NullifierKeyPair>,\n}\n\nimpl ContextInterface for PrivateContext {\n fn msg_sender(self) -> AztecAddress {\n self.inputs.call_context.msg_sender\n }\n\n fn this_address(self) -> AztecAddress {\n self.inputs.call_context.storage_contract_address\n }\n\n fn this_portal_address(self) -> EthAddress {\n self.inputs.call_context.portal_contract_address\n }\n\n fn chain_id(self) -> Field {\n self.inputs.private_global_variables.chain_id\n }\n\n fn version(self) -> Field {\n self.inputs.private_global_variables.version\n }\n\n fn selector(self) -> FunctionSelector {\n self.inputs.call_context.function_selector\n }\n\n fn get_args_hash(self) -> Field {\n self.args_hash\n }\n\n // Returns the header of a block whose state is used during private execution (not the block the transaction is\n // included in).\n fn get_header(self) -> Header {\n self.historical_header\n }\n\n fn push_new_note_hash(&mut self, note_hash: Field) {\n let side_effect = SideEffect { value: note_hash, counter: self.side_effect_counter };\n self.new_note_hashes.push(side_effect);\n self.side_effect_counter = self.side_effect_counter + 1;\n }\n\n fn push_new_nullifier(&mut self, nullifier: Field, nullified_commitment: Field) {\n let side_effect = SideEffectLinkedToNoteHash { value: nullifier, note_hash: nullified_commitment, counter: self.side_effect_counter };\n self.new_nullifiers.push(side_effect);\n self.side_effect_counter = self.side_effect_counter + 1;\n }\n}\n\nimpl PrivateContext {\n pub fn new(inputs: PrivateContextInputs, args_hash: Field) -> PrivateContext {\n let side_effect_counter = inputs.start_side_effect_counter;\n let mut min_revertible_side_effect_counter = 0;\n if is_empty(inputs.call_context.msg_sender) {\n min_revertible_side_effect_counter = side_effect_counter;\n }\n PrivateContext {\n inputs,\n side_effect_counter,\n min_revertible_side_effect_counter,\n args_hash,\n return_values: BoundedVec::new(),\n max_block_number: MaxBlockNumber::default(),\n note_hash_read_requests: BoundedVec::new(),\n nullifier_read_requests: BoundedVec::new(),\n nullifier_key_validation_requests: BoundedVec::new(),\n new_note_hashes: BoundedVec::new(),\n new_nullifiers: BoundedVec::new(),\n historical_header: inputs.historical_header,\n private_call_stack_hashes: BoundedVec::new(),\n public_call_stack_hashes: BoundedVec::new(),\n new_l2_to_l1_msgs: BoundedVec::new(),\n // TODO(https://github.com/AztecProtocol/aztec-packages/issues/1165)\n // encrypted_logs_preimages: Vec::new(),\n // unencrypted_logs_preimages: Vec::new(),\n nullifier_key: Option::none()\n }\n }\n\n // Returns the header of an arbitrary block whose block number is less than or equal to the block number\n // of historical header.\n pub fn get_header_at(self, block_number: u32) -> Header {\n get_header_at(block_number, self)\n }\n\n pub fn finish(self) -> PrivateCircuitPublicInputs {\n // TODO(https://github.com/AztecProtocol/aztec-packages/issues/1165)\n let encrypted_logs_hash = 0;\n let unencrypted_logs_hash = 0;\n let encrypted_log_preimages_length = 0;\n let unencrypted_log_preimages_length = 0;\n\n let priv_circuit_pub_inputs = PrivateCircuitPublicInputs {\n call_context: self.inputs.call_context,\n args_hash: self.args_hash,\n return_values: self.return_values.storage,\n min_revertible_side_effect_counter: self.min_revertible_side_effect_counter,\n max_block_number: self.max_block_number,\n note_hash_read_requests: self.note_hash_read_requests.storage,\n nullifier_read_requests: self.nullifier_read_requests.storage,\n nullifier_key_validation_requests: self.nullifier_key_validation_requests.storage,\n new_note_hashes: self.new_note_hashes.storage,\n new_nullifiers: self.new_nullifiers.storage,\n private_call_stack_hashes: self.private_call_stack_hashes.storage,\n public_call_stack_hashes: self.public_call_stack_hashes.storage,\n new_l2_to_l1_msgs: self.new_l2_to_l1_msgs.storage,\n start_side_effect_counter: self.inputs.start_side_effect_counter,\n end_side_effect_counter: self.side_effect_counter,\n encrypted_logs_hash,\n unencrypted_logs_hash,\n encrypted_log_preimages_length,\n unencrypted_log_preimages_length,\n historical_header: self.historical_header,\n chain_id: self.inputs.private_global_variables.chain_id,\n version: self.inputs.private_global_variables.version\n };\n priv_circuit_pub_inputs\n }\n\n pub fn capture_min_revertible_side_effect_counter(&mut self) {\n self.min_revertible_side_effect_counter = self.side_effect_counter;\n }\n\n // docs:start:max-block-number\n pub fn request_max_block_number(&mut self, max_block_number: u32) {\n // docs:end:max-block-number\n self.max_block_number = MaxBlockNumber::min_with_u32(self.max_block_number, max_block_number);\n }\n\n pub fn push_note_hash_read_request(&mut self, note_hash: Field) {\n let side_effect = SideEffect { value: note_hash, counter: self.side_effect_counter };\n self.note_hash_read_requests.push(side_effect);\n self.side_effect_counter = self.side_effect_counter + 1;\n }\n\n pub fn push_nullifier_read_request(&mut self, nullifier: Field) {\n let request = ReadRequest { value: nullifier, counter: self.side_effect_counter };\n self.nullifier_read_requests.push(request);\n self.side_effect_counter = self.side_effect_counter + 1;\n }\n\n pub fn request_nullifier_secret_key(&mut self, account: AztecAddress) -> GrumpkinPrivateKey {\n let key_pair = if self.nullifier_key.is_none() {\n let key_pair = get_nullifier_key_pair(account);\n validate_nullifier_key_against_address(account, key_pair.public_key);\n let request = NullifierKeyValidationRequest { public_key: key_pair.public_key, secret_key: key_pair.secret_key };\n self.nullifier_key_validation_requests.push(request);\n self.nullifier_key = Option::some(key_pair);\n key_pair\n } else {\n let key_pair = self.nullifier_key.unwrap_unchecked();\n // If MAX_NULLIFIER_KEY_VALIDATION_REQUESTS_PER_CALL is larger than 1, need to update the way the key pair is cached.\n assert(MAX_NULLIFIER_KEY_VALIDATION_REQUESTS_PER_CALL == 1);\n assert(\n key_pair.account == account, \"Cannot query nullifier key for more than one account per call\"\n );\n key_pair\n };\n key_pair.secret_key\n }\n\n // docs:start:context_message_portal\n pub fn message_portal(&mut self, recipient: EthAddress, content: Field) {\n // docs:end:context_message_portal\n let message = L2ToL1Message { recipient, content };\n self.new_l2_to_l1_msgs.push(message);\n }\n\n // docs:start:context_consume_l1_to_l2_message\n // docs:start:consume_l1_to_l2_message\n pub fn consume_l1_to_l2_message(&mut self, content: Field, secret: Field, sender: EthAddress) {\n // docs:end:context_consume_l1_to_l2_message\n let nullifier = process_l1_to_l2_message(\n self.historical_header.state.l1_to_l2_message_tree.root,\n self.this_address(),\n sender,\n self.chain_id(),\n self.version(),\n content,\n secret\n );\n\n // Push nullifier (and the \"commitment\" corresponding to this can be \"empty\")\n self.push_new_nullifier(nullifier, 0)\n }\n // docs:end:consume_l1_to_l2_message\n\n pub fn accumulate_encrypted_logs<N>(&mut self, log: [Field; N]) {\n let _void1 = self.inputs;\n let _void2 = log;\n // TODO(https://github.com/AztecProtocol/aztec-packages/issues/1165)\n }\n\n pub fn accumulate_unencrypted_logs<T>(&mut self, log: T) {\n let _void1 = self.inputs;\n let _void2 = log;\n // TODO(https://github.com/AztecProtocol/aztec-packages/issues/1165)\n }\n\n pub fn call_private_function<ARGS_COUNT>(\n &mut self,\n contract_address: AztecAddress,\n function_selector: FunctionSelector,\n args: [Field; ARGS_COUNT]\n ) -> [Field; RETURN_VALUES_LENGTH] {\n let args_hash = hash_args_array(args);\n assert(args_hash == arguments::pack_arguments(args));\n self.call_private_function_with_packed_args(contract_address, function_selector, args_hash, false, false)\n }\n\n pub fn static_call_private_function<ARGS_COUNT>(\n &mut self,\n contract_address: AztecAddress,\n function_selector: FunctionSelector,\n args: [Field; ARGS_COUNT]\n ) -> [Field; RETURN_VALUES_LENGTH] {\n let args_hash = hash_args_array(args);\n assert(args_hash == arguments::pack_arguments(args));\n self.call_private_function_with_packed_args(contract_address, function_selector, args_hash, true, false)\n }\n\n pub fn delegate_call_private_function<ARGS_COUNT>(\n &mut self,\n contract_address: AztecAddress,\n function_selector: FunctionSelector,\n args: [Field; ARGS_COUNT]\n ) -> [Field; RETURN_VALUES_LENGTH] {\n let args_hash = hash_args_array(args);\n assert(args_hash == arguments::pack_arguments(args));\n self.call_private_function_with_packed_args(contract_address, function_selector, args_hash, false, true)\n }\n\n pub fn call_private_function_no_args(\n &mut self,\n contract_address: AztecAddress,\n function_selector: FunctionSelector\n ) -> [Field; RETURN_VALUES_LENGTH] {\n self.call_private_function_with_packed_args(contract_address, function_selector, 0, false, false)\n }\n\n pub fn static_call_private_function_no_args(\n &mut self,\n contract_address: AztecAddress,\n function_selector: FunctionSelector\n ) -> [Field; RETURN_VALUES_LENGTH] {\n self.call_private_function_with_packed_args(contract_address, function_selector, 0, true, false)\n }\n\n pub fn delegate_call_private_function_no_args<ARGS_COUNT>(\n &mut self,\n contract_address: AztecAddress,\n function_selector: FunctionSelector\n ) -> [Field; RETURN_VALUES_LENGTH] {\n self.call_private_function_with_packed_args(contract_address, function_selector, 0, false, true)\n }\n\n pub fn call_private_function_with_packed_args(\n &mut self,\n contract_address: AztecAddress,\n function_selector: FunctionSelector,\n args_hash: Field,\n is_static_call: bool,\n is_delegate_call: bool\n ) -> [Field; RETURN_VALUES_LENGTH] {\n let mut is_static_call = is_static_call | self.inputs.call_context.is_static_call;\n let item = call_private_function_internal(\n contract_address,\n function_selector,\n args_hash,\n self.side_effect_counter,\n is_static_call,\n is_delegate_call\n );\n\n assert_eq(item.public_inputs.call_context.side_effect_counter, self.side_effect_counter);\n assert_eq(item.public_inputs.start_side_effect_counter, self.side_effect_counter);\n self.side_effect_counter = item.public_inputs.end_side_effect_counter + 1;\n\n assert(contract_address.eq(item.contract_address));\n assert(function_selector.eq(item.function_data.selector));\n\n assert(args_hash == item.public_inputs.args_hash);\n\n // Assert that the call context of the enqueued call generated by the oracle matches our request.\n assert(item.public_inputs.call_context.is_delegate_call == is_delegate_call);\n assert(item.public_inputs.call_context.is_static_call == is_static_call);\n\n if (is_delegate_call) {\n // For delegate calls, we also constrain the execution context address for the nested call to be equal to our address.\n assert(\n item.public_inputs.call_context.storage_contract_address.eq(self.inputs.call_context.storage_contract_address)\n );\n assert(item.public_inputs.call_context.msg_sender.eq(self.inputs.call_context.msg_sender));\n } else {\n // For non-delegate calls, we also constrain the execution context address for the nested call to be equal to the address we called.\n assert(item.public_inputs.call_context.storage_contract_address.eq(contract_address));\n assert(\n item.public_inputs.call_context.msg_sender.eq(self.inputs.call_context.storage_contract_address)\n );\n }\n\n self.private_call_stack_hashes.push(item.hash());\n\n item.public_inputs.return_values\n }\n\n pub fn call_public_function<ARGS_COUNT>(\n &mut self,\n contract_address: AztecAddress,\n function_selector: FunctionSelector,\n args: [Field; ARGS_COUNT]\n ) {\n let args_hash = hash_args_array(args);\n assert(args_hash == arguments::pack_arguments(args));\n self.call_public_function_with_packed_args(contract_address, function_selector, args_hash, false, false)\n }\n\n pub fn static_call_public_function<ARGS_COUNT>(\n &mut self,\n contract_address: AztecAddress,\n function_selector: FunctionSelector,\n args: [Field; ARGS_COUNT]\n ) {\n let args_hash = hash_args_array(args);\n assert(args_hash == arguments::pack_arguments(args));\n self.call_public_function_with_packed_args(contract_address, function_selector, args_hash, true, false)\n }\n\n pub fn delegate_call_public_function<ARGS_COUNT>(\n &mut self,\n contract_address: AztecAddress,\n function_selector: FunctionSelector,\n args: [Field; ARGS_COUNT]\n ) {\n let args_hash = hash_args_array(args);\n assert(args_hash == arguments::pack_arguments(args));\n self.call_public_function_with_packed_args(contract_address, function_selector, args_hash, false, true)\n }\n\n pub fn call_public_function_no_args(\n &mut self,\n contract_address: AztecAddress,\n function_selector: FunctionSelector\n ) {\n self.call_public_function_with_packed_args(contract_address, function_selector, 0, false, false)\n }\n\n pub fn static_call_public_function_no_args(\n &mut self,\n contract_address: AztecAddress,\n function_selector: FunctionSelector\n ) {\n self.call_public_function_with_packed_args(contract_address, function_selector, 0, true, false)\n }\n\n pub fn delegate_call_public_function_no_args(\n &mut self,\n contract_address: AztecAddress,\n function_selector: FunctionSelector\n ) {\n self.call_public_function_with_packed_args(contract_address, function_selector, 0, false, true)\n }\n\n pub fn call_public_function_with_packed_args(\n &mut self,\n contract_address: AztecAddress,\n function_selector: FunctionSelector,\n args_hash: Field,\n is_static_call: bool,\n is_delegate_call: bool\n ) {\n let mut is_static_call = is_static_call | self.inputs.call_context.is_static_call;\n let fields = enqueue_public_function_call_internal(\n contract_address,\n function_selector,\n args_hash,\n self.side_effect_counter,\n is_static_call,\n is_delegate_call\n );\n\n let mut reader = Reader::new(fields);\n\n // Note: Not using PublicCirclePublicInputs::deserialize here, because everything below args_hash is 0 and\n // there is no more data in fields because there is only ENQUEUE_PUBLIC_FUNCTION_CALL_RETURN_SIZE fields!\n let item = PublicCallStackItem {\n contract_address: AztecAddress::from_field(reader.read()),\n function_data: reader.read_struct(FunctionData::deserialize),\n public_inputs: PublicCircuitPublicInputs {\n call_context: reader.read_struct(CallContext::deserialize),\n args_hash: reader.read(),\n return_values: [0; RETURN_VALUES_LENGTH],\n nullifier_read_requests: [ReadRequest::empty(); MAX_NULLIFIER_READ_REQUESTS_PER_CALL],\n nullifier_non_existent_read_requests: [ReadRequest::empty(); MAX_NULLIFIER_NON_EXISTENT_READ_REQUESTS_PER_CALL],\n contract_storage_update_requests: [StorageUpdateRequest::empty(); MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_CALL],\n contract_storage_reads: [StorageRead::empty(); MAX_PUBLIC_DATA_READS_PER_CALL],\n public_call_stack_hashes: [0; MAX_PUBLIC_CALL_STACK_LENGTH_PER_CALL],\n new_note_hashes: [SideEffect::empty(); MAX_NEW_NOTE_HASHES_PER_CALL],\n new_nullifiers: [SideEffectLinkedToNoteHash::empty(); MAX_NEW_NULLIFIERS_PER_CALL],\n new_l2_to_l1_msgs: [L2ToL1Message::empty(); MAX_NEW_L2_TO_L1_MSGS_PER_CALL],\n start_side_effect_counter: 0,\n end_side_effect_counter: 0,\n unencrypted_logs_hash: 0,\n unencrypted_log_preimages_length: 0,\n historical_header: Header::empty(),\n prover_address: AztecAddress::zero(),\n revert_code: 0\n },\n is_execution_request: true\n };\n reader.finish();\n\n assert(contract_address.eq(item.contract_address));\n assert(function_selector.eq(item.function_data.selector));\n\n assert_eq(item.public_inputs.call_context.side_effect_counter, self.side_effect_counter);\n // We increment the sideffect counter by one, to account for the call itself being a side effect.\n self.side_effect_counter = self.side_effect_counter + 1;\n\n assert(args_hash == item.public_inputs.args_hash);\n\n // Assert that the call context of the enqueued call generated by the oracle matches our request.\n assert(item.public_inputs.call_context.is_delegate_call == is_delegate_call);\n assert(item.public_inputs.call_context.is_static_call == is_static_call);\n\n if (is_delegate_call) {\n // For delegate calls, we also constrain the execution context address for the nested call to be equal to our address.\n assert(\n item.public_inputs.call_context.storage_contract_address.eq(self.inputs.call_context.storage_contract_address)\n );\n assert(item.public_inputs.call_context.msg_sender.eq(self.inputs.call_context.msg_sender));\n } else {\n // For non-delegate calls, we also constrain the execution context address for the nested call to be equal to the address we called.\n assert(item.public_inputs.call_context.storage_contract_address.eq(contract_address));\n assert(\n item.public_inputs.call_context.msg_sender.eq(self.inputs.call_context.storage_contract_address)\n );\n }\n\n self.public_call_stack_hashes.push(item.hash());\n }\n}\n","path":"/usr/src/noir-projects/aztec-nr/aztec/src/context/private_context.nr"},"86":{"source":"use crate::context::{PrivateContext, PublicContext};\nuse crate::oracle;\nuse dep::protocol_types::{address::AztecAddress, grumpkin_point::GrumpkinPoint};\n\npub fn emit_encrypted_log<N>(\n context: &mut PrivateContext,\n contract_address: AztecAddress,\n storage_slot: Field,\n note_type_id: Field,\n encryption_pub_key: GrumpkinPoint,\n log: [Field; N]\n) {\n let _ = oracle::logs::emit_encrypted_log(\n contract_address,\n storage_slot,\n note_type_id,\n encryption_pub_key,\n log\n );\n context.accumulate_encrypted_logs(log);\n}\n\npub fn emit_unencrypted_log<T>(context: &mut PublicContext, log: T) {\n let contract_address = context.this_address();\n let event_selector = 5; // TODO: compute actual event selector.\n let _ = oracle::logs::emit_unencrypted_log(contract_address, event_selector, log);\n // context.accumulate_unencrypted_logs(log);\n}\n\n// TODO: We might want to remove this since emitting unencrypted logs from private functions is violating privacy.\n// --> might be a better approach to force devs to make a public function call that emits the log if needed then\n// it would be less easy to accidentally leak information.\n// If we decide to keep this function around would make sense to wait for traits and then merge it with emit_unencrypted_log.\npub fn emit_unencrypted_log_from_private<T>(context: &mut PrivateContext, log: T) {\n let contract_address = context.this_address();\n let event_selector = 5; // TODO: compute actual event selector.\n let _ = oracle::logs::emit_unencrypted_log(contract_address, event_selector, log);\n // context.accumulate_unencrypted_logs(log);\n}\n","path":"/usr/src/noir-projects/aztec-nr/aztec/src/log.nr"},"105":{"source":"use dep::protocol_types::{address::AztecAddress, grumpkin_point::GrumpkinPoint};\n\n// TODO: Should take encrypted data.\n#[oracle(emitEncryptedLog)]\nfn emit_encrypted_log_oracle<N>(\n _contract_address: AztecAddress,\n _storage_slot: Field,\n _note_type_id: Field,\n _encryption_pub_key: GrumpkinPoint,\n _preimage: [Field; N]\n) -> Field {}\n\nunconstrained pub fn emit_encrypted_log<N>(\n contract_address: AztecAddress,\n storage_slot: Field,\n note_type_id: Field,\n encryption_pub_key: GrumpkinPoint,\n preimage: [Field; N]\n) -> Field {\n emit_encrypted_log_oracle(\n contract_address,\n storage_slot,\n note_type_id,\n encryption_pub_key,\n preimage\n )\n}\n\n#[oracle(emitUnencryptedLog)]\nfn emit_unencrypted_log_oracle<T>(\n _contract_address: AztecAddress,\n _event_selector: Field,\n _message: T\n) -> Field {}\n\nunconstrained pub fn emit_unencrypted_log<T>(\n contract_address: AztecAddress,\n event_selector: Field,\n message: T\n) -> Field {\n // https://github.com/AztecProtocol/aztec-packages/issues/885\n emit_unencrypted_log_oracle(contract_address, event_selector, message)\n}\n","path":"/usr/src/noir-projects/aztec-nr/aztec/src/oracle/logs.nr"},"111":{"source":"use dep::protocol_types::{\n address::{AztecAddress, EthAddress},\n constants::{\n GENERATOR_INDEX__L1_TO_L2_MESSAGE_SECRET, GENERATOR_INDEX__NULLIFIER, ARGS_HASH_CHUNK_COUNT,\n GENERATOR_INDEX__FUNCTION_ARGS, ARGS_HASH_CHUNK_LENGTH\n},\n traits::Hash, hash::{pedersen_hash, silo_nullifier}\n};\n\nuse dep::protocol_types::hash::sha256_to_field;\n\npub fn compute_secret_hash(secret: Field) -> Field {\n // TODO(#1205) This is probably not the right index to use\n pedersen_hash([secret], GENERATOR_INDEX__L1_TO_L2_MESSAGE_SECRET)\n}\n\npub fn compute_message_hash(\n sender: EthAddress,\n chain_id: Field,\n recipient: AztecAddress,\n version: Field,\n content: Field,\n secret_hash: Field\n) -> Field {\n let mut hash_bytes = [0 as u8; 192];\n let sender_bytes = sender.to_field().to_be_bytes(32);\n let chain_id_bytes = chain_id.to_be_bytes(32);\n let recipient_bytes = recipient.to_field().to_be_bytes(32);\n let version_bytes = version.to_be_bytes(32);\n let content_bytes = content.to_be_bytes(32);\n let secret_hash_bytes = secret_hash.to_be_bytes(32);\n\n for i in 0..32 {\n hash_bytes[i] = sender_bytes[i];\n hash_bytes[i + 32] = chain_id_bytes[i];\n hash_bytes[i + 64] = recipient_bytes[i];\n hash_bytes[i + 96] = version_bytes[i];\n hash_bytes[i + 128] = content_bytes[i];\n hash_bytes[i + 160] = secret_hash_bytes[i];\n }\n\n sha256_to_field(hash_bytes)\n}\n\n// The nullifier of a l1 to l2 message is the hash of the message salted with the secret and index of the message hash\n// in the L1 to L2 message tree\npub fn compute_message_nullifier(message_hash: Field, secret: Field, leaf_index: Field) -> Field {\n pedersen_hash(\n [message_hash, secret, leaf_index],\n GENERATOR_INDEX__NULLIFIER\n )\n}\n\npub fn compute_siloed_nullifier(address: AztecAddress, nullifier: Field) -> Field {\n silo_nullifier(address, nullifier)\n}\n\nstruct ArgsHasher {\n fields: [Field],\n}\n\nimpl Hash for ArgsHasher {\n fn hash(self) -> Field {\n hash_args(self.fields)\n }\n}\n\nimpl ArgsHasher {\n pub fn new() -> Self {\n Self { fields: [] }\n }\n\n pub fn add(&mut self, field: Field) {\n self.fields = self.fields.push_back(field);\n }\n\n pub fn add_multiple<N>(&mut self, fields: [Field; N]) {\n for i in 0..N {\n self.fields = self.fields.push_back(fields[i]);\n }\n }\n}\n\npub fn hash_args_array<N>(args: [Field; N]) -> Field {\n hash_args(args.as_slice())\n}\n\npub fn hash_args(args: [Field]) -> Field {\n if args.len() == 0 {\n 0\n } else {\n let mut chunks_hashes = [0; ARGS_HASH_CHUNK_COUNT];\n for i in 0..ARGS_HASH_CHUNK_COUNT {\n let mut chunk_hash = 0;\n let start_chunk_index = i * ARGS_HASH_CHUNK_LENGTH;\n if start_chunk_index < args.len() {\n let mut chunk_args = [0; ARGS_HASH_CHUNK_LENGTH];\n for j in 0..ARGS_HASH_CHUNK_LENGTH {\n let item_index = i * ARGS_HASH_CHUNK_LENGTH + j;\n if item_index < args.len() {\n chunk_args[j] = args[item_index];\n }\n }\n chunk_hash = pedersen_hash(chunk_args, GENERATOR_INDEX__FUNCTION_ARGS);\n }\n chunks_hashes[i] = chunk_hash;\n }\n pedersen_hash(chunks_hashes, GENERATOR_INDEX__FUNCTION_ARGS)\n }\n}\n\n#[test]\nfn compute_var_args_hash() {\n let mut input = ArgsHasher::new();\n for i in 0..800 {\n input.add(i as Field);\n }\n let hash = input.hash();\n assert(hash == 0x05a1023fef839ac88731f49ae983e172c1b600a3c8f3393ad0ac25d819ac0f0f);\n}\n","path":"/usr/src/noir-projects/aztec-nr/aztec/src/hash.nr"},"144":{"source":"use crate::{\n address::{eth_address::EthAddress, aztec_address::AztecAddress},\n constants::GENERATOR_INDEX__PARTIAL_ADDRESS, hash::pedersen_hash, traits::ToField\n};\n\n// Salted initialization hash. Used in the computation of a partial address.\nstruct SaltedInitializationHash {\n inner: Field\n}\n\nimpl ToField for SaltedInitializationHash {\n fn to_field(self) -> Field {\n self.inner\n }\n}\n\nimpl SaltedInitializationHash {\n pub fn from_field(field: Field) -> Self {\n Self { inner: field }\n }\n\n pub fn compute(\n salt: Field,\n initialization_hash: Field,\n portal_contract_address: EthAddress,\n deployer: AztecAddress\n ) -> Self {\n SaltedInitializationHash::from_field(\n pedersen_hash(\n [\n salt,\n initialization_hash,\n deployer.to_field(),\n portal_contract_address.to_field()\n ],\n GENERATOR_INDEX__PARTIAL_ADDRESS\n )\n )\n }\n\n pub fn assert_is_zero(self) {\n assert(self.to_field() == 0);\n }\n}\n","path":"/usr/src/noir-projects/noir-protocol-circuits/crates/types/src/address/salted_initialization_hash.nr"},"145":{"source":"use crate::{\n address::{\n eth_address::EthAddress, salted_initialization_hash::SaltedInitializationHash,\n aztec_address::AztecAddress\n},\n constants::GENERATOR_INDEX__PARTIAL_ADDRESS, contract_class_id::ContractClassId,\n hash::pedersen_hash, traits::ToField\n};\n\n// Partial address\nstruct PartialAddress {\n inner : Field\n}\n\nimpl ToField for PartialAddress {\n fn to_field(self) -> Field {\n self.inner\n }\n}\n\nimpl PartialAddress {\n pub fn from_field(field: Field) -> Self {\n Self { inner: field }\n }\n\n pub fn compute(\n contract_class_id: ContractClassId,\n salt: Field,\n initialization_hash: Field,\n portal_contract_address: EthAddress,\n deployer: AztecAddress\n ) -> Self {\n PartialAddress::compute_from_salted_initialization_hash(\n contract_class_id,\n SaltedInitializationHash::compute(salt, initialization_hash, portal_contract_address, deployer)\n )\n }\n\n pub fn compute_from_salted_initialization_hash(\n contract_class_id: ContractClassId,\n salted_initialization_hash: SaltedInitializationHash\n ) -> Self {\n PartialAddress::from_field(\n pedersen_hash(\n [\n contract_class_id.to_field(),\n salted_initialization_hash.to_field()\n ],\n GENERATOR_INDEX__PARTIAL_ADDRESS\n )\n )\n }\n\n pub fn to_field(self) -> Field {\n self.inner\n }\n\n pub fn assert_is_zero(self) {\n assert(self.to_field() == 0);\n }\n}\n","path":"/usr/src/noir-projects/noir-protocol-circuits/crates/types/src/address/partial_address.nr"},"147":{"source":"use crate::{\n crate::address::{eth_address::EthAddress, partial_address::PartialAddress, public_keys_hash::PublicKeysHash},\n constants::{AZTEC_ADDRESS_LENGTH, GENERATOR_INDEX__CONTRACT_ADDRESS},\n contract_class_id::ContractClassId, hash::pedersen_hash, grumpkin_point::GrumpkinPoint,\n traits::{Empty, ToField, Serialize, Deserialize}, utils\n};\n\n// Aztec address\nstruct AztecAddress {\n inner : Field\n}\n\nimpl Eq for AztecAddress {\n fn eq(self, other : Self) -> bool {\n self.to_field() == other.to_field()\n }\n}\n\nimpl Empty for AztecAddress {\n fn empty() -> Self {\n Self {\n inner : 0\n }\n }\n}\n\nimpl ToField for AztecAddress {\n fn to_field(self) -> Field {\n self.inner\n }\n}\n\nimpl Serialize<AZTEC_ADDRESS_LENGTH> for AztecAddress {\n fn serialize(self: Self) -> [Field; AZTEC_ADDRESS_LENGTH] {\n [self.to_field()]\n }\n}\n\nimpl Deserialize<AZTEC_ADDRESS_LENGTH> for AztecAddress {\n fn deserialize(fields: [Field; AZTEC_ADDRESS_LENGTH]) -> Self {\n AztecAddress::from_field(fields[0])\n }\n}\n\nimpl AztecAddress {\n pub fn zero() -> Self {\n Self { inner: 0 }\n }\n\n pub fn from_field(field: Field) -> Self {\n Self { inner: field }\n }\n\n pub fn compute_from_public_key(\n pub_key: GrumpkinPoint,\n contract_class_id: ContractClassId,\n salt: Field,\n initialization_hash: Field,\n portal_contract_address: EthAddress,\n deployer: AztecAddress\n ) -> AztecAddress {\n AztecAddress::compute(\n PublicKeysHash::compute(pub_key),\n PartialAddress::compute(\n contract_class_id,\n salt,\n initialization_hash,\n portal_contract_address,\n deployer\n )\n )\n }\n\n pub fn compute(pub_keys_hash: PublicKeysHash, partial_address: PartialAddress) -> AztecAddress {\n AztecAddress::from_field(\n pedersen_hash(\n [pub_keys_hash.to_field(), partial_address.to_field()],\n GENERATOR_INDEX__CONTRACT_ADDRESS\n )\n )\n }\n\n pub fn is_zero(self) -> bool {\n self.inner == 0\n }\n\n pub fn assert_is_zero(self) {\n assert(self.to_field() == 0);\n }\n\n pub fn conditional_assign(predicate: bool, lhs: Self, rhs: Self) -> Self {\n let result = utils::conditional_assign(predicate, rhs.to_field(), lhs.to_field());\n Self { inner: result }\n }\n}\n\n#[test]\nfn compute_address() {\n let point = GrumpkinPoint { x: 1, y: 2 };\n let contract_address_salt = 3;\n let contract_class_id = ContractClassId::from_field(4);\n let initialization_hash = 5;\n let portal_contract_address = EthAddress::from_field(6);\n let deployer = AztecAddress::from_field(7);\n\n let address = AztecAddress::compute_from_public_key(\n point,\n contract_class_id,\n contract_address_salt,\n initialization_hash,\n portal_contract_address,\n deployer\n );\n\n let expected_computed_address_from_preimage = 0x027ea2b41ced2ec9a98305984e96dd28518536a4628883ccdc06e38aa8997220;\n assert(address.to_field() == expected_computed_address_from_preimage);\n}\n\n#[test]\nfn compute_address_from_partial_and_pubkey() {\n let point = GrumpkinPoint { x: 1, y: 2 };\n let partial_address = PartialAddress::from_field(3);\n\n let address = AztecAddress::compute(PublicKeysHash::compute(point), partial_address);\n let expected_computed_address_from_partial_and_pubkey = 0x0447f893197175723deb223696e2e96dbba1e707ee8507766373558877e74197;\n assert(address.to_field() == expected_computed_address_from_partial_and_pubkey);\n}\n","path":"/usr/src/noir-projects/noir-protocol-circuits/crates/types/src/address/aztec_address.nr"},"152":{"source":"use dep::std::cmp::Eq;\n\n// Trait: is_empty\n//\n// The general is_empty trait checks if a data type is is empty,\n// and it defines empty for the basic data types as 0.\n//\n// If a Field is equal to zero, then it is regarded as zero.\n// We will go with this definition for now, however it can be problematic \n// if a value can actually be zero. In a future refactor, we can \n// use the optional type for safety. Doing it now would lead to a worse devex\n// and would make it harder to sync up with the cpp code.\n// Preferred over Default trait to convey intent, as default doesn't necessarily mean empty.\ntrait Empty {\n fn empty() -> Self;\n}\n\nimpl Empty for Field { fn empty() -> Self {0} }\n\nimpl Empty for u1 { fn empty() -> Self {0} }\nimpl Empty for u8 { fn empty() -> Self {0} }\nimpl Empty for u32 { fn empty() -> Self {0} }\nimpl Empty for u64 { fn empty() -> Self {0} }\nimpl Empty for U128 { fn empty() -> Self {U128::from_integer(0)} }\n\npub fn is_empty<T>(item: T) -> bool where T: Empty + Eq {\n item.eq(T::empty())\n}\n\npub fn is_empty_array<T, N>(array: [T; N]) -> bool where T: Empty + Eq {\n array.all(|elem| is_empty(elem))\n}\n\ntrait Hash {\n fn hash(self) -> Field;\n}\n\ntrait ToField {\n fn to_field(self) -> Field;\n}\n\nimpl ToField for Field {\n fn to_field(self) -> Field {\n self\n }\n}\n\nimpl ToField for bool { fn to_field(self) -> Field { self as Field } }\nimpl ToField for u1 { fn to_field(self) -> Field { self as Field } }\nimpl ToField for u8 { fn to_field(self) -> Field { self as Field } }\nimpl ToField for u32 { fn to_field(self) -> Field { self as Field } }\nimpl ToField for u64 { fn to_field(self) -> Field { self as Field } }\nimpl ToField for U128 {\n fn to_field(self) -> Field {\n self.to_integer()\n }\n}\n\ntrait FromField {\n fn from_field(value: Field) -> Self;\n}\n\nimpl FromField for Field {\n fn from_field(value: Field) -> Self {\n value\n }\n}\n\nimpl FromField for bool { fn from_field(value: Field) -> Self { value as bool } }\nimpl FromField for u1 { fn from_field(value: Field) -> Self { value as u1 } }\nimpl FromField for u8 { fn from_field(value: Field) -> Self { value as u8 } }\nimpl FromField for u32 { fn from_field(value: Field) -> Self { value as u32 } }\nimpl FromField for u64 { fn from_field(value: Field) -> Self { value as u64 } }\nimpl FromField for U128 {\n fn from_field(value: Field) -> Self {\n U128::from_integer(value)\n }\n}\n\n// docs:start:serialize\ntrait Serialize<N> {\n fn serialize(self) -> [Field; N];\n}\n// docs:end:serialize\n\n// docs:start:deserialize\ntrait Deserialize<N> {\n fn deserialize(fields: [Field; N]) -> Self;\n}\n// docs:end:deserialize\n","path":"/usr/src/noir-projects/noir-protocol-circuits/crates/types/src/traits.nr"},"198":{"source":"// Utility function to console.log data in the acir simulator\n// WARNING: sometimes when using debug logs the ACVM errors with: `thrown: \"solver opcode resolution error: cannot solve opcode: expression has too many unknowns x155\"`\n\n#[oracle(debugLog)]\nfn debug_log_oracle<T, N>(_msg: T, _num_args: Field) -> Field {}\n#[oracle(debugLog)]\nfn debug_log_format_oracle<T, N>(_msg: T, _args: [Field; N], _num_args: Field) -> Field {}\n#[oracle(debugLog)]\nfn debug_log_field_oracle(_field: Field) -> Field {}\n#[oracle(debugLog)]\nfn debug_log_array_oracle<T, N>(_arbitrary_array: [T; N]) -> Field {}\n#[oracle(debugLogWithPrefix)]\nfn debug_log_array_with_prefix_oracle<S, T, N>(_prefix: S, _arbitrary_array: [T; N]) -> Field {}\n\n/// NOTE: call this with a str<N> msg of length > 1\n/// Example:\n/// `debug_log(\"blah blah this is a debug string\");`\nunconstrained pub fn debug_log<T>(msg: T) {\n assert(debug_log_oracle(msg, 0) == 0);\n}\n\n/// NOTE: call this with a str<N> msg of form\n/// \"some string with {0} and {1} ... {N}\"\n/// and an array of N field which will be formatted\n/// into the string in the simulator.\n/// Example:\n/// debug_log_format(\"get_2(slot:{0}) =>\\n\\t0:{1}\\n\\t1:{2}\", [storage_slot, note0_hash, note1_hash]);\nunconstrained pub fn debug_log_format<T, N>(msg: T, args: [Field; N]) {\n assert(debug_log_format_oracle(msg, args, args.len() as Field) == 0);\n}\n\n/// Example:\n/// `debug_log_field(my_field);`\nunconstrained pub fn debug_log_field(field: Field) {\n assert(debug_log_field_oracle(field) == 0);\n}\n\n/// Example:\n/// `debug_log_array(my_array);`\nunconstrained fn debug_log_array<T, N>(arbitrary_array: [T; N]) {\n assert(debug_log_array_oracle(arbitrary_array) == 0);\n}\n\n/// Example:\n/// `debug_log_array_with_prefix(\"Prefix\", my_array);`\nunconstrained pub fn debug_log_array_with_prefix<S, T, N>(prefix: S, arbitrary_array: [T; N]) {\n assert(debug_log_array_with_prefix_oracle(prefix, arbitrary_array) == 0);\n}\n","path":"/usr/src/noir-projects/noir-protocol-circuits/crates/types/src/debug_log.nr"},"199":{"source":"use crate::address::{AztecAddress, EthAddress};\nuse crate::mocked::VerificationKey;\nuse crate::abis::function_selector::FunctionSelector;\nuse crate::abis::contract_class_function_leaf_preimage::ContractClassFunctionLeafPreimage;\nuse crate::contract_class_id::ContractClassId;\nuse crate::utils::{uint256::U256, field::field_from_bytes_32_trunc};\nuse crate::constants::{\n FUNCTION_TREE_HEIGHT, GENERATOR_INDEX__SILOED_NOTE_HASH, GENERATOR_INDEX__OUTER_NULLIFIER,\n GENERATOR_INDEX__VK, GENERATOR_INDEX__CONSTRUCTOR, GENERATOR_INDEX__PARTIAL_ADDRESS,\n GENERATOR_INDEX__CONTRACT_ADDRESS, GENERATOR_INDEX__NOTE_HASH_NONCE,\n GENERATOR_INDEX__UNIQUE_NOTE_HASH\n};\nuse crate::traits::Hash;\nuse crate::messaging::l2_to_l1_message::L2ToL1Message;\nuse crate::merkle_tree::root::root_from_sibling_path;\nuse dep::std::hash::{pedersen_hash_with_separator, sha256};\n\npub fn sha256_to_field<N>(bytes_to_hash: [u8; N]) -> Field {\n let sha256_hashed = sha256(bytes_to_hash);\n let hash_in_a_field = field_from_bytes_32_trunc(sha256_hashed);\n\n hash_in_a_field\n}\n\npub fn private_functions_root_from_siblings(\n selector: FunctionSelector,\n vk_hash: Field,\n function_leaf_index: Field,\n function_leaf_sibling_path: [Field; FUNCTION_TREE_HEIGHT]\n) -> Field {\n let function_leaf_preimage = ContractClassFunctionLeafPreimage { selector, vk_hash };\n let function_leaf = function_leaf_preimage.hash();\n root_from_sibling_path(function_leaf, function_leaf_index, function_leaf_sibling_path)\n}\n\npub fn silo_note_hash(address: AztecAddress, inner_commitment: Field) -> Field {\n pedersen_hash(\n [\n address.to_field(),\n inner_commitment\n ],\n GENERATOR_INDEX__SILOED_NOTE_HASH\n )\n}\n\npub fn silo_nullifier(address: AztecAddress, nullifier: Field) -> Field {\n pedersen_hash(\n [\n address.to_field(),\n nullifier\n ],\n GENERATOR_INDEX__OUTER_NULLIFIER\n )\n}\n\npub fn merkle_hash(left: Field, right: Field) -> Field {\n pedersen_hash([left, right], 0)\n}\n\npub fn stdlib_recursion_verification_key_compress_native_vk(_vk: VerificationKey) -> Field {\n // Original cpp code\n // stdlib::recursion::verification_key<CT::bn254>::compress_native(private_call.vk, GeneratorIndex::VK);\n // The above cpp method is only ever called on verification key, so it has been special cased here\n let _hash_index = GENERATOR_INDEX__VK;\n 0\n}\n\npub fn compute_l2_to_l1_hash(\n contract_address: AztecAddress,\n rollup_version_id: Field,\n chain_id: Field,\n message: L2ToL1Message\n) -> Field {\n let mut bytes: BoundedVec<u8, 160> = BoundedVec::new();\n\n let inputs = [\n contract_address.to_field(), rollup_version_id, message.recipient.to_field(), chain_id, message.content\n ];\n for i in 0..inputs.len() {\n // TODO are bytes be in fr.to_buffer() ?\n let item_bytes = inputs[i].to_be_bytes(32);\n for j in 0..32 {\n bytes.push(item_bytes[j]);\n }\n }\n\n sha256_to_field(bytes.storage)\n}\n\n// Computes sha256 hash of 2 input hashes.\n//\n// NB: This method now takes in two 31 byte fields - it assumes that any input\n// is the result of a sha_to_field hash and => is truncated\n//\n// TODO(Jan and David): This is used for the encrypted_log hashes.\n// Can we check to see if we can just use hash_to_field or pedersen_compress here?\n//\npub fn accumulate_sha256(input: [Field; 2]) -> Field {\n // This is a note about the cpp code, since it takes an array of Fields\n // instead of a U128.\n // 4 Field elements when converted to bytes will usually \n // occupy 4 * 32 = 128 bytes.\n // However, this function is making the assumption that each Field \n // only occupies 128 bits.\n //\n // TODO(David): This does not seem to be getting guaranteed anywhere in the code?\n\n // Concatentate two fields into 32x2 = 64 bytes\n // accumulate_sha256 assumes that the inputs are pre-truncated 31 byte numbers\n let mut hash_input_flattened = [0; 64];\n for offset in 0..input.len() {\n let input_as_bytes = input[offset].to_be_bytes(32);\n for byte_index in 0..32 {\n hash_input_flattened[offset * 32 + byte_index] = input_as_bytes[byte_index];\n }\n }\n\n sha256_to_field(hash_input_flattened)\n}\n\npub fn compute_logs_hash(previous_log_hash: Field, current_log_hash: Field) -> Field {\n accumulate_sha256(\n [\n previous_log_hash,\n current_log_hash\n ]\n )\n}\n\npub fn compute_note_hash_nonce(first_nullifier: Field, commitment_index: u64) -> Field {\n pedersen_hash(\n [\n first_nullifier,\n commitment_index as Field\n ],\n GENERATOR_INDEX__NOTE_HASH_NONCE\n )\n}\n\npub fn compute_unique_siloed_note_hash(nonce: Field, siloed_note_hash: Field) -> Field {\n pedersen_hash(\n [\n nonce,\n siloed_note_hash\n ],\n GENERATOR_INDEX__UNIQUE_NOTE_HASH\n )\n}\n\npub fn pedersen_hash<N>(inputs: [Field; N], hash_index: u32) -> Field {\n dep::std::hash::pedersen_hash_with_separator(inputs, hash_index)\n}\n\n#[test]\nfn smoke_sha256_to_field() {\n let full_buffer = [\n 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,\n 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,\n 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,\n 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,\n 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99,\n 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119,\n 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139,\n 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159\n ];\n let result = sha256_to_field(full_buffer);\n\n assert(result == 0x448ebbc9e1a31220a2f3830c18eef61b9bd070e5084b7fa2a359fe729184c7);\n\n // to show correctness of the current ver (truncate one byte) vs old ver (mod full bytes):\n let result_bytes = sha256(full_buffer);\n let truncated_field = crate::utils::field::field_from_bytes_32_trunc(result_bytes);\n assert(truncated_field == result);\n let mod_res = result + (result_bytes[31] as Field);\n assert(mod_res == 0x448ebbc9e1a31220a2f3830c18eef61b9bd070e5084b7fa2a359fe729184e0);\n}\n\n#[test]\nfn compute_l2_l1_hash() {\n // All zeroes\n let hash_result = compute_l2_to_l1_hash(AztecAddress::from_field(0), 0, 0, L2ToL1Message::empty());\n assert(hash_result == 0xb393978842a0fa3d3e1470196f098f473f9678e72463cb65ec4ab5581856c2);\n\n // Non-zero case\n let message = L2ToL1Message { recipient: EthAddress::from_field(3), content: 5 };\n let hash_result = compute_l2_to_l1_hash(AztecAddress::from_field(1), 2, 4, message);\n assert(hash_result == 0x3f88c1044a05e5340ed20466276500f6d45ca5603913b9091e957161734e16);\n}\n","path":"/usr/src/noir-projects/noir-protocol-circuits/crates/types/src/hash.nr"},"254":{"source":"mod events;\n\ncontract ContractInstanceDeployer {\n use dep::aztec::protocol_types::{\n address::{AztecAddress, EthAddress, PublicKeysHash, PartialAddress},\n contract_class_id::ContractClassId, constants::DEPLOYER_CONTRACT_INSTANCE_DEPLOYED_MAGIC_VALUE,\n traits::Serialize\n };\n\n use dep::aztec::log::{emit_unencrypted_log, emit_unencrypted_log_from_private};\n\n use crate::events::{instance_deployed::ContractInstanceDeployed};\n\n #[aztec(private)]\n fn deploy(\n salt: Field,\n contract_class_id: ContractClassId,\n initialization_hash: Field,\n portal_contract_address: EthAddress,\n public_keys_hash: PublicKeysHash,\n universal_deploy: bool\n ) {\n // TODO(@spalladino): assert nullifier_exists silo(contract_class_id, ContractClassRegisterer)\n\n let deployer = if universal_deploy {\n AztecAddress::zero()\n } else {\n context.msg_sender()\n };\n\n let partial_address = PartialAddress::compute(\n contract_class_id,\n salt,\n initialization_hash,\n portal_contract_address,\n deployer\n );\n\n let address = AztecAddress::compute(public_keys_hash, partial_address);\n\n // Emit the address as a nullifier to be able to prove that this instance has been (not) deployed\n context.push_new_nullifier(address.to_field(), 0);\n\n // Broadcast the event\n let event = ContractInstanceDeployed {\n contract_class_id,\n address,\n public_keys_hash,\n portal_contract_address,\n initialization_hash,\n salt,\n deployer,\n version: 1\n };\n let event_payload = event.serialize();\n dep::aztec::oracle::debug_log::debug_log_array_with_prefix(\"ContractInstanceDeployed\", event_payload);\n emit_unencrypted_log_from_private(&mut context, event_payload);\n }\n}\n","path":"/usr/src/noir-projects/noir-contracts/contracts/contract_instance_deployer_contract/src/main.nr"}}}
|