@aztec/pxe 0.0.1-commit.9b94fc1 → 0.0.1-commit.9badcec54
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dest/bin/check_oracle_version.js +107 -17
- package/dest/block_synchronizer/block_synchronizer.d.ts +49 -0
- package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -0
- package/dest/block_synchronizer/block_synchronizer.js +171 -0
- package/dest/block_synchronizer/index.d.ts +2 -0
- package/dest/block_synchronizer/index.d.ts.map +1 -0
- package/dest/block_synchronizer/index.js +1 -0
- package/dest/config/index.d.ts +7 -5
- package/dest/config/index.d.ts.map +1 -1
- package/dest/config/index.js +12 -2
- package/dest/config/package_info.js +1 -1
- package/dest/contract_function_simulator/benchmarked_node.d.ts +9 -0
- package/dest/contract_function_simulator/benchmarked_node.d.ts.map +1 -0
- package/dest/contract_function_simulator/benchmarked_node.js +77 -0
- package/dest/contract_function_simulator/contract_function_simulator.d.ts +84 -24
- package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.js +252 -82
- package/dest/contract_function_simulator/ephemeral_array_service.d.ts +28 -0
- package/dest/contract_function_simulator/ephemeral_array_service.d.ts.map +1 -0
- package/dest/contract_function_simulator/ephemeral_array_service.js +78 -0
- package/dest/contract_function_simulator/execution_note_cache.d.ts +21 -11
- package/dest/contract_function_simulator/execution_note_cache.d.ts.map +1 -1
- package/dest/contract_function_simulator/execution_note_cache.js +49 -31
- package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts +7 -7
- package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts.map +1 -1
- package/dest/contract_function_simulator/execution_tagging_index_cache.js +19 -11
- package/dest/contract_function_simulator/hashed_values_cache.d.ts +2 -2
- package/dest/contract_function_simulator/hashed_values_cache.d.ts.map +1 -1
- package/dest/contract_function_simulator/index.d.ts +3 -2
- package/dest/contract_function_simulator/index.d.ts.map +1 -1
- package/dest/contract_function_simulator/index.js +2 -1
- package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts +7 -8
- package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/event_validation_request.js +12 -11
- package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts +6 -5
- package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/log_retrieval_request.js +8 -7
- package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts +3 -3
- package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/log_retrieval_response.js +3 -5
- package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +7 -9
- package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/note_validation_request.js +10 -12
- package/dest/contract_function_simulator/noir-structs/utility_context.d.ts +4 -10
- package/dest/contract_function_simulator/noir-structs/utility_context.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/utility_context.js +7 -18
- package/dest/contract_function_simulator/oracle/interfaces.d.ts +73 -50
- package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/legacy_oracle_mappings.d.ts +9 -0
- package/dest/contract_function_simulator/oracle/legacy_oracle_mappings.d.ts.map +1 -0
- package/dest/contract_function_simulator/oracle/legacy_oracle_mappings.js +47 -0
- package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts +4 -2
- package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.js +1 -1
- package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts +11 -7
- package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/note_packing_utils.js +14 -10
- package/dest/contract_function_simulator/oracle/oracle.d.ts +75 -42
- package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/oracle.js +340 -120
- package/dest/contract_function_simulator/oracle/private_execution.d.ts +2 -27
- package/dest/contract_function_simulator/oracle/private_execution.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution.js +6 -40
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +66 -82
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.js +145 -119
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +168 -58
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +402 -108
- package/dest/contract_function_simulator/pick_notes.d.ts +2 -2
- package/dest/contract_function_simulator/pick_notes.d.ts.map +1 -1
- package/dest/contract_function_simulator/pick_notes.js +21 -4
- package/dest/contract_function_simulator/proxied_contract_data_source.d.ts +4 -4
- package/dest/contract_function_simulator/proxied_contract_data_source.d.ts.map +1 -1
- package/dest/contract_function_simulator/proxied_contract_data_source.js +26 -5
- package/dest/contract_logging.d.ts +27 -0
- package/dest/contract_logging.d.ts.map +1 -0
- package/dest/contract_logging.js +38 -0
- package/dest/contract_sync/contract_sync_service.d.ts +44 -0
- package/dest/contract_sync/contract_sync_service.d.ts.map +1 -0
- package/dest/contract_sync/contract_sync_service.js +116 -0
- package/dest/contract_sync/helpers.d.ts +28 -0
- package/dest/contract_sync/helpers.d.ts.map +1 -0
- package/dest/contract_sync/helpers.js +60 -0
- package/dest/debug/pxe_debug_utils.d.ts +45 -0
- package/dest/debug/pxe_debug_utils.d.ts.map +1 -0
- package/dest/debug/pxe_debug_utils.js +48 -0
- package/dest/entrypoints/client/bundle/index.d.ts +3 -2
- package/dest/entrypoints/client/bundle/index.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/index.js +2 -1
- package/dest/entrypoints/client/bundle/utils.d.ts +2 -2
- package/dest/entrypoints/client/bundle/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/utils.js +32 -9
- package/dest/entrypoints/client/lazy/index.d.ts +3 -2
- package/dest/entrypoints/client/lazy/index.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/index.js +2 -1
- package/dest/entrypoints/client/lazy/utils.d.ts +3 -3
- package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/utils.js +33 -10
- package/dest/entrypoints/pxe_creation_options.d.ts +9 -3
- package/dest/entrypoints/pxe_creation_options.d.ts.map +1 -1
- package/dest/entrypoints/pxe_creation_options.js +3 -1
- package/dest/entrypoints/server/index.d.ts +6 -3
- package/dest/entrypoints/server/index.d.ts.map +1 -1
- package/dest/entrypoints/server/index.js +5 -2
- package/dest/entrypoints/server/utils.d.ts +2 -2
- package/dest/entrypoints/server/utils.d.ts.map +1 -1
- package/dest/entrypoints/server/utils.js +39 -16
- package/dest/error_enriching.d.ts +4 -4
- package/dest/error_enriching.d.ts.map +1 -1
- package/dest/error_enriching.js +6 -6
- package/dest/events/event_service.d.ts +16 -0
- package/dest/events/event_service.d.ts.map +1 -0
- package/dest/events/event_service.js +65 -0
- package/dest/events/index.d.ts +2 -0
- package/dest/events/index.d.ts.map +1 -0
- package/dest/events/index.js +1 -0
- package/dest/events/private_event_filter_validator.d.ts +10 -0
- package/dest/events/private_event_filter_validator.d.ts.map +1 -0
- package/dest/events/private_event_filter_validator.js +53 -0
- package/dest/job_coordinator/job_coordinator.d.ts +75 -0
- package/dest/job_coordinator/job_coordinator.d.ts.map +1 -0
- package/dest/job_coordinator/job_coordinator.js +94 -0
- package/dest/logs/log_service.d.ts +28 -0
- package/dest/logs/log_service.d.ts.map +1 -0
- package/dest/logs/log_service.js +108 -0
- package/dest/messages/message_context_service.d.ts +17 -0
- package/dest/messages/message_context_service.d.ts.map +1 -0
- package/dest/messages/message_context_service.js +36 -0
- package/dest/notes/index.d.ts +2 -0
- package/dest/notes/index.d.ts.map +1 -0
- package/dest/notes/index.js +1 -0
- package/dest/notes/note_service.d.ts +48 -0
- package/dest/notes/note_service.d.ts.map +1 -0
- package/dest/notes/note_service.js +157 -0
- package/dest/notes_filter.d.ts +24 -0
- package/dest/notes_filter.d.ts.map +1 -0
- package/dest/notes_filter.js +4 -0
- package/dest/oracle_version.d.ts +4 -3
- package/dest/oracle_version.d.ts.map +1 -1
- package/dest/oracle_version.js +20 -9
- package/dest/private_kernel/hints/compute_tx_expiration_timestamp.d.ts +4 -0
- package/dest/private_kernel/hints/compute_tx_expiration_timestamp.d.ts.map +1 -0
- package/dest/private_kernel/hints/{compute_tx_include_by_timestamp.js → compute_tx_expiration_timestamp.js} +12 -12
- package/dest/private_kernel/hints/index.d.ts +3 -3
- package/dest/private_kernel/hints/index.d.ts.map +1 -1
- package/dest/private_kernel/hints/index.js +2 -2
- package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts +29 -0
- package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts.map +1 -0
- package/dest/private_kernel/hints/{build_private_kernel_reset_private_inputs.js → private_kernel_reset_private_inputs_builder.js} +141 -74
- package/dest/private_kernel/hints/test_utils.d.ts +122 -0
- package/dest/private_kernel/hints/test_utils.d.ts.map +1 -0
- package/dest/private_kernel/hints/test_utils.js +203 -0
- package/dest/private_kernel/private_kernel_execution_prover.d.ts +3 -2
- package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_execution_prover.js +27 -23
- package/dest/private_kernel/private_kernel_oracle.d.ts +27 -26
- package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_oracle.js +91 -2
- package/dest/pxe.d.ts +117 -103
- package/dest/pxe.d.ts.map +1 -1
- package/dest/pxe.js +291 -262
- package/dest/storage/address_store/address_store.d.ts +11 -0
- package/dest/storage/address_store/address_store.d.ts.map +1 -0
- package/dest/storage/{address_data_provider/address_data_provider.js → address_store/address_store.js} +13 -12
- package/dest/storage/address_store/index.d.ts +2 -0
- package/dest/storage/address_store/index.d.ts.map +1 -0
- package/dest/storage/address_store/index.js +1 -0
- package/dest/storage/anchor_block_store/anchor_block_store.d.ts +17 -0
- package/dest/storage/anchor_block_store/anchor_block_store.d.ts.map +1 -0
- package/dest/storage/anchor_block_store/anchor_block_store.js +26 -0
- package/dest/storage/{sync_data_provider → anchor_block_store}/index.d.ts +2 -2
- package/dest/storage/anchor_block_store/index.d.ts.map +1 -0
- package/dest/storage/anchor_block_store/index.js +1 -0
- package/dest/storage/capsule_store/capsule_service.d.ts +21 -0
- package/dest/storage/capsule_store/capsule_service.d.ts.map +1 -0
- package/dest/storage/capsule_store/capsule_service.js +50 -0
- package/dest/storage/capsule_store/capsule_store.d.ts +72 -0
- package/dest/storage/capsule_store/capsule_store.d.ts.map +1 -0
- package/dest/storage/capsule_store/capsule_store.js +261 -0
- package/dest/storage/capsule_store/index.d.ts +3 -0
- package/dest/storage/capsule_store/index.d.ts.map +1 -0
- package/dest/storage/capsule_store/index.js +2 -0
- package/dest/storage/contract_store/contract_store.d.ts +93 -0
- package/dest/storage/contract_store/contract_store.d.ts.map +1 -0
- package/dest/storage/contract_store/contract_store.js +311 -0
- package/dest/storage/contract_store/index.d.ts +2 -0
- package/dest/storage/contract_store/index.d.ts.map +1 -0
- package/dest/storage/contract_store/index.js +1 -0
- package/dest/storage/{contract_data_provider → contract_store}/private_functions_tree.d.ts +1 -1
- package/dest/storage/contract_store/private_functions_tree.d.ts.map +1 -0
- package/dest/storage/{contract_data_provider → contract_store}/private_functions_tree.js +1 -1
- package/dest/storage/index.d.ts +8 -8
- package/dest/storage/index.d.ts.map +1 -1
- package/dest/storage/index.js +7 -7
- package/dest/storage/metadata.d.ts +1 -1
- package/dest/storage/metadata.js +1 -1
- package/dest/storage/note_store/index.d.ts +3 -0
- package/dest/storage/note_store/index.d.ts.map +1 -0
- package/dest/storage/note_store/index.js +2 -0
- package/dest/storage/note_store/note_store.d.ts +83 -0
- package/dest/storage/note_store/note_store.d.ts.map +1 -0
- package/dest/storage/note_store/note_store.js +343 -0
- package/dest/storage/note_store/stored_note.d.ts +16 -0
- package/dest/storage/note_store/stored_note.d.ts.map +1 -0
- package/dest/storage/note_store/stored_note.js +43 -0
- package/dest/storage/private_event_store/private_event_store.d.ts +91 -0
- package/dest/storage/private_event_store/private_event_store.d.ts.map +1 -0
- package/dest/storage/private_event_store/private_event_store.js +276 -0
- package/dest/storage/private_event_store/stored_private_event.d.ts +23 -0
- package/dest/storage/private_event_store/stored_private_event.d.ts.map +1 -0
- package/dest/storage/private_event_store/stored_private_event.js +56 -0
- package/dest/storage/tagging_store/index.d.ts +4 -0
- package/dest/storage/tagging_store/index.d.ts.map +1 -0
- package/dest/storage/tagging_store/index.js +3 -0
- package/dest/storage/tagging_store/recipient_tagging_store.d.ts +28 -0
- package/dest/storage/tagging_store/recipient_tagging_store.d.ts.map +1 -0
- package/dest/storage/tagging_store/recipient_tagging_store.js +111 -0
- package/dest/storage/tagging_store/sender_address_book_store.d.ts +14 -0
- package/dest/storage/tagging_store/sender_address_book_store.d.ts.map +1 -0
- package/dest/storage/tagging_store/sender_address_book_store.js +36 -0
- package/dest/storage/tagging_store/sender_tagging_store.d.ts +78 -0
- package/dest/storage/tagging_store/sender_tagging_store.d.ts.map +1 -0
- package/dest/storage/tagging_store/sender_tagging_store.js +374 -0
- package/dest/tagging/constants.d.ts +2 -2
- package/dest/tagging/constants.d.ts.map +1 -1
- package/dest/tagging/constants.js +10 -2
- package/dest/tagging/get_all_logs_by_tags.d.ts +24 -0
- package/dest/tagging/get_all_logs_by_tags.d.ts.map +1 -0
- package/dest/tagging/get_all_logs_by_tags.js +60 -0
- package/dest/tagging/index.d.ts +17 -7
- package/dest/tagging/index.d.ts.map +1 -1
- package/dest/tagging/index.js +15 -5
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts +14 -0
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts.map +1 -0
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.js +85 -0
- package/dest/tagging/recipient_sync/utils/find_highest_indexes.d.ts +12 -0
- package/dest/tagging/recipient_sync/utils/find_highest_indexes.d.ts.map +1 -0
- package/dest/tagging/recipient_sync/utils/find_highest_indexes.js +20 -0
- package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts +14 -0
- package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts.map +1 -0
- package/dest/tagging/recipient_sync/utils/load_logs_for_range.js +33 -0
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts +17 -0
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts.map +1 -0
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.js +80 -0
- package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts +12 -0
- package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts.map +1 -0
- package/dest/tagging/sender_sync/utils/get_status_change_of_pending.js +39 -0
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts +19 -0
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts.map +1 -0
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.js +72 -0
- package/package.json +28 -19
- package/src/bin/check_oracle_version.ts +133 -22
- package/src/block_synchronizer/block_synchronizer.ts +198 -0
- package/src/block_synchronizer/index.ts +1 -0
- package/src/config/index.ts +12 -4
- package/src/config/package_info.ts +1 -1
- package/src/contract_function_simulator/benchmarked_node.ts +103 -0
- package/src/contract_function_simulator/contract_function_simulator.ts +424 -114
- package/src/contract_function_simulator/ephemeral_array_service.ts +110 -0
- package/src/contract_function_simulator/execution_note_cache.ts +51 -28
- package/src/contract_function_simulator/execution_tagging_index_cache.ts +19 -14
- package/src/contract_function_simulator/hashed_values_cache.ts +1 -1
- package/src/contract_function_simulator/index.ts +2 -1
- package/src/contract_function_simulator/noir-structs/event_validation_request.ts +15 -11
- package/src/contract_function_simulator/noir-structs/log_retrieval_request.ts +7 -6
- package/src/contract_function_simulator/noir-structs/log_retrieval_response.ts +3 -6
- package/src/contract_function_simulator/noir-structs/note_validation_request.ts +9 -12
- package/src/contract_function_simulator/noir-structs/utility_context.ts +6 -25
- package/src/contract_function_simulator/oracle/interfaces.ts +105 -62
- package/src/contract_function_simulator/oracle/legacy_oracle_mappings.ts +104 -0
- package/src/contract_function_simulator/oracle/message_load_oracle_inputs.ts +1 -1
- package/src/contract_function_simulator/oracle/note_packing_utils.ts +27 -13
- package/src/contract_function_simulator/oracle/oracle.ts +441 -163
- package/src/contract_function_simulator/oracle/private_execution.ts +6 -72
- package/src/contract_function_simulator/oracle/private_execution_oracle.ts +201 -167
- package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +676 -113
- package/src/contract_function_simulator/pick_notes.ts +23 -4
- package/src/contract_function_simulator/proxied_contract_data_source.ts +32 -8
- package/src/contract_logging.ts +52 -0
- package/src/contract_sync/contract_sync_service.ts +176 -0
- package/src/contract_sync/helpers.ts +98 -0
- package/src/debug/pxe_debug_utils.ts +93 -0
- package/src/entrypoints/client/bundle/index.ts +2 -1
- package/src/entrypoints/client/bundle/utils.ts +24 -18
- package/src/entrypoints/client/lazy/index.ts +2 -1
- package/src/entrypoints/client/lazy/utils.ts +25 -19
- package/src/entrypoints/pxe_creation_options.ts +13 -2
- package/src/entrypoints/server/index.ts +5 -2
- package/src/entrypoints/server/utils.ts +33 -42
- package/src/error_enriching.ts +7 -15
- package/src/events/event_service.ts +96 -0
- package/src/events/index.ts +1 -0
- package/src/events/private_event_filter_validator.ts +66 -0
- package/src/job_coordinator/job_coordinator.ts +150 -0
- package/src/logs/log_service.ts +192 -0
- package/src/messages/message_context_service.ts +44 -0
- package/src/notes/index.ts +1 -0
- package/src/notes/note_service.ts +206 -0
- package/src/notes_filter.ts +24 -0
- package/src/oracle_version.ts +20 -9
- package/src/private_kernel/hints/{compute_tx_include_by_timestamp.ts → compute_tx_expiration_timestamp.ts} +13 -13
- package/src/private_kernel/hints/index.ts +2 -2
- package/src/private_kernel/hints/{build_private_kernel_reset_private_inputs.ts → private_kernel_reset_private_inputs_builder.ts} +197 -139
- package/src/private_kernel/hints/test_utils.ts +325 -0
- package/src/private_kernel/private_kernel_execution_prover.ts +31 -27
- package/src/private_kernel/private_kernel_oracle.ts +118 -37
- package/src/pxe.ts +454 -354
- package/src/storage/{address_data_provider/address_data_provider.ts → address_store/address_store.ts} +16 -16
- package/src/storage/address_store/index.ts +1 -0
- package/src/storage/{sync_data_provider/sync_data_provider.ts → anchor_block_store/anchor_block_store.ts} +11 -12
- package/src/storage/anchor_block_store/index.ts +1 -0
- package/src/storage/capsule_store/capsule_service.ts +90 -0
- package/src/storage/capsule_store/capsule_store.ts +333 -0
- package/src/storage/capsule_store/index.ts +2 -0
- package/src/storage/contract_store/contract_store.ts +431 -0
- package/src/storage/contract_store/index.ts +1 -0
- package/src/storage/{contract_data_provider → contract_store}/private_functions_tree.ts +1 -1
- package/src/storage/index.ts +7 -7
- package/src/storage/metadata.ts +1 -1
- package/src/storage/note_store/index.ts +2 -0
- package/src/storage/note_store/note_store.ts +415 -0
- package/src/storage/note_store/stored_note.ts +48 -0
- package/src/storage/private_event_store/private_event_store.ts +388 -0
- package/src/storage/private_event_store/stored_private_event.ts +73 -0
- package/src/storage/tagging_store/index.ts +3 -0
- package/src/storage/tagging_store/recipient_tagging_store.ts +143 -0
- package/src/storage/tagging_store/sender_address_book_store.ts +48 -0
- package/src/storage/tagging_store/sender_tagging_store.ts +476 -0
- package/src/tagging/constants.ts +10 -2
- package/src/tagging/get_all_logs_by_tags.ts +92 -0
- package/src/tagging/index.ts +19 -6
- package/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts +130 -0
- package/src/tagging/recipient_sync/utils/find_highest_indexes.ts +34 -0
- package/src/tagging/recipient_sync/utils/load_logs_for_range.ts +44 -0
- package/src/tagging/sender_sync/sync_sender_tagging_indexes.ts +112 -0
- package/src/tagging/sender_sync/utils/get_status_change_of_pending.ts +51 -0
- package/src/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.ts +85 -0
- package/dest/contract_function_simulator/execution_data_provider.d.ts +0 -265
- package/dest/contract_function_simulator/execution_data_provider.d.ts.map +0 -1
- package/dest/contract_function_simulator/execution_data_provider.js +0 -14
- package/dest/contract_function_simulator/proxied_node.d.ts +0 -9
- package/dest/contract_function_simulator/proxied_node.d.ts.map +0 -1
- package/dest/contract_function_simulator/proxied_node.js +0 -27
- package/dest/contract_function_simulator/pxe_oracle_interface.d.ts +0 -122
- package/dest/contract_function_simulator/pxe_oracle_interface.d.ts.map +0 -1
- package/dest/contract_function_simulator/pxe_oracle_interface.js +0 -694
- package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts +0 -28
- package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts.map +0 -1
- package/dest/private_kernel/hints/compute_tx_include_by_timestamp.d.ts +0 -4
- package/dest/private_kernel/hints/compute_tx_include_by_timestamp.d.ts.map +0 -1
- package/dest/private_kernel/private_kernel_oracle_impl.d.ts +0 -45
- package/dest/private_kernel/private_kernel_oracle_impl.d.ts.map +0 -1
- package/dest/private_kernel/private_kernel_oracle_impl.js +0 -86
- package/dest/storage/address_data_provider/address_data_provider.d.ts +0 -11
- package/dest/storage/address_data_provider/address_data_provider.d.ts.map +0 -1
- package/dest/storage/address_data_provider/index.d.ts +0 -2
- package/dest/storage/address_data_provider/index.d.ts.map +0 -1
- package/dest/storage/address_data_provider/index.js +0 -1
- package/dest/storage/capsule_data_provider/capsule_data_provider.d.ts +0 -25
- package/dest/storage/capsule_data_provider/capsule_data_provider.d.ts.map +0 -1
- package/dest/storage/capsule_data_provider/capsule_data_provider.js +0 -118
- package/dest/storage/capsule_data_provider/index.d.ts +0 -2
- package/dest/storage/capsule_data_provider/index.d.ts.map +0 -1
- package/dest/storage/capsule_data_provider/index.js +0 -1
- package/dest/storage/contract_data_provider/contract_data_provider.d.ts +0 -64
- package/dest/storage/contract_data_provider/contract_data_provider.d.ts.map +0 -1
- package/dest/storage/contract_data_provider/contract_data_provider.js +0 -193
- package/dest/storage/contract_data_provider/index.d.ts +0 -2
- package/dest/storage/contract_data_provider/index.d.ts.map +0 -1
- package/dest/storage/contract_data_provider/index.js +0 -1
- package/dest/storage/contract_data_provider/private_functions_tree.d.ts.map +0 -1
- package/dest/storage/note_data_provider/index.d.ts +0 -3
- package/dest/storage/note_data_provider/index.d.ts.map +0 -1
- package/dest/storage/note_data_provider/index.js +0 -2
- package/dest/storage/note_data_provider/note_data_provider.d.ts +0 -83
- package/dest/storage/note_data_provider/note_data_provider.d.ts.map +0 -1
- package/dest/storage/note_data_provider/note_data_provider.js +0 -311
- package/dest/storage/private_event_data_provider/private_event_data_provider.d.ts +0 -37
- package/dest/storage/private_event_data_provider/private_event_data_provider.d.ts.map +0 -1
- package/dest/storage/private_event_data_provider/private_event_data_provider.js +0 -105
- package/dest/storage/sync_data_provider/index.d.ts.map +0 -1
- package/dest/storage/sync_data_provider/index.js +0 -1
- package/dest/storage/sync_data_provider/sync_data_provider.d.ts +0 -10
- package/dest/storage/sync_data_provider/sync_data_provider.d.ts.map +0 -1
- package/dest/storage/sync_data_provider/sync_data_provider.js +0 -26
- package/dest/storage/tagging_data_provider/index.d.ts +0 -2
- package/dest/storage/tagging_data_provider/index.d.ts.map +0 -1
- package/dest/storage/tagging_data_provider/index.js +0 -1
- package/dest/storage/tagging_data_provider/tagging_data_provider.d.ts +0 -40
- package/dest/storage/tagging_data_provider/tagging_data_provider.d.ts.map +0 -1
- package/dest/storage/tagging_data_provider/tagging_data_provider.js +0 -89
- package/dest/synchronizer/index.d.ts +0 -2
- package/dest/synchronizer/index.d.ts.map +0 -1
- package/dest/synchronizer/index.js +0 -1
- package/dest/synchronizer/synchronizer.d.ts +0 -35
- package/dest/synchronizer/synchronizer.d.ts.map +0 -1
- package/dest/synchronizer/synchronizer.js +0 -101
- package/dest/tagging/siloed_tag.d.ts +0 -14
- package/dest/tagging/siloed_tag.d.ts.map +0 -1
- package/dest/tagging/siloed_tag.js +0 -20
- package/dest/tagging/tag.d.ts +0 -12
- package/dest/tagging/tag.d.ts.map +0 -1
- package/dest/tagging/tag.js +0 -17
- package/dest/tagging/utils.d.ts +0 -18
- package/dest/tagging/utils.d.ts.map +0 -1
- package/dest/tagging/utils.js +0 -24
- package/src/contract_function_simulator/execution_data_provider.ts +0 -333
- package/src/contract_function_simulator/proxied_node.ts +0 -33
- package/src/contract_function_simulator/pxe_oracle_interface.ts +0 -1008
- package/src/private_kernel/private_kernel_oracle_impl.ts +0 -132
- package/src/storage/address_data_provider/index.ts +0 -1
- package/src/storage/capsule_data_provider/capsule_data_provider.ts +0 -147
- package/src/storage/capsule_data_provider/index.ts +0 -1
- package/src/storage/contract_data_provider/contract_data_provider.ts +0 -277
- package/src/storage/contract_data_provider/index.ts +0 -1
- package/src/storage/note_data_provider/index.ts +0 -2
- package/src/storage/note_data_provider/note_data_provider.ts +0 -399
- package/src/storage/private_event_data_provider/private_event_data_provider.ts +0 -143
- package/src/storage/sync_data_provider/index.ts +0 -1
- package/src/storage/tagging_data_provider/index.ts +0 -1
- package/src/storage/tagging_data_provider/tagging_data_provider.ts +0 -120
- package/src/synchronizer/index.ts +0 -1
- package/src/synchronizer/synchronizer.ts +0 -120
- package/src/tagging/siloed_tag.ts +0 -22
- package/src/tagging/tag.ts +0 -16
- package/src/tagging/utils.ts +0 -31
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
2
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
|
+
import { Point } from '@aztec/foundation/curves/grumpkin';
|
|
2
4
|
import {
|
|
3
5
|
type ACIRCallback,
|
|
4
6
|
type ACVMField,
|
|
@@ -10,11 +12,13 @@ import {
|
|
|
10
12
|
} from '@aztec/simulator/client';
|
|
11
13
|
import { FunctionSelector, NoteSelector } from '@aztec/stdlib/abi';
|
|
12
14
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
15
|
+
import { BlockHash } from '@aztec/stdlib/block';
|
|
13
16
|
import { ContractClassLog, ContractClassLogFields } from '@aztec/stdlib/logs';
|
|
14
|
-
import { MerkleTreeId } from '@aztec/stdlib/trees';
|
|
15
17
|
|
|
18
|
+
import { ORACLE_VERSION_MAJOR, ORACLE_VERSION_MINOR } from '../../oracle_version.js';
|
|
16
19
|
import type { IMiscOracle, IPrivateExecutionOracle, IUtilityExecutionOracle } from './interfaces.js';
|
|
17
|
-
import {
|
|
20
|
+
import { buildLegacyOracleCallbacks } from './legacy_oracle_mappings.js';
|
|
21
|
+
import { packAsHintedNote } from './note_packing_utils.js';
|
|
18
22
|
|
|
19
23
|
export class UnavailableOracleError extends Error {
|
|
20
24
|
constructor(oracleName: string) {
|
|
@@ -24,6 +28,25 @@ export class UnavailableOracleError extends Error {
|
|
|
24
28
|
|
|
25
29
|
/**
|
|
26
30
|
* A data source that has all the apis required by Aztec.nr.
|
|
31
|
+
*
|
|
32
|
+
* ## Oracle naming conventions
|
|
33
|
+
*
|
|
34
|
+
* We try to keep oracle naming consistent, please see below the conventions we adhere to.
|
|
35
|
+
*
|
|
36
|
+
* Each oracle method name has the form `aztec_{scope}_{verb}{Object}`, where:
|
|
37
|
+
*
|
|
38
|
+
* - **Scope prefix** indicates the execution context required:
|
|
39
|
+
* - `aztec_prv_` — available only during private function execution.
|
|
40
|
+
* - `aztec_utl_` — available during both utility and private execution.
|
|
41
|
+
*
|
|
42
|
+
* - **Verb** signals the operation's semantics (verb-first, then object):
|
|
43
|
+
* - `get` — read / lookup / get data from oracle into contract.
|
|
44
|
+
* - `does`/`is`/`has` — predicate (returns boolean).
|
|
45
|
+
* - `emit`/`notify` — propagate data from contract to oracle.
|
|
46
|
+
* - `set` — contract driven oracle state mutation (capsules, execution cache, tagging, etc).
|
|
47
|
+
* - `call` — trigger nested execution (control flow).
|
|
48
|
+
* - `assert` — validate a condition, throw on failure.
|
|
49
|
+
* - Standalone verbs (`delete`, `copy`, `decrypt`, `log`, etc) are used when no generic verb fits.
|
|
27
50
|
*/
|
|
28
51
|
export class Oracle {
|
|
29
52
|
constructor(private handler: IMiscOracle | IUtilityExecutionOracle | IPrivateExecutionOracle) {}
|
|
@@ -67,12 +90,12 @@ export class Oracle {
|
|
|
67
90
|
name => !excludedProps.includes(name as (typeof excludedProps)[number]),
|
|
68
91
|
);
|
|
69
92
|
|
|
70
|
-
// Validate oracle names - these must be prefixed with either "
|
|
93
|
+
// Validate oracle names - these must be prefixed with either "aztec_prv_" or "aztec_utl_" to indicate their scope
|
|
71
94
|
// and must correspond to a function on the Oracle class.
|
|
72
95
|
oracleNames.forEach(name => {
|
|
73
|
-
if (!name.startsWith('
|
|
96
|
+
if (!name.startsWith('aztec_prv_') && !name.startsWith('aztec_utl_')) {
|
|
74
97
|
throw new Error(
|
|
75
|
-
`Oracle function "${name}" must be prefixed with either "
|
|
98
|
+
`Oracle function "${name}" must be prefixed with either "aztec_prv_" or "aztec_utl_" to indicate its scope`,
|
|
76
99
|
);
|
|
77
100
|
}
|
|
78
101
|
|
|
@@ -83,48 +106,110 @@ export class Oracle {
|
|
|
83
106
|
});
|
|
84
107
|
|
|
85
108
|
// Build callback object and return it
|
|
86
|
-
|
|
109
|
+
const callback = oracleNames.reduce((acc, name) => {
|
|
87
110
|
const method = this[name as keyof Omit<Oracle, (typeof excludedProps)[number]>];
|
|
88
111
|
acc[name] = method.bind(this);
|
|
89
112
|
return acc;
|
|
90
113
|
}, {} as ACIRCallback);
|
|
114
|
+
|
|
115
|
+
const allCallbacks = { ...callback, ...buildLegacyOracleCallbacks(this) };
|
|
116
|
+
|
|
117
|
+
// Wrap in a Proxy to intercept access to missing oracle names and provide enhanced error messages when the
|
|
118
|
+
// contract's minor version is higher than the PXE's (i.e. the contract expects oracles that were added in a newer
|
|
119
|
+
// minor version).
|
|
120
|
+
const handler = this.handler;
|
|
121
|
+
return new Proxy(allCallbacks, {
|
|
122
|
+
get(target, prop: string) {
|
|
123
|
+
if (prop in target) {
|
|
124
|
+
return target[prop];
|
|
125
|
+
}
|
|
126
|
+
// Return a function that throws with an enhanced error message if applicable
|
|
127
|
+
return () => {
|
|
128
|
+
type NonOracleFunctionGetContractOracleVersion = {
|
|
129
|
+
nonOracleFunctionGetContractOracleVersion(): { major: number; minor: number } | undefined;
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
let contractVersion = undefined;
|
|
133
|
+
if ('nonOracleFunctionGetContractOracleVersion' in handler) {
|
|
134
|
+
contractVersion = (
|
|
135
|
+
handler as unknown as NonOracleFunctionGetContractOracleVersion
|
|
136
|
+
).nonOracleFunctionGetContractOracleVersion();
|
|
137
|
+
}
|
|
138
|
+
if (!contractVersion) {
|
|
139
|
+
throw new Error(
|
|
140
|
+
`Oracle '${prop}' not found and the contract's oracle version is unknown (the version check oracle ` +
|
|
141
|
+
`was not called before '${prop}'). This usually means the contract was not compiled with the ` +
|
|
142
|
+
`#[aztec] macro, which injects the version check as the first oracle call in every private/utility ` +
|
|
143
|
+
`external function. If you're using a custom entry point, ensure assert_compatible_oracle_version() ` +
|
|
144
|
+
`is called before any other oracle calls. See https://docs.aztec.network/errors/8`,
|
|
145
|
+
);
|
|
146
|
+
} else if (contractVersion.minor > ORACLE_VERSION_MINOR) {
|
|
147
|
+
throw new Error(
|
|
148
|
+
`Oracle '${prop}' not found.` +
|
|
149
|
+
` This usually means the contract requires a newer private execution environment than you have.` +
|
|
150
|
+
` Upgrade your private execution environment to a compatible version. The contract was compiled with` +
|
|
151
|
+
` Aztec.nr oracle version ${contractVersion.major}.${contractVersion.minor}, but this private` +
|
|
152
|
+
` execution environment only supports up to ${ORACLE_VERSION_MAJOR}.${ORACLE_VERSION_MINOR}.` +
|
|
153
|
+
` See https://docs.aztec.network/errors/8`,
|
|
154
|
+
);
|
|
155
|
+
} else {
|
|
156
|
+
throw new Error(
|
|
157
|
+
`Oracle '${prop}' not found.` +
|
|
158
|
+
` The contract's oracle version (${contractVersion.major}.${contractVersion.minor}) is compatible` +
|
|
159
|
+
` with this private execution environment (${ORACLE_VERSION_MAJOR}.${ORACLE_VERSION_MINOR}), so all` +
|
|
160
|
+
` standard oracles should be available. This could mean the contract was compiled against a modified` +
|
|
161
|
+
` version of Aztec.nr, or that it references an oracle that does not exist.` +
|
|
162
|
+
` See https://docs.aztec.network/errors/8`,
|
|
163
|
+
);
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
},
|
|
167
|
+
});
|
|
91
168
|
}
|
|
92
169
|
|
|
93
|
-
|
|
94
|
-
|
|
170
|
+
// eslint-disable-next-line camelcase
|
|
171
|
+
aztec_utl_assertCompatibleOracleVersionV2([major]: ACVMField[], [minor]: ACVMField[]) {
|
|
172
|
+
this.handlerAsMisc().assertCompatibleOracleVersion(
|
|
173
|
+
Fr.fromString(major).toNumber(),
|
|
174
|
+
Fr.fromString(minor).toNumber(),
|
|
175
|
+
);
|
|
95
176
|
return Promise.resolve([]);
|
|
96
177
|
}
|
|
97
178
|
|
|
98
|
-
|
|
99
|
-
|
|
179
|
+
// eslint-disable-next-line camelcase
|
|
180
|
+
aztec_utl_getRandomField(): Promise<ACVMField[]> {
|
|
181
|
+
const val = this.handlerAsMisc().getRandomField();
|
|
100
182
|
return Promise.resolve([toACVMField(val)]);
|
|
101
183
|
}
|
|
102
184
|
|
|
103
|
-
|
|
104
|
-
|
|
185
|
+
// eslint-disable-next-line camelcase
|
|
186
|
+
aztec_prv_setHashPreimage(values: ACVMField[], [hash]: ACVMField[]): Promise<ACVMField[]> {
|
|
187
|
+
this.handlerAsPrivate().setHashPreimage(values.map(Fr.fromString), Fr.fromString(hash));
|
|
105
188
|
return Promise.resolve([]);
|
|
106
189
|
}
|
|
107
190
|
|
|
108
|
-
|
|
109
|
-
|
|
191
|
+
// eslint-disable-next-line camelcase
|
|
192
|
+
async aztec_prv_getHashPreimage([returnsHash]: ACVMField[]): Promise<ACVMField[][]> {
|
|
193
|
+
const values = await this.handlerAsPrivate().getHashPreimage(Fr.fromString(returnsHash));
|
|
110
194
|
return [values.map(toACVMField)];
|
|
111
195
|
}
|
|
112
196
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
197
|
+
// eslint-disable-next-line camelcase
|
|
198
|
+
aztec_utl_getUtilityContext(): Promise<(ACVMField | ACVMField[])[]> {
|
|
199
|
+
const context = this.handlerAsUtility().getUtilityContext();
|
|
200
|
+
return Promise.resolve(context.toNoirRepresentation());
|
|
116
201
|
}
|
|
117
202
|
|
|
118
|
-
|
|
119
|
-
|
|
203
|
+
// eslint-disable-next-line camelcase
|
|
204
|
+
async aztec_utl_getKeyValidationRequest([pkMHash]: ACVMField[]): Promise<ACVMField[]> {
|
|
205
|
+
const keyValidationRequest = await this.handlerAsUtility().getKeyValidationRequest(Fr.fromString(pkMHash));
|
|
120
206
|
|
|
121
207
|
return keyValidationRequest.toFields().map(toACVMField);
|
|
122
208
|
}
|
|
123
209
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
);
|
|
210
|
+
// eslint-disable-next-line camelcase
|
|
211
|
+
async aztec_utl_getContractInstance([address]: ACVMField[]): Promise<ACVMField[]> {
|
|
212
|
+
const instance = await this.handlerAsUtility().getContractInstance(AztecAddress.fromField(Fr.fromString(address)));
|
|
128
213
|
|
|
129
214
|
return [
|
|
130
215
|
instance.salt,
|
|
@@ -135,106 +220,132 @@ export class Oracle {
|
|
|
135
220
|
].map(toACVMField);
|
|
136
221
|
}
|
|
137
222
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
[
|
|
141
|
-
[
|
|
223
|
+
// eslint-disable-next-line camelcase
|
|
224
|
+
async aztec_utl_getNoteHashMembershipWitness(
|
|
225
|
+
[anchorBlockHash]: ACVMField[],
|
|
226
|
+
[noteHash]: ACVMField[],
|
|
142
227
|
): Promise<(ACVMField | ACVMField[])[]> {
|
|
143
|
-
const
|
|
144
|
-
const
|
|
145
|
-
const parsedLeafValue = Fr.fromString(leafValue);
|
|
228
|
+
const parsedAnchorBlockHash = BlockHash.fromString(anchorBlockHash);
|
|
229
|
+
const parsedNoteHash = Fr.fromString(noteHash);
|
|
146
230
|
|
|
147
|
-
const witness = await this.handlerAsUtility().
|
|
148
|
-
parsedBlockNumber,
|
|
149
|
-
parsedTreeId,
|
|
150
|
-
parsedLeafValue,
|
|
151
|
-
);
|
|
231
|
+
const witness = await this.handlerAsUtility().getNoteHashMembershipWitness(parsedAnchorBlockHash, parsedNoteHash);
|
|
152
232
|
if (!witness) {
|
|
153
233
|
throw new Error(
|
|
154
|
-
`
|
|
234
|
+
`Note hash ${noteHash} not found in the note hash tree at anchor block hash ${parsedAnchorBlockHash.toString()}.`,
|
|
155
235
|
);
|
|
156
236
|
}
|
|
157
|
-
return
|
|
237
|
+
return witness.toNoirRepresentation();
|
|
158
238
|
}
|
|
159
239
|
|
|
160
|
-
|
|
161
|
-
|
|
240
|
+
// eslint-disable-next-line camelcase
|
|
241
|
+
async aztec_utl_getBlockHashMembershipWitness(
|
|
242
|
+
[anchorBlockHash]: ACVMField[],
|
|
243
|
+
[blockHash]: ACVMField[],
|
|
244
|
+
): Promise<(ACVMField | ACVMField[])[]> {
|
|
245
|
+
const parsedAnchorBlockHash = BlockHash.fromString(anchorBlockHash);
|
|
246
|
+
const parsedBlockHash = BlockHash.fromString(blockHash);
|
|
247
|
+
|
|
248
|
+
const witness = await this.handlerAsUtility().getBlockHashMembershipWitness(parsedAnchorBlockHash, parsedBlockHash);
|
|
249
|
+
if (!witness) {
|
|
250
|
+
throw new Error(
|
|
251
|
+
`Block hash ${parsedBlockHash.toString()} not found in the archive tree at anchor block ${parsedAnchorBlockHash.toString()}.`,
|
|
252
|
+
);
|
|
253
|
+
}
|
|
254
|
+
return witness.toNoirRepresentation();
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
// eslint-disable-next-line camelcase
|
|
258
|
+
async aztec_utl_getNullifierMembershipWitness(
|
|
259
|
+
[blockHash]: ACVMField[],
|
|
162
260
|
[nullifier]: ACVMField[], // nullifier, we try to find the witness for (to prove inclusion)
|
|
163
261
|
): Promise<(ACVMField | ACVMField[])[]> {
|
|
164
|
-
const
|
|
262
|
+
const parsedBlockHash = BlockHash.fromString(blockHash);
|
|
165
263
|
const parsedNullifier = Fr.fromString(nullifier);
|
|
166
264
|
|
|
167
|
-
const witness = await this.handlerAsUtility().
|
|
168
|
-
parsedBlockNumber,
|
|
169
|
-
parsedNullifier,
|
|
170
|
-
);
|
|
265
|
+
const witness = await this.handlerAsUtility().getNullifierMembershipWitness(parsedBlockHash, parsedNullifier);
|
|
171
266
|
if (!witness) {
|
|
172
|
-
throw new Error(
|
|
267
|
+
throw new Error(
|
|
268
|
+
`Nullifier witness not found for nullifier ${parsedNullifier} at block hash ${parsedBlockHash.toString()}.`,
|
|
269
|
+
);
|
|
173
270
|
}
|
|
174
271
|
return witness.toNoirRepresentation();
|
|
175
272
|
}
|
|
176
273
|
|
|
177
|
-
|
|
178
|
-
|
|
274
|
+
// eslint-disable-next-line camelcase
|
|
275
|
+
async aztec_utl_getLowNullifierMembershipWitness(
|
|
276
|
+
[blockHash]: ACVMField[],
|
|
179
277
|
[nullifier]: ACVMField[], // nullifier, we try to find the low nullifier witness for (to prove non-inclusion)
|
|
180
278
|
): Promise<(ACVMField | ACVMField[])[]> {
|
|
181
|
-
const
|
|
279
|
+
const parsedBlockHash = BlockHash.fromString(blockHash);
|
|
182
280
|
const parsedNullifier = Fr.fromString(nullifier);
|
|
183
281
|
|
|
184
|
-
const witness = await this.handlerAsUtility().
|
|
185
|
-
parsedBlockNumber,
|
|
186
|
-
parsedNullifier,
|
|
187
|
-
);
|
|
282
|
+
const witness = await this.handlerAsUtility().getLowNullifierMembershipWitness(parsedBlockHash, parsedNullifier);
|
|
188
283
|
if (!witness) {
|
|
189
284
|
throw new Error(
|
|
190
|
-
`Low nullifier witness not found for nullifier ${parsedNullifier} at block ${
|
|
285
|
+
`Low nullifier witness not found for nullifier ${parsedNullifier} at block hash ${parsedBlockHash.toString()}.`,
|
|
191
286
|
);
|
|
192
287
|
}
|
|
193
288
|
return witness.toNoirRepresentation();
|
|
194
289
|
}
|
|
195
290
|
|
|
196
|
-
|
|
197
|
-
|
|
291
|
+
// eslint-disable-next-line camelcase
|
|
292
|
+
async aztec_utl_getPublicDataWitness(
|
|
293
|
+
[blockHash]: ACVMField[],
|
|
198
294
|
[leafSlot]: ACVMField[],
|
|
199
295
|
): Promise<(ACVMField | ACVMField[])[]> {
|
|
200
|
-
const
|
|
296
|
+
const parsedBlockHash = BlockHash.fromString(blockHash);
|
|
201
297
|
const parsedLeafSlot = Fr.fromString(leafSlot);
|
|
202
298
|
|
|
203
|
-
const witness = await this.handlerAsUtility().
|
|
299
|
+
const witness = await this.handlerAsUtility().getPublicDataWitness(parsedBlockHash, parsedLeafSlot);
|
|
204
300
|
if (!witness) {
|
|
205
|
-
throw new Error(
|
|
301
|
+
throw new Error(
|
|
302
|
+
`Public data witness not found for slot ${parsedLeafSlot} at block hash ${parsedBlockHash.toString()}.`,
|
|
303
|
+
);
|
|
206
304
|
}
|
|
207
305
|
return witness.toNoirRepresentation();
|
|
208
306
|
}
|
|
209
307
|
|
|
210
|
-
|
|
308
|
+
// eslint-disable-next-line camelcase
|
|
309
|
+
async aztec_utl_getBlockHeader([blockNumber]: ACVMField[]): Promise<ACVMField[]> {
|
|
211
310
|
const parsedBlockNumber = Fr.fromString(blockNumber).toNumber();
|
|
212
311
|
|
|
213
|
-
const header = await this.handlerAsUtility().
|
|
312
|
+
const header = await this.handlerAsUtility().getBlockHeader(BlockNumber(parsedBlockNumber));
|
|
214
313
|
if (!header) {
|
|
215
314
|
throw new Error(`Block header not found for block ${parsedBlockNumber}.`);
|
|
216
315
|
}
|
|
217
316
|
return header.toFields().map(toACVMField);
|
|
218
317
|
}
|
|
219
318
|
|
|
220
|
-
|
|
319
|
+
// eslint-disable-next-line camelcase
|
|
320
|
+
async aztec_utl_getAuthWitness([messageHash]: ACVMField[]): Promise<ACVMField[][]> {
|
|
221
321
|
const messageHashField = Fr.fromString(messageHash);
|
|
222
|
-
const witness = await this.handlerAsUtility().
|
|
322
|
+
const witness = await this.handlerAsUtility().getAuthWitness(messageHashField);
|
|
223
323
|
if (!witness) {
|
|
224
324
|
throw new Error(`Unknown auth witness for message hash ${messageHashField}`);
|
|
225
325
|
}
|
|
226
326
|
return [witness.map(toACVMField)];
|
|
227
327
|
}
|
|
228
328
|
|
|
229
|
-
|
|
329
|
+
// eslint-disable-next-line camelcase
|
|
330
|
+
async aztec_utl_getPublicKeysAndPartialAddress([address]: ACVMField[]): Promise<(ACVMField | ACVMField[])[]> {
|
|
230
331
|
const parsedAddress = AztecAddress.fromField(Fr.fromString(address));
|
|
231
|
-
const
|
|
232
|
-
await this.handlerAsUtility().utilityGetPublicKeysAndPartialAddress(parsedAddress);
|
|
332
|
+
const result = await this.handlerAsUtility().getPublicKeysAndPartialAddress(parsedAddress);
|
|
233
333
|
|
|
234
|
-
return
|
|
334
|
+
// We are going to return a Noir Option struct to represent the possibility of null values. Options are a struct
|
|
335
|
+
// with two fields: `some` (a boolean) and `value` (a field array in this case).
|
|
336
|
+
if (result === undefined) {
|
|
337
|
+
// No data was found so we set `some` to 0 and pad `value` with zeros get the correct return size.
|
|
338
|
+
return [toACVMField(0), Array(13).fill(toACVMField(0))];
|
|
339
|
+
} else {
|
|
340
|
+
// Data was found so we set `some` to 1 and return it along with `value`.
|
|
341
|
+
return [toACVMField(1), [...result.publicKeys.toFields(), result.partialAddress].map(toACVMField)];
|
|
342
|
+
}
|
|
235
343
|
}
|
|
236
344
|
|
|
237
|
-
|
|
345
|
+
// eslint-disable-next-line camelcase
|
|
346
|
+
async aztec_utl_getNotes(
|
|
347
|
+
[ownerSome]: ACVMField[],
|
|
348
|
+
[ownerValue]: ACVMField[],
|
|
238
349
|
[storageSlot]: ACVMField[],
|
|
239
350
|
[numSelects]: ACVMField[],
|
|
240
351
|
selectByIndexes: ACVMField[],
|
|
@@ -250,9 +361,12 @@ export class Oracle {
|
|
|
250
361
|
[offset]: ACVMField[],
|
|
251
362
|
[status]: ACVMField[],
|
|
252
363
|
[maxNotes]: ACVMField[],
|
|
253
|
-
[
|
|
364
|
+
[packedHintedNoteLength]: ACVMField[],
|
|
254
365
|
): Promise<(ACVMField | ACVMField[])[]> {
|
|
255
|
-
|
|
366
|
+
// Parse Option<AztecAddress>: ownerSome is 0 for None, 1 for Some
|
|
367
|
+
const owner = Fr.fromString(ownerSome).toNumber() === 1 ? AztecAddress.fromString(ownerValue) : undefined;
|
|
368
|
+
const noteDatas = await this.handlerAsUtility().getNotes(
|
|
369
|
+
owner,
|
|
256
370
|
Fr.fromString(storageSlot),
|
|
257
371
|
+numSelects,
|
|
258
372
|
selectByIndexes.map(s => +s),
|
|
@@ -269,18 +383,30 @@ export class Oracle {
|
|
|
269
383
|
+status,
|
|
270
384
|
);
|
|
271
385
|
|
|
272
|
-
const
|
|
386
|
+
const returnDataAsArrayOfPackedHintedNotes = noteDatas.map(noteData =>
|
|
387
|
+
packAsHintedNote({
|
|
388
|
+
contractAddress: noteData.contractAddress,
|
|
389
|
+
owner: noteData.owner,
|
|
390
|
+
randomness: noteData.randomness,
|
|
391
|
+
storageSlot: noteData.storageSlot,
|
|
392
|
+
noteNonce: noteData.noteNonce,
|
|
393
|
+
isPending: noteData.isPending,
|
|
394
|
+
note: noteData.note,
|
|
395
|
+
}),
|
|
396
|
+
);
|
|
273
397
|
|
|
274
398
|
// Now we convert each sub-array to an array of ACVMField
|
|
275
|
-
const returnDataAsArrayOfACVMFieldArrays =
|
|
399
|
+
const returnDataAsArrayOfACVMFieldArrays = returnDataAsArrayOfPackedHintedNotes.map(subArray =>
|
|
276
400
|
subArray.map(toACVMField),
|
|
277
401
|
);
|
|
278
402
|
|
|
279
403
|
// At last we convert the array of arrays to a bounded vec of arrays
|
|
280
|
-
return arrayOfArraysToBoundedVecOfArrays(returnDataAsArrayOfACVMFieldArrays, +maxNotes, +
|
|
404
|
+
return arrayOfArraysToBoundedVecOfArrays(returnDataAsArrayOfACVMFieldArrays, +maxNotes, +packedHintedNoteLength);
|
|
281
405
|
}
|
|
282
406
|
|
|
283
|
-
|
|
407
|
+
// eslint-disable-next-line camelcase
|
|
408
|
+
aztec_prv_notifyCreatedNote(
|
|
409
|
+
[owner]: ACVMField[],
|
|
284
410
|
[storageSlot]: ACVMField[],
|
|
285
411
|
[randomness]: ACVMField[],
|
|
286
412
|
[noteTypeId]: ACVMField[],
|
|
@@ -288,7 +414,8 @@ export class Oracle {
|
|
|
288
414
|
[noteHash]: ACVMField[],
|
|
289
415
|
[counter]: ACVMField[],
|
|
290
416
|
): Promise<ACVMField[]> {
|
|
291
|
-
this.handlerAsPrivate().
|
|
417
|
+
this.handlerAsPrivate().notifyCreatedNote(
|
|
418
|
+
AztecAddress.fromString(owner),
|
|
292
419
|
Fr.fromString(storageSlot),
|
|
293
420
|
Fr.fromString(randomness),
|
|
294
421
|
NoteSelector.fromField(Fr.fromString(noteTypeId)),
|
|
@@ -299,35 +426,47 @@ export class Oracle {
|
|
|
299
426
|
return Promise.resolve([]);
|
|
300
427
|
}
|
|
301
428
|
|
|
302
|
-
|
|
429
|
+
// eslint-disable-next-line camelcase
|
|
430
|
+
async aztec_prv_notifyNullifiedNote(
|
|
303
431
|
[innerNullifier]: ACVMField[],
|
|
304
432
|
[noteHash]: ACVMField[],
|
|
305
433
|
[counter]: ACVMField[],
|
|
306
434
|
): Promise<ACVMField[]> {
|
|
307
|
-
await this.handlerAsPrivate().
|
|
308
|
-
Fr.fromString(innerNullifier),
|
|
309
|
-
Fr.fromString(noteHash),
|
|
310
|
-
+counter,
|
|
311
|
-
);
|
|
435
|
+
await this.handlerAsPrivate().notifyNullifiedNote(Fr.fromString(innerNullifier), Fr.fromString(noteHash), +counter);
|
|
312
436
|
return [];
|
|
313
437
|
}
|
|
314
438
|
|
|
315
|
-
|
|
316
|
-
|
|
439
|
+
// eslint-disable-next-line camelcase
|
|
440
|
+
async aztec_prv_notifyCreatedNullifier([innerNullifier]: ACVMField[]): Promise<ACVMField[]> {
|
|
441
|
+
await this.handlerAsPrivate().notifyCreatedNullifier(Fr.fromString(innerNullifier));
|
|
317
442
|
return [];
|
|
318
443
|
}
|
|
319
444
|
|
|
320
|
-
|
|
321
|
-
|
|
445
|
+
// eslint-disable-next-line camelcase
|
|
446
|
+
async aztec_prv_isNullifierPending(
|
|
447
|
+
[innerNullifier]: ACVMField[],
|
|
448
|
+
[contractAddress]: ACVMField[],
|
|
449
|
+
): Promise<ACVMField[]> {
|
|
450
|
+
const isPending = await this.handlerAsPrivate().isNullifierPending(
|
|
451
|
+
Fr.fromString(innerNullifier),
|
|
452
|
+
AztecAddress.fromString(contractAddress),
|
|
453
|
+
);
|
|
454
|
+
return [toACVMField(isPending)];
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
// eslint-disable-next-line camelcase
|
|
458
|
+
async aztec_utl_doesNullifierExist([innerNullifier]: ACVMField[]): Promise<ACVMField[]> {
|
|
459
|
+
const exists = await this.handlerAsUtility().doesNullifierExist(Fr.fromString(innerNullifier));
|
|
322
460
|
return [toACVMField(exists)];
|
|
323
461
|
}
|
|
324
462
|
|
|
325
|
-
|
|
463
|
+
// eslint-disable-next-line camelcase
|
|
464
|
+
async aztec_utl_getL1ToL2MembershipWitness(
|
|
326
465
|
[contractAddress]: ACVMField[],
|
|
327
466
|
[messageHash]: ACVMField[],
|
|
328
467
|
[secret]: ACVMField[],
|
|
329
468
|
): Promise<(ACVMField | ACVMField[])[]> {
|
|
330
|
-
const message = await this.handlerAsUtility().
|
|
469
|
+
const message = await this.handlerAsUtility().getL1ToL2MembershipWitness(
|
|
331
470
|
AztecAddress.fromString(contractAddress),
|
|
332
471
|
Fr.fromString(messageHash),
|
|
333
472
|
Fr.fromString(secret),
|
|
@@ -335,22 +474,24 @@ export class Oracle {
|
|
|
335
474
|
return message.toNoirRepresentation();
|
|
336
475
|
}
|
|
337
476
|
|
|
338
|
-
|
|
477
|
+
// eslint-disable-next-line camelcase
|
|
478
|
+
async aztec_utl_getFromPublicStorage(
|
|
479
|
+
[blockHash]: ACVMField[],
|
|
339
480
|
[contractAddress]: ACVMField[],
|
|
340
481
|
[startStorageSlot]: ACVMField[],
|
|
341
|
-
[blockNumber]: ACVMField[],
|
|
342
482
|
[numberOfElements]: ACVMField[],
|
|
343
483
|
): Promise<ACVMField[][]> {
|
|
344
|
-
const values = await this.handlerAsUtility().
|
|
484
|
+
const values = await this.handlerAsUtility().getFromPublicStorage(
|
|
485
|
+
BlockHash.fromString(blockHash),
|
|
345
486
|
new AztecAddress(Fr.fromString(contractAddress)),
|
|
346
487
|
Fr.fromString(startStorageSlot),
|
|
347
|
-
+blockNumber,
|
|
348
488
|
+numberOfElements,
|
|
349
489
|
);
|
|
350
490
|
return [values.map(toACVMField)];
|
|
351
491
|
}
|
|
352
492
|
|
|
353
|
-
|
|
493
|
+
// eslint-disable-next-line camelcase
|
|
494
|
+
aztec_prv_notifyCreatedContractClassLog(
|
|
354
495
|
[contractAddress]: ACVMField[],
|
|
355
496
|
message: ACVMField[],
|
|
356
497
|
[length]: ACVMField[],
|
|
@@ -359,11 +500,12 @@ export class Oracle {
|
|
|
359
500
|
const logFields = new ContractClassLogFields(message.map(Fr.fromString));
|
|
360
501
|
const log = new ContractClassLog(new AztecAddress(Fr.fromString(contractAddress)), logFields, +length);
|
|
361
502
|
|
|
362
|
-
this.handlerAsPrivate().
|
|
503
|
+
this.handlerAsPrivate().notifyCreatedContractClassLog(log, +counter);
|
|
363
504
|
return Promise.resolve([]);
|
|
364
505
|
}
|
|
365
506
|
|
|
366
|
-
|
|
507
|
+
// eslint-disable-next-line camelcase
|
|
508
|
+
async aztec_utl_log(
|
|
367
509
|
level: ACVMField[],
|
|
368
510
|
message: ACVMField[],
|
|
369
511
|
_ignoredFieldsSize: ACVMField[],
|
|
@@ -372,20 +514,21 @@ export class Oracle {
|
|
|
372
514
|
const levelFr = Fr.fromString(level[0]);
|
|
373
515
|
const messageStr = message.map(acvmField => String.fromCharCode(Fr.fromString(acvmField).toNumber())).join('');
|
|
374
516
|
const fieldsFr = fields.map(Fr.fromString);
|
|
375
|
-
this.handlerAsMisc().
|
|
376
|
-
return
|
|
517
|
+
await this.handlerAsMisc().log(levelFr.toNumber(), messageStr, fieldsFr);
|
|
518
|
+
return [];
|
|
377
519
|
}
|
|
378
520
|
|
|
379
521
|
// This function's name is directly hardcoded in `circuit_recorder.ts`. Don't forget to update it there if you
|
|
380
522
|
// change the name here.
|
|
381
|
-
|
|
523
|
+
// eslint-disable-next-line camelcase
|
|
524
|
+
async aztec_prv_callPrivateFunction(
|
|
382
525
|
[contractAddress]: ACVMField[],
|
|
383
526
|
[functionSelector]: ACVMField[],
|
|
384
527
|
[argsHash]: ACVMField[],
|
|
385
528
|
[sideEffectCounter]: ACVMField[],
|
|
386
529
|
[isStaticCall]: ACVMField[],
|
|
387
530
|
): Promise<ACVMField[][]> {
|
|
388
|
-
const { endSideEffectCounter, returnsHash } = await this.handlerAsPrivate().
|
|
531
|
+
const { endSideEffectCounter, returnsHash } = await this.handlerAsPrivate().callPrivateFunction(
|
|
389
532
|
AztecAddress.fromField(Fr.fromString(contractAddress)),
|
|
390
533
|
FunctionSelector.fromField(Fr.fromString(functionSelector)),
|
|
391
534
|
Fr.fromString(argsHash),
|
|
@@ -395,113 +538,165 @@ export class Oracle {
|
|
|
395
538
|
return [[endSideEffectCounter, returnsHash].map(toACVMField)];
|
|
396
539
|
}
|
|
397
540
|
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
[sideEffectCounter]: ACVMField[],
|
|
402
|
-
[isStaticCall]: ACVMField[],
|
|
403
|
-
): Promise<ACVMField[]> {
|
|
404
|
-
await this.handlerAsPrivate().privateNotifyEnqueuedPublicFunctionCall(
|
|
405
|
-
AztecAddress.fromString(contractAddress),
|
|
406
|
-
Fr.fromString(calldataHash),
|
|
407
|
-
Fr.fromString(sideEffectCounter).toNumber(),
|
|
408
|
-
Fr.fromString(isStaticCall).toBool(),
|
|
409
|
-
);
|
|
541
|
+
// eslint-disable-next-line camelcase
|
|
542
|
+
async aztec_prv_assertValidPublicCalldata([calldataHash]: ACVMField[]): Promise<ACVMField[]> {
|
|
543
|
+
await this.handlerAsPrivate().assertValidPublicCalldata(Fr.fromString(calldataHash));
|
|
410
544
|
return [];
|
|
411
545
|
}
|
|
412
546
|
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
[sideEffectCounter]: ACVMField[],
|
|
417
|
-
[isStaticCall]: ACVMField[],
|
|
418
|
-
): Promise<ACVMField[]> {
|
|
419
|
-
await this.handlerAsPrivate().privateNotifySetPublicTeardownFunctionCall(
|
|
420
|
-
AztecAddress.fromString(contractAddress),
|
|
421
|
-
Fr.fromString(calldataHash),
|
|
422
|
-
Fr.fromString(sideEffectCounter).toNumber(),
|
|
423
|
-
Fr.fromString(isStaticCall).toBool(),
|
|
424
|
-
);
|
|
425
|
-
return [];
|
|
426
|
-
}
|
|
427
|
-
|
|
428
|
-
async privateNotifySetMinRevertibleSideEffectCounter([minRevertibleSideEffectCounter]: ACVMField[]): Promise<
|
|
429
|
-
ACVMField[]
|
|
430
|
-
> {
|
|
431
|
-
await this.handlerAsPrivate().privateNotifySetMinRevertibleSideEffectCounter(
|
|
432
|
-
Fr.fromString(minRevertibleSideEffectCounter).toNumber(),
|
|
433
|
-
);
|
|
547
|
+
// eslint-disable-next-line camelcase
|
|
548
|
+
async aztec_prv_notifyRevertiblePhaseStart([minRevertibleSideEffectCounter]: ACVMField[]): Promise<ACVMField[]> {
|
|
549
|
+
await this.handlerAsPrivate().notifyRevertiblePhaseStart(Fr.fromString(minRevertibleSideEffectCounter).toNumber());
|
|
434
550
|
return Promise.resolve([]);
|
|
435
551
|
}
|
|
436
552
|
|
|
437
|
-
|
|
438
|
-
|
|
553
|
+
// eslint-disable-next-line camelcase
|
|
554
|
+
async aztec_prv_isExecutionInRevertiblePhase([sideEffectCounter]: ACVMField[]): Promise<ACVMField[]> {
|
|
555
|
+
const isRevertible = await this.handlerAsPrivate().isExecutionInRevertiblePhase(
|
|
439
556
|
Fr.fromString(sideEffectCounter).toNumber(),
|
|
440
557
|
);
|
|
441
558
|
return Promise.resolve([toACVMField(isRevertible)]);
|
|
442
559
|
}
|
|
443
560
|
|
|
444
|
-
|
|
445
|
-
|
|
561
|
+
// eslint-disable-next-line camelcase
|
|
562
|
+
async aztec_prv_getNextAppTagAsSender([sender]: ACVMField[], [recipient]: ACVMField[]): Promise<ACVMField[]> {
|
|
563
|
+
const tag = await this.handlerAsPrivate().getNextAppTagAsSender(
|
|
446
564
|
AztecAddress.fromString(sender),
|
|
447
565
|
AztecAddress.fromString(recipient),
|
|
448
566
|
);
|
|
449
567
|
return [toACVMField(tag.value)];
|
|
450
568
|
}
|
|
451
569
|
|
|
452
|
-
|
|
453
|
-
|
|
570
|
+
// eslint-disable-next-line camelcase
|
|
571
|
+
async aztec_utl_getPendingTaggedLogs(
|
|
572
|
+
[pendingTaggedLogArrayBaseSlot]: ACVMField[],
|
|
573
|
+
[scope]: ACVMField[],
|
|
574
|
+
): Promise<ACVMField[]> {
|
|
575
|
+
await this.handlerAsUtility().getPendingTaggedLogs(
|
|
576
|
+
Fr.fromString(pendingTaggedLogArrayBaseSlot),
|
|
577
|
+
AztecAddress.fromString(scope),
|
|
578
|
+
);
|
|
454
579
|
return [];
|
|
455
580
|
}
|
|
456
581
|
|
|
457
|
-
|
|
582
|
+
// eslint-disable-next-line camelcase
|
|
583
|
+
async aztec_utl_getPendingTaggedLogs_v2([scope]: ACVMField[]): Promise<ACVMField[]> {
|
|
584
|
+
const slot = await this.handlerAsUtility().getPendingTaggedLogsV2(AztecAddress.fromString(scope));
|
|
585
|
+
return [toACVMField(slot)];
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
// eslint-disable-next-line camelcase
|
|
589
|
+
async aztec_utl_validateAndStoreEnqueuedNotesAndEvents(
|
|
458
590
|
[contractAddress]: ACVMField[],
|
|
459
591
|
[noteValidationRequestsArrayBaseSlot]: ACVMField[],
|
|
460
592
|
[eventValidationRequestsArrayBaseSlot]: ACVMField[],
|
|
593
|
+
[maxNotePackedLen]: ACVMField[],
|
|
594
|
+
[maxEventSerializedLen]: ACVMField[],
|
|
595
|
+
[scope]: ACVMField[],
|
|
461
596
|
): Promise<ACVMField[]> {
|
|
462
|
-
await this.handlerAsUtility().
|
|
597
|
+
await this.handlerAsUtility().validateAndStoreEnqueuedNotesAndEvents(
|
|
463
598
|
AztecAddress.fromString(contractAddress),
|
|
464
599
|
Fr.fromString(noteValidationRequestsArrayBaseSlot),
|
|
465
600
|
Fr.fromString(eventValidationRequestsArrayBaseSlot),
|
|
601
|
+
Fr.fromString(maxNotePackedLen).toNumber(),
|
|
602
|
+
Fr.fromString(maxEventSerializedLen).toNumber(),
|
|
603
|
+
AztecAddress.fromString(scope),
|
|
466
604
|
);
|
|
467
605
|
|
|
468
606
|
return [];
|
|
469
607
|
}
|
|
470
608
|
|
|
471
|
-
|
|
609
|
+
// eslint-disable-next-line camelcase
|
|
610
|
+
async aztec_utl_validateAndStoreEnqueuedNotesAndEvents_v2(
|
|
611
|
+
[noteValidationRequestsArrayBaseSlot]: ACVMField[],
|
|
612
|
+
[eventValidationRequestsArrayBaseSlot]: ACVMField[],
|
|
613
|
+
[maxNotePackedLen]: ACVMField[],
|
|
614
|
+
[maxEventSerializedLen]: ACVMField[],
|
|
615
|
+
[scope]: ACVMField[],
|
|
616
|
+
): Promise<ACVMField[]> {
|
|
617
|
+
await this.handlerAsUtility().validateAndStoreEnqueuedNotesAndEventsV2(
|
|
618
|
+
Fr.fromString(noteValidationRequestsArrayBaseSlot),
|
|
619
|
+
Fr.fromString(eventValidationRequestsArrayBaseSlot),
|
|
620
|
+
Fr.fromString(maxNotePackedLen).toNumber(),
|
|
621
|
+
Fr.fromString(maxEventSerializedLen).toNumber(),
|
|
622
|
+
AztecAddress.fromString(scope),
|
|
623
|
+
);
|
|
624
|
+
return [];
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
// eslint-disable-next-line camelcase
|
|
628
|
+
async aztec_utl_getLogsByTag(
|
|
472
629
|
[contractAddress]: ACVMField[],
|
|
473
630
|
[logRetrievalRequestsArrayBaseSlot]: ACVMField[],
|
|
474
631
|
[logRetrievalResponsesArrayBaseSlot]: ACVMField[],
|
|
632
|
+
[scope]: ACVMField[],
|
|
475
633
|
): Promise<ACVMField[]> {
|
|
476
|
-
await this.handlerAsUtility().
|
|
634
|
+
await this.handlerAsUtility().getLogsByTag(
|
|
477
635
|
AztecAddress.fromString(contractAddress),
|
|
478
636
|
Fr.fromString(logRetrievalRequestsArrayBaseSlot),
|
|
479
637
|
Fr.fromString(logRetrievalResponsesArrayBaseSlot),
|
|
638
|
+
AztecAddress.fromString(scope),
|
|
480
639
|
);
|
|
481
640
|
return [];
|
|
482
641
|
}
|
|
483
642
|
|
|
484
|
-
|
|
643
|
+
// eslint-disable-next-line camelcase
|
|
644
|
+
async aztec_utl_getMessageContextsByTxHash(
|
|
645
|
+
[contractAddress]: ACVMField[],
|
|
646
|
+
[messageContextRequestsArrayBaseSlot]: ACVMField[],
|
|
647
|
+
[messageContextResponsesArrayBaseSlot]: ACVMField[],
|
|
648
|
+
[scope]: ACVMField[],
|
|
649
|
+
): Promise<ACVMField[]> {
|
|
650
|
+
await this.handlerAsUtility().getMessageContextsByTxHash(
|
|
651
|
+
AztecAddress.fromString(contractAddress),
|
|
652
|
+
Fr.fromString(messageContextRequestsArrayBaseSlot),
|
|
653
|
+
Fr.fromString(messageContextResponsesArrayBaseSlot),
|
|
654
|
+
AztecAddress.fromString(scope),
|
|
655
|
+
);
|
|
656
|
+
return [];
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
// eslint-disable-next-line camelcase
|
|
660
|
+
async aztec_utl_getLogsByTag_v2([requestArrayBaseSlot]: ACVMField[]): Promise<ACVMField[]> {
|
|
661
|
+
const responseSlot = await this.handlerAsUtility().getLogsByTagV2(Fr.fromString(requestArrayBaseSlot));
|
|
662
|
+
return [toACVMField(responseSlot)];
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
// eslint-disable-next-line camelcase
|
|
666
|
+
async aztec_utl_getMessageContextsByTxHash_v2([requestArrayBaseSlot]: ACVMField[]): Promise<ACVMField[]> {
|
|
667
|
+
const responseSlot = await this.handlerAsUtility().getMessageContextsByTxHashV2(
|
|
668
|
+
Fr.fromString(requestArrayBaseSlot),
|
|
669
|
+
);
|
|
670
|
+
return [toACVMField(responseSlot)];
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
// eslint-disable-next-line camelcase
|
|
674
|
+
aztec_utl_setCapsule(
|
|
485
675
|
[contractAddress]: ACVMField[],
|
|
486
676
|
[slot]: ACVMField[],
|
|
487
677
|
capsule: ACVMField[],
|
|
678
|
+
[scope]: ACVMField[],
|
|
488
679
|
): Promise<ACVMField[]> {
|
|
489
|
-
|
|
680
|
+
this.handlerAsUtility().setCapsule(
|
|
490
681
|
AztecAddress.fromField(Fr.fromString(contractAddress)),
|
|
491
682
|
Fr.fromString(slot),
|
|
492
683
|
capsule.map(Fr.fromString),
|
|
684
|
+
AztecAddress.fromField(Fr.fromString(scope)),
|
|
493
685
|
);
|
|
494
|
-
return [];
|
|
686
|
+
return Promise.resolve([]);
|
|
495
687
|
}
|
|
496
688
|
|
|
497
|
-
|
|
689
|
+
// eslint-disable-next-line camelcase
|
|
690
|
+
async aztec_utl_getCapsule(
|
|
498
691
|
[contractAddress]: ACVMField[],
|
|
499
692
|
[slot]: ACVMField[],
|
|
500
693
|
[tSize]: ACVMField[],
|
|
694
|
+
[scope]: ACVMField[],
|
|
501
695
|
): Promise<(ACVMField | ACVMField[])[]> {
|
|
502
|
-
const values = await this.handlerAsUtility().
|
|
696
|
+
const values = await this.handlerAsUtility().getCapsule(
|
|
503
697
|
AztecAddress.fromField(Fr.fromString(contractAddress)),
|
|
504
698
|
Fr.fromString(slot),
|
|
699
|
+
AztecAddress.fromField(Fr.fromString(scope)),
|
|
505
700
|
);
|
|
506
701
|
|
|
507
702
|
// We are going to return a Noir Option struct to represent the possibility of null values. Options are a struct
|
|
@@ -515,30 +710,86 @@ export class Oracle {
|
|
|
515
710
|
}
|
|
516
711
|
}
|
|
517
712
|
|
|
518
|
-
|
|
519
|
-
|
|
713
|
+
// eslint-disable-next-line camelcase
|
|
714
|
+
aztec_utl_deleteCapsule(
|
|
715
|
+
[contractAddress]: ACVMField[],
|
|
716
|
+
[slot]: ACVMField[],
|
|
717
|
+
[scope]: ACVMField[],
|
|
718
|
+
): Promise<ACVMField[]> {
|
|
719
|
+
this.handlerAsUtility().deleteCapsule(
|
|
520
720
|
AztecAddress.fromField(Fr.fromString(contractAddress)),
|
|
521
721
|
Fr.fromString(slot),
|
|
722
|
+
AztecAddress.fromField(Fr.fromString(scope)),
|
|
522
723
|
);
|
|
523
|
-
return [];
|
|
724
|
+
return Promise.resolve([]);
|
|
524
725
|
}
|
|
525
726
|
|
|
526
|
-
|
|
727
|
+
// eslint-disable-next-line camelcase
|
|
728
|
+
async aztec_utl_copyCapsule(
|
|
527
729
|
[contractAddress]: ACVMField[],
|
|
528
730
|
[srcSlot]: ACVMField[],
|
|
529
731
|
[dstSlot]: ACVMField[],
|
|
530
732
|
[numEntries]: ACVMField[],
|
|
733
|
+
[scope]: ACVMField[],
|
|
531
734
|
): Promise<ACVMField[]> {
|
|
532
|
-
await this.handlerAsUtility().
|
|
735
|
+
await this.handlerAsUtility().copyCapsule(
|
|
533
736
|
AztecAddress.fromField(Fr.fromString(contractAddress)),
|
|
534
737
|
Fr.fromString(srcSlot),
|
|
535
738
|
Fr.fromString(dstSlot),
|
|
536
739
|
Fr.fromString(numEntries).toNumber(),
|
|
740
|
+
AztecAddress.fromField(Fr.fromString(scope)),
|
|
537
741
|
);
|
|
538
742
|
return [];
|
|
539
743
|
}
|
|
540
744
|
|
|
541
|
-
|
|
745
|
+
// eslint-disable-next-line camelcase
|
|
746
|
+
aztec_utl_pushEphemeral([slot]: ACVMField[], elements: ACVMField[]): Promise<ACVMField[]> {
|
|
747
|
+
const newLen = this.handlerAsUtility().pushEphemeral(Fr.fromString(slot), elements.map(Fr.fromString));
|
|
748
|
+
return Promise.resolve([toACVMField(newLen)]);
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
// eslint-disable-next-line camelcase
|
|
752
|
+
aztec_utl_popEphemeral([slot]: ACVMField[]): Promise<ACVMField[][]> {
|
|
753
|
+
const element = this.handlerAsUtility().popEphemeral(Fr.fromString(slot));
|
|
754
|
+
return Promise.resolve([element.map(toACVMField)]);
|
|
755
|
+
}
|
|
756
|
+
|
|
757
|
+
// eslint-disable-next-line camelcase
|
|
758
|
+
aztec_utl_getEphemeral([slot]: ACVMField[], [index]: ACVMField[]): Promise<ACVMField[][]> {
|
|
759
|
+
const element = this.handlerAsUtility().getEphemeral(Fr.fromString(slot), Fr.fromString(index).toNumber());
|
|
760
|
+
return Promise.resolve([element.map(toACVMField)]);
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
// eslint-disable-next-line camelcase
|
|
764
|
+
aztec_utl_setEphemeral([slot]: ACVMField[], [index]: ACVMField[], elements: ACVMField[]): Promise<ACVMField[]> {
|
|
765
|
+
this.handlerAsUtility().setEphemeral(
|
|
766
|
+
Fr.fromString(slot),
|
|
767
|
+
Fr.fromString(index).toNumber(),
|
|
768
|
+
elements.map(Fr.fromString),
|
|
769
|
+
);
|
|
770
|
+
return Promise.resolve([]);
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
// eslint-disable-next-line camelcase
|
|
774
|
+
aztec_utl_getEphemeralLen([slot]: ACVMField[]): Promise<ACVMField[]> {
|
|
775
|
+
const len = this.handlerAsUtility().getEphemeralLen(Fr.fromString(slot));
|
|
776
|
+
return Promise.resolve([toACVMField(len)]);
|
|
777
|
+
}
|
|
778
|
+
|
|
779
|
+
// eslint-disable-next-line camelcase
|
|
780
|
+
aztec_utl_removeEphemeral([slot]: ACVMField[], [index]: ACVMField[]): Promise<ACVMField[]> {
|
|
781
|
+
this.handlerAsUtility().removeEphemeral(Fr.fromString(slot), Fr.fromString(index).toNumber());
|
|
782
|
+
return Promise.resolve([]);
|
|
783
|
+
}
|
|
784
|
+
|
|
785
|
+
// eslint-disable-next-line camelcase
|
|
786
|
+
aztec_utl_clearEphemeral([slot]: ACVMField[]): Promise<ACVMField[]> {
|
|
787
|
+
this.handlerAsUtility().clearEphemeral(Fr.fromString(slot));
|
|
788
|
+
return Promise.resolve([]);
|
|
789
|
+
}
|
|
790
|
+
|
|
791
|
+
// eslint-disable-next-line camelcase
|
|
792
|
+
async aztec_utl_decryptAes128(
|
|
542
793
|
ciphertextBVecStorage: ACVMField[],
|
|
543
794
|
[ciphertextLength]: ACVMField[],
|
|
544
795
|
iv: ACVMField[],
|
|
@@ -548,36 +799,63 @@ export class Oracle {
|
|
|
548
799
|
const ivBuffer = fromUintArray(iv, 8);
|
|
549
800
|
const symKeyBuffer = fromUintArray(symKey, 8);
|
|
550
801
|
|
|
551
|
-
|
|
552
|
-
|
|
802
|
+
// Noir Option<BoundedVec> is encoded as [is_some: Field, storage: Field[], length: Field].
|
|
803
|
+
try {
|
|
804
|
+
const plaintext = await this.handlerAsUtility().decryptAes128(ciphertext, ivBuffer, symKeyBuffer);
|
|
805
|
+
const [storage, length] = bufferToBoundedVec(plaintext, ciphertextBVecStorage.length);
|
|
806
|
+
return [toACVMField(1), storage, length];
|
|
807
|
+
} catch {
|
|
808
|
+
const zeroStorage = Array(ciphertextBVecStorage.length).fill(toACVMField(0));
|
|
809
|
+
return [toACVMField(0), zeroStorage, toACVMField(0)];
|
|
810
|
+
}
|
|
553
811
|
}
|
|
554
812
|
|
|
555
|
-
|
|
813
|
+
// eslint-disable-next-line camelcase
|
|
814
|
+
async aztec_utl_getSharedSecret(
|
|
556
815
|
[address]: ACVMField[],
|
|
557
816
|
[ephPKField0]: ACVMField[],
|
|
558
817
|
[ephPKField1]: ACVMField[],
|
|
559
818
|
[ephPKField2]: ACVMField[],
|
|
819
|
+
[contractAddress]: ACVMField[],
|
|
560
820
|
): Promise<ACVMField[]> {
|
|
561
|
-
const secret = await this.handlerAsUtility().
|
|
821
|
+
const secret = await this.handlerAsUtility().getSharedSecret(
|
|
562
822
|
AztecAddress.fromField(Fr.fromString(address)),
|
|
563
823
|
Point.fromFields([ephPKField0, ephPKField1, ephPKField2].map(Fr.fromString)),
|
|
824
|
+
AztecAddress.fromField(Fr.fromString(contractAddress)),
|
|
825
|
+
);
|
|
826
|
+
return [toACVMField(secret)];
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
// eslint-disable-next-line camelcase
|
|
830
|
+
aztec_utl_setContractSyncCacheInvalid(
|
|
831
|
+
[contractAddress]: ACVMField[],
|
|
832
|
+
scopes: ACVMField[],
|
|
833
|
+
[scopeCount]: ACVMField[],
|
|
834
|
+
): Promise<ACVMField[]> {
|
|
835
|
+
const scopeAddresses = scopes.slice(0, +scopeCount).map(s => AztecAddress.fromField(Fr.fromString(s)));
|
|
836
|
+
this.handlerAsUtility().setContractSyncCacheInvalid(
|
|
837
|
+
AztecAddress.fromField(Fr.fromString(contractAddress)),
|
|
838
|
+
scopeAddresses,
|
|
564
839
|
);
|
|
565
|
-
return
|
|
840
|
+
return Promise.resolve([]);
|
|
566
841
|
}
|
|
567
842
|
|
|
568
|
-
|
|
569
|
-
|
|
843
|
+
// eslint-disable-next-line camelcase
|
|
844
|
+
async aztec_utl_emitOffchainEffect(data: ACVMField[]) {
|
|
845
|
+
await this.handlerAsUtility().emitOffchainEffect(data.map(Fr.fromString));
|
|
570
846
|
return [];
|
|
571
847
|
}
|
|
572
848
|
|
|
573
|
-
|
|
574
|
-
|
|
849
|
+
// eslint-disable-next-line camelcase
|
|
850
|
+
async aztec_prv_getSenderForTags(): Promise<ACVMField[]> {
|
|
851
|
+
const sender = await this.handlerAsPrivate().getSenderForTags();
|
|
575
852
|
// Return [1, address] for Some(address), [0, 0] for None
|
|
576
853
|
return sender ? [toACVMField(1n), toACVMField(sender)] : [toACVMField(0n), toACVMField(0n)];
|
|
577
854
|
}
|
|
578
855
|
|
|
579
|
-
|
|
580
|
-
|
|
856
|
+
// eslint-disable-next-line camelcase
|
|
857
|
+
async aztec_prv_setSenderForTags([senderForTags]: ACVMField[]): Promise<ACVMField[]> {
|
|
858
|
+
await this.handlerAsPrivate().setSenderForTags(AztecAddress.fromField(Fr.fromString(senderForTags)));
|
|
581
859
|
return [];
|
|
582
860
|
}
|
|
583
861
|
}
|