@aztec/protocol-contracts 0.54.0 → 0.55.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/artifacts/AuthRegistry.json +1 -1
- package/artifacts/ContractClassRegisterer.json +1 -1
- package/artifacts/ContractInstanceDeployer.json +1 -1
- package/artifacts/FeeJuice.json +1 -1
- package/artifacts/KeyRegistry.json +1 -1
- package/artifacts/MultiCallEntrypoint.json +1 -1
- package/artifacts/Router.json +1 -1
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"transpiled":true,"noir_version":"0.33.0+8ac81b15cd2a3b57493bfbfe444086deac8f3dc8","name":"AuthRegistry","functions":[{"name":"is_consumable","is_unconstrained":true,"custom_attributes":["aztec(public)","aztec(view)"],"abi":{"error_types":{},"parameters":[{"name":"inputs","type":{"fields":[{"name":"calldata_length","type":{"kind":"field"}},{"name":"is_static_call","type":{"kind":"boolean"}}],"kind":"struct","path":"aztec::context::inputs::public_context_inputs::PublicContextInputs"},"visibility":"private"},{"name":"on_behalf_of","type":{"fields":[{"name":"inner","type":{"kind":"field"}}],"kind":"struct","path":"authwit::aztec::protocol_types::address::aztec_address::AztecAddress"},"visibility":"private"},{"name":"message_hash","type":{"kind":"field"},"visibility":"private"}],"return_type":{"abi_type":{"kind":"boolean"},"visibility":"public"}},"bytecode":"H4sIAAAAAAAC/11Sy04cQQysfrndj0mknJC4Roo0CbtSNKOco0CIcuCUe36AE0JInOHr+CrKvbssMFL3tN3lKtvtDYLzWwT9A2wQYuYG/QJ+ypX5+3UK4e/c1hUOJx48lzuFO7hWYhFWsyL3CyTuvyHfiPu4giKXFqaXFreBc/oV+IR44bD/NhAfmYGvy9APqJaVKwu0Lj5WuiovfaqWp22+/42M5A3aPulOGhArLSbKoFS4VEzsM7N6JcZg6iTT6UNHF6S++Nbp6rz00g01vUjwwvCYyN6jkFgG8ff3xELiYsQyiBNNMTMddCSxHi5hbcVSSJ6WEljzjJ8V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W+3uN33Yv9fPo3tAnP++/f+kEf8D","brillig_names":["is_consumable"],"assert_messages":{"17":"Function is_consumable can only be called statically","35":"Storage slot 0 not allowed. Storage slots must start from 1.","49":"Storage slot 0 not allowed. Storage slots must start from 1.","94":"Array index out of bounds","107":"attempt to add with overflow"}},{"name":"set_authorized","is_unconstrained":true,"custom_attributes":["aztec(public)"],"abi":{"error_types":{},"parameters":[{"name":"inputs","type":{"fields":[{"name":"calldata_length","type":{"kind":"field"}},{"name":"is_static_call","type":{"kind":"boolean"}}],"kind":"struct","path":"aztec::context::inputs::public_context_inputs::PublicContextInputs"},"visibility":"private"},{"name":"message_hash","type":{"kind":"field"},"visibility":"private"},{"name":"authorize","type":{"kind":"boolean"},"visibility":"private"}],"return_type":null},"bytecode":"H4sIAAAAAAAC/01R0UoDMRCc5O6SXJJN8a1Q8EkQqp4gOajP2gqCfni/ytmc1zYwSW53dnZuM6Ez9hVd+AImdL3nhvAIrkB4Hh87OB6fil+sN14sYXYwa2jhnRSNd1pwy2uhmZroZq3quR8xzJpxz+TdqbCaAe6bCfUzTnA28malAgkMibo1uSJJtVEYEiZtEGWV756lI8GE8lGogBDhJFDHIEeYmNMT8IB0NPhfrZgtorYorUWqiKVaKQwVJu1QlLW5tGBC+dhQvYRE4ZQDhd/4ZxfhNpoGWh79HnNE50ch7x2yx+FlYfjFsyuStHmo7ZMv0rzECgnVZh2KcZkKbqACB3jtpJPwQzVDOKyPuEgx4UMq3FNk0Q/itYhjVE8ztuft+Q/XWV7xEwIAAA==","debug_symbols":"5ZrRbuowDIbfJddcxIkTx7zK0dFUNpgqVWUCNmlCvPta1pQyKnIxbUrmG9TCX/f7kIiN0qN6Wq9enx/qdrPdq+W/o2q2j9Wh3rbd2fG0UKtd3TT188P0baX7F6Bzfv9Stf3p/lDtDmoZnF6odfvUHfnQXb+pm7VaWqdPi5ssWm+HMFqCMQ2AM2nSZIY06UBX6f8LBWEWx8RrAnICh4GGLPtJeT8HA6Mm8EXTOD9X12EMs+MLhenvMpeOlbU2lzCdJVmApNESJEGCpJEgaSVIogRJJ0HSS5AkCZISJh4jYeKx3554QKMZ609g5jUjt05UdRSTLlx/dT00lAhtSoS2JUJjidCuROhURyf8A0skSZAMEiRZgCRqCZIgQdJIkLQSJFGCpJMg+e2J52fGtG5fYkiScZOa/gxNJUKHEqG5QGiXmhg4CW0YIrQFurrBbdrbELm95QnO7OabHUujxslPF87o9rfR0Y7oPoXuwUWQ7tBepXt4yhue42rsjb7Z9HQhb/hg7sFz1vBG8wgP4Su81yXDQ8nwpmT4vJfKBDyWDO9Khvclw+fdYRPweXfYBHzJHZZK7rCUd4cFHy7wnEgzYlRlZH2jmnc/vqPaw2f+1+U+fN79OAGfdz9OwOfdj+/Bn7rTt2pXV6tmPTzju3ltHyeP/B7eXz4/6cIf","brillig_names":["set_authorized"],"assert_messages":{"68":"Array index out of bounds","49":"Storage slot 0 not allowed. Storage slots must start from 1.","76":"attempt to add with overflow","35":"Storage slot 0 not allowed. Storage slots must start from 1."}},{"name":"set_authorized_private","is_unconstrained":false,"custom_attributes":["aztec(private)"],"abi":{"error_types":{},"parameters":[{"name":"inputs","type":{"fields":[{"name":"call_context","type":{"fields":[{"name":"msg_sender","type":{"fields":[{"name":"inner","type":{"kind":"field"}}],"kind":"struct","path":"authwit::aztec::protocol_types::address::aztec_address::AztecAddress"}},{"name":"storage_contract_address","type":{"fields":[{"name":"inner","type":{"kind":"field"}}],"kind":"struct","path":"authwit::aztec::protocol_types::address::aztec_address::AztecAddress"}},{"name":"function_selector","type":{"fields":[{"name":"inner","type":{"kind":"integer","sign":"unsigned","width":32}}],"kind":"struct","path":"authwit::aztec::protocol_types::abis::function_selector::FunctionSelector"}},{"name":"is_delegate_call","type":{"kind":"boolean"}},{"name":"is_static_call","type":{"kind":"boolean"}}],"kind":"struct","path":"authwit::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":"authwit::aztec::protocol_types::abis::append_only_tree_snapshot::AppendOnlyTreeSnapshot"}},{"name":"content_commitment","type":{"fields":[{"name":"num_txs","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":"authwit::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":"authwit::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":"authwit::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":"authwit::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":"authwit::aztec::protocol_types::abis::append_only_tree_snapshot::AppendOnlyTreeSnapshot"}}],"kind":"struct","path":"authwit::aztec::protocol_types::partial_state_reference::PartialStateReference"}}],"kind":"struct","path":"authwit::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":"slot_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":"authwit::aztec::protocol_types::address::eth_address::EthAddress"}},{"name":"fee_recipient","type":{"fields":[{"name":"inner","type":{"kind":"field"}}],"kind":"struct","path":"authwit::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":"authwit::aztec::protocol_types::abis::gas_fees::GasFees"}}],"kind":"struct","path":"authwit::aztec::protocol_types::abis::global_variables::GlobalVariables"}},{"name":"total_fees","type":{"kind":"field"}}],"kind":"struct","path":"authwit::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":"authwit::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":"authwit::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":"authwit::aztec::protocol_types::abis::gas_fees::GasFees"}},{"name":"inclusion_fee","type":{"kind":"field"}}],"kind":"struct","path":"authwit::aztec::protocol_types::abis::gas_settings::GasSettings"}}],"kind":"struct","path":"authwit::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":"approver","type":{"fields":[{"name":"inner","type":{"kind":"field"}}],"kind":"struct","path":"authwit::aztec::protocol_types::address::aztec_address::AztecAddress"},"visibility":"private"},{"name":"message_hash","type":{"kind":"field"},"visibility":"private"},{"name":"authorize","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":"authwit::aztec::protocol_types::address::aztec_address::AztecAddress"}},{"name":"storage_contract_address","type":{"fields":[{"name":"inner","type":{"kind":"field"}}],"kind":"struct","path":"authwit::aztec::protocol_types::address::aztec_address::AztecAddress"}},{"name":"function_selector","type":{"fields":[{"name":"inner","type":{"kind":"integer","sign":"unsigned","width":32}}],"kind":"struct","path":"authwit::aztec::protocol_types::abis::function_selector::FunctionSelector"}},{"name":"is_delegate_call","type":{"kind":"boolean"}},{"name":"is_static_call","type":{"kind":"boolean"}}],"kind":"struct","path":"authwit::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":"is_fee_payer","type":{"kind":"boolean"}},{"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":"authwit::aztec::protocol_types::abis::max_block_number::MaxBlockNumber"}},{"name":"note_hash_read_requests","type":{"kind":"array","length":16,"type":{"fields":[{"name":"value","type":{"kind":"field"}},{"name":"counter","type":{"kind":"integer","sign":"unsigned","width":32}}],"kind":"struct","path":"authwit::aztec::protocol_types::abis::read_request::ReadRequest"}}},{"name":"nullifier_read_requests","type":{"kind":"array","length":16,"type":{"fields":[{"name":"value","type":{"kind":"field"}},{"name":"counter","type":{"kind":"integer","sign":"unsigned","width":32}}],"kind":"struct","path":"authwit::aztec::protocol_types::abis::read_request::ReadRequest"}}},{"name":"key_validation_requests_and_generators","type":{"kind":"array","length":16,"type":{"fields":[{"name":"request","type":{"fields":[{"name":"pk_m","type":{"fields":[{"name":"x","type":{"kind":"field"}},{"name":"y","type":{"kind":"field"}},{"name":"is_infinite","type":{"kind":"boolean"}}],"kind":"struct","path":"std::embedded_curve_ops::EmbeddedCurvePoint"}},{"name":"sk_app","type":{"kind":"field"}}],"kind":"struct","path":"authwit::aztec::protocol_types::abis::validation_requests::key_validation_request::KeyValidationRequest"}},{"name":"sk_app_generator","type":{"kind":"field"}}],"kind":"struct","path":"authwit::aztec::protocol_types::abis::validation_requests::key_validation_request_and_generator::KeyValidationRequestAndGenerator"}}},{"name":"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":"authwit::aztec::protocol_types::abis::note_hash::NoteHash"}}},{"name":"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":"authwit::aztec::protocol_types::abis::nullifier::Nullifier"}}},{"name":"private_call_requests","type":{"kind":"array","length":4,"type":{"fields":[{"name":"contract_address","type":{"fields":[{"name":"inner","type":{"kind":"field"}}],"kind":"struct","path":"authwit::aztec::protocol_types::address::aztec_address::AztecAddress"}},{"name":"call_context","type":{"fields":[{"name":"msg_sender","type":{"fields":[{"name":"inner","type":{"kind":"field"}}],"kind":"struct","path":"authwit::aztec::protocol_types::address::aztec_address::AztecAddress"}},{"name":"storage_contract_address","type":{"fields":[{"name":"inner","type":{"kind":"field"}}],"kind":"struct","path":"authwit::aztec::protocol_types::address::aztec_address::AztecAddress"}},{"name":"function_selector","type":{"fields":[{"name":"inner","type":{"kind":"integer","sign":"unsigned","width":32}}],"kind":"struct","path":"authwit::aztec::protocol_types::abis::function_selector::FunctionSelector"}},{"name":"is_delegate_call","type":{"kind":"boolean"}},{"name":"is_static_call","type":{"kind":"boolean"}}],"kind":"struct","path":"authwit::aztec::protocol_types::abis::call_context::CallContext"}},{"name":"args_hash","type":{"kind":"field"}},{"name":"returns_hash","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}}],"kind":"struct","path":"authwit::aztec::protocol_types::abis::private_call_request::PrivateCallRequest"}}},{"name":"public_call_requests","type":{"kind":"array","length":16,"type":{"fields":[{"name":"item","type":{"fields":[{"name":"contract_address","type":{"fields":[{"name":"inner","type":{"kind":"field"}}],"kind":"struct","path":"authwit::aztec::protocol_types::address::aztec_address::AztecAddress"}},{"name":"call_context","type":{"fields":[{"name":"msg_sender","type":{"fields":[{"name":"inner","type":{"kind":"field"}}],"kind":"struct","path":"authwit::aztec::protocol_types::address::aztec_address::AztecAddress"}},{"name":"storage_contract_address","type":{"fields":[{"name":"inner","type":{"kind":"field"}}],"kind":"struct","path":"authwit::aztec::protocol_types::address::aztec_address::AztecAddress"}},{"name":"function_selector","type":{"fields":[{"name":"inner","type":{"kind":"integer","sign":"unsigned","width":32}}],"kind":"struct","path":"authwit::aztec::protocol_types::abis::function_selector::FunctionSelector"}},{"name":"is_delegate_call","type":{"kind":"boolean"}},{"name":"is_static_call","type":{"kind":"boolean"}}],"kind":"struct","path":"authwit::aztec::protocol_types::abis::call_context::CallContext"}},{"name":"args_hash","type":{"kind":"field"}},{"name":"returns_hash","type":{"kind":"field"}},{"name":"revert_code","type":{"kind":"integer","sign":"unsigned","width":8}},{"name":"start_gas_left","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":"authwit::aztec::protocol_types::abis::gas::Gas"}},{"name":"end_gas_left","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":"authwit::aztec::protocol_types::abis::gas::Gas"}}],"kind":"struct","path":"authwit::aztec::protocol_types::abis::public_call_stack_item_compressed::PublicCallStackItemCompressed"}},{"name":"counter","type":{"kind":"integer","sign":"unsigned","width":32}}],"kind":"struct","path":"authwit::aztec::protocol_types::abis::public_call_request::PublicCallRequest"}}},{"name":"public_teardown_call_request","type":{"fields":[{"name":"item","type":{"fields":[{"name":"contract_address","type":{"fields":[{"name":"inner","type":{"kind":"field"}}],"kind":"struct","path":"authwit::aztec::protocol_types::address::aztec_address::AztecAddress"}},{"name":"call_context","type":{"fields":[{"name":"msg_sender","type":{"fields":[{"name":"inner","type":{"kind":"field"}}],"kind":"struct","path":"authwit::aztec::protocol_types::address::aztec_address::AztecAddress"}},{"name":"storage_contract_address","type":{"fields":[{"name":"inner","type":{"kind":"field"}}],"kind":"struct","path":"authwit::aztec::protocol_types::address::aztec_address::AztecAddress"}},{"name":"function_selector","type":{"fields":[{"name":"inner","type":{"kind":"integer","sign":"unsigned","width":32}}],"kind":"struct","path":"authwit::aztec::protocol_types::abis::function_selector::FunctionSelector"}},{"name":"is_delegate_call","type":{"kind":"boolean"}},{"name":"is_static_call","type":{"kind":"boolean"}}],"kind":"struct","path":"authwit::aztec::protocol_types::abis::call_context::CallContext"}},{"name":"args_hash","type":{"kind":"field"}},{"name":"returns_hash","type":{"kind":"field"}},{"name":"revert_code","type":{"kind":"integer","sign":"unsigned","width":8}},{"name":"start_gas_left","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":"authwit::aztec::protocol_types::abis::gas::Gas"}},{"name":"end_gas_left","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":"authwit::aztec::protocol_types::abis::gas::Gas"}}],"kind":"struct","path":"authwit::aztec::protocol_types::abis::public_call_stack_item_compressed::PublicCallStackItemCompressed"}},{"name":"counter","type":{"kind":"integer","sign":"unsigned","width":32}}],"kind":"struct","path":"authwit::aztec::protocol_types::abis::public_call_request::PublicCallRequest"}},{"name":"l2_to_l1_msgs","type":{"kind":"array","length":2,"type":{"fields":[{"name":"recipient","type":{"fields":[{"name":"inner","type":{"kind":"field"}}],"kind":"struct","path":"authwit::aztec::protocol_types::address::eth_address::EthAddress"}},{"name":"content","type":{"kind":"field"}},{"name":"counter","type":{"kind":"integer","sign":"unsigned","width":32}}],"kind":"struct","path":"authwit::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":"note_encrypted_logs_hashes","type":{"kind":"array","length":16,"type":{"fields":[{"name":"value","type":{"kind":"field"}},{"name":"counter","type":{"kind":"integer","sign":"unsigned","width":32}},{"name":"length","type":{"kind":"field"}},{"name":"note_hash_counter","type":{"kind":"integer","sign":"unsigned","width":32}}],"kind":"struct","path":"authwit::aztec::protocol_types::abis::log_hash::NoteLogHash"}}},{"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}},{"name":"length","type":{"kind":"field"}},{"name":"randomness","type":{"kind":"field"}}],"kind":"struct","path":"authwit::aztec::protocol_types::abis::log_hash::EncryptedLogHash"}}},{"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}},{"name":"length","type":{"kind":"field"}}],"kind":"struct","path":"authwit::aztec::protocol_types::abis::log_hash::LogHash"}}},{"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":"authwit::aztec::protocol_types::abis::append_only_tree_snapshot::AppendOnlyTreeSnapshot"}},{"name":"content_commitment","type":{"fields":[{"name":"num_txs","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":"authwit::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":"authwit::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":"authwit::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":"authwit::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":"authwit::aztec::protocol_types::abis::append_only_tree_snapshot::AppendOnlyTreeSnapshot"}}],"kind":"struct","path":"authwit::aztec::protocol_types::partial_state_reference::PartialStateReference"}}],"kind":"struct","path":"authwit::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":"slot_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":"authwit::aztec::protocol_types::address::eth_address::EthAddress"}},{"name":"fee_recipient","type":{"fields":[{"name":"inner","type":{"kind":"field"}}],"kind":"struct","path":"authwit::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":"authwit::aztec::protocol_types::abis::gas_fees::GasFees"}}],"kind":"struct","path":"authwit::aztec::protocol_types::abis::global_variables::GlobalVariables"}},{"name":"total_fees","type":{"kind":"field"}}],"kind":"struct","path":"authwit::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":"authwit::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":"authwit::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":"authwit::aztec::protocol_types::abis::gas_fees::GasFees"}},{"name":"inclusion_fee","type":{"kind":"field"}}],"kind":"struct","path":"authwit::aztec::protocol_types::abis::gas_settings::GasSettings"}}],"kind":"struct","path":"authwit::aztec::protocol_types::transaction::tx_context::TxContext"}}],"kind":"struct","path":"authwit::aztec::protocol_types::abis::private_circuit_public_inputs::PrivateCircuitPublicInputs"},"visibility":"public"}},"bytecode":"H4sIAAAAAAAA/+2dBXhTd/fH06SlxX0M2Siw4ZK0aZvCNoq7bwO2IZUUb6G0uLtsg7m7u7u7MMHdtuGwDXf5f8+W+3B635CXrb/w3/fZe5/n8+T8bpKTz7luuTfC8We30OVw7HD+GUcAV+BVesXa+lmvOo4M0q9QkO8WC9KvRJB+pYL0KxOkXwWQYutXNcjnYoP0qxakX/Ug/WoG6Vcn8Ko7q50SeI13J3q9/qQ4vyfek+qOS07zJbi9CWmJPo/Pk+BLyIjzxcf7fV5fUnJacpI72eON93syE5LjM91/di87z+ZyF6iLSw+n5yt/29PjsfexxmmkcpXhcDoQ13KcjWur+JXAZ6zvvYr2a+B18IbzbH+rc9mGgbtgnaeOwVyvOs2NmzeNTUPBx82baty8puLXVfyGbdy8hfbb4B3wrvPsssOe+y2V420Vv6Pid22530P7ffAB+DBE7vdUjvdV/IGKP7Tl/gjtj8En4NMQuT9SOT5W8Scq/tSW+zO0PwdfgC9D5P5M5fhcxV+o+Etb7q/Q/hp8A74NMi+YXh4sCvM0p5cHX6l4kfPcy4Pv0P4e/AB+DDF8v1M5vlfxDyr+0ZZ7MdpLwFKwLETuxSrHEhUvVfEyW+7laK8AK8GqELmXqxwrVLxSxatsuVejvQasBetC5F6tcqxR8VoVr7PlXo/2BrARbAqRe73KsUHFG1W8yZZ7M9o/gZ/BL0GmZ2fgNSXw6i5Y56npMDdvbDE3b3j09ojkjbUNB9Pz9VZz2yMZ4fTc9vc9vfYewabZrWralM6KnSreZptmtzv/3L7eCXZdgO2RzQans+0Gt0d2h3ndsFuNmx0q3qniXbZxswftX8Fv4PcQyyq93tlznuudvWjvA/vBgRC596oc+1S8X8UHbLkPon0IHAZHQuQ+qHIcUvFhF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lTKEyrp7ksm9Z1juWEl3GaoARncPVw0CT5iz9+1Y00pNiZVzJFthuRhLJywXY5lh2WlQm44ludPmxof52HjszZujb1toVMF5/dlE79Q4vrOAfWLZEr6KjJqnNmRgZ9tchJ3vb8igS66KehA0KTRa0KTQoKBJoSFBk0JjBE0Kjb15NLnSM++ujqaUYo/3giaFhgVNAg0rQZNCA4ImhUbfPJpcdyheIhv2ENB4ggGa5hS0xCkUnjrFEtmZNzqcgt2EwMBOh68T1iWE4S6Hf7DOZ1t+CO76IXijukKdHX6pc1MfPb3u9vvdjy+D30Wimr9gdFKwFJ7auN4DATJHb3BsOHp7tqFi6F3vpfaa0ia1J//pJjC/iZ7fBOc3oflNRi9PVkHp/gOyZlzFg8iGMdSTpRlOm9Se08u5d/Pcb1J7G3OYtesrb6JH2rXznfZxj/hc9/2A1cD9yCXJYZZQoH4PdXxz3kv1RVNrqy3+jmV8S9w8XdG30xW8aldOjdvxzW3/tCuxe3NZ9/ay7t1l3Y9PSelre/ZEwGef4OQ4Ht9TcUH/cGH/+nz/6YurPtKN5XjaQGEJQNh/u8Sm04bTTXB+E5rfxMxsUh/hMUMbvVJBhTdy6mwSo+SOjk1Hr0KLrbC+39Bw3bA+/Hv7uts+7Z+b5LL56a/D1zbXrA/f//n5/09q4/8A","brillig_names":["pack_arguments_array","call_private_function_internal","unpack_returns","pack_arguments","enqueue_public_function_call_internal"]},{"name":"_set_authorized","is_unconstrained":true,"custom_attributes":["aztec(public)","aztec(internal)"],"abi":{"error_types":{},"parameters":[{"name":"inputs","type":{"fields":[{"name":"calldata_length","type":{"kind":"field"}},{"name":"is_static_call","type":{"kind":"boolean"}}],"kind":"struct","path":"aztec::context::inputs::public_context_inputs::PublicContextInputs"},"visibility":"private"},{"name":"approver","type":{"fields":[{"name":"inner","type":{"kind":"field"}}],"kind":"struct","path":"authwit::aztec::protocol_types::address::aztec_address::AztecAddress"},"visibility":"private"},{"name":"message_hash","type":{"kind":"field"},"visibility":"private"},{"name":"authorize","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uNM4HPReM7VTY+lI2fe9VN4OdedRP4ZVddV3bVdblXXSB/w0/tM2RjoiwbVhPZ3Gv0gmyHn/3DzTJ+7jV6Gd/nXqMT+LnX6CX8t3D6Z3OsN9tm1++x3r+2j6Mt1+e/L/+/CeF/","brillig_names":["_set_authorized"],"assert_messages":{"40":"Storage slot 0 not allowed. Storage slots must start from 1.","81":"attempt to add with overflow","73":"Array index out of bounds","22":"Function _set_authorized can only be called internally","54":"Storage slot 0 not allowed. Storage slots must start from 1."}},{"name":"unconstrained_is_consumable","is_unconstrained":true,"custom_attributes":[],"abi":{"error_types":{},"parameters":[{"name":"on_behalf_of","type":{"fields":[{"name":"inner","type":{"kind":"field"}}],"kind":"struct","path":"authwit::aztec::protocol_types::address::aztec_address::AztecAddress"},"visibility":"private"},{"name":"message_hash","type":{"kind":"field"},"visibility":"private"}],"return_type":{"abi_type":{"kind":"boolean"},"visibility":"public"}},"bytecode":"H4sIAAAAAAAA/7VWwU7CQBDtFgqFLqD+gPsDEiDGeDAGRQ9ePGjivUJFIrRJW+Lv28IMvqyFGN2dZLvb6cybN7PTdoWzFbcYgtYe6HRhmzHNg//J0CDWwCZPYZCnAJ4uk62jQksC1y7Y4PNTWF/R/JwnaTiPVLZMcjVQcXENl8vkM5r1FT7L1Gqd5SrLwzRXb2myUsM+Yp8Zxt4Rv6bZ15KqG9w5XyuiMezL84sS27PDe1RiN+xgD0rcCRWG+XMsWYwardlGOt8Neke6ZjHa4HNPevY9AR3vd1CMLq3nUX67TKYfj+vVa5Riu2FF9Z3TJaBIhDhJ4jwNp/nNbJZGWYYIjQpUZw9iGxDfw0X8MEOv5t+QXqI0WyQxevm/RCrtWmBrshdKbGkHeyShAg7EQMFdlZBvYIfTUEKcNsTrAA9DsUY9iNWBfKSWP9/zNxD9asCxa6cmoyOqBdeD47Qq9sVCnTZ/bt5vr6JmPnATNEzFFlDjOmEzlzbo2UbRfOz8FJt7JIGXAzFQ8F3qAqeaHU6bd4njMLce6PC70tV48r1b4VcH7j073Hc9j7xLaWn1c6B+Hujxfe4Ab+wn7B+26dNc1T8u+Hig97X7sWOkBkPb39malt+hfg0g144lTgHEybaH1Kco3P3ccetExSz2pINpNGCNLYS/Qa/C75Bgi7Ef3+OxuaHZcC7Y0vpxzwUsPHgJesa+GN8F25bmI0HHNrKCS1mPL1gg3Bl9DgAA","debug_symbols":"7ZrdasJAEIXfZa+92Nmd2R9fpZQSWy2BEIvaQhHfvYl115VsiaAtbCc3avQ4+c5JNBNm9+JluXh/farb1Xor5g970ayfq129brut/WEmFpu6aerXp/RtIfsHkEf99q1q+83trtrsxFzOxLJ96Z67767qZinmmrrXA50Df1I6baMWpM1oSdFJS3SuCwYOjzMBcBOGDUrn1QgG6oCMxg0w1C0YHuxJ6TWMYBgZ0jDKDDD0TRgUSvvUYR7DhapWDg8K5jDQaxcS9Iauz8QkZ4jBjBYowIA/gysyWZMYxJ68P6uNzatDZSnPZ4iyR5vEw6bhYdPysOl42PQsbCrJwybwsKl42NQ8bCIPmzy6IHWHLggkqriHBCdv9Nq2neJNDLnL8HpsWya2KxPbF4mtZZnYUCb2+FXeqfL/MLXmYRN52CQeNg0Pm5aHTcfDpmdhEyUPm8DD5h26oN9p3qwMCFZRUtMcsXWZ2FgmNpWJPdZFkJQwhk1xGgfk5MUuhmoFFKaTClJ1dngH3Zgx/ubTSH4Y9UWrmEwnCXJDUhMKY3Jgem0fi+Uai3YqWnSDWNwUSy4WP8WSiYXkFEsuFphiycWiplhyseh/FYvVMRZ1Uyz497Egxlg8jRiluASLMLlV+V50RFQyvCkGnswA3pYM74qFP3SbH9WmrhbN8rRec/XePifLN3efb9+fdOIv","brillig_names":["unconstrained_is_consumable"]},{"name":"compute_note_hash_and_optionally_a_nullifier","is_unconstrained":true,"custom_attributes":[],"abi":{"error_types":{},"parameters":[{"name":"contract_address","type":{"fields":[{"name":"inner","type":{"kind":"field"}}],"kind":"struct","path":"authwit::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":"compute_nullifier","type":{"kind":"boolean"},"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"}},"bytecode":"H4sIAAAAAAAA/9VWzU7CQBDeBQoVW4h61jR68VgSSDiS+PsAvgDBJnIBQ6vPL2Pnk8+FcHE3sZtsZjo7P9/Mzu7WmnrE22mVj5R2zf6Azkxp/rcx8ugrD4nTNgRnqyE42w3B2fGI0x7AKbSjvJw7OXM9U5/HvUU2lo1u07o54sg6QWVcE3+r9OVtWWaL9arazBdV9rouymy1rrKPssjeN8vPeVXId1H+OJoojRUQg575qdoodhL35ns6XojvfhjcE/F9GsZ3Lpt7p4UBfsSSfXjSNVCrMzF10xiyT8yuce5JhoZ7IBlehEeS9czvWLHOAPs1Fb8nIXxv+yyhGgJ/QjzWJN8r0osC5toNk+s42B7l9S2HPYrUN2J1qW587jy+riPr9IilWJB3iL8kXehBp014ZQzMrt/7R+wix25IOj2yix07fOMuFT8Xyp9v53O804X/UHV07y+ff0C4i5CLpVh9kkPnRumZ2R9cA+MRo/hNKX+f54/vGkMxePDDnlKuSRhM3/cf4gDbkGTcZ6mDE9+tf2R3KB+RDYgHxTlPSYb6D8jvF96XymUuDQAA","debug_symbols":"lZDBCsMgEET/Zc8ebGwbyK+UEjTRsCBrUFMo4r930+SQq5dlZmfeZQrM1mzLiORCguFVwIdJZwzErlQBJqL3uIzXN8j9KPnvp1XTblPWMcOgnr0ASzOrvmPeobesH7K+BahbO9K1I6oduTcile1HR9TG23Mpt9F0GS5/1yPh8g8=","brillig_names":["compute_note_hash_and_optionally_a_nullifier"]},{"name":"set_reject_all","is_unconstrained":true,"custom_attributes":["aztec(public)"],"abi":{"error_types":{},"parameters":[{"name":"inputs","type":{"fields":[{"name":"calldata_length","type":{"kind":"field"}},{"name":"is_static_call","type":{"kind":"boolean"}}],"kind":"struct","path":"aztec::context::inputs::public_context_inputs::PublicContextInputs"},"visibility":"private"},{"name":"reject","type":{"kind":"boolean"},"visibility":"private"}],"return_type":null},"bytecode":"H4sIAAAAAAAC/01Qu07EMBAce+NH7D1EedJJNEggAoTGQVQ0EAoKPvy+ilnnDs7S2PuYnZ1khjj/AslfwAyRyAvpHjyJiED+OPTn0/CDc8TAE+4Ady5tvNXQeeuGS14vLdSELDY1LFYLT2Rcm6TZAG76+hnRZbMz8vLagAJmaj5dbSjafFaWlE2f1Fi774GjI8GG8bGjDFJB1EQxZ6HLqT4Ct6irw+l07wi2t2GME+4KJI7Gm1AnPDxvDEPlo7WYjdB6Kpy0NDfUQC/BkkGpMAgVXiH/m8iuUZqT8IbTyk2KjRjKFe+SOfTOP/M3xK81Twv2x/3xFxt+eWK0AQAA","debug_symbols":"5ZrRioMwEEX/Jc99yEwmE9NfWZbFtrYIYktrF5bSf1/tGmtXMS/LkpAXMXqZnIvgnYTcxK7YXA8fZb0/XsT67Saq4zZvymPdjm73ldicy6oqDx/jx0J2F+CH/nLK6254afJzI9aAxCtR1LvulqmtsC+rQqyVlvfVRE2KVa8mZWBQA9CM2kiDvdrIzLyo31cCzDwQ0gBE2gNkwfRiy6MJeA4HtHSFbTZoUfNcXU1ObLW1T3U3y5zaVZYSn2LzsJmlYdMmYRNlGjYhDZuYhk2Vhk1Kw6ZOwyanYTONLgjT6ILwD7ogkITDDCOceaOOXHqqth2468VRj2pyh61knNgQJzbGia3ixKY4sf0pb5QPGy04tQLzMsVUzSpz5Kys9izu1VCaJI1+mfCAz/4fntQAzz54Bu2+Z3urfu9MEIaOb10SMsrJxgqp0PEzXMKnwPFR2gEfsgm+jhuf48Y3ceOH/uP04Nuo8bWMGx/ixg89dT34oaeuBz/u1NVxp64OPXWBsye+9agtkTNrycqJ2dAzesFshx/84mYZP/SMXsbn0DPagx96Ri/h39vhZ34u801V9OcN9td6Ozp+0Hydft604m8=","brillig_names":["set_reject_all"],"assert_messages":{"53":"Array index out of bounds","34":"Storage slot 0 not allowed. Storage slots must start from 1.","61":"attempt to add with overflow"}},{"name":"consume","is_unconstrained":true,"custom_attributes":["aztec(public)"],"abi":{"error_types":{},"parameters":[{"name":"inputs","type":{"fields":[{"name":"calldata_length","type":{"kind":"field"}},{"name":"is_static_call","type":{"kind":"boolean"}}],"kind":"struct","path":"aztec::context::inputs::public_context_inputs::PublicContextInputs"},"visibility":"private"},{"name":"on_behalf_of","type":{"fields":[{"name":"inner","type":{"kind":"field"}}],"kind":"struct","path":"authwit::aztec::protocol_types::address::aztec_address::AztecAddress"},"visibility":"private"},{"name":"inner_hash","type":{"kind":"field"},"visibility":"private"}],"return_type":{"abi_type":{"kind":"field"},"visibility":"public"}},"bytecode":"H4sIAAAAAAAC/4VXu6sdRRj/ZnbPzpzdnX3M7Ot4oqCFyia5MbKXpAyamEdhFSzEwkrBVhBEhFQK2lgoiK2dFoJ/goVFsLSwEmtBSzvB3zf7OLtyxQuzd+ab7/2cc0aBkNco0PeIzigIFT6knyP8aSyFfy8fKcK/27xepXmHjcQSRxIz6By4FJzzKcT3Du3wfYWiK8DLzwlC7jKZvst0kCP2g5cS0J4GGWgGBTMoACj0IA1QyCANDQXpQepwRg1H1DNoGIAF4JHgS9rjI1NgxIyRsm0iGShOwTUFKMWl3KWMZR6AC1QgoHl8MjFFaRDGJEKdXCa6TskdQdMfkySz6MQzNjgmfDT+GA+UGGiDlYQDhQZXRuIUA3GveroVU6D2ice9TPINSnq6PYhQAXlWTqTMUe15F/oIsERSHAEOi1+nCIygEY+3ybhNmMyThNNakXjQYuTDtZFPeZKn+Zs84yV6Tw3eR5OdMsORbaPMm53jmPEx98cCx5yPBR8Di2PBR+tvy4EKi2iduUE6C7iVFi5b7QZZIH7pAikt52cNNgyi2rOpBrI1sGuAannh7kXvCP7bzdZRM8gGKBYGmYWgwoozZFfe00eT9Ba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crxe12NWNMdS1dUwXnngy2bRerp/12Zjlzb4Axch7rWtbt5havsw3rc/8GZy/gPNXcP6mnL+l9djLUFzd8nft/EQz/h+tl6aHP/QLfxNa9zQ+B+npalrOsI3qbcOwDWXLT+D8CZxfe1pL/NrTWuLXntYSv/a0lvjVp7XArz6t5/ykP63n/OD5S+D5S+D5S+D5S+D5S+D5S+D5S+D5S+D5m5Dz9+vy7X/efHx68/b9u0/Li07/++fzL5+fPjy/fPv5v398+5+l8f8A","brillig_names":["consume"],"assert_messages":{"614":"Array index out of bounds","407":"attempt to add with overflow","471":"attempt to add with overflow","567":"Array index out of bounds","270":"unauthorized","459":"Array index out of bounds","584":"Array index out of bounds","549":"attempt to add with overflow","223":"Storage slot 0 not allowed. Storage slots must start from 1.","319":"Array index out of bounds","284":"Storage slot 0 not allowed. Storage slots must start from 1.","351":"attempt to add with overflow","83":"rejecting all","48":"Storage slot 0 not allowed. Storage slots must start from 1.","237":"Storage slot 0 not allowed. Storage slots must start from 1.","298":"Storage slot 0 not allowed. Storage slots must start from 1.","383":"Array index out of bounds","339":"Array index out of bounds","577":"Array index out of bounds","601":"attempt to add with overflow","373":"Array index out of bounds","626":"attempt to add with overflow","425":"Array index out of bounds","390":"Array index out of bounds","326":"attempt to add with overflow"}},{"name":"is_reject_all","is_unconstrained":true,"custom_attributes":["aztec(public)","aztec(view)"],"abi":{"error_types":{},"parameters":[{"name":"inputs","type":{"fields":[{"name":"calldata_length","type":{"kind":"field"}},{"name":"is_static_call","type":{"kind":"boolean"}}],"kind":"struct","path":"aztec::context::inputs::public_context_inputs::PublicContextInputs"},"visibility":"private"},{"name":"on_behalf_of","type":{"fields":[{"name":"inner","type":{"kind":"field"}}],"kind":"struct","path":"authwit::aztec::protocol_types::address::aztec_address::AztecAddress"},"visibility":"private"}],"return_type":{"abi_type":{"kind":"boolean"},"visibility":"public"}},"bytecode":"H4sIAAAAAAAC/1VSy04bQRCseffMeJFyQ/Ixh0hOsKVoV/mAxETigPgBTgghc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MmOz75stDOzstu6yH1DmcDnfoybwOee0ev4yD2jE/jcMzqBzz2jE/iyD1OQfUav48s+TEHZqYuyUxdlpy7KTl2SnbokO3VJduqS7NQl2alLslOXJKfurRn+K05lsav23Wtgh/f6efJW2OX/2+c/jfgD","brillig_names":["is_reject_all"],"assert_messages":{"16":"Function is_reject_all can only be called statically","34":"Storage slot 0 not allowed. Storage slots must start from 1.","79":"Array index out of bounds","92":"attempt to add with overflow"}}],"outputs":{"globals":{"storage":[{"fields":[{"name":"reject_all","value":{"fields":[{"name":"slot","value":{"kind":"integer","sign":false,"value":"0000000000000000000000000000000000000000000000000000000000000001"}}],"kind":"struct"}},{"name":"approved_actions","value":{"fields":[{"name":"slot","value":{"kind":"integer","sign":false,"value":"0000000000000000000000000000000000000000000000000000000000000002"}}],"kind":"struct"}}],"kind":"struct"}]},"structs":{"functions":[{"fields":[{"name":"parameters","type":{"fields":[{"name":"reject","type":{"kind":"boolean"}}],"kind":"struct","path":"AuthRegistry::set_reject_all_parameters"}}],"kind":"struct","path":"AuthRegistry::set_reject_all_abi"},{"fields":[{"name":"parameters","type":{"fields":[{"name":"on_behalf_of","type":{"fields":[{"name":"inner","type":{"kind":"field"}}],"kind":"struct","path":"authwit::aztec::protocol_types::address::aztec_address::AztecAddress"}},{"name":"message_hash","type":{"kind":"field"}}],"kind":"struct","path":"AuthRegistry::is_consumable_parameters"}},{"name":"return_type","type":{"kind":"boolean"}}],"kind":"struct","path":"AuthRegistry::is_consumable_abi"},{"fields":[{"name":"parameters","type":{"fields":[{"name":"on_behalf_of","type":{"fields":[{"name":"inner","type":{"kind":"field"}}],"kind":"struct","path":"authwit::aztec::protocol_types::address::aztec_address::AztecAddress"}},{"name":"inner_hash","type":{"kind":"field"}}],"kind":"struct","path":"AuthRegistry::consume_parameters"}},{"name":"return_type","type":{"kind":"field"}}],"kind":"struct","path":"AuthRegistry::consume_abi"},{"fields":[{"name":"parameters","type":{"fields":[{"name":"approver","type":{"fields":[{"name":"inner","type":{"kind":"field"}}],"kind":"struct","path":"authwit::aztec::protocol_types::address::aztec_address::AztecAddress"}},{"name":"message_hash","type":{"kind":"field"}},{"name":"authorize","type":{"kind":"boolean"}}],"kind":"struct","path":"AuthRegistry::set_authorized_private_parameters"}}],"kind":"struct","path":"AuthRegistry::set_authorized_private_abi"},{"fields":[{"name":"parameters","type":{"fields":[{"name":"message_hash","type":{"kind":"field"}},{"name":"authorize","type":{"kind":"boolean"}}],"kind":"struct","path":"AuthRegistry::set_authorized_parameters"}}],"kind":"struct","path":"AuthRegistry::set_authorized_abi"},{"fields":[{"name":"parameters","type":{"fields":[{"name":"approver","type":{"fields":[{"name":"inner","type":{"kind":"field"}}],"kind":"struct","path":"authwit::aztec::protocol_types::address::aztec_address::AztecAddress"}},{"name":"message_hash","type":{"kind":"field"}},{"name":"authorize","type":{"kind":"boolean"}}],"kind":"struct","path":"AuthRegistry::_set_authorized_parameters"}}],"kind":"struct","path":"AuthRegistry::_set_authorized_abi"},{"fields":[{"name":"parameters","type":{"fields":[{"name":"on_behalf_of","type":{"fields":[{"name":"inner","type":{"kind":"field"}}],"kind":"struct","path":"authwit::aztec::protocol_types::address::aztec_address::AztecAddress"}}],"kind":"struct","path":"AuthRegistry::is_reject_all_parameters"}},{"name":"return_type","type":{"kind":"boolean"}}],"kind":"struct","path":"AuthRegistry::is_reject_all_abi"}]}},"file_map":{"107":{"path":"/usr/src/noir-projects/aztec-nr/aztec/src/context/unconstrained_context.nr","source":"use dep::protocol_types::{address::AztecAddress, traits::Deserialize};\nuse crate::oracle::{\n execution::{get_chain_id, get_version, get_contract_address, get_block_number},\n storage::{raw_storage_read, storage_read}\n};\n\nstruct UnconstrainedContext {\n block_number: u32,\n contract_address: AztecAddress,\n version: Field,\n chain_id: Field,\n}\n\nimpl UnconstrainedContext {\n unconstrained fn new() -> Self {\n // We could call these oracles on the getters instead of at creation, which makes sense given that they might\n // not even be accessed. However any performance gains are minimal, and we'd rather fail early if a user\n // incorrectly attempts to create an UnconstrainedContext in an environment in which these oracles are not\n // available.\n let block_number = get_block_number();\n let contract_address = get_contract_address();\n let chain_id = get_chain_id();\n let version = get_version();\n Self { block_number, contract_address, version, chain_id }\n }\n\n unconstrained fn at(contract_address: AztecAddress) -> Self {\n let block_number = get_block_number();\n let chain_id = get_chain_id();\n let version = get_version();\n Self { block_number, contract_address, version, chain_id }\n }\n\n unconstrained fn at_historical(contract_address: AztecAddress, block_number: u32) -> Self {\n let chain_id = get_chain_id();\n let version = get_version();\n Self { block_number, contract_address, version, chain_id }\n }\n\n fn block_number(self) -> u32 {\n self.block_number\n }\n\n fn this_address(self) -> AztecAddress {\n self.contract_address\n }\n\n fn version(self) -> Field {\n self.version\n }\n\n fn chain_id(self) -> Field {\n self.chain_id\n }\n\n unconstrained fn raw_storage_read<let N: u32>(self: Self, storage_slot: Field) -> [Field; N] {\n storage_read(self.this_address(), storage_slot, self.block_number())\n }\n\n unconstrained fn storage_read<T, let N: u32>(\n self,\n storage_slot: Field\n ) -> T where T: Deserialize<N> {\n T::deserialize(self.raw_storage_read(storage_slot))\n }\n}\n"},"108":{"path":"/usr/src/noir-projects/aztec-nr/aztec/src/context/packed_returns.nr","source":"use crate::{hash::hash_args_array, oracle::returns::unpack_returns};\nuse dep::protocol_types::traits::Deserialize;\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<let N: u32>(self) -> [Field; N] {\n let unpacked: [Field; N] = 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, let N: u32>(self) -> T where T: Deserialize<N> {\n let unpacked: [Field; N] = self.unpack();\n Deserialize::deserialize(unpacked)\n }\n}\n"},"112":{"path":"/usr/src/noir-projects/aztec-nr/aztec/src/context/call_interfaces.nr","source":"use dep::protocol_types::{\n abis::{function_selector::FunctionSelector, private_circuit_public_inputs::PrivateCircuitPublicInputs},\n address::AztecAddress, traits::Deserialize\n};\n\nuse crate::context::{\n private_context::PrivateContext, public_context::PublicContext, gas::GasOpts,\n public_context::FunctionReturns, inputs::{PrivateContextInputs, PublicContextInputs}\n};\n\nuse crate::oracle::arguments::pack_arguments;\nuse crate::hash::hash_args;\n\ntrait CallInterface<let N: u32, T, P, Env> {\n fn get_original(self) -> fn[Env](T) -> P;\n\n fn get_args(self) -> [Field] {\n self.args\n }\n\n fn get_selector(self) -> FunctionSelector {\n self.selector\n }\n\n fn get_name(self) -> str<N> {\n self.name\n }\n\n fn get_contract_address(self) -> AztecAddress {\n self.target_contract\n }\n\n fn get_is_static(self) -> bool {\n self.is_static\n }\n}\n\nimpl<let N: u32, T, P, Env> CallInterface<N, PrivateContextInputs, PrivateCircuitPublicInputs, Env> for PrivateCallInterface<N, T, Env> {\n fn get_original(self) -> fn[Env](PrivateContextInputs) -> PrivateCircuitPublicInputs {\n self.original\n }\n}\n\nstruct PrivateCallInterface<let N: u32, T, Env> {\n target_contract: AztecAddress,\n selector: FunctionSelector,\n name: str<N>,\n args_hash: Field,\n args: [Field],\n original: fn[Env](PrivateContextInputs) -> PrivateCircuitPublicInputs,\n is_static: bool\n}\n\nimpl<let N: u32, T, Env> PrivateCallInterface<N, T, Env> {\n pub fn call<let M: u32>(self, context: &mut PrivateContext) -> T where T: Deserialize<M> {\n assert(self.args_hash == pack_arguments(self.args));\n let returns = context.call_private_function_with_packed_args(\n self.target_contract,\n self.selector,\n self.args_hash,\n false,\n false\n );\n let unpacked: T = returns.unpack_into();\n unpacked\n }\n\n pub fn view<let M: u32>(self, context: &mut PrivateContext) -> T where T: Deserialize<M> {\n assert(self.args_hash == pack_arguments(self.args));\n let returns = context.call_private_function_with_packed_args(self.target_contract, self.selector, self.args_hash, true, false);\n returns.unpack_into()\n }\n\n pub fn delegate_call<let M: u32>(self, context: &mut PrivateContext) -> T where T: Deserialize<M> {\n assert(self.args_hash == pack_arguments(self.args));\n let returns = context.call_private_function_with_packed_args(self.target_contract, self.selector, self.args_hash, false, true);\n returns.unpack_into()\n }\n}\n\nimpl<let N: u32, T, P, Env> CallInterface<N, PrivateContextInputs, PrivateCircuitPublicInputs, Env> for PrivateVoidCallInterface<N, Env> {\n fn get_original(self) -> fn[Env](PrivateContextInputs) -> PrivateCircuitPublicInputs {\n self.original\n }\n}\n\nstruct PrivateVoidCallInterface<let N: u32, Env> {\n target_contract: AztecAddress,\n selector: FunctionSelector,\n name: str<N>,\n args_hash: Field,\n args: [Field],\n original: fn[Env](PrivateContextInputs) -> PrivateCircuitPublicInputs,\n is_static: bool\n}\n\nimpl<let N: u32, Env> PrivateVoidCallInterface<N, Env> {\n pub fn call(self, context: &mut PrivateContext) {\n assert(self.args_hash == pack_arguments(self.args));\n context.call_private_function_with_packed_args(\n self.target_contract,\n self.selector,\n self.args_hash,\n false,\n false\n ).assert_empty();\n }\n\n pub fn view(self, context: &mut PrivateContext) {\n assert(self.args_hash == pack_arguments(self.args));\n context.call_private_function_with_packed_args(self.target_contract, self.selector, self.args_hash, true, false).assert_empty();\n }\n\n pub fn delegate_call(self, context: &mut PrivateContext) {\n assert(self.args_hash == pack_arguments(self.args));\n context.call_private_function_with_packed_args(self.target_contract, self.selector, self.args_hash, false, true).assert_empty();\n }\n}\n\nimpl<let N: u32, T, P, Env> CallInterface<N, PrivateContextInputs, PrivateCircuitPublicInputs, Env> for PrivateStaticCallInterface<N, T, Env> {\n fn get_original(self) -> fn[Env](PrivateContextInputs) -> PrivateCircuitPublicInputs {\n self.original\n }\n}\n\nstruct PrivateStaticCallInterface<let N: u32, T, Env> {\n target_contract: AztecAddress,\n selector: FunctionSelector,\n name: str<N>,\n args_hash: Field,\n args: [Field],\n original: fn[Env](PrivateContextInputs) -> PrivateCircuitPublicInputs,\n is_static: bool\n}\n\nimpl<let N: u32, T, Env> PrivateStaticCallInterface<N, T, Env> {\n pub fn view<let M: u32>(self, context: &mut PrivateContext) -> T where T: Deserialize<M> {\n assert(self.args_hash == pack_arguments(self.args));\n let returns = context.call_private_function_with_packed_args(self.target_contract, self.selector, self.args_hash, true, false);\n returns.unpack_into()\n }\n}\n\nimpl<let N: u32, T, P, Env> CallInterface<N, PrivateContextInputs, PrivateCircuitPublicInputs, Env> for PrivateStaticVoidCallInterface<N, Env> {\n fn get_original(self) -> fn[Env](PrivateContextInputs) -> PrivateCircuitPublicInputs {\n self.original\n }\n}\n\nstruct PrivateStaticVoidCallInterface<let N: u32, Env> {\n target_contract: AztecAddress,\n selector: FunctionSelector,\n name: str<N>,\n args_hash: Field,\n args: [Field],\n original: fn[Env](PrivateContextInputs) -> PrivateCircuitPublicInputs,\n is_static: bool\n}\n\nimpl<let N: u32, Env> PrivateStaticVoidCallInterface<N, Env> {\n pub fn view(self, context: &mut PrivateContext) {\n assert(self.args_hash == pack_arguments(self.args));\n context.call_private_function_with_packed_args(self.target_contract, self.selector, self.args_hash, true, false).assert_empty();\n }\n}\n\nimpl<let N: u32, T, P, Env> CallInterface<N, PublicContextInputs, T, Env> for PublicCallInterface<N, T, Env> {\n fn get_original(self) -> fn[Env](PublicContextInputs) -> T {\n self.original\n }\n}\n\nstruct PublicCallInterface<let N: u32, T, Env> {\n target_contract: AztecAddress,\n selector: FunctionSelector,\n name: str<N>,\n args: [Field],\n gas_opts: GasOpts,\n original: fn[Env](PublicContextInputs) -> T,\n is_static: bool\n}\n\nimpl<let N: u32, T, Env> PublicCallInterface<N, T, Env> {\n pub fn with_gas(self: &mut Self, gas_opts: GasOpts) -> &mut Self {\n self.gas_opts = gas_opts;\n self\n }\n\n pub fn call<let M: u32>(self, context: &mut PublicContext) -> T where T: Deserialize<M> {\n let returns = context.call_public_function(self.target_contract, self.selector, self.args, self.gas_opts);\n returns.deserialize_into()\n }\n\n pub fn view<let M: u32>(self, context: &mut PublicContext) -> T where T: Deserialize<M> {\n let returns = context.static_call_public_function(self.target_contract, self.selector, self.args, self.gas_opts);\n returns.deserialize_into()\n }\n\n pub fn delegate_call<let M: u32>(self, context: &mut PublicContext) -> T where T: Deserialize<M> {\n let returns = context.delegate_call_public_function(self.target_contract, self.selector, self.args);\n returns.deserialize_into()\n }\n\n pub fn enqueue(self, context: &mut PrivateContext) {\n let args_hash = hash_args(self.args);\n assert(args_hash == pack_arguments(self.args));\n context.call_public_function_with_packed_args(\n self.target_contract,\n self.selector,\n args_hash,\n /*static=*/ false,\n /*delegate=*/ false\n )\n }\n\n pub fn enqueue_view(self, context: &mut PrivateContext) {\n let args_hash = hash_args(self.args);\n assert(args_hash == pack_arguments(self.args));\n context.call_public_function_with_packed_args(\n self.target_contract,\n self.selector,\n args_hash,\n /*static=*/ true,\n /*delegate=*/ false\n )\n }\n\n pub fn delegate_enqueue(self, context: &mut PrivateContext) {\n let args_hash = hash_args(self.args);\n assert(args_hash == pack_arguments(self.args));\n context.call_public_function_with_packed_args(\n self.target_contract,\n self.selector,\n args_hash,\n /*static=*/ false,\n /*delegate=*/ true\n )\n }\n}\n\nimpl<let N: u32, T, P, Env> CallInterface<N, PublicContextInputs, (), Env> for PublicVoidCallInterface<N, Env> {\n fn get_original(self) -> fn[Env](PublicContextInputs) -> () {\n self.original\n }\n}\n\nstruct PublicVoidCallInterface<let N: u32, Env> {\n target_contract: AztecAddress,\n selector: FunctionSelector,\n name: str<N>,\n args: [Field],\n original: fn[Env](PublicContextInputs) -> (),\n is_static: bool,\n gas_opts: GasOpts\n}\n\nimpl<let N: u32, Env> PublicVoidCallInterface<N, Env> {\n pub fn with_gas(self: &mut Self, gas_opts: GasOpts) -> &mut Self {\n self.gas_opts = gas_opts;\n self\n }\n\n pub fn call(self, context: &mut PublicContext) {\n let returns = context.call_public_function(self.target_contract, self.selector, self.args, self.gas_opts);\n returns.assert_empty()\n }\n\n pub fn view(self, context: &mut PublicContext) {\n let returns = context.static_call_public_function(self.target_contract, self.selector, self.args, self.gas_opts);\n returns.assert_empty()\n }\n\n pub fn delegate_call(self, context: &mut PublicContext) {\n let returns = context.delegate_call_public_function(self.target_contract, self.selector, self.args);\n returns.assert_empty()\n }\n\n pub fn enqueue(self, context: &mut PrivateContext) {\n let args_hash = hash_args(self.args);\n assert(args_hash == pack_arguments(self.args));\n context.call_public_function_with_packed_args(\n self.target_contract,\n self.selector,\n args_hash,\n /*static=*/ false,\n /*delegate=*/ false\n )\n }\n\n pub fn enqueue_view(self, context: &mut PrivateContext) {\n let args_hash = hash_args(self.args);\n assert(args_hash == pack_arguments(self.args));\n context.call_public_function_with_packed_args(\n self.target_contract,\n self.selector,\n args_hash,\n /*static=*/ true,\n /*delegate=*/ false\n )\n }\n\n pub fn delegate_enqueue(self, context: &mut PrivateContext) {\n let args_hash = hash_args(self.args);\n assert(args_hash == pack_arguments(self.args));\n context.call_public_function_with_packed_args(\n self.target_contract,\n self.selector,\n args_hash,\n /*static=*/ false,\n /*delegate=*/ true\n )\n }\n}\n\nimpl<let N: u32, T, P, Env> CallInterface<N, PublicContextInputs, T, Env> for PublicStaticCallInterface<N, T, Env> {\n fn get_original(self) -> fn[Env](PublicContextInputs) -> T {\n self.original\n }\n}\n\nstruct PublicStaticCallInterface<let N: u32, T, Env> {\n target_contract: AztecAddress,\n selector: FunctionSelector,\n name: str<N>,\n args: [Field],\n original: fn[Env](PublicContextInputs) -> T,\n is_static: bool,\n gas_opts: GasOpts\n}\n\nimpl<let N: u32, T, Env> PublicStaticCallInterface<N, T, Env> {\n pub fn with_gas(self: &mut Self, gas_opts: GasOpts) -> &mut Self {\n self.gas_opts = gas_opts;\n self\n }\n\n pub fn view<let M: u32>(self, context: &mut PublicContext) -> T where T: Deserialize<M> {\n let returns = context.static_call_public_function(self.target_contract, self.selector, self.args, self.gas_opts);\n let unpacked: T = returns.deserialize_into();\n unpacked\n }\n\n pub fn enqueue_view(self, context: &mut PrivateContext) {\n let args_hash = hash_args(self.args);\n assert(args_hash == pack_arguments(self.args));\n context.call_public_function_with_packed_args(\n self.target_contract,\n self.selector,\n args_hash,\n /*static=*/ true,\n /*delegate=*/ false\n )\n }\n}\n\nimpl<let N: u32, T, P, Env> CallInterface<N, PublicContextInputs, (), Env> for PublicStaticVoidCallInterface<N, Env> {\n fn get_original(self) -> fn[Env](PublicContextInputs) -> () {\n self.original\n }\n}\n\nstruct PublicStaticVoidCallInterface<let N: u32, Env> {\n target_contract: AztecAddress,\n selector: FunctionSelector,\n name: str<N>,\n args: [Field],\n original: fn[Env](PublicContextInputs) -> (),\n is_static: bool,\n gas_opts: GasOpts\n}\n\nimpl<let N: u32, Env> PublicStaticVoidCallInterface<N, Env> {\n pub fn with_gas(self: &mut Self, gas_opts: GasOpts) -> &mut Self {\n self.gas_opts = gas_opts;\n self\n }\n\n pub fn view(self, context: &mut PublicContext) {\n let returns = context.static_call_public_function(self.target_contract, self.selector, self.args, self.gas_opts);\n returns.assert_empty()\n }\n\n pub fn enqueue_view(self, context: &mut PrivateContext) {\n let args_hash = hash_args(self.args);\n assert(args_hash == pack_arguments(self.args));\n context.call_public_function_with_packed_args(\n self.target_contract,\n self.selector,\n args_hash,\n /*static=*/ true,\n /*delegate=*/ false\n )\n }\n}\n"},"113":{"path":"/usr/src/noir-projects/aztec-nr/aztec/src/context/private_context.nr","source":"use crate::{\n context::{inputs::PrivateContextInputs, packed_returns::PackedReturns},\n messaging::process_l1_to_l2_message, hash::{hash_args_array, ArgsHasher},\n keys::constants::{NULLIFIER_INDEX, OUTGOING_INDEX, NUM_KEY_TYPES, sk_generators},\n oracle::{\n key_validation_request::get_key_validation_request, arguments, returns::pack_returns,\n call_private_function::call_private_function_internal, header::get_header_at,\n logs::{emit_encrypted_note_log, emit_encrypted_event_log},\n enqueue_public_function_call::{\n enqueue_public_function_call_internal, notify_set_min_revertible_side_effect_counter,\n set_public_teardown_function_call_internal\n}\n}\n};\nuse dep::protocol_types::{\n abis::{\n call_context::CallContext, function_selector::FunctionSelector, gas::Gas,\n max_block_number::MaxBlockNumber,\n validation_requests::{KeyValidationRequest, KeyValidationRequestAndGenerator},\n private_call_request::PrivateCallRequest, private_circuit_public_inputs::PrivateCircuitPublicInputs,\n public_call_request::PublicCallRequest, public_call_stack_item::PublicCallStackItem,\n public_call_stack_item_compressed::PublicCallStackItemCompressed, read_request::ReadRequest,\n note_hash::NoteHash, nullifier::Nullifier, log_hash::{LogHash, NoteLogHash, EncryptedLogHash}\n},\n address::{AztecAddress, EthAddress},\n constants::{\n MAX_NOTE_HASHES_PER_CALL, MAX_L2_TO_L1_MSGS_PER_CALL, MAX_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_KEY_VALIDATION_REQUESTS_PER_CALL, MAX_ENCRYPTED_LOGS_PER_CALL, MAX_UNENCRYPTED_LOGS_PER_CALL,\n MAX_NOTE_ENCRYPTED_LOGS_PER_CALL\n},\n header::Header, messaging::l2_to_l1_message::L2ToL1Message, utils::reader::Reader, traits::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 is_fee_payer: bool,\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 key_validation_requests_and_generators: BoundedVec<KeyValidationRequestAndGenerator, MAX_KEY_VALIDATION_REQUESTS_PER_CALL>,\n\n note_hashes: BoundedVec<NoteHash, MAX_NOTE_HASHES_PER_CALL>,\n nullifiers: BoundedVec<Nullifier, MAX_NULLIFIERS_PER_CALL>,\n\n private_call_requests : BoundedVec<PrivateCallRequest, MAX_PRIVATE_CALL_STACK_LENGTH_PER_CALL>,\n public_call_requests : BoundedVec<PublicCallRequest, MAX_PUBLIC_CALL_STACK_LENGTH_PER_CALL>,\n public_teardown_call_request: PublicCallRequest,\n l2_to_l1_msgs : BoundedVec<L2ToL1Message, MAX_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 note_encrypted_logs_hashes: BoundedVec<NoteLogHash, MAX_NOTE_ENCRYPTED_LOGS_PER_CALL>,\n encrypted_logs_hashes: BoundedVec<EncryptedLogHash, MAX_ENCRYPTED_LOGS_PER_CALL>,\n unencrypted_logs_hashes: BoundedVec<LogHash, MAX_UNENCRYPTED_LOGS_PER_CALL>,\n\n // Contains the last key validation request for each key type. This is used to cache the last request and avoid\n // fetching the same request multiple times.\n // The index of the array corresponds to the key type (0 nullifier, 1 incoming, 2 outgoing, 3 tagging).\n last_key_validation_requests: [Option<KeyValidationRequest>; NUM_KEY_TYPES],\n}\n\nimpl PrivateContext {\n pub fn new(inputs: PrivateContextInputs, args_hash: Field) -> PrivateContext {\n PrivateContext {\n inputs,\n side_effect_counter: inputs.start_side_effect_counter + 1,\n min_revertible_side_effect_counter: 0,\n is_fee_payer: false,\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 key_validation_requests_and_generators: BoundedVec::new(),\n note_hashes: BoundedVec::new(),\n nullifiers: BoundedVec::new(),\n historical_header: inputs.historical_header,\n private_call_requests: BoundedVec::new(),\n public_call_requests: BoundedVec::new(),\n public_teardown_call_request: PublicCallRequest::empty(),\n l2_to_l1_msgs: BoundedVec::new(),\n note_encrypted_logs_hashes: BoundedVec::new(),\n encrypted_logs_hashes: BoundedVec::new(),\n unencrypted_logs_hashes: BoundedVec::new(),\n last_key_validation_requests: [Option::none(); NUM_KEY_TYPES]\n }\n }\n\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_note_hash(&mut self, note_hash: Field) {\n self.note_hashes.push(NoteHash { value: note_hash, counter: self.next_counter() });\n }\n\n fn push_nullifier(&mut self, nullifier: Field) {\n self.nullifiers.push(Nullifier { value: nullifier, note_hash: 0, counter: self.next_counter() });\n }\n\n fn push_nullifier_for_note_hash(&mut self, nullifier: Field, nullified_note_hash: Field) {\n self.nullifiers.push(Nullifier { value: nullifier, note_hash: nullified_note_hash, counter: self.next_counter() });\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 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 is_fee_payer: self.is_fee_payer,\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 key_validation_requests_and_generators: self.key_validation_requests_and_generators.storage,\n note_hashes: self.note_hashes.storage,\n nullifiers: self.nullifiers.storage,\n private_call_requests: self.private_call_requests.storage,\n public_call_requests: self.public_call_requests.storage,\n public_teardown_call_request: self.public_teardown_call_request,\n l2_to_l1_msgs: self.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 note_encrypted_logs_hashes: self.note_encrypted_logs_hashes.storage,\n encrypted_logs_hashes: self.encrypted_logs_hashes.storage,\n unencrypted_logs_hashes: self.unencrypted_logs_hashes.storage,\n historical_header: self.historical_header,\n tx_context: self.inputs.tx_context\n }\n }\n\n pub fn set_as_fee_payer(&mut self) {\n dep::protocol_types::debug_log::debug_log_format(\"Setting {0} as fee payer\", [self.this_address().to_field()]);\n self.is_fee_payer = true;\n }\n\n pub fn end_setup(&mut self) {\n // dep::protocol_types::debug_log::debug_log_format(\n // \"Ending setup at counter {0}\",\n // [self.side_effect_counter as Field]\n // );\n self.min_revertible_side_effect_counter = self.side_effect_counter;\n notify_set_min_revertible_side_effect_counter(self.min_revertible_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.next_counter() };\n self.note_hash_read_requests.push(side_effect);\n }\n\n pub fn push_nullifier_read_request(&mut self, nullifier: Field) {\n let request = ReadRequest { value: nullifier, counter: self.next_counter() };\n self.nullifier_read_requests.push(request);\n }\n\n pub fn request_nsk_app(&mut self, npk_m_hash: Field) -> Field {\n self.request_sk_app(npk_m_hash, NULLIFIER_INDEX)\n }\n\n pub fn request_ovsk_app(&mut self, ovpk_m_hash: Field) -> Field {\n self.request_sk_app(ovpk_m_hash, OUTGOING_INDEX)\n }\n\n fn request_sk_app(&mut self, pk_m_hash: Field, key_index: Field) -> Field {\n let cached_request = self.last_key_validation_requests[key_index].unwrap_or(KeyValidationRequest::empty());\n\n if cached_request.pk_m.hash() == pk_m_hash {\n // We get a match so the cached request is the latest one\n cached_request.sk_app\n } else {\n // We didn't get a match meaning the cached result is stale. We fetch new values from oracle and instruct\n // protocol circuits to validate them by storing the validation request in context.\n let request = get_key_validation_request(pk_m_hash, key_index);\n let request_and_generator = KeyValidationRequestAndGenerator { request, sk_app_generator: sk_generators[key_index] };\n // We constrain that the pk_m_hash matches the one in the request (otherwise we could get an arbitrary\n // valid key request and not the one corresponding to pk_m_hash).\n assert(request.pk_m.hash() == pk_m_hash);\n self.key_validation_requests_and_generators.push(request_and_generator);\n self.last_key_validation_requests[key_index] = Option::some(request);\n request.sk_app\n }\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, counter: self.next_counter() };\n self.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_nullifier(nullifier)\n }\n // docs:end:consume_l1_to_l2_message\n\n // NB: A randomness value of 0 signals that the kernels should not mask the contract address\n // used in siloing later on e.g. 'handshaking' contract w/ known address.\n pub fn emit_raw_event_log_with_masked_address<let M: u32>(\n &mut self,\n randomness: Field,\n log: [u8; M],\n log_hash: Field\n ) {\n let counter = self.next_counter();\n let contract_address = self.this_address();\n let len = log.len() as Field + 4;\n let side_effect = EncryptedLogHash { value: log_hash, counter, length: len, randomness };\n self.encrypted_logs_hashes.push(side_effect);\n\n emit_encrypted_event_log(contract_address, randomness, log, counter);\n }\n\n pub fn emit_raw_note_log<let M: u32>(&mut self, note_hash_counter: u32, log: [u8; M], log_hash: Field) {\n let counter = self.next_counter();\n let len = log.len() as Field + 4;\n let side_effect = NoteLogHash { value: log_hash, counter, length: len, note_hash_counter };\n self.note_encrypted_logs_hashes.push(side_effect);\n\n emit_encrypted_note_log(note_hash_counter, log, counter);\n }\n\n pub fn call_private_function<let ARGS_COUNT: u32>(\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<let ARGS_COUNT: u32>(\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<let ARGS_COUNT: u32>(\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(\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(\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(\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(\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 start_side_effect_counter = self.side_effect_counter;\n let (end_side_effect_counter, returns_hash) = call_private_function_internal(\n contract_address,\n function_selector,\n args_hash,\n start_side_effect_counter,\n is_static_call,\n is_delegate_call\n );\n\n self.side_effect_counter = 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 let call_context = self.generate_call_context(\n contract_address,\n function_selector,\n is_static_call,\n is_delegate_call\n );\n\n self.private_call_requests.push(\n PrivateCallRequest {\n contract_address,\n call_context,\n args_hash,\n returns_hash,\n start_side_effect_counter,\n end_side_effect_counter\n }\n );\n\n PackedReturns::new(returns_hash)\n }\n\n pub fn call_public_function<let ARGS_COUNT: u32>(\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<let ARGS_COUNT: u32>(\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<let ARGS_COUNT: u32>(\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 counter = self.next_counter();\n\n let mut is_static_call = is_static_call | self.inputs.call_context.is_static_call;\n enqueue_public_function_call_internal(\n contract_address,\n function_selector,\n args_hash,\n counter,\n is_static_call,\n is_delegate_call\n );\n\n let call_context = self.generate_call_context(\n contract_address,\n function_selector,\n is_static_call,\n is_delegate_call\n );\n\n let item = PublicCallStackItemCompressed {\n contract_address,\n call_context,\n args_hash,\n returns_hash: 0,\n revert_code: 0,\n start_gas_left: Gas::empty(),\n end_gas_left: Gas::empty()\n };\n\n let call_request = PublicCallRequest { item, counter };\n self.public_call_requests.push(call_request);\n }\n\n pub fn set_public_teardown_function<let ARGS_COUNT: u32>(\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(\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 counter = self.next_counter();\n\n let mut is_static_call = is_static_call | self.inputs.call_context.is_static_call;\n set_public_teardown_function_call_internal(\n contract_address,\n function_selector,\n args_hash,\n counter,\n is_static_call,\n is_delegate_call\n );\n\n let call_context = self.generate_call_context(\n contract_address,\n function_selector,\n is_static_call,\n is_delegate_call\n );\n\n let item = PublicCallStackItemCompressed {\n contract_address,\n call_context,\n args_hash,\n returns_hash: 0,\n revert_code: 0,\n start_gas_left: Gas::empty(),\n end_gas_left: Gas::empty()\n };\n\n self.public_teardown_call_request = PublicCallRequest {\n item,\n counter,\n };\n }\n\n fn generate_call_context(\n self,\n contract_address: AztecAddress,\n function_selector: FunctionSelector,\n is_static_call: bool,\n is_delegate_call: bool\n ) -> CallContext {\n let msg_sender = if is_delegate_call {\n self.msg_sender()\n } else {\n self.this_address()\n };\n let storage_contract_address = if is_delegate_call {\n self.this_address()\n } else {\n contract_address\n };\n CallContext { msg_sender, storage_contract_address, function_selector, is_static_call, is_delegate_call }\n }\n\n fn next_counter(&mut self) -> u32 {\n let counter = self.side_effect_counter;\n self.side_effect_counter += 1;\n counter\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 is_fee_payer: false,\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 key_validation_requests_and_generators: BoundedVec::new(),\n note_hashes: BoundedVec::new(),\n nullifiers: BoundedVec::new(),\n private_call_requests: BoundedVec::new(),\n public_call_requests: BoundedVec::new(),\n public_teardown_call_request: PublicCallRequest::empty(),\n l2_to_l1_msgs: BoundedVec::new(),\n historical_header: Header::empty(),\n note_encrypted_logs_hashes: BoundedVec::new(),\n encrypted_logs_hashes: BoundedVec::new(),\n unencrypted_logs_hashes: BoundedVec::new(),\n last_key_validation_requests: [Option::none(); NUM_KEY_TYPES]\n }\n }\n}\n"},"114":{"path":"/usr/src/noir-projects/aztec-nr/aztec/src/context/public_context.nr","source":"use crate::hash::{compute_secret_hash, compute_message_hash, compute_message_nullifier};\nuse dep::protocol_types::address::{AztecAddress, EthAddress};\nuse dep::protocol_types::constants::MAX_FIELD_VALUE;\nuse dep::protocol_types::traits::{Serialize, Deserialize, Empty};\nuse dep::protocol_types::abis::function_selector::FunctionSelector;\nuse crate::context::inputs::public_context_inputs::PublicContextInputs;\nuse crate::context::gas::GasOpts;\nuse crate::hash::ArgsHasher;\n\nstruct PublicContext {\n inputs: PublicContextInputs,\n args_hash: Option<Field>\n}\n\nimpl PublicContext {\n pub fn new(inputs: PublicContextInputs) -> Self {\n PublicContext { inputs, args_hash: Option::none() }\n }\n\n pub fn emit_unencrypted_log<T, let N: u32>(_self: &mut Self, log: T) where T: Serialize<N> {\n emit_unencrypted_log(Serialize::serialize(log).as_slice());\n }\n\n pub fn note_hash_exists(_self: Self, note_hash: Field, leaf_index: Field) -> bool {\n note_hash_exists(note_hash, leaf_index) == 1\n }\n\n pub fn l1_to_l2_msg_exists(_self: Self, msg_hash: Field, msg_leaf_index: Field) -> bool {\n l1_to_l2_msg_exists(msg_hash, msg_leaf_index) == 1\n }\n\n fn nullifier_exists(_self: Self, unsiloed_nullifier: Field, address: AztecAddress) -> bool {\n nullifier_exists(unsiloed_nullifier, address.to_field()) == 1\n }\n\n fn consume_l1_to_l2_message(\n &mut self,\n content: Field,\n secret: Field,\n sender: EthAddress,\n leaf_index: Field\n ) {\n let secret_hash = compute_secret_hash(secret);\n let message_hash = compute_message_hash(\n sender,\n self.chain_id(),\n /*recipient=*/ self.this_address(),\n self.version(),\n content,\n secret_hash\n );\n let nullifier = compute_message_nullifier(message_hash, secret, leaf_index);\n\n assert(\n !self.nullifier_exists(nullifier, self.this_address()), \"L1-to-L2 message is already nullified\"\n );\n assert(\n self.l1_to_l2_msg_exists(message_hash, leaf_index), \"Tried to consume nonexistent L1-to-L2 message\"\n );\n\n self.push_nullifier(nullifier);\n }\n\n fn message_portal(_self: &mut Self, recipient: EthAddress, content: Field) {\n send_l2_to_l1_msg(recipient, content);\n }\n\n fn call_public_function<let RETURNS_COUNT: u32>(\n _self: &mut Self,\n contract_address: AztecAddress,\n function_selector: FunctionSelector,\n args: [Field],\n gas_opts: GasOpts\n ) -> FunctionReturns<RETURNS_COUNT> {\n let results = call(\n gas_for_call(gas_opts),\n contract_address,\n args,\n function_selector.to_field()\n );\n let data_to_return: [Field; RETURNS_COUNT] = results.0;\n let success: u8 = results.1;\n assert(success == 1, \"Nested call failed!\");\n\n FunctionReturns::new(data_to_return)\n }\n\n fn static_call_public_function<let RETURNS_COUNT: u32>(\n _self: &mut Self,\n contract_address: AztecAddress,\n function_selector: FunctionSelector,\n args: [Field],\n gas_opts: GasOpts\n ) -> FunctionReturns<RETURNS_COUNT> {\n let (data_to_return, success): ([Field; RETURNS_COUNT], u8) = call_static(\n gas_for_call(gas_opts),\n contract_address,\n args,\n function_selector.to_field()\n );\n\n assert(success == 1, \"Nested static call failed!\");\n FunctionReturns::new(data_to_return)\n }\n\n fn delegate_call_public_function<let RETURNS_COUNT: u32>(\n _self: &mut Self,\n _contract_address: AztecAddress,\n _function_selector: FunctionSelector,\n _args: [Field]\n ) -> FunctionReturns<RETURNS_COUNT> {\n assert(false, \"'delegate_call_public_function' not implemented!\");\n FunctionReturns::new([0; RETURNS_COUNT])\n }\n\n fn push_note_hash(_self: &mut Self, note_hash: Field) {\n emit_note_hash(note_hash);\n }\n fn push_nullifier(_self: &mut Self, nullifier: Field) {\n emit_nullifier(nullifier);\n }\n\n fn this_address(_self: Self) -> AztecAddress {\n address()\n }\n pub fn storage_address(_self: Self) -> AztecAddress {\n storage_address()\n }\n fn msg_sender(_self: Self) -> AztecAddress {\n sender()\n }\n fn selector(_self: Self) -> FunctionSelector {\n FunctionSelector::from_u32(function_selector())\n }\n fn get_args_hash(mut self) -> Field {\n if !self.args_hash.is_some() {\n let mut hasher = ArgsHasher::new();\n\n // TODO: this should be replaced with the compile-time calldata size.\n for i in 0..self.inputs.calldata_length as u32 {\n let argn: [Field; 1] = calldata_copy((2 + i) as u32, 1);\n hasher.add(argn[0]);\n }\n\n self.args_hash = Option::some(hasher.hash());\n }\n\n self.args_hash.unwrap()\n }\n fn transaction_fee(_self: Self) -> Field {\n transaction_fee()\n }\n\n fn chain_id(_self: Self) -> Field {\n chain_id()\n }\n fn version(_self: Self) -> Field {\n version()\n }\n fn block_number(_self: Self) -> Field {\n block_number()\n }\n fn timestamp(_self: Self) -> u64 {\n timestamp()\n }\n pub fn fee_per_l2_gas(_self: Self) -> Field {\n fee_per_l2_gas()\n }\n pub fn fee_per_da_gas(_self: Self) -> Field {\n fee_per_da_gas()\n }\n\n fn l2_gas_left(_self: Self) -> Field {\n l2_gas_left()\n }\n fn da_gas_left(_self: Self) -> Field {\n da_gas_left()\n }\n\n fn raw_storage_read<let N: u32>(_self: Self, storage_slot: Field) -> [Field; N] {\n let mut out = [0; N];\n for i in 0..N {\n out[i] = storage_read(storage_slot + i as Field);\n }\n out\n }\n\n fn storage_read<T, let N: u32>(self, storage_slot: Field) -> T where T: Deserialize<N> {\n T::deserialize(self.raw_storage_read(storage_slot))\n }\n\n fn raw_storage_write<let N: u32>(_self: Self, storage_slot: Field, values: [Field; N]) {\n for i in 0..N {\n storage_write(storage_slot + i as Field, values[i]);\n }\n }\n\n fn storage_write<T, let N: u32>(self, storage_slot: Field, value: T) where T: Serialize<N> {\n self.raw_storage_write(storage_slot, value.serialize());\n }\n}\n\n// Helper functions\nfn gas_for_call(user_gas: GasOpts) -> [Field; 2] {\n // It's ok to use the max possible gas here, because the gas will be\n // capped by the gas left in the (STATIC)CALL instruction.\n [\n user_gas.l2_gas.unwrap_or(MAX_FIELD_VALUE),\n user_gas.da_gas.unwrap_or(MAX_FIELD_VALUE)\n ]\n}\n\n// Unconstrained opcode wrappers (do not use directly).\n// TODO(https://github.com/AztecProtocol/aztec-packages/issues/6420): reconsider.\nunconstrained fn address() -> AztecAddress {\n address_opcode()\n}\nunconstrained fn storage_address() -> AztecAddress {\n storage_address_opcode()\n}\nunconstrained fn sender() -> AztecAddress {\n sender_opcode()\n}\nunconstrained fn portal() -> EthAddress {\n portal_opcode()\n}\nunconstrained fn function_selector() -> u32 {\n function_selector_opcode()\n}\nunconstrained fn transaction_fee() -> Field {\n transaction_fee_opcode()\n}\nunconstrained fn chain_id() -> Field {\n chain_id_opcode()\n}\nunconstrained fn version() -> Field {\n version_opcode()\n}\nunconstrained fn block_number() -> Field {\n block_number_opcode()\n}\nunconstrained fn timestamp() -> u64 {\n timestamp_opcode()\n}\nunconstrained fn fee_per_l2_gas() -> Field {\n fee_per_l2_gas_opcode()\n}\nunconstrained fn fee_per_da_gas() -> Field {\n fee_per_da_gas_opcode()\n}\nunconstrained fn l2_gas_left() -> Field {\n l2_gas_left_opcode()\n}\nunconstrained fn da_gas_left() -> Field {\n da_gas_left_opcode()\n}\nunconstrained fn note_hash_exists(note_hash: Field, leaf_index: Field) -> u8 {\n note_hash_exists_opcode(note_hash, leaf_index)\n}\nunconstrained fn emit_note_hash(note_hash: Field) {\n emit_note_hash_opcode(note_hash)\n}\nunconstrained fn nullifier_exists(nullifier: Field, address: Field) -> u8 {\n nullifier_exists_opcode(nullifier, address)\n}\nunconstrained fn emit_nullifier(nullifier: Field) {\n emit_nullifier_opcode(nullifier)\n}\nunconstrained fn emit_unencrypted_log(message: [Field]) {\n emit_unencrypted_log_opcode(message)\n}\nunconstrained fn l1_to_l2_msg_exists(msg_hash: Field, msg_leaf_index: Field) -> u8 {\n l1_to_l2_msg_exists_opcode(msg_hash, msg_leaf_index)\n}\nunconstrained fn send_l2_to_l1_msg(recipient: EthAddress, content: Field) {\n send_l2_to_l1_msg_opcode(recipient, content)\n}\nunconstrained fn call<let RET_SIZE: u32>(\n gas: [Field; 2],\n address: AztecAddress,\n args: [Field],\n function_selector: Field\n) -> ([Field; RET_SIZE], u8) {\n call_opcode(gas, address, args, function_selector)\n}\nunconstrained fn call_static<let RET_SIZE: u32>(\n gas: [Field; 2],\n address: AztecAddress,\n args: [Field],\n function_selector: Field\n) -> ([Field; RET_SIZE], u8) {\n call_static_opcode(gas, address, args, function_selector)\n}\n\nunconstrained fn calldata_copy<let N: u32>(cdoffset: u32, copy_size: u32) -> [Field; N] {\n calldata_copy_opcode(cdoffset, copy_size)\n}\n\nunconstrained fn storage_read(storage_slot: Field) -> Field {\n storage_read_opcode(storage_slot)\n}\n\nunconstrained fn storage_write(storage_slot: Field, value: Field) {\n storage_write_opcode(storage_slot, value);\n}\n\nimpl Empty for PublicContext {\n fn empty() -> Self {\n PublicContext::new(PublicContextInputs::empty())\n }\n}\n\n// AVM oracles (opcodes) follow, do not use directly.\n#[oracle(avmOpcodeAddress)]\nunconstrained fn address_opcode() -> AztecAddress {}\n\n#[oracle(avmOpcodeStorageAddress)]\nunconstrained fn storage_address_opcode() -> AztecAddress {}\n\n#[oracle(avmOpcodeSender)]\nunconstrained fn sender_opcode() -> AztecAddress {}\n\n#[oracle(avmOpcodePortal)]\nunconstrained fn portal_opcode() -> EthAddress {}\n\n#[oracle(avmOpcodeFunctionSelector)]\nunconstrained fn function_selector_opcode() -> u32 {}\n\n#[oracle(avmOpcodeTransactionFee)]\nunconstrained fn transaction_fee_opcode() -> Field {}\n\n#[oracle(avmOpcodeChainId)]\nunconstrained fn chain_id_opcode() -> Field {}\n\n#[oracle(avmOpcodeVersion)]\nunconstrained fn version_opcode() -> Field {}\n\n#[oracle(avmOpcodeBlockNumber)]\nunconstrained fn block_number_opcode() -> Field {}\n\n#[oracle(avmOpcodeTimestamp)]\nunconstrained fn timestamp_opcode() -> u64 {}\n\n#[oracle(avmOpcodeFeePerL2Gas)]\nunconstrained fn fee_per_l2_gas_opcode() -> Field {}\n\n#[oracle(avmOpcodeFeePerDaGas)]\nunconstrained fn fee_per_da_gas_opcode() -> Field {}\n\n#[oracle(avmOpcodeL2GasLeft)]\nunconstrained fn l2_gas_left_opcode() -> Field {}\n\n#[oracle(avmOpcodeDaGasLeft)]\nunconstrained fn da_gas_left_opcode() -> Field {}\n\n#[oracle(avmOpcodeNoteHashExists)]\nunconstrained fn note_hash_exists_opcode(note_hash: Field, leaf_index: Field) -> u8 {}\n\n#[oracle(avmOpcodeEmitNoteHash)]\nunconstrained fn emit_note_hash_opcode(note_hash: Field) {}\n\n#[oracle(avmOpcodeNullifierExists)]\nunconstrained fn nullifier_exists_opcode(nullifier: Field, address: Field) -> u8 {}\n\n#[oracle(avmOpcodeEmitNullifier)]\nunconstrained fn emit_nullifier_opcode(nullifier: Field) {}\n\n#[oracle(avmOpcodeEmitUnencryptedLog)]\nunconstrained fn emit_unencrypted_log_opcode(message: [Field]) {}\n\n#[oracle(avmOpcodeL1ToL2MsgExists)]\nunconstrained fn l1_to_l2_msg_exists_opcode(msg_hash: Field, msg_leaf_index: Field) -> u8 {}\n\n#[oracle(avmOpcodeSendL2ToL1Msg)]\nunconstrained fn send_l2_to_l1_msg_opcode(recipient: EthAddress, content: Field) {}\n\n#[oracle(avmOpcodeCalldataCopy)]\nunconstrained fn calldata_copy_opcode<let N: u32>(cdoffset: u32, copy_size: u32) -> [Field; N] {}\n\n#[oracle(avmOpcodeCall)]\nunconstrained fn call_opcode<let RET_SIZE: u32>(\n gas: [Field; 2], // gas allocation: [l2_gas, da_gas]\n address: AztecAddress,\n args: [Field],\n // TODO(5110): consider passing in calldata directly\n function_selector: Field\n) -> ([Field; RET_SIZE], u8) {}\n// ^ return data ^ success\n\n#[oracle(avmOpcodeStaticCall)]\nunconstrained fn call_static_opcode<let RET_SIZE: u32>(\n gas: [Field; 2], // gas allocation: [l2_gas, da_gas]\n address: AztecAddress,\n args: [Field],\n // TODO(5110): consider passing in calldata directly\n function_selector: Field\n) -> ([Field; RET_SIZE], u8) {}\n// ^ return data ^ success\n\n#[oracle(avmOpcodeStorageRead)]\nunconstrained fn storage_read_opcode(storage_slot: Field) -> Field {}\n\n#[oracle(avmOpcodeStorageWrite)]\nunconstrained fn storage_write_opcode(storage_slot: Field, value: Field) {}\n\nstruct FunctionReturns<let N: u32> {\n values: [Field; N]\n}\n\nimpl<let N: u32> FunctionReturns<N> {\n pub fn new(values: [Field; N]) -> FunctionReturns<N> {\n FunctionReturns { values }\n }\n\n pub fn raw(self) -> [Field; N] {\n self.values\n }\n\n pub fn deserialize_into<T>(self) -> T where T: Deserialize<N> {\n Deserialize::deserialize(self.raw())\n }\n}\n\nimpl FunctionReturns<0> {\n pub fn assert_empty(self) {\n assert(self.values.len() == 0);\n }\n}\n"},"141":{"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, MAX_ARGS_LENGTH\n},\n point::Point, traits::Hash, hash::{sha256_to_field, poseidon2_hash_with_separator}\n};\nuse crate::oracle::logs_traits::ToBytesForUnencryptedLog;\n\npub use dep::protocol_types::hash::{compute_siloed_nullifier, pedersen_hash};\n\npub fn pedersen_commitment<let N: u32>(inputs: [Field; N], hash_index: u32) -> Point {\n std::hash::pedersen_commitment_with_separator(inputs, hash_index)\n}\n\npub fn compute_secret_hash(secret: Field) -> Field {\n poseidon2_hash_with_separator([secret], GENERATOR_INDEX__SECRET_HASH)\n}\n\npub fn compute_unencrypted_log_hash<T, let N: u32, let M: u32>(\n contract_address: AztecAddress,\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 len_bytes: [u8; 4] = (n as Field).to_be_bytes();\n for i in 0..4 {\n hash_bytes[32 + i] = len_bytes[i];\n }\n for i in 0..n {\n hash_bytes[36 + 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: [u8; 32] = sender.to_field().to_be_bytes();\n let chain_id_bytes: [u8; 32] = chain_id.to_be_bytes();\n let recipient_bytes: [u8; 32] = recipient.to_field().to_be_bytes();\n let version_bytes: [u8; 32] = version.to_be_bytes();\n let content_bytes: [u8; 32] = content.to_be_bytes();\n let secret_hash_bytes: [u8; 32] = secret_hash.to_be_bytes();\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 poseidon2_hash_with_separator(\n [message_hash, secret, leaf_index],\n GENERATOR_INDEX__MESSAGE_NULLIFIER\n )\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<let N: u32>(&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<let N: u32>(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() <= MAX_ARGS_LENGTH, \"Args length exceeds maximum\");\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] = poseidon2_hash_with_separator(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] = poseidon2_hash_with_separator(current_chunk_values, GENERATOR_INDEX__FUNCTION_ARGS);\n }\n poseidon2_hash_with_separator(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..MAX_ARGS_LENGTH {\n input.add(i as Field);\n }\n let hash = input.hash();\n assert(hash == 0x1cce4dbf69f14c44865919991ee1057922e34d7310ba237d71759aa422621ca9);\n}\n\n#[test]\nfn compute_unenc_log_hash_array() {\n let contract_address = AztecAddress::from_field(0x233a3e0df23b2b15b324194cb4a151f26c0b7333250781d34cc269d85dc334c6);\n let log = [\n 0x20660de09f35f876e3e69d227b2a35166ad05f09d82d06366ec9b6f65a51fec2,\n 0x1b52bfe3b8689761916f76dc3d38aa8810860db325cd39ca611eed980091f01c,\n 0x2e559c4045c378a56ad13b9edb1e8de4e7ad3b3aa35cc7ba9ec77f7a68fa43a4,\n 0x25d0f689c4a4178a29d59306f2675824d19be6d25e44fa03b03f49c263053dd2,\n 0x2d513a722d6f352dc0961f156afdc5e31495b9f0e35cb069261a8e55e2df67fd\n ];\n let hash = compute_unencrypted_log_hash(contract_address, log);\n assert(hash == 0x0095b2d17ab72f4b27a341f7ac63e49ec73935ae8c9181a0ac02023eb12f3284);\n}\n\n#[test]\nfn compute_unenc_log_hash_addr() {\n let contract_address = AztecAddress::from_field(0x233a3e0df23b2b15b324194cb4a151f26c0b7333250781d34cc269d85dc334c6);\n let log = AztecAddress::from_field(0x26aa302d4715fd8a687453cb26d616b0768027bd54bcae56b09d908ecd9f8303);\n let hash = compute_unencrypted_log_hash(contract_address, log);\n assert(hash == 0x0083ab647dfb26e7ddee90a0f4209d049d4660cab42000c544b986aaa84c55a3);\n}\n\n#[test]\nfn compute_unenc_log_hash_str() {\n let contract_address = AztecAddress::from_field(0x1b401e1146c5c507962287065c81f0ef7590adae3802c533d7549d6bf0a41bd8);\n let log = \"dummy\";\n let hash = compute_unencrypted_log_hash(contract_address, log);\n assert(hash == 0x00629e88ebd6374f44aa6cfe07e251ecf07213ebc7267e8f6b578ae57ffd6c20);\n}\n\n#[test]\nfn compute_unenc_log_hash_longer_str() {\n let contract_address = AztecAddress::from_field(0x1b401e1146c5c507962287065c81f0ef7590adae3802c533d7549d6bf0a41bd8);\n let log = \"Hello this is a string\";\n let hash = compute_unencrypted_log_hash(contract_address, log);\n assert(hash == 0x0098637962f7d34fa202b7ffad8a07a238c5d1fd897b82a108f7f467fa73b841);\n}\n"},"145":{"path":"/usr/src/noir-projects/aztec-nr/aztec/src/oracle/arguments.nr","source":"#[oracle(packArgumentsArray)]\nunconstrained fn pack_arguments_array_oracle<let N: u32>(_args: [Field; N]) -> Field {}\n\n#[oracle(packArguments)]\nunconstrained fn pack_arguments_oracle(_args: [Field]) -> Field {}\n\n/// - Pack arguments (array version) will notify the simulator that these arguments will be used later at\n/// some point in the call.\n/// - When the external call is made later, the simulator will know what the values unpack to.\n/// - This oracle will not be required in public vm functions, as the vm will keep track of arguments\n/// itself.\nunconstrained pub fn pack_arguments_array<let N: u32>(args: [Field; N]) -> Field {\n pack_arguments_array_oracle(args)\n}\n\n/// - Pack arguments (slice version) will notify the simulator that these arguments will be used later at\n/// some point in the call.\n/// - When the external call is made later, the simulator will know what the values unpack to.\n/// - This oracle will not be required in public vm functions, as the vm will keep track of arguments\n/// itself.\nunconstrained pub fn pack_arguments(args: [Field]) -> Field {\n pack_arguments_oracle(args)\n}\n\n"},"146":{"path":"/usr/src/noir-projects/aztec-nr/aztec/src/oracle/returns.nr","source":"#[oracle(packReturns)]\nunconstrained fn pack_returns_oracle(_returns: [Field]) -> Field {}\n\nunconstrained pub fn pack_returns(returns: [Field]) {\n let _unused = pack_returns_oracle(returns);\n}\n\n#[oracle(unpackReturns)]\nunconstrained fn unpack_returns_oracle<let N: u32>(_return_hash: Field) -> [Field; N] {}\n\nunconstrained pub fn unpack_returns<let N: u32>(return_hash: Field) -> [Field; N] {\n unpack_returns_oracle(return_hash)\n}\n"},"151":{"path":"/usr/src/noir-projects/aztec-nr/aztec/src/oracle/storage.nr","source":"use dep::protocol_types::{address::AztecAddress, traits::Deserialize};\n\n#[oracle(storageRead)]\nunconstrained fn storage_read_oracle<let N: u32>(address: Field, storage_slot: Field, block_number: Field, length: Field) -> [Field; N] {}\n\nunconstrained pub fn raw_storage_read<let N: u32>(\n address: AztecAddress,\n storage_slot: Field,\n block_number: u32\n) -> [Field; N] {\n storage_read_oracle(\n address.to_field(),\n storage_slot,\n block_number as Field,\n N as Field\n )\n}\n\nunconstrained pub fn storage_read<T, let N: u32>(\n address: AztecAddress,\n storage_slot: Field,\n block_number: u32\n) -> T where T: Deserialize<N> {\n T::deserialize(raw_storage_read(address, storage_slot, block_number))\n}\n\nmod tests {\n use crate::oracle::storage::{raw_storage_read, storage_read};\n use dep::protocol_types::address::AztecAddress;\n\n use std::test::OracleMock;\n use crate::test::mocks::mock_struct::MockStruct;\n\n global address = AztecAddress::from_field(29);\n global slot = 7;\n global block_number = 17;\n\n #[test]\n fn test_raw_storage_read() {\n let written = MockStruct { a: 13, b: 42 };\n\n let _ = OracleMock::mock(\"storageRead\").returns(written.serialize());\n\n let read: [Field; 2] = raw_storage_read(address, slot, block_number);\n assert_eq(read[0], 13);\n assert_eq(read[1], 42);\n }\n\n #[test]\n fn test_storage_read() {\n let written = MockStruct { a: 13, b: 42 };\n\n let _ = OracleMock::mock(\"storageRead\").returns(written.serialize());\n\n let read: MockStruct = storage_read(address, slot, block_number);\n assert_eq(read.a, 13);\n assert_eq(read.b, 42);\n }\n}\n"},"154":{"path":"/usr/src/noir-projects/aztec-nr/aztec/src/oracle/call_private_function.nr","source":"use dep::protocol_types::{abis::function_selector::FunctionSelector, address::AztecAddress, utils::reader::Reader};\n\n#[oracle(callPrivateFunction)]\nunconstrained fn call_private_function_oracle(\n _contract_address: AztecAddress,\n _function_selector: FunctionSelector,\n _args_hash: Field,\n _start_side_effect_counter: u32,\n _is_static_call: bool,\n _is_delegate_call: bool\n) -> [Field; 2] {}\n\nunconstrained pub fn call_private_function_internal(\n contract_address: AztecAddress,\n function_selector: FunctionSelector,\n args_hash: Field,\n start_side_effect_counter: u32,\n is_static_call: bool,\n is_delegate_call: bool\n) -> (u32, Field) {\n let fields = call_private_function_oracle(\n contract_address,\n function_selector,\n args_hash,\n start_side_effect_counter,\n is_static_call,\n is_delegate_call\n );\n\n let mut reader = Reader::new(fields);\n let end_side_effect_counter = reader.read_u32();\n let returns_hash = reader.read();\n\n (end_side_effect_counter, returns_hash)\n}\n"},"159":{"path":"/usr/src/noir-projects/aztec-nr/aztec/src/oracle/enqueue_public_function_call.nr","source":"use dep::protocol_types::{abis::{function_selector::FunctionSelector}, address::AztecAddress};\n\n#[oracle(enqueuePublicFunctionCall)]\nunconstrained fn enqueue_public_function_call_oracle(\n _contract_address: AztecAddress,\n _function_selector: FunctionSelector,\n _args_hash: Field,\n _side_effect_counter: u32,\n _is_static_call: bool,\n _is_delegate_call: bool\n) {}\n\nunconstrained pub fn enqueue_public_function_call_internal(\n contract_address: AztecAddress,\n function_selector: FunctionSelector,\n args_hash: Field,\n side_effect_counter: u32,\n is_static_call: bool,\n is_delegate_call: bool\n) {\n enqueue_public_function_call_oracle(\n contract_address,\n function_selector,\n args_hash,\n side_effect_counter,\n is_static_call,\n is_delegate_call\n );\n}\n\n#[oracle(setPublicTeardownFunctionCall)]\nunconstrained fn set_public_teardown_function_call_oracle(\n _contract_address: AztecAddress,\n _function_selector: FunctionSelector,\n _args_hash: Field,\n _side_effect_counter: u32,\n _is_static_call: bool,\n _is_delegate_call: bool\n) {}\n\nunconstrained pub fn set_public_teardown_function_call_internal(\n contract_address: AztecAddress,\n function_selector: FunctionSelector,\n args_hash: Field,\n side_effect_counter: u32,\n is_static_call: bool,\n is_delegate_call: bool\n) {\n set_public_teardown_function_call_oracle(\n contract_address,\n function_selector,\n args_hash,\n side_effect_counter,\n is_static_call,\n is_delegate_call\n );\n}\n\n#[oracle(notifySetMinRevertibleSideEffectCounter)]\nunconstrained fn notify_set_min_revertible_side_effect_counter_oracle(_counter: u32) {}\n\nunconstrained pub fn notify_set_min_revertible_side_effect_counter(counter: u32) {\n notify_set_min_revertible_side_effect_counter_oracle(counter);\n}\n"},"161":{"path":"/usr/src/noir-projects/aztec-nr/aztec/src/oracle/execution.nr","source":"use dep::protocol_types::address::AztecAddress;\n\n#[oracle(getContractAddress)]\nunconstrained fn get_contract_address_oracle() -> AztecAddress {}\n\n#[oracle(getBlockNumber)]\nunconstrained fn get_block_number_oracle() -> u32 {}\n\n#[oracle(getChainId)]\nunconstrained fn get_chain_id_oracle() -> Field {}\n\n#[oracle(getVersion)]\nunconstrained fn get_version_oracle() -> Field {}\n\nunconstrained pub fn get_contract_address() -> AztecAddress {\n get_contract_address_oracle()\n}\n\nunconstrained pub fn get_block_number() -> u32 {\n get_block_number_oracle()\n}\n\nunconstrained pub fn get_chain_id() -> Field {\n get_chain_id_oracle()\n}\n\nunconstrained pub fn get_version() -> Field {\n get_version_oracle()\n}\n"},"164":{"path":"/usr/src/noir-projects/aztec-nr/aztec/src/state_vars/map.nr","source":"use dep::protocol_types::{storage::map::derive_storage_slot_in_map, traits::ToField};\nuse crate::state_vars::storage::Storage;\n\n// docs:start:map\nstruct Map<K, V, Context> {\n context: Context,\n storage_slot: Field,\n state_var_constructor: fn(Context, Field) -> V,\n}\n// docs:end:map\n\nimpl<K, T, Context> Storage<T> for Map<K, T, Context> {}\n\nimpl<K, V, Context> Map<K, V, Context> {\n // docs:start:new\n pub fn new(\n context: Context,\n storage_slot: Field,\n state_var_constructor: fn(Context, Field) -> V\n ) -> Self {\n assert(storage_slot != 0, \"Storage slot 0 not allowed. Storage slots must start from 1.\");\n Map { context, storage_slot, state_var_constructor }\n }\n // docs:end:new\n\n // docs:start:at\n pub fn at(self, key: K) -> V where K: ToField {\n // TODO(#1204): use a generator index for the storage slot\n let derived_storage_slot = derive_storage_slot_in_map(self.storage_slot, key);\n\n let state_var_constructor = self.state_var_constructor;\n state_var_constructor(self.context, derived_storage_slot)\n }\n // docs:end:at\n}\n\n"},"166":{"path":"/usr/src/noir-projects/aztec-nr/aztec/src/state_vars/public_mutable.nr","source":"use crate::context::{PublicContext, UnconstrainedContext};\nuse crate::oracle::storage::storage_read;\nuse dep::protocol_types::traits::{Deserialize, Serialize};\nuse crate::state_vars::storage::Storage;\n\n// docs:start:public_mutable_struct\nstruct PublicMutable<T, Context> {\n context: Context,\n storage_slot: Field,\n}\n// docs:end:public_mutable_struct\n\nimpl<T, Context> Storage<T> for PublicMutable<T, Context> {}\n\nimpl<T, Context> PublicMutable<T, Context> {\n // docs:start:public_mutable_struct_new\n pub fn new(\n // Note: Passing the contexts to new(...) just to have an interface compatible with a Map.\n context: Context,\n storage_slot: Field\n ) -> Self {\n assert(storage_slot != 0, \"Storage slot 0 not allowed. Storage slots must start from 1.\");\n PublicMutable { context, storage_slot }\n }\n // docs:end:public_mutable_struct_new\n}\n\nimpl<T, T_SERIALIZED_LEN> PublicMutable<T, &mut PublicContext> where T: Serialize<T_SERIALIZED_LEN> + Deserialize<T_SERIALIZED_LEN> {\n // docs:start:public_mutable_struct_read\n pub fn read(self) -> T {\n self.context.storage_read(self.storage_slot)\n }\n // docs:end:public_mutable_struct_read\n\n // docs:start:public_mutable_struct_write\n pub fn write(self, value: T) {\n self.context.storage_write(self.storage_slot, value);\n }\n // docs:end:public_mutable_struct_write\n}\n\nimpl<T, T_SERIALIZED_LEN> PublicMutable<T, UnconstrainedContext> where T: Deserialize<T_SERIALIZED_LEN> {\n unconstrained pub fn read(self) -> T {\n self.context.storage_read(self.storage_slot)\n }\n}\n"},"256":{"path":"/usr/src/noir-projects/noir-protocol-circuits/crates/types/src/storage/map.nr","source":"use crate::{hash::pedersen_hash, traits::ToField};\n\npub fn derive_storage_slot_in_map<K>(storage_slot: Field, key: K) -> Field where K: ToField {\n pedersen_hash([storage_slot, key.to_field()], 0)\n}\n\nmod test {\n use crate::{address::AztecAddress, storage::map::derive_storage_slot_in_map};\n\n #[test]\n fn test_derive_storage_slot_in_map_matches_typescript() {\n let map_slot = 0x132258fb6962c4387ba659d9556521102d227549a386d39f0b22d1890d59c2b5;\n let key = AztecAddress::from_field(0x302dbc2f9b50a73283d5fb2f35bc01eae8935615817a0b4219a057b2ba8a5a3f);\n\n let slot = derive_storage_slot_in_map(map_slot, key);\n\n // The following value was generated by `map_slot.test.ts`\n let slot_from_typescript = 0x2499880e2b1b831785c17286f99a0d5122fee784ce7b1c04e380c4a991da819a;\n\n assert_eq(slot, slot_from_typescript);\n }\n}\n"},"261":{"path":"/usr/src/noir-projects/noir-protocol-circuits/crates/types/src/type_serialization.nr","source":"use crate::traits::{Serialize, Deserialize};\n\nglobal BOOL_SERIALIZED_LEN: Field = 1;\nglobal U8_SERIALIZED_LEN: Field = 1;\nglobal U32_SERIALIZED_LEN: Field = 1;\nglobal U64_SERIALIZED_LEN: Field = 1;\nglobal U128_SERIALIZED_LEN: Field = 1;\nglobal FIELD_SERIALIZED_LEN: Field = 1;\n\nimpl Serialize<BOOL_SERIALIZED_LEN> for bool {\n fn serialize(self) -> [Field; BOOL_SERIALIZED_LEN] {\n [self as Field]\n }\n}\n\nimpl Deserialize<BOOL_SERIALIZED_LEN> for bool {\n fn deserialize(fields: [Field; BOOL_SERIALIZED_LEN]) -> bool {\n fields[0] as bool\n }\n}\n\nimpl Serialize<U8_SERIALIZED_LEN> for u8 {\n fn serialize(self) -> [Field; U32_SERIALIZED_LEN] {\n [self as Field]\n }\n}\n\nimpl Deserialize<U8_SERIALIZED_LEN> for u8 {\n fn deserialize(fields: [Field; U8_SERIALIZED_LEN]) -> Self {\n fields[0] as u8\n }\n}\n\nimpl Serialize<U32_SERIALIZED_LEN> for u32 {\n fn serialize(self) -> [Field; U32_SERIALIZED_LEN] {\n [self as Field]\n }\n}\n\nimpl Deserialize<U32_SERIALIZED_LEN> for u32 {\n fn deserialize(fields: [Field; U32_SERIALIZED_LEN]) -> Self {\n fields[0] as u32\n }\n}\n\nimpl Serialize<U64_SERIALIZED_LEN> for u64 {\n fn serialize(self) -> [Field; U64_SERIALIZED_LEN] {\n [self as Field]\n }\n}\n\nimpl Deserialize<U64_SERIALIZED_LEN> for u64 {\n fn deserialize(fields: [Field; U64_SERIALIZED_LEN]) -> Self {\n fields[0] as u64\n }\n}\n\nimpl Serialize<U128_SERIALIZED_LEN> for U128 {\n fn serialize(self) -> [Field; 1] {\n [self.to_integer()]\n }\n\n}\n\nimpl Deserialize<U128_SERIALIZED_LEN> for U128 {\n fn deserialize(fields: [Field; U128_SERIALIZED_LEN]) -> Self {\n U128::from_integer(fields[0])\n }\n}\n\nimpl Serialize<FIELD_SERIALIZED_LEN> for Field {\n fn serialize(self) -> [Field; U32_SERIALIZED_LEN] {\n [self]\n }\n}\n\nimpl Deserialize<FIELD_SERIALIZED_LEN> for Field {\n fn deserialize(fields: [Field; FIELD_SERIALIZED_LEN]) -> Self {\n fields[0]\n }\n}\n"},"262":{"path":"/usr/src/noir-projects/noir-protocol-circuits/crates/types/src/traits.nr","source":"use 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, let N: u32>(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<let N: u32> 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<let N: u32> {\n fn serialize(self) -> [Field; N];\n}\n// docs:end:serialize\n\nimpl<let N: u32> Serialize<N> for [Field; N] {\n fn serialize(self) -> [Field; N] {\n self\n }\n}\nimpl<let N: u32> 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<let N: u32> {\n fn deserialize(fields: [Field; N]) -> Self;\n}\n// docs:end:deserialize\n\nimpl<let N: u32> Deserialize<N> for [Field; N] {\n fn deserialize(fields: [Field; N]) -> Self {\n fields\n }\n}\n"},"267":{"path":"/usr/src/noir-projects/noir-protocol-circuits/crates/types/src/hash.nr","source":"use crate::{\n abis::{\n contract_class_function_leaf_preimage::ContractClassFunctionLeafPreimage,\n function_selector::FunctionSelector, log_hash::{LogHash, ScopedLogHash, ScopedEncryptedLogHash},\n note_hash::ScopedNoteHash, nullifier::ScopedNullifier\n},\n address::{AztecAddress, EthAddress},\n 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, MAX_NOTE_ENCRYPTED_LOGS_PER_TX\n},\n merkle_tree::root::root_from_sibling_path,\n messaging::l2_to_l1_message::{L2ToL1Message, ScopedL2ToL1Message},\n recursion::verification_key::VerificationKey, traits::{is_empty, ToField},\n utils::field::field_from_bytes_32_trunc\n};\n\npub fn sha256_to_field<let N: u32>(bytes_to_hash: [u8; N]) -> Field {\n let sha256_hashed = std::hash::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\nfn compute_note_hash_nonce(tx_hash: Field, note_index_in_tx: u32) -> Field {\n // Hashing tx hash with note index in tx is guaranteed to be unique\n poseidon2_hash_with_separator(\n [\n tx_hash,\n note_index_in_tx as Field\n ],\n GENERATOR_INDEX__NOTE_HASH_NONCE\n )\n}\n\npub fn compute_unique_note_hash(nonce: Field, note_hash: Field) -> Field {\n let inputs = [nonce, note_hash];\n poseidon2_hash_with_separator(inputs, GENERATOR_INDEX__UNIQUE_NOTE_HASH)\n}\n\npub fn compute_siloed_note_hash(app: AztecAddress, unique_note_hash: Field) -> Field {\n poseidon2_hash_with_separator(\n [\n app.to_field(),\n unique_note_hash\n ],\n GENERATOR_INDEX__SILOED_NOTE_HASH\n )\n}\n\n/// Siloing in the context of Aztec refers to the process of hashing a note hash with a contract address (this way\n/// the note hash is scoped to a specific contract). This is used to prevent intermingling of notes between contracts.\npub fn silo_note_hash(note_hash: ScopedNoteHash, tx_hash: Field, note_index_in_tx: u32) -> Field {\n if note_hash.contract_address.is_zero() {\n 0\n } else {\n let nonce = compute_note_hash_nonce(tx_hash, note_index_in_tx);\n let unique_note_hash = compute_unique_note_hash(nonce, note_hash.value());\n compute_siloed_note_hash(note_hash.contract_address, unique_note_hash)\n }\n}\n\npub fn compute_siloed_nullifier(app: AztecAddress, nullifier: Field) -> Field {\n poseidon2_hash_with_separator(\n [\n app.to_field(),\n nullifier\n ],\n GENERATOR_INDEX__OUTER_NULLIFIER\n )\n}\n\npub fn silo_nullifier(nullifier: ScopedNullifier) -> Field {\n if nullifier.contract_address.is_zero() {\n nullifier.value() // Return value instead of 0 because the first nullifier's contract address is zero.\n } else {\n compute_siloed_nullifier(nullifier.contract_address, nullifier.value())\n }\n}\n\npub fn silo_encrypted_log_hash(log_hash: ScopedLogHash) -> Field {\n // We assume contract address has already been masked\n if log_hash.contract_address.is_zero() {\n 0\n } else {\n accumulate_sha256([log_hash.contract_address.to_field(), log_hash.log_hash.value])\n }\n}\n\npub fn mask_encrypted_log_hash(scoped_log: ScopedEncryptedLogHash) -> AztecAddress {\n if scoped_log.contract_address.is_zero() {\n AztecAddress::from_field(0)\n } else if (scoped_log.log_hash.randomness == 0) {\n scoped_log.contract_address\n } else {\n AztecAddress::from_field(\n poseidon2_hash_with_separator(\n [scoped_log.contract_address.to_field(), scoped_log.log_hash.randomness],\n 0\n )\n )\n }\n}\n\nfn compute_siloed_unencrypted_log_hash(address: AztecAddress, log_hash: Field) -> Field {\n accumulate_sha256([address.to_field(), log_hash])\n}\n\npub fn silo_unencrypted_log_hash(log_hash: ScopedLogHash) -> Field {\n if log_hash.contract_address.is_zero() {\n 0\n } else {\n compute_siloed_unencrypted_log_hash(log_hash.contract_address, log_hash.value())\n }\n}\n\npub fn merkle_hash(left: Field, right: Field) -> Field {\n poseidon2_hash([left, right])\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 recipient: EthAddress,\n content: Field,\n rollup_version_id: Field,\n chain_id: Field\n) -> Field {\n let mut bytes: BoundedVec<u8, 160> = BoundedVec::new();\n\n let inputs = [contract_address.to_field(), rollup_version_id, recipient.to_field(), chain_id, content];\n for i in 0..inputs.len() {\n // TODO are bytes be in fr.to_buffer() ?\n let item_bytes: [u8; 32] = inputs[i].to_be_bytes();\n for j in 0..32 {\n bytes.push(item_bytes[j]);\n }\n }\n\n sha256_to_field(bytes.storage)\n}\n\npub fn silo_l2_to_l1_message(msg: ScopedL2ToL1Message, rollup_version_id: Field, chain_id: Field) -> Field {\n if msg.contract_address.is_zero() {\n 0\n } else {\n compute_l2_to_l1_hash(\n msg.contract_address,\n msg.message.recipient,\n msg.message.content,\n rollup_version_id,\n chain_id\n )\n }\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: [u8; 32] = input[offset].to_be_bytes();\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: [LogHash; 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: [u8; 32] = logs[offset].value.to_be_bytes();\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_tx_note_logs_hash(logs: [LogHash; MAX_NOTE_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_NOTE_ENCRYPTED_LOGS_PER_TX * 32];\n for offset in 0..MAX_NOTE_ENCRYPTED_LOGS_PER_TX {\n let input_as_bytes: [u8; 32] = logs[offset].value.to_be_bytes();\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 pedersen_hash<let N: u32>(inputs: [Field; N], hash_index: u32) -> Field {\n std::hash::pedersen_hash_with_separator(inputs, hash_index)\n}\n\npub fn poseidon2_hash<let N: u32>(inputs: [Field; N]) -> Field {\n std::hash::poseidon2::Poseidon2::hash(inputs, N)\n}\n\n#[no_predicates]\npub fn poseidon2_hash_with_separator<let N: u32, T>(\n inputs: [Field; N],\n separator: T\n) -> Field where T: ToField {\n // We manually hash the inputs here, since we cannot express with the type system a constant size inputs array of N + 1\n let in_len = N + 1;\n let two_pow_64 = 18446744073709551616;\n let iv : Field = (in_len as Field) * two_pow_64;\n let mut sponge = std::hash::poseidon2::Poseidon2::new(iv);\n sponge.absorb(separator.to_field());\n\n for i in 0..inputs.len() {\n sponge.absorb(inputs[i]);\n }\n\n sponge.squeeze()\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 = std::hash::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), EthAddress::zero(), 0, 0, 0);\n assert(hash_result == 0xb393978842a0fa3d3e1470196f098f473f9678e72463cb65ec4ab5581856c2);\n\n // Non-zero case\n let hash_result = compute_l2_to_l1_hash(AztecAddress::from_field(1), EthAddress::from_field(3), 5, 2, 4);\n assert(hash_result == 0x3f88c1044a05e5340ed20466276500f6d45ca5603913b9091e957161734e16);\n}\n\n#[test]\nfn silo_l2_to_l1_message_matches_typescript() {\n let version = 4;\n let chainId = 5;\n\n let hash = silo_l2_to_l1_message(\n ScopedL2ToL1Message {\n message: L2ToL1Message { recipient: EthAddress::from_field(1), content: 2, counter: 0 },\n contract_address: AztecAddress::from_field(3)\n },\n version,\n chainId\n );\n\n // The following value was generated by `l2_to_l1_message.test.ts`\n let hash_from_typescript = 0x00c6155d69febb9d5039b374dd4f77bf57b7c881709aa524a18acaa0bd57476a;\n\n assert_eq(hash, hash_from_typescript);\n}\n"},"27":{"path":"std/hash/mod.nr","source":"mod poseidon;\nmod mimc;\nmod poseidon2;\nmod keccak;\nmod sha256;\nmod sha512;\n\nuse crate::default::Default;\nuse crate::uint128::U128;\nuse crate::collections::vec::Vec;\nuse crate::embedded_curve_ops::{EmbeddedCurvePoint, EmbeddedCurveScalar, multi_scalar_mul, multi_scalar_mul_slice};\nuse crate::meta::derive_via;\n\n// Kept for backwards compatibility\npub use sha256::{digest, sha256, sha256_compression, sha256_var};\n\n#[foreign(blake2s)]\n// docs:start:blake2s\npub fn blake2s<let N: u32>(input: [u8; N]) -> [u8; 32]\n// docs:end:blake2s\n{}\n\n#[foreign(blake3)]\n// docs:start:blake3\npub fn blake3<let N: u32>(input: [u8; N]) -> [u8; 32]\n// docs:end:blake3\n{}\n\n// docs:start:pedersen_commitment\npub fn pedersen_commitment<let N: u32>(input: [Field; N]) -> EmbeddedCurvePoint {\n // docs:end:pedersen_commitment\n pedersen_commitment_with_separator(input, 0)\n}\n\npub fn pedersen_hash_with_separator<let N: u32>(input: [Field; N], separator: u32) -> Field {\n __pedersen_hash_with_separator(input, separator)\n}\n\nfn pedersen_commitment_with_separator<let N: u32>(input: [Field; N], separator: u32) -> EmbeddedCurvePoint {\n let value = __pedersen_commitment_with_separator(input, separator);\n if (value[0] == 0) & (value[1] == 0) {\n EmbeddedCurvePoint { x: 0, y: 0, is_infinite: true }\n } else {\n EmbeddedCurvePoint { x: value[0], y: value[1], is_infinite: false }\n }\n}\n\n#[no_predicates]\nfn pedersen_commitment_with_separator_noir<let N: u32>(input: [Field; N], separator: u32) -> EmbeddedCurvePoint {\n let mut points = [EmbeddedCurveScalar { lo: 0, hi: 0 }; N];\n for i in 0..N {\n // we use the unsafe version because the multi_scalar_mul will constrain the scalars.\n points[i] = from_field_unsafe(input[i]);\n }\n let generators = derive_generators(\"DEFAULT_DOMAIN_SEPARATOR\".as_bytes(), separator);\n multi_scalar_mul(generators, points)\n}\n\n#[no_predicates]\nfn pedersen_hash_with_separator_noir<let N: u32>(input: [Field; N], separator: u32) -> Field {\n let mut scalars: Vec<EmbeddedCurveScalar> = Vec::from_slice([EmbeddedCurveScalar { lo: 0, hi: 0 }; N].as_slice()); //Vec::new();\n\n for i in 0..N {\n scalars.set(i, from_field_unsafe(input[i]));\n }\n scalars.push(EmbeddedCurveScalar { lo: N as Field, hi: 0 as Field });\n let domain_generators :[EmbeddedCurvePoint; N]= derive_generators(\"DEFAULT_DOMAIN_SEPARATOR\".as_bytes(), separator);\n let mut vec_generators = Vec::new();\n for i in 0..N {\n vec_generators.push(domain_generators[i]);\n }\n let length_generator : [EmbeddedCurvePoint; 1] = derive_generators(\"pedersen_hash_length\".as_bytes(), 0);\n vec_generators.push(length_generator[0]);\n multi_scalar_mul_slice(vec_generators.slice, scalars.slice)[0]\n}\n\n// docs:start:pedersen_hash\npub fn pedersen_hash<let N: u32>(input: [Field; N]) -> Field\n// docs:end:pedersen_hash\n{\n __pedersen_hash_with_separator(input, 0)\n}\n\n#[foreign(pedersen_hash)]\nfn __pedersen_hash_with_separator<let N: u32>(input: [Field; N], separator: u32) -> Field {}\n\n#[foreign(pedersen_commitment)]\nfn __pedersen_commitment_with_separator<let N: u32>(input: [Field; N], separator: u32) -> [Field; 2] {}\n\n#[field(bn254)]\nfn derive_generators<let N: u32, let M: u32>(domain_separator_bytes: [u8; M], starting_index: u32) -> [EmbeddedCurvePoint; N] {\n crate::assert_constant(domain_separator_bytes);\n // TODO(https://github.com/noir-lang/noir/issues/5672): Add back assert_constant on starting_index\n __derive_generators(domain_separator_bytes, starting_index)\n}\n\n#[builtin(derive_pedersen_generators)]\n#[field(bn254)]\nfn __derive_generators<let N: u32, let M: u32>(\n domain_separator_bytes: [u8; M],\n starting_index: u32\n) -> [EmbeddedCurvePoint; N] {}\n\n#[field(bn254)]\n // Same as from_field but:\n // does not assert the limbs are 128 bits\n // does not assert the decomposition does not overflow the EmbeddedCurveScalar\n fn from_field_unsafe(scalar: Field) -> EmbeddedCurveScalar {\n let (xlo, xhi) = unsafe {\n crate::field::bn254::decompose_hint(scalar)\n };\n // Check that the decomposition is correct\n assert_eq(scalar, xlo + crate::field::bn254::TWO_POW_128 * xhi);\n EmbeddedCurveScalar { lo: xlo, hi: xhi }\n}\n\npub fn hash_to_field(inputs: [Field]) -> Field {\n let mut sum = 0;\n\n for input in inputs {\n let input_bytes: [u8; 32] = input.to_le_bytes();\n sum += crate::field::bytes32_to_field(blake2s(input_bytes));\n }\n\n sum\n}\n\n// docs:start:keccak256\npub fn keccak256<let N: u32>(input: [u8; N], message_size: u32) -> [u8; 32]\n// docs:end:keccak256\n{\n crate::hash::keccak::keccak256(input, message_size)\n}\n\n#[foreign(poseidon2_permutation)]\npub fn poseidon2_permutation<let N: u32>(_input: [Field; N], _state_length: u32) -> [Field; N] {}\n\n// Generic hashing support. \n// Partially ported and impacted by rust.\n\n// Hash trait shall be implemented per type.\n#[derive_via(derive_hash)]\ntrait Hash {\n fn hash<H>(self, state: &mut H) where H: Hasher;\n}\n\n// docs:start:derive_hash\ncomptime fn derive_hash(s: StructDefinition) -> Quoted {\n let name = quote { Hash };\n let signature = quote { fn hash<H>(_self: Self, _state: &mut H) where H: std::hash::Hasher };\n let for_each_field = |name| quote { _self.$name.hash(_state); };\n crate::meta::make_trait_impl(s, name, signature, for_each_field, quote {}, |fields| fields)\n}\n// docs:end:derive_hash\n\n// Hasher trait shall be implemented by algorithms to provide hash-agnostic means.\n// TODO: consider making the types generic here ([u8], [Field], etc.)\ntrait Hasher{\n fn finish(self) -> Field;\n \n fn write(&mut self, input: Field);\n}\n\n// BuildHasher is a factory trait, responsible for production of specific Hasher.\ntrait BuildHasher<H> where H: Hasher{\n fn build_hasher(self) -> H;\n}\n\nstruct BuildHasherDefault<H>;\n\nimpl<H> BuildHasher<H> for BuildHasherDefault<H>\nwhere \n H: Hasher + Default\n{\n fn build_hasher(_self: Self) -> H{\n H::default()\n }\n}\n\nimpl<H> Default for BuildHasherDefault<H>\nwhere \n H: Hasher + Default\n{\n fn default() -> Self{\n BuildHasherDefault{}\n } \n}\n\nimpl Hash for Field {\n fn hash<H>(self, state: &mut H) where H: Hasher{\n H::write(state, self);\n }\n}\n\nimpl Hash for u1 {\n fn hash<H>(self, state: &mut H) where H: Hasher{\n H::write(state, self as Field);\n }\n}\n\nimpl Hash for u8 {\n fn hash<H>(self, state: &mut H) where H: Hasher{\n H::write(state, self as Field);\n }\n}\n\nimpl Hash for u16 {\n fn hash<H>(self, state: &mut H) where H: Hasher{\n H::write(state, self as Field);\n }\n}\n\nimpl Hash for u32 {\n fn hash<H>(self, state: &mut H) where H: Hasher{\n H::write(state, self as Field);\n }\n}\n\nimpl Hash for u64 {\n fn hash<H>(self, state: &mut H) where H: Hasher{\n H::write(state, self as Field);\n }\n}\n\nimpl Hash for i8 {\n fn hash<H>(self, state: &mut H) where H: Hasher{\n H::write(state, self as Field);\n }\n}\n\nimpl Hash for i16 {\n fn hash<H>(self, state: &mut H) where H: Hasher{\n H::write(state, self as Field);\n }\n}\n\nimpl Hash for i32 {\n fn hash<H>(self, state: &mut H) where H: Hasher{\n H::write(state, self as Field);\n }\n}\n\nimpl Hash for i64 {\n fn hash<H>(self, state: &mut H) where H: Hasher{\n H::write(state, self as Field);\n }\n}\n\nimpl Hash for bool {\n fn hash<H>(self, state: &mut H) where H: Hasher{\n H::write(state, self as Field);\n }\n}\n\nimpl Hash for () {\n fn hash<H>(_self: Self, _state: &mut H) where H: Hasher {}\n}\n\nimpl Hash for U128 {\n fn hash<H>(self, state: &mut H) where H: Hasher{\n H::write(state, self.lo as Field);\n H::write(state, self.hi as Field);\n }\n}\n\nimpl<T, let N: u32> Hash for [T; N] where T: Hash {\n fn hash<H>(self, state: &mut H) where H: Hasher{\n for elem in self {\n elem.hash(state);\n }\n }\n}\n\nimpl<T> Hash for [T] where T: Hash {\n fn hash<H>(self, state: &mut H) where H: Hasher{\n self.len().hash(state);\n for elem in self {\n elem.hash(state);\n }\n }\n}\n\nimpl<A, B> Hash for (A, B) where A: Hash, B: Hash {\n fn hash<H>(self, state: &mut H) where H: Hasher{\n self.0.hash(state);\n self.1.hash(state);\n }\n}\n\nimpl<A, B, C> Hash for (A, B, C) where A: Hash, B: Hash, C: Hash {\n fn hash<H>(self, state: &mut H) where H: Hasher{\n self.0.hash(state);\n self.1.hash(state);\n self.2.hash(state);\n }\n}\n\nimpl<A, B, C, D> Hash for (A, B, C, D) where A: Hash, B: Hash, C: Hash, D: Hash {\n fn hash<H>(self, state: &mut H) where H: Hasher{\n self.0.hash(state);\n self.1.hash(state);\n self.2.hash(state);\n self.3.hash(state);\n }\n}\n\nimpl<A, B, C, D, E> Hash for (A, B, C, D, E) where A: Hash, B: Hash, C: Hash, D: Hash, E: Hash {\n fn hash<H>(self, state: &mut H) where H: Hasher{\n self.0.hash(state);\n self.1.hash(state);\n self.2.hash(state);\n self.3.hash(state);\n self.4.hash(state);\n }\n}\n\n// Some test vectors for Pedersen hash and Pedersen Commitment.\n// They have been generated using the same functions so the tests are for now useless\n// but they will be useful when we switch to Noir implementation.\n#[test]\nfn assert_pedersen() {\n assert_eq(\n pedersen_hash_with_separator([1], 1), 0x1b3f4b1a83092a13d8d1a59f7acb62aba15e7002f4440f2275edb99ebbc2305f\n );\n assert_eq(\n pedersen_commitment_with_separator([1], 1), EmbeddedCurvePoint {\n x: 0x054aa86a73cb8a34525e5bbed6e43ba1198e860f5f3950268f71df4591bde402,\n y: 0x209dcfbf2cfb57f9f6046f44d71ac6faf87254afc7407c04eb621a6287cac126,\n is_infinite: false\n }\n );\n\n assert_eq(\n pedersen_hash_with_separator([1, 2], 2), 0x26691c129448e9ace0c66d11f0a16d9014a9e8498ee78f4d69f0083168188255\n );\n assert_eq(\n pedersen_commitment_with_separator([1, 2], 2), EmbeddedCurvePoint {\n x: 0x2e2b3b191e49541fe468ec6877721d445dcaffe41728df0a0eafeb15e87b0753,\n y: 0x2ff4482400ad3a6228be17a2af33e2bcdf41be04795f9782bd96efe7e24f8778,\n is_infinite: false\n }\n );\n assert_eq(\n pedersen_hash_with_separator([1, 2, 3], 3), 0x0bc694b7a1f8d10d2d8987d07433f26bd616a2d351bc79a3c540d85b6206dbe4\n );\n assert_eq(\n pedersen_commitment_with_separator([1, 2, 3], 3), EmbeddedCurvePoint {\n x: 0x1fee4e8cf8d2f527caa2684236b07c4b1bad7342c01b0f75e9a877a71827dc85,\n y: 0x2f9fedb9a090697ab69bf04c8bc15f7385b3e4b68c849c1536e5ae15ff138fd1,\n is_infinite: false\n }\n );\n assert_eq(\n pedersen_hash_with_separator([1, 2, 3, 4], 4), 0xdae10fb32a8408521803905981a2b300d6a35e40e798743e9322b223a5eddc\n );\n assert_eq(\n pedersen_commitment_with_separator([1, 2, 3, 4], 4), EmbeddedCurvePoint {\n x: 0x07ae3e202811e1fca39c2d81eabe6f79183978e6f12be0d3b8eda095b79bdbc9,\n y: 0x0afc6f892593db6fbba60f2da558517e279e0ae04f95758587760ba193145014,\n is_infinite: false\n }\n );\n assert_eq(\n pedersen_hash_with_separator([1, 2, 3, 4, 5], 5), 0xfc375b062c4f4f0150f7100dfb8d9b72a6d28582dd9512390b0497cdad9c22\n );\n assert_eq(\n pedersen_commitment_with_separator([1, 2, 3, 4, 5], 5), EmbeddedCurvePoint {\n x: 0x1754b12bd475a6984a1094b5109eeca9838f4f81ac89c5f0a41dbce53189bb29,\n y: 0x2da030e3cfcdc7ddad80eaf2599df6692cae0717d4e9f7bfbee8d073d5d278f7,\n is_infinite: false\n }\n );\n assert_eq(\n pedersen_hash_with_separator([1, 2, 3, 4, 5, 6], 6), 0x1696ed13dc2730062a98ac9d8f9de0661bb98829c7582f699d0273b18c86a572\n );\n assert_eq(\n pedersen_commitment_with_separator([1, 2, 3, 4, 5, 6], 6), EmbeddedCurvePoint {\n x: 0x190f6c0e97ad83e1e28da22a98aae156da083c5a4100e929b77e750d3106a697,\n y: 0x1f4b60f34ef91221a0b49756fa0705da93311a61af73d37a0c458877706616fb,\n is_infinite: false\n }\n );\n assert_eq(\n pedersen_hash_with_separator([1, 2, 3, 4, 5, 6, 7], 7), 0x128c0ff144fc66b6cb60eeac8a38e23da52992fc427b92397a7dffd71c45ede3\n );\n assert_eq(\n pedersen_commitment_with_separator([1, 2, 3, 4, 5, 6, 7], 7), EmbeddedCurvePoint {\n x: 0x015441e9d29491b06563fac16fc76abf7a9534c715421d0de85d20dbe2965939,\n y: 0x1d2575b0276f4e9087e6e07c2cb75aa1baafad127af4be5918ef8a2ef2fea8fc,\n is_infinite: false\n }\n );\n assert_eq(\n pedersen_hash_with_separator([1, 2, 3, 4, 5, 6, 7, 8], 8), 0x2f960e117482044dfc99d12fece2ef6862fba9242be4846c7c9a3e854325a55c\n );\n assert_eq(\n pedersen_commitment_with_separator([1, 2, 3, 4, 5, 6, 7, 8], 8), EmbeddedCurvePoint {\n x: 0x1657737676968887fceb6dd516382ea13b3a2c557f509811cd86d5d1199bc443,\n y: 0x1f39f0cb569040105fa1e2f156521e8b8e08261e635a2b210bdc94e8d6d65f77,\n is_infinite: false\n }\n );\n assert_eq(\n pedersen_hash_with_separator([1, 2, 3, 4, 5, 6, 7, 8, 9], 9), 0x0c96db0790602dcb166cc4699e2d306c479a76926b81c2cb2aaa92d249ec7be7\n );\n assert_eq(\n pedersen_commitment_with_separator([1, 2, 3, 4, 5, 6, 7, 8, 9], 9), EmbeddedCurvePoint {\n x: 0x0a3ceae42d14914a432aa60ec7fded4af7dad7dd4acdbf2908452675ec67e06d,\n y: 0xfc19761eaaf621ad4aec9a8b2e84a4eceffdba78f60f8b9391b0bd9345a2f2,\n is_infinite: false\n }\n );\n assert_eq(\n pedersen_hash_with_separator([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], 10), 0x2cd37505871bc460a62ea1e63c7fe51149df5d0801302cf1cbc48beb8dff7e94\n );\n assert_eq(\n pedersen_commitment_with_separator([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], 10), EmbeddedCurvePoint {\n x: 0x2fb3f8b3d41ddde007c8c3c62550f9a9380ee546fcc639ffbb3fd30c8d8de30c,\n y: 0x300783be23c446b11a4c0fabf6c91af148937cea15fcf5fb054abf7f752ee245,\n is_infinite: false\n }\n );\n}\n\n"},"290":{"path":"/usr/src/noir-projects/noir-protocol-circuits/crates/types/src/utils/reader.nr","source":"struct Reader<let N: u32> {\n data: [Field; N],\n offset: u32,\n}\n\nimpl<let N: u32> Reader<N> {\n pub fn new(data: [Field; N]) -> Self {\n Self { data, offset: 0 }\n }\n\n pub fn read(&mut self) -> Field {\n let result = self.data[self.offset];\n self.offset += 1;\n result\n }\n\n pub fn read_u32(&mut self) -> u32 {\n self.read() as u32\n }\n\n pub fn read_bool(&mut self) -> bool {\n self.read() as bool\n }\n\n pub fn read_array<let K: u32>(&mut self, mut result: [Field; K]) -> [Field; K] {\n for i in 0..K {\n result[i] = self.data[self.offset + i];\n }\n self.offset += K;\n result\n }\n\n // TODO(#4394)\n pub fn read_struct<T, let K: u32>(&mut self, deserialise: fn([Field; K]) -> T) -> T {\n let result = deserialise(self.read_array([0; K]));\n result\n }\n\n pub fn read_struct_array<T, let K: u32, let C: u32>(&mut self, deserialise: fn([Field; K]) -> T, mut result: [T; C]) -> [T; C] {\n for i in 0..C {\n result[i] = self.read_struct(deserialise);\n }\n result\n }\n\n pub fn finish(self) {\n assert(self.offset == self.data.len(), \"Reader did not read all data\");\n }\n}\n"},"32":{"path":"std/hash/poseidon2.nr","source":"use crate::hash::Hasher;\nuse crate::default::Default;\n\ncomptime global 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 #[no_predicates]\n pub fn hash<let N: u32>(input: [Field; N], message_size: u32) -> 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) {\n // add the cache into sponge state\n for i in 0..RATE {\n // We effectively zero-pad the cache by only adding to the state\n // cache that is less than the specified `cache_size`\n if i < self.cache_size {\n self.state[i] += self.cache[i];\n }\n }\n self.state = crate::hash::poseidon2_permutation(self.state, 4);\n }\n\n fn absorb(&mut self, input: Field) {\n assert(!self.squeeze_mode);\n if self.cache_size == RATE {\n // If we're absorbing, and the cache is full, apply the sponge permutation to compress the cache\n self.perform_duplex();\n self.cache[0] = input;\n self.cache_size = 1;\n } else {\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 }\n }\n\n fn squeeze(&mut self) -> Field {\n assert(!self.squeeze_mode);\n // If we're in absorb mode, apply sponge permutation to compress the cache.\n self.perform_duplex();\n self.squeeze_mode = true;\n\n // Pop one item off the top of the permutation and return it.\n self.state[0]\n }\n\n fn hash_internal<let N: u32>(input: [Field; N], in_len: u32, 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"},"350":{"path":"/usr/src/noir-projects/noir-contracts/contracts/auth_registry_contract/src/main.nr","source":"contract AuthRegistry {\n use dep::aztec::{state_vars::{PublicMutable, Map}, protocol_types::address::AztecAddress};\n use dep::authwit::auth::{IS_VALID_SELECTOR, compute_authwit_message_hash, assert_current_call_valid_authwit};\n\n #[aztec(storage)]\n struct Storage {\n reject_all: Map<AztecAddress, PublicMutable<bool>>,\n // on_behalf_of => authwit hash => authorized\n approved_actions: Map<AztecAddress, Map<Field, PublicMutable<bool>>>,\n }\n\n /**\n * Updates the `authorized` value for `msg_sender` for `message_hash`.\n *\n * @param message_hash The message hash being authorized\n * @param authorize True if the caller is authorized to perform the message hash, false otherwise\n */\n #[aztec(public)]\n fn set_authorized(message_hash: Field, authorize: bool) {\n storage.approved_actions.at(context.msg_sender()).at(message_hash).write(authorize);\n }\n\n /**\n * Updates the `reject_all` value for `msg_sender`.\n * \n * When `reject_all` is `true` any `consume` on `msg_sender` will revert.\n * \n * @param reject True if all actions should be rejected, false otherwise\n */\n #[aztec(public)]\n fn set_reject_all(reject: bool) {\n storage.reject_all.at(context.msg_sender()).write(reject);\n }\n\n /**\n * Consumes an `inner_hash` on behalf of `on_behalf_of` if the caller is authorized to do so.\n * \n * Will revert even if the caller is authorized if `reject_all` is set to true for `on_behalf_of`.\n * This is to support \"mass-revoke\".\n *\n * @param on_behalf_of The address on whose behalf the action is being consumed\n * @param inner_hash The inner_hash of the authwit\n * @return `IS_VALID_SELECTOR` if the action was consumed, revert otherwise\n */\n #[aztec(public)]\n fn consume(on_behalf_of: AztecAddress, inner_hash: Field) -> Field {\n assert_eq(false, storage.reject_all.at(on_behalf_of).read(), \"rejecting all\");\n\n let message_hash = compute_authwit_message_hash(\n context.msg_sender(),\n context.chain_id(),\n context.version(),\n inner_hash\n );\n\n let authorized = storage.approved_actions.at(on_behalf_of).at(message_hash).read();\n\n assert_eq(true, authorized, \"unauthorized\");\n storage.approved_actions.at(on_behalf_of).at(message_hash).write(false);\n\n IS_VALID_SELECTOR\n }\n\n /**\n * Updates a public authwit using a private authwit\n * \n * Useful for the case where you want someone else to insert a public authwit for you.\n * For example, if Alice wants Bob to insert an authwit in public, such that they can execute\n * a trade, Alice can create a private authwit, and Bob can call this function with it.\n *\n * @param approver The address of the approver (Alice in the example)\n * @param message_hash The message hash to authorize\n * @param authorize True if the message hash should be authorized, false otherwise\n */\n #[aztec(private)]\n fn set_authorized_private(approver: AztecAddress, message_hash: Field, authorize: bool) {\n assert_current_call_valid_authwit(&mut context, approver);\n AuthRegistry::at(context.this_address())._set_authorized(approver, message_hash, authorize).enqueue(&mut context);\n }\n\n /**\n * Internal function to update the `authorized` value for `approver` for `messageHash`.\n * Used along with `set_authorized_private` to update the public authwit.\n * \n * @param approver The address of the approver\n * @param message_hash The message hash being authorized\n * @param authorize True if the caller is authorized to perform the message hash, false otherwise\n */\n #[aztec(public)]\n #[aztec(internal)]\n fn _set_authorized(approver: AztecAddress, message_hash: Field, authorize: bool) {\n storage.approved_actions.at(approver).at(message_hash).write(authorize);\n }\n\n /**\n * Fetches the `reject_all` value for `on_behalf_of`.\n * \n * @param on_behalf_of The address to check\n * @return True if all actions are rejected, false otherwise\n */\n #[aztec(public)]\n #[aztec(view)]\n fn is_reject_all(on_behalf_of: AztecAddress) -> bool {\n storage.reject_all.at(on_behalf_of).read()\n }\n\n /**\n * Fetches the `authorized` value for `on_behalf_of` for `message_hash`.\n * \n * @param on_behalf_of The address on whose behalf the action is being consumed\n * @param message_hash The message hash to check\n * @return True if the caller is authorized to perform the action, false otherwise\n */\n #[aztec(public)]\n #[aztec(view)]\n fn is_consumable(on_behalf_of: AztecAddress, message_hash: Field) -> bool {\n storage.approved_actions.at(on_behalf_of).at(message_hash).read()\n }\n\n unconstrained fn unconstrained_is_consumable(on_behalf_of: AztecAddress, message_hash: Field) -> pub bool {\n storage.approved_actions.at(on_behalf_of).at(message_hash).read()\n }\n}\n"},"71":{"path":"/usr/src/noir-projects/aztec-nr/authwit/src/auth.nr","source":"use dep::aztec::protocol_types::{\n abis::function_selector::FunctionSelector, address::AztecAddress,\n constants::{\n GENERATOR_INDEX__AUTHWIT_INNER, GENERATOR_INDEX__AUTHWIT_OUTER, GENERATOR_INDEX__AUTHWIT_NULLIFIER,\n CANONICAL_AUTH_REGISTRY_ADDRESS\n},\n hash::poseidon2_hash_with_separator\n};\nuse dep::aztec::{prelude::Deserialize, context::{PrivateContext, PublicContext, gas::GasOpts}, hash::hash_args_array};\n\n/**\n * Authenticaion witness helper library\n *\n * Authentication Witness is a scheme for authenticating actions on Aztec, so users can allow third-parties\n * (e.g. protocols or other users) to execute an action on their behalf.\n *\n * This library provides helper functions to manage such witnesses.\n * The authentication witness, is some \"witness\" (data) that authenticates a `message_hash`.\n * The simplest example of an authentication witness, is a signature. The signature is the \"evidence\",\n * that the signer has seen the message, agrees with it, and has allowed it.\n * It does not need to be a signature. It could be any kind of \"proof\" that the message is allowed.\n * Another proof could be knowing some kind of secret, or having some kind of \"token\" that allows the message.\n *\n * The `message_hash` is a hash of the following structure:\n * hash(consumer, chain_id, version, inner_hash)\n * - consumer: the address of the contract that is \"consuming\" the message,\n * - chain_id: the chain id of the chain that the message is being consumed on,\n * - version: the version of the chain that the message is being consumed on,\n * - inner_hash: the hash of the \"inner\" message that is being consumed, this is the \"actual\" message or action.\n *\n * While the `inner_hash` could be anything, such as showing you signed a specific message, it will often be\n * a hash of the \"action\" to approve, along with who made the call. As part of this library, we provide a few\n * helper functions to deal with such messages.\n *\n * For example, we provide helper function that is used for checking that the message is an encoding of the current call.\n * This can be used to let some contract \"allow\" another contract to act on its behalf, as long as it can\n * show that it is acting on behalf of the contract.\n *\n * If we take a case of allowing a contract to transfer tokens on behalf of an account, the `inner_hash` can be\n * derived as:\n * inner_hash = hash(caller, \"transfer\", hash(to, amount))\n *\n * Where the `caller` would be the address of the contract that is trying to transfer the tokens, and `to` and `amount`\n * the arguments for the transfer.\n *\n * Note that we have both a `caller` and a `consumer`, the `consumer` will be the contract that is consuming the message,\n * in the case of the transfer, it would be the `Token` contract itself, while the caller, will be the actor that is\n * allowed to transfer the tokens.\n *\n *\n * The authentication mechanism works differently in public and private contexts. In private, we recall that everything\n * is executed on the user's device, so we can use `oracles` to \"ask\" the user (not contract) for information. In public\n * we cannot do this, since it is executed by the sequencer (someone else). Therefore we can instead use a \"registry\"\n * to store the messages that we have approved.\n *\n * A simple example would be a \"token\" that is being \"pulled\" from one account into another. We will first outline\n * how this would look in private, and then in public later.\n *\n * Say that a user `Alice` wants to deposit some tokens into a DeFi protocol (say a DEX).\n * `Alice` would make a `deposit` transaction, that she is executing using her account contract.\n * The account would call the `DeFi` contract to execute `deposit`, which would try to pull funds from the `Token`\n * contract. Since the `DeFi` contract is trying to pull funds from an account that is not its own, it needs to\n * convince the `Token` contract that it is allowed to do so.\n *\n * This is where the authentication witness comes in The `Token` contract computes a `message_hash` from the\n * `transfer` call, and then asks `Alice Account` contract to verify that the `DeFi` contract is allowed to\n * execute that call.\n *\n * `Alice Account` contract can then ask `Alice` if she wants to allow the `DeFi` contract to pull funds from her\n * account. If she does, she will sign the `message_hash` and return the signature to the `Alice Account` which\n * will validate it and return success to the `Token` contract which will then allow the `DeFi` contract to pull\n * funds from `Alice`.\n *\n * To ensure that the same \"approval\" cannot be used multiple times, we also compute a `nullifier` for the\n * authentication witness, and emit it from the `Token` contract (consumer).\n *\n * Note that we can do this flow as we are in private were we can do oracle calls out from contracts.\n *\n *\n * Person Contract Contract Contract\n * Alice Alice Account Token DeFi\n * | | | |\n * | Defi.deposit(Token, 1000) | |\n * |----------------->| | |\n * | | deposit(Token, 1000) |\n * | |---------------------------------------->|\n * | | | |\n * | | | transfer(Alice, Defi, 1000)\n * | | |<---------------------|\n * | | | |\n * | | Check if Defi may call transfer(Alice, Defi, 1000)\n * | |<-----------------| |\n * | | | |\n * | Please give me AuthWit for DeFi | |\n * | calling transfer(Alice, Defi, 1000) | |\n * |<-----------------| | |\n * | | | |\n * | | | |\n * | AuthWit for transfer(Alice, Defi, 1000) |\n * |----------------->| | |\n * | | AuthWit validity | |\n * | |----------------->| |\n * | | | |\n * | | throw if invalid AuthWit |\n * | | | |\n * | | emit AuthWit nullifier |\n * | | | |\n * | | transfer(Alice, Defi, 1000) |\n * | | | |\n * | | | |\n * | | | success |\n * | | |--------------------->|\n * | | | |\n * | | | |\n * | | | deposit(Token, 1000)\n * | | | |\n * | | | |\n *\n *\n * If we instead were in public, we cannot do the same flow. Instead we would use an authentication registry to store\n * the messages that we have approved.\n *\n * To approve a message, `Alice Account` can make a `set_authorized` call to the registry, to set a `message_hash`\n * as authorized. This is essentially a mapping from `message_hash` to `true` for `Alice Contract`. Every account\n * has its own map in the registry, so `Alice` cannot approve a message for `Bob`.\n *\n * The `Token` contract can then try to \"spend\" the approval by calling `consume` on the registry. If the message\n * was approved, the value is updated to `false`, and we return the success flag. For more information on the\n * registry, see `main.nr` in `auth_registry_contract`.\n *\n * Person Contract Contract Contract Contract\n * Alice Alice Account Registry Token DeFi\n * | | | | |\n * | Registry.set_authorized(..., true) | | |\n * |----------------->| | | |\n * | | set_authorized(..., true) | |\n * | |------------------->| | |\n * | | | | |\n * | | set authorized to true | |\n * | | | | |\n * | | | | |\n * | Defi.deposit(Token, 1000) | | |\n * |----------------->| | | |\n * | | deposit(Token, 1000) | |\n * | |-------------------------------------------------------------->|\n * | | | | |\n * | | | transfer(Alice, Defi, 1000) |\n * | | | |<---------------------|\n * | | | | |\n * | | | Check if Defi may call transfer(Alice, Defi, 1000)\n * | | |<------------------| |\n * | | | | |\n * | | throw if invalid AuthWit | |\n * | | | | |\n * | | | | |\n * | | set authorized to false | |\n * | | | | |\n * | | | | |\n * | | | AuthWit validity | |\n * | | |------------------>| |\n * | | | | |\n * | | | | transfer(Alice, Defi, 1000)\n * | | | |<-------------------->|\n * | | | | |\n * | | | | success |\n * | | | |--------------------->|\n * | | | | |\n * | | | | deposit(Token, 1000)\n * | | | | |\n *\n *\n * --- FAQ ---\n * Q: Why are we using a success flag of `keccak256(\"IS_VALID()\")` instead of just returning a boolean?\n * A: We want to make sure that we don't accidentally return `true` if there is a collision in the function selector.\n * By returning a hash of `IS_VALID()`, it becomes very unlikely that there is both a collision and we return\n * a success flag.\n *\n * Q: Why are we using static calls?\n * A: We are using static calls to ensure that the account contract cannot re-enter. If it was a normal call, it\n * could make a new call and do a re-entry attack. Using a static ensures that it cannot update any state.\n *\n * Q: Would it not be cheaper to use a nullifier instead of updating state in public?\n * A: At a quick glance, a public state update + nullifier is 96 bytes, but two state updates are 128, so it would be\n * cheaper to use a nullifier, if this is the way it would always be done. However, if both the approval and the\n * consumption is done in the same transaction, then we will be able to squash the updates (only final tx state diff is posted to DA), and now it is cheaper.\n *\n * Q: Why is the chain id and the version part of the message hash?\n * A: The chain id and the version is part of the message hash to ensure that the message is only valid on a specific\n * chain to avoid a case where the same message could be used across multiple chains.\n */\n\nglobal IS_VALID_SELECTOR = 0xabf64ad4; // 4 first bytes of keccak256(\"IS_VALID()\")\n\n/**\n * Assert that `on_behalf_of` have authorized the current call with a valid authentication witness\n *\n * Computing the `inner_hash` using the `msg_sender`, `selector` and `args_hash` and then making a call out to the\n * `on_behalf_of` contract to verify that the `inner_hash` is valid.\n *\n * @param on_behalf_of The address that have authorized the current call\n */\n// docs:start:assert_current_call_valid_authwit\npub fn assert_current_call_valid_authwit(context: &mut PrivateContext, on_behalf_of: AztecAddress) {\n let inner_hash = compute_inner_authwit_hash([context.msg_sender().to_field(), context.selector().to_field(), context.args_hash]);\n assert_inner_hash_valid_authwit(context, on_behalf_of, inner_hash);\n}\n// docs:end:assert_current_call_valid_authwit\n\n/**\n * Assert that a specific `inner_hash` is valid for the `on_behalf_of` address\n *\n * Used as an internal function for `assert_current_call_valid_authwit` and can be used as a standalone function when\n * the `inner_hash` is from a different source, e.g., say a block of text etc.\n *\n * @param on_behalf_of The address that have authorized the current call\n * @param inner_hash The hash of the message to authorize\n */\npub fn assert_inner_hash_valid_authwit(\n context: &mut PrivateContext,\n on_behalf_of: AztecAddress,\n inner_hash: Field\n) {\n // We perform a static call here and not a standard one to ensure that the account contract cannot re-enter.\n let result: Field = context.static_call_private_function(\n on_behalf_of,\n comptime {\n FunctionSelector::from_signature(\"verify_private_authwit(Field)\")\n },\n [inner_hash]\n ).unpack_into();\n assert(result == IS_VALID_SELECTOR, \"Message not authorized by account\");\n // Compute the nullifier, similar computation to the outer hash, but without the chain_id and version.\n // Those should already be handled in the verification, so we just need something to nullify, that allow same inner_hash for multiple actors.\n let nullifier = compute_authwit_nullifier(on_behalf_of, inner_hash);\n context.push_nullifier(nullifier);\n}\n\n/**\n * Assert that `on_behalf_of` have authorized the current call in the authentication registry\n *\n * Computing the `inner_hash` using the `msg_sender`, `selector` and `args_hash` and then making a call out to the\n * `on_behalf_of` contract to verify that the `inner_hash` is valid.\n *\n * Note that the authentication registry will take the `msg_sender` into account as the consumer, so this will only\n * work if the `msg_sender` is the same as the `consumer` when the `message_hash` was inserted into the registry.\n *\n * @param on_behalf_of The address that have authorized the current call\n */\n// docs:start:assert_current_call_valid_authwit_public\npub fn assert_current_call_valid_authwit_public(context: &mut PublicContext, on_behalf_of: AztecAddress) {\n let inner_hash = compute_inner_authwit_hash(\n [(*context).msg_sender().to_field(), (*context).selector().to_field(), (*context).get_args_hash()]\n );\n assert_inner_hash_valid_authwit_public(context, on_behalf_of, inner_hash);\n}\n// docs:end:assert_current_call_valid_authwit_public\n\n/**\n * Assert that `on_behalf_of` have authorized a speicifc `inner_hash` in the authentication registry\n *\n * Computing the `inner_hash` using the `msg_sender`, `selector` and `args_hash` and then making a call out to the\n * `on_behalf_of` contract to verify that the `inner_hash` is valid.\n *\n * Note that the authentication registry will take the `msg_sender` into account as the consumer, so this will only\n * work if the `msg_sender` is the same as the `consumer` when the `message_hash` was inserted into the registry.\n *\n * @param on_behalf_of The address that have authorized the `inner_hash`\n */\npub fn assert_inner_hash_valid_authwit_public(\n context: &mut PublicContext,\n on_behalf_of: AztecAddress,\n inner_hash: Field\n) {\n let result: Field = context.call_public_function(\n CANONICAL_AUTH_REGISTRY_ADDRESS,\n comptime {\n FunctionSelector::from_signature(\"consume((Field),Field)\")\n },\n [on_behalf_of.to_field(), inner_hash].as_slice(),\n GasOpts::default()\n ).deserialize_into();\n assert(result == IS_VALID_SELECTOR, \"Message not authorized by account\");\n}\n\n/**\n * Compute the `message_hash` from a function call to be used by an authentication witness\n *\n * Useful for when you need a non-account contract to approve during execution. For example if you need a contract\n * to make a call to nested contract, e.g., contract A wants to exit token T to L1 using bridge B, so it needs to allow\n * B to transfer T on its behalf.\n *\n * @param caller The address of the contract that is calling the function, in the example above, this would be B\n * @param consumer The address of the contract that is consuming the message, in the example above, this would be T\n * @param chain_id The chain id of the chain that the message is being consumed on\n * @param version The version of the chain that the message is being consumed on\n * @param selector The function selector of the function that is being called\n * @param args The arguments of the function that is being called\n */\n// docs:start:compute_authwit_message_hash_from_call\npub fn compute_authwit_message_hash_from_call<let N: u32>(\n caller: AztecAddress,\n consumer: AztecAddress,\n chain_id: Field,\n version: Field,\n selector: FunctionSelector,\n args: [Field; N]\n) -> Field {\n let args_hash = hash_args_array(args);\n let inner_hash = compute_inner_authwit_hash([caller.to_field(), selector.to_field(), args_hash]);\n compute_authwit_message_hash(consumer, chain_id, version, inner_hash)\n}\n// docs:end:compute_authwit_message_hash_from_call\n\n/**\n * Computes the `inner_hash` of the authentication witness\n *\n * This is used internally, but also useful in cases where you want to compute the `inner_hash` for a specific message\n * that is not necessarily a call, but just some \"bytes\" or text.\n *\n * @param args The arguments to hash\n */\npub fn compute_inner_authwit_hash<let N: u32>(args: [Field; N]) -> Field {\n poseidon2_hash_with_separator(args, GENERATOR_INDEX__AUTHWIT_INNER)\n}\n\n/**\n * Computs the `authwit_nullifier` for a specific `on_behalf_of` and `inner_hash`\n *\n * Using the `on_behalf_of` and the `inner_hash` to ensure that the nullifier is siloed for a specific `on_behalf_of`.\n *\n * @param on_behalf_of The address that have authorized the `inner_hash`\n * @param inner_hash The hash of the message to authorize\n */\npub fn compute_authwit_nullifier(on_behalf_of: AztecAddress, inner_hash: Field) -> Field {\n poseidon2_hash_with_separator(\n [on_behalf_of.to_field(), inner_hash],\n GENERATOR_INDEX__AUTHWIT_NULLIFIER\n )\n}\n\n/**\n * Computes the `message_hash` for the authentication witness\n *\n * @param consumer The address of the contract that is consuming the message\n * @param chain_id The chain id of the chain that the message is being consumed on\n * @param version The version of the chain that the message is being consumed on\n * @param inner_hash The hash of the \"inner\" message that is being consumed\n */\npub fn compute_authwit_message_hash(\n consumer: AztecAddress,\n chain_id: Field,\n version: Field,\n inner_hash: Field\n) -> Field {\n poseidon2_hash_with_separator(\n [\n consumer.to_field(),\n chain_id,\n version,\n inner_hash\n ],\n GENERATOR_INDEX__AUTHWIT_OUTER\n )\n}\n\n/**\n * Helper function to set the authorization status of a message hash\n *\n * Wraps a public call to the authentication registry to set the authorization status of a `message_hash`\n *\n * @param message_hash The hash of the message to authorize\n * @param authorize True if the message should be authorized, false if it should be revoked\n */\npub fn set_authorized(context: &mut PublicContext, message_hash: Field, authorize: bool) {\n context.call_public_function(\n CANONICAL_AUTH_REGISTRY_ADDRESS,\n comptime {\n FunctionSelector::from_signature(\"set_authorized(Field,bool)\")\n },\n [message_hash, authorize as Field].as_slice(),\n GasOpts::default()\n ).assert_empty();\n}\n\n/**\n * Helper function to reject all authwits\n *\n * Wraps a public call to the authentication registry to set the `reject_all` flag\n *\n * @param reject True if all authwits should be rejected, false otherwise\n */\npub fn set_reject_all(context: &mut PublicContext, reject: bool) {\n context.call_public_function(\n CANONICAL_AUTH_REGISTRY_ADDRESS,\n comptime {\n FunctionSelector::from_signature(\"set_reject_all(bool)\")\n },\n [context.this_address().to_field(), reject as Field].as_slice(),\n GasOpts::default()\n ).assert_empty();\n}\n"}}}
|
|
1
|
+
{"transpiled":true,"noir_version":"0.33.0+cb20e078dd909656110d133339b2b425e6c3ebb0","name":"AuthRegistry","functions":[{"name":"set_reject_all","is_unconstrained":true,"custom_attributes":["aztec(public)"],"abi":{"error_types":{},"parameters":[{"name":"inputs","type":{"fields":[{"name":"calldata_length","type":{"kind":"field"}},{"name":"is_static_call","type":{"kind":"boolean"}}],"kind":"struct","path":"aztec::context::inputs::public_context_inputs::PublicContextInputs"},"visibility":"private"},{"name":"reject","type":{"kind":"boolean"},"visibility":"private"}],"return_type":null},"bytecode":"H4sIAAAAAAAC/01Q0UoDMRCcZJPNXpL2uQ8KgiBUqp4vd+CTYK8++eBv96ucvUPowYTdmc3sXEZIiO8QuwAjRJQHyhH8CqGAfd1D7WznX/Z23oBIBBcWW1Zh2bAJM29BZh9Ns/P5lfT+4oN+4GFdMEKD+cLBV7cJqGDXMAYJXtZIsvUpWmfXI6vSV77zRtz9JNoMRCMoYEdLlApthcbBy2ClvgCPqN8BuIPmMmHQE54qRAfXnlFPOL5RU27VVj1UzP958k0ekjkxReJESJ0OSegwQ9x9HRH4O6YppPzhVPa/9nEWotn2PM3Xfm6RJpinmXG4Hq5/tJFtZ5ABAAA=","debug_symbols":"5ZrdioMwEIXfJde9SCaTSaavsiyL/UUQW/qzsJS++9quUbuKuVmWhNyI0cPkOwieSchNbLar6/6jrHeHs1i+3UR1WBeX8lA3o9t9IVansqrK/cfwsZCPi8Kn/nws6sfwfClOF7FUgLQQ23rzuCVsKuzKaiuW2sB9MVKjJt2qUVvVqZWiCbWVFlq1lc6+qN8XQplpIMAOCE0AiJVtxUyDCWgKRxnpC7PrtGDcVF2DXsyGuVcTT6t9ZSmhF/PTJuVh0+Zh0+Vhk7OwCTIPmyoPm5CHTZ2HTczDZh5dEOTRBUEeXRDk0QXBH3RBSiJ0Mwxwpo16chmoSuRXbeT0oKZ7YGuZJrZKExvSxNZpYmOa2OGUtzqEDci92rxMMYGjnScnzSawVaNZ+X0diYNfpn7Cu/+HR93BUwielPHfs7nV91/7TAix47NPQgI52iZDHTu+gzl8jBwfJHf4yo3wTdr4lDa+TRs/9h9nAJ+TxjcybXyVNn7sqRvAjz11A/hpp65JO3VN2qlr0k5dE/1yhVyPzwE1Y0fCyHJkNvaMnjHb4FPsGR3Ajz2jA/jRr4zn8aNfGc/g35vhZ3Eqi1W1bc/u7K71enCU5/J1/HnTiL8B","brillig_names":["set_reject_all"],"assert_messages":{"63":"attempt to add with overflow","34":"Storage slot 0 not allowed. Storage slots must start from 1.","54":"Array index out of bounds"}},{"name":"compute_note_hash_and_optionally_a_nullifier","is_unconstrained":true,"custom_attributes":[],"abi":{"error_types":{},"parameters":[{"name":"contract_address","type":{"fields":[{"name":"inner","type":{"kind":"field"}}],"kind":"struct","path":"authwit::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":"compute_nullifier","type":{"kind":"boolean"},"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"}},"bytecode":"H4sIAAAAAAAA/9VW207DMAx1Wbum6yom+IHyhuCBVtqkPQ5x/QB+YBqV2MuG1sL3M3c2O8sKLzQSjRQ5ceLjE8e5eLQrZls9aQci+3RcdM5MZPa3kreIlbnk6XWE50lHePY6wtNvkafXwJOlL20+d3zmQtqdx6NBNOaN7sE4/QLkWU653ED7UuTL27JMF+tVtZkvqvR1XZTpal2lH2WRvm+Wn/Oq4H5RfgPdioyEEJKetRO1PLIW3hr2dLyIhLsD3hPGHbjBznhj78w+9gS+OCmeZEylJzWRcQL7hPaJcw86TbgH0OmL8Ai6kA59MR/jZr+mDvcrY9zYDXaewP4Q+MCCB1l5DMhZDtUvWmz5V196lut8kc00oPPNIc86X6x85G4K4wbWpOPX1tqQS8/iwriBi1hIXvVdYGfZGGPoN8QwaIhhvyGG59v6bOEw79A44V2/VgY4+uBLeZ7AHAM8Auhf0V4faRIInsZFcU957ZpH5mc737IbwZw+2IWWXQi867nbeiHtWOKJ90uLv77cfg/a/FHiWfYFW33pegKYo1+mMzouGAOiTtyvky7fr0OL0wh0mItDC2toYf0Hu4QOY6s6vctjkF9e6Ei/eg4AAA==","debug_symbols":"lZDBCsMgEET/Zc8eSmIi5FdKCZpoWJA1qCkU8d+7aXPI1csyszPvMgVWa45tRnIhwfQs4MOiMwZiV6oAE9F73Ob7Gx7nkf2vn3ZNp01ZxwxTPyoBllZWqmPeobesh66+BEjZjgztyNiOqEaksn3riNp4ey3lDlpuw+XP/k+4/AU=","brillig_names":["compute_note_hash_and_optionally_a_nullifier"]},{"name":"set_authorized","is_unconstrained":true,"custom_attributes":["aztec(public)"],"abi":{"error_types":{},"parameters":[{"name":"inputs","type":{"fields":[{"name":"calldata_length","type":{"kind":"field"}},{"name":"is_static_call","type":{"kind":"boolean"}}],"kind":"struct","path":"aztec::context::inputs::public_context_inputs::PublicContextInputs"},"visibility":"private"},{"name":"message_hash","type":{"kind":"field"},"visibility":"private"},{"name":"authorize","type":{"kind":"boolean"},"visibility":"private"}],"return_type":null},"bytecode":"H4sIAAAAAAAC/z1QwU7DMAx9SbbEdZP0ugNIHLggDSgSaqVxpHRcOOy391U8p9Mq2XXes9+LMyI4/4EgZ2BE2CUmyAv4CSPx9/2IKIssF8OWLeAZzohV1kasW2zEzCmE2Vp3zD/Yz8bGN5KDdZkd8NRszLEbEb2yCnkCehDKGF1wVvaeYC6T18JT8aykNLxwwte/HWU6RmaQQKUaRBGzUNOhVzjt6yvwjHp2bdNQaaRmVJuRleoJVsrnu9G+NLwZDXejejMa6FFFm7xQ/pOLUf4BMfYTunTErAipK+S+UI44vZNLHI21ZNPUqSkFXsVusfkSVJl8b0/jJFNBIhV+EU29tUTmmGRyoieD1Na3dtsjaa7M2WwvKDbEB7TbzDhcD9d/prHhnPUBAAA=","debug_symbols":"5ZvfaupAEIffZa+92J2d/TO+yuFQYqslEGJRe+AgvnsTm40RQ/aitOx0biTRX8bvE9yZRXNWL9vN++tT3e72R7X+c1bN/rk61fu2OztfVmpzqJumfn2aPq10/2DcNX98q9r+9HiqDie1jk6v1LZ96Y587K7f1c1Wra2Dy+ohi9bbIYw2mDFtjJ9JBx1gSAcdw13670oZP4sD6ZqIlMEhE4Ys+Ul5PwdjRk1DN01wca6uwxQmRzcK8DSfTpW1hluYrpJBgmSUIEkCJEFLkDQSJEGCpJUgiRIknQRJCRMPSJh4QMLEAxImHvvlicdohLH+BGZeM3HrTFUXUtLF+4+uhzYcoYEjtOUIjRyhHUfoXEcP+AuWyCBBMkqQJAGSqCVIGgmSIEHSSpBECZJOgqSEiQclTDz45YnnewZu7/2Q9NFOasYrNDGEdpojtOEInZsYKAsNSAkagrt7gxkYGxO3tzRJz/4gbskMYdQ4+eraK7r7aXS0I7rPoXvjEkh3aO/SPTyVDU9pNfagH/6I4HXZ8BGW4E3R8KBphDfxAR44w1vO8MgZvuylMgPvOcMHzvCRM3zZHXYZPpTdYTPwnDts4NxhA+cOGzh32FD4ZsTHGzxl0oQjCSHpB9Wy+/GCag9fdj/OwJfdjzPwhe94F+Fj4TveBfhLd/qvOtTVptkOdzzs3tvnyQ0Qp/9vn6904Q8=","brillig_names":["set_authorized"],"assert_messages":{"51":"Storage slot 0 not allowed. Storage slots must start from 1.","80":"attempt to add with overflow","71":"Array index out of bounds","35":"Storage slot 0 not allowed. Storage slots must start from 1."}},{"name":"is_reject_all","is_unconstrained":true,"custom_attributes":["aztec(public)","aztec(view)"],"abi":{"error_types":{},"parameters":[{"name":"inputs","type":{"fields":[{"name":"calldata_length","type":{"kind":"field"}},{"name":"is_static_call","type":{"kind":"boolean"}}],"kind":"struct","path":"aztec::context::inputs::public_context_inputs::PublicContextInputs"},"visibility":"private"},{"name":"on_behalf_of","type":{"fields":[{"name":"inner","type":{"kind":"field"}}],"kind":"struct","path":"authwit::aztec::protocol_types::address::aztec_address::AztecAddress"},"visibility":"private"}],"return_type":{"abi_type":{"kind":"boolean"},"visibility":"public"}},"bytecode":"H4sIAAAAAAAC/zVSy0otQQysdPqR7r5e3OlCd26Eo84BmcGd4PGxcSEILkRwL/6oX2Wl5ziQTCeTVCU1PUElbKH2CExQzXQo5+BTaBmwu1Nk29nuhbHtVkOgycKP0MUzkf4e6ZLpgwXEe3jwcncyQaRcAIeIj7LSxHngKyImUfFjCUxGm5ClzqGagwSbQ7Jp1HlF4zH0ZwaeAGvQaJ1NSI1jpkIy1AYptZPyDH1PSdA9ZcVAYVg97GMCP1ZP9kZKWi2cJm+wbdAcE7FukTa4nqVQFM0h0aeos2g5QS7Z5XG9hg15mM6RLpaXPz3L37cZxdfVK+IlL1Q2mtYbr+QwUJ+5/SNT80We1kUobTLl/0Kw6GK/UfeE/fT0PXN2dZ3EB8xJ/9OrQ7yuEOtq6qstYmq5U+hMPP9F71Y2+CCmGpf9XlzkJKSDUfDtONQDNlSL1o4g1qz5/eBr3I+22rokAb+ssd28oZOum3mYRhjMrHtYyV43+NyKEtGJrxYc/xz//AJDV7IMngIAAA==","debug_symbols":"5ZrNisIwFIXfJWsX+b258VWGYahapVCqaB0YxHef1Omf09IgDEwu2WirJ/E7m5xzpTe2yzfXw0dR7Y8Xtn67sfK4zeriWPm7233FNueiLIvDx/hjxpsXoR76yymrmttLnZ1rtuYrllc7/+7X7osyZ2tl5P19xYR+TW5ek8OcXEst2xVagnpatJqonbCt2IHttQJgRitMhyIc9lppcG5fozuxM84NanDz6m5nzuUgdg+bNg2bmIZNl4RNydOwKdKwKdOwqdKwqdOwadKwmUYLkmm0IJlGC5JptCD1By1I8F4t+Ahn3uj8sDTVAUCrBFSjPfGBLWhiS5rYiia2poltaGKHUx5lEBvMgM2ffmKq9kdfpwYuYFCLOZPGmu409pf4pG7wLW18pI3vSONrThtf0MaXtPEVbXxNG9/Qxqedujr6cx91j4/mN76J/eRB3nU7fwkT/H84eZD3+EqE8JXr6PVoJvbtt4HXlOENZXggA29gAo+U4R1heIi+KCye9RB7UUDVJy1qO8GPvSiglEv4sY/nyN2AjwG1U8MfuMqqidnYh/nlWgGxl7plfBv7MB/Aj32YD+DTrtQ29mE+gB97Rgfwo8/oZfzoM3oZP/6MXsSnnbqWduoi7dRF2qmLtFMXaacuUk7du7/9zM5Ftinz9un8/bXajh7Wr79OP9948Tc=","brillig_names":["is_reject_all"],"assert_messages":{"35":"Storage slot 0 not allowed. Storage slots must start from 1.","71":"Array index out of bounds","15":"Function is_reject_all can only be called statically","83":"attempt to add with overflow"}},{"name":"unconstrained_is_consumable","is_unconstrained":true,"custom_attributes":[],"abi":{"error_types":{},"parameters":[{"name":"on_behalf_of","type":{"fields":[{"name":"inner","type":{"kind":"field"}}],"kind":"struct","path":"authwit::aztec::protocol_types::address::aztec_address::AztecAddress"},"visibility":"private"},{"name":"message_hash","type":{"kind":"field"},"visibility":"private"}],"return_type":{"abi_type":{"kind":"boolean"},"visibility":"public"}},"byt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V4fKSt2OEPBXmyjDJsmw6WTYZBk2vQiboGTY1DJsggybRoZNK8OmjC4IZHRBIKMLggd0QVpZiP+Q4OSN/utNGLqgRP47vAHbF4ltVJnYukxsKBPblIltZ7EZyr9gGpRhk2TYdDJssgybXoRNq2TY1DJsggybRoZNK8OmjC7IPqAL+j+tOBGNSmKT1OQrtisTm8vE9kVi41wXgSpZg/8EG7UJ2JgulVPuxAQNYecA6HQHQ3ZhXXul4zlPfkZNHLCdTXYOoMloLYXCNpmYQTvEoqXGYhiiRZ7EAkssuVjMEksuFrvEkosFl1hysdASSy4Wt8SSi4W/VSzOxFjgrlj8EksmFvpeXe7DYvmCLlfbGEuyfvXJVue4xxhtcr//sauWoGR4UzK8LQYeaQKPJcNTsfCXfvirPjT1pt2OT1Ps3rvn5OGK0++3j2968R8=","brillig_names":["unconstrained_is_consumable"]},{"name":"_set_authorized","is_unconstrained":true,"custom_attributes":["aztec(public)","aztec(internal)"],"abi":{"error_types":{},"parameters":[{"name":"inputs","type":{"fields":[{"name":"calldata_length","type":{"kind":"field"}},{"name":"is_static_call","type":{"kind":"boolean"}}],"kind":"struct","path":"aztec::context::inputs::public_context_inputs::PublicContextInputs"},"visibility":"private"},{"name":"approver","type":{"fields":[{"name":"inner","type":{"kind":"field"}}],"kind":"struct","path":"authwit::aztec::protocol_types::address::aztec_address::AztecAddress"},"visibility":"private"},{"name":"message_hash","type":{"kind":"field"},"visibility":"private"},{"name":"authorize","type":{"kind":"boolean"},"visibility":"private"}],"return_type":null},"bytecode":"H4sIAAAAAAAC/z2Qu04DMRBFr+34sX6FBikFINpIAZbGKxASSIRsmhQ0fHS+ijvewGpnNJ7HPWOPMEo/w4QjMMLYQIdhC34DLfD/vIUL+7D/lvN+MWiaksIc5l6YF1sKE6dgJmld0X/B0h/gJunxj2y5OsjQUTj3HXYnPka4IaYH4BppVn0lMzQWIGthVEZJGDWTQxrhdG46J6aSTk3b1NfvHYWhrqfV5SbsQaFVDiGTk7IdoQSpbKxEblH/kJVIK8jakRJazWQtTSeqmKIZudLzHbT+B9ULaE1GzbbLZ8q/IIv8DZyPXD7s8Bb57kNh7QNlh/cn1gJHXS1ZNFPrSoa7yxYLl8nkm46eHcpnKnhHhROcqPcWR++Cb8qnV1yuLoJK3imkXOmzYH9QZKghyzYTNufN+RdobcL4EQIAAA==","debug_symbols":"5Zthj6IwEIb/C5/90Hbaace/crlscFc3JAQ36l5yMf73A48ihsbu5vY2ncwXBX0pz1MjMwQ4Vy/bzfvrU9Pt9sdq/eNctfvn+tTsu37tfFlVm0PTts3r0/zjSg0vGq/541vdDavHU304VWu1qrbdS//eb7tr2m21Bmcuq0XOAsIYteD1lNYaE2mvvBnTXgV/l/65qrT/JxSjYrRfpAwKktFjGgmWKOHjKEOcPhU36nNxnYpDwLgFhNlkpmeHtB/DhDNbTM2NdnFgTWHKGhdS4zobw+ToNusGKZ2OIytlbmG6ahoZmiBD08rQdDI0UYaml6EZZGiSCE1QMjRldEEgowsCGV0QWBmaX9AFaWXNtIcZTlr0o2eFzsekC/eTN2AjT2zPEzvwxCaW2FbxxM5WeVK5HTA4YFojQxNkaFoZmk6GJsrQ9DI0gwxNEqHplAxNGV2Qk9EFuS/ogv5PK46IYxIDzMYMV2zLE9vxxEae2PkuwmSxjaWIbby720UCB0IcG4Fm6eR1fqB4md8qO/sTwwCP6vvhLUzwmINH7eLv2S/CXXrAt6XjUzw2o1GLeyzQlY4fzCN8LBzfKJrwdVjge974gTc+scb3pR84M/iaN77hjQ+88Uuvuhn80qtuBp931fW8q67nXXU976obij9dwXDDz92BTXYiIUtqIVt6jX4gO+CXXqMz+KXX6Ax+6TU6g1/8mfED/Eu/+qs+NPWm3Y5Pn+zeu+fZwyin329/v+nDfwA=","brillig_names":["_set_authorized"],"assert_messages":{"56":"Storage slot 0 not allowed. Storage slots must start from 1.","85":"attempt to add with overflow","40":"Storage slot 0 not allowed. Storage slots must start from 1.","20":"Function _set_authorized can only be called internally","76":"Array index out of bounds"}},{"name":"set_authorized_private","is_unconstrained":false,"custom_attributes":["aztec(private)"],"abi":{"error_types":{},"parameters":[{"name":"inputs","type":{"fields":[{"name":"call_context","type":{"fields":[{"name":"msg_sender","type":{"fields":[{"name":"inner","type":{"kind":"field"}}],"kind":"struct","path":"authwit::aztec::protocol_types::address::aztec_address::AztecAddress"}},{"name":"storage_contract_address","type":{"fields":[{"name":"inner","type":{"kind":"field"}}],"kind":"struct","path":"authwit::aztec::protocol_types::address::aztec_address::AztecAddress"}},{"name":"function_selector","type":{"fields":[{"name":"inner","type":{"kind":"integer","sign":"unsigned","width":32}}],"kind":"struct","path":"authwit::aztec::protocol_types::abis::function_selector::FunctionSelector"}},{"name":"is_delegate_call","type":{"kind":"boolean"}},{"name":"is_static_call","type":{"kind":"boolean"}}],"kind":"struct","path":"authwit::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":"authwit::aztec::protocol_types::abis::append_only_tree_snapshot::AppendOnlyTreeSnapshot"}},{"name":"content_commitment","type":{"fields":[{"name":"num_txs","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":"authwit::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":"authwit::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":"authwit::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":"authwit::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":"authwit::aztec::protocol_types::abis::append_only_tree_snapshot::AppendOnlyTreeSnapshot"}}],"kind":"struct","path":"authwit::aztec::protocol_types::partial_state_reference::PartialStateReference"}}],"kind":"struct","path":"authwit::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":"slot_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":"authwit::aztec::protocol_types::address::eth_address::EthAddress"}},{"name":"fee_recipient","type":{"fields":[{"name":"inner","type":{"kind":"field"}}],"kind":"struct","path":"authwit::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":"authwit::aztec::protocol_types::abis::gas_fees::GasFees"}}],"kind":"struct","path":"authwit::aztec::protocol_types::abis::global_variables::GlobalVariables"}},{"name":"total_fees","type":{"kind":"field"}}],"kind":"struct","path":"authwit::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":"authwit::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":"authwit::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":"authwit::aztec::protocol_types::abis::gas_fees::GasFees"}},{"name":"inclusion_fee","type":{"kind":"field"}}],"kind":"struct","path":"authwit::aztec::protocol_types::abis::gas_settings::GasSettings"}}],"kind":"struct","path":"authwit::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":"approver","type":{"fields":[{"name":"inner","type":{"kind":"field"}}],"kind":"struct","path":"authwit::aztec::protocol_types::address::aztec_address::AztecAddress"},"visibility":"private"},{"name":"message_hash","type":{"kind":"field"},"visibility":"private"},{"name":"authorize","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":"authwit::aztec::protocol_types::address::aztec_address::AztecAddress"}},{"name":"storage_contract_address","type":{"fields":[{"name":"inner","type":{"kind":"field"}}],"kind":"struct","path":"authwit::aztec::protocol_types::address::aztec_address::AztecAddress"}},{"name":"function_selector","type":{"fields":[{"name":"inner","type":{"kind":"integer","sign":"unsigned","width":32}}],"kind":"struct","path":"authwit::aztec::protocol_types::abis::function_selector::FunctionSelector"}},{"name":"is_delegate_call","type":{"kind":"boolean"}},{"name":"is_static_call","type":{"kind":"boolean"}}],"kind":"struct","path":"authwit::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":"is_fee_payer","type":{"kind":"boolean"}},{"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":"authwit::aztec::protocol_types::abis::max_block_number::MaxBlockNumber"}},{"name":"note_hash_read_requests","type":{"kind":"array","length":16,"type":{"fields":[{"name":"value","type":{"kind":"field"}},{"name":"counter","type":{"kind":"integer","sign":"unsigned","width":32}}],"kind":"struct","path":"authwit::aztec::protocol_types::abis::read_request::ReadRequest"}}},{"name":"nullifier_read_requests","type":{"kind":"array","length":16,"type":{"fields":[{"name":"value","type":{"kind":"field"}},{"name":"counter","type":{"kind":"integer","sign":"unsigned","width":32}}],"kind":"struct","path":"authwit::aztec::protocol_types::abis::read_request::ReadRequest"}}},{"name":"key_validation_requests_and_generators","type":{"kind":"array","length":16,"type":{"fields":[{"name":"request","type":{"fields":[{"name":"pk_m","type":{"fields":[{"name":"x","type":{"kind":"field"}},{"name":"y","type":{"kind":"field"}},{"name":"is_infinite","type":{"kind":"boolean"}}],"kind":"struct","path":"std::embedded_curve_ops::EmbeddedCurvePoint"}},{"name":"sk_app","type":{"kind":"field"}}],"kind":"struct","path":"authwit::aztec::protocol_types::abis::validation_requests::key_validation_request::KeyValidationRequest"}},{"name":"sk_app_generator","type":{"kind":"field"}}],"kind":"struct","path":"authwit::aztec::protocol_types::abis::validation_requests::key_validation_request_and_generator::KeyValidationRequestAndGenerator"}}},{"name":"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":"authwit::aztec::protocol_types::abis::note_hash::NoteHash"}}},{"name":"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":"authwit::aztec::protocol_types::abis::nullifier::Nullifier"}}},{"name":"private_call_requests","type":{"kind":"array","length":4,"type":{"fields":[{"name":"contract_address","type":{"fields":[{"name":"inner","type":{"kind":"field"}}],"kind":"struct","path":"authwit::aztec::protocol_types::address::aztec_address::AztecAddress"}},{"name":"call_context","type":{"fields":[{"name":"msg_sender","type":{"fields":[{"name":"inner","type":{"kind":"field"}}],"kind":"struct","path":"authwit::aztec::protocol_types::address::aztec_address::AztecAddress"}},{"name":"storage_contract_address","type":{"fields":[{"name":"inner","type":{"kind":"field"}}],"kind":"struct","path":"authwit::aztec::protocol_types::address::aztec_address::AztecAddress"}},{"name":"function_selector","type":{"fields":[{"name":"inner","type":{"kind":"integer","sign":"unsigned","width":32}}],"kind":"struct","path":"authwit::aztec::protocol_types::abis::function_selector::FunctionSelector"}},{"name":"is_delegate_call","type":{"kind":"boolean"}},{"name":"is_static_call","type":{"kind":"boolean"}}],"kind":"struct","path":"authwit::aztec::protocol_types::abis::call_context::CallContext"}},{"name":"args_hash","type":{"kind":"field"}},{"name":"returns_hash","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}}],"kind":"struct","path":"authwit::aztec::protocol_types::abis::private_call_request::PrivateCallRequest"}}},{"name":"public_call_requests","type":{"kind":"array","length":16,"type":{"fields":[{"name":"item","type":{"fields":[{"name":"contract_address","type":{"fields":[{"name":"inner","type":{"kind":"field"}}],"kind":"struct","path":"authwit::aztec::protocol_types::address::aztec_address::AztecAddress"}},{"name":"call_context","type":{"fields":[{"name":"msg_sender","type":{"fields":[{"name":"inner","type":{"kind":"field"}}],"kind":"struct","path":"authwit::aztec::protocol_types::address::aztec_address::AztecAddress"}},{"name":"storage_contract_address","type":{"fields":[{"name":"inner","type":{"kind":"field"}}],"kind":"struct","path":"authwit::aztec::protocol_types::address::aztec_address::AztecAddress"}},{"name":"function_selector","type":{"fields":[{"name":"inner","type":{"kind":"integer","sign":"unsigned","width":32}}],"kind":"struct","path":"authwit::aztec::protocol_types::abis::function_selector::FunctionSelector"}},{"name":"is_delegate_call","type":{"kind":"boolean"}},{"name":"is_static_call","type":{"kind":"boolean"}}],"kind":"struct","path":"authwit::aztec::protocol_types::abis::call_context::CallContext"}},{"name":"args_hash","type":{"kind":"field"}},{"name":"returns_hash","type":{"kind":"field"}},{"name":"revert_code","type":{"kind":"integer","sign":"unsigned","width":8}},{"name":"start_gas_left","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":"authwit::aztec::protocol_types::abis::gas::Gas"}},{"name":"end_gas_left","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":"authwit::aztec::protocol_types::abis::gas::Gas"}}],"kind":"struct","path":"authwit::aztec::protocol_types::abis::public_call_stack_item_compressed::PublicCallStackItemCompressed"}},{"name":"counter","type":{"kind":"integer","sign":"unsigned","width":32}}],"kind":"struct","path":"authwit::aztec::protocol_types::abis::public_call_request::PublicCallRequest"}}},{"name":"public_teardown_call_request","type":{"fields":[{"name":"item","type":{"fields":[{"name":"contract_address","type":{"fields":[{"name":"inner","type":{"kind":"field"}}],"kind":"struct","path":"authwit::aztec::protocol_types::address::aztec_address::AztecAddress"}},{"name":"call_context","type":{"fields":[{"name":"msg_sender","type":{"fields":[{"name":"inner","type":{"kind":"field"}}],"kind":"struct","path":"authwit::aztec::protocol_types::address::aztec_address::AztecAddress"}},{"name":"storage_contract_address","type":{"fields":[{"name":"inner","type":{"kind":"field"}}],"kind":"struct","path":"authwit::aztec::protocol_types::address::aztec_address::AztecAddress"}},{"name":"function_selector","type":{"fields":[{"name":"inner","type":{"kind":"integer","sign":"unsigned","width":32}}],"kind":"struct","path":"authwit::aztec::protocol_types::abis::function_selector::FunctionSelector"}},{"name":"is_delegate_call","type":{"kind":"boolean"}},{"name":"is_static_call","type":{"kind":"boolean"}}],"kind":"struct","path":"authwit::aztec::protocol_types::abis::call_context::CallContext"}},{"name":"args_hash","type":{"kind":"field"}},{"name":"returns_hash","type":{"kind":"field"}},{"name":"revert_code","type":{"kind":"integer","sign":"unsigned","width":8}},{"name":"start_gas_left","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":"authwit::aztec::protocol_types::abis::gas::Gas"}},{"name":"end_gas_left","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":"authwit::aztec::protocol_types::abis::gas::Gas"}}],"kind":"struct","path":"authwit::aztec::protocol_types::abis::public_call_stack_item_compressed::PublicCallStackItemCompressed"}},{"name":"counter","type":{"kind":"integer","sign":"unsigned","width":32}}],"kind":"struct","path":"authwit::aztec::protocol_types::abis::public_call_request::PublicCallRequest"}},{"name":"l2_to_l1_msgs","type":{"kind":"array","length":2,"type":{"fields":[{"name":"recipient","type":{"fields":[{"name":"inner","type":{"kind":"field"}}],"kind":"struct","path":"authwit::aztec::protocol_types::address::eth_address::EthAddress"}},{"name":"content","type":{"kind":"field"}},{"name":"counter","type":{"kind":"integer","sign":"unsigned","width":32}}],"kind":"struct","path":"authwit::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":"note_encrypted_logs_hashes","type":{"kind":"array","length":16,"type":{"fields":[{"name":"value","type":{"kind":"field"}},{"name":"counter","type":{"kind":"integer","sign":"unsigned","width":32}},{"name":"length","type":{"kind":"field"}},{"name":"note_hash_counter","type":{"kind":"integer","sign":"unsigned","width":32}}],"kind":"struct","path":"authwit::aztec::protocol_types::abis::log_hash::NoteLogHash"}}},{"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}},{"name":"length","type":{"kind":"field"}},{"name":"randomness","type":{"kind":"field"}}],"kind":"struct","path":"authwit::aztec::protocol_types::abis::log_hash::EncryptedLogHash"}}},{"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}},{"name":"length","type":{"kind":"field"}}],"kind":"struct","path":"authwit::aztec::protocol_types::abis::log_hash::LogHash"}}},{"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":"authwit::aztec::protocol_types::abis::append_only_tree_snapshot::AppendOnlyTreeSnapshot"}},{"name":"content_commitment","type":{"fields":[{"name":"num_txs","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":"authwit::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":"authwit::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":"authwit::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":"authwit::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":"authwit::aztec::protocol_types::abis::append_only_tree_snapshot::AppendOnlyTreeSnapshot"}}],"kind":"struct","path":"authwit::aztec::protocol_types::partial_state_reference::PartialStateReference"}}],"kind":"struct","path":"authwit::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":"slot_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":"authwit::aztec::protocol_types::address::eth_address::EthAddress"}},{"name":"fee_recipient","type":{"fields":[{"name":"inner","type":{"kind":"field"}}],"kind":"struct","path":"authwit::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":"authwit::aztec::protocol_types::abis::gas_fees::GasFees"}}],"kind":"struct","path":"authwit::aztec::protocol_types::abis::global_variables::GlobalVariables"}},{"name":"total_fees","type":{"kind":"field"}}],"kind":"struct","path":"authwit::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":"authwit::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":"authwit::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":"authwit::aztec::protocol_types::abis::gas_fees::GasFees"}},{"name":"inclusion_fee","type":{"kind":"field"}}],"kind":"struct","path":"authwit::aztec::protocol_types::abis::gas_settings::GasSettings"}}],"kind":"struct","path":"authwit::aztec::protocol_types::transaction::tx_context::TxContext"}}],"kind":"struct","path":"authwit::aztec::protocol_types::abis::private_circuit_public_inputs::PrivateCircuitPublicInputs"},"visibility":"public"}},"bytecode":"H4sIAAAAAAAA/+2dBXQU59fGN7sJEVxatCW4w250A21xd2gLtEUiGzyBkODu0hbq7u7u7kLdFWiLQ1vc5Xsu7Hy5mS5b2rzDv89p55zf2fvO7t793XHbmQjX8W6Fx+Xa6D4eRwBP8FV6xdv6Wa86jgzRr0SI75YK0a9MiH7lQvSrEKJfZdDG1q9miM/Fh+hXK0S/2iH61Q/Rr1HwVXdWu03wNdGbkpQUSE0I+BJ96d6EtAx/sjcpOSPF7/P7kv3JWQn+xMSAP8mfmpaRlupN8yUlBnzZyWmJ2d7j3aPuwlzeYnUJmU56Pva3PX0+ex9rnEYqVxkOR4JxA1dh3FDFjwU/Y33vcbSfAE+Cp9yF/a3OYxsG3uJ1vkYGcz3uNjdunjY2DYU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j6+TshOtU85/IN1PtvyXXDXd8Er00jUtV/qfAilp9f94bD/8aX1XSSq+pU+QNNS3LVxDQdD0ueh71jMAZVQ0pVk+osKbEwyetfo0sb2H+M/rKKnq8B0FZyuQtNVzHQVO13FTVdJxq2s6vc9ubnZF1QSm3023g+N/gIM/QcAz2Y+fZTufOb1suZhWfO4rHmaZv6h78DTYRU7XSV5F3CMMdjBiN/g6gAAfNdvv6x5XtR8+ii/KeabnUK1zCemP+YYB2r1f6LSp9VlagusqC14zbYA1bJgsdNdaD1NMetpil1PU9xVmzI4tPj1NIVX0xQz64DbNa+XNQ/LmsdlzdOy5s2y5tOjTP/UMXWeSZ9/MGcFfukK+NMVDI6u6ZfgZ7SvF7YPC9vHz9sfGjzTr3LOaN8saT+U4JQuSdZCMY9J2HxE1p++CtJOV3HTVfx0FZ6skk79DKiEEp5SWkmPtIpPImvdykW7/uXZmBL/gVJ6KTWoFEp06hHpRA3Wt5pvKlodFEPx78fX/ePT4bnK+VWf/jp+rVOAofj+z8//PgnC/wI=","brillig_names":["pack_arguments_array","call_private_function_internal","unpack_returns","pack_arguments","enqueue_public_function_call_internal"]},{"name":"consume","is_unconstrained":true,"custom_attributes":["aztec(public)"],"abi":{"error_types":{},"parameters":[{"name":"inputs","type":{"fields":[{"name":"calldata_length","type":{"kind":"field"}},{"name":"is_static_call","type":{"kind":"boolean"}}],"kind":"struct","path":"aztec::context::inputs::public_context_inputs::PublicContextInputs"},"visibility":"private"},{"name":"on_behalf_of","type":{"fields":[{"name":"inner","type":{"kind":"field"}}],"kind":"struct","path":"authwit::aztec::protocol_types::address::aztec_address::AztecAddress"},"visibility":"private"},{"name":"inner_hash","type":{"kind":"field"},"visibility":"private"}],"return_type":{"abi_type":{"kind":"field"},"visibility":"public"}},"bytecode":"H4sIAAAAAAAC/3VWvaskRRCv7p6Pnu7tmenZndndh6KiiTDv7p0e81ADkTvv/EDkUgPxXzAzUAw0EEFBBP8JUxExMBKDw8zD7ILD0MjkwED0V9Uz+/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7hsg1OS+AUJN7hlIAOhNpy5/GaPR1Rht27i33oEEgA/9Edn+RRMSAHqIW+oCdCeHdGlZqoRI2kYXoO+5oS4BDB5uqQsw0rilLsCw5Ja6g1VdTVd86QKMjm6pO1qqUnRHS1WKrq9URb5SFftKVewrVbGvVMW+UtV9lhq6ny5AqhKui67QxgAgKCkGANlHMQCIM4oBQELpG0SEa7P6BgjXZvUN0K/NkghQ7RUDgAKuGFiraGcoa0XqDGWt7pyhrJWSE5QMNmjpfiMpgw1Zuqt0iww2U6jYDjZRqNiONk/Y/7JZRpsn7Oum0eYJFd3R5gkV3dHmCRXd0eYJFV3xpTvat6+K7nDXtPXW+ZU03DVtfd3hUlVfd7hU1dXNw6Wqvu5wqaqvO1yq6uuOnKp2dMVVzMi+UlX2dadA9nWnQPY1V5V9zVUVX3NVxddcFcIqU7fU9TVXhbB81S11faUqhGWlbqnrK2YUXzEDYYWxW+r+oBCF5fqgdnmV2a4uhbx+hdzWF4dy3WmdWptb50ArEJ0eb1uXOq+5MT1MV63P/GKcv8Z5ec1UpWz5k3V+5i5/ts4f2spfldYtLnNhLV6sqrDYFvO2YbENectfwfkbNv+PlsqC4Sdwfgbnt16tNX7z1VrhN1+tFX771brPD15/G3j9bdj1NwXs+psCdv1NAbn+fp9+/M+HL48fPj59+joddPrfv55/fXn8/Pz648t///z7f6bG/wM=","brillig_names":["consume"],"assert_messages":{"224":"unauthorized","256":"Storage slot 0 not allowed. Storage slots must start from 1.","320":"Array index out of bounds","349":"attempt to add with overflow","439":"attempt to add with overflow","49":"Storage slot 0 not allowed. Storage slots must start from 1.","78":"rejecting all","480":"attempt to add with overflow","296":"Array index out of bounds","197":"Storage slot 0 not allowed. Storage slots must start from 1.","386":"Array index out of bounds","459":"Array index out of bounds","328":"Array index out of bounds","278":"Array index out of bounds","307":"attempt to add with overflow","336":"Array index out of bounds","240":"Storage slot 0 not allowed. Storage slots must start from 1.","368":"Array index out of bounds","397":"attempt to add with overflow","467":"Array index out of bounds","490":"Array index out of bounds","286":"attempt to add with overflow","501":"attempt to add with overflow","181":"Storage slot 0 not allowed. Storage slots must start from 1.","451":"Array index out of bounds"}},{"name":"is_consumable","is_unconstrained":true,"custom_attributes":["aztec(public)","aztec(view)"],"abi":{"error_types":{},"parameters":[{"name":"inputs","type":{"fields":[{"name":"calldata_length","type":{"kind":"field"}},{"name":"is_static_call","type":{"kind":"boolean"}}],"kind":"struct","path":"aztec::context::inputs::public_context_inputs::PublicContextInputs"},"visibility":"private"},{"name":"on_behalf_of","type":{"fields":[{"name":"inner","type":{"kind":"field"}}],"kind":"struct","path":"authwit::aztec::protocol_types::address::aztec_address::AztecAddress"},"visibility":"private"},{"name":"message_hash","type":{"kind":"field"},"visibility":"private"}],"return_type":{"abi_type":{"kind":"boolean"},"visibility":"public"}},"bytecode":"H4sIAAAAAAAC/z1SPU8cQQx98+EZz8chpQpFUqaIdAl7RXaVFg6OhuJKfgASBUKiR/xAfhXPsxwr2Wt77PfG9kwIzu8Q9BaYEGKmgv4GP6Vk/q5+Iule90eL7VeBp7iFhwiLRSL1NYT6BukvD88WEPVwY0UHS57gnP4BviEenJElH0kWyjyoAgomF5yZ6hksdfax0queltRppNhho+n7XSQqA2AOGqUTEqxINQrJoBVOtJPyF/pKGUInmxhbH2xmimewt9lXooTmaaU24oNo80XUP4k25OgxET6pEP4f5BPepVMzyVwvdJO5MtjMTBaU0Rt5lH3mLS4rQi6NWEe0La5np5x8yH5UFJnZyA9uodgOxl3KaQcMl0yV9Xhamp7OZmiekcMF8ZrlcFSp1/TfMpONzu4snUwSSX6/roabaxr4KOA12i4fuVbBensOg69EOC2xYhtUbvWMuhrEwwqxtlattcVpUA6UiniZOU/K+DMxg8oWb4tdWRzpoETfDaNsWFA0av0Op1WrPUL+xiOsq6xNEvBVK8vVChrpmqq5Mlyvqs3cQvayxcvOBSIa8cWC8/fz9w991RdfAwMAAA==","debug_symbols":"5ZvNbuJAEITfxWcO89c93bzKahVBApEly0RAVloh3n1tFv+wtjyKlFWm0xfAULa/4jBVbcuX4mW3fX99Kuv94VSsf1yK6vC8OZeHutm6XFfF9lhWVfn6NP66MO2LDTf96W1Tt5un8+Z4LtZmVezql+a92XdfVrti7cFdf64KCx+T48fkcU4eYoD7HiFG97DTaqJmG+9ixthrLeKM1kKHYpl6rQOaOy6ETszAPKiR59XdkY0ZkB3fbJIOm6zCpjM6bFodNp0Om16HzaDDJuiwiTps6mhBTkcLcjpakNfRgvwntCBrguvPMMKZNzo/LE11EDsl0OOf12I7mdheJnaQiQ0ysVEmdjrlib/Bgkk6bLIKm8HosGl12HQ6bHodNoMOm6DDJuqwqaMFBR0tKHxCC/o/VRwR70okPzomtdhgZGJbmdhOJnayRZChJDbCgG0eTjEzPjJ3ajQWB7XF2WETuvWh+UgP6hY/yMYH2fgoGz/KxifZ+CwaH41sfCsb38nGl526mP26T6HHJ5jg577ykBmusBv8Fz9+wcpDpsf3NoXvuaMPoykN/Q3eSoZ3kuG9GHjACTxIhkfB8JR9UVhc6yn3okC+T1oKcYKfe1Eg55bwQ/ZJywM+JdTsh0uKPvqJ2dyH+eVaQbmXugR+7sN8Aj/3YT6BL7tSc+7DfAI/94xO4Gef0cv42Wf0Mn7+Gb2ILzt1WXbqsuzUZdmpy7JTt7nVLpxfcu5em81fm2O52Va7+/PU+/f6efR49fn3299fGvEf","brillig_names":["is_consumable"],"assert_messages":{"88":"Array index out of bounds","16":"Function is_consumable can only be called statically","52":"Storage slot 0 not allowed. Storage slots must start from 1.","100":"attempt to add with overflow","36":"Storage slot 0 not allowed. Storage slots must start from 1."}}],"outputs":{"globals":{"storage":[{"fields":[{"name":"reject_all","value":{"fields":[{"name":"slot","value":{"kind":"integer","sign":false,"value":"0000000000000000000000000000000000000000000000000000000000000001"}}],"kind":"struct"}},{"name":"approved_actions","value":{"fields":[{"name":"slot","value":{"kind":"integer","sign":false,"value":"0000000000000000000000000000000000000000000000000000000000000002"}}],"kind":"struct"}}],"kind":"struct"}]},"structs":{"functions":[{"fields":[{"name":"parameters","type":{"fields":[{"name":"message_hash","type":{"kind":"field"}},{"name":"authorize","type":{"kind":"boolean"}}],"kind":"struct","path":"AuthRegistry::set_authorized_parameters"}}],"kind":"struct","path":"AuthRegistry::set_authorized_abi"},{"fields":[{"name":"parameters","type":{"fields":[{"name":"on_behalf_of","type":{"fields":[{"name":"inner","type":{"kind":"field"}}],"kind":"struct","path":"authwit::aztec::protocol_types::address::aztec_address::AztecAddress"}},{"name":"inner_hash","type":{"kind":"field"}}],"kind":"struct","path":"AuthRegistry::consume_parameters"}},{"name":"return_type","type":{"kind":"field"}}],"kind":"struct","path":"AuthRegistry::consume_abi"},{"fields":[{"name":"parameters","type":{"fields":[{"name":"approver","type":{"fields":[{"name":"inner","type":{"kind":"field"}}],"kind":"struct","path":"authwit::aztec::protocol_types::address::aztec_address::AztecAddress"}},{"name":"message_hash","type":{"kind":"field"}},{"name":"authorize","type":{"kind":"boolean"}}],"kind":"struct","path":"AuthRegistry::_set_authorized_parameters"}}],"kind":"struct","path":"AuthRegistry::_set_authorized_abi"},{"fields":[{"name":"parameters","type":{"fields":[{"name":"on_behalf_of","type":{"fields":[{"name":"inner","type":{"kind":"field"}}],"kind":"struct","path":"authwit::aztec::protocol_types::address::aztec_address::AztecAddress"}},{"name":"message_hash","type":{"kind":"field"}}],"kind":"struct","path":"AuthRegistry::is_consumable_parameters"}},{"name":"return_type","type":{"kind":"boolean"}}],"kind":"struct","path":"AuthRegistry::is_consumable_abi"},{"fields":[{"name":"parameters","type":{"fields":[{"name":"reject","type":{"kind":"boolean"}}],"kind":"struct","path":"AuthRegistry::set_reject_all_parameters"}}],"kind":"struct","path":"AuthRegistry::set_reject_all_abi"},{"fields":[{"name":"parameters","type":{"fields":[{"name":"approver","type":{"fields":[{"name":"inner","type":{"kind":"field"}}],"kind":"struct","path":"authwit::aztec::protocol_types::address::aztec_address::AztecAddress"}},{"name":"message_hash","type":{"kind":"field"}},{"name":"authorize","type":{"kind":"boolean"}}],"kind":"struct","path":"AuthRegistry::set_authorized_private_parameters"}}],"kind":"struct","path":"AuthRegistry::set_authorized_private_abi"},{"fields":[{"name":"parameters","type":{"fields":[{"name":"on_behalf_of","type":{"fields":[{"name":"inner","type":{"kind":"field"}}],"kind":"struct","path":"authwit::aztec::protocol_types::address::aztec_address::AztecAddress"}}],"kind":"struct","path":"AuthRegistry::is_reject_all_parameters"}},{"name":"return_type","type":{"kind":"boolean"}}],"kind":"struct","path":"AuthRegistry::is_reject_all_abi"}]}},"file_map":{"109":{"path":"/usr/src/noir-projects/aztec-nr/aztec/src/context/unconstrained_context.nr","source":"use dep::protocol_types::{address::AztecAddress, traits::Deserialize};\nuse crate::oracle::{execution::{get_chain_id, get_version, get_contract_address, get_block_number}, storage::storage_read};\n\nstruct UnconstrainedContext {\n block_number: u32,\n contract_address: AztecAddress,\n version: Field,\n chain_id: Field,\n}\n\nimpl UnconstrainedContext {\n unconstrained fn new() -> Self {\n // We could call these oracles on the getters instead of at creation, which makes sense given that they might\n // not even be accessed. However any performance gains are minimal, and we'd rather fail early if a user\n // incorrectly attempts to create an UnconstrainedContext in an environment in which these oracles are not\n // available.\n let block_number = get_block_number();\n let contract_address = get_contract_address();\n let chain_id = get_chain_id();\n let version = get_version();\n Self { block_number, contract_address, version, chain_id }\n }\n\n unconstrained fn at(contract_address: AztecAddress) -> Self {\n let block_number = get_block_number();\n let chain_id = get_chain_id();\n let version = get_version();\n Self { block_number, contract_address, version, chain_id }\n }\n\n unconstrained fn at_historical(contract_address: AztecAddress, block_number: u32) -> Self {\n let chain_id = get_chain_id();\n let version = get_version();\n Self { block_number, contract_address, version, chain_id }\n }\n\n fn block_number(self) -> u32 {\n self.block_number\n }\n\n fn this_address(self) -> AztecAddress {\n self.contract_address\n }\n\n fn version(self) -> Field {\n self.version\n }\n\n fn chain_id(self) -> Field {\n self.chain_id\n }\n\n unconstrained fn raw_storage_read<let N: u32>(self: Self, storage_slot: Field) -> [Field; N] {\n storage_read(self.this_address(), storage_slot, self.block_number())\n }\n\n unconstrained fn storage_read<T, let N: u32>(\n self,\n storage_slot: Field\n ) -> T where T: Deserialize<N> {\n T::deserialize(self.raw_storage_read(storage_slot))\n }\n}\n"},"110":{"path":"/usr/src/noir-projects/aztec-nr/aztec/src/context/packed_returns.nr","source":"use crate::{hash::hash_args_array, oracle::returns::unpack_returns};\nuse dep::protocol_types::traits::Deserialize;\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<let N: u32>(self) -> [Field; N] {\n let unpacked: [Field; N] = 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, let N: u32>(self) -> T where T: Deserialize<N> {\n let unpacked: [Field; N] = self.unpack();\n Deserialize::deserialize(unpacked)\n }\n}\n"},"114":{"path":"/usr/src/noir-projects/aztec-nr/aztec/src/context/call_interfaces.nr","source":"use dep::protocol_types::{\n abis::{function_selector::FunctionSelector, private_circuit_public_inputs::PrivateCircuitPublicInputs},\n address::AztecAddress, traits::Deserialize\n};\n\nuse crate::context::{\n private_context::PrivateContext, public_context::PublicContext, gas::GasOpts,\n inputs::{PrivateContextInputs, PublicContextInputs}\n};\n\nuse crate::oracle::arguments::pack_arguments;\nuse crate::hash::hash_args;\n\ntrait CallInterface<let N: u32, T, P, Env> {\n fn get_original(self) -> fn[Env](T) -> P;\n\n fn get_args(self) -> [Field] {\n self.args\n }\n\n fn get_selector(self) -> FunctionSelector {\n self.selector\n }\n\n fn get_name(self) -> str<N> {\n self.name\n }\n\n fn get_contract_address(self) -> AztecAddress {\n self.target_contract\n }\n\n fn get_is_static(self) -> bool {\n self.is_static\n }\n}\n\nimpl<let N: u32, T, P, Env> CallInterface<N, PrivateContextInputs, PrivateCircuitPublicInputs, Env> for PrivateCallInterface<N, T, Env> {\n fn get_original(self) -> fn[Env](PrivateContextInputs) -> PrivateCircuitPublicInputs {\n self.original\n }\n}\n\nstruct PrivateCallInterface<let N: u32, T, Env> {\n target_contract: AztecAddress,\n selector: FunctionSelector,\n name: str<N>,\n args_hash: Field,\n args: [Field],\n original: fn[Env](PrivateContextInputs) -> PrivateCircuitPublicInputs,\n is_static: bool\n}\n\nimpl<let N: u32, T, Env> PrivateCallInterface<N, T, Env> {\n pub fn call<let M: u32>(self, context: &mut PrivateContext) -> T where T: Deserialize<M> {\n assert(self.args_hash == pack_arguments(self.args));\n let returns = context.call_private_function_with_packed_args(\n self.target_contract,\n self.selector,\n self.args_hash,\n false,\n false\n );\n let unpacked: T = returns.unpack_into();\n unpacked\n }\n\n pub fn view<let M: u32>(self, context: &mut PrivateContext) -> T where T: Deserialize<M> {\n assert(self.args_hash == pack_arguments(self.args));\n let returns = context.call_private_function_with_packed_args(self.target_contract, self.selector, self.args_hash, true, false);\n returns.unpack_into()\n }\n\n pub fn delegate_call<let M: u32>(self, context: &mut PrivateContext) -> T where T: Deserialize<M> {\n assert(self.args_hash == pack_arguments(self.args));\n let returns = context.call_private_function_with_packed_args(self.target_contract, self.selector, self.args_hash, false, true);\n returns.unpack_into()\n }\n}\n\nimpl<let N: u32, T, P, Env> CallInterface<N, PrivateContextInputs, PrivateCircuitPublicInputs, Env> for PrivateVoidCallInterface<N, Env> {\n fn get_original(self) -> fn[Env](PrivateContextInputs) -> PrivateCircuitPublicInputs {\n self.original\n }\n}\n\nstruct PrivateVoidCallInterface<let N: u32, Env> {\n target_contract: AztecAddress,\n selector: FunctionSelector,\n name: str<N>,\n args_hash: Field,\n args: [Field],\n original: fn[Env](PrivateContextInputs) -> PrivateCircuitPublicInputs,\n is_static: bool\n}\n\nimpl<let N: u32, Env> PrivateVoidCallInterface<N, Env> {\n pub fn call(self, context: &mut PrivateContext) {\n assert(self.args_hash == pack_arguments(self.args));\n context.call_private_function_with_packed_args(\n self.target_contract,\n self.selector,\n self.args_hash,\n false,\n false\n ).assert_empty();\n }\n\n pub fn view(self, context: &mut PrivateContext) {\n assert(self.args_hash == pack_arguments(self.args));\n context.call_private_function_with_packed_args(self.target_contract, self.selector, self.args_hash, true, false).assert_empty();\n }\n\n pub fn delegate_call(self, context: &mut PrivateContext) {\n assert(self.args_hash == pack_arguments(self.args));\n context.call_private_function_with_packed_args(self.target_contract, self.selector, self.args_hash, false, true).assert_empty();\n }\n}\n\nimpl<let N: u32, T, P, Env> CallInterface<N, PrivateContextInputs, PrivateCircuitPublicInputs, Env> for PrivateStaticCallInterface<N, T, Env> {\n fn get_original(self) -> fn[Env](PrivateContextInputs) -> PrivateCircuitPublicInputs {\n self.original\n }\n}\n\nstruct PrivateStaticCallInterface<let N: u32, T, Env> {\n target_contract: AztecAddress,\n selector: FunctionSelector,\n name: str<N>,\n args_hash: Field,\n args: [Field],\n original: fn[Env](PrivateContextInputs) -> PrivateCircuitPublicInputs,\n is_static: bool\n}\n\nimpl<let N: u32, T, Env> PrivateStaticCallInterface<N, T, Env> {\n pub fn view<let M: u32>(self, context: &mut PrivateContext) -> T where T: Deserialize<M> {\n assert(self.args_hash == pack_arguments(self.args));\n let returns = context.call_private_function_with_packed_args(self.target_contract, self.selector, self.args_hash, true, false);\n returns.unpack_into()\n }\n}\n\nimpl<let N: u32, T, P, Env> CallInterface<N, PrivateContextInputs, PrivateCircuitPublicInputs, Env> for PrivateStaticVoidCallInterface<N, Env> {\n fn get_original(self) -> fn[Env](PrivateContextInputs) -> PrivateCircuitPublicInputs {\n self.original\n }\n}\n\nstruct PrivateStaticVoidCallInterface<let N: u32, Env> {\n target_contract: AztecAddress,\n selector: FunctionSelector,\n name: str<N>,\n args_hash: Field,\n args: [Field],\n original: fn[Env](PrivateContextInputs) -> PrivateCircuitPublicInputs,\n is_static: bool\n}\n\nimpl<let N: u32, Env> PrivateStaticVoidCallInterface<N, Env> {\n pub fn view(self, context: &mut PrivateContext) {\n assert(self.args_hash == pack_arguments(self.args));\n context.call_private_function_with_packed_args(self.target_contract, self.selector, self.args_hash, true, false).assert_empty();\n }\n}\n\nimpl<let N: u32, T, P, Env> CallInterface<N, PublicContextInputs, T, Env> for PublicCallInterface<N, T, Env> {\n fn get_original(self) -> fn[Env](PublicContextInputs) -> T {\n self.original\n }\n}\n\nstruct PublicCallInterface<let N: u32, T, Env> {\n target_contract: AztecAddress,\n selector: FunctionSelector,\n name: str<N>,\n args: [Field],\n gas_opts: GasOpts,\n original: fn[Env](PublicContextInputs) -> T,\n is_static: bool\n}\n\nimpl<let N: u32, T, Env> PublicCallInterface<N, T, Env> {\n pub fn with_gas(self: &mut Self, gas_opts: GasOpts) -> &mut Self {\n self.gas_opts = gas_opts;\n self\n }\n\n pub fn call<let M: u32>(self, context: &mut PublicContext) -> T where T: Deserialize<M> {\n let returns = context.call_public_function(self.target_contract, self.selector, self.args, self.gas_opts);\n returns.deserialize_into()\n }\n\n pub fn view<let M: u32>(self, context: &mut PublicContext) -> T where T: Deserialize<M> {\n let returns = context.static_call_public_function(self.target_contract, self.selector, self.args, self.gas_opts);\n returns.deserialize_into()\n }\n\n pub fn delegate_call<let M: u32>(self, context: &mut PublicContext) -> T where T: Deserialize<M> {\n let returns = context.delegate_call_public_function(self.target_contract, self.selector, self.args);\n returns.deserialize_into()\n }\n\n pub fn enqueue(self, context: &mut PrivateContext) {\n let args_hash = hash_args(self.args);\n assert(args_hash == pack_arguments(self.args));\n context.call_public_function_with_packed_args(\n self.target_contract,\n self.selector,\n args_hash,\n /*static=*/ false,\n /*delegate=*/ false\n )\n }\n\n pub fn enqueue_view(self, context: &mut PrivateContext) {\n let args_hash = hash_args(self.args);\n assert(args_hash == pack_arguments(self.args));\n context.call_public_function_with_packed_args(\n self.target_contract,\n self.selector,\n args_hash,\n /*static=*/ true,\n /*delegate=*/ false\n )\n }\n\n pub fn delegate_enqueue(self, context: &mut PrivateContext) {\n let args_hash = hash_args(self.args);\n assert(args_hash == pack_arguments(self.args));\n context.call_public_function_with_packed_args(\n self.target_contract,\n self.selector,\n args_hash,\n /*static=*/ false,\n /*delegate=*/ true\n )\n }\n}\n\nimpl<let N: u32, T, P, Env> CallInterface<N, PublicContextInputs, (), Env> for PublicVoidCallInterface<N, Env> {\n fn get_original(self) -> fn[Env](PublicContextInputs) -> () {\n self.original\n }\n}\n\nstruct PublicVoidCallInterface<let N: u32, Env> {\n target_contract: AztecAddress,\n selector: FunctionSelector,\n name: str<N>,\n args: [Field],\n original: fn[Env](PublicContextInputs) -> (),\n is_static: bool,\n gas_opts: GasOpts\n}\n\nimpl<let N: u32, Env> PublicVoidCallInterface<N, Env> {\n pub fn with_gas(self: &mut Self, gas_opts: GasOpts) -> &mut Self {\n self.gas_opts = gas_opts;\n self\n }\n\n pub fn call(self, context: &mut PublicContext) {\n let returns = context.call_public_function(self.target_contract, self.selector, self.args, self.gas_opts);\n returns.assert_empty()\n }\n\n pub fn view(self, context: &mut PublicContext) {\n let returns = context.static_call_public_function(self.target_contract, self.selector, self.args, self.gas_opts);\n returns.assert_empty()\n }\n\n pub fn delegate_call(self, context: &mut PublicContext) {\n let returns = context.delegate_call_public_function(self.target_contract, self.selector, self.args);\n returns.assert_empty()\n }\n\n pub fn enqueue(self, context: &mut PrivateContext) {\n let args_hash = hash_args(self.args);\n assert(args_hash == pack_arguments(self.args));\n context.call_public_function_with_packed_args(\n self.target_contract,\n self.selector,\n args_hash,\n /*static=*/ false,\n /*delegate=*/ false\n )\n }\n\n pub fn enqueue_view(self, context: &mut PrivateContext) {\n let args_hash = hash_args(self.args);\n assert(args_hash == pack_arguments(self.args));\n context.call_public_function_with_packed_args(\n self.target_contract,\n self.selector,\n args_hash,\n /*static=*/ true,\n /*delegate=*/ false\n )\n }\n\n pub fn delegate_enqueue(self, context: &mut PrivateContext) {\n let args_hash = hash_args(self.args);\n assert(args_hash == pack_arguments(self.args));\n context.call_public_function_with_packed_args(\n self.target_contract,\n self.selector,\n args_hash,\n /*static=*/ false,\n /*delegate=*/ true\n )\n }\n}\n\nimpl<let N: u32, T, P, Env> CallInterface<N, PublicContextInputs, T, Env> for PublicStaticCallInterface<N, T, Env> {\n fn get_original(self) -> fn[Env](PublicContextInputs) -> T {\n self.original\n }\n}\n\nstruct PublicStaticCallInterface<let N: u32, T, Env> {\n target_contract: AztecAddress,\n selector: FunctionSelector,\n name: str<N>,\n args: [Field],\n original: fn[Env](PublicContextInputs) -> T,\n is_static: bool,\n gas_opts: GasOpts\n}\n\nimpl<let N: u32, T, Env> PublicStaticCallInterface<N, T, Env> {\n pub fn with_gas(self: &mut Self, gas_opts: GasOpts) -> &mut Self {\n self.gas_opts = gas_opts;\n self\n }\n\n pub fn view<let M: u32>(self, context: &mut PublicContext) -> T where T: Deserialize<M> {\n let returns = context.static_call_public_function(self.target_contract, self.selector, self.args, self.gas_opts);\n let unpacked: T = returns.deserialize_into();\n unpacked\n }\n\n pub fn enqueue_view(self, context: &mut PrivateContext) {\n let args_hash = hash_args(self.args);\n assert(args_hash == pack_arguments(self.args));\n context.call_public_function_with_packed_args(\n self.target_contract,\n self.selector,\n args_hash,\n /*static=*/ true,\n /*delegate=*/ false\n )\n }\n}\n\nimpl<let N: u32, T, P, Env> CallInterface<N, PublicContextInputs, (), Env> for PublicStaticVoidCallInterface<N, Env> {\n fn get_original(self) -> fn[Env](PublicContextInputs) -> () {\n self.original\n }\n}\n\nstruct PublicStaticVoidCallInterface<let N: u32, Env> {\n target_contract: AztecAddress,\n selector: FunctionSelector,\n name: str<N>,\n args: [Field],\n original: fn[Env](PublicContextInputs) -> (),\n is_static: bool,\n gas_opts: GasOpts\n}\n\nimpl<let N: u32, Env> PublicStaticVoidCallInterface<N, Env> {\n pub fn with_gas(self: &mut Self, gas_opts: GasOpts) -> &mut Self {\n self.gas_opts = gas_opts;\n self\n }\n\n pub fn view(self, context: &mut PublicContext) {\n let returns = context.static_call_public_function(self.target_contract, self.selector, self.args, self.gas_opts);\n returns.assert_empty()\n }\n\n pub fn enqueue_view(self, context: &mut PrivateContext) {\n let args_hash = hash_args(self.args);\n assert(args_hash == pack_arguments(self.args));\n context.call_public_function_with_packed_args(\n self.target_contract,\n self.selector,\n args_hash,\n /*static=*/ true,\n /*delegate=*/ false\n )\n }\n}\n"},"115":{"path":"/usr/src/noir-projects/aztec-nr/aztec/src/context/private_context.nr","source":"use crate::{\n context::{inputs::PrivateContextInputs, packed_returns::PackedReturns},\n messaging::process_l1_to_l2_message, hash::{hash_args_array, ArgsHasher},\n keys::constants::{NULLIFIER_INDEX, OUTGOING_INDEX, NUM_KEY_TYPES, sk_generators},\n oracle::{\n key_validation_request::get_key_validation_request, arguments, returns::pack_returns,\n call_private_function::call_private_function_internal, header::get_header_at,\n logs::{emit_encrypted_note_log, emit_encrypted_event_log},\n enqueue_public_function_call::{\n enqueue_public_function_call_internal, notify_set_min_revertible_side_effect_counter,\n set_public_teardown_function_call_internal\n}\n}\n};\nuse dep::protocol_types::{\n abis::{\n call_context::CallContext, function_selector::FunctionSelector, gas::Gas,\n max_block_number::MaxBlockNumber,\n validation_requests::{KeyValidationRequest, KeyValidationRequestAndGenerator},\n private_call_request::PrivateCallRequest, private_circuit_public_inputs::PrivateCircuitPublicInputs,\n public_call_request::PublicCallRequest,\n public_call_stack_item_compressed::PublicCallStackItemCompressed, read_request::ReadRequest,\n note_hash::NoteHash, nullifier::Nullifier, log_hash::{LogHash, NoteLogHash, EncryptedLogHash}\n},\n address::{AztecAddress, EthAddress},\n constants::{\n MAX_NOTE_HASHES_PER_CALL, MAX_L2_TO_L1_MSGS_PER_CALL, MAX_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_KEY_VALIDATION_REQUESTS_PER_CALL, MAX_ENCRYPTED_LOGS_PER_CALL, MAX_UNENCRYPTED_LOGS_PER_CALL,\n MAX_NOTE_ENCRYPTED_LOGS_PER_CALL\n},\n header::Header, messaging::l2_to_l1_message::L2ToL1Message, utils::reader::Reader, traits::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 is_fee_payer: bool,\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 key_validation_requests_and_generators: BoundedVec<KeyValidationRequestAndGenerator, MAX_KEY_VALIDATION_REQUESTS_PER_CALL>,\n\n note_hashes: BoundedVec<NoteHash, MAX_NOTE_HASHES_PER_CALL>,\n nullifiers: BoundedVec<Nullifier, MAX_NULLIFIERS_PER_CALL>,\n\n private_call_requests : BoundedVec<PrivateCallRequest, MAX_PRIVATE_CALL_STACK_LENGTH_PER_CALL>,\n public_call_requests : BoundedVec<PublicCallRequest, MAX_PUBLIC_CALL_STACK_LENGTH_PER_CALL>,\n public_teardown_call_request: PublicCallRequest,\n l2_to_l1_msgs : BoundedVec<L2ToL1Message, MAX_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 note_encrypted_logs_hashes: BoundedVec<NoteLogHash, MAX_NOTE_ENCRYPTED_LOGS_PER_CALL>,\n encrypted_logs_hashes: BoundedVec<EncryptedLogHash, MAX_ENCRYPTED_LOGS_PER_CALL>,\n unencrypted_logs_hashes: BoundedVec<LogHash, MAX_UNENCRYPTED_LOGS_PER_CALL>,\n\n // Contains the last key validation request for each key type. This is used to cache the last request and avoid\n // fetching the same request multiple times.\n // The index of the array corresponds to the key type (0 nullifier, 1 incoming, 2 outgoing, 3 tagging).\n last_key_validation_requests: [Option<KeyValidationRequest>; NUM_KEY_TYPES],\n}\n\nimpl PrivateContext {\n pub fn new(inputs: PrivateContextInputs, args_hash: Field) -> PrivateContext {\n PrivateContext {\n inputs,\n side_effect_counter: inputs.start_side_effect_counter + 1,\n min_revertible_side_effect_counter: 0,\n is_fee_payer: false,\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 key_validation_requests_and_generators: BoundedVec::new(),\n note_hashes: BoundedVec::new(),\n nullifiers: BoundedVec::new(),\n historical_header: inputs.historical_header,\n private_call_requests: BoundedVec::new(),\n public_call_requests: BoundedVec::new(),\n public_teardown_call_request: PublicCallRequest::empty(),\n l2_to_l1_msgs: BoundedVec::new(),\n note_encrypted_logs_hashes: BoundedVec::new(),\n encrypted_logs_hashes: BoundedVec::new(),\n unencrypted_logs_hashes: BoundedVec::new(),\n last_key_validation_requests: [Option::none(); NUM_KEY_TYPES]\n }\n }\n\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_note_hash(&mut self, note_hash: Field) {\n self.note_hashes.push(NoteHash { value: note_hash, counter: self.next_counter() });\n }\n\n fn push_nullifier(&mut self, nullifier: Field) {\n self.nullifiers.push(Nullifier { value: nullifier, note_hash: 0, counter: self.next_counter() });\n }\n\n fn push_nullifier_for_note_hash(&mut self, nullifier: Field, nullified_note_hash: Field) {\n self.nullifiers.push(Nullifier { value: nullifier, note_hash: nullified_note_hash, counter: self.next_counter() });\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 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 is_fee_payer: self.is_fee_payer,\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 key_validation_requests_and_generators: self.key_validation_requests_and_generators.storage,\n note_hashes: self.note_hashes.storage,\n nullifiers: self.nullifiers.storage,\n private_call_requests: self.private_call_requests.storage,\n public_call_requests: self.public_call_requests.storage,\n public_teardown_call_request: self.public_teardown_call_request,\n l2_to_l1_msgs: self.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 note_encrypted_logs_hashes: self.note_encrypted_logs_hashes.storage,\n encrypted_logs_hashes: self.encrypted_logs_hashes.storage,\n unencrypted_logs_hashes: self.unencrypted_logs_hashes.storage,\n historical_header: self.historical_header,\n tx_context: self.inputs.tx_context\n }\n }\n\n pub fn set_as_fee_payer(&mut self) {\n dep::protocol_types::debug_log::debug_log_format(\"Setting {0} as fee payer\", [self.this_address().to_field()]);\n self.is_fee_payer = true;\n }\n\n pub fn end_setup(&mut self) {\n // dep::protocol_types::debug_log::debug_log_format(\n // \"Ending setup at counter {0}\",\n // [self.side_effect_counter as Field]\n // );\n self.min_revertible_side_effect_counter = self.side_effect_counter;\n notify_set_min_revertible_side_effect_counter(self.min_revertible_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.next_counter() };\n self.note_hash_read_requests.push(side_effect);\n }\n\n pub fn push_nullifier_read_request(&mut self, nullifier: Field) {\n let request = ReadRequest { value: nullifier, counter: self.next_counter() };\n self.nullifier_read_requests.push(request);\n }\n\n pub fn request_nsk_app(&mut self, npk_m_hash: Field) -> Field {\n self.request_sk_app(npk_m_hash, NULLIFIER_INDEX)\n }\n\n pub fn request_ovsk_app(&mut self, ovpk_m_hash: Field) -> Field {\n self.request_sk_app(ovpk_m_hash, OUTGOING_INDEX)\n }\n\n fn request_sk_app(&mut self, pk_m_hash: Field, key_index: Field) -> Field {\n let cached_request = self.last_key_validation_requests[key_index].unwrap_or(KeyValidationRequest::empty());\n\n if cached_request.pk_m.hash() == pk_m_hash {\n // We get a match so the cached request is the latest one\n cached_request.sk_app\n } else {\n // We didn't get a match meaning the cached result is stale. We fetch new values from oracle and instruct\n // protocol circuits to validate them by storing the validation request in context.\n let request = get_key_validation_request(pk_m_hash, key_index);\n let request_and_generator = KeyValidationRequestAndGenerator { request, sk_app_generator: sk_generators[key_index] };\n // We constrain that the pk_m_hash matches the one in the request (otherwise we could get an arbitrary\n // valid key request and not the one corresponding to pk_m_hash).\n assert(request.pk_m.hash() == pk_m_hash);\n self.key_validation_requests_and_generators.push(request_and_generator);\n self.last_key_validation_requests[key_index] = Option::some(request);\n request.sk_app\n }\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, counter: self.next_counter() };\n self.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_nullifier(nullifier)\n }\n // docs:end:consume_l1_to_l2_message\n\n // NB: A randomness value of 0 signals that the kernels should not mask the contract address\n // used in siloing later on e.g. 'handshaking' contract w/ known address.\n pub fn emit_raw_event_log_with_masked_address<let M: u32>(\n &mut self,\n randomness: Field,\n log: [u8; M],\n log_hash: Field\n ) {\n let counter = self.next_counter();\n let contract_address = self.this_address();\n let len = log.len() as Field + 4;\n let side_effect = EncryptedLogHash { value: log_hash, counter, length: len, randomness };\n self.encrypted_logs_hashes.push(side_effect);\n\n emit_encrypted_event_log(contract_address, randomness, log, counter);\n }\n\n pub fn emit_raw_note_log<let M: u32>(&mut self, note_hash_counter: u32, log: [u8; M], log_hash: Field) {\n let counter = self.next_counter();\n let len = log.len() as Field + 4;\n let side_effect = NoteLogHash { value: log_hash, counter, length: len, note_hash_counter };\n self.note_encrypted_logs_hashes.push(side_effect);\n\n emit_encrypted_note_log(note_hash_counter, log, counter);\n }\n\n pub fn call_private_function<let ARGS_COUNT: u32>(\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<let ARGS_COUNT: u32>(\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<let ARGS_COUNT: u32>(\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(\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(\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(\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(\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 start_side_effect_counter = self.side_effect_counter;\n let (end_side_effect_counter, returns_hash) = call_private_function_internal(\n contract_address,\n function_selector,\n args_hash,\n start_side_effect_counter,\n is_static_call,\n is_delegate_call\n );\n\n self.side_effect_counter = 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 let call_context = self.generate_call_context(\n contract_address,\n function_selector,\n is_static_call,\n is_delegate_call\n );\n\n self.private_call_requests.push(\n PrivateCallRequest {\n contract_address,\n call_context,\n args_hash,\n returns_hash,\n start_side_effect_counter,\n end_side_effect_counter\n }\n );\n\n PackedReturns::new(returns_hash)\n }\n\n pub fn call_public_function<let ARGS_COUNT: u32>(\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<let ARGS_COUNT: u32>(\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<let ARGS_COUNT: u32>(\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 counter = self.next_counter();\n\n let mut is_static_call = is_static_call | self.inputs.call_context.is_static_call;\n enqueue_public_function_call_internal(\n contract_address,\n function_selector,\n args_hash,\n counter,\n is_static_call,\n is_delegate_call\n );\n\n let call_context = self.generate_call_context(\n contract_address,\n function_selector,\n is_static_call,\n is_delegate_call\n );\n\n let item = PublicCallStackItemCompressed {\n contract_address,\n call_context,\n args_hash,\n returns_hash: 0,\n revert_code: 0,\n start_gas_left: Gas::empty(),\n end_gas_left: Gas::empty()\n };\n\n let call_request = PublicCallRequest { item, counter };\n self.public_call_requests.push(call_request);\n }\n\n pub fn set_public_teardown_function<let ARGS_COUNT: u32>(\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(\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 counter = self.next_counter();\n\n let mut is_static_call = is_static_call | self.inputs.call_context.is_static_call;\n set_public_teardown_function_call_internal(\n contract_address,\n function_selector,\n args_hash,\n counter,\n is_static_call,\n is_delegate_call\n );\n\n let call_context = self.generate_call_context(\n contract_address,\n function_selector,\n is_static_call,\n is_delegate_call\n );\n\n let item = PublicCallStackItemCompressed {\n contract_address,\n call_context,\n args_hash,\n returns_hash: 0,\n revert_code: 0,\n start_gas_left: Gas::empty(),\n end_gas_left: Gas::empty()\n };\n\n self.public_teardown_call_request = PublicCallRequest {\n item,\n counter,\n };\n }\n\n fn generate_call_context(\n self,\n contract_address: AztecAddress,\n function_selector: FunctionSelector,\n is_static_call: bool,\n is_delegate_call: bool\n ) -> CallContext {\n let msg_sender = if is_delegate_call {\n self.msg_sender()\n } else {\n self.this_address()\n };\n let storage_contract_address = if is_delegate_call {\n self.this_address()\n } else {\n contract_address\n };\n CallContext { msg_sender, storage_contract_address, function_selector, is_static_call, is_delegate_call }\n }\n\n fn next_counter(&mut self) -> u32 {\n let counter = self.side_effect_counter;\n self.side_effect_counter += 1;\n counter\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 is_fee_payer: false,\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 key_validation_requests_and_generators: BoundedVec::new(),\n note_hashes: BoundedVec::new(),\n nullifiers: BoundedVec::new(),\n private_call_requests: BoundedVec::new(),\n public_call_requests: BoundedVec::new(),\n public_teardown_call_request: PublicCallRequest::empty(),\n l2_to_l1_msgs: BoundedVec::new(),\n historical_header: Header::empty(),\n note_encrypted_logs_hashes: BoundedVec::new(),\n encrypted_logs_hashes: BoundedVec::new(),\n unencrypted_logs_hashes: BoundedVec::new(),\n last_key_validation_requests: [Option::none(); NUM_KEY_TYPES]\n }\n }\n}\n"},"116":{"path":"/usr/src/noir-projects/aztec-nr/aztec/src/context/public_context.nr","source":"use crate::hash::{compute_secret_hash, compute_message_hash, compute_message_nullifier};\nuse dep::protocol_types::address::{AztecAddress, EthAddress};\nuse dep::protocol_types::constants::MAX_FIELD_VALUE;\nuse dep::protocol_types::traits::{Serialize, Deserialize, Empty};\nuse dep::protocol_types::abis::function_selector::FunctionSelector;\nuse crate::context::inputs::public_context_inputs::PublicContextInputs;\nuse crate::context::gas::GasOpts;\nuse crate::hash::ArgsHasher;\n\nstruct PublicContext {\n inputs: PublicContextInputs,\n args_hash: Option<Field>\n}\n\nimpl PublicContext {\n pub fn new(inputs: PublicContextInputs) -> Self {\n PublicContext { inputs, args_hash: Option::none() }\n }\n\n pub fn emit_unencrypted_log<T, let N: u32>(_self: &mut Self, log: T) where T: Serialize<N> {\n emit_unencrypted_log(Serialize::serialize(log).as_slice());\n }\n\n pub fn note_hash_exists(_self: Self, note_hash: Field, leaf_index: Field) -> bool {\n note_hash_exists(note_hash, leaf_index) == 1\n }\n\n pub fn l1_to_l2_msg_exists(_self: Self, msg_hash: Field, msg_leaf_index: Field) -> bool {\n l1_to_l2_msg_exists(msg_hash, msg_leaf_index) == 1\n }\n\n fn nullifier_exists(_self: Self, unsiloed_nullifier: Field, address: AztecAddress) -> bool {\n nullifier_exists(unsiloed_nullifier, address.to_field()) == 1\n }\n\n fn consume_l1_to_l2_message(\n &mut self,\n content: Field,\n secret: Field,\n sender: EthAddress,\n leaf_index: Field\n ) {\n let secret_hash = compute_secret_hash(secret);\n let message_hash = compute_message_hash(\n sender,\n self.chain_id(),\n /*recipient=*/ self.this_address(),\n self.version(),\n content,\n secret_hash\n );\n let nullifier = compute_message_nullifier(message_hash, secret, leaf_index);\n\n assert(\n !self.nullifier_exists(nullifier, self.this_address()), \"L1-to-L2 message is already nullified\"\n );\n assert(\n self.l1_to_l2_msg_exists(message_hash, leaf_index), \"Tried to consume nonexistent L1-to-L2 message\"\n );\n\n self.push_nullifier(nullifier);\n }\n\n fn message_portal(_self: &mut Self, recipient: EthAddress, content: Field) {\n send_l2_to_l1_msg(recipient, content);\n }\n\n fn call_public_function<let RETURNS_COUNT: u32>(\n _self: &mut Self,\n contract_address: AztecAddress,\n function_selector: FunctionSelector,\n args: [Field],\n gas_opts: GasOpts\n ) -> FunctionReturns<RETURNS_COUNT> {\n let results = call(\n gas_for_call(gas_opts),\n contract_address,\n args,\n function_selector.to_field()\n );\n let data_to_return: [Field; RETURNS_COUNT] = results.0;\n let success: u8 = results.1;\n assert(success == 1, \"Nested call failed!\");\n\n FunctionReturns::new(data_to_return)\n }\n\n fn static_call_public_function<let RETURNS_COUNT: u32>(\n _self: &mut Self,\n contract_address: AztecAddress,\n function_selector: FunctionSelector,\n args: [Field],\n gas_opts: GasOpts\n ) -> FunctionReturns<RETURNS_COUNT> {\n let (data_to_return, success): ([Field; RETURNS_COUNT], u8) = call_static(\n gas_for_call(gas_opts),\n contract_address,\n args,\n function_selector.to_field()\n );\n\n assert(success == 1, \"Nested static call failed!\");\n FunctionReturns::new(data_to_return)\n }\n\n fn delegate_call_public_function<let RETURNS_COUNT: u32>(\n _self: &mut Self,\n _contract_address: AztecAddress,\n _function_selector: FunctionSelector,\n _args: [Field]\n ) -> FunctionReturns<RETURNS_COUNT> {\n assert(false, \"'delegate_call_public_function' not implemented!\");\n FunctionReturns::new([0; RETURNS_COUNT])\n }\n\n fn push_note_hash(_self: &mut Self, note_hash: Field) {\n emit_note_hash(note_hash);\n }\n fn push_nullifier(_self: &mut Self, nullifier: Field) {\n emit_nullifier(nullifier);\n }\n\n fn this_address(_self: Self) -> AztecAddress {\n address()\n }\n pub fn storage_address(_self: Self) -> AztecAddress {\n storage_address()\n }\n fn msg_sender(_self: Self) -> AztecAddress {\n sender()\n }\n fn selector(_self: Self) -> FunctionSelector {\n FunctionSelector::from_u32(function_selector())\n }\n fn get_args_hash(mut self) -> Field {\n if !self.args_hash.is_some() {\n let mut hasher = ArgsHasher::new();\n\n // TODO: this should be replaced with the compile-time calldata size.\n for i in 0..self.inputs.calldata_length as u32 {\n let argn: [Field; 1] = calldata_copy((2 + i) as u32, 1);\n hasher.add(argn[0]);\n }\n\n self.args_hash = Option::some(hasher.hash());\n }\n\n self.args_hash.unwrap()\n }\n fn transaction_fee(_self: Self) -> Field {\n transaction_fee()\n }\n\n fn chain_id(_self: Self) -> Field {\n chain_id()\n }\n fn version(_self: Self) -> Field {\n version()\n }\n fn block_number(_self: Self) -> Field {\n block_number()\n }\n fn timestamp(_self: Self) -> u64 {\n timestamp()\n }\n pub fn fee_per_l2_gas(_self: Self) -> Field {\n fee_per_l2_gas()\n }\n pub fn fee_per_da_gas(_self: Self) -> Field {\n fee_per_da_gas()\n }\n\n fn l2_gas_left(_self: Self) -> Field {\n l2_gas_left()\n }\n fn da_gas_left(_self: Self) -> Field {\n da_gas_left()\n }\n\n fn raw_storage_read<let N: u32>(_self: Self, storage_slot: Field) -> [Field; N] {\n let mut out = [0; N];\n for i in 0..N {\n out[i] = storage_read(storage_slot + i as Field);\n }\n out\n }\n\n fn storage_read<T, let N: u32>(self, storage_slot: Field) -> T where T: Deserialize<N> {\n T::deserialize(self.raw_storage_read(storage_slot))\n }\n\n fn raw_storage_write<let N: u32>(_self: Self, storage_slot: Field, values: [Field; N]) {\n for i in 0..N {\n storage_write(storage_slot + i as Field, values[i]);\n }\n }\n\n fn storage_write<T, let N: u32>(self, storage_slot: Field, value: T) where T: Serialize<N> {\n self.raw_storage_write(storage_slot, value.serialize());\n }\n}\n\n// Helper functions\nfn gas_for_call(user_gas: GasOpts) -> [Field; 2] {\n // It's ok to use the max possible gas here, because the gas will be\n // capped by the gas left in the (STATIC)CALL instruction.\n [\n user_gas.l2_gas.unwrap_or(MAX_FIELD_VALUE),\n user_gas.da_gas.unwrap_or(MAX_FIELD_VALUE)\n ]\n}\n\n// Unconstrained opcode wrappers (do not use directly).\n// TODO(https://github.com/AztecProtocol/aztec-packages/issues/6420): reconsider.\nunconstrained fn address() -> AztecAddress {\n address_opcode()\n}\nunconstrained fn storage_address() -> AztecAddress {\n storage_address_opcode()\n}\nunconstrained fn sender() -> AztecAddress {\n sender_opcode()\n}\nunconstrained fn portal() -> EthAddress {\n portal_opcode()\n}\nunconstrained fn function_selector() -> u32 {\n function_selector_opcode()\n}\nunconstrained fn transaction_fee() -> Field {\n transaction_fee_opcode()\n}\nunconstrained fn chain_id() -> Field {\n chain_id_opcode()\n}\nunconstrained fn version() -> Field {\n version_opcode()\n}\nunconstrained fn block_number() -> Field {\n block_number_opcode()\n}\nunconstrained fn timestamp() -> u64 {\n timestamp_opcode()\n}\nunconstrained fn fee_per_l2_gas() -> Field {\n fee_per_l2_gas_opcode()\n}\nunconstrained fn fee_per_da_gas() -> Field {\n fee_per_da_gas_opcode()\n}\nunconstrained fn l2_gas_left() -> Field {\n l2_gas_left_opcode()\n}\nunconstrained fn da_gas_left() -> Field {\n da_gas_left_opcode()\n}\nunconstrained fn note_hash_exists(note_hash: Field, leaf_index: Field) -> u8 {\n note_hash_exists_opcode(note_hash, leaf_index)\n}\nunconstrained fn emit_note_hash(note_hash: Field) {\n emit_note_hash_opcode(note_hash)\n}\nunconstrained fn nullifier_exists(nullifier: Field, address: Field) -> u8 {\n nullifier_exists_opcode(nullifier, address)\n}\nunconstrained fn emit_nullifier(nullifier: Field) {\n emit_nullifier_opcode(nullifier)\n}\nunconstrained fn emit_unencrypted_log(message: [Field]) {\n emit_unencrypted_log_opcode(message)\n}\nunconstrained fn l1_to_l2_msg_exists(msg_hash: Field, msg_leaf_index: Field) -> u8 {\n l1_to_l2_msg_exists_opcode(msg_hash, msg_leaf_index)\n}\nunconstrained fn send_l2_to_l1_msg(recipient: EthAddress, content: Field) {\n send_l2_to_l1_msg_opcode(recipient, content)\n}\nunconstrained fn call<let RET_SIZE: u32>(\n gas: [Field; 2],\n address: AztecAddress,\n args: [Field],\n function_selector: Field\n) -> ([Field; RET_SIZE], u8) {\n call_opcode(gas, address, args, function_selector)\n}\nunconstrained fn call_static<let RET_SIZE: u32>(\n gas: [Field; 2],\n address: AztecAddress,\n args: [Field],\n function_selector: Field\n) -> ([Field; RET_SIZE], u8) {\n call_static_opcode(gas, address, args, function_selector)\n}\n\nunconstrained fn calldata_copy<let N: u32>(cdoffset: u32, copy_size: u32) -> [Field; N] {\n calldata_copy_opcode(cdoffset, copy_size)\n}\n\nunconstrained fn storage_read(storage_slot: Field) -> Field {\n storage_read_opcode(storage_slot)\n}\n\nunconstrained fn storage_write(storage_slot: Field, value: Field) {\n storage_write_opcode(storage_slot, value);\n}\n\nimpl Empty for PublicContext {\n fn empty() -> Self {\n PublicContext::new(PublicContextInputs::empty())\n }\n}\n\n// AVM oracles (opcodes) follow, do not use directly.\n#[oracle(avmOpcodeAddress)]\nunconstrained fn address_opcode() -> AztecAddress {}\n\n#[oracle(avmOpcodeStorageAddress)]\nunconstrained fn storage_address_opcode() -> AztecAddress {}\n\n#[oracle(avmOpcodeSender)]\nunconstrained fn sender_opcode() -> AztecAddress {}\n\n#[oracle(avmOpcodePortal)]\nunconstrained fn portal_opcode() -> EthAddress {}\n\n#[oracle(avmOpcodeFunctionSelector)]\nunconstrained fn function_selector_opcode() -> u32 {}\n\n#[oracle(avmOpcodeTransactionFee)]\nunconstrained fn transaction_fee_opcode() -> Field {}\n\n#[oracle(avmOpcodeChainId)]\nunconstrained fn chain_id_opcode() -> Field {}\n\n#[oracle(avmOpcodeVersion)]\nunconstrained fn version_opcode() -> Field {}\n\n#[oracle(avmOpcodeBlockNumber)]\nunconstrained fn block_number_opcode() -> Field {}\n\n#[oracle(avmOpcodeTimestamp)]\nunconstrained fn timestamp_opcode() -> u64 {}\n\n#[oracle(avmOpcodeFeePerL2Gas)]\nunconstrained fn fee_per_l2_gas_opcode() -> Field {}\n\n#[oracle(avmOpcodeFeePerDaGas)]\nunconstrained fn fee_per_da_gas_opcode() -> Field {}\n\n#[oracle(avmOpcodeL2GasLeft)]\nunconstrained fn l2_gas_left_opcode() -> Field {}\n\n#[oracle(avmOpcodeDaGasLeft)]\nunconstrained fn da_gas_left_opcode() -> Field {}\n\n#[oracle(avmOpcodeNoteHashExists)]\nunconstrained fn note_hash_exists_opcode(note_hash: Field, leaf_index: Field) -> u8 {}\n\n#[oracle(avmOpcodeEmitNoteHash)]\nunconstrained fn emit_note_hash_opcode(note_hash: Field) {}\n\n#[oracle(avmOpcodeNullifierExists)]\nunconstrained fn nullifier_exists_opcode(nullifier: Field, address: Field) -> u8 {}\n\n#[oracle(avmOpcodeEmitNullifier)]\nunconstrained fn emit_nullifier_opcode(nullifier: Field) {}\n\n#[oracle(avmOpcodeEmitUnencryptedLog)]\nunconstrained fn emit_unencrypted_log_opcode(message: [Field]) {}\n\n#[oracle(avmOpcodeL1ToL2MsgExists)]\nunconstrained fn l1_to_l2_msg_exists_opcode(msg_hash: Field, msg_leaf_index: Field) -> u8 {}\n\n#[oracle(avmOpcodeSendL2ToL1Msg)]\nunconstrained fn send_l2_to_l1_msg_opcode(recipient: EthAddress, content: Field) {}\n\n#[oracle(avmOpcodeCalldataCopy)]\nunconstrained fn calldata_copy_opcode<let N: u32>(cdoffset: u32, copy_size: u32) -> [Field; N] {}\n\n#[oracle(avmOpcodeCall)]\nunconstrained fn call_opcode<let RET_SIZE: u32>(\n gas: [Field; 2], // gas allocation: [l2_gas, da_gas]\n address: AztecAddress,\n args: [Field],\n // TODO(5110): consider passing in calldata directly\n function_selector: Field\n) -> ([Field; RET_SIZE], u8) {}\n// ^ return data ^ success\n\n#[oracle(avmOpcodeStaticCall)]\nunconstrained fn call_static_opcode<let RET_SIZE: u32>(\n gas: [Field; 2], // gas allocation: [l2_gas, da_gas]\n address: AztecAddress,\n args: [Field],\n // TODO(5110): consider passing in calldata directly\n function_selector: Field\n) -> ([Field; RET_SIZE], u8) {}\n// ^ return data ^ success\n\n#[oracle(avmOpcodeStorageRead)]\nunconstrained fn storage_read_opcode(storage_slot: Field) -> Field {}\n\n#[oracle(avmOpcodeStorageWrite)]\nunconstrained fn storage_write_opcode(storage_slot: Field, value: Field) {}\n\nstruct FunctionReturns<let N: u32> {\n values: [Field; N]\n}\n\nimpl<let N: u32> FunctionReturns<N> {\n pub fn new(values: [Field; N]) -> FunctionReturns<N> {\n FunctionReturns { values }\n }\n\n pub fn raw(self) -> [Field; N] {\n self.values\n }\n\n pub fn deserialize_into<T>(self) -> T where T: Deserialize<N> {\n Deserialize::deserialize(self.raw())\n }\n}\n\nimpl FunctionReturns<0> {\n pub fn assert_empty(self) {\n assert(self.values.len() == 0);\n }\n}\n"},"143":{"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, MAX_ARGS_LENGTH\n},\n point::Point, traits::Hash, hash::{sha256_to_field, poseidon2_hash_with_separator}\n};\nuse crate::oracle::logs_traits::ToBytesForUnencryptedLog;\n\npub use dep::protocol_types::hash::{compute_siloed_nullifier, pedersen_hash};\n\npub fn pedersen_commitment<let N: u32>(inputs: [Field; N], hash_index: u32) -> Point {\n std::hash::pedersen_commitment_with_separator(inputs, hash_index)\n}\n\npub fn compute_secret_hash(secret: Field) -> Field {\n poseidon2_hash_with_separator([secret], GENERATOR_INDEX__SECRET_HASH)\n}\n\npub fn compute_unencrypted_log_hash<T, let N: u32, let M: u32>(\n contract_address: AztecAddress,\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 len_bytes: [u8; 4] = (n as Field).to_be_bytes();\n for i in 0..4 {\n hash_bytes[32 + i] = len_bytes[i];\n }\n for i in 0..n {\n hash_bytes[36 + 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: [u8; 32] = sender.to_field().to_be_bytes();\n let chain_id_bytes: [u8; 32] = chain_id.to_be_bytes();\n let recipient_bytes: [u8; 32] = recipient.to_field().to_be_bytes();\n let version_bytes: [u8; 32] = version.to_be_bytes();\n let content_bytes: [u8; 32] = content.to_be_bytes();\n let secret_hash_bytes: [u8; 32] = secret_hash.to_be_bytes();\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 poseidon2_hash_with_separator(\n [message_hash, secret, leaf_index],\n GENERATOR_INDEX__MESSAGE_NULLIFIER\n )\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<let N: u32>(&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<let N: u32>(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() <= MAX_ARGS_LENGTH, \"Args length exceeds maximum\");\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] = poseidon2_hash_with_separator(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] = poseidon2_hash_with_separator(current_chunk_values, GENERATOR_INDEX__FUNCTION_ARGS);\n }\n poseidon2_hash_with_separator(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..MAX_ARGS_LENGTH {\n input.add(i as Field);\n }\n let hash = input.hash();\n assert(hash == 0x1cce4dbf69f14c44865919991ee1057922e34d7310ba237d71759aa422621ca9);\n}\n\n#[test]\nfn compute_unenc_log_hash_array() {\n let contract_address = AztecAddress::from_field(0x233a3e0df23b2b15b324194cb4a151f26c0b7333250781d34cc269d85dc334c6);\n let log = [\n 0x20660de09f35f876e3e69d227b2a35166ad05f09d82d06366ec9b6f65a51fec2,\n 0x1b52bfe3b8689761916f76dc3d38aa8810860db325cd39ca611eed980091f01c,\n 0x2e559c4045c378a56ad13b9edb1e8de4e7ad3b3aa35cc7ba9ec77f7a68fa43a4,\n 0x25d0f689c4a4178a29d59306f2675824d19be6d25e44fa03b03f49c263053dd2,\n 0x2d513a722d6f352dc0961f156afdc5e31495b9f0e35cb069261a8e55e2df67fd\n ];\n let hash = compute_unencrypted_log_hash(contract_address, log);\n assert(hash == 0x0095b2d17ab72f4b27a341f7ac63e49ec73935ae8c9181a0ac02023eb12f3284);\n}\n\n#[test]\nfn compute_unenc_log_hash_addr() {\n let contract_address = AztecAddress::from_field(0x233a3e0df23b2b15b324194cb4a151f26c0b7333250781d34cc269d85dc334c6);\n let log = AztecAddress::from_field(0x26aa302d4715fd8a687453cb26d616b0768027bd54bcae56b09d908ecd9f8303);\n let hash = compute_unencrypted_log_hash(contract_address, log);\n assert(hash == 0x0083ab647dfb26e7ddee90a0f4209d049d4660cab42000c544b986aaa84c55a3);\n}\n\n#[test]\nfn compute_unenc_log_hash_str() {\n let contract_address = AztecAddress::from_field(0x1b401e1146c5c507962287065c81f0ef7590adae3802c533d7549d6bf0a41bd8);\n let log = \"dummy\";\n let hash = compute_unencrypted_log_hash(contract_address, log);\n assert(hash == 0x00629e88ebd6374f44aa6cfe07e251ecf07213ebc7267e8f6b578ae57ffd6c20);\n}\n\n#[test]\nfn compute_unenc_log_hash_longer_str() {\n let contract_address = AztecAddress::from_field(0x1b401e1146c5c507962287065c81f0ef7590adae3802c533d7549d6bf0a41bd8);\n let log = \"Hello this is a string\";\n let hash = compute_unencrypted_log_hash(contract_address, log);\n assert(hash == 0x0098637962f7d34fa202b7ffad8a07a238c5d1fd897b82a108f7f467fa73b841);\n}\n"},"147":{"path":"/usr/src/noir-projects/aztec-nr/aztec/src/oracle/arguments.nr","source":"#[oracle(packArgumentsArray)]\nunconstrained fn pack_arguments_array_oracle<let N: u32>(_args: [Field; N]) -> Field {}\n\n#[oracle(packArguments)]\nunconstrained fn pack_arguments_oracle(_args: [Field]) -> Field {}\n\n/// - Pack arguments (array version) will notify the simulator that these arguments will be used later at\n/// some point in the call.\n/// - When the external call is made later, the simulator will know what the values unpack to.\n/// - This oracle will not be required in public vm functions, as the vm will keep track of arguments\n/// itself.\nunconstrained pub fn pack_arguments_array<let N: u32>(args: [Field; N]) -> Field {\n pack_arguments_array_oracle(args)\n}\n\n/// - Pack arguments (slice version) will notify the simulator that these arguments will be used later at\n/// some point in the call.\n/// - When the external call is made later, the simulator will know what the values unpack to.\n/// - This oracle will not be required in public vm functions, as the vm will keep track of arguments\n/// itself.\nunconstrained pub fn pack_arguments(args: [Field]) -> Field {\n pack_arguments_oracle(args)\n}\n\n"},"148":{"path":"/usr/src/noir-projects/aztec-nr/aztec/src/oracle/returns.nr","source":"#[oracle(packReturns)]\nunconstrained fn pack_returns_oracle(_returns: [Field]) -> Field {}\n\nunconstrained pub fn pack_returns(returns: [Field]) {\n let _unused = pack_returns_oracle(returns);\n}\n\n#[oracle(unpackReturns)]\nunconstrained fn unpack_returns_oracle<let N: u32>(_return_hash: Field) -> [Field; N] {}\n\nunconstrained pub fn unpack_returns<let N: u32>(return_hash: Field) -> [Field; N] {\n unpack_returns_oracle(return_hash)\n}\n"},"153":{"path":"/usr/src/noir-projects/aztec-nr/aztec/src/oracle/storage.nr","source":"use dep::protocol_types::{address::AztecAddress, traits::Deserialize};\n\n#[oracle(storageRead)]\nunconstrained fn storage_read_oracle<let N: u32>(address: Field, storage_slot: Field, block_number: Field, length: Field) -> [Field; N] {}\n\nunconstrained pub fn raw_storage_read<let N: u32>(\n address: AztecAddress,\n storage_slot: Field,\n block_number: u32\n) -> [Field; N] {\n storage_read_oracle(\n address.to_field(),\n storage_slot,\n block_number as Field,\n N as Field\n )\n}\n\nunconstrained pub fn storage_read<T, let N: u32>(\n address: AztecAddress,\n storage_slot: Field,\n block_number: u32\n) -> T where T: Deserialize<N> {\n T::deserialize(raw_storage_read(address, storage_slot, block_number))\n}\n\nmod tests {\n use crate::oracle::storage::{raw_storage_read, storage_read};\n use dep::protocol_types::address::AztecAddress;\n\n use std::test::OracleMock;\n use crate::test::mocks::mock_struct::MockStruct;\n\n global address = AztecAddress::from_field(29);\n global slot = 7;\n global block_number = 17;\n\n #[test]\n fn test_raw_storage_read() {\n let written = MockStruct { a: 13, b: 42 };\n\n let _ = OracleMock::mock(\"storageRead\").returns(written.serialize());\n\n let read: [Field; 2] = raw_storage_read(address, slot, block_number);\n assert_eq(read[0], 13);\n assert_eq(read[1], 42);\n }\n\n #[test]\n fn test_storage_read() {\n let written = MockStruct { a: 13, b: 42 };\n\n let _ = OracleMock::mock(\"storageRead\").returns(written.serialize());\n\n let read: MockStruct = storage_read(address, slot, block_number);\n assert_eq(read.a, 13);\n assert_eq(read.b, 42);\n }\n}\n"},"156":{"path":"/usr/src/noir-projects/aztec-nr/aztec/src/oracle/call_private_function.nr","source":"use dep::protocol_types::{abis::function_selector::FunctionSelector, address::AztecAddress, utils::reader::Reader};\n\n#[oracle(callPrivateFunction)]\nunconstrained fn call_private_function_oracle(\n _contract_address: AztecAddress,\n _function_selector: FunctionSelector,\n _args_hash: Field,\n _start_side_effect_counter: u32,\n _is_static_call: bool,\n _is_delegate_call: bool\n) -> [Field; 2] {}\n\nunconstrained pub fn call_private_function_internal(\n contract_address: AztecAddress,\n function_selector: FunctionSelector,\n args_hash: Field,\n start_side_effect_counter: u32,\n is_static_call: bool,\n is_delegate_call: bool\n) -> (u32, Field) {\n let fields = call_private_function_oracle(\n contract_address,\n function_selector,\n args_hash,\n start_side_effect_counter,\n is_static_call,\n is_delegate_call\n );\n\n let mut reader = Reader::new(fields);\n let end_side_effect_counter = reader.read_u32();\n let returns_hash = reader.read();\n\n (end_side_effect_counter, returns_hash)\n}\n"},"161":{"path":"/usr/src/noir-projects/aztec-nr/aztec/src/oracle/enqueue_public_function_call.nr","source":"use dep::protocol_types::{abis::{function_selector::FunctionSelector}, address::AztecAddress};\n\n#[oracle(enqueuePublicFunctionCall)]\nunconstrained fn enqueue_public_function_call_oracle(\n _contract_address: AztecAddress,\n _function_selector: FunctionSelector,\n _args_hash: Field,\n _side_effect_counter: u32,\n _is_static_call: bool,\n _is_delegate_call: bool\n) {}\n\nunconstrained pub fn enqueue_public_function_call_internal(\n contract_address: AztecAddress,\n function_selector: FunctionSelector,\n args_hash: Field,\n side_effect_counter: u32,\n is_static_call: bool,\n is_delegate_call: bool\n) {\n enqueue_public_function_call_oracle(\n contract_address,\n function_selector,\n args_hash,\n side_effect_counter,\n is_static_call,\n is_delegate_call\n );\n}\n\n#[oracle(setPublicTeardownFunctionCall)]\nunconstrained fn set_public_teardown_function_call_oracle(\n _contract_address: AztecAddress,\n _function_selector: FunctionSelector,\n _args_hash: Field,\n _side_effect_counter: u32,\n _is_static_call: bool,\n _is_delegate_call: bool\n) {}\n\nunconstrained pub fn set_public_teardown_function_call_internal(\n contract_address: AztecAddress,\n function_selector: FunctionSelector,\n args_hash: Field,\n side_effect_counter: u32,\n is_static_call: bool,\n is_delegate_call: bool\n) {\n set_public_teardown_function_call_oracle(\n contract_address,\n function_selector,\n args_hash,\n side_effect_counter,\n is_static_call,\n is_delegate_call\n );\n}\n\n#[oracle(notifySetMinRevertibleSideEffectCounter)]\nunconstrained fn notify_set_min_revertible_side_effect_counter_oracle(_counter: u32) {}\n\nunconstrained pub fn notify_set_min_revertible_side_effect_counter(counter: u32) {\n notify_set_min_revertible_side_effect_counter_oracle(counter);\n}\n"},"163":{"path":"/usr/src/noir-projects/aztec-nr/aztec/src/oracle/execution.nr","source":"use dep::protocol_types::address::AztecAddress;\n\n#[oracle(getContractAddress)]\nunconstrained fn get_contract_address_oracle() -> AztecAddress {}\n\n#[oracle(getBlockNumber)]\nunconstrained fn get_block_number_oracle() -> u32 {}\n\n#[oracle(getChainId)]\nunconstrained fn get_chain_id_oracle() -> Field {}\n\n#[oracle(getVersion)]\nunconstrained fn get_version_oracle() -> Field {}\n\nunconstrained pub fn get_contract_address() -> AztecAddress {\n get_contract_address_oracle()\n}\n\nunconstrained pub fn get_block_number() -> u32 {\n get_block_number_oracle()\n}\n\nunconstrained pub fn get_chain_id() -> Field {\n get_chain_id_oracle()\n}\n\nunconstrained pub fn get_version() -> Field {\n get_version_oracle()\n}\n"},"166":{"path":"/usr/src/noir-projects/aztec-nr/aztec/src/state_vars/map.nr","source":"use dep::protocol_types::{storage::map::derive_storage_slot_in_map, traits::ToField};\nuse crate::state_vars::storage::Storage;\n\n// docs:start:map\nstruct Map<K, V, Context> {\n context: Context,\n storage_slot: Field,\n state_var_constructor: fn(Context, Field) -> V,\n}\n// docs:end:map\n\nimpl<K, T, Context> Storage<T> for Map<K, T, Context> {}\n\nimpl<K, V, Context> Map<K, V, Context> {\n // docs:start:new\n pub fn new(\n context: Context,\n storage_slot: Field,\n state_var_constructor: fn(Context, Field) -> V\n ) -> Self {\n assert(storage_slot != 0, \"Storage slot 0 not allowed. Storage slots must start from 1.\");\n Map { context, storage_slot, state_var_constructor }\n }\n // docs:end:new\n\n // docs:start:at\n pub fn at(self, key: K) -> V where K: ToField {\n // TODO(#1204): use a generator index for the storage slot\n let derived_storage_slot = derive_storage_slot_in_map(self.storage_slot, key);\n\n let state_var_constructor = self.state_var_constructor;\n state_var_constructor(self.context, derived_storage_slot)\n }\n // docs:end:at\n}\n\n"},"168":{"path":"/usr/src/noir-projects/aztec-nr/aztec/src/state_vars/public_mutable.nr","source":"use crate::context::{PublicContext, UnconstrainedContext};\nuse dep::protocol_types::traits::{Deserialize, Serialize};\nuse crate::state_vars::storage::Storage;\n\n// docs:start:public_mutable_struct\nstruct PublicMutable<T, Context> {\n context: Context,\n storage_slot: Field,\n}\n// docs:end:public_mutable_struct\n\nimpl<T, Context> Storage<T> for PublicMutable<T, Context> {}\n\nimpl<T, Context> PublicMutable<T, Context> {\n // docs:start:public_mutable_struct_new\n pub fn new(\n // Note: Passing the contexts to new(...) just to have an interface compatible with a Map.\n context: Context,\n storage_slot: Field\n ) -> Self {\n assert(storage_slot != 0, \"Storage slot 0 not allowed. Storage slots must start from 1.\");\n PublicMutable { context, storage_slot }\n }\n // docs:end:public_mutable_struct_new\n}\n\nimpl<T, T_SERIALIZED_LEN> PublicMutable<T, &mut PublicContext> where T: Serialize<T_SERIALIZED_LEN> + Deserialize<T_SERIALIZED_LEN> {\n // docs:start:public_mutable_struct_read\n pub fn read(self) -> T {\n self.context.storage_read(self.storage_slot)\n }\n // docs:end:public_mutable_struct_read\n\n // docs:start:public_mutable_struct_write\n pub fn write(self, value: T) {\n self.context.storage_write(self.storage_slot, value);\n }\n // docs:end:public_mutable_struct_write\n}\n\nimpl<T, T_SERIALIZED_LEN> PublicMutable<T, UnconstrainedContext> where T: Deserialize<T_SERIALIZED_LEN> {\n unconstrained pub fn read(self) -> T {\n self.context.storage_read(self.storage_slot)\n }\n}\n"},"258":{"path":"/usr/src/noir-projects/noir-protocol-circuits/crates/types/src/storage/map.nr","source":"use crate::{hash::pedersen_hash, traits::ToField};\n\npub fn derive_storage_slot_in_map<K>(storage_slot: Field, key: K) -> Field where K: ToField {\n pedersen_hash([storage_slot, key.to_field()], 0)\n}\n\nmod test {\n use crate::{address::AztecAddress, storage::map::derive_storage_slot_in_map};\n\n #[test]\n fn test_derive_storage_slot_in_map_matches_typescript() {\n let map_slot = 0x132258fb6962c4387ba659d9556521102d227549a386d39f0b22d1890d59c2b5;\n let key = AztecAddress::from_field(0x302dbc2f9b50a73283d5fb2f35bc01eae8935615817a0b4219a057b2ba8a5a3f);\n\n let slot = derive_storage_slot_in_map(map_slot, key);\n\n // The following value was generated by `map_slot.test.ts`\n let slot_from_typescript = 0x2499880e2b1b831785c17286f99a0d5122fee784ce7b1c04e380c4a991da819a;\n\n assert_eq(slot, slot_from_typescript);\n }\n}\n"},"263":{"path":"/usr/src/noir-projects/noir-protocol-circuits/crates/types/src/type_serialization.nr","source":"use crate::traits::{Serialize, Deserialize};\n\nglobal BOOL_SERIALIZED_LEN: Field = 1;\nglobal U8_SERIALIZED_LEN: Field = 1;\nglobal U32_SERIALIZED_LEN: Field = 1;\nglobal U64_SERIALIZED_LEN: Field = 1;\nglobal U128_SERIALIZED_LEN: Field = 1;\nglobal FIELD_SERIALIZED_LEN: Field = 1;\n\nimpl Serialize<BOOL_SERIALIZED_LEN> for bool {\n fn serialize(self) -> [Field; BOOL_SERIALIZED_LEN] {\n [self as Field]\n }\n}\n\nimpl Deserialize<BOOL_SERIALIZED_LEN> for bool {\n fn deserialize(fields: [Field; BOOL_SERIALIZED_LEN]) -> bool {\n fields[0] as bool\n }\n}\n\nimpl Serialize<U8_SERIALIZED_LEN> for u8 {\n fn serialize(self) -> [Field; U32_SERIALIZED_LEN] {\n [self as Field]\n }\n}\n\nimpl Deserialize<U8_SERIALIZED_LEN> for u8 {\n fn deserialize(fields: [Field; U8_SERIALIZED_LEN]) -> Self {\n fields[0] as u8\n }\n}\n\nimpl Serialize<U32_SERIALIZED_LEN> for u32 {\n fn serialize(self) -> [Field; U32_SERIALIZED_LEN] {\n [self as Field]\n }\n}\n\nimpl Deserialize<U32_SERIALIZED_LEN> for u32 {\n fn deserialize(fields: [Field; U32_SERIALIZED_LEN]) -> Self {\n fields[0] as u32\n }\n}\n\nimpl Serialize<U64_SERIALIZED_LEN> for u64 {\n fn serialize(self) -> [Field; U64_SERIALIZED_LEN] {\n [self as Field]\n }\n}\n\nimpl Deserialize<U64_SERIALIZED_LEN> for u64 {\n fn deserialize(fields: [Field; U64_SERIALIZED_LEN]) -> Self {\n fields[0] as u64\n }\n}\n\nimpl Serialize<U128_SERIALIZED_LEN> for U128 {\n fn serialize(self) -> [Field; 1] {\n [self.to_integer()]\n }\n}\n\nimpl Deserialize<U128_SERIALIZED_LEN> for U128 {\n fn deserialize(fields: [Field; U128_SERIALIZED_LEN]) -> Self {\n U128::from_integer(fields[0])\n }\n}\n\nimpl Serialize<FIELD_SERIALIZED_LEN> for Field {\n fn serialize(self) -> [Field; U32_SERIALIZED_LEN] {\n [self]\n }\n}\n\nimpl Deserialize<FIELD_SERIALIZED_LEN> for Field {\n fn deserialize(fields: [Field; FIELD_SERIALIZED_LEN]) -> Self {\n fields[0]\n }\n}\n"},"264":{"path":"/usr/src/noir-projects/noir-protocol-circuits/crates/types/src/traits.nr","source":"use 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 {\n fn empty() -> Self {\n 0\n }\n}\n\nimpl Empty for u1 {\n fn empty() -> Self {\n 0\n }\n}\nimpl Empty for u8 {\n fn empty() -> Self {\n 0\n }\n}\nimpl Empty for u32 {\n fn empty() -> Self {\n 0\n }\n}\nimpl Empty for u64 {\n fn empty() -> Self {\n 0\n }\n}\nimpl Empty for U128 {\n fn empty() -> Self {\n U128::from_integer(0)\n }\n}\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, let N: u32>(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 {\n fn to_field(self) -> Field {\n self as Field\n }\n}\nimpl ToField for u1 {\n fn to_field(self) -> Field {\n self as Field\n }\n}\nimpl ToField for u8 {\n fn to_field(self) -> Field {\n self as Field\n }\n}\nimpl ToField for u32 {\n fn to_field(self) -> Field {\n self as Field\n }\n}\nimpl ToField for u64 {\n fn to_field(self) -> Field {\n self as Field\n }\n}\nimpl ToField for U128 {\n fn to_field(self) -> Field {\n self.to_integer()\n }\n}\nimpl<let N: u32> 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 {\n fn from_field(value: Field) -> Self {\n value as bool\n }\n}\nimpl FromField for u1 {\n fn from_field(value: Field) -> Self {\n value as u1\n }\n}\nimpl FromField for u8 {\n fn from_field(value: Field) -> Self {\n value as u8\n }\n}\nimpl FromField for u32 {\n fn from_field(value: Field) -> Self {\n value as u32\n }\n}\nimpl FromField for u64 {\n fn from_field(value: Field) -> Self {\n value as u64\n }\n}\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<let N: u32> {\n fn serialize(self) -> [Field; N];\n}\n// docs:end:serialize\n\nimpl<let N: u32> Serialize<N> for [Field; N] {\n fn serialize(self) -> [Field; N] {\n self\n }\n}\nimpl<let N: u32> 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<let N: u32> {\n fn deserialize(fields: [Field; N]) -> Self;\n}\n// docs:end:deserialize\n\nimpl<let N: u32> Deserialize<N> for [Field; N] {\n fn deserialize(fields: [Field; N]) -> Self {\n fields\n }\n}\n"},"269":{"path":"/usr/src/noir-projects/noir-protocol-circuits/crates/types/src/hash.nr","source":"use crate::{\n abis::{\n contract_class_function_leaf_preimage::ContractClassFunctionLeafPreimage,\n function_selector::FunctionSelector, log_hash::{LogHash, ScopedLogHash, ScopedEncryptedLogHash},\n note_hash::ScopedNoteHash, nullifier::ScopedNullifier\n},\n address::{AztecAddress, EthAddress},\n 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, MAX_NOTE_ENCRYPTED_LOGS_PER_TX\n},\n merkle_tree::root::root_from_sibling_path,\n messaging::l2_to_l1_message::{L2ToL1Message, ScopedL2ToL1Message},\n recursion::verification_key::VerificationKey, traits::{is_empty, ToField},\n utils::field::field_from_bytes_32_trunc\n};\n\npub fn sha256_to_field<let N: u32>(bytes_to_hash: [u8; N]) -> Field {\n let sha256_hashed = std::hash::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\nfn compute_note_hash_nonce(tx_hash: Field, note_index_in_tx: u32) -> Field {\n // Hashing tx hash with note index in tx is guaranteed to be unique\n poseidon2_hash_with_separator(\n [\n tx_hash,\n note_index_in_tx as Field\n ],\n GENERATOR_INDEX__NOTE_HASH_NONCE\n )\n}\n\npub fn compute_unique_note_hash(nonce: Field, note_hash: Field) -> Field {\n let inputs = [nonce, note_hash];\n poseidon2_hash_with_separator(inputs, GENERATOR_INDEX__UNIQUE_NOTE_HASH)\n}\n\npub fn compute_siloed_note_hash(app: AztecAddress, unique_note_hash: Field) -> Field {\n poseidon2_hash_with_separator(\n [\n app.to_field(),\n unique_note_hash\n ],\n GENERATOR_INDEX__SILOED_NOTE_HASH\n )\n}\n\n/// Siloing in the context of Aztec refers to the process of hashing a note hash with a contract address (this way\n/// the note hash is scoped to a specific contract). This is used to prevent intermingling of notes between contracts.\npub fn silo_note_hash(note_hash: ScopedNoteHash, tx_hash: Field, note_index_in_tx: u32) -> Field {\n if note_hash.contract_address.is_zero() {\n 0\n } else {\n let nonce = compute_note_hash_nonce(tx_hash, note_index_in_tx);\n let unique_note_hash = compute_unique_note_hash(nonce, note_hash.value());\n compute_siloed_note_hash(note_hash.contract_address, unique_note_hash)\n }\n}\n\npub fn compute_siloed_nullifier(app: AztecAddress, nullifier: Field) -> Field {\n poseidon2_hash_with_separator(\n [\n app.to_field(),\n nullifier\n ],\n GENERATOR_INDEX__OUTER_NULLIFIER\n )\n}\n\npub fn silo_nullifier(nullifier: ScopedNullifier) -> Field {\n if nullifier.contract_address.is_zero() {\n nullifier.value() // Return value instead of 0 because the first nullifier's contract address is zero.\n } else {\n compute_siloed_nullifier(nullifier.contract_address, nullifier.value())\n }\n}\n\npub fn silo_encrypted_log_hash(log_hash: ScopedLogHash) -> Field {\n // We assume contract address has already been masked\n if log_hash.contract_address.is_zero() {\n 0\n } else {\n accumulate_sha256([log_hash.contract_address.to_field(), log_hash.log_hash.value])\n }\n}\n\npub fn mask_encrypted_log_hash(scoped_log: ScopedEncryptedLogHash) -> AztecAddress {\n if scoped_log.contract_address.is_zero() {\n AztecAddress::from_field(0)\n } else if (scoped_log.log_hash.randomness == 0) {\n scoped_log.contract_address\n } else {\n AztecAddress::from_field(\n poseidon2_hash_with_separator(\n [scoped_log.contract_address.to_field(), scoped_log.log_hash.randomness],\n 0\n )\n )\n }\n}\n\nfn compute_siloed_unencrypted_log_hash(address: AztecAddress, log_hash: Field) -> Field {\n accumulate_sha256([address.to_field(), log_hash])\n}\n\npub fn silo_unencrypted_log_hash(log_hash: ScopedLogHash) -> Field {\n if log_hash.contract_address.is_zero() {\n 0\n } else {\n compute_siloed_unencrypted_log_hash(log_hash.contract_address, log_hash.value())\n }\n}\n\npub fn merkle_hash(left: Field, right: Field) -> Field {\n poseidon2_hash([left, right])\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 recipient: EthAddress,\n content: Field,\n rollup_version_id: Field,\n chain_id: Field\n) -> Field {\n let mut bytes: BoundedVec<u8, 160> = BoundedVec::new();\n\n let inputs = [contract_address.to_field(), rollup_version_id, recipient.to_field(), chain_id, content];\n for i in 0..inputs.len() {\n // TODO are bytes be in fr.to_buffer() ?\n let item_bytes: [u8; 32] = inputs[i].to_be_bytes();\n for j in 0..32 {\n bytes.push(item_bytes[j]);\n }\n }\n\n sha256_to_field(bytes.storage)\n}\n\npub fn silo_l2_to_l1_message(msg: ScopedL2ToL1Message, rollup_version_id: Field, chain_id: Field) -> Field {\n if msg.contract_address.is_zero() {\n 0\n } else {\n compute_l2_to_l1_hash(\n msg.contract_address,\n msg.message.recipient,\n msg.message.content,\n rollup_version_id,\n chain_id\n )\n }\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: [u8; 32] = input[offset].to_be_bytes();\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: [LogHash; 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: [u8; 32] = logs[offset].value.to_be_bytes();\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_tx_note_logs_hash(logs: [LogHash; MAX_NOTE_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_NOTE_ENCRYPTED_LOGS_PER_TX * 32];\n for offset in 0..MAX_NOTE_ENCRYPTED_LOGS_PER_TX {\n let input_as_bytes: [u8; 32] = logs[offset].value.to_be_bytes();\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 pedersen_hash<let N: u32>(inputs: [Field; N], hash_index: u32) -> Field {\n std::hash::pedersen_hash_with_separator(inputs, hash_index)\n}\n\npub fn poseidon2_hash<let N: u32>(inputs: [Field; N]) -> Field {\n std::hash::poseidon2::Poseidon2::hash(inputs, N)\n}\n\n#[no_predicates]\npub fn poseidon2_hash_with_separator<let N: u32, T>(\n inputs: [Field; N],\n separator: T\n) -> Field where T: ToField {\n // We manually hash the inputs here, since we cannot express with the type system a constant size inputs array of N + 1\n let in_len = N + 1;\n let two_pow_64 = 18446744073709551616;\n let iv : Field = (in_len as Field) * two_pow_64;\n let mut sponge = std::hash::poseidon2::Poseidon2::new(iv);\n sponge.absorb(separator.to_field());\n\n for i in 0..inputs.len() {\n sponge.absorb(inputs[i]);\n }\n\n sponge.squeeze()\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 = std::hash::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), EthAddress::zero(), 0, 0, 0);\n assert(hash_result == 0xb393978842a0fa3d3e1470196f098f473f9678e72463cb65ec4ab5581856c2);\n\n // Non-zero case\n let hash_result = compute_l2_to_l1_hash(AztecAddress::from_field(1), EthAddress::from_field(3), 5, 2, 4);\n assert(hash_result == 0x3f88c1044a05e5340ed20466276500f6d45ca5603913b9091e957161734e16);\n}\n\n#[test]\nfn silo_l2_to_l1_message_matches_typescript() {\n let version = 4;\n let chainId = 5;\n\n let hash = silo_l2_to_l1_message(\n ScopedL2ToL1Message {\n message: L2ToL1Message { recipient: EthAddress::from_field(1), content: 2, counter: 0 },\n contract_address: AztecAddress::from_field(3)\n },\n version,\n chainId\n );\n\n // The following value was generated by `l2_to_l1_message.test.ts`\n let hash_from_typescript = 0x00c6155d69febb9d5039b374dd4f77bf57b7c881709aa524a18acaa0bd57476a;\n\n assert_eq(hash, hash_from_typescript);\n}\n"},"29":{"path":"std/hash/mod.nr","source":"mod poseidon;\nmod mimc;\nmod poseidon2;\nmod keccak;\nmod sha256;\nmod sha512;\n\nuse crate::default::Default;\nuse crate::uint128::U128;\nuse crate::collections::vec::Vec;\nuse crate::embedded_curve_ops::{EmbeddedCurvePoint, EmbeddedCurveScalar, multi_scalar_mul, multi_scalar_mul_slice};\nuse crate::meta::derive_via;\n\n// Kept for backwards compatibility\npub use sha256::{digest, sha256, sha256_compression, sha256_var};\n\n#[foreign(blake2s)]\n// docs:start:blake2s\npub fn blake2s<let N: u32>(input: [u8; N]) -> [u8; 32]\n// docs:end:blake2s\n{}\n\n#[foreign(blake3)]\n// docs:start:blake3\npub fn blake3<let N: u32>(input: [u8; N]) -> [u8; 32]\n// docs:end:blake3\n{}\n\n// docs:start:pedersen_commitment\npub fn pedersen_commitment<let N: u32>(input: [Field; N]) -> EmbeddedCurvePoint {\n // docs:end:pedersen_commitment\n pedersen_commitment_with_separator(input, 0)\n}\n\npub fn pedersen_hash_with_separator<let N: u32>(input: [Field; N], separator: u32) -> Field {\n __pedersen_hash_with_separator(input, separator)\n}\n\nfn pedersen_commitment_with_separator<let N: u32>(input: [Field; N], separator: u32) -> EmbeddedCurvePoint {\n let value = __pedersen_commitment_with_separator(input, separator);\n if (value[0] == 0) & (value[1] == 0) {\n EmbeddedCurvePoint { x: 0, y: 0, is_infinite: true }\n } else {\n EmbeddedCurvePoint { x: value[0], y: value[1], is_infinite: false }\n }\n}\n\n#[no_predicates]\nfn pedersen_commitment_with_separator_noir<let N: u32>(input: [Field; N], separator: u32) -> EmbeddedCurvePoint {\n let mut points = [EmbeddedCurveScalar { lo: 0, hi: 0 }; N];\n for i in 0..N {\n // we use the unsafe version because the multi_scalar_mul will constrain the scalars.\n points[i] = from_field_unsafe(input[i]);\n }\n let generators = derive_generators(\"DEFAULT_DOMAIN_SEPARATOR\".as_bytes(), separator);\n multi_scalar_mul(generators, points)\n}\n\n#[no_predicates]\nfn pedersen_hash_with_separator_noir<let N: u32>(input: [Field; N], separator: u32) -> Field {\n let mut scalars: Vec<EmbeddedCurveScalar> = Vec::from_slice([EmbeddedCurveScalar { lo: 0, hi: 0 }; N].as_slice()); //Vec::new();\n\n for i in 0..N {\n scalars.set(i, from_field_unsafe(input[i]));\n }\n scalars.push(EmbeddedCurveScalar { lo: N as Field, hi: 0 as Field });\n let domain_generators :[EmbeddedCurvePoint; N]= derive_generators(\"DEFAULT_DOMAIN_SEPARATOR\".as_bytes(), separator);\n let mut vec_generators = Vec::new();\n for i in 0..N {\n vec_generators.push(domain_generators[i]);\n }\n let length_generator : [EmbeddedCurvePoint; 1] = derive_generators(\"pedersen_hash_length\".as_bytes(), 0);\n vec_generators.push(length_generator[0]);\n multi_scalar_mul_slice(vec_generators.slice, scalars.slice)[0]\n}\n\n// docs:start:pedersen_hash\npub fn pedersen_hash<let N: u32>(input: [Field; N]) -> Field\n// docs:end:pedersen_hash\n{\n __pedersen_hash_with_separator(input, 0)\n}\n\n#[foreign(pedersen_hash)]\nfn __pedersen_hash_with_separator<let N: u32>(input: [Field; N], separator: u32) -> Field {}\n\n#[foreign(pedersen_commitment)]\nfn __pedersen_commitment_with_separator<let N: u32>(input: [Field; N], separator: u32) -> [Field; 2] {}\n\n#[field(bn254)]\nfn derive_generators<let N: u32, let M: u32>(domain_separator_bytes: [u8; M], starting_index: u32) -> [EmbeddedCurvePoint; N] {\n crate::assert_constant(domain_separator_bytes);\n // TODO(https://github.com/noir-lang/noir/issues/5672): Add back assert_constant on starting_index\n __derive_generators(domain_separator_bytes, starting_index)\n}\n\n#[builtin(derive_pedersen_generators)]\n#[field(bn254)]\nfn __derive_generators<let N: u32, let M: u32>(\n domain_separator_bytes: [u8; M],\n starting_index: u32\n) -> [EmbeddedCurvePoint; N] {}\n\n#[field(bn254)]\n // Same as from_field but:\n // does not assert the limbs are 128 bits\n // does not assert the decomposition does not overflow the EmbeddedCurveScalar\n fn from_field_unsafe(scalar: Field) -> EmbeddedCurveScalar {\n let (xlo, xhi) = unsafe {\n crate::field::bn254::decompose_hint(scalar)\n };\n // Check that the decomposition is correct\n assert_eq(scalar, xlo + crate::field::bn254::TWO_POW_128 * xhi);\n EmbeddedCurveScalar { lo: xlo, hi: xhi }\n}\n\npub fn hash_to_field(inputs: [Field]) -> Field {\n let mut sum = 0;\n\n for input in inputs {\n let input_bytes: [u8; 32] = input.to_le_bytes();\n sum += crate::field::bytes32_to_field(blake2s(input_bytes));\n }\n\n sum\n}\n\n// docs:start:keccak256\npub fn keccak256<let N: u32>(input: [u8; N], message_size: u32) -> [u8; 32]\n// docs:end:keccak256\n{\n crate::hash::keccak::keccak256(input, message_size)\n}\n\n#[foreign(poseidon2_permutation)]\npub fn poseidon2_permutation<let N: u32>(_input: [Field; N], _state_length: u32) -> [Field; N] {}\n\n// Generic hashing support. \n// Partially ported and impacted by rust.\n\n// Hash trait shall be implemented per type.\n#[derive_via(derive_hash)]\ntrait Hash {\n fn hash<H>(self, state: &mut H) where H: Hasher;\n}\n\n// docs:start:derive_hash\ncomptime fn derive_hash(s: StructDefinition) -> Quoted {\n let name = quote { Hash };\n let signature = quote { fn hash<H>(_self: Self, _state: &mut H) where H: std::hash::Hasher };\n let for_each_field = |name| quote { _self.$name.hash(_state); };\n crate::meta::make_trait_impl(s, name, signature, for_each_field, quote {}, |fields| fields)\n}\n// docs:end:derive_hash\n\n// Hasher trait shall be implemented by algorithms to provide hash-agnostic means.\n// TODO: consider making the types generic here ([u8], [Field], etc.)\ntrait Hasher{\n fn finish(self) -> Field;\n \n fn write(&mut self, input: Field);\n}\n\n// BuildHasher is a factory trait, responsible for production of specific Hasher.\ntrait BuildHasher<H> where H: Hasher{\n fn build_hasher(self) -> H;\n}\n\nstruct BuildHasherDefault<H>;\n\nimpl<H> BuildHasher<H> for BuildHasherDefault<H>\nwhere \n H: Hasher + Default {\n fn build_hasher(_self: Self) -> H {\n H::default()\n }\n}\n\nimpl<H> Default for BuildHasherDefault<H>\nwhere \n H: Hasher + Default {\n fn default() -> Self {\n BuildHasherDefault {}\n }\n}\n\nimpl Hash for Field {\n fn hash<H>(self, state: &mut H) where H: Hasher {\n H::write(state, self);\n }\n}\n\nimpl Hash for u1 {\n fn hash<H>(self, state: &mut H) where H: Hasher {\n H::write(state, self as Field);\n }\n}\n\nimpl Hash for u8 {\n fn hash<H>(self, state: &mut H) where H: Hasher {\n H::write(state, self as Field);\n }\n}\n\nimpl Hash for u16 {\n fn hash<H>(self, state: &mut H) where H: Hasher {\n H::write(state, self as Field);\n }\n}\n\nimpl Hash for u32 {\n fn hash<H>(self, state: &mut H) where H: Hasher {\n H::write(state, self as Field);\n }\n}\n\nimpl Hash for u64 {\n fn hash<H>(self, state: &mut H) where H: Hasher {\n H::write(state, self as Field);\n }\n}\n\nimpl Hash for i8 {\n fn hash<H>(self, state: &mut H) where H: Hasher {\n H::write(state, self as Field);\n }\n}\n\nimpl Hash for i16 {\n fn hash<H>(self, state: &mut H) where H: Hasher {\n H::write(state, self as Field);\n }\n}\n\nimpl Hash for i32 {\n fn hash<H>(self, state: &mut H) where H: Hasher {\n H::write(state, self as Field);\n }\n}\n\nimpl Hash for i64 {\n fn hash<H>(self, state: &mut H) where H: Hasher {\n H::write(state, self as Field);\n }\n}\n\nimpl Hash for bool {\n fn hash<H>(self, state: &mut H) where H: Hasher {\n H::write(state, self as Field);\n }\n}\n\nimpl Hash for () {\n fn hash<H>(_self: Self, _state: &mut H) where H: Hasher {}\n}\n\nimpl Hash for U128 {\n fn hash<H>(self, state: &mut H) where H: Hasher {\n H::write(state, self.lo as Field);\n H::write(state, self.hi as Field);\n }\n}\n\nimpl<T, let N: u32> Hash for [T; N] where T: Hash {\n fn hash<H>(self, state: &mut H) where H: Hasher {\n for elem in self {\n elem.hash(state);\n }\n }\n}\n\nimpl<T> Hash for [T] where T: Hash {\n fn hash<H>(self, state: &mut H) where H: Hasher {\n self.len().hash(state);\n for elem in self {\n elem.hash(state);\n }\n }\n}\n\nimpl<A, B> Hash for (A, B) where A: Hash, B: Hash {\n fn hash<H>(self, state: &mut H) where H: Hasher {\n self.0.hash(state);\n self.1.hash(state);\n }\n}\n\nimpl<A, B, C> Hash for (A, B, C) where A: Hash, B: Hash, C: Hash {\n fn hash<H>(self, state: &mut H) where H: Hasher {\n self.0.hash(state);\n self.1.hash(state);\n self.2.hash(state);\n }\n}\n\nimpl<A, B, C, D> Hash for (A, B, C, D) where A: Hash, B: Hash, C: Hash, D: Hash {\n fn hash<H>(self, state: &mut H) where H: Hasher {\n self.0.hash(state);\n self.1.hash(state);\n self.2.hash(state);\n self.3.hash(state);\n }\n}\n\nimpl<A, B, C, D, E> Hash for (A, B, C, D, E) where A: Hash, B: Hash, C: Hash, D: Hash, E: Hash {\n fn hash<H>(self, state: &mut H) where H: Hasher {\n self.0.hash(state);\n self.1.hash(state);\n self.2.hash(state);\n self.3.hash(state);\n self.4.hash(state);\n }\n}\n\n// Some test vectors for Pedersen hash and Pedersen Commitment.\n// They have been generated using the same functions so the tests are for now useless\n// but they will be useful when we switch to Noir implementation.\n#[test]\nfn assert_pedersen() {\n assert_eq(\n pedersen_hash_with_separator([1], 1), 0x1b3f4b1a83092a13d8d1a59f7acb62aba15e7002f4440f2275edb99ebbc2305f\n );\n assert_eq(\n pedersen_commitment_with_separator([1], 1), EmbeddedCurvePoint {\n x: 0x054aa86a73cb8a34525e5bbed6e43ba1198e860f5f3950268f71df4591bde402,\n y: 0x209dcfbf2cfb57f9f6046f44d71ac6faf87254afc7407c04eb621a6287cac126,\n is_infinite: false\n }\n );\n\n assert_eq(\n pedersen_hash_with_separator([1, 2], 2), 0x26691c129448e9ace0c66d11f0a16d9014a9e8498ee78f4d69f0083168188255\n );\n assert_eq(\n pedersen_commitment_with_separator([1, 2], 2), EmbeddedCurvePoint {\n x: 0x2e2b3b191e49541fe468ec6877721d445dcaffe41728df0a0eafeb15e87b0753,\n y: 0x2ff4482400ad3a6228be17a2af33e2bcdf41be04795f9782bd96efe7e24f8778,\n is_infinite: false\n }\n );\n assert_eq(\n pedersen_hash_with_separator([1, 2, 3], 3), 0x0bc694b7a1f8d10d2d8987d07433f26bd616a2d351bc79a3c540d85b6206dbe4\n );\n assert_eq(\n pedersen_commitment_with_separator([1, 2, 3], 3), EmbeddedCurvePoint {\n x: 0x1fee4e8cf8d2f527caa2684236b07c4b1bad7342c01b0f75e9a877a71827dc85,\n y: 0x2f9fedb9a090697ab69bf04c8bc15f7385b3e4b68c849c1536e5ae15ff138fd1,\n is_infinite: false\n }\n );\n assert_eq(\n pedersen_hash_with_separator([1, 2, 3, 4], 4), 0xdae10fb32a8408521803905981a2b300d6a35e40e798743e9322b223a5eddc\n );\n assert_eq(\n pedersen_commitment_with_separator([1, 2, 3, 4], 4), EmbeddedCurvePoint {\n x: 0x07ae3e202811e1fca39c2d81eabe6f79183978e6f12be0d3b8eda095b79bdbc9,\n y: 0x0afc6f892593db6fbba60f2da558517e279e0ae04f95758587760ba193145014,\n is_infinite: false\n }\n );\n assert_eq(\n pedersen_hash_with_separator([1, 2, 3, 4, 5], 5), 0xfc375b062c4f4f0150f7100dfb8d9b72a6d28582dd9512390b0497cdad9c22\n );\n assert_eq(\n pedersen_commitment_with_separator([1, 2, 3, 4, 5], 5), EmbeddedCurvePoint {\n x: 0x1754b12bd475a6984a1094b5109eeca9838f4f81ac89c5f0a41dbce53189bb29,\n y: 0x2da030e3cfcdc7ddad80eaf2599df6692cae0717d4e9f7bfbee8d073d5d278f7,\n is_infinite: false\n }\n );\n assert_eq(\n pedersen_hash_with_separator([1, 2, 3, 4, 5, 6], 6), 0x1696ed13dc2730062a98ac9d8f9de0661bb98829c7582f699d0273b18c86a572\n );\n assert_eq(\n pedersen_commitment_with_separator([1, 2, 3, 4, 5, 6], 6), EmbeddedCurvePoint {\n x: 0x190f6c0e97ad83e1e28da22a98aae156da083c5a4100e929b77e750d3106a697,\n y: 0x1f4b60f34ef91221a0b49756fa0705da93311a61af73d37a0c458877706616fb,\n is_infinite: false\n }\n );\n assert_eq(\n pedersen_hash_with_separator([1, 2, 3, 4, 5, 6, 7], 7), 0x128c0ff144fc66b6cb60eeac8a38e23da52992fc427b92397a7dffd71c45ede3\n );\n assert_eq(\n pedersen_commitment_with_separator([1, 2, 3, 4, 5, 6, 7], 7), EmbeddedCurvePoint {\n x: 0x015441e9d29491b06563fac16fc76abf7a9534c715421d0de85d20dbe2965939,\n y: 0x1d2575b0276f4e9087e6e07c2cb75aa1baafad127af4be5918ef8a2ef2fea8fc,\n is_infinite: false\n }\n );\n assert_eq(\n pedersen_hash_with_separator([1, 2, 3, 4, 5, 6, 7, 8], 8), 0x2f960e117482044dfc99d12fece2ef6862fba9242be4846c7c9a3e854325a55c\n );\n assert_eq(\n pedersen_commitment_with_separator([1, 2, 3, 4, 5, 6, 7, 8], 8), EmbeddedCurvePoint {\n x: 0x1657737676968887fceb6dd516382ea13b3a2c557f509811cd86d5d1199bc443,\n y: 0x1f39f0cb569040105fa1e2f156521e8b8e08261e635a2b210bdc94e8d6d65f77,\n is_infinite: false\n }\n );\n assert_eq(\n pedersen_hash_with_separator([1, 2, 3, 4, 5, 6, 7, 8, 9], 9), 0x0c96db0790602dcb166cc4699e2d306c479a76926b81c2cb2aaa92d249ec7be7\n );\n assert_eq(\n pedersen_commitment_with_separator([1, 2, 3, 4, 5, 6, 7, 8, 9], 9), EmbeddedCurvePoint {\n x: 0x0a3ceae42d14914a432aa60ec7fded4af7dad7dd4acdbf2908452675ec67e06d,\n y: 0xfc19761eaaf621ad4aec9a8b2e84a4eceffdba78f60f8b9391b0bd9345a2f2,\n is_infinite: false\n }\n );\n assert_eq(\n pedersen_hash_with_separator([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], 10), 0x2cd37505871bc460a62ea1e63c7fe51149df5d0801302cf1cbc48beb8dff7e94\n );\n assert_eq(\n pedersen_commitment_with_separator([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], 10), EmbeddedCurvePoint {\n x: 0x2fb3f8b3d41ddde007c8c3c62550f9a9380ee546fcc639ffbb3fd30c8d8de30c,\n y: 0x300783be23c446b11a4c0fabf6c91af148937cea15fcf5fb054abf7f752ee245,\n is_infinite: false\n }\n );\n}\n\n"},"292":{"path":"/usr/src/noir-projects/noir-protocol-circuits/crates/types/src/utils/reader.nr","source":"struct Reader<let N: u32> {\n data: [Field; N],\n offset: u32,\n}\n\nimpl<let N: u32> Reader<N> {\n pub fn new(data: [Field; N]) -> Self {\n Self { data, offset: 0 }\n }\n\n pub fn read(&mut self) -> Field {\n let result = self.data[self.offset];\n self.offset += 1;\n result\n }\n\n pub fn read_u32(&mut self) -> u32 {\n self.read() as u32\n }\n\n pub fn read_bool(&mut self) -> bool {\n self.read() as bool\n }\n\n pub fn read_array<let K: u32>(&mut self, mut result: [Field; K]) -> [Field; K] {\n for i in 0..K {\n result[i] = self.data[self.offset + i];\n }\n self.offset += K;\n result\n }\n\n // TODO(#4394)\n pub fn read_struct<T, let K: u32>(&mut self, deserialise: fn([Field; K]) -> T) -> T {\n let result = deserialise(self.read_array([0; K]));\n result\n }\n\n pub fn read_struct_array<T, let K: u32, let C: u32>(&mut self, deserialise: fn([Field; K]) -> T, mut result: [T; C]) -> [T; C] {\n for i in 0..C {\n result[i] = self.read_struct(deserialise);\n }\n result\n }\n\n pub fn finish(self) {\n assert(self.offset == self.data.len(), \"Reader did not read all data\");\n }\n}\n"},"34":{"path":"std/hash/poseidon2.nr","source":"use crate::hash::Hasher;\nuse crate::default::Default;\n\ncomptime global 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 #[no_predicates]\n pub fn hash<let N: u32>(input: [Field; N], message_size: u32) -> 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) {\n // add the cache into sponge state\n for i in 0..RATE {\n // We effectively zero-pad the cache by only adding to the state\n // cache that is less than the specified `cache_size`\n if i < self.cache_size {\n self.state[i] += self.cache[i];\n }\n }\n self.state = crate::hash::poseidon2_permutation(self.state, 4);\n }\n\n fn absorb(&mut self, input: Field) {\n assert(!self.squeeze_mode);\n if self.cache_size == RATE {\n // If we're absorbing, and the cache is full, apply the sponge permutation to compress the cache\n self.perform_duplex();\n self.cache[0] = input;\n self.cache_size = 1;\n } else {\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 }\n }\n\n fn squeeze(&mut self) -> Field {\n assert(!self.squeeze_mode);\n // If we're in absorb mode, apply sponge permutation to compress the cache.\n self.perform_duplex();\n self.squeeze_mode = true;\n\n // Pop one item off the top of the permutation and return it.\n self.state[0]\n }\n\n fn hash_internal<let N: u32>(input: [Field; N], in_len: u32, 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 { _state: &[] }\n }\n}\n"},"352":{"path":"/usr/src/noir-projects/noir-contracts/contracts/auth_registry_contract/src/main.nr","source":"contract AuthRegistry {\n use dep::aztec::{state_vars::{PublicMutable, Map}, protocol_types::address::AztecAddress};\n use dep::authwit::auth::{IS_VALID_SELECTOR, compute_authwit_message_hash, assert_current_call_valid_authwit};\n\n #[aztec(storage)]\n struct Storage {\n reject_all: Map<AztecAddress, PublicMutable<bool>>,\n // on_behalf_of => authwit hash => authorized\n approved_actions: Map<AztecAddress, Map<Field, PublicMutable<bool>>>,\n }\n\n /**\n * Updates the `authorized` value for `msg_sender` for `message_hash`.\n *\n * @param message_hash The message hash being authorized\n * @param authorize True if the caller is authorized to perform the message hash, false otherwise\n */\n #[aztec(public)]\n fn set_authorized(message_hash: Field, authorize: bool) {\n storage.approved_actions.at(context.msg_sender()).at(message_hash).write(authorize);\n }\n\n /**\n * Updates the `reject_all` value for `msg_sender`.\n * \n * When `reject_all` is `true` any `consume` on `msg_sender` will revert.\n * \n * @param reject True if all actions should be rejected, false otherwise\n */\n #[aztec(public)]\n fn set_reject_all(reject: bool) {\n storage.reject_all.at(context.msg_sender()).write(reject);\n }\n\n /**\n * Consumes an `inner_hash` on behalf of `on_behalf_of` if the caller is authorized to do so.\n * \n * Will revert even if the caller is authorized if `reject_all` is set to true for `on_behalf_of`.\n * This is to support \"mass-revoke\".\n *\n * @param on_behalf_of The address on whose behalf the action is being consumed\n * @param inner_hash The inner_hash of the authwit\n * @return `IS_VALID_SELECTOR` if the action was consumed, revert otherwise\n */\n #[aztec(public)]\n fn consume(on_behalf_of: AztecAddress, inner_hash: Field) -> Field {\n assert_eq(false, storage.reject_all.at(on_behalf_of).read(), \"rejecting all\");\n\n let message_hash = compute_authwit_message_hash(\n context.msg_sender(),\n context.chain_id(),\n context.version(),\n inner_hash\n );\n\n let authorized = storage.approved_actions.at(on_behalf_of).at(message_hash).read();\n\n assert_eq(true, authorized, \"unauthorized\");\n storage.approved_actions.at(on_behalf_of).at(message_hash).write(false);\n\n IS_VALID_SELECTOR\n }\n\n /**\n * Updates a public authwit using a private authwit\n * \n * Useful for the case where you want someone else to insert a public authwit for you.\n * For example, if Alice wants Bob to insert an authwit in public, such that they can execute\n * a trade, Alice can create a private authwit, and Bob can call this function with it.\n *\n * @param approver The address of the approver (Alice in the example)\n * @param message_hash The message hash to authorize\n * @param authorize True if the message hash should be authorized, false otherwise\n */\n #[aztec(private)]\n fn set_authorized_private(approver: AztecAddress, message_hash: Field, authorize: bool) {\n assert_current_call_valid_authwit(&mut context, approver);\n AuthRegistry::at(context.this_address())._set_authorized(approver, message_hash, authorize).enqueue(&mut context);\n }\n\n /**\n * Internal function to update the `authorized` value for `approver` for `messageHash`.\n * Used along with `set_authorized_private` to update the public authwit.\n * \n * @param approver The address of the approver\n * @param message_hash The message hash being authorized\n * @param authorize True if the caller is authorized to perform the message hash, false otherwise\n */\n #[aztec(public)]\n #[aztec(internal)]\n fn _set_authorized(approver: AztecAddress, message_hash: Field, authorize: bool) {\n storage.approved_actions.at(approver).at(message_hash).write(authorize);\n }\n\n /**\n * Fetches the `reject_all` value for `on_behalf_of`.\n * \n * @param on_behalf_of The address to check\n * @return True if all actions are rejected, false otherwise\n */\n #[aztec(public)]\n #[aztec(view)]\n fn is_reject_all(on_behalf_of: AztecAddress) -> bool {\n storage.reject_all.at(on_behalf_of).read()\n }\n\n /**\n * Fetches the `authorized` value for `on_behalf_of` for `message_hash`.\n * \n * @param on_behalf_of The address on whose behalf the action is being consumed\n * @param message_hash The message hash to check\n * @return True if the caller is authorized to perform the action, false otherwise\n */\n #[aztec(public)]\n #[aztec(view)]\n fn is_consumable(on_behalf_of: AztecAddress, message_hash: Field) -> bool {\n storage.approved_actions.at(on_behalf_of).at(message_hash).read()\n }\n\n unconstrained fn unconstrained_is_consumable(on_behalf_of: AztecAddress, message_hash: Field) -> pub bool {\n storage.approved_actions.at(on_behalf_of).at(message_hash).read()\n }\n}\n"},"73":{"path":"/usr/src/noir-projects/aztec-nr/authwit/src/auth.nr","source":"use dep::aztec::protocol_types::{\n abis::function_selector::FunctionSelector, address::AztecAddress,\n constants::{\n GENERATOR_INDEX__AUTHWIT_INNER, GENERATOR_INDEX__AUTHWIT_OUTER, GENERATOR_INDEX__AUTHWIT_NULLIFIER,\n CANONICAL_AUTH_REGISTRY_ADDRESS\n},\n hash::poseidon2_hash_with_separator\n};\nuse dep::aztec::{prelude::Deserialize, context::{PrivateContext, PublicContext, gas::GasOpts}, hash::hash_args_array};\n\n/**\n * Authenticaion witness helper library\n *\n * Authentication Witness is a scheme for authenticating actions on Aztec, so users can allow third-parties\n * (e.g. protocols or other users) to execute an action on their behalf.\n *\n * This library provides helper functions to manage such witnesses.\n * The authentication witness, is some \"witness\" (data) that authenticates a `message_hash`.\n * The simplest example of an authentication witness, is a signature. The signature is the \"evidence\",\n * that the signer has seen the message, agrees with it, and has allowed it.\n * It does not need to be a signature. It could be any kind of \"proof\" that the message is allowed.\n * Another proof could be knowing some kind of secret, or having some kind of \"token\" that allows the message.\n *\n * The `message_hash` is a hash of the following structure:\n * hash(consumer, chain_id, version, inner_hash)\n * - consumer: the address of the contract that is \"consuming\" the message,\n * - chain_id: the chain id of the chain that the message is being consumed on,\n * - version: the version of the chain that the message is being consumed on,\n * - inner_hash: the hash of the \"inner\" message that is being consumed, this is the \"actual\" message or action.\n *\n * While the `inner_hash` could be anything, such as showing you signed a specific message, it will often be\n * a hash of the \"action\" to approve, along with who made the call. As part of this library, we provide a few\n * helper functions to deal with such messages.\n *\n * For example, we provide helper function that is used for checking that the message is an encoding of the current call.\n * This can be used to let some contract \"allow\" another contract to act on its behalf, as long as it can\n * show that it is acting on behalf of the contract.\n *\n * If we take a case of allowing a contract to transfer tokens on behalf of an account, the `inner_hash` can be\n * derived as:\n * inner_hash = hash(caller, \"transfer\", hash(to, amount))\n *\n * Where the `caller` would be the address of the contract that is trying to transfer the tokens, and `to` and `amount`\n * the arguments for the transfer.\n *\n * Note that we have both a `caller` and a `consumer`, the `consumer` will be the contract that is consuming the message,\n * in the case of the transfer, it would be the `Token` contract itself, while the caller, will be the actor that is\n * allowed to transfer the tokens.\n *\n *\n * The authentication mechanism works differently in public and private contexts. In private, we recall that everything\n * is executed on the user's device, so we can use `oracles` to \"ask\" the user (not contract) for information. In public\n * we cannot do this, since it is executed by the sequencer (someone else). Therefore we can instead use a \"registry\"\n * to store the messages that we have approved.\n *\n * A simple example would be a \"token\" that is being \"pulled\" from one account into another. We will first outline\n * how this would look in private, and then in public later.\n *\n * Say that a user `Alice` wants to deposit some tokens into a DeFi protocol (say a DEX).\n * `Alice` would make a `deposit` transaction, that she is executing using her account contract.\n * The account would call the `DeFi` contract to execute `deposit`, which would try to pull funds from the `Token`\n * contract. Since the `DeFi` contract is trying to pull funds from an account that is not its own, it needs to\n * convince the `Token` contract that it is allowed to do so.\n *\n * This is where the authentication witness comes in The `Token` contract computes a `message_hash` from the\n * `transfer` call, and then asks `Alice Account` contract to verify that the `DeFi` contract is allowed to\n * execute that call.\n *\n * `Alice Account` contract can then ask `Alice` if she wants to allow the `DeFi` contract to pull funds from her\n * account. If she does, she will sign the `message_hash` and return the signature to the `Alice Account` which\n * will validate it and return success to the `Token` contract which will then allow the `DeFi` contract to pull\n * funds from `Alice`.\n *\n * To ensure that the same \"approval\" cannot be used multiple times, we also compute a `nullifier` for the\n * authentication witness, and emit it from the `Token` contract (consumer).\n *\n * Note that we can do this flow as we are in private were we can do oracle calls out from contracts.\n *\n *\n * Person Contract Contract Contract\n * Alice Alice Account Token DeFi\n * | | | |\n * | Defi.deposit(Token, 1000) | |\n * |----------------->| | |\n * | | deposit(Token, 1000) |\n * | |---------------------------------------->|\n * | | | |\n * | | | transfer(Alice, Defi, 1000)\n * | | |<---------------------|\n * | | | |\n * | | Check if Defi may call transfer(Alice, Defi, 1000)\n * | |<-----------------| |\n * | | | |\n * | Please give me AuthWit for DeFi | |\n * | calling transfer(Alice, Defi, 1000) | |\n * |<-----------------| | |\n * | | | |\n * | | | |\n * | AuthWit for transfer(Alice, Defi, 1000) |\n * |----------------->| | |\n * | | AuthWit validity | |\n * | |----------------->| |\n * | | | |\n * | | throw if invalid AuthWit |\n * | | | |\n * | | emit AuthWit nullifier |\n * | | | |\n * | | transfer(Alice, Defi, 1000) |\n * | | | |\n * | | | |\n * | | | success |\n * | | |--------------------->|\n * | | | |\n * | | | |\n * | | | deposit(Token, 1000)\n * | | | |\n * | | | |\n *\n *\n * If we instead were in public, we cannot do the same flow. Instead we would use an authentication registry to store\n * the messages that we have approved.\n *\n * To approve a message, `Alice Account` can make a `set_authorized` call to the registry, to set a `message_hash`\n * as authorized. This is essentially a mapping from `message_hash` to `true` for `Alice Contract`. Every account\n * has its own map in the registry, so `Alice` cannot approve a message for `Bob`.\n *\n * The `Token` contract can then try to \"spend\" the approval by calling `consume` on the registry. If the message\n * was approved, the value is updated to `false`, and we return the success flag. For more information on the\n * registry, see `main.nr` in `auth_registry_contract`.\n *\n * Person Contract Contract Contract Contract\n * Alice Alice Account Registry Token DeFi\n * | | | | |\n * | Registry.set_authorized(..., true) | | |\n * |----------------->| | | |\n * | | set_authorized(..., true) | |\n * | |------------------->| | |\n * | | | | |\n * | | set authorized to true | |\n * | | | | |\n * | | | | |\n * | Defi.deposit(Token, 1000) | | |\n * |----------------->| | | |\n * | | deposit(Token, 1000) | |\n * | |-------------------------------------------------------------->|\n * | | | | |\n * | | | transfer(Alice, Defi, 1000) |\n * | | | |<---------------------|\n * | | | | |\n * | | | Check if Defi may call transfer(Alice, Defi, 1000)\n * | | |<------------------| |\n * | | | | |\n * | | throw if invalid AuthWit | |\n * | | | | |\n * | | | | |\n * | | set authorized to false | |\n * | | | | |\n * | | | | |\n * | | | AuthWit validity | |\n * | | |------------------>| |\n * | | | | |\n * | | | | transfer(Alice, Defi, 1000)\n * | | | |<-------------------->|\n * | | | | |\n * | | | | success |\n * | | | |--------------------->|\n * | | | | |\n * | | | | deposit(Token, 1000)\n * | | | | |\n *\n *\n * --- FAQ ---\n * Q: Why are we using a success flag of `keccak256(\"IS_VALID()\")` instead of just returning a boolean?\n * A: We want to make sure that we don't accidentally return `true` if there is a collision in the function selector.\n * By returning a hash of `IS_VALID()`, it becomes very unlikely that there is both a collision and we return\n * a success flag.\n *\n * Q: Why are we using static calls?\n * A: We are using static calls to ensure that the account contract cannot re-enter. If it was a normal call, it\n * could make a new call and do a re-entry attack. Using a static ensures that it cannot update any state.\n *\n * Q: Would it not be cheaper to use a nullifier instead of updating state in public?\n * A: At a quick glance, a public state update + nullifier is 96 bytes, but two state updates are 128, so it would be\n * cheaper to use a nullifier, if this is the way it would always be done. However, if both the approval and the\n * consumption is done in the same transaction, then we will be able to squash the updates (only final tx state diff is posted to DA), and now it is cheaper.\n *\n * Q: Why is the chain id and the version part of the message hash?\n * A: The chain id and the version is part of the message hash to ensure that the message is only valid on a specific\n * chain to avoid a case where the same message could be used across multiple chains.\n */\n\nglobal IS_VALID_SELECTOR = 0xabf64ad4; // 4 first bytes of keccak256(\"IS_VALID()\")\n\n/**\n * Assert that `on_behalf_of` have authorized the current call with a valid authentication witness\n *\n * Computing the `inner_hash` using the `msg_sender`, `selector` and `args_hash` and then making a call out to the\n * `on_behalf_of` contract to verify that the `inner_hash` is valid.\n *\n * @param on_behalf_of The address that have authorized the current call\n */\n// docs:start:assert_current_call_valid_authwit\npub fn assert_current_call_valid_authwit(context: &mut PrivateContext, on_behalf_of: AztecAddress) {\n let inner_hash = compute_inner_authwit_hash([context.msg_sender().to_field(), context.selector().to_field(), context.args_hash]);\n assert_inner_hash_valid_authwit(context, on_behalf_of, inner_hash);\n}\n// docs:end:assert_current_call_valid_authwit\n\n/**\n * Assert that a specific `inner_hash` is valid for the `on_behalf_of` address\n *\n * Used as an internal function for `assert_current_call_valid_authwit` and can be used as a standalone function when\n * the `inner_hash` is from a different source, e.g., say a block of text etc.\n *\n * @param on_behalf_of The address that have authorized the current call\n * @param inner_hash The hash of the message to authorize\n */\npub fn assert_inner_hash_valid_authwit(\n context: &mut PrivateContext,\n on_behalf_of: AztecAddress,\n inner_hash: Field\n) {\n // We perform a static call here and not a standard one to ensure that the account contract cannot re-enter.\n let result: Field = context.static_call_private_function(\n on_behalf_of,\n comptime {\n FunctionSelector::from_signature(\"verify_private_authwit(Field)\")\n },\n [inner_hash]\n ).unpack_into();\n assert(result == IS_VALID_SELECTOR, \"Message not authorized by account\");\n // Compute the nullifier, similar computation to the outer hash, but without the chain_id and version.\n // Those should already be handled in the verification, so we just need something to nullify, that allow same inner_hash for multiple actors.\n let nullifier = compute_authwit_nullifier(on_behalf_of, inner_hash);\n context.push_nullifier(nullifier);\n}\n\n/**\n * Assert that `on_behalf_of` have authorized the current call in the authentication registry\n *\n * Computing the `inner_hash` using the `msg_sender`, `selector` and `args_hash` and then making a call out to the\n * `on_behalf_of` contract to verify that the `inner_hash` is valid.\n *\n * Note that the authentication registry will take the `msg_sender` into account as the consumer, so this will only\n * work if the `msg_sender` is the same as the `consumer` when the `message_hash` was inserted into the registry.\n *\n * @param on_behalf_of The address that have authorized the current call\n */\n// docs:start:assert_current_call_valid_authwit_public\npub fn assert_current_call_valid_authwit_public(context: &mut PublicContext, on_behalf_of: AztecAddress) {\n let inner_hash = compute_inner_authwit_hash(\n [(*context).msg_sender().to_field(), (*context).selector().to_field(), (*context).get_args_hash()]\n );\n assert_inner_hash_valid_authwit_public(context, on_behalf_of, inner_hash);\n}\n// docs:end:assert_current_call_valid_authwit_public\n\n/**\n * Assert that `on_behalf_of` have authorized a speicifc `inner_hash` in the authentication registry\n *\n * Computing the `inner_hash` using the `msg_sender`, `selector` and `args_hash` and then making a call out to the\n * `on_behalf_of` contract to verify that the `inner_hash` is valid.\n *\n * Note that the authentication registry will take the `msg_sender` into account as the consumer, so this will only\n * work if the `msg_sender` is the same as the `consumer` when the `message_hash` was inserted into the registry.\n *\n * @param on_behalf_of The address that have authorized the `inner_hash`\n */\npub fn assert_inner_hash_valid_authwit_public(\n context: &mut PublicContext,\n on_behalf_of: AztecAddress,\n inner_hash: Field\n) {\n let result: Field = context.call_public_function(\n CANONICAL_AUTH_REGISTRY_ADDRESS,\n comptime {\n FunctionSelector::from_signature(\"consume((Field),Field)\")\n },\n [on_behalf_of.to_field(), inner_hash].as_slice(),\n GasOpts::default()\n ).deserialize_into();\n assert(result == IS_VALID_SELECTOR, \"Message not authorized by account\");\n}\n\n/**\n * Compute the `message_hash` from a function call to be used by an authentication witness\n *\n * Useful for when you need a non-account contract to approve during execution. For example if you need a contract\n * to make a call to nested contract, e.g., contract A wants to exit token T to L1 using bridge B, so it needs to allow\n * B to transfer T on its behalf.\n *\n * @param caller The address of the contract that is calling the function, in the example above, this would be B\n * @param consumer The address of the contract that is consuming the message, in the example above, this would be T\n * @param chain_id The chain id of the chain that the message is being consumed on\n * @param version The version of the chain that the message is being consumed on\n * @param selector The function selector of the function that is being called\n * @param args The arguments of the function that is being called\n */\n// docs:start:compute_authwit_message_hash_from_call\npub fn compute_authwit_message_hash_from_call<let N: u32>(\n caller: AztecAddress,\n consumer: AztecAddress,\n chain_id: Field,\n version: Field,\n selector: FunctionSelector,\n args: [Field; N]\n) -> Field {\n let args_hash = hash_args_array(args);\n let inner_hash = compute_inner_authwit_hash([caller.to_field(), selector.to_field(), args_hash]);\n compute_authwit_message_hash(consumer, chain_id, version, inner_hash)\n}\n// docs:end:compute_authwit_message_hash_from_call\n\n/**\n * Computes the `inner_hash` of the authentication witness\n *\n * This is used internally, but also useful in cases where you want to compute the `inner_hash` for a specific message\n * that is not necessarily a call, but just some \"bytes\" or text.\n *\n * @param args The arguments to hash\n */\npub fn compute_inner_authwit_hash<let N: u32>(args: [Field; N]) -> Field {\n poseidon2_hash_with_separator(args, GENERATOR_INDEX__AUTHWIT_INNER)\n}\n\n/**\n * Computs the `authwit_nullifier` for a specific `on_behalf_of` and `inner_hash`\n *\n * Using the `on_behalf_of` and the `inner_hash` to ensure that the nullifier is siloed for a specific `on_behalf_of`.\n *\n * @param on_behalf_of The address that have authorized the `inner_hash`\n * @param inner_hash The hash of the message to authorize\n */\npub fn compute_authwit_nullifier(on_behalf_of: AztecAddress, inner_hash: Field) -> Field {\n poseidon2_hash_with_separator(\n [on_behalf_of.to_field(), inner_hash],\n GENERATOR_INDEX__AUTHWIT_NULLIFIER\n )\n}\n\n/**\n * Computes the `message_hash` for the authentication witness\n *\n * @param consumer The address of the contract that is consuming the message\n * @param chain_id The chain id of the chain that the message is being consumed on\n * @param version The version of the chain that the message is being consumed on\n * @param inner_hash The hash of the \"inner\" message that is being consumed\n */\npub fn compute_authwit_message_hash(\n consumer: AztecAddress,\n chain_id: Field,\n version: Field,\n inner_hash: Field\n) -> Field {\n poseidon2_hash_with_separator(\n [\n consumer.to_field(),\n chain_id,\n version,\n inner_hash\n ],\n GENERATOR_INDEX__AUTHWIT_OUTER\n )\n}\n\n/**\n * Helper function to set the authorization status of a message hash\n *\n * Wraps a public call to the authentication registry to set the authorization status of a `message_hash`\n *\n * @param message_hash The hash of the message to authorize\n * @param authorize True if the message should be authorized, false if it should be revoked\n */\npub fn set_authorized(context: &mut PublicContext, message_hash: Field, authorize: bool) {\n context.call_public_function(\n CANONICAL_AUTH_REGISTRY_ADDRESS,\n comptime {\n FunctionSelector::from_signature(\"set_authorized(Field,bool)\")\n },\n [message_hash, authorize as Field].as_slice(),\n GasOpts::default()\n ).assert_empty();\n}\n\n/**\n * Helper function to reject all authwits\n *\n * Wraps a public call to the authentication registry to set the `reject_all` flag\n *\n * @param reject True if all authwits should be rejected, false otherwise\n */\npub fn set_reject_all(context: &mut PublicContext, reject: bool) {\n context.call_public_function(\n CANONICAL_AUTH_REGISTRY_ADDRESS,\n comptime {\n FunctionSelector::from_signature(\"set_reject_all(bool)\")\n },\n [context.this_address().to_field(), reject as Field].as_slice(),\n GasOpts::default()\n ).assert_empty();\n}\n"}}}
|