@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
package/dest/pxe.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
1
|
import { createLogger } from '@aztec/foundation/log';
|
|
3
2
|
import { SerialQueue } from '@aztec/foundation/queue';
|
|
4
3
|
import { Timer } from '@aztec/foundation/timer';
|
|
@@ -8,26 +7,28 @@ import { protocolContractNames } from '@aztec/protocol-contracts';
|
|
|
8
7
|
import { FunctionType, decodeFunctionSignature } from '@aztec/stdlib/abi';
|
|
9
8
|
import { computeContractAddressFromInstance, getContractClassFromArtifact } from '@aztec/stdlib/contract';
|
|
10
9
|
import { SimulationError } from '@aztec/stdlib/errors';
|
|
11
|
-
import { computeProtocolNullifier, siloNullifier } from '@aztec/stdlib/hash';
|
|
12
10
|
import { PrivateSimulationResult, TxProfileResult, TxProvingResult, TxSimulationResult } from '@aztec/stdlib/tx';
|
|
13
11
|
import { inspect } from 'util';
|
|
14
12
|
import { BlockSynchronizer } from './block_synchronizer/index.js';
|
|
13
|
+
import { BenchmarkedNodeFactory } from './contract_function_simulator/benchmarked_node.js';
|
|
15
14
|
import { ContractFunctionSimulator, generateSimulatedProvingResult } from './contract_function_simulator/contract_function_simulator.js';
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
15
|
+
import { ProxiedContractStoreFactory } from './contract_function_simulator/proxied_contract_data_source.js';
|
|
16
|
+
import { ensureContractSynced, readCurrentClassId } from './contract_sync/index.js';
|
|
18
17
|
import { PXEDebugUtils } from './debug/pxe_debug_utils.js';
|
|
19
18
|
import { enrichPublicSimulationError, enrichSimulationError } from './error_enriching.js';
|
|
20
19
|
import { PrivateEventFilterValidator } from './events/private_event_filter_validator.js';
|
|
20
|
+
import { JobCoordinator } from './job_coordinator/job_coordinator.js';
|
|
21
21
|
import { PrivateKernelExecutionProver } from './private_kernel/private_kernel_execution_prover.js';
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
22
|
+
import { PrivateKernelOracle } from './private_kernel/private_kernel_oracle.js';
|
|
23
|
+
import { AddressStore } from './storage/address_store/address_store.js';
|
|
24
|
+
import { AnchorBlockStore } from './storage/anchor_block_store/anchor_block_store.js';
|
|
25
|
+
import { CapsuleStore } from './storage/capsule_store/capsule_store.js';
|
|
26
|
+
import { ContractStore } from './storage/contract_store/contract_store.js';
|
|
27
|
+
import { NoteStore } from './storage/note_store/note_store.js';
|
|
28
|
+
import { PrivateEventStore } from './storage/private_event_store/private_event_store.js';
|
|
29
|
+
import { RecipientTaggingStore } from './storage/tagging_store/recipient_tagging_store.js';
|
|
30
|
+
import { SenderAddressBookStore } from './storage/tagging_store/sender_address_book_store.js';
|
|
31
|
+
import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store.js';
|
|
31
32
|
/**
|
|
32
33
|
* Private eXecution Environment (PXE) is a library used by wallets to simulate private phase of transactions and to
|
|
33
34
|
* manage private state of users.
|
|
@@ -35,39 +36,43 @@ import { SenderTaggingDataProvider } from './storage/tagging_data_provider/sende
|
|
|
35
36
|
node;
|
|
36
37
|
blockStateSynchronizer;
|
|
37
38
|
keyStore;
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
39
|
+
contractStore;
|
|
40
|
+
noteStore;
|
|
41
|
+
capsuleStore;
|
|
42
|
+
anchorBlockStore;
|
|
43
|
+
senderTaggingStore;
|
|
44
|
+
senderAddressBookStore;
|
|
45
|
+
recipientTaggingStore;
|
|
46
|
+
addressStore;
|
|
47
|
+
privateEventStore;
|
|
46
48
|
simulator;
|
|
47
49
|
proverEnabled;
|
|
48
50
|
proofCreator;
|
|
49
51
|
protocolContractsProvider;
|
|
50
52
|
log;
|
|
51
53
|
jobQueue;
|
|
54
|
+
jobCoordinator;
|
|
52
55
|
debug;
|
|
53
|
-
constructor(node, blockStateSynchronizer, keyStore,
|
|
56
|
+
constructor(node, blockStateSynchronizer, keyStore, contractStore, noteStore, capsuleStore, anchorBlockStore, senderTaggingStore, senderAddressBookStore, recipientTaggingStore, addressStore, privateEventStore, simulator, proverEnabled, proofCreator, protocolContractsProvider, log, jobQueue, jobCoordinator, debug){
|
|
54
57
|
this.node = node;
|
|
55
58
|
this.blockStateSynchronizer = blockStateSynchronizer;
|
|
56
59
|
this.keyStore = keyStore;
|
|
57
|
-
this.
|
|
58
|
-
this.
|
|
59
|
-
this.
|
|
60
|
-
this.
|
|
61
|
-
this.
|
|
62
|
-
this.
|
|
63
|
-
this.
|
|
64
|
-
this.
|
|
60
|
+
this.contractStore = contractStore;
|
|
61
|
+
this.noteStore = noteStore;
|
|
62
|
+
this.capsuleStore = capsuleStore;
|
|
63
|
+
this.anchorBlockStore = anchorBlockStore;
|
|
64
|
+
this.senderTaggingStore = senderTaggingStore;
|
|
65
|
+
this.senderAddressBookStore = senderAddressBookStore;
|
|
66
|
+
this.recipientTaggingStore = recipientTaggingStore;
|
|
67
|
+
this.addressStore = addressStore;
|
|
68
|
+
this.privateEventStore = privateEventStore;
|
|
65
69
|
this.simulator = simulator;
|
|
66
70
|
this.proverEnabled = proverEnabled;
|
|
67
71
|
this.proofCreator = proofCreator;
|
|
68
72
|
this.protocolContractsProvider = protocolContractsProvider;
|
|
69
73
|
this.log = log;
|
|
70
74
|
this.jobQueue = jobQueue;
|
|
75
|
+
this.jobCoordinator = jobCoordinator;
|
|
71
76
|
this.debug = debug;
|
|
72
77
|
}
|
|
73
78
|
/**
|
|
@@ -79,20 +84,29 @@ import { SenderTaggingDataProvider } from './storage/tagging_data_provider/sende
|
|
|
79
84
|
*/ static async create(node, store, proofCreator, simulator, protocolContractsProvider, config, loggerOrSuffix) {
|
|
80
85
|
const log = !loggerOrSuffix || typeof loggerOrSuffix === 'string' ? createLogger(loggerOrSuffix ? `pxe:service:${loggerOrSuffix}` : `pxe:service`) : loggerOrSuffix;
|
|
81
86
|
const proverEnabled = !!config.proverEnabled;
|
|
82
|
-
const
|
|
83
|
-
const
|
|
84
|
-
const
|
|
85
|
-
const
|
|
86
|
-
const
|
|
87
|
-
const
|
|
88
|
-
const
|
|
89
|
-
const
|
|
87
|
+
const addressStore = new AddressStore(store);
|
|
88
|
+
const privateEventStore = new PrivateEventStore(store);
|
|
89
|
+
const contractStore = new ContractStore(store);
|
|
90
|
+
const noteStore = new NoteStore(store);
|
|
91
|
+
const anchorBlockStore = new AnchorBlockStore(store);
|
|
92
|
+
const senderTaggingStore = new SenderTaggingStore(store);
|
|
93
|
+
const senderAddressBookStore = new SenderAddressBookStore(store);
|
|
94
|
+
const recipientTaggingStore = new RecipientTaggingStore(store);
|
|
95
|
+
const capsuleStore = new CapsuleStore(store);
|
|
90
96
|
const keyStore = new KeyStore(store);
|
|
91
97
|
const tipsStore = new L2TipsKVStore(store, 'pxe');
|
|
92
|
-
const synchronizer = new BlockSynchronizer(node,
|
|
93
|
-
const
|
|
98
|
+
const synchronizer = new BlockSynchronizer(node, store, anchorBlockStore, noteStore, privateEventStore, tipsStore, config, loggerOrSuffix);
|
|
99
|
+
const jobCoordinator = new JobCoordinator(store);
|
|
100
|
+
jobCoordinator.registerStores([
|
|
101
|
+
capsuleStore,
|
|
102
|
+
senderTaggingStore,
|
|
103
|
+
recipientTaggingStore,
|
|
104
|
+
privateEventStore,
|
|
105
|
+
noteStore
|
|
106
|
+
]);
|
|
107
|
+
const debugUtils = new PXEDebugUtils(contractStore, noteStore);
|
|
94
108
|
const jobQueue = new SerialQueue();
|
|
95
|
-
const pxe = new PXE(node, synchronizer, keyStore,
|
|
109
|
+
const pxe = new PXE(node, synchronizer, keyStore, contractStore, noteStore, capsuleStore, anchorBlockStore, senderTaggingStore, senderAddressBookStore, recipientTaggingStore, addressStore, privateEventStore, simulator, proverEnabled, proofCreator, protocolContractsProvider, log, jobQueue, jobCoordinator, debugUtils);
|
|
96
110
|
debugUtils.setPXE(pxe);
|
|
97
111
|
pxe.jobQueue.start();
|
|
98
112
|
await pxe.#registerProtocolContracts();
|
|
@@ -102,8 +116,8 @@ import { SenderTaggingDataProvider } from './storage/tagging_data_provider/sende
|
|
|
102
116
|
}
|
|
103
117
|
// Internal methods
|
|
104
118
|
#getSimulatorForTx(overrides) {
|
|
105
|
-
const
|
|
106
|
-
return new ContractFunctionSimulator(
|
|
119
|
+
const proxyContractStore = ProxiedContractStoreFactory.create(this.contractStore, overrides?.contracts);
|
|
120
|
+
return new ContractFunctionSimulator(proxyContractStore, this.noteStore, this.keyStore, this.addressStore, BenchmarkedNodeFactory.create(this.node), this.anchorBlockStore, this.senderTaggingStore, this.recipientTaggingStore, this.senderAddressBookStore, this.capsuleStore, this.privateEventStore, this.simulator);
|
|
107
121
|
}
|
|
108
122
|
#contextualizeError(err, ...context) {
|
|
109
123
|
let contextStr = '';
|
|
@@ -128,42 +142,46 @@ import { SenderTaggingDataProvider } from './storage/tagging_data_provider/sende
|
|
|
128
142
|
if (this.jobQueue.length() != 0) {
|
|
129
143
|
this.log.warn(`PXE is already processing ${this.jobQueue.length()} jobs, concurrent execution is not supported. Will run once those are complete.`);
|
|
130
144
|
}
|
|
131
|
-
return this.jobQueue.put(
|
|
145
|
+
return this.jobQueue.put(async ()=>{
|
|
146
|
+
const jobId = this.jobCoordinator.beginJob();
|
|
147
|
+
this.log.verbose(`Beginning job ${jobId}`);
|
|
148
|
+
try {
|
|
149
|
+
const result = await fn(jobId);
|
|
150
|
+
this.log.verbose(`Committing job ${jobId}`);
|
|
151
|
+
await this.jobCoordinator.commitJob(jobId);
|
|
152
|
+
return result;
|
|
153
|
+
} catch (err) {
|
|
154
|
+
this.log.verbose(`Aborting job ${jobId}`);
|
|
155
|
+
await this.jobCoordinator.abortJob(jobId);
|
|
156
|
+
throw err;
|
|
157
|
+
}
|
|
158
|
+
});
|
|
132
159
|
}
|
|
133
160
|
async #registerProtocolContracts() {
|
|
134
161
|
const registered = {};
|
|
135
162
|
for (const name of protocolContractNames){
|
|
136
163
|
const { address, contractClass, instance, artifact } = await this.protocolContractsProvider.getProtocolContractArtifact(name);
|
|
137
|
-
await this.
|
|
138
|
-
await this.
|
|
164
|
+
await this.contractStore.addContractArtifact(contractClass.id, artifact);
|
|
165
|
+
await this.contractStore.addContractInstance(instance);
|
|
139
166
|
registered[name] = address.toString();
|
|
140
167
|
}
|
|
141
168
|
this.log.verbose(`Registered protocol contracts in pxe`, registered);
|
|
142
169
|
}
|
|
143
|
-
async #isContractClassPubliclyRegistered(id) {
|
|
144
|
-
return !!await this.node.getContractClass(id);
|
|
145
|
-
}
|
|
146
|
-
async #isContractPublished(address) {
|
|
147
|
-
return !!await this.node.getContract(address);
|
|
148
|
-
}
|
|
149
|
-
async #isContractInitialized(address) {
|
|
150
|
-
const initNullifier = await siloNullifier(address, address.toField());
|
|
151
|
-
return !!await this.node.getNullifierMembershipWitness('latest', initNullifier);
|
|
152
|
-
}
|
|
153
170
|
// Executes the entrypoint private function, as well as all nested private
|
|
154
171
|
// functions that might arise.
|
|
155
|
-
async #executePrivate(contractFunctionSimulator, txRequest, scopes) {
|
|
172
|
+
async #executePrivate(contractFunctionSimulator, txRequest, scopes, jobId) {
|
|
156
173
|
const { origin: contractAddress, functionSelector } = txRequest;
|
|
157
174
|
try {
|
|
158
|
-
const anchorBlockHeader = await this.
|
|
175
|
+
const anchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
|
|
176
|
+
await ensureContractSynced(contractAddress, functionSelector, (privateSyncCall)=>this.#simulateUtility(contractFunctionSimulator, privateSyncCall, [], undefined, jobId), this.node, this.contractStore, anchorBlockHeader);
|
|
159
177
|
const result = await contractFunctionSimulator.run(txRequest, contractAddress, functionSelector, undefined, anchorBlockHeader, // The sender for tags is set by contracts, typically by an account
|
|
160
178
|
// contract entrypoint
|
|
161
|
-
undefined, scopes);
|
|
179
|
+
undefined, scopes, jobId);
|
|
162
180
|
this.log.debug(`Private simulation completed for ${contractAddress.toString()}:${functionSelector}`);
|
|
163
181
|
return result;
|
|
164
182
|
} catch (err) {
|
|
165
183
|
if (err instanceof SimulationError) {
|
|
166
|
-
await enrichSimulationError(err, this.
|
|
184
|
+
await enrichSimulationError(err, this.contractStore, this.log);
|
|
167
185
|
}
|
|
168
186
|
throw err;
|
|
169
187
|
}
|
|
@@ -175,14 +193,15 @@ import { SenderTaggingDataProvider } from './storage/tagging_data_provider/sende
|
|
|
175
193
|
* @param authWitnesses - Authentication witnesses required for the function call.
|
|
176
194
|
* @param scopes - Optional array of account addresses whose notes can be accessed in this call. Defaults to all
|
|
177
195
|
* accounts if not specified.
|
|
196
|
+
* @param jobId - The job ID for staged writes.
|
|
178
197
|
* @returns The simulation result containing the outputs of the utility function.
|
|
179
|
-
*/ async #simulateUtility(contractFunctionSimulator, call, authWitnesses, scopes) {
|
|
198
|
+
*/ async #simulateUtility(contractFunctionSimulator, call, authWitnesses, scopes, jobId) {
|
|
180
199
|
try {
|
|
181
|
-
const anchorBlockHeader = await this.
|
|
182
|
-
return contractFunctionSimulator.runUtility(call, authWitnesses ?? [], anchorBlockHeader, scopes);
|
|
200
|
+
const anchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
|
|
201
|
+
return contractFunctionSimulator.runUtility(call, authWitnesses ?? [], anchorBlockHeader, scopes, jobId);
|
|
183
202
|
} catch (err) {
|
|
184
203
|
if (err instanceof SimulationError) {
|
|
185
|
-
await enrichSimulationError(err, this.
|
|
204
|
+
await enrichSimulationError(err, this.contractStore, this.log);
|
|
186
205
|
}
|
|
187
206
|
throw err;
|
|
188
207
|
}
|
|
@@ -204,7 +223,7 @@ import { SenderTaggingDataProvider } from './storage/tagging_data_provider/sende
|
|
|
204
223
|
} catch (err) {
|
|
205
224
|
if (err instanceof SimulationError) {
|
|
206
225
|
try {
|
|
207
|
-
await enrichPublicSimulationError(err, this.
|
|
226
|
+
await enrichPublicSimulationError(err, this.contractStore, this.log);
|
|
208
227
|
} catch (enrichErr) {
|
|
209
228
|
this.log.error(`Failed to enrich public simulation error: ${enrichErr}`);
|
|
210
229
|
}
|
|
@@ -223,62 +242,23 @@ import { SenderTaggingDataProvider } from './storage/tagging_data_provider/sende
|
|
|
223
242
|
* @param config - The configuration for the kernel execution prover.
|
|
224
243
|
* @returns An object that contains the output of the kernel execution, including the ChonkProof if proving is enabled.
|
|
225
244
|
*/ async #prove(txExecutionRequest, proofCreator, privateExecutionResult, config) {
|
|
226
|
-
const
|
|
227
|
-
const
|
|
245
|
+
const anchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
|
|
246
|
+
const anchorBlockHash = await anchorBlockHeader.hash();
|
|
247
|
+
const kernelOracle = new PrivateKernelOracle(this.contractStore, this.keyStore, this.node, anchorBlockHash);
|
|
228
248
|
const kernelTraceProver = new PrivateKernelExecutionProver(kernelOracle, proofCreator, !this.proverEnabled);
|
|
229
249
|
this.log.debug(`Executing kernel trace prover (${JSON.stringify(config)})...`);
|
|
230
250
|
return await kernelTraceProver.proveWithKernels(txExecutionRequest.toTxRequest(), privateExecutionResult, config);
|
|
231
251
|
}
|
|
232
252
|
// Public API
|
|
233
253
|
getContractInstance(address) {
|
|
234
|
-
return this.
|
|
235
|
-
}
|
|
236
|
-
/**
|
|
237
|
-
* Returns the contract class metadata given a contract class id.
|
|
238
|
-
* The metadata consists of its contract class, whether it has been publicly registered, and its artifact.
|
|
239
|
-
* @remark - it queries the node to check whether the contract class with the given id has been publicly registered.
|
|
240
|
-
* @param id - Identifier of the class.
|
|
241
|
-
* @param includeArtifact - Identifier of the class.
|
|
242
|
-
* @returns - It returns the contract class metadata, with the artifact field being optional, and will only be returned if true is passed in
|
|
243
|
-
* for `includeArtifact`
|
|
244
|
-
* TODO(@spalladino): The PXE actually holds artifacts and not classes, what should we return? Also,
|
|
245
|
-
* should the pxe query the node for contract public info, and merge it with its own definitions?
|
|
246
|
-
* TODO(@spalladino): This method is strictly needed to decide whether to publicly register a class or not
|
|
247
|
-
* during a public deployment. We probably want a nicer and more general API for this, but it'll have to
|
|
248
|
-
* do for the time being.
|
|
249
|
-
*/ async getContractClassMetadata(id, includeArtifact = false) {
|
|
250
|
-
const artifact = await this.contractDataProvider.getContractArtifact(id);
|
|
251
|
-
if (!artifact) {
|
|
252
|
-
this.log.warn(`No artifact found for contract class ${id.toString()} when looking for its metadata`);
|
|
253
|
-
}
|
|
254
|
-
return {
|
|
255
|
-
contractClass: artifact && await getContractClassFromArtifact(artifact),
|
|
256
|
-
isContractClassPubliclyRegistered: await this.#isContractClassPubliclyRegistered(id),
|
|
257
|
-
artifact: includeArtifact ? artifact : undefined
|
|
258
|
-
};
|
|
254
|
+
return this.contractStore.getContractInstance(address);
|
|
259
255
|
}
|
|
260
256
|
/**
|
|
261
|
-
* Returns the contract
|
|
262
|
-
*
|
|
263
|
-
*
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
* This query is not dependent on the PXE.
|
|
267
|
-
* @param address - The address that the contract instance resides at.
|
|
268
|
-
* @returns - It returns the contract metadata
|
|
269
|
-
* TODO(@spalladino): Should we return the public keys in plain as well here?
|
|
270
|
-
*/ async getContractMetadata(address) {
|
|
271
|
-
let instance;
|
|
272
|
-
try {
|
|
273
|
-
instance = await this.contractDataProvider.getContractInstance(address);
|
|
274
|
-
} catch {
|
|
275
|
-
this.log.warn(`No instance found for contract ${address.toString()} when looking for its metadata`);
|
|
276
|
-
}
|
|
277
|
-
return {
|
|
278
|
-
contractInstance: instance,
|
|
279
|
-
isContractInitialized: await this.#isContractInitialized(address),
|
|
280
|
-
isContractPublished: await this.#isContractPublished(address)
|
|
281
|
-
};
|
|
257
|
+
* Returns the contract artifact for a given contract class id, if it's registered in the PXE.
|
|
258
|
+
* @param id - Identifier of the contract class.
|
|
259
|
+
* @returns The contract artifact if found, undefined otherwise.
|
|
260
|
+
*/ async getContractArtifact(id) {
|
|
261
|
+
return await this.contractStore.getContractArtifact(id);
|
|
282
262
|
}
|
|
283
263
|
/**
|
|
284
264
|
* Registers a user account in PXE given its master encryption private key.
|
|
@@ -299,8 +279,7 @@ import { SenderTaggingDataProvider } from './storage/tagging_data_provider/sende
|
|
|
299
279
|
this.log.info(`Registered account ${accountCompleteAddress.address.toString()}`);
|
|
300
280
|
this.log.debug(`Registered account\n ${accountCompleteAddress.toReadableString()}`);
|
|
301
281
|
}
|
|
302
|
-
await this.
|
|
303
|
-
await this.noteDataProvider.addScope(accountCompleteAddress.address);
|
|
282
|
+
await this.addressStore.addCompleteAddress(accountCompleteAddress);
|
|
304
283
|
return accountCompleteAddress;
|
|
305
284
|
}
|
|
306
285
|
/**
|
|
@@ -318,7 +297,7 @@ import { SenderTaggingDataProvider } from './storage/tagging_data_provider/sende
|
|
|
318
297
|
this.log.info(`Sender:\n "${sender.toString()}"\n already registered.`);
|
|
319
298
|
return sender;
|
|
320
299
|
}
|
|
321
|
-
const wasAdded = await this.
|
|
300
|
+
const wasAdded = await this.senderAddressBookStore.addSender(sender);
|
|
322
301
|
if (wasAdded) {
|
|
323
302
|
this.log.info(`Added sender:\n ${sender.toString()}`);
|
|
324
303
|
} else {
|
|
@@ -330,13 +309,13 @@ import { SenderTaggingDataProvider } from './storage/tagging_data_provider/sende
|
|
|
330
309
|
* Retrieves senders registered in this PXE.
|
|
331
310
|
* @returns Senders registered in this PXE.
|
|
332
311
|
*/ getSenders() {
|
|
333
|
-
return this.
|
|
312
|
+
return this.senderAddressBookStore.getSenders();
|
|
334
313
|
}
|
|
335
314
|
/**
|
|
336
315
|
* Removes a sender registered in this PXE.
|
|
337
316
|
* @param sender - The address of the sender to remove.
|
|
338
317
|
*/ async removeSender(sender) {
|
|
339
|
-
const wasRemoved = await this.
|
|
318
|
+
const wasRemoved = await this.senderAddressBookStore.removeSender(sender);
|
|
340
319
|
if (wasRemoved) {
|
|
341
320
|
this.log.info(`Removed sender:\n ${sender.toString()}`);
|
|
342
321
|
} else {
|
|
@@ -348,7 +327,7 @@ import { SenderTaggingDataProvider } from './storage/tagging_data_provider/sende
|
|
|
348
327
|
* @returns An array of the accounts registered on this PXE.
|
|
349
328
|
*/ async getRegisteredAccounts() {
|
|
350
329
|
// Get complete addresses of both the recipients and the accounts
|
|
351
|
-
const completeAddresses = await this.
|
|
330
|
+
const completeAddresses = await this.addressStore.getCompleteAddresses();
|
|
352
331
|
// Filter out the addresses not corresponding to accounts
|
|
353
332
|
const accounts = await this.keyStore.getAccounts();
|
|
354
333
|
return completeAddresses.filter((completeAddress)=>accounts.find((address)=>address.equals(completeAddress.address)));
|
|
@@ -359,7 +338,7 @@ import { SenderTaggingDataProvider } from './storage/tagging_data_provider/sende
|
|
|
359
338
|
* @param artifact - The build artifact for the contract class.
|
|
360
339
|
*/ async registerContractClass(artifact) {
|
|
361
340
|
const { id: contractClassId } = await getContractClassFromArtifact(artifact);
|
|
362
|
-
await this.
|
|
341
|
+
await this.contractStore.addContractArtifact(contractClassId, artifact);
|
|
363
342
|
this.log.info(`Added contract class ${artifact.name} with id ${contractClassId}`);
|
|
364
343
|
}
|
|
365
344
|
/**
|
|
@@ -383,17 +362,17 @@ import { SenderTaggingDataProvider } from './storage/tagging_data_provider/sende
|
|
|
383
362
|
if (!computedAddress.equals(instance.address)) {
|
|
384
363
|
throw new Error('Added a contract in which the address does not match the contract instance.');
|
|
385
364
|
}
|
|
386
|
-
await this.
|
|
365
|
+
await this.contractStore.addContractArtifact(contractClass.id, artifact);
|
|
387
366
|
const publicFunctionSignatures = artifact.functions.filter((fn)=>fn.functionType === FunctionType.PUBLIC).map((fn)=>decodeFunctionSignature(fn.name, fn.parameters));
|
|
388
367
|
await this.node.registerContractFunctionSignatures(publicFunctionSignatures);
|
|
389
368
|
} else {
|
|
390
369
|
// Otherwise, make sure there is an artifact already registered for that class id
|
|
391
|
-
artifact = await this.
|
|
370
|
+
artifact = await this.contractStore.getContractArtifact(instance.currentContractClassId);
|
|
392
371
|
if (!artifact) {
|
|
393
372
|
throw new Error(`Artifact not found when registering an instance. Contract class: ${instance.currentContractClassId}.`);
|
|
394
373
|
}
|
|
395
374
|
}
|
|
396
|
-
await this.
|
|
375
|
+
await this.contractStore.addContractInstance(instance);
|
|
397
376
|
this.log.info(`Added contract ${artifact.name} at ${instance.address.toString()} with class ${instance.currentContractClassId}`);
|
|
398
377
|
}
|
|
399
378
|
/**
|
|
@@ -408,22 +387,22 @@ import { SenderTaggingDataProvider } from './storage/tagging_data_provider/sende
|
|
|
408
387
|
// We disable concurrently updating contracts to avoid concurrently syncing with the node, or changing a contract's
|
|
409
388
|
// class while we're simulating it.
|
|
410
389
|
return this.#putInJobQueue(async ()=>{
|
|
411
|
-
const currentInstance = await this.
|
|
390
|
+
const currentInstance = await this.contractStore.getContractInstance(contractAddress);
|
|
412
391
|
if (!currentInstance) {
|
|
413
392
|
throw new Error(`Instance not found when updating a contract. Contract address: ${contractAddress}.`);
|
|
414
393
|
}
|
|
415
394
|
const contractClass = await getContractClassFromArtifact(artifact);
|
|
416
395
|
await this.blockStateSynchronizer.sync();
|
|
417
|
-
const header = await this.
|
|
418
|
-
const currentClassId = await readCurrentClassId(contractAddress, currentInstance, this.node, header
|
|
396
|
+
const header = await this.anchorBlockStore.getBlockHeader();
|
|
397
|
+
const currentClassId = await readCurrentClassId(contractAddress, currentInstance, this.node, header);
|
|
419
398
|
if (!contractClass.id.equals(currentClassId)) {
|
|
420
399
|
throw new Error('Could not update contract to a class different from the current one.');
|
|
421
400
|
}
|
|
422
|
-
await this.
|
|
401
|
+
await this.contractStore.addContractArtifact(contractClass.id, artifact);
|
|
423
402
|
const publicFunctionSignatures = artifact.functions.filter((fn)=>fn.functionType === FunctionType.PUBLIC).map((fn)=>decodeFunctionSignature(fn.name, fn.parameters));
|
|
424
403
|
await this.node.registerContractFunctionSignatures(publicFunctionSignatures);
|
|
425
404
|
currentInstance.currentContractClassId = contractClass.id;
|
|
426
|
-
await this.
|
|
405
|
+
await this.contractStore.addContractInstance(currentInstance);
|
|
427
406
|
this.log.info(`Updated contract ${artifact.name} at ${contractAddress.toString()} to class ${contractClass.id}`);
|
|
428
407
|
});
|
|
429
408
|
}
|
|
@@ -431,7 +410,7 @@ import { SenderTaggingDataProvider } from './storage/tagging_data_provider/sende
|
|
|
431
410
|
* Retrieves the addresses of contracts added to this PXE.
|
|
432
411
|
* @returns An array of contracts addresses registered on this PXE.
|
|
433
412
|
*/ getContracts() {
|
|
434
|
-
return this.
|
|
413
|
+
return this.contractStore.getContractsAddresses();
|
|
435
414
|
}
|
|
436
415
|
/**
|
|
437
416
|
* Proves the private portion of a simulated transaction, ready to send to the network
|
|
@@ -445,14 +424,14 @@ import { SenderTaggingDataProvider } from './storage/tagging_data_provider/sende
|
|
|
445
424
|
let privateExecutionResult;
|
|
446
425
|
// We disable proving concurrently mostly out of caution, since it accesses some of our stores. Proving is so
|
|
447
426
|
// computationally demanding that it'd be rare for someone to try to do it concurrently regardless.
|
|
448
|
-
return this.#putInJobQueue(async ()=>{
|
|
427
|
+
return this.#putInJobQueue(async (jobId)=>{
|
|
449
428
|
const totalTimer = new Timer();
|
|
450
429
|
try {
|
|
451
430
|
const syncTimer = new Timer();
|
|
452
431
|
await this.blockStateSynchronizer.sync();
|
|
453
432
|
const syncTime = syncTimer.ms();
|
|
454
433
|
const contractFunctionSimulator = this.#getSimulatorForTx();
|
|
455
|
-
privateExecutionResult = await this.#executePrivate(contractFunctionSimulator, txRequest);
|
|
434
|
+
privateExecutionResult = await this.#executePrivate(contractFunctionSimulator, txRequest, undefined, jobId);
|
|
456
435
|
const { publicInputs, chonkProof, executionSteps, timings: { proving } = {} } = await this.#prove(txRequest, this.proofCreator, privateExecutionResult, {
|
|
457
436
|
simulate: false,
|
|
458
437
|
skipFeeEnforcement: false,
|
|
@@ -487,7 +466,7 @@ import { SenderTaggingDataProvider } from './storage/tagging_data_provider/sende
|
|
|
487
466
|
if (preTagsUsedInTheTx.length > 0) {
|
|
488
467
|
// TODO(benesjan): The following is an expensive operation. Figure out a way to avoid it.
|
|
489
468
|
const txHash = (await txProvingResult.toTx()).txHash;
|
|
490
|
-
await this.
|
|
469
|
+
await this.senderTaggingStore.storePendingIndexes(preTagsUsedInTheTx, txHash, jobId);
|
|
491
470
|
this.log.debug(`Stored used pre-tags as sender for the tx`, {
|
|
492
471
|
preTagsUsedInTheTx
|
|
493
472
|
});
|
|
@@ -510,7 +489,7 @@ import { SenderTaggingDataProvider } from './storage/tagging_data_provider/sende
|
|
|
510
489
|
* @throws If the code for the functions executed in this transaction have not been made available via `addContracts`.
|
|
511
490
|
*/ profileTx(txRequest, profileMode, skipProofGeneration = true) {
|
|
512
491
|
// We disable concurrent profiles for consistency with simulateTx.
|
|
513
|
-
return this.#putInJobQueue(async ()=>{
|
|
492
|
+
return this.#putInJobQueue(async (jobId)=>{
|
|
514
493
|
const totalTimer = new Timer();
|
|
515
494
|
try {
|
|
516
495
|
const txInfo = {
|
|
@@ -526,7 +505,7 @@ import { SenderTaggingDataProvider } from './storage/tagging_data_provider/sende
|
|
|
526
505
|
await this.blockStateSynchronizer.sync();
|
|
527
506
|
const syncTime = syncTimer.ms();
|
|
528
507
|
const contractFunctionSimulator = this.#getSimulatorForTx();
|
|
529
|
-
const privateExecutionResult = await this.#executePrivate(contractFunctionSimulator, txRequest);
|
|
508
|
+
const privateExecutionResult = await this.#executePrivate(contractFunctionSimulator, txRequest, undefined, jobId);
|
|
530
509
|
const { executionSteps, timings: { proving } = {} } = await this.#prove(txRequest, this.proofCreator, privateExecutionResult, {
|
|
531
510
|
simulate: skipProofGeneration,
|
|
532
511
|
skipFeeEnforcement: false,
|
|
@@ -586,7 +565,7 @@ import { SenderTaggingDataProvider } from './storage/tagging_data_provider/sende
|
|
|
586
565
|
// We disable concurrent simulations since those might execute oracles which read and write to the PXE stores (e.g.
|
|
587
566
|
// to the capsules), and we need to prevent concurrent runs from interfering with one another (e.g. attempting to
|
|
588
567
|
// delete the same read value, or reading values that another simulation is currently modifying).
|
|
589
|
-
return this.#putInJobQueue(async ()=>{
|
|
568
|
+
return this.#putInJobQueue(async (jobId)=>{
|
|
590
569
|
try {
|
|
591
570
|
const totalTimer = new Timer();
|
|
592
571
|
const txInfo = {
|
|
@@ -607,14 +586,11 @@ import { SenderTaggingDataProvider } from './storage/tagging_data_provider/sende
|
|
|
607
586
|
// or not.
|
|
608
587
|
const skipKernels = overrides?.contracts !== undefined && Object.keys(overrides.contracts ?? {}).length > 0;
|
|
609
588
|
// Execution of private functions only; no proving, and no kernel logic.
|
|
610
|
-
const privateExecutionResult = await this.#executePrivate(contractFunctionSimulator, txRequest, scopes);
|
|
589
|
+
const privateExecutionResult = await this.#executePrivate(contractFunctionSimulator, txRequest, scopes, jobId);
|
|
611
590
|
let publicInputs;
|
|
612
591
|
let executionSteps = [];
|
|
613
592
|
if (skipKernels) {
|
|
614
|
-
|
|
615
|
-
// can either be the first nullifier in the tx or the protocol nullifier if there are none.
|
|
616
|
-
const nonceGenerator = privateExecutionResult.firstNullifier.equals(Fr.ZERO) ? await computeProtocolNullifier(await txRequest.toTxRequest().hash()) : privateExecutionResult.firstNullifier;
|
|
617
|
-
({ publicInputs, executionSteps } = await generateSimulatedProvingResult(privateExecutionResult, nonceGenerator, this.contractDataProvider));
|
|
593
|
+
({ publicInputs, executionSteps } = await generateSimulatedProvingResult(privateExecutionResult, this.contractStore));
|
|
618
594
|
} else {
|
|
619
595
|
// Kernel logic, plus proving of all private functions and kernels.
|
|
620
596
|
({ publicInputs, executionSteps } = await this.#prove(txRequest, this.proofCreator, privateExecutionResult, {
|
|
@@ -690,7 +666,7 @@ import { SenderTaggingDataProvider } from './storage/tagging_data_provider/sende
|
|
|
690
666
|
// We disable concurrent simulations since those might execute oracles which read and write to the PXE stores (e.g.
|
|
691
667
|
// to the capsules), and we need to prevent concurrent runs from interfering with one another (e.g. attempting to
|
|
692
668
|
// delete the same read value, or reading values that another simulation is currently modifying).
|
|
693
|
-
return this.#putInJobQueue(async ()=>{
|
|
669
|
+
return this.#putInJobQueue(async (jobId)=>{
|
|
694
670
|
try {
|
|
695
671
|
const totalTimer = new Timer();
|
|
696
672
|
const syncTimer = new Timer();
|
|
@@ -698,7 +674,9 @@ import { SenderTaggingDataProvider } from './storage/tagging_data_provider/sende
|
|
|
698
674
|
const syncTime = syncTimer.ms();
|
|
699
675
|
const functionTimer = new Timer();
|
|
700
676
|
const contractFunctionSimulator = this.#getSimulatorForTx();
|
|
701
|
-
const
|
|
677
|
+
const anchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
|
|
678
|
+
await ensureContractSynced(call.to, call.selector, (privateSyncCall)=>this.#simulateUtility(contractFunctionSimulator, privateSyncCall, [], undefined, jobId), this.node, this.contractStore, anchorBlockHeader);
|
|
679
|
+
const executionResult = await this.#simulateUtility(contractFunctionSimulator, call, authwits ?? [], scopes, jobId);
|
|
702
680
|
const functionTime = functionTimer.ms();
|
|
703
681
|
const totalTime = totalTimer.ms();
|
|
704
682
|
const perFunction = [
|
|
@@ -741,12 +719,18 @@ import { SenderTaggingDataProvider } from './storage/tagging_data_provider/sende
|
|
|
741
719
|
* Defaults to the latest known block to PXE + 1.
|
|
742
720
|
* @returns - The packed events with block and tx metadata.
|
|
743
721
|
*/ async getPrivateEvents(eventSelector, filter) {
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
722
|
+
let anchorBlockNumber;
|
|
723
|
+
await this.#putInJobQueue(async (jobId)=>{
|
|
724
|
+
await this.blockStateSynchronizer.sync();
|
|
725
|
+
const anchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
|
|
726
|
+
anchorBlockNumber = anchorBlockHeader.getBlockNumber();
|
|
727
|
+
const contractFunctionSimulator = this.#getSimulatorForTx();
|
|
728
|
+
await ensureContractSynced(filter.contractAddress, null, async (privateSyncCall)=>await this.#simulateUtility(contractFunctionSimulator, privateSyncCall, [], undefined, jobId), this.node, this.contractStore, anchorBlockHeader);
|
|
729
|
+
});
|
|
730
|
+
// anchorBlockNumber is set during the job and fixed to whatever it is after a block sync
|
|
731
|
+
const sanitizedFilter = new PrivateEventFilterValidator(anchorBlockNumber).validate(filter);
|
|
748
732
|
this.log.debug(`Getting private events for ${sanitizedFilter.contractAddress.toString()} from ${sanitizedFilter.fromBlock} to ${sanitizedFilter.toBlock}`);
|
|
749
|
-
return this.
|
|
733
|
+
return this.privateEventStore.getPrivateEvents(eventSelector, sanitizedFilter);
|
|
750
734
|
}
|
|
751
735
|
/**
|
|
752
736
|
* Stops the PXE's job queue.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { AztecAsyncKVStore } from '@aztec/kv-store';
|
|
2
|
+
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
3
|
+
import { CompleteAddress } from '@aztec/stdlib/contract';
|
|
4
|
+
export declare class AddressStore {
|
|
5
|
+
#private;
|
|
6
|
+
constructor(store: AztecAsyncKVStore);
|
|
7
|
+
addCompleteAddress(completeAddress: CompleteAddress): Promise<boolean>;
|
|
8
|
+
getCompleteAddress(account: AztecAddress): Promise<CompleteAddress | undefined>;
|
|
9
|
+
getCompleteAddresses(): Promise<CompleteAddress[]>;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYWRkcmVzc19zdG9yZS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL3N0b3JhZ2UvYWRkcmVzc19zdG9yZS9hZGRyZXNzX3N0b3JlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUNBLE9BQU8sS0FBSyxFQUFtQixpQkFBaUIsRUFBaUIsTUFBTSxpQkFBaUIsQ0FBQztBQUN6RixPQUFPLEtBQUssRUFBRSxZQUFZLEVBQUUsTUFBTSw2QkFBNkIsQ0FBQztBQUNoRSxPQUFPLEVBQUUsZUFBZSxFQUFFLE1BQU0sd0JBQXdCLENBQUM7QUFFekQscUJBQWEsWUFBWTs7SUFLdkIsWUFBWSxLQUFLLEVBQUUsaUJBQWlCLEVBS25DO0lBRUQsa0JBQWtCLENBQUMsZUFBZSxFQUFFLGVBQWUsR0FBRyxPQUFPLENBQUMsT0FBTyxDQUFDLENBMEJyRTtJQVlELGtCQUFrQixDQUFDLE9BQU8sRUFBRSxZQUFZLEdBQUcsT0FBTyxDQUFDLGVBQWUsR0FBRyxTQUFTLENBQUMsQ0FFOUU7SUFFSyxvQkFBb0IsSUFBSSxPQUFPLENBQUMsZUFBZSxFQUFFLENBQUMsQ0FJdkQ7Q0FDRiJ9
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"address_store.d.ts","sourceRoot":"","sources":["../../../src/storage/address_store/address_store.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAmB,iBAAiB,EAAiB,MAAM,iBAAiB,CAAC;AACzF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,qBAAa,YAAY;;IAKvB,YAAY,KAAK,EAAE,iBAAiB,EAKnC;IAED,kBAAkB,CAAC,eAAe,EAAE,eAAe,GAAG,OAAO,CAAC,OAAO,CAAC,CA0BrE;IAYD,kBAAkB,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,eAAe,GAAG,SAAS,CAAC,CAE9E;IAEK,oBAAoB,IAAI,OAAO,CAAC,eAAe,EAAE,CAAC,CAIvD;CACF"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { AddressStore } from './address_store.js';
|
|
2
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9zdG9yYWdlL2FkZHJlc3Nfc3RvcmUvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFlBQVksRUFBRSxNQUFNLG9CQUFvQixDQUFDIn0=
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/storage/address_store/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { AddressStore } from './address_store.js';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { AztecAsyncKVStore } from '@aztec/kv-store';
|
|
2
|
+
import { BlockHeader } from '@aztec/stdlib/tx';
|
|
3
|
+
export declare class AnchorBlockStore {
|
|
4
|
+
#private;
|
|
5
|
+
constructor(store: AztecAsyncKVStore);
|
|
6
|
+
setHeader(header: BlockHeader): Promise<void>;
|
|
7
|
+
getBlockHeader(): Promise<BlockHeader>;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYW5jaG9yX2Jsb2NrX3N0b3JlLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvc3RvcmFnZS9hbmNob3JfYmxvY2tfc3RvcmUvYW5jaG9yX2Jsb2NrX3N0b3JlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLGlCQUFpQixFQUF1QixNQUFNLGlCQUFpQixDQUFDO0FBQzlFLE9BQU8sRUFBRSxXQUFXLEVBQUUsTUFBTSxrQkFBa0IsQ0FBQztBQUUvQyxxQkFBYSxnQkFBZ0I7O0lBSTNCLFlBQVksS0FBSyxFQUFFLGlCQUFpQixFQUduQztJQUVLLFNBQVMsQ0FBQyxNQUFNLEVBQUUsV0FBVyxHQUFHLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FFbEQ7SUFFSyxjQUFjLElBQUksT0FBTyxDQUFDLFdBQVcsQ0FBQyxDQU8zQztDQUNGIn0=
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"anchor_block_store.d.ts","sourceRoot":"","sources":["../../../src/storage/anchor_block_store/anchor_block_store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAuB,MAAM,iBAAiB,CAAC;AAC9E,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,qBAAa,gBAAgB;;IAI3B,YAAY,KAAK,EAAE,iBAAiB,EAGnC;IAEK,SAAS,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAElD;IAEK,cAAc,IAAI,OAAO,CAAC,WAAW,CAAC,CAO3C;CACF"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { AnchorBlockStore } from './anchor_block_store.js';
|
|
2
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9zdG9yYWdlL2FuY2hvcl9ibG9ja19zdG9yZS9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSx5QkFBeUIsQ0FBQyJ9
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/storage/anchor_block_store/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { AnchorBlockStore } from './anchor_block_store.js';
|