@aztec/pxe 0.0.1-commit.b33fc05d0 → 0.0.1-commit.b3d3157a
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 +43 -99
- package/dest/bin/index.d.ts +2 -0
- package/dest/bin/index.d.ts.map +1 -0
- package/dest/bin/index.js +1 -0
- package/dest/bin/oracle_version_helpers.d.ts +26 -0
- package/dest/bin/oracle_version_helpers.d.ts.map +1 -0
- package/dest/bin/oracle_version_helpers.js +93 -0
- package/dest/block_synchronizer/block_stream_source.d.ts +10 -0
- package/dest/block_synchronizer/block_stream_source.d.ts.map +1 -0
- package/dest/block_synchronizer/block_stream_source.js +62 -0
- package/dest/block_synchronizer/block_synchronizer.d.ts +6 -2
- package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -1
- package/dest/block_synchronizer/block_synchronizer.js +30 -10
- package/dest/config/index.d.ts +7 -1
- package/dest/config/index.d.ts.map +1 -1
- package/dest/config/index.js +12 -14
- package/dest/config/package_info.js +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.d.ts +13 -5
- package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.js +47 -16
- package/dest/contract_function_simulator/ephemeral_array_service.d.ts +28 -0
- package/dest/contract_function_simulator/ephemeral_array_service.d.ts.map +1 -0
- package/dest/contract_function_simulator/ephemeral_array_service.js +78 -0
- package/dest/contract_function_simulator/execution_note_cache.d.ts +2 -2
- package/dest/contract_function_simulator/execution_note_cache.d.ts.map +1 -1
- package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts +5 -9
- package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts.map +1 -1
- package/dest/contract_function_simulator/execution_tagging_index_cache.js +3 -7
- package/dest/contract_function_simulator/index.d.ts +13 -2
- package/dest/contract_function_simulator/index.d.ts.map +1 -1
- package/dest/contract_function_simulator/index.js +10 -0
- package/dest/contract_function_simulator/noir-structs/bounded_vec.d.ts +48 -0
- package/dest/contract_function_simulator/noir-structs/bounded_vec.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/bounded_vec.js +45 -0
- package/dest/contract_function_simulator/noir-structs/ephemeral_array.d.ts +37 -0
- package/dest/contract_function_simulator/noir-structs/ephemeral_array.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/ephemeral_array.js +59 -0
- package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts +5 -5
- 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 -8
- package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts +13 -3
- package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/log_retrieval_request.js +35 -4
- package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts +1 -1
- package/dest/contract_function_simulator/noir-structs/log_retrieval_response.js +1 -1
- package/dest/contract_function_simulator/noir-structs/note_data.d.ts +27 -0
- package/dest/contract_function_simulator/noir-structs/note_data.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/note_data.js +3 -0
- package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +5 -5
- package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/note_validation_request.js +6 -8
- package/dest/contract_function_simulator/noir-structs/option.d.ts +61 -0
- package/dest/contract_function_simulator/noir-structs/option.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/option.js +62 -0
- package/dest/contract_function_simulator/noir-structs/provided_secret.d.ts +11 -0
- package/dest/contract_function_simulator/noir-structs/provided_secret.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/provided_secret.js +24 -0
- package/dest/contract_function_simulator/oracle/interfaces.d.ts +16 -102
- package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/interfaces.js +2 -2
- package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts +2 -2
- package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/note_packing_utils.js +2 -2
- package/dest/contract_function_simulator/oracle/oracle.d.ts +74 -45
- package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/oracle.js +405 -269
- package/dest/contract_function_simulator/oracle/oracle_registry.d.ts +127 -0
- package/dest/contract_function_simulator/oracle/oracle_registry.d.ts.map +1 -0
- package/dest/contract_function_simulator/oracle/oracle_registry.js +786 -0
- package/dest/contract_function_simulator/oracle/oracle_type_mappings.d.ts +139 -0
- package/dest/contract_function_simulator/oracle/oracle_type_mappings.d.ts.map +1 -0
- package/dest/contract_function_simulator/oracle/oracle_type_mappings.js +560 -0
- package/dest/contract_function_simulator/oracle/private_execution.js +4 -2
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +33 -47
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.js +69 -65
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +108 -60
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +382 -157
- package/dest/contract_function_simulator/pick_notes.d.ts +1 -1
- package/dest/contract_function_simulator/pick_notes.d.ts.map +1 -1
- package/dest/contract_function_simulator/pick_notes.js +20 -3
- package/dest/contract_function_simulator/proxied_contract_data_source.d.ts +1 -1
- package/dest/contract_function_simulator/proxied_contract_data_source.d.ts.map +1 -1
- package/dest/contract_function_simulator/proxied_contract_data_source.js +35 -64
- package/dest/contract_logging.d.ts +9 -4
- package/dest/contract_logging.d.ts.map +1 -1
- package/dest/contract_logging.js +21 -6
- package/dest/contract_sync/contract_sync_service.d.ts +7 -8
- package/dest/contract_sync/contract_sync_service.d.ts.map +1 -1
- package/dest/contract_sync/contract_sync_service.js +87 -49
- package/dest/contract_sync/helpers.d.ts +2 -4
- package/dest/contract_sync/helpers.d.ts.map +1 -1
- package/dest/contract_sync/helpers.js +12 -14
- package/dest/debug/pxe_debug_utils.d.ts +3 -8
- package/dest/debug/pxe_debug_utils.d.ts.map +1 -1
- package/dest/debug/pxe_debug_utils.js +0 -6
- package/dest/entrypoints/client/bundle/index.d.ts +1 -2
- package/dest/entrypoints/client/bundle/index.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/index.js +0 -1
- package/dest/entrypoints/client/bundle/utils.d.ts +2 -2
- package/dest/entrypoints/client/bundle/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/utils.js +13 -5
- package/dest/entrypoints/client/lazy/index.d.ts +1 -2
- package/dest/entrypoints/client/lazy/index.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/index.js +0 -1
- package/dest/entrypoints/client/lazy/utils.d.ts +2 -2
- package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/utils.js +13 -5
- package/dest/entrypoints/pxe_creation_options.d.ts +9 -1
- package/dest/entrypoints/pxe_creation_options.d.ts.map +1 -1
- package/dest/entrypoints/pxe_creation_options.js +3 -1
- package/dest/entrypoints/server/index.d.ts +3 -3
- package/dest/entrypoints/server/index.d.ts.map +1 -1
- package/dest/entrypoints/server/index.js +2 -2
- package/dest/entrypoints/server/utils.d.ts +4 -3
- package/dest/entrypoints/server/utils.d.ts.map +1 -1
- package/dest/entrypoints/server/utils.js +13 -5
- package/dest/events/event_service.d.ts +15 -6
- package/dest/events/event_service.d.ts.map +1 -1
- package/dest/events/event_service.js +44 -11
- package/dest/events/private_event_filter_validator.d.ts +3 -2
- package/dest/events/private_event_filter_validator.d.ts.map +1 -1
- package/dest/events/private_event_filter_validator.js +15 -0
- package/dest/hooks/authorize_utility_call.d.ts +41 -0
- package/dest/hooks/authorize_utility_call.d.ts.map +1 -0
- package/dest/hooks/authorize_utility_call.js +4 -0
- package/dest/hooks/execution_hooks.d.ts +42 -0
- package/dest/hooks/execution_hooks.d.ts.map +1 -0
- package/dest/hooks/execution_hooks.js +9 -0
- package/dest/hooks/index.d.ts +4 -0
- package/dest/hooks/index.d.ts.map +1 -0
- package/dest/hooks/index.js +1 -0
- package/dest/logs/log_service.d.ts +9 -9
- package/dest/logs/log_service.d.ts.map +1 -1
- package/dest/logs/log_service.js +126 -72
- package/dest/messages/message_context_service.d.ts +3 -3
- package/dest/messages/message_context_service.d.ts.map +1 -1
- package/dest/messages/message_context_service.js +30 -11
- package/dest/notes/note_service.d.ts +27 -6
- package/dest/notes/note_service.d.ts.map +1 -1
- package/dest/notes/note_service.js +80 -56
- package/dest/notes_filter.d.ts +2 -3
- package/dest/notes_filter.d.ts.map +1 -1
- package/dest/oracle_version.d.ts +4 -3
- package/dest/oracle_version.d.ts.map +1 -1
- package/dest/oracle_version.js +20 -10
- package/dest/private_kernel/batch_planner.d.ts +47 -0
- package/dest/private_kernel/batch_planner.d.ts.map +1 -0
- package/dest/private_kernel/batch_planner.js +104 -0
- package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.js +1 -1
- package/dest/private_kernel/hints/test_utils.d.ts +1 -1
- package/dest/private_kernel/hints/test_utils.d.ts.map +1 -1
- package/dest/private_kernel/hints/test_utils.js +2 -3
- package/dest/private_kernel/private_kernel_execution_prover.d.ts +6 -2
- package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_execution_prover.js +152 -59
- package/dest/private_kernel/private_kernel_oracle.d.ts +10 -10
- package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_oracle.js +24 -22
- package/dest/pxe.d.ts +58 -10
- package/dest/pxe.d.ts.map +1 -1
- package/dest/pxe.js +149 -93
- package/dest/storage/anchor_block_store/anchor_block_store.js +1 -1
- package/dest/storage/backwards_compatibility_tests/kv_store_snapshot.d.ts +42 -0
- package/dest/storage/backwards_compatibility_tests/kv_store_snapshot.d.ts.map +1 -0
- package/dest/storage/backwards_compatibility_tests/kv_store_snapshot.js +93 -0
- package/dest/storage/backwards_compatibility_tests/schema_tests.d.ts +15 -0
- package/dest/storage/backwards_compatibility_tests/schema_tests.d.ts.map +1 -0
- package/dest/storage/backwards_compatibility_tests/schema_tests.js +591 -0
- package/dest/storage/backwards_compatibility_tests/store_spy.d.ts +19 -0
- package/dest/storage/backwards_compatibility_tests/store_spy.d.ts.map +1 -0
- package/dest/storage/backwards_compatibility_tests/store_spy.js +63 -0
- package/dest/storage/capsule_store/capsule_service.d.ts +21 -0
- package/dest/storage/capsule_store/capsule_service.d.ts.map +1 -0
- package/dest/storage/capsule_store/capsule_service.js +50 -0
- package/dest/storage/capsule_store/capsule_store.d.ts +9 -9
- package/dest/storage/capsule_store/capsule_store.d.ts.map +1 -1
- package/dest/storage/capsule_store/capsule_store.js +36 -28
- package/dest/storage/capsule_store/index.d.ts +2 -1
- package/dest/storage/capsule_store/index.d.ts.map +1 -1
- package/dest/storage/capsule_store/index.js +1 -0
- package/dest/storage/contract_store/contract_store.d.ts +1 -1
- package/dest/storage/contract_store/contract_store.d.ts.map +1 -1
- package/dest/storage/contract_store/contract_store.js +9 -26
- package/dest/storage/metadata.d.ts +1 -1
- package/dest/storage/metadata.js +1 -1
- package/dest/storage/note_store/note_store.d.ts +1 -1
- package/dest/storage/note_store/note_store.d.ts.map +1 -1
- package/dest/storage/note_store/note_store.js +2 -2
- package/dest/storage/open_pxe_stores.d.ts +33 -0
- package/dest/storage/open_pxe_stores.d.ts.map +1 -0
- package/dest/storage/open_pxe_stores.js +27 -0
- package/dest/storage/private_event_store/private_event_store.d.ts +1 -1
- package/dest/storage/private_event_store/private_event_store.d.ts.map +1 -1
- package/dest/storage/private_event_store/private_event_store.js +3 -0
- package/dest/storage/private_event_store/stored_private_event.js +1 -1
- package/dest/storage/tagging_store/recipient_tagging_store.d.ts +6 -6
- package/dest/storage/tagging_store/recipient_tagging_store.d.ts.map +1 -1
- package/dest/storage/tagging_store/sender_tagging_store.d.ts +5 -5
- package/dest/storage/tagging_store/sender_tagging_store.d.ts.map +1 -1
- package/dest/storage/tagging_store/sender_tagging_store.js +3 -3
- package/dest/tagging/get_all_logs_by_tags.d.ts +34 -10
- package/dest/tagging/get_all_logs_by_tags.d.ts.map +1 -1
- package/dest/tagging/get_all_logs_by_tags.js +36 -37
- package/dest/tagging/index.d.ts +5 -4
- package/dest/tagging/index.d.ts.map +1 -1
- package/dest/tagging/index.js +4 -3
- package/dest/tagging/persist_sender_tagging_index_ranges.d.ts +29 -0
- package/dest/tagging/persist_sender_tagging_index_ranges.d.ts.map +1 -0
- package/dest/tagging/persist_sender_tagging_index_ranges.js +42 -0
- package/dest/tagging/recipient_sync/sync_tagged_private_logs.d.ts +56 -0
- package/dest/tagging/recipient_sync/sync_tagged_private_logs.d.ts.map +1 -0
- package/dest/tagging/recipient_sync/sync_tagged_private_logs.js +163 -0
- package/dest/tagging/recipient_sync/utils/find_highest_indexes.d.ts +3 -3
- package/dest/tagging/recipient_sync/utils/find_highest_indexes.d.ts.map +1 -1
- package/dest/tagging/reconcile_tagging_index_ranges.d.ts +36 -0
- package/dest/tagging/reconcile_tagging_index_ranges.d.ts.map +1 -0
- package/dest/tagging/reconcile_tagging_index_ranges.js +74 -0
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts +4 -5
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts.map +1 -1
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.js +26 -14
- package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts +11 -6
- package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts.map +1 -1
- package/dest/tagging/sender_sync/utils/get_status_change_of_pending.js +21 -0
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts +4 -4
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts.map +1 -1
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.js +2 -2
- package/package.json +20 -17
- package/src/bin/check_oracle_version.ts +49 -122
- package/src/bin/index.ts +1 -0
- package/src/bin/oracle_version_helpers.ts +121 -0
- package/src/block_synchronizer/block_stream_source.ts +81 -0
- package/src/block_synchronizer/block_synchronizer.ts +33 -11
- package/src/config/index.ts +14 -8
- package/src/config/package_info.ts +1 -1
- package/src/contract_function_simulator/contract_function_simulator.ts +74 -20
- package/src/contract_function_simulator/ephemeral_array_service.ts +110 -0
- package/src/contract_function_simulator/execution_note_cache.ts +1 -1
- package/src/contract_function_simulator/execution_tagging_index_cache.ts +5 -9
- package/src/contract_function_simulator/index.ts +50 -1
- package/src/contract_function_simulator/noir-structs/bounded_vec.ts +55 -0
- package/src/contract_function_simulator/noir-structs/ephemeral_array.ts +66 -0
- package/src/contract_function_simulator/noir-structs/event_validation_request.ts +4 -6
- package/src/contract_function_simulator/noir-structs/log_retrieval_request.ts +36 -3
- package/src/contract_function_simulator/noir-structs/log_retrieval_response.ts +1 -1
- package/src/contract_function_simulator/noir-structs/note_data.ts +27 -0
- package/src/contract_function_simulator/noir-structs/note_validation_request.ts +4 -6
- package/src/contract_function_simulator/noir-structs/option.ts +69 -0
- package/src/contract_function_simulator/noir-structs/provided_secret.ts +27 -0
- package/src/contract_function_simulator/oracle/interfaces.ts +12 -175
- package/src/contract_function_simulator/oracle/note_packing_utils.ts +3 -3
- package/src/contract_function_simulator/oracle/oracle.ts +498 -441
- package/src/contract_function_simulator/oracle/oracle_registry.ts +585 -0
- package/src/contract_function_simulator/oracle/oracle_type_mappings.ts +553 -0
- package/src/contract_function_simulator/oracle/private_execution.ts +2 -2
- package/src/contract_function_simulator/oracle/private_execution_oracle.ts +91 -86
- package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +558 -265
- package/src/contract_function_simulator/pick_notes.ts +22 -3
- package/src/contract_function_simulator/proxied_contract_data_source.ts +41 -64
- package/src/contract_logging.ts +18 -5
- package/src/contract_sync/contract_sync_service.ts +120 -83
- package/src/contract_sync/helpers.ts +13 -25
- package/src/debug/pxe_debug_utils.ts +3 -11
- package/src/entrypoints/client/bundle/index.ts +0 -1
- package/src/entrypoints/client/bundle/utils.ts +10 -5
- package/src/entrypoints/client/lazy/index.ts +0 -1
- package/src/entrypoints/client/lazy/utils.ts +10 -5
- package/src/entrypoints/pxe_creation_options.ts +14 -0
- package/src/entrypoints/server/index.ts +2 -2
- package/src/entrypoints/server/utils.ts +15 -6
- package/src/events/event_service.ts +69 -21
- package/src/events/private_event_filter_validator.ts +21 -1
- package/src/hooks/authorize_utility_call.ts +44 -0
- package/src/hooks/execution_hooks.ts +48 -0
- package/src/hooks/index.ts +7 -0
- package/src/logs/log_service.ts +158 -134
- package/src/messages/message_context_service.ts +43 -26
- package/src/notes/note_service.ts +119 -85
- package/src/notes_filter.ts +1 -3
- package/src/oracle_version.ts +20 -10
- package/src/private_kernel/batch_planner.ts +169 -0
- package/src/private_kernel/hints/private_kernel_reset_private_inputs_builder.ts +1 -1
- package/src/private_kernel/hints/test_utils.ts +2 -9
- package/src/private_kernel/private_kernel_execution_prover.ts +240 -82
- package/src/private_kernel/private_kernel_oracle.ts +35 -25
- package/src/pxe.ts +256 -98
- package/src/storage/anchor_block_store/anchor_block_store.ts +1 -1
- package/src/storage/backwards_compatibility_tests/__snapshots__/AddressStore.json +22 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/AnchorBlockStore.json +3 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/CapsuleStore.json +16 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/ContractStore.json +28 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/KeyStore.json +52 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/L2TipsKVStore.json +46 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/NoteStore.json +36 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/PrivateEventStore.json +44 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/RecipientTaggingStore.json +18 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/SenderAddressBookStore.json +16 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/SenderTaggingStore.json +22 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/opened_stores.json +97 -0
- package/src/storage/backwards_compatibility_tests/kv_store_snapshot.ts +122 -0
- package/src/storage/backwards_compatibility_tests/schema_tests.ts +712 -0
- package/src/storage/backwards_compatibility_tests/store_spy.ts +73 -0
- package/src/storage/capsule_store/capsule_service.ts +90 -0
- package/src/storage/capsule_store/capsule_store.ts +44 -26
- package/src/storage/capsule_store/index.ts +1 -0
- package/src/storage/contract_store/contract_store.ts +14 -35
- package/src/storage/metadata.ts +1 -1
- package/src/storage/note_store/note_store.ts +2 -5
- package/src/storage/open_pxe_stores.ts +49 -0
- package/src/storage/private_event_store/private_event_store.ts +4 -0
- package/src/storage/private_event_store/stored_private_event.ts +1 -1
- package/src/storage/tagging_store/recipient_tagging_store.ts +5 -9
- package/src/storage/tagging_store/sender_tagging_store.ts +6 -6
- package/src/tagging/get_all_logs_by_tags.ts +78 -50
- package/src/tagging/index.ts +4 -3
- package/src/tagging/persist_sender_tagging_index_ranges.ts +57 -0
- package/src/tagging/recipient_sync/sync_tagged_private_logs.ts +240 -0
- package/src/tagging/recipient_sync/utils/find_highest_indexes.ts +2 -2
- package/src/tagging/reconcile_tagging_index_ranges.ts +102 -0
- package/src/tagging/sender_sync/sync_sender_tagging_indexes.ts +41 -19
- package/src/tagging/sender_sync/utils/get_status_change_of_pending.ts +23 -8
- package/src/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.ts +4 -5
- package/dest/access_scopes.d.ts +0 -9
- package/dest/access_scopes.d.ts.map +0 -1
- package/dest/access_scopes.js +0 -6
- package/dest/contract_function_simulator/noir-structs/message_tx_context.d.ts +0 -16
- package/dest/contract_function_simulator/noir-structs/message_tx_context.d.ts.map +0 -1
- package/dest/contract_function_simulator/noir-structs/message_tx_context.js +0 -57
- package/dest/contract_function_simulator/oracle/legacy_oracle_mappings.d.ts +0 -9
- package/dest/contract_function_simulator/oracle/legacy_oracle_mappings.d.ts.map +0 -1
- package/dest/contract_function_simulator/oracle/legacy_oracle_mappings.js +0 -52
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts +0 -14
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts.map +0 -1
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.js +0 -99
- package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts +0 -14
- package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts.map +0 -1
- package/dest/tagging/recipient_sync/utils/load_logs_for_range.js +0 -33
- package/src/access_scopes.ts +0 -9
- package/src/contract_function_simulator/noir-structs/message_tx_context.ts +0 -55
- package/src/contract_function_simulator/oracle/legacy_oracle_mappings.ts +0 -77
- package/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts +0 -140
- package/src/tagging/recipient_sync/utils/load_logs_for_range.ts +0 -44
package/src/pxe.ts
CHANGED
|
@@ -6,7 +6,6 @@ import { SerialQueue } from '@aztec/foundation/queue';
|
|
|
6
6
|
import { Timer } from '@aztec/foundation/timer';
|
|
7
7
|
import { KeyStore } from '@aztec/key-store';
|
|
8
8
|
import type { AztecAsyncKVStore } from '@aztec/kv-store';
|
|
9
|
-
import { L2TipsKVStore } from '@aztec/kv-store/stores';
|
|
10
9
|
import { type ProtocolContractsProvider, protocolContractNames } from '@aztec/protocol-contracts';
|
|
11
10
|
import type { CircuitSimulator } from '@aztec/simulator/client';
|
|
12
11
|
import {
|
|
@@ -18,6 +17,7 @@ import {
|
|
|
18
17
|
} from '@aztec/stdlib/abi';
|
|
19
18
|
import type { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
20
19
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
20
|
+
import { GENESIS_BLOCK_HEADER_HASH, type L2TipsProvider } from '@aztec/stdlib/block';
|
|
21
21
|
import {
|
|
22
22
|
CompleteAddress,
|
|
23
23
|
type ContractInstanceWithAddress,
|
|
@@ -52,7 +52,6 @@ import {
|
|
|
52
52
|
|
|
53
53
|
import { inspect } from 'util';
|
|
54
54
|
|
|
55
|
-
import type { AccessScopes } from './access_scopes.js';
|
|
56
55
|
import { BlockSynchronizer } from './block_synchronizer/index.js';
|
|
57
56
|
import type { PXEConfig } from './config/index.js';
|
|
58
57
|
import { BenchmarkedNodeFactory } from './contract_function_simulator/benchmarked_node.js';
|
|
@@ -67,6 +66,7 @@ import { readCurrentClassId } from './contract_sync/helpers.js';
|
|
|
67
66
|
import { PXEDebugUtils } from './debug/pxe_debug_utils.js';
|
|
68
67
|
import { enrichPublicSimulationError, enrichSimulationError } from './error_enriching.js';
|
|
69
68
|
import { PrivateEventFilterValidator } from './events/private_event_filter_validator.js';
|
|
69
|
+
import type { ExecutionHooks } from './hooks/index.js';
|
|
70
70
|
import { JobCoordinator } from './job_coordinator/job_coordinator.js';
|
|
71
71
|
import { MessageContextService } from './messages/message_context_service.js';
|
|
72
72
|
import {
|
|
@@ -79,16 +79,26 @@ import { AnchorBlockStore } from './storage/anchor_block_store/anchor_block_stor
|
|
|
79
79
|
import { CapsuleStore } from './storage/capsule_store/capsule_store.js';
|
|
80
80
|
import { ContractStore } from './storage/contract_store/contract_store.js';
|
|
81
81
|
import { NoteStore } from './storage/note_store/note_store.js';
|
|
82
|
+
import { openPxeStores } from './storage/open_pxe_stores.js';
|
|
82
83
|
import { PrivateEventStore } from './storage/private_event_store/private_event_store.js';
|
|
83
84
|
import { RecipientTaggingStore } from './storage/tagging_store/recipient_tagging_store.js';
|
|
84
85
|
import { SenderAddressBookStore } from './storage/tagging_store/sender_address_book_store.js';
|
|
85
86
|
import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store.js';
|
|
87
|
+
import { persistSenderTaggingIndexRangesForTx } from './tagging/index.js';
|
|
86
88
|
|
|
87
89
|
export type PackedPrivateEvent = InTx & {
|
|
88
90
|
packedEvent: Fr[];
|
|
89
91
|
eventSelector: EventSelector;
|
|
90
92
|
};
|
|
91
93
|
|
|
94
|
+
/** Options for PXE.proveTx. */
|
|
95
|
+
export type ProveTxOpts = {
|
|
96
|
+
/** Addresses whose private state and keys are accessible during private execution. */
|
|
97
|
+
scopes: AztecAddress[];
|
|
98
|
+
/** Sender address used to derive discovery tags for private messages (notes, events, logs) this tx emits. */
|
|
99
|
+
senderForTags?: AztecAddress;
|
|
100
|
+
};
|
|
101
|
+
|
|
92
102
|
/** Options for PXE.profileTx. */
|
|
93
103
|
export type ProfileTxOpts = {
|
|
94
104
|
/** The profiling mode to use. */
|
|
@@ -96,7 +106,9 @@ export type ProfileTxOpts = {
|
|
|
96
106
|
/** If true, proof generation is skipped during profiling. Defaults to true. */
|
|
97
107
|
skipProofGeneration?: boolean;
|
|
98
108
|
/** Addresses whose private state and keys are accessible during private execution. */
|
|
99
|
-
scopes:
|
|
109
|
+
scopes: AztecAddress[];
|
|
110
|
+
/** Sender address used to derive discovery tags for private messages (notes, events, logs) this tx emits. */
|
|
111
|
+
senderForTags?: AztecAddress;
|
|
100
112
|
};
|
|
101
113
|
|
|
102
114
|
/** Options for PXE.simulateTx. */
|
|
@@ -107,10 +119,18 @@ export type SimulateTxOpts = {
|
|
|
107
119
|
skipTxValidation?: boolean;
|
|
108
120
|
/** If false, fees are enforced. */
|
|
109
121
|
skipFeeEnforcement?: boolean;
|
|
110
|
-
/**
|
|
122
|
+
/** If true, kernel logic is emulated in TS for simulation */
|
|
123
|
+
skipKernels?: boolean;
|
|
124
|
+
/**
|
|
125
|
+
* Pre-simulation overrides applied to the ephemeral fork and contract DB. Bundles publicStorage
|
|
126
|
+
* writes (no skipKernels required) and per-address (instance, artifact?) overrides used by both
|
|
127
|
+
* AVM-side public dispatch and PXE-side ACIR private dispatch (requires skipKernels: true).
|
|
128
|
+
*/
|
|
111
129
|
overrides?: SimulationOverrides;
|
|
112
130
|
/** Addresses whose private state and keys are accessible during private execution */
|
|
113
|
-
scopes:
|
|
131
|
+
scopes: AztecAddress[];
|
|
132
|
+
/** Sender address used to derive discovery tags for private messages (notes, events, logs) this tx emits. */
|
|
133
|
+
senderForTags?: AztecAddress;
|
|
114
134
|
};
|
|
115
135
|
|
|
116
136
|
/** Options for PXE.executeUtility. */
|
|
@@ -118,7 +138,22 @@ export type ExecuteUtilityOpts = {
|
|
|
118
138
|
/** The authentication witnesses required for the function call. */
|
|
119
139
|
authwits?: AuthWitness[];
|
|
120
140
|
/** The accounts whose notes we can access in this call */
|
|
121
|
-
scopes:
|
|
141
|
+
scopes: AztecAddress[];
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Supplies the set of "nice to have" contracts that every PXE preloads regardless of which wallet
|
|
146
|
+
* drives it. Today this is just the standard multi-call entrypoint: the SDK's self-paid account
|
|
147
|
+
* deploy flow ({@link DeployAccountMethod} with `from = NO_FROM`) routes its payload through it, so a
|
|
148
|
+
* PXE that did not register it would fail contract sync with an opaque "no contract instance" error.
|
|
149
|
+
*
|
|
150
|
+
* Returning a list keeps this extensible: a wallet may supply its own provider that preloads
|
|
151
|
+
* additional contracts. Injected the same way as {@link ProtocolContractsProvider} so the PXE never
|
|
152
|
+
* statically imports the bundled artifacts, keeping the bundle/lazy split intact.
|
|
153
|
+
*/
|
|
154
|
+
export type PreloadedContractsProvider = {
|
|
155
|
+
/** Returns the contract instances and artifacts the PXE should preload on startup. */
|
|
156
|
+
getPreloadedContracts: () => Promise<Array<{ instance: ContractInstanceWithAddress; artifact: ContractArtifact }>>;
|
|
122
157
|
};
|
|
123
158
|
|
|
124
159
|
/** Args for PXE.create. */
|
|
@@ -133,10 +168,14 @@ export type PXECreateArgs = {
|
|
|
133
168
|
simulator: CircuitSimulator;
|
|
134
169
|
/** Provider for protocol contract artifacts and instances. */
|
|
135
170
|
protocolContractsProvider: ProtocolContractsProvider;
|
|
171
|
+
/** Provider for the "nice to have" contracts the PXE preloads. */
|
|
172
|
+
preloadedContractsProvider: PreloadedContractsProvider;
|
|
136
173
|
/** PXE configuration options. */
|
|
137
174
|
config: PXEConfig;
|
|
138
175
|
/** Optional logger instance or string suffix for the logger name. */
|
|
139
176
|
loggerOrSuffix?: string | Logger;
|
|
177
|
+
/** Optional hooks to observe and influence contract execution. */
|
|
178
|
+
hooks?: ExecutionHooks;
|
|
140
179
|
};
|
|
141
180
|
|
|
142
181
|
/**
|
|
@@ -160,14 +199,18 @@ export class PXE {
|
|
|
160
199
|
private privateEventStore: PrivateEventStore,
|
|
161
200
|
private contractSyncService: ContractSyncService,
|
|
162
201
|
private messageContextService: MessageContextService,
|
|
202
|
+
private l2TipsStore: L2TipsProvider,
|
|
163
203
|
private simulator: CircuitSimulator,
|
|
164
204
|
private proverEnabled: boolean,
|
|
205
|
+
private autoSync: boolean,
|
|
165
206
|
private proofCreator: PrivateKernelProver,
|
|
166
207
|
private protocolContractsProvider: ProtocolContractsProvider,
|
|
208
|
+
private preloadedContractsProvider: PreloadedContractsProvider,
|
|
167
209
|
private log: Logger,
|
|
168
210
|
private jobQueue: SerialQueue,
|
|
169
211
|
private jobCoordinator: JobCoordinator,
|
|
170
212
|
public debug: PXEDebugUtils,
|
|
213
|
+
private hooks: ExecutionHooks | undefined,
|
|
171
214
|
) {}
|
|
172
215
|
|
|
173
216
|
/**
|
|
@@ -183,8 +226,10 @@ export class PXE {
|
|
|
183
226
|
proofCreator,
|
|
184
227
|
simulator,
|
|
185
228
|
protocolContractsProvider,
|
|
229
|
+
preloadedContractsProvider,
|
|
186
230
|
config,
|
|
187
231
|
loggerOrSuffix,
|
|
232
|
+
hooks,
|
|
188
233
|
}: PXECreateArgs) {
|
|
189
234
|
// Extract bindings from the logger, or use empty bindings if a string suffix is provided.
|
|
190
235
|
const bindings: LoggerBindings | undefined =
|
|
@@ -197,18 +242,28 @@ export class PXE {
|
|
|
197
242
|
|
|
198
243
|
const info = await node.getNodeInfo();
|
|
199
244
|
|
|
245
|
+
// Source the genesis block hash from the node so PXE's L2BlockStream agrees with the node's
|
|
246
|
+
// archiver on the dynamic initial header hash. Without this the tip store would fall back to
|
|
247
|
+
// the static `GENESIS_BLOCK_HEADER_HASH` constant, which only matches deployments with the
|
|
248
|
+
// default empty genesis (timestamp 0, no prefilled public data) and diverges otherwise — the
|
|
249
|
+
// sync at block 0 would then get stuck in `areBlockHashesEqualAt` and abort. If the node does
|
|
250
|
+
// not return a genesis block (older node or test fixture) we fall back to the static constant.
|
|
251
|
+
const initialBlockHash = (await node.getBlock(BlockNumber.ZERO))?.hash ?? GENESIS_BLOCK_HEADER_HASH;
|
|
252
|
+
|
|
200
253
|
const proverEnabled = config.proverEnabled !== undefined ? config.proverEnabled : info.realProofs;
|
|
201
|
-
const
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
254
|
+
const {
|
|
255
|
+
addressStore,
|
|
256
|
+
privateEventStore,
|
|
257
|
+
contractStore,
|
|
258
|
+
noteStore,
|
|
259
|
+
anchorBlockStore,
|
|
260
|
+
senderTaggingStore,
|
|
261
|
+
senderAddressBookStore,
|
|
262
|
+
recipientTaggingStore,
|
|
263
|
+
capsuleStore,
|
|
264
|
+
keyStore,
|
|
265
|
+
l2TipsStore,
|
|
266
|
+
} = openPxeStores(store, initialBlockHash);
|
|
212
267
|
const contractSyncService = new ContractSyncService(
|
|
213
268
|
node,
|
|
214
269
|
contractStore,
|
|
@@ -223,7 +278,7 @@ export class PXE {
|
|
|
223
278
|
anchorBlockStore,
|
|
224
279
|
noteStore,
|
|
225
280
|
privateEventStore,
|
|
226
|
-
|
|
281
|
+
l2TipsStore,
|
|
227
282
|
contractSyncService,
|
|
228
283
|
config,
|
|
229
284
|
bindings,
|
|
@@ -259,14 +314,18 @@ export class PXE {
|
|
|
259
314
|
privateEventStore,
|
|
260
315
|
contractSyncService,
|
|
261
316
|
messageContextService,
|
|
317
|
+
l2TipsStore,
|
|
262
318
|
simulator,
|
|
263
319
|
proverEnabled,
|
|
320
|
+
config.autoSync,
|
|
264
321
|
proofCreator,
|
|
265
322
|
protocolContractsProvider,
|
|
323
|
+
preloadedContractsProvider,
|
|
266
324
|
log,
|
|
267
325
|
jobQueue,
|
|
268
326
|
jobCoordinator,
|
|
269
327
|
debugUtils,
|
|
328
|
+
hooks,
|
|
270
329
|
);
|
|
271
330
|
|
|
272
331
|
debugUtils.setPXEHelpers(
|
|
@@ -277,7 +336,7 @@ export class PXE {
|
|
|
277
336
|
|
|
278
337
|
pxe.jobQueue.start();
|
|
279
338
|
|
|
280
|
-
await pxe.#registerProtocolContracts();
|
|
339
|
+
await Promise.all([pxe.#registerProtocolContracts(), pxe.#registerPreloadedContracts()]);
|
|
281
340
|
log.info(`Started PXE connected to chain ${info.l1ChainId} version ${info.rollupVersion}`);
|
|
282
341
|
return pxe;
|
|
283
342
|
}
|
|
@@ -293,6 +352,7 @@ export class PXE {
|
|
|
293
352
|
keyStore: this.keyStore,
|
|
294
353
|
addressStore: this.addressStore,
|
|
295
354
|
aztecNode: BenchmarkedNodeFactory.create(this.node),
|
|
355
|
+
l2TipsStore: this.l2TipsStore,
|
|
296
356
|
senderTaggingStore: this.senderTaggingStore,
|
|
297
357
|
recipientTaggingStore: this.recipientTaggingStore,
|
|
298
358
|
senderAddressBookStore: this.senderAddressBookStore,
|
|
@@ -301,6 +361,7 @@ export class PXE {
|
|
|
301
361
|
simulator: this.simulator,
|
|
302
362
|
contractSyncService: this.contractSyncService,
|
|
303
363
|
messageContextService: this.messageContextService,
|
|
364
|
+
hooks: this.hooks,
|
|
304
365
|
});
|
|
305
366
|
}
|
|
306
367
|
|
|
@@ -351,29 +412,48 @@ export class PXE {
|
|
|
351
412
|
}
|
|
352
413
|
|
|
353
414
|
async #registerProtocolContracts() {
|
|
354
|
-
const registered
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
415
|
+
const registered = Object.fromEntries(
|
|
416
|
+
await Promise.all(
|
|
417
|
+
protocolContractNames.map(async name => {
|
|
418
|
+
const { address, instance, artifact } =
|
|
419
|
+
await this.protocolContractsProvider.getProtocolContractArtifact(name);
|
|
420
|
+
await this.contractStore.addContractArtifact(artifact);
|
|
421
|
+
await this.contractStore.addContractInstance(instance);
|
|
422
|
+
return [name, address.toString()] as const;
|
|
423
|
+
}),
|
|
424
|
+
),
|
|
425
|
+
);
|
|
361
426
|
this.log.verbose(`Registered protocol contracts in pxe`, registered);
|
|
362
427
|
}
|
|
363
428
|
|
|
429
|
+
async #registerPreloadedContracts() {
|
|
430
|
+
const contracts = await this.preloadedContractsProvider.getPreloadedContracts();
|
|
431
|
+
await Promise.all(contracts.map(({ instance, artifact }) => this.registerContract({ instance, artifact })));
|
|
432
|
+
this.log.verbose(`Registered preloaded contracts in pxe`, {
|
|
433
|
+
contracts: contracts.map(({ instance }) => instance.address.toString()),
|
|
434
|
+
});
|
|
435
|
+
}
|
|
436
|
+
|
|
364
437
|
// Executes the entrypoint private function, as well as all nested private
|
|
365
438
|
// functions that might arise.
|
|
366
|
-
async #executePrivate(
|
|
367
|
-
contractFunctionSimulator
|
|
368
|
-
txRequest
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
439
|
+
async #executePrivate({
|
|
440
|
+
contractFunctionSimulator,
|
|
441
|
+
txRequest,
|
|
442
|
+
anchorBlockHeader,
|
|
443
|
+
scopes,
|
|
444
|
+
jobId,
|
|
445
|
+
senderForTags,
|
|
446
|
+
}: {
|
|
447
|
+
contractFunctionSimulator: ContractFunctionSimulator;
|
|
448
|
+
txRequest: TxExecutionRequest;
|
|
449
|
+
anchorBlockHeader: BlockHeader;
|
|
450
|
+
scopes: AztecAddress[];
|
|
451
|
+
jobId: string;
|
|
452
|
+
senderForTags?: AztecAddress;
|
|
453
|
+
}): Promise<PrivateExecutionResult> {
|
|
372
454
|
const { origin: contractAddress, functionSelector } = txRequest;
|
|
373
455
|
|
|
374
456
|
try {
|
|
375
|
-
const anchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
|
|
376
|
-
|
|
377
457
|
await this.contractSyncService.ensureContractSynced(
|
|
378
458
|
contractAddress,
|
|
379
459
|
functionSelector,
|
|
@@ -390,6 +470,7 @@ export class PXE {
|
|
|
390
470
|
anchorBlockHeader,
|
|
391
471
|
scopes,
|
|
392
472
|
jobId,
|
|
473
|
+
senderForTags,
|
|
393
474
|
});
|
|
394
475
|
this.log.debug(`Private simulation completed for ${contractAddress.toString()}:${functionSelector}`);
|
|
395
476
|
return result;
|
|
@@ -415,12 +496,19 @@ export class PXE {
|
|
|
415
496
|
contractFunctionSimulator: ContractFunctionSimulator,
|
|
416
497
|
call: FunctionCall,
|
|
417
498
|
authWitnesses: AuthWitness[] | undefined,
|
|
418
|
-
scopes:
|
|
499
|
+
scopes: AztecAddress[],
|
|
419
500
|
jobId: string,
|
|
420
501
|
) {
|
|
421
502
|
try {
|
|
422
503
|
const anchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
|
|
423
|
-
|
|
504
|
+
const { result, offchainEffects } = await contractFunctionSimulator.runUtility(
|
|
505
|
+
call,
|
|
506
|
+
authWitnesses ?? [],
|
|
507
|
+
anchorBlockHeader,
|
|
508
|
+
scopes,
|
|
509
|
+
jobId,
|
|
510
|
+
);
|
|
511
|
+
return { result, offchainEffects };
|
|
424
512
|
} catch (err) {
|
|
425
513
|
if (err instanceof SimulationError) {
|
|
426
514
|
await enrichSimulationError(err, this.contractStore, this.log);
|
|
@@ -435,11 +523,11 @@ export class PXE {
|
|
|
435
523
|
* It can also be used for estimating gas in the future.
|
|
436
524
|
* @param tx - The transaction to be simulated.
|
|
437
525
|
*/
|
|
438
|
-
async #simulatePublicCalls(tx: Tx, skipFeeEnforcement: boolean) {
|
|
526
|
+
async #simulatePublicCalls(tx: Tx, skipFeeEnforcement: boolean, overrides?: SimulationOverrides) {
|
|
439
527
|
// Simulating public calls can throw if the TX fails in a phase that doesn't allow reverts (setup)
|
|
440
528
|
// Or return as reverted if it fails in a phase that allows reverts (app logic, teardown)
|
|
441
529
|
try {
|
|
442
|
-
const result = await this.node.simulatePublicCalls(tx, skipFeeEnforcement);
|
|
530
|
+
const result = await this.node.simulatePublicCalls(tx, skipFeeEnforcement, overrides);
|
|
443
531
|
if (result.revertReason) {
|
|
444
532
|
throw result.revertReason;
|
|
445
533
|
}
|
|
@@ -471,11 +559,10 @@ export class PXE {
|
|
|
471
559
|
txExecutionRequest: TxExecutionRequest,
|
|
472
560
|
proofCreator: PrivateKernelProver,
|
|
473
561
|
privateExecutionResult: PrivateExecutionResult,
|
|
562
|
+
anchorBlockHeader: BlockHeader,
|
|
474
563
|
config: PrivateKernelExecutionProverConfig,
|
|
475
564
|
): Promise<PrivateKernelExecutionProofOutput<PrivateKernelTailCircuitPublicInputs>> {
|
|
476
|
-
const
|
|
477
|
-
const anchorBlockHash = await anchorBlockHeader.hash();
|
|
478
|
-
const kernelOracle = new PrivateKernelOracle(this.contractStore, this.keyStore, this.node, anchorBlockHash);
|
|
565
|
+
const kernelOracle = new PrivateKernelOracle(this.contractStore, this.keyStore, this.node, anchorBlockHeader);
|
|
479
566
|
const kernelTraceProver = new PrivateKernelExecutionProver(
|
|
480
567
|
kernelOracle,
|
|
481
568
|
proofCreator,
|
|
@@ -486,14 +573,36 @@ export class PXE {
|
|
|
486
573
|
return await kernelTraceProver.proveWithKernels(txExecutionRequest.toTxRequest(), privateExecutionResult, config);
|
|
487
574
|
}
|
|
488
575
|
|
|
576
|
+
/**
|
|
577
|
+
* Syncs with the node only when `autoSync` is enabled.
|
|
578
|
+
* When `autoSync` is disabled, callers (typically a wallet) are
|
|
579
|
+
* responsible for invoking `pxe.sync()` at the right granularity.
|
|
580
|
+
*/
|
|
581
|
+
async #maybeSync(): Promise<void> {
|
|
582
|
+
if (this.autoSync) {
|
|
583
|
+
await this.blockStateSynchronizer.sync();
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
|
|
489
587
|
// Public API
|
|
490
588
|
|
|
589
|
+
/**
|
|
590
|
+
* Triggers a sync of PXE state with the node, regardless of the `autoSync` config flag. Use this to
|
|
591
|
+
* batch syncs across composite flows when `autoSync` is disabled (e.g. one sync per simulate+send
|
|
592
|
+
* instead of one per inner PXE call). Serialized through the job queue.
|
|
593
|
+
*/
|
|
594
|
+
public sync(): Promise<void> {
|
|
595
|
+
return this.#putInJobQueue(() => this.blockStateSynchronizer.sync());
|
|
596
|
+
}
|
|
597
|
+
|
|
491
598
|
/**
|
|
492
599
|
* Returns the block header up to which the PXE has synced.
|
|
493
600
|
* @returns The synced block header
|
|
494
601
|
*/
|
|
495
602
|
public getSyncedBlockHeader(): Promise<BlockHeader> {
|
|
496
|
-
return this
|
|
603
|
+
return this.#putInJobQueue(() => {
|
|
604
|
+
return this.anchorBlockStore.getBlockHeader();
|
|
605
|
+
});
|
|
497
606
|
}
|
|
498
607
|
|
|
499
608
|
/**
|
|
@@ -527,7 +636,7 @@ export class PXE {
|
|
|
527
636
|
public async registerAccount(secretKey: Fr, partialAddress: PartialAddress): Promise<CompleteAddress> {
|
|
528
637
|
const accounts = await this.keyStore.getAccounts();
|
|
529
638
|
const accountCompleteAddress = await this.keyStore.addAccount(secretKey, partialAddress);
|
|
530
|
-
if (accounts.
|
|
639
|
+
if (accounts.some(a => a.equals(accountCompleteAddress.address))) {
|
|
531
640
|
this.log.info(`Account:\n "${accountCompleteAddress.address.toString()}"\n already registered.`);
|
|
532
641
|
return accountCompleteAddress;
|
|
533
642
|
} else {
|
|
@@ -550,8 +659,14 @@ export class PXE {
|
|
|
550
659
|
* TODO: It's strange that we return the address here and I (benesjan) think we should drop the return value.
|
|
551
660
|
*/
|
|
552
661
|
public async registerSender(sender: AztecAddress): Promise<AztecAddress> {
|
|
662
|
+
if (!(await sender.isValid())) {
|
|
663
|
+
throw new Error(
|
|
664
|
+
`Address ${sender} is not valid: it does not correspond to a point on the Grumpkin curve. Cannot register it as a sender.`,
|
|
665
|
+
);
|
|
666
|
+
}
|
|
667
|
+
|
|
553
668
|
const accounts = await this.keyStore.getAccounts();
|
|
554
|
-
if (accounts.
|
|
669
|
+
if (accounts.some(a => a.equals(sender))) {
|
|
555
670
|
this.log.info(`Sender:\n "${sender.toString()}"\n already registered.`);
|
|
556
671
|
return sender;
|
|
557
672
|
}
|
|
@@ -560,6 +675,9 @@ export class PXE {
|
|
|
560
675
|
|
|
561
676
|
if (wasAdded) {
|
|
562
677
|
this.log.info(`Added sender:\n ${sender.toString()}`);
|
|
678
|
+
// Wipe the entire sync cache: the new sender's tagged logs could contain notes/events for any contract, so
|
|
679
|
+
// all contracts must re-sync to discover them. Queued to avoid wiping while a job is in flight.
|
|
680
|
+
await this.#putInJobQueue(() => Promise.resolve(this.contractSyncService.wipe()));
|
|
563
681
|
} else {
|
|
564
682
|
this.log.info(`Sender:\n "${sender.toString()}"\n already registered.`);
|
|
565
683
|
}
|
|
@@ -643,7 +761,9 @@ export class PXE {
|
|
|
643
761
|
const publicFunctionSignatures = artifact.functions
|
|
644
762
|
.filter(fn => fn.functionType === FunctionType.PUBLIC)
|
|
645
763
|
.map(fn => decodeFunctionSignature(fn.name, fn.parameters));
|
|
646
|
-
|
|
764
|
+
if (publicFunctionSignatures.length > 0) {
|
|
765
|
+
await this.node.registerContractFunctionSignatures(publicFunctionSignatures);
|
|
766
|
+
}
|
|
647
767
|
} else {
|
|
648
768
|
// Otherwise, make sure there is an artifact already registered for that class id
|
|
649
769
|
artifact = await this.contractStore.getContractArtifact(instance.currentContractClassId);
|
|
@@ -678,7 +798,7 @@ export class PXE {
|
|
|
678
798
|
throw new Error(`Instance not found when updating a contract. Contract address: ${contractAddress}.`);
|
|
679
799
|
}
|
|
680
800
|
const contractClass = await getContractClassFromArtifact(artifact);
|
|
681
|
-
await this
|
|
801
|
+
await this.#maybeSync();
|
|
682
802
|
|
|
683
803
|
const header = await this.anchorBlockStore.getBlockHeader();
|
|
684
804
|
|
|
@@ -690,7 +810,9 @@ export class PXE {
|
|
|
690
810
|
const publicFunctionSignatures = artifact.functions
|
|
691
811
|
.filter(fn => fn.functionType === FunctionType.PUBLIC)
|
|
692
812
|
.map(fn => decodeFunctionSignature(fn.name, fn.parameters));
|
|
693
|
-
|
|
813
|
+
if (publicFunctionSignatures.length > 0) {
|
|
814
|
+
await this.node.registerContractFunctionSignatures(publicFunctionSignatures);
|
|
815
|
+
}
|
|
694
816
|
|
|
695
817
|
currentInstance.currentContractClassId = contractClass.id;
|
|
696
818
|
await Promise.all([
|
|
@@ -719,7 +841,7 @@ export class PXE {
|
|
|
719
841
|
* @throws If contract code not found, or public simulation reverts.
|
|
720
842
|
* Also throws if simulatePublic is true and public simulation reverts.
|
|
721
843
|
*/
|
|
722
|
-
public proveTx(txRequest: TxExecutionRequest, scopes:
|
|
844
|
+
public proveTx(txRequest: TxExecutionRequest, { scopes, senderForTags }: ProveTxOpts): Promise<TxProvingResult> {
|
|
723
845
|
let privateExecutionResult: PrivateExecutionResult;
|
|
724
846
|
// We disable proving concurrently mostly out of caution, since it accesses some of our stores. Proving is so
|
|
725
847
|
// computationally demanding that it'd be rare for someone to try to do it concurrently regardless.
|
|
@@ -727,17 +849,25 @@ export class PXE {
|
|
|
727
849
|
const totalTimer = new Timer();
|
|
728
850
|
try {
|
|
729
851
|
const syncTimer = new Timer();
|
|
730
|
-
await this
|
|
852
|
+
await this.#maybeSync();
|
|
853
|
+
const anchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
|
|
731
854
|
const syncTime = syncTimer.ms();
|
|
732
855
|
const contractFunctionSimulator = this.#getSimulatorForTx();
|
|
733
|
-
privateExecutionResult = await this.#executePrivate(
|
|
856
|
+
privateExecutionResult = await this.#executePrivate({
|
|
857
|
+
contractFunctionSimulator,
|
|
858
|
+
txRequest,
|
|
859
|
+
anchorBlockHeader,
|
|
860
|
+
scopes,
|
|
861
|
+
jobId,
|
|
862
|
+
senderForTags,
|
|
863
|
+
});
|
|
734
864
|
|
|
735
865
|
const {
|
|
736
866
|
publicInputs,
|
|
737
867
|
chonkProof,
|
|
738
868
|
executionSteps,
|
|
739
869
|
timings: { proving } = {},
|
|
740
|
-
} = await this.#prove(txRequest, this.proofCreator, privateExecutionResult, {
|
|
870
|
+
} = await this.#prove(txRequest, this.proofCreator, privateExecutionResult, anchorBlockHeader, {
|
|
741
871
|
simulate: false,
|
|
742
872
|
skipFeeEnforcement: false,
|
|
743
873
|
profileMode: 'none',
|
|
@@ -767,23 +897,20 @@ export class PXE {
|
|
|
767
897
|
nodeRPCCalls: contractFunctionSimulator?.getStats().nodeRPCCalls,
|
|
768
898
|
});
|
|
769
899
|
|
|
770
|
-
//
|
|
771
|
-
//
|
|
772
|
-
//
|
|
773
|
-
//
|
|
774
|
-
//
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
} else {
|
|
785
|
-
this.log.debug(`No tagging index ranges used in the tx`);
|
|
786
|
-
}
|
|
900
|
+
// We keep track of which tagging indices we've used in this tx so that we don't repeat them in future txs
|
|
901
|
+
// (which would link them) without having to rely on this tx being mined (and us seeing the indices being used
|
|
902
|
+
// onchain).
|
|
903
|
+
// Note that this must happen _after_ proving as it requires the proof's public inputs, from which the kernels
|
|
904
|
+
// may have removed some logs due to note-nullifier squashing - this may lead to range of tagging indices we've
|
|
905
|
+
// actually used to being reduced.
|
|
906
|
+
await persistSenderTaggingIndexRangesForTx(
|
|
907
|
+
this.senderTaggingStore,
|
|
908
|
+
privateExecutionResult.entrypoint.taggingIndexRanges,
|
|
909
|
+
publicInputs,
|
|
910
|
+
() => txProvingResult.getTxHash(),
|
|
911
|
+
jobId,
|
|
912
|
+
this.log,
|
|
913
|
+
);
|
|
787
914
|
|
|
788
915
|
return txProvingResult;
|
|
789
916
|
} catch (err: any) {
|
|
@@ -800,7 +927,7 @@ export class PXE {
|
|
|
800
927
|
*/
|
|
801
928
|
public profileTx(
|
|
802
929
|
txRequest: TxExecutionRequest,
|
|
803
|
-
{ profileMode, skipProofGeneration = true, scopes }: ProfileTxOpts,
|
|
930
|
+
{ profileMode, skipProofGeneration = true, scopes, senderForTags }: ProfileTxOpts,
|
|
804
931
|
): Promise<TxProfileResult> {
|
|
805
932
|
// We disable concurrent profiles for consistency with simulateTx.
|
|
806
933
|
return this.#putInJobQueue(async jobId => {
|
|
@@ -819,16 +946,25 @@ export class PXE {
|
|
|
819
946
|
txInfo,
|
|
820
947
|
);
|
|
821
948
|
const syncTimer = new Timer();
|
|
822
|
-
await this
|
|
949
|
+
await this.#maybeSync();
|
|
950
|
+
const anchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
|
|
823
951
|
const syncTime = syncTimer.ms();
|
|
824
952
|
|
|
825
953
|
const contractFunctionSimulator = this.#getSimulatorForTx();
|
|
826
|
-
const privateExecutionResult = await this.#executePrivate(
|
|
954
|
+
const privateExecutionResult = await this.#executePrivate({
|
|
955
|
+
contractFunctionSimulator,
|
|
956
|
+
txRequest,
|
|
957
|
+
anchorBlockHeader,
|
|
958
|
+
scopes,
|
|
959
|
+
jobId,
|
|
960
|
+
senderForTags,
|
|
961
|
+
});
|
|
827
962
|
|
|
828
963
|
const { executionSteps, timings: { proving } = {} } = await this.#prove(
|
|
829
964
|
txRequest,
|
|
830
965
|
this.proofCreator,
|
|
831
966
|
privateExecutionResult,
|
|
967
|
+
anchorBlockHeader,
|
|
832
968
|
{
|
|
833
969
|
simulate: skipProofGeneration,
|
|
834
970
|
skipFeeEnforcement: false,
|
|
@@ -889,7 +1025,15 @@ export class PXE {
|
|
|
889
1025
|
*/
|
|
890
1026
|
public simulateTx(
|
|
891
1027
|
txRequest: TxExecutionRequest,
|
|
892
|
-
{
|
|
1028
|
+
{
|
|
1029
|
+
simulatePublic,
|
|
1030
|
+
skipTxValidation = false,
|
|
1031
|
+
skipFeeEnforcement = false,
|
|
1032
|
+
skipKernels = true,
|
|
1033
|
+
overrides,
|
|
1034
|
+
scopes,
|
|
1035
|
+
senderForTags,
|
|
1036
|
+
}: SimulateTxOpts,
|
|
893
1037
|
): Promise<TxSimulationResult> {
|
|
894
1038
|
// We disable concurrent simulations since those might execute oracles which read and write to the PXE stores (e.g.
|
|
895
1039
|
// to the capsules), and we need to prevent concurrent runs from interfering with one another (e.g. attempting to
|
|
@@ -910,24 +1054,26 @@ export class PXE {
|
|
|
910
1054
|
txInfo,
|
|
911
1055
|
);
|
|
912
1056
|
const syncTimer = new Timer();
|
|
913
|
-
await this
|
|
1057
|
+
await this.#maybeSync();
|
|
1058
|
+
const anchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
|
|
914
1059
|
const syncTime = syncTimer.ms();
|
|
915
1060
|
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
const overriddenContracts = overrides?.contracts ? new Set(Object.keys(overrides.contracts)) : undefined;
|
|
921
|
-
const hasOverriddenContracts = overriddenContracts !== undefined && overriddenContracts.size > 0;
|
|
922
|
-
const skipKernels = hasOverriddenContracts;
|
|
923
|
-
|
|
924
|
-
// Set overridden contracts on the sync service so it knows to skip syncing them
|
|
925
|
-
if (hasOverriddenContracts) {
|
|
926
|
-
this.contractSyncService.setOverriddenContracts(jobId, overriddenContracts);
|
|
1061
|
+
if (overrides?.contracts && Object.keys(overrides.contracts).length > 0 && !skipKernels) {
|
|
1062
|
+
throw new Error(
|
|
1063
|
+
'Simulating with overridden contracts is not compatible with kernel execution. Please set skipKernels to true when simulating with overridden contracts.',
|
|
1064
|
+
);
|
|
927
1065
|
}
|
|
1066
|
+
const contractFunctionSimulator = this.#getSimulatorForTx(overrides);
|
|
928
1067
|
|
|
929
1068
|
// Execution of private functions only; no proving, and no kernel logic.
|
|
930
|
-
const privateExecutionResult = await this.#executePrivate(
|
|
1069
|
+
const privateExecutionResult = await this.#executePrivate({
|
|
1070
|
+
contractFunctionSimulator,
|
|
1071
|
+
txRequest,
|
|
1072
|
+
anchorBlockHeader,
|
|
1073
|
+
scopes,
|
|
1074
|
+
jobId,
|
|
1075
|
+
senderForTags,
|
|
1076
|
+
});
|
|
931
1077
|
|
|
932
1078
|
let publicInputs: PrivateKernelTailCircuitPublicInputs | undefined;
|
|
933
1079
|
let executionSteps: PrivateExecutionStep[] = [];
|
|
@@ -940,11 +1086,17 @@ export class PXE {
|
|
|
940
1086
|
));
|
|
941
1087
|
} else {
|
|
942
1088
|
// Kernel logic, plus proving of all private functions and kernels.
|
|
943
|
-
({ publicInputs, executionSteps } = await this.#prove(
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
1089
|
+
({ publicInputs, executionSteps } = await this.#prove(
|
|
1090
|
+
txRequest,
|
|
1091
|
+
this.proofCreator,
|
|
1092
|
+
privateExecutionResult,
|
|
1093
|
+
anchorBlockHeader,
|
|
1094
|
+
{
|
|
1095
|
+
simulate: true,
|
|
1096
|
+
skipFeeEnforcement,
|
|
1097
|
+
profileMode: 'none',
|
|
1098
|
+
},
|
|
1099
|
+
));
|
|
948
1100
|
}
|
|
949
1101
|
|
|
950
1102
|
const privateSimulationResult = new PrivateSimulationResult(privateExecutionResult, publicInputs);
|
|
@@ -953,7 +1105,7 @@ export class PXE {
|
|
|
953
1105
|
let publicOutput: PublicSimulationOutput | undefined;
|
|
954
1106
|
if (simulatePublic && publicInputs.forPublic) {
|
|
955
1107
|
const publicSimulationTimer = new Timer();
|
|
956
|
-
publicOutput = await this.#simulatePublicCalls(simulatedTx, skipFeeEnforcement);
|
|
1108
|
+
publicOutput = await this.#simulatePublicCalls(simulatedTx, skipFeeEnforcement, overrides);
|
|
957
1109
|
publicSimulationTime = publicSimulationTimer.ms();
|
|
958
1110
|
if (publicOutput?.debugLogs?.length) {
|
|
959
1111
|
await displayDebugLogs(publicOutput.debugLogs, addr => this.contractStore.getDebugContractName(addr));
|
|
@@ -1018,7 +1170,7 @@ export class PXE {
|
|
|
1018
1170
|
inspect(txRequest),
|
|
1019
1171
|
`simulatePublic=${simulatePublic}`,
|
|
1020
1172
|
`skipTxValidation=${skipTxValidation}`,
|
|
1021
|
-
`scopes=${scopes
|
|
1173
|
+
`scopes=${scopes.map(s => s.toString()).join(', ')}`,
|
|
1022
1174
|
);
|
|
1023
1175
|
}
|
|
1024
1176
|
});
|
|
@@ -1030,7 +1182,7 @@ export class PXE {
|
|
|
1030
1182
|
*/
|
|
1031
1183
|
public executeUtility(
|
|
1032
1184
|
call: FunctionCall,
|
|
1033
|
-
{ authwits, scopes }: ExecuteUtilityOpts = { scopes:
|
|
1185
|
+
{ authwits, scopes }: ExecuteUtilityOpts = { scopes: [] },
|
|
1034
1186
|
): Promise<UtilityExecutionResult> {
|
|
1035
1187
|
// We disable concurrent executions since those might execute oracles which read and write to the PXE stores (e.g.
|
|
1036
1188
|
// to the capsules), and we need to prevent concurrent runs from interfering with one another (e.g. attempting to
|
|
@@ -1039,7 +1191,7 @@ export class PXE {
|
|
|
1039
1191
|
try {
|
|
1040
1192
|
const totalTimer = new Timer();
|
|
1041
1193
|
const syncTimer = new Timer();
|
|
1042
|
-
await this
|
|
1194
|
+
await this.#maybeSync();
|
|
1043
1195
|
const syncTime = syncTimer.ms();
|
|
1044
1196
|
const functionTimer = new Timer();
|
|
1045
1197
|
const contractFunctionSimulator = this.#getSimulatorForTx();
|
|
@@ -1055,7 +1207,7 @@ export class PXE {
|
|
|
1055
1207
|
scopes,
|
|
1056
1208
|
);
|
|
1057
1209
|
|
|
1058
|
-
const executionResult = await this.#executeUtility(
|
|
1210
|
+
const { result: executionResult, offchainEffects } = await this.#executeUtility(
|
|
1059
1211
|
contractFunctionSimulator,
|
|
1060
1212
|
call,
|
|
1061
1213
|
authwits ?? [],
|
|
@@ -1076,14 +1228,19 @@ export class PXE {
|
|
|
1076
1228
|
};
|
|
1077
1229
|
|
|
1078
1230
|
const simulationStats = contractFunctionSimulator.getStats();
|
|
1079
|
-
return {
|
|
1231
|
+
return {
|
|
1232
|
+
result: executionResult,
|
|
1233
|
+
offchainEffects,
|
|
1234
|
+
anchorBlockTimestamp: anchorBlockHeader.globalVariables.timestamp,
|
|
1235
|
+
stats: { timings, nodeRPCCalls: simulationStats.nodeRPCCalls },
|
|
1236
|
+
};
|
|
1080
1237
|
} catch (err: any) {
|
|
1081
1238
|
const { to, name, args } = call;
|
|
1082
1239
|
const stringifiedArgs = args.map(arg => arg.toString()).join(', ');
|
|
1083
1240
|
throw this.#contextualizeError(
|
|
1084
1241
|
err,
|
|
1085
1242
|
`executeUtility ${to}:${name}(${stringifiedArgs})`,
|
|
1086
|
-
`scopes=${scopes
|
|
1243
|
+
`scopes=${scopes.map(s => s.toString()).join(', ')}`,
|
|
1087
1244
|
);
|
|
1088
1245
|
}
|
|
1089
1246
|
});
|
|
@@ -1109,7 +1266,7 @@ export class PXE {
|
|
|
1109
1266
|
let anchorBlockNumber: BlockNumber;
|
|
1110
1267
|
|
|
1111
1268
|
await this.#putInJobQueue(async jobId => {
|
|
1112
|
-
await this
|
|
1269
|
+
await this.#maybeSync();
|
|
1113
1270
|
|
|
1114
1271
|
const anchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
|
|
1115
1272
|
anchorBlockNumber = anchorBlockHeader.getBlockNumber();
|
|
@@ -1142,6 +1299,7 @@ export class PXE {
|
|
|
1142
1299
|
*/
|
|
1143
1300
|
public async stop(): Promise<void> {
|
|
1144
1301
|
await this.jobQueue.end();
|
|
1302
|
+
await this.blockStateSynchronizer.stop();
|
|
1145
1303
|
await this.db.close();
|
|
1146
1304
|
}
|
|
1147
1305
|
}
|