@aztec/protocol-contracts 0.36.0 → 0.38.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.
@@ -1 +1 @@
1
- { "noir_version": "0.28.0+587973ff94368b5ae6247f04c26fd0ef6a933b51", "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": "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": "gas_fees", "type": { "kind": "struct", "path": "aztec::protocol_types::abis::gas_fees::GasFees", "fields": [{ "name": "fee_per_da_gas", "type": { "kind": "field" } }, { "name": "fee_per_l2_gas", "type": { "kind": "field" } }] } }] } }] } }, { "name": "tx_context", "type": { "kind": "struct", "path": "aztec::protocol_types::transaction::tx_context::TxContext", "fields": [{ "name": "chain_id", "type": { "kind": "field" } }, { "name": "version", "type": { "kind": "field" } }, { "name": "gas_settings", "type": { "kind": "struct", "path": "aztec::protocol_types::abis::gas_settings::GasSettings", "fields": [{ "name": "gas_limits", "type": { "kind": "struct", "path": "aztec::protocol_types::abis::gas::Gas", "fields": [{ "name": "da_gas", "type": { "kind": "integer", "sign": "unsigned", "width": 32 } }, { "name": "l2_gas", "type": { "kind": "integer", "sign": "unsigned", "width": 32 } }] } }, { "name": "teardown_gas_limits", "type": { "kind": "struct", "path": "aztec::protocol_types::abis::gas::Gas", "fields": [{ "name": "da_gas", "type": { "kind": "integer", "sign": "unsigned", "width": 32 } }, { "name": "l2_gas", "type": { "kind": "integer", "sign": "unsigned", "width": 32 } }] } }, { "name": "max_fees_per_gas", "type": { "kind": "struct", "path": "aztec::protocol_types::abis::gas_fees::GasFees", "fields": [{ "name": "fee_per_da_gas", "type": { "kind": "field" } }, { "name": "fee_per_l2_gas", "type": { "kind": "field" } }] } }, { "name": "inclusion_fee", "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": "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": 39, "end": 40 }], "initialization_hash": [{ "start": 40, "end": 41 }], "inputs": [{ "start": 0, "end": 38 }], "public_keys_hash": [{ "start": 41, "end": 42 }], "salt": [{ "start": 38, "end": 39 }], "universal_deploy": [{ "start": 42, "end": 43 }] }, "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": "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": "returns_hash", "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": "master_nullifier_public_key", "type": { "kind": "struct", "path": "aztec::protocol_types::grumpkin_point::GrumpkinPoint", "fields": [{ "name": "x", "type": { "kind": "field" } }, { "name": "y", "type": { "kind": "field" } }] } }, { "name": "app_nullifier_secret_key", "type": { "kind": "field" } }] } } }, { "name": "new_note_hashes", "type": { "kind": "array", "length": 16, "type": { "kind": "struct", "path": "aztec::protocol_types::abis::note_hash::NoteHash", "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::nullifier::Nullifier", "fields": [{ "name": "value", "type": { "kind": "field" } }, { "name": "counter", "type": { "kind": "integer", "sign": "unsigned", "width": 32 } }, { "name": "note_hash", "type": { "kind": "field" } }] } } }, { "name": "private_call_stack_hashes", "type": { "kind": "array", "length": 4, "type": { "kind": "field" } } }, { "name": "public_call_stack_hashes", "type": { "kind": "array", "length": 16, "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_hashes", "type": { "kind": "array", "length": 4, "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": "unencrypted_logs_hashes", "type": { "kind": "array", "length": 4, "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": "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": "gas_fees", "type": { "kind": "struct", "path": "aztec::protocol_types::abis::gas_fees::GasFees", "fields": [{ "name": "fee_per_da_gas", "type": { "kind": "field" } }, { "name": "fee_per_l2_gas", "type": { "kind": "field" } }] } }] } }] } }, { "name": "tx_context", "type": { "kind": "struct", "path": "aztec::protocol_types::transaction::tx_context::TxContext", "fields": [{ "name": "chain_id", "type": { "kind": "field" } }, { "name": "version", "type": { "kind": "field" } }, { "name": "gas_settings", "type": { "kind": "struct", "path": "aztec::protocol_types::abis::gas_settings::GasSettings", "fields": [{ "name": "gas_limits", "type": { "kind": "struct", "path": "aztec::protocol_types::abis::gas::Gas", "fields": [{ "name": "da_gas", "type": { "kind": "integer", "sign": "unsigned", "width": 32 } }, { "name": "l2_gas", "type": { "kind": "integer", "sign": "unsigned", "width": 32 } }] } }, { "name": "teardown_gas_limits", "type": { "kind": "struct", "path": "aztec::protocol_types::abis::gas::Gas", "fields": [{ "name": "da_gas", "type": { "kind": "integer", "sign": "unsigned", "width": 32 } }, { "name": "l2_gas", "type": { "kind": "integer", "sign": "unsigned", "width": 32 } }] } }, { "name": "max_fees_per_gas", "type": { "kind": "struct", "path": "aztec::protocol_types::abis::gas_fees::GasFees", "fields": [{ "name": "fee_per_da_gas", "type": { "kind": "field" } }, { "name": "fee_per_l2_gas", "type": { "kind": "field" } }] } }, { "name": "inclusion_fee", "type": { "kind": "field" } }] } }] } }] }, "visibility": "public" }, "return_witnesses": [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, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298], "error_types": {} }, "bytecode": "H4sIAAAAAAAA/+2dB3QcxRnH93QnWbZsy5Jsy2Bjn8FNMuC9fqKK3gyYYkwHlTtbYFtGyI3ee++9lySkkN4TID2kkN4TIL2QkN6dfH80C8NYLwT0Le8Nf817f81+s6vZ+c3Nzs7Ozs4kgiHXngiCpsTQNrwao7RlJ812ZKccu9Y5foxjT3DsRsducuwWx24VdVr2TGf/LMdOO/Zsx57r2O1m23aR3Wn8XFjM5yulbCWTy3SF2Y7uciHMF7qL5Uw5UygXerPlXK5SzpdLHd0dpbAjk89VMtVCR64aDrmFVlzhCB3SVm/FN0+0STTf+AuM32b8duMvHPXfkP62Rm652HY0f+jLxXbBUP2Mes6t44Jg83ouHJnLKMYV2undfrj0ayY6jozYPoZ4FwV6N6W4uBfp/0ahFeULhTlQzId2xbhCD8plGOg3cDKBfgMnaeKLGjhRwyZj/OmibPDSjS8qF1FDKGsdlwte7rT583r81TjTWXjt6cy5AUgbGucpE1/U4MwZP2/8gvGj44qikqgs6rDCI+de3+HIXGauYv7toJiu6AEEcaaDoRu1zY/904LhnU4a8rl44i1WY4q3Ek+8pXxM8WZjyodMTPHGVB7iyt98R0z5EFc58yx/YytnMeVvXOW3WIgn3nxcv1tM6S2FMaW3J6Z4Y7oPleKqd2L63Yr5qI08nHPPUS6UpZHUUSrmij3VUqHQVSl191bCXDVbLPVUwkxXIRt2lDM92UxPrljOdnVV5U8x92J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BDDT0aI7cgT1A7aAW+OH/U22xJlBo9UToqcKA9UxZ4kBO9OCt7PKUGmht/CL02lIoOvKaiA+WfxRhyDnFogKIYrOsrNOyJuwz6SwZHZjBcMjgyg8WrAUDfKECxNrTEQWIX1uHQijs4++87FEcuUG5fwAc26IKwGMSud4PX+uDAkOQYr5qHYO4v9uB8EwQUxMM96AR7wJUrdnsIks+v6AflkON8Nc5hKS4cGafHxZE9Jg6voOg9lHh7SxUq7N1eQuPirXmZN3eLWfcm1z17be/Ti11crt+fv55E7Qc=" }, { "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": 0, "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": [], "storage_slot": [{ "start": 2, "end": 3 }] }, "return_type": { "abi_type": { "kind": "array", "length": 4, "type": { "kind": "field" } }, "visibility": "public" }, "return_witnesses": [4, 5, 6, 7], "error_types": {} }, "bytecode": "H4sIAAAAAAAA/+2byW7bMBCGJa9yVC+SZXlf4uTSm+w6tnPzy7Rv3XuBvkPRjMKpx8QkoNARIQImYGhMUfy/+blECRjfey/tt4+v4qZ2pQXbXNQ1+7+yE+wrK5PTd4Sz5ghnXZDTZzjh2lAxXGEut7zbef6vXAQnCRWlUDAwdVL3EdzNQ1BaKgg04IsE9CE7twgNhYYSKnB6MySJ+KQOn62ROtxB6o1rDi35HA4BMU+s37cBDb2r7y3iCcZ4D7Rnp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hyf2qfD8Pr/rAbHqtvPr893EddRouMVhiNGxlFRiWjUUaTjGYZSRGjFDFKEaMUMUkRkxQxSRGTFDFJEZMUMUkRkxQxSRGTFDFLEbMUMUsRsxQxSxGzFDFLEbMUMUsRsxTRpIgmRTQpokkRTYpoUkSTIpoU0aSIJkV0KaJLEV2K6FJElyK6FNGliC5FdCmiSxGLFLFIEYsUsUgRixSxSBGLFLFIEYsUsUgRqxSxShGrFLFKEasUsUoRqxSxShGrFLFKEdlsaBVaFa1GWk20mmnVaNVptdCK2gi1EWoj1EaojVAboTZCbYTaCLURaqOojaI2itooaqOojaI2iDNDnhkCzZBohkgzZJoh1AypZog1Q64Zgs2QbIZoM2SbIdwM6WaIN0O+GQLOkHCGiDNknCHkDClniDlDzhmCzpB0hqgzZJ0h7AxpZ4g7Q94ZAs+QeIbIM2SeIfQMqWeIPUPuGYLPkHyG6DNknyH8DOlniD9D/hkC0JCAhgg0ZKAhBA0paIhBQw4agtCQhIYoNGShIQwNaWiIQ0MeGgLRkIiGSDRkoiEUDaloiEVDLlrkokUuWuSiRS5a5KJFLlrkokUuWuSiRS5a5KJFLlrkokUuWuSiRS5a5KJFLlrkokUuWuSiRS5a5KJFLlrkokUuWnbN0+552kVPctEiFy1y0SIXLXLR+m8XvZ1+bt/326fD7n6z9/7x4/j876Lv7Xj59fb3y+3f3w==" }], "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": "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": { "28": { "source": "use crate::hash::Hasher;\nuse crate::default::Default;\n\nglobal RATE: u32 = 3;\n\nstruct Poseidon2 {\n cache: [Field;3],\n state: [Field;4],\n cache_size: u32,\n squeeze_mode: bool, // 0 => absorb, 1 => squeeze\n}\n\nimpl Poseidon2 {\n\n pub fn hash<N>(input: [Field; N], message_size: u64) -> Field {\n if message_size == N {\n Poseidon2::hash_internal(input, N, false)\n } else {\n Poseidon2::hash_internal(input, message_size, true)\n }\n }\n\n fn new(iv: Field) -> Poseidon2 {\n let mut result = Poseidon2 { cache: [0; 3], state: [0; 4], cache_size: 0, squeeze_mode: false };\n result.state[RATE] = iv;\n result\n }\n\n fn perform_duplex(&mut self) -> [Field; RATE] {\n // zero-pad the cache\n for i in 0..RATE {\n if i >= self.cache_size {\n self.cache[i] = 0;\n }\n }\n // add the cache into sponge state\n for i in 0..RATE {\n self.state[i] += self.cache[i];\n }\n self.state = crate::hash::poseidon2_permutation(self.state, 4);\n // return `RATE` number of field elements from the sponge state.\n let mut result = [0; RATE];\n for i in 0..RATE {\n result[i] = self.state[i];\n }\n result\n }\n\n fn absorb(&mut self, input: Field) {\n if (!self.squeeze_mode) & (self.cache_size == RATE) {\n // If we're absorbing, and the cache is full, apply the sponge permutation to compress the cache\n let _ = self.perform_duplex();\n self.cache[0] = input;\n self.cache_size = 1;\n } else if (!self.squeeze_mode) & (self.cache_size != RATE) {\n // If we're absorbing, and the cache is not full, add the input into the cache\n self.cache[self.cache_size] = input;\n self.cache_size += 1;\n } else if self.squeeze_mode {\n // If we're in squeeze mode, switch to absorb mode and add the input into the cache.\n // N.B. I don't think this code path can be reached?!\n self.cache[0] = input;\n self.cache_size = 1;\n self.squeeze_mode = false;\n }\n }\n\n fn squeeze(&mut self) -> Field {\n if self.squeeze_mode & (self.cache_size == 0) {\n // If we're in squeze mode and the cache is empty, there is nothing left to squeeze out of the sponge!\n // Switch to absorb mode.\n self.squeeze_mode = false;\n self.cache_size = 0;\n }\n if !self.squeeze_mode {\n // If we're in absorb mode, apply sponge permutation to compress the cache, populate cache with compressed\n // state and switch to squeeze mode. Note: this code block will execute if the previous `if` condition was\n // matched\n let new_output_elements = self.perform_duplex();\n self.squeeze_mode = true;\n for i in 0..RATE {\n self.cache[i] = new_output_elements[i];\n }\n self.cache_size = RATE;\n }\n // By this point, we should have a non-empty cache. Pop one item off the top of the cache and return it.\n let result = self.cache[0];\n for i in 1..RATE {\n if i < self.cache_size {\n self.cache[i - 1] = self.cache[i];\n }\n }\n self.cache_size -= 1;\n self.cache[self.cache_size] = 0;\n result\n }\n\n fn hash_internal<N>(input: [Field; N], in_len: u64, is_variable_length: bool) -> Field {\n let two_pow_64 = 18446744073709551616;\n let iv : Field = (in_len as Field) * two_pow_64;\n let mut sponge = Poseidon2::new(iv);\n for i in 0..input.len() {\n if i < in_len {\n sponge.absorb(input[i]);\n }\n }\n\n // In the case where the hash preimage is variable-length, we append `1` to the end of the input, to distinguish\n // from fixed-length hashes. (the combination of this additional field element + the hash IV ensures\n // fixed-length and variable-length hashes do not collide)\n if is_variable_length {\n sponge.absorb(1);\n }\n sponge.squeeze()\n }\n}\n\nstruct Poseidon2Hasher{\n _state: [Field],\n}\n\nimpl Hasher for Poseidon2Hasher {\n fn finish(self) -> Field {\n let iv : Field = (self._state.len() as Field)*18446744073709551616; // iv = (self._state.len() << 64)\n let mut sponge = Poseidon2::new(iv);\n for i in 0..self._state.len() {\n sponge.absorb(self._state[i]);\n }\n sponge.squeeze()\n }\n\n fn write(&mut self, input: Field){\n self._state = self._state.push_back(input);\n }\n}\n\nimpl Default for Poseidon2Hasher {\n fn default() -> Self {\n Poseidon2Hasher {\n _state: &[],\n }\n }\n}\n", "path": "std/hash/poseidon2.nr" }, "84": { "source": "use crate::{\n context::{inputs::PrivateContextInputs, interface::ContextInterface},\n messaging::process_l1_to_l2_message, hash::{hash_args_array, ArgsHasher},\n oracle::{\n arguments, returns, call_private_function::call_private_function_internal,\n enqueue_public_function_call::enqueue_public_function_call_internal, header::get_header_at,\n nullifier_key::{get_nullifier_keys, NullifierKeys}\n}\n};\nuse dep::protocol_types::{\n abis::{\n global_variables::GlobalVariables, gas::Gas, call_context::CallContext, function_data::FunctionData,\n function_selector::FunctionSelector, max_block_number::MaxBlockNumber,\n 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 note_hash::NoteHash, nullifier::Nullifier, side_effect::SideEffect\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 MAX_ENCRYPTED_LOGS_PER_CALL, MAX_UNENCRYPTED_LOGS_PER_CALL\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,\n traits::{is_empty, Deserialize, 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_hash : Field,\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<NoteHash, MAX_NEW_NOTE_HASHES_PER_CALL>,\n new_nullifiers: BoundedVec<Nullifier, 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_hashes: BoundedVec<SideEffect, MAX_ENCRYPTED_LOGS_PER_CALL>,\n unencrypted_logs_hashes: BoundedVec<SideEffect, MAX_UNENCRYPTED_LOGS_PER_CALL>,\n // encrypted_logs_preimages: Vec<Field>,\n // unencrypted_logs_preimages: Vec<Field>,\n\n nullifier_key: Option<NullifierKeys>,\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 chain_id(self) -> Field {\n self.inputs.tx_context.chain_id\n }\n\n fn version(self) -> Field {\n self.inputs.tx_context.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 fn push_new_note_hash(&mut self, note_hash: Field) {\n self.new_note_hashes.push(NoteHash { value: note_hash, counter: self.side_effect_counter });\n self.side_effect_counter = self.side_effect_counter + 1;\n }\n\n fn push_new_nullifier(&mut self, nullifier: Field, nullified_note_hash: Field) {\n self.new_nullifiers.push(Nullifier { value: nullifier, note_hash: nullified_note_hash, counter: self.side_effect_counter });\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_hash: 0,\n max_block_number: MaxBlockNumber::empty(),\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_hashes: BoundedVec::new(),\n unencrypted_logs_hashes: BoundedVec::new(),\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 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 // 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 set_return_hash(&mut self, returns_hasher: ArgsHasher) {\n returns::pack_returns(returns_hasher.fields);\n self.return_hash = returns_hasher.hash();\n }\n\n pub fn finish(self) -> PrivateCircuitPublicInputs {\n // TODO(https://github.com/AztecProtocol/aztec-packages/issues/1165)\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 returns_hash: self.return_hash,\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_hashes: self.encrypted_logs_hashes.storage,\n unencrypted_logs_hashes: self.unencrypted_logs_hashes.storage,\n encrypted_log_preimages_length,\n unencrypted_log_preimages_length,\n historical_header: self.historical_header,\n tx_context: self.inputs.tx_context\n };\n\n priv_circuit_pub_inputs\n }\n\n pub fn end_setup(&mut self) {\n self.min_revertible_side_effect_counter = self.side_effect_counter;\n }\n\n // docs:start:max-block-number\n pub fn set_tx_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_app_nullifier_secret_key(&mut self, account: AztecAddress) -> Field {\n let keys = if self.nullifier_key.is_none() {\n let keys = get_nullifier_keys(account);\n let request = NullifierKeyValidationRequest {\n master_nullifier_public_key: keys.master_nullifier_public_key,\n app_nullifier_secret_key: keys.app_nullifier_secret_key\n };\n self.nullifier_key_validation_requests.push(request);\n self.nullifier_key = Option::some(keys);\n keys\n } else {\n let keys = 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(keys.account == account, \"Cannot query nullifier key for more than one account per call\");\n keys\n };\n keys.app_nullifier_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 push_encrypted_log(&mut self, log_hash: Field) {\n let side_effect = SideEffect { value: log_hash, counter: self.side_effect_counter };\n self.encrypted_logs_hashes.push(side_effect);\n self.side_effect_counter = self.side_effect_counter + 1;\n // TODO(https://github.com/AztecProtocol/aztec-packages/issues/1165)\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.\n pub fn emit_unencrypted_log<T>(&mut self, log: T) {\n let event_selector = 5; // TODO: compute actual event selector.\n let log_hash = emit_unencrypted_log_private_internal(self.this_address(), event_selector, log);\n\n let side_effect = SideEffect { value: log_hash, counter: self.side_effect_counter };\n self.unencrypted_logs_hashes.push(side_effect);\n self.side_effect_counter = self.side_effect_counter + 1;\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 ) -> PackedReturns {\n let args_hash = hash_args_array(args);\n assert(args_hash == arguments::pack_arguments_array(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 ) -> PackedReturns {\n let args_hash = hash_args_array(args);\n assert(args_hash == arguments::pack_arguments_array(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 ) -> PackedReturns {\n let args_hash = hash_args_array(args);\n assert(args_hash == arguments::pack_arguments_array(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<RETURNS_COUNT>(\n &mut self,\n contract_address: AztecAddress,\n function_selector: FunctionSelector\n ) -> PackedReturns {\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<RETURNS_COUNT>(\n &mut self,\n contract_address: AztecAddress,\n function_selector: FunctionSelector\n ) -> PackedReturns {\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 ) -> PackedReturns {\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<RETURNS_COUNT>(\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 ) -> PackedReturns {\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 // TODO (fees) figure out why this crashes the prover and enable it\n // we need this in order to pay fees inside child call contexts\n // assert(\n // (item.public_inputs.min_revertible_side_effect_counter == 0 as u32)\n // | (item.public_inputs.min_revertible_side_effect_counter\n // > self.min_revertible_side_effect_counter)\n // );\n\n // if item.public_inputs.min_revertible_side_effect_counter\n // > self.min_revertible_side_effect_counter {\n // self.min_revertible_side_effect_counter = item.public_inputs.min_revertible_side_effect_counter;\n // }\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 PackedReturns::new(item.public_inputs.returns_hash)\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_array(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_array(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_array(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 returns_hash: 0,\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: [NoteHash::empty(); MAX_NEW_NOTE_HASHES_PER_CALL],\n new_nullifiers: [Nullifier::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_hashes: [SideEffect::empty(); MAX_UNENCRYPTED_LOGS_PER_CALL],\n unencrypted_log_preimages_length: 0,\n historical_header: Header::empty(),\n global_variables: GlobalVariables::empty(),\n prover_address: AztecAddress::zero(),\n revert_code: 0,\n start_gas_left: Gas::empty(),\n end_gas_left: Gas::empty(),\n transaction_fee: 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\nimpl Empty for PrivateContext {\n fn empty() -> Self {\n PrivateContext {\n inputs: PrivateContextInputs::empty(),\n side_effect_counter: 0 as u32,\n min_revertible_side_effect_counter: 0 as u32,\n args_hash : 0,\n return_hash : 0,\n max_block_number: MaxBlockNumber::empty(),\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 private_call_stack_hashes : BoundedVec::new(),\n public_call_stack_hashes : BoundedVec::new(),\n new_l2_to_l1_msgs : BoundedVec::new(),\n historical_header: Header::empty(),\n encrypted_logs_hashes: BoundedVec::new(),\n unencrypted_logs_hashes: BoundedVec::new(),\n nullifier_key: Option::none(),\n }\n }\n}\n\nstruct PackedReturns {\n packed_returns: Field,\n}\n\nimpl PackedReturns {\n pub fn new(packed_returns: Field) -> Self {\n PackedReturns { packed_returns }\n }\n\n pub fn assert_empty(self) {\n assert_eq(self.packed_returns, 0);\n }\n\n pub fn raw(self) -> Field {\n self.packed_returns\n }\n\n pub fn unpack<N>(self) -> [Field; N] {\n let unpacked: [Field; N] = returns::unpack_returns(self.packed_returns);\n assert_eq(self.packed_returns, hash_args_array(unpacked));\n unpacked\n }\n\n pub fn unpack_into<T, N>(self) -> T where T: Deserialize<N> {\n let unpacked: [Field; N] = self.unpack();\n Deserialize::deserialize(unpacked)\n }\n}\n\n#[oracle(emitUnencryptedLog)]\nfn emit_unencrypted_log_oracle_private<T>(\n _contract_address: AztecAddress,\n _event_selector: Field,\n _message: T\n) -> Field {}\n\nunconstrained pub fn emit_unencrypted_log_private_internal<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_private(contract_address, event_selector, message)\n}\n", "path": "/usr/src/noir-projects/aztec-nr/aztec/src/context/private_context.nr" }, "113": { "source": "use dep::protocol_types::{\n address::{AztecAddress, EthAddress},\n constants::{\n GENERATOR_INDEX__SECRET_HASH, GENERATOR_INDEX__MESSAGE_NULLIFIER, ARGS_HASH_CHUNK_COUNT,\n GENERATOR_INDEX__FUNCTION_ARGS, ARGS_HASH_CHUNK_LENGTH\n},\n traits::Hash, hash::{pedersen_hash, poseidon2_hash, silo_nullifier, sha256_to_field}\n};\n\npub fn compute_secret_hash(secret: Field) -> Field {\n pedersen_hash([secret], GENERATOR_INDEX__SECRET_HASH)\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__MESSAGE_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 assert(args.len() < ARGS_HASH_CHUNK_COUNT * ARGS_HASH_CHUNK_LENGTH);\n let mut chunks_hashes = [0; ARGS_HASH_CHUNK_COUNT];\n let mut current_chunk_values = [0; ARGS_HASH_CHUNK_LENGTH];\n\n let mut current_chunk_index = 0;\n let mut index_inside_current_chunk = 0;\n for i in 0..args.len() {\n current_chunk_values[index_inside_current_chunk] = args[i];\n index_inside_current_chunk+=1;\n if index_inside_current_chunk == ARGS_HASH_CHUNK_LENGTH {\n chunks_hashes[current_chunk_index] = pedersen_hash(current_chunk_values, GENERATOR_INDEX__FUNCTION_ARGS);\n current_chunk_values = [0; ARGS_HASH_CHUNK_LENGTH];\n current_chunk_index+=1;\n index_inside_current_chunk = 0;\n }\n }\n if index_inside_current_chunk > 0 {\n chunks_hashes[current_chunk_index] = pedersen_hash(current_chunk_values, GENERATOR_INDEX__FUNCTION_ARGS);\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" }, "146": { "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(salt: Field, initialization_hash: Field, deployer: AztecAddress) -> Self {\n SaltedInitializationHash::from_field(\n pedersen_hash(\n [\n salt,\n initialization_hash,\n deployer.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" }, "147": { "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, FromField, Serialize, Deserialize}\n};\n\nglobal PARTIAL_ADDRESS_LENGTH = 1;\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 Serialize<PARTIAL_ADDRESS_LENGTH> for PartialAddress {\n fn serialize(self: Self) -> [Field; PARTIAL_ADDRESS_LENGTH] {\n [self.to_field()]\n }\n}\n\nimpl Deserialize<PARTIAL_ADDRESS_LENGTH> for PartialAddress {\n fn deserialize(fields: [Field; PARTIAL_ADDRESS_LENGTH]) -> Self {\n PartialAddress { inner: fields[0] }\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 deployer: AztecAddress\n ) -> Self {\n PartialAddress::compute_from_salted_initialization_hash(\n contract_class_id,\n SaltedInitializationHash::compute(salt, initialization_hash, 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" }, "149": { "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_V1},\n contract_class_id::ContractClassId, hash::poseidon2_hash, grumpkin_point::GrumpkinPoint,\n traits::{Empty, FromField, 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 FromField for AztecAddress {\n fn from_field(value: Field) -> AztecAddress {\n AztecAddress { inner: value }\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 FromField::from_field(fields[0])\n }\n}\n\nimpl AztecAddress {\n pub fn zero() -> Self {\n Self { inner: 0 }\n }\n\n pub fn compute(pub_keys_hash: PublicKeysHash, partial_address: PartialAddress) -> AztecAddress {\n AztecAddress::from_field(\n poseidon2_hash(\n [pub_keys_hash.to_field(), partial_address.to_field(), GENERATOR_INDEX__CONTRACT_ADDRESS_V1]\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_from_partial_and_pubkey() {\n let pub_keys_hash = PublicKeysHash::from_field(1);\n let partial_address = PartialAddress::from_field(2);\n\n let address = AztecAddress::compute(pub_keys_hash, partial_address);\n let expected_computed_address_from_partial_and_pubkey = 0x1b6ead051e7b42665064ca6cf1ec77da0a36d86e00d1ff6e44077966c0c3a9fa;\n assert(address.to_field() == expected_computed_address_from_partial_and_pubkey);\n}\n\n#[test]\nfn from_field_to_field() {\n let address = AztecAddress { inner: 37 };\n assert_eq(FromField::from_field(address.to_field()), address);\n}\n\n#[test]\nfn serde() {\n let address = AztecAddress { inner: 37 };\n assert_eq(Deserialize::deserialize(address.serialize()), address);\n}\n", "path": "/usr/src/noir-projects/noir-protocol-circuits/crates/types/src/address/aztec_address.nr" }, "154": { "source": "use dep::std::cmp::Eq;\nuse crate::utils::field::field_from_bytes;\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}\nimpl<N> ToField for str<N> {\n fn to_field(self) -> Field {\n assert(N < 32, \"String doesn't fit in a field, consider using Serialize instead\");\n field_from_bytes(self.as_bytes(), true)\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\nimpl<N> Serialize<N> for str<N> {\n fn serialize(self) -> [Field; N] {\n let mut result = [0; N];\n let bytes: [u8; N] = self.as_bytes();\n for i in 0..N {\n result[i] = field_from_bytes([bytes[i];1], true);\n }\n result\n }\n}\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" }, "204": { "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" }, "205": { "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::abis::side_effect::SideEffect;\nuse crate::traits::is_empty;\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__NOTE_HASH_NONCE, 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_tx_logs_hash<MAX_ENCRYPTED_LOGS_PER_TX>(logs: [SideEffect; MAX_ENCRYPTED_LOGS_PER_TX]) -> Field {\n // TODO(Miranda): Below is flat hashing which would reduce constraints (we now only hash once in tail) - convert to this?\n\n // // Convert each field element into a byte array and append the bytes to `hash_input_flattened`\n // // Ideally we would define a new global here but for now we assert in case MAX_LOGS changes\n // assert(MAX_ENCRYPTED_LOGS_PER_TX * 32 == 256);\n // let mut hash_input_flattened = [0; 256];\n // for offset in 0..MAX_ENCRYPTED_LOGS_PER_TX {\n // let input_as_bytes = logs[offset].value.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 // // This differs from accumulate_sha256 as we could increase MAX_LOGS and\n // // ideally we would push to a slice then hash, but in practice compilation was very slow\n // // Hardcode to 256 bytes for now\n // sha256_to_field(hash_input_flattened)\n\n // Assuming logs are pre-sorted\n let mut accumulated_logs_hash = 0;\n for i in 0..MAX_ENCRYPTED_LOGS_PER_TX {\n if !is_empty(logs[i]) {\n accumulated_logs_hash = accumulate_sha256([accumulated_logs_hash, logs[i].value]);\n }\n }\n\n accumulated_logs_hash\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\npub fn poseidon2_hash<N>(inputs: [Field; N]) -> Field {\n dep::std::hash::poseidon2::Poseidon2::hash(inputs, N)\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" }, "270": { "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 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 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(contract_class_id, salt, initialization_hash, deployer);\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 { contract_class_id, address, public_keys_hash, initialization_hash, salt, deployer, version: 1 };\n let event_payload = event.serialize();\n dep::aztec::oracle::debug_log::debug_log_array_with_prefix(\"ContractInstanceDeployed\", event_payload);\n context.emit_unencrypted_log(event_payload);\n }\n}\n", "path": "/usr/src/noir-projects/noir-contracts/contracts/contract_instance_deployer_contract/src/main.nr" } } }
1
+ { "transpiled": true, "noir_version": "0.29.0+9edb7f5a94a9b0e3a0a108728fe04cd51e5d0db2", "name": "ContractInstanceDeployer", "functions": [{ "name": "compute_note_hash_and_nullifier", "is_unconstrained": true, "custom_attributes": [], "abi": { "error_types": {}, "param_witnesses": { "contract_address": [{ "end": 1, "start": 0 }], "nonce": [{ "end": 2, "start": 1 }], "note_type_id": [{ "end": 4, "start": 3 }], "serialized_note": [], "storage_slot": [{ "end": 3, "start": 2 }] }, "parameters": [{ "name": "contract_address", "type": { "fields": [{ "name": "inner", "type": { "kind": "field" } }], "kind": "struct", "path": "aztec::protocol_types::address::aztec_address::AztecAddress" }, "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": 0, "type": { "kind": "field" } }, "visibility": "private" }], "return_type": { "abi_type": { "kind": "array", "length": 4, "type": { "kind": "field" } }, "visibility": "public" }, "return_witnesses": [4, 5, 6, 7] }, "bytecode": "H4sIAAAAAAAA/+2byW7bMBCGJa9yVC+SZXlf4uTSm+w6tnPzy7Rv3XuBvkPRjMKpx8Q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Mr/uzHfmj5jp+0RA6vD+mtTVtFzo/zJgezgz/BdsuDj5FjUAAA==", "debug_symbols": "ndpBattQGIXRvWgciu8v6T0pWymlOIlTDMYOsVMoJnuv3dIF9Mz0JN3ZNzq86/Cye/r48X1/fD2dh8ev1+Fwet5e9qfj7XQdNl+q/Xl7ftse7y/Ol+37ZXgcKw/D7vhyf2qfD8Pr/rAbHqtvPr893EddRouMVhiNGxlFRiWjUUaTjGYZSRGjFDFKEaMUMUkRkxQxSRGTFDFJEZMUMUkRkxQxSRGTFDFLEbMUMUsRsxQxSxGzFDFLEbMUMUsRsxTRpIgmRTQpokkRTYpoUkSTIpoU0aSIJkV0KaJLEV2K6FJElyK6FNGliC5FdCmiSxGLFLFIEYsUsUgRixSxSBGLFLFIEYsUsUgRqxSxShGrFLFKEasUsUoRqxSxShGrFLFKEdlsaBVaFa1GWk20mmnVaNVptdCK2gi1EWoj1EaojVAboTZCbYTaCLURaqOojaI2itooaqOojaI2iDNDnhkCzZBohkgzZJoh1AypZog1Q64Zgs2QbIZoM2SbIdwM6WaIN0O+GQLOkHCGiDNknCHkDClniDlDzhmCzpB0hqgzZJ0h7AxpZ4g7Q94ZAs+QeIbIM2SeIfQMqWeIPUPuGYLPkHyG6DNknyH8DOlniD9D/hkC0JCAhgg0ZKAhBA0paIhBQw4agtCQhIYoNGShIQwNaWiIQ0MeGgLRkIiGSDRkoiEUDaloiEVDLlrkokUuWuSiRS5a5KJFLlrkokUuWuSiRS5a5KJFLlrkokUuWuSiRS5a5KJFLlrkokUuWuSiRS5a5KJFLlrkokUuWnbN0+552kVPctEiFy1y0SIXLXLR+m8XvZ1+bt/326fD7n6z9/7x4/j876Lv7Xj59fb3y+3f3w==" }, { "name": "deploy", "is_unconstrained": false, "custom_attributes": ["aztec(private)"], "abi": { "error_types": {}, "param_witnesses": { "contract_class_id": [{ "end": 40, "start": 39 }], "initialization_hash": [{ "end": 41, "start": 40 }], "inputs": [{ "end": 38, "start": 0 }], "public_keys_hash": [{ "end": 42, "start": 41 }], "salt": [{ "end": 39, "start": 38 }], "universal_deploy": [{ "end": 43, "start": 42 }] }, "parameters": [{ "name": "inputs", "type": { "fields": [{ "name": "call_context", "type": { "fields": [{ "name": "msg_sender", "type": { "fields": [{ "name": "inner", "type": { "kind": "field" } }], "kind": "struct", "path": "aztec::protocol_types::address::aztec_address::AztecAddress" } }, { "name": "storage_contract_address", "type": { "fields": [{ "name": "inner", "type": { "kind": "field" } }], "kind": "struct", "path": "aztec::protocol_types::address::aztec_address::AztecAddress" } }, { "name": "function_selector", "type": { "fields": [{ "name": "inner", "type": { "kind": "integer", "sign": "unsigned", "width": 32 } }], "kind": "struct", "path": "aztec::protocol_types::abis::function_selector::FunctionSelector" } }, { "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 } }], "kind": "struct", "path": "aztec::protocol_types::abis::call_context::CallContext" } }, { "name": "historical_header", "type": { "fields": [{ "name": "last_archive", "type": { "fields": [{ "name": "root", "type": { "kind": "field" } }, { "name": "next_available_leaf_index", "type": { "kind": "integer", "sign": "unsigned", "width": 32 } }], "kind": "struct", "path": "aztec::protocol_types::abis::append_only_tree_snapshot::AppendOnlyTreeSnapshot" } }, { "name": "content_commitment", "type": { "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" } }], "kind": "struct", "path": "aztec::protocol_types::content_commitment::ContentCommitment" } }, { "name": "state", "type": { "fields": [{ "name": "l1_to_l2_message_tree", "type": { "fields": [{ "name": "root", "type": { "kind": "field" } }, { "name": "next_available_leaf_index", "type": { "kind": "integer", "sign": "unsigned", "width": 32 } }], "kind": "struct", "path": "aztec::protocol_types::abis::append_only_tree_snapshot::AppendOnlyTreeSnapshot" } }, { "name": "partial", "type": { "fields": [{ "name": "note_hash_tree", "type": { "fields": [{ "name": "root", "type": { "kind": "field" } }, { "name": "next_available_leaf_index", "type": { "kind": "integer", "sign": "unsigned", "width": 32 } }], "kind": "struct", "path": "aztec::protocol_types::abis::append_only_tree_snapshot::AppendOnlyTreeSnapshot" } }, { "name": "nullifier_tree", "type": { "fields": [{ "name": "root", "type": { "kind": "field" } }, { "name": "next_available_leaf_index", "type": { "kind": "integer", "sign": "unsigned", "width": 32 } }], "kind": "struct", "path": "aztec::protocol_types::abis::append_only_tree_snapshot::AppendOnlyTreeSnapshot" } }, { "name": "public_data_tree", "type": { "fields": [{ "name": "root", "type": { "kind": "field" } }, { "name": "next_available_leaf_index", "type": { "kind": "integer", "sign": "unsigned", "width": 32 } }], "kind": "struct", "path": "aztec::protocol_types::abis::append_only_tree_snapshot::AppendOnlyTreeSnapshot" } }], "kind": "struct", "path": "aztec::protocol_types::partial_state_reference::PartialStateReference" } }], "kind": "struct", "path": "aztec::protocol_types::state_reference::StateReference" } }, { "name": "global_variables", "type": { "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": { "fields": [{ "name": "inner", "type": { "kind": "field" } }], "kind": "struct", "path": "aztec::protocol_types::address::eth_address::EthAddress" } }, { "name": "fee_recipient", "type": { "fields": [{ "name": "inner", "type": { "kind": "field" } }], "kind": "struct", "path": "aztec::protocol_types::address::aztec_address::AztecAddress" } }, { "name": "gas_fees", "type": { "fields": [{ "name": "fee_per_da_gas", "type": { "kind": "field" } }, { "name": "fee_per_l2_gas", "type": { "kind": "field" } }], "kind": "struct", "path": "aztec::protocol_types::abis::gas_fees::GasFees" } }], "kind": "struct", "path": "aztec::protocol_types::abis::global_variables::GlobalVariables" } }], "kind": "struct", "path": "aztec::protocol_types::header::Header" } }, { "name": "tx_context", "type": { "fields": [{ "name": "chain_id", "type": { "kind": "field" } }, { "name": "version", "type": { "kind": "field" } }, { "name": "gas_settings", "type": { "fields": [{ "name": "gas_limits", "type": { "fields": [{ "name": "da_gas", "type": { "kind": "integer", "sign": "unsigned", "width": 32 } }, { "name": "l2_gas", "type": { "kind": "integer", "sign": "unsigned", "width": 32 } }], "kind": "struct", "path": "aztec::protocol_types::abis::gas::Gas" } }, { "name": "teardown_gas_limits", "type": { "fields": [{ "name": "da_gas", "type": { "kind": "integer", "sign": "unsigned", "width": 32 } }, { "name": "l2_gas", "type": { "kind": "integer", "sign": "unsigned", "width": 32 } }], "kind": "struct", "path": "aztec::protocol_types::abis::gas::Gas" } }, { "name": "max_fees_per_gas", "type": { "fields": [{ "name": "fee_per_da_gas", "type": { "kind": "field" } }, { "name": "fee_per_l2_gas", "type": { "kind": "field" } }], "kind": "struct", "path": "aztec::protocol_types::abis::gas_fees::GasFees" } }, { "name": "inclusion_fee", "type": { "kind": "field" } }], "kind": "struct", "path": "aztec::protocol_types::abis::gas_settings::GasSettings" } }], "kind": "struct", "path": "aztec::protocol_types::transaction::tx_context::TxContext" } }, { "name": "start_side_effect_counter", "type": { "kind": "integer", "sign": "unsigned", "width": 32 } }], "kind": "struct", "path": "aztec::context::inputs::private_context_inputs::PrivateContextInputs" }, "visibility": "private" }, { "name": "salt", "type": { "kind": "field" }, "visibility": "private" }, { "name": "contract_class_id", "type": { "fields": [{ "name": "inner", "type": { "kind": "field" } }], "kind": "struct", "path": "aztec::protocol_types::contract_class_id::ContractClassId" }, "visibility": "private" }, { "name": "initialization_hash", "type": { "kind": "field" }, "visibility": "private" }, { "name": "public_keys_hash", "type": { "fields": [{ "name": "inner", "type": { "kind": "field" } }], "kind": "struct", "path": "aztec::protocol_types::address::public_keys_hash::PublicKeysHash" }, "visibility": "private" }, { "name": "universal_deploy", "type": { "kind": "boolean" }, "visibility": "private" }], "return_type": { "abi_type": { "fields": [{ "name": "call_context", "type": { "fields": [{ "name": "msg_sender", "type": { "fields": [{ "name": "inner", "type": { "kind": "field" } }], "kind": "struct", "path": "aztec::protocol_types::address::aztec_address::AztecAddress" } }, { "name": "storage_contract_address", "type": { "fields": [{ "name": "inner", "type": { "kind": "field" } }], "kind": "struct", "path": "aztec::protocol_types::address::aztec_address::AztecAddress" } }, { "name": "function_selector", "type": { "fields": [{ "name": "inner", "type": { "kind": "integer", "sign": "unsigned", "width": 32 } }], "kind": "struct", "path": "aztec::protocol_types::abis::function_selector::FunctionSelector" } }, { "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 } }], "kind": "struct", "path": "aztec::protocol_types::abis::call_context::CallContext" } }, { "name": "args_hash", "type": { "kind": "field" } }, { "name": "returns_hash", "type": { "kind": "field" } }, { "name": "min_revertible_side_effect_counter", "type": { "kind": "integer", "sign": "unsigned", "width": 32 } }, { "name": "max_block_number", "type": { "fields": [{ "name": "_opt", "type": { "fields": [{ "name": "_is_some", "type": { "kind": "boolean" } }, { "name": "_value", "type": { "kind": "integer", "sign": "unsigned", "width": 32 } }], "kind": "struct", "path": "std::option::Option" } }], "kind": "struct", "path": "aztec::protocol_types::abis::max_block_number::MaxBlockNumber" } }, { "name": "note_hash_read_requests", "type": { "kind": "array", "length": 32, "type": { "fields": [{ "name": "value", "type": { "kind": "field" } }, { "name": "counter", "type": { "kind": "integer", "sign": "unsigned", "width": 32 } }], "kind": "struct", "path": "aztec::protocol_types::abis::read_request::ReadRequest" } } }, { "name": "nullifier_read_requests", "type": { "kind": "array", "length": 2, "type": { "fields": [{ "name": "value", "type": { "kind": "field" } }, { "name": "counter", "type": { "kind": "integer", "sign": "unsigned", "width": 32 } }], "kind": "struct", "path": "aztec::protocol_types::abis::read_request::ReadRequest" } } }, { "name": "nullifier_key_validation_requests", "type": { "kind": "array", "length": 1, "type": { "fields": [{ "name": "master_nullifier_public_key", "type": { "fields": [{ "name": "x", "type": { "kind": "field" } }, { "name": "y", "type": { "kind": "field" } }], "kind": "struct", "path": "aztec::protocol_types::grumpkin_point::GrumpkinPoint" } }, { "name": "app_nullifier_secret_key", "type": { "kind": "field" } }], "kind": "struct", "path": "aztec::protocol_types::abis::nullifier_key_validation_request::NullifierKeyValidationRequest" } } }, { "name": "new_note_hashes", "type": { "kind": "array", "length": 16, "type": { "fields": [{ "name": "value", "type": { "kind": "field" } }, { "name": "counter", "type": { "kind": "integer", "sign": "unsigned", "width": 32 } }], "kind": "struct", "path": "aztec::protocol_types::abis::note_hash::NoteHash" } } }, { "name": "new_nullifiers", "type": { "kind": "array", "length": 16, "type": { "fields": [{ "name": "value", "type": { "kind": "field" } }, { "name": "counter", "type": { "kind": "integer", "sign": "unsigned", "width": 32 } }, { "name": "note_hash", "type": { "kind": "field" } }], "kind": "struct", "path": "aztec::protocol_types::abis::nullifier::Nullifier" } } }, { "name": "private_call_stack_hashes", "type": { "kind": "array", "length": 4, "type": { "kind": "field" } } }, { "name": "public_call_stack_hashes", "type": { "kind": "array", "length": 16, "type": { "kind": "field" } } }, { "name": "public_teardown_function_hash", "type": { "kind": "field" } }, { "name": "new_l2_to_l1_msgs", "type": { "kind": "array", "length": 2, "type": { "fields": [{ "name": "recipient", "type": { "fields": [{ "name": "inner", "type": { "kind": "field" } }], "kind": "struct", "path": "aztec::protocol_types::address::eth_address::EthAddress" } }, { "name": "content", "type": { "kind": "field" } }], "kind": "struct", "path": "aztec::protocol_types::messaging::l2_to_l1_message::L2ToL1Message" } } }, { "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_hashes", "type": { "kind": "array", "length": 4, "type": { "fields": [{ "name": "value", "type": { "kind": "field" } }, { "name": "counter", "type": { "kind": "integer", "sign": "unsigned", "width": 32 } }], "kind": "struct", "path": "aztec::protocol_types::abis::side_effect::SideEffect" } } }, { "name": "unencrypted_logs_hashes", "type": { "kind": "array", "length": 4, "type": { "fields": [{ "name": "value", "type": { "kind": "field" } }, { "name": "counter", "type": { "kind": "integer", "sign": "unsigned", "width": 32 } }], "kind": "struct", "path": "aztec::protocol_types::abis::side_effect::SideEffect" } } }, { "name": "encrypted_log_preimages_length", "type": { "kind": "field" } }, { "name": "unencrypted_log_preimages_length", "type": { "kind": "field" } }, { "name": "historical_header", "type": { "fields": [{ "name": "last_archive", "type": { "fields": [{ "name": "root", "type": { "kind": "field" } }, { "name": "next_available_leaf_index", "type": { "kind": "integer", "sign": "unsigned", "width": 32 } }], "kind": "struct", "path": "aztec::protocol_types::abis::append_only_tree_snapshot::AppendOnlyTreeSnapshot" } }, { "name": "content_commitment", "type": { "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" } }], "kind": "struct", "path": "aztec::protocol_types::content_commitment::ContentCommitment" } }, { "name": "state", "type": { "fields": [{ "name": "l1_to_l2_message_tree", "type": { "fields": [{ "name": "root", "type": { "kind": "field" } }, { "name": "next_available_leaf_index", "type": { "kind": "integer", "sign": "unsigned", "width": 32 } }], "kind": "struct", "path": "aztec::protocol_types::abis::append_only_tree_snapshot::AppendOnlyTreeSnapshot" } }, { "name": "partial", "type": { "fields": [{ "name": "note_hash_tree", "type": { "fields": [{ "name": "root", "type": { "kind": "field" } }, { "name": "next_available_leaf_index", "type": { "kind": "integer", "sign": "unsigned", "width": 32 } }], "kind": "struct", "path": "aztec::protocol_types::abis::append_only_tree_snapshot::AppendOnlyTreeSnapshot" } }, { "name": "nullifier_tree", "type": { "fields": [{ "name": "root", "type": { "kind": "field" } }, { "name": "next_available_leaf_index", "type": { "kind": "integer", "sign": "unsigned", "width": 32 } }], "kind": "struct", "path": "aztec::protocol_types::abis::append_only_tree_snapshot::AppendOnlyTreeSnapshot" } }, { "name": "public_data_tree", "type": { "fields": [{ "name": "root", "type": { "kind": "field" } }, { "name": "next_available_leaf_index", "type": { "kind": "integer", "sign": "unsigned", "width": 32 } }], "kind": "struct", "path": "aztec::protocol_types::abis::append_only_tree_snapshot::AppendOnlyTreeSnapshot" } }], "kind": "struct", "path": "aztec::protocol_types::partial_state_reference::PartialStateReference" } }], "kind": "struct", "path": "aztec::protocol_types::state_reference::StateReference" } }, { "name": "global_variables", "type": { "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": { "fields": [{ "name": "inner", "type": { "kind": "field" } }], "kind": "struct", "path": "aztec::protocol_types::address::eth_address::EthAddress" } }, { "name": "fee_recipient", "type": { "fields": [{ "name": "inner", "type": { "kind": "field" } }], "kind": "struct", "path": "aztec::protocol_types::address::aztec_address::AztecAddress" } }, { "name": "gas_fees", "type": { "fields": [{ "name": "fee_per_da_gas", "type": { "kind": "field" } }, { "name": "fee_per_l2_gas", "type": { "kind": "field" } }], "kind": "struct", "path": "aztec::protocol_types::abis::gas_fees::GasFees" } }], "kind": "struct", "path": "aztec::protocol_types::abis::global_variables::GlobalVariables" } }], "kind": "struct", "path": "aztec::protocol_types::header::Header" } }, { "name": "tx_context", "type": { "fields": [{ "name": "chain_id", "type": { "kind": "field" } }, { "name": "version", "type": { "kind": "field" } }, { "name": "gas_settings", "type": { "fields": [{ "name": "gas_limits", "type": { "fields": [{ "name": "da_gas", "type": { "kind": "integer", "sign": "unsigned", "width": 32 } }, { "name": "l2_gas", "type": { "kind": "integer", "sign": "unsigned", "width": 32 } }], "kind": "struct", "path": "aztec::protocol_types::abis::gas::Gas" } }, { "name": "teardown_gas_limits", "type": { "fields": [{ "name": "da_gas", "type": { "kind": "integer", "sign": "unsigned", "width": 32 } }, { "name": "l2_gas", "type": { "kind": "integer", "sign": "unsigned", "width": 32 } }], "kind": "struct", "path": "aztec::protocol_types::abis::gas::Gas" } }, { "name": "max_fees_per_gas", "type": { "fields": [{ "name": "fee_per_da_gas", "type": { "kind": "field" } }, { "name": "fee_per_l2_gas", "type": { "kind": "field" } }], "kind": "struct", "path": "aztec::protocol_types::abis::gas_fees::GasFees" } }, { "name": "inclusion_fee", "type": { "kind": "field" } }], "kind": "struct", "path": "aztec::protocol_types::abis::gas_settings::GasSettings" } }], "kind": "struct", "path": "aztec::protocol_types::transaction::tx_context::TxContext" } }], "kind": "struct", "path": "aztec::protocol_types::abis::private_circuit_public_inputs::PrivateCircuitPublicInputs" }, "visibility": "public" }, "return_witnesses": [542, 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 658, 659, 660, 661, 662, 663, 664, 665, 666, 667, 668, 669, 670, 671, 672, 673, 674, 675, 676, 677, 678, 679, 680, 681, 682, 683, 684, 685, 686, 687, 688, 689, 690, 691, 692, 693, 694, 695, 696, 697, 698, 699, 700, 701, 702, 703, 704, 705, 706, 707, 708, 709, 710, 711, 712, 713, 714, 715, 716, 717, 718, 719, 720, 721, 722, 723, 724, 725, 726, 727, 728, 729, 730, 731, 732, 733, 734, 735, 736, 737, 738, 739, 740, 741, 742, 743, 744, 745, 746, 747, 748, 749, 750, 751, 752, 753, 754, 755, 756, 757, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 770, 771, 772, 773, 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wydjAJGMDk0wpAzI2MMnYwCRjA5OMDUwyNjDIlA1MMjYwydjAJGMDk0wpAzI2MMnYwCRjA5OMDUwyNjDITDYwydjAJGMDk4wNTDKlDMjYwCRjA5OMDUwyNjDJ2MAgM9vAJGMDk4wNTDI2MMmUMiBjA5OMDUwyNjDJ2MAk8/UbeDjMp6uHQ7/1N+jWGl4uXuer04/1+/G/wYNso8dv+z7+sO/jj/s+fu37+NO+jz/v+/jLvo/f9338fd91+77vun3fd92+77tu3/dd9xs8Si96/H3fdfu+77p933fdvu+7bt/3XXfd91133fddd933XXfd9133GzzwKXr8fd91133fddd933XXfd91M8/Q6b3Ox1/bcH384wdZMg+YufVBEnewoQ0nreOP2vqHDzK27+Av+y7n/0LQ+nD97/GXl8N9t/1/rx16Lf30yezTPH32EY9v/Of+l4f779+/+3h8p+df+/Xxh6eHD48vbz799+f//8rx2v8B" }], "outputs": { "globals": {}, "structs": { "functions": [{ "fields": [{ "name": "parameters", "type": { "fields": [{ "name": "salt", "type": { "kind": "field" } }, { "name": "contract_class_id", "type": { "fields": [{ "name": "inner", "type": { "kind": "field" } }], "kind": "struct", "path": "aztec::protocol_types::contract_class_id::ContractClassId" } }, { "name": "initialization_hash", "type": { "kind": "field" } }, { "name": "public_keys_hash", "type": { "fields": [{ "name": "inner", "type": { "kind": "field" } }], "kind": "struct", "path": "aztec::protocol_types::address::public_keys_hash::PublicKeysHash" } }, { "name": "universal_deploy", "type": { "kind": "boolean" } }], "kind": "struct", "path": "ContractInstanceDeployer::deploy_parameters" } }], "kind": "struct", "path": "ContractInstanceDeployer::deploy_abi" }] } }, "file_map": { "106": { "path": "/usr/src/noir-projects/aztec-nr/aztec/src/oracle/logs_traits.nr", "source": "use dep::protocol_types::address::AztecAddress;\n\n// TODO: this is awful but since we can't have a fn that maps [Field; N] -> [Field; N+7]\n// (where N is encrypted log preimage size and N+7 is encryption output size)\n// and can't return slices from oracles, this at least compiles and runs\n// The fns for LensForEncryptedLog are never used, it's just to tell the compiler what the lens are\n\n// The to_bytes fn for ToBytesForUnencryptedLog is used to allow us to hash some generic T\n\n// I could have omitted N from the trait, but wanted to keep it strictly for field arrs\n// TODO(1139): Once we enc inside the circuit, we will no longer need the oracle to return\n// anything, so we can remove this trait\ntrait LensForEncryptedLog<N, M, L> {\n // N = note preimage input in fields\n // M = encryption output len in fields (= N + 7 = N + 3 fields for addr, slot, type + 3.5 fields for AES data)\n // L = encryption output len in bytes (= 32*M - 16)\n fn output_fields(self: [Field; N]) -> [Field; M];\n fn output_bytes(self: [Field; N]) -> [u8; L];\n}\n\nimpl LensForEncryptedLog<1, 8, 240> for [Field; 1] {\n fn output_fields(self) -> [Field; 8] {[self[0]; 8]}\n fn output_bytes(self) -> [u8; 240] {[self[0] as u8; 240]}\n}\nimpl LensForEncryptedLog<2, 9, 272> for [Field; 2] {\n fn output_fields(self) -> [Field; 9] {[self[0]; 9]}\n fn output_bytes(self) -> [u8; 272] {[self[0] as u8; 272]}\n}\nimpl LensForEncryptedLog<3, 10, 304> for [Field; 3] {\n fn output_fields(self) -> [Field; 10] {[self[0]; 10]}\n fn output_bytes(self) -> [u8; 304] {[self[0] as u8; 304]}\n}\nimpl LensForEncryptedLog<4, 11, 336> for [Field; 4] {\n fn output_fields(self) -> [Field; 11] {[self[0]; 11]}\n fn output_bytes(self) -> [u8; 336] {[self[0] as u8; 336]}\n}\nimpl LensForEncryptedLog<5, 12, 368> for [Field; 5] {\n fn output_fields(self) -> [Field; 12] {[self[0]; 12]}\n fn output_bytes(self) -> [u8; 368] {[self[0] as u8; 368]}\n}\nimpl LensForEncryptedLog<6, 13, 400> for [Field; 6] {\n fn output_fields(self) -> [Field; 13] {[self[0]; 13]}\n fn output_bytes(self) -> [u8; 400] {[self[0] as u8; 400]}\n}\n\n// This trait defines the length of the inputs in bytes to\n// the unencrypted log hash fn, where the log can be any type T\n// as long as the ACVM can convert to fields.\ntrait ToBytesForUnencryptedLog<N, M> {\n // N = preimage input in bytes (32 * num fields or chars)\n // M = full log input in bytes ( = N + 40 = N + 32 for addr, + 4 for selector, + 4 for len)\n fn to_be_bytes_arr(self) -> [u8; N];\n fn output_bytes(self) -> [u8; M];\n}\n\nimpl ToBytesForUnencryptedLog<32, 72> for Field {\n fn to_be_bytes_arr(self) -> [u8; 32] {\n self.to_be_bytes(32).as_array()\n }\n fn output_bytes(self) -> [u8; 72] {[self as u8; 72]}\n}\n\nimpl ToBytesForUnencryptedLog<32, 72> for AztecAddress {\n fn to_be_bytes_arr(self) -> [u8; 32] {\n self.to_field().to_be_bytes(32).as_array()\n }\n fn output_bytes(self) -> [u8; 72] {[self.to_field() as u8; 72]}\n}\n\nfn arr_to_be_bytes_arr<N, L>(fields: [Field; L]) -> [u8; N] {\n let mut bytes: [u8] = &[];\n for i in 0..L {\n // Note that bytes.append() results in bound error\n let to_add = fields[i].to_be_bytes(32);\n for j in 0..32 {\n bytes = bytes.push_back(to_add[j]);\n }\n }\n bytes.as_array()\n}\n\n// each character of a string is converted into a byte\n// then an ACVM field via the oracle => we recreate here\nfn str_to_be_bytes_arr<N, L>(string: str<L>) -> [u8; N] {\n let chars_bytes = string.as_bytes();\n let mut bytes: [u8] = &[];\n for i in 0..L {\n let to_add = (chars_bytes[i] as Field).to_be_bytes(32);\n for j in 0..32 {\n bytes = bytes.push_back(to_add[j]);\n }\n }\n bytes.as_array()\n}\n\nimpl ToBytesForUnencryptedLog<32, 72> for [Field; 1] {\n fn to_be_bytes_arr(self) -> [u8; 32] {\n arr_to_be_bytes_arr(self)\n }\n fn output_bytes(self) -> [u8; 72] {\n [self[0] as u8; 72]\n }\n}\n\nimpl ToBytesForUnencryptedLog<64, 104> for [Field; 2] {\n fn to_be_bytes_arr(self) -> [u8; 64] {\n arr_to_be_bytes_arr(self)\n }\n fn output_bytes(self) -> [u8; 104] {\n [self[0] as u8; 104]\n }\n}\n\nimpl ToBytesForUnencryptedLog<96, 136> for [Field; 3] {\n fn to_be_bytes_arr(self) -> [u8; 96] {\n arr_to_be_bytes_arr(self)\n }\n fn output_bytes(self) -> [u8; 136] {\n [self[0] as u8; 136]\n }\n}\n\nimpl ToBytesForUnencryptedLog<128, 168> for [Field; 4] {\n fn to_be_bytes_arr(self) -> [u8; 128] {\n arr_to_be_bytes_arr(self)\n }\n fn output_bytes(self) -> [u8; 168] {\n [self[0] as u8; 168]\n }\n}\n\nimpl ToBytesForUnencryptedLog<160, 200> for [Field; 5] {\n fn to_be_bytes_arr(self) -> [u8; 160] {\n arr_to_be_bytes_arr(self)\n }\n fn output_bytes(self) -> [u8; 200] {\n [self[0] as u8; 200]\n }\n}\n\nimpl ToBytesForUnencryptedLog<192, 232> for [Field; 6] {\n fn to_be_bytes_arr(self) -> [u8; 192] {\n arr_to_be_bytes_arr(self)\n }\n fn output_bytes(self) -> [u8; 232] {\n [self[0] as u8; 232]\n }\n}\n\nimpl ToBytesForUnencryptedLog<224, 264> for [Field; 7] {\n fn to_be_bytes_arr(self) -> [u8; 224] {\n arr_to_be_bytes_arr(self)\n }\n fn output_bytes(self) -> [u8; 264] {\n [self[0] as u8; 264]\n }\n}\n\nimpl ToBytesForUnencryptedLog<256, 296> for [Field; 8] {\n fn to_be_bytes_arr(self) -> [u8; 256] {\n arr_to_be_bytes_arr(self)\n }\n fn output_bytes(self) -> [u8; 296] {\n [self[0] as u8; 296]\n }\n}\n\nimpl ToBytesForUnencryptedLog<288, 328> for [Field; 9] {\n fn to_be_bytes_arr(self) -> [u8; 288] {\n arr_to_be_bytes_arr(self)\n }\n fn output_bytes(self) -> [u8; 328] {\n [self[0] as u8; 328]\n }\n}\n\nimpl ToBytesForUnencryptedLog<320, 360> for [Field; 10] {\n fn to_be_bytes_arr(self) -> [u8; 320] {\n arr_to_be_bytes_arr(self)\n }\n fn output_bytes(self) -> [u8; 360] {\n [self[0] as u8; 360]\n }\n}\n\nimpl ToBytesForUnencryptedLog<352, 392> for [Field; 11] {\n fn to_be_bytes_arr(self) -> [u8; 352] {\n arr_to_be_bytes_arr(self)\n }\n fn output_bytes(self) -> [u8; 392] {\n [self[0] as u8; 392]\n }\n}\n\nimpl ToBytesForUnencryptedLog<384, 424> for [Field; 12] {\n fn to_be_bytes_arr(self) -> [u8; 384] {\n arr_to_be_bytes_arr(self)\n }\n fn output_bytes(self) -> [u8; 424] {\n [self[0] as u8; 424]\n }\n}\n\nimpl ToBytesForUnencryptedLog<416, 456> for [Field; 13] {\n fn to_be_bytes_arr(self) -> [u8; 416] {\n arr_to_be_bytes_arr(self)\n }\n fn output_bytes(self) -> [u8; 456] {\n [self[0] as u8; 456]\n }\n}\n\nimpl ToBytesForUnencryptedLog<448, 488> for [Field; 14] {\n fn to_be_bytes_arr(self) -> [u8; 448] {\n arr_to_be_bytes_arr(self)\n }\n fn output_bytes(self) -> [u8; 488] {\n [self[0] as u8; 488]\n }\n}\n\nimpl ToBytesForUnencryptedLog<480, 520> for [Field; 15] {\n fn to_be_bytes_arr(self) -> [u8; 480] {\n arr_to_be_bytes_arr(self)\n }\n fn output_bytes(self) -> [u8; 520] {\n [self[0] as u8; 520]\n }\n}\n\nimpl ToBytesForUnencryptedLog<512, 552> for [Field; 16] {\n fn to_be_bytes_arr(self) -> [u8; 512] {\n arr_to_be_bytes_arr(self)\n }\n fn output_bytes(self) -> [u8; 552] {\n [self[0] as u8; 552]\n }\n}\n\nimpl ToBytesForUnencryptedLog<544, 584> for [Field; 17] {\n fn to_be_bytes_arr(self) -> [u8; 544] {\n arr_to_be_bytes_arr(self)\n }\n fn output_bytes(self) -> [u8; 584] {\n [self[0] as u8; 584]\n }\n}\n\nimpl ToBytesForUnencryptedLog<576, 616> for [Field; 18] {\n fn to_be_bytes_arr(self) -> [u8; 576] {\n arr_to_be_bytes_arr(self)\n }\n fn output_bytes(self) -> [u8; 616] {\n [self[0] as u8; 616]\n }\n}\n\nimpl ToBytesForUnencryptedLog<608, 648> for [Field; 19] {\n fn to_be_bytes_arr(self) -> [u8; 608] {\n arr_to_be_bytes_arr(self)\n }\n fn output_bytes(self) -> [u8; 648] {\n [self[0] as u8; 648]\n }\n}\n\nimpl ToBytesForUnencryptedLog<640, 680> for [Field; 20] {\n fn to_be_bytes_arr(self) -> [u8; 640] {\n arr_to_be_bytes_arr(self)\n }\n fn output_bytes(self) -> [u8; 680] {\n [self[0] as u8; 680]\n }\n}\n\nimpl ToBytesForUnencryptedLog<672, 712> for [Field; 21] {\n fn to_be_bytes_arr(self) -> [u8; 672] {\n arr_to_be_bytes_arr(self)\n }\n fn output_bytes(self) -> [u8; 712] {\n [self[0] as u8; 712]\n }\n}\n\nimpl ToBytesForUnencryptedLog<704, 744> for [Field; 22] {\n fn to_be_bytes_arr(self) -> [u8; 704] {\n arr_to_be_bytes_arr(self)\n }\n fn output_bytes(self) -> [u8; 744] {\n [self[0] as u8; 744]\n }\n}\n\nimpl ToBytesForUnencryptedLog<736, 776> for [Field; 23] {\n fn to_be_bytes_arr(self) -> [u8; 736] {\n arr_to_be_bytes_arr(self)\n }\n fn output_bytes(self) -> [u8; 776] {\n [self[0] as u8; 776]\n }\n}\n\nimpl ToBytesForUnencryptedLog<768, 808> for [Field; 24] {\n fn to_be_bytes_arr(self) -> [u8; 768] {\n arr_to_be_bytes_arr(self)\n }\n fn output_bytes(self) -> [u8; 808] {\n [self[0] as u8; 808]\n }\n}\n\nimpl<N,M,L> ToBytesForUnencryptedLog<N, M> for str<L> where [Field; L]: ToBytesForUnencryptedLog<N,M> {\n fn to_be_bytes_arr(self) -> [u8; N] {\n str_to_be_bytes_arr(self)\n }\n fn output_bytes(self) -> [u8; M] {\n [0; M]\n }\n}\n" }, "130": { "path": "/usr/src/noir-projects/aztec-nr/aztec/src/hash.nr", "source": "use dep::protocol_types::{\n address::{AztecAddress, EthAddress},\n constants::{\n GENERATOR_INDEX__SECRET_HASH, GENERATOR_INDEX__MESSAGE_NULLIFIER, ARGS_HASH_CHUNK_COUNT,\n GENERATOR_INDEX__FUNCTION_ARGS, ARGS_HASH_CHUNK_LENGTH\n},\n traits::Hash, hash::{pedersen_hash, poseidon2_hash, silo_nullifier, sha256_to_field}\n};\nuse crate::oracle::logs_traits::{LensForEncryptedLog, ToBytesForUnencryptedLog};\n\npub fn compute_secret_hash(secret: Field) -> Field {\n pedersen_hash([secret], GENERATOR_INDEX__SECRET_HASH)\n}\n\npub fn compute_encrypted_log_hash<N, M, L>(\n encrypted_log: [Field; M]\n) -> Field where [Field; N]: LensForEncryptedLog<N, M, L> {\n let mut bytes = [0; L];\n // Note that bytes.append(encrypted_log[i].to_be_bytes(31)) results in bound error\n for i in 0..M-1 {\n let to_add = encrypted_log[i].to_be_bytes(31);\n for j in 0..31 {\n bytes[i*31 + j] = to_add[j];\n }\n }\n // can't assign as L - not in scope error for: L-31*(M-1)\n let num_bytes = bytes.len() as u32 - 31*(M-1);\n let to_add_final = encrypted_log[M-1].to_be_bytes(num_bytes);\n for j in 0..num_bytes {\n bytes[(M-1)*31 + j] = to_add_final[j];\n }\n sha256_to_field(bytes)\n}\n\npub fn compute_unencrypted_log_hash<T, N, M>(\n contract_address: AztecAddress,\n event_selector: Field,\n log: T,\n) -> Field where T: ToBytesForUnencryptedLog<N, M> {\n let message_bytes: [u8; N] = log.to_be_bytes_arr();\n // can't use N - not in scope error\n let n = message_bytes.len();\n let mut hash_bytes = [0; M];\n // Address is converted to 32 bytes in ts\n let address_bytes = contract_address.to_be_bytes_arr();\n for i in 0..32 {\n hash_bytes[i] = address_bytes[i];\n }\n let event_bytes = event_selector.to_be_bytes(4);\n for i in 0..4 {\n hash_bytes[32 + i] = event_bytes[i];\n }\n let len_bytes = (n as Field).to_be_bytes(4);\n for i in 0..4 {\n hash_bytes[36 + i] = len_bytes[i];\n }\n for i in 0..n {\n hash_bytes[40 + i] = message_bytes[i];\n }\n\n sha256_to_field(hash_bytes)\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__MESSAGE_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 assert(args.len() < ARGS_HASH_CHUNK_COUNT * ARGS_HASH_CHUNK_LENGTH);\n let mut chunks_hashes = [0; ARGS_HASH_CHUNK_COUNT];\n let mut current_chunk_values = [0; ARGS_HASH_CHUNK_LENGTH];\n\n let mut current_chunk_index = 0;\n let mut index_inside_current_chunk = 0;\n for i in 0..args.len() {\n current_chunk_values[index_inside_current_chunk] = args[i];\n index_inside_current_chunk+=1;\n if index_inside_current_chunk == ARGS_HASH_CHUNK_LENGTH {\n chunks_hashes[current_chunk_index] = pedersen_hash(current_chunk_values, GENERATOR_INDEX__FUNCTION_ARGS);\n current_chunk_values = [0; ARGS_HASH_CHUNK_LENGTH];\n current_chunk_index+=1;\n index_inside_current_chunk = 0;\n }\n }\n if index_inside_current_chunk > 0 {\n chunks_hashes[current_chunk_index] = pedersen_hash(current_chunk_values, GENERATOR_INDEX__FUNCTION_ARGS);\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\n#[test]\nfn compute_enc_log_hash_304() {\n let input = [\n 0x0000000000000000000000000000000000000000000000000000000000000000,\n 0x0021a0d4aa9989656b592187cf6da1965df53ab2ff2277421e663465cf20d3e9,\n 0x00c3969cc350f3474f8187a33ac1317181961f5f94043b07ce888d85a5d20cb5,\n 0x0058198041ed1547b056955b5141a5a8a1551b0c8d094255ec9daaf3604d9348,\n 0x00247ad96df2e4d984cf795ed7316234743a681f824a45c46253de8bfde48850,\n 0x007fc251f4ce44f4e9aba3dbf6567228be28fac85660156f2825ddb0b0577457,\n 0x009315851323c6bc2aaa42e23fe5f3be97208f2d8167eafdfc5742d94f2f4dd4,\n 0x00b938289e563b0fe01982cd9b8d9e33e3069046768ad01c0fb05e429e7b7909,\n 0x00fbcc257a3211f705b471eee763b0f43876a2b2178fab6d2b09bd2b7e086584,\n 0x000000000000008c3289b5793b7448f4d45ecde039d004b6f037cad10b5c2336\n ];\n let hash = compute_encrypted_log_hash(input);\n assert(hash == 0x001e3c013994947fe28957a876bf1b2c3a69ac69cc92909efd4f2ae9b972f893);\n}\n\n#[test]\nfn compute_enc_log_hash_368() {\n let input = [\n 0x0000000000000000000000000000000000000000000000000000000000000000,\n 0x002190697d2a50e229a7a077e0951073f7d51e46679f10466153c308b63b1ea9,\n 0x00543e346facc6799b94514c9d461bcc836c04b083b13c2e4544a39130473c1e,\n 0x000df76d59526f8f953bcc7d9f77cdaefd36435931f0d7348f794bc275b42ded,\n 0x00a6d390ee1723af7f7ac1ae4fc81a266b2370fe07040a36d06dbe242e02413e,\n 0x00acbce15b6af1fbe94bd0f7b70f11768265dff77bfe63398f2a053efdfdf26d,\n 0x00b8b131b9f42c689beb095ba4f4a836d4d15c9068d0422e9add6ca82b786329,\n 0x00661a6a654b38f0f97d404ef5553e0efea9ed670561ae86685b31bbb2824fac,\n 0x00113a6b58edfaec0065b365f66ba8d8aa68254b8690035e8d671a17a843f0a1,\n 0x0023f2d2eae8c4449bac8f268a3e62a3faace1fe1401f0efdc8b0ccfbc8fb271,\n 0x00cf6603f8c61993dd2f662c719671c61727a2f4e925fb988b23d31feccd77d9,\n 0x0000000000a402a84b7294671799c38dd805f6a827a3a12633fdf91a57debe1f\n ];\n let hash = compute_encrypted_log_hash(input);\n assert(hash == 0x00a0d651ac0cbc01b72430fa6a05d91738595af6e0229347b4c9968223387aeb);\n}\n\n#[test]\nfn compute_unenc_log_hash_array() {\n let contract_address = AztecAddress::from_field(0x233a3e0df23b2b15b324194cb4a151f26c0b7333250781d34cc269d85dc334c6);\n let event_selector = 5;\n let log = [\n 0x20660de09f35f876e3e69d227b2a35166ad05f09d82d06366ec9b6f65a51fec2,\n 0x1b52bfe3b8689761916f76dc3d38aa8810860db325cd39ca611eed980091f01c,\n 0x2e559c4045c378a56ad13b9edb1e8de4e7ad3b3aa35cc7ba9ec77f7a68fa43a4,\n 0x25d0f689c4a4178a29d59306f2675824d19be6d25e44fa03b03f49c263053dd2,\n 0x2d513a722d6f352dc0961f156afdc5e31495b9f0e35cb069261a8e55e2df67fd\n ];\n let hash = compute_unencrypted_log_hash(contract_address, event_selector, log);\n assert(hash == 0x00846d6969c8c2f61d39cd2762efcb0abb14f88d59c2675910251ef2bcffe9a7);\n}\n\n#[test]\nfn compute_unenc_log_hash_addr() {\n let contract_address = AztecAddress::from_field(0x233a3e0df23b2b15b324194cb4a151f26c0b7333250781d34cc269d85dc334c6);\n let event_selector = 5;\n let log = AztecAddress::from_field(0x26aa302d4715fd8a687453cb26d616b0768027bd54bcae56b09d908ecd9f8303);\n let hash = compute_unencrypted_log_hash(contract_address, event_selector, log);\n assert(hash == 0x00880a801230ea08c98a802a11b4786cba474513875f0fc69a615e81c5f9f21c);\n}\n\n#[test]\nfn compute_unenc_log_hash_str() {\n let contract_address = AztecAddress::from_field(0x1b401e1146c5c507962287065c81f0ef7590adae3802c533d7549d6bf0a41bd8);\n let event_selector = 5;\n let log = \"dummy\";\n let hash = compute_unencrypted_log_hash(contract_address, event_selector, log);\n assert(hash == 0x00a78b5347813624ecfd26e5b8bc6146f418b0cfcc8296b5112d09b8ebba9496);\n}\n\n#[test]\nfn compute_unenc_log_hash_longer_str() {\n let contract_address = AztecAddress::from_field(0x1b401e1146c5c507962287065c81f0ef7590adae3802c533d7549d6bf0a41bd8);\n let event_selector = 5;\n let log = \"Hello this is a string\";\n let hash = compute_unencrypted_log_hash(contract_address, event_selector, log);\n assert(hash == 0x001f3390ea242afee7ce46dafdbdc4bd4f1cf20cd63850d12d60ff9956712c4f);\n}\n" }, "152": { "path": "/usr/src/noir-projects/noir-protocol-circuits/crates/types/src/address/aztec_address.nr", "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_V1},\n contract_class_id::ContractClassId, hash::poseidon2_hash, grumpkin_point::GrumpkinPoint,\n traits::{Empty, FromField, 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 FromField for AztecAddress {\n fn from_field(value: Field) -> AztecAddress {\n AztecAddress { inner: value }\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 FromField::from_field(fields[0])\n }\n}\n\nimpl AztecAddress {\n pub fn zero() -> Self {\n Self { inner: 0 }\n }\n\n pub fn compute(pub_keys_hash: PublicKeysHash, partial_address: PartialAddress) -> AztecAddress {\n AztecAddress::from_field(\n poseidon2_hash(\n [pub_keys_hash.to_field(), partial_address.to_field(), GENERATOR_INDEX__CONTRACT_ADDRESS_V1]\n )\n )\n }\n\n pub fn compute_from_public_keys_and_partial_address(\n nullifier_public_key: GrumpkinPoint,\n incoming_public_key: GrumpkinPoint,\n outgoing_public_key: GrumpkinPoint,\n tagging_public_key: GrumpkinPoint,\n partial_address: PartialAddress,\n ) -> AztecAddress {\n let public_keys_hash = PublicKeysHash::compute_new(\n nullifier_public_key,\n incoming_public_key,\n outgoing_public_key,\n tagging_public_key,\n );\n\n let computed_address = AztecAddress::compute(public_keys_hash, partial_address);\n\n computed_address\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_from_partial_and_pubkey() {\n let pub_keys_hash = PublicKeysHash::from_field(1);\n let partial_address = PartialAddress::from_field(2);\n\n let address = AztecAddress::compute(pub_keys_hash, partial_address);\n let expected_computed_address_from_partial_and_pubkey = 0x1b6ead051e7b42665064ca6cf1ec77da0a36d86e00d1ff6e44077966c0c3a9fa;\n assert(address.to_field() == expected_computed_address_from_partial_and_pubkey);\n}\n\n#[test]\nfn from_field_to_field() {\n let address = AztecAddress { inner: 37 };\n assert_eq(FromField::from_field(address.to_field()), address);\n}\n\n#[test]\nfn serde() {\n let address = AztecAddress { inner: 37 };\n assert_eq(Deserialize::deserialize(address.serialize()), address);\n}\n" }, "153": { "path": "/usr/src/noir-projects/noir-protocol-circuits/crates/types/src/address/salted_initialization_hash.nr", "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(salt: Field, initialization_hash: Field, deployer: AztecAddress) -> Self {\n SaltedInitializationHash::from_field(\n pedersen_hash(\n [\n salt,\n initialization_hash,\n deployer.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" }, "154": { "path": "/usr/src/noir-projects/noir-protocol-circuits/crates/types/src/address/partial_address.nr", "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, FromField, Serialize, Deserialize}\n};\n\nglobal PARTIAL_ADDRESS_LENGTH = 1;\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 Serialize<PARTIAL_ADDRESS_LENGTH> for PartialAddress {\n fn serialize(self: Self) -> [Field; PARTIAL_ADDRESS_LENGTH] {\n [self.to_field()]\n }\n}\n\nimpl Deserialize<PARTIAL_ADDRESS_LENGTH> for PartialAddress {\n fn deserialize(fields: [Field; PARTIAL_ADDRESS_LENGTH]) -> Self {\n PartialAddress { inner: fields[0] }\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 deployer: AztecAddress\n ) -> Self {\n PartialAddress::compute_from_salted_initialization_hash(\n contract_class_id,\n SaltedInitializationHash::compute(salt, initialization_hash, 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 is_zero(self) -> bool {\n self.to_field() == 0\n }\n\n pub fn assert_is_zero(self) {\n assert(self.to_field() == 0);\n }\n}\n" }, "163": { "path": "/usr/src/noir-projects/noir-protocol-circuits/crates/types/src/traits.nr", "source": "use dep::std::cmp::Eq;\nuse crate::utils::field::field_from_bytes;\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}\nimpl<N> ToField for str<N> {\n fn to_field(self) -> Field {\n assert(N < 32, \"String doesn't fit in a field, consider using Serialize instead\");\n field_from_bytes(self.as_bytes(), true)\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\nimpl<N> Serialize<N> for str<N> {\n fn serialize(self) -> [Field; N] {\n let mut result = [0; N];\n let bytes: [u8; N] = self.as_bytes();\n for i in 0..N {\n result[i] = field_from_bytes([bytes[i];1], true);\n }\n result\n }\n}\n\n// docs:start:deserialize\ntrait Deserialize<N> {\n fn deserialize(fields: [Field; N]) -> Self;\n}\n// docs:end:deserialize\n" }, "22": { "path": "std/field.nr", "source": "mod bn254;\nuse bn254::lt as bn254_lt;\n\nimpl Field {\n pub fn to_le_bits(self: Self, bit_size: u32) -> [u1] {\n crate::assert_constant(bit_size);\n self.__to_le_bits(bit_size)\n }\n\n pub fn to_be_bits(self: Self, bit_size: u32) -> [u1] {\n crate::assert_constant(bit_size);\n self.__to_be_bits(bit_size)\n }\n\n #[builtin(to_le_bits)]\n fn __to_le_bits(self, _bit_size: u32) -> [u1] {}\n\n #[builtin(to_be_bits)]\n fn __to_be_bits(self, bit_size: u32) -> [u1] {}\n\n #[builtin(apply_range_constraint)]\n fn __assert_max_bit_size(self, bit_size: u32) {}\n\n pub fn assert_max_bit_size(self: Self, bit_size: u32) {\n crate::assert_constant(bit_size);\n assert(bit_size < modulus_num_bits() as u32);\n self.__assert_max_bit_size(bit_size);\n }\n\n pub fn to_le_bytes(self: Self, byte_size: u32) -> [u8] {\n self.to_le_radix(256, byte_size)\n }\n\n pub fn to_be_bytes(self: Self, byte_size: u32) -> [u8] {\n self.to_be_radix(256, byte_size)\n }\n\n pub fn to_le_radix(self: Self, radix: u32, result_len: u32) -> [u8] {\n crate::assert_constant(radix);\n crate::assert_constant(result_len);\n self.__to_le_radix(radix, result_len)\n }\n\n pub fn to_be_radix(self: Self, radix: u32, result_len: u32) -> [u8] {\n crate::assert_constant(radix);\n crate::assert_constant(result_len);\n self.__to_be_radix(radix, result_len)\n }\n\n // decompose `_self` into a `_result_len` vector over the `_radix` basis\n // `_radix` must be less than 256\n #[builtin(to_le_radix)]\n fn __to_le_radix(self, radix: u32, result_len: u32) -> [u8] {}\n\n #[builtin(to_be_radix)]\n fn __to_be_radix(self, radix: u32, result_len: u32) -> [u8] {}\n\n // Returns self to the power of the given exponent value.\n // Caution: we assume the exponent fits into 32 bits\n // using a bigger bit size impacts negatively the performance and should be done only if the exponent does not fit in 32 bits\n pub fn pow_32(self, exponent: Field) -> Field {\n let mut r: Field = 1;\n let b = exponent.to_le_bits(32);\n\n for i in 1..33 {\n r *= r;\n r = (b[32-i] as Field) * (r * self) + (1 - b[32-i] as Field) * r;\n }\n r\n }\n\n // Parity of (prime) Field element, i.e. sgn0(x mod p) = 0 if x ∈ {0, ..., p-1} is even, otherwise sgn0(x mod p) = 1.\n pub fn sgn0(self) -> u1 {\n self as u1\n }\n\n pub fn lt(self, another: Field) -> bool {\n if crate::compat::is_bn254() {\n bn254_lt(self, another)\n } else {\n lt_fallback(self, another)\n }\n }\n}\n\n#[builtin(modulus_num_bits)]\npub fn modulus_num_bits() -> u64 {}\n\n#[builtin(modulus_be_bits)]\npub fn modulus_be_bits() -> [u1] {}\n\n#[builtin(modulus_le_bits)]\npub fn modulus_le_bits() -> [u1] {}\n\n#[builtin(modulus_be_bytes)]\npub fn modulus_be_bytes() -> [u8] {}\n\n#[builtin(modulus_le_bytes)]\npub fn modulus_le_bytes() -> [u8] {}\n// Convert a 32 byte array to a field element by modding\npub fn bytes32_to_field(bytes32: [u8; 32]) -> Field {\n // Convert it to a field element\n let mut v = 1;\n let mut high = 0 as Field;\n let mut low = 0 as Field;\n\n for i in 0..16 {\n high = high + (bytes32[15 - i] as Field) * v;\n low = low + (bytes32[16 + 15 - i] as Field) * v;\n v = v * 256;\n }\n // Abuse that a % p + b % p = (a + b) % p and that low < p\n low + high * v\n}\n\nfn lt_fallback(x: Field, y: Field) -> bool {\n let num_bytes = (modulus_num_bits() as u32 + 7) / 8;\n let x_bytes = x.to_le_bytes(num_bytes);\n let y_bytes = y.to_le_bytes(num_bytes);\n let mut x_is_lt = false;\n let mut done = false;\n for i in 0..num_bytes {\n if (!done) {\n let x_byte = x_bytes[num_bytes - 1 - i] as u8;\n let y_byte = y_bytes[num_bytes - 1 - i] as u8;\n let bytes_match = x_byte == y_byte;\n if !bytes_match {\n x_is_lt = x_byte < y_byte;\n done = true;\n }\n }\n }\n x_is_lt\n}\n\n" }, "227": { "path": "/usr/src/noir-projects/noir-protocol-circuits/crates/types/src/debug_log.nr", "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) {}\n#[oracle(debugLog)]\nfn debug_log_format_oracle<T, N>(_msg: T, _args: [Field; N], _num_args: Field) {}\n#[oracle(debugLog)]\nfn debug_log_field_oracle(_field: Field) {}\n#[oracle(debugLog)]\nfn debug_log_array_oracle<T, N>(_arbitrary_array: [T; N]) {}\n#[oracle(debugLogWithPrefix)]\nfn debug_log_array_with_prefix_oracle<S, T, N>(_prefix: S, _arbitrary_array: [T; N]) {}\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 debug_log_oracle(msg, 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 debug_log_format_oracle(msg, args, args.len() as Field);\n}\n\n/// Example:\n/// `debug_log_field(my_field);`\nunconstrained pub fn debug_log_field(field: Field) {\n debug_log_field_oracle(field);\n}\n\n/// Example:\n/// `debug_log_array(my_array);`\nunconstrained fn debug_log_array<T, N>(arbitrary_array: [T; N]) {\n debug_log_array_oracle(arbitrary_array);\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 debug_log_array_with_prefix_oracle(prefix, arbitrary_array);\n}\n" }, "234": { "path": "/usr/src/noir-projects/noir-protocol-circuits/crates/types/src/hash.nr", "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::abis::side_effect::SideEffect;\nuse crate::traits::is_empty;\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__NOTE_HASH_NONCE, GENERATOR_INDEX__UNIQUE_NOTE_HASH,\n MAX_ENCRYPTED_LOGS_PER_TX\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\n// Computes the final logs hash for a tx.\n// NB: this assumes MAX_ENCRYPTED_LOGS_PER_TX == MAX_UNENCRYPTED_LOGS_PER_TX\n// to avoid doubling code, since we can't define the byte len to be 32*N directly. \npub fn compute_tx_logs_hash(logs: [SideEffect; MAX_ENCRYPTED_LOGS_PER_TX]) -> Field {\n // Convert each field element into a byte array and append the bytes to `hash_input_flattened`\n let mut hash_input_flattened = [0; MAX_ENCRYPTED_LOGS_PER_TX * 32];\n for offset in 0..MAX_ENCRYPTED_LOGS_PER_TX {\n let input_as_bytes = logs[offset].value.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 // Ideally we would push to a slice then hash, but there is no sha_slice\n // Hardcode to 256 bytes for now\n let mut hash = sha256_to_field(hash_input_flattened);\n // Not having a 0 value hash for empty logs causes issues with empty txs\n // used for padding. Returning early is currently unsupported.\n // We always provide sorted logs here, so 0 being empty means all are empty.\n if is_empty(logs[0]) {\n hash = 0;\n }\n hash\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\npub fn poseidon2_hash<N>(inputs: [Field; N]) -> Field {\n dep::std::hash::poseidon2::Poseidon2::hash(inputs, N)\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" }, "270": { "path": "/usr/src/noir-projects/noir-contracts/contracts/contract_instance_deployer_contract/src/main.nr", "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 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 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(contract_class_id, salt, initialization_hash, deployer);\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 { contract_class_id, address, public_keys_hash, initialization_hash, salt, deployer, version: 1 };\n let event_payload = event.serialize();\n dep::aztec::oracle::debug_log::debug_log_array_with_prefix(\"ContractInstanceDeployed\", event_payload);\n context.emit_unencrypted_log(event_payload);\n }\n}\n" }, "28": { "path": "std/hash/poseidon2.nr", "source": "use crate::hash::Hasher;\nuse crate::default::Default;\n\nglobal RATE: u32 = 3;\n\nstruct Poseidon2 {\n cache: [Field;3],\n state: [Field;4],\n cache_size: u32,\n squeeze_mode: bool, // 0 => absorb, 1 => squeeze\n}\n\nimpl Poseidon2 {\n\n pub fn hash<N>(input: [Field; N], message_size: u64) -> Field {\n if message_size == N {\n Poseidon2::hash_internal(input, N, false)\n } else {\n Poseidon2::hash_internal(input, message_size, true)\n }\n }\n\n fn new(iv: Field) -> Poseidon2 {\n let mut result = Poseidon2 { cache: [0; 3], state: [0; 4], cache_size: 0, squeeze_mode: false };\n result.state[RATE] = iv;\n result\n }\n\n fn perform_duplex(&mut self) -> [Field; RATE] {\n // zero-pad the cache\n for i in 0..RATE {\n if i >= self.cache_size {\n self.cache[i] = 0;\n }\n }\n // add the cache into sponge state\n for i in 0..RATE {\n self.state[i] += self.cache[i];\n }\n self.state = crate::hash::poseidon2_permutation(self.state, 4);\n // return `RATE` number of field elements from the sponge state.\n let mut result = [0; RATE];\n for i in 0..RATE {\n result[i] = self.state[i];\n }\n result\n }\n\n fn absorb(&mut self, input: Field) {\n if (!self.squeeze_mode) & (self.cache_size == RATE) {\n // If we're absorbing, and the cache is full, apply the sponge permutation to compress the cache\n let _ = self.perform_duplex();\n self.cache[0] = input;\n self.cache_size = 1;\n } else if (!self.squeeze_mode) & (self.cache_size != RATE) {\n // If we're absorbing, and the cache is not full, add the input into the cache\n self.cache[self.cache_size] = input;\n self.cache_size += 1;\n } else if self.squeeze_mode {\n // If we're in squeeze mode, switch to absorb mode and add the input into the cache.\n // N.B. I don't think this code path can be reached?!\n self.cache[0] = input;\n self.cache_size = 1;\n self.squeeze_mode = false;\n }\n }\n\n fn squeeze(&mut self) -> Field {\n if self.squeeze_mode & (self.cache_size == 0) {\n // If we're in squeze mode and the cache is empty, there is nothing left to squeeze out of the sponge!\n // Switch to absorb mode.\n self.squeeze_mode = false;\n self.cache_size = 0;\n }\n if !self.squeeze_mode {\n // If we're in absorb mode, apply sponge permutation to compress the cache, populate cache with compressed\n // state and switch to squeeze mode. Note: this code block will execute if the previous `if` condition was\n // matched\n let new_output_elements = self.perform_duplex();\n self.squeeze_mode = true;\n for i in 0..RATE {\n self.cache[i] = new_output_elements[i];\n }\n self.cache_size = RATE;\n }\n // By this point, we should have a non-empty cache. Pop one item off the top of the cache and return it.\n let result = self.cache[0];\n for i in 1..RATE {\n if i < self.cache_size {\n self.cache[i - 1] = self.cache[i];\n }\n }\n self.cache_size -= 1;\n self.cache[self.cache_size] = 0;\n result\n }\n\n fn hash_internal<N>(input: [Field; N], in_len: u64, is_variable_length: bool) -> Field {\n let two_pow_64 = 18446744073709551616;\n let iv : Field = (in_len as Field) * two_pow_64;\n let mut sponge = Poseidon2::new(iv);\n for i in 0..input.len() {\n if i < in_len {\n sponge.absorb(input[i]);\n }\n }\n\n // In the case where the hash preimage is variable-length, we append `1` to the end of the input, to distinguish\n // from fixed-length hashes. (the combination of this additional field element + the hash IV ensures\n // fixed-length and variable-length hashes do not collide)\n if is_variable_length {\n sponge.absorb(1);\n }\n sponge.squeeze()\n }\n}\n\nstruct Poseidon2Hasher{\n _state: [Field],\n}\n\nimpl Hasher for Poseidon2Hasher {\n fn finish(self) -> Field {\n let iv : Field = (self._state.len() as Field)*18446744073709551616; // iv = (self._state.len() << 64)\n let mut sponge = Poseidon2::new(iv);\n for i in 0..self._state.len() {\n sponge.absorb(self._state[i]);\n }\n sponge.squeeze()\n }\n\n fn write(&mut self, input: Field){\n self._state = self._state.push_back(input);\n }\n}\n\nimpl Default for Poseidon2Hasher {\n fn default() -> Self {\n Poseidon2Hasher {\n _state: &[],\n }\n }\n}\n" }, "70": { "path": "/usr/src/noir-projects/aztec-nr/aztec/src/context/private_context.nr", "source": "use crate::{\n context::{inputs::PrivateContextInputs, interface::ContextInterface},\n messaging::process_l1_to_l2_message,\n hash::{hash_args_array, ArgsHasher, compute_encrypted_log_hash, compute_unencrypted_log_hash},\n oracle::{\n arguments, returns, call_private_function::call_private_function_internal,\n enqueue_public_function_call::{\n enqueue_public_function_call_internal, set_public_teardown_function_call_internal,\n parse_public_call_stack_item_from_oracle\n},\n header::get_header_at, logs::emit_encrypted_log,\n logs_traits::{LensForEncryptedLog, ToBytesForUnencryptedLog},\n nullifier_key::{get_nullifier_keys, NullifierKeys}\n}\n};\nuse dep::protocol_types::{\n abis::{\n function_selector::FunctionSelector, max_block_number::MaxBlockNumber,\n nullifier_key_validation_request::NullifierKeyValidationRequest,\n private_circuit_public_inputs::PrivateCircuitPublicInputs,\n public_call_stack_item::PublicCallStackItem, read_request::ReadRequest, note_hash::NoteHash,\n nullifier::Nullifier, side_effect::SideEffect\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_NOTE_HASH_READ_REQUESTS_PER_CALL, MAX_NULLIFIER_READ_REQUESTS_PER_CALL,\n MAX_NULLIFIER_KEY_VALIDATION_REQUESTS_PER_CALL, MAX_ENCRYPTED_LOGS_PER_CALL,\n MAX_UNENCRYPTED_LOGS_PER_CALL\n},\n grumpkin_point::GrumpkinPoint, header::Header, messaging::l2_to_l1_message::L2ToL1Message,\n traits::{is_empty, Deserialize, Empty}\n};\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_hash: Field,\n\n max_block_number: MaxBlockNumber,\n\n note_hash_read_requests: BoundedVec<ReadRequest, 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<NoteHash, MAX_NEW_NOTE_HASHES_PER_CALL>,\n new_nullifiers: BoundedVec<Nullifier, 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 public_teardown_function_hash: Field,\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 encrypted_logs_hashes: BoundedVec<SideEffect, MAX_ENCRYPTED_LOGS_PER_CALL>,\n unencrypted_logs_hashes: BoundedVec<SideEffect, MAX_UNENCRYPTED_LOGS_PER_CALL>,\n encrypted_log_preimages_length: Field,\n unencrypted_log_preimages_length: Field,\n\n nullifier_key: Option<NullifierKeys>,\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 chain_id(self) -> Field {\n self.inputs.tx_context.chain_id\n }\n\n fn version(self) -> Field {\n self.inputs.tx_context.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 fn push_new_note_hash(&mut self, note_hash: Field) {\n self.new_note_hashes.push(NoteHash { value: note_hash, counter: self.side_effect_counter });\n self.side_effect_counter = self.side_effect_counter + 1;\n }\n\n fn push_new_nullifier(&mut self, nullifier: Field, nullified_note_hash: Field) {\n self.new_nullifiers.push(Nullifier { value: nullifier, note_hash: nullified_note_hash, counter: self.side_effect_counter });\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_hash: 0,\n max_block_number: MaxBlockNumber::empty(),\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 public_teardown_function_hash: 0,\n new_l2_to_l1_msgs: BoundedVec::new(),\n encrypted_logs_hashes: BoundedVec::new(),\n unencrypted_logs_hashes: BoundedVec::new(),\n encrypted_log_preimages_length: 0,\n unencrypted_log_preimages_length: 0,\n nullifier_key: Option::none()\n }\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 // 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 set_return_hash(&mut self, returns_hasher: ArgsHasher) {\n returns::pack_returns(returns_hasher.fields);\n self.return_hash = returns_hasher.hash();\n }\n\n pub fn finish(self) -> PrivateCircuitPublicInputs {\n PrivateCircuitPublicInputs {\n call_context: self.inputs.call_context,\n args_hash: self.args_hash,\n returns_hash: self.return_hash,\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 public_teardown_function_hash: self.public_teardown_function_hash,\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_hashes: self.encrypted_logs_hashes.storage,\n unencrypted_logs_hashes: self.unencrypted_logs_hashes.storage,\n encrypted_log_preimages_length: self.encrypted_log_preimages_length + 4,\n unencrypted_log_preimages_length: self.unencrypted_log_preimages_length + 4,\n historical_header: self.historical_header,\n tx_context: self.inputs.tx_context\n }\n }\n\n pub fn end_setup(&mut self) {\n self.min_revertible_side_effect_counter = self.side_effect_counter;\n }\n\n // docs:start:max-block-number\n pub fn set_tx_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 = ReadRequest { 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_app_nullifier_secret_key(&mut self, account: AztecAddress) -> Field {\n let keys = if self.nullifier_key.is_none() {\n let keys = get_nullifier_keys(account);\n let request = NullifierKeyValidationRequest {\n master_nullifier_public_key: keys.master_nullifier_public_key,\n app_nullifier_secret_key: keys.app_nullifier_secret_key\n };\n self.nullifier_key_validation_requests.push(request);\n self.nullifier_key = Option::some(keys);\n keys\n } else {\n let keys = 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(keys.account == account, \"Cannot query nullifier key for more than one account per call\");\n keys\n };\n keys.app_nullifier_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 // 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.\n pub fn emit_unencrypted_log<T, N, M>(&mut self, log: T) where T: ToBytesForUnencryptedLog<N, M> {\n let event_selector = 5; // TODO: compute actual event selector.\n let contract_address = self.this_address();\n let log_slice = log.to_be_bytes_arr();\n let log_hash = compute_unencrypted_log_hash(contract_address, event_selector, log);\n let side_effect = SideEffect { value: log_hash, counter: self.side_effect_counter };\n self.unencrypted_logs_hashes.push(side_effect);\n self.side_effect_counter = self.side_effect_counter + 1;\n // 44 = addr (32) + selector (4) + raw log len (4) + processed log len (4)\n self.unencrypted_log_preimages_length += 44 + log_slice.len().to_field();\n // call oracle\n let _void = emit_unencrypted_log_private_internal(contract_address, event_selector, log, side_effect.counter);\n }\n\n // This fn exists separately from emit_unencrypted_log because sha hashing the preimage\n // is too large to compile (16,200 fields, 518,400 bytes) => the oracle hashes it\n // It is ONLY used with contract_class_registerer_contract since we already assert correctness:\n // - Contract class -> we will commit to the packed bytecode (currently a TODO)\n // - Private function -> we provide a membership proof\n // - Unconstrained function -> we provide a membership proof\n // Ordinary logs are not protected by the above so this fn shouldn't be called by anything else\n pub fn emit_contract_class_unencrypted_log<N>(&mut self, log: [Field; N]) {\n let event_selector = 5; // TODO: compute actual event selector.\n let contract_address = self.this_address();\n let log_hash = emit_contract_class_unencrypted_log_private_internal(contract_address, event_selector, log, self.side_effect_counter);\n let side_effect = SideEffect { value: log_hash, counter: self.side_effect_counter };\n self.unencrypted_logs_hashes.push(side_effect);\n self.side_effect_counter = self.side_effect_counter + 1;\n // 44 = addr (32) + selector (4) + raw log len (4) + processed log len (4)\n self.unencrypted_log_preimages_length += 44 + N*32;\n }\n\n pub fn emit_encrypted_log<N, M, L>(\n &mut self,\n contract_address: AztecAddress,\n storage_slot: Field,\n note_type_id: Field,\n encryption_pub_key: GrumpkinPoint,\n preimage: [Field; N]\n ) where [Field; N]: LensForEncryptedLog<N, M, L> {\n // TODO(1139): perform encryption in the circuit\n // The oracle call should come last, but we require the encrypted value for now\n let encrypted_log: [Field; M] = emit_encrypted_log(\n contract_address,\n storage_slot,\n note_type_id,\n encryption_pub_key,\n preimage,\n self.side_effect_counter\n );\n let log_hash = compute_encrypted_log_hash(encrypted_log);\n let side_effect = SideEffect { value: log_hash, counter: self.side_effect_counter };\n self.encrypted_logs_hashes.push(side_effect);\n self.side_effect_counter = self.side_effect_counter + 1;\n let encrypted_log_byte_len = 112 + 32 * (N + 3);\n // + processed log len (4)\n self.encrypted_log_preimages_length += encrypted_log_byte_len + 4;\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 ) -> PackedReturns {\n let args_hash = hash_args_array(args);\n assert(args_hash == arguments::pack_arguments_array(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 ) -> PackedReturns {\n let args_hash = hash_args_array(args);\n assert(args_hash == arguments::pack_arguments_array(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 ) -> PackedReturns {\n let args_hash = hash_args_array(args);\n assert(args_hash == arguments::pack_arguments_array(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<RETURNS_COUNT>(\n &mut self,\n contract_address: AztecAddress,\n function_selector: FunctionSelector\n ) -> PackedReturns {\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<RETURNS_COUNT>(\n &mut self,\n contract_address: AztecAddress,\n function_selector: FunctionSelector\n ) -> PackedReturns {\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 ) -> PackedReturns {\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<RETURNS_COUNT>(\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 ) -> PackedReturns {\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 // TODO (fees) figure out why this crashes the prover and enable it\n // we need this in order to pay fees inside child call contexts\n // assert(\n // (item.public_inputs.min_revertible_side_effect_counter == 0 as u32)\n // | (item.public_inputs.min_revertible_side_effect_counter\n // > self.min_revertible_side_effect_counter)\n // );\n\n // if item.public_inputs.min_revertible_side_effect_counter\n // > self.min_revertible_side_effect_counter {\n // self.min_revertible_side_effect_counter = item.public_inputs.min_revertible_side_effect_counter;\n // }\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 PackedReturns::new(item.public_inputs.returns_hash)\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_array(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_array(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_array(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 item = parse_public_call_stack_item_from_oracle(fields);\n self.validate_call_stack_item_from_oracle(\n item,\n contract_address,\n function_selector,\n args_hash,\n is_static_call,\n is_delegate_call\n );\n\n self.side_effect_counter = self.side_effect_counter + 1;\n self.public_call_stack_hashes.push(item.hash());\n }\n\n pub fn set_public_teardown_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_array(args));\n self.set_public_teardown_function_with_packed_args(contract_address, function_selector, args_hash, false, false)\n }\n\n pub fn set_public_teardown_function_with_packed_args<ARGS_COUNT>(\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 = set_public_teardown_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 item = parse_public_call_stack_item_from_oracle(fields);\n self.validate_call_stack_item_from_oracle(\n item,\n contract_address,\n function_selector,\n args_hash,\n is_static_call,\n is_delegate_call\n );\n\n self.side_effect_counter = self.side_effect_counter + 1;\n self.public_teardown_function_hash = item.hash();\n }\n\n fn validate_call_stack_item_from_oracle(\n self,\n item: PublicCallStackItem,\n contract_address: AztecAddress,\n function_selector: FunctionSelector,\n args_hash: Field,\n is_static_call: bool,\n is_delegate_call: bool\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\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}\n\nimpl Empty for PrivateContext {\n fn empty() -> Self {\n PrivateContext {\n inputs: PrivateContextInputs::empty(),\n side_effect_counter: 0 as u32,\n min_revertible_side_effect_counter: 0 as u32,\n args_hash: 0,\n return_hash: 0,\n max_block_number: MaxBlockNumber::empty(),\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 private_call_stack_hashes : BoundedVec::new(),\n public_call_stack_hashes : BoundedVec::new(),\n public_teardown_function_hash: 0,\n new_l2_to_l1_msgs : BoundedVec::new(),\n historical_header: Header::empty(),\n encrypted_logs_hashes: BoundedVec::new(),\n unencrypted_logs_hashes: BoundedVec::new(),\n encrypted_log_preimages_length: 0,\n unencrypted_log_preimages_length: 0,\n nullifier_key: Option::none(),\n }\n }\n}\n\nstruct PackedReturns {\n packed_returns: Field,\n}\n\nimpl PackedReturns {\n pub fn new(packed_returns: Field) -> Self {\n PackedReturns { packed_returns }\n }\n\n pub fn assert_empty(self) {\n assert_eq(self.packed_returns, 0);\n }\n\n pub fn raw(self) -> Field {\n self.packed_returns\n }\n\n pub fn unpack<N>(self) -> [Field; N] {\n let unpacked: [Field; N] = returns::unpack_returns(self.packed_returns);\n assert_eq(self.packed_returns, hash_args_array(unpacked));\n unpacked\n }\n\n pub fn unpack_into<T, N>(self) -> T where T: Deserialize<N> {\n let unpacked: [Field; N] = self.unpack();\n Deserialize::deserialize(unpacked)\n }\n}\n\n#[oracle(emitUnencryptedLog)]\nfn emit_unencrypted_log_oracle_private<T>(\n _contract_address: AztecAddress,\n _event_selector: Field,\n _message: T,\n _counter: u32\n) -> Field {}\n\nunconstrained pub fn emit_unencrypted_log_private_internal<T>(\n contract_address: AztecAddress,\n event_selector: Field,\n message: T,\n counter: u32\n) -> Field {\n emit_unencrypted_log_oracle_private(contract_address, event_selector, message, counter)\n}\n\n#[oracle(emitContractClassUnencryptedLog)]\nfn emit_contract_class_unencrypted_log_private<N>(\n contract_address: AztecAddress,\n event_selector: Field,\n message: [Field; N],\n counter: u32\n) -> Field {}\n\nunconstrained pub fn emit_contract_class_unencrypted_log_private_internal<N>(\n contract_address: AztecAddress,\n event_selector: Field,\n message: [Field; N],\n counter: u32\n) -> Field {\n emit_contract_class_unencrypted_log_private(contract_address, event_selector, message, counter)\n}\n\n" } } }