@aztec/pxe 0.0.1-commit.a072138 → 0.0.1-commit.a5db02d
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 +45 -111
- 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 +51 -0
- package/dest/bin/oracle_version_helpers.d.ts.map +1 -0
- package/dest/bin/oracle_version_helpers.js +254 -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 +37 -0
- package/dest/block_synchronizer/block_synchronizer.d.ts +23 -13
- package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -1
- package/dest/block_synchronizer/block_synchronizer.js +90 -28
- package/dest/config/index.d.ts +9 -2
- package/dest/config/index.d.ts.map +1 -1
- package/dest/config/index.js +14 -15
- package/dest/config/package_info.js +1 -1
- package/dest/contract/contract_class_service.d.ts +31 -0
- package/dest/contract/contract_class_service.d.ts.map +1 -0
- package/dest/contract/contract_class_service.js +68 -0
- package/dest/contract/contract_sync_service.d.ts +48 -0
- package/dest/contract/contract_sync_service.d.ts.map +1 -0
- package/dest/contract/contract_sync_service.js +116 -0
- package/dest/contract/helpers.d.ts +7 -0
- package/dest/contract/helpers.d.ts.map +1 -0
- package/dest/contract/helpers.js +20 -0
- package/dest/contract_function_simulator/anchored_contract_data.d.ts +36 -0
- package/dest/contract_function_simulator/anchored_contract_data.d.ts.map +1 -0
- package/dest/contract_function_simulator/anchored_contract_data.js +54 -0
- package/dest/contract_function_simulator/aztec_node_read_cache.d.ts +39 -0
- package/dest/contract_function_simulator/aztec_node_read_cache.d.ts.map +1 -0
- package/dest/contract_function_simulator/aztec_node_read_cache.js +60 -0
- package/dest/contract_function_simulator/contract_function_simulator.d.ts +72 -34
- package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.js +265 -95
- 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 +4 -10
- package/dest/contract_function_simulator/execution_note_cache.d.ts.map +1 -1
- package/dest/contract_function_simulator/execution_note_cache.js +8 -28
- package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts +7 -11
- package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts.map +1 -1
- package/dest/contract_function_simulator/execution_tagging_index_cache.js +19 -15
- package/dest/contract_function_simulator/index.d.ts +26 -5
- package/dest/contract_function_simulator/index.d.ts.map +1 -1
- package/dest/contract_function_simulator/index.js +12 -3
- package/dest/contract_function_simulator/noir-structs/bounded_vec.d.ts +29 -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 +30 -0
- package/dest/contract_function_simulator/noir-structs/contract_class_log_data.d.ts +9 -0
- package/dest/contract_function_simulator/noir-structs/contract_class_log_data.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/contract_class_log_data.js +1 -0
- package/dest/contract_function_simulator/noir-structs/embedded_curve_point.d.ts +7 -0
- package/dest/contract_function_simulator/noir-structs/embedded_curve_point.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/embedded_curve_point.js +1 -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 +3 -4
- 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 +9 -10
- package/dest/contract_function_simulator/noir-structs/fact.d.ts +16 -0
- package/dest/contract_function_simulator/noir-structs/fact.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/fact.js +6 -0
- package/dest/contract_function_simulator/noir-structs/fact_collection.d.ts +27 -0
- package/dest/contract_function_simulator/noir-structs/fact_collection.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/fact_collection.js +31 -0
- package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts +19 -10
- 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 +12 -24
- package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts +11 -9
- package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/log_retrieval_response.js +2 -63
- 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 +3 -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 +8 -12
- package/dest/contract_function_simulator/noir-structs/option.d.ts +59 -0
- package/dest/contract_function_simulator/noir-structs/option.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/option.js +67 -0
- package/dest/contract_function_simulator/noir-structs/origin_block.d.ts +11 -0
- package/dest/contract_function_simulator/noir-structs/origin_block.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/origin_block.js +5 -0
- package/dest/contract_function_simulator/noir-structs/pending_tagged_log.d.ts +11 -0
- package/dest/contract_function_simulator/noir-structs/pending_tagged_log.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/pending_tagged_log.js +4 -0
- package/dest/contract_function_simulator/noir-structs/provided_secret.d.ts +8 -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 +1 -0
- package/dest/contract_function_simulator/noir-structs/resolved_tagging_strategy.d.ts +28 -0
- package/dest/contract_function_simulator/noir-structs/resolved_tagging_strategy.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/resolved_tagging_strategy.js +50 -0
- package/dest/contract_function_simulator/noir-structs/resolved_tx.d.ts +21 -0
- package/dest/contract_function_simulator/noir-structs/resolved_tx.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/resolved_tx.js +50 -0
- package/dest/contract_function_simulator/noir-structs/tx_effect_data.d.ts +14 -0
- package/dest/contract_function_simulator/noir-structs/tx_effect_data.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/tx_effect_data.js +5 -0
- package/dest/contract_function_simulator/noir-structs/utility_context.d.ts +6 -11
- package/dest/contract_function_simulator/noir-structs/utility_context.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/utility_context.js +1 -20
- package/dest/contract_function_simulator/oracle/acir_callback.d.ts +21 -0
- package/dest/contract_function_simulator/oracle/acir_callback.d.ts.map +1 -0
- package/dest/contract_function_simulator/oracle/acir_callback.js +115 -0
- package/dest/contract_function_simulator/oracle/index.d.ts +2 -13
- package/dest/contract_function_simulator/oracle/index.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/index.js +1 -1
- package/dest/contract_function_simulator/oracle/interfaces.d.ts +15 -98
- 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/legacy_oracle_registry.d.ts +39 -0
- package/dest/contract_function_simulator/oracle/legacy_oracle_registry.d.ts.map +1 -0
- package/dest/contract_function_simulator/oracle/legacy_oracle_registry.js +107 -0
- package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts +3 -14
- package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.js +1 -24
- 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_registry.d.ts +139 -0
- package/dest/contract_function_simulator/oracle/oracle_registry.d.ts.map +1 -0
- package/dest/contract_function_simulator/oracle/oracle_registry.js +1016 -0
- package/dest/contract_function_simulator/oracle/oracle_type_mappings.d.ts +222 -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 +1243 -0
- package/dest/contract_function_simulator/oracle/private_execution.d.ts +1 -1
- package/dest/contract_function_simulator/oracle/private_execution.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution.js +7 -6
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +82 -96
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.js +256 -114
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +201 -84
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +604 -186
- 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/transient_array_service.d.ts +31 -0
- package/dest/contract_function_simulator/transient_array_service.d.ts.map +1 -0
- package/dest/contract_function_simulator/transient_array_service.js +62 -0
- package/dest/contract_logging.d.ts +27 -0
- package/dest/contract_logging.d.ts.map +1 -0
- package/dest/contract_logging.js +38 -0
- package/dest/debug/pxe_debug_utils.d.ts +14 -15
- package/dest/debug/pxe_debug_utils.d.ts.map +1 -1
- package/dest/debug/pxe_debug_utils.js +16 -21
- package/dest/entrypoints/client/bundle/index.d.ts +4 -1
- package/dest/entrypoints/client/bundle/index.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/index.js +3 -0
- 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 +35 -8
- package/dest/entrypoints/client/lazy/index.d.ts +4 -1
- package/dest/entrypoints/client/lazy/index.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/index.js +3 -0
- 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 +35 -8
- package/dest/entrypoints/client/store.d.ts +14 -0
- package/dest/entrypoints/client/store.d.ts.map +1 -0
- package/dest/entrypoints/client/store.js +28 -0
- package/dest/entrypoints/pxe_creation_options.d.ts +16 -2
- 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 +8 -3
- package/dest/entrypoints/server/index.d.ts.map +1 -1
- package/dest/entrypoints/server/index.js +6 -2
- package/dest/entrypoints/server/store.d.ts +18 -0
- package/dest/entrypoints/server/store.d.ts.map +1 -0
- package/dest/entrypoints/server/store.js +28 -0
- 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 +36 -8
- package/dest/error_enriching.d.ts +5 -3
- package/dest/error_enriching.d.ts.map +1 -1
- package/dest/error_enriching.js +13 -11
- 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 +62 -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 +5 -0
- package/dest/hooks/index.d.ts.map +1 -0
- package/dest/hooks/index.js +2 -0
- package/dest/hooks/resolve_custom_request.d.ts +23 -0
- package/dest/hooks/resolve_custom_request.d.ts.map +1 -0
- package/dest/hooks/resolve_custom_request.js +3 -0
- package/dest/hooks/resolve_tagging_secret_strategy.d.ts +50 -0
- package/dest/hooks/resolve_tagging_secret_strategy.d.ts.map +1 -0
- package/dest/hooks/resolve_tagging_secret_strategy.js +3 -0
- package/dest/logs/log_service.d.ts +14 -11
- package/dest/logs/log_service.d.ts.map +1 -1
- package/dest/logs/log_service.js +193 -91
- package/dest/messages/tx_resolver_service.d.ts +17 -0
- package/dest/messages/tx_resolver_service.d.ts.map +1 -0
- package/dest/messages/tx_resolver_service.js +55 -0
- package/dest/notes/note_service.d.ts +28 -6
- package/dest/notes/note_service.d.ts.map +1 -1
- package/dest/notes/note_service.js +84 -59
- package/dest/notes_filter.d.ts +24 -0
- package/dest/notes_filter.d.ts.map +1 -0
- package/dest/notes_filter.js +4 -0
- 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/compute_tx_expiration_timestamp.d.ts +4 -0
- package/dest/private_kernel/hints/compute_tx_expiration_timestamp.d.ts.map +1 -0
- package/dest/private_kernel/hints/{compute_tx_include_by_timestamp.js → compute_tx_expiration_timestamp.js} +12 -12
- package/dest/private_kernel/hints/index.d.ts +1 -1
- package/dest/private_kernel/hints/index.js +1 -1
- package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts +4 -3
- package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts.map +1 -1
- package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.js +135 -70
- package/dest/private_kernel/hints/test_utils.d.ts +122 -0
- package/dest/private_kernel/hints/test_utils.d.ts.map +1 -0
- package/dest/private_kernel/hints/test_utils.js +202 -0
- 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 +164 -82
- package/dest/private_kernel/private_kernel_oracle.d.ts +17 -11
- package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_oracle.js +47 -29
- package/dest/pxe.d.ts +228 -66
- package/dest/pxe.d.ts.map +1 -1
- package/dest/pxe.js +410 -227
- package/dest/storage/allowed_scopes.d.ts +6 -0
- package/dest/storage/allowed_scopes.d.ts.map +1 -0
- package/dest/storage/allowed_scopes.js +7 -0
- package/dest/storage/anchor_block_store/anchor_block_store.d.ts +9 -6
- package/dest/storage/anchor_block_store/anchor_block_store.d.ts.map +1 -1
- package/dest/storage/anchor_block_store/anchor_block_store.js +9 -7
- 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 +671 -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 +47 -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 +63 -33
- package/dest/storage/contract_store/contract_store.d.ts.map +1 -1
- package/dest/storage/contract_store/contract_store.js +182 -134
- package/dest/storage/fact_store/fact_service.d.ts +22 -0
- package/dest/storage/fact_store/fact_service.d.ts.map +1 -0
- package/dest/storage/fact_store/fact_service.js +45 -0
- package/dest/storage/fact_store/fact_store.d.ts +95 -0
- package/dest/storage/fact_store/fact_store.d.ts.map +1 -0
- package/dest/storage/fact_store/fact_store.js +408 -0
- package/dest/storage/fact_store/fact_store_keys.d.ts +34 -0
- package/dest/storage/fact_store/fact_store_keys.d.ts.map +1 -0
- package/dest/storage/fact_store/fact_store_keys.js +50 -0
- package/dest/storage/fact_store/index.d.ts +6 -0
- package/dest/storage/fact_store/index.d.ts.map +1 -0
- package/dest/storage/fact_store/index.js +4 -0
- package/dest/storage/fact_store/origin_state.d.ts +57 -0
- package/dest/storage/fact_store/origin_state.d.ts.map +1 -0
- package/dest/storage/fact_store/origin_state.js +53 -0
- package/dest/storage/fact_store/stored_fact.d.ts +32 -0
- package/dest/storage/fact_store/stored_fact.d.ts.map +1 -0
- package/dest/storage/fact_store/stored_fact.js +64 -0
- package/dest/storage/index.d.ts +3 -2
- package/dest/storage/index.d.ts.map +1 -1
- package/dest/storage/index.js +2 -1
- package/dest/storage/metadata.d.ts +2 -2
- package/dest/storage/metadata.d.ts.map +1 -1
- package/dest/storage/metadata.js +1 -1
- package/dest/storage/note_store/note_store.d.ts +44 -35
- package/dest/storage/note_store/note_store.d.ts.map +1 -1
- package/dest/storage/note_store/note_store.js +202 -171
- package/dest/storage/note_store/stored_note.d.ts +3 -8
- package/dest/storage/note_store/stored_note.d.ts.map +1 -1
- package/dest/storage/note_store/stored_note.js +4 -20
- package/dest/storage/open_pxe_stores.d.ts +35 -0
- package/dest/storage/open_pxe_stores.d.ts.map +1 -0
- package/dest/storage/open_pxe_stores.js +29 -0
- package/dest/storage/private_event_store/private_event_store.d.ts +13 -16
- package/dest/storage/private_event_store/private_event_store.d.ts.map +1 -1
- package/dest/storage/private_event_store/private_event_store.js +43 -43
- package/dest/storage/private_event_store/stored_private_event.js +1 -1
- package/dest/storage/store_identity.d.ts +35 -0
- package/dest/storage/store_identity.d.ts.map +1 -0
- package/dest/storage/store_identity.js +44 -0
- package/dest/storage/tagging_store/index.d.ts +2 -2
- package/dest/storage/tagging_store/index.d.ts.map +1 -1
- package/dest/storage/tagging_store/index.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 +45 -28
- package/dest/storage/tagging_store/sender_tagging_store.d.ts.map +1 -1
- package/dest/storage/tagging_store/sender_tagging_store.js +182 -119
- package/dest/storage/tagging_store/tagging_secret_sources_store.d.ts +51 -0
- package/dest/storage/tagging_store/tagging_secret_sources_store.d.ts.map +1 -0
- package/dest/storage/tagging_store/tagging_secret_sources_store.js +105 -0
- package/dest/tagging/constants.d.ts +2 -2
- package/dest/tagging/constants.d.ts.map +1 -1
- package/dest/tagging/constants.js +18 -9
- 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 +45 -32
- package/dest/tagging/index.d.ts +6 -5
- 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 +69 -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 +203 -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/recipient_sync/utils/find_highest_indexes.js +2 -2
- 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 -9
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts.map +1 -1
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.js +32 -14
- package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts +13 -7
- 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 +41 -10
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts +5 -7
- 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 +41 -25
- package/package.json +29 -17
- package/src/bin/check_oracle_version.ts +51 -133
- package/src/bin/index.ts +5 -0
- package/src/bin/oracle_version_helpers.ts +311 -0
- package/src/block_synchronizer/block_stream_source.ts +42 -0
- package/src/block_synchronizer/block_synchronizer.ts +106 -37
- package/src/config/index.ts +16 -9
- package/src/config/package_info.ts +1 -1
- package/src/contract/contract_class_service.ts +83 -0
- package/src/contract/contract_sync_service.ts +176 -0
- package/src/contract/helpers.ts +35 -0
- package/src/contract_function_simulator/anchored_contract_data.ts +74 -0
- package/src/contract_function_simulator/aztec_node_read_cache.ts +89 -0
- package/src/contract_function_simulator/contract_function_simulator.ts +466 -159
- package/src/contract_function_simulator/ephemeral_array_service.ts +110 -0
- package/src/contract_function_simulator/execution_note_cache.ts +8 -29
- package/src/contract_function_simulator/execution_tagging_index_cache.ts +19 -18
- package/src/contract_function_simulator/index.ts +69 -4
- package/src/contract_function_simulator/noir-structs/bounded_vec.ts +43 -0
- package/src/contract_function_simulator/noir-structs/contract_class_log_data.ts +9 -0
- package/src/contract_function_simulator/noir-structs/embedded_curve_point.ts +4 -0
- package/src/contract_function_simulator/noir-structs/ephemeral_array.ts +66 -0
- package/src/contract_function_simulator/noir-structs/event_validation_request.ts +10 -9
- package/src/contract_function_simulator/noir-structs/fact.ts +13 -0
- package/src/contract_function_simulator/noir-structs/fact_collection.ts +64 -0
- package/src/contract_function_simulator/noir-structs/log_retrieval_request.ts +27 -20
- package/src/contract_function_simulator/noir-structs/log_retrieval_response.ts +14 -64
- package/src/contract_function_simulator/noir-structs/note_data.ts +27 -0
- package/src/contract_function_simulator/noir-structs/note_validation_request.ts +6 -11
- package/src/contract_function_simulator/noir-structs/option.ts +75 -0
- package/src/contract_function_simulator/noir-structs/origin_block.ts +8 -0
- package/src/contract_function_simulator/noir-structs/pending_tagged_log.ts +12 -0
- package/src/contract_function_simulator/noir-structs/provided_secret.ts +5 -0
- package/src/contract_function_simulator/noir-structs/resolved_tagging_strategy.ts +66 -0
- package/src/contract_function_simulator/noir-structs/resolved_tx.ts +53 -0
- package/src/contract_function_simulator/noir-structs/tx_effect_data.ts +15 -0
- package/src/contract_function_simulator/noir-structs/utility_context.ts +5 -17
- package/src/contract_function_simulator/oracle/acir_callback.ts +154 -0
- package/src/contract_function_simulator/oracle/index.ts +1 -15
- package/src/contract_function_simulator/oracle/interfaces.ts +11 -176
- package/src/contract_function_simulator/oracle/legacy_oracle_registry.ts +147 -0
- package/src/contract_function_simulator/oracle/message_load_oracle_inputs.ts +6 -21
- package/src/contract_function_simulator/oracle/note_packing_utils.ts +3 -3
- package/src/contract_function_simulator/oracle/oracle_registry.ts +711 -0
- package/src/contract_function_simulator/oracle/oracle_type_mappings.ts +964 -0
- package/src/contract_function_simulator/oracle/private_execution.ts +6 -7
- package/src/contract_function_simulator/oracle/private_execution_oracle.ts +314 -214
- package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +935 -263
- package/src/contract_function_simulator/pick_notes.ts +22 -3
- package/src/contract_function_simulator/transient_array_service.ts +91 -0
- package/src/contract_logging.ts +52 -0
- package/src/debug/pxe_debug_utils.ts +47 -25
- package/src/entrypoints/client/bundle/index.ts +3 -0
- package/src/entrypoints/client/bundle/utils.ts +41 -9
- package/src/entrypoints/client/lazy/index.ts +3 -0
- package/src/entrypoints/client/lazy/utils.ts +41 -9
- package/src/entrypoints/client/store.ts +38 -0
- package/src/entrypoints/pxe_creation_options.ts +21 -1
- package/src/entrypoints/server/index.ts +8 -2
- package/src/entrypoints/server/store.ts +47 -0
- package/src/entrypoints/server/utils.ts +52 -21
- package/src/error_enriching.ts +27 -11
- 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 +68 -0
- package/src/hooks/index.ts +13 -0
- package/src/hooks/resolve_custom_request.ts +24 -0
- package/src/hooks/resolve_tagging_secret_strategy.ts +60 -0
- package/src/logs/log_service.ts +231 -156
- package/src/messages/tx_resolver_service.ts +69 -0
- package/src/notes/note_service.ts +121 -86
- package/src/notes_filter.ts +24 -0
- package/src/oracle_version.ts +20 -10
- package/src/private_kernel/batch_planner.ts +169 -0
- package/src/private_kernel/hints/{compute_tx_include_by_timestamp.ts → compute_tx_expiration_timestamp.ts} +13 -13
- package/src/private_kernel/hints/index.ts +1 -1
- package/src/private_kernel/hints/private_kernel_reset_private_inputs_builder.ts +176 -119
- package/src/private_kernel/hints/test_utils.ts +318 -0
- package/src/private_kernel/private_kernel_execution_prover.ts +251 -116
- package/src/private_kernel/private_kernel_oracle.ts +65 -36
- package/src/pxe.ts +702 -298
- package/src/storage/allowed_scopes.ts +14 -0
- package/src/storage/anchor_block_store/anchor_block_store.ts +9 -7
- 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__/FactStore.json +40 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/KeyStore.json +52 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/L2TipsKVStore.json +40 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/NoteStore.json +56 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/PrivateEventStore.json +44 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/RecipientTaggingStore.json +26 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/SenderTaggingStore.json +30 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/TaggingSecretSourcesStore.json +30 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/opened_stores.json +117 -0
- package/src/storage/backwards_compatibility_tests/kv_store_snapshot.ts +122 -0
- package/src/storage/backwards_compatibility_tests/schema_tests.ts +803 -0
- package/src/storage/backwards_compatibility_tests/store_spy.ts +73 -0
- package/src/storage/capsule_store/capsule_service.ts +85 -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 +240 -169
- package/src/storage/fact_store/fact_service.ts +69 -0
- package/src/storage/fact_store/fact_store.ts +487 -0
- package/src/storage/fact_store/fact_store_keys.ts +75 -0
- package/src/storage/fact_store/index.ts +14 -0
- package/src/storage/fact_store/origin_state.ts +75 -0
- package/src/storage/fact_store/stored_fact.ts +80 -0
- package/src/storage/index.ts +2 -1
- package/src/storage/metadata.ts +1 -1
- package/src/storage/note_store/note_store.ts +234 -191
- package/src/storage/note_store/stored_note.ts +5 -27
- package/src/storage/open_pxe_stores.ts +52 -0
- package/src/storage/private_event_store/private_event_store.ts +52 -54
- package/src/storage/private_event_store/stored_private_event.ts +1 -1
- package/src/storage/store_identity.ts +72 -0
- package/src/storage/tagging_store/index.ts +1 -1
- package/src/storage/tagging_store/recipient_tagging_store.ts +5 -5
- package/src/storage/tagging_store/sender_tagging_store.ts +235 -141
- package/src/storage/tagging_store/tagging_secret_sources_store.ts +138 -0
- package/src/tagging/constants.ts +19 -9
- package/src/tagging/get_all_logs_by_tags.ts +87 -35
- package/src/tagging/index.ts +5 -4
- package/src/tagging/persist_sender_tagging_index_ranges.ts +57 -0
- package/src/tagging/recipient_sync/sync_tagged_private_logs.ts +301 -0
- package/src/tagging/recipient_sync/utils/find_highest_indexes.ts +4 -4
- package/src/tagging/reconcile_tagging_index_ranges.ts +102 -0
- package/src/tagging/sender_sync/sync_sender_tagging_indexes.ts +52 -17
- package/src/tagging/sender_sync/utils/get_status_change_of_pending.ts +44 -14
- package/src/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.ts +31 -27
- package/dest/contract_function_simulator/oracle/oracle.d.ts +0 -60
- package/dest/contract_function_simulator/oracle/oracle.d.ts.map +0 -1
- package/dest/contract_function_simulator/oracle/oracle.js +0 -356
- package/dest/contract_function_simulator/proxied_contract_data_source.d.ts +0 -6
- package/dest/contract_function_simulator/proxied_contract_data_source.d.ts.map +0 -1
- package/dest/contract_function_simulator/proxied_contract_data_source.js +0 -80
- package/dest/contract_sync/index.d.ts +0 -23
- package/dest/contract_sync/index.d.ts.map +0 -1
- package/dest/contract_sync/index.js +0 -54
- package/dest/private_kernel/hints/compute_tx_include_by_timestamp.d.ts +0 -4
- package/dest/private_kernel/hints/compute_tx_include_by_timestamp.d.ts.map +0 -1
- package/dest/storage/tagging_store/sender_address_book_store.d.ts +0 -14
- package/dest/storage/tagging_store/sender_address_book_store.d.ts.map +0 -1
- package/dest/storage/tagging_store/sender_address_book_store.js +0 -36
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts +0 -15
- 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 -15
- 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 -32
- package/src/contract_function_simulator/oracle/oracle.ts +0 -630
- package/src/contract_function_simulator/proxied_contract_data_source.ts +0 -83
- package/src/contract_sync/index.ts +0 -98
- package/src/storage/tagging_store/sender_address_book_store.ts +0 -48
- package/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts +0 -143
- package/src/tagging/recipient_sync/utils/load_logs_for_range.ts +0 -49
package/src/pxe.ts
CHANGED
|
@@ -1,38 +1,45 @@
|
|
|
1
1
|
import type { PrivateEventFilter } from '@aztec/aztec.js/wallet';
|
|
2
2
|
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
3
3
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
4
|
+
import { Point } from '@aztec/foundation/curves/grumpkin';
|
|
4
5
|
import { type Logger, type LoggerBindings, createLogger } from '@aztec/foundation/log';
|
|
5
6
|
import { SerialQueue } from '@aztec/foundation/queue';
|
|
6
7
|
import { Timer } from '@aztec/foundation/timer';
|
|
7
8
|
import { KeyStore } from '@aztec/key-store';
|
|
9
|
+
import type { AccountPrivacyKeys, AccountPrivacySecretKeys } from '@aztec/key-store';
|
|
8
10
|
import type { AztecAsyncKVStore } from '@aztec/kv-store';
|
|
9
|
-
import { L2TipsKVStore } from '@aztec/kv-store/stores';
|
|
10
11
|
import { type ProtocolContractsProvider, protocolContractNames } from '@aztec/protocol-contracts';
|
|
11
12
|
import type { CircuitSimulator } from '@aztec/simulator/client';
|
|
12
13
|
import {
|
|
13
14
|
type ContractArtifact,
|
|
14
15
|
EventSelector,
|
|
15
16
|
FunctionCall,
|
|
17
|
+
type FunctionSelector,
|
|
16
18
|
FunctionType,
|
|
17
19
|
decodeFunctionSignature,
|
|
18
20
|
} from '@aztec/stdlib/abi';
|
|
19
21
|
import type { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
20
22
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
23
|
+
import { GENESIS_BLOCK_HEADER_HASH, type L2TipsProvider } from '@aztec/stdlib/block';
|
|
21
24
|
import {
|
|
22
25
|
CompleteAddress,
|
|
26
|
+
type ContractInstancePreimage,
|
|
27
|
+
type ContractInstancePreimageWithAddress,
|
|
23
28
|
type ContractInstanceWithAddress,
|
|
24
29
|
type PartialAddress,
|
|
25
30
|
computeContractAddressFromInstance,
|
|
26
|
-
getContractClassFromArtifact,
|
|
27
31
|
} from '@aztec/stdlib/contract';
|
|
28
32
|
import { SimulationError } from '@aztec/stdlib/errors';
|
|
29
|
-
import type { AztecNode, PrivateKernelProver } from '@aztec/stdlib/interfaces/client';
|
|
33
|
+
import type { AztecNode, AztecNodeDebug, PrivateKernelProver } from '@aztec/stdlib/interfaces/client';
|
|
30
34
|
import type {
|
|
31
35
|
PrivateExecutionStep,
|
|
32
36
|
PrivateKernelExecutionProofOutput,
|
|
33
37
|
PrivateKernelTailCircuitPublicInputs,
|
|
34
38
|
} from '@aztec/stdlib/kernel';
|
|
39
|
+
import { computeAddressSecret } from '@aztec/stdlib/keys';
|
|
40
|
+
import { deriveEcdhSharedSecretPoint, protectFromForgery } from '@aztec/stdlib/logs';
|
|
35
41
|
import {
|
|
42
|
+
BlockHeader,
|
|
36
43
|
type ContractOverrides,
|
|
37
44
|
type InTx,
|
|
38
45
|
PrivateExecutionResult,
|
|
@@ -46,24 +53,27 @@ import {
|
|
|
46
53
|
TxProfileResult,
|
|
47
54
|
TxProvingResult,
|
|
48
55
|
TxSimulationResult,
|
|
49
|
-
|
|
56
|
+
UtilityExecutionResult,
|
|
50
57
|
} from '@aztec/stdlib/tx';
|
|
51
58
|
|
|
52
59
|
import { inspect } from 'util';
|
|
53
60
|
|
|
54
61
|
import { BlockSynchronizer } from './block_synchronizer/index.js';
|
|
55
62
|
import type { PXEConfig } from './config/index.js';
|
|
63
|
+
import { ContractClassService } from './contract/contract_class_service.js';
|
|
64
|
+
import { ContractSyncService } from './contract/contract_sync_service.js';
|
|
56
65
|
import { BenchmarkedNodeFactory } from './contract_function_simulator/benchmarked_node.js';
|
|
57
66
|
import {
|
|
58
67
|
ContractFunctionSimulator,
|
|
59
68
|
generateSimulatedProvingResult,
|
|
60
69
|
} from './contract_function_simulator/contract_function_simulator.js';
|
|
61
|
-
import {
|
|
62
|
-
import { ensureContractSynced, readCurrentClassId } from './contract_sync/index.js';
|
|
70
|
+
import { displayDebugLogs } from './contract_logging.js';
|
|
63
71
|
import { PXEDebugUtils } from './debug/pxe_debug_utils.js';
|
|
64
72
|
import { enrichPublicSimulationError, enrichSimulationError } from './error_enriching.js';
|
|
65
73
|
import { PrivateEventFilterValidator } from './events/private_event_filter_validator.js';
|
|
74
|
+
import type { ExecutionHooks } from './hooks/index.js';
|
|
66
75
|
import { JobCoordinator } from './job_coordinator/job_coordinator.js';
|
|
76
|
+
import { TxResolverService } from './messages/tx_resolver_service.js';
|
|
67
77
|
import {
|
|
68
78
|
PrivateKernelExecutionProver,
|
|
69
79
|
type PrivateKernelExecutionProverConfig,
|
|
@@ -73,17 +83,147 @@ import { AddressStore } from './storage/address_store/address_store.js';
|
|
|
73
83
|
import { AnchorBlockStore } from './storage/anchor_block_store/anchor_block_store.js';
|
|
74
84
|
import { CapsuleStore } from './storage/capsule_store/capsule_store.js';
|
|
75
85
|
import { ContractStore } from './storage/contract_store/contract_store.js';
|
|
86
|
+
import { FactStore } from './storage/fact_store/index.js';
|
|
76
87
|
import { NoteStore } from './storage/note_store/note_store.js';
|
|
88
|
+
import { openPxeStores } from './storage/open_pxe_stores.js';
|
|
77
89
|
import { PrivateEventStore } from './storage/private_event_store/private_event_store.js';
|
|
78
90
|
import { RecipientTaggingStore } from './storage/tagging_store/recipient_tagging_store.js';
|
|
79
|
-
import { SenderAddressBookStore } from './storage/tagging_store/sender_address_book_store.js';
|
|
80
91
|
import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store.js';
|
|
92
|
+
import {
|
|
93
|
+
type SharedSecretKind,
|
|
94
|
+
TaggingSecretSourcesStore,
|
|
95
|
+
} from './storage/tagging_store/tagging_secret_sources_store.js';
|
|
96
|
+
import { persistSenderTaggingIndexRangesForTx } from './tagging/index.js';
|
|
81
97
|
|
|
82
98
|
export type PackedPrivateEvent = InTx & {
|
|
83
99
|
packedEvent: Fr[];
|
|
84
100
|
eventSelector: EventSelector;
|
|
85
101
|
};
|
|
86
102
|
|
|
103
|
+
/** Options for PXE.proveTx. */
|
|
104
|
+
export type ProveTxOpts = {
|
|
105
|
+
/** Addresses whose private state and keys are accessible during private execution. */
|
|
106
|
+
scopes: AztecAddress[];
|
|
107
|
+
/** Sender address used to derive discovery tags for private messages (notes, events, logs) this tx emits. */
|
|
108
|
+
senderForTags?: AztecAddress;
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
/** Options for PXE.profileTx. */
|
|
112
|
+
export type ProfileTxOpts = {
|
|
113
|
+
/** The profiling mode to use. */
|
|
114
|
+
profileMode: 'full' | 'execution-steps' | 'gates';
|
|
115
|
+
/** If true, proof generation is skipped during profiling. Defaults to true. */
|
|
116
|
+
skipProofGeneration?: boolean;
|
|
117
|
+
/** Addresses whose private state and keys are accessible during private execution. */
|
|
118
|
+
scopes: AztecAddress[];
|
|
119
|
+
/** Sender address used to derive discovery tags for private messages (notes, events, logs) this tx emits. */
|
|
120
|
+
senderForTags?: AztecAddress;
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
/** Options for PXE.simulateTx. */
|
|
124
|
+
export type SimulateTxOpts = {
|
|
125
|
+
/** Whether to simulate the public part of the transaction. */
|
|
126
|
+
simulatePublic: boolean;
|
|
127
|
+
/** If false, this function throws if the transaction is unable to be included in a block at the current state. */
|
|
128
|
+
skipTxValidation?: boolean;
|
|
129
|
+
/** If false, fees are enforced. */
|
|
130
|
+
skipFeeEnforcement?: boolean;
|
|
131
|
+
/** If true, kernel logic is emulated in TS for simulation */
|
|
132
|
+
skipKernels?: boolean;
|
|
133
|
+
/**
|
|
134
|
+
* Pre-simulation overrides applied to the ephemeral fork and contract DB. Bundles publicStorage
|
|
135
|
+
* writes (no skipKernels required) and per-address (instance, artifact?) overrides used by both
|
|
136
|
+
* AVM-side public dispatch and PXE-side ACIR private dispatch (requires skipKernels: true).
|
|
137
|
+
*/
|
|
138
|
+
overrides?: SimulationOverrides;
|
|
139
|
+
/** Addresses whose private state and keys are accessible during private execution */
|
|
140
|
+
scopes: AztecAddress[];
|
|
141
|
+
/** Sender address used to derive discovery tags for private messages (notes, events, logs) this tx emits. */
|
|
142
|
+
senderForTags?: AztecAddress;
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
/** Options for PXE.executeUtility. */
|
|
146
|
+
export type ExecuteUtilityOpts = {
|
|
147
|
+
/** The authentication witnesses required for the function call. */
|
|
148
|
+
authwits?: AuthWitness[];
|
|
149
|
+
/** The accounts whose notes we can access in this call */
|
|
150
|
+
scopes: AztecAddress[];
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Supplies the set of "nice to have" contracts that every PXE preloads regardless of which wallet
|
|
155
|
+
* drives it. Today this is just the standard multi-call entrypoint: the SDK's self-paid account
|
|
156
|
+
* deploy flow ({@link DeployAccountMethod} with `from = NO_FROM`) routes its payload through it, so a
|
|
157
|
+
* PXE that did not register it would fail contract sync with an opaque "no contract instance" error.
|
|
158
|
+
*
|
|
159
|
+
* Returning a list keeps this extensible: a wallet may supply its own provider that preloads
|
|
160
|
+
* additional contracts. Injected the same way as {@link ProtocolContractsProvider} so the PXE never
|
|
161
|
+
* statically imports the bundled artifacts, keeping the bundle/lazy split intact.
|
|
162
|
+
*/
|
|
163
|
+
export type PreloadedContractsProvider = {
|
|
164
|
+
/** Returns the contract instances and artifacts the PXE should preload on startup. */
|
|
165
|
+
getPreloadedContracts: () => Promise<Array<{ instance: ContractInstanceWithAddress; artifact: ContractArtifact }>>;
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
/** Args for PXE.create. */
|
|
169
|
+
export type PXECreateArgs = {
|
|
170
|
+
/** The Aztec node to connect to. */
|
|
171
|
+
node: AztecNode;
|
|
172
|
+
/**
|
|
173
|
+
* Optional debug API client. When provided, public function signatures are registered with the node so that
|
|
174
|
+
* node-side public-execution stack traces can be named. Skipped when the node does not expose the debug API.
|
|
175
|
+
*/
|
|
176
|
+
nodeDebug?: AztecNodeDebug;
|
|
177
|
+
/** The key-value store for persisting PXE state. */
|
|
178
|
+
store: AztecAsyncKVStore;
|
|
179
|
+
/** The prover for generating private kernel proofs. */
|
|
180
|
+
proofCreator: PrivateKernelProver;
|
|
181
|
+
/** The circuit simulator for executing ACIR circuits. */
|
|
182
|
+
simulator: CircuitSimulator;
|
|
183
|
+
/** Provider for protocol contract artifacts and instances. */
|
|
184
|
+
protocolContractsProvider: ProtocolContractsProvider;
|
|
185
|
+
/**
|
|
186
|
+
* Contracts to preload on startup. Injected by the entrypoint with the bundle-or-lazy flavor that
|
|
187
|
+
* matches the runtime (bundle for node/eager browser, lazy for code-split browser), so the PXE
|
|
188
|
+
* never statically imports a standard-contract artifact and the bundle/lazy split stays intact.
|
|
189
|
+
*/
|
|
190
|
+
preloadedContractsProvider: PreloadedContractsProvider;
|
|
191
|
+
/** PXE configuration options. */
|
|
192
|
+
config: PXEConfig;
|
|
193
|
+
/** Optional logger instance or string suffix for the logger name. */
|
|
194
|
+
loggerOrSuffix?: string | Logger;
|
|
195
|
+
/** Optional hooks to observe and influence contract execution. */
|
|
196
|
+
hooks?: ExecutionHooks;
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
/** A source from which PXE derives the tagging secrets it scans for to discover incoming private logs. */
|
|
200
|
+
export type TaggingSecretSource =
|
|
201
|
+
/**
|
|
202
|
+
* Derives a shared secret via ECDH from an external `sender` address against every account registered in this PXE
|
|
203
|
+
* (present and future), so registering one sender applies it to all of them. The address is not secret, so unlike
|
|
204
|
+
* `arbitrary-secret` it can be reused freely across recipients.
|
|
205
|
+
*/
|
|
206
|
+
| { kind: 'address-derived'; sender: AztecAddress }
|
|
207
|
+
/**
|
|
208
|
+
* A shared secret point provided directly, scoped to a single recipient. It bypasses ECDH, so it must not be
|
|
209
|
+
* reused across recipients (each would then be able to find the others' tags).
|
|
210
|
+
*/
|
|
211
|
+
| { kind: 'arbitrary-secret'; recipient: AztecAddress; secret: Point }
|
|
212
|
+
/**
|
|
213
|
+
* A handshake known by the x-coordinate of its ephemeral public key (the value a recipient learns while authorizing
|
|
214
|
+
* an interactive handshake, which emits no discoverable announcement). The ephemeral key's y-coordinate is always
|
|
215
|
+
* positive by protocol construction, so the x-coordinate alone identifies it.
|
|
216
|
+
*/
|
|
217
|
+
| { kind: 'handshake'; recipient: AztecAddress; ephPk: Fr };
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* The registered form of a {@link TaggingSecretSource}.
|
|
221
|
+
*/
|
|
222
|
+
export type RegisteredTaggingSecretSource =
|
|
223
|
+
| Exclude<TaggingSecretSource, { kind: 'handshake' }>
|
|
224
|
+
/** A handshake's resolved shared secret, derived at registration from the handshake's ephemeral key. */
|
|
225
|
+
| { kind: 'handshake'; recipient: AztecAddress; secret: Point };
|
|
226
|
+
|
|
87
227
|
/**
|
|
88
228
|
* Private eXecution Environment (PXE) is a library used by wallets to simulate private phase of transactions and to
|
|
89
229
|
* manage private state of users.
|
|
@@ -91,25 +231,35 @@ export type PackedPrivateEvent = InTx & {
|
|
|
91
231
|
export class PXE {
|
|
92
232
|
private constructor(
|
|
93
233
|
private node: AztecNode,
|
|
234
|
+
private nodeDebug: AztecNodeDebug | undefined,
|
|
235
|
+
private db: AztecAsyncKVStore,
|
|
94
236
|
private blockStateSynchronizer: BlockSynchronizer,
|
|
95
237
|
private keyStore: KeyStore,
|
|
96
238
|
private contractStore: ContractStore,
|
|
97
239
|
private noteStore: NoteStore,
|
|
98
240
|
private capsuleStore: CapsuleStore,
|
|
241
|
+
private factStore: FactStore,
|
|
99
242
|
private anchorBlockStore: AnchorBlockStore,
|
|
100
243
|
private senderTaggingStore: SenderTaggingStore,
|
|
101
|
-
private
|
|
244
|
+
private taggingSecretSourcesStore: TaggingSecretSourcesStore,
|
|
102
245
|
private recipientTaggingStore: RecipientTaggingStore,
|
|
103
246
|
private addressStore: AddressStore,
|
|
104
247
|
private privateEventStore: PrivateEventStore,
|
|
248
|
+
private contractSyncService: ContractSyncService,
|
|
249
|
+
private contractClassService: ContractClassService,
|
|
250
|
+
private txResolver: TxResolverService,
|
|
251
|
+
private l2TipsStore: L2TipsProvider,
|
|
105
252
|
private simulator: CircuitSimulator,
|
|
106
253
|
private proverEnabled: boolean,
|
|
254
|
+
private autoSync: boolean,
|
|
107
255
|
private proofCreator: PrivateKernelProver,
|
|
108
256
|
private protocolContractsProvider: ProtocolContractsProvider,
|
|
257
|
+
private preloadedContractsProvider: PreloadedContractsProvider,
|
|
109
258
|
private log: Logger,
|
|
110
259
|
private jobQueue: SerialQueue,
|
|
111
260
|
private jobCoordinator: JobCoordinator,
|
|
112
261
|
public debug: PXEDebugUtils,
|
|
262
|
+
private hooks: ExecutionHooks | undefined,
|
|
113
263
|
) {}
|
|
114
264
|
|
|
115
265
|
/**
|
|
@@ -119,15 +269,18 @@ export class PXE {
|
|
|
119
269
|
*
|
|
120
270
|
* @returns A promise that resolves PXE is ready to be used.
|
|
121
271
|
*/
|
|
122
|
-
public static async create(
|
|
123
|
-
node
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
272
|
+
public static async create({
|
|
273
|
+
node,
|
|
274
|
+
nodeDebug,
|
|
275
|
+
store,
|
|
276
|
+
proofCreator,
|
|
277
|
+
simulator,
|
|
278
|
+
protocolContractsProvider,
|
|
279
|
+
preloadedContractsProvider,
|
|
280
|
+
config,
|
|
281
|
+
loggerOrSuffix,
|
|
282
|
+
hooks,
|
|
283
|
+
}: PXECreateArgs) {
|
|
131
284
|
// Extract bindings from the logger, or use empty bindings if a string suffix is provided.
|
|
132
285
|
const bindings: LoggerBindings | undefined =
|
|
133
286
|
loggerOrSuffix && typeof loggerOrSuffix !== 'string' ? loggerOrSuffix.getBindings() : undefined;
|
|
@@ -137,25 +290,51 @@ export class PXE {
|
|
|
137
290
|
? createLogger(loggerOrSuffix ? `pxe:service:${loggerOrSuffix}` : `pxe:service`)
|
|
138
291
|
: loggerOrSuffix;
|
|
139
292
|
|
|
140
|
-
const
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
const
|
|
149
|
-
|
|
150
|
-
const
|
|
151
|
-
const
|
|
293
|
+
const info = await node.getNodeInfo();
|
|
294
|
+
|
|
295
|
+
// Source the genesis block hash from the node so PXE's L2BlockStream agrees with the node's
|
|
296
|
+
// archiver on the dynamic initial header hash. Without this the tip store would fall back to
|
|
297
|
+
// the static `GENESIS_BLOCK_HEADER_HASH` constant, which only matches deployments with the
|
|
298
|
+
// default empty genesis (timestamp 0, no prefilled public data) and diverges otherwise — the
|
|
299
|
+
// sync at block 0 would then get stuck in `areBlockHashesEqualAt` and abort. If the node does
|
|
300
|
+
// not return a genesis block (older node or test fixture) we fall back to the static constant.
|
|
301
|
+
const initialBlockHash = (await node.getBlock(BlockNumber.ZERO))?.hash ?? GENESIS_BLOCK_HEADER_HASH;
|
|
302
|
+
|
|
303
|
+
const proverEnabled = config.proverEnabled !== undefined ? config.proverEnabled : info.realProofs;
|
|
304
|
+
const {
|
|
305
|
+
addressStore,
|
|
306
|
+
privateEventStore,
|
|
307
|
+
contractStore,
|
|
308
|
+
noteStore,
|
|
309
|
+
anchorBlockStore,
|
|
310
|
+
senderTaggingStore,
|
|
311
|
+
taggingSecretSourcesStore,
|
|
312
|
+
recipientTaggingStore,
|
|
313
|
+
capsuleStore,
|
|
314
|
+
keyStore,
|
|
315
|
+
l2TipsStore,
|
|
316
|
+
factStore,
|
|
317
|
+
} = openPxeStores(store, initialBlockHash);
|
|
318
|
+
const contractClassService = new ContractClassService(node, contractStore);
|
|
319
|
+
const contractSyncService = new ContractSyncService(
|
|
320
|
+
node,
|
|
321
|
+
contractStore,
|
|
322
|
+
contractClassService,
|
|
323
|
+
noteStore,
|
|
324
|
+
createLogger('pxe:contract_sync', bindings),
|
|
325
|
+
);
|
|
326
|
+
const txResolver = new TxResolverService(node);
|
|
327
|
+
|
|
152
328
|
const synchronizer = new BlockSynchronizer(
|
|
153
329
|
node,
|
|
154
330
|
store,
|
|
155
331
|
anchorBlockStore,
|
|
156
332
|
noteStore,
|
|
157
333
|
privateEventStore,
|
|
158
|
-
|
|
334
|
+
factStore,
|
|
335
|
+
l2TipsStore,
|
|
336
|
+
contractSyncService,
|
|
337
|
+
contractClassService,
|
|
159
338
|
config,
|
|
160
339
|
bindings,
|
|
161
340
|
);
|
|
@@ -167,41 +346,56 @@ export class PXE {
|
|
|
167
346
|
recipientTaggingStore,
|
|
168
347
|
privateEventStore,
|
|
169
348
|
noteStore,
|
|
349
|
+
factStore,
|
|
350
|
+
contractSyncService,
|
|
170
351
|
]);
|
|
171
352
|
|
|
172
|
-
const debugUtils = new PXEDebugUtils(
|
|
353
|
+
const debugUtils = new PXEDebugUtils(contractSyncService, noteStore, synchronizer, anchorBlockStore);
|
|
173
354
|
|
|
174
355
|
const jobQueue = new SerialQueue();
|
|
175
356
|
|
|
176
357
|
const pxe = new PXE(
|
|
177
358
|
node,
|
|
359
|
+
nodeDebug,
|
|
360
|
+
store,
|
|
178
361
|
synchronizer,
|
|
179
362
|
keyStore,
|
|
180
363
|
contractStore,
|
|
181
364
|
noteStore,
|
|
182
365
|
capsuleStore,
|
|
366
|
+
factStore,
|
|
183
367
|
anchorBlockStore,
|
|
184
368
|
senderTaggingStore,
|
|
185
|
-
|
|
369
|
+
taggingSecretSourcesStore,
|
|
186
370
|
recipientTaggingStore,
|
|
187
371
|
addressStore,
|
|
188
372
|
privateEventStore,
|
|
373
|
+
contractSyncService,
|
|
374
|
+
contractClassService,
|
|
375
|
+
txResolver,
|
|
376
|
+
l2TipsStore,
|
|
189
377
|
simulator,
|
|
190
378
|
proverEnabled,
|
|
379
|
+
config.autoSync,
|
|
191
380
|
proofCreator,
|
|
192
381
|
protocolContractsProvider,
|
|
382
|
+
preloadedContractsProvider,
|
|
193
383
|
log,
|
|
194
384
|
jobQueue,
|
|
195
385
|
jobCoordinator,
|
|
196
386
|
debugUtils,
|
|
387
|
+
hooks,
|
|
197
388
|
);
|
|
198
389
|
|
|
199
|
-
debugUtils.
|
|
390
|
+
debugUtils.setPXEHelpers(
|
|
391
|
+
pxe.#putInJobQueue.bind(pxe),
|
|
392
|
+
pxe.#getSimulatorForTx.bind(pxe),
|
|
393
|
+
pxe.#executeUtility.bind(pxe),
|
|
394
|
+
);
|
|
200
395
|
|
|
201
396
|
pxe.jobQueue.start();
|
|
202
397
|
|
|
203
|
-
await pxe.#registerProtocolContracts();
|
|
204
|
-
const info = await node.getNodeInfo();
|
|
398
|
+
await Promise.all([pxe.#registerProtocolContracts(), pxe.#registerPreloadedContracts()]);
|
|
205
399
|
log.info(`Started PXE connected to chain ${info.l1ChainId} version ${info.rollupVersion}`);
|
|
206
400
|
return pxe;
|
|
207
401
|
}
|
|
@@ -209,21 +403,50 @@ export class PXE {
|
|
|
209
403
|
// Internal methods
|
|
210
404
|
|
|
211
405
|
#getSimulatorForTx(overrides?: { contracts?: ContractOverrides }) {
|
|
212
|
-
|
|
406
|
+
return new ContractFunctionSimulator({
|
|
407
|
+
contractStore: this.contractStore,
|
|
408
|
+
contractClassService: this.contractClassService,
|
|
409
|
+
overrides: overrides?.contracts,
|
|
410
|
+
noteStore: this.noteStore,
|
|
411
|
+
keyStore: this.keyStore,
|
|
412
|
+
addressStore: this.addressStore,
|
|
413
|
+
aztecNode: BenchmarkedNodeFactory.create(this.node),
|
|
414
|
+
l2TipsStore: this.l2TipsStore,
|
|
415
|
+
senderTaggingStore: this.senderTaggingStore,
|
|
416
|
+
recipientTaggingStore: this.recipientTaggingStore,
|
|
417
|
+
taggingSecretSourcesStore: this.taggingSecretSourcesStore,
|
|
418
|
+
capsuleStore: this.capsuleStore,
|
|
419
|
+
factStore: this.factStore,
|
|
420
|
+
privateEventStore: this.privateEventStore,
|
|
421
|
+
simulator: this.simulator,
|
|
422
|
+
contractSyncService: this.contractSyncService,
|
|
423
|
+
txResolver: this.txResolver,
|
|
424
|
+
hooks: this.hooks,
|
|
425
|
+
});
|
|
426
|
+
}
|
|
213
427
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
this.
|
|
222
|
-
this.
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
428
|
+
/** Best-effort debug function name for the class `address` runs at `anchorBlockHeader`. Used for log display only. */
|
|
429
|
+
async #getDebugFunctionName(
|
|
430
|
+
address: AztecAddress,
|
|
431
|
+
selector: FunctionSelector,
|
|
432
|
+
anchorBlockHeader: BlockHeader,
|
|
433
|
+
): Promise<string> {
|
|
434
|
+
try {
|
|
435
|
+
const classId = await this.contractClassService.getCurrentClassId(address, anchorBlockHeader);
|
|
436
|
+
return classId ? await this.contractStore.getDebugFunctionName(classId, selector) : `${address}:${selector}`;
|
|
437
|
+
} catch {
|
|
438
|
+
return `${address}:${selector}`;
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
/** Best-effort debug contract name for the class `address` runs at `anchorBlockHeader`. Used for log display only. */
|
|
443
|
+
async #getDebugContractName(address: AztecAddress, anchorBlockHeader: BlockHeader): Promise<string | undefined> {
|
|
444
|
+
try {
|
|
445
|
+
const classId = await this.contractClassService.getCurrentClassId(address, anchorBlockHeader);
|
|
446
|
+
return classId ? await this.contractStore.getDebugContractName(classId) : undefined;
|
|
447
|
+
} catch {
|
|
448
|
+
return undefined;
|
|
449
|
+
}
|
|
227
450
|
}
|
|
228
451
|
|
|
229
452
|
#contextualizeError(err: Error, ...context: string[]): Error {
|
|
@@ -273,84 +496,112 @@ export class PXE {
|
|
|
273
496
|
}
|
|
274
497
|
|
|
275
498
|
async #registerProtocolContracts() {
|
|
276
|
-
const registered
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
499
|
+
const registered = Object.fromEntries(
|
|
500
|
+
await Promise.all(
|
|
501
|
+
protocolContractNames.map(async name => {
|
|
502
|
+
const { address, instance, artifact } =
|
|
503
|
+
await this.protocolContractsProvider.getProtocolContractArtifact(name);
|
|
504
|
+
await this.contractStore.addContractArtifact(artifact);
|
|
505
|
+
await this.contractStore.addContractInstance(instance);
|
|
506
|
+
return [name, address.toString()] as const;
|
|
507
|
+
}),
|
|
508
|
+
),
|
|
509
|
+
);
|
|
284
510
|
this.log.verbose(`Registered protocol contracts in pxe`, registered);
|
|
285
511
|
}
|
|
286
512
|
|
|
513
|
+
async #registerPreloadedContracts() {
|
|
514
|
+
const contracts = await this.preloadedContractsProvider.getPreloadedContracts();
|
|
515
|
+
await Promise.all(
|
|
516
|
+
contracts.map(async ({ instance, artifact }) => {
|
|
517
|
+
if (artifact) {
|
|
518
|
+
await this.registerContractClass(artifact);
|
|
519
|
+
}
|
|
520
|
+
await this.registerContract(instance);
|
|
521
|
+
}),
|
|
522
|
+
);
|
|
523
|
+
this.log.verbose(`Registered preloaded contracts in pxe`, {
|
|
524
|
+
contracts: contracts.map(({ instance }) => instance.address.toString()),
|
|
525
|
+
});
|
|
526
|
+
}
|
|
527
|
+
|
|
287
528
|
// Executes the entrypoint private function, as well as all nested private
|
|
288
529
|
// functions that might arise.
|
|
289
|
-
async #executePrivate(
|
|
290
|
-
contractFunctionSimulator
|
|
291
|
-
txRequest
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
530
|
+
async #executePrivate({
|
|
531
|
+
contractFunctionSimulator,
|
|
532
|
+
txRequest,
|
|
533
|
+
anchorBlockHeader,
|
|
534
|
+
scopes,
|
|
535
|
+
jobId,
|
|
536
|
+
senderForTags,
|
|
537
|
+
}: {
|
|
538
|
+
contractFunctionSimulator: ContractFunctionSimulator;
|
|
539
|
+
txRequest: TxExecutionRequest;
|
|
540
|
+
anchorBlockHeader: BlockHeader;
|
|
541
|
+
scopes: AztecAddress[];
|
|
542
|
+
jobId: string;
|
|
543
|
+
senderForTags?: AztecAddress;
|
|
544
|
+
}): Promise<PrivateExecutionResult> {
|
|
295
545
|
const { origin: contractAddress, functionSelector } = txRequest;
|
|
296
546
|
|
|
297
547
|
try {
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
await ensureContractSynced(
|
|
548
|
+
await this.contractSyncService.ensureContractSynced(
|
|
301
549
|
contractAddress,
|
|
302
550
|
functionSelector,
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
this.contractStore,
|
|
551
|
+
(privateSyncCall, execScopes) =>
|
|
552
|
+
this.#executeUtility(contractFunctionSimulator, privateSyncCall, [], execScopes, jobId),
|
|
306
553
|
anchorBlockHeader,
|
|
554
|
+
jobId,
|
|
555
|
+
scopes,
|
|
307
556
|
);
|
|
308
557
|
|
|
309
|
-
const result = await contractFunctionSimulator.run(
|
|
310
|
-
txRequest,
|
|
311
|
-
contractAddress,
|
|
312
|
-
functionSelector,
|
|
313
|
-
undefined,
|
|
558
|
+
const result = await contractFunctionSimulator.run(txRequest, {
|
|
314
559
|
anchorBlockHeader,
|
|
315
|
-
// The sender for tags is set by contracts, typically by an account
|
|
316
|
-
// contract entrypoint
|
|
317
|
-
undefined, // senderForTags
|
|
318
560
|
scopes,
|
|
319
561
|
jobId,
|
|
320
|
-
|
|
562
|
+
senderForTags,
|
|
563
|
+
});
|
|
321
564
|
this.log.debug(`Private simulation completed for ${contractAddress.toString()}:${functionSelector}`);
|
|
322
565
|
return result;
|
|
323
566
|
} catch (err) {
|
|
324
567
|
if (err instanceof SimulationError) {
|
|
325
|
-
await enrichSimulationError(err, this.contractStore, this.log);
|
|
568
|
+
await enrichSimulationError(err, this.contractStore, this.contractClassService, anchorBlockHeader, this.log);
|
|
326
569
|
}
|
|
327
570
|
throw err;
|
|
328
571
|
}
|
|
329
572
|
}
|
|
330
573
|
|
|
331
574
|
/**
|
|
332
|
-
*
|
|
575
|
+
* Execute a utility function call on the given contract.
|
|
333
576
|
* @param contractFunctionSimulator - The simulator to use for the function call.
|
|
334
577
|
* @param call - The function call to execute.
|
|
335
578
|
* @param authWitnesses - Authentication witnesses required for the function call.
|
|
336
579
|
* @param scopes - Optional array of account addresses whose notes can be accessed in this call. Defaults to all
|
|
337
580
|
* accounts if not specified.
|
|
338
581
|
* @param jobId - The job ID for staged writes.
|
|
339
|
-
* @returns The
|
|
582
|
+
* @returns The execution result containing the outputs of the utility function.
|
|
340
583
|
*/
|
|
341
|
-
async #
|
|
584
|
+
async #executeUtility(
|
|
342
585
|
contractFunctionSimulator: ContractFunctionSimulator,
|
|
343
586
|
call: FunctionCall,
|
|
344
587
|
authWitnesses: AuthWitness[] | undefined,
|
|
345
|
-
scopes: AztecAddress[]
|
|
588
|
+
scopes: AztecAddress[],
|
|
346
589
|
jobId: string,
|
|
347
590
|
) {
|
|
348
591
|
try {
|
|
349
592
|
const anchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
|
|
350
|
-
|
|
593
|
+
const { result, offchainEffects } = await contractFunctionSimulator.runUtility(
|
|
594
|
+
call,
|
|
595
|
+
authWitnesses ?? [],
|
|
596
|
+
anchorBlockHeader,
|
|
597
|
+
scopes,
|
|
598
|
+
jobId,
|
|
599
|
+
);
|
|
600
|
+
return { result, offchainEffects };
|
|
351
601
|
} catch (err) {
|
|
352
602
|
if (err instanceof SimulationError) {
|
|
353
|
-
|
|
603
|
+
const anchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
|
|
604
|
+
await enrichSimulationError(err, this.contractStore, this.contractClassService, anchorBlockHeader, this.log);
|
|
354
605
|
}
|
|
355
606
|
throw err;
|
|
356
607
|
}
|
|
@@ -362,11 +613,11 @@ export class PXE {
|
|
|
362
613
|
* It can also be used for estimating gas in the future.
|
|
363
614
|
* @param tx - The transaction to be simulated.
|
|
364
615
|
*/
|
|
365
|
-
async #simulatePublicCalls(tx: Tx, skipFeeEnforcement: boolean) {
|
|
616
|
+
async #simulatePublicCalls(tx: Tx, skipFeeEnforcement: boolean, overrides?: SimulationOverrides) {
|
|
366
617
|
// Simulating public calls can throw if the TX fails in a phase that doesn't allow reverts (setup)
|
|
367
618
|
// Or return as reverted if it fails in a phase that allows reverts (app logic, teardown)
|
|
368
619
|
try {
|
|
369
|
-
const result = await this.node.simulatePublicCalls(tx, skipFeeEnforcement);
|
|
620
|
+
const result = await this.node.simulatePublicCalls(tx, skipFeeEnforcement, overrides);
|
|
370
621
|
if (result.revertReason) {
|
|
371
622
|
throw result.revertReason;
|
|
372
623
|
}
|
|
@@ -374,7 +625,14 @@ export class PXE {
|
|
|
374
625
|
} catch (err) {
|
|
375
626
|
if (err instanceof SimulationError) {
|
|
376
627
|
try {
|
|
377
|
-
|
|
628
|
+
const anchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
|
|
629
|
+
await enrichPublicSimulationError(
|
|
630
|
+
err,
|
|
631
|
+
this.contractStore,
|
|
632
|
+
this.contractClassService,
|
|
633
|
+
anchorBlockHeader,
|
|
634
|
+
this.log,
|
|
635
|
+
);
|
|
378
636
|
} catch (enrichErr) {
|
|
379
637
|
this.log.error(`Failed to enrich public simulation error: ${enrichErr}`);
|
|
380
638
|
}
|
|
@@ -398,11 +656,16 @@ export class PXE {
|
|
|
398
656
|
txExecutionRequest: TxExecutionRequest,
|
|
399
657
|
proofCreator: PrivateKernelProver,
|
|
400
658
|
privateExecutionResult: PrivateExecutionResult,
|
|
659
|
+
anchorBlockHeader: BlockHeader,
|
|
401
660
|
config: PrivateKernelExecutionProverConfig,
|
|
402
661
|
): Promise<PrivateKernelExecutionProofOutput<PrivateKernelTailCircuitPublicInputs>> {
|
|
403
|
-
const
|
|
404
|
-
|
|
405
|
-
|
|
662
|
+
const kernelOracle = new PrivateKernelOracle(
|
|
663
|
+
this.contractStore,
|
|
664
|
+
this.contractClassService,
|
|
665
|
+
this.keyStore,
|
|
666
|
+
this.node,
|
|
667
|
+
anchorBlockHeader,
|
|
668
|
+
);
|
|
406
669
|
const kernelTraceProver = new PrivateKernelExecutionProver(
|
|
407
670
|
kernelOracle,
|
|
408
671
|
proofCreator,
|
|
@@ -413,9 +676,44 @@ export class PXE {
|
|
|
413
676
|
return await kernelTraceProver.proveWithKernels(txExecutionRequest.toTxRequest(), privateExecutionResult, config);
|
|
414
677
|
}
|
|
415
678
|
|
|
679
|
+
/**
|
|
680
|
+
* Syncs with the node only when `autoSync` is enabled.
|
|
681
|
+
* When `autoSync` is disabled, callers (typically a wallet) are
|
|
682
|
+
* responsible for invoking `pxe.sync()` at the right granularity.
|
|
683
|
+
*/
|
|
684
|
+
async #maybeSync(): Promise<void> {
|
|
685
|
+
if (this.autoSync) {
|
|
686
|
+
await this.blockStateSynchronizer.sync();
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
|
|
416
690
|
// Public API
|
|
417
691
|
|
|
418
|
-
|
|
692
|
+
/**
|
|
693
|
+
* Triggers a sync of PXE state with the node, regardless of the `autoSync` config flag. Use this to
|
|
694
|
+
* batch syncs across composite flows when `autoSync` is disabled (e.g. one sync per simulate+send
|
|
695
|
+
* instead of one per inner PXE call). Serialized through the job queue.
|
|
696
|
+
*/
|
|
697
|
+
public sync(): Promise<void> {
|
|
698
|
+
return this.#putInJobQueue(() => this.blockStateSynchronizer.sync());
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
/**
|
|
702
|
+
* Returns the block header up to which the PXE has synced.
|
|
703
|
+
* @returns The synced block header
|
|
704
|
+
*/
|
|
705
|
+
public getSyncedBlockHeader(): Promise<BlockHeader> {
|
|
706
|
+
return this.#putInJobQueue(() => {
|
|
707
|
+
return this.anchorBlockStore.getBlockHeader();
|
|
708
|
+
});
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
/**
|
|
712
|
+
* Returns the address preimage of the contract instance at a given address, if it's registered in the PXE.
|
|
713
|
+
* @param address - The contract address.
|
|
714
|
+
* @returns The contract instance address preimage if found, undefined otherwise.
|
|
715
|
+
*/
|
|
716
|
+
public getContractInstance(address: AztecAddress): Promise<ContractInstancePreimageWithAddress | undefined> {
|
|
419
717
|
return this.contractStore.getContractInstance(address);
|
|
420
718
|
}
|
|
421
719
|
|
|
@@ -429,19 +727,23 @@ export class PXE {
|
|
|
429
727
|
}
|
|
430
728
|
|
|
431
729
|
/**
|
|
432
|
-
* Registers a user account in PXE
|
|
433
|
-
* Once a new account is registered, the PXE will trial-decrypt all published notes on
|
|
434
|
-
* the chain and store those that correspond to the registered account. Will do nothing if the
|
|
435
|
-
* account is already registered.
|
|
730
|
+
* Registers a user account in PXE.
|
|
436
731
|
*
|
|
437
|
-
*
|
|
732
|
+
* PXE holds the account's four privacy secret keys but only the *public* message-signing and fallback keys: their
|
|
733
|
+
* secret keys are withheld, since PXE is not trusted to hold them.
|
|
734
|
+
*
|
|
735
|
+
* Does nothing if the account is already registered.
|
|
736
|
+
*
|
|
737
|
+
* The four privacy secret keys can be retrieved later with {@link getAccountSecretKeys}.
|
|
738
|
+
*
|
|
739
|
+
* @param keys - The account's privacy keys: four secret keys plus the message-signing and fallback public keys.
|
|
438
740
|
* @param partialAddress - The partial address of the account contract corresponding to the account being registered.
|
|
439
741
|
* @returns The complete address of the account.
|
|
440
742
|
*/
|
|
441
|
-
public async registerAccount(
|
|
743
|
+
public async registerAccount(keys: AccountPrivacyKeys, partialAddress: PartialAddress): Promise<CompleteAddress> {
|
|
442
744
|
const accounts = await this.keyStore.getAccounts();
|
|
443
|
-
const accountCompleteAddress = await this.keyStore.addAccount(
|
|
444
|
-
if (accounts.
|
|
745
|
+
const accountCompleteAddress = await this.keyStore.addAccount(keys, partialAddress);
|
|
746
|
+
if (accounts.some(a => a.equals(accountCompleteAddress.address))) {
|
|
445
747
|
this.log.info(`Account:\n "${accountCompleteAddress.address.toString()}"\n already registered.`);
|
|
446
748
|
return accountCompleteAddress;
|
|
447
749
|
} else {
|
|
@@ -454,53 +756,189 @@ export class PXE {
|
|
|
454
756
|
}
|
|
455
757
|
|
|
456
758
|
/**
|
|
457
|
-
*
|
|
759
|
+
* Retrieves the four privacy secret keys PXE holds for a registered account (nullifier-hiding, incoming-viewing,
|
|
760
|
+
* outgoing-viewing, tagging).
|
|
458
761
|
*
|
|
459
|
-
*
|
|
460
|
-
*
|
|
762
|
+
* These do NOT grant control over an account's assets, e.g. they are insufficient to impersonate the account or to
|
|
763
|
+
* spend notes, but they _do_ guard the account's privacy. Parties that have knowledge of these keys can decrypt all
|
|
764
|
+
* messages sent to the account, discover all of their on-chain activity, including notes, events, etc.
|
|
461
765
|
*
|
|
462
|
-
*
|
|
463
|
-
*
|
|
464
|
-
*
|
|
766
|
+
* Security is paramount when handling these keys, which should itself be a very rare occurrence. Other than exporting
|
|
767
|
+
* and then importing an account into a separate PXE/wallet, there is typically no need for a wallet to ever access
|
|
768
|
+
* these keys. Applications should NEVER be given access to them.
|
|
769
|
+
*
|
|
770
|
+
* @throws If the account is not registered.
|
|
465
771
|
*/
|
|
466
|
-
public
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
this.log.info(`Sender:\n "${sender.toString()}"\n already registered.`);
|
|
470
|
-
return sender;
|
|
471
|
-
}
|
|
772
|
+
public getAccountSecretKeys(account: AztecAddress): Promise<AccountPrivacySecretKeys> {
|
|
773
|
+
return this.keyStore.getAccountSecretKeys(account);
|
|
774
|
+
}
|
|
472
775
|
|
|
473
|
-
|
|
776
|
+
/**
|
|
777
|
+
* Registers a source from which this PXE derives the tagging secrets it scans for to discover incoming private logs.
|
|
778
|
+
* See {@link TaggingSecretSource} for the meaning of each variant. Does nothing if the source is already registered.
|
|
779
|
+
*
|
|
780
|
+
* After a new source is added we clear the cache tracking which contracts have finished syncing, so every contract
|
|
781
|
+
* re-syncs against the new source's logs (whose notes/events could belong to any contract). Already-discovered
|
|
782
|
+
* notes/events are not discarded.
|
|
783
|
+
*/
|
|
784
|
+
public async registerTaggingSecretSource(source: TaggingSecretSource): Promise<void> {
|
|
785
|
+
let wasAdded: boolean;
|
|
786
|
+
|
|
787
|
+
switch (source.kind) {
|
|
788
|
+
case 'address-derived':
|
|
789
|
+
wasAdded = await this.#registerSender(source.sender);
|
|
790
|
+
break;
|
|
791
|
+
case 'arbitrary-secret':
|
|
792
|
+
wasAdded = await this.#registerSharedSecret(source.recipient, 'arbitrary-secret', source.secret);
|
|
793
|
+
break;
|
|
794
|
+
case 'handshake':
|
|
795
|
+
wasAdded = await this.#registerSharedSecret(
|
|
796
|
+
source.recipient,
|
|
797
|
+
'handshake',
|
|
798
|
+
await this.#deriveHandshakeSecret(source.recipient, source.ephPk),
|
|
799
|
+
);
|
|
800
|
+
break;
|
|
801
|
+
default: {
|
|
802
|
+
const _: never = source;
|
|
803
|
+
throw new Error('Unhandled tagging secret source kind');
|
|
804
|
+
}
|
|
805
|
+
}
|
|
474
806
|
|
|
475
807
|
if (wasAdded) {
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
this.log.info(`Sender:\n "${sender.toString()}"\n already registered.`);
|
|
808
|
+
// Queued to avoid wiping while a job is in flight.
|
|
809
|
+
await this.#putInJobQueue(() => Promise.resolve(this.contractSyncService.wipe()));
|
|
479
810
|
}
|
|
811
|
+
}
|
|
480
812
|
|
|
481
|
-
|
|
813
|
+
/**
|
|
814
|
+
* Removes a previously registered tagging secret source, identified by its registered form (see
|
|
815
|
+
* {@link getTaggingSecretSources}). Does nothing if it was not registered.
|
|
816
|
+
*/
|
|
817
|
+
public async removeTaggingSecretSource(source: RegisteredTaggingSecretSource): Promise<void> {
|
|
818
|
+
switch (source.kind) {
|
|
819
|
+
case 'address-derived': {
|
|
820
|
+
const { sender } = source;
|
|
821
|
+
const wasRemoved = await this.taggingSecretSourcesStore.removeSender(sender);
|
|
822
|
+
this.log.info(
|
|
823
|
+
wasRemoved
|
|
824
|
+
? `Removed sender:\n ${sender.toString()}`
|
|
825
|
+
: `Sender:\n "${sender.toString()}"\n not registered in PXE.`,
|
|
826
|
+
);
|
|
827
|
+
break;
|
|
828
|
+
}
|
|
829
|
+
case 'arbitrary-secret':
|
|
830
|
+
case 'handshake': {
|
|
831
|
+
const { kind, recipient, secret } = source;
|
|
832
|
+
const wasRemoved = await this.taggingSecretSourcesStore.removeSharedSecret(recipient, kind, secret);
|
|
833
|
+
this.log.info(
|
|
834
|
+
wasRemoved
|
|
835
|
+
? `Removed ${kind} shared secret for recipient:\n ${recipient.toString()}`
|
|
836
|
+
: `No ${kind} shared secret registered for recipient:\n ${recipient.toString()}`,
|
|
837
|
+
);
|
|
838
|
+
break;
|
|
839
|
+
}
|
|
840
|
+
default: {
|
|
841
|
+
const _: never = source;
|
|
842
|
+
throw new Error('Unhandled tagging secret source kind');
|
|
843
|
+
}
|
|
844
|
+
}
|
|
482
845
|
}
|
|
483
846
|
|
|
484
847
|
/**
|
|
485
|
-
* Retrieves
|
|
486
|
-
*
|
|
848
|
+
* Retrieves the tagging secret sources registered in this PXE, in their registered form. Without a filter it
|
|
849
|
+
* returns every source; pass `{ kind }` to narrow to a single variant. See {@link RegisteredTaggingSecretSource}.
|
|
487
850
|
*/
|
|
488
|
-
public
|
|
489
|
-
|
|
851
|
+
public getTaggingSecretSources<K extends RegisteredTaggingSecretSource['kind']>(filter: {
|
|
852
|
+
kind: K;
|
|
853
|
+
}): Promise<Extract<RegisteredTaggingSecretSource, { kind: K }>[]>;
|
|
854
|
+
public getTaggingSecretSources(): Promise<RegisteredTaggingSecretSource[]>;
|
|
855
|
+
public async getTaggingSecretSources(filter?: {
|
|
856
|
+
kind?: RegisteredTaggingSecretSource['kind'];
|
|
857
|
+
}): Promise<RegisteredTaggingSecretSource[]> {
|
|
858
|
+
const [senders, secrets] = await Promise.all([
|
|
859
|
+
this.taggingSecretSourcesStore.getSenders(),
|
|
860
|
+
this.taggingSecretSourcesStore.getAllSharedSecrets(),
|
|
861
|
+
]);
|
|
862
|
+
|
|
863
|
+
const sources: RegisteredTaggingSecretSource[] = [
|
|
864
|
+
...senders.map((sender): RegisteredTaggingSecretSource => ({ kind: 'address-derived', sender })),
|
|
865
|
+
...secrets.map(({ recipient, kind, secret }): RegisteredTaggingSecretSource => ({ kind, recipient, secret })),
|
|
866
|
+
];
|
|
867
|
+
|
|
868
|
+
return filter?.kind ? sources.filter(source => source.kind === filter.kind) : sources;
|
|
869
|
+
}
|
|
870
|
+
|
|
871
|
+
/** Registers a sender, skipping addresses that belong to a local account. Returns whether it was newly added. */
|
|
872
|
+
async #registerSender(address: AztecAddress): Promise<boolean> {
|
|
873
|
+
if (!(await address.isValid())) {
|
|
874
|
+
throw new Error(
|
|
875
|
+
`Address ${address} is not valid: it does not correspond to a point on the Grumpkin curve. Cannot register it as a sender.`,
|
|
876
|
+
);
|
|
877
|
+
}
|
|
878
|
+
|
|
879
|
+
const accounts = await this.keyStore.getAccounts();
|
|
880
|
+
if (accounts.some(a => a.equals(address))) {
|
|
881
|
+
this.log.info(`Sender:\n "${address.toString()}"\n already registered.`);
|
|
882
|
+
return false;
|
|
883
|
+
}
|
|
884
|
+
|
|
885
|
+
const wasAdded = await this.taggingSecretSourcesStore.addSender(address);
|
|
886
|
+
this.log.info(
|
|
887
|
+
wasAdded ? `Added sender:\n ${address.toString()}` : `Sender:\n "${address.toString()}"\n already registered.`,
|
|
888
|
+
);
|
|
889
|
+
return wasAdded;
|
|
490
890
|
}
|
|
491
891
|
|
|
492
892
|
/**
|
|
493
|
-
*
|
|
494
|
-
*
|
|
893
|
+
* Derives the shared secret of a handshake from its ephemeral public key: the raw ECDH secret
|
|
894
|
+
* `S = addressSecret(recipient) * ephPk` with the forgery protection applied,
|
|
895
|
+
* matching the protected secret the registry stores and the derivation the recipient-side scan uses for
|
|
896
|
+
* handshakes discovered onchain. The ephemeral key is reconstructed from its x-coordinate with a positive y,
|
|
897
|
+
* matching how the protocol generates it.
|
|
898
|
+
*
|
|
899
|
+
* @throws If `ephPk` is not the x-coordinate of a Grumpkin curve point, or if `recipient` is not an account of
|
|
900
|
+
* this PXE, since the derivation needs its keys.
|
|
495
901
|
*/
|
|
496
|
-
|
|
497
|
-
|
|
902
|
+
async #deriveHandshakeSecret(recipient: AztecAddress, ephPk: Fr): Promise<Point> {
|
|
903
|
+
let ephPkPoint: Point;
|
|
904
|
+
try {
|
|
905
|
+
ephPkPoint = await Point.fromXAndSign(ephPk, true);
|
|
906
|
+
} catch {
|
|
907
|
+
throw new Error(`Ephemeral public key x-coordinate ${ephPk} does not correspond to a Grumpkin curve point.`);
|
|
908
|
+
}
|
|
498
909
|
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
910
|
+
const completeAddress = await this.addressStore.getCompleteAddress(recipient);
|
|
911
|
+
if (!completeAddress || !(await this.keyStore.hasAccount(recipient))) {
|
|
912
|
+
throw new Error(
|
|
913
|
+
`Recipient ${recipient} is not an account of this PXE. A handshake's shared secret can only be derived for an account whose keys are held.`,
|
|
914
|
+
);
|
|
503
915
|
}
|
|
916
|
+
|
|
917
|
+
const ivskM = await this.keyStore.getMasterIncomingViewingSecretKey(recipient);
|
|
918
|
+
const addressSecret = await computeAddressSecret(await completeAddress.getPreaddress(), ivskM);
|
|
919
|
+
const rawSecret = await deriveEcdhSharedSecretPoint(addressSecret, ephPkPoint);
|
|
920
|
+
return protectFromForgery(rawSecret, ephPkPoint, await recipient.toAddressPoint());
|
|
921
|
+
}
|
|
922
|
+
|
|
923
|
+
/** Registers a resolved shared secret scoped to a recipient. Returns whether it was newly added. */
|
|
924
|
+
async #registerSharedSecret(recipient: AztecAddress, kind: SharedSecretKind, secret: Point): Promise<boolean> {
|
|
925
|
+
if (!(await recipient.isValid())) {
|
|
926
|
+
throw new Error(
|
|
927
|
+
`Recipient ${recipient} is not valid: it does not correspond to a point on the Grumpkin curve. Cannot register a shared secret for it.`,
|
|
928
|
+
);
|
|
929
|
+
}
|
|
930
|
+
|
|
931
|
+
if (secret.isZero() || !secret.isOnCurve()) {
|
|
932
|
+
throw new Error(`Shared secret ${secret} is not a valid non-zero point on the Grumpkin curve.`);
|
|
933
|
+
}
|
|
934
|
+
|
|
935
|
+
const wasAdded = await this.taggingSecretSourcesStore.addSharedSecret(recipient, kind, secret);
|
|
936
|
+
this.log.info(
|
|
937
|
+
wasAdded
|
|
938
|
+
? `Added ${kind} shared secret for recipient:\n ${recipient.toString()}`
|
|
939
|
+
: `${kind} shared secret already registered for recipient:\n ${recipient.toString()}`,
|
|
940
|
+
);
|
|
941
|
+
return wasAdded;
|
|
504
942
|
}
|
|
505
943
|
|
|
506
944
|
/**
|
|
@@ -523,95 +961,34 @@ export class PXE {
|
|
|
523
961
|
* @param artifact - The build artifact for the contract class.
|
|
524
962
|
*/
|
|
525
963
|
public async registerContractClass(artifact: ContractArtifact): Promise<void> {
|
|
526
|
-
const
|
|
527
|
-
|
|
964
|
+
const contractClassId = await this.contractStore.addContractArtifact(artifact);
|
|
965
|
+
// Publishing the artifact's public function signatures to the node is part of "registering a class", so that
|
|
966
|
+
// node-side debugging works regardless of which entrypoint (registerContractClass or registerContract) was used.
|
|
967
|
+
const publicFunctionSignatures = artifact.functions
|
|
968
|
+
.filter(fn => fn.functionType === FunctionType.PUBLIC)
|
|
969
|
+
.map(fn => decodeFunctionSignature(fn.name, fn.parameters));
|
|
970
|
+
if (publicFunctionSignatures.length > 0) {
|
|
971
|
+
await this.nodeDebug?.registerContractFunctionSignatures(publicFunctionSignatures);
|
|
972
|
+
}
|
|
528
973
|
this.log.info(`Added contract class ${artifact.name} with id ${contractClassId}`);
|
|
529
974
|
}
|
|
530
975
|
|
|
531
976
|
/**
|
|
532
|
-
*
|
|
533
|
-
*
|
|
534
|
-
*
|
|
535
|
-
*
|
|
977
|
+
* Registers a deployed contract instance so its private state can be synced and its functions simulated. The
|
|
978
|
+
* artifact for the class the instance runs must be registered separately via {@link registerContractClass}, before
|
|
979
|
+
* or after this call; registration performs no validation, so a missing or mismatched artifact only surfaces when
|
|
980
|
+
* the contract is later simulated. This is automatically called by aztec.js when deploying a contract.
|
|
536
981
|
*
|
|
537
|
-
* @param
|
|
538
|
-
|
|
539
|
-
public async registerContract(contract: { instance: ContractInstanceWithAddress; artifact?: ContractArtifact }) {
|
|
540
|
-
const { instance } = contract;
|
|
541
|
-
let { artifact } = contract;
|
|
542
|
-
|
|
543
|
-
if (artifact) {
|
|
544
|
-
// If the user provides an artifact, validate it against the expected class id and register it
|
|
545
|
-
const contractClass = await getContractClassFromArtifact(artifact);
|
|
546
|
-
const contractClassId = contractClass.id;
|
|
547
|
-
if (!contractClassId.equals(instance.currentContractClassId)) {
|
|
548
|
-
throw new Error(
|
|
549
|
-
`Artifact does not match expected class id (computed ${contractClassId} but instance refers to ${instance.currentContractClassId})`,
|
|
550
|
-
);
|
|
551
|
-
}
|
|
552
|
-
const computedAddress = await computeContractAddressFromInstance(instance);
|
|
553
|
-
if (!computedAddress.equals(instance.address)) {
|
|
554
|
-
throw new Error('Added a contract in which the address does not match the contract instance.');
|
|
555
|
-
}
|
|
556
|
-
await this.contractStore.addContractArtifact(contractClass.id, artifact);
|
|
557
|
-
|
|
558
|
-
const publicFunctionSignatures = artifact.functions
|
|
559
|
-
.filter(fn => fn.functionType === FunctionType.PUBLIC)
|
|
560
|
-
.map(fn => decodeFunctionSignature(fn.name, fn.parameters));
|
|
561
|
-
await this.node.registerContractFunctionSignatures(publicFunctionSignatures);
|
|
562
|
-
} else {
|
|
563
|
-
// Otherwise, make sure there is an artifact already registered for that class id
|
|
564
|
-
artifact = await this.contractStore.getContractArtifact(instance.currentContractClassId);
|
|
565
|
-
if (!artifact) {
|
|
566
|
-
throw new Error(
|
|
567
|
-
`Artifact not found when registering an instance. Contract class: ${instance.currentContractClassId}.`,
|
|
568
|
-
);
|
|
569
|
-
}
|
|
570
|
-
}
|
|
571
|
-
|
|
572
|
-
await this.contractStore.addContractInstance(instance);
|
|
573
|
-
this.log.info(
|
|
574
|
-
`Added contract ${artifact.name} at ${instance.address.toString()} with class ${instance.currentContractClassId}`,
|
|
575
|
-
);
|
|
576
|
-
}
|
|
577
|
-
|
|
578
|
-
/**
|
|
579
|
-
* Updates a deployed contract in the PXE. This is used to update the contract artifact when
|
|
580
|
-
* an update has happened, so the new code can be used in the simulation of local transactions.
|
|
581
|
-
* This is called by aztec.js when instantiating a contract in a given address with a mismatching artifact.
|
|
582
|
-
* @param contractAddress - The address of the contract to update.
|
|
583
|
-
* @param artifact - The updated artifact for the contract.
|
|
584
|
-
* @throws If the artifact's contract class is not found in the PXE or if the contract class is different from
|
|
585
|
-
* the current one (current one from the point of view of the node to which the PXE is connected).
|
|
982
|
+
* @param instance - The address preimage of the contract instance to register. The address is derived from it.
|
|
983
|
+
* @returns The address of the registered instance.
|
|
586
984
|
*/
|
|
587
|
-
public
|
|
588
|
-
//
|
|
589
|
-
// class while we're simulating it.
|
|
985
|
+
public registerContract(instance: ContractInstancePreimage): Promise<AztecAddress> {
|
|
986
|
+
// Run inside the job queue so we can't race a concurrent simulation while writing the instance to the store.
|
|
590
987
|
return this.#putInJobQueue(async () => {
|
|
591
|
-
const
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
const contractClass = await getContractClassFromArtifact(artifact);
|
|
596
|
-
await this.blockStateSynchronizer.sync();
|
|
597
|
-
|
|
598
|
-
const header = await this.anchorBlockStore.getBlockHeader();
|
|
599
|
-
|
|
600
|
-
const currentClassId = await readCurrentClassId(contractAddress, currentInstance, this.node, header);
|
|
601
|
-
if (!contractClass.id.equals(currentClassId)) {
|
|
602
|
-
throw new Error('Could not update contract to a class different from the current one.');
|
|
603
|
-
}
|
|
604
|
-
|
|
605
|
-
await this.contractStore.addContractArtifact(contractClass.id, artifact);
|
|
606
|
-
|
|
607
|
-
const publicFunctionSignatures = artifact.functions
|
|
608
|
-
.filter(fn => fn.functionType === FunctionType.PUBLIC)
|
|
609
|
-
.map(fn => decodeFunctionSignature(fn.name, fn.parameters));
|
|
610
|
-
await this.node.registerContractFunctionSignatures(publicFunctionSignatures);
|
|
611
|
-
|
|
612
|
-
currentInstance.currentContractClassId = contractClass.id;
|
|
613
|
-
await this.contractStore.addContractInstance(currentInstance);
|
|
614
|
-
this.log.info(`Updated contract ${artifact.name} at ${contractAddress.toString()} to class ${contractClass.id}`);
|
|
988
|
+
const address = await computeContractAddressFromInstance(instance);
|
|
989
|
+
await this.contractStore.addContractInstance({ ...instance, address });
|
|
990
|
+
this.log.info(`Added contract at ${address}`, { address });
|
|
991
|
+
return address;
|
|
615
992
|
});
|
|
616
993
|
}
|
|
617
994
|
|
|
@@ -628,11 +1005,12 @@ export class PXE {
|
|
|
628
1005
|
* (where validators prove the public portion).
|
|
629
1006
|
*
|
|
630
1007
|
* @param txRequest - An authenticated tx request ready for proving
|
|
1008
|
+
* @param scopes - Addresses whose private state and keys are accessible during private execution.
|
|
631
1009
|
* @returns A result containing the proof and public inputs of the tail circuit.
|
|
632
1010
|
* @throws If contract code not found, or public simulation reverts.
|
|
633
1011
|
* Also throws if simulatePublic is true and public simulation reverts.
|
|
634
1012
|
*/
|
|
635
|
-
public proveTx(txRequest: TxExecutionRequest): Promise<TxProvingResult> {
|
|
1013
|
+
public proveTx(txRequest: TxExecutionRequest, { scopes, senderForTags }: ProveTxOpts): Promise<TxProvingResult> {
|
|
636
1014
|
let privateExecutionResult: PrivateExecutionResult;
|
|
637
1015
|
// We disable proving concurrently mostly out of caution, since it accesses some of our stores. Proving is so
|
|
638
1016
|
// computationally demanding that it'd be rare for someone to try to do it concurrently regardless.
|
|
@@ -640,17 +1018,25 @@ export class PXE {
|
|
|
640
1018
|
const totalTimer = new Timer();
|
|
641
1019
|
try {
|
|
642
1020
|
const syncTimer = new Timer();
|
|
643
|
-
await this
|
|
1021
|
+
await this.#maybeSync();
|
|
1022
|
+
const anchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
|
|
644
1023
|
const syncTime = syncTimer.ms();
|
|
645
1024
|
const contractFunctionSimulator = this.#getSimulatorForTx();
|
|
646
|
-
privateExecutionResult = await this.#executePrivate(
|
|
1025
|
+
privateExecutionResult = await this.#executePrivate({
|
|
1026
|
+
contractFunctionSimulator,
|
|
1027
|
+
txRequest,
|
|
1028
|
+
anchorBlockHeader,
|
|
1029
|
+
scopes,
|
|
1030
|
+
jobId,
|
|
1031
|
+
senderForTags,
|
|
1032
|
+
});
|
|
647
1033
|
|
|
648
1034
|
const {
|
|
649
1035
|
publicInputs,
|
|
650
1036
|
chonkProof,
|
|
651
1037
|
executionSteps,
|
|
652
1038
|
timings: { proving } = {},
|
|
653
|
-
} = await this.#prove(txRequest, this.proofCreator, privateExecutionResult, {
|
|
1039
|
+
} = await this.#prove(txRequest, this.proofCreator, privateExecutionResult, anchorBlockHeader, {
|
|
654
1040
|
simulate: false,
|
|
655
1041
|
skipFeeEnforcement: false,
|
|
656
1042
|
profileMode: 'none',
|
|
@@ -680,23 +1066,20 @@ export class PXE {
|
|
|
680
1066
|
nodeRPCCalls: contractFunctionSimulator?.getStats().nodeRPCCalls,
|
|
681
1067
|
});
|
|
682
1068
|
|
|
683
|
-
//
|
|
684
|
-
//
|
|
685
|
-
//
|
|
686
|
-
//
|
|
687
|
-
//
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
} else {
|
|
698
|
-
this.log.debug(`No pre-tags used in the tx`);
|
|
699
|
-
}
|
|
1069
|
+
// We keep track of which tagging indices we've used in this tx so that we don't repeat them in future txs
|
|
1070
|
+
// (which would link them) without having to rely on this tx being mined (and us seeing the indices being used
|
|
1071
|
+
// onchain).
|
|
1072
|
+
// Note that this must happen _after_ proving as it requires the proof's public inputs, from which the kernels
|
|
1073
|
+
// may have removed some logs due to note-nullifier squashing - this may lead to range of tagging indices we've
|
|
1074
|
+
// actually used to being reduced.
|
|
1075
|
+
await persistSenderTaggingIndexRangesForTx(
|
|
1076
|
+
this.senderTaggingStore,
|
|
1077
|
+
privateExecutionResult.entrypoint.taggingIndexRanges,
|
|
1078
|
+
publicInputs,
|
|
1079
|
+
() => txProvingResult.getTxHash(),
|
|
1080
|
+
jobId,
|
|
1081
|
+
this.log,
|
|
1082
|
+
);
|
|
700
1083
|
|
|
701
1084
|
return txProvingResult;
|
|
702
1085
|
} catch (err: any) {
|
|
@@ -707,17 +1090,13 @@ export class PXE {
|
|
|
707
1090
|
|
|
708
1091
|
/**
|
|
709
1092
|
* Profiles a transaction, reporting gate counts (unless disabled) and returns an execution trace.
|
|
710
|
-
*
|
|
711
|
-
* @param txRequest - An authenticated tx request ready for simulation
|
|
712
|
-
* @param msgSender - (Optional) The message sender to use for the simulation.
|
|
713
|
-
* @param skipTxValidation - (Optional) If false, this function throws if the transaction is unable to be included in a block at the current state.
|
|
1093
|
+
* @param txRequest - An authenticated tx request ready for simulation.
|
|
714
1094
|
* @returns A trace of the program execution with gate counts.
|
|
715
1095
|
* @throws If the code for the functions executed in this transaction have not been made available via `addContracts`.
|
|
716
1096
|
*/
|
|
717
1097
|
public profileTx(
|
|
718
1098
|
txRequest: TxExecutionRequest,
|
|
719
|
-
profileMode
|
|
720
|
-
skipProofGeneration: boolean = true,
|
|
1099
|
+
{ profileMode, skipProofGeneration = true, scopes, senderForTags }: ProfileTxOpts,
|
|
721
1100
|
): Promise<TxProfileResult> {
|
|
722
1101
|
// We disable concurrent profiles for consistency with simulateTx.
|
|
723
1102
|
return this.#putInJobQueue(async jobId => {
|
|
@@ -736,21 +1115,25 @@ export class PXE {
|
|
|
736
1115
|
txInfo,
|
|
737
1116
|
);
|
|
738
1117
|
const syncTimer = new Timer();
|
|
739
|
-
await this
|
|
1118
|
+
await this.#maybeSync();
|
|
1119
|
+
const anchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
|
|
740
1120
|
const syncTime = syncTimer.ms();
|
|
741
1121
|
|
|
742
1122
|
const contractFunctionSimulator = this.#getSimulatorForTx();
|
|
743
|
-
const privateExecutionResult = await this.#executePrivate(
|
|
1123
|
+
const privateExecutionResult = await this.#executePrivate({
|
|
744
1124
|
contractFunctionSimulator,
|
|
745
1125
|
txRequest,
|
|
746
|
-
|
|
1126
|
+
anchorBlockHeader,
|
|
1127
|
+
scopes,
|
|
747
1128
|
jobId,
|
|
748
|
-
|
|
1129
|
+
senderForTags,
|
|
1130
|
+
});
|
|
749
1131
|
|
|
750
1132
|
const { executionSteps, timings: { proving } = {} } = await this.#prove(
|
|
751
1133
|
txRequest,
|
|
752
1134
|
this.proofCreator,
|
|
753
1135
|
privateExecutionResult,
|
|
1136
|
+
anchorBlockHeader,
|
|
754
1137
|
{
|
|
755
1138
|
simulate: skipProofGeneration,
|
|
756
1139
|
skipFeeEnforcement: false,
|
|
@@ -802,12 +1185,7 @@ export class PXE {
|
|
|
802
1185
|
* In that case, the transaction returned is only potentially ready to be sent to the network for execution.
|
|
803
1186
|
*
|
|
804
1187
|
*
|
|
805
|
-
* @param txRequest - An authenticated tx request ready for simulation
|
|
806
|
-
* @param simulatePublic - Whether to simulate the public part of the transaction.
|
|
807
|
-
* @param skipTxValidation - (Optional) If false, this function throws if the transaction is unable to be included in a block at the current state.
|
|
808
|
-
* @param skipFeeEnforcement - (Optional) If false, fees are enforced.
|
|
809
|
-
* @param overrides - (Optional) State overrides for the simulation, such as msgSender, contract instances and artifacts.
|
|
810
|
-
* @param scopes - (Optional) The accounts whose notes we can access in this call. Currently optional and will default to all.
|
|
1188
|
+
* @param txRequest - An authenticated tx request ready for simulation.
|
|
811
1189
|
* @returns A simulated transaction result object that includes public and private return values.
|
|
812
1190
|
* @throws If the code for the functions executed in this transaction have not been made available via `addContracts`.
|
|
813
1191
|
* Also throws if simulatePublic is true and public simulation reverts.
|
|
@@ -816,11 +1194,15 @@ export class PXE {
|
|
|
816
1194
|
*/
|
|
817
1195
|
public simulateTx(
|
|
818
1196
|
txRequest: TxExecutionRequest,
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
1197
|
+
{
|
|
1198
|
+
simulatePublic,
|
|
1199
|
+
skipTxValidation = false,
|
|
1200
|
+
skipFeeEnforcement = false,
|
|
1201
|
+
skipKernels = true,
|
|
1202
|
+
overrides,
|
|
1203
|
+
scopes,
|
|
1204
|
+
senderForTags,
|
|
1205
|
+
}: SimulateTxOpts,
|
|
824
1206
|
): Promise<TxSimulationResult> {
|
|
825
1207
|
// We disable concurrent simulations since those might execute oracles which read and write to the PXE stores (e.g.
|
|
826
1208
|
// to the capsules), and we need to prevent concurrent runs from interfering with one another (e.g. attempting to
|
|
@@ -841,17 +1223,26 @@ export class PXE {
|
|
|
841
1223
|
txInfo,
|
|
842
1224
|
);
|
|
843
1225
|
const syncTimer = new Timer();
|
|
844
|
-
await this
|
|
1226
|
+
await this.#maybeSync();
|
|
1227
|
+
const anchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
|
|
845
1228
|
const syncTime = syncTimer.ms();
|
|
846
1229
|
|
|
1230
|
+
if (overrides?.contracts && Object.keys(overrides.contracts).length > 0 && !skipKernels) {
|
|
1231
|
+
throw new Error(
|
|
1232
|
+
'Simulating with overridden contracts is not compatible with kernel execution. Please set skipKernels to true when simulating with overridden contracts.',
|
|
1233
|
+
);
|
|
1234
|
+
}
|
|
847
1235
|
const contractFunctionSimulator = this.#getSimulatorForTx(overrides);
|
|
848
|
-
// Temporary: in case there are overrides, we have to skip the kernels or validations
|
|
849
|
-
// will fail. Consider handing control to the user/wallet on whether they want to run them
|
|
850
|
-
// or not.
|
|
851
|
-
const skipKernels = overrides?.contracts !== undefined && Object.keys(overrides.contracts ?? {}).length > 0;
|
|
852
1236
|
|
|
853
1237
|
// Execution of private functions only; no proving, and no kernel logic.
|
|
854
|
-
const privateExecutionResult = await this.#executePrivate(
|
|
1238
|
+
const privateExecutionResult = await this.#executePrivate({
|
|
1239
|
+
contractFunctionSimulator,
|
|
1240
|
+
txRequest,
|
|
1241
|
+
anchorBlockHeader,
|
|
1242
|
+
scopes,
|
|
1243
|
+
jobId,
|
|
1244
|
+
senderForTags,
|
|
1245
|
+
});
|
|
855
1246
|
|
|
856
1247
|
let publicInputs: PrivateKernelTailCircuitPublicInputs | undefined;
|
|
857
1248
|
let executionSteps: PrivateExecutionStep[] = [];
|
|
@@ -859,15 +1250,22 @@ export class PXE {
|
|
|
859
1250
|
if (skipKernels) {
|
|
860
1251
|
({ publicInputs, executionSteps } = await generateSimulatedProvingResult(
|
|
861
1252
|
privateExecutionResult,
|
|
862
|
-
this
|
|
1253
|
+
(addr, sel) => this.#getDebugFunctionName(addr, sel, anchorBlockHeader),
|
|
1254
|
+
this.node,
|
|
863
1255
|
));
|
|
864
1256
|
} else {
|
|
865
1257
|
// Kernel logic, plus proving of all private functions and kernels.
|
|
866
|
-
({ publicInputs, executionSteps } = await this.#prove(
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
1258
|
+
({ publicInputs, executionSteps } = await this.#prove(
|
|
1259
|
+
txRequest,
|
|
1260
|
+
this.proofCreator,
|
|
1261
|
+
privateExecutionResult,
|
|
1262
|
+
anchorBlockHeader,
|
|
1263
|
+
{
|
|
1264
|
+
simulate: true,
|
|
1265
|
+
skipFeeEnforcement,
|
|
1266
|
+
profileMode: 'none',
|
|
1267
|
+
},
|
|
1268
|
+
));
|
|
871
1269
|
}
|
|
872
1270
|
|
|
873
1271
|
const privateSimulationResult = new PrivateSimulationResult(privateExecutionResult, publicInputs);
|
|
@@ -876,8 +1274,11 @@ export class PXE {
|
|
|
876
1274
|
let publicOutput: PublicSimulationOutput | undefined;
|
|
877
1275
|
if (simulatePublic && publicInputs.forPublic) {
|
|
878
1276
|
const publicSimulationTimer = new Timer();
|
|
879
|
-
publicOutput = await this.#simulatePublicCalls(simulatedTx, skipFeeEnforcement);
|
|
1277
|
+
publicOutput = await this.#simulatePublicCalls(simulatedTx, skipFeeEnforcement, overrides);
|
|
880
1278
|
publicSimulationTime = publicSimulationTimer.ms();
|
|
1279
|
+
if (publicOutput?.debugLogs?.length) {
|
|
1280
|
+
await displayDebugLogs(publicOutput.debugLogs, addr => this.#getDebugContractName(addr, anchorBlockHeader));
|
|
1281
|
+
}
|
|
881
1282
|
}
|
|
882
1283
|
|
|
883
1284
|
let validationTime: number | undefined;
|
|
@@ -886,7 +1287,8 @@ export class PXE {
|
|
|
886
1287
|
const validationResult = await this.node.isValidTx(simulatedTx, { isSimulation: true, skipFeeEnforcement });
|
|
887
1288
|
validationTime = validationTimer.ms();
|
|
888
1289
|
if (validationResult.result === 'invalid') {
|
|
889
|
-
|
|
1290
|
+
const reason = validationResult.reason.length > 0 ? ` Reason: ${validationResult.reason.join(', ')}` : '';
|
|
1291
|
+
throw new Error(`The simulated transaction is unable to be added to state and is invalid.${reason}`);
|
|
890
1292
|
}
|
|
891
1293
|
}
|
|
892
1294
|
|
|
@@ -937,49 +1339,44 @@ export class PXE {
|
|
|
937
1339
|
inspect(txRequest),
|
|
938
1340
|
`simulatePublic=${simulatePublic}`,
|
|
939
1341
|
`skipTxValidation=${skipTxValidation}`,
|
|
940
|
-
`scopes=${scopes
|
|
1342
|
+
`scopes=${scopes.map(s => s.toString()).join(', ')}`,
|
|
941
1343
|
);
|
|
942
1344
|
}
|
|
943
1345
|
});
|
|
944
1346
|
}
|
|
945
1347
|
|
|
946
1348
|
/**
|
|
947
|
-
*
|
|
948
|
-
*
|
|
1349
|
+
* Executes a contract utility function.
|
|
949
1350
|
* @param call - The function call containing the function details, arguments, and target contract address.
|
|
950
|
-
* @param authwits - (Optional) The authentication witnesses required for the function call.
|
|
951
|
-
* @param scopes - (Optional) The accounts whose notes we can access in this call. Currently optional and will
|
|
952
|
-
* default to all.
|
|
953
|
-
* @returns The result of the utility function call, structured based on the function ABI.
|
|
954
1351
|
*/
|
|
955
|
-
public
|
|
1352
|
+
public executeUtility(
|
|
956
1353
|
call: FunctionCall,
|
|
957
|
-
authwits
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
// We disable concurrent simulations since those might execute oracles which read and write to the PXE stores (e.g.
|
|
1354
|
+
{ authwits, scopes }: ExecuteUtilityOpts = { scopes: [] },
|
|
1355
|
+
): Promise<UtilityExecutionResult> {
|
|
1356
|
+
// We disable concurrent executions since those might execute oracles which read and write to the PXE stores (e.g.
|
|
961
1357
|
// to the capsules), and we need to prevent concurrent runs from interfering with one another (e.g. attempting to
|
|
962
|
-
// delete the same read value, or reading values that another
|
|
1358
|
+
// delete the same read value, or reading values that another execution is currently modifying).
|
|
963
1359
|
return this.#putInJobQueue(async jobId => {
|
|
964
1360
|
try {
|
|
965
1361
|
const totalTimer = new Timer();
|
|
966
1362
|
const syncTimer = new Timer();
|
|
967
|
-
await this
|
|
1363
|
+
await this.#maybeSync();
|
|
968
1364
|
const syncTime = syncTimer.ms();
|
|
969
1365
|
const functionTimer = new Timer();
|
|
970
1366
|
const contractFunctionSimulator = this.#getSimulatorForTx();
|
|
971
1367
|
|
|
972
1368
|
const anchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
|
|
973
|
-
await ensureContractSynced(
|
|
1369
|
+
await this.contractSyncService.ensureContractSynced(
|
|
974
1370
|
call.to,
|
|
975
1371
|
call.selector,
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
this.contractStore,
|
|
1372
|
+
(privateSyncCall, execScopes) =>
|
|
1373
|
+
this.#executeUtility(contractFunctionSimulator, privateSyncCall, [], execScopes, jobId),
|
|
979
1374
|
anchorBlockHeader,
|
|
1375
|
+
jobId,
|
|
1376
|
+
scopes,
|
|
980
1377
|
);
|
|
981
1378
|
|
|
982
|
-
const executionResult = await this.#
|
|
1379
|
+
const { result: executionResult, offchainEffects } = await this.#executeUtility(
|
|
983
1380
|
contractFunctionSimulator,
|
|
984
1381
|
call,
|
|
985
1382
|
authwits ?? [],
|
|
@@ -1000,14 +1397,19 @@ export class PXE {
|
|
|
1000
1397
|
};
|
|
1001
1398
|
|
|
1002
1399
|
const simulationStats = contractFunctionSimulator.getStats();
|
|
1003
|
-
return {
|
|
1400
|
+
return {
|
|
1401
|
+
result: executionResult,
|
|
1402
|
+
offchainEffects,
|
|
1403
|
+
anchorBlockTimestamp: anchorBlockHeader.globalVariables.timestamp,
|
|
1404
|
+
stats: { timings, nodeRPCCalls: simulationStats.nodeRPCCalls },
|
|
1405
|
+
};
|
|
1004
1406
|
} catch (err: any) {
|
|
1005
1407
|
const { to, name, args } = call;
|
|
1006
1408
|
const stringifiedArgs = args.map(arg => arg.toString()).join(', ');
|
|
1007
1409
|
throw this.#contextualizeError(
|
|
1008
1410
|
err,
|
|
1009
|
-
`
|
|
1010
|
-
`scopes=${scopes
|
|
1411
|
+
`executeUtility ${to}:${name}(${stringifiedArgs})`,
|
|
1412
|
+
`scopes=${scopes.map(s => s.toString()).join(', ')}`,
|
|
1011
1413
|
);
|
|
1012
1414
|
}
|
|
1013
1415
|
});
|
|
@@ -1033,21 +1435,21 @@ export class PXE {
|
|
|
1033
1435
|
let anchorBlockNumber: BlockNumber;
|
|
1034
1436
|
|
|
1035
1437
|
await this.#putInJobQueue(async jobId => {
|
|
1036
|
-
await this
|
|
1438
|
+
await this.#maybeSync();
|
|
1037
1439
|
|
|
1038
1440
|
const anchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
|
|
1039
1441
|
anchorBlockNumber = anchorBlockHeader.getBlockNumber();
|
|
1040
1442
|
|
|
1041
1443
|
const contractFunctionSimulator = this.#getSimulatorForTx();
|
|
1042
1444
|
|
|
1043
|
-
await ensureContractSynced(
|
|
1445
|
+
await this.contractSyncService.ensureContractSynced(
|
|
1044
1446
|
filter.contractAddress,
|
|
1045
1447
|
null,
|
|
1046
|
-
async privateSyncCall =>
|
|
1047
|
-
await this.#
|
|
1048
|
-
this.node,
|
|
1049
|
-
this.contractStore,
|
|
1448
|
+
async (privateSyncCall, execScopes) =>
|
|
1449
|
+
await this.#executeUtility(contractFunctionSimulator, privateSyncCall, [], execScopes, jobId),
|
|
1050
1450
|
anchorBlockHeader,
|
|
1451
|
+
jobId,
|
|
1452
|
+
filter.scopes,
|
|
1051
1453
|
);
|
|
1052
1454
|
});
|
|
1053
1455
|
|
|
@@ -1062,9 +1464,11 @@ export class PXE {
|
|
|
1062
1464
|
}
|
|
1063
1465
|
|
|
1064
1466
|
/**
|
|
1065
|
-
* Stops the PXE's job queue.
|
|
1467
|
+
* Stops the PXE's job queue and closes the backing store.
|
|
1066
1468
|
*/
|
|
1067
|
-
public stop(): Promise<void> {
|
|
1068
|
-
|
|
1469
|
+
public async stop(): Promise<void> {
|
|
1470
|
+
await this.jobQueue.end();
|
|
1471
|
+
await this.blockStateSynchronizer.stop();
|
|
1472
|
+
await this.db.close();
|
|
1069
1473
|
}
|
|
1070
1474
|
}
|