@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
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
|
+
import { createLogger } from '@aztec/foundation/log';
|
|
3
|
+
import type { KeyStore } from '@aztec/key-store';
|
|
4
|
+
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
5
|
+
import type { CompleteAddress } from '@aztec/stdlib/contract';
|
|
6
|
+
import type { AztecNode } from '@aztec/stdlib/interfaces/server';
|
|
7
|
+
import { DirectionalAppTaggingSecret, PendingTaggedLog, SiloedTag, Tag, TxScopedL2Log } from '@aztec/stdlib/logs';
|
|
8
|
+
|
|
9
|
+
import type { LogRetrievalRequest } from '../contract_function_simulator/noir-structs/log_retrieval_request.js';
|
|
10
|
+
import { LogRetrievalResponse } from '../contract_function_simulator/noir-structs/log_retrieval_response.js';
|
|
11
|
+
import { AddressStore } from '../storage/address_store/address_store.js';
|
|
12
|
+
import { AnchorBlockStore } from '../storage/anchor_block_store/anchor_block_store.js';
|
|
13
|
+
import { CapsuleStore } from '../storage/capsule_store/capsule_store.js';
|
|
14
|
+
import type { RecipientTaggingStore } from '../storage/tagging_store/recipient_tagging_store.js';
|
|
15
|
+
import type { SenderAddressBookStore } from '../storage/tagging_store/sender_address_book_store.js';
|
|
16
|
+
import { loadPrivateLogsForSenderRecipientPair } from '../tagging/index.js';
|
|
17
|
+
|
|
18
|
+
export class LogService {
|
|
19
|
+
private log = createLogger('log_service');
|
|
20
|
+
|
|
21
|
+
constructor(
|
|
22
|
+
private readonly aztecNode: AztecNode,
|
|
23
|
+
private readonly anchorBlockStore: AnchorBlockStore,
|
|
24
|
+
private readonly keyStore: KeyStore,
|
|
25
|
+
private readonly capsuleStore: CapsuleStore,
|
|
26
|
+
private readonly recipientTaggingStore: RecipientTaggingStore,
|
|
27
|
+
private readonly senderAddressBookStore: SenderAddressBookStore,
|
|
28
|
+
private readonly addressStore: AddressStore,
|
|
29
|
+
) {}
|
|
30
|
+
|
|
31
|
+
public async bulkRetrieveLogs(logRetrievalRequests: LogRetrievalRequest[]): Promise<(LogRetrievalResponse | null)[]> {
|
|
32
|
+
return await Promise.all(
|
|
33
|
+
logRetrievalRequests.map(async request => {
|
|
34
|
+
const [publicLog, privateLog] = await Promise.all([
|
|
35
|
+
this.#getPublicLogByTag(request.tag, request.contractAddress),
|
|
36
|
+
this.#getPrivateLogByTag(await SiloedTag.compute(request.tag, request.contractAddress)),
|
|
37
|
+
]);
|
|
38
|
+
|
|
39
|
+
if (publicLog !== null && privateLog !== null) {
|
|
40
|
+
throw new Error(
|
|
41
|
+
`Found both a public and private log when searching for tag ${request.tag} from contract ${request.contractAddress}`,
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return publicLog ?? privateLog;
|
|
46
|
+
}),
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
async #getPublicLogByTag(tag: Tag, contractAddress: AztecAddress): Promise<LogRetrievalResponse | null> {
|
|
51
|
+
const logs = await this.aztecNode.getPublicLogsByTagsFromContract(contractAddress, [tag]);
|
|
52
|
+
const logsForTag = logs[0];
|
|
53
|
+
|
|
54
|
+
if (logsForTag.length == 0) {
|
|
55
|
+
return null;
|
|
56
|
+
} else if (logsForTag.length > 1) {
|
|
57
|
+
// TODO(#11627): handle this case
|
|
58
|
+
throw new Error(
|
|
59
|
+
`Got ${logsForTag.length} logs for tag ${tag} and contract ${contractAddress.toString()}. getPublicLogByTag currently only supports a single log per tag`,
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const scopedLog = logsForTag[0];
|
|
64
|
+
|
|
65
|
+
return new LogRetrievalResponse(
|
|
66
|
+
scopedLog.logData.slice(1), // Skip the tag
|
|
67
|
+
scopedLog.txHash,
|
|
68
|
+
scopedLog.noteHashes,
|
|
69
|
+
scopedLog.firstNullifier,
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
async #getPrivateLogByTag(siloedTag: SiloedTag): Promise<LogRetrievalResponse | null> {
|
|
74
|
+
const logs = await this.aztecNode.getPrivateLogsByTags([siloedTag]);
|
|
75
|
+
const logsForTag = logs[0];
|
|
76
|
+
|
|
77
|
+
if (logsForTag.length == 0) {
|
|
78
|
+
return null;
|
|
79
|
+
} else if (logsForTag.length > 1) {
|
|
80
|
+
// TODO(#11627): handle this case
|
|
81
|
+
throw new Error(
|
|
82
|
+
`Got ${logsForTag.length} logs for tag ${siloedTag}. getPrivateLogByTag currently only supports a single log per tag`,
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const scopedLog = logsForTag[0];
|
|
87
|
+
|
|
88
|
+
return new LogRetrievalResponse(
|
|
89
|
+
scopedLog.logData.slice(1), // Skip the tag
|
|
90
|
+
scopedLog.txHash,
|
|
91
|
+
scopedLog.noteHashes,
|
|
92
|
+
scopedLog.firstNullifier,
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
public async syncTaggedLogs(
|
|
97
|
+
contractAddress: AztecAddress,
|
|
98
|
+
pendingTaggedLogArrayBaseSlot: Fr,
|
|
99
|
+
scopes?: AztecAddress[],
|
|
100
|
+
) {
|
|
101
|
+
this.log.verbose('Searching for tagged logs', { contract: contractAddress });
|
|
102
|
+
|
|
103
|
+
// We only load logs from block up to and including the anchor block number
|
|
104
|
+
const anchorBlockNumber = (await this.anchorBlockStore.getBlockHeader()).getBlockNumber();
|
|
105
|
+
|
|
106
|
+
// Determine recipients: use scopes if provided, otherwise get all accounts
|
|
107
|
+
const recipients = scopes && scopes.length > 0 ? scopes : await this.keyStore.getAccounts();
|
|
108
|
+
|
|
109
|
+
// For each recipient, fetch secrets, load logs, and store them.
|
|
110
|
+
// We run these per-recipient tasks in parallel so that logs are loaded for all recipients concurrently.
|
|
111
|
+
await Promise.all(
|
|
112
|
+
recipients.map(async recipient => {
|
|
113
|
+
// Get all secrets for this recipient (one per sender)
|
|
114
|
+
const secrets = await this.#getSecretsForSenders(contractAddress, recipient);
|
|
115
|
+
|
|
116
|
+
// Load logs for all sender-recipient pairs in parallel
|
|
117
|
+
const logArrays = await Promise.all(
|
|
118
|
+
secrets.map(secret =>
|
|
119
|
+
loadPrivateLogsForSenderRecipientPair(
|
|
120
|
+
secret,
|
|
121
|
+
contractAddress,
|
|
122
|
+
this.aztecNode,
|
|
123
|
+
this.recipientTaggingStore,
|
|
124
|
+
anchorBlockNumber,
|
|
125
|
+
),
|
|
126
|
+
),
|
|
127
|
+
);
|
|
128
|
+
|
|
129
|
+
// Flatten all logs from all secrets
|
|
130
|
+
const allLogs = logArrays.flat();
|
|
131
|
+
|
|
132
|
+
// Store the logs for this recipient
|
|
133
|
+
if (allLogs.length > 0) {
|
|
134
|
+
await this.#storePendingTaggedLogs(contractAddress, pendingTaggedLogArrayBaseSlot, recipient, allLogs);
|
|
135
|
+
}
|
|
136
|
+
}),
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
async #getSecretsForSenders(
|
|
141
|
+
contractAddress: AztecAddress,
|
|
142
|
+
recipient: AztecAddress,
|
|
143
|
+
): Promise<DirectionalAppTaggingSecret[]> {
|
|
144
|
+
const recipientCompleteAddress = await this.#getCompleteAddress(recipient);
|
|
145
|
+
const recipientIvsk = await this.keyStore.getMasterIncomingViewingSecretKey(recipient);
|
|
146
|
+
|
|
147
|
+
// We implicitly add all PXE accounts as senders, this helps us decrypt tags on notes that we send to ourselves
|
|
148
|
+
// (recipient = us, sender = us)
|
|
149
|
+
const allSenders = [...(await this.senderAddressBookStore.getSenders()), ...(await this.keyStore.getAccounts())];
|
|
150
|
+
|
|
151
|
+
// We deduplicate the senders by adding them to a set and then converting the set back to an array
|
|
152
|
+
const deduplicatedSenders = Array.from(new Set(allSenders.map(sender => sender.toString()))).map(sender =>
|
|
153
|
+
AztecAddress.fromString(sender),
|
|
154
|
+
);
|
|
155
|
+
|
|
156
|
+
return Promise.all(
|
|
157
|
+
deduplicatedSenders.map(sender => {
|
|
158
|
+
return DirectionalAppTaggingSecret.compute(
|
|
159
|
+
recipientCompleteAddress,
|
|
160
|
+
recipientIvsk,
|
|
161
|
+
sender,
|
|
162
|
+
contractAddress,
|
|
163
|
+
recipient,
|
|
164
|
+
);
|
|
165
|
+
}),
|
|
166
|
+
);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
#storePendingTaggedLogs(
|
|
170
|
+
contractAddress: AztecAddress,
|
|
171
|
+
capsuleArrayBaseSlot: Fr,
|
|
172
|
+
recipient: AztecAddress,
|
|
173
|
+
privateLogs: TxScopedL2Log[],
|
|
174
|
+
) {
|
|
175
|
+
// Build all pending tagged logs from the scoped logs
|
|
176
|
+
const pendingTaggedLogs = privateLogs.map(scopedLog => {
|
|
177
|
+
const pendingTaggedLog = new PendingTaggedLog(
|
|
178
|
+
scopedLog.logData,
|
|
179
|
+
scopedLog.txHash,
|
|
180
|
+
scopedLog.noteHashes,
|
|
181
|
+
scopedLog.firstNullifier,
|
|
182
|
+
recipient,
|
|
183
|
+
);
|
|
184
|
+
|
|
185
|
+
return pendingTaggedLog.toFields();
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
// TODO: This looks like it could belong more at the oracle interface level
|
|
189
|
+
return this.capsuleStore.appendToCapsuleArray(contractAddress, capsuleArrayBaseSlot, pendingTaggedLogs);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
async #getCompleteAddress(account: AztecAddress): Promise<CompleteAddress> {
|
|
193
|
+
const completeAddress = await this.addressStore.getCompleteAddress(account);
|
|
194
|
+
if (!completeAddress) {
|
|
195
|
+
throw new Error(
|
|
196
|
+
`No public key registered for address ${account}.
|
|
197
|
+
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`,
|
|
198
|
+
);
|
|
199
|
+
}
|
|
200
|
+
return completeAddress;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { NoteService } from './note_service.js';
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
|
+
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
3
|
+
import type { DataInBlock } from '@aztec/stdlib/block';
|
|
4
|
+
import { computeUniqueNoteHash, siloNoteHash, siloNullifier } from '@aztec/stdlib/hash';
|
|
5
|
+
import { type AztecNode, MAX_RPC_LEN } from '@aztec/stdlib/interfaces/client';
|
|
6
|
+
import { Note, NoteDao, NoteStatus } from '@aztec/stdlib/note';
|
|
7
|
+
import { MerkleTreeId } from '@aztec/stdlib/trees';
|
|
8
|
+
import type { TxHash } from '@aztec/stdlib/tx';
|
|
9
|
+
|
|
10
|
+
import type { AnchorBlockStore } from '../storage/anchor_block_store/anchor_block_store.js';
|
|
11
|
+
import type { NoteStore } from '../storage/note_store/note_store.js';
|
|
12
|
+
|
|
13
|
+
export class NoteService {
|
|
14
|
+
constructor(
|
|
15
|
+
private readonly noteStore: NoteStore,
|
|
16
|
+
private readonly aztecNode: AztecNode,
|
|
17
|
+
private readonly anchorBlockStore: AnchorBlockStore,
|
|
18
|
+
) {}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Retrieves a set of notes stored in the database for a given contract address and storage slot.
|
|
22
|
+
* The query result is paginated using 'limit' and 'offset' values.
|
|
23
|
+
* Returns an object containing an array of note data.
|
|
24
|
+
*
|
|
25
|
+
* @param owner - The owner of the notes. If undefined, returns notes for all known owners.
|
|
26
|
+
* @param status - The status of notes to fetch.
|
|
27
|
+
* @param scopes - The accounts whose notes we can access in this call. Currently optional and will default to all.
|
|
28
|
+
*/
|
|
29
|
+
public async getNotes(
|
|
30
|
+
contractAddress: AztecAddress,
|
|
31
|
+
owner: AztecAddress | undefined,
|
|
32
|
+
storageSlot: Fr,
|
|
33
|
+
status: NoteStatus,
|
|
34
|
+
scopes?: AztecAddress[],
|
|
35
|
+
) {
|
|
36
|
+
const noteDaos = await this.noteStore.getNotes({
|
|
37
|
+
contractAddress,
|
|
38
|
+
owner,
|
|
39
|
+
storageSlot,
|
|
40
|
+
status,
|
|
41
|
+
scopes,
|
|
42
|
+
});
|
|
43
|
+
return noteDaos.map(
|
|
44
|
+
({ contractAddress, owner, storageSlot, randomness, noteNonce, note, noteHash, siloedNullifier, index }) => ({
|
|
45
|
+
contractAddress,
|
|
46
|
+
owner,
|
|
47
|
+
storageSlot,
|
|
48
|
+
randomness,
|
|
49
|
+
noteNonce,
|
|
50
|
+
note,
|
|
51
|
+
noteHash,
|
|
52
|
+
siloedNullifier,
|
|
53
|
+
// PXE can use this index to get full MembershipWitness
|
|
54
|
+
index,
|
|
55
|
+
}),
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Looks for nullifiers of active contract notes and marks them as nullified if a nullifier is found.
|
|
61
|
+
*
|
|
62
|
+
* Fetches notes from the NoteStore and checks which nullifiers are present in the
|
|
63
|
+
* onchain nullifier Merkle tree - up to the latest locally synced block. We use the
|
|
64
|
+
* locally synced block instead of querying the chain's 'latest' block to ensure correctness:
|
|
65
|
+
* notes are only marked nullified once their corresponding nullifier has been included in a
|
|
66
|
+
* block up to which the PXE has synced.
|
|
67
|
+
* This allows recent nullifications to be processed even if the node is not an archive node.
|
|
68
|
+
*
|
|
69
|
+
* @param contractAddress - The contract whose notes should be checked and nullified.
|
|
70
|
+
*/
|
|
71
|
+
public async syncNoteNullifiers(contractAddress: AztecAddress): Promise<void> {
|
|
72
|
+
const syncedBlockNumber = (await this.anchorBlockStore.getBlockHeader()).getBlockNumber();
|
|
73
|
+
|
|
74
|
+
const contractNotes = await this.noteStore.getNotes({ contractAddress });
|
|
75
|
+
|
|
76
|
+
if (contractNotes.length === 0) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const nullifiersToCheck = contractNotes.map(note => note.siloedNullifier);
|
|
81
|
+
const nullifierBatches = nullifiersToCheck.reduce(
|
|
82
|
+
(acc, nullifier) => {
|
|
83
|
+
if (acc[acc.length - 1].length < MAX_RPC_LEN) {
|
|
84
|
+
acc[acc.length - 1].push(nullifier);
|
|
85
|
+
} else {
|
|
86
|
+
acc.push([nullifier]);
|
|
87
|
+
}
|
|
88
|
+
return acc;
|
|
89
|
+
},
|
|
90
|
+
[[]] as Fr[][],
|
|
91
|
+
);
|
|
92
|
+
const nullifierIndexes = (
|
|
93
|
+
await Promise.all(
|
|
94
|
+
nullifierBatches.map(batch =>
|
|
95
|
+
this.aztecNode.findLeavesIndexes(syncedBlockNumber, MerkleTreeId.NULLIFIER_TREE, batch),
|
|
96
|
+
),
|
|
97
|
+
)
|
|
98
|
+
).flat();
|
|
99
|
+
|
|
100
|
+
const foundNullifiers = nullifiersToCheck
|
|
101
|
+
.map((nullifier, i) => {
|
|
102
|
+
if (nullifierIndexes[i] !== undefined) {
|
|
103
|
+
return { ...nullifierIndexes[i], ...{ data: nullifier } } as DataInBlock<Fr>;
|
|
104
|
+
}
|
|
105
|
+
})
|
|
106
|
+
.filter(nullifier => nullifier !== undefined) as DataInBlock<Fr>[];
|
|
107
|
+
|
|
108
|
+
await this.noteStore.applyNullifiers(foundNullifiers);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
public async deliverNote(
|
|
112
|
+
contractAddress: AztecAddress,
|
|
113
|
+
owner: AztecAddress,
|
|
114
|
+
storageSlot: Fr,
|
|
115
|
+
randomness: Fr,
|
|
116
|
+
noteNonce: Fr,
|
|
117
|
+
content: Fr[],
|
|
118
|
+
noteHash: Fr,
|
|
119
|
+
nullifier: Fr,
|
|
120
|
+
txHash: TxHash,
|
|
121
|
+
recipient: AztecAddress,
|
|
122
|
+
): Promise<void> {
|
|
123
|
+
// We are going to store the new note in the NoteStore, which will let us later return it via `getNotes`.
|
|
124
|
+
// There's two things we need to check before we do this however:
|
|
125
|
+
// - we must make sure the note does actually exist in the note hash tree
|
|
126
|
+
// - we need to check if the note has already been nullified
|
|
127
|
+
//
|
|
128
|
+
// Failing to do either of the above would result in circuits getting either non-existent notes and failing to
|
|
129
|
+
// produce inclusion proofs for them, or getting nullified notes and producing duplicate nullifiers, both of which
|
|
130
|
+
// are catastrophic failure modes.
|
|
131
|
+
//
|
|
132
|
+
// Note that adding a note and removing it is *not* equivalent to never adding it in the first place. A nullifier
|
|
133
|
+
// emitted in a block that comes after note creation might result in the note being de-nullified by a chain reorg,
|
|
134
|
+
// so we must store both the note hash and nullifier block information.
|
|
135
|
+
|
|
136
|
+
// We avoid making node queries at 'latest' since we don't want to process notes or nullifiers that only exist ahead
|
|
137
|
+
// in time of the locally synced state.
|
|
138
|
+
// Note that while this technically results in historical queries, we perform it at the latest locally synced block
|
|
139
|
+
// number which *should* be recent enough to be available, even for non-archive nodes.
|
|
140
|
+
// Also note that the note should never be ahead of the synced block here since `fetchTaggedLogs` only processes
|
|
141
|
+
// logs up to the synced block making this only an additional safety check.
|
|
142
|
+
const syncedBlockNumber = (await this.anchorBlockStore.getBlockHeader()).getBlockNumber();
|
|
143
|
+
|
|
144
|
+
// By computing siloed and unique note hashes ourselves we prevent contracts from interfering with the note storage
|
|
145
|
+
// of other contracts, which would constitute a security breach.
|
|
146
|
+
const uniqueNoteHash = await computeUniqueNoteHash(noteNonce, await siloNoteHash(contractAddress, noteHash));
|
|
147
|
+
const siloedNullifier = await siloNullifier(contractAddress, nullifier);
|
|
148
|
+
|
|
149
|
+
const txEffect = await this.aztecNode.getTxEffect(txHash);
|
|
150
|
+
if (!txEffect) {
|
|
151
|
+
throw new Error(`Could not find tx effect for tx hash ${txHash}`);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
if (txEffect.l2BlockNumber > syncedBlockNumber) {
|
|
155
|
+
throw new Error(`Could not find tx effect for tx hash ${txHash} as of block number ${syncedBlockNumber}`);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
const noteInTx = txEffect.data.noteHashes.some(nh => nh.equals(uniqueNoteHash));
|
|
159
|
+
if (!noteInTx) {
|
|
160
|
+
throw new Error(`Note hash ${noteHash} (uniqued as ${uniqueNoteHash}) is not present in tx ${txHash}`);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
// We store notes by their index in the global note hash tree, which has the convenient side effect of validating
|
|
164
|
+
// note existence in said tree. We concurrently also check if the note's nullifier exists, performing all node
|
|
165
|
+
// queries in a single round-trip.
|
|
166
|
+
const [[uniqueNoteHashTreeIndexInBlock], [nullifierIndex]] = await Promise.all([
|
|
167
|
+
this.aztecNode.findLeavesIndexes(syncedBlockNumber, MerkleTreeId.NOTE_HASH_TREE, [uniqueNoteHash]),
|
|
168
|
+
this.aztecNode.findLeavesIndexes(syncedBlockNumber, MerkleTreeId.NULLIFIER_TREE, [siloedNullifier]),
|
|
169
|
+
]);
|
|
170
|
+
|
|
171
|
+
if (uniqueNoteHashTreeIndexInBlock === undefined) {
|
|
172
|
+
throw new Error(
|
|
173
|
+
`Note hash ${noteHash} (uniqued as ${uniqueNoteHash}) is not present on the tree at block ${syncedBlockNumber} (from tx ${txHash})`,
|
|
174
|
+
);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
const noteDao = new NoteDao(
|
|
178
|
+
new Note(content),
|
|
179
|
+
contractAddress,
|
|
180
|
+
owner,
|
|
181
|
+
storageSlot,
|
|
182
|
+
randomness,
|
|
183
|
+
noteNonce,
|
|
184
|
+
noteHash,
|
|
185
|
+
siloedNullifier,
|
|
186
|
+
txHash,
|
|
187
|
+
uniqueNoteHashTreeIndexInBlock.l2BlockNumber,
|
|
188
|
+
uniqueNoteHashTreeIndexInBlock.l2BlockHash.toString(),
|
|
189
|
+
uniqueNoteHashTreeIndexInBlock.data,
|
|
190
|
+
);
|
|
191
|
+
|
|
192
|
+
// The note was found by `recipient`, so we use that as the scope when storing the note.
|
|
193
|
+
await this.noteStore.addNotes([noteDao], recipient);
|
|
194
|
+
|
|
195
|
+
if (nullifierIndex !== undefined) {
|
|
196
|
+
const { data: _, ...blockHashAndNum } = nullifierIndex;
|
|
197
|
+
await this.noteStore.applyNullifiers([{ data: siloedNullifier, ...blockHashAndNum }]);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
package/src/oracle_version.ts
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
///
|
|
5
5
|
/// @dev Whenever a contract function or Noir test is run, the `utilityAssertCompatibleOracleVersion` oracle is called
|
|
6
6
|
/// and if the oracle version is incompatible an error is thrown.
|
|
7
|
-
export const ORACLE_VERSION =
|
|
7
|
+
export const ORACLE_VERSION = 5;
|
|
8
8
|
|
|
9
9
|
/// This hash is computed as by hashing the Oracle interface and it is used to detect when the Oracle interface changes,
|
|
10
10
|
/// which in turn implies that you need to update the ORACLE_VERSION constant.
|
|
11
|
-
export const ORACLE_INTERFACE_HASH = '
|
|
11
|
+
export const ORACLE_INTERFACE_HASH = 'd603c17a97034d978ca453d2bce3aacae139539dee28bbc46e8f8c7177a348ec';
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
} from '@aztec/constants';
|
|
10
10
|
import { makeTuple } from '@aztec/foundation/array';
|
|
11
11
|
import { padArrayEnd } from '@aztec/foundation/collection';
|
|
12
|
-
import type { Fr } from '@aztec/foundation/
|
|
12
|
+
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
13
13
|
import { type Tuple, assertLength } from '@aztec/foundation/serialize';
|
|
14
14
|
import { MembershipWitness } from '@aztec/foundation/trees';
|
|
15
15
|
import { privateKernelResetDimensionsConfig } from '@aztec/noir-protocol-circuits-types/client';
|
|
@@ -24,7 +24,6 @@ import {
|
|
|
24
24
|
PrivateKernelResetDimensions,
|
|
25
25
|
PrivateKernelResetHints,
|
|
26
26
|
type PrivateKernelSimulateOutput,
|
|
27
|
-
type ReadRequest,
|
|
28
27
|
ReadRequestActionEnum,
|
|
29
28
|
ReadRequestResetActions,
|
|
30
29
|
type ScopedKeyValidationRequestAndGenerator,
|
|
@@ -47,12 +46,10 @@ import type { PrivateKernelOracle } from '../private_kernel_oracle.js';
|
|
|
47
46
|
|
|
48
47
|
function collectNestedReadRequests<N extends number>(
|
|
49
48
|
executionStack: PrivateCallExecutionResult[],
|
|
50
|
-
extractReadRequests: (execution: PrivateCallExecutionResult) => ClaimedLengthArray<
|
|
49
|
+
extractReadRequests: (execution: PrivateCallExecutionResult) => ClaimedLengthArray<ScopedReadRequest, N>,
|
|
51
50
|
): ScopedReadRequest[] {
|
|
52
51
|
return collectNested(executionStack, executionResult => {
|
|
53
|
-
return extractReadRequests(executionResult)
|
|
54
|
-
.getActiveItems()
|
|
55
|
-
.map(readRequest => new ScopedReadRequest(readRequest, executionResult.publicInputs.callContext.contractAddress));
|
|
52
|
+
return extractReadRequests(executionResult).getActiveItems();
|
|
56
53
|
});
|
|
57
54
|
}
|
|
58
55
|
|
|
@@ -104,7 +101,7 @@ export class PrivateKernelResetPrivateInputsBuilder {
|
|
|
104
101
|
private previousKernelOutput: PrivateKernelSimulateOutput<PrivateKernelCircuitPublicInputs>,
|
|
105
102
|
private executionStack: PrivateCallExecutionResult[],
|
|
106
103
|
private noteHashNullifierCounterMap: Map<number, number>,
|
|
107
|
-
private
|
|
104
|
+
private splitCounter: number,
|
|
108
105
|
) {
|
|
109
106
|
this.previousKernel = previousKernelOutput.publicInputs;
|
|
110
107
|
this.requestedDimensions = PrivateKernelResetDimensions.empty();
|
|
@@ -206,7 +203,6 @@ export class PrivateKernelResetPrivateInputsBuilder {
|
|
|
206
203
|
oracle,
|
|
207
204
|
),
|
|
208
205
|
this.transientDataSquashingHints,
|
|
209
|
-
this.validationRequestsSplitCounter,
|
|
210
206
|
),
|
|
211
207
|
dimensions,
|
|
212
208
|
);
|
|
@@ -403,7 +399,7 @@ export class PrivateKernelResetPrivateInputsBuilder {
|
|
|
403
399
|
futureNoteHashReads,
|
|
404
400
|
futureNullifierReads,
|
|
405
401
|
this.noteHashNullifierCounterMap,
|
|
406
|
-
this.
|
|
402
|
+
this.splitCounter,
|
|
407
403
|
);
|
|
408
404
|
|
|
409
405
|
if (this.nextIteration && !numTransientData) {
|
|
@@ -31,8 +31,8 @@ export function computeTxIncludeByTimestamp(
|
|
|
31
31
|
);
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
const
|
|
35
|
-
const maxTimestamp =
|
|
34
|
+
const anchorBlockTimestamp = previousKernel.constants.anchorBlockHeader.globalVariables.timestamp;
|
|
35
|
+
const maxTimestamp = anchorBlockTimestamp + BigInt(maxDuration);
|
|
36
36
|
const includeByTimestamp = previousKernel.includeByTimestamp;
|
|
37
37
|
|
|
38
38
|
// If the includeByTimestamp set during the tx execution is greater than or equal to the max allowed duration,
|
|
@@ -44,13 +44,13 @@ export function computeTxIncludeByTimestamp(
|
|
|
44
44
|
|
|
45
45
|
// Round it down to the nearest hour/min/second to reduce precision and avoid revealing the exact value.
|
|
46
46
|
// This makes it harder for others to infer what function calls may have been used to produce a specific timestamp.
|
|
47
|
-
const roundedTimestamp = roundTimestamp(
|
|
47
|
+
const roundedTimestamp = roundTimestamp(anchorBlockTimestamp, includeByTimestamp);
|
|
48
48
|
|
|
49
|
-
// The tx can't be published if the timestamp is the same or less than the
|
|
49
|
+
// The tx can't be published if the timestamp is the same or less than the anchor block's timestamp.
|
|
50
50
|
// Future blocks will have a greater timestamp, so the tx would never be included.
|
|
51
|
-
if (roundedTimestamp <=
|
|
51
|
+
if (roundedTimestamp <= anchorBlockTimestamp) {
|
|
52
52
|
throw new Error(
|
|
53
|
-
`Include-by timestamp must be greater than the
|
|
53
|
+
`Include-by timestamp must be greater than the anchor block timestamp. Anchor block timestamp: ${anchorBlockTimestamp}. Include-by timestamp: ${includeByTimestamp}.`,
|
|
54
54
|
);
|
|
55
55
|
}
|
|
56
56
|
|