@aztec/pxe 0.0.1-commit.d3ec352c → 0.0.1-commit.f295ac2
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 +105 -15
- package/dest/block_synchronizer/block_synchronizer.d.ts +41 -0
- package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -0
- package/dest/{synchronizer/synchronizer.js → block_synchronizer/block_synchronizer.js} +35 -30
- 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 +4 -4
- package/dest/config/index.d.ts.map +1 -1
- package/dest/config/package_info.js +1 -1
- package/dest/contract_function_simulator/benchmarked_node.d.ts +9 -0
- package/dest/contract_function_simulator/benchmarked_node.d.ts.map +1 -0
- package/dest/contract_function_simulator/benchmarked_node.js +77 -0
- package/dest/contract_function_simulator/contract_function_simulator.d.ts +42 -14
- package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.js +73 -29
- package/dest/contract_function_simulator/execution_note_cache.d.ts +21 -12
- package/dest/contract_function_simulator/execution_note_cache.d.ts.map +1 -1
- package/dest/contract_function_simulator/execution_note_cache.js +48 -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/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 +5 -2
- 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 +2 -2
- package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts.map +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 +14 -13
- 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 +9 -5
- package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/note_packing_utils.js +11 -7
- package/dest/contract_function_simulator/oracle/oracle.d.ts +7 -7
- package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/oracle.js +37 -25
- package/dest/contract_function_simulator/oracle/private_execution.d.ts +10 -16
- package/dest/contract_function_simulator/oracle/private_execution.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution.js +19 -18
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +25 -25
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.js +29 -44
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +63 -21
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +162 -54
- 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/debug/pxe_debug_utils.d.ts +31 -0
- package/dest/debug/pxe_debug_utils.d.ts.map +1 -0
- package/dest/debug/pxe_debug_utils.js +37 -0
- package/dest/entrypoints/client/bundle/index.d.ts +1 -2
- package/dest/entrypoints/client/bundle/index.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/index.js +0 -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 +12 -3
- package/dest/entrypoints/client/lazy/index.d.ts +1 -2
- package/dest/entrypoints/client/lazy/index.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/index.js +0 -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 +12 -3
- package/dest/entrypoints/pxe_creation_options.d.ts +5 -2
- package/dest/entrypoints/pxe_creation_options.d.ts.map +1 -1
- package/dest/entrypoints/server/index.d.ts +3 -2
- package/dest/entrypoints/server/index.d.ts.map +1 -1
- package/dest/entrypoints/server/index.js +2 -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 +12 -8
- 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 +16 -0
- package/dest/events/event_service.d.ts.map +1 -0
- package/dest/events/event_service.js +45 -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 +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 +27 -0
- package/dest/logs/log_service.d.ts.map +1 -0
- package/dest/logs/log_service.js +122 -0
- package/dest/notes/index.d.ts +2 -0
- package/dest/notes/index.d.ts.map +1 -0
- package/dest/notes/index.js +1 -0
- package/dest/notes/note_service.d.ts +48 -0
- package/dest/notes/note_service.d.ts.map +1 -0
- package/dest/notes/note_service.js +147 -0
- package/dest/oracle_version.d.ts +2 -2
- package/dest/oracle_version.js +2 -2
- 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 +8 -9
- package/dest/private_kernel/private_kernel_oracle.d.ts +26 -29
- 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 +45 -81
- package/dest/pxe.d.ts.map +1 -1
- package/dest/pxe.js +182 -215
- 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/{sync_data_provider/sync_data_provider.d.ts → anchor_block_store/anchor_block_store.d.ts} +2 -4
- package/dest/storage/anchor_block_store/anchor_block_store.d.ts.map +1 -0
- package/dest/storage/{sync_data_provider/sync_data_provider.js → anchor_block_store/anchor_block_store.js} +2 -9
- 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 +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} +8 -5
- package/dest/storage/contract_store/contract_store.d.ts.map +1 -0
- package/dest/storage/{contract_data_provider/contract_data_provider.js → contract_store/contract_store.js} +46 -3
- 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/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_data_provider/note_data_provider.d.ts → note_store/note_store.d.ts} +15 -13
- package/dest/storage/note_store/note_store.d.ts.map +1 -0
- package/dest/storage/{note_data_provider/note_data_provider.js → note_store/note_store.js} +105 -102
- package/dest/storage/private_event_store/private_event_store.d.ts +78 -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 +222 -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_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 +278 -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/index.d.ts +15 -6
- package/dest/tagging/index.d.ts.map +1 -1
- package/dest/tagging/index.js +14 -5
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts +14 -0
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts.map +1 -0
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.js +99 -0
- package/dest/tagging/recipient_sync/utils/find_highest_indexes.d.ts +12 -0
- package/dest/tagging/recipient_sync/utils/find_highest_indexes.d.ts.map +1 -0
- package/dest/tagging/recipient_sync/utils/find_highest_indexes.js +20 -0
- package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts +14 -0
- package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts.map +1 -0
- package/dest/tagging/recipient_sync/utils/load_logs_for_range.js +29 -0
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts +20 -0
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts.map +1 -0
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.js +74 -0
- package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts +11 -0
- package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts.map +1 -0
- package/dest/tagging/sender_sync/utils/get_status_change_of_pending.js +32 -0
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts +20 -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 +57 -0
- package/dest/tree_membership/tree_membership_service.d.ts +50 -0
- package/dest/tree_membership/tree_membership_service.d.ts.map +1 -0
- package/dest/tree_membership/tree_membership_service.js +75 -0
- package/package.json +18 -18
- package/src/bin/check_oracle_version.ts +130 -20
- package/src/{synchronizer/synchronizer.ts → block_synchronizer/block_synchronizer.ts} +44 -30
- package/src/block_synchronizer/index.ts +1 -0
- package/src/config/index.ts +3 -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 +118 -30
- package/src/contract_function_simulator/execution_note_cache.ts +51 -29
- 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/noir-structs/event_validation_request.ts +5 -1
- package/src/contract_function_simulator/noir-structs/log_retrieval_request.ts +6 -5
- package/src/contract_function_simulator/noir-structs/log_retrieval_response.ts +1 -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 +13 -12
- package/src/contract_function_simulator/oracle/message_load_oracle_inputs.ts +1 -1
- package/src/contract_function_simulator/oracle/note_packing_utils.ts +23 -9
- package/src/contract_function_simulator/oracle/oracle.ts +44 -28
- package/src/contract_function_simulator/oracle/private_execution.ts +22 -30
- package/src/contract_function_simulator/oracle/private_execution_oracle.ts +97 -58
- package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +233 -63
- package/src/contract_function_simulator/pick_notes.ts +1 -1
- package/src/contract_function_simulator/proxied_contract_data_source.ts +24 -7
- package/src/debug/pxe_debug_utils.ts +48 -0
- package/src/entrypoints/client/bundle/index.ts +0 -1
- package/src/entrypoints/client/bundle/utils.ts +9 -3
- package/src/entrypoints/client/lazy/index.ts +0 -1
- package/src/entrypoints/client/lazy/utils.ts +9 -4
- package/src/entrypoints/pxe_creation_options.ts +4 -1
- package/src/entrypoints/server/index.ts +2 -1
- package/src/entrypoints/server/utils.ts +12 -16
- package/src/error_enriching.ts +7 -15
- package/src/events/event_service.ts +73 -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 +149 -0
- package/src/logs/log_service.ts +204 -0
- package/src/notes/index.ts +1 -0
- package/src/notes/note_service.ts +194 -0
- package/src/oracle_version.ts +2 -2
- 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} +34 -23
- package/src/private_kernel/private_kernel_execution_prover.ts +7 -9
- package/src/private_kernel/private_kernel_oracle.ts +118 -37
- package/src/pxe.ts +233 -279
- 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/{sync_data_provider/sync_data_provider.ts → anchor_block_store/anchor_block_store.ts} +2 -12
- 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} +65 -3
- 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/note_store/index.ts +2 -0
- package/src/storage/{note_data_provider/note_data_provider.ts → note_store/note_store.ts} +117 -105
- package/src/storage/private_event_store/private_event_store.ts +324 -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_store/sender_tagging_store.ts +345 -0
- package/src/tagging/constants.ts +10 -2
- package/src/tagging/index.ts +17 -5
- package/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts +133 -0
- package/src/tagging/recipient_sync/utils/find_highest_indexes.ts +34 -0
- package/src/tagging/recipient_sync/utils/load_logs_for_range.ts +43 -0
- package/src/tagging/sender_sync/sync_sender_tagging_indexes.ts +97 -0
- package/src/tagging/sender_sync/utils/get_status_change_of_pending.ts +48 -0
- package/src/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.ts +75 -0
- package/src/tree_membership/tree_membership_service.ts +97 -0
- package/dest/contract_function_simulator/execution_data_provider.d.ts +0 -267
- 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 -123
- package/dest/contract_function_simulator/pxe_oracle_interface.d.ts.map +0 -1
- package/dest/contract_function_simulator/pxe_oracle_interface.js +0 -696
- 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 -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.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.map +0 -1
- package/dest/storage/private_event_data_provider/private_event_data_provider.d.ts +0 -37
- package/dest/storage/private_event_data_provider/private_event_data_provider.d.ts.map +0 -1
- package/dest/storage/private_event_data_provider/private_event_data_provider.js +0 -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.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 -36
- package/dest/synchronizer/synchronizer.d.ts.map +0 -1
- 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 -342
- package/src/contract_function_simulator/proxied_node.ts +0 -33
- package/src/contract_function_simulator/pxe_oracle_interface.ts +0 -1023
- 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/index.ts +0 -1
- package/src/storage/note_data_provider/index.ts +0 -2
- 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/tagging/siloed_tag.ts +0 -22
- package/src/tagging/tag.ts +0 -16
- package/src/tagging/utils.ts +0 -31
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
import { NOTE_HASH_TREE_HEIGHT, PUBLIC_DATA_TREE_HEIGHT, VK_TREE_HEIGHT } from '@aztec/constants';
|
|
2
|
-
import type { Fr, GrumpkinScalar, Point } from '@aztec/foundation/fields';
|
|
3
|
-
import { createLogger } from '@aztec/foundation/log';
|
|
4
|
-
import type { Tuple } from '@aztec/foundation/serialize';
|
|
5
|
-
import { MembershipWitness } from '@aztec/foundation/trees';
|
|
6
|
-
import type { KeyStore } from '@aztec/key-store';
|
|
7
|
-
import { getVKIndex, getVKSiblingPath } from '@aztec/noir-protocol-circuits-types/vk-tree';
|
|
8
|
-
import { ProtocolContractAddress } from '@aztec/protocol-contracts';
|
|
9
|
-
import type { FunctionSelector } from '@aztec/stdlib/abi';
|
|
10
|
-
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
11
|
-
import type { BlockParameter } from '@aztec/stdlib/block';
|
|
12
|
-
import { computeContractClassIdPreimage, computeSaltedInitializationHash } from '@aztec/stdlib/contract';
|
|
13
|
-
import { DelayedPublicMutableValues, DelayedPublicMutableValuesWithHash } from '@aztec/stdlib/delayed-public-mutable';
|
|
14
|
-
import { computePublicDataTreeLeafSlot } from '@aztec/stdlib/hash';
|
|
15
|
-
import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
16
|
-
import { UpdatedClassIdHints } from '@aztec/stdlib/kernel';
|
|
17
|
-
import type { NullifierMembershipWitness } from '@aztec/stdlib/trees';
|
|
18
|
-
import type { VerificationKeyAsFields } from '@aztec/stdlib/vks';
|
|
19
|
-
|
|
20
|
-
import type { ContractDataProvider } from '../storage/index.js';
|
|
21
|
-
import type { PrivateKernelOracle } from './private_kernel_oracle.js';
|
|
22
|
-
|
|
23
|
-
// TODO: Block number should not be "latest".
|
|
24
|
-
// It should be fixed at the time the proof is being simulated. I.e., it should be the same as the value defined in the constant data.
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* A data oracle that provides information needed for simulating a transaction.
|
|
28
|
-
*/
|
|
29
|
-
export class PrivateKernelOracleImpl implements PrivateKernelOracle {
|
|
30
|
-
constructor(
|
|
31
|
-
private contractDataProvider: ContractDataProvider,
|
|
32
|
-
private keyStore: KeyStore,
|
|
33
|
-
private node: AztecNode,
|
|
34
|
-
private blockNumber: BlockParameter = 'latest',
|
|
35
|
-
private log = createLogger('pxe:kernel_oracle'),
|
|
36
|
-
) {}
|
|
37
|
-
|
|
38
|
-
public async getContractAddressPreimage(address: AztecAddress) {
|
|
39
|
-
const instance = await this.contractDataProvider.getContractInstance(address);
|
|
40
|
-
if (!instance) {
|
|
41
|
-
throw new Error(`Contract instance not found when getting address preimage. Contract address: ${address}.`);
|
|
42
|
-
}
|
|
43
|
-
return {
|
|
44
|
-
saltedInitializationHash: await computeSaltedInitializationHash(instance),
|
|
45
|
-
...instance,
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
public async getContractClassIdPreimage(contractClassId: Fr) {
|
|
50
|
-
const contractClass = await this.contractDataProvider.getContractClass(contractClassId);
|
|
51
|
-
if (!contractClass) {
|
|
52
|
-
throw new Error(`Contract class not found when getting class id preimage. Class id: ${contractClassId}.`);
|
|
53
|
-
}
|
|
54
|
-
return computeContractClassIdPreimage(contractClass);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
public async getFunctionMembershipWitness(contractClassId: Fr, selector: FunctionSelector) {
|
|
58
|
-
const membershipWitness = await this.contractDataProvider.getFunctionMembershipWitness(contractClassId, selector);
|
|
59
|
-
if (!membershipWitness) {
|
|
60
|
-
throw new Error(
|
|
61
|
-
`Membership witness not found for contract class id ${contractClassId} and selector ${selector}.`,
|
|
62
|
-
);
|
|
63
|
-
}
|
|
64
|
-
return membershipWitness;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
public getVkMembershipWitness(vk: VerificationKeyAsFields) {
|
|
68
|
-
const leafIndex = getVKIndex(vk);
|
|
69
|
-
return Promise.resolve(new MembershipWitness(VK_TREE_HEIGHT, BigInt(leafIndex), getVKSiblingPath(leafIndex)));
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
async getNoteHashMembershipWitness(leafIndex: bigint): Promise<MembershipWitness<typeof NOTE_HASH_TREE_HEIGHT>> {
|
|
73
|
-
const path = await this.node.getNoteHashSiblingPath(this.blockNumber, leafIndex);
|
|
74
|
-
return new MembershipWitness<typeof NOTE_HASH_TREE_HEIGHT>(
|
|
75
|
-
path.pathSize,
|
|
76
|
-
leafIndex,
|
|
77
|
-
path.toFields() as Tuple<Fr, typeof NOTE_HASH_TREE_HEIGHT>,
|
|
78
|
-
);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
getNullifierMembershipWitness(nullifier: Fr): Promise<NullifierMembershipWitness | undefined> {
|
|
82
|
-
return this.node.getNullifierMembershipWitness(this.blockNumber, nullifier);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
async getNoteHashTreeRoot(): Promise<Fr> {
|
|
86
|
-
const header = await this.node.getBlockHeader(this.blockNumber);
|
|
87
|
-
if (!header) {
|
|
88
|
-
throw new Error(`No block header found for block number ${this.blockNumber}`);
|
|
89
|
-
}
|
|
90
|
-
return header.state.partial.noteHashTree.root;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
public getMasterSecretKey(masterPublicKey: Point): Promise<GrumpkinScalar> {
|
|
94
|
-
return this.keyStore.getMasterSecretKey(masterPublicKey);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
public getDebugFunctionName(contractAddress: AztecAddress, selector: FunctionSelector): Promise<string> {
|
|
98
|
-
return this.contractDataProvider.getDebugFunctionName(contractAddress, selector);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
public async getUpdatedClassIdHints(contractAddress: AztecAddress): Promise<UpdatedClassIdHints> {
|
|
102
|
-
const { delayedPublicMutableSlot, delayedPublicMutableHashSlot } =
|
|
103
|
-
await DelayedPublicMutableValuesWithHash.getContractUpdateSlots(contractAddress);
|
|
104
|
-
|
|
105
|
-
const hashLeafSlot = await computePublicDataTreeLeafSlot(
|
|
106
|
-
ProtocolContractAddress.ContractInstanceRegistry,
|
|
107
|
-
delayedPublicMutableHashSlot,
|
|
108
|
-
);
|
|
109
|
-
const updatedClassIdWitness = await this.node.getPublicDataWitness(this.blockNumber, hashLeafSlot);
|
|
110
|
-
|
|
111
|
-
if (!updatedClassIdWitness) {
|
|
112
|
-
throw new Error(`No public data tree witness found for ${hashLeafSlot}`);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
const readStorage = (storageSlot: Fr) =>
|
|
116
|
-
this.node.getPublicStorageAt(this.blockNumber, ProtocolContractAddress.ContractInstanceRegistry, storageSlot);
|
|
117
|
-
const delayedPublicMutableValues = await DelayedPublicMutableValues.readFromTree(
|
|
118
|
-
delayedPublicMutableSlot,
|
|
119
|
-
readStorage,
|
|
120
|
-
);
|
|
121
|
-
|
|
122
|
-
return new UpdatedClassIdHints(
|
|
123
|
-
new MembershipWitness(
|
|
124
|
-
PUBLIC_DATA_TREE_HEIGHT,
|
|
125
|
-
updatedClassIdWitness.index,
|
|
126
|
-
updatedClassIdWitness.siblingPath.toTuple(),
|
|
127
|
-
),
|
|
128
|
-
updatedClassIdWitness.leafPreimage,
|
|
129
|
-
delayedPublicMutableValues,
|
|
130
|
-
);
|
|
131
|
-
}
|
|
132
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { AddressDataProvider } from './address_data_provider.js';
|
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
import { Fr } from '@aztec/foundation/fields';
|
|
2
|
-
import { type Logger, createLogger } from '@aztec/foundation/log';
|
|
3
|
-
import type { AztecAsyncKVStore, AztecAsyncMap } from '@aztec/kv-store';
|
|
4
|
-
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
5
|
-
|
|
6
|
-
export class CapsuleDataProvider {
|
|
7
|
-
#store: AztecAsyncKVStore;
|
|
8
|
-
|
|
9
|
-
// Arbitrary data stored by contracts. Key is computed as `${contractAddress}:${key}`
|
|
10
|
-
#capsules: AztecAsyncMap<string, Buffer>;
|
|
11
|
-
|
|
12
|
-
logger: Logger;
|
|
13
|
-
|
|
14
|
-
constructor(store: AztecAsyncKVStore) {
|
|
15
|
-
this.#store = store;
|
|
16
|
-
|
|
17
|
-
this.#capsules = this.#store.openMap('capsules');
|
|
18
|
-
|
|
19
|
-
this.logger = createLogger('pxe:capsule-data-provider');
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
async storeCapsule(contractAddress: AztecAddress, slot: Fr, capsule: Fr[]): Promise<void> {
|
|
23
|
-
await this.#capsules.set(dbSlotToKey(contractAddress, slot), Buffer.concat(capsule.map(value => value.toBuffer())));
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
async loadCapsule(contractAddress: AztecAddress, slot: Fr): Promise<Fr[] | null> {
|
|
27
|
-
const dataBuffer = await this.#capsules.getAsync(dbSlotToKey(contractAddress, slot));
|
|
28
|
-
if (!dataBuffer) {
|
|
29
|
-
this.logger.trace(`Data not found for contract ${contractAddress.toString()} and slot ${slot.toString()}`);
|
|
30
|
-
return null;
|
|
31
|
-
}
|
|
32
|
-
const capsule: Fr[] = [];
|
|
33
|
-
for (let i = 0; i < dataBuffer.length; i += Fr.SIZE_IN_BYTES) {
|
|
34
|
-
capsule.push(Fr.fromBuffer(dataBuffer.subarray(i, i + Fr.SIZE_IN_BYTES)));
|
|
35
|
-
}
|
|
36
|
-
return capsule;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
async deleteCapsule(contractAddress: AztecAddress, slot: Fr): Promise<void> {
|
|
40
|
-
await this.#capsules.delete(dbSlotToKey(contractAddress, slot));
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
copyCapsule(contractAddress: AztecAddress, srcSlot: Fr, dstSlot: Fr, numEntries: number): Promise<void> {
|
|
44
|
-
return this.#store.transactionAsync(async () => {
|
|
45
|
-
// In order to support overlapping source and destination regions, we need to check the relative positions of source
|
|
46
|
-
// and destination. If destination is ahead of source, then by the time we overwrite source elements using forward
|
|
47
|
-
// indexes we'll have already read those. On the contrary, if source is ahead of destination we need to use backward
|
|
48
|
-
// indexes to avoid reading elements that've been overwritten.
|
|
49
|
-
|
|
50
|
-
const indexes = Array.from(Array(numEntries).keys());
|
|
51
|
-
if (srcSlot.lt(dstSlot)) {
|
|
52
|
-
indexes.reverse();
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
for (const i of indexes) {
|
|
56
|
-
const currentSrcSlot = dbSlotToKey(contractAddress, srcSlot.add(new Fr(i)));
|
|
57
|
-
const currentDstSlot = dbSlotToKey(contractAddress, dstSlot.add(new Fr(i)));
|
|
58
|
-
|
|
59
|
-
const toCopy = await this.#capsules.getAsync(currentSrcSlot);
|
|
60
|
-
if (!toCopy) {
|
|
61
|
-
throw new Error(`Attempted to copy empty slot ${currentSrcSlot} for contract ${contractAddress.toString()}`);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
await this.#capsules.set(currentDstSlot, toCopy);
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Appends multiple capsules to a capsule array stored at the base slot.
|
|
71
|
-
* The array length is stored at the base slot, and elements are stored in consecutive slots after it.
|
|
72
|
-
* All operations are performed in a single transaction.
|
|
73
|
-
* @param contractAddress - The contract address that owns the capsule array
|
|
74
|
-
* @param baseSlot - The slot where the array length is stored
|
|
75
|
-
* @param content - Array of capsule data to append
|
|
76
|
-
*/
|
|
77
|
-
appendToCapsuleArray(contractAddress: AztecAddress, baseSlot: Fr, content: Fr[][]): Promise<void> {
|
|
78
|
-
return this.#store.transactionAsync(async () => {
|
|
79
|
-
// Load current length, defaulting to 0 if not found
|
|
80
|
-
const lengthData = await this.loadCapsule(contractAddress, baseSlot);
|
|
81
|
-
const currentLength = lengthData ? lengthData[0].toNumber() : 0;
|
|
82
|
-
|
|
83
|
-
// Store each capsule at consecutive slots after baseSlot + 1 + currentLength
|
|
84
|
-
for (let i = 0; i < content.length; i++) {
|
|
85
|
-
const nextSlot = arraySlot(baseSlot, currentLength + i);
|
|
86
|
-
await this.storeCapsule(contractAddress, nextSlot, content[i]);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
// Update length to include all new capsules
|
|
90
|
-
const newLength = currentLength + content.length;
|
|
91
|
-
await this.storeCapsule(contractAddress, baseSlot, [new Fr(newLength)]);
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
readCapsuleArray(contractAddress: AztecAddress, baseSlot: Fr): Promise<Fr[][]> {
|
|
96
|
-
return this.#store.transactionAsync(async () => {
|
|
97
|
-
// Load length, defaulting to 0 if not found
|
|
98
|
-
const maybeLength = await this.loadCapsule(contractAddress, baseSlot);
|
|
99
|
-
const length = maybeLength ? maybeLength[0].toBigInt() : 0n;
|
|
100
|
-
|
|
101
|
-
const values: Fr[][] = [];
|
|
102
|
-
|
|
103
|
-
// Read each capsule at consecutive slots after baseSlot
|
|
104
|
-
for (let i = 0; i < length; i++) {
|
|
105
|
-
const currentValue = await this.loadCapsule(contractAddress, arraySlot(baseSlot, i));
|
|
106
|
-
if (currentValue == undefined) {
|
|
107
|
-
throw new Error(
|
|
108
|
-
`Expected non-empty value at capsule array in base slot ${baseSlot} at index ${i} for contract ${contractAddress}`,
|
|
109
|
-
);
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
values.push(currentValue);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
return values;
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
setCapsuleArray(contractAddress: AztecAddress, baseSlot: Fr, content: Fr[][]) {
|
|
120
|
-
return this.#store.transactionAsync(async () => {
|
|
121
|
-
// Load current length, defaulting to 0 if not found
|
|
122
|
-
const maybeLength = await this.loadCapsule(contractAddress, baseSlot);
|
|
123
|
-
const originalLength = maybeLength ? maybeLength[0].toNumber() : 0;
|
|
124
|
-
|
|
125
|
-
// Set the new length
|
|
126
|
-
await this.storeCapsule(contractAddress, baseSlot, [new Fr(content.length)]);
|
|
127
|
-
|
|
128
|
-
// Store the new content, possibly overwriting existing values
|
|
129
|
-
for (let i = 0; i < content.length; i++) {
|
|
130
|
-
await this.storeCapsule(contractAddress, arraySlot(baseSlot, i), content[i]);
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
// Clear any stragglers
|
|
134
|
-
for (let i = content.length; i < originalLength; i++) {
|
|
135
|
-
await this.deleteCapsule(contractAddress, arraySlot(baseSlot, i));
|
|
136
|
-
}
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
function dbSlotToKey(contractAddress: AztecAddress, slot: Fr): string {
|
|
142
|
-
return `${contractAddress.toString()}:${slot.toString()}`;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
function arraySlot(baseSlot: Fr, index: number) {
|
|
146
|
-
return baseSlot.add(new Fr(1)).add(new Fr(index));
|
|
147
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { CapsuleDataProvider } from './capsule_data_provider.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { ContractDataProvider } from './contract_data_provider.js';
|
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
import { Fr } from '@aztec/foundation/fields';
|
|
2
|
-
import { createLogger } from '@aztec/foundation/log';
|
|
3
|
-
import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
4
|
-
import type { AztecAsyncArray, AztecAsyncKVStore, AztecAsyncMap } from '@aztec/kv-store';
|
|
5
|
-
import type { EventSelector } from '@aztec/stdlib/abi';
|
|
6
|
-
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
7
|
-
import { L2BlockHash } from '@aztec/stdlib/block';
|
|
8
|
-
import { TxHash } from '@aztec/stdlib/tx';
|
|
9
|
-
|
|
10
|
-
import type { PrivateEvent } from '../../pxe.js';
|
|
11
|
-
|
|
12
|
-
interface PrivateEventEntry {
|
|
13
|
-
msgContent: Buffer;
|
|
14
|
-
blockNumber: number;
|
|
15
|
-
blockHash: Buffer;
|
|
16
|
-
eventCommitmentIndex: number;
|
|
17
|
-
txHash: Buffer;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Stores decrypted private event logs.
|
|
22
|
-
*/
|
|
23
|
-
export class PrivateEventDataProvider {
|
|
24
|
-
#store: AztecAsyncKVStore;
|
|
25
|
-
/** Array storing the actual private event log entries containing the log content and block number */
|
|
26
|
-
#eventLogs: AztecAsyncArray<PrivateEventEntry>;
|
|
27
|
-
/** Map from contract_address_recipient_eventSelector to array of indices into #eventLogs for efficient lookup */
|
|
28
|
-
#eventLogIndex: AztecAsyncMap<string, number[]>;
|
|
29
|
-
/** Map from eventCommitmentIndex to boolean indicating if log has been seen. */
|
|
30
|
-
#seenLogs: AztecAsyncMap<number, boolean>;
|
|
31
|
-
|
|
32
|
-
logger = createLogger('private_event_data_provider');
|
|
33
|
-
|
|
34
|
-
constructor(store: AztecAsyncKVStore) {
|
|
35
|
-
this.#store = store;
|
|
36
|
-
this.#eventLogs = this.#store.openArray('private_event_logs');
|
|
37
|
-
this.#eventLogIndex = this.#store.openMap('private_event_log_index');
|
|
38
|
-
this.#seenLogs = this.#store.openMap('seen_logs');
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Store a private event log.
|
|
43
|
-
* @param contractAddress - The address of the contract that emitted the event.
|
|
44
|
-
* @param recipient - The recipient of the event.
|
|
45
|
-
* @param eventSelector - The event selector of the event.
|
|
46
|
-
* @param msgContent - The content of the event.
|
|
47
|
-
* @param txHash - The transaction hash of the event log.
|
|
48
|
-
* @param eventCommitmentIndex - The index of the event commitment in the nullifier tree.
|
|
49
|
-
* @param blockNumber - The block number in which the event was emitted.
|
|
50
|
-
*/
|
|
51
|
-
storePrivateEventLog(
|
|
52
|
-
contractAddress: AztecAddress,
|
|
53
|
-
recipient: AztecAddress,
|
|
54
|
-
eventSelector: EventSelector,
|
|
55
|
-
msgContent: Fr[],
|
|
56
|
-
txHash: TxHash,
|
|
57
|
-
eventCommitmentIndex: number,
|
|
58
|
-
blockNumber: number,
|
|
59
|
-
blockHash: L2BlockHash,
|
|
60
|
-
): Promise<void> {
|
|
61
|
-
return this.#store.transactionAsync(async () => {
|
|
62
|
-
const key = `${contractAddress.toString()}_${recipient.toString()}_${eventSelector.toString()}`;
|
|
63
|
-
|
|
64
|
-
// Check if this exact log has already been stored using eventCommitmentIndex as unique identifier
|
|
65
|
-
const hasBeenSeen = await this.#seenLogs.getAsync(eventCommitmentIndex);
|
|
66
|
-
if (hasBeenSeen) {
|
|
67
|
-
this.logger.verbose('Ignoring duplicate event log', { txHash: txHash.toString(), eventCommitmentIndex });
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
this.logger.verbose('storing private event log', { contractAddress, recipient, msgContent, blockNumber });
|
|
72
|
-
|
|
73
|
-
const index = await this.#eventLogs.lengthAsync();
|
|
74
|
-
await this.#eventLogs.push({
|
|
75
|
-
msgContent: serializeToBuffer(msgContent),
|
|
76
|
-
blockNumber,
|
|
77
|
-
blockHash: blockHash.toBuffer(),
|
|
78
|
-
eventCommitmentIndex,
|
|
79
|
-
txHash: txHash.toBuffer(),
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
const existingIndices = (await this.#eventLogIndex.getAsync(key)) || [];
|
|
83
|
-
await this.#eventLogIndex.set(key, [...existingIndices, index]);
|
|
84
|
-
|
|
85
|
-
// Mark this log as seen using eventCommitmentIndex
|
|
86
|
-
await this.#seenLogs.set(eventCommitmentIndex, true);
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* Returns the private events given search parameters.
|
|
92
|
-
* @param contractAddress - The address of the contract to get events from.
|
|
93
|
-
* @param from - The block number to search from.
|
|
94
|
-
* @param numBlocks - The amount of blocks to search.
|
|
95
|
-
* @param recipients - The addresses that decrypted the logs.
|
|
96
|
-
* @param eventSelector - The event selector to filter by.
|
|
97
|
-
* @returns - The event log contents.
|
|
98
|
-
*/
|
|
99
|
-
public async getPrivateEvents(
|
|
100
|
-
contractAddress: AztecAddress,
|
|
101
|
-
from: number,
|
|
102
|
-
numBlocks: number,
|
|
103
|
-
recipients: AztecAddress[],
|
|
104
|
-
eventSelector: EventSelector,
|
|
105
|
-
): Promise<PrivateEvent[]> {
|
|
106
|
-
const events: Array<{ eventCommitmentIndex: number; event: PrivateEvent }> = [];
|
|
107
|
-
|
|
108
|
-
for (const recipient of recipients) {
|
|
109
|
-
const key = `${contractAddress.toString()}_${recipient.toString()}_${eventSelector.toString()}`;
|
|
110
|
-
const indices = (await this.#eventLogIndex.getAsync(key)) || [];
|
|
111
|
-
|
|
112
|
-
for (const index of indices) {
|
|
113
|
-
const entry = await this.#eventLogs.atAsync(index);
|
|
114
|
-
if (!entry || entry.blockNumber < from || entry.blockNumber >= from + numBlocks) {
|
|
115
|
-
continue;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
// Convert buffer back to Fr array
|
|
119
|
-
const reader = BufferReader.asReader(entry.msgContent);
|
|
120
|
-
const numFields = entry.msgContent.length / Fr.SIZE_IN_BYTES;
|
|
121
|
-
const msgContent = reader.readArray(numFields, Fr);
|
|
122
|
-
const txHash = TxHash.fromBuffer(entry.txHash);
|
|
123
|
-
const blockHash = L2BlockHash.fromBuffer(entry.blockHash);
|
|
124
|
-
|
|
125
|
-
events.push({
|
|
126
|
-
eventCommitmentIndex: entry.eventCommitmentIndex,
|
|
127
|
-
event: {
|
|
128
|
-
packedEvent: msgContent,
|
|
129
|
-
blockNumber: entry.blockNumber,
|
|
130
|
-
recipient,
|
|
131
|
-
txHash,
|
|
132
|
-
blockHash,
|
|
133
|
-
eventSelector,
|
|
134
|
-
},
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
// Sort by eventCommitmentIndex only
|
|
140
|
-
events.sort((a, b) => a.eventCommitmentIndex - b.eventCommitmentIndex);
|
|
141
|
-
return events.map(ev => ev.event);
|
|
142
|
-
}
|
|
143
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { SyncDataProvider } from './sync_data_provider.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { TaggingDataProvider } from './tagging_data_provider.js';
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
import { toArray } from '@aztec/foundation/iterable';
|
|
2
|
-
import type { AztecAsyncKVStore, AztecAsyncMap } from '@aztec/kv-store';
|
|
3
|
-
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
|
-
import type { DirectionalAppTaggingSecret, PreTag } from '@aztec/stdlib/logs';
|
|
5
|
-
|
|
6
|
-
export class TaggingDataProvider {
|
|
7
|
-
#store: AztecAsyncKVStore;
|
|
8
|
-
#addressBook: AztecAsyncMap<string, true>;
|
|
9
|
-
|
|
10
|
-
// Stores the last used index for each directional app tagging secret. Taking into account whether we are
|
|
11
|
-
// requesting the index as a sender or as a recipient because the sender and recipient can be in the same PXE.
|
|
12
|
-
#lastUsedIndexesAsSenders: AztecAsyncMap<string, number>;
|
|
13
|
-
#lastUsedIndexesAsRecipients: AztecAsyncMap<string, number>;
|
|
14
|
-
|
|
15
|
-
constructor(store: AztecAsyncKVStore) {
|
|
16
|
-
this.#store = store;
|
|
17
|
-
|
|
18
|
-
this.#addressBook = this.#store.openMap('address_book');
|
|
19
|
-
|
|
20
|
-
this.#lastUsedIndexesAsSenders = this.#store.openMap('last_used_indexes_as_senders');
|
|
21
|
-
this.#lastUsedIndexesAsRecipients = this.#store.openMap('last_used_indexes_as_recipients');
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Sets the last used indexes when sending a log.
|
|
26
|
-
* @param preTags - The pre tags containing the directional app tagging secrets and the indexes that are to be
|
|
27
|
-
* updated in the db.
|
|
28
|
-
* @throws If any two pre tags contain the same directional app tagging secret
|
|
29
|
-
*/
|
|
30
|
-
setLastUsedIndexesAsSender(preTags: PreTag[]) {
|
|
31
|
-
this.#assertUniqueSecrets(preTags, 'sender');
|
|
32
|
-
|
|
33
|
-
return Promise.all(
|
|
34
|
-
preTags.map(({ secret, index }) => this.#lastUsedIndexesAsSenders.set(secret.toString(), index)),
|
|
35
|
-
);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Sets the last used indexes when looking for logs.
|
|
40
|
-
* @param preTags - The pre tags containing the directional app tagging secrets and the indexes that are to be
|
|
41
|
-
* updated in the db.
|
|
42
|
-
* @throws If any two pre tags contain the same directional app tagging secret
|
|
43
|
-
*/
|
|
44
|
-
setLastUsedIndexesAsRecipient(preTags: PreTag[]) {
|
|
45
|
-
this.#assertUniqueSecrets(preTags, 'recipient');
|
|
46
|
-
|
|
47
|
-
return Promise.all(
|
|
48
|
-
preTags.map(({ secret, index }) => this.#lastUsedIndexesAsRecipients.set(secret.toString(), index)),
|
|
49
|
-
);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
// It should never happen that we would receive any two pre tags on the input containing the same directional app
|
|
53
|
-
// tagging secret as everywhere we always just apply the largest index. Hence this check is a good way to catch
|
|
54
|
-
// bugs.
|
|
55
|
-
#assertUniqueSecrets(preTags: PreTag[], role: 'sender' | 'recipient'): void {
|
|
56
|
-
const secretStrings = preTags.map(({ secret }) => secret.toString());
|
|
57
|
-
const uniqueSecrets = new Set(secretStrings);
|
|
58
|
-
if (uniqueSecrets.size !== secretStrings.length) {
|
|
59
|
-
throw new Error(`Duplicate secrets found when setting last used indexes as ${role}`);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Returns the last used index when sending a log with a given secret.
|
|
65
|
-
* @param secret - The directional app tagging secret.
|
|
66
|
-
* @returns The last used index for the given directional app tagging secret, or undefined if not found.
|
|
67
|
-
*/
|
|
68
|
-
async getLastUsedIndexesAsSender(secret: DirectionalAppTaggingSecret): Promise<number | undefined> {
|
|
69
|
-
return await this.#lastUsedIndexesAsSenders.getAsync(secret.toString());
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* Returns the last used indexes when looking for logs as a recipient.
|
|
74
|
-
* @param secrets - The directional app tagging secrets to obtain the indexes for.
|
|
75
|
-
* @returns The last used indexes for the given directional app tagging secrets, or undefined if have never yet found
|
|
76
|
-
* a log for a given secret.
|
|
77
|
-
*/
|
|
78
|
-
getLastUsedIndexesAsRecipient(secrets: DirectionalAppTaggingSecret[]): Promise<(number | undefined)[]> {
|
|
79
|
-
return Promise.all(secrets.map(secret => this.#lastUsedIndexesAsRecipients.getAsync(secret.toString())));
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
resetNoteSyncData(): Promise<void> {
|
|
83
|
-
return this.#store.transactionAsync(async () => {
|
|
84
|
-
const keysForSenders = await toArray(this.#lastUsedIndexesAsSenders.keysAsync());
|
|
85
|
-
await Promise.all(keysForSenders.map(secret => this.#lastUsedIndexesAsSenders.delete(secret)));
|
|
86
|
-
const keysForRecipients = await toArray(this.#lastUsedIndexesAsRecipients.keysAsync());
|
|
87
|
-
await Promise.all(keysForRecipients.map(secret => this.#lastUsedIndexesAsRecipients.delete(secret)));
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
async addSenderAddress(address: AztecAddress): Promise<boolean> {
|
|
92
|
-
if (await this.#addressBook.hasAsync(address.toString())) {
|
|
93
|
-
return false;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
await this.#addressBook.set(address.toString(), true);
|
|
97
|
-
|
|
98
|
-
return true;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
async getSenderAddresses(): Promise<AztecAddress[]> {
|
|
102
|
-
return (await toArray(this.#addressBook.keysAsync())).map(AztecAddress.fromString);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
async removeSenderAddress(address: AztecAddress): Promise<boolean> {
|
|
106
|
-
if (!(await this.#addressBook.hasAsync(address.toString()))) {
|
|
107
|
-
return false;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
await this.#addressBook.delete(address.toString());
|
|
111
|
-
|
|
112
|
-
return true;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
async getSize() {
|
|
116
|
-
const addressesCount = (await toArray(this.#addressBook.keysAsync())).length;
|
|
117
|
-
// All keys are addresses
|
|
118
|
-
return 3 * addressesCount * AztecAddress.SIZE_IN_BYTES;
|
|
119
|
-
}
|
|
120
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './synchronizer.js';
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { poseidon2Hash } from '@aztec/foundation/crypto';
|
|
2
|
-
import type { Fr } from '@aztec/foundation/fields';
|
|
3
|
-
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
|
-
|
|
5
|
-
import type { Tag } from './tag.js';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Represents a tag used in private log as it "appears on the chain" - that is the tag is siloed with a contract
|
|
9
|
-
* address that emitted the log.
|
|
10
|
-
*/
|
|
11
|
-
export class SiloedTag {
|
|
12
|
-
private constructor(public readonly value: Fr) {}
|
|
13
|
-
|
|
14
|
-
static async compute(tag: Tag, app: AztecAddress): Promise<SiloedTag> {
|
|
15
|
-
const siloedTag = await poseidon2Hash([app, tag.value]);
|
|
16
|
-
return new SiloedTag(siloedTag);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
toString(): string {
|
|
20
|
-
return this.value.toString();
|
|
21
|
-
}
|
|
22
|
-
}
|
package/src/tagging/tag.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { poseidon2Hash } from '@aztec/foundation/crypto';
|
|
2
|
-
import type { Fr } from '@aztec/foundation/fields';
|
|
3
|
-
import type { PreTag } from '@aztec/stdlib/logs';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Represents a tag of a private log. This is not the tag that "appears" on the chain as this tag is first siloed
|
|
7
|
-
* with a contract address by kernels before being included in the final log.
|
|
8
|
-
*/
|
|
9
|
-
export class Tag {
|
|
10
|
-
private constructor(public readonly value: Fr) {}
|
|
11
|
-
|
|
12
|
-
static async compute(preTag: PreTag): Promise<Tag> {
|
|
13
|
-
const tag = await poseidon2Hash([preTag.secret.value, preTag.index]);
|
|
14
|
-
return new Tag(tag);
|
|
15
|
-
}
|
|
16
|
-
}
|
package/src/tagging/utils.ts
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import type { DirectionalAppTaggingSecret, PreTag } from '@aztec/stdlib/logs';
|
|
2
|
-
|
|
3
|
-
// TODO(benesjan): Make this return tags instead - this will moves some complexity from syncTaggedLogs
|
|
4
|
-
export function getPreTagsForTheWindow(
|
|
5
|
-
secretsAndWindows: { secret: DirectionalAppTaggingSecret; leftMostIndex: number; rightMostIndex: number }[],
|
|
6
|
-
): PreTag[] {
|
|
7
|
-
const secrets = [];
|
|
8
|
-
for (const secretAndWindow of secretsAndWindows) {
|
|
9
|
-
for (let i = secretAndWindow.leftMostIndex; i <= secretAndWindow.rightMostIndex; i++) {
|
|
10
|
-
secrets.push({ secret: secretAndWindow.secret, index: i });
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
return secrets;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Creates a map from directional app tagging secret to initial index.
|
|
18
|
-
* @param preTags - The pre tags to get the initial indexes map from.
|
|
19
|
-
* @returns The map from directional app tagging secret to initial index.
|
|
20
|
-
*/
|
|
21
|
-
export function getInitialIndexesMap(preTags: { secret: DirectionalAppTaggingSecret; index: number | undefined }[]): {
|
|
22
|
-
[k: string]: number;
|
|
23
|
-
} {
|
|
24
|
-
const initialIndexes: { [k: string]: number } = {};
|
|
25
|
-
|
|
26
|
-
for (const preTag of preTags) {
|
|
27
|
-
initialIndexes[preTag.secret.toString()] = preTag.index ?? 0;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
return initialIndexes;
|
|
31
|
-
}
|