@aztec/pxe 0.0.1-fake-ceab37513c → 0.0.6-commit.a2d1860fe9
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/access_scopes.d.ts +9 -0
- package/dest/access_scopes.d.ts.map +1 -0
- package/dest/access_scopes.js +6 -0
- 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 +45 -0
- package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -0
- package/dest/block_synchronizer/block_synchronizer.js +153 -0
- package/dest/block_synchronizer/index.d.ts +2 -0
- package/dest/block_synchronizer/index.d.ts.map +1 -0
- package/dest/block_synchronizer/index.js +1 -0
- package/dest/config/index.d.ts +11 -17
- package/dest/config/index.d.ts.map +1 -1
- package/dest/config/index.js +27 -16
- package/dest/config/package_info.d.ts +1 -1
- package/dest/config/package_info.js +1 -1
- package/dest/contract_function_simulator/benchmarked_node.d.ts +9 -0
- package/dest/contract_function_simulator/benchmarked_node.d.ts.map +1 -0
- package/dest/contract_function_simulator/benchmarked_node.js +77 -0
- package/dest/contract_function_simulator/contract_function_simulator.d.ts +79 -27
- package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.js +287 -87
- package/dest/contract_function_simulator/execution_note_cache.d.ts +26 -15
- package/dest/contract_function_simulator/execution_note_cache.d.ts.map +1 -1
- package/dest/contract_function_simulator/execution_note_cache.js +65 -37
- 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 +5 -3
- package/dest/contract_function_simulator/index.d.ts.map +1 -1
- package/dest/contract_function_simulator/index.js +3 -2
- package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts +5 -4
- package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/event_validation_request.js +7 -4
- 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 +7 -4
- 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 +13 -4
- package/dest/contract_function_simulator/noir-structs/utility_context.d.ts +16 -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 +22 -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 +107 -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 -2
- package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.js +1 -1
- package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts +14 -8
- package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/note_packing_utils.js +16 -11
- package/dest/contract_function_simulator/oracle/oracle.d.ts +26 -22
- package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/oracle.js +156 -113
- package/dest/contract_function_simulator/oracle/private_execution.d.ts +2 -27
- package/dest/contract_function_simulator/oracle/private_execution.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution.js +3 -48
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +72 -52
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.js +173 -68
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +116 -53
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +217 -94
- 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_logging.d.ts +22 -0
- package/dest/contract_logging.d.ts.map +1 -0
- package/dest/contract_logging.js +23 -0
- package/dest/contract_sync/contract_sync_service.d.ts +43 -0
- package/dest/contract_sync/contract_sync_service.d.ts.map +1 -0
- package/dest/contract_sync/contract_sync_service.js +97 -0
- package/dest/contract_sync/helpers.d.ts +29 -0
- package/dest/contract_sync/helpers.d.ts.map +1 -0
- package/dest/contract_sync/helpers.js +55 -0
- package/dest/debug/pxe_debug_utils.d.ts +45 -0
- package/dest/debug/pxe_debug_utils.d.ts.map +1 -0
- package/dest/debug/pxe_debug_utils.js +48 -0
- package/dest/entrypoints/client/bundle/index.d.ts +7 -3
- package/dest/entrypoints/client/bundle/index.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/index.js +5 -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 +40 -17
- package/dest/entrypoints/client/lazy/index.d.ts +7 -3
- package/dest/entrypoints/client/lazy/index.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/index.js +5 -2
- package/dest/entrypoints/client/lazy/utils.d.ts +9 -9
- package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/utils.js +40 -17
- package/dest/entrypoints/pxe_creation_options.d.ts +7 -3
- package/dest/entrypoints/pxe_creation_options.d.ts.map +1 -1
- package/dest/entrypoints/server/index.d.ts +9 -3
- package/dest/entrypoints/server/index.d.ts.map +1 -1
- package/dest/entrypoints/server/index.js +7 -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 +42 -51
- 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 +44 -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 +38 -0
- package/dest/job_coordinator/job_coordinator.d.ts +75 -0
- package/dest/job_coordinator/job_coordinator.d.ts.map +1 -0
- package/dest/job_coordinator/job_coordinator.js +94 -0
- package/dest/logs/log_service.d.ts +29 -0
- package/dest/logs/log_service.d.ts.map +1 -0
- package/dest/logs/log_service.js +118 -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 +49 -0
- package/dest/notes/note_service.d.ts.map +1 -0
- package/dest/notes/note_service.js +148 -0
- package/dest/notes_filter.d.ts +25 -0
- package/dest/notes_filter.d.ts.map +1 -0
- package/dest/notes_filter.js +4 -0
- package/dest/oracle_version.d.ts +3 -3
- package/dest/oracle_version.d.ts.map +1 -1
- package/dest/oracle_version.js +4 -3
- package/dest/private_kernel/hints/compute_tx_expiration_timestamp.d.ts +4 -0
- package/dest/private_kernel/hints/compute_tx_expiration_timestamp.d.ts.map +1 -0
- package/dest/private_kernel/hints/compute_tx_expiration_timestamp.js +41 -0
- package/dest/private_kernel/hints/index.d.ts +3 -3
- package/dest/private_kernel/hints/index.d.ts.map +1 -1
- package/dest/private_kernel/hints/index.js +2 -2
- package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts +28 -0
- package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts.map +1 -0
- package/dest/private_kernel/hints/{build_private_kernel_reset_private_inputs.js → private_kernel_reset_private_inputs_builder.js} +22 -16
- package/dest/private_kernel/index.d.ts +1 -1
- package/dest/private_kernel/private_kernel_execution_prover.d.ts +11 -3
- package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_execution_prover.js +48 -43
- package/dest/private_kernel/private_kernel_oracle.d.ts +26 -25
- package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_oracle.js +94 -2
- package/dest/pxe.d.ts +250 -0
- package/dest/pxe.d.ts.map +1 -0
- package/dest/pxe.js +774 -0
- package/dest/storage/address_store/address_store.d.ts +11 -0
- package/dest/storage/address_store/address_store.d.ts.map +1 -0
- package/dest/storage/{address_data_provider/address_data_provider.js → address_store/address_store.js} +13 -15
- package/dest/storage/address_store/index.d.ts +2 -0
- package/dest/storage/address_store/index.d.ts.map +1 -0
- package/dest/storage/address_store/index.js +1 -0
- package/dest/storage/anchor_block_store/anchor_block_store.d.ts +17 -0
- package/dest/storage/anchor_block_store/anchor_block_store.d.ts.map +1 -0
- package/dest/storage/{sync_data_provider/sync_data_provider.js → anchor_block_store/anchor_block_store.js} +10 -13
- 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 +72 -0
- package/dest/storage/capsule_store/capsule_store.d.ts.map +1 -0
- package/dest/storage/capsule_store/capsule_store.js +253 -0
- 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_store/contract_store.d.ts +93 -0
- package/dest/storage/contract_store/contract_store.d.ts.map +1 -0
- package/dest/storage/contract_store/contract_store.js +309 -0
- package/dest/storage/contract_store/index.d.ts +2 -0
- package/dest/storage/contract_store/index.d.ts.map +1 -0
- package/dest/storage/contract_store/index.js +1 -0
- package/dest/storage/{contract_data_provider → contract_store}/private_functions_tree.d.ts +1 -1
- package/dest/storage/contract_store/private_functions_tree.d.ts.map +1 -0
- package/dest/storage/{contract_data_provider → contract_store}/private_functions_tree.js +1 -1
- package/dest/storage/index.d.ts +8 -9
- package/dest/storage/index.d.ts.map +1 -1
- package/dest/storage/index.js +7 -8
- package/dest/storage/metadata.d.ts +2 -2
- package/dest/storage/metadata.js +1 -1
- package/dest/storage/note_store/index.d.ts +3 -0
- package/dest/storage/note_store/index.d.ts.map +1 -0
- package/dest/storage/note_store/index.js +2 -0
- package/dest/storage/note_store/note_store.d.ts +83 -0
- package/dest/storage/note_store/note_store.d.ts.map +1 -0
- package/dest/storage/note_store/note_store.js +343 -0
- package/dest/storage/note_store/stored_note.d.ts +16 -0
- package/dest/storage/note_store/stored_note.d.ts.map +1 -0
- package/dest/storage/note_store/stored_note.js +43 -0
- package/dest/storage/private_event_store/private_event_store.d.ts +91 -0
- package/dest/storage/private_event_store/private_event_store.d.ts.map +1 -0
- package/dest/storage/private_event_store/private_event_store.js +273 -0
- package/dest/storage/private_event_store/stored_private_event.d.ts +23 -0
- package/dest/storage/private_event_store/stored_private_event.d.ts.map +1 -0
- package/dest/storage/private_event_store/stored_private_event.js +56 -0
- package/dest/storage/tagging_store/index.d.ts +4 -0
- package/dest/storage/tagging_store/index.d.ts.map +1 -0
- package/dest/storage/tagging_store/index.js +3 -0
- package/dest/storage/tagging_store/recipient_tagging_store.d.ts +28 -0
- package/dest/storage/tagging_store/recipient_tagging_store.d.ts.map +1 -0
- package/dest/storage/tagging_store/recipient_tagging_store.js +111 -0
- package/dest/storage/tagging_store/sender_address_book_store.d.ts +14 -0
- package/dest/storage/tagging_store/sender_address_book_store.d.ts.map +1 -0
- package/dest/storage/tagging_store/sender_address_book_store.js +36 -0
- package/dest/storage/tagging_store/sender_tagging_store.d.ts +77 -0
- package/dest/storage/tagging_store/sender_tagging_store.d.ts.map +1 -0
- package/dest/storage/tagging_store/sender_tagging_store.js +348 -0
- package/dest/tagging/constants.d.ts +2 -0
- package/dest/tagging/constants.d.ts.map +1 -0
- package/dest/tagging/constants.js +10 -0
- package/dest/tagging/get_all_logs_by_tags.d.ts +24 -0
- package/dest/tagging/get_all_logs_by_tags.d.ts.map +1 -0
- package/dest/tagging/get_all_logs_by_tags.js +60 -0
- package/dest/tagging/index.d.ts +17 -0
- package/dest/tagging/index.d.ts.map +1 -0
- package/dest/tagging/index.js +15 -0
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts +15 -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 +15 -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 +32 -0
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts +21 -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 +29 -0
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts +21 -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 +60 -0
- package/package.json +30 -23
- package/src/access_scopes.ts +9 -0
- package/src/bin/check_oracle_version.ts +135 -10
- package/src/block_synchronizer/block_synchronizer.ts +178 -0
- package/src/block_synchronizer/index.ts +1 -0
- package/src/config/index.ts +32 -32
- package/src/config/package_info.ts +1 -1
- package/src/contract_function_simulator/benchmarked_node.ts +103 -0
- package/src/contract_function_simulator/contract_function_simulator.ts +505 -140
- package/src/contract_function_simulator/execution_note_cache.ts +67 -32
- 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 +4 -2
- package/src/contract_function_simulator/noir-structs/event_validation_request.ts +7 -3
- 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 +15 -3
- package/src/contract_function_simulator/noir-structs/utility_context.ts +23 -0
- package/src/contract_function_simulator/oracle/index.ts +1 -1
- package/src/contract_function_simulator/oracle/interfaces.ts +185 -0
- package/src/contract_function_simulator/oracle/message_load_oracle_inputs.ts +1 -1
- package/src/contract_function_simulator/oracle/note_packing_utils.ts +30 -14
- package/src/contract_function_simulator/oracle/oracle.ts +197 -110
- package/src/contract_function_simulator/oracle/private_execution.ts +4 -78
- package/src/contract_function_simulator/oracle/private_execution_oracle.ts +248 -122
- package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +372 -138
- package/src/contract_function_simulator/pick_notes.ts +1 -1
- package/src/contract_function_simulator/proxied_contract_data_source.ts +24 -7
- package/src/contract_logging.ts +39 -0
- package/src/contract_sync/contract_sync_service.ts +152 -0
- package/src/contract_sync/helpers.ts +98 -0
- package/src/debug/pxe_debug_utils.ts +93 -0
- package/src/entrypoints/client/bundle/index.ts +6 -2
- package/src/entrypoints/client/bundle/utils.ts +31 -32
- package/src/entrypoints/client/lazy/index.ts +6 -2
- package/src/entrypoints/client/lazy/utils.ts +31 -32
- package/src/entrypoints/pxe_creation_options.ts +6 -2
- package/src/entrypoints/server/index.ts +8 -2
- package/src/entrypoints/server/utils.ts +39 -91
- package/src/{pxe_service/error_enriching.ts → error_enriching.ts} +11 -15
- package/src/events/event_service.ts +71 -0
- package/src/events/index.ts +1 -0
- package/src/events/private_event_filter_validator.ts +46 -0
- package/src/job_coordinator/job_coordinator.ts +150 -0
- package/src/logs/log_service.ts +208 -0
- package/src/notes/index.ts +1 -0
- package/src/notes/note_service.ts +196 -0
- package/src/notes_filter.ts +26 -0
- package/src/oracle_version.ts +4 -3
- package/src/private_kernel/hints/{compute_tx_include_by_timestamp.ts → compute_tx_expiration_timestamp.ts} +16 -16
- package/src/private_kernel/hints/index.ts +2 -2
- package/src/private_kernel/hints/{build_private_kernel_reset_private_inputs.ts → private_kernel_reset_private_inputs_builder.ts} +44 -37
- package/src/private_kernel/private_kernel_execution_prover.ts +64 -55
- package/src/private_kernel/private_kernel_oracle.ts +118 -37
- package/src/pxe.ts +1137 -0
- package/src/storage/{address_data_provider/address_data_provider.ts → address_store/address_store.ts} +15 -21
- 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} +10 -17
- package/src/storage/anchor_block_store/index.ts +1 -0
- package/src/storage/capsule_store/capsule_store.ts +315 -0
- package/src/storage/capsule_store/index.ts +1 -0
- package/src/storage/contract_store/contract_store.ts +429 -0
- package/src/storage/contract_store/index.ts +1 -0
- package/src/storage/{contract_data_provider → contract_store}/private_functions_tree.ts +1 -1
- package/src/storage/index.ts +7 -8
- package/src/storage/metadata.ts +1 -1
- package/src/storage/note_store/index.ts +2 -0
- package/src/storage/note_store/note_store.ts +418 -0
- package/src/storage/note_store/stored_note.ts +48 -0
- package/src/storage/private_event_store/private_event_store.ts +384 -0
- package/src/storage/private_event_store/stored_private_event.ts +73 -0
- package/src/storage/tagging_store/index.ts +3 -0
- package/src/storage/tagging_store/recipient_tagging_store.ts +139 -0
- package/src/storage/tagging_store/sender_address_book_store.ts +48 -0
- package/src/storage/tagging_store/sender_tagging_store.ts +429 -0
- package/src/tagging/constants.ts +10 -0
- package/src/tagging/get_all_logs_by_tags.ts +92 -0
- package/src/tagging/index.ts +19 -0
- package/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts +143 -0
- package/src/tagging/recipient_sync/utils/find_highest_indexes.ts +34 -0
- package/src/tagging/recipient_sync/utils/load_logs_for_range.ts +49 -0
- package/src/tagging/sender_sync/sync_sender_tagging_indexes.ts +99 -0
- package/src/tagging/sender_sync/utils/get_status_change_of_pending.ts +36 -0
- package/src/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.ts +84 -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/proxied_node.d.ts +0 -9
- package/dest/contract_function_simulator/proxied_node.d.ts.map +0 -1
- package/dest/contract_function_simulator/proxied_node.js +0 -27
- package/dest/contract_function_simulator/pxe_oracle_interface.d.ts +0 -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/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts +0 -28
- package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts.map +0 -1
- package/dest/private_kernel/hints/compute_tx_include_by_timestamp.d.ts +0 -4
- package/dest/private_kernel/hints/compute_tx_include_by_timestamp.d.ts.map +0 -1
- package/dest/private_kernel/hints/compute_tx_include_by_timestamp.js +0 -41
- package/dest/private_kernel/private_kernel_oracle_impl.d.ts +0 -45
- package/dest/private_kernel/private_kernel_oracle_impl.d.ts.map +0 -1
- package/dest/private_kernel/private_kernel_oracle_impl.js +0 -86
- package/dest/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 -101
- package/dest/pxe_service/pxe_service.d.ts.map +0 -1
- package/dest/pxe_service/pxe_service.js +0 -791
- 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/capsule_data_provider.js +0 -122
- package/dest/storage/capsule_data_provider/index.d.ts +0 -2
- package/dest/storage/capsule_data_provider/index.d.ts.map +0 -1
- package/dest/storage/capsule_data_provider/index.js +0 -1
- package/dest/storage/contract_data_provider/contract_data_provider.d.ts +0 -75
- package/dest/storage/contract_data_provider/contract_data_provider.d.ts.map +0 -1
- package/dest/storage/contract_data_provider/contract_data_provider.js +0 -208
- 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/note_data_provider/note_data_provider.js +0 -260
- 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/synchronizer/synchronizer.js +0 -102
- 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/proxied_node.ts +0 -33
- package/src/contract_function_simulator/pxe_oracle_interface.ts +0 -1020
- package/src/contract_function_simulator/tagging_utils.ts +0 -32
- package/src/private_kernel/private_kernel_oracle_impl.ts +0 -132
- package/src/pxe_service/index.ts +0 -2
- package/src/pxe_service/pxe_service.ts +0 -1139
- package/src/storage/address_data_provider/index.ts +0 -1
- package/src/storage/capsule_data_provider/capsule_data_provider.ts +0 -157
- package/src/storage/capsule_data_provider/index.ts +0 -1
- package/src/storage/contract_data_provider/contract_data_provider.ts +0 -300
- 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/note_data_provider/note_data_provider.ts +0 -350
- 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/synchronizer/synchronizer.ts +0 -121
- package/src/test/pxe_test_suite.ts +0 -113
|
@@ -1,350 +0,0 @@
|
|
|
1
|
-
import { toBufferBE } from '@aztec/foundation/bigint-buffer';
|
|
2
|
-
import type { Fr } from '@aztec/foundation/fields';
|
|
3
|
-
import { toArray } from '@aztec/foundation/iterable';
|
|
4
|
-
import type { AztecAsyncKVStore, AztecAsyncMap, AztecAsyncMultiMap } from '@aztec/kv-store';
|
|
5
|
-
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
6
|
-
import type { InBlock } from '@aztec/stdlib/block';
|
|
7
|
-
import { NoteStatus, type NotesFilter } from '@aztec/stdlib/note';
|
|
8
|
-
|
|
9
|
-
import type { DataProvider } from '../data_provider.js';
|
|
10
|
-
import { NoteDao } from './note_dao.js';
|
|
11
|
-
|
|
12
|
-
export class NoteDataProvider implements DataProvider {
|
|
13
|
-
#store: AztecAsyncKVStore;
|
|
14
|
-
|
|
15
|
-
#notes: AztecAsyncMap<string, Buffer>;
|
|
16
|
-
#nullifiedNotes: AztecAsyncMap<string, Buffer>;
|
|
17
|
-
#nullifierToNoteId: AztecAsyncMap<string, string>;
|
|
18
|
-
#nullifiersByBlockNumber: AztecAsyncMultiMap<number, string>;
|
|
19
|
-
|
|
20
|
-
#nullifiedNotesToScope: AztecAsyncMultiMap<string, string>;
|
|
21
|
-
#nullifiedNotesByContract: AztecAsyncMultiMap<string, string>;
|
|
22
|
-
#nullifiedNotesByStorageSlot: AztecAsyncMultiMap<string, string>;
|
|
23
|
-
#nullifiedNotesByTxHash: AztecAsyncMultiMap<string, string>;
|
|
24
|
-
#nullifiedNotesByRecipient: AztecAsyncMultiMap<string, string>;
|
|
25
|
-
#nullifiedNotesByNullifier: AztecAsyncMap<string, string>;
|
|
26
|
-
|
|
27
|
-
#scopes: AztecAsyncMap<string, true>;
|
|
28
|
-
#notesToScope: AztecAsyncMultiMap<string, string>;
|
|
29
|
-
#notesByContractAndScope: Map<string, AztecAsyncMultiMap<string, string>>;
|
|
30
|
-
#notesByStorageSlotAndScope: Map<string, AztecAsyncMultiMap<string, string>>;
|
|
31
|
-
#notesByTxHashAndScope: Map<string, AztecAsyncMultiMap<string, string>>;
|
|
32
|
-
#notesByRecipientAndScope: Map<string, AztecAsyncMultiMap<string, string>>;
|
|
33
|
-
|
|
34
|
-
private constructor(store: AztecAsyncKVStore) {
|
|
35
|
-
this.#store = store;
|
|
36
|
-
this.#notes = store.openMap('notes');
|
|
37
|
-
this.#nullifiedNotes = store.openMap('nullified_notes');
|
|
38
|
-
this.#nullifierToNoteId = store.openMap('nullifier_to_note');
|
|
39
|
-
this.#nullifiersByBlockNumber = store.openMultiMap('nullifier_to_block_number');
|
|
40
|
-
|
|
41
|
-
this.#nullifiedNotesToScope = store.openMultiMap('nullified_notes_to_scope');
|
|
42
|
-
this.#nullifiedNotesByContract = store.openMultiMap('nullified_notes_by_contract');
|
|
43
|
-
this.#nullifiedNotesByStorageSlot = store.openMultiMap('nullified_notes_by_storage_slot');
|
|
44
|
-
this.#nullifiedNotesByTxHash = store.openMultiMap('nullified_notes_by_tx_hash');
|
|
45
|
-
this.#nullifiedNotesByRecipient = store.openMultiMap('nullified_notes_by_recipient');
|
|
46
|
-
this.#nullifiedNotesByNullifier = store.openMap('nullified_notes_by_nullifier');
|
|
47
|
-
|
|
48
|
-
this.#scopes = store.openMap('scopes');
|
|
49
|
-
this.#notesToScope = store.openMultiMap('notes_to_scope');
|
|
50
|
-
this.#notesByContractAndScope = new Map<string, AztecAsyncMultiMap<string, string>>();
|
|
51
|
-
this.#notesByStorageSlotAndScope = new Map<string, AztecAsyncMultiMap<string, string>>();
|
|
52
|
-
this.#notesByTxHashAndScope = new Map<string, AztecAsyncMultiMap<string, string>>();
|
|
53
|
-
this.#notesByRecipientAndScope = new Map<string, AztecAsyncMultiMap<string, string>>();
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
public static async create(store: AztecAsyncKVStore): Promise<NoteDataProvider> {
|
|
57
|
-
const pxeDB = new NoteDataProvider(store);
|
|
58
|
-
for await (const scope of pxeDB.#scopes.keysAsync()) {
|
|
59
|
-
pxeDB.#notesByContractAndScope.set(scope, store.openMultiMap(`${scope}:notes_by_contract`));
|
|
60
|
-
pxeDB.#notesByStorageSlotAndScope.set(scope, store.openMultiMap(`${scope}:notes_by_storage_slot`));
|
|
61
|
-
pxeDB.#notesByTxHashAndScope.set(scope, store.openMultiMap(`${scope}:notes_by_tx_hash`));
|
|
62
|
-
pxeDB.#notesByRecipientAndScope.set(scope, store.openMultiMap(`${scope}:notes_by_recipient`));
|
|
63
|
-
}
|
|
64
|
-
return pxeDB;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
public async addScope(scope: AztecAddress): Promise<boolean> {
|
|
68
|
-
const scopeString = scope.toString();
|
|
69
|
-
|
|
70
|
-
if (await this.#scopes.hasAsync(scopeString)) {
|
|
71
|
-
return false;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
await this.#scopes.set(scopeString, true);
|
|
75
|
-
this.#notesByContractAndScope.set(scopeString, this.#store.openMultiMap(`${scopeString}:notes_by_contract`));
|
|
76
|
-
this.#notesByStorageSlotAndScope.set(scopeString, this.#store.openMultiMap(`${scopeString}:notes_by_storage_slot`));
|
|
77
|
-
this.#notesByTxHashAndScope.set(scopeString, this.#store.openMultiMap(`${scopeString}:notes_by_tx_hash`));
|
|
78
|
-
this.#notesByRecipientAndScope.set(scopeString, this.#store.openMultiMap(`${scopeString}:notes_by_recipient`));
|
|
79
|
-
|
|
80
|
-
return true;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
addNotes(notes: NoteDao[], scope: AztecAddress = AztecAddress.ZERO): Promise<void> {
|
|
84
|
-
return this.#store.transactionAsync(async () => {
|
|
85
|
-
if (!(await this.#scopes.hasAsync(scope.toString()))) {
|
|
86
|
-
await this.addScope(scope);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
for (const dao of notes) {
|
|
90
|
-
// store notes by their index in the notes hash tree
|
|
91
|
-
// this provides the uniqueness we need to store individual notes
|
|
92
|
-
// and should also return notes in the order that they were created.
|
|
93
|
-
// Had we stored them by their nullifier, they would be returned in random order
|
|
94
|
-
const noteIndex = toBufferBE(dao.index, 32).toString('hex');
|
|
95
|
-
await this.#notes.set(noteIndex, dao.toBuffer());
|
|
96
|
-
await this.#notesToScope.set(noteIndex, scope.toString());
|
|
97
|
-
await this.#nullifierToNoteId.set(dao.siloedNullifier.toString(), noteIndex);
|
|
98
|
-
|
|
99
|
-
await this.#notesByContractAndScope.get(scope.toString())!.set(dao.contractAddress.toString(), noteIndex);
|
|
100
|
-
await this.#notesByStorageSlotAndScope.get(scope.toString())!.set(dao.storageSlot.toString(), noteIndex);
|
|
101
|
-
await this.#notesByTxHashAndScope.get(scope.toString())!.set(dao.txHash.toString(), noteIndex);
|
|
102
|
-
await this.#notesByRecipientAndScope.get(scope.toString())!.set(dao.recipient.toString(), noteIndex);
|
|
103
|
-
}
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
public removeNotesAfter(blockNumber: number): Promise<void> {
|
|
108
|
-
return this.#store.transactionAsync(async () => {
|
|
109
|
-
const notes = await toArray(this.#notes.valuesAsync());
|
|
110
|
-
for (const note of notes) {
|
|
111
|
-
const noteDao = NoteDao.fromBuffer(note);
|
|
112
|
-
if (noteDao.l2BlockNumber > blockNumber) {
|
|
113
|
-
const noteIndex = toBufferBE(noteDao.index, 32).toString('hex');
|
|
114
|
-
await this.#notes.delete(noteIndex);
|
|
115
|
-
await this.#notesToScope.delete(noteIndex);
|
|
116
|
-
await this.#nullifierToNoteId.delete(noteDao.siloedNullifier.toString());
|
|
117
|
-
const scopes = await toArray(this.#scopes.keysAsync());
|
|
118
|
-
for (const scope of scopes) {
|
|
119
|
-
await this.#notesByRecipientAndScope.get(scope)!.deleteValue(noteDao.recipient.toString(), noteIndex);
|
|
120
|
-
await this.#notesByTxHashAndScope.get(scope)!.deleteValue(noteDao.txHash.toString(), noteIndex);
|
|
121
|
-
await this.#notesByContractAndScope.get(scope)!.deleteValue(noteDao.contractAddress.toString(), noteIndex);
|
|
122
|
-
await this.#notesByStorageSlotAndScope.get(scope)!.deleteValue(noteDao.storageSlot.toString(), noteIndex);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
public async unnullifyNotesAfter(blockNumber: number, synchedBlockNumber?: number): Promise<void> {
|
|
130
|
-
await this.#store.transactionAsync(async () => {
|
|
131
|
-
const nullifiersToUndo: string[] = [];
|
|
132
|
-
const currentBlockNumber = blockNumber + 1;
|
|
133
|
-
const maxBlockNumber = synchedBlockNumber ?? currentBlockNumber;
|
|
134
|
-
for (let i = currentBlockNumber; i <= maxBlockNumber; i++) {
|
|
135
|
-
nullifiersToUndo.push(...(await toArray(this.#nullifiersByBlockNumber.getValuesAsync(i))));
|
|
136
|
-
}
|
|
137
|
-
const notesIndexesToReinsert = await Promise.all(
|
|
138
|
-
nullifiersToUndo.map(nullifier => this.#nullifiedNotesByNullifier.getAsync(nullifier)),
|
|
139
|
-
);
|
|
140
|
-
const notNullNoteIndexes = notesIndexesToReinsert.filter(noteIndex => noteIndex != undefined);
|
|
141
|
-
const nullifiedNoteBuffers = await Promise.all(
|
|
142
|
-
notNullNoteIndexes.map(noteIndex => this.#nullifiedNotes.getAsync(noteIndex!)),
|
|
143
|
-
);
|
|
144
|
-
const noteDaos = nullifiedNoteBuffers
|
|
145
|
-
.filter(buffer => buffer != undefined)
|
|
146
|
-
.map(buffer => NoteDao.fromBuffer(buffer!));
|
|
147
|
-
|
|
148
|
-
for (const dao of noteDaos) {
|
|
149
|
-
const noteIndex = toBufferBE(dao.index, 32).toString('hex');
|
|
150
|
-
await this.#notes.set(noteIndex, dao.toBuffer());
|
|
151
|
-
await this.#nullifierToNoteId.set(dao.siloedNullifier.toString(), noteIndex);
|
|
152
|
-
|
|
153
|
-
let scopes = (await toArray(this.#nullifiedNotesToScope.getValuesAsync(noteIndex))) ?? [];
|
|
154
|
-
|
|
155
|
-
if (scopes.length === 0) {
|
|
156
|
-
scopes = [dao.recipient.toString()];
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
for (const scope of scopes) {
|
|
160
|
-
await this.#notesByContractAndScope.get(scope.toString())!.set(dao.contractAddress.toString(), noteIndex);
|
|
161
|
-
await this.#notesByStorageSlotAndScope.get(scope.toString())!.set(dao.storageSlot.toString(), noteIndex);
|
|
162
|
-
await this.#notesByTxHashAndScope.get(scope.toString())!.set(dao.txHash.toString(), noteIndex);
|
|
163
|
-
await this.#notesByRecipientAndScope.get(scope.toString())!.set(dao.recipient.toString(), noteIndex);
|
|
164
|
-
await this.#notesToScope.set(noteIndex, scope);
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
await this.#nullifiedNotes.delete(noteIndex);
|
|
168
|
-
await this.#nullifiedNotesToScope.delete(noteIndex);
|
|
169
|
-
await this.#nullifiersByBlockNumber.deleteValue(dao.l2BlockNumber, dao.siloedNullifier.toString());
|
|
170
|
-
await this.#nullifiedNotesByContract.deleteValue(dao.contractAddress.toString(), noteIndex);
|
|
171
|
-
await this.#nullifiedNotesByStorageSlot.deleteValue(dao.storageSlot.toString(), noteIndex);
|
|
172
|
-
await this.#nullifiedNotesByTxHash.deleteValue(dao.txHash.toString(), noteIndex);
|
|
173
|
-
await this.#nullifiedNotesByRecipient.deleteValue(dao.recipient.toString(), noteIndex);
|
|
174
|
-
await this.#nullifiedNotesByNullifier.delete(dao.siloedNullifier.toString());
|
|
175
|
-
}
|
|
176
|
-
});
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
async getNotes(filter: NotesFilter): Promise<NoteDao[]> {
|
|
180
|
-
filter.status = filter.status ?? NoteStatus.ACTIVE;
|
|
181
|
-
|
|
182
|
-
const candidateNoteSources = [];
|
|
183
|
-
|
|
184
|
-
filter.scopes ??= (await toArray(this.#scopes.keysAsync())).map(addressString =>
|
|
185
|
-
AztecAddress.fromString(addressString),
|
|
186
|
-
);
|
|
187
|
-
|
|
188
|
-
const activeNoteIdsPerScope: string[][] = [];
|
|
189
|
-
|
|
190
|
-
for (const scope of new Set(filter.scopes)) {
|
|
191
|
-
const formattedScopeString = scope.toString();
|
|
192
|
-
if (!(await this.#scopes.hasAsync(formattedScopeString))) {
|
|
193
|
-
throw new Error('Trying to get incoming notes of an scope that is not in the PXE database');
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
activeNoteIdsPerScope.push(
|
|
197
|
-
filter.recipient
|
|
198
|
-
? await toArray(
|
|
199
|
-
this.#notesByRecipientAndScope.get(formattedScopeString)!.getValuesAsync(filter.recipient.toString()),
|
|
200
|
-
)
|
|
201
|
-
: filter.txHash
|
|
202
|
-
? await toArray(
|
|
203
|
-
this.#notesByTxHashAndScope.get(formattedScopeString)!.getValuesAsync(filter.txHash.toString()),
|
|
204
|
-
)
|
|
205
|
-
: filter.storageSlot
|
|
206
|
-
? await toArray(
|
|
207
|
-
this.#notesByStorageSlotAndScope
|
|
208
|
-
.get(formattedScopeString)!
|
|
209
|
-
.getValuesAsync(filter.storageSlot.toString()),
|
|
210
|
-
)
|
|
211
|
-
: await toArray(
|
|
212
|
-
this.#notesByContractAndScope
|
|
213
|
-
.get(formattedScopeString)!
|
|
214
|
-
.getValuesAsync(filter.contractAddress.toString()),
|
|
215
|
-
),
|
|
216
|
-
);
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
candidateNoteSources.push({
|
|
220
|
-
ids: new Set(activeNoteIdsPerScope.flat()),
|
|
221
|
-
notes: this.#notes,
|
|
222
|
-
});
|
|
223
|
-
|
|
224
|
-
if (filter.status == NoteStatus.ACTIVE_OR_NULLIFIED) {
|
|
225
|
-
candidateNoteSources.push({
|
|
226
|
-
ids: filter.recipient
|
|
227
|
-
? await toArray(this.#nullifiedNotesByRecipient.getValuesAsync(filter.recipient.toString()))
|
|
228
|
-
: filter.txHash
|
|
229
|
-
? await toArray(this.#nullifiedNotesByTxHash.getValuesAsync(filter.txHash.toString()))
|
|
230
|
-
: filter.storageSlot
|
|
231
|
-
? await toArray(this.#nullifiedNotesByStorageSlot.getValuesAsync(filter.storageSlot.toString()))
|
|
232
|
-
: await toArray(this.#nullifiedNotesByContract.getValuesAsync(filter.contractAddress.toString())),
|
|
233
|
-
notes: this.#nullifiedNotes,
|
|
234
|
-
});
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
const result: NoteDao[] = [];
|
|
238
|
-
for (const { ids, notes } of candidateNoteSources) {
|
|
239
|
-
for (const id of ids) {
|
|
240
|
-
const serializedNote = await notes.getAsync(id);
|
|
241
|
-
if (!serializedNote) {
|
|
242
|
-
continue;
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
const note = NoteDao.fromBuffer(serializedNote);
|
|
246
|
-
if (!note.contractAddress.equals(filter.contractAddress)) {
|
|
247
|
-
continue;
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
if (filter.txHash && !note.txHash.equals(filter.txHash)) {
|
|
251
|
-
continue;
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
if (filter.storageSlot && !note.storageSlot.equals(filter.storageSlot!)) {
|
|
255
|
-
continue;
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
if (filter.recipient && !note.recipient.equals(filter.recipient)) {
|
|
259
|
-
continue;
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
if (filter.siloedNullifier && !note.siloedNullifier.equals(filter.siloedNullifier)) {
|
|
263
|
-
continue;
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
result.push(note);
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
return result;
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
removeNullifiedNotes(nullifiers: InBlock<Fr>[], recipient: AztecAddress): Promise<NoteDao[]> {
|
|
274
|
-
if (nullifiers.length === 0) {
|
|
275
|
-
return Promise.resolve([]);
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
return this.#store.transactionAsync(async () => {
|
|
279
|
-
const nullifiedNotes: NoteDao[] = [];
|
|
280
|
-
|
|
281
|
-
for (const blockScopedNullifier of nullifiers) {
|
|
282
|
-
const { data: nullifier, l2BlockNumber: blockNumber } = blockScopedNullifier;
|
|
283
|
-
const noteIndex = await this.#nullifierToNoteId.getAsync(nullifier.toString());
|
|
284
|
-
if (!noteIndex) {
|
|
285
|
-
throw new Error('Nullifier not found in removeNullifiedNotes');
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
const noteBuffer = noteIndex ? await this.#notes.getAsync(noteIndex) : undefined;
|
|
289
|
-
|
|
290
|
-
if (!noteBuffer) {
|
|
291
|
-
throw new Error('Note not found in removeNullifiedNotes');
|
|
292
|
-
}
|
|
293
|
-
const noteScopes = (await toArray(this.#notesToScope.getValuesAsync(noteIndex))) ?? [];
|
|
294
|
-
const note = NoteDao.fromBuffer(noteBuffer);
|
|
295
|
-
if (!note.recipient.equals(recipient)) {
|
|
296
|
-
throw new Error("Tried to nullify someone else's note");
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
nullifiedNotes.push(note);
|
|
300
|
-
|
|
301
|
-
await this.#notes.delete(noteIndex);
|
|
302
|
-
await this.#notesToScope.delete(noteIndex);
|
|
303
|
-
|
|
304
|
-
const scopes = await toArray(this.#scopes.keysAsync());
|
|
305
|
-
|
|
306
|
-
for (const scope of scopes) {
|
|
307
|
-
await this.#notesByRecipientAndScope.get(scope)!.deleteValue(note.recipient.toString(), noteIndex);
|
|
308
|
-
await this.#notesByTxHashAndScope.get(scope)!.deleteValue(note.txHash.toString(), noteIndex);
|
|
309
|
-
await this.#notesByContractAndScope.get(scope)!.deleteValue(note.contractAddress.toString(), noteIndex);
|
|
310
|
-
await this.#notesByStorageSlotAndScope.get(scope)!.deleteValue(note.storageSlot.toString(), noteIndex);
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
if (noteScopes !== undefined) {
|
|
314
|
-
for (const scope of noteScopes) {
|
|
315
|
-
await this.#nullifiedNotesToScope.set(noteIndex, scope);
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
await this.#nullifiedNotes.set(noteIndex, note.toBuffer());
|
|
319
|
-
await this.#nullifiersByBlockNumber.set(blockNumber, nullifier.toString());
|
|
320
|
-
await this.#nullifiedNotesByContract.set(note.contractAddress.toString(), noteIndex);
|
|
321
|
-
await this.#nullifiedNotesByStorageSlot.set(note.storageSlot.toString(), noteIndex);
|
|
322
|
-
await this.#nullifiedNotesByTxHash.set(note.txHash.toString(), noteIndex);
|
|
323
|
-
await this.#nullifiedNotesByRecipient.set(note.recipient.toString(), noteIndex);
|
|
324
|
-
await this.#nullifiedNotesByNullifier.set(nullifier.toString(), noteIndex);
|
|
325
|
-
|
|
326
|
-
await this.#nullifierToNoteId.delete(nullifier.toString());
|
|
327
|
-
}
|
|
328
|
-
return nullifiedNotes;
|
|
329
|
-
});
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
async getSize() {
|
|
333
|
-
const scopes = await toArray(this.#scopes.keysAsync());
|
|
334
|
-
const contractAddresses = new Set<string>();
|
|
335
|
-
|
|
336
|
-
// Collect all unique contract addresses across all scopes
|
|
337
|
-
for (const scope of scopes) {
|
|
338
|
-
const addresses = await toArray(this.#notesByContractAndScope.get(scope)!.keysAsync());
|
|
339
|
-
addresses.forEach(addr => contractAddresses.add(addr));
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
// Get all notes for each contract address
|
|
343
|
-
const allNotes = await Promise.all(
|
|
344
|
-
Array.from(contractAddresses).map(addr => this.getNotes({ contractAddress: AztecAddress.fromString(addr) })),
|
|
345
|
-
);
|
|
346
|
-
|
|
347
|
-
// Reduce all notes to get total size
|
|
348
|
-
return allNotes.flat().reduce((sum, note) => sum + note.getSize(), 0);
|
|
349
|
-
}
|
|
350
|
-
}
|
|
@@ -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';
|