@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,31 +0,0 @@
|
|
|
1
|
-
import type { AztecAsyncKVStore } from '@aztec/kv-store';
|
|
2
|
-
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
3
|
-
import type { DirectionalAppTaggingSecret, PreTag } from '@aztec/stdlib/logs';
|
|
4
|
-
/**
|
|
5
|
-
* Data provider of tagging data used when syncing the logs as a recipient. The sender counterpart of this class is
|
|
6
|
-
* called SenderTaggingDataProvider. We have the providers separate for the sender and recipient because
|
|
7
|
-
* the algorithms are completely disjoint and there is not data reuse between the 2.
|
|
8
|
-
*/
|
|
9
|
-
export declare class RecipientTaggingDataProvider {
|
|
10
|
-
#private;
|
|
11
|
-
constructor(store: AztecAsyncKVStore);
|
|
12
|
-
/**
|
|
13
|
-
* Sets the last used indexes when looking for logs.
|
|
14
|
-
* @param preTags - The pre-tags containing the directional app tagging secrets and the indexes that are to be
|
|
15
|
-
* updated in the db.
|
|
16
|
-
* @throws If any two pre-tags contain the same directional app tagging secret
|
|
17
|
-
*/
|
|
18
|
-
setLastUsedIndexes(preTags: PreTag[]): Promise<void[]>;
|
|
19
|
-
/**
|
|
20
|
-
* Returns the last used indexes when looking for logs.
|
|
21
|
-
* @param secrets - The directional app tagging secrets to obtain the indexes for.
|
|
22
|
-
* @returns The last used indexes for the given directional app tagging secrets, or undefined if have never yet found
|
|
23
|
-
* a log for a given secret.
|
|
24
|
-
*/
|
|
25
|
-
getLastUsedIndexes(secrets: DirectionalAppTaggingSecret[]): Promise<(number | undefined)[]>;
|
|
26
|
-
resetNoteSyncData(): Promise<void>;
|
|
27
|
-
addSenderAddress(address: AztecAddress): Promise<boolean>;
|
|
28
|
-
getSenderAddresses(): Promise<AztecAddress[]>;
|
|
29
|
-
removeSenderAddress(address: AztecAddress): Promise<boolean>;
|
|
30
|
-
}
|
|
31
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmVjaXBpZW50X3RhZ2dpbmdfZGF0YV9wcm92aWRlci5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL3N0b3JhZ2UvdGFnZ2luZ19kYXRhX3Byb3ZpZGVyL3JlY2lwaWVudF90YWdnaW5nX2RhdGFfcHJvdmlkZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQ0EsT0FBTyxLQUFLLEVBQUUsaUJBQWlCLEVBQWlCLE1BQU0saUJBQWlCLENBQUM7QUFDeEUsT0FBTyxFQUFFLFlBQVksRUFBRSxNQUFNLDZCQUE2QixDQUFDO0FBQzNELE9BQU8sS0FBSyxFQUFFLDJCQUEyQixFQUFFLE1BQU0sRUFBRSxNQUFNLG9CQUFvQixDQUFDO0FBRTlFOzs7O0dBSUc7QUFDSCxxQkFBYSw0QkFBNEI7O0lBT3ZDLFlBQVksS0FBSyxFQUFFLGlCQUFpQixFQUtuQztJQUVEOzs7OztPQUtHO0lBQ0gsa0JBQWtCLENBQUMsT0FBTyxFQUFFLE1BQU0sRUFBRSxtQkFRbkM7SUFFRDs7Ozs7T0FLRztJQUNILGtCQUFrQixDQUFDLE9BQU8sRUFBRSwyQkFBMkIsRUFBRSxHQUFHLE9BQU8sQ0FBQyxDQUFDLE1BQU0sR0FBRyxTQUFTLENBQUMsRUFBRSxDQUFDLENBRTFGO0lBRUQsaUJBQWlCLElBQUksT0FBTyxDQUFDLElBQUksQ0FBQyxDQUtqQztJQU9LLGdCQUFnQixDQUFDLE9BQU8sRUFBRSxZQUFZLEdBQUcsT0FBTyxDQUFDLE9BQU8sQ0FBQyxDQVE5RDtJQUVLLGtCQUFrQixJQUFJLE9BQU8sQ0FBQyxZQUFZLEVBQUUsQ0FBQyxDQUVsRDtJQUVLLG1CQUFtQixDQUFDLE9BQU8sRUFBRSxZQUFZLEdBQUcsT0FBTyxDQUFDLE9BQU8sQ0FBQyxDQVFqRTtDQUNGIn0=
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"recipient_tagging_data_provider.d.ts","sourceRoot":"","sources":["../../../src/storage/tagging_data_provider/recipient_tagging_data_provider.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAiB,MAAM,iBAAiB,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE9E;;;;GAIG;AACH,qBAAa,4BAA4B;;IAOvC,YAAY,KAAK,EAAE,iBAAiB,EAKnC;IAED;;;;;OAKG;IACH,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,mBAQnC;IAED;;;;;OAKG;IACH,kBAAkB,CAAC,OAAO,EAAE,2BAA2B,EAAE,GAAG,OAAO,CAAC,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,CAAC,CAE1F;IAED,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC,CAKjC;IAOK,gBAAgB,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC,CAQ9D;IAEK,kBAAkB,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC,CAElD;IAEK,mBAAmB,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC,CAQjE;CACF"}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { toArray } from '@aztec/foundation/iterable';
|
|
2
|
-
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
3
|
-
/**
|
|
4
|
-
* Data provider of tagging data used when syncing the logs as a recipient. The sender counterpart of this class is
|
|
5
|
-
* called SenderTaggingDataProvider. We have the providers separate for the sender and recipient because
|
|
6
|
-
* the algorithms are completely disjoint and there is not data reuse between the 2.
|
|
7
|
-
*/ export class RecipientTaggingDataProvider {
|
|
8
|
-
#store;
|
|
9
|
-
#addressBook;
|
|
10
|
-
// Stores the last used index for each directional app tagging secret.
|
|
11
|
-
#lastUsedIndexes;
|
|
12
|
-
constructor(store){
|
|
13
|
-
this.#store = store;
|
|
14
|
-
this.#addressBook = this.#store.openMap('address_book');
|
|
15
|
-
this.#lastUsedIndexes = this.#store.openMap('last_used_indexes');
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Sets the last used indexes when looking for logs.
|
|
19
|
-
* @param preTags - The pre-tags containing the directional app tagging secrets and the indexes that are to be
|
|
20
|
-
* updated in the db.
|
|
21
|
-
* @throws If any two pre-tags contain the same directional app tagging secret
|
|
22
|
-
*/ setLastUsedIndexes(preTags) {
|
|
23
|
-
// Non-unique secrets would indicate a bug in the caller function.
|
|
24
|
-
const secretsSet = new Set(preTags.map((preTag)=>preTag.secret.toString()));
|
|
25
|
-
if (secretsSet.size !== preTags.length) {
|
|
26
|
-
throw new Error(`Duplicate secrets found when setting last used indexes`);
|
|
27
|
-
}
|
|
28
|
-
return Promise.all(preTags.map(({ secret, index })=>this.#lastUsedIndexes.set(secret.toString(), index)));
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Returns the last used indexes when looking for logs.
|
|
32
|
-
* @param secrets - The directional app tagging secrets to obtain the indexes for.
|
|
33
|
-
* @returns The last used indexes for the given directional app tagging secrets, or undefined if have never yet found
|
|
34
|
-
* a log for a given secret.
|
|
35
|
-
*/ getLastUsedIndexes(secrets) {
|
|
36
|
-
return Promise.all(secrets.map((secret)=>this.#lastUsedIndexes.getAsync(secret.toString())));
|
|
37
|
-
}
|
|
38
|
-
resetNoteSyncData() {
|
|
39
|
-
return this.#store.transactionAsync(async ()=>{
|
|
40
|
-
const keys = await toArray(this.#lastUsedIndexes.keysAsync());
|
|
41
|
-
await Promise.all(keys.map((secret)=>this.#lastUsedIndexes.delete(secret)));
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
// It might seem weird that the following 3 methods are in RecipientTaggingDataProvider and not
|
|
45
|
-
// in SenderTaggingDataProvider but that is because this data is truly only used for the purposes of syncing logs
|
|
46
|
-
// as a recipient. When sending logs or when syncing sender tagging indexes we only receive directional app tagging
|
|
47
|
-
// secret from Aztec.nr via an oracle and we don't need to access sender addresses.
|
|
48
|
-
async addSenderAddress(address) {
|
|
49
|
-
if (await this.#addressBook.hasAsync(address.toString())) {
|
|
50
|
-
return false;
|
|
51
|
-
}
|
|
52
|
-
await this.#addressBook.set(address.toString(), true);
|
|
53
|
-
return true;
|
|
54
|
-
}
|
|
55
|
-
async getSenderAddresses() {
|
|
56
|
-
return (await toArray(this.#addressBook.keysAsync())).map(AztecAddress.fromString);
|
|
57
|
-
}
|
|
58
|
-
async removeSenderAddress(address) {
|
|
59
|
-
if (!await this.#addressBook.hasAsync(address.toString())) {
|
|
60
|
-
return false;
|
|
61
|
-
}
|
|
62
|
-
await this.#addressBook.delete(address.toString());
|
|
63
|
-
return true;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sender_tagging_data_provider.d.ts","sourceRoot":"","sources":["../../../src/storage/tagging_data_provider/sender_tagging_data_provider.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAiB,MAAM,iBAAiB,CAAC;AACxE,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC9E,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAI1C;;;;GAIG;AACH,qBAAa,yBAAyB;;IAkBpC,YAAY,KAAK,EAAE,iBAAiB,EAKnC;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;IACG,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,MAAM,iBAiD1D;IAED;;;;;;;;OAQG;IACG,2BAA2B,CAC/B,MAAM,EAAE,2BAA2B,EACnC,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,MAAM,EAAE,CAAC,CAMnB;IAED;;;;OAIG;IACH,qBAAqB,CAAC,MAAM,EAAE,2BAA2B,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAEtF;IAED;;;;;OAKG;IACG,gBAAgB,CAAC,MAAM,EAAE,2BAA2B,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAYvF;IAED;;OAEG;IACG,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,iBAqB1C;IAED;;;OAGG;IACG,sBAAsB,CAAC,QAAQ,EAAE,MAAM,EAAE,iBAqD9C;CACF"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { AztecAsyncKVStore } from '@aztec/kv-store';
|
|
2
|
-
import type { DirectionalAppTaggingSecret } from '@aztec/stdlib/logs';
|
|
3
|
-
/**
|
|
4
|
-
* Data provider of tagging data used when syncing the logs as a recipient. The sender counterpart of this class
|
|
5
|
-
* is called SenderTaggingDataProvider. We have the providers separate for the sender and recipient because
|
|
6
|
-
* the algorithms are completely disjoint and there is not data reuse between the two.
|
|
7
|
-
*
|
|
8
|
-
* @dev Chain reorgs do not need to be handled here because both the finalized and aged indexes refer to finalized
|
|
9
|
-
* blocks, which by definition cannot be affected by reorgs.
|
|
10
|
-
*
|
|
11
|
-
* TODO(benesjan): Rename as to RecipientTaggingDataProvider and relocate once the old tagging sync is purged.
|
|
12
|
-
*/
|
|
13
|
-
export declare class NewRecipientTaggingDataProvider {
|
|
14
|
-
#private;
|
|
15
|
-
constructor(store: AztecAsyncKVStore);
|
|
16
|
-
getHighestAgedIndex(secret: DirectionalAppTaggingSecret): Promise<number | undefined>;
|
|
17
|
-
updateHighestAgedIndex(secret: DirectionalAppTaggingSecret, index: number): Promise<void>;
|
|
18
|
-
getHighestFinalizedIndex(secret: DirectionalAppTaggingSecret): Promise<number | undefined>;
|
|
19
|
-
updateHighestFinalizedIndex(secret: DirectionalAppTaggingSecret, index: number): Promise<void>;
|
|
20
|
-
}
|
|
21
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibmV3X3JlY2lwaWVudF90YWdnaW5nX2RhdGFfcHJvdmlkZXIuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy90YWdnaW5nL3JlY2lwaWVudF9zeW5jL25ld19yZWNpcGllbnRfdGFnZ2luZ19kYXRhX3Byb3ZpZGVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLGlCQUFpQixFQUFpQixNQUFNLGlCQUFpQixDQUFDO0FBQ3hFLE9BQU8sS0FBSyxFQUFFLDJCQUEyQixFQUFFLE1BQU0sb0JBQW9CLENBQUM7QUFFdEU7Ozs7Ozs7OztHQVNHO0FBQ0gscUJBQWEsK0JBQStCOztJQU0xQyxZQUFZLEtBQUssRUFBRSxpQkFBaUIsRUFLbkM7SUFFRCxtQkFBbUIsQ0FBQyxNQUFNLEVBQUUsMkJBQTJCLEdBQUcsT0FBTyxDQUFDLE1BQU0sR0FBRyxTQUFTLENBQUMsQ0FFcEY7SUFFSyxzQkFBc0IsQ0FBQyxNQUFNLEVBQUUsMkJBQTJCLEVBQUUsS0FBSyxFQUFFLE1BQU0sR0FBRyxPQUFPLENBQUMsSUFBSSxDQUFDLENBTzlGO0lBRUQsd0JBQXdCLENBQUMsTUFBTSxFQUFFLDJCQUEyQixHQUFHLE9BQU8sQ0FBQyxNQUFNLEdBQUcsU0FBUyxDQUFDLENBRXpGO0lBRUssMkJBQTJCLENBQUMsTUFBTSxFQUFFLDJCQUEyQixFQUFFLEtBQUssRUFBRSxNQUFNLEdBQUcsT0FBTyxDQUFDLElBQUksQ0FBQyxDQVFuRztDQUNGIn0=
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"new_recipient_tagging_data_provider.d.ts","sourceRoot":"","sources":["../../../src/tagging/recipient_sync/new_recipient_tagging_data_provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAiB,MAAM,iBAAiB,CAAC;AACxE,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,oBAAoB,CAAC;AAEtE;;;;;;;;;GASG;AACH,qBAAa,+BAA+B;;IAM1C,YAAY,KAAK,EAAE,iBAAiB,EAKnC;IAED,mBAAmB,CAAC,MAAM,EAAE,2BAA2B,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAEpF;IAEK,sBAAsB,CAAC,MAAM,EAAE,2BAA2B,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAO9F;IAED,wBAAwB,CAAC,MAAM,EAAE,2BAA2B,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAEzF;IAEK,2BAA2B,CAAC,MAAM,EAAE,2BAA2B,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAQnG;CACF"}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Data provider of tagging data used when syncing the logs as a recipient. The sender counterpart of this class
|
|
3
|
-
* is called SenderTaggingDataProvider. We have the providers separate for the sender and recipient because
|
|
4
|
-
* the algorithms are completely disjoint and there is not data reuse between the two.
|
|
5
|
-
*
|
|
6
|
-
* @dev Chain reorgs do not need to be handled here because both the finalized and aged indexes refer to finalized
|
|
7
|
-
* blocks, which by definition cannot be affected by reorgs.
|
|
8
|
-
*
|
|
9
|
-
* TODO(benesjan): Rename as to RecipientTaggingDataProvider and relocate once the old tagging sync is purged.
|
|
10
|
-
*/ export class NewRecipientTaggingDataProvider {
|
|
11
|
-
#store;
|
|
12
|
-
#highestAgedIndex;
|
|
13
|
-
#highestFinalizedIndex;
|
|
14
|
-
constructor(store){
|
|
15
|
-
this.#store = store;
|
|
16
|
-
this.#highestAgedIndex = this.#store.openMap('highest_aged_index');
|
|
17
|
-
this.#highestFinalizedIndex = this.#store.openMap('highest_finalized_index');
|
|
18
|
-
}
|
|
19
|
-
getHighestAgedIndex(secret) {
|
|
20
|
-
return this.#highestAgedIndex.getAsync(secret.toString());
|
|
21
|
-
}
|
|
22
|
-
async updateHighestAgedIndex(secret, index) {
|
|
23
|
-
const currentIndex = await this.#highestAgedIndex.getAsync(secret.toString());
|
|
24
|
-
if (currentIndex !== undefined && index <= currentIndex) {
|
|
25
|
-
// Log sync should never set a lower highest aged index.
|
|
26
|
-
throw new Error(`New highest aged index (${index}) must be higher than the current one (${currentIndex})`);
|
|
27
|
-
}
|
|
28
|
-
await this.#highestAgedIndex.set(secret.toString(), index);
|
|
29
|
-
}
|
|
30
|
-
getHighestFinalizedIndex(secret) {
|
|
31
|
-
return this.#highestFinalizedIndex.getAsync(secret.toString());
|
|
32
|
-
}
|
|
33
|
-
async updateHighestFinalizedIndex(secret, index) {
|
|
34
|
-
const currentIndex = await this.#highestFinalizedIndex.getAsync(secret.toString());
|
|
35
|
-
if (currentIndex !== undefined && index < currentIndex) {
|
|
36
|
-
// Log sync should never set a lower highest finalized index but it can happen that it would try to set the same
|
|
37
|
-
// one because we are loading logs from highest aged index + 1 and not from the highest finalized index.
|
|
38
|
-
throw new Error(`New highest finalized index (${index}) must be higher than the current one (${currentIndex})`);
|
|
39
|
-
}
|
|
40
|
-
await this.#highestFinalizedIndex.set(secret.toString(), index);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sync_sender_tagging_indexes.d.ts","sourceRoot":"","sources":["../../../src/tagging/sync/sync_sender_tagging_indexes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,oBAAoB,CAAC;AAEtE,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,qEAAqE,CAAC;AAmBrH,eAAO,MAAM,sCAAsC,KAAK,CAAC;AAEzD;;;;;;;;;;;;;GAaG;AACH,wBAAsB,wBAAwB,CAC5C,MAAM,EAAE,2BAA2B,EACnC,GAAG,EAAE,YAAY,EACjB,SAAS,EAAE,SAAS,EACpB,mBAAmB,EAAE,yBAAyB,GAC7C,OAAO,CAAC,IAAI,CAAC,CAmEf"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get_status_change_of_pending.d.ts","sourceRoot":"","sources":["../../../../src/tagging/sync/utils/get_status_change_of_pending.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,MAAM,EAAY,MAAM,kBAAkB,CAAC;AAEpD;;;GAGG;AACH,wBAAsB,wBAAwB,CAC5C,OAAO,EAAE,MAAM,EAAE,EACjB,SAAS,EAAE,SAAS,GACnB,OAAO,CAAC;IAAE,kBAAkB,EAAE,MAAM,EAAE,CAAC;IAAC,cAAc,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CAiCrE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"load_and_store_new_tagging_indexes.d.ts","sourceRoot":"","sources":["../../../../src/tagging/sync/utils/load_and_store_new_tagging_indexes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,KAAK,EAAE,2BAA2B,EAAU,MAAM,oBAAoB,CAAC;AAI9E,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,wEAAwE,CAAC;AAExH;;;;;;;;;;;GAWG;AACH,wBAAsB,6BAA6B,CACjD,MAAM,EAAE,2BAA2B,EACnC,GAAG,EAAE,YAAY,EACjB,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,MAAM,EACX,SAAS,EAAE,SAAS,EACpB,mBAAmB,EAAE,yBAAyB,iBAkB/C"}
|
package/dest/tagging/utils.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { DirectionalAppTaggingSecret, PreTag } from '@aztec/stdlib/logs';
|
|
2
|
-
export declare function getPreTagsForTheWindow(secretsAndWindows: {
|
|
3
|
-
secret: DirectionalAppTaggingSecret;
|
|
4
|
-
leftMostIndex: number;
|
|
5
|
-
rightMostIndex: number;
|
|
6
|
-
}[]): PreTag[];
|
|
7
|
-
/**
|
|
8
|
-
* Creates a map from directional app tagging secret to initial index.
|
|
9
|
-
* @param preTags - The pre-tags to get the initial indexes map from.
|
|
10
|
-
* @returns The map from directional app tagging secret to initial index.
|
|
11
|
-
*/
|
|
12
|
-
export declare function getInitialIndexesMap(preTags: {
|
|
13
|
-
secret: DirectionalAppTaggingSecret;
|
|
14
|
-
index: number | undefined;
|
|
15
|
-
}[]): {
|
|
16
|
-
[k: string]: number;
|
|
17
|
-
};
|
|
18
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXRpbHMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy90YWdnaW5nL3V0aWxzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLDJCQUEyQixFQUFFLE1BQU0sRUFBRSxNQUFNLG9CQUFvQixDQUFDO0FBSTlFLHdCQUFnQixzQkFBc0IsQ0FDcEMsaUJBQWlCLEVBQUU7SUFBRSxNQUFNLEVBQUUsMkJBQTJCLENBQUM7SUFBQyxhQUFhLEVBQUUsTUFBTSxDQUFDO0lBQUMsY0FBYyxFQUFFLE1BQU0sQ0FBQTtDQUFFLEVBQUUsR0FDMUcsTUFBTSxFQUFFLENBUVY7QUFFRDs7OztHQUlHO0FBQ0gsd0JBQWdCLG9CQUFvQixDQUFDLE9BQU8sRUFBRTtJQUFFLE1BQU0sRUFBRSwyQkFBMkIsQ0FBQztJQUFDLEtBQUssRUFBRSxNQUFNLEdBQUcsU0FBUyxDQUFBO0NBQUUsRUFBRSxHQUFHO0lBQ25ILENBQUMsQ0FBQyxFQUFFLE1BQU0sR0FBRyxNQUFNLENBQUM7Q0FDckIsQ0FRQSJ9
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/tagging/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAI9E,wBAAgB,sBAAsB,CACpC,iBAAiB,EAAE;IAAE,MAAM,EAAE,2BAA2B,CAAC;IAAC,aAAa,EAAE,MAAM,CAAC;IAAC,cAAc,EAAE,MAAM,CAAA;CAAE,EAAE,GAC1G,MAAM,EAAE,CAQV;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE;IAAE,MAAM,EAAE,2BAA2B,CAAC;IAAC,KAAK,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,EAAE,GAAG;IACnH,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACrB,CAQA"}
|
package/dest/tagging/utils.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
// TODO(#17775): If this does not get dropped when implementing the linked issue make this return tags instead. This
|
|
2
|
-
// will move some complexity from syncTaggedLogs to here.
|
|
3
|
-
export function getPreTagsForTheWindow(secretsAndWindows) {
|
|
4
|
-
const secrets = [];
|
|
5
|
-
for (const secretAndWindow of secretsAndWindows){
|
|
6
|
-
for(let i = secretAndWindow.leftMostIndex; i <= secretAndWindow.rightMostIndex; i++){
|
|
7
|
-
secrets.push({
|
|
8
|
-
secret: secretAndWindow.secret,
|
|
9
|
-
index: i
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
return secrets;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Creates a map from directional app tagging secret to initial index.
|
|
17
|
-
* @param preTags - The pre-tags to get the initial indexes map from.
|
|
18
|
-
* @returns The map from directional app tagging secret to initial index.
|
|
19
|
-
*/ export function getInitialIndexesMap(preTags) {
|
|
20
|
-
const initialIndexes = {};
|
|
21
|
-
for (const preTag of preTags){
|
|
22
|
-
initialIndexes[preTag.secret.toString()] = preTag.index ?? 0;
|
|
23
|
-
}
|
|
24
|
-
return initialIndexes;
|
|
25
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import type { L1_TO_L2_MSG_TREE_HEIGHT } from '@aztec/constants';
|
|
2
|
-
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
|
-
import type { SiblingPath } from '@aztec/foundation/trees';
|
|
4
|
-
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
5
|
-
import type { BlockParameter } from '@aztec/stdlib/block';
|
|
6
|
-
import type { AztecNode } from '@aztec/stdlib/interfaces/server';
|
|
7
|
-
import { MerkleTreeId, NullifierMembershipWitness, PublicDataWitness } from '@aztec/stdlib/trees';
|
|
8
|
-
import type { AnchorBlockDataProvider } from '../storage/anchor_block_data_provider/anchor_block_data_provider.js';
|
|
9
|
-
export declare class TreeMembershipService {
|
|
10
|
-
#private;
|
|
11
|
-
private readonly aztecNode;
|
|
12
|
-
private readonly anchorBlockDataProvider;
|
|
13
|
-
constructor(aztecNode: AztecNode, anchorBlockDataProvider: AnchorBlockDataProvider);
|
|
14
|
-
/**
|
|
15
|
-
* Gets the index of a nullifier in the nullifier tree.
|
|
16
|
-
* @returns - The index of the nullifier. Undefined if it does not exist in the tree.
|
|
17
|
-
*/
|
|
18
|
-
getNullifierIndex(nullifier: Fr): Promise<bigint | undefined>;
|
|
19
|
-
/**
|
|
20
|
-
* Fetches the index and sibling path of a leaf at a given block from a given tree.
|
|
21
|
-
* @param blockNumber - The block number at which to get the membership witness.
|
|
22
|
-
* @param treeId - Id of the tree to get the sibling path from.
|
|
23
|
-
* @param leafValue - The leaf value
|
|
24
|
-
* @returns The index and sibling path concatenated [index, sibling_path]
|
|
25
|
-
*/
|
|
26
|
-
getMembershipWitness(blockNumber: BlockParameter, treeId: MerkleTreeId, leafValue: Fr): Promise<Fr[]>;
|
|
27
|
-
/**
|
|
28
|
-
* Returns a low nullifier membership witness for a given nullifier at a given block.
|
|
29
|
-
* @param blockNumber - The block number at which to get the index.
|
|
30
|
-
* @param nullifier - Nullifier we try to find the low nullifier witness for.
|
|
31
|
-
* @returns The low nullifier membership witness (if found).
|
|
32
|
-
* @remarks Low nullifier witness can be used to perform a nullifier non-inclusion proof by leveraging the "linked
|
|
33
|
-
* list structure" of leaves and proving that a lower nullifier is pointing to a bigger next value than the nullifier
|
|
34
|
-
* we are trying to prove non-inclusion for.
|
|
35
|
-
*/
|
|
36
|
-
getLowNullifierMembershipWitness(blockNumber: BlockParameter, nullifier: Fr): Promise<NullifierMembershipWitness | undefined>;
|
|
37
|
-
/**
|
|
38
|
-
* Returns a witness for a given slot of the public data tree at a given block.
|
|
39
|
-
* @param blockNumber - The block number at which to get the witness.
|
|
40
|
-
* @param leafSlot - The slot of the public data in the public data tree.
|
|
41
|
-
*/
|
|
42
|
-
getPublicDataWitness(blockNumber: BlockParameter, leafSlot: Fr): Promise<PublicDataWitness | undefined>;
|
|
43
|
-
/**
|
|
44
|
-
* Looks for the L1 to L2 membership witness of a message at the Aztec node, given its hash.
|
|
45
|
-
* @param contractAddress - Address of a contract by which the message was emitted.
|
|
46
|
-
* @dev Contract address and secret are only used to compute the nullifier to get non-nullified messages.
|
|
47
|
-
* The message nullifier is computed locally, so the secret is not sent to the node.
|
|
48
|
-
* @returns The l1 to l2 membership witness (index of message in the tree and sibling path).
|
|
49
|
-
*/
|
|
50
|
-
getL1ToL2MembershipWitness(contractAddress: AztecAddress, messageHash: Fr, secret: Fr): Promise<[bigint, SiblingPath<typeof L1_TO_L2_MSG_TREE_HEIGHT>]>;
|
|
51
|
-
}
|
|
52
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHJlZV9tZW1iZXJzaGlwX3NlcnZpY2UuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy90cmVlX21lbWJlcnNoaXAvdHJlZV9tZW1iZXJzaGlwX3NlcnZpY2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLEVBQUUsd0JBQXdCLEVBQUUsTUFBTSxrQkFBa0IsQ0FBQztBQUNqRSxPQUFPLEtBQUssRUFBRSxFQUFFLEVBQUUsTUFBTSxnQ0FBZ0MsQ0FBQztBQUN6RCxPQUFPLEtBQUssRUFBRSxXQUFXLEVBQUUsTUFBTSx5QkFBeUIsQ0FBQztBQUMzRCxPQUFPLEtBQUssRUFBRSxZQUFZLEVBQUUsTUFBTSw2QkFBNkIsQ0FBQztBQUNoRSxPQUFPLEtBQUssRUFBRSxjQUFjLEVBQUUsTUFBTSxxQkFBcUIsQ0FBQztBQUMxRCxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUVqRSxPQUFPLEVBQUUsWUFBWSxFQUFFLDBCQUEwQixFQUFFLGlCQUFpQixFQUFFLE1BQU0scUJBQXFCLENBQUM7QUFFbEcsT0FBTyxLQUFLLEVBQUUsdUJBQXVCLEVBQUUsTUFBTSxxRUFBcUUsQ0FBQztBQUVuSCxxQkFBYSxxQkFBcUI7O0lBRTlCLE9BQU8sQ0FBQyxRQUFRLENBQUMsU0FBUztJQUMxQixPQUFPLENBQUMsUUFBUSxDQUFDLHVCQUF1QjtJQUYxQyxZQUNtQixTQUFTLEVBQUUsU0FBUyxFQUNwQix1QkFBdUIsRUFBRSx1QkFBdUIsRUFDL0Q7SUFFSjs7O09BR0c7SUFDSSxpQkFBaUIsQ0FBQyxTQUFTLEVBQUUsRUFBRSwrQkFFckM7SUFFRDs7Ozs7O09BTUc7SUFDVSxvQkFBb0IsQ0FBQyxXQUFXLEVBQUUsY0FBYyxFQUFFLE1BQU0sRUFBRSxZQUFZLEVBQUUsU0FBUyxFQUFFLEVBQUUsR0FBRyxPQUFPLENBQUMsRUFBRSxFQUFFLENBQUMsQ0FNakg7SUFFRDs7Ozs7Ozs7T0FRRztJQUNVLGdDQUFnQyxDQUMzQyxXQUFXLEVBQUUsY0FBYyxFQUMzQixTQUFTLEVBQUUsRUFBRSxHQUNaLE9BQU8sQ0FBQywwQkFBMEIsR0FBRyxTQUFTLENBQUMsQ0FNakQ7SUFFRDs7OztPQUlHO0lBQ1Usb0JBQW9CLENBQUMsV0FBVyxFQUFFLGNBQWMsRUFBRSxRQUFRLEVBQUUsRUFBRSxHQUFHLE9BQU8sQ0FBQyxpQkFBaUIsR0FBRyxTQUFTLENBQUMsQ0FNbkg7SUFFRDs7Ozs7O09BTUc7SUFDSSwwQkFBMEIsQ0FDL0IsZUFBZSxFQUFFLFlBQVksRUFDN0IsV0FBVyxFQUFFLEVBQUUsRUFDZixNQUFNLEVBQUUsRUFBRSxHQUNULE9BQU8sQ0FBQyxDQUFDLE1BQU0sRUFBRSxXQUFXLENBQUMsT0FBTyx3QkFBd0IsQ0FBQyxDQUFDLENBQUMsQ0FFakU7Q0F5QkYifQ==
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tree_membership_service.d.ts","sourceRoot":"","sources":["../../src/tree_membership/tree_membership_service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAEjE,OAAO,EAAE,YAAY,EAAE,0BAA0B,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAElG,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qEAAqE,CAAC;AAEnH,qBAAa,qBAAqB;;IAE9B,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,uBAAuB;IAF1C,YACmB,SAAS,EAAE,SAAS,EACpB,uBAAuB,EAAE,uBAAuB,EAC/D;IAEJ;;;OAGG;IACI,iBAAiB,CAAC,SAAS,EAAE,EAAE,+BAErC;IAED;;;;;;OAMG;IACU,oBAAoB,CAAC,WAAW,EAAE,cAAc,EAAE,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,EAAE,GAAG,OAAO,CAAC,EAAE,EAAE,CAAC,CAMjH;IAED;;;;;;;;OAQG;IACU,gCAAgC,CAC3C,WAAW,EAAE,cAAc,EAC3B,SAAS,EAAE,EAAE,GACZ,OAAO,CAAC,0BAA0B,GAAG,SAAS,CAAC,CAMjD;IAED;;;;OAIG;IACU,oBAAoB,CAAC,WAAW,EAAE,cAAc,EAAE,QAAQ,EAAE,EAAE,GAAG,OAAO,CAAC,iBAAiB,GAAG,SAAS,CAAC,CAMnH;IAED;;;;;;OAMG;IACI,0BAA0B,CAC/B,eAAe,EAAE,YAAY,EAC7B,WAAW,EAAE,EAAE,EACf,MAAM,EAAE,EAAE,GACT,OAAO,CAAC,CAAC,MAAM,EAAE,WAAW,CAAC,OAAO,wBAAwB,CAAC,CAAC,CAAC,CAEjE;CAyBF"}
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import { getNonNullifiedL1ToL2MessageWitness } from '@aztec/stdlib/messaging';
|
|
2
|
-
import { MerkleTreeId } from '@aztec/stdlib/trees';
|
|
3
|
-
export class TreeMembershipService {
|
|
4
|
-
aztecNode;
|
|
5
|
-
anchorBlockDataProvider;
|
|
6
|
-
constructor(aztecNode, anchorBlockDataProvider){
|
|
7
|
-
this.aztecNode = aztecNode;
|
|
8
|
-
this.anchorBlockDataProvider = anchorBlockDataProvider;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Gets the index of a nullifier in the nullifier tree.
|
|
12
|
-
* @returns - The index of the nullifier. Undefined if it does not exist in the tree.
|
|
13
|
-
*/ getNullifierIndex(nullifier) {
|
|
14
|
-
return this.#findLeafIndex('latest', MerkleTreeId.NULLIFIER_TREE, nullifier);
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Fetches the index and sibling path of a leaf at a given block from a given tree.
|
|
18
|
-
* @param blockNumber - The block number at which to get the membership witness.
|
|
19
|
-
* @param treeId - Id of the tree to get the sibling path from.
|
|
20
|
-
* @param leafValue - The leaf value
|
|
21
|
-
* @returns The index and sibling path concatenated [index, sibling_path]
|
|
22
|
-
*/ async getMembershipWitness(blockNumber, treeId, leafValue) {
|
|
23
|
-
const witness = await this.#tryGetMembershipWitness(blockNumber, treeId, leafValue);
|
|
24
|
-
if (!witness) {
|
|
25
|
-
throw new Error(`Leaf value ${leafValue} not found in tree ${MerkleTreeId[treeId]} at block ${blockNumber}`);
|
|
26
|
-
}
|
|
27
|
-
return witness;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Returns a low nullifier membership witness for a given nullifier at a given block.
|
|
31
|
-
* @param blockNumber - The block number at which to get the index.
|
|
32
|
-
* @param nullifier - Nullifier we try to find the low nullifier witness for.
|
|
33
|
-
* @returns The low nullifier membership witness (if found).
|
|
34
|
-
* @remarks Low nullifier witness can be used to perform a nullifier non-inclusion proof by leveraging the "linked
|
|
35
|
-
* list structure" of leaves and proving that a lower nullifier is pointing to a bigger next value than the nullifier
|
|
36
|
-
* we are trying to prove non-inclusion for.
|
|
37
|
-
*/ async getLowNullifierMembershipWitness(blockNumber, nullifier) {
|
|
38
|
-
const anchorBlockNumber = (await this.anchorBlockDataProvider.getBlockHeader()).getBlockNumber();
|
|
39
|
-
if (blockNumber !== 'latest' && blockNumber > anchorBlockNumber) {
|
|
40
|
-
throw new Error(`Block number ${blockNumber} is higher than current block ${anchorBlockNumber}`);
|
|
41
|
-
}
|
|
42
|
-
return this.aztecNode.getLowNullifierMembershipWitness(blockNumber, nullifier);
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Returns a witness for a given slot of the public data tree at a given block.
|
|
46
|
-
* @param blockNumber - The block number at which to get the witness.
|
|
47
|
-
* @param leafSlot - The slot of the public data in the public data tree.
|
|
48
|
-
*/ async getPublicDataWitness(blockNumber, leafSlot) {
|
|
49
|
-
const anchorBlockNumber = (await this.anchorBlockDataProvider.getBlockHeader()).getBlockNumber();
|
|
50
|
-
if (blockNumber !== 'latest' && blockNumber > anchorBlockNumber) {
|
|
51
|
-
throw new Error(`Block number ${blockNumber} is higher than current block ${anchorBlockNumber}`);
|
|
52
|
-
}
|
|
53
|
-
return await this.aztecNode.getPublicDataWitness(blockNumber, leafSlot);
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Looks for the L1 to L2 membership witness of a message at the Aztec node, given its hash.
|
|
57
|
-
* @param contractAddress - Address of a contract by which the message was emitted.
|
|
58
|
-
* @dev Contract address and secret are only used to compute the nullifier to get non-nullified messages.
|
|
59
|
-
* The message nullifier is computed locally, so the secret is not sent to the node.
|
|
60
|
-
* @returns The l1 to l2 membership witness (index of message in the tree and sibling path).
|
|
61
|
-
*/ getL1ToL2MembershipWitness(contractAddress, messageHash, secret) {
|
|
62
|
-
return getNonNullifiedL1ToL2MessageWitness(this.aztecNode, contractAddress, messageHash, secret);
|
|
63
|
-
}
|
|
64
|
-
async #tryGetMembershipWitness(blockNumber, treeId, value) {
|
|
65
|
-
switch(treeId){
|
|
66
|
-
case MerkleTreeId.NULLIFIER_TREE:
|
|
67
|
-
return (await this.aztecNode.getNullifierMembershipWitness(blockNumber, value))?.withoutPreimage().toFields();
|
|
68
|
-
case MerkleTreeId.NOTE_HASH_TREE:
|
|
69
|
-
return (await this.aztecNode.getNoteHashMembershipWitness(blockNumber, value))?.toFields();
|
|
70
|
-
case MerkleTreeId.PUBLIC_DATA_TREE:
|
|
71
|
-
return (await this.aztecNode.getPublicDataWitness(blockNumber, value))?.withoutPreimage().toFields();
|
|
72
|
-
case MerkleTreeId.ARCHIVE:
|
|
73
|
-
return (await this.aztecNode.getArchiveMembershipWitness(blockNumber, value))?.toFields();
|
|
74
|
-
default:
|
|
75
|
-
throw new Error('Not implemented');
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
async #findLeafIndex(blockNumber, treeId, leafValue) {
|
|
79
|
-
const [leafIndex] = await this.aztecNode.findLeavesIndexes(blockNumber, treeId, [
|
|
80
|
-
leafValue
|
|
81
|
-
]);
|
|
82
|
-
return leafIndex?.data;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { Timer } from '@aztec/foundation/timer';
|
|
2
|
-
import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
3
|
-
import type { NodeStats } from '@aztec/stdlib/tx';
|
|
4
|
-
|
|
5
|
-
/*
|
|
6
|
-
* Proxy generator for an AztecNode that tracks the time taken for each RPC call.
|
|
7
|
-
*/
|
|
8
|
-
export type ProxiedNode = AztecNode & { getStats(): NodeStats };
|
|
9
|
-
|
|
10
|
-
export class ProxiedNodeFactory {
|
|
11
|
-
static create(node: AztecNode) {
|
|
12
|
-
const stats: Partial<Record<keyof AztecNode, { times: number[] }>> = {};
|
|
13
|
-
return new Proxy(node, {
|
|
14
|
-
get(target, prop: keyof ProxiedNode) {
|
|
15
|
-
if (prop === 'getStats') {
|
|
16
|
-
return () => {
|
|
17
|
-
return stats;
|
|
18
|
-
};
|
|
19
|
-
} else {
|
|
20
|
-
return async function (...args: any[]) {
|
|
21
|
-
if (!stats[prop]) {
|
|
22
|
-
stats[prop] = { times: [] };
|
|
23
|
-
}
|
|
24
|
-
const timer = new Timer();
|
|
25
|
-
const result = await (target[prop] as any).apply(target, args);
|
|
26
|
-
stats[prop].times.push(timer.ms());
|
|
27
|
-
return result;
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
},
|
|
31
|
-
}) as ProxiedNode;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
import { NOTE_HASH_TREE_HEIGHT, PUBLIC_DATA_TREE_HEIGHT, VK_TREE_HEIGHT } from '@aztec/constants';
|
|
2
|
-
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
|
-
import type { GrumpkinScalar, Point } from '@aztec/foundation/curves/grumpkin';
|
|
4
|
-
import { createLogger } from '@aztec/foundation/log';
|
|
5
|
-
import type { Tuple } from '@aztec/foundation/serialize';
|
|
6
|
-
import { MembershipWitness } from '@aztec/foundation/trees';
|
|
7
|
-
import type { KeyStore } from '@aztec/key-store';
|
|
8
|
-
import { getVKIndex, getVKSiblingPath } from '@aztec/noir-protocol-circuits-types/vk-tree';
|
|
9
|
-
import { ProtocolContractAddress } from '@aztec/protocol-contracts';
|
|
10
|
-
import type { FunctionSelector } from '@aztec/stdlib/abi';
|
|
11
|
-
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
12
|
-
import type { BlockParameter } from '@aztec/stdlib/block';
|
|
13
|
-
import { computeContractClassIdPreimage, computeSaltedInitializationHash } from '@aztec/stdlib/contract';
|
|
14
|
-
import { DelayedPublicMutableValues, DelayedPublicMutableValuesWithHash } from '@aztec/stdlib/delayed-public-mutable';
|
|
15
|
-
import { computePublicDataTreeLeafSlot } from '@aztec/stdlib/hash';
|
|
16
|
-
import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
17
|
-
import { UpdatedClassIdHints } from '@aztec/stdlib/kernel';
|
|
18
|
-
import type { NullifierMembershipWitness } from '@aztec/stdlib/trees';
|
|
19
|
-
import type { VerificationKeyAsFields } from '@aztec/stdlib/vks';
|
|
20
|
-
|
|
21
|
-
import type { ContractDataProvider } from '../storage/contract_data_provider/contract_data_provider.js';
|
|
22
|
-
import type { PrivateKernelOracle } from './private_kernel_oracle.js';
|
|
23
|
-
|
|
24
|
-
// TODO: Block number should not be "latest".
|
|
25
|
-
// 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.
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* A data oracle that provides information needed for simulating a transaction.
|
|
29
|
-
*/
|
|
30
|
-
export class PrivateKernelOracleImpl implements PrivateKernelOracle {
|
|
31
|
-
constructor(
|
|
32
|
-
private contractDataProvider: ContractDataProvider,
|
|
33
|
-
private keyStore: KeyStore,
|
|
34
|
-
private node: AztecNode,
|
|
35
|
-
private blockNumber: BlockParameter = 'latest',
|
|
36
|
-
private log = createLogger('pxe:kernel_oracle'),
|
|
37
|
-
) {}
|
|
38
|
-
|
|
39
|
-
public async getContractAddressPreimage(address: AztecAddress) {
|
|
40
|
-
const instance = await this.contractDataProvider.getContractInstance(address);
|
|
41
|
-
if (!instance) {
|
|
42
|
-
throw new Error(`Contract instance not found when getting address preimage. Contract address: ${address}.`);
|
|
43
|
-
}
|
|
44
|
-
return {
|
|
45
|
-
saltedInitializationHash: await computeSaltedInitializationHash(instance),
|
|
46
|
-
...instance,
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
public async getContractClassIdPreimage(contractClassId: Fr) {
|
|
51
|
-
const contractClass = await this.contractDataProvider.getContractClass(contractClassId);
|
|
52
|
-
if (!contractClass) {
|
|
53
|
-
throw new Error(`Contract class not found when getting class id preimage. Class id: ${contractClassId}.`);
|
|
54
|
-
}
|
|
55
|
-
return computeContractClassIdPreimage(contractClass);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
public async getFunctionMembershipWitness(contractClassId: Fr, selector: FunctionSelector) {
|
|
59
|
-
const membershipWitness = await this.contractDataProvider.getFunctionMembershipWitness(contractClassId, selector);
|
|
60
|
-
if (!membershipWitness) {
|
|
61
|
-
throw new Error(
|
|
62
|
-
`Membership witness not found for contract class id ${contractClassId} and selector ${selector}.`,
|
|
63
|
-
);
|
|
64
|
-
}
|
|
65
|
-
return membershipWitness;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
public getVkMembershipWitness(vk: VerificationKeyAsFields) {
|
|
69
|
-
const leafIndex = getVKIndex(vk);
|
|
70
|
-
return Promise.resolve(new MembershipWitness(VK_TREE_HEIGHT, BigInt(leafIndex), getVKSiblingPath(leafIndex)));
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
async getNoteHashMembershipWitness(leafIndex: bigint): Promise<MembershipWitness<typeof NOTE_HASH_TREE_HEIGHT>> {
|
|
74
|
-
const path = await this.node.getNoteHashSiblingPath(this.blockNumber, leafIndex);
|
|
75
|
-
return new MembershipWitness<typeof NOTE_HASH_TREE_HEIGHT>(
|
|
76
|
-
path.pathSize,
|
|
77
|
-
leafIndex,
|
|
78
|
-
path.toFields() as Tuple<Fr, typeof NOTE_HASH_TREE_HEIGHT>,
|
|
79
|
-
);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
getNullifierMembershipWitness(nullifier: Fr): Promise<NullifierMembershipWitness | undefined> {
|
|
83
|
-
return this.node.getNullifierMembershipWitness(this.blockNumber, nullifier);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
async getNoteHashTreeRoot(): Promise<Fr> {
|
|
87
|
-
const header = await this.node.getBlockHeader(this.blockNumber);
|
|
88
|
-
if (!header) {
|
|
89
|
-
throw new Error(`No block header found for block number ${this.blockNumber}`);
|
|
90
|
-
}
|
|
91
|
-
return header.state.partial.noteHashTree.root;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
public getMasterSecretKey(masterPublicKey: Point): Promise<GrumpkinScalar> {
|
|
95
|
-
return this.keyStore.getMasterSecretKey(masterPublicKey);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
public getDebugFunctionName(contractAddress: AztecAddress, selector: FunctionSelector): Promise<string> {
|
|
99
|
-
return this.contractDataProvider.getDebugFunctionName(contractAddress, selector);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
public async getUpdatedClassIdHints(contractAddress: AztecAddress): Promise<UpdatedClassIdHints> {
|
|
103
|
-
const { delayedPublicMutableSlot, delayedPublicMutableHashSlot } =
|
|
104
|
-
await DelayedPublicMutableValuesWithHash.getContractUpdateSlots(contractAddress);
|
|
105
|
-
|
|
106
|
-
const hashLeafSlot = await computePublicDataTreeLeafSlot(
|
|
107
|
-
ProtocolContractAddress.ContractInstanceRegistry,
|
|
108
|
-
delayedPublicMutableHashSlot,
|
|
109
|
-
);
|
|
110
|
-
const updatedClassIdWitness = await this.node.getPublicDataWitness(this.blockNumber, hashLeafSlot);
|
|
111
|
-
|
|
112
|
-
if (!updatedClassIdWitness) {
|
|
113
|
-
throw new Error(`No public data tree witness found for ${hashLeafSlot}`);
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
const readStorage = (storageSlot: Fr) =>
|
|
117
|
-
this.node.getPublicStorageAt(this.blockNumber, ProtocolContractAddress.ContractInstanceRegistry, storageSlot);
|
|
118
|
-
const delayedPublicMutableValues = await DelayedPublicMutableValues.readFromTree(
|
|
119
|
-
delayedPublicMutableSlot,
|
|
120
|
-
readStorage,
|
|
121
|
-
);
|
|
122
|
-
|
|
123
|
-
return new UpdatedClassIdHints(
|
|
124
|
-
new MembershipWitness(
|
|
125
|
-
PUBLIC_DATA_TREE_HEIGHT,
|
|
126
|
-
updatedClassIdWitness.index,
|
|
127
|
-
updatedClassIdWitness.siblingPath.toTuple(),
|
|
128
|
-
),
|
|
129
|
-
updatedClassIdWitness.leafPreimage,
|
|
130
|
-
delayedPublicMutableValues,
|
|
131
|
-
);
|
|
132
|
-
}
|
|
133
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
|
-
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
3
|
-
import type { BlockParameter } from '@aztec/stdlib/block';
|
|
4
|
-
import type { AztecNode } from '@aztec/stdlib/interfaces/server';
|
|
5
|
-
|
|
6
|
-
import type { AnchorBlockDataProvider } from '../storage/anchor_block_data_provider/anchor_block_data_provider.js';
|
|
7
|
-
|
|
8
|
-
export class PublicStorageService {
|
|
9
|
-
constructor(
|
|
10
|
-
private readonly anchorBlockDataProvider: AnchorBlockDataProvider,
|
|
11
|
-
private readonly aztecNode: AztecNode,
|
|
12
|
-
) {}
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Gets the storage value at the given contract storage slot.
|
|
16
|
-
*
|
|
17
|
-
* @remarks The storage slot here refers to the slot as it is defined in Noir not the index in the merkle tree.
|
|
18
|
-
* Aztec's version of `eth_getStorageAt`.
|
|
19
|
-
*
|
|
20
|
-
* @param blockNumber - The block number at which to get the data.
|
|
21
|
-
* @param contract - Address of the contract to query.
|
|
22
|
-
* @param slot - Slot to query.
|
|
23
|
-
* @returns Storage value at the given contract slot.
|
|
24
|
-
* @throws If the contract is not deployed.
|
|
25
|
-
*/
|
|
26
|
-
public async getPublicStorageAt(blockNumber: BlockParameter, contract: AztecAddress, slot: Fr): Promise<Fr> {
|
|
27
|
-
const anchorBlockNumber = (await this.anchorBlockDataProvider.getBlockHeader()).getBlockNumber();
|
|
28
|
-
if (blockNumber !== 'latest' && blockNumber > anchorBlockNumber) {
|
|
29
|
-
throw new Error(`Block number ${blockNumber} is higher than current block ${anchorBlockNumber}`);
|
|
30
|
-
}
|
|
31
|
-
return await this.aztecNode.getPublicStorageAt(blockNumber, contract, slot);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { AddressDataProvider } from './address_data_provider.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { AnchorBlockDataProvider } from './anchor_block_data_provider.js';
|