@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,32 +0,0 @@
|
|
|
1
|
-
import type { Fr } from '@aztec/foundation/fields';
|
|
2
|
-
import { IndexedTaggingSecret } from '@aztec/stdlib/logs';
|
|
3
|
-
|
|
4
|
-
// Half the size of the window we slide over the tagging secret indexes.
|
|
5
|
-
export const WINDOW_HALF_SIZE = 10;
|
|
6
|
-
|
|
7
|
-
export function getIndexedTaggingSecretsForTheWindow(
|
|
8
|
-
secretsAndWindows: { appTaggingSecret: Fr; leftMostIndex: number; rightMostIndex: number }[],
|
|
9
|
-
): IndexedTaggingSecret[] {
|
|
10
|
-
const secrets: IndexedTaggingSecret[] = [];
|
|
11
|
-
for (const secretAndWindow of secretsAndWindows) {
|
|
12
|
-
for (let i = secretAndWindow.leftMostIndex; i <= secretAndWindow.rightMostIndex; i++) {
|
|
13
|
-
secrets.push(new IndexedTaggingSecret(secretAndWindow.appTaggingSecret, i));
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
return secrets;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Creates a map from app tagging secret to initial index.
|
|
21
|
-
* @param indexedTaggingSecrets - The indexed tagging secrets to get the initial indexes from.
|
|
22
|
-
* @returns The map from app tagging secret to initial index.
|
|
23
|
-
*/
|
|
24
|
-
export function getInitialIndexesMap(indexedTaggingSecrets: IndexedTaggingSecret[]): { [k: string]: number } {
|
|
25
|
-
const initialIndexes: { [k: string]: number } = {};
|
|
26
|
-
|
|
27
|
-
for (const indexedTaggingSecret of indexedTaggingSecrets) {
|
|
28
|
-
initialIndexes[indexedTaggingSecret.appTaggingSecret.toString()] = indexedTaggingSecret.index;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
return initialIndexes;
|
|
32
|
-
}
|
package/src/pxe_service/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { AddressDataProvider } from './address_data_provider.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { CapsuleDataProvider } from './capsule_data_provider.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { ContractDataProvider } from './contract_data_provider.js';
|
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
import { toBigIntBE } from '@aztec/foundation/bigint-buffer';
|
|
2
|
-
import { Fr, Point } from '@aztec/foundation/fields';
|
|
3
|
-
import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
4
|
-
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
5
|
-
import { Note } from '@aztec/stdlib/note';
|
|
6
|
-
import { TxHash } from '@aztec/stdlib/tx';
|
|
7
|
-
|
|
8
|
-
import type { NoteData } from '../../contract_function_simulator/oracle/typed_oracle.js';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* A Note Data Access Object, representing a note that was committed to the note hash tree, holding all of the
|
|
12
|
-
* information required to use it during execution and manage its state.
|
|
13
|
-
*/
|
|
14
|
-
export class NoteDao implements NoteData {
|
|
15
|
-
constructor(
|
|
16
|
-
// Note information
|
|
17
|
-
|
|
18
|
-
/** The packed content of the note, as will be returned in the getNotes oracle. */
|
|
19
|
-
public note: Note,
|
|
20
|
-
/** The address of the contract that created the note (i.e. the address used by the kernel during siloing). */
|
|
21
|
-
public contractAddress: AztecAddress,
|
|
22
|
-
/**
|
|
23
|
-
* The storage location of the note. This value is not used for anything in PXE, but we do index by storage slot
|
|
24
|
-
* since contracts typically make queries based on it.
|
|
25
|
-
*/
|
|
26
|
-
public storageSlot: Fr,
|
|
27
|
-
/** The nonce that was injected into the note hash preimage in order to guarantee uniqueness. */
|
|
28
|
-
public noteNonce: Fr,
|
|
29
|
-
|
|
30
|
-
// Computed values
|
|
31
|
-
/**
|
|
32
|
-
* The inner hash (non-unique, non-siloed) of the note. Each contract determines how the note is hashed. Can
|
|
33
|
-
* be used alongside contractAddress and nonce to compute the uniqueNoteHash and the siloedNoteHash.
|
|
34
|
-
*/
|
|
35
|
-
public noteHash: Fr,
|
|
36
|
-
/**
|
|
37
|
-
* The nullifier of the note, siloed by contract address.
|
|
38
|
-
* Note: Might be set as 0 if the note was added to PXE as nullified.
|
|
39
|
-
*/
|
|
40
|
-
public siloedNullifier: Fr,
|
|
41
|
-
|
|
42
|
-
// Metadata
|
|
43
|
-
/** The hash of the tx in which this note was created. Knowing the tx hash allows for efficient node queries e.g.
|
|
44
|
-
* when searching for txEffects.
|
|
45
|
-
*/
|
|
46
|
-
public txHash: TxHash,
|
|
47
|
-
/** The L2 block number in which the tx with this note was included. Used for note management while processing
|
|
48
|
-
* reorgs.*/
|
|
49
|
-
public l2BlockNumber: number,
|
|
50
|
-
/** The L2 block hash in which the tx with this note was included. Used for note management while processing
|
|
51
|
-
* reorgs.*/
|
|
52
|
-
public l2BlockHash: string,
|
|
53
|
-
/** The index of the leaf in the global note hash tree the note is stored at */
|
|
54
|
-
public index: bigint,
|
|
55
|
-
/**
|
|
56
|
-
* The address whose public key was used to encrypt the note log during delivery.
|
|
57
|
-
* (This is the x-coordinate of the public key.)
|
|
58
|
-
*/
|
|
59
|
-
public recipient: AztecAddress,
|
|
60
|
-
) {}
|
|
61
|
-
|
|
62
|
-
toBuffer(): Buffer {
|
|
63
|
-
return serializeToBuffer([
|
|
64
|
-
this.note,
|
|
65
|
-
this.contractAddress,
|
|
66
|
-
this.storageSlot,
|
|
67
|
-
this.noteNonce,
|
|
68
|
-
this.noteHash,
|
|
69
|
-
this.siloedNullifier,
|
|
70
|
-
this.txHash,
|
|
71
|
-
this.l2BlockNumber,
|
|
72
|
-
Fr.fromHexString(this.l2BlockHash),
|
|
73
|
-
this.index,
|
|
74
|
-
this.recipient,
|
|
75
|
-
]);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
static fromBuffer(buffer: Buffer | BufferReader) {
|
|
79
|
-
const reader = BufferReader.asReader(buffer);
|
|
80
|
-
|
|
81
|
-
const note = Note.fromBuffer(reader);
|
|
82
|
-
const contractAddress = AztecAddress.fromBuffer(reader);
|
|
83
|
-
const storageSlot = Fr.fromBuffer(reader);
|
|
84
|
-
const noteNonce = Fr.fromBuffer(reader);
|
|
85
|
-
const noteHash = Fr.fromBuffer(reader);
|
|
86
|
-
const siloedNullifier = Fr.fromBuffer(reader);
|
|
87
|
-
const txHash = reader.readObject(TxHash);
|
|
88
|
-
const l2BlockNumber = reader.readNumber();
|
|
89
|
-
const l2BlockHash = Fr.fromBuffer(reader).toString();
|
|
90
|
-
const index = toBigIntBE(reader.readBytes(32));
|
|
91
|
-
const recipient = AztecAddress.fromBuffer(reader);
|
|
92
|
-
|
|
93
|
-
return new NoteDao(
|
|
94
|
-
note,
|
|
95
|
-
contractAddress,
|
|
96
|
-
storageSlot,
|
|
97
|
-
noteNonce,
|
|
98
|
-
noteHash,
|
|
99
|
-
siloedNullifier,
|
|
100
|
-
txHash,
|
|
101
|
-
l2BlockNumber,
|
|
102
|
-
l2BlockHash,
|
|
103
|
-
index,
|
|
104
|
-
recipient,
|
|
105
|
-
);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
toString() {
|
|
109
|
-
return '0x' + this.toBuffer().toString('hex');
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
static fromString(str: string) {
|
|
113
|
-
const hex = str.replace(/^0x/, '');
|
|
114
|
-
return NoteDao.fromBuffer(Buffer.from(hex, 'hex'));
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* Returns the size in bytes of the Note Dao.
|
|
119
|
-
* @returns - Its size in bytes.
|
|
120
|
-
*/
|
|
121
|
-
public getSize() {
|
|
122
|
-
const indexSize = Math.ceil(Math.log2(Number(this.index)));
|
|
123
|
-
const noteSize = 4 + this.note.items.length * Fr.SIZE_IN_BYTES;
|
|
124
|
-
return noteSize + AztecAddress.SIZE_IN_BYTES + Fr.SIZE_IN_BYTES * 4 + TxHash.SIZE + Point.SIZE_IN_BYTES + indexSize;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
static async random({
|
|
128
|
-
note = Note.random(),
|
|
129
|
-
contractAddress = undefined,
|
|
130
|
-
storageSlot = Fr.random(),
|
|
131
|
-
noteNonce = Fr.random(),
|
|
132
|
-
noteHash = Fr.random(),
|
|
133
|
-
siloedNullifier = Fr.random(),
|
|
134
|
-
txHash = TxHash.random(),
|
|
135
|
-
l2BlockNumber = Math.floor(Math.random() * 1000),
|
|
136
|
-
l2BlockHash = Fr.random().toString(),
|
|
137
|
-
index = Fr.random().toBigInt(),
|
|
138
|
-
recipient = undefined,
|
|
139
|
-
}: Partial<NoteDao> = {}) {
|
|
140
|
-
return new NoteDao(
|
|
141
|
-
note,
|
|
142
|
-
contractAddress ?? (await AztecAddress.random()),
|
|
143
|
-
storageSlot,
|
|
144
|
-
noteNonce,
|
|
145
|
-
noteHash,
|
|
146
|
-
siloedNullifier,
|
|
147
|
-
txHash,
|
|
148
|
-
l2BlockNumber,
|
|
149
|
-
l2BlockHash,
|
|
150
|
-
index,
|
|
151
|
-
recipient ?? (await AztecAddress.random()),
|
|
152
|
-
);
|
|
153
|
-
}
|
|
154
|
-
}
|
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
import { Fr } from '@aztec/foundation/fields';
|
|
2
|
-
import { createLogger } from '@aztec/foundation/log';
|
|
3
|
-
import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
4
|
-
import type { AztecAsyncArray, AztecAsyncKVStore, AztecAsyncMap } from '@aztec/kv-store';
|
|
5
|
-
import type { EventSelector } from '@aztec/stdlib/abi';
|
|
6
|
-
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
7
|
-
import type { TxHash } from '@aztec/stdlib/tx';
|
|
8
|
-
|
|
9
|
-
import type { DataProvider } from '../data_provider.js';
|
|
10
|
-
|
|
11
|
-
interface PrivateEventEntry {
|
|
12
|
-
msgContent: Buffer;
|
|
13
|
-
blockNumber: number;
|
|
14
|
-
eventCommitmentIndex: number;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Stores decrypted private event logs.
|
|
19
|
-
*/
|
|
20
|
-
export class PrivateEventDataProvider implements DataProvider {
|
|
21
|
-
#store: AztecAsyncKVStore;
|
|
22
|
-
/** Array storing the actual private event log entries containing the log content and block number */
|
|
23
|
-
#eventLogs: AztecAsyncArray<PrivateEventEntry>;
|
|
24
|
-
/** Map from contract_address_recipient_eventSelector to array of indices into #eventLogs for efficient lookup */
|
|
25
|
-
#eventLogIndex: AztecAsyncMap<string, number[]>;
|
|
26
|
-
/** Map from eventCommitmentIndex to boolean indicating if log has been seen. */
|
|
27
|
-
#seenLogs: AztecAsyncMap<number, boolean>;
|
|
28
|
-
|
|
29
|
-
logger = createLogger('private_event_data_provider');
|
|
30
|
-
|
|
31
|
-
constructor(store: AztecAsyncKVStore) {
|
|
32
|
-
this.#store = store;
|
|
33
|
-
this.#eventLogs = this.#store.openArray('private_event_logs');
|
|
34
|
-
this.#eventLogIndex = this.#store.openMap('private_event_log_index');
|
|
35
|
-
this.#seenLogs = this.#store.openMap('seen_logs');
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Store a private event log.
|
|
40
|
-
* @param contractAddress - The address of the contract that emitted the event.
|
|
41
|
-
* @param recipient - The recipient of the event.
|
|
42
|
-
* @param eventSelector - The event selector of the event.
|
|
43
|
-
* @param msgContent - The content of the event.
|
|
44
|
-
* @param txHash - The transaction hash of the event log.
|
|
45
|
-
* @param eventCommitmentIndex - The index of the event commitment in the nullifier tree.
|
|
46
|
-
* @param blockNumber - The block number in which the event was emitted.
|
|
47
|
-
*/
|
|
48
|
-
storePrivateEventLog(
|
|
49
|
-
contractAddress: AztecAddress,
|
|
50
|
-
recipient: AztecAddress,
|
|
51
|
-
eventSelector: EventSelector,
|
|
52
|
-
msgContent: Fr[],
|
|
53
|
-
txHash: TxHash,
|
|
54
|
-
eventCommitmentIndex: number,
|
|
55
|
-
blockNumber: number,
|
|
56
|
-
): Promise<void> {
|
|
57
|
-
return this.#store.transactionAsync(async () => {
|
|
58
|
-
const key = `${contractAddress.toString()}_${recipient.toString()}_${eventSelector.toString()}`;
|
|
59
|
-
|
|
60
|
-
// Check if this exact log has already been stored using eventCommitmentIndex as unique identifier
|
|
61
|
-
const hasBeenSeen = await this.#seenLogs.getAsync(eventCommitmentIndex);
|
|
62
|
-
if (hasBeenSeen) {
|
|
63
|
-
this.logger.verbose('Ignoring duplicate event log', { txHash: txHash.toString(), eventCommitmentIndex });
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
this.logger.verbose('storing private event log', { contractAddress, recipient, msgContent, blockNumber });
|
|
68
|
-
|
|
69
|
-
const index = await this.#eventLogs.lengthAsync();
|
|
70
|
-
await this.#eventLogs.push({
|
|
71
|
-
msgContent: serializeToBuffer(msgContent),
|
|
72
|
-
blockNumber,
|
|
73
|
-
eventCommitmentIndex,
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
const existingIndices = (await this.#eventLogIndex.getAsync(key)) || [];
|
|
77
|
-
await this.#eventLogIndex.set(key, [...existingIndices, index]);
|
|
78
|
-
|
|
79
|
-
// Mark this log as seen using eventCommitmentIndex
|
|
80
|
-
await this.#seenLogs.set(eventCommitmentIndex, true);
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* Returns the private events given search parameters.
|
|
86
|
-
* @param contractAddress - The address of the contract to get events from.
|
|
87
|
-
* @param from - The block number to search from.
|
|
88
|
-
* @param numBlocks - The amount of blocks to search.
|
|
89
|
-
* @param recipients - The addresses that decrypted the logs.
|
|
90
|
-
* @param eventSelector - The event selector to filter by.
|
|
91
|
-
* @returns - The event log contents.
|
|
92
|
-
*/
|
|
93
|
-
public async getPrivateEvents(
|
|
94
|
-
contractAddress: AztecAddress,
|
|
95
|
-
from: number,
|
|
96
|
-
numBlocks: number,
|
|
97
|
-
recipients: AztecAddress[],
|
|
98
|
-
eventSelector: EventSelector,
|
|
99
|
-
): Promise<Fr[][]> {
|
|
100
|
-
const events: Array<{ msgContent: Fr[]; blockNumber: number; eventCommitmentIndex: number }> = [];
|
|
101
|
-
|
|
102
|
-
for (const recipient of recipients) {
|
|
103
|
-
const key = `${contractAddress.toString()}_${recipient.toString()}_${eventSelector.toString()}`;
|
|
104
|
-
const indices = (await this.#eventLogIndex.getAsync(key)) || [];
|
|
105
|
-
|
|
106
|
-
for (const index of indices) {
|
|
107
|
-
const entry = await this.#eventLogs.atAsync(index);
|
|
108
|
-
if (!entry || entry.blockNumber < from || entry.blockNumber >= from + numBlocks) {
|
|
109
|
-
continue;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
// Convert buffer back to Fr array
|
|
113
|
-
const reader = BufferReader.asReader(entry.msgContent);
|
|
114
|
-
const numFields = entry.msgContent.length / Fr.SIZE_IN_BYTES;
|
|
115
|
-
const msgContent = reader.readArray(numFields, Fr);
|
|
116
|
-
|
|
117
|
-
events.push({
|
|
118
|
-
msgContent,
|
|
119
|
-
blockNumber: entry.blockNumber,
|
|
120
|
-
eventCommitmentIndex: entry.eventCommitmentIndex,
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
// Sort by eventCommitmentIndex only
|
|
126
|
-
events.sort((a, b) => a.eventCommitmentIndex - b.eventCommitmentIndex);
|
|
127
|
-
|
|
128
|
-
return events.map(e => e.msgContent);
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
getSize(): Promise<number> {
|
|
132
|
-
return this.#eventLogs.lengthAsync();
|
|
133
|
-
}
|
|
134
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { SyncDataProvider } from './sync_data_provider.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { TaggingDataProvider } from './tagging_data_provider.js';
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
import type { Fr } from '@aztec/foundation/fields';
|
|
2
|
-
import { toArray } from '@aztec/foundation/iterable';
|
|
3
|
-
import type { AztecAsyncKVStore, AztecAsyncMap } from '@aztec/kv-store';
|
|
4
|
-
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
5
|
-
import type { IndexedTaggingSecret } from '@aztec/stdlib/logs';
|
|
6
|
-
|
|
7
|
-
export class TaggingDataProvider {
|
|
8
|
-
#store: AztecAsyncKVStore;
|
|
9
|
-
#addressBook: AztecAsyncMap<string, true>;
|
|
10
|
-
|
|
11
|
-
// Stores the last index used for each tagging secret, taking direction into account
|
|
12
|
-
// This is necessary to avoid reusing the same index for the same secret, which happens if
|
|
13
|
-
// sender and recipient are the same
|
|
14
|
-
#taggingSecretIndexesForSenders: AztecAsyncMap<string, number>;
|
|
15
|
-
#taggingSecretIndexesForRecipients: AztecAsyncMap<string, number>;
|
|
16
|
-
|
|
17
|
-
constructor(store: AztecAsyncKVStore) {
|
|
18
|
-
this.#store = store;
|
|
19
|
-
|
|
20
|
-
this.#addressBook = this.#store.openMap('address_book');
|
|
21
|
-
|
|
22
|
-
this.#taggingSecretIndexesForSenders = this.#store.openMap('tagging_secret_indexes_for_senders');
|
|
23
|
-
this.#taggingSecretIndexesForRecipients = this.#store.openMap('tagging_secret_indexes_for_recipients');
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
setTaggingSecretsIndexesAsSender(indexedSecrets: IndexedTaggingSecret[], sender: AztecAddress) {
|
|
27
|
-
return this.#setTaggingSecretsIndexes(indexedSecrets, this.#taggingSecretIndexesForSenders, sender);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
setTaggingSecretsIndexesAsRecipient(indexedSecrets: IndexedTaggingSecret[], recipient: AztecAddress) {
|
|
31
|
-
return this.#setTaggingSecretsIndexes(indexedSecrets, this.#taggingSecretIndexesForRecipients, recipient);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Sets the indexes of the tagging secrets for the given app tagging secrets in the direction of the given address.
|
|
36
|
-
* @dev We need to specify the direction because app tagging secrets are direction-less due to the way they are generated
|
|
37
|
-
* but we need to guarantee that the index is stored under a uni-directional key because the tags are themselves
|
|
38
|
-
* uni-directional.
|
|
39
|
-
* @param indexedSecrets - The app tagging secrets and indexes to set.
|
|
40
|
-
* @param storageMap - The storage map to set the indexes in.
|
|
41
|
-
* @param inDirectionOf - The address that the secrets are in the direction of.
|
|
42
|
-
*/
|
|
43
|
-
#setTaggingSecretsIndexes(
|
|
44
|
-
indexedSecrets: IndexedTaggingSecret[],
|
|
45
|
-
storageMap: AztecAsyncMap<string, number>,
|
|
46
|
-
inDirectionOf: AztecAddress,
|
|
47
|
-
) {
|
|
48
|
-
return Promise.all(
|
|
49
|
-
indexedSecrets.map(indexedSecret =>
|
|
50
|
-
storageMap.set(`${indexedSecret.appTaggingSecret.toString()}_${inDirectionOf.toString()}`, indexedSecret.index),
|
|
51
|
-
),
|
|
52
|
-
);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
getTaggingSecretsIndexesAsRecipient(appTaggingSecrets: Fr[], recipient: AztecAddress) {
|
|
56
|
-
return this.#getTaggingSecretsIndexes(appTaggingSecrets, this.#taggingSecretIndexesForRecipients, recipient);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
getTaggingSecretsIndexesAsSender(appTaggingSecrets: Fr[], sender: AztecAddress) {
|
|
60
|
-
return this.#getTaggingSecretsIndexes(appTaggingSecrets, this.#taggingSecretIndexesForSenders, sender);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Returns the indexes of the tagging secrets for the given app tagging secrets in the direction of the given address.
|
|
65
|
-
* @dev We need to specify the direction because app tagging secrets are direction-less due to the way they are generated
|
|
66
|
-
* but we need to guarantee that the index is stored under a uni-directional key because the tags are themselves
|
|
67
|
-
* uni-directional.
|
|
68
|
-
* @param appTaggingSecrets - The app tagging secrets to get the indexes for.
|
|
69
|
-
* @param storageMap - The storage map to get the indexes from.
|
|
70
|
-
* @param inDirectionOf - The address that the secrets are in the direction of.
|
|
71
|
-
* @returns The indexes of the tagging secrets.
|
|
72
|
-
*/
|
|
73
|
-
#getTaggingSecretsIndexes(
|
|
74
|
-
appTaggingSecrets: Fr[],
|
|
75
|
-
storageMap: AztecAsyncMap<string, number>,
|
|
76
|
-
inDirectionOf: AztecAddress,
|
|
77
|
-
): Promise<number[]> {
|
|
78
|
-
return Promise.all(
|
|
79
|
-
appTaggingSecrets.map(
|
|
80
|
-
async secret => (await storageMap.getAsync(`${secret.toString()}_${inDirectionOf.toString()}`)) ?? 0,
|
|
81
|
-
),
|
|
82
|
-
);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
resetNoteSyncData(): Promise<void> {
|
|
86
|
-
return this.#store.transactionAsync(async () => {
|
|
87
|
-
const recipients = await toArray(this.#taggingSecretIndexesForRecipients.keysAsync());
|
|
88
|
-
await Promise.all(recipients.map(recipient => this.#taggingSecretIndexesForRecipients.delete(recipient)));
|
|
89
|
-
const senders = await toArray(this.#taggingSecretIndexesForSenders.keysAsync());
|
|
90
|
-
await Promise.all(senders.map(sender => this.#taggingSecretIndexesForSenders.delete(sender)));
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
async addSenderAddress(address: AztecAddress): Promise<boolean> {
|
|
95
|
-
if (await this.#addressBook.hasAsync(address.toString())) {
|
|
96
|
-
return false;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
await this.#addressBook.set(address.toString(), true);
|
|
100
|
-
|
|
101
|
-
return true;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
async getSenderAddresses(): Promise<AztecAddress[]> {
|
|
105
|
-
return (await toArray(this.#addressBook.keysAsync())).map(AztecAddress.fromString);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
async removeSenderAddress(address: AztecAddress): Promise<boolean> {
|
|
109
|
-
if (!(await this.#addressBook.hasAsync(address.toString()))) {
|
|
110
|
-
return false;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
await this.#addressBook.delete(address.toString());
|
|
114
|
-
|
|
115
|
-
return true;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
async getSize() {
|
|
119
|
-
const addressesCount = (await toArray(this.#addressBook.keysAsync())).length;
|
|
120
|
-
// All keys are addresses
|
|
121
|
-
return 3 * addressesCount * AztecAddress.SIZE_IN_BYTES;
|
|
122
|
-
}
|
|
123
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './synchronizer.js';
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import { INITIAL_L2_BLOCK_NUM } from '@aztec/constants';
|
|
2
|
-
import { Fr } from '@aztec/foundation/fields';
|
|
3
|
-
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
|
-
import { getContractClassFromArtifact } from '@aztec/stdlib/contract';
|
|
5
|
-
import type { PXE } from '@aztec/stdlib/interfaces/client';
|
|
6
|
-
import {
|
|
7
|
-
randomContractArtifact,
|
|
8
|
-
randomContractInstanceWithAddress,
|
|
9
|
-
randomDeployedContract,
|
|
10
|
-
} from '@aztec/stdlib/testing';
|
|
11
|
-
|
|
12
|
-
import omit from 'lodash.omit';
|
|
13
|
-
|
|
14
|
-
export const pxeTestSuite = (testName: string, pxeSetup: () => Promise<PXE>) => {
|
|
15
|
-
describe(testName, () => {
|
|
16
|
-
let pxe: PXE;
|
|
17
|
-
|
|
18
|
-
beforeAll(async () => {
|
|
19
|
-
pxe = await pxeSetup();
|
|
20
|
-
}, 120_000);
|
|
21
|
-
|
|
22
|
-
it('registers an account and returns it as an account only and not as a recipient', async () => {
|
|
23
|
-
const randomSecretKey = Fr.random();
|
|
24
|
-
const randomPartialAddress = Fr.random();
|
|
25
|
-
const completeAddress = await pxe.registerAccount(randomSecretKey, randomPartialAddress);
|
|
26
|
-
|
|
27
|
-
// Check that the account is correctly registered using the getAccounts and getRecipients methods
|
|
28
|
-
const accounts = await pxe.getRegisteredAccounts();
|
|
29
|
-
expect(accounts).toContainEqual(completeAddress);
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
it('does not throw when registering the same account twice (just ignores the second attempt)', async () => {
|
|
33
|
-
const randomSecretKey = Fr.random();
|
|
34
|
-
const randomPartialAddress = Fr.random();
|
|
35
|
-
|
|
36
|
-
await pxe.registerAccount(randomSecretKey, randomPartialAddress);
|
|
37
|
-
await pxe.registerAccount(randomSecretKey, randomPartialAddress);
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
it('successfully adds a contract', async () => {
|
|
41
|
-
const contracts = await Promise.all([randomDeployedContract(), randomDeployedContract()]);
|
|
42
|
-
for (const contract of contracts) {
|
|
43
|
-
await pxe.registerContract(contract);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
const expectedContractAddresses = contracts.map(contract => contract.instance.address);
|
|
47
|
-
const contractAddresses = await pxe.getContracts();
|
|
48
|
-
expect(contractAddresses).toEqual(expect.arrayContaining(expectedContractAddresses));
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
it('registers a class and adds a contract for it', async () => {
|
|
52
|
-
const artifact = randomContractArtifact();
|
|
53
|
-
const contractClass = await getContractClassFromArtifact(artifact);
|
|
54
|
-
const contractClassId = contractClass.id;
|
|
55
|
-
const instance = await randomContractInstanceWithAddress({ contractClassId });
|
|
56
|
-
|
|
57
|
-
await pxe.registerContractClass(artifact);
|
|
58
|
-
expect((await pxe.getContractClassMetadata(contractClassId)).contractClass).toMatchObject(
|
|
59
|
-
omit(contractClass, 'privateFunctionsRoot', 'publicBytecodeCommitment'),
|
|
60
|
-
);
|
|
61
|
-
|
|
62
|
-
await pxe.registerContract({ instance });
|
|
63
|
-
expect((await pxe.getContractMetadata(instance.address)).contractInstance).toEqual(instance);
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
it('refuses to register a class with a mismatched address', async () => {
|
|
67
|
-
const artifact = randomContractArtifact();
|
|
68
|
-
const contractClass = await getContractClassFromArtifact(artifact);
|
|
69
|
-
const contractClassId = contractClass.id;
|
|
70
|
-
const instance = await randomContractInstanceWithAddress({ contractClassId });
|
|
71
|
-
await expect(
|
|
72
|
-
pxe.registerContract({
|
|
73
|
-
instance: {
|
|
74
|
-
...instance,
|
|
75
|
-
address: await AztecAddress.random(),
|
|
76
|
-
},
|
|
77
|
-
artifact,
|
|
78
|
-
}),
|
|
79
|
-
).rejects.toThrow(/Added a contract in which the address does not match the contract instance./);
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
it('refuses to register a contract with a class that has not been registered', async () => {
|
|
83
|
-
const instance = await randomContractInstanceWithAddress();
|
|
84
|
-
await expect(pxe.registerContract({ instance })).rejects.toThrow(
|
|
85
|
-
/Artifact not found when registering an instance/,
|
|
86
|
-
);
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
it('refuses to register a contract with an artifact with mismatching class id', async () => {
|
|
90
|
-
const artifact = randomContractArtifact();
|
|
91
|
-
const instance = await randomContractInstanceWithAddress();
|
|
92
|
-
await expect(pxe.registerContract({ instance, artifact })).rejects.toThrow(/Artifact does not match/i);
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
// Note: Not testing a successful run of `proveTx`, `sendTx`, `getTxReceipt` and `simulateUtility` here as it
|
|
96
|
-
// requires a larger setup and it's sufficiently tested in the e2e tests.
|
|
97
|
-
|
|
98
|
-
// Note: Not testing `getContractData`, `getPublicLogs` and `getPublicStorageAt` here as these
|
|
99
|
-
// functions only call AztecNode and these methods are frequently used by the e2e tests.
|
|
100
|
-
|
|
101
|
-
it('successfully gets a block number', async () => {
|
|
102
|
-
const blockNum = await pxe.getBlockNumber();
|
|
103
|
-
expect(blockNum).toBeGreaterThanOrEqual(INITIAL_L2_BLOCK_NUM);
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
it('successfully gets node info', async () => {
|
|
107
|
-
const nodeInfo = await pxe.getNodeInfo();
|
|
108
|
-
expect(typeof nodeInfo.rollupVersion).toEqual('number');
|
|
109
|
-
expect(typeof nodeInfo.l1ChainId).toEqual('number');
|
|
110
|
-
expect(nodeInfo.l1ContractAddresses.rollupAddress.toString()).toMatch(/0x[a-fA-F0-9]+/);
|
|
111
|
-
});
|
|
112
|
-
});
|
|
113
|
-
};
|