@aztec/pxe 0.0.1-commit.b655e406 → 0.0.1-commit.b8a057fa
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.d.ts +1 -1
- package/dest/bin/check_oracle_version.js +53 -29
- 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 +53 -0
- package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -0
- package/dest/block_synchronizer/block_synchronizer.js +209 -0
- package/dest/block_synchronizer/index.d.ts +2 -0
- package/dest/block_synchronizer/index.d.ts.map +1 -0
- package/dest/block_synchronizer/index.js +1 -0
- package/dest/config/index.d.ts +14 -13
- package/dest/config/index.d.ts.map +1 -1
- package/dest/config/index.js +25 -15
- package/dest/config/package_info.d.ts +1 -1
- 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/benchmarked_node.d.ts +9 -0
- package/dest/contract_function_simulator/benchmarked_node.d.ts.map +1 -0
- package/dest/contract_function_simulator/benchmarked_node.js +77 -0
- package/dest/contract_function_simulator/contract_function_simulator.d.ts +93 -29
- package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.js +307 -97
- 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 +22 -17
- package/dest/contract_function_simulator/execution_note_cache.d.ts.map +1 -1
- package/dest/contract_function_simulator/execution_note_cache.js +41 -36
- 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/hashed_values_cache.d.ts +2 -2
- package/dest/contract_function_simulator/hashed_values_cache.d.ts.map +1 -1
- package/dest/contract_function_simulator/index.d.ts +27 -6
- package/dest/contract_function_simulator/index.d.ts.map +1 -1
- package/dest/contract_function_simulator/index.js +13 -4
- 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 +6 -6
- 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 +13 -11
- 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 +21 -11
- 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 -23
- 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 +7 -7
- 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 +16 -11
- 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 +43 -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 +7 -18
- 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 -31
- 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 -88
- 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 +74 -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 +14 -8
- package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/note_packing_utils.js +17 -12
- package/dest/contract_function_simulator/oracle/oracle_registry.d.ts +136 -0
- package/dest/contract_function_simulator/oracle/oracle_registry.d.ts.map +1 -0
- package/dest/contract_function_simulator/oracle/oracle_registry.js +989 -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 +2 -27
- package/dest/contract_function_simulator/oracle/private_execution.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution.js +8 -43
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +92 -103
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.js +291 -138
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +228 -62
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +632 -129
- package/dest/contract_function_simulator/pick_notes.d.ts +2 -2
- package/dest/contract_function_simulator/pick_notes.d.ts.map +1 -1
- package/dest/contract_function_simulator/pick_notes.js +21 -4
- 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 +40 -0
- package/dest/debug/pxe_debug_utils.d.ts.map +1 -0
- package/dest/debug/pxe_debug_utils.js +42 -0
- package/dest/entrypoints/client/bundle/index.d.ts +3 -2
- package/dest/entrypoints/client/bundle/index.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/index.js +2 -1
- package/dest/entrypoints/client/bundle/utils.d.ts +2 -2
- package/dest/entrypoints/client/bundle/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/utils.js +49 -13
- package/dest/entrypoints/client/lazy/index.d.ts +3 -2
- package/dest/entrypoints/client/lazy/index.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/index.js +2 -1
- package/dest/entrypoints/client/lazy/utils.d.ts +3 -3
- package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/utils.js +50 -14
- package/dest/entrypoints/pxe_creation_options.d.ts +22 -4
- 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 +9 -3
- package/dest/entrypoints/server/index.d.ts.map +1 -1
- package/dest/entrypoints/server/index.js +7 -2
- package/dest/entrypoints/server/utils.d.ts +4 -3
- package/dest/entrypoints/server/utils.d.ts.map +1 -1
- package/dest/entrypoints/server/utils.js +57 -31
- package/dest/error_enriching.d.ts +6 -4
- package/dest/error_enriching.d.ts.map +1 -1
- package/dest/error_enriching.js +13 -11
- package/dest/events/event_service.d.ts +24 -0
- package/dest/events/event_service.d.ts.map +1 -0
- package/dest/events/event_service.js +77 -0
- package/dest/events/index.d.ts +2 -0
- package/dest/events/index.d.ts.map +1 -0
- package/dest/events/index.js +1 -0
- package/dest/events/private_event_filter_validator.d.ts +10 -0
- package/dest/events/private_event_filter_validator.d.ts.map +1 -0
- package/dest/events/private_event_filter_validator.js +53 -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 +1 -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 +48 -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/job_coordinator/job_coordinator.d.ts +75 -0
- package/dest/job_coordinator/job_coordinator.d.ts.map +1 -0
- package/dest/job_coordinator/job_coordinator.js +94 -0
- package/dest/logs/log_service.d.ts +30 -0
- package/dest/logs/log_service.d.ts.map +1 -0
- package/dest/logs/log_service.js +223 -0
- 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/index.d.ts +2 -0
- package/dest/notes/index.d.ts.map +1 -0
- package/dest/notes/index.js +1 -0
- package/dest/notes/note_service.d.ts +70 -0
- package/dest/notes/note_service.d.ts.map +1 -0
- package/dest/notes/note_service.js +172 -0
- 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 -9
- 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 +3 -3
- package/dest/private_kernel/hints/index.d.ts.map +1 -1
- package/dest/private_kernel/hints/index.js +2 -2
- package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts +29 -0
- package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts.map +1 -0
- package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.js +342 -0
- 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/index.d.ts +1 -1
- package/dest/private_kernel/private_kernel_execution_prover.d.ts +7 -2
- package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_execution_prover.js +218 -96
- package/dest/private_kernel/private_kernel_oracle.d.ts +32 -29
- package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_oracle.js +108 -2
- package/dest/pxe.d.ts +267 -134
- package/dest/pxe.d.ts.map +1 -1
- package/dest/pxe.js +498 -365
- package/dest/storage/address_store/address_store.d.ts +11 -0
- package/dest/storage/address_store/address_store.d.ts.map +1 -0
- package/dest/storage/{address_data_provider/address_data_provider.js → address_store/address_store.js} +13 -12
- package/dest/storage/address_store/index.d.ts +2 -0
- package/dest/storage/address_store/index.d.ts.map +1 -0
- package/dest/storage/address_store/index.js +1 -0
- package/dest/storage/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 +20 -0
- package/dest/storage/anchor_block_store/anchor_block_store.d.ts.map +1 -0
- package/dest/storage/anchor_block_store/anchor_block_store.js +28 -0
- package/dest/storage/anchor_block_store/index.d.ts +2 -0
- package/dest/storage/anchor_block_store/index.d.ts.map +1 -0
- package/dest/storage/anchor_block_store/index.js +1 -0
- package/dest/storage/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 +647 -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 +72 -0
- package/dest/storage/capsule_store/capsule_store.d.ts.map +1 -0
- package/dest/storage/capsule_store/capsule_store.js +261 -0
- package/dest/storage/capsule_store/index.d.ts +3 -0
- package/dest/storage/capsule_store/index.d.ts.map +1 -0
- package/dest/storage/capsule_store/index.js +2 -0
- package/dest/storage/contract_store/contract_store.d.ts +96 -0
- package/dest/storage/contract_store/contract_store.d.ts.map +1 -0
- package/dest/storage/contract_store/contract_store.js +281 -0
- package/dest/storage/contract_store/index.d.ts +2 -0
- package/dest/storage/contract_store/index.d.ts.map +1 -0
- package/dest/storage/contract_store/index.js +1 -0
- package/dest/storage/{contract_data_provider → contract_store}/private_functions_tree.d.ts +1 -1
- package/dest/storage/contract_store/private_functions_tree.d.ts.map +1 -0
- package/dest/storage/{contract_data_provider → contract_store}/private_functions_tree.js +1 -1
- package/dest/storage/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 +9 -8
- package/dest/storage/index.d.ts.map +1 -1
- package/dest/storage/index.js +8 -7
- 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/index.d.ts +3 -0
- package/dest/storage/note_store/index.d.ts.map +1 -0
- package/dest/storage/note_store/index.js +2 -0
- package/dest/storage/note_store/note_store.d.ts +92 -0
- package/dest/storage/note_store/note_store.d.ts.map +1 -0
- package/dest/storage/note_store/note_store.js +372 -0
- package/dest/storage/note_store/stored_note.d.ts +11 -0
- package/dest/storage/note_store/stored_note.d.ts.map +1 -0
- package/dest/storage/note_store/stored_note.js +27 -0
- 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 +88 -0
- package/dest/storage/private_event_store/private_event_store.d.ts.map +1 -0
- package/dest/storage/private_event_store/private_event_store.js +273 -0
- package/dest/storage/private_event_store/stored_private_event.d.ts +23 -0
- package/dest/storage/private_event_store/stored_private_event.d.ts.map +1 -0
- package/dest/storage/private_event_store/stored_private_event.js +56 -0
- package/dest/storage/tagging_store/index.d.ts +4 -0
- package/dest/storage/tagging_store/index.d.ts.map +1 -0
- package/dest/storage/tagging_store/index.js +3 -0
- package/dest/storage/tagging_store/recipient_tagging_store.d.ts +28 -0
- package/dest/storage/tagging_store/recipient_tagging_store.d.ts.map +1 -0
- package/dest/storage/tagging_store/recipient_tagging_store.js +111 -0
- package/dest/storage/tagging_store/sender_tagging_store.d.ts +78 -0
- package/dest/storage/tagging_store/sender_tagging_store.d.ts.map +1 -0
- package/dest/storage/tagging_store/sender_tagging_store.js +374 -0
- 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 +7 -2
- package/dest/tagging/get_all_logs_by_tags.d.ts +48 -0
- package/dest/tagging/get_all_logs_by_tags.d.ts.map +1 -0
- package/dest/tagging/get_all_logs_by_tags.js +59 -0
- package/dest/tagging/index.d.ts +18 -7
- package/dest/tagging/index.d.ts.map +1 -1
- package/dest/tagging/index.js +16 -5
- 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 +12 -0
- package/dest/tagging/recipient_sync/utils/find_highest_indexes.d.ts.map +1 -0
- package/dest/tagging/recipient_sync/utils/find_highest_indexes.js +20 -0
- package/dest/tagging/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 +16 -0
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts.map +1 -0
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.js +92 -0
- package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts +17 -0
- package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts.map +1 -0
- package/dest/tagging/sender_sync/utils/get_status_change_of_pending.js +60 -0
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts +19 -0
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts.map +1 -0
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.js +72 -0
- package/package.json +33 -20
- package/src/bin/check_oracle_version.ts +62 -33
- 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 +241 -0
- package/src/block_synchronizer/index.ts +1 -0
- package/src/config/index.ts +32 -26
- 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/benchmarked_node.ts +103 -0
- package/src/contract_function_simulator/contract_function_simulator.ts +526 -132
- package/src/contract_function_simulator/ephemeral_array_service.ts +110 -0
- package/src/contract_function_simulator/execution_note_cache.ts +42 -33
- package/src/contract_function_simulator/execution_tagging_index_cache.ts +19 -18
- package/src/contract_function_simulator/hashed_values_cache.ts +1 -1
- package/src/contract_function_simulator/index.ts +70 -5
- 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 +16 -11
- 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 +28 -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 +18 -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 +58 -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 +6 -37
- 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 -151
- package/src/contract_function_simulator/oracle/legacy_oracle_registry.ts +120 -0
- package/src/contract_function_simulator/oracle/message_load_oracle_inputs.ts +6 -21
- package/src/contract_function_simulator/oracle/note_packing_utils.ts +31 -15
- package/src/contract_function_simulator/oracle/oracle_registry.ts +689 -0
- package/src/contract_function_simulator/oracle/oracle_type_mappings.ts +964 -0
- package/src/contract_function_simulator/oracle/private_execution.ts +8 -75
- package/src/contract_function_simulator/oracle/private_execution_oracle.ts +363 -189
- package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +974 -154
- package/src/contract_function_simulator/pick_notes.ts +23 -4
- 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 +85 -0
- package/src/entrypoints/client/bundle/index.ts +2 -1
- package/src/entrypoints/client/bundle/utils.ts +41 -22
- package/src/entrypoints/client/lazy/index.ts +2 -1
- package/src/entrypoints/client/lazy/utils.ts +43 -24
- package/src/entrypoints/pxe_creation_options.ts +27 -3
- package/src/entrypoints/server/index.ts +9 -2
- package/src/entrypoints/server/utils.ts +55 -60
- package/src/error_enriching.ts +20 -12
- package/src/events/event_service.ts +119 -0
- package/src/events/index.ts +1 -0
- package/src/events/private_event_filter_validator.ts +66 -0
- package/src/hooks/authorize_utility_call.ts +44 -0
- package/src/hooks/execution_hooks.ts +68 -0
- package/src/hooks/index.ts +12 -0
- package/src/hooks/resolve_custom_request.ts +24 -0
- package/src/hooks/resolve_tagging_secret_strategy.ts +57 -0
- package/src/job_coordinator/job_coordinator.ts +150 -0
- package/src/logs/log_service.ts +291 -0
- package/src/messages/tx_resolver_service.ts +69 -0
- package/src/notes/index.ts +1 -0
- package/src/notes/note_service.ts +230 -0
- package/src/notes_filter.ts +24 -0
- package/src/oracle_version.ts +20 -9
- package/src/private_kernel/batch_planner.ts +168 -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 +2 -2
- package/src/private_kernel/hints/{build_private_kernel_reset_private_inputs.ts → private_kernel_reset_private_inputs_builder.ts} +211 -147
- package/src/private_kernel/hints/test_utils.ts +318 -0
- package/src/private_kernel/private_kernel_execution_prover.ts +358 -140
- package/src/private_kernel/private_kernel_oracle.ts +149 -39
- package/src/pxe.ts +849 -491
- package/src/storage/{address_data_provider/address_data_provider.ts → address_store/address_store.ts} +16 -16
- package/src/storage/address_store/index.ts +1 -0
- package/src/storage/allowed_scopes.ts +14 -0
- package/src/storage/anchor_block_store/anchor_block_store.ts +35 -0
- package/src/storage/anchor_block_store/index.ts +1 -0
- 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 +18 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/SenderTaggingStore.json +22 -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 +774 -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 +333 -0
- package/src/storage/capsule_store/index.ts +2 -0
- package/src/storage/contract_store/contract_store.ts +401 -0
- package/src/storage/contract_store/index.ts +1 -0
- package/src/storage/{contract_data_provider → contract_store}/private_functions_tree.ts +1 -1
- package/src/storage/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 +8 -7
- package/src/storage/metadata.ts +1 -1
- package/src/storage/note_store/index.ts +2 -0
- package/src/storage/note_store/note_store.ts +454 -0
- package/src/storage/note_store/stored_note.ts +26 -0
- package/src/storage/open_pxe_stores.ts +52 -0
- package/src/storage/private_event_store/private_event_store.ts +382 -0
- package/src/storage/private_event_store/stored_private_event.ts +73 -0
- package/src/storage/tagging_store/index.ts +3 -0
- package/src/storage/tagging_store/recipient_tagging_store.ts +139 -0
- package/src/storage/tagging_store/sender_tagging_store.ts +476 -0
- package/src/storage/tagging_store/tagging_secret_sources_store.ts +138 -0
- package/src/tagging/constants.ts +8 -2
- package/src/tagging/get_all_logs_by_tags.ts +120 -0
- package/src/tagging/index.ts +20 -6
- 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 +34 -0
- package/src/tagging/reconcile_tagging_index_ranges.ts +102 -0
- package/src/tagging/sender_sync/sync_sender_tagging_indexes.ts +134 -0
- package/src/tagging/sender_sync/utils/get_status_change_of_pending.ts +66 -0
- package/src/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.ts +84 -0
- package/dest/contract_function_simulator/execution_data_provider.d.ts +0 -274
- package/dest/contract_function_simulator/execution_data_provider.d.ts.map +0 -1
- package/dest/contract_function_simulator/execution_data_provider.js +0 -14
- package/dest/contract_function_simulator/oracle/oracle.d.ts +0 -57
- package/dest/contract_function_simulator/oracle/oracle.d.ts.map +0 -1
- package/dest/contract_function_simulator/oracle/oracle.js +0 -328
- 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 -62
- package/dest/contract_function_simulator/proxied_node.d.ts +0 -9
- package/dest/contract_function_simulator/proxied_node.d.ts.map +0 -1
- package/dest/contract_function_simulator/proxied_node.js +0 -27
- package/dest/contract_function_simulator/pxe_oracle_interface.d.ts +0 -122
- package/dest/contract_function_simulator/pxe_oracle_interface.d.ts.map +0 -1
- package/dest/contract_function_simulator/pxe_oracle_interface.js +0 -701
- package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts +0 -28
- package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts.map +0 -1
- package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.js +0 -271
- 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/private_kernel/private_kernel_oracle_impl.d.ts +0 -45
- package/dest/private_kernel/private_kernel_oracle_impl.d.ts.map +0 -1
- package/dest/private_kernel/private_kernel_oracle_impl.js +0 -86
- package/dest/storage/address_data_provider/address_data_provider.d.ts +0 -11
- package/dest/storage/address_data_provider/address_data_provider.d.ts.map +0 -1
- package/dest/storage/address_data_provider/index.d.ts +0 -2
- package/dest/storage/address_data_provider/index.d.ts.map +0 -1
- package/dest/storage/address_data_provider/index.js +0 -1
- package/dest/storage/capsule_data_provider/capsule_data_provider.d.ts +0 -25
- package/dest/storage/capsule_data_provider/capsule_data_provider.d.ts.map +0 -1
- package/dest/storage/capsule_data_provider/capsule_data_provider.js +0 -118
- package/dest/storage/capsule_data_provider/index.d.ts +0 -2
- package/dest/storage/capsule_data_provider/index.d.ts.map +0 -1
- package/dest/storage/capsule_data_provider/index.js +0 -1
- package/dest/storage/contract_data_provider/contract_data_provider.d.ts +0 -74
- package/dest/storage/contract_data_provider/contract_data_provider.d.ts.map +0 -1
- package/dest/storage/contract_data_provider/contract_data_provider.js +0 -205
- package/dest/storage/contract_data_provider/index.d.ts +0 -2
- package/dest/storage/contract_data_provider/index.d.ts.map +0 -1
- package/dest/storage/contract_data_provider/index.js +0 -1
- package/dest/storage/contract_data_provider/private_functions_tree.d.ts.map +0 -1
- package/dest/storage/note_data_provider/index.d.ts +0 -3
- package/dest/storage/note_data_provider/index.d.ts.map +0 -1
- package/dest/storage/note_data_provider/index.js +0 -2
- package/dest/storage/note_data_provider/note_dao.d.ts +0 -100
- package/dest/storage/note_data_provider/note_dao.d.ts.map +0 -1
- package/dest/storage/note_data_provider/note_dao.js +0 -102
- package/dest/storage/note_data_provider/note_data_provider.d.ts +0 -83
- package/dest/storage/note_data_provider/note_data_provider.d.ts.map +0 -1
- package/dest/storage/note_data_provider/note_data_provider.js +0 -308
- package/dest/storage/private_event_data_provider/private_event_data_provider.d.ts +0 -43
- package/dest/storage/private_event_data_provider/private_event_data_provider.d.ts.map +0 -1
- package/dest/storage/private_event_data_provider/private_event_data_provider.js +0 -104
- package/dest/storage/sync_data_provider/index.d.ts +0 -2
- package/dest/storage/sync_data_provider/index.d.ts.map +0 -1
- package/dest/storage/sync_data_provider/index.js +0 -1
- package/dest/storage/sync_data_provider/sync_data_provider.d.ts +0 -10
- package/dest/storage/sync_data_provider/sync_data_provider.d.ts.map +0 -1
- package/dest/storage/sync_data_provider/sync_data_provider.js +0 -26
- package/dest/storage/tagging_data_provider/index.d.ts +0 -2
- package/dest/storage/tagging_data_provider/index.d.ts.map +0 -1
- package/dest/storage/tagging_data_provider/index.js +0 -1
- package/dest/storage/tagging_data_provider/tagging_data_provider.d.ts +0 -40
- package/dest/storage/tagging_data_provider/tagging_data_provider.d.ts.map +0 -1
- package/dest/storage/tagging_data_provider/tagging_data_provider.js +0 -89
- package/dest/synchronizer/index.d.ts +0 -2
- package/dest/synchronizer/index.d.ts.map +0 -1
- package/dest/synchronizer/index.js +0 -1
- package/dest/synchronizer/synchronizer.d.ts +0 -35
- package/dest/synchronizer/synchronizer.d.ts.map +0 -1
- package/dest/synchronizer/synchronizer.js +0 -101
- package/dest/tagging/siloed_tag.d.ts +0 -14
- package/dest/tagging/siloed_tag.d.ts.map +0 -1
- package/dest/tagging/siloed_tag.js +0 -20
- package/dest/tagging/tag.d.ts +0 -12
- package/dest/tagging/tag.d.ts.map +0 -1
- package/dest/tagging/tag.js +0 -17
- package/dest/tagging/utils.d.ts +0 -18
- package/dest/tagging/utils.d.ts.map +0 -1
- package/dest/tagging/utils.js +0 -24
- package/src/contract_function_simulator/execution_data_provider.ts +0 -343
- package/src/contract_function_simulator/oracle/oracle.ts +0 -575
- package/src/contract_function_simulator/proxied_contract_data_source.ts +0 -66
- package/src/contract_function_simulator/proxied_node.ts +0 -33
- package/src/contract_function_simulator/pxe_oracle_interface.ts +0 -1019
- package/src/private_kernel/private_kernel_oracle_impl.ts +0 -132
- package/src/storage/address_data_provider/index.ts +0 -1
- package/src/storage/capsule_data_provider/capsule_data_provider.ts +0 -147
- package/src/storage/capsule_data_provider/index.ts +0 -1
- package/src/storage/contract_data_provider/contract_data_provider.ts +0 -294
- package/src/storage/contract_data_provider/index.ts +0 -1
- package/src/storage/note_data_provider/index.ts +0 -2
- package/src/storage/note_data_provider/note_dao.ts +0 -154
- package/src/storage/note_data_provider/note_data_provider.ts +0 -393
- package/src/storage/private_event_data_provider/private_event_data_provider.ts +0 -148
- package/src/storage/sync_data_provider/index.ts +0 -1
- package/src/storage/sync_data_provider/sync_data_provider.ts +0 -34
- package/src/storage/tagging_data_provider/index.ts +0 -1
- package/src/storage/tagging_data_provider/tagging_data_provider.ts +0 -120
- package/src/synchronizer/index.ts +0 -1
- package/src/synchronizer/synchronizer.ts +0 -120
- package/src/tagging/siloed_tag.ts +0 -22
- package/src/tagging/tag.ts +0 -16
- package/src/tagging/utils.ts +0 -31
package/src/pxe.ts
CHANGED
|
@@ -1,43 +1,47 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { PrivateEventFilter } from '@aztec/aztec.js/wallet';
|
|
2
|
+
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
3
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
4
|
+
import { Point } from '@aztec/foundation/curves/grumpkin';
|
|
5
|
+
import { type Logger, type LoggerBindings, createLogger } from '@aztec/foundation/log';
|
|
3
6
|
import { SerialQueue } from '@aztec/foundation/queue';
|
|
4
7
|
import { Timer } from '@aztec/foundation/timer';
|
|
5
8
|
import { KeyStore } from '@aztec/key-store';
|
|
9
|
+
import type { AccountPrivacyKeys, AccountPrivacySecretKeys } from '@aztec/key-store';
|
|
6
10
|
import type { AztecAsyncKVStore } from '@aztec/kv-store';
|
|
7
|
-
import { L2TipsKVStore } from '@aztec/kv-store/stores';
|
|
8
11
|
import { type ProtocolContractsProvider, protocolContractNames } from '@aztec/protocol-contracts';
|
|
9
12
|
import type { CircuitSimulator } from '@aztec/simulator/client';
|
|
10
13
|
import {
|
|
11
14
|
type ContractArtifact,
|
|
12
|
-
|
|
15
|
+
EventSelector,
|
|
13
16
|
FunctionCall,
|
|
14
|
-
FunctionSelector,
|
|
17
|
+
type FunctionSelector,
|
|
15
18
|
FunctionType,
|
|
16
|
-
decodeFromAbi,
|
|
17
19
|
decodeFunctionSignature,
|
|
18
|
-
encodeArguments,
|
|
19
20
|
} from '@aztec/stdlib/abi';
|
|
20
21
|
import type { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
21
22
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
23
|
+
import { GENESIS_BLOCK_HEADER_HASH, type L2TipsProvider } from '@aztec/stdlib/block';
|
|
22
24
|
import {
|
|
23
25
|
CompleteAddress,
|
|
24
|
-
type
|
|
26
|
+
type ContractInstancePreimage,
|
|
27
|
+
type ContractInstancePreimageWithAddress,
|
|
25
28
|
type ContractInstanceWithAddress,
|
|
26
29
|
type PartialAddress,
|
|
27
30
|
computeContractAddressFromInstance,
|
|
28
|
-
getContractClassFromArtifact,
|
|
29
31
|
} from '@aztec/stdlib/contract';
|
|
30
32
|
import { SimulationError } from '@aztec/stdlib/errors';
|
|
31
|
-
import {
|
|
32
|
-
import type { AztecNode, PrivateKernelProver } from '@aztec/stdlib/interfaces/client';
|
|
33
|
+
import type { AztecNode, AztecNodeDebug, PrivateKernelProver } from '@aztec/stdlib/interfaces/client';
|
|
33
34
|
import type {
|
|
34
35
|
PrivateExecutionStep,
|
|
35
36
|
PrivateKernelExecutionProofOutput,
|
|
36
37
|
PrivateKernelTailCircuitPublicInputs,
|
|
37
38
|
} from '@aztec/stdlib/kernel';
|
|
38
|
-
import {
|
|
39
|
+
import { computeAddressSecret } from '@aztec/stdlib/keys';
|
|
40
|
+
import { deriveEcdhSharedSecretPoint } from '@aztec/stdlib/logs';
|
|
39
41
|
import {
|
|
42
|
+
BlockHeader,
|
|
40
43
|
type ContractOverrides,
|
|
44
|
+
type InTx,
|
|
41
45
|
PrivateExecutionResult,
|
|
42
46
|
PrivateSimulationResult,
|
|
43
47
|
type ProvingTimings,
|
|
@@ -49,37 +53,176 @@ import {
|
|
|
49
53
|
TxProfileResult,
|
|
50
54
|
TxProvingResult,
|
|
51
55
|
TxSimulationResult,
|
|
52
|
-
|
|
56
|
+
UtilityExecutionResult,
|
|
53
57
|
} from '@aztec/stdlib/tx';
|
|
54
58
|
|
|
55
59
|
import { inspect } from 'util';
|
|
56
60
|
|
|
61
|
+
import { BlockSynchronizer } from './block_synchronizer/index.js';
|
|
57
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';
|
|
65
|
+
import { BenchmarkedNodeFactory } from './contract_function_simulator/benchmarked_node.js';
|
|
58
66
|
import {
|
|
59
67
|
ContractFunctionSimulator,
|
|
60
68
|
generateSimulatedProvingResult,
|
|
61
69
|
} from './contract_function_simulator/contract_function_simulator.js';
|
|
62
|
-
import {
|
|
63
|
-
import {
|
|
64
|
-
import { ProxiedNodeFactory } from './contract_function_simulator/proxied_node.js';
|
|
65
|
-
import { PXEOracleInterface } from './contract_function_simulator/pxe_oracle_interface.js';
|
|
70
|
+
import { displayDebugLogs } from './contract_logging.js';
|
|
71
|
+
import { PXEDebugUtils } from './debug/pxe_debug_utils.js';
|
|
66
72
|
import { enrichPublicSimulationError, enrichSimulationError } from './error_enriching.js';
|
|
73
|
+
import { PrivateEventFilterValidator } from './events/private_event_filter_validator.js';
|
|
74
|
+
import type { ExecutionHooks } from './hooks/index.js';
|
|
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,
|
|
70
80
|
} from './private_kernel/private_kernel_execution_prover.js';
|
|
71
|
-
import {
|
|
72
|
-
import {
|
|
73
|
-
import {
|
|
74
|
-
import {
|
|
75
|
-
import {
|
|
81
|
+
import { PrivateKernelOracle } from './private_kernel/private_kernel_oracle.js';
|
|
82
|
+
import { AddressStore } from './storage/address_store/address_store.js';
|
|
83
|
+
import { AnchorBlockStore } from './storage/anchor_block_store/anchor_block_store.js';
|
|
84
|
+
import { CapsuleStore } from './storage/capsule_store/capsule_store.js';
|
|
85
|
+
import { ContractStore } from './storage/contract_store/contract_store.js';
|
|
86
|
+
import { FactStore } from './storage/fact_store/index.js';
|
|
87
|
+
import { NoteStore } from './storage/note_store/note_store.js';
|
|
88
|
+
import { openPxeStores } from './storage/open_pxe_stores.js';
|
|
89
|
+
import { PrivateEventStore } from './storage/private_event_store/private_event_store.js';
|
|
90
|
+
import { RecipientTaggingStore } from './storage/tagging_store/recipient_tagging_store.js';
|
|
91
|
+
import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store.js';
|
|
76
92
|
import {
|
|
77
|
-
type
|
|
78
|
-
|
|
79
|
-
} from './storage/
|
|
80
|
-
import {
|
|
81
|
-
|
|
82
|
-
|
|
93
|
+
type SharedSecretKind,
|
|
94
|
+
TaggingSecretSourcesStore,
|
|
95
|
+
} from './storage/tagging_store/tagging_secret_sources_store.js';
|
|
96
|
+
import { persistSenderTaggingIndexRangesForTx } from './tagging/index.js';
|
|
97
|
+
|
|
98
|
+
export type PackedPrivateEvent = InTx & {
|
|
99
|
+
packedEvent: Fr[];
|
|
100
|
+
eventSelector: EventSelector;
|
|
101
|
+
};
|
|
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 };
|
|
83
226
|
|
|
84
227
|
/**
|
|
85
228
|
* Private eXecution Environment (PXE) is a library used by wallets to simulate private phase of transactions and to
|
|
@@ -88,21 +231,35 @@ import { Synchronizer } from './synchronizer/index.js';
|
|
|
88
231
|
export class PXE {
|
|
89
232
|
private constructor(
|
|
90
233
|
private node: AztecNode,
|
|
91
|
-
private
|
|
234
|
+
private nodeDebug: AztecNodeDebug | undefined,
|
|
235
|
+
private db: AztecAsyncKVStore,
|
|
236
|
+
private blockStateSynchronizer: BlockSynchronizer,
|
|
92
237
|
private keyStore: KeyStore,
|
|
93
|
-
private
|
|
94
|
-
private
|
|
95
|
-
private
|
|
96
|
-
private
|
|
97
|
-
private
|
|
98
|
-
private
|
|
99
|
-
private
|
|
238
|
+
private contractStore: ContractStore,
|
|
239
|
+
private noteStore: NoteStore,
|
|
240
|
+
private capsuleStore: CapsuleStore,
|
|
241
|
+
private factStore: FactStore,
|
|
242
|
+
private anchorBlockStore: AnchorBlockStore,
|
|
243
|
+
private senderTaggingStore: SenderTaggingStore,
|
|
244
|
+
private taggingSecretSourcesStore: TaggingSecretSourcesStore,
|
|
245
|
+
private recipientTaggingStore: RecipientTaggingStore,
|
|
246
|
+
private addressStore: AddressStore,
|
|
247
|
+
private privateEventStore: PrivateEventStore,
|
|
248
|
+
private contractSyncService: ContractSyncService,
|
|
249
|
+
private contractClassService: ContractClassService,
|
|
250
|
+
private txResolver: TxResolverService,
|
|
251
|
+
private l2TipsStore: L2TipsProvider,
|
|
100
252
|
private simulator: CircuitSimulator,
|
|
101
253
|
private proverEnabled: boolean,
|
|
254
|
+
private autoSync: boolean,
|
|
102
255
|
private proofCreator: PrivateKernelProver,
|
|
103
256
|
private protocolContractsProvider: ProtocolContractsProvider,
|
|
257
|
+
private preloadedContractsProvider: PreloadedContractsProvider,
|
|
104
258
|
private log: Logger,
|
|
105
259
|
private jobQueue: SerialQueue,
|
|
260
|
+
private jobCoordinator: JobCoordinator,
|
|
261
|
+
public debug: PXEDebugUtils,
|
|
262
|
+
private hooks: ExecutionHooks | undefined,
|
|
106
263
|
) {}
|
|
107
264
|
|
|
108
265
|
/**
|
|
@@ -112,65 +269,133 @@ export class PXE {
|
|
|
112
269
|
*
|
|
113
270
|
* @returns A promise that resolves PXE is ready to be used.
|
|
114
271
|
*/
|
|
115
|
-
public static async create(
|
|
116
|
-
node
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
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) {
|
|
284
|
+
// Extract bindings from the logger, or use empty bindings if a string suffix is provided.
|
|
285
|
+
const bindings: LoggerBindings | undefined =
|
|
286
|
+
loggerOrSuffix && typeof loggerOrSuffix !== 'string' ? loggerOrSuffix.getBindings() : undefined;
|
|
287
|
+
|
|
124
288
|
const log =
|
|
125
289
|
!loggerOrSuffix || typeof loggerOrSuffix === 'string'
|
|
126
290
|
? createLogger(loggerOrSuffix ? `pxe:service:${loggerOrSuffix}` : `pxe:service`)
|
|
127
291
|
: loggerOrSuffix;
|
|
128
292
|
|
|
129
|
-
const
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
const
|
|
138
|
-
|
|
139
|
-
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(
|
|
140
320
|
node,
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
321
|
+
contractStore,
|
|
322
|
+
contractClassService,
|
|
323
|
+
noteStore,
|
|
324
|
+
createLogger('pxe:contract_sync', bindings),
|
|
325
|
+
);
|
|
326
|
+
const txResolver = new TxResolverService(node);
|
|
327
|
+
|
|
328
|
+
const synchronizer = new BlockSynchronizer(
|
|
329
|
+
node,
|
|
330
|
+
store,
|
|
331
|
+
anchorBlockStore,
|
|
332
|
+
noteStore,
|
|
333
|
+
privateEventStore,
|
|
334
|
+
factStore,
|
|
335
|
+
l2TipsStore,
|
|
336
|
+
contractSyncService,
|
|
337
|
+
contractClassService,
|
|
145
338
|
config,
|
|
146
|
-
|
|
339
|
+
bindings,
|
|
147
340
|
);
|
|
148
341
|
|
|
342
|
+
const jobCoordinator = new JobCoordinator(store, bindings);
|
|
343
|
+
jobCoordinator.registerStores([
|
|
344
|
+
capsuleStore,
|
|
345
|
+
senderTaggingStore,
|
|
346
|
+
recipientTaggingStore,
|
|
347
|
+
privateEventStore,
|
|
348
|
+
noteStore,
|
|
349
|
+
factStore,
|
|
350
|
+
contractSyncService,
|
|
351
|
+
]);
|
|
352
|
+
|
|
353
|
+
const debugUtils = new PXEDebugUtils(contractSyncService, noteStore, synchronizer, anchorBlockStore);
|
|
354
|
+
|
|
149
355
|
const jobQueue = new SerialQueue();
|
|
150
356
|
|
|
151
357
|
const pxe = new PXE(
|
|
152
358
|
node,
|
|
359
|
+
nodeDebug,
|
|
360
|
+
store,
|
|
153
361
|
synchronizer,
|
|
154
362
|
keyStore,
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
363
|
+
contractStore,
|
|
364
|
+
noteStore,
|
|
365
|
+
capsuleStore,
|
|
366
|
+
factStore,
|
|
367
|
+
anchorBlockStore,
|
|
368
|
+
senderTaggingStore,
|
|
369
|
+
taggingSecretSourcesStore,
|
|
370
|
+
recipientTaggingStore,
|
|
371
|
+
addressStore,
|
|
372
|
+
privateEventStore,
|
|
373
|
+
contractSyncService,
|
|
374
|
+
contractClassService,
|
|
375
|
+
txResolver,
|
|
376
|
+
l2TipsStore,
|
|
162
377
|
simulator,
|
|
163
378
|
proverEnabled,
|
|
379
|
+
config.autoSync,
|
|
164
380
|
proofCreator,
|
|
165
381
|
protocolContractsProvider,
|
|
382
|
+
preloadedContractsProvider,
|
|
166
383
|
log,
|
|
167
384
|
jobQueue,
|
|
385
|
+
jobCoordinator,
|
|
386
|
+
debugUtils,
|
|
387
|
+
hooks,
|
|
388
|
+
);
|
|
389
|
+
|
|
390
|
+
debugUtils.setPXEHelpers(
|
|
391
|
+
pxe.#putInJobQueue.bind(pxe),
|
|
392
|
+
pxe.#getSimulatorForTx.bind(pxe),
|
|
393
|
+
pxe.#executeUtility.bind(pxe),
|
|
168
394
|
);
|
|
169
395
|
|
|
170
396
|
pxe.jobQueue.start();
|
|
171
397
|
|
|
172
|
-
await pxe.#registerProtocolContracts();
|
|
173
|
-
const info = await node.getNodeInfo();
|
|
398
|
+
await Promise.all([pxe.#registerProtocolContracts(), pxe.#registerPreloadedContracts()]);
|
|
174
399
|
log.info(`Started PXE connected to chain ${info.l1ChainId} version ${info.rollupVersion}`);
|
|
175
400
|
return pxe;
|
|
176
401
|
}
|
|
@@ -178,19 +403,50 @@ export class PXE {
|
|
|
178
403
|
// Internal methods
|
|
179
404
|
|
|
180
405
|
#getSimulatorForTx(overrides?: { contracts?: ContractOverrides }) {
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
this.
|
|
184
|
-
|
|
185
|
-
this.
|
|
186
|
-
this.
|
|
187
|
-
this.
|
|
188
|
-
this.
|
|
189
|
-
this.
|
|
190
|
-
this.
|
|
191
|
-
this.
|
|
192
|
-
|
|
193
|
-
|
|
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
|
+
}
|
|
427
|
+
|
|
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
|
+
}
|
|
194
450
|
}
|
|
195
451
|
|
|
196
452
|
#contextualizeError(err: Error, ...context: string[]): Error {
|
|
@@ -213,7 +469,7 @@ export class PXE {
|
|
|
213
469
|
*
|
|
214
470
|
* Useful for tasks that cannot run concurrently, such as contract function simulation.
|
|
215
471
|
*/
|
|
216
|
-
#putInJobQueue<T>(fn: () => Promise<T>): Promise<T> {
|
|
472
|
+
#putInJobQueue<T>(fn: (jobId: string) => Promise<T>): Promise<T> {
|
|
217
473
|
// TODO(#12636): relax the conditions under which we forbid concurrency.
|
|
218
474
|
if (this.jobQueue.length() != 0) {
|
|
219
475
|
this.log.warn(
|
|
@@ -221,109 +477,131 @@ export class PXE {
|
|
|
221
477
|
);
|
|
222
478
|
}
|
|
223
479
|
|
|
224
|
-
return this.jobQueue.put(
|
|
480
|
+
return this.jobQueue.put(async () => {
|
|
481
|
+
const jobId = this.jobCoordinator.beginJob();
|
|
482
|
+
this.log.verbose(`Beginning job ${jobId}`);
|
|
483
|
+
|
|
484
|
+
try {
|
|
485
|
+
const result = await fn(jobId);
|
|
486
|
+
this.log.verbose(`Committing job ${jobId}`);
|
|
487
|
+
|
|
488
|
+
await this.jobCoordinator.commitJob(jobId);
|
|
489
|
+
return result;
|
|
490
|
+
} catch (err) {
|
|
491
|
+
this.log.verbose(`Aborting job ${jobId}`);
|
|
492
|
+
await this.jobCoordinator.abortJob(jobId);
|
|
493
|
+
throw err;
|
|
494
|
+
}
|
|
495
|
+
});
|
|
225
496
|
}
|
|
226
497
|
|
|
227
498
|
async #registerProtocolContracts() {
|
|
228
|
-
const registered
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
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
|
+
);
|
|
236
510
|
this.log.verbose(`Registered protocol contracts in pxe`, registered);
|
|
237
511
|
}
|
|
238
512
|
|
|
239
|
-
async #
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
async #getFunctionCall(functionName: string, args: any[], to: AztecAddress): Promise<FunctionCall> {
|
|
253
|
-
const contract = await this.contractDataProvider.getContract(to);
|
|
254
|
-
if (!contract) {
|
|
255
|
-
throw new Error(
|
|
256
|
-
`Unknown contract ${to}: add it to PXE by calling server.addContracts(...).\nSee docs for context: https://docs.aztec.network/developers/resources/debugging/aztecnr-errors#unknown-contract-0x0-add-it-to-pxe-by-calling-serveraddcontracts`,
|
|
257
|
-
);
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
const functionDao = contract.functions.find(f => f.name === functionName);
|
|
261
|
-
if (!functionDao) {
|
|
262
|
-
throw new Error(`Unknown function ${functionName} in contract ${contract.name}.`);
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
return {
|
|
266
|
-
name: functionDao.name,
|
|
267
|
-
args: encodeArguments(functionDao, args),
|
|
268
|
-
selector: await FunctionSelector.fromNameAndParameters(functionDao.name, functionDao.parameters),
|
|
269
|
-
type: functionDao.functionType,
|
|
270
|
-
to,
|
|
271
|
-
hideMsgSender: false,
|
|
272
|
-
isStatic: functionDao.isStatic,
|
|
273
|
-
returnTypes: functionDao.returnTypes,
|
|
274
|
-
};
|
|
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
|
+
});
|
|
275
526
|
}
|
|
276
527
|
|
|
277
528
|
// Executes the entrypoint private function, as well as all nested private
|
|
278
529
|
// functions that might arise.
|
|
279
|
-
async #executePrivate(
|
|
280
|
-
contractFunctionSimulator
|
|
281
|
-
txRequest
|
|
282
|
-
|
|
283
|
-
|
|
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> {
|
|
284
545
|
const { origin: contractAddress, functionSelector } = txRequest;
|
|
285
546
|
|
|
286
547
|
try {
|
|
287
|
-
|
|
288
|
-
txRequest,
|
|
548
|
+
await this.contractSyncService.ensureContractSynced(
|
|
289
549
|
contractAddress,
|
|
290
550
|
functionSelector,
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
551
|
+
(privateSyncCall, execScopes) =>
|
|
552
|
+
this.#executeUtility(contractFunctionSimulator, privateSyncCall, [], execScopes, jobId),
|
|
553
|
+
anchorBlockHeader,
|
|
554
|
+
jobId,
|
|
295
555
|
scopes,
|
|
296
556
|
);
|
|
557
|
+
|
|
558
|
+
const result = await contractFunctionSimulator.run(txRequest, {
|
|
559
|
+
anchorBlockHeader,
|
|
560
|
+
scopes,
|
|
561
|
+
jobId,
|
|
562
|
+
senderForTags,
|
|
563
|
+
});
|
|
297
564
|
this.log.debug(`Private simulation completed for ${contractAddress.toString()}:${functionSelector}`);
|
|
298
565
|
return result;
|
|
299
566
|
} catch (err) {
|
|
300
567
|
if (err instanceof SimulationError) {
|
|
301
|
-
await enrichSimulationError(err, this.
|
|
568
|
+
await enrichSimulationError(err, this.contractStore, this.contractClassService, anchorBlockHeader, this.log);
|
|
302
569
|
}
|
|
303
570
|
throw err;
|
|
304
571
|
}
|
|
305
572
|
}
|
|
306
573
|
|
|
307
574
|
/**
|
|
308
|
-
*
|
|
575
|
+
* Execute a utility function call on the given contract.
|
|
309
576
|
* @param contractFunctionSimulator - The simulator to use for the function call.
|
|
310
577
|
* @param call - The function call to execute.
|
|
311
578
|
* @param authWitnesses - Authentication witnesses required for the function call.
|
|
312
579
|
* @param scopes - Optional array of account addresses whose notes can be accessed in this call. Defaults to all
|
|
313
580
|
* accounts if not specified.
|
|
314
|
-
* @
|
|
581
|
+
* @param jobId - The job ID for staged writes.
|
|
582
|
+
* @returns The execution result containing the outputs of the utility function.
|
|
315
583
|
*/
|
|
316
|
-
async #
|
|
584
|
+
async #executeUtility(
|
|
317
585
|
contractFunctionSimulator: ContractFunctionSimulator,
|
|
318
586
|
call: FunctionCall,
|
|
319
|
-
authWitnesses
|
|
320
|
-
scopes
|
|
587
|
+
authWitnesses: AuthWitness[] | undefined,
|
|
588
|
+
scopes: AztecAddress[],
|
|
589
|
+
jobId: string,
|
|
321
590
|
) {
|
|
322
591
|
try {
|
|
323
|
-
|
|
592
|
+
const anchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
|
|
593
|
+
const { result, offchainEffects } = await contractFunctionSimulator.runUtility(
|
|
594
|
+
call,
|
|
595
|
+
authWitnesses ?? [],
|
|
596
|
+
anchorBlockHeader,
|
|
597
|
+
scopes,
|
|
598
|
+
jobId,
|
|
599
|
+
);
|
|
600
|
+
return { result, offchainEffects };
|
|
324
601
|
} catch (err) {
|
|
325
602
|
if (err instanceof SimulationError) {
|
|
326
|
-
|
|
603
|
+
const anchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
|
|
604
|
+
await enrichSimulationError(err, this.contractStore, this.contractClassService, anchorBlockHeader, this.log);
|
|
327
605
|
}
|
|
328
606
|
throw err;
|
|
329
607
|
}
|
|
@@ -335,11 +613,11 @@ export class PXE {
|
|
|
335
613
|
* It can also be used for estimating gas in the future.
|
|
336
614
|
* @param tx - The transaction to be simulated.
|
|
337
615
|
*/
|
|
338
|
-
async #simulatePublicCalls(tx: Tx, skipFeeEnforcement: boolean) {
|
|
616
|
+
async #simulatePublicCalls(tx: Tx, skipFeeEnforcement: boolean, overrides?: SimulationOverrides) {
|
|
339
617
|
// Simulating public calls can throw if the TX fails in a phase that doesn't allow reverts (setup)
|
|
340
618
|
// Or return as reverted if it fails in a phase that allows reverts (app logic, teardown)
|
|
341
619
|
try {
|
|
342
|
-
const result = await this.node.simulatePublicCalls(tx, skipFeeEnforcement);
|
|
620
|
+
const result = await this.node.simulatePublicCalls(tx, skipFeeEnforcement, overrides);
|
|
343
621
|
if (result.revertReason) {
|
|
344
622
|
throw result.revertReason;
|
|
345
623
|
}
|
|
@@ -347,7 +625,14 @@ export class PXE {
|
|
|
347
625
|
} catch (err) {
|
|
348
626
|
if (err instanceof SimulationError) {
|
|
349
627
|
try {
|
|
350
|
-
|
|
628
|
+
const anchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
|
|
629
|
+
await enrichPublicSimulationError(
|
|
630
|
+
err,
|
|
631
|
+
this.contractStore,
|
|
632
|
+
this.contractClassService,
|
|
633
|
+
anchorBlockHeader,
|
|
634
|
+
this.log,
|
|
635
|
+
);
|
|
351
636
|
} catch (enrichErr) {
|
|
352
637
|
this.log.error(`Failed to enrich public simulation error: ${enrichErr}`);
|
|
353
638
|
}
|
|
@@ -371,103 +656,94 @@ export class PXE {
|
|
|
371
656
|
txExecutionRequest: TxExecutionRequest,
|
|
372
657
|
proofCreator: PrivateKernelProver,
|
|
373
658
|
privateExecutionResult: PrivateExecutionResult,
|
|
659
|
+
anchorBlockHeader: BlockHeader,
|
|
374
660
|
config: PrivateKernelExecutionProverConfig,
|
|
375
661
|
): Promise<PrivateKernelExecutionProofOutput<PrivateKernelTailCircuitPublicInputs>> {
|
|
376
|
-
const
|
|
377
|
-
|
|
378
|
-
this.
|
|
662
|
+
const kernelOracle = new PrivateKernelOracle(
|
|
663
|
+
this.contractStore,
|
|
664
|
+
this.contractClassService,
|
|
379
665
|
this.keyStore,
|
|
380
666
|
this.node,
|
|
381
|
-
|
|
667
|
+
anchorBlockHeader,
|
|
668
|
+
);
|
|
669
|
+
const kernelTraceProver = new PrivateKernelExecutionProver(
|
|
670
|
+
kernelOracle,
|
|
671
|
+
proofCreator,
|
|
672
|
+
!this.proverEnabled,
|
|
673
|
+
this.log.getBindings(),
|
|
382
674
|
);
|
|
383
|
-
const kernelTraceProver = new PrivateKernelExecutionProver(kernelOracle, proofCreator, !this.proverEnabled);
|
|
384
675
|
this.log.debug(`Executing kernel trace prover (${JSON.stringify(config)})...`);
|
|
385
676
|
return await kernelTraceProver.proveWithKernels(txExecutionRequest.toTxRequest(), privateExecutionResult, config);
|
|
386
677
|
}
|
|
387
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
|
+
|
|
388
690
|
// Public API
|
|
389
691
|
|
|
390
|
-
|
|
391
|
-
|
|
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());
|
|
392
699
|
}
|
|
393
700
|
|
|
394
701
|
/**
|
|
395
|
-
* Returns the
|
|
396
|
-
* The
|
|
397
|
-
* @remark - it queries the node to check whether the contract class with the given id has been publicly registered.
|
|
398
|
-
* @param id - Identifier of the class.
|
|
399
|
-
* @param includeArtifact - Identifier of the class.
|
|
400
|
-
* @returns - It returns the contract class metadata, with the artifact field being optional, and will only be returned if true is passed in
|
|
401
|
-
* for `includeArtifact`
|
|
402
|
-
* TODO(@spalladino): The PXE actually holds artifacts and not classes, what should we return? Also,
|
|
403
|
-
* should the pxe query the node for contract public info, and merge it with its own definitions?
|
|
404
|
-
* TODO(@spalladino): This method is strictly needed to decide whether to publicly register a class or not
|
|
405
|
-
* during a public deployment. We probably want a nicer and more general API for this, but it'll have to
|
|
406
|
-
* do for the time being.
|
|
702
|
+
* Returns the block header up to which the PXE has synced.
|
|
703
|
+
* @returns The synced block header
|
|
407
704
|
*/
|
|
408
|
-
public
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
isContractClassPubliclyRegistered: boolean;
|
|
414
|
-
artifact: ContractArtifact | undefined;
|
|
415
|
-
}> {
|
|
416
|
-
const artifact = await this.contractDataProvider.getContractArtifact(id);
|
|
417
|
-
if (!artifact) {
|
|
418
|
-
this.log.warn(`No artifact found for contract class ${id.toString()} when looking for its metadata`);
|
|
419
|
-
}
|
|
705
|
+
public getSyncedBlockHeader(): Promise<BlockHeader> {
|
|
706
|
+
return this.#putInJobQueue(() => {
|
|
707
|
+
return this.anchorBlockStore.getBlockHeader();
|
|
708
|
+
});
|
|
709
|
+
}
|
|
420
710
|
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
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> {
|
|
717
|
+
return this.contractStore.getContractInstance(address);
|
|
426
718
|
}
|
|
427
719
|
|
|
428
720
|
/**
|
|
429
|
-
* Returns the contract
|
|
430
|
-
*
|
|
431
|
-
*
|
|
432
|
-
* and whether the contract instance with the given address has been publicly deployed.
|
|
433
|
-
* @remark - it queries the node to check whether the contract instance has been initialized / publicly deployed through a node.
|
|
434
|
-
* This query is not dependent on the PXE.
|
|
435
|
-
* @param address - The address that the contract instance resides at.
|
|
436
|
-
* @returns - It returns the contract metadata
|
|
437
|
-
* TODO(@spalladino): Should we return the public keys in plain as well here?
|
|
721
|
+
* Returns the contract artifact for a given contract class id, if it's registered in the PXE.
|
|
722
|
+
* @param id - Identifier of the contract class.
|
|
723
|
+
* @returns The contract artifact if found, undefined otherwise.
|
|
438
724
|
*/
|
|
439
|
-
public async
|
|
440
|
-
|
|
441
|
-
isContractInitialized: boolean;
|
|
442
|
-
isContractPublished: boolean;
|
|
443
|
-
}> {
|
|
444
|
-
let instance;
|
|
445
|
-
try {
|
|
446
|
-
instance = await this.contractDataProvider.getContractInstance(address);
|
|
447
|
-
} catch {
|
|
448
|
-
this.log.warn(`No instance found for contract ${address.toString()} when looking for its metadata`);
|
|
449
|
-
}
|
|
450
|
-
return {
|
|
451
|
-
contractInstance: instance,
|
|
452
|
-
isContractInitialized: await this.#isContractInitialized(address),
|
|
453
|
-
isContractPublished: await this.#isContractPublished(address),
|
|
454
|
-
};
|
|
725
|
+
public async getContractArtifact(id: Fr): Promise<ContractArtifact | undefined> {
|
|
726
|
+
return await this.contractStore.getContractArtifact(id);
|
|
455
727
|
}
|
|
456
728
|
|
|
457
729
|
/**
|
|
458
|
-
* Registers a user account in PXE
|
|
459
|
-
*
|
|
460
|
-
* the
|
|
461
|
-
*
|
|
730
|
+
* Registers a user account in PXE.
|
|
731
|
+
*
|
|
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.
|
|
462
736
|
*
|
|
463
|
-
*
|
|
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.
|
|
464
740
|
* @param partialAddress - The partial address of the account contract corresponding to the account being registered.
|
|
465
741
|
* @returns The complete address of the account.
|
|
466
742
|
*/
|
|
467
|
-
public async registerAccount(
|
|
743
|
+
public async registerAccount(keys: AccountPrivacyKeys, partialAddress: PartialAddress): Promise<CompleteAddress> {
|
|
468
744
|
const accounts = await this.keyStore.getAccounts();
|
|
469
|
-
const accountCompleteAddress = await this.keyStore.addAccount(
|
|
470
|
-
if (accounts.
|
|
745
|
+
const accountCompleteAddress = await this.keyStore.addAccount(keys, partialAddress);
|
|
746
|
+
if (accounts.some(a => a.equals(accountCompleteAddress.address))) {
|
|
471
747
|
this.log.info(`Account:\n "${accountCompleteAddress.address.toString()}"\n already registered.`);
|
|
472
748
|
return accountCompleteAddress;
|
|
473
749
|
} else {
|
|
@@ -475,57 +751,191 @@ export class PXE {
|
|
|
475
751
|
this.log.debug(`Registered account\n ${accountCompleteAddress.toReadableString()}`);
|
|
476
752
|
}
|
|
477
753
|
|
|
478
|
-
await this.
|
|
479
|
-
await this.noteDataProvider.addScope(accountCompleteAddress.address);
|
|
754
|
+
await this.addressStore.addCompleteAddress(accountCompleteAddress);
|
|
480
755
|
return accountCompleteAddress;
|
|
481
756
|
}
|
|
482
757
|
|
|
483
758
|
/**
|
|
484
|
-
*
|
|
759
|
+
* Retrieves the four privacy secret keys PXE holds for a registered account (nullifier-hiding, incoming-viewing,
|
|
760
|
+
* outgoing-viewing, tagging).
|
|
761
|
+
*
|
|
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.
|
|
485
765
|
*
|
|
486
|
-
*
|
|
487
|
-
*
|
|
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.
|
|
488
769
|
*
|
|
489
|
-
* @
|
|
490
|
-
* @returns The address address of the account.
|
|
770
|
+
* @throws If the account is not registered.
|
|
491
771
|
*/
|
|
492
|
-
public
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
this.log.info(`Sender:\n "${address.toString()}"\n already registered.`);
|
|
496
|
-
return address;
|
|
497
|
-
}
|
|
772
|
+
public getAccountSecretKeys(account: AztecAddress): Promise<AccountPrivacySecretKeys> {
|
|
773
|
+
return this.keyStore.getAccountSecretKeys(account);
|
|
774
|
+
}
|
|
498
775
|
|
|
499
|
-
|
|
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
|
+
}
|
|
500
806
|
|
|
501
807
|
if (wasAdded) {
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
this.log.info(`Sender:\n "${address.toString()}"\n already registered.`);
|
|
808
|
+
// Queued to avoid wiping while a job is in flight.
|
|
809
|
+
await this.#putInJobQueue(() => Promise.resolve(this.contractSyncService.wipe()));
|
|
505
810
|
}
|
|
811
|
+
}
|
|
506
812
|
|
|
507
|
-
|
|
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
|
+
}
|
|
508
845
|
}
|
|
509
846
|
|
|
510
847
|
/**
|
|
511
|
-
* Retrieves the
|
|
512
|
-
*
|
|
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}.
|
|
513
850
|
*/
|
|
514
|
-
public
|
|
515
|
-
|
|
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;
|
|
516
890
|
}
|
|
517
891
|
|
|
518
892
|
/**
|
|
519
|
-
*
|
|
893
|
+
* Derives the shared secret of a handshake from its ephemeral public key: `S = addressSecret(recipient) * ephPk`,
|
|
894
|
+
* the same derivation the recipient-side scan uses for handshakes discovered onchain. The ephemeral key is
|
|
895
|
+
* reconstructed from its x-coordinate with a positive y, matching how the protocol generates it.
|
|
896
|
+
*
|
|
897
|
+
* @throws If `ephPk` is not the x-coordinate of a Grumpkin curve point, or if `recipient` is not an account of
|
|
898
|
+
* this PXE, since the derivation needs its keys.
|
|
520
899
|
*/
|
|
521
|
-
|
|
522
|
-
|
|
900
|
+
async #deriveHandshakeSecret(recipient: AztecAddress, ephPk: Fr): Promise<Point> {
|
|
901
|
+
let ephPkPoint: Point;
|
|
902
|
+
try {
|
|
903
|
+
ephPkPoint = await Point.fromXAndSign(ephPk, true);
|
|
904
|
+
} catch {
|
|
905
|
+
throw new Error(`Ephemeral public key x-coordinate ${ephPk} does not correspond to a Grumpkin curve point.`);
|
|
906
|
+
}
|
|
523
907
|
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
908
|
+
const completeAddress = await this.addressStore.getCompleteAddress(recipient);
|
|
909
|
+
if (!completeAddress || !(await this.keyStore.hasAccount(recipient))) {
|
|
910
|
+
throw new Error(
|
|
911
|
+
`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.`,
|
|
912
|
+
);
|
|
913
|
+
}
|
|
914
|
+
|
|
915
|
+
const ivskM = await this.keyStore.getMasterIncomingViewingSecretKey(recipient);
|
|
916
|
+
const addressSecret = await computeAddressSecret(await completeAddress.getPreaddress(), ivskM);
|
|
917
|
+
return deriveEcdhSharedSecretPoint(addressSecret, ephPkPoint);
|
|
918
|
+
}
|
|
919
|
+
|
|
920
|
+
/** Registers a resolved shared secret scoped to a recipient. Returns whether it was newly added. */
|
|
921
|
+
async #registerSharedSecret(recipient: AztecAddress, kind: SharedSecretKind, secret: Point): Promise<boolean> {
|
|
922
|
+
if (!(await recipient.isValid())) {
|
|
923
|
+
throw new Error(
|
|
924
|
+
`Recipient ${recipient} is not valid: it does not correspond to a point on the Grumpkin curve. Cannot register a shared secret for it.`,
|
|
925
|
+
);
|
|
926
|
+
}
|
|
927
|
+
|
|
928
|
+
if (secret.isZero() || !secret.isOnCurve()) {
|
|
929
|
+
throw new Error(`Shared secret ${secret} is not a valid non-zero point on the Grumpkin curve.`);
|
|
528
930
|
}
|
|
931
|
+
|
|
932
|
+
const wasAdded = await this.taggingSecretSourcesStore.addSharedSecret(recipient, kind, secret);
|
|
933
|
+
this.log.info(
|
|
934
|
+
wasAdded
|
|
935
|
+
? `Added ${kind} shared secret for recipient:\n ${recipient.toString()}`
|
|
936
|
+
: `${kind} shared secret already registered for recipient:\n ${recipient.toString()}`,
|
|
937
|
+
);
|
|
938
|
+
return wasAdded;
|
|
529
939
|
}
|
|
530
940
|
|
|
531
941
|
/**
|
|
@@ -534,7 +944,7 @@ export class PXE {
|
|
|
534
944
|
*/
|
|
535
945
|
public async getRegisteredAccounts(): Promise<CompleteAddress[]> {
|
|
536
946
|
// Get complete addresses of both the recipients and the accounts
|
|
537
|
-
const completeAddresses = await this.
|
|
947
|
+
const completeAddresses = await this.addressStore.getCompleteAddresses();
|
|
538
948
|
// Filter out the addresses not corresponding to accounts
|
|
539
949
|
const accounts = await this.keyStore.getAccounts();
|
|
540
950
|
return completeAddresses.filter(completeAddress =>
|
|
@@ -548,101 +958,34 @@ export class PXE {
|
|
|
548
958
|
* @param artifact - The build artifact for the contract class.
|
|
549
959
|
*/
|
|
550
960
|
public async registerContractClass(artifact: ContractArtifact): Promise<void> {
|
|
551
|
-
const
|
|
552
|
-
|
|
961
|
+
const contractClassId = await this.contractStore.addContractArtifact(artifact);
|
|
962
|
+
// Publishing the artifact's public function signatures to the node is part of "registering a class", so that
|
|
963
|
+
// node-side debugging works regardless of which entrypoint (registerContractClass or registerContract) was used.
|
|
964
|
+
const publicFunctionSignatures = artifact.functions
|
|
965
|
+
.filter(fn => fn.functionType === FunctionType.PUBLIC)
|
|
966
|
+
.map(fn => decodeFunctionSignature(fn.name, fn.parameters));
|
|
967
|
+
if (publicFunctionSignatures.length > 0) {
|
|
968
|
+
await this.nodeDebug?.registerContractFunctionSignatures(publicFunctionSignatures);
|
|
969
|
+
}
|
|
553
970
|
this.log.info(`Added contract class ${artifact.name} with id ${contractClassId}`);
|
|
554
971
|
}
|
|
555
972
|
|
|
556
973
|
/**
|
|
557
|
-
*
|
|
558
|
-
*
|
|
559
|
-
*
|
|
560
|
-
*
|
|
974
|
+
* Registers a deployed contract instance so its private state can be synced and its functions simulated. The
|
|
975
|
+
* artifact for the class the instance runs must be registered separately via {@link registerContractClass}, before
|
|
976
|
+
* or after this call; registration performs no validation, so a missing or mismatched artifact only surfaces when
|
|
977
|
+
* the contract is later simulated. This is automatically called by aztec.js when deploying a contract.
|
|
561
978
|
*
|
|
562
|
-
* @param
|
|
563
|
-
|
|
564
|
-
public async registerContract(contract: { instance: ContractInstanceWithAddress; artifact?: ContractArtifact }) {
|
|
565
|
-
const { instance } = contract;
|
|
566
|
-
let { artifact } = contract;
|
|
567
|
-
|
|
568
|
-
if (artifact) {
|
|
569
|
-
// If the user provides an artifact, validate it against the expected class id and register it
|
|
570
|
-
const contractClass = await getContractClassFromArtifact(artifact);
|
|
571
|
-
const contractClassId = contractClass.id;
|
|
572
|
-
if (!contractClassId.equals(instance.currentContractClassId)) {
|
|
573
|
-
throw new Error(
|
|
574
|
-
`Artifact does not match expected class id (computed ${contractClassId} but instance refers to ${instance.currentContractClassId})`,
|
|
575
|
-
);
|
|
576
|
-
}
|
|
577
|
-
const computedAddress = await computeContractAddressFromInstance(instance);
|
|
578
|
-
if (!computedAddress.equals(instance.address)) {
|
|
579
|
-
throw new Error('Added a contract in which the address does not match the contract instance.');
|
|
580
|
-
}
|
|
581
|
-
await this.contractDataProvider.addContractArtifact(contractClass.id, artifact);
|
|
582
|
-
|
|
583
|
-
const publicFunctionSignatures = artifact.functions
|
|
584
|
-
.filter(fn => fn.functionType === FunctionType.PUBLIC)
|
|
585
|
-
.map(fn => decodeFunctionSignature(fn.name, fn.parameters));
|
|
586
|
-
await this.node.registerContractFunctionSignatures(publicFunctionSignatures);
|
|
587
|
-
} else {
|
|
588
|
-
// Otherwise, make sure there is an artifact already registered for that class id
|
|
589
|
-
artifact = await this.contractDataProvider.getContractArtifact(instance.currentContractClassId);
|
|
590
|
-
if (!artifact) {
|
|
591
|
-
throw new Error(
|
|
592
|
-
`Artifact not found when registering an instance. Contract class: ${instance.currentContractClassId}.`,
|
|
593
|
-
);
|
|
594
|
-
}
|
|
595
|
-
}
|
|
596
|
-
|
|
597
|
-
await this.contractDataProvider.addContractInstance(instance);
|
|
598
|
-
this.log.info(
|
|
599
|
-
`Added contract ${artifact.name} at ${instance.address.toString()} with class ${instance.currentContractClassId}`,
|
|
600
|
-
);
|
|
601
|
-
}
|
|
602
|
-
|
|
603
|
-
/**
|
|
604
|
-
* Updates a deployed contract in the PXE. This is used to update the contract artifact when
|
|
605
|
-
* an update has happened, so the new code can be used in the simulation of local transactions.
|
|
606
|
-
* This is called by aztec.js when instantiating a contract in a given address with a mismatching artifact.
|
|
607
|
-
* @param contractAddress - The address of the contract to update.
|
|
608
|
-
* @param artifact - The updated artifact for the contract.
|
|
609
|
-
* @throws If the artifact's contract class is not found in the PXE or if the contract class is different from
|
|
610
|
-
* the current one (current one from the point of view of the node to which the PXE is connected).
|
|
979
|
+
* @param instance - The address preimage of the contract instance to register. The address is derived from it.
|
|
980
|
+
* @returns The address of the registered instance.
|
|
611
981
|
*/
|
|
612
|
-
public
|
|
613
|
-
//
|
|
614
|
-
// class while we're simulating it.
|
|
982
|
+
public registerContract(instance: ContractInstancePreimage): Promise<AztecAddress> {
|
|
983
|
+
// Run inside the job queue so we can't race a concurrent simulation while writing the instance to the store.
|
|
615
984
|
return this.#putInJobQueue(async () => {
|
|
616
|
-
const
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
const contractClass = await getContractClassFromArtifact(artifact);
|
|
621
|
-
await this.synchronizer.sync();
|
|
622
|
-
|
|
623
|
-
const header = await this.syncDataProvider.getBlockHeader();
|
|
624
|
-
|
|
625
|
-
const currentClassId = await readCurrentClassId(
|
|
626
|
-
contractAddress,
|
|
627
|
-
currentInstance,
|
|
628
|
-
this.node,
|
|
629
|
-
header.globalVariables.blockNumber,
|
|
630
|
-
header.globalVariables.timestamp,
|
|
631
|
-
);
|
|
632
|
-
if (!contractClass.id.equals(currentClassId)) {
|
|
633
|
-
throw new Error('Could not update contract to a class different from the current one.');
|
|
634
|
-
}
|
|
635
|
-
|
|
636
|
-
await this.contractDataProvider.addContractArtifact(contractClass.id, artifact);
|
|
637
|
-
|
|
638
|
-
const publicFunctionSignatures = artifact.functions
|
|
639
|
-
.filter(fn => fn.functionType === FunctionType.PUBLIC)
|
|
640
|
-
.map(fn => decodeFunctionSignature(fn.name, fn.parameters));
|
|
641
|
-
await this.node.registerContractFunctionSignatures(publicFunctionSignatures);
|
|
642
|
-
|
|
643
|
-
currentInstance.currentContractClassId = contractClass.id;
|
|
644
|
-
await this.contractDataProvider.addContractInstance(currentInstance);
|
|
645
|
-
this.log.info(`Updated contract ${artifact.name} at ${contractAddress.toString()} to class ${contractClass.id}`);
|
|
985
|
+
const address = await computeContractAddressFromInstance(instance);
|
|
986
|
+
await this.contractStore.addContractInstance({ ...instance, address });
|
|
987
|
+
this.log.info(`Added contract at ${address}`, { address });
|
|
988
|
+
return address;
|
|
646
989
|
});
|
|
647
990
|
}
|
|
648
991
|
|
|
@@ -651,39 +994,7 @@ export class PXE {
|
|
|
651
994
|
* @returns An array of contracts addresses registered on this PXE.
|
|
652
995
|
*/
|
|
653
996
|
public getContracts(): Promise<AztecAddress[]> {
|
|
654
|
-
return this.
|
|
655
|
-
}
|
|
656
|
-
|
|
657
|
-
/**
|
|
658
|
-
* A debugging utility to get notes based on the provided filter.
|
|
659
|
-
*
|
|
660
|
-
* Note that this should not be used in production code because the structure of notes is considered to be
|
|
661
|
-
* an implementation detail of contracts. This is only meant to be used for debugging purposes. If you need to obtain
|
|
662
|
-
* note-related information in production code, please implement a custom utility function on your contract and call
|
|
663
|
-
* that function instead (e.g. `get_balance(owner: AztecAddress) -> u128` utility function on a Token contract).
|
|
664
|
-
*
|
|
665
|
-
* @param filter - The filter to apply to the notes.
|
|
666
|
-
* @returns The requested notes.
|
|
667
|
-
*/
|
|
668
|
-
public async getNotes(filter: NotesFilter): Promise<UniqueNote[]> {
|
|
669
|
-
// We need to manually trigger private state sync to have a guarantee that all the notes are available.
|
|
670
|
-
await this.simulateUtility('sync_private_state', [], filter.contractAddress);
|
|
671
|
-
|
|
672
|
-
const noteDaos = await this.noteDataProvider.getNotes(filter);
|
|
673
|
-
|
|
674
|
-
const uniqueNotes = noteDaos.map(async dao => {
|
|
675
|
-
const completeAddresses = await this.addressDataProvider.getCompleteAddresses();
|
|
676
|
-
const completeAddressIndex = completeAddresses.findIndex(completeAddress =>
|
|
677
|
-
completeAddress.address.equals(dao.recipient),
|
|
678
|
-
);
|
|
679
|
-
const completeAddress = completeAddresses[completeAddressIndex];
|
|
680
|
-
if (completeAddress === undefined) {
|
|
681
|
-
throw new Error(`Cannot find complete address for recipient ${dao.recipient.toString()}`);
|
|
682
|
-
}
|
|
683
|
-
const recipient = completeAddress.address;
|
|
684
|
-
return new UniqueNote(dao.note, recipient, dao.contractAddress, dao.storageSlot, dao.txHash, dao.noteNonce);
|
|
685
|
-
});
|
|
686
|
-
return Promise.all(uniqueNotes);
|
|
997
|
+
return this.contractStore.getContractsAddresses();
|
|
687
998
|
}
|
|
688
999
|
|
|
689
1000
|
/**
|
|
@@ -691,29 +1002,38 @@ export class PXE {
|
|
|
691
1002
|
* (where validators prove the public portion).
|
|
692
1003
|
*
|
|
693
1004
|
* @param txRequest - An authenticated tx request ready for proving
|
|
1005
|
+
* @param scopes - Addresses whose private state and keys are accessible during private execution.
|
|
694
1006
|
* @returns A result containing the proof and public inputs of the tail circuit.
|
|
695
1007
|
* @throws If contract code not found, or public simulation reverts.
|
|
696
1008
|
* Also throws if simulatePublic is true and public simulation reverts.
|
|
697
1009
|
*/
|
|
698
|
-
public proveTx(txRequest: TxExecutionRequest): Promise<TxProvingResult> {
|
|
1010
|
+
public proveTx(txRequest: TxExecutionRequest, { scopes, senderForTags }: ProveTxOpts): Promise<TxProvingResult> {
|
|
699
1011
|
let privateExecutionResult: PrivateExecutionResult;
|
|
700
1012
|
// We disable proving concurrently mostly out of caution, since it accesses some of our stores. Proving is so
|
|
701
1013
|
// computationally demanding that it'd be rare for someone to try to do it concurrently regardless.
|
|
702
|
-
return this.#putInJobQueue(async
|
|
1014
|
+
return this.#putInJobQueue(async jobId => {
|
|
703
1015
|
const totalTimer = new Timer();
|
|
704
1016
|
try {
|
|
705
1017
|
const syncTimer = new Timer();
|
|
706
|
-
await this
|
|
1018
|
+
await this.#maybeSync();
|
|
1019
|
+
const anchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
|
|
707
1020
|
const syncTime = syncTimer.ms();
|
|
708
1021
|
const contractFunctionSimulator = this.#getSimulatorForTx();
|
|
709
|
-
privateExecutionResult = await this.#executePrivate(
|
|
1022
|
+
privateExecutionResult = await this.#executePrivate({
|
|
1023
|
+
contractFunctionSimulator,
|
|
1024
|
+
txRequest,
|
|
1025
|
+
anchorBlockHeader,
|
|
1026
|
+
scopes,
|
|
1027
|
+
jobId,
|
|
1028
|
+
senderForTags,
|
|
1029
|
+
});
|
|
710
1030
|
|
|
711
1031
|
const {
|
|
712
1032
|
publicInputs,
|
|
713
1033
|
chonkProof,
|
|
714
1034
|
executionSteps,
|
|
715
1035
|
timings: { proving } = {},
|
|
716
|
-
} = await this.#prove(txRequest, this.proofCreator, privateExecutionResult, {
|
|
1036
|
+
} = await this.#prove(txRequest, this.proofCreator, privateExecutionResult, anchorBlockHeader, {
|
|
717
1037
|
simulate: false,
|
|
718
1038
|
skipFeeEnforcement: false,
|
|
719
1039
|
profileMode: 'none',
|
|
@@ -743,15 +1063,20 @@ export class PXE {
|
|
|
743
1063
|
nodeRPCCalls: contractFunctionSimulator?.getStats().nodeRPCCalls,
|
|
744
1064
|
});
|
|
745
1065
|
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
this.
|
|
754
|
-
|
|
1066
|
+
// We keep track of which tagging indices we've used in this tx so that we don't repeat them in future txs
|
|
1067
|
+
// (which would link them) without having to rely on this tx being mined (and us seeing the indices being used
|
|
1068
|
+
// onchain).
|
|
1069
|
+
// Note that this must happen _after_ proving as it requires the proof's public inputs, from which the kernels
|
|
1070
|
+
// may have removed some logs due to note-nullifier squashing - this may lead to range of tagging indices we've
|
|
1071
|
+
// actually used to being reduced.
|
|
1072
|
+
await persistSenderTaggingIndexRangesForTx(
|
|
1073
|
+
this.senderTaggingStore,
|
|
1074
|
+
privateExecutionResult.entrypoint.taggingIndexRanges,
|
|
1075
|
+
publicInputs,
|
|
1076
|
+
() => txProvingResult.getTxHash(),
|
|
1077
|
+
jobId,
|
|
1078
|
+
this.log,
|
|
1079
|
+
);
|
|
755
1080
|
|
|
756
1081
|
return txProvingResult;
|
|
757
1082
|
} catch (err: any) {
|
|
@@ -762,20 +1087,16 @@ export class PXE {
|
|
|
762
1087
|
|
|
763
1088
|
/**
|
|
764
1089
|
* Profiles a transaction, reporting gate counts (unless disabled) and returns an execution trace.
|
|
765
|
-
*
|
|
766
|
-
* @param txRequest - An authenticated tx request ready for simulation
|
|
767
|
-
* @param msgSender - (Optional) The message sender to use for the simulation.
|
|
768
|
-
* @param skipTxValidation - (Optional) If false, this function throws if the transaction is unable to be included in a block at the current state.
|
|
1090
|
+
* @param txRequest - An authenticated tx request ready for simulation.
|
|
769
1091
|
* @returns A trace of the program execution with gate counts.
|
|
770
1092
|
* @throws If the code for the functions executed in this transaction have not been made available via `addContracts`.
|
|
771
1093
|
*/
|
|
772
1094
|
public profileTx(
|
|
773
1095
|
txRequest: TxExecutionRequest,
|
|
774
|
-
profileMode
|
|
775
|
-
skipProofGeneration: boolean = true,
|
|
1096
|
+
{ profileMode, skipProofGeneration = true, scopes, senderForTags }: ProfileTxOpts,
|
|
776
1097
|
): Promise<TxProfileResult> {
|
|
777
1098
|
// We disable concurrent profiles for consistency with simulateTx.
|
|
778
|
-
return this.#putInJobQueue(async
|
|
1099
|
+
return this.#putInJobQueue(async jobId => {
|
|
779
1100
|
const totalTimer = new Timer();
|
|
780
1101
|
try {
|
|
781
1102
|
const txInfo = {
|
|
@@ -791,16 +1112,25 @@ export class PXE {
|
|
|
791
1112
|
txInfo,
|
|
792
1113
|
);
|
|
793
1114
|
const syncTimer = new Timer();
|
|
794
|
-
await this
|
|
1115
|
+
await this.#maybeSync();
|
|
1116
|
+
const anchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
|
|
795
1117
|
const syncTime = syncTimer.ms();
|
|
796
1118
|
|
|
797
1119
|
const contractFunctionSimulator = this.#getSimulatorForTx();
|
|
798
|
-
const privateExecutionResult = await this.#executePrivate(
|
|
1120
|
+
const privateExecutionResult = await this.#executePrivate({
|
|
1121
|
+
contractFunctionSimulator,
|
|
1122
|
+
txRequest,
|
|
1123
|
+
anchorBlockHeader,
|
|
1124
|
+
scopes,
|
|
1125
|
+
jobId,
|
|
1126
|
+
senderForTags,
|
|
1127
|
+
});
|
|
799
1128
|
|
|
800
1129
|
const { executionSteps, timings: { proving } = {} } = await this.#prove(
|
|
801
1130
|
txRequest,
|
|
802
1131
|
this.proofCreator,
|
|
803
1132
|
privateExecutionResult,
|
|
1133
|
+
anchorBlockHeader,
|
|
804
1134
|
{
|
|
805
1135
|
simulate: skipProofGeneration,
|
|
806
1136
|
skipFeeEnforcement: false,
|
|
@@ -852,12 +1182,7 @@ export class PXE {
|
|
|
852
1182
|
* In that case, the transaction returned is only potentially ready to be sent to the network for execution.
|
|
853
1183
|
*
|
|
854
1184
|
*
|
|
855
|
-
* @param txRequest - An authenticated tx request ready for simulation
|
|
856
|
-
* @param simulatePublic - Whether to simulate the public part of the transaction.
|
|
857
|
-
* @param skipTxValidation - (Optional) If false, this function throws if the transaction is unable to be included in a block at the current state.
|
|
858
|
-
* @param skipFeeEnforcement - (Optional) If false, fees are enforced.
|
|
859
|
-
* @param overrides - (Optional) State overrides for the simulation, such as msgSender, contract instances and artifacts.
|
|
860
|
-
* @param scopes - (Optional) The accounts whose notes we can access in this call. Currently optional and will default to all.
|
|
1185
|
+
* @param txRequest - An authenticated tx request ready for simulation.
|
|
861
1186
|
* @returns A simulated transaction result object that includes public and private return values.
|
|
862
1187
|
* @throws If the code for the functions executed in this transaction have not been made available via `addContracts`.
|
|
863
1188
|
* Also throws if simulatePublic is true and public simulation reverts.
|
|
@@ -866,16 +1191,20 @@ export class PXE {
|
|
|
866
1191
|
*/
|
|
867
1192
|
public simulateTx(
|
|
868
1193
|
txRequest: TxExecutionRequest,
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
1194
|
+
{
|
|
1195
|
+
simulatePublic,
|
|
1196
|
+
skipTxValidation = false,
|
|
1197
|
+
skipFeeEnforcement = false,
|
|
1198
|
+
skipKernels = true,
|
|
1199
|
+
overrides,
|
|
1200
|
+
scopes,
|
|
1201
|
+
senderForTags,
|
|
1202
|
+
}: SimulateTxOpts,
|
|
874
1203
|
): Promise<TxSimulationResult> {
|
|
875
1204
|
// We disable concurrent simulations since those might execute oracles which read and write to the PXE stores (e.g.
|
|
876
1205
|
// to the capsules), and we need to prevent concurrent runs from interfering with one another (e.g. attempting to
|
|
877
1206
|
// delete the same read value, or reading values that another simulation is currently modifying).
|
|
878
|
-
return this.#putInJobQueue(async
|
|
1207
|
+
return this.#putInJobQueue(async jobId => {
|
|
879
1208
|
try {
|
|
880
1209
|
const totalTimer = new Timer();
|
|
881
1210
|
const txInfo = {
|
|
@@ -891,40 +1220,49 @@ export class PXE {
|
|
|
891
1220
|
txInfo,
|
|
892
1221
|
);
|
|
893
1222
|
const syncTimer = new Timer();
|
|
894
|
-
await this
|
|
1223
|
+
await this.#maybeSync();
|
|
1224
|
+
const anchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
|
|
895
1225
|
const syncTime = syncTimer.ms();
|
|
896
1226
|
|
|
1227
|
+
if (overrides?.contracts && Object.keys(overrides.contracts).length > 0 && !skipKernels) {
|
|
1228
|
+
throw new Error(
|
|
1229
|
+
'Simulating with overridden contracts is not compatible with kernel execution. Please set skipKernels to true when simulating with overridden contracts.',
|
|
1230
|
+
);
|
|
1231
|
+
}
|
|
897
1232
|
const contractFunctionSimulator = this.#getSimulatorForTx(overrides);
|
|
898
|
-
// Temporary: in case there are overrides, we have to skip the kernels or validations
|
|
899
|
-
// will fail. Consider handing control to the user/wallet on whether they want to run them
|
|
900
|
-
// or not.
|
|
901
|
-
const skipKernels = overrides?.contracts !== undefined && Object.keys(overrides.contracts ?? {}).length > 0;
|
|
902
1233
|
|
|
903
1234
|
// Execution of private functions only; no proving, and no kernel logic.
|
|
904
|
-
const privateExecutionResult = await this.#executePrivate(
|
|
1235
|
+
const privateExecutionResult = await this.#executePrivate({
|
|
1236
|
+
contractFunctionSimulator,
|
|
1237
|
+
txRequest,
|
|
1238
|
+
anchorBlockHeader,
|
|
1239
|
+
scopes,
|
|
1240
|
+
jobId,
|
|
1241
|
+
senderForTags,
|
|
1242
|
+
});
|
|
905
1243
|
|
|
906
1244
|
let publicInputs: PrivateKernelTailCircuitPublicInputs | undefined;
|
|
907
1245
|
let executionSteps: PrivateExecutionStep[] = [];
|
|
908
1246
|
|
|
909
1247
|
if (skipKernels) {
|
|
910
|
-
// According to the protocol rules, the nonce generator for the note hashes
|
|
911
|
-
// can either be the first nullifier in the tx or the hash of the initial tx request
|
|
912
|
-
// if there are none.
|
|
913
|
-
const nonceGenerator = privateExecutionResult.firstNullifier.equals(Fr.ZERO)
|
|
914
|
-
? await txRequest.toTxRequest().hash()
|
|
915
|
-
: privateExecutionResult.firstNullifier;
|
|
916
1248
|
({ publicInputs, executionSteps } = await generateSimulatedProvingResult(
|
|
917
1249
|
privateExecutionResult,
|
|
918
|
-
|
|
919
|
-
this.
|
|
1250
|
+
(addr, sel) => this.#getDebugFunctionName(addr, sel, anchorBlockHeader),
|
|
1251
|
+
this.node,
|
|
920
1252
|
));
|
|
921
1253
|
} else {
|
|
922
1254
|
// Kernel logic, plus proving of all private functions and kernels.
|
|
923
|
-
({ publicInputs, executionSteps } = await this.#prove(
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
1255
|
+
({ publicInputs, executionSteps } = await this.#prove(
|
|
1256
|
+
txRequest,
|
|
1257
|
+
this.proofCreator,
|
|
1258
|
+
privateExecutionResult,
|
|
1259
|
+
anchorBlockHeader,
|
|
1260
|
+
{
|
|
1261
|
+
simulate: true,
|
|
1262
|
+
skipFeeEnforcement,
|
|
1263
|
+
profileMode: 'none',
|
|
1264
|
+
},
|
|
1265
|
+
));
|
|
928
1266
|
}
|
|
929
1267
|
|
|
930
1268
|
const privateSimulationResult = new PrivateSimulationResult(privateExecutionResult, publicInputs);
|
|
@@ -933,8 +1271,11 @@ export class PXE {
|
|
|
933
1271
|
let publicOutput: PublicSimulationOutput | undefined;
|
|
934
1272
|
if (simulatePublic && publicInputs.forPublic) {
|
|
935
1273
|
const publicSimulationTimer = new Timer();
|
|
936
|
-
publicOutput = await this.#simulatePublicCalls(simulatedTx, skipFeeEnforcement);
|
|
1274
|
+
publicOutput = await this.#simulatePublicCalls(simulatedTx, skipFeeEnforcement, overrides);
|
|
937
1275
|
publicSimulationTime = publicSimulationTimer.ms();
|
|
1276
|
+
if (publicOutput?.debugLogs?.length) {
|
|
1277
|
+
await displayDebugLogs(publicOutput.debugLogs, addr => this.#getDebugContractName(addr, anchorBlockHeader));
|
|
1278
|
+
}
|
|
938
1279
|
}
|
|
939
1280
|
|
|
940
1281
|
let validationTime: number | undefined;
|
|
@@ -943,7 +1284,8 @@ export class PXE {
|
|
|
943
1284
|
const validationResult = await this.node.isValidTx(simulatedTx, { isSimulation: true, skipFeeEnforcement });
|
|
944
1285
|
validationTime = validationTimer.ms();
|
|
945
1286
|
if (validationResult.result === 'invalid') {
|
|
946
|
-
|
|
1287
|
+
const reason = validationResult.reason.length > 0 ? ` Reason: ${validationResult.reason.join(', ')}` : '';
|
|
1288
|
+
throw new Error(`The simulated transaction is unable to be added to state and is invalid.${reason}`);
|
|
947
1289
|
}
|
|
948
1290
|
}
|
|
949
1291
|
|
|
@@ -994,55 +1336,55 @@ export class PXE {
|
|
|
994
1336
|
inspect(txRequest),
|
|
995
1337
|
`simulatePublic=${simulatePublic}`,
|
|
996
1338
|
`skipTxValidation=${skipTxValidation}`,
|
|
997
|
-
`scopes=${scopes
|
|
1339
|
+
`scopes=${scopes.map(s => s.toString()).join(', ')}`,
|
|
998
1340
|
);
|
|
999
1341
|
}
|
|
1000
1342
|
});
|
|
1001
1343
|
}
|
|
1002
1344
|
|
|
1003
1345
|
/**
|
|
1004
|
-
*
|
|
1005
|
-
*
|
|
1006
|
-
* @param functionName - The name of the utility contract function to be called.
|
|
1007
|
-
* @param args - The arguments to be provided to the function.
|
|
1008
|
-
* @param to - The address of the contract to be called.
|
|
1009
|
-
* @param authwits - (Optional) The authentication witnesses required for the function call.
|
|
1010
|
-
* @param from - (Optional) The msg sender to set for the call.
|
|
1011
|
-
* @param scopes - (Optional) The accounts whose notes we can access in this call. Currently optional and will
|
|
1012
|
-
* default to all.
|
|
1013
|
-
* @returns The result of the utility function call, structured based on the function ABI.
|
|
1346
|
+
* Executes a contract utility function.
|
|
1347
|
+
* @param call - The function call containing the function details, arguments, and target contract address.
|
|
1014
1348
|
*/
|
|
1015
|
-
public
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
_from?: AztecAddress,
|
|
1021
|
-
scopes?: AztecAddress[],
|
|
1022
|
-
): Promise<UtilitySimulationResult> {
|
|
1023
|
-
// We disable concurrent simulations since those might execute oracles which read and write to the PXE stores (e.g.
|
|
1349
|
+
public executeUtility(
|
|
1350
|
+
call: FunctionCall,
|
|
1351
|
+
{ authwits, scopes }: ExecuteUtilityOpts = { scopes: [] },
|
|
1352
|
+
): Promise<UtilityExecutionResult> {
|
|
1353
|
+
// We disable concurrent executions since those might execute oracles which read and write to the PXE stores (e.g.
|
|
1024
1354
|
// to the capsules), and we need to prevent concurrent runs from interfering with one another (e.g. attempting to
|
|
1025
|
-
// delete the same read value, or reading values that another
|
|
1026
|
-
return this.#putInJobQueue(async
|
|
1355
|
+
// delete the same read value, or reading values that another execution is currently modifying).
|
|
1356
|
+
return this.#putInJobQueue(async jobId => {
|
|
1027
1357
|
try {
|
|
1028
1358
|
const totalTimer = new Timer();
|
|
1029
1359
|
const syncTimer = new Timer();
|
|
1030
|
-
await this
|
|
1360
|
+
await this.#maybeSync();
|
|
1031
1361
|
const syncTime = syncTimer.ms();
|
|
1032
|
-
const functionCall = await this.#getFunctionCall(functionName, args, to);
|
|
1033
1362
|
const functionTimer = new Timer();
|
|
1034
1363
|
const contractFunctionSimulator = this.#getSimulatorForTx();
|
|
1035
|
-
|
|
1364
|
+
|
|
1365
|
+
const anchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
|
|
1366
|
+
await this.contractSyncService.ensureContractSynced(
|
|
1367
|
+
call.to,
|
|
1368
|
+
call.selector,
|
|
1369
|
+
(privateSyncCall, execScopes) =>
|
|
1370
|
+
this.#executeUtility(contractFunctionSimulator, privateSyncCall, [], execScopes, jobId),
|
|
1371
|
+
anchorBlockHeader,
|
|
1372
|
+
jobId,
|
|
1373
|
+
scopes,
|
|
1374
|
+
);
|
|
1375
|
+
|
|
1376
|
+
const { result: executionResult, offchainEffects } = await this.#executeUtility(
|
|
1036
1377
|
contractFunctionSimulator,
|
|
1037
|
-
|
|
1378
|
+
call,
|
|
1038
1379
|
authwits ?? [],
|
|
1039
1380
|
scopes,
|
|
1381
|
+
jobId,
|
|
1040
1382
|
);
|
|
1041
1383
|
const functionTime = functionTimer.ms();
|
|
1042
1384
|
|
|
1043
1385
|
const totalTime = totalTimer.ms();
|
|
1044
1386
|
|
|
1045
|
-
const perFunction = [{ functionName, time: functionTime }];
|
|
1387
|
+
const perFunction = [{ functionName: call.name, time: functionTime }];
|
|
1046
1388
|
|
|
1047
1389
|
const timings: SimulationTimings = {
|
|
1048
1390
|
total: totalTime,
|
|
@@ -1052,13 +1394,19 @@ export class PXE {
|
|
|
1052
1394
|
};
|
|
1053
1395
|
|
|
1054
1396
|
const simulationStats = contractFunctionSimulator.getStats();
|
|
1055
|
-
return {
|
|
1397
|
+
return {
|
|
1398
|
+
result: executionResult,
|
|
1399
|
+
offchainEffects,
|
|
1400
|
+
anchorBlockTimestamp: anchorBlockHeader.globalVariables.timestamp,
|
|
1401
|
+
stats: { timings, nodeRPCCalls: simulationStats.nodeRPCCalls },
|
|
1402
|
+
};
|
|
1056
1403
|
} catch (err: any) {
|
|
1404
|
+
const { to, name, args } = call;
|
|
1057
1405
|
const stringifiedArgs = args.map(arg => arg.toString()).join(', ');
|
|
1058
1406
|
throw this.#contextualizeError(
|
|
1059
1407
|
err,
|
|
1060
|
-
`
|
|
1061
|
-
`scopes=${scopes
|
|
1408
|
+
`executeUtility ${to}:${name}(${stringifiedArgs})`,
|
|
1409
|
+
`scopes=${scopes.map(s => s.toString()).join(', ')}`,
|
|
1062
1410
|
);
|
|
1063
1411
|
}
|
|
1064
1412
|
});
|
|
@@ -1066,48 +1414,58 @@ export class PXE {
|
|
|
1066
1414
|
|
|
1067
1415
|
/**
|
|
1068
1416
|
* Returns the private events given search parameters.
|
|
1069
|
-
* @param
|
|
1070
|
-
* @param
|
|
1071
|
-
*
|
|
1072
|
-
*
|
|
1073
|
-
*
|
|
1074
|
-
*
|
|
1417
|
+
* @param eventSelector - Event selector to search for.
|
|
1418
|
+
* @param filter
|
|
1419
|
+
* contractAddress - The address of the contract to get events from. Required.
|
|
1420
|
+
* scopes - One or more event scope addresses to filter by. Required.
|
|
1421
|
+
* fromBlock - The block number to search from (inclusive). Optional. If provided, it must be >= 0.
|
|
1422
|
+
* Defaults to 0.
|
|
1423
|
+
* If toBlock is defined but fromBlock is not, fromBlock defaults to toBlock - 1.
|
|
1424
|
+
* toBlock - The block number to search up to (exclusive). Optional. If provided, it must be > 0.
|
|
1425
|
+
* Defaults to the latest known block to PXE + 1.
|
|
1426
|
+
* @returns - The packed events with block and tx metadata.
|
|
1075
1427
|
*/
|
|
1076
|
-
public async getPrivateEvents
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1428
|
+
public async getPrivateEvents(
|
|
1429
|
+
eventSelector: EventSelector,
|
|
1430
|
+
filter: PrivateEventFilter,
|
|
1431
|
+
): Promise<PackedPrivateEvent[]> {
|
|
1432
|
+
let anchorBlockNumber: BlockNumber;
|
|
1433
|
+
|
|
1434
|
+
await this.#putInJobQueue(async jobId => {
|
|
1435
|
+
await this.#maybeSync();
|
|
1436
|
+
|
|
1437
|
+
const anchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
|
|
1438
|
+
anchorBlockNumber = anchorBlockHeader.getBlockNumber();
|
|
1439
|
+
|
|
1440
|
+
const contractFunctionSimulator = this.#getSimulatorForTx();
|
|
1441
|
+
|
|
1442
|
+
await this.contractSyncService.ensureContractSynced(
|
|
1443
|
+
filter.contractAddress,
|
|
1444
|
+
null,
|
|
1445
|
+
async (privateSyncCall, execScopes) =>
|
|
1446
|
+
await this.#executeUtility(contractFunctionSimulator, privateSyncCall, [], execScopes, jobId),
|
|
1447
|
+
anchorBlockHeader,
|
|
1448
|
+
jobId,
|
|
1449
|
+
filter.scopes,
|
|
1450
|
+
);
|
|
1451
|
+
});
|
|
1091
1452
|
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
from,
|
|
1095
|
-
numBlocks,
|
|
1096
|
-
recipients,
|
|
1097
|
-
eventMetadataDef.eventSelector,
|
|
1098
|
-
);
|
|
1453
|
+
// anchorBlockNumber is set during the job and fixed to whatever it is after a block sync
|
|
1454
|
+
const sanitizedFilter = new PrivateEventFilterValidator(anchorBlockNumber!).validate(filter);
|
|
1099
1455
|
|
|
1100
|
-
|
|
1101
|
-
|
|
1456
|
+
this.log.debug(
|
|
1457
|
+
`Getting private events for ${sanitizedFilter.contractAddress.toString()} from ${sanitizedFilter.fromBlock} to ${sanitizedFilter.toBlock}`,
|
|
1102
1458
|
);
|
|
1103
1459
|
|
|
1104
|
-
return
|
|
1460
|
+
return this.privateEventStore.getPrivateEvents(eventSelector, sanitizedFilter);
|
|
1105
1461
|
}
|
|
1106
1462
|
|
|
1107
1463
|
/**
|
|
1108
|
-
* Stops the PXE's job queue.
|
|
1464
|
+
* Stops the PXE's job queue and closes the backing store.
|
|
1109
1465
|
*/
|
|
1110
|
-
public stop(): Promise<void> {
|
|
1111
|
-
|
|
1466
|
+
public async stop(): Promise<void> {
|
|
1467
|
+
await this.jobQueue.end();
|
|
1468
|
+
await this.blockStateSynchronizer.stop();
|
|
1469
|
+
await this.db.close();
|
|
1112
1470
|
}
|
|
1113
1471
|
}
|