@aztec/pxe 0.0.1-commit.fce3e4f → 0.0.1-commit.ff7989d6c
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dest/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.js +105 -15
- 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 +6 -4
- package/dest/config/index.d.ts.map +1 -1
- package/dest/config/index.js +17 -0
- 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 +76 -24
- package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.js +218 -73
- package/dest/contract_function_simulator/execution_note_cache.d.ts +21 -11
- package/dest/contract_function_simulator/execution_note_cache.d.ts.map +1 -1
- package/dest/contract_function_simulator/execution_note_cache.js +49 -31
- package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts +1 -1
- package/dest/contract_function_simulator/execution_tagging_index_cache.js +1 -1
- 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 +2 -2
- package/dest/contract_function_simulator/index.d.ts.map +1 -1
- package/dest/contract_function_simulator/index.js +1 -1
- 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 +2 -2
- 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 +1 -1
- package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +6 -5
- 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 +7 -4
- package/dest/contract_function_simulator/noir-structs/utility_context.d.ts +4 -10
- package/dest/contract_function_simulator/noir-structs/utility_context.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/utility_context.js +7 -18
- package/dest/contract_function_simulator/oracle/interfaces.d.ts +27 -20
- package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts +4 -2
- package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.js +1 -1
- package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts +11 -7
- package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/note_packing_utils.js +14 -10
- package/dest/contract_function_simulator/oracle/oracle.d.ts +13 -11
- package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/oracle.js +86 -51
- 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 +2 -38
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +54 -45
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.js +105 -62
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +114 -38
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +214 -86
- 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 +4 -2
- package/dest/entrypoints/client/bundle/index.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/index.js +3 -1
- package/dest/entrypoints/client/bundle/utils.d.ts +1 -1
- package/dest/entrypoints/client/bundle/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/utils.js +32 -9
- package/dest/entrypoints/client/lazy/index.d.ts +4 -2
- package/dest/entrypoints/client/lazy/index.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/index.js +3 -1
- package/dest/entrypoints/client/lazy/utils.d.ts +2 -2
- package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/utils.js +33 -10
- package/dest/entrypoints/pxe_creation_options.d.ts +7 -3
- package/dest/entrypoints/pxe_creation_options.d.ts.map +1 -1
- package/dest/entrypoints/server/index.d.ts +6 -2
- package/dest/entrypoints/server/index.d.ts.map +1 -1
- package/dest/entrypoints/server/index.js +5 -1
- package/dest/entrypoints/server/utils.d.ts +1 -1
- package/dest/entrypoints/server/utils.d.ts.map +1 -1
- package/dest/entrypoints/server/utils.js +39 -16
- package/dest/error_enriching.d.ts +4 -4
- package/dest/error_enriching.d.ts.map +1 -1
- package/dest/error_enriching.js +6 -6
- package/dest/events/event_service.d.ts +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_include_by_timestamp.js → compute_tx_expiration_timestamp.js} +12 -12
- package/dest/private_kernel/hints/index.d.ts +3 -3
- package/dest/private_kernel/hints/index.d.ts.map +1 -1
- package/dest/private_kernel/hints/index.js +2 -2
- package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts +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} +16 -10
- package/dest/private_kernel/private_kernel_execution_prover.d.ts +3 -2
- package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_execution_prover.js +16 -17
- 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 +112 -102
- package/dest/pxe.d.ts.map +1 -1
- package/dest/pxe.js +255 -252
- package/dest/storage/address_store/address_store.d.ts +11 -0
- package/dest/storage/address_store/address_store.d.ts.map +1 -0
- package/dest/storage/{address_data_provider/address_data_provider.js → address_store/address_store.js} +13 -12
- package/dest/storage/address_store/index.d.ts +2 -0
- package/dest/storage/address_store/index.d.ts.map +1 -0
- package/dest/storage/address_store/index.js +1 -0
- package/dest/storage/anchor_block_store/anchor_block_store.d.ts +17 -0
- package/dest/storage/anchor_block_store/anchor_block_store.d.ts.map +1 -0
- package/dest/storage/{sync_data_provider/sync_data_provider.js → anchor_block_store/anchor_block_store.js} +10 -10
- package/dest/storage/{sync_data_provider → anchor_block_store}/index.d.ts +2 -2
- package/dest/storage/anchor_block_store/index.d.ts.map +1 -0
- package/dest/storage/anchor_block_store/index.js +1 -0
- package/dest/storage/capsule_store/capsule_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 -8
- package/dest/storage/index.d.ts.map +1 -1
- package/dest/storage/index.js +7 -7
- package/dest/storage/metadata.d.ts +1 -1
- package/dest/storage/metadata.js +1 -1
- package/dest/storage/note_store/index.d.ts +3 -0
- package/dest/storage/note_store/index.d.ts.map +1 -0
- package/dest/storage/note_store/index.js +2 -0
- package/dest/storage/note_store/note_store.d.ts +83 -0
- package/dest/storage/note_store/note_store.d.ts.map +1 -0
- package/dest/storage/note_store/note_store.js +343 -0
- package/dest/storage/note_store/stored_note.d.ts +16 -0
- package/dest/storage/note_store/stored_note.d.ts.map +1 -0
- package/dest/storage/note_store/stored_note.js +43 -0
- package/dest/storage/private_event_store/private_event_store.d.ts +91 -0
- package/dest/storage/private_event_store/private_event_store.d.ts.map +1 -0
- package/dest/storage/private_event_store/private_event_store.js +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 -2
- package/dest/tagging/constants.d.ts.map +1 -1
- package/dest/tagging/constants.js +10 -2
- package/dest/tagging/get_all_logs_by_tags.d.ts +24 -0
- package/dest/tagging/get_all_logs_by_tags.d.ts.map +1 -0
- package/dest/tagging/get_all_logs_by_tags.js +60 -0
- package/dest/tagging/index.d.ts +16 -6
- package/dest/tagging/index.d.ts.map +1 -1
- package/dest/tagging/index.js +15 -5
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts +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 +28 -19
- package/src/access_scopes.ts +9 -0
- package/src/bin/check_oracle_version.ts +131 -20
- package/src/block_synchronizer/block_synchronizer.ts +178 -0
- package/src/block_synchronizer/index.ts +1 -0
- package/src/config/index.ts +17 -3
- 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 +380 -104
- package/src/contract_function_simulator/execution_note_cache.ts +51 -28
- package/src/contract_function_simulator/execution_tagging_index_cache.ts +1 -1
- package/src/contract_function_simulator/hashed_values_cache.ts +1 -1
- package/src/contract_function_simulator/index.ts +1 -1
- 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 +1 -1
- package/src/contract_function_simulator/noir-structs/note_validation_request.ts +6 -3
- package/src/contract_function_simulator/noir-structs/utility_context.ts +6 -25
- package/src/contract_function_simulator/oracle/interfaces.ts +32 -17
- package/src/contract_function_simulator/oracle/message_load_oracle_inputs.ts +1 -1
- package/src/contract_function_simulator/oracle/note_packing_utils.ts +27 -13
- package/src/contract_function_simulator/oracle/oracle.ts +101 -47
- package/src/contract_function_simulator/oracle/private_execution.ts +2 -68
- package/src/contract_function_simulator/oracle/private_execution_oracle.ts +154 -97
- package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +350 -91
- 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 +3 -1
- package/src/entrypoints/client/bundle/utils.ts +24 -17
- package/src/entrypoints/client/lazy/index.ts +3 -1
- package/src/entrypoints/client/lazy/utils.ts +25 -18
- package/src/entrypoints/pxe_creation_options.ts +6 -2
- package/src/entrypoints/server/index.ts +5 -1
- package/src/entrypoints/server/utils.ts +33 -41
- package/src/error_enriching.ts +7 -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} +13 -13
- package/src/private_kernel/hints/index.ts +2 -2
- package/src/private_kernel/hints/{build_private_kernel_reset_private_inputs.ts → private_kernel_reset_private_inputs_builder.ts} +40 -29
- package/src/private_kernel/private_kernel_execution_prover.ts +20 -18
- package/src/private_kernel/private_kernel_oracle.ts +118 -37
- package/src/pxe.ts +395 -343
- package/src/storage/{address_data_provider/address_data_provider.ts → address_store/address_store.ts} +16 -16
- package/src/storage/address_store/index.ts +1 -0
- package/src/storage/{sync_data_provider/sync_data_provider.ts → anchor_block_store/anchor_block_store.ts} +10 -11
- 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 -7
- package/src/storage/metadata.ts +1 -1
- package/src/storage/note_store/index.ts +2 -0
- package/src/storage/note_store/note_store.ts +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 -2
- package/src/tagging/get_all_logs_by_tags.ts +92 -0
- package/src/tagging/index.ts +18 -5
- 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/contract_function_simulator/execution_data_provider.d.ts +0 -265
- package/dest/contract_function_simulator/execution_data_provider.d.ts.map +0 -1
- package/dest/contract_function_simulator/execution_data_provider.js +0 -14
- package/dest/contract_function_simulator/proxied_node.d.ts +0 -9
- package/dest/contract_function_simulator/proxied_node.d.ts.map +0 -1
- package/dest/contract_function_simulator/proxied_node.js +0 -27
- package/dest/contract_function_simulator/pxe_oracle_interface.d.ts +0 -122
- package/dest/contract_function_simulator/pxe_oracle_interface.d.ts.map +0 -1
- package/dest/contract_function_simulator/pxe_oracle_interface.js +0 -694
- package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts +0 -28
- package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts.map +0 -1
- package/dest/private_kernel/hints/compute_tx_include_by_timestamp.d.ts +0 -4
- package/dest/private_kernel/hints/compute_tx_include_by_timestamp.d.ts.map +0 -1
- package/dest/private_kernel/private_kernel_oracle_impl.d.ts +0 -45
- package/dest/private_kernel/private_kernel_oracle_impl.d.ts.map +0 -1
- package/dest/private_kernel/private_kernel_oracle_impl.js +0 -86
- package/dest/storage/address_data_provider/address_data_provider.d.ts +0 -11
- package/dest/storage/address_data_provider/address_data_provider.d.ts.map +0 -1
- package/dest/storage/address_data_provider/index.d.ts +0 -2
- package/dest/storage/address_data_provider/index.d.ts.map +0 -1
- package/dest/storage/address_data_provider/index.js +0 -1
- package/dest/storage/capsule_data_provider/capsule_data_provider.d.ts +0 -25
- package/dest/storage/capsule_data_provider/capsule_data_provider.d.ts.map +0 -1
- package/dest/storage/capsule_data_provider/capsule_data_provider.js +0 -118
- package/dest/storage/capsule_data_provider/index.d.ts +0 -2
- package/dest/storage/capsule_data_provider/index.d.ts.map +0 -1
- package/dest/storage/capsule_data_provider/index.js +0 -1
- package/dest/storage/contract_data_provider/contract_data_provider.d.ts +0 -64
- package/dest/storage/contract_data_provider/contract_data_provider.d.ts.map +0 -1
- package/dest/storage/contract_data_provider/contract_data_provider.js +0 -193
- package/dest/storage/contract_data_provider/index.d.ts +0 -2
- package/dest/storage/contract_data_provider/index.d.ts.map +0 -1
- package/dest/storage/contract_data_provider/index.js +0 -1
- package/dest/storage/contract_data_provider/private_functions_tree.d.ts.map +0 -1
- package/dest/storage/note_data_provider/index.d.ts +0 -3
- package/dest/storage/note_data_provider/index.d.ts.map +0 -1
- package/dest/storage/note_data_provider/index.js +0 -2
- package/dest/storage/note_data_provider/note_data_provider.d.ts +0 -83
- package/dest/storage/note_data_provider/note_data_provider.d.ts.map +0 -1
- package/dest/storage/note_data_provider/note_data_provider.js +0 -311
- package/dest/storage/private_event_data_provider/private_event_data_provider.d.ts +0 -37
- package/dest/storage/private_event_data_provider/private_event_data_provider.d.ts.map +0 -1
- package/dest/storage/private_event_data_provider/private_event_data_provider.js +0 -105
- package/dest/storage/sync_data_provider/index.d.ts.map +0 -1
- package/dest/storage/sync_data_provider/index.js +0 -1
- package/dest/storage/sync_data_provider/sync_data_provider.d.ts +0 -10
- package/dest/storage/sync_data_provider/sync_data_provider.d.ts.map +0 -1
- package/dest/storage/tagging_data_provider/index.d.ts +0 -2
- package/dest/storage/tagging_data_provider/index.d.ts.map +0 -1
- package/dest/storage/tagging_data_provider/index.js +0 -1
- package/dest/storage/tagging_data_provider/tagging_data_provider.d.ts +0 -40
- package/dest/storage/tagging_data_provider/tagging_data_provider.d.ts.map +0 -1
- package/dest/storage/tagging_data_provider/tagging_data_provider.js +0 -89
- package/dest/synchronizer/index.d.ts +0 -2
- package/dest/synchronizer/index.d.ts.map +0 -1
- package/dest/synchronizer/index.js +0 -1
- package/dest/synchronizer/synchronizer.d.ts +0 -35
- package/dest/synchronizer/synchronizer.d.ts.map +0 -1
- package/dest/synchronizer/synchronizer.js +0 -101
- package/dest/tagging/siloed_tag.d.ts +0 -14
- package/dest/tagging/siloed_tag.d.ts.map +0 -1
- package/dest/tagging/siloed_tag.js +0 -20
- package/dest/tagging/tag.d.ts +0 -12
- package/dest/tagging/tag.d.ts.map +0 -1
- package/dest/tagging/tag.js +0 -17
- package/dest/tagging/utils.d.ts +0 -18
- package/dest/tagging/utils.d.ts.map +0 -1
- package/dest/tagging/utils.js +0 -24
- package/src/contract_function_simulator/execution_data_provider.ts +0 -333
- package/src/contract_function_simulator/proxied_node.ts +0 -33
- package/src/contract_function_simulator/pxe_oracle_interface.ts +0 -1008
- package/src/private_kernel/private_kernel_oracle_impl.ts +0 -132
- package/src/storage/address_data_provider/index.ts +0 -1
- package/src/storage/capsule_data_provider/capsule_data_provider.ts +0 -147
- package/src/storage/capsule_data_provider/index.ts +0 -1
- package/src/storage/contract_data_provider/contract_data_provider.ts +0 -277
- package/src/storage/contract_data_provider/index.ts +0 -1
- package/src/storage/note_data_provider/index.ts +0 -2
- package/src/storage/note_data_provider/note_data_provider.ts +0 -399
- package/src/storage/private_event_data_provider/private_event_data_provider.ts +0 -143
- package/src/storage/sync_data_provider/index.ts +0 -1
- package/src/storage/tagging_data_provider/index.ts +0 -1
- package/src/storage/tagging_data_provider/tagging_data_provider.ts +0 -120
- package/src/synchronizer/index.ts +0 -1
- package/src/synchronizer/synchronizer.ts +0 -120
- package/src/tagging/siloed_tag.ts +0 -22
- package/src/tagging/tag.ts +0 -16
- package/src/tagging/utils.ts +0 -31
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { Fr } from '@aztec/foundation/fields';
|
|
2
|
-
import type { AztecAsyncKVStore } from '@aztec/kv-store';
|
|
3
|
-
import type { EventSelector } from '@aztec/stdlib/abi';
|
|
4
|
-
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
5
|
-
import { L2BlockHash } from '@aztec/stdlib/block';
|
|
6
|
-
import { TxHash } from '@aztec/stdlib/tx';
|
|
7
|
-
import type { PrivateEvent } from '../../pxe.js';
|
|
8
|
-
/**
|
|
9
|
-
* Stores decrypted private event logs.
|
|
10
|
-
*/
|
|
11
|
-
export declare class PrivateEventDataProvider {
|
|
12
|
-
#private;
|
|
13
|
-
logger: import("@aztec/foundation/log").Logger;
|
|
14
|
-
constructor(store: AztecAsyncKVStore);
|
|
15
|
-
/**
|
|
16
|
-
* Store a private event log.
|
|
17
|
-
* @param contractAddress - The address of the contract that emitted the event.
|
|
18
|
-
* @param recipient - The recipient of the event.
|
|
19
|
-
* @param eventSelector - The event selector of the event.
|
|
20
|
-
* @param msgContent - The content of the event.
|
|
21
|
-
* @param txHash - The transaction hash of the event log.
|
|
22
|
-
* @param eventCommitmentIndex - The index of the event commitment in the nullifier tree.
|
|
23
|
-
* @param blockNumber - The block number in which the event was emitted.
|
|
24
|
-
*/
|
|
25
|
-
storePrivateEventLog(contractAddress: AztecAddress, recipient: AztecAddress, eventSelector: EventSelector, msgContent: Fr[], txHash: TxHash, eventCommitmentIndex: number, blockNumber: number, blockHash: L2BlockHash): Promise<void>;
|
|
26
|
-
/**
|
|
27
|
-
* Returns the private events given search parameters.
|
|
28
|
-
* @param contractAddress - The address of the contract to get events from.
|
|
29
|
-
* @param from - The block number to search from.
|
|
30
|
-
* @param numBlocks - The amount of blocks to search.
|
|
31
|
-
* @param recipients - The addresses that decrypted the logs.
|
|
32
|
-
* @param eventSelector - The event selector to filter by.
|
|
33
|
-
* @returns - The event log contents.
|
|
34
|
-
*/
|
|
35
|
-
getPrivateEvents(contractAddress: AztecAddress, from: number, numBlocks: number, recipients: AztecAddress[], eventSelector: EventSelector): Promise<PrivateEvent[]>;
|
|
36
|
-
}
|
|
37
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJpdmF0ZV9ldmVudF9kYXRhX3Byb3ZpZGVyLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvc3RvcmFnZS9wcml2YXRlX2V2ZW50X2RhdGFfcHJvdmlkZXIvcHJpdmF0ZV9ldmVudF9kYXRhX3Byb3ZpZGVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxFQUFFLEVBQUUsTUFBTSwwQkFBMEIsQ0FBQztBQUc5QyxPQUFPLEtBQUssRUFBbUIsaUJBQWlCLEVBQWlCLE1BQU0saUJBQWlCLENBQUM7QUFDekYsT0FBTyxLQUFLLEVBQUUsYUFBYSxFQUFFLE1BQU0sbUJBQW1CLENBQUM7QUFDdkQsT0FBTyxLQUFLLEVBQUUsWUFBWSxFQUFFLE1BQU0sNkJBQTZCLENBQUM7QUFDaEUsT0FBTyxFQUFFLFdBQVcsRUFBRSxNQUFNLHFCQUFxQixDQUFDO0FBQ2xELE9BQU8sRUFBRSxNQUFNLEVBQUUsTUFBTSxrQkFBa0IsQ0FBQztBQUUxQyxPQUFPLEtBQUssRUFBRSxZQUFZLEVBQUUsTUFBTSxjQUFjLENBQUM7QUFVakQ7O0dBRUc7QUFDSCxxQkFBYSx3QkFBd0I7O0lBU25DLE1BQU0seUNBQStDO0lBRXJELFlBQVksS0FBSyxFQUFFLGlCQUFpQixFQUtuQztJQUVEOzs7Ozs7Ozs7T0FTRztJQUNILG9CQUFvQixDQUNsQixlQUFlLEVBQUUsWUFBWSxFQUM3QixTQUFTLEVBQUUsWUFBWSxFQUN2QixhQUFhLEVBQUUsYUFBYSxFQUM1QixVQUFVLEVBQUUsRUFBRSxFQUFFLEVBQ2hCLE1BQU0sRUFBRSxNQUFNLEVBQ2Qsb0JBQW9CLEVBQUUsTUFBTSxFQUM1QixXQUFXLEVBQUUsTUFBTSxFQUNuQixTQUFTLEVBQUUsV0FBVyxHQUNyQixPQUFPLENBQUMsSUFBSSxDQUFDLENBNEJmO0lBRUQ7Ozs7Ozs7O09BUUc7SUFDVSxnQkFBZ0IsQ0FDM0IsZUFBZSxFQUFFLFlBQVksRUFDN0IsSUFBSSxFQUFFLE1BQU0sRUFDWixTQUFTLEVBQUUsTUFBTSxFQUNqQixVQUFVLEVBQUUsWUFBWSxFQUFFLEVBQzFCLGFBQWEsRUFBRSxhQUFhLEdBQzNCLE9BQU8sQ0FBQyxZQUFZLEVBQUUsQ0FBQyxDQXFDekI7Q0FDRiJ9
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"private_event_data_provider.d.ts","sourceRoot":"","sources":["../../../src/storage/private_event_data_provider/private_event_data_provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAG9C,OAAO,KAAK,EAAmB,iBAAiB,EAAiB,MAAM,iBAAiB,CAAC;AACzF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE1C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAUjD;;GAEG;AACH,qBAAa,wBAAwB;;IASnC,MAAM,yCAA+C;IAErD,YAAY,KAAK,EAAE,iBAAiB,EAKnC;IAED;;;;;;;;;OASG;IACH,oBAAoB,CAClB,eAAe,EAAE,YAAY,EAC7B,SAAS,EAAE,YAAY,EACvB,aAAa,EAAE,aAAa,EAC5B,UAAU,EAAE,EAAE,EAAE,EAChB,MAAM,EAAE,MAAM,EACd,oBAAoB,EAAE,MAAM,EAC5B,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,WAAW,GACrB,OAAO,CAAC,IAAI,CAAC,CA4Bf;IAED;;;;;;;;OAQG;IACU,gBAAgB,CAC3B,eAAe,EAAE,YAAY,EAC7B,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,YAAY,EAAE,EAC1B,aAAa,EAAE,aAAa,GAC3B,OAAO,CAAC,YAAY,EAAE,CAAC,CAqCzB;CACF"}
|
|
@@ -1,105 +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 { L2BlockHash } from '@aztec/stdlib/block';
|
|
5
|
-
import { TxHash } from '@aztec/stdlib/tx';
|
|
6
|
-
/**
|
|
7
|
-
* Stores decrypted private event logs.
|
|
8
|
-
*/ export class PrivateEventDataProvider {
|
|
9
|
-
#store;
|
|
10
|
-
/** Array storing the actual private event log entries containing the log content and block number */ #eventLogs;
|
|
11
|
-
/** Map from contract_address_recipient_eventSelector to array of indices into #eventLogs for efficient lookup */ #eventLogIndex;
|
|
12
|
-
/** Map from eventCommitmentIndex to boolean indicating if log has been seen. */ #seenLogs;
|
|
13
|
-
logger = createLogger('private_event_data_provider');
|
|
14
|
-
constructor(store){
|
|
15
|
-
this.#store = store;
|
|
16
|
-
this.#eventLogs = this.#store.openArray('private_event_logs');
|
|
17
|
-
this.#eventLogIndex = this.#store.openMap('private_event_log_index');
|
|
18
|
-
this.#seenLogs = this.#store.openMap('seen_logs');
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Store a private event log.
|
|
22
|
-
* @param contractAddress - The address of the contract that emitted the event.
|
|
23
|
-
* @param recipient - The recipient of the event.
|
|
24
|
-
* @param eventSelector - The event selector of the event.
|
|
25
|
-
* @param msgContent - The content of the event.
|
|
26
|
-
* @param txHash - The transaction hash of the event log.
|
|
27
|
-
* @param eventCommitmentIndex - The index of the event commitment in the nullifier tree.
|
|
28
|
-
* @param blockNumber - The block number in which the event was emitted.
|
|
29
|
-
*/ storePrivateEventLog(contractAddress, recipient, eventSelector, msgContent, txHash, eventCommitmentIndex, blockNumber, blockHash) {
|
|
30
|
-
return this.#store.transactionAsync(async ()=>{
|
|
31
|
-
const key = `${contractAddress.toString()}_${recipient.toString()}_${eventSelector.toString()}`;
|
|
32
|
-
// Check if this exact log has already been stored using eventCommitmentIndex as unique identifier
|
|
33
|
-
const hasBeenSeen = await this.#seenLogs.getAsync(eventCommitmentIndex);
|
|
34
|
-
if (hasBeenSeen) {
|
|
35
|
-
this.logger.verbose('Ignoring duplicate event log', {
|
|
36
|
-
txHash: txHash.toString(),
|
|
37
|
-
eventCommitmentIndex
|
|
38
|
-
});
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
this.logger.verbose('storing private event log', {
|
|
42
|
-
contractAddress,
|
|
43
|
-
recipient,
|
|
44
|
-
msgContent,
|
|
45
|
-
blockNumber
|
|
46
|
-
});
|
|
47
|
-
const index = await this.#eventLogs.lengthAsync();
|
|
48
|
-
await this.#eventLogs.push({
|
|
49
|
-
msgContent: serializeToBuffer(msgContent),
|
|
50
|
-
blockNumber,
|
|
51
|
-
blockHash: blockHash.toBuffer(),
|
|
52
|
-
eventCommitmentIndex,
|
|
53
|
-
txHash: txHash.toBuffer()
|
|
54
|
-
});
|
|
55
|
-
const existingIndices = await this.#eventLogIndex.getAsync(key) || [];
|
|
56
|
-
await this.#eventLogIndex.set(key, [
|
|
57
|
-
...existingIndices,
|
|
58
|
-
index
|
|
59
|
-
]);
|
|
60
|
-
// Mark this log as seen using eventCommitmentIndex
|
|
61
|
-
await this.#seenLogs.set(eventCommitmentIndex, true);
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Returns the private events given search parameters.
|
|
66
|
-
* @param contractAddress - The address of the contract to get events from.
|
|
67
|
-
* @param from - The block number to search from.
|
|
68
|
-
* @param numBlocks - The amount of blocks to search.
|
|
69
|
-
* @param recipients - The addresses that decrypted the logs.
|
|
70
|
-
* @param eventSelector - The event selector to filter by.
|
|
71
|
-
* @returns - The event log contents.
|
|
72
|
-
*/ async getPrivateEvents(contractAddress, from, numBlocks, recipients, eventSelector) {
|
|
73
|
-
const events = [];
|
|
74
|
-
for (const recipient of recipients){
|
|
75
|
-
const key = `${contractAddress.toString()}_${recipient.toString()}_${eventSelector.toString()}`;
|
|
76
|
-
const indices = await this.#eventLogIndex.getAsync(key) || [];
|
|
77
|
-
for (const index of indices){
|
|
78
|
-
const entry = await this.#eventLogs.atAsync(index);
|
|
79
|
-
if (!entry || entry.blockNumber < from || entry.blockNumber >= from + numBlocks) {
|
|
80
|
-
continue;
|
|
81
|
-
}
|
|
82
|
-
// Convert buffer back to Fr array
|
|
83
|
-
const reader = BufferReader.asReader(entry.msgContent);
|
|
84
|
-
const numFields = entry.msgContent.length / Fr.SIZE_IN_BYTES;
|
|
85
|
-
const msgContent = reader.readArray(numFields, Fr);
|
|
86
|
-
const txHash = TxHash.fromBuffer(entry.txHash);
|
|
87
|
-
const blockHash = L2BlockHash.fromBuffer(entry.blockHash);
|
|
88
|
-
events.push({
|
|
89
|
-
eventCommitmentIndex: entry.eventCommitmentIndex,
|
|
90
|
-
event: {
|
|
91
|
-
packedEvent: msgContent,
|
|
92
|
-
blockNumber: entry.blockNumber,
|
|
93
|
-
recipient,
|
|
94
|
-
txHash,
|
|
95
|
-
blockHash,
|
|
96
|
-
eventSelector
|
|
97
|
-
}
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
// Sort by eventCommitmentIndex only
|
|
102
|
-
events.sort((a, b)=>a.eventCommitmentIndex - b.eventCommitmentIndex);
|
|
103
|
-
return events.map((ev)=>ev.event);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/storage/sync_data_provider/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { SyncDataProvider } from './sync_data_provider.js';
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { AztecAsyncKVStore } from '@aztec/kv-store';
|
|
2
|
-
import { BlockHeader } from '@aztec/stdlib/tx';
|
|
3
|
-
export declare class SyncDataProvider {
|
|
4
|
-
#private;
|
|
5
|
-
constructor(store: AztecAsyncKVStore);
|
|
6
|
-
setHeader(header: BlockHeader): Promise<void>;
|
|
7
|
-
getBlockNumber(): Promise<number>;
|
|
8
|
-
getBlockHeader(): Promise<BlockHeader>;
|
|
9
|
-
}
|
|
10
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3luY19kYXRhX3Byb3ZpZGVyLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvc3RvcmFnZS9zeW5jX2RhdGFfcHJvdmlkZXIvc3luY19kYXRhX3Byb3ZpZGVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLGlCQUFpQixFQUF1QixNQUFNLGlCQUFpQixDQUFDO0FBQzlFLE9BQU8sRUFBRSxXQUFXLEVBQUUsTUFBTSxrQkFBa0IsQ0FBQztBQUUvQyxxQkFBYSxnQkFBZ0I7O0lBSTNCLFlBQVksS0FBSyxFQUFFLGlCQUFpQixFQUduQztJQUVLLFNBQVMsQ0FBQyxNQUFNLEVBQUUsV0FBVyxHQUFHLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FFbEQ7SUFFSyxjQUFjLElBQUksT0FBTyxDQUFDLE1BQU0sQ0FBQyxDQU90QztJQUVLLGNBQWMsSUFBSSxPQUFPLENBQUMsV0FBVyxDQUFDLENBTzNDO0NBQ0YifQ==
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sync_data_provider.d.ts","sourceRoot":"","sources":["../../../src/storage/sync_data_provider/sync_data_provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAuB,MAAM,iBAAiB,CAAC;AAC9E,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,qBAAa,gBAAgB;;IAI3B,YAAY,KAAK,EAAE,iBAAiB,EAGnC;IAEK,SAAS,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAElD;IAEK,cAAc,IAAI,OAAO,CAAC,MAAM,CAAC,CAOtC;IAEK,cAAc,IAAI,OAAO,CAAC,WAAW,CAAC,CAO3C;CACF"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
export { TaggingDataProvider } from './tagging_data_provider.js';
|
|
2
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9zdG9yYWdlL3RhZ2dpbmdfZGF0YV9wcm92aWRlci9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsbUJBQW1CLEVBQUUsTUFBTSw0QkFBNEIsQ0FBQyJ9
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/storage/tagging_data_provider/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { TaggingDataProvider } from './tagging_data_provider.js';
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import type { AztecAsyncKVStore } from '@aztec/kv-store';
|
|
2
|
-
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
3
|
-
import type { DirectionalAppTaggingSecret, PreTag } from '@aztec/stdlib/logs';
|
|
4
|
-
export declare class TaggingDataProvider {
|
|
5
|
-
#private;
|
|
6
|
-
constructor(store: AztecAsyncKVStore);
|
|
7
|
-
/**
|
|
8
|
-
* Sets the last used indexes when sending a log.
|
|
9
|
-
* @param preTags - The pre tags containing the directional app tagging secrets and the indexes that are to be
|
|
10
|
-
* updated in the db.
|
|
11
|
-
* @throws If any two pre tags contain the same directional app tagging secret
|
|
12
|
-
*/
|
|
13
|
-
setLastUsedIndexesAsSender(preTags: PreTag[]): Promise<void[]>;
|
|
14
|
-
/**
|
|
15
|
-
* Sets the last used indexes when looking for logs.
|
|
16
|
-
* @param preTags - The pre tags containing the directional app tagging secrets and the indexes that are to be
|
|
17
|
-
* updated in the db.
|
|
18
|
-
* @throws If any two pre tags contain the same directional app tagging secret
|
|
19
|
-
*/
|
|
20
|
-
setLastUsedIndexesAsRecipient(preTags: PreTag[]): Promise<void[]>;
|
|
21
|
-
/**
|
|
22
|
-
* Returns the last used index when sending a log with a given secret.
|
|
23
|
-
* @param secret - The directional app tagging secret.
|
|
24
|
-
* @returns The last used index for the given directional app tagging secret, or undefined if not found.
|
|
25
|
-
*/
|
|
26
|
-
getLastUsedIndexesAsSender(secret: DirectionalAppTaggingSecret): Promise<number | undefined>;
|
|
27
|
-
/**
|
|
28
|
-
* Returns the last used indexes when looking for logs as a recipient.
|
|
29
|
-
* @param secrets - The directional app tagging secrets to obtain the indexes for.
|
|
30
|
-
* @returns The last used indexes for the given directional app tagging secrets, or undefined if have never yet found
|
|
31
|
-
* a log for a given secret.
|
|
32
|
-
*/
|
|
33
|
-
getLastUsedIndexesAsRecipient(secrets: DirectionalAppTaggingSecret[]): Promise<(number | undefined)[]>;
|
|
34
|
-
resetNoteSyncData(): Promise<void>;
|
|
35
|
-
addSenderAddress(address: AztecAddress): Promise<boolean>;
|
|
36
|
-
getSenderAddresses(): Promise<AztecAddress[]>;
|
|
37
|
-
removeSenderAddress(address: AztecAddress): Promise<boolean>;
|
|
38
|
-
getSize(): Promise<number>;
|
|
39
|
-
}
|
|
40
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGFnZ2luZ19kYXRhX3Byb3ZpZGVyLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvc3RvcmFnZS90YWdnaW5nX2RhdGFfcHJvdmlkZXIvdGFnZ2luZ19kYXRhX3Byb3ZpZGVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUNBLE9BQU8sS0FBSyxFQUFFLGlCQUFpQixFQUFpQixNQUFNLGlCQUFpQixDQUFDO0FBQ3hFLE9BQU8sRUFBRSxZQUFZLEVBQUUsTUFBTSw2QkFBNkIsQ0FBQztBQUMzRCxPQUFPLEtBQUssRUFBRSwyQkFBMkIsRUFBRSxNQUFNLEVBQUUsTUFBTSxvQkFBb0IsQ0FBQztBQUU5RSxxQkFBYSxtQkFBbUI7O0lBUzlCLFlBQVksS0FBSyxFQUFFLGlCQUFpQixFQU9uQztJQUVEOzs7OztPQUtHO0lBQ0gsMEJBQTBCLENBQUMsT0FBTyxFQUFFLE1BQU0sRUFBRSxtQkFNM0M7SUFFRDs7Ozs7T0FLRztJQUNILDZCQUE2QixDQUFDLE9BQU8sRUFBRSxNQUFNLEVBQUUsbUJBTTlDO0lBYUQ7Ozs7T0FJRztJQUNHLDBCQUEwQixDQUFDLE1BQU0sRUFBRSwyQkFBMkIsR0FBRyxPQUFPLENBQUMsTUFBTSxHQUFHLFNBQVMsQ0FBQyxDQUVqRztJQUVEOzs7OztPQUtHO0lBQ0gsNkJBQTZCLENBQUMsT0FBTyxFQUFFLDJCQUEyQixFQUFFLEdBQUcsT0FBTyxDQUFDLENBQUMsTUFBTSxHQUFHLFNBQVMsQ0FBQyxFQUFFLENBQUMsQ0FFckc7SUFFRCxpQkFBaUIsSUFBSSxPQUFPLENBQUMsSUFBSSxDQUFDLENBT2pDO0lBRUssZ0JBQWdCLENBQUMsT0FBTyxFQUFFLFlBQVksR0FBRyxPQUFPLENBQUMsT0FBTyxDQUFDLENBUTlEO0lBRUssa0JBQWtCLElBQUksT0FBTyxDQUFDLFlBQVksRUFBRSxDQUFDLENBRWxEO0lBRUssbUJBQW1CLENBQUMsT0FBTyxFQUFFLFlBQVksR0FBRyxPQUFPLENBQUMsT0FBTyxDQUFDLENBUWpFO0lBRUssT0FBTyxvQkFJWjtDQUNGIn0=
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tagging_data_provider.d.ts","sourceRoot":"","sources":["../../../src/storage/tagging_data_provider/tagging_data_provider.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAiB,MAAM,iBAAiB,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE9E,qBAAa,mBAAmB;;IAS9B,YAAY,KAAK,EAAE,iBAAiB,EAOnC;IAED;;;;;OAKG;IACH,0BAA0B,CAAC,OAAO,EAAE,MAAM,EAAE,mBAM3C;IAED;;;;;OAKG;IACH,6BAA6B,CAAC,OAAO,EAAE,MAAM,EAAE,mBAM9C;IAaD;;;;OAIG;IACG,0BAA0B,CAAC,MAAM,EAAE,2BAA2B,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAEjG;IAED;;;;;OAKG;IACH,6BAA6B,CAAC,OAAO,EAAE,2BAA2B,EAAE,GAAG,OAAO,CAAC,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,CAAC,CAErG;IAED,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC,CAOjC;IAEK,gBAAgB,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC,CAQ9D;IAEK,kBAAkB,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC,CAElD;IAEK,mBAAmB,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC,CAQjE;IAEK,OAAO,oBAIZ;CACF"}
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import { toArray } from '@aztec/foundation/iterable';
|
|
2
|
-
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
3
|
-
export class TaggingDataProvider {
|
|
4
|
-
#store;
|
|
5
|
-
#addressBook;
|
|
6
|
-
// Stores the last used index for each directional app tagging secret. Taking into account whether we are
|
|
7
|
-
// requesting the index as a sender or as a recipient because the sender and recipient can be in the same PXE.
|
|
8
|
-
#lastUsedIndexesAsSenders;
|
|
9
|
-
#lastUsedIndexesAsRecipients;
|
|
10
|
-
constructor(store){
|
|
11
|
-
this.#store = store;
|
|
12
|
-
this.#addressBook = this.#store.openMap('address_book');
|
|
13
|
-
this.#lastUsedIndexesAsSenders = this.#store.openMap('last_used_indexes_as_senders');
|
|
14
|
-
this.#lastUsedIndexesAsRecipients = this.#store.openMap('last_used_indexes_as_recipients');
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Sets the last used indexes when sending a log.
|
|
18
|
-
* @param preTags - The pre tags containing the directional app tagging secrets and the indexes that are to be
|
|
19
|
-
* updated in the db.
|
|
20
|
-
* @throws If any two pre tags contain the same directional app tagging secret
|
|
21
|
-
*/ setLastUsedIndexesAsSender(preTags) {
|
|
22
|
-
this.#assertUniqueSecrets(preTags, 'sender');
|
|
23
|
-
return Promise.all(preTags.map(({ secret, index })=>this.#lastUsedIndexesAsSenders.set(secret.toString(), index)));
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Sets the last used indexes when looking for logs.
|
|
27
|
-
* @param preTags - The pre tags containing the directional app tagging secrets and the indexes that are to be
|
|
28
|
-
* updated in the db.
|
|
29
|
-
* @throws If any two pre tags contain the same directional app tagging secret
|
|
30
|
-
*/ setLastUsedIndexesAsRecipient(preTags) {
|
|
31
|
-
this.#assertUniqueSecrets(preTags, 'recipient');
|
|
32
|
-
return Promise.all(preTags.map(({ secret, index })=>this.#lastUsedIndexesAsRecipients.set(secret.toString(), index)));
|
|
33
|
-
}
|
|
34
|
-
// It should never happen that we would receive any two pre tags on the input containing the same directional app
|
|
35
|
-
// tagging secret as everywhere we always just apply the largest index. Hence this check is a good way to catch
|
|
36
|
-
// bugs.
|
|
37
|
-
#assertUniqueSecrets(preTags, role) {
|
|
38
|
-
const secretStrings = preTags.map(({ secret })=>secret.toString());
|
|
39
|
-
const uniqueSecrets = new Set(secretStrings);
|
|
40
|
-
if (uniqueSecrets.size !== secretStrings.length) {
|
|
41
|
-
throw new Error(`Duplicate secrets found when setting last used indexes as ${role}`);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Returns the last used index when sending a log with a given secret.
|
|
46
|
-
* @param secret - The directional app tagging secret.
|
|
47
|
-
* @returns The last used index for the given directional app tagging secret, or undefined if not found.
|
|
48
|
-
*/ async getLastUsedIndexesAsSender(secret) {
|
|
49
|
-
return await this.#lastUsedIndexesAsSenders.getAsync(secret.toString());
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Returns the last used indexes when looking for logs as a recipient.
|
|
53
|
-
* @param secrets - The directional app tagging secrets to obtain the indexes for.
|
|
54
|
-
* @returns The last used indexes for the given directional app tagging secrets, or undefined if have never yet found
|
|
55
|
-
* a log for a given secret.
|
|
56
|
-
*/ getLastUsedIndexesAsRecipient(secrets) {
|
|
57
|
-
return Promise.all(secrets.map((secret)=>this.#lastUsedIndexesAsRecipients.getAsync(secret.toString())));
|
|
58
|
-
}
|
|
59
|
-
resetNoteSyncData() {
|
|
60
|
-
return this.#store.transactionAsync(async ()=>{
|
|
61
|
-
const keysForSenders = await toArray(this.#lastUsedIndexesAsSenders.keysAsync());
|
|
62
|
-
await Promise.all(keysForSenders.map((secret)=>this.#lastUsedIndexesAsSenders.delete(secret)));
|
|
63
|
-
const keysForRecipients = await toArray(this.#lastUsedIndexesAsRecipients.keysAsync());
|
|
64
|
-
await Promise.all(keysForRecipients.map((secret)=>this.#lastUsedIndexesAsRecipients.delete(secret)));
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
async addSenderAddress(address) {
|
|
68
|
-
if (await this.#addressBook.hasAsync(address.toString())) {
|
|
69
|
-
return false;
|
|
70
|
-
}
|
|
71
|
-
await this.#addressBook.set(address.toString(), true);
|
|
72
|
-
return true;
|
|
73
|
-
}
|
|
74
|
-
async getSenderAddresses() {
|
|
75
|
-
return (await toArray(this.#addressBook.keysAsync())).map(AztecAddress.fromString);
|
|
76
|
-
}
|
|
77
|
-
async removeSenderAddress(address) {
|
|
78
|
-
if (!await this.#addressBook.hasAsync(address.toString())) {
|
|
79
|
-
return false;
|
|
80
|
-
}
|
|
81
|
-
await this.#addressBook.delete(address.toString());
|
|
82
|
-
return true;
|
|
83
|
-
}
|
|
84
|
-
async getSize() {
|
|
85
|
-
const addressesCount = (await toArray(this.#addressBook.keysAsync())).length;
|
|
86
|
-
// All keys are addresses
|
|
87
|
-
return 3 * addressesCount * AztecAddress.SIZE_IN_BYTES;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/synchronizer/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './synchronizer.js';
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { type Logger } from '@aztec/foundation/log';
|
|
2
|
-
import type { L2TipsKVStore } from '@aztec/kv-store/stores';
|
|
3
|
-
import { L2BlockStream, type L2BlockStreamEvent, type L2BlockStreamEventHandler } from '@aztec/stdlib/block';
|
|
4
|
-
import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
5
|
-
import type { PXEConfig } from '../config/index.js';
|
|
6
|
-
import type { NoteDataProvider } from '../storage/note_data_provider/note_data_provider.js';
|
|
7
|
-
import type { SyncDataProvider } from '../storage/sync_data_provider/sync_data_provider.js';
|
|
8
|
-
import type { TaggingDataProvider } from '../storage/tagging_data_provider/tagging_data_provider.js';
|
|
9
|
-
/**
|
|
10
|
-
* The Synchronizer class orchestrates synchronization between the PXE and Aztec node, maintaining an up-to-date
|
|
11
|
-
* view of the L2 chain state. It handles block header retrieval, chain reorganizations, and provides an interface
|
|
12
|
-
* for querying sync status.
|
|
13
|
-
*/
|
|
14
|
-
export declare class Synchronizer implements L2BlockStreamEventHandler {
|
|
15
|
-
private node;
|
|
16
|
-
private syncDataProvider;
|
|
17
|
-
private noteDataProvider;
|
|
18
|
-
private taggingDataProvider;
|
|
19
|
-
private l2TipsStore;
|
|
20
|
-
private log;
|
|
21
|
-
private isSyncing;
|
|
22
|
-
protected readonly blockStream: L2BlockStream;
|
|
23
|
-
constructor(node: AztecNode, syncDataProvider: SyncDataProvider, noteDataProvider: NoteDataProvider, taggingDataProvider: TaggingDataProvider, l2TipsStore: L2TipsKVStore, config?: Partial<Pick<PXEConfig, 'l2BlockBatchSize'>>, loggerOrSuffix?: string | Logger);
|
|
24
|
-
protected createBlockStream(config: Partial<Pick<PXEConfig, 'l2BlockBatchSize'>>): L2BlockStream;
|
|
25
|
-
/** Handle events emitted by the block stream. */
|
|
26
|
-
handleBlockStreamEvent(event: L2BlockStreamEvent): Promise<void>;
|
|
27
|
-
/**
|
|
28
|
-
* Syncs PXE and the node by downloading the metadata of the latest blocks, allowing simulations to use
|
|
29
|
-
* recent data (e.g. notes), and handling any reorgs that might have occurred.
|
|
30
|
-
*/
|
|
31
|
-
sync(): Promise<void>;
|
|
32
|
-
private doSync;
|
|
33
|
-
getSynchedBlockNumber(): Promise<number>;
|
|
34
|
-
}
|
|
35
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3luY2hyb25pemVyLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvc3luY2hyb25pemVyL3N5bmNocm9uaXplci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsS0FBSyxNQUFNLEVBQWdCLE1BQU0sdUJBQXVCLENBQUM7QUFDbEUsT0FBTyxLQUFLLEVBQUUsYUFBYSxFQUFFLE1BQU0sd0JBQXdCLENBQUM7QUFDNUQsT0FBTyxFQUFFLGFBQWEsRUFBRSxLQUFLLGtCQUFrQixFQUFFLEtBQUsseUJBQXlCLEVBQUUsTUFBTSxxQkFBcUIsQ0FBQztBQUM3RyxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUVqRSxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsTUFBTSxvQkFBb0IsQ0FBQztBQUNwRCxPQUFPLEtBQUssRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLHFEQUFxRCxDQUFDO0FBQzVGLE9BQU8sS0FBSyxFQUFFLGdCQUFnQixFQUFFLE1BQU0scURBQXFELENBQUM7QUFDNUYsT0FBTyxLQUFLLEVBQUUsbUJBQW1CLEVBQUUsTUFBTSwyREFBMkQsQ0FBQztBQUVyRzs7OztHQUlHO0FBQ0gscUJBQWEsWUFBYSxZQUFXLHlCQUF5QjtJQU0xRCxPQUFPLENBQUMsSUFBSTtJQUNaLE9BQU8sQ0FBQyxnQkFBZ0I7SUFDeEIsT0FBTyxDQUFDLGdCQUFnQjtJQUN4QixPQUFPLENBQUMsbUJBQW1CO0lBQzNCLE9BQU8sQ0FBQyxXQUFXO0lBVHJCLE9BQU8sQ0FBQyxHQUFHLENBQVM7SUFDcEIsT0FBTyxDQUFDLFNBQVMsQ0FBNEI7SUFDN0MsU0FBUyxDQUFDLFFBQVEsQ0FBQyxXQUFXLEVBQUUsYUFBYSxDQUFDO0lBRTlDLFlBQ1UsSUFBSSxFQUFFLFNBQVMsRUFDZixnQkFBZ0IsRUFBRSxnQkFBZ0IsRUFDbEMsZ0JBQWdCLEVBQUUsZ0JBQWdCLEVBQ2xDLG1CQUFtQixFQUFFLG1CQUFtQixFQUN4QyxXQUFXLEVBQUUsYUFBYSxFQUNsQyxNQUFNLEdBQUUsT0FBTyxDQUFDLElBQUksQ0FBQyxTQUFTLEVBQUUsa0JBQWtCLENBQUMsQ0FBTSxFQUN6RCxjQUFjLENBQUMsRUFBRSxNQUFNLEdBQUcsTUFBTSxFQU9qQztJQUVELFNBQVMsQ0FBQyxpQkFBaUIsQ0FBQyxNQUFNLEVBQUUsT0FBTyxDQUFDLElBQUksQ0FBQyxTQUFTLEVBQUUsa0JBQWtCLENBQUMsQ0FBQyxpQkFPL0U7SUFFRCxpREFBaUQ7SUFDcEMsc0JBQXNCLENBQUMsS0FBSyxFQUFFLGtCQUFrQixHQUFHLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FnQzVFO0lBRUQ7OztPQUdHO0lBQ1UsSUFBSSxrQkFlaEI7WUFFYSxNQUFNO0lBZWIscUJBQXFCLG9CQUUzQjtDQUNGIn0=
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"synchronizer.d.ts","sourceRoot":"","sources":["../../src/synchronizer/synchronizer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,uBAAuB,CAAC;AAClE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,KAAK,kBAAkB,EAAE,KAAK,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAC7G,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAEjE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qDAAqD,CAAC;AAC5F,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qDAAqD,CAAC;AAC5F,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2DAA2D,CAAC;AAErG;;;;GAIG;AACH,qBAAa,YAAa,YAAW,yBAAyB;IAM1D,OAAO,CAAC,IAAI;IACZ,OAAO,CAAC,gBAAgB;IACxB,OAAO,CAAC,gBAAgB;IACxB,OAAO,CAAC,mBAAmB;IAC3B,OAAO,CAAC,WAAW;IATrB,OAAO,CAAC,GAAG,CAAS;IACpB,OAAO,CAAC,SAAS,CAA4B;IAC7C,SAAS,CAAC,QAAQ,CAAC,WAAW,EAAE,aAAa,CAAC;IAE9C,YACU,IAAI,EAAE,SAAS,EACf,gBAAgB,EAAE,gBAAgB,EAClC,gBAAgB,EAAE,gBAAgB,EAClC,mBAAmB,EAAE,mBAAmB,EACxC,WAAW,EAAE,aAAa,EAClC,MAAM,GAAE,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,kBAAkB,CAAC,CAAM,EACzD,cAAc,CAAC,EAAE,MAAM,GAAG,MAAM,EAOjC;IAED,SAAS,CAAC,iBAAiB,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,kBAAkB,CAAC,CAAC,iBAO/E;IAED,iDAAiD;IACpC,sBAAsB,CAAC,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CAgC5E;IAED;;;OAGG;IACU,IAAI,kBAehB;YAEa,MAAM;IAeb,qBAAqB,oBAE3B;CACF"}
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import { createLogger } from '@aztec/foundation/log';
|
|
2
|
-
import { L2BlockStream } from '@aztec/stdlib/block';
|
|
3
|
-
/**
|
|
4
|
-
* The Synchronizer class orchestrates synchronization between the PXE and Aztec node, maintaining an up-to-date
|
|
5
|
-
* view of the L2 chain state. It handles block header retrieval, chain reorganizations, and provides an interface
|
|
6
|
-
* for querying sync status.
|
|
7
|
-
*/ export class Synchronizer {
|
|
8
|
-
node;
|
|
9
|
-
syncDataProvider;
|
|
10
|
-
noteDataProvider;
|
|
11
|
-
taggingDataProvider;
|
|
12
|
-
l2TipsStore;
|
|
13
|
-
log;
|
|
14
|
-
isSyncing;
|
|
15
|
-
blockStream;
|
|
16
|
-
constructor(node, syncDataProvider, noteDataProvider, taggingDataProvider, l2TipsStore, config = {}, loggerOrSuffix){
|
|
17
|
-
this.node = node;
|
|
18
|
-
this.syncDataProvider = syncDataProvider;
|
|
19
|
-
this.noteDataProvider = noteDataProvider;
|
|
20
|
-
this.taggingDataProvider = taggingDataProvider;
|
|
21
|
-
this.l2TipsStore = l2TipsStore;
|
|
22
|
-
this.log = !loggerOrSuffix || typeof loggerOrSuffix === 'string' ? createLogger(loggerOrSuffix ? `pxe:synchronizer:${loggerOrSuffix}` : `pxe:synchronizer`) : loggerOrSuffix;
|
|
23
|
-
this.blockStream = this.createBlockStream(config);
|
|
24
|
-
}
|
|
25
|
-
createBlockStream(config) {
|
|
26
|
-
return new L2BlockStream(this.node, this.l2TipsStore, this, createLogger('pxe:block_stream'), {
|
|
27
|
-
batchSize: config.l2BlockBatchSize,
|
|
28
|
-
// Skipping finalized blocks makes us sync much faster - we only need to download blocks other than the latest one
|
|
29
|
-
// in order to detect reorgs, and there can be no reorgs on finalized block, making this safe.
|
|
30
|
-
skipFinalized: true
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
/** Handle events emitted by the block stream. */ async handleBlockStreamEvent(event) {
|
|
34
|
-
await this.l2TipsStore.handleBlockStreamEvent(event);
|
|
35
|
-
switch(event.type){
|
|
36
|
-
case 'blocks-added':
|
|
37
|
-
{
|
|
38
|
-
const lastBlock = event.blocks.at(-1).block;
|
|
39
|
-
this.log.verbose(`Updated pxe last block to ${lastBlock.number}`, {
|
|
40
|
-
blockHash: lastBlock.hash(),
|
|
41
|
-
archive: lastBlock.archive.root.toString(),
|
|
42
|
-
header: lastBlock.header.toInspect()
|
|
43
|
-
});
|
|
44
|
-
await this.syncDataProvider.setHeader(lastBlock.getBlockHeader());
|
|
45
|
-
break;
|
|
46
|
-
}
|
|
47
|
-
case 'chain-pruned':
|
|
48
|
-
{
|
|
49
|
-
this.log.warn(`Pruning data after block ${event.block.number} due to reorg`);
|
|
50
|
-
// We first unnullify and then remove so that unnullified notes that were created after the block number end up deleted.
|
|
51
|
-
const lastSynchedBlockNumber = await this.syncDataProvider.getBlockNumber();
|
|
52
|
-
await this.noteDataProvider.rollbackNotesAndNullifiers(event.block.number, lastSynchedBlockNumber);
|
|
53
|
-
// Remove all note tagging indexes to force a full resync. This is suboptimal, but unless we track the
|
|
54
|
-
// block number in which each index is used it's all we can do.
|
|
55
|
-
await this.taggingDataProvider.resetNoteSyncData();
|
|
56
|
-
// Update the header to the last block.
|
|
57
|
-
const newHeader = await this.node.getBlockHeader(event.block.number);
|
|
58
|
-
if (!newHeader) {
|
|
59
|
-
this.log.error(`Block header not found for block number ${event.block.number} during chain prune`);
|
|
60
|
-
} else {
|
|
61
|
-
await this.syncDataProvider.setHeader(newHeader);
|
|
62
|
-
}
|
|
63
|
-
break;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Syncs PXE and the node by downloading the metadata of the latest blocks, allowing simulations to use
|
|
69
|
-
* recent data (e.g. notes), and handling any reorgs that might have occurred.
|
|
70
|
-
*/ async sync() {
|
|
71
|
-
if (this.isSyncing !== undefined) {
|
|
72
|
-
this.log.debug(`Waiting for the ongoing sync to finish`);
|
|
73
|
-
await this.isSyncing;
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
this.log.debug(`Syncing PXE with the node`);
|
|
77
|
-
const isSyncing = this.doSync();
|
|
78
|
-
this.isSyncing = isSyncing;
|
|
79
|
-
try {
|
|
80
|
-
await isSyncing;
|
|
81
|
-
} finally{
|
|
82
|
-
this.isSyncing = undefined;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
async doSync() {
|
|
86
|
-
let currentHeader;
|
|
87
|
-
try {
|
|
88
|
-
currentHeader = await this.syncDataProvider.getBlockHeader();
|
|
89
|
-
} catch {
|
|
90
|
-
this.log.debug('Header is not set, requesting from the node');
|
|
91
|
-
}
|
|
92
|
-
if (!currentHeader) {
|
|
93
|
-
// REFACTOR: We should know the header of the genesis block without having to request it from the node.
|
|
94
|
-
await this.syncDataProvider.setHeader(await this.node.getBlockHeader(0));
|
|
95
|
-
}
|
|
96
|
-
await this.blockStream.sync();
|
|
97
|
-
}
|
|
98
|
-
getSynchedBlockNumber() {
|
|
99
|
-
return this.syncDataProvider.getBlockNumber();
|
|
100
|
-
}
|
|
101
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { Fr } from '@aztec/foundation/fields';
|
|
2
|
-
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
3
|
-
import type { Tag } from './tag.js';
|
|
4
|
-
/**
|
|
5
|
-
* Represents a tag used in private log as it "appears on the chain" - that is the tag is siloed with a contract
|
|
6
|
-
* address that emitted the log.
|
|
7
|
-
*/
|
|
8
|
-
export declare class SiloedTag {
|
|
9
|
-
readonly value: Fr;
|
|
10
|
-
private constructor();
|
|
11
|
-
static compute(tag: Tag, app: AztecAddress): Promise<SiloedTag>;
|
|
12
|
-
toString(): string;
|
|
13
|
-
}
|
|
14
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2lsb2VkX3RhZy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3RhZ2dpbmcvc2lsb2VkX3RhZy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFDQSxPQUFPLEtBQUssRUFBRSxFQUFFLEVBQUUsTUFBTSwwQkFBMEIsQ0FBQztBQUNuRCxPQUFPLEtBQUssRUFBRSxZQUFZLEVBQUUsTUFBTSw2QkFBNkIsQ0FBQztBQUVoRSxPQUFPLEtBQUssRUFBRSxHQUFHLEVBQUUsTUFBTSxVQUFVLENBQUM7QUFFcEM7OztHQUdHO0FBQ0gscUJBQWEsU0FBUzthQUNnQixLQUFLLEVBQUUsRUFBRTtJQUE3QyxPQUFPLGVBQTBDO0lBRWpELE9BQWEsT0FBTyxDQUFDLEdBQUcsRUFBRSxHQUFHLEVBQUUsR0FBRyxFQUFFLFlBQVksR0FBRyxPQUFPLENBQUMsU0FBUyxDQUFDLENBR3BFO0lBRUQsUUFBUSxJQUFJLE1BQU0sQ0FFakI7Q0FDRiJ9
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"siloed_tag.d.ts","sourceRoot":"","sources":["../../src/tagging/siloed_tag.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAEhE,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAEpC;;;GAGG;AACH,qBAAa,SAAS;aACgB,KAAK,EAAE,EAAE;IAA7C,OAAO,eAA0C;IAEjD,OAAa,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,YAAY,GAAG,OAAO,CAAC,SAAS,CAAC,CAGpE;IAED,QAAQ,IAAI,MAAM,CAEjB;CACF"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { poseidon2Hash } from '@aztec/foundation/crypto';
|
|
2
|
-
/**
|
|
3
|
-
* Represents a tag used in private log as it "appears on the chain" - that is the tag is siloed with a contract
|
|
4
|
-
* address that emitted the log.
|
|
5
|
-
*/ export class SiloedTag {
|
|
6
|
-
value;
|
|
7
|
-
constructor(value){
|
|
8
|
-
this.value = value;
|
|
9
|
-
}
|
|
10
|
-
static async compute(tag, app) {
|
|
11
|
-
const siloedTag = await poseidon2Hash([
|
|
12
|
-
app,
|
|
13
|
-
tag.value
|
|
14
|
-
]);
|
|
15
|
-
return new SiloedTag(siloedTag);
|
|
16
|
-
}
|
|
17
|
-
toString() {
|
|
18
|
-
return this.value.toString();
|
|
19
|
-
}
|
|
20
|
-
}
|
package/dest/tagging/tag.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { Fr } from '@aztec/foundation/fields';
|
|
2
|
-
import type { PreTag } from '@aztec/stdlib/logs';
|
|
3
|
-
/**
|
|
4
|
-
* Represents a tag of a private log. This is not the tag that "appears" on the chain as this tag is first siloed
|
|
5
|
-
* with a contract address by kernels before being included in the final log.
|
|
6
|
-
*/
|
|
7
|
-
export declare class Tag {
|
|
8
|
-
readonly value: Fr;
|
|
9
|
-
private constructor();
|
|
10
|
-
static compute(preTag: PreTag): Promise<Tag>;
|
|
11
|
-
}
|
|
12
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGFnLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdGFnZ2luZy90YWcudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQ0EsT0FBTyxLQUFLLEVBQUUsRUFBRSxFQUFFLE1BQU0sMEJBQTBCLENBQUM7QUFDbkQsT0FBTyxLQUFLLEVBQUUsTUFBTSxFQUFFLE1BQU0sb0JBQW9CLENBQUM7QUFFakQ7OztHQUdHO0FBQ0gscUJBQWEsR0FBRzthQUNzQixLQUFLLEVBQUUsRUFBRTtJQUE3QyxPQUFPLGVBQTBDO0lBRWpELE9BQWEsT0FBTyxDQUFDLE1BQU0sRUFBRSxNQUFNLEdBQUcsT0FBTyxDQUFDLEdBQUcsQ0FBQyxDQUdqRDtDQUNGIn0=
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tag.d.ts","sourceRoot":"","sources":["../../src/tagging/tag.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD;;;GAGG;AACH,qBAAa,GAAG;aACsB,KAAK,EAAE,EAAE;IAA7C,OAAO,eAA0C;IAEjD,OAAa,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,CAGjD;CACF"}
|
package/dest/tagging/tag.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { poseidon2Hash } from '@aztec/foundation/crypto';
|
|
2
|
-
/**
|
|
3
|
-
* Represents a tag of a private log. This is not the tag that "appears" on the chain as this tag is first siloed
|
|
4
|
-
* with a contract address by kernels before being included in the final log.
|
|
5
|
-
*/ export class Tag {
|
|
6
|
-
value;
|
|
7
|
-
constructor(value){
|
|
8
|
-
this.value = value;
|
|
9
|
-
}
|
|
10
|
-
static async compute(preTag) {
|
|
11
|
-
const tag = await poseidon2Hash([
|
|
12
|
-
preTag.secret.value,
|
|
13
|
-
preTag.index
|
|
14
|
-
]);
|
|
15
|
-
return new Tag(tag);
|
|
16
|
-
}
|
|
17
|
-
}
|
package/dest/tagging/utils.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { DirectionalAppTaggingSecret, PreTag } from '@aztec/stdlib/logs';
|
|
2
|
-
export declare function getPreTagsForTheWindow(secretsAndWindows: {
|
|
3
|
-
secret: DirectionalAppTaggingSecret;
|
|
4
|
-
leftMostIndex: number;
|
|
5
|
-
rightMostIndex: number;
|
|
6
|
-
}[]): PreTag[];
|
|
7
|
-
/**
|
|
8
|
-
* Creates a map from directional app tagging secret to initial index.
|
|
9
|
-
* @param preTags - The pre tags to get the initial indexes map from.
|
|
10
|
-
* @returns The map from directional app tagging secret to initial index.
|
|
11
|
-
*/
|
|
12
|
-
export declare function getInitialIndexesMap(preTags: {
|
|
13
|
-
secret: DirectionalAppTaggingSecret;
|
|
14
|
-
index: number | undefined;
|
|
15
|
-
}[]): {
|
|
16
|
-
[k: string]: number;
|
|
17
|
-
};
|
|
18
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXRpbHMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy90YWdnaW5nL3V0aWxzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLDJCQUEyQixFQUFFLE1BQU0sRUFBRSxNQUFNLG9CQUFvQixDQUFDO0FBRzlFLHdCQUFnQixzQkFBc0IsQ0FDcEMsaUJBQWlCLEVBQUU7SUFBRSxNQUFNLEVBQUUsMkJBQTJCLENBQUM7SUFBQyxhQUFhLEVBQUUsTUFBTSxDQUFDO0lBQUMsY0FBYyxFQUFFLE1BQU0sQ0FBQTtDQUFFLEVBQUUsR0FDMUcsTUFBTSxFQUFFLENBUVY7QUFFRDs7OztHQUlHO0FBQ0gsd0JBQWdCLG9CQUFvQixDQUFDLE9BQU8sRUFBRTtJQUFFLE1BQU0sRUFBRSwyQkFBMkIsQ0FBQztJQUFDLEtBQUssRUFBRSxNQUFNLEdBQUcsU0FBUyxDQUFBO0NBQUUsRUFBRSxHQUFHO0lBQ25ILENBQUMsQ0FBQyxFQUFFLE1BQU0sR0FBRyxNQUFNLENBQUM7Q0FDckIsQ0FRQSJ9
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/tagging/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAG9E,wBAAgB,sBAAsB,CACpC,iBAAiB,EAAE;IAAE,MAAM,EAAE,2BAA2B,CAAC;IAAC,aAAa,EAAE,MAAM,CAAC;IAAC,cAAc,EAAE,MAAM,CAAA;CAAE,EAAE,GAC1G,MAAM,EAAE,CAQV;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE;IAAE,MAAM,EAAE,2BAA2B,CAAC;IAAC,KAAK,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,EAAE,GAAG;IACnH,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACrB,CAQA"}
|
package/dest/tagging/utils.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
// TODO(benesjan): Make this return tags instead - this will moves some complexity from syncTaggedLogs
|
|
2
|
-
export function getPreTagsForTheWindow(secretsAndWindows) {
|
|
3
|
-
const secrets = [];
|
|
4
|
-
for (const secretAndWindow of secretsAndWindows){
|
|
5
|
-
for(let i = secretAndWindow.leftMostIndex; i <= secretAndWindow.rightMostIndex; i++){
|
|
6
|
-
secrets.push({
|
|
7
|
-
secret: secretAndWindow.secret,
|
|
8
|
-
index: i
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
return secrets;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Creates a map from directional app tagging secret to initial index.
|
|
16
|
-
* @param preTags - The pre tags to get the initial indexes map from.
|
|
17
|
-
* @returns The map from directional app tagging secret to initial index.
|
|
18
|
-
*/ export function getInitialIndexesMap(preTags) {
|
|
19
|
-
const initialIndexes = {};
|
|
20
|
-
for (const preTag of preTags){
|
|
21
|
-
initialIndexes[preTag.secret.toString()] = preTag.index ?? 0;
|
|
22
|
-
}
|
|
23
|
-
return initialIndexes;
|
|
24
|
-
}
|