@aztec/pxe 0.0.1-commit.03f7ef2 → 0.0.1-commit.0b941701
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/bin/check_oracle_version.js +1 -1
- package/dest/block_synchronizer/block_synchronizer.d.ts +14 -10
- package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -1
- package/dest/block_synchronizer/block_synchronizer.js +72 -32
- package/dest/config/index.d.ts +3 -1
- 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 +28 -27
- package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.js +56 -40
- package/dest/contract_function_simulator/execution_note_cache.d.ts +18 -9
- package/dest/contract_function_simulator/execution_note_cache.d.ts.map +1 -1
- package/dest/contract_function_simulator/execution_note_cache.js +45 -28
- 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 +4 -3
- 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 +6 -3
- package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +1 -1
- package/dest/contract_function_simulator/noir-structs/note_validation_request.js +1 -1
- 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 +15 -11
- package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts +3 -1
- package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts +6 -6
- package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/note_packing_utils.js +8 -8
- package/dest/contract_function_simulator/oracle/oracle.d.ts +10 -8
- package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/oracle.js +43 -32
- package/dest/contract_function_simulator/oracle/private_execution.d.ts +2 -26
- package/dest/contract_function_simulator/oracle/private_execution.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution.js +1 -37
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +26 -26
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.js +28 -41
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +44 -34
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +92 -92
- 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 +5 -5
- package/dest/contract_sync/index.d.ts +23 -0
- package/dest/contract_sync/index.d.ts.map +1 -0
- package/dest/contract_sync/index.js +54 -0
- package/dest/debug/pxe_debug_utils.d.ts +6 -6
- package/dest/debug/pxe_debug_utils.d.ts.map +1 -1
- package/dest/debug/pxe_debug_utils.js +8 -7
- 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 +10 -1
- package/dest/entrypoints/client/lazy/utils.d.ts +1 -1
- package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/utils.js +10 -1
- package/dest/entrypoints/pxe_creation_options.d.ts +3 -2
- package/dest/entrypoints/pxe_creation_options.d.ts.map +1 -1
- package/dest/entrypoints/server/index.d.ts +3 -1
- package/dest/entrypoints/server/index.d.ts.map +1 -1
- package/dest/entrypoints/server/index.js +2 -0
- 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 +11 -7
- 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 +8 -7
- package/dest/events/event_service.d.ts.map +1 -1
- package/dest/events/event_service.js +22 -24
- package/dest/events/private_event_filter_validator.d.ts +6 -6
- package/dest/events/private_event_filter_validator.d.ts.map +1 -1
- package/dest/events/private_event_filter_validator.js +5 -6
- package/dest/job_coordinator/job_coordinator.d.ts +74 -0
- package/dest/job_coordinator/job_coordinator.d.ts.map +1 -0
- package/dest/job_coordinator/job_coordinator.js +93 -0
- package/dest/logs/log_service.d.ts +15 -31
- package/dest/logs/log_service.d.ts.map +1 -1
- package/dest/logs/log_service.js +77 -188
- package/dest/notes/note_service.d.ts +10 -9
- package/dest/notes/note_service.d.ts.map +1 -1
- package/dest/notes/note_service.js +40 -44
- 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/index.d.ts +2 -2
- package/dest/private_kernel/hints/index.d.ts.map +1 -1
- package/dest/private_kernel/hints/index.js +1 -1
- 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} +13 -7
- package/dest/private_kernel/private_kernel_execution_prover.d.ts +1 -1
- package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_execution_prover.js +4 -5
- package/dest/private_kernel/private_kernel_oracle.d.ts +24 -28
- package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_oracle.js +90 -2
- package/dest/pxe.d.ts +17 -44
- package/dest/pxe.d.ts.map +1 -1
- package/dest/pxe.js +131 -147
- package/dest/storage/address_store/address_store.d.ts +11 -0
- package/dest/storage/address_store/address_store.d.ts.map +1 -0
- package/dest/storage/{address_data_provider/address_data_provider.js → address_store/address_store.js} +1 -1
- package/dest/storage/address_store/index.d.ts +2 -0
- package/dest/storage/address_store/index.d.ts.map +1 -0
- package/dest/storage/address_store/index.js +1 -0
- package/dest/storage/anchor_block_store/anchor_block_store.d.ts +9 -0
- package/dest/storage/anchor_block_store/anchor_block_store.d.ts.map +1 -0
- package/dest/storage/{anchor_block_data_provider/anchor_block_data_provider.js → anchor_block_store/anchor_block_store.js} +1 -1
- 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 +255 -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_data_provider/contract_data_provider.d.ts → contract_store/contract_store.d.ts} +3 -3
- package/dest/storage/contract_store/contract_store.d.ts.map +1 -0
- package/dest/storage/{contract_data_provider/contract_data_provider.js → contract_store/contract_store.js} +2 -2
- 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/index.d.ts +8 -8
- package/dest/storage/index.d.ts.map +1 -1
- package/dest/storage/index.js +7 -7
- 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 +73 -0
- package/dest/storage/note_store/note_store.d.ts.map +1 -0
- package/dest/storage/note_store/note_store.js +303 -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 +250 -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 +99 -0
- package/dest/storage/tagging_store/sender_address_book_store.d.ts +14 -0
- package/dest/storage/tagging_store/sender_address_book_store.d.ts.map +1 -0
- package/dest/storage/tagging_store/sender_address_book_store.js +30 -0
- package/dest/storage/{tagging_data_provider/sender_tagging_data_provider.d.ts → tagging_store/sender_tagging_store.d.ts} +19 -9
- package/dest/storage/tagging_store/sender_tagging_store.d.ts.map +1 -0
- package/dest/storage/{tagging_data_provider/sender_tagging_data_provider.js → tagging_store/sender_tagging_store.js} +111 -29
- package/dest/tagging/constants.d.ts +2 -2
- package/dest/tagging/constants.d.ts.map +1 -1
- package/dest/tagging/constants.js +10 -3
- 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 +46 -0
- package/dest/tagging/index.d.ts +15 -3
- package/dest/tagging/index.d.ts.map +1 -1
- package/dest/tagging/index.js +14 -2
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts +4 -3
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts.map +1 -1
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.js +8 -8
- package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts +3 -2
- package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts.map +1 -1
- package/dest/tagging/recipient_sync/utils/load_logs_for_range.js +5 -2
- package/dest/tagging/{sync → sender_sync}/sync_sender_tagging_indexes.d.ts +4 -4
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts.map +1 -0
- package/dest/tagging/{sync → sender_sync}/sync_sender_tagging_indexes.js +8 -23
- package/dest/tagging/{sync → sender_sync}/utils/get_status_change_of_pending.d.ts +1 -1
- package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts.map +1 -0
- package/dest/tagging/{sync → sender_sync}/utils/get_status_change_of_pending.js +5 -8
- package/dest/tagging/{sync → sender_sync}/utils/load_and_store_new_tagging_indexes.d.ts +7 -4
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts.map +1 -0
- package/dest/tagging/{sync → sender_sync}/utils/load_and_store_new_tagging_indexes.js +12 -7
- package/package.json +18 -18
- package/src/bin/check_oracle_version.ts +1 -0
- package/src/block_synchronizer/block_synchronizer.ts +83 -34
- package/src/config/index.ts +14 -0
- 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 +79 -64
- package/src/contract_function_simulator/execution_note_cache.ts +44 -25
- package/src/contract_function_simulator/index.ts +1 -1
- package/src/contract_function_simulator/noir-structs/event_validation_request.ts +5 -1
- package/src/contract_function_simulator/noir-structs/note_validation_request.ts +1 -1
- package/src/contract_function_simulator/noir-structs/utility_context.ts +6 -25
- package/src/contract_function_simulator/oracle/interfaces.ts +20 -10
- package/src/contract_function_simulator/oracle/note_packing_utils.ts +10 -10
- package/src/contract_function_simulator/oracle/oracle.ts +56 -41
- package/src/contract_function_simulator/oracle/private_execution.ts +1 -69
- package/src/contract_function_simulator/oracle/private_execution_oracle.ts +77 -78
- package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +121 -105
- package/src/contract_function_simulator/proxied_contract_data_source.ts +7 -7
- package/src/contract_sync/index.ts +98 -0
- package/src/debug/pxe_debug_utils.ts +7 -6
- package/src/entrypoints/client/bundle/utils.ts +7 -1
- package/src/entrypoints/client/lazy/utils.ts +7 -2
- package/src/entrypoints/pxe_creation_options.ts +2 -1
- package/src/entrypoints/server/index.ts +2 -0
- package/src/entrypoints/server/utils.ts +11 -15
- package/src/error_enriching.ts +7 -15
- package/src/events/event_service.ts +23 -27
- package/src/events/private_event_filter_validator.ts +4 -6
- package/src/job_coordinator/job_coordinator.ts +149 -0
- package/src/logs/log_service.ts +116 -260
- package/src/notes/note_service.ts +43 -46
- package/src/oracle_version.ts +4 -3
- package/src/private_kernel/hints/index.ts +1 -1
- package/src/private_kernel/hints/{build_private_kernel_reset_private_inputs.ts → private_kernel_reset_private_inputs_builder.ts} +33 -22
- package/src/private_kernel/private_kernel_execution_prover.ts +3 -5
- package/src/private_kernel/private_kernel_oracle.ts +116 -36
- package/src/pxe.ts +189 -190
- package/src/storage/{address_data_provider/address_data_provider.ts → address_store/address_store.ts} +1 -1
- package/src/storage/address_store/index.ts +1 -0
- package/src/storage/{anchor_block_data_provider/anchor_block_data_provider.ts → anchor_block_store/anchor_block_store.ts} +1 -1
- 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_data_provider/contract_data_provider.ts → contract_store/contract_store.ts} +2 -2
- package/src/storage/contract_store/index.ts +1 -0
- package/src/storage/index.ts +7 -7
- package/src/storage/note_store/index.ts +2 -0
- package/src/storage/note_store/note_store.ts +381 -0
- package/src/storage/note_store/stored_note.ts +48 -0
- package/src/storage/private_event_store/private_event_store.ts +363 -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 +129 -0
- package/src/storage/tagging_store/sender_address_book_store.ts +42 -0
- package/src/storage/{tagging_data_provider/sender_tagging_data_provider.ts → tagging_store/sender_tagging_store.ts} +129 -28
- package/src/tagging/constants.ts +10 -3
- package/src/tagging/get_all_logs_by_tags.ts +68 -0
- package/src/tagging/index.ts +17 -2
- package/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts +23 -9
- package/src/tagging/recipient_sync/utils/load_logs_for_range.ts +7 -1
- package/src/tagging/{sync → sender_sync}/sync_sender_tagging_indexes.ts +12 -25
- package/src/tagging/{sync → sender_sync}/utils/get_status_change_of_pending.ts +5 -13
- package/src/tagging/{sync → sender_sync}/utils/load_and_store_new_tagging_indexes.ts +19 -7
- 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/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/private_kernel_oracle_impl.d.ts +0 -46
- 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/public_storage/public_storage_service.d.ts +0 -24
- package/dest/public_storage/public_storage_service.d.ts.map +0 -1
- package/dest/public_storage/public_storage_service.js +0 -26
- 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/anchor_block_data_provider/anchor_block_data_provider.d.ts +0 -9
- package/dest/storage/anchor_block_data_provider/anchor_block_data_provider.d.ts.map +0 -1
- package/dest/storage/anchor_block_data_provider/index.d.ts +0 -2
- package/dest/storage/anchor_block_data_provider/index.d.ts.map +0 -1
- package/dest/storage/anchor_block_data_provider/index.js +0 -1
- package/dest/storage/capsule_data_provider/capsule_data_provider.d.ts +0 -57
- 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 -146
- package/dest/storage/capsule_data_provider/index.d.ts +0 -2
- package/dest/storage/capsule_data_provider/index.d.ts.map +0 -1
- package/dest/storage/capsule_data_provider/index.js +0 -1
- package/dest/storage/contract_data_provider/contract_data_provider.d.ts.map +0 -1
- package/dest/storage/contract_data_provider/index.d.ts +0 -2
- package/dest/storage/contract_data_provider/index.d.ts.map +0 -1
- package/dest/storage/contract_data_provider/index.js +0 -1
- package/dest/storage/contract_data_provider/private_functions_tree.d.ts.map +0 -1
- package/dest/storage/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 -84
- 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 -322
- package/dest/storage/private_event_data_provider/private_event_data_provider.d.ts +0 -51
- 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 -115
- package/dest/storage/tagging_data_provider/index.d.ts +0 -3
- package/dest/storage/tagging_data_provider/index.d.ts.map +0 -1
- package/dest/storage/tagging_data_provider/index.js +0 -2
- package/dest/storage/tagging_data_provider/recipient_tagging_data_provider.d.ts +0 -31
- package/dest/storage/tagging_data_provider/recipient_tagging_data_provider.d.ts.map +0 -1
- package/dest/storage/tagging_data_provider/recipient_tagging_data_provider.js +0 -65
- package/dest/storage/tagging_data_provider/sender_tagging_data_provider.d.ts.map +0 -1
- package/dest/tagging/recipient_sync/new_recipient_tagging_data_provider.d.ts +0 -21
- package/dest/tagging/recipient_sync/new_recipient_tagging_data_provider.d.ts.map +0 -1
- package/dest/tagging/recipient_sync/new_recipient_tagging_data_provider.js +0 -42
- package/dest/tagging/sync/sync_sender_tagging_indexes.d.ts.map +0 -1
- package/dest/tagging/sync/utils/get_status_change_of_pending.d.ts.map +0 -1
- package/dest/tagging/sync/utils/load_and_store_new_tagging_indexes.d.ts.map +0 -1
- package/dest/tagging/utils.d.ts +0 -18
- package/dest/tagging/utils.d.ts.map +0 -1
- package/dest/tagging/utils.js +0 -25
- package/dest/tree_membership/tree_membership_service.d.ts +0 -52
- package/dest/tree_membership/tree_membership_service.d.ts.map +0 -1
- package/dest/tree_membership/tree_membership_service.js +0 -84
- package/src/contract_function_simulator/proxied_node.ts +0 -33
- package/src/private_kernel/private_kernel_oracle_impl.ts +0 -133
- package/src/public_storage/public_storage_service.ts +0 -33
- package/src/storage/address_data_provider/index.ts +0 -1
- package/src/storage/anchor_block_data_provider/index.ts +0 -1
- package/src/storage/capsule_data_provider/capsule_data_provider.ts +0 -179
- package/src/storage/capsule_data_provider/index.ts +0 -1
- 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 -412
- package/src/storage/private_event_data_provider/private_event_data_provider.ts +0 -162
- package/src/storage/tagging_data_provider/index.ts +0 -2
- package/src/storage/tagging_data_provider/recipient_tagging_data_provider.ts +0 -86
- package/src/tagging/recipient_sync/new_recipient_tagging_data_provider.ts +0 -53
- package/src/tagging/utils.ts +0 -32
- package/src/tree_membership/tree_membership_service.ts +0 -112
- /package/dest/storage/{contract_data_provider → contract_store}/private_functions_tree.js +0 -0
- /package/src/storage/{contract_data_provider → contract_store}/private_functions_tree.ts +0 -0
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { toArray } from '@aztec/foundation/iterable';
|
|
2
2
|
import { TxHash } from '@aztec/stdlib/tx';
|
|
3
|
-
import { UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN } from '../../tagging/
|
|
3
|
+
import { UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN } from '../../tagging/constants.js';
|
|
4
4
|
/**
|
|
5
5
|
* Data provider of tagging data used when syncing the sender tagging indexes. The recipient counterpart of this class
|
|
6
|
-
* is called
|
|
6
|
+
* is called RecipientTaggingStore. We have the data stores separate for sender and recipient because
|
|
7
7
|
* the algorithms are completely disjoint and there is not data reuse between the two.
|
|
8
|
-
*/ export class
|
|
8
|
+
*/ export class SenderTaggingStore {
|
|
9
|
+
storeName = 'sender_tagging';
|
|
9
10
|
#store;
|
|
10
11
|
// Stores the pending indexes for each directional app tagging secret. Pending here means that the tx that contained
|
|
11
12
|
// the private logs with tags corresponding to these indexes has not been finalized yet.
|
|
@@ -15,15 +16,95 @@ import { UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN } from '../../tagging/sync/sync_
|
|
|
15
16
|
// the smaller ones are irrelevant due to tx atomicity.
|
|
16
17
|
//
|
|
17
18
|
// TODO(#17615): This assumes no logs are used in the non-revertible phase.
|
|
19
|
+
//
|
|
20
|
+
// directional app tagging secret => { pending index, txHash }[]
|
|
18
21
|
#pendingIndexes;
|
|
22
|
+
// jobId => directional app tagging secret => { pending index, txHash }[]
|
|
23
|
+
#pendingIndexesForJob;
|
|
19
24
|
// Stores the last (highest) finalized index for each directional app tagging secret. We care only about the last
|
|
20
25
|
// index because unlike the pending indexes, it will never happen that a finalized index would be removed and hence
|
|
21
26
|
// we don't need to store the history.
|
|
27
|
+
//
|
|
28
|
+
// directional app tagging secret => highest finalized index
|
|
22
29
|
#lastFinalizedIndexes;
|
|
30
|
+
// jobId => directional app tagging secret => highest finalized index
|
|
31
|
+
#lastFinalizedIndexesForJob;
|
|
23
32
|
constructor(store){
|
|
24
33
|
this.#store = store;
|
|
25
34
|
this.#pendingIndexes = this.#store.openMap('pending_indexes');
|
|
26
35
|
this.#lastFinalizedIndexes = this.#store.openMap('last_finalized_indexes');
|
|
36
|
+
this.#pendingIndexesForJob = new Map();
|
|
37
|
+
this.#lastFinalizedIndexesForJob = new Map();
|
|
38
|
+
}
|
|
39
|
+
#getPendingIndexesForJob(jobId) {
|
|
40
|
+
let pendingIndexesForJob = this.#pendingIndexesForJob.get(jobId);
|
|
41
|
+
if (!pendingIndexesForJob) {
|
|
42
|
+
pendingIndexesForJob = new Map();
|
|
43
|
+
this.#pendingIndexesForJob.set(jobId, pendingIndexesForJob);
|
|
44
|
+
}
|
|
45
|
+
return pendingIndexesForJob;
|
|
46
|
+
}
|
|
47
|
+
#getLastFinalizedIndexesForJob(jobId) {
|
|
48
|
+
let jobStagedLastFinalizedIndexes = this.#lastFinalizedIndexesForJob.get(jobId);
|
|
49
|
+
if (!jobStagedLastFinalizedIndexes) {
|
|
50
|
+
jobStagedLastFinalizedIndexes = new Map();
|
|
51
|
+
this.#lastFinalizedIndexesForJob.set(jobId, jobStagedLastFinalizedIndexes);
|
|
52
|
+
}
|
|
53
|
+
return jobStagedLastFinalizedIndexes;
|
|
54
|
+
}
|
|
55
|
+
async #readPendingIndexes(jobId, secret) {
|
|
56
|
+
const jobStagedPendingIndexes = this.#getPendingIndexesForJob(jobId);
|
|
57
|
+
const pendingIndexes = jobStagedPendingIndexes.get(secret);
|
|
58
|
+
// We return the staged version of this if it exists, if not, we read from the DB.
|
|
59
|
+
// If the DB also has nothing, we return an empty array [].
|
|
60
|
+
return pendingIndexes !== undefined ? pendingIndexes : await this.#pendingIndexes.getAsync(secret) ?? [];
|
|
61
|
+
}
|
|
62
|
+
#writePendingIndexes(jobId, secret, pendingIndexes) {
|
|
63
|
+
this.#getPendingIndexesForJob(jobId).set(secret, pendingIndexes);
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Returns a job view of all the secrets that have a corresponding list of pending indexes either in persistent
|
|
67
|
+
* storage or the current job.
|
|
68
|
+
*/ async #readSecretsWithPendingIndexes(jobId) {
|
|
69
|
+
const storedSecrets = new Set(await toArray(this.#pendingIndexes.keysAsync()));
|
|
70
|
+
const stagedSecrets = this.#getPendingIndexesForJob(jobId).keys();
|
|
71
|
+
return [
|
|
72
|
+
...storedSecrets.union(new Set(stagedSecrets))
|
|
73
|
+
];
|
|
74
|
+
}
|
|
75
|
+
async #readLastFinalizedIndex(jobId, secret) {
|
|
76
|
+
return this.#getLastFinalizedIndexesForJob(jobId).get(secret) ?? await this.#lastFinalizedIndexes.getAsync(secret);
|
|
77
|
+
}
|
|
78
|
+
#writeLastFinalizedIndex(jobId, secret, lastFinalizedIndex) {
|
|
79
|
+
this.#getLastFinalizedIndexesForJob(jobId).set(secret, lastFinalizedIndex);
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Writes all job-specific in-memory data to persistent storage.
|
|
83
|
+
*
|
|
84
|
+
* @remark This method must run in a DB transaction context. It's designed to be called from JobCoordinator#commitJob.
|
|
85
|
+
*/ async commit(jobId) {
|
|
86
|
+
const pendingIndexesForJob = this.#pendingIndexesForJob.get(jobId);
|
|
87
|
+
if (pendingIndexesForJob) {
|
|
88
|
+
for (const [secret, pendingIndexes] of pendingIndexesForJob.entries()){
|
|
89
|
+
if (pendingIndexes.length === 0) {
|
|
90
|
+
await this.#pendingIndexes.delete(secret);
|
|
91
|
+
} else {
|
|
92
|
+
await this.#pendingIndexes.set(secret, pendingIndexes);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
const lastFinalizedIndexesForJob = this.#lastFinalizedIndexesForJob.get(jobId);
|
|
97
|
+
if (lastFinalizedIndexesForJob) {
|
|
98
|
+
for (const [secret, lastFinalizedIndex] of lastFinalizedIndexesForJob.entries()){
|
|
99
|
+
await this.#lastFinalizedIndexes.set(secret, lastFinalizedIndex);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return this.discardStaged(jobId);
|
|
103
|
+
}
|
|
104
|
+
discardStaged(jobId) {
|
|
105
|
+
this.#pendingIndexesForJob.delete(jobId);
|
|
106
|
+
this.#lastFinalizedIndexesForJob.delete(jobId);
|
|
107
|
+
return Promise.resolve();
|
|
27
108
|
}
|
|
28
109
|
/**
|
|
29
110
|
* Stores pending indexes.
|
|
@@ -33,6 +114,7 @@ import { UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN } from '../../tagging/sync/sync_
|
|
|
33
114
|
* @param preTags - The pre-tags containing the directional app tagging secrets and the indexes that are to be
|
|
34
115
|
* stored in the db.
|
|
35
116
|
* @param txHash - The tx in which the pretags were used in private logs.
|
|
117
|
+
* @param jobId - job context for staged writes to this store. See `JobCoordinator` for more details.
|
|
36
118
|
* @throws If any two pre-tags contain the same directional app tagging secret. This is enforced because we care
|
|
37
119
|
* only about the highest index for a given secret that was used in the tx. Hence this check is a good way to catch
|
|
38
120
|
* bugs.
|
|
@@ -45,7 +127,7 @@ import { UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN } from '../../tagging/sync/sync_
|
|
|
45
127
|
* @throws If the newly stored pending index is lower than or equal to the last finalized index for the same secret.
|
|
46
128
|
* This is enforced because this should never happen if the syncing is done correctly as we look for logs from higher
|
|
47
129
|
* indexes than finalized ones.
|
|
48
|
-
*/ async storePendingIndexes(preTags, txHash) {
|
|
130
|
+
*/ async storePendingIndexes(preTags, txHash, jobId) {
|
|
49
131
|
// The secrets in pre-tags should be unique because we always store just the highest index per given secret-txHash
|
|
50
132
|
// pair. Below we check that this is the case.
|
|
51
133
|
const secretsSet = new Set(preTags.map((preTag)=>preTag.secret.toString()));
|
|
@@ -55,7 +137,7 @@ import { UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN } from '../../tagging/sync/sync_
|
|
|
55
137
|
for (const { secret, index } of preTags){
|
|
56
138
|
// First we check that for any secret the highest used index in tx is not further than window length from
|
|
57
139
|
// the highest finalized index.
|
|
58
|
-
const finalizedIndex = await this.getLastFinalizedIndex(secret) ?? 0;
|
|
140
|
+
const finalizedIndex = await this.getLastFinalizedIndex(secret, jobId) ?? 0;
|
|
59
141
|
if (index > finalizedIndex + UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN) {
|
|
60
142
|
throw new Error(`Highest used index ${index} is further than window length from the highest finalized index ${finalizedIndex}.
|
|
61
143
|
Tagging window length ${UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN} is configured too low. Contact the Aztec team
|
|
@@ -63,13 +145,13 @@ import { UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN } from '../../tagging/sync/sync_
|
|
|
63
145
|
}
|
|
64
146
|
// Throw if the new pending index is lower than or equal to the last finalized index
|
|
65
147
|
const secretStr = secret.toString();
|
|
66
|
-
const lastFinalizedIndex = await this.#
|
|
148
|
+
const lastFinalizedIndex = await this.#readLastFinalizedIndex(jobId, secretStr);
|
|
67
149
|
if (lastFinalizedIndex !== undefined && index <= lastFinalizedIndex) {
|
|
68
150
|
throw new Error(`Cannot store pending index ${index} for secret ${secretStr}: ` + `it is lower than or equal to the last finalized index ${lastFinalizedIndex}`);
|
|
69
151
|
}
|
|
70
152
|
// Check if this secret + txHash combination already exists
|
|
71
153
|
const txHashStr = txHash.toString();
|
|
72
|
-
const existingForSecret = await this.#
|
|
154
|
+
const existingForSecret = await this.#readPendingIndexes(jobId, secretStr);
|
|
73
155
|
const existingForSecretAndTx = existingForSecret.find((entry)=>entry.txHash === txHashStr);
|
|
74
156
|
if (existingForSecretAndTx) {
|
|
75
157
|
// If it exists with a different index, throw an error
|
|
@@ -79,7 +161,7 @@ import { UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN } from '../../tagging/sync/sync_
|
|
|
79
161
|
// If it exists with the same index, ignore the update (no-op)
|
|
80
162
|
} else {
|
|
81
163
|
// If it doesn't exist, add it
|
|
82
|
-
|
|
164
|
+
this.#writePendingIndexes(jobId, secretStr, [
|
|
83
165
|
...existingForSecret,
|
|
84
166
|
{
|
|
85
167
|
index,
|
|
@@ -97,8 +179,8 @@ import { UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN } from '../../tagging/sync/sync_
|
|
|
97
179
|
* @param endIndex - The upper bound of the index range (exclusive).
|
|
98
180
|
* @returns An array of unique transaction hashes for pending transactions that contain indexes in the range
|
|
99
181
|
* [startIndex, endIndex). Returns an empty array if no pending indexes exist in the range.
|
|
100
|
-
*/ async getTxHashesOfPendingIndexes(secret, startIndex, endIndex) {
|
|
101
|
-
const existing = await this.#
|
|
182
|
+
*/ async getTxHashesOfPendingIndexes(secret, startIndex, endIndex, jobId) {
|
|
183
|
+
const existing = await this.#readPendingIndexes(jobId, secret.toString());
|
|
102
184
|
const txHashes = existing.filter((entry)=>entry.index >= startIndex && entry.index < endIndex).map((entry)=>entry.txHash);
|
|
103
185
|
return Array.from(new Set(txHashes)).map(TxHash.fromString);
|
|
104
186
|
}
|
|
@@ -106,20 +188,20 @@ import { UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN } from '../../tagging/sync/sync_
|
|
|
106
188
|
* Returns the last (highest) finalized index for a given secret.
|
|
107
189
|
* @param secret - The secret to get the last finalized index for.
|
|
108
190
|
* @returns The last (highest) finalized index for the given secret.
|
|
109
|
-
*/ getLastFinalizedIndex(secret) {
|
|
110
|
-
return this.#
|
|
191
|
+
*/ getLastFinalizedIndex(secret, jobId) {
|
|
192
|
+
return this.#readLastFinalizedIndex(jobId, secret.toString());
|
|
111
193
|
}
|
|
112
194
|
/**
|
|
113
195
|
* Returns the last used index for a given directional app tagging secret, considering both finalized and pending
|
|
114
196
|
* indexes.
|
|
115
197
|
* @param secret - The directional app tagging secret to query the last used index for.
|
|
116
198
|
* @returns The last used index.
|
|
117
|
-
*/ async getLastUsedIndex(secret) {
|
|
199
|
+
*/ async getLastUsedIndex(secret, jobId) {
|
|
118
200
|
const secretStr = secret.toString();
|
|
119
|
-
const pendingTxScopedIndexes = await this.#
|
|
201
|
+
const pendingTxScopedIndexes = await this.#readPendingIndexes(jobId, secretStr);
|
|
120
202
|
const pendingIndexes = pendingTxScopedIndexes.map((entry)=>entry.index);
|
|
121
203
|
if (pendingTxScopedIndexes.length === 0) {
|
|
122
|
-
return this.#
|
|
204
|
+
return this.#readLastFinalizedIndex(jobId, secretStr);
|
|
123
205
|
}
|
|
124
206
|
// As the last used index we return the highest one from the pending indexes. Note that this value will be always
|
|
125
207
|
// higher than the last finalized index because we prune lower pending indexes when a tx is finalized.
|
|
@@ -127,21 +209,21 @@ import { UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN } from '../../tagging/sync/sync_
|
|
|
127
209
|
}
|
|
128
210
|
/**
|
|
129
211
|
* Drops all pending indexes corresponding to the given transaction hashes.
|
|
130
|
-
*/ async dropPendingIndexes(txHashes) {
|
|
212
|
+
*/ async dropPendingIndexes(txHashes, jobId) {
|
|
131
213
|
if (txHashes.length === 0) {
|
|
132
214
|
return;
|
|
133
215
|
}
|
|
134
|
-
const
|
|
135
|
-
const allSecrets = await
|
|
216
|
+
const txHashStrings = new Set(txHashes.map((txHash)=>txHash.toString()));
|
|
217
|
+
const allSecrets = await this.#readSecretsWithPendingIndexes(jobId);
|
|
136
218
|
for (const secret of allSecrets){
|
|
137
|
-
const pendingData = await this.#
|
|
219
|
+
const pendingData = await this.#readPendingIndexes(jobId, secret);
|
|
138
220
|
if (pendingData) {
|
|
139
|
-
const filtered = pendingData.filter((item)=>!
|
|
221
|
+
const filtered = pendingData.filter((item)=>!txHashStrings.has(item.txHash));
|
|
140
222
|
if (filtered.length === 0) {
|
|
141
|
-
|
|
223
|
+
this.#writePendingIndexes(jobId, secret, []);
|
|
142
224
|
} else if (filtered.length !== pendingData.length) {
|
|
143
225
|
// Some items were filtered out, so update the pending data
|
|
144
|
-
|
|
226
|
+
this.#writePendingIndexes(jobId, secret, filtered);
|
|
145
227
|
}
|
|
146
228
|
// else: No items were filtered out (txHashes not found for this secret) --> no-op
|
|
147
229
|
}
|
|
@@ -150,15 +232,15 @@ import { UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN } from '../../tagging/sync/sync_
|
|
|
150
232
|
/**
|
|
151
233
|
* Updates pending indexes corresponding to the given transaction hashes to be finalized and prunes any lower pending
|
|
152
234
|
* indexes.
|
|
153
|
-
*/ async finalizePendingIndexes(txHashes) {
|
|
235
|
+
*/ async finalizePendingIndexes(txHashes, jobId) {
|
|
154
236
|
if (txHashes.length === 0) {
|
|
155
237
|
return;
|
|
156
238
|
}
|
|
157
239
|
for (const txHash of txHashes){
|
|
158
240
|
const txHashStr = txHash.toString();
|
|
159
|
-
const allSecrets = await
|
|
241
|
+
const allSecrets = await this.#readSecretsWithPendingIndexes(jobId);
|
|
160
242
|
for (const secret of allSecrets){
|
|
161
|
-
const pendingData = await this.#
|
|
243
|
+
const pendingData = await this.#readPendingIndexes(jobId, secret);
|
|
162
244
|
if (!pendingData) {
|
|
163
245
|
continue;
|
|
164
246
|
}
|
|
@@ -171,14 +253,14 @@ import { UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN } from '../../tagging/sync/sync_
|
|
|
171
253
|
// values are irrelevant.
|
|
172
254
|
throw new Error(`Multiple pending indexes found for tx hash ${txHashStr} and secret ${secret}`);
|
|
173
255
|
}
|
|
174
|
-
let lastFinalized = await this.#
|
|
256
|
+
let lastFinalized = await this.#readLastFinalizedIndex(jobId, secret);
|
|
175
257
|
const newFinalized = matchingIndexes[0];
|
|
176
258
|
if (newFinalized < (lastFinalized ?? 0)) {
|
|
177
259
|
// This should never happen because when last finalized index was finalized we should have pruned the lower
|
|
178
260
|
// pending indexes.
|
|
179
261
|
throw new Error(`New finalized index ${newFinalized} is smaller than the current last finalized index ${lastFinalized}`);
|
|
180
262
|
}
|
|
181
|
-
|
|
263
|
+
this.#writeLastFinalizedIndex(jobId, secret, newFinalized);
|
|
182
264
|
lastFinalized = newFinalized;
|
|
183
265
|
// When we add pending indexes, we ensure they are higher than the last finalized index. However, because we
|
|
184
266
|
// cannot control the order in which transactions are finalized, there may be pending indexes that are now
|
|
@@ -186,9 +268,9 @@ import { UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN } from '../../tagging/sync/sync_
|
|
|
186
268
|
// outdated pending indexes.
|
|
187
269
|
const remainingItemsOfHigherIndex = pendingData.filter((item)=>item.index > (lastFinalized ?? 0));
|
|
188
270
|
if (remainingItemsOfHigherIndex.length === 0) {
|
|
189
|
-
|
|
271
|
+
this.#writePendingIndexes(jobId, secret, []);
|
|
190
272
|
} else {
|
|
191
|
-
|
|
273
|
+
this.#writePendingIndexes(jobId, secret, remainingItemsOfHigherIndex);
|
|
192
274
|
}
|
|
193
275
|
}
|
|
194
276
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const
|
|
2
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
1
|
+
export declare const UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN = 20;
|
|
2
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uc3RhbnRzLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdGFnZ2luZy9jb25zdGFudHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBU0EsZUFBTyxNQUFNLHNDQUFzQyxLQUFLLENBQUMifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/tagging/constants.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/tagging/constants.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,sCAAsC,KAAK,CAAC"}
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
-
//
|
|
2
|
-
//
|
|
3
|
-
|
|
1
|
+
// This window has to be as large as the largest expected number of logs emitted in a tx for a given directional app
|
|
2
|
+
// tagging secret. If we get more tag indexes consumed than this window, an error is thrown in `PXE::proveTx` function.
|
|
3
|
+
// This is set to a larger value than MAX_PRIVATE_LOGS_PER_TX (currently 64) because there could be more than
|
|
4
|
+
// MAX_PRIVATE_LOGS_PER_TX indexes consumed in case the logs are squashed. This happens when the log contains a note
|
|
5
|
+
// and the note is nullified in the same tx.
|
|
6
|
+
//
|
|
7
|
+
// Having a large window significantly slowed down `e2e_l1_with_wall_time` test as there we perform sync for more than
|
|
8
|
+
// 1000 secrets. For this reason we set it to a relatively low value of 20. 20 should be sufficient for all the use
|
|
9
|
+
// cases.
|
|
10
|
+
export const UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN = 20;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
2
|
+
import type { L2BlockHash } from '@aztec/stdlib/block';
|
|
3
|
+
import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
4
|
+
import type { SiloedTag, Tag, TxScopedL2Log } from '@aztec/stdlib/logs';
|
|
5
|
+
/**
|
|
6
|
+
* Fetches all private logs for the given tags, automatically paginating through all pages.
|
|
7
|
+
* @param aztecNode - The Aztec node to query.
|
|
8
|
+
* @param tags - The siloed tags to search for.
|
|
9
|
+
* @param anchorBlockHash - reference block for the Aztec node query, throws if block is not found there (typically
|
|
10
|
+
* because of reorgs).
|
|
11
|
+
* @returns An array of log arrays, one per tag, containing all logs across all pages.
|
|
12
|
+
*/
|
|
13
|
+
export declare function getAllPrivateLogsByTags(aztecNode: AztecNode, tags: SiloedTag[], anchorBlockHash: L2BlockHash): Promise<TxScopedL2Log[][]>;
|
|
14
|
+
/**
|
|
15
|
+
* Fetches all public logs for the given tags from a contract, automatically paginating through all pages.
|
|
16
|
+
* @param aztecNode - The Aztec node to query.
|
|
17
|
+
* @param contractAddress - The contract address to search logs for.
|
|
18
|
+
* @param tags - The tags to search for.
|
|
19
|
+
* @param anchorBlockHash - reference block for the Aztec node query, throws if block is not found there (typically
|
|
20
|
+
* because of reorgs).
|
|
21
|
+
* @returns An array of log arrays, one per tag, containing all logs across all pages.
|
|
22
|
+
*/
|
|
23
|
+
export declare function getAllPublicLogsByTagsFromContract(aztecNode: AztecNode, contractAddress: AztecAddress, tags: Tag[], anchorBlockHash: L2BlockHash): Promise<TxScopedL2Log[][]>;
|
|
24
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2V0X2FsbF9sb2dzX2J5X3RhZ3MuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy90YWdnaW5nL2dldF9hbGxfbG9nc19ieV90YWdzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLFlBQVksRUFBRSxNQUFNLDZCQUE2QixDQUFDO0FBQ2hFLE9BQU8sS0FBSyxFQUFFLFdBQVcsRUFBRSxNQUFNLHFCQUFxQixDQUFDO0FBRXZELE9BQU8sS0FBSyxFQUFFLFNBQVMsRUFBRSxNQUFNLGlDQUFpQyxDQUFDO0FBQ2pFLE9BQU8sS0FBSyxFQUFFLFNBQVMsRUFBRSxHQUFHLEVBQUUsYUFBYSxFQUFFLE1BQU0sb0JBQW9CLENBQUM7QUE2QnhFOzs7Ozs7O0dBT0c7QUFDSCx3QkFBZ0IsdUJBQXVCLENBQ3JDLFNBQVMsRUFBRSxTQUFTLEVBQ3BCLElBQUksRUFBRSxTQUFTLEVBQUUsRUFDakIsZUFBZSxFQUFFLFdBQVcsR0FDM0IsT0FBTyxDQUFDLGFBQWEsRUFBRSxFQUFFLENBQUMsQ0FFNUI7QUFFRDs7Ozs7Ozs7R0FRRztBQUNILHdCQUFnQixrQ0FBa0MsQ0FDaEQsU0FBUyxFQUFFLFNBQVMsRUFDcEIsZUFBZSxFQUFFLFlBQVksRUFDN0IsSUFBSSxFQUFFLEdBQUcsRUFBRSxFQUNYLGVBQWUsRUFBRSxXQUFXLEdBQzNCLE9BQU8sQ0FBQyxhQUFhLEVBQUUsRUFBRSxDQUFDLENBSTVCIn0=
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get_all_logs_by_tags.d.ts","sourceRoot":"","sources":["../../src/tagging/get_all_logs_by_tags.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AA6BxE;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CACrC,SAAS,EAAE,SAAS,EACpB,IAAI,EAAE,SAAS,EAAE,EACjB,eAAe,EAAE,WAAW,GAC3B,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC,CAE5B;AAED;;;;;;;;GAQG;AACH,wBAAgB,kCAAkC,CAChD,SAAS,EAAE,SAAS,EACpB,eAAe,EAAE,YAAY,EAC7B,IAAI,EAAE,GAAG,EAAE,EACX,eAAe,EAAE,WAAW,GAC3B,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC,CAI5B"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { MAX_LOGS_PER_TAG } from '@aztec/stdlib/interfaces/api-limit';
|
|
2
|
+
/**
|
|
3
|
+
* Generic pagination helper that fetches all pages of results.
|
|
4
|
+
* @param numTags - The number of tags being queried (determines result array size).
|
|
5
|
+
* @param fetchPage - Function that fetches a single page of results given a page number.
|
|
6
|
+
* @returns An array of arrays, one per tag, containing all results across all pages.
|
|
7
|
+
*/ async function getAllPages(numTags, fetchPage) {
|
|
8
|
+
const allResultsPerTag = Array.from({
|
|
9
|
+
length: numTags
|
|
10
|
+
}, ()=>[]);
|
|
11
|
+
let page = 0;
|
|
12
|
+
let hasMore = true;
|
|
13
|
+
while(hasMore){
|
|
14
|
+
const resultsPage = await fetchPage(page);
|
|
15
|
+
hasMore = false;
|
|
16
|
+
for(let i = 0; i < resultsPage.length; i++){
|
|
17
|
+
allResultsPerTag[i].push(...resultsPage[i]);
|
|
18
|
+
if (resultsPage[i].length === MAX_LOGS_PER_TAG) {
|
|
19
|
+
hasMore = true;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
page++;
|
|
23
|
+
}
|
|
24
|
+
return allResultsPerTag;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Fetches all private logs for the given tags, automatically paginating through all pages.
|
|
28
|
+
* @param aztecNode - The Aztec node to query.
|
|
29
|
+
* @param tags - The siloed tags to search for.
|
|
30
|
+
* @param anchorBlockHash - reference block for the Aztec node query, throws if block is not found there (typically
|
|
31
|
+
* because of reorgs).
|
|
32
|
+
* @returns An array of log arrays, one per tag, containing all logs across all pages.
|
|
33
|
+
*/ export function getAllPrivateLogsByTags(aztecNode, tags, anchorBlockHash) {
|
|
34
|
+
return getAllPages(tags.length, (page)=>aztecNode.getPrivateLogsByTags(tags, page, anchorBlockHash));
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Fetches all public logs for the given tags from a contract, automatically paginating through all pages.
|
|
38
|
+
* @param aztecNode - The Aztec node to query.
|
|
39
|
+
* @param contractAddress - The contract address to search logs for.
|
|
40
|
+
* @param tags - The tags to search for.
|
|
41
|
+
* @param anchorBlockHash - reference block for the Aztec node query, throws if block is not found there (typically
|
|
42
|
+
* because of reorgs).
|
|
43
|
+
* @returns An array of log arrays, one per tag, containing all logs across all pages.
|
|
44
|
+
*/ export function getAllPublicLogsByTagsFromContract(aztecNode, contractAddress, tags, anchorBlockHash) {
|
|
45
|
+
return getAllPages(tags.length, (page)=>aztecNode.getPublicLogsByTagsFromContract(contractAddress, tags, page, anchorBlockHash));
|
|
46
|
+
}
|
package/dest/tagging/index.d.ts
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* This directory contains the sender and recipient synchronization algorithms that use tagging.
|
|
3
|
+
*
|
|
4
|
+
* The objective of the sender sync algorithm is to determine which tags have already been used by a sender, thereby
|
|
5
|
+
* deciding which tag should be used next.
|
|
6
|
+
*
|
|
7
|
+
* The objective of the recipient sync algorithm is to load and process the corresponding logs.
|
|
8
|
+
*
|
|
9
|
+
* @module tagging
|
|
10
|
+
*/
|
|
11
|
+
export { loadPrivateLogsForSenderRecipientPair } from './recipient_sync/load_private_logs_for_sender_recipient_pair.js';
|
|
12
|
+
export { syncSenderTaggingIndexes } from './sender_sync/sync_sender_tagging_indexes.js';
|
|
13
|
+
export { UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN } from './constants.js';
|
|
14
|
+
export { getAllPrivateLogsByTags, getAllPublicLogsByTagsFromContract } from './get_all_logs_by_tags.js';
|
|
3
15
|
export { DirectionalAppTaggingSecret, Tag, SiloedTag } from '@aztec/stdlib/logs';
|
|
4
16
|
export { type PreTag } from '@aztec/stdlib/logs';
|
|
5
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
17
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy90YWdnaW5nL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOzs7Ozs7Ozs7R0FTRztBQUVILE9BQU8sRUFBRSxxQ0FBcUMsRUFBRSxNQUFNLGlFQUFpRSxDQUFDO0FBQ3hILE9BQU8sRUFBRSx3QkFBd0IsRUFBRSxNQUFNLDhDQUE4QyxDQUFDO0FBQ3hGLE9BQU8sRUFBRSxzQ0FBc0MsRUFBRSxNQUFNLGdCQUFnQixDQUFDO0FBQ3hFLE9BQU8sRUFBRSx1QkFBdUIsRUFBRSxrQ0FBa0MsRUFBRSxNQUFNLDJCQUEyQixDQUFDO0FBR3hHLE9BQU8sRUFBRSwyQkFBMkIsRUFBRSxHQUFHLEVBQUUsU0FBUyxFQUFFLE1BQU0sb0JBQW9CLENBQUM7QUFDakYsT0FBTyxFQUFFLEtBQUssTUFBTSxFQUFFLE1BQU0sb0JBQW9CLENBQUMifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tagging/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tagging/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,qCAAqC,EAAE,MAAM,iEAAiE,CAAC;AACxH,OAAO,EAAE,wBAAwB,EAAE,MAAM,8CAA8C,CAAC;AACxF,OAAO,EAAE,sCAAsC,EAAE,MAAM,gBAAgB,CAAC;AACxE,OAAO,EAAE,uBAAuB,EAAE,kCAAkC,EAAE,MAAM,2BAA2B,CAAC;AAGxG,OAAO,EAAE,2BAA2B,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACjF,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,oBAAoB,CAAC"}
|
package/dest/tagging/index.js
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* This directory contains the sender and recipient synchronization algorithms that use tagging.
|
|
3
|
+
*
|
|
4
|
+
* The objective of the sender sync algorithm is to determine which tags have already been used by a sender, thereby
|
|
5
|
+
* deciding which tag should be used next.
|
|
6
|
+
*
|
|
7
|
+
* The objective of the recipient sync algorithm is to load and process the corresponding logs.
|
|
8
|
+
*
|
|
9
|
+
* @module tagging
|
|
10
|
+
*/ export { loadPrivateLogsForSenderRecipientPair } from './recipient_sync/load_private_logs_for_sender_recipient_pair.js';
|
|
11
|
+
export { syncSenderTaggingIndexes } from './sender_sync/sync_sender_tagging_indexes.js';
|
|
12
|
+
export { UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN } from './constants.js';
|
|
13
|
+
export { getAllPrivateLogsByTags, getAllPublicLogsByTagsFromContract } from './get_all_logs_by_tags.js';
|
|
14
|
+
// Re-export tagging-related types from stdlib
|
|
3
15
|
export { DirectionalAppTaggingSecret, Tag, SiloedTag } from '@aztec/stdlib/logs';
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { BlockNumber } from '@aztec/foundation/branded-types';
|
|
2
2
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
3
|
+
import type { L2BlockHash } from '@aztec/stdlib/block';
|
|
3
4
|
import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
4
5
|
import type { DirectionalAppTaggingSecret, TxScopedL2Log } from '@aztec/stdlib/logs';
|
|
5
|
-
import type {
|
|
6
|
+
import type { RecipientTaggingStore } from '../../storage/tagging_store/recipient_tagging_store.js';
|
|
6
7
|
/**
|
|
7
8
|
* Loads private logs for `app` and sender-recipient pair defined by `secret` and updates the highest aged and
|
|
8
9
|
* finalized indexes in the db. At most load logs from blocks up to and including `anchorBlockNumber`.
|
|
@@ -10,5 +11,5 @@ import type { NewRecipientTaggingDataProvider } from './new_recipient_tagging_da
|
|
|
10
11
|
* @dev This function can be safely executed "in parallel" for other sender-recipient pairs because the data in
|
|
11
12
|
* in the tagging data provider is indexed by the secret and hence completely disjoint.
|
|
12
13
|
*/
|
|
13
|
-
export declare function loadPrivateLogsForSenderRecipientPair(secret: DirectionalAppTaggingSecret, app: AztecAddress, aztecNode: AztecNode,
|
|
14
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
14
|
+
export declare function loadPrivateLogsForSenderRecipientPair(secret: DirectionalAppTaggingSecret, app: AztecAddress, aztecNode: AztecNode, taggingStore: RecipientTaggingStore, anchorBlockNumber: BlockNumber, anchorBlockHash: L2BlockHash, jobId: string): Promise<TxScopedL2Log[]>;
|
|
15
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibG9hZF9wcml2YXRlX2xvZ3NfZm9yX3NlbmRlcl9yZWNpcGllbnRfcGFpci5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL3RhZ2dpbmcvcmVjaXBpZW50X3N5bmMvbG9hZF9wcml2YXRlX2xvZ3NfZm9yX3NlbmRlcl9yZWNpcGllbnRfcGFpci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxXQUFXLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUNuRSxPQUFPLEtBQUssRUFBRSxZQUFZLEVBQUUsTUFBTSw2QkFBNkIsQ0FBQztBQUNoRSxPQUFPLEtBQUssRUFBRSxXQUFXLEVBQUUsTUFBTSxxQkFBcUIsQ0FBQztBQUN2RCxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUNqRSxPQUFPLEtBQUssRUFBRSwyQkFBMkIsRUFBRSxhQUFhLEVBQUUsTUFBTSxvQkFBb0IsQ0FBQztBQUVyRixPQUFPLEtBQUssRUFBRSxxQkFBcUIsRUFBRSxNQUFNLHdEQUF3RCxDQUFDO0FBS3BHOzs7Ozs7R0FNRztBQUNILHdCQUFzQixxQ0FBcUMsQ0FDekQsTUFBTSxFQUFFLDJCQUEyQixFQUNuQyxHQUFHLEVBQUUsWUFBWSxFQUNqQixTQUFTLEVBQUUsU0FBUyxFQUNwQixZQUFZLEVBQUUscUJBQXFCLEVBQ25DLGlCQUFpQixFQUFFLFdBQVcsRUFDOUIsZUFBZSxFQUFFLFdBQVcsRUFDNUIsS0FBSyxFQUFFLE1BQU0sR0FDWixPQUFPLENBQUMsYUFBYSxFQUFFLENBQUMsQ0FvSDFCIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load_private_logs_for_sender_recipient_pair.d.ts","sourceRoot":"","sources":["../../../src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,KAAK,EAAE,2BAA2B,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"load_private_logs_for_sender_recipient_pair.d.ts","sourceRoot":"","sources":["../../../src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,KAAK,EAAE,2BAA2B,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAErF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,wDAAwD,CAAC;AAKpG;;;;;;GAMG;AACH,wBAAsB,qCAAqC,CACzD,MAAM,EAAE,2BAA2B,EACnC,GAAG,EAAE,YAAY,EACjB,SAAS,EAAE,SAAS,EACpB,YAAY,EAAE,qBAAqB,EACnC,iBAAiB,EAAE,WAAW,EAC9B,eAAe,EAAE,WAAW,EAC5B,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,aAAa,EAAE,CAAC,CAoH1B"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN } from '../
|
|
1
|
+
import { UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN } from '../constants.js';
|
|
2
2
|
import { findHighestIndexes } from './utils/find_highest_indexes.js';
|
|
3
3
|
import { loadLogsForRange } from './utils/load_logs_for_range.js';
|
|
4
4
|
/**
|
|
@@ -7,7 +7,7 @@ import { loadLogsForRange } from './utils/load_logs_for_range.js';
|
|
|
7
7
|
*
|
|
8
8
|
* @dev This function can be safely executed "in parallel" for other sender-recipient pairs because the data in
|
|
9
9
|
* in the tagging data provider is indexed by the secret and hence completely disjoint.
|
|
10
|
-
*/ export async function loadPrivateLogsForSenderRecipientPair(secret, app, aztecNode,
|
|
10
|
+
*/ export async function loadPrivateLogsForSenderRecipientPair(secret, app, aztecNode, taggingStore, anchorBlockNumber, anchorBlockHash, jobId) {
|
|
11
11
|
// # Explanation of how the algorithm works
|
|
12
12
|
// When we perform the sync we will look at logs that correspond to the tagging index range
|
|
13
13
|
// (highestAgedIndex, highestFinalizedIndex + WINDOW_LEN]
|
|
@@ -55,14 +55,14 @@ import { loadLogsForRange } from './utils/load_logs_for_range.js';
|
|
|
55
55
|
throw new Error('Node failed to return latest block header when syncing logs');
|
|
56
56
|
}
|
|
57
57
|
[finalizedBlockNumber, currentTimestamp] = [
|
|
58
|
-
l2Tips.finalized.number,
|
|
58
|
+
l2Tips.finalized.block.number,
|
|
59
59
|
latestBlockHeader.globalVariables.timestamp
|
|
60
60
|
];
|
|
61
61
|
}
|
|
62
62
|
let start, end;
|
|
63
63
|
{
|
|
64
|
-
const currentHighestAgedIndex = await
|
|
65
|
-
const currentHighestFinalizedIndex = await
|
|
64
|
+
const currentHighestAgedIndex = await taggingStore.getHighestAgedIndex(secret, jobId);
|
|
65
|
+
const currentHighestFinalizedIndex = await taggingStore.getHighestFinalizedIndex(secret, jobId);
|
|
66
66
|
// We don't want to include the highest aged index so we start from `currentHighestAgedIndex + 1` (or 0 if not set)
|
|
67
67
|
start = currentHighestAgedIndex === undefined ? 0 : currentHighestAgedIndex + 1;
|
|
68
68
|
// The highest index a sender can choose is "highest finalized index + window length" but given that
|
|
@@ -72,7 +72,7 @@ import { loadLogsForRange } from './utils/load_logs_for_range.js';
|
|
|
72
72
|
const logs = [];
|
|
73
73
|
while(true){
|
|
74
74
|
// Get private logs with their block timestamps and corresponding tagging indexes
|
|
75
|
-
const privateLogsWithIndexes = await loadLogsForRange(secret, app, aztecNode, start, end, anchorBlockNumber);
|
|
75
|
+
const privateLogsWithIndexes = await loadLogsForRange(secret, app, aztecNode, start, end, anchorBlockNumber, anchorBlockHash);
|
|
76
76
|
if (privateLogsWithIndexes.length === 0) {
|
|
77
77
|
break;
|
|
78
78
|
}
|
|
@@ -80,7 +80,7 @@ import { loadLogsForRange } from './utils/load_logs_for_range.js';
|
|
|
80
80
|
const { highestAgedIndex, highestFinalizedIndex } = findHighestIndexes(privateLogsWithIndexes, currentTimestamp, finalizedBlockNumber);
|
|
81
81
|
// Store updates in data provider and update local variables
|
|
82
82
|
if (highestAgedIndex !== undefined) {
|
|
83
|
-
await
|
|
83
|
+
await taggingStore.updateHighestAgedIndex(secret, highestAgedIndex, jobId);
|
|
84
84
|
}
|
|
85
85
|
if (highestFinalizedIndex === undefined) {
|
|
86
86
|
break;
|
|
@@ -89,7 +89,7 @@ import { loadLogsForRange } from './utils/load_logs_for_range.js';
|
|
|
89
89
|
// This is just a sanity check as this should never happen.
|
|
90
90
|
throw new Error('Highest aged index lower than highest finalized index invariant violated');
|
|
91
91
|
}
|
|
92
|
-
await
|
|
92
|
+
await taggingStore.updateHighestFinalizedIndex(secret, highestFinalizedIndex, jobId);
|
|
93
93
|
// For the next iteration we want to look only at indexes for which we have not attempted to load logs yet while
|
|
94
94
|
// ensuring that we do not look further than WINDOW_LEN ahead of the highest finalized index.
|
|
95
95
|
start = end;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { BlockNumber } from '@aztec/foundation/branded-types';
|
|
2
2
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
3
|
+
import type { L2BlockHash } from '@aztec/stdlib/block';
|
|
3
4
|
import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
4
5
|
import type { DirectionalAppTaggingSecret, TxScopedL2Log } from '@aztec/stdlib/logs';
|
|
5
6
|
/**
|
|
@@ -7,8 +8,8 @@ import type { DirectionalAppTaggingSecret, TxScopedL2Log } from '@aztec/stdlib/l
|
|
|
7
8
|
* `secret`. At most load logs from blocks up to and including `anchorBlockNumber`. `start` is inclusive and `end` is
|
|
8
9
|
* exclusive.
|
|
9
10
|
*/
|
|
10
|
-
export declare function loadLogsForRange(secret: DirectionalAppTaggingSecret, app: AztecAddress, aztecNode: AztecNode, start: number, end: number, anchorBlockNumber: BlockNumber): Promise<Array<{
|
|
11
|
+
export declare function loadLogsForRange(secret: DirectionalAppTaggingSecret, app: AztecAddress, aztecNode: AztecNode, start: number, end: number, anchorBlockNumber: BlockNumber, anchorBlockHash: L2BlockHash): Promise<Array<{
|
|
11
12
|
log: TxScopedL2Log;
|
|
12
13
|
taggingIndex: number;
|
|
13
14
|
}>>;
|
|
14
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
15
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibG9hZF9sb2dzX2Zvcl9yYW5nZS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vc3JjL3RhZ2dpbmcvcmVjaXBpZW50X3N5bmMvdXRpbHMvbG9hZF9sb2dzX2Zvcl9yYW5nZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxXQUFXLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUNuRSxPQUFPLEtBQUssRUFBRSxZQUFZLEVBQUUsTUFBTSw2QkFBNkIsQ0FBQztBQUNoRSxPQUFPLEtBQUssRUFBRSxXQUFXLEVBQUUsTUFBTSxxQkFBcUIsQ0FBQztBQUN2RCxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUNqRSxPQUFPLEtBQUssRUFBRSwyQkFBMkIsRUFBVSxhQUFhLEVBQUUsTUFBTSxvQkFBb0IsQ0FBQztBQUs3Rjs7OztHQUlHO0FBQ0gsd0JBQXNCLGdCQUFnQixDQUNwQyxNQUFNLEVBQUUsMkJBQTJCLEVBQ25DLEdBQUcsRUFBRSxZQUFZLEVBQ2pCLFNBQVMsRUFBRSxTQUFTLEVBQ3BCLEtBQUssRUFBRSxNQUFNLEVBQ2IsR0FBRyxFQUFFLE1BQU0sRUFDWCxpQkFBaUIsRUFBRSxXQUFXLEVBQzlCLGVBQWUsRUFBRSxXQUFXLEdBQzNCLE9BQU8sQ0FBQyxLQUFLLENBQUM7SUFBRSxHQUFHLEVBQUUsYUFBYSxDQUFDO0lBQUMsWUFBWSxFQUFFLE1BQU0sQ0FBQTtDQUFFLENBQUMsQ0FBQyxDQTBCOUQifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load_logs_for_range.d.ts","sourceRoot":"","sources":["../../../../src/tagging/recipient_sync/utils/load_logs_for_range.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,KAAK,EAAE,2BAA2B,EAAU,aAAa,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"load_logs_for_range.d.ts","sourceRoot":"","sources":["../../../../src/tagging/recipient_sync/utils/load_logs_for_range.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,KAAK,EAAE,2BAA2B,EAAU,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAK7F;;;;GAIG;AACH,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,2BAA2B,EACnC,GAAG,EAAE,YAAY,EACjB,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,MAAM,EACX,iBAAiB,EAAE,WAAW,EAC9B,eAAe,EAAE,WAAW,GAC3B,OAAO,CAAC,KAAK,CAAC;IAAE,GAAG,EAAE,aAAa,CAAC;IAAC,YAAY,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC,CA0B9D"}
|
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
import { SiloedTag, Tag } from '@aztec/stdlib/logs';
|
|
2
|
+
import { getAllPrivateLogsByTags } from '../../get_all_logs_by_tags.js';
|
|
2
3
|
/**
|
|
3
4
|
* Gets private logs with their corresponding block timestamps and tagging indexes for the given index range, `app` and
|
|
4
5
|
* `secret`. At most load logs from blocks up to and including `anchorBlockNumber`. `start` is inclusive and `end` is
|
|
5
6
|
* exclusive.
|
|
6
|
-
*/ export async function loadLogsForRange(secret, app, aztecNode, start, end, anchorBlockNumber) {
|
|
7
|
+
*/ export async function loadLogsForRange(secret, app, aztecNode, start, end, anchorBlockNumber, anchorBlockHash) {
|
|
7
8
|
// Derive tags for the window
|
|
8
9
|
const preTags = Array(end - start).fill(0).map((_, i)=>({
|
|
9
10
|
secret,
|
|
10
11
|
index: start + i
|
|
11
12
|
}));
|
|
12
13
|
const siloedTags = await Promise.all(preTags.map((preTag)=>Tag.compute(preTag))).then((tags)=>Promise.all(tags.map((tag)=>SiloedTag.compute(tag, app))));
|
|
13
|
-
|
|
14
|
+
// We use the utility function below to retrieve all logs for the tags across all pages, so we don't need to handle
|
|
15
|
+
// pagination here.
|
|
16
|
+
const logs = await getAllPrivateLogsByTags(aztecNode, siloedTags, anchorBlockHash);
|
|
14
17
|
// Pair logs with their corresponding tagging indexes
|
|
15
18
|
const logsWithIndexes = [];
|
|
16
19
|
for(let i = 0; i < logs.length; i++){
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
2
|
+
import type { L2BlockHash } from '@aztec/stdlib/block';
|
|
2
3
|
import type { AztecNode } from '@aztec/stdlib/interfaces/server';
|
|
3
4
|
import type { DirectionalAppTaggingSecret } from '@aztec/stdlib/logs';
|
|
4
|
-
import type {
|
|
5
|
-
export declare const UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN = 95;
|
|
5
|
+
import type { SenderTaggingStore } from '../../storage/tagging_store/sender_tagging_store.js';
|
|
6
6
|
/**
|
|
7
7
|
* Syncs tagging indexes. This function needs to be called whenever a private log is being sent.
|
|
8
8
|
*
|
|
@@ -17,5 +17,5 @@ export declare const UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN = 95;
|
|
|
17
17
|
* @dev This function looks for new indexes, adds them to pending, then it checks status of each pending index and
|
|
18
18
|
* updates its status accordingly.
|
|
19
19
|
*/
|
|
20
|
-
export declare function syncSenderTaggingIndexes(secret: DirectionalAppTaggingSecret, app: AztecAddress, aztecNode: AztecNode,
|
|
21
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
20
|
+
export declare function syncSenderTaggingIndexes(secret: DirectionalAppTaggingSecret, app: AztecAddress, aztecNode: AztecNode, taggingStore: SenderTaggingStore, anchorBlockHash: L2BlockHash, jobId: string): Promise<void>;
|
|
21
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3luY19zZW5kZXJfdGFnZ2luZ19pbmRleGVzLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvdGFnZ2luZy9zZW5kZXJfc3luYy9zeW5jX3NlbmRlcl90YWdnaW5nX2luZGV4ZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLEVBQUUsWUFBWSxFQUFFLE1BQU0sNkJBQTZCLENBQUM7QUFDaEUsT0FBTyxLQUFLLEVBQUUsV0FBVyxFQUFFLE1BQU0scUJBQXFCLENBQUM7QUFDdkQsT0FBTyxLQUFLLEVBQUUsU0FBUyxFQUFFLE1BQU0saUNBQWlDLENBQUM7QUFDakUsT0FBTyxLQUFLLEVBQUUsMkJBQTJCLEVBQUUsTUFBTSxvQkFBb0IsQ0FBQztBQUV0RSxPQUFPLEtBQUssRUFBRSxrQkFBa0IsRUFBRSxNQUFNLHFEQUFxRCxDQUFDO0FBSzlGOzs7Ozs7Ozs7Ozs7O0dBYUc7QUFDSCx3QkFBc0Isd0JBQXdCLENBQzVDLE1BQU0sRUFBRSwyQkFBMkIsRUFDbkMsR0FBRyxFQUFFLFlBQVksRUFDakIsU0FBUyxFQUFFLFNBQVMsRUFDcEIsWUFBWSxFQUFFLGtCQUFrQixFQUNoQyxlQUFlLEVBQUUsV0FBVyxFQUM1QixLQUFLLEVBQUUsTUFBTSxHQUNaLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FtRWYifQ==
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sync_sender_tagging_indexes.d.ts","sourceRoot":"","sources":["../../../src/tagging/sender_sync/sync_sender_tagging_indexes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,oBAAoB,CAAC;AAEtE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qDAAqD,CAAC;AAK9F;;;;;;;;;;;;;GAaG;AACH,wBAAsB,wBAAwB,CAC5C,MAAM,EAAE,2BAA2B,EACnC,GAAG,EAAE,YAAY,EACjB,SAAS,EAAE,SAAS,EACpB,YAAY,EAAE,kBAAkB,EAChC,eAAe,EAAE,WAAW,EAC5B,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,IAAI,CAAC,CAmEf"}
|