@aztec/pxe 4.0.0-nightly.20250907 → 4.0.0-nightly.20260108
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/README.md +5 -5
- package/dest/bin/check_oracle_version.d.ts +1 -1
- package/dest/bin/check_oracle_version.js +110 -10
- package/dest/block_synchronizer/block_synchronizer.d.ts +39 -0
- package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -0
- package/dest/{synchronizer/synchronizer.js → block_synchronizer/block_synchronizer.js} +23 -23
- 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 +9 -17
- package/dest/config/index.d.ts.map +1 -1
- package/dest/config/index.js +10 -16
- package/dest/config/package_info.d.ts +1 -1
- package/dest/config/package_info.js +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.d.ts +44 -15
- package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.js +142 -57
- package/dest/contract_function_simulator/execution_note_cache.d.ts +11 -9
- package/dest/contract_function_simulator/execution_note_cache.d.ts.map +1 -1
- package/dest/contract_function_simulator/execution_note_cache.js +28 -17
- package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts +16 -0
- package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts.map +1 -0
- package/dest/contract_function_simulator/execution_tagging_index_cache.js +26 -0
- 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 +4 -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 +2 -2
- package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts +5 -4
- 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 +7 -6
- 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 +8 -4
- package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +6 -3
- 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 +12 -3
- package/dest/contract_function_simulator/noir-structs/utility_context.d.ts +22 -0
- package/dest/contract_function_simulator/noir-structs/utility_context.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/utility_context.js +33 -0
- package/dest/contract_function_simulator/oracle/index.d.ts +2 -2
- package/dest/contract_function_simulator/oracle/index.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/index.js +1 -1
- package/dest/contract_function_simulator/oracle/interfaces.d.ts +103 -0
- package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -0
- package/dest/contract_function_simulator/oracle/interfaces.js +4 -0
- package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts +2 -4
- 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 +10 -4
- package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/note_packing_utils.js +10 -5
- package/dest/contract_function_simulator/oracle/oracle.d.ts +17 -15
- package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/oracle.js +101 -81
- package/dest/contract_function_simulator/oracle/private_execution.d.ts +11 -12
- package/dest/contract_function_simulator/oracle/private_execution.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution.js +15 -24
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +51 -25
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.js +103 -27
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +65 -36
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +171 -69
- 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 +1 -1
- 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 +23 -5
- package/dest/contract_function_simulator/proxied_node.d.ts +1 -1
- package/dest/contract_function_simulator/proxied_node.d.ts.map +1 -1
- package/dest/debug/pxe_debug_utils.d.ts +31 -0
- package/dest/debug/pxe_debug_utils.d.ts.map +1 -0
- package/dest/debug/pxe_debug_utils.js +37 -0
- package/dest/entrypoints/client/bundle/index.d.ts +4 -3
- package/dest/entrypoints/client/bundle/index.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/index.js +2 -2
- package/dest/entrypoints/client/bundle/utils.d.ts +9 -9
- package/dest/entrypoints/client/bundle/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/utils.js +21 -12
- package/dest/entrypoints/client/lazy/index.d.ts +4 -3
- package/dest/entrypoints/client/lazy/index.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/index.js +2 -2
- package/dest/entrypoints/client/lazy/utils.d.ts +8 -8
- package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/utils.js +20 -11
- package/dest/entrypoints/pxe_creation_options.d.ts +5 -2
- package/dest/entrypoints/pxe_creation_options.d.ts.map +1 -1
- package/dest/entrypoints/server/index.d.ts +5 -3
- package/dest/entrypoints/server/index.d.ts.map +1 -1
- package/dest/entrypoints/server/index.js +3 -2
- package/dest/entrypoints/server/utils.d.ts +5 -24
- package/dest/entrypoints/server/utils.d.ts.map +1 -1
- package/dest/entrypoints/server/utils.js +17 -45
- package/dest/error_enriching.d.ts +11 -0
- package/dest/error_enriching.d.ts.map +1 -0
- package/dest/{pxe_service/error_enriching.js → error_enriching.js} +9 -6
- package/dest/events/event_service.d.ts +15 -0
- package/dest/events/event_service.d.ts.map +1 -0
- package/dest/events/event_service.js +47 -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 +9 -0
- package/dest/events/private_event_filter_validator.d.ts.map +1 -0
- package/dest/events/private_event_filter_validator.js +39 -0
- package/dest/logs/log_service.d.ts +26 -0
- package/dest/logs/log_service.d.ts.map +1 -0
- package/dest/logs/log_service.js +120 -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 +152 -0
- package/dest/oracle_version.d.ts +3 -3
- package/dest/oracle_version.js +2 -2
- package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts +3 -3
- package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts.map +1 -1
- package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.js +7 -7
- package/dest/private_kernel/hints/compute_tx_include_by_timestamp.d.ts +1 -1
- package/dest/private_kernel/hints/compute_tx_include_by_timestamp.js +6 -6
- package/dest/private_kernel/hints/index.d.ts +1 -1
- package/dest/private_kernel/index.d.ts +1 -1
- package/dest/private_kernel/private_kernel_execution_prover.d.ts +9 -2
- package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_execution_prover.js +38 -32
- package/dest/private_kernel/private_kernel_oracle.d.ts +3 -2
- package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_oracle_impl.d.ts +10 -9
- package/dest/private_kernel/private_kernel_oracle_impl.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_oracle_impl.js +7 -7
- package/dest/public_storage/public_storage_service.d.ts +24 -0
- package/dest/public_storage/public_storage_service.d.ts.map +1 -0
- package/dest/public_storage/public_storage_service.js +26 -0
- package/dest/pxe.d.ts +232 -0
- package/dest/pxe.d.ts.map +1 -0
- package/dest/{pxe_service/pxe_service.js → pxe.js} +299 -324
- 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} +1 -4
- 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 +9 -0
- package/dest/storage/anchor_block_store/anchor_block_store.d.ts.map +1 -0
- package/dest/storage/{sync_data_provider/sync_data_provider.js → anchor_block_store/anchor_block_store.js} +2 -12
- package/dest/storage/anchor_block_store/index.d.ts +2 -0
- 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_store.d.ts +57 -0
- package/dest/storage/capsule_store/capsule_store.d.ts.map +1 -0
- package/dest/storage/{capsule_data_provider/capsule_data_provider.js → capsule_store/capsule_store.js} +34 -10
- package/dest/storage/capsule_store/index.d.ts +2 -0
- package/dest/storage/capsule_store/index.d.ts.map +1 -0
- package/dest/storage/capsule_store/index.js +1 -0
- package/dest/storage/{contract_data_provider/contract_data_provider.d.ts → contract_store/contract_store.d.ts} +10 -18
- package/dest/storage/contract_store/contract_store.d.ts.map +1 -0
- package/dest/storage/{contract_data_provider/contract_data_provider.js → contract_store/contract_store.js} +46 -18
- 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 -9
- package/dest/storage/index.d.ts.map +1 -1
- package/dest/storage/index.js +7 -8
- package/dest/storage/metadata.d.ts +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 +84 -0
- package/dest/storage/note_store/note_store.d.ts.map +1 -0
- package/dest/storage/{note_data_provider/note_data_provider.js → note_store/note_store.js} +144 -82
- package/dest/storage/private_event_store/private_event_store.d.ts +56 -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 +157 -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 +21 -0
- package/dest/storage/tagging_store/recipient_tagging_store.d.ts.map +1 -0
- package/dest/storage/tagging_store/recipient_tagging_store.js +42 -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 +30 -0
- package/dest/storage/tagging_store/sender_tagging_store.d.ts +67 -0
- package/dest/storage/tagging_store/sender_tagging_store.d.ts.map +1 -0
- package/dest/storage/tagging_store/sender_tagging_store.js +196 -0
- package/dest/tagging/index.d.ts +16 -0
- package/dest/tagging/index.d.ts.map +1 -0
- package/dest/tagging/index.js +23 -0
- 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 +99 -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 +29 -0
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts +20 -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 +74 -0
- package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts +11 -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 +32 -0
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts +18 -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 +55 -0
- package/dest/tree_membership/tree_membership_service.d.ts +52 -0
- package/dest/tree_membership/tree_membership_service.d.ts.map +1 -0
- package/dest/tree_membership/tree_membership_service.js +84 -0
- package/package.json +22 -24
- package/src/bin/check_oracle_version.ts +134 -10
- package/src/{synchronizer/synchronizer.ts → block_synchronizer/block_synchronizer.ts} +22 -23
- package/src/block_synchronizer/index.ts +1 -0
- package/src/config/index.ts +18 -32
- package/src/config/package_info.ts +1 -1
- package/src/contract_function_simulator/contract_function_simulator.ts +233 -75
- package/src/contract_function_simulator/execution_note_cache.ts +33 -17
- package/src/contract_function_simulator/execution_tagging_index_cache.ts +32 -0
- package/src/contract_function_simulator/hashed_values_cache.ts +1 -1
- package/src/contract_function_simulator/index.ts +3 -1
- package/src/contract_function_simulator/noir-structs/event_validation_request.ts +1 -1
- package/src/contract_function_simulator/noir-structs/log_retrieval_request.ts +6 -5
- package/src/contract_function_simulator/noir-structs/log_retrieval_response.ts +10 -5
- package/src/contract_function_simulator/noir-structs/note_validation_request.ts +14 -2
- package/src/contract_function_simulator/noir-structs/utility_context.ts +42 -0
- package/src/contract_function_simulator/oracle/index.ts +1 -1
- package/src/contract_function_simulator/oracle/interfaces.ts +175 -0
- package/src/contract_function_simulator/oracle/message_load_oracle_inputs.ts +1 -1
- package/src/contract_function_simulator/oracle/note_packing_utils.ts +21 -5
- package/src/contract_function_simulator/oracle/oracle.ts +135 -80
- package/src/contract_function_simulator/oracle/private_execution.ts +22 -28
- package/src/contract_function_simulator/oracle/private_execution_oracle.ts +200 -56
- package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +260 -109
- package/src/contract_function_simulator/pick_notes.ts +1 -1
- package/src/contract_function_simulator/proxied_contract_data_source.ts +24 -7
- package/src/debug/pxe_debug_utils.ts +48 -0
- package/src/entrypoints/client/bundle/index.ts +3 -2
- package/src/entrypoints/client/bundle/utils.ts +21 -23
- package/src/entrypoints/client/lazy/index.ts +3 -2
- package/src/entrypoints/client/lazy/utils.ts +20 -23
- package/src/entrypoints/pxe_creation_options.ts +4 -1
- package/src/entrypoints/server/index.ts +4 -2
- package/src/entrypoints/server/utils.ts +20 -68
- package/src/{pxe_service/error_enriching.ts → error_enriching.ts} +11 -15
- package/src/events/event_service.ts +77 -0
- package/src/events/index.ts +1 -0
- package/src/events/private_event_filter_validator.ts +48 -0
- package/src/logs/log_service.ts +202 -0
- package/src/notes/index.ts +1 -0
- package/src/notes/note_service.ts +200 -0
- package/src/oracle_version.ts +2 -2
- package/src/private_kernel/hints/build_private_kernel_reset_private_inputs.ts +5 -9
- package/src/private_kernel/hints/compute_tx_include_by_timestamp.ts +6 -6
- package/src/private_kernel/private_kernel_execution_prover.ts +51 -43
- package/src/private_kernel/private_kernel_oracle.ts +2 -1
- package/src/private_kernel/private_kernel_oracle_impl.ts +10 -9
- package/src/public_storage/public_storage_service.ts +33 -0
- package/src/{pxe_service/pxe_service.ts → pxe.ts} +349 -410
- package/src/storage/{address_data_provider/address_data_provider.ts → address_store/address_store.ts} +1 -7
- 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} +2 -17
- package/src/storage/anchor_block_store/index.ts +1 -0
- package/src/storage/{capsule_data_provider/capsule_data_provider.ts → capsule_store/capsule_store.ts} +34 -12
- package/src/storage/capsule_store/index.ts +1 -0
- package/src/storage/{contract_data_provider/contract_data_provider.ts → contract_store/contract_store.ts} +67 -28
- 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 -8
- package/src/storage/note_store/index.ts +2 -0
- package/src/storage/{note_data_provider/note_data_provider.ts → note_store/note_store.ts} +173 -111
- package/src/storage/private_event_store/private_event_store.ts +213 -0
- package/src/storage/tagging_store/index.ts +3 -0
- package/src/storage/tagging_store/recipient_tagging_store.ts +53 -0
- package/src/storage/tagging_store/sender_address_book_store.ts +42 -0
- package/src/storage/tagging_store/sender_tagging_store.ts +244 -0
- package/src/tagging/index.ts +28 -0
- package/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts +129 -0
- package/src/tagging/recipient_sync/utils/find_highest_indexes.ts +34 -0
- package/src/tagging/recipient_sync/utils/load_logs_for_range.ts +43 -0
- package/src/tagging/sender_sync/sync_sender_tagging_indexes.ts +96 -0
- package/src/tagging/sender_sync/utils/get_status_change_of_pending.ts +44 -0
- package/src/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.ts +72 -0
- package/src/tree_membership/tree_membership_service.ts +112 -0
- package/dest/bin/index.d.ts +0 -3
- package/dest/bin/index.d.ts.map +0 -1
- package/dest/bin/index.js +0 -48
- package/dest/contract_function_simulator/execution_data_provider.d.ts +0 -285
- 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/oracle/typed_oracle.d.ts +0 -87
- package/dest/contract_function_simulator/oracle/typed_oracle.d.ts.map +0 -1
- package/dest/contract_function_simulator/oracle/typed_oracle.js +0 -146
- package/dest/contract_function_simulator/pxe_oracle_interface.d.ts +0 -158
- package/dest/contract_function_simulator/pxe_oracle_interface.d.ts.map +0 -1
- package/dest/contract_function_simulator/pxe_oracle_interface.js +0 -701
- package/dest/contract_function_simulator/tagging_utils.d.ts +0 -17
- package/dest/contract_function_simulator/tagging_utils.d.ts.map +0 -1
- package/dest/contract_function_simulator/tagging_utils.js +0 -23
- package/dest/pxe_service/error_enriching.d.ts +0 -11
- package/dest/pxe_service/error_enriching.d.ts.map +0 -1
- package/dest/pxe_service/index.d.ts +0 -3
- package/dest/pxe_service/index.d.ts.map +0 -1
- package/dest/pxe_service/index.js +0 -2
- package/dest/pxe_service/pxe_service.d.ts +0 -100
- package/dest/pxe_service/pxe_service.d.ts.map +0 -1
- package/dest/storage/address_data_provider/address_data_provider.d.ts +0 -13
- 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 -27
- package/dest/storage/capsule_data_provider/capsule_data_provider.d.ts.map +0 -1
- 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.map +0 -1
- 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/data_provider.d.ts +0 -4
- package/dest/storage/data_provider.d.ts.map +0 -1
- package/dest/storage/data_provider.js +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_dao.d.ts +0 -100
- package/dest/storage/note_data_provider/note_dao.d.ts.map +0 -1
- package/dest/storage/note_data_provider/note_dao.js +0 -102
- package/dest/storage/note_data_provider/note_data_provider.d.ts +0 -20
- package/dest/storage/note_data_provider/note_data_provider.d.ts.map +0 -1
- 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 -96
- package/dest/storage/sync_data_provider/index.d.ts +0 -2
- 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 -12
- package/dest/storage/sync_data_provider/sync_data_provider.d.ts.map +0 -1
- 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 -18
- 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 -82
- 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/test/pxe_test_suite.d.ts +0 -3
- package/dest/test/pxe_test_suite.d.ts.map +0 -1
- package/dest/test/pxe_test_suite.js +0 -97
- package/src/bin/index.ts +0 -62
- package/src/contract_function_simulator/execution_data_provider.ts +0 -361
- package/src/contract_function_simulator/oracle/typed_oracle.ts +0 -289
- package/src/contract_function_simulator/pxe_oracle_interface.ts +0 -1020
- package/src/contract_function_simulator/tagging_utils.ts +0 -32
- package/src/pxe_service/index.ts +0 -2
- package/src/storage/address_data_provider/index.ts +0 -1
- package/src/storage/capsule_data_provider/index.ts +0 -1
- package/src/storage/contract_data_provider/index.ts +0 -1
- package/src/storage/data_provider.ts +0 -3
- package/src/storage/note_data_provider/index.ts +0 -2
- package/src/storage/note_data_provider/note_dao.ts +0 -154
- package/src/storage/private_event_data_provider/private_event_data_provider.ts +0 -134
- 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 -123
- package/src/synchronizer/index.ts +0 -1
- package/src/test/pxe_test_suite.ts +0 -113
|
@@ -1,63 +1,91 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import type { BlockNumber } from '@aztec/foundation/branded-types';
|
|
2
|
+
import { Aes128 } from '@aztec/foundation/crypto/aes128';
|
|
3
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
4
|
+
import { Point } from '@aztec/foundation/curves/grumpkin';
|
|
5
|
+
import { LogLevels, applyStringFormatting, createLogger } from '@aztec/foundation/log';
|
|
6
|
+
import type { KeyStore } from '@aztec/key-store';
|
|
4
7
|
import type { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
5
8
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
6
9
|
import type { CompleteAddress, ContractInstance } from '@aztec/stdlib/contract';
|
|
7
10
|
import { siloNullifier } from '@aztec/stdlib/hash';
|
|
11
|
+
import type { AztecNode } from '@aztec/stdlib/interfaces/server';
|
|
8
12
|
import type { KeyValidationRequest } from '@aztec/stdlib/kernel';
|
|
9
|
-
import {
|
|
13
|
+
import { computeAddressSecret } from '@aztec/stdlib/keys';
|
|
14
|
+
import { deriveEcdhSharedSecret } from '@aztec/stdlib/logs';
|
|
10
15
|
import type { NoteStatus } from '@aztec/stdlib/note';
|
|
11
|
-
import {
|
|
16
|
+
import { MerkleTreeId, type NullifierMembershipWitness, PublicDataWitness } from '@aztec/stdlib/trees';
|
|
12
17
|
import type { BlockHeader, Capsule } from '@aztec/stdlib/tx';
|
|
13
|
-
import type { UInt64 } from '@aztec/stdlib/types';
|
|
14
18
|
|
|
15
|
-
import
|
|
19
|
+
import { EventService } from '../../events/event_service.js';
|
|
20
|
+
import { LogService } from '../../logs/log_service.js';
|
|
21
|
+
import { NoteService } from '../../notes/note_service.js';
|
|
22
|
+
import { ORACLE_VERSION } from '../../oracle_version.js';
|
|
23
|
+
import { PublicStorageService } from '../../public_storage/public_storage_service.js';
|
|
24
|
+
import type { AddressStore } from '../../storage/address_store/address_store.js';
|
|
25
|
+
import type { AnchorBlockStore } from '../../storage/anchor_block_store/anchor_block_store.js';
|
|
26
|
+
import type { CapsuleStore } from '../../storage/capsule_store/capsule_store.js';
|
|
27
|
+
import type { ContractStore } from '../../storage/contract_store/contract_store.js';
|
|
28
|
+
import type { NoteStore } from '../../storage/note_store/note_store.js';
|
|
29
|
+
import type { PrivateEventStore } from '../../storage/private_event_store/private_event_store.js';
|
|
30
|
+
import type { RecipientTaggingStore } from '../../storage/tagging_store/recipient_tagging_store.js';
|
|
31
|
+
import type { SenderAddressBookStore } from '../../storage/tagging_store/sender_address_book_store.js';
|
|
32
|
+
import { TreeMembershipService } from '../../tree_membership/tree_membership_service.js';
|
|
33
|
+
import { EventValidationRequest } from '../noir-structs/event_validation_request.js';
|
|
34
|
+
import { LogRetrievalRequest } from '../noir-structs/log_retrieval_request.js';
|
|
35
|
+
import { LogRetrievalResponse } from '../noir-structs/log_retrieval_response.js';
|
|
36
|
+
import { NoteValidationRequest } from '../noir-structs/note_validation_request.js';
|
|
37
|
+
import { UtilityContext } from '../noir-structs/utility_context.js';
|
|
16
38
|
import { pickNotes } from '../pick_notes.js';
|
|
17
|
-
import {
|
|
39
|
+
import type { IMiscOracle, IUtilityExecutionOracle, NoteData } from './interfaces.js';
|
|
40
|
+
import { MessageLoadOracleInputs } from './message_load_oracle_inputs.js';
|
|
18
41
|
|
|
19
42
|
/**
|
|
20
43
|
* The oracle for an execution of utility contract functions.
|
|
21
44
|
*/
|
|
22
|
-
export class UtilityExecutionOracle
|
|
45
|
+
export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOracle {
|
|
46
|
+
isMisc = true as const;
|
|
47
|
+
isUtility = true as const;
|
|
48
|
+
|
|
49
|
+
private aztecNrDebugLog = createLogger('aztec-nr:debug_log');
|
|
50
|
+
|
|
23
51
|
constructor(
|
|
24
52
|
protected readonly contractAddress: AztecAddress,
|
|
25
53
|
/** List of transient auth witnesses to be used during this simulation */
|
|
26
54
|
protected readonly authWitnesses: AuthWitness[],
|
|
27
55
|
protected readonly capsules: Capsule[], // TODO(#12425): Rename to transientCapsules
|
|
28
|
-
protected readonly
|
|
56
|
+
protected readonly anchorBlockHeader: BlockHeader,
|
|
57
|
+
protected readonly contractStore: ContractStore,
|
|
58
|
+
protected readonly noteStore: NoteStore,
|
|
59
|
+
protected readonly keyStore: KeyStore,
|
|
60
|
+
protected readonly addressStore: AddressStore,
|
|
61
|
+
protected readonly aztecNode: AztecNode,
|
|
62
|
+
protected readonly anchorBlockStore: AnchorBlockStore,
|
|
63
|
+
protected readonly recipientTaggingStore: RecipientTaggingStore,
|
|
64
|
+
protected readonly senderAddressBookStore: SenderAddressBookStore,
|
|
65
|
+
protected readonly capsuleStore: CapsuleStore,
|
|
66
|
+
protected readonly privateEventStore: PrivateEventStore,
|
|
29
67
|
protected log = createLogger('simulator:client_view_context'),
|
|
30
68
|
protected readonly scopes?: AztecAddress[],
|
|
31
|
-
) {
|
|
32
|
-
super();
|
|
33
|
-
}
|
|
69
|
+
) {}
|
|
34
70
|
|
|
35
|
-
public
|
|
36
|
-
|
|
71
|
+
public utilityAssertCompatibleOracleVersion(version: number): void {
|
|
72
|
+
if (version !== ORACLE_VERSION) {
|
|
73
|
+
throw new Error(`Incompatible oracle version. Expected version ${ORACLE_VERSION}, got ${version}.`);
|
|
74
|
+
}
|
|
37
75
|
}
|
|
38
76
|
|
|
39
|
-
public
|
|
77
|
+
public utilityGetRandomField(): Fr {
|
|
40
78
|
return Fr.random();
|
|
41
79
|
}
|
|
42
80
|
|
|
43
|
-
public
|
|
44
|
-
return
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
public override utilityGetContractAddress(): Promise<AztecAddress> {
|
|
52
|
-
return Promise.resolve(this.contractAddress);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
public override utilityGetChainId(): Promise<Fr> {
|
|
56
|
-
return Promise.resolve(this.executionDataProvider.getChainId().then(id => new Fr(id)));
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
public override utilityGetVersion(): Promise<Fr> {
|
|
60
|
-
return Promise.resolve(this.executionDataProvider.getVersion().then(v => new Fr(v)));
|
|
81
|
+
public utilityGetUtilityContext(): UtilityContext {
|
|
82
|
+
return UtilityContext.from({
|
|
83
|
+
blockNumber: this.anchorBlockHeader.globalVariables.blockNumber,
|
|
84
|
+
timestamp: this.anchorBlockHeader.globalVariables.timestamp,
|
|
85
|
+
contractAddress: this.contractAddress,
|
|
86
|
+
version: this.anchorBlockHeader.globalVariables.version,
|
|
87
|
+
chainId: this.anchorBlockHeader.globalVariables.chainId,
|
|
88
|
+
});
|
|
61
89
|
}
|
|
62
90
|
|
|
63
91
|
/**
|
|
@@ -66,8 +94,8 @@ export class UtilityExecutionOracle extends TypedOracle {
|
|
|
66
94
|
* @returns A Promise that resolves to nullifier keys.
|
|
67
95
|
* @throws If the keys are not registered in the key store.
|
|
68
96
|
*/
|
|
69
|
-
public
|
|
70
|
-
return this.
|
|
97
|
+
public utilityGetKeyValidationRequest(pkMHash: Fr): Promise<KeyValidationRequest> {
|
|
98
|
+
return this.keyStore.getKeyValidationRequest(pkMHash, this.contractAddress);
|
|
71
99
|
}
|
|
72
100
|
|
|
73
101
|
/**
|
|
@@ -77,8 +105,9 @@ export class UtilityExecutionOracle extends TypedOracle {
|
|
|
77
105
|
* @param leafValue - The leaf value
|
|
78
106
|
* @returns The index and sibling path concatenated [index, sibling_path]
|
|
79
107
|
*/
|
|
80
|
-
public
|
|
81
|
-
|
|
108
|
+
public utilityGetMembershipWitness(blockNumber: BlockNumber, treeId: MerkleTreeId, leafValue: Fr): Promise<Fr[]> {
|
|
109
|
+
const treeMembershipService = new TreeMembershipService(this.aztecNode, this.anchorBlockStore);
|
|
110
|
+
return treeMembershipService.getMembershipWitness(blockNumber, treeId, leafValue);
|
|
82
111
|
}
|
|
83
112
|
|
|
84
113
|
/**
|
|
@@ -87,11 +116,11 @@ export class UtilityExecutionOracle extends TypedOracle {
|
|
|
87
116
|
* @param nullifier - Nullifier we try to find witness for.
|
|
88
117
|
* @returns The nullifier membership witness (if found).
|
|
89
118
|
*/
|
|
90
|
-
public
|
|
91
|
-
blockNumber:
|
|
119
|
+
public async utilityGetNullifierMembershipWitness(
|
|
120
|
+
blockNumber: BlockNumber,
|
|
92
121
|
nullifier: Fr,
|
|
93
122
|
): Promise<NullifierMembershipWitness | undefined> {
|
|
94
|
-
return await this.
|
|
123
|
+
return await this.aztecNode.getNullifierMembershipWitness(blockNumber, nullifier);
|
|
95
124
|
}
|
|
96
125
|
|
|
97
126
|
/**
|
|
@@ -103,11 +132,12 @@ export class UtilityExecutionOracle extends TypedOracle {
|
|
|
103
132
|
* list structure" of leaves and proving that a lower nullifier is pointing to a bigger next value than the nullifier
|
|
104
133
|
* we are trying to prove non-inclusion for.
|
|
105
134
|
*/
|
|
106
|
-
public
|
|
107
|
-
blockNumber:
|
|
135
|
+
public async utilityGetLowNullifierMembershipWitness(
|
|
136
|
+
blockNumber: BlockNumber,
|
|
108
137
|
nullifier: Fr,
|
|
109
138
|
): Promise<NullifierMembershipWitness | undefined> {
|
|
110
|
-
|
|
139
|
+
const treeMembershipService = new TreeMembershipService(this.aztecNode, this.anchorBlockStore);
|
|
140
|
+
return await treeMembershipService.getLowNullifierMembershipWitness(blockNumber, nullifier);
|
|
111
141
|
}
|
|
112
142
|
|
|
113
143
|
/**
|
|
@@ -116,11 +146,12 @@ export class UtilityExecutionOracle extends TypedOracle {
|
|
|
116
146
|
* @param leafSlot - The slot of the public data tree to get the witness for.
|
|
117
147
|
* @returns - The witness
|
|
118
148
|
*/
|
|
119
|
-
public
|
|
120
|
-
blockNumber:
|
|
149
|
+
public async utilityGetPublicDataWitness(
|
|
150
|
+
blockNumber: BlockNumber,
|
|
121
151
|
leafSlot: Fr,
|
|
122
152
|
): Promise<PublicDataWitness | undefined> {
|
|
123
|
-
|
|
153
|
+
const treeMembershipService = new TreeMembershipService(this.aztecNode, this.anchorBlockStore);
|
|
154
|
+
return await treeMembershipService.getPublicDataWitness(blockNumber, leafSlot);
|
|
124
155
|
}
|
|
125
156
|
|
|
126
157
|
/**
|
|
@@ -128,12 +159,14 @@ export class UtilityExecutionOracle extends TypedOracle {
|
|
|
128
159
|
* @param blockNumber - The number of a block of which to get the block header.
|
|
129
160
|
* @returns Block extracted from a block with block number `blockNumber`.
|
|
130
161
|
*/
|
|
131
|
-
public
|
|
132
|
-
const
|
|
133
|
-
if (
|
|
134
|
-
|
|
162
|
+
public async utilityGetBlockHeader(blockNumber: BlockNumber): Promise<BlockHeader | undefined> {
|
|
163
|
+
const anchorBlockNumber = (await this.anchorBlockStore.getBlockHeader()).getBlockNumber();
|
|
164
|
+
if (blockNumber > anchorBlockNumber) {
|
|
165
|
+
throw new Error(`Block number ${blockNumber} is higher than current block ${anchorBlockNumber}`);
|
|
135
166
|
}
|
|
136
|
-
|
|
167
|
+
|
|
168
|
+
const block = await this.aztecNode.getBlock(blockNumber);
|
|
169
|
+
return block?.getBlockHeader() || undefined;
|
|
137
170
|
}
|
|
138
171
|
|
|
139
172
|
/**
|
|
@@ -142,8 +175,19 @@ export class UtilityExecutionOracle extends TypedOracle {
|
|
|
142
175
|
* @returns A complete address associated with the input address.
|
|
143
176
|
* @throws An error if the account is not registered in the database.
|
|
144
177
|
*/
|
|
145
|
-
public
|
|
146
|
-
return this.
|
|
178
|
+
public utilityGetPublicKeysAndPartialAddress(account: AztecAddress): Promise<CompleteAddress> {
|
|
179
|
+
return this.getCompleteAddress(account);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
protected async getCompleteAddress(account: AztecAddress): Promise<CompleteAddress> {
|
|
183
|
+
const completeAddress = await this.addressStore.getCompleteAddress(account);
|
|
184
|
+
if (!completeAddress) {
|
|
185
|
+
throw new Error(
|
|
186
|
+
`No public key registered for address ${account}.
|
|
187
|
+
Register it by calling pxe.addAccount(...).\nSee docs for context: https://docs.aztec.network/developers/resources/debugging/aztecnr-errors#simulation-error-no-public-key-registered-for-address-0x0-register-it-by-calling-pxeregisterrecipient-or-pxeregisteraccount`,
|
|
188
|
+
);
|
|
189
|
+
}
|
|
190
|
+
return completeAddress;
|
|
147
191
|
}
|
|
148
192
|
|
|
149
193
|
/**
|
|
@@ -151,8 +195,16 @@ export class UtilityExecutionOracle extends TypedOracle {
|
|
|
151
195
|
* @param address - Address.
|
|
152
196
|
* @returns A contract instance.
|
|
153
197
|
*/
|
|
154
|
-
public
|
|
155
|
-
return this.
|
|
198
|
+
public utilityGetContractInstance(address: AztecAddress): Promise<ContractInstance> {
|
|
199
|
+
return this.getContractInstance(address);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
protected async getContractInstance(address: AztecAddress): Promise<ContractInstance> {
|
|
203
|
+
const instance = await this.contractStore.getContractInstance(address);
|
|
204
|
+
if (!instance) {
|
|
205
|
+
throw new Error(`No contract instance found for address ${address.toString()}`);
|
|
206
|
+
}
|
|
207
|
+
return instance;
|
|
156
208
|
}
|
|
157
209
|
|
|
158
210
|
/**
|
|
@@ -161,7 +213,7 @@ export class UtilityExecutionOracle extends TypedOracle {
|
|
|
161
213
|
* @param messageHash - Hash of the message to authenticate.
|
|
162
214
|
* @returns Authentication witness for the requested message hash.
|
|
163
215
|
*/
|
|
164
|
-
public
|
|
216
|
+
public utilityGetAuthWitness(messageHash: Fr): Promise<Fr[] | undefined> {
|
|
165
217
|
return Promise.resolve(this.authWitnesses.find(w => w.requestHash.equals(messageHash))?.witness);
|
|
166
218
|
}
|
|
167
219
|
|
|
@@ -174,6 +226,7 @@ export class UtilityExecutionOracle extends TypedOracle {
|
|
|
174
226
|
* Real notes coming from DB will have a leafIndex which
|
|
175
227
|
* represents their index in the note hash tree.
|
|
176
228
|
*
|
|
229
|
+
* @param owner - The owner of the notes. If undefined, returns notes for all owners.
|
|
177
230
|
* @param storageSlot - The storage slot.
|
|
178
231
|
* @param numSelects - The number of valid selects in selectBy and selectValues.
|
|
179
232
|
* @param selectBy - An array of indices of the fields to selects.
|
|
@@ -186,7 +239,8 @@ export class UtilityExecutionOracle extends TypedOracle {
|
|
|
186
239
|
* @param status - The status of notes to fetch.
|
|
187
240
|
* @returns Array of note data.
|
|
188
241
|
*/
|
|
189
|
-
public
|
|
242
|
+
public async utilityGetNotes(
|
|
243
|
+
owner: AztecAddress | undefined,
|
|
190
244
|
storageSlot: Fr,
|
|
191
245
|
numSelects: number,
|
|
192
246
|
selectByIndexes: number[],
|
|
@@ -202,7 +256,9 @@ export class UtilityExecutionOracle extends TypedOracle {
|
|
|
202
256
|
offset: number,
|
|
203
257
|
status: NoteStatus,
|
|
204
258
|
): Promise<NoteData[]> {
|
|
205
|
-
const
|
|
259
|
+
const noteService = new NoteService(this.noteStore, this.aztecNode, this.anchorBlockStore);
|
|
260
|
+
|
|
261
|
+
const dbNotes = await noteService.getNotes(this.contractAddress, owner, storageSlot, status, this.scopes);
|
|
206
262
|
return pickNotes<NoteData>(dbNotes, {
|
|
207
263
|
selects: selectByIndexes.slice(0, numSelects).map((index, i) => ({
|
|
208
264
|
selector: { index, offset: selectByOffsets[i], length: selectByLengths[i] },
|
|
@@ -223,22 +279,31 @@ export class UtilityExecutionOracle extends TypedOracle {
|
|
|
223
279
|
* @param innerNullifier - The inner nullifier.
|
|
224
280
|
* @returns A boolean indicating whether the nullifier exists in the tree or not.
|
|
225
281
|
*/
|
|
226
|
-
public
|
|
282
|
+
public async utilityCheckNullifierExists(innerNullifier: Fr) {
|
|
227
283
|
const nullifier = await siloNullifier(this.contractAddress, innerNullifier!);
|
|
228
|
-
const
|
|
284
|
+
const treeMembershipService = new TreeMembershipService(this.aztecNode, this.anchorBlockStore);
|
|
285
|
+
const index = await treeMembershipService.getNullifierIndex(nullifier);
|
|
229
286
|
return index !== undefined;
|
|
230
287
|
}
|
|
231
288
|
|
|
232
289
|
/**
|
|
233
|
-
* Fetches a message from the
|
|
290
|
+
* Fetches a message from the executionStore, given its key.
|
|
234
291
|
* @param contractAddress - Address of a contract by which the message was emitted.
|
|
235
292
|
* @param messageHash - Hash of the message.
|
|
236
293
|
* @param secret - Secret used to compute a nullifier.
|
|
237
294
|
* @dev Contract address and secret are only used to compute the nullifier to get non-nullified messages
|
|
238
295
|
* @returns The l1 to l2 membership witness (index of message in the tree and sibling path).
|
|
239
296
|
*/
|
|
240
|
-
public
|
|
241
|
-
|
|
297
|
+
public async utilityGetL1ToL2MembershipWitness(contractAddress: AztecAddress, messageHash: Fr, secret: Fr) {
|
|
298
|
+
const treeMembershipService = new TreeMembershipService(this.aztecNode, this.anchorBlockStore);
|
|
299
|
+
const [messageIndex, siblingPath] = await treeMembershipService.getL1ToL2MembershipWitness(
|
|
300
|
+
contractAddress,
|
|
301
|
+
messageHash,
|
|
302
|
+
secret,
|
|
303
|
+
);
|
|
304
|
+
|
|
305
|
+
// Assuming messageIndex is what you intended to use for the index in MessageLoadOracleInputs
|
|
306
|
+
return new MessageLoadOracleInputs(messageIndex, siblingPath);
|
|
242
307
|
}
|
|
243
308
|
|
|
244
309
|
/**
|
|
@@ -248,16 +313,20 @@ export class UtilityExecutionOracle extends TypedOracle {
|
|
|
248
313
|
* @param blockNumber - The block number to read storage at.
|
|
249
314
|
* @param numberOfElements - Number of elements to read from the starting storage slot.
|
|
250
315
|
*/
|
|
251
|
-
public
|
|
316
|
+
public async utilityStorageRead(
|
|
252
317
|
contractAddress: AztecAddress,
|
|
253
318
|
startStorageSlot: Fr,
|
|
254
|
-
blockNumber:
|
|
319
|
+
blockNumber: BlockNumber,
|
|
255
320
|
numberOfElements: number,
|
|
256
321
|
) {
|
|
257
322
|
const values = [];
|
|
323
|
+
const publicStorageService = new PublicStorageService(this.anchorBlockStore, this.aztecNode);
|
|
324
|
+
|
|
325
|
+
// TODO: why do we serialize these requests? This should probably a single call
|
|
326
|
+
// Privacy considerations?
|
|
258
327
|
for (let i = 0n; i < numberOfElements; i++) {
|
|
259
328
|
const storageSlot = new Fr(startStorageSlot.value + i);
|
|
260
|
-
const value = await
|
|
329
|
+
const value = await publicStorageService.getPublicStorageAt(blockNumber, contractAddress, storageSlot);
|
|
261
330
|
|
|
262
331
|
this.log.debug(
|
|
263
332
|
`Oracle storage read: slot=${storageSlot.toString()} address-${contractAddress.toString()} value=${value}`,
|
|
@@ -267,32 +336,42 @@ export class UtilityExecutionOracle extends TypedOracle {
|
|
|
267
336
|
return values;
|
|
268
337
|
}
|
|
269
338
|
|
|
270
|
-
public
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
339
|
+
public utilityDebugLog(level: number, message: string, fields: Fr[]): void {
|
|
340
|
+
if (!LogLevels[level]) {
|
|
341
|
+
throw new Error(`Invalid debug log level: ${level}`);
|
|
342
|
+
}
|
|
343
|
+
const levelName = LogLevels[level];
|
|
344
|
+
this.aztecNrDebugLog[levelName](`${applyStringFormatting(message, fields)}`);
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
public async utilityFetchTaggedLogs(pendingTaggedLogArrayBaseSlot: Fr) {
|
|
348
|
+
const logService = new LogService(
|
|
349
|
+
this.aztecNode,
|
|
350
|
+
this.anchorBlockStore,
|
|
351
|
+
this.keyStore,
|
|
352
|
+
this.capsuleStore,
|
|
353
|
+
this.recipientTaggingStore,
|
|
354
|
+
this.senderAddressBookStore,
|
|
355
|
+
this.addressStore,
|
|
356
|
+
);
|
|
288
357
|
|
|
289
|
-
|
|
290
|
-
await this.executionDataProvider.syncTaggedLogs(this.contractAddress, pendingTaggedLogArrayBaseSlot, this.scopes);
|
|
358
|
+
await logService.syncTaggedLogs(this.contractAddress, pendingTaggedLogArrayBaseSlot, this.scopes);
|
|
291
359
|
|
|
292
|
-
|
|
360
|
+
const noteService = new NoteService(this.noteStore, this.aztecNode, this.anchorBlockStore);
|
|
361
|
+
await noteService.syncNoteNullifiers(this.contractAddress);
|
|
293
362
|
}
|
|
294
363
|
|
|
295
|
-
|
|
364
|
+
/**
|
|
365
|
+
* Validates all note and event validation requests enqueued via `enqueue_note_for_validation` and
|
|
366
|
+
* `enqueue_event_for_validation`, inserting them into the note database and event store respectively, making them
|
|
367
|
+
* queryable via `get_notes` and `getPrivateEvents`.
|
|
368
|
+
*
|
|
369
|
+
* This automatically clears both validation request queues, so no further work needs to be done by the caller.
|
|
370
|
+
* @param contractAddress - The address of the contract that the logs are tagged for.
|
|
371
|
+
* @param noteValidationRequestsArrayBaseSlot - The base slot of capsule array containing note validation requests.
|
|
372
|
+
* @param eventValidationRequestsArrayBaseSlot - The base slot of capsule array containing event validation requests.
|
|
373
|
+
*/
|
|
374
|
+
public async utilityValidateEnqueuedNotesAndEvents(
|
|
296
375
|
contractAddress: AztecAddress,
|
|
297
376
|
noteValidationRequestsArrayBaseSlot: Fr,
|
|
298
377
|
eventValidationRequestsArrayBaseSlot: Fr,
|
|
@@ -302,14 +381,52 @@ export class UtilityExecutionOracle extends TypedOracle {
|
|
|
302
381
|
throw new Error(`Got a note validation request from ${contractAddress}, expected ${this.contractAddress}`);
|
|
303
382
|
}
|
|
304
383
|
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
384
|
+
// We read all note and event validation requests and process them all concurrently. This makes the process much
|
|
385
|
+
// faster as we don't need to wait for the network round-trip.
|
|
386
|
+
const noteValidationRequests = (
|
|
387
|
+
await this.capsuleStore.readCapsuleArray(contractAddress, noteValidationRequestsArrayBaseSlot)
|
|
388
|
+
).map(NoteValidationRequest.fromFields);
|
|
389
|
+
|
|
390
|
+
const eventValidationRequests = (
|
|
391
|
+
await this.capsuleStore.readCapsuleArray(contractAddress, eventValidationRequestsArrayBaseSlot)
|
|
392
|
+
).map(EventValidationRequest.fromFields);
|
|
393
|
+
|
|
394
|
+
const noteService = new NoteService(this.noteStore, this.aztecNode, this.anchorBlockStore);
|
|
395
|
+
const noteDeliveries = noteValidationRequests.map(request =>
|
|
396
|
+
noteService.deliverNote(
|
|
397
|
+
request.contractAddress,
|
|
398
|
+
request.owner,
|
|
399
|
+
request.storageSlot,
|
|
400
|
+
request.randomness,
|
|
401
|
+
request.noteNonce,
|
|
402
|
+
request.content,
|
|
403
|
+
request.noteHash,
|
|
404
|
+
request.nullifier,
|
|
405
|
+
request.txHash,
|
|
406
|
+
request.recipient,
|
|
407
|
+
),
|
|
408
|
+
);
|
|
409
|
+
|
|
410
|
+
const eventService = new EventService(this.anchorBlockStore, this.aztecNode, this.privateEventStore);
|
|
411
|
+
const eventDeliveries = eventValidationRequests.map(request =>
|
|
412
|
+
eventService.deliverEvent(
|
|
413
|
+
request.contractAddress,
|
|
414
|
+
request.eventTypeId,
|
|
415
|
+
request.serializedEvent,
|
|
416
|
+
request.eventCommitment,
|
|
417
|
+
request.txHash,
|
|
418
|
+
request.recipient,
|
|
419
|
+
),
|
|
309
420
|
);
|
|
421
|
+
|
|
422
|
+
await Promise.all([...noteDeliveries, ...eventDeliveries]);
|
|
423
|
+
|
|
424
|
+
// Requests are cleared once we're done.
|
|
425
|
+
await this.capsuleStore.setCapsuleArray(contractAddress, noteValidationRequestsArrayBaseSlot, []);
|
|
426
|
+
await this.capsuleStore.setCapsuleArray(contractAddress, eventValidationRequestsArrayBaseSlot, []);
|
|
310
427
|
}
|
|
311
428
|
|
|
312
|
-
public
|
|
429
|
+
public async utilityBulkRetrieveLogs(
|
|
313
430
|
contractAddress: AztecAddress,
|
|
314
431
|
logRetrievalRequestsArrayBaseSlot: Fr,
|
|
315
432
|
logRetrievalResponsesArrayBaseSlot: Fr,
|
|
@@ -319,22 +436,44 @@ export class UtilityExecutionOracle extends TypedOracle {
|
|
|
319
436
|
throw new Error(`Got a note validation request from ${contractAddress}, expected ${this.contractAddress}`);
|
|
320
437
|
}
|
|
321
438
|
|
|
322
|
-
|
|
439
|
+
// We read all log retrieval requests and process them all concurrently. This makes the process much faster as we
|
|
440
|
+
// don't need to wait for the network round-trip.
|
|
441
|
+
const logRetrievalRequests = (
|
|
442
|
+
await this.capsuleStore.readCapsuleArray(contractAddress, logRetrievalRequestsArrayBaseSlot)
|
|
443
|
+
).map(LogRetrievalRequest.fromFields);
|
|
444
|
+
|
|
445
|
+
const logService = new LogService(
|
|
446
|
+
this.aztecNode,
|
|
447
|
+
this.anchorBlockStore,
|
|
448
|
+
this.keyStore,
|
|
449
|
+
this.capsuleStore,
|
|
450
|
+
this.recipientTaggingStore,
|
|
451
|
+
this.senderAddressBookStore,
|
|
452
|
+
this.addressStore,
|
|
453
|
+
);
|
|
454
|
+
|
|
455
|
+
const maybeLogRetrievalResponses = await logService.bulkRetrieveLogs(logRetrievalRequests);
|
|
456
|
+
|
|
457
|
+
// Requests are cleared once we're done.
|
|
458
|
+
await this.capsuleStore.setCapsuleArray(contractAddress, logRetrievalRequestsArrayBaseSlot, []);
|
|
459
|
+
|
|
460
|
+
// The responses are stored as Option<LogRetrievalResponse> in a second CapsuleArray.
|
|
461
|
+
await this.capsuleStore.setCapsuleArray(
|
|
323
462
|
contractAddress,
|
|
324
|
-
logRetrievalRequestsArrayBaseSlot,
|
|
325
463
|
logRetrievalResponsesArrayBaseSlot,
|
|
464
|
+
maybeLogRetrievalResponses.map(LogRetrievalResponse.toSerializedOption),
|
|
326
465
|
);
|
|
327
466
|
}
|
|
328
467
|
|
|
329
|
-
public
|
|
468
|
+
public utilityStoreCapsule(contractAddress: AztecAddress, slot: Fr, capsule: Fr[]): Promise<void> {
|
|
330
469
|
if (!contractAddress.equals(this.contractAddress)) {
|
|
331
470
|
// TODO(#10727): instead of this check that this.contractAddress is allowed to access the external DB
|
|
332
471
|
throw new Error(`Contract ${contractAddress} is not allowed to access ${this.contractAddress}'s PXE DB`);
|
|
333
472
|
}
|
|
334
|
-
return this.
|
|
473
|
+
return this.capsuleStore.storeCapsule(this.contractAddress, slot, capsule);
|
|
335
474
|
}
|
|
336
475
|
|
|
337
|
-
public
|
|
476
|
+
public async utilityLoadCapsule(contractAddress: AztecAddress, slot: Fr): Promise<Fr[] | null> {
|
|
338
477
|
if (!contractAddress.equals(this.contractAddress)) {
|
|
339
478
|
// TODO(#10727): instead of this check that this.contractAddress is allowed to access the external DB
|
|
340
479
|
throw new Error(`Contract ${contractAddress} is not allowed to access ${this.contractAddress}'s PXE DB`);
|
|
@@ -342,19 +481,19 @@ export class UtilityExecutionOracle extends TypedOracle {
|
|
|
342
481
|
return (
|
|
343
482
|
// TODO(#12425): On the following line, the pertinent capsule gets overshadowed by the transient one. Tackle this.
|
|
344
483
|
this.capsules.find(c => c.contractAddress.equals(contractAddress) && c.storageSlot.equals(slot))?.data ??
|
|
345
|
-
(await this.
|
|
484
|
+
(await this.capsuleStore.loadCapsule(this.contractAddress, slot))
|
|
346
485
|
);
|
|
347
486
|
}
|
|
348
487
|
|
|
349
|
-
public
|
|
488
|
+
public utilityDeleteCapsule(contractAddress: AztecAddress, slot: Fr): Promise<void> {
|
|
350
489
|
if (!contractAddress.equals(this.contractAddress)) {
|
|
351
490
|
// TODO(#10727): instead of this check that this.contractAddress is allowed to access the external DB
|
|
352
491
|
throw new Error(`Contract ${contractAddress} is not allowed to access ${this.contractAddress}'s PXE DB`);
|
|
353
492
|
}
|
|
354
|
-
return this.
|
|
493
|
+
return this.capsuleStore.deleteCapsule(this.contractAddress, slot);
|
|
355
494
|
}
|
|
356
495
|
|
|
357
|
-
public
|
|
496
|
+
public utilityCopyCapsule(
|
|
358
497
|
contractAddress: AztecAddress,
|
|
359
498
|
srcSlot: Fr,
|
|
360
499
|
dstSlot: Fr,
|
|
@@ -364,20 +503,32 @@ export class UtilityExecutionOracle extends TypedOracle {
|
|
|
364
503
|
// TODO(#10727): instead of this check that this.contractAddress is allowed to access the external DB
|
|
365
504
|
throw new Error(`Contract ${contractAddress} is not allowed to access ${this.contractAddress}'s PXE DB`);
|
|
366
505
|
}
|
|
367
|
-
return this.
|
|
506
|
+
return this.capsuleStore.copyCapsule(this.contractAddress, srcSlot, dstSlot, numEntries);
|
|
368
507
|
}
|
|
369
508
|
|
|
370
509
|
// TODO(#11849): consider replacing this oracle with a pure Noir implementation of aes decryption.
|
|
371
|
-
public
|
|
510
|
+
public utilityAes128Decrypt(ciphertext: Buffer, iv: Buffer, symKey: Buffer): Promise<Buffer> {
|
|
372
511
|
const aes128 = new Aes128();
|
|
373
512
|
return aes128.decryptBufferCBC(ciphertext, iv, symKey);
|
|
374
513
|
}
|
|
375
514
|
|
|
376
|
-
|
|
377
|
-
|
|
515
|
+
/**
|
|
516
|
+
* Retrieves the shared secret for a given address and ephemeral public key.
|
|
517
|
+
* @param address - The address to get the secret for.
|
|
518
|
+
* @param ephPk - The ephemeral public key to get the secret for.
|
|
519
|
+
* @returns The secret for the given address.
|
|
520
|
+
*/
|
|
521
|
+
public utilityGetSharedSecret(address: AztecAddress, ephPk: Point): Promise<Point> {
|
|
522
|
+
return this.getSharedSecret(address, ephPk);
|
|
378
523
|
}
|
|
379
524
|
|
|
380
|
-
|
|
381
|
-
|
|
525
|
+
protected async getSharedSecret(address: AztecAddress, ephPk: Point): Promise<Point> {
|
|
526
|
+
// TODO(#12656): return an app-siloed secret
|
|
527
|
+
const recipientCompleteAddress = await this.getCompleteAddress(address);
|
|
528
|
+
const ivskM = await this.keyStore.getMasterSecretKey(
|
|
529
|
+
recipientCompleteAddress.publicKeys.masterIncomingViewingPublicKey,
|
|
530
|
+
);
|
|
531
|
+
const addressSecret = await computeAddressSecret(await recipientCompleteAddress.getPreaddress(), ivskM);
|
|
532
|
+
return deriveEcdhSharedSecret(addressSecret, ephPk);
|
|
382
533
|
}
|
|
383
534
|
}
|
|
@@ -2,21 +2,21 @@ import { FunctionSelector } from '@aztec/stdlib/abi';
|
|
|
2
2
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
3
3
|
import type { ContractOverrides } from '@aztec/stdlib/tx';
|
|
4
4
|
|
|
5
|
-
import type {
|
|
5
|
+
import type { ContractStore } from '../storage/contract_store/contract_store.js';
|
|
6
6
|
|
|
7
7
|
/*
|
|
8
|
-
* Proxy generator for a
|
|
8
|
+
* Proxy generator for a ContractStore that allows overriding contract instances and artifacts, so
|
|
9
9
|
* the contract function simulator can execute different bytecode on certain addresses. An example use case
|
|
10
10
|
* would be overriding your own account contract so that valid signatures don't have to be provided while simulating.
|
|
11
11
|
*/
|
|
12
|
-
export class
|
|
13
|
-
static create(
|
|
12
|
+
export class ProxiedContractStoreFactory {
|
|
13
|
+
static create(contractStore: ContractStore, overrides?: ContractOverrides) {
|
|
14
14
|
if (!overrides) {
|
|
15
|
-
return
|
|
15
|
+
return contractStore;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
return new Proxy(
|
|
19
|
-
get(target, prop: keyof
|
|
18
|
+
return new Proxy(contractStore, {
|
|
19
|
+
get(target, prop: keyof ContractStore) {
|
|
20
20
|
switch (prop) {
|
|
21
21
|
case 'getContractInstance': {
|
|
22
22
|
return async (address: AztecAddress) => {
|
|
@@ -52,6 +52,23 @@ export class ProxiedContractDataProviderFactory {
|
|
|
52
52
|
}
|
|
53
53
|
};
|
|
54
54
|
}
|
|
55
|
+
case 'getFunctionArtifactWithDebugMetadata': {
|
|
56
|
+
return async (contractAddress: AztecAddress, selector: FunctionSelector) => {
|
|
57
|
+
if (overrides[contractAddress.toString()]) {
|
|
58
|
+
const { artifact } = overrides[contractAddress.toString()]!;
|
|
59
|
+
const functions = artifact.functions;
|
|
60
|
+
for (let i = 0; i < functions.length; i++) {
|
|
61
|
+
const fn = functions[i];
|
|
62
|
+
const fnSelector = await FunctionSelector.fromNameAndParameters(fn.name, fn.parameters);
|
|
63
|
+
if (fnSelector.equals(selector)) {
|
|
64
|
+
return fn;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
} else {
|
|
68
|
+
return target.getFunctionArtifactWithDebugMetadata(contractAddress, selector);
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
}
|
|
55
72
|
default: {
|
|
56
73
|
const value = Reflect.get(target, prop);
|
|
57
74
|
if (typeof value === 'function') {
|