@aztec/pxe 0.0.1-commit.993d240 → 0.0.1-commit.9a89641
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 +2 -12
- package/dest/bin/check_oracle_version.d.ts.map +1 -1
- package/dest/bin/check_oracle_version.js +9 -122
- package/dest/bin/index.d.ts +2 -2
- package/dest/bin/index.d.ts.map +1 -1
- package/dest/bin/index.js +1 -1
- package/dest/bin/oracle_version_helpers.d.ts +20 -0
- package/dest/bin/oracle_version_helpers.d.ts.map +1 -0
- package/dest/bin/oracle_version_helpers.js +25 -0
- package/dest/block_synchronizer/block_stream_source.d.ts +5 -5
- package/dest/block_synchronizer/block_stream_source.d.ts.map +1 -1
- package/dest/block_synchronizer/block_stream_source.js +4 -29
- package/dest/block_synchronizer/block_synchronizer.d.ts +17 -15
- package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -1
- package/dest/block_synchronizer/block_synchronizer.js +41 -18
- package/dest/config/index.d.ts +2 -1
- package/dest/config/index.d.ts.map +1 -1
- package/dest/config/index.js +1 -0
- package/dest/config/package_info.js +1 -1
- package/dest/contract/contract_class_service.d.ts +24 -0
- package/dest/contract/contract_class_service.d.ts.map +1 -0
- package/dest/contract/contract_class_service.js +36 -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_sync → contract}/contract_sync_service.js +26 -45
- 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/skip_sync_contracts.d.ts +11 -0
- package/dest/contract/skip_sync_contracts.d.ts.map +1 -0
- package/dest/contract/skip_sync_contracts.js +18 -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/contract_function_simulator.d.ts +19 -25
- package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.js +63 -49
- package/dest/contract_function_simulator/execution_note_cache.d.ts +4 -10
- package/dest/contract_function_simulator/execution_note_cache.d.ts.map +1 -1
- package/dest/contract_function_simulator/execution_note_cache.js +8 -28
- package/dest/contract_function_simulator/index.d.ts +24 -6
- package/dest/contract_function_simulator/index.d.ts.map +1 -1
- package/dest/contract_function_simulator/index.js +9 -4
- package/dest/contract_function_simulator/noir-structs/bounded_vec.d.ts +8 -27
- package/dest/contract_function_simulator/noir-structs/bounded_vec.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/bounded_vec.js +8 -23
- package/dest/contract_function_simulator/noir-structs/contract_class_log_data.d.ts +9 -0
- package/dest/contract_function_simulator/noir-structs/contract_class_log_data.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/contract_class_log_data.js +1 -0
- package/dest/contract_function_simulator/noir-structs/embedded_curve_point.d.ts +7 -0
- package/dest/contract_function_simulator/noir-structs/embedded_curve_point.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/embedded_curve_point.js +1 -0
- package/dest/contract_function_simulator/noir-structs/ephemeral_array.d.ts +37 -0
- package/dest/contract_function_simulator/noir-structs/ephemeral_array.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/ephemeral_array.js +59 -0
- package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts +3 -2
- 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 +2 -2
- 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 +11 -12
- 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 +6 -49
- package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts +10 -8
- 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 +1 -60
- package/dest/contract_function_simulator/noir-structs/note_data.d.ts +27 -0
- package/dest/contract_function_simulator/noir-structs/note_data.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/note_data.js +3 -0
- package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +3 -2
- 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 +3 -3
- package/dest/contract_function_simulator/noir-structs/option.d.ts +9 -11
- package/dest/contract_function_simulator/noir-structs/option.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/option.js +18 -13
- package/dest/contract_function_simulator/noir-structs/origin_block.d.ts +11 -0
- package/dest/contract_function_simulator/noir-structs/origin_block.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/origin_block.js +5 -0
- package/dest/contract_function_simulator/noir-structs/pending_tagged_log.d.ts +11 -0
- package/dest/contract_function_simulator/noir-structs/pending_tagged_log.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/pending_tagged_log.js +4 -0
- package/dest/contract_function_simulator/noir-structs/provided_secret.d.ts +8 -0
- package/dest/contract_function_simulator/noir-structs/provided_secret.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/provided_secret.js +1 -0
- package/dest/contract_function_simulator/noir-structs/resolved_tagging_strategy.d.ts +28 -0
- package/dest/contract_function_simulator/noir-structs/resolved_tagging_strategy.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/resolved_tagging_strategy.js +50 -0
- package/dest/contract_function_simulator/noir-structs/resolved_tx.d.ts +19 -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 +9 -0
- package/dest/contract_function_simulator/noir-structs/tx_effect_data.d.ts +15 -0
- package/dest/contract_function_simulator/noir-structs/tx_effect_data.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/tx_effect_data.js +5 -0
- package/dest/contract_function_simulator/noir-structs/utility_context.d.ts +6 -11
- package/dest/contract_function_simulator/noir-structs/utility_context.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/utility_context.js +1 -20
- package/dest/contract_function_simulator/oracle/acir_callback.d.ts +21 -0
- package/dest/contract_function_simulator/oracle/acir_callback.d.ts.map +1 -0
- package/dest/contract_function_simulator/oracle/acir_callback.js +115 -0
- package/dest/contract_function_simulator/oracle/index.d.ts +2 -13
- package/dest/contract_function_simulator/oracle/index.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/index.js +1 -1
- package/dest/contract_function_simulator/oracle/interfaces.d.ts +15 -114
- package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/interfaces.js +2 -2
- package/dest/contract_function_simulator/oracle/legacy_oracle_registry.d.ts +39 -0
- package/dest/contract_function_simulator/oracle/legacy_oracle_registry.d.ts.map +1 -0
- package/dest/contract_function_simulator/oracle/legacy_oracle_registry.js +107 -0
- package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts +3 -14
- package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.js +1 -24
- package/dest/contract_function_simulator/oracle/oracle_registry.d.ts +92 -100
- package/dest/contract_function_simulator/oracle/oracle_registry.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/oracle_registry.js +296 -479
- package/dest/contract_function_simulator/oracle/oracle_type_mappings.d.ts +274 -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 +1253 -0
- package/dest/contract_function_simulator/oracle/private_execution.d.ts +1 -1
- package/dest/contract_function_simulator/oracle/private_execution.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution.js +2 -3
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +32 -21
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.js +152 -49
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +97 -37
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +376 -138
- 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/debug/pxe_debug_utils.d.ts +2 -2
- package/dest/debug/pxe_debug_utils.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/index.d.ts +2 -1
- package/dest/entrypoints/client/bundle/index.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/index.js +1 -0
- package/dest/entrypoints/client/bundle/utils.d.ts +1 -1
- package/dest/entrypoints/client/bundle/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/utils.js +17 -6
- package/dest/entrypoints/client/lazy/index.d.ts +2 -1
- package/dest/entrypoints/client/lazy/index.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/index.js +1 -0
- package/dest/entrypoints/client/lazy/utils.d.ts +1 -1
- package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/utils.js +17 -6
- package/dest/entrypoints/client/store.d.ts +14 -0
- package/dest/entrypoints/client/store.d.ts.map +1 -0
- package/dest/entrypoints/client/store.js +42 -0
- package/dest/entrypoints/pxe_creation_options.d.ts +9 -3
- package/dest/entrypoints/pxe_creation_options.d.ts.map +1 -1
- package/dest/entrypoints/server/index.d.ts +6 -3
- package/dest/entrypoints/server/index.d.ts.map +1 -1
- package/dest/entrypoints/server/index.js +4 -2
- package/dest/entrypoints/server/store.d.ts +18 -0
- package/dest/entrypoints/server/store.d.ts.map +1 -0
- package/dest/entrypoints/server/store.js +28 -0
- package/dest/entrypoints/server/utils.d.ts +1 -1
- package/dest/entrypoints/server/utils.d.ts.map +1 -1
- package/dest/entrypoints/server/utils.js +16 -4
- package/dest/error_enriching.d.ts +5 -3
- package/dest/error_enriching.d.ts.map +1 -1
- package/dest/error_enriching.js +13 -11
- package/dest/events/event_service.d.ts +13 -6
- package/dest/events/event_service.d.ts.map +1 -1
- package/dest/events/event_service.js +13 -13
- package/dest/hooks/execution_hooks.d.ts +31 -11
- package/dest/hooks/execution_hooks.d.ts.map +1 -1
- package/dest/hooks/execution_hooks.js +3 -3
- package/dest/hooks/index.d.ts +4 -3
- package/dest/hooks/index.d.ts.map +1 -1
- 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 +50 -0
- package/dest/hooks/resolve_tagging_secret_strategy.d.ts.map +1 -0
- package/dest/hooks/resolve_tagging_secret_strategy.js +3 -0
- package/dest/logs/log_service.d.ts +18 -8
- package/dest/logs/log_service.d.ts.map +1 -1
- package/dest/logs/log_service.js +93 -45
- package/dest/messages/tx_resolver_service.d.ts +28 -0
- package/dest/messages/tx_resolver_service.d.ts.map +1 -0
- package/dest/messages/tx_resolver_service.js +61 -0
- package/dest/node/benchmarked_node.d.ts +20 -0
- package/dest/node/benchmarked_node.d.ts.map +1 -0
- package/dest/node/benchmarked_node.js +94 -0
- package/dest/node/caching_aztec_node.d.ts +24 -0
- package/dest/node/caching_aztec_node.d.ts.map +1 -0
- package/dest/node/caching_aztec_node.js +267 -0
- package/dest/notes/note_service.d.ts +13 -7
- package/dest/notes/note_service.d.ts.map +1 -1
- package/dest/notes/note_service.js +10 -10
- package/dest/oracle_version.d.ts +3 -3
- package/dest/oracle_version.js +8 -8
- package/dest/private_kernel/batch_planner.d.ts +1 -1
- package/dest/private_kernel/batch_planner.d.ts.map +1 -1
- package/dest/private_kernel/batch_planner.js +1 -1
- package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts +1 -1
- package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts.map +1 -1
- package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.js +6 -2
- package/dest/private_kernel/hints/test_utils.js +1 -1
- package/dest/private_kernel/private_kernel_execution_prover.d.ts +1 -1
- package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_execution_prover.js +61 -40
- package/dest/private_kernel/private_kernel_oracle.d.ts +4 -2
- package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_oracle.js +17 -5
- package/dest/pxe.d.ts +114 -48
- package/dest/pxe.d.ts.map +1 -1
- package/dest/pxe.js +251 -148
- package/dest/storage/allowed_scopes.d.ts +6 -0
- package/dest/storage/allowed_scopes.d.ts.map +1 -0
- package/dest/storage/allowed_scopes.js +7 -0
- package/dest/storage/anchor_block_store/anchor_block_store.d.ts +9 -6
- package/dest/storage/anchor_block_store/anchor_block_store.d.ts.map +1 -1
- package/dest/storage/anchor_block_store/anchor_block_store.js +8 -6
- package/dest/storage/backwards_compatibility_tests/schema_tests.d.ts +1 -1
- package/dest/storage/backwards_compatibility_tests/schema_tests.d.ts.map +1 -1
- package/dest/storage/backwards_compatibility_tests/schema_tests.js +129 -49
- package/dest/storage/capsule_store/capsule_service.d.ts +1 -1
- package/dest/storage/capsule_store/capsule_service.d.ts.map +1 -1
- package/dest/storage/capsule_store/capsule_service.js +6 -9
- package/dest/storage/contract_store/contract_store.d.ts +27 -24
- package/dest/storage/contract_store/contract_store.d.ts.map +1 -1
- package/dest/storage/contract_store/contract_store.js +66 -77
- 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 +59 -0
- package/dest/storage/fact_store/origin_state.d.ts.map +1 -0
- package/dest/storage/fact_store/origin_state.js +60 -0
- package/dest/storage/fact_store/stored_fact.d.ts +32 -0
- package/dest/storage/fact_store/stored_fact.d.ts.map +1 -0
- package/dest/storage/fact_store/stored_fact.js +64 -0
- package/dest/storage/index.d.ts +3 -2
- package/dest/storage/index.d.ts.map +1 -1
- package/dest/storage/index.js +2 -1
- package/dest/storage/metadata.d.ts +2 -2
- package/dest/storage/metadata.d.ts.map +1 -1
- package/dest/storage/metadata.js +1 -1
- package/dest/storage/note_store/note_store.d.ts +42 -33
- package/dest/storage/note_store/note_store.d.ts.map +1 -1
- package/dest/storage/note_store/note_store.js +197 -168
- package/dest/storage/note_store/stored_note.d.ts +3 -8
- package/dest/storage/note_store/stored_note.d.ts.map +1 -1
- package/dest/storage/note_store/stored_note.js +4 -20
- package/dest/storage/open_pxe_stores.d.ts +5 -3
- package/dest/storage/open_pxe_stores.d.ts.map +1 -1
- package/dest/storage/open_pxe_stores.js +5 -3
- package/dest/storage/private_event_store/private_event_store.d.ts +13 -16
- package/dest/storage/private_event_store/private_event_store.d.ts.map +1 -1
- package/dest/storage/private_event_store/private_event_store.js +40 -43
- package/dest/storage/store_identity.d.ts +35 -0
- package/dest/storage/store_identity.d.ts.map +1 -0
- package/dest/storage/store_identity.js +44 -0
- package/dest/storage/tagging_store/index.d.ts +2 -2
- package/dest/storage/tagging_store/index.d.ts.map +1 -1
- package/dest/storage/tagging_store/index.js +1 -1
- package/dest/storage/tagging_store/sender_tagging_store.d.ts +41 -10
- package/dest/storage/tagging_store/sender_tagging_store.d.ts.map +1 -1
- package/dest/storage/tagging_store/sender_tagging_store.js +81 -29
- 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 +11 -2
- package/dest/tagging/constants.d.ts.map +1 -1
- package/dest/tagging/constants.js +38 -10
- package/dest/tagging/get_all_logs_by_tags.d.ts +29 -8
- package/dest/tagging/get_all_logs_by_tags.d.ts.map +1 -1
- package/dest/tagging/get_all_logs_by_tags.js +29 -10
- package/dest/tagging/index.d.ts +3 -3
- package/dest/tagging/index.d.ts.map +1 -1
- package/dest/tagging/index.js +2 -2
- package/dest/tagging/recipient_sync/sync_tagged_private_logs.d.ts +27 -9
- package/dest/tagging/recipient_sync/sync_tagged_private_logs.d.ts.map +1 -1
- package/dest/tagging/recipient_sync/sync_tagged_private_logs.js +104 -33
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts +6 -3
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts.map +1 -1
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.js +23 -36
- package/dest/tagging/sender_sync/utils/classify_pending_txs.d.ts +22 -0
- package/dest/tagging/sender_sync/utils/classify_pending_txs.d.ts.map +1 -0
- package/dest/tagging/sender_sync/utils/classify_pending_txs.js +61 -0
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts +15 -5
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts.map +1 -1
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.js +36 -35
- package/dest/tagging/sender_sync/utils/resolve_pending_txs.d.ts +29 -0
- package/dest/tagging/sender_sync/utils/resolve_pending_txs.d.ts.map +1 -0
- package/dest/tagging/sender_sync/utils/resolve_pending_txs.js +41 -0
- package/dest/tagging/sender_sync/utils/test_utils.d.ts +16 -0
- package/dest/tagging/sender_sync/utils/test_utils.d.ts.map +1 -0
- package/dest/tagging/sender_sync/utils/test_utils.js +24 -0
- package/dest/tagging/testing/tag_query_test_utils.d.ts +6 -0
- package/dest/tagging/testing/tag_query_test_utils.d.ts.map +1 -0
- package/dest/tagging/testing/tag_query_test_utils.js +10 -0
- package/package.json +17 -17
- package/src/bin/check_oracle_version.ts +8 -151
- package/src/bin/index.ts +1 -1
- package/src/bin/oracle_version_helpers.ts +30 -0
- package/src/block_synchronizer/block_stream_source.ts +6 -45
- package/src/block_synchronizer/block_synchronizer.ts +54 -30
- package/src/config/index.ts +1 -0
- package/src/config/package_info.ts +1 -1
- package/src/contract/contract_class_service.ts +45 -0
- package/src/{contract_sync → contract}/contract_sync_service.ts +37 -50
- package/src/contract/helpers.ts +35 -0
- package/src/contract/skip_sync_contracts.ts +23 -0
- package/src/contract_function_simulator/anchored_contract_data.ts +74 -0
- package/src/contract_function_simulator/contract_function_simulator.ts +96 -59
- package/src/contract_function_simulator/execution_note_cache.ts +8 -29
- package/src/contract_function_simulator/index.ts +87 -5
- package/src/contract_function_simulator/noir-structs/bounded_vec.ts +12 -24
- 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 +3 -3
- 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 +20 -46
- package/src/contract_function_simulator/noir-structs/log_retrieval_response.ts +13 -60
- package/src/contract_function_simulator/noir-structs/note_data.ts +27 -0
- package/src/contract_function_simulator/noir-structs/note_validation_request.ts +4 -4
- package/src/contract_function_simulator/noir-structs/option.ts +17 -11
- package/src/contract_function_simulator/noir-structs/origin_block.ts +8 -0
- package/src/contract_function_simulator/noir-structs/pending_tagged_log.ts +12 -0
- package/src/contract_function_simulator/noir-structs/provided_secret.ts +5 -0
- package/src/contract_function_simulator/noir-structs/resolved_tagging_strategy.ts +66 -0
- package/src/contract_function_simulator/noir-structs/resolved_tx.ts +19 -0
- package/src/contract_function_simulator/noir-structs/tx_effect_data.ts +16 -0
- package/src/contract_function_simulator/noir-structs/utility_context.ts +5 -17
- package/src/contract_function_simulator/oracle/acir_callback.ts +154 -0
- package/src/contract_function_simulator/oracle/index.ts +1 -15
- package/src/contract_function_simulator/oracle/interfaces.ts +11 -189
- package/src/contract_function_simulator/oracle/legacy_oracle_registry.ts +147 -0
- package/src/contract_function_simulator/oracle/message_load_oracle_inputs.ts +6 -21
- package/src/contract_function_simulator/oracle/oracle_registry.ts +289 -483
- package/src/contract_function_simulator/oracle/oracle_type_mappings.ts +1067 -0
- package/src/contract_function_simulator/oracle/private_execution.ts +2 -3
- package/src/contract_function_simulator/oracle/private_execution_oracle.ts +190 -61
- package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +556 -174
- package/src/contract_function_simulator/transient_array_service.ts +91 -0
- package/src/debug/pxe_debug_utils.ts +1 -1
- package/src/entrypoints/client/bundle/index.ts +1 -0
- package/src/entrypoints/client/bundle/utils.ts +24 -5
- package/src/entrypoints/client/lazy/index.ts +1 -0
- package/src/entrypoints/client/lazy/utils.ts +24 -5
- package/src/entrypoints/client/store.ts +54 -0
- package/src/entrypoints/pxe_creation_options.ts +8 -2
- package/src/entrypoints/server/index.ts +6 -2
- package/src/entrypoints/server/store.ts +47 -0
- package/src/entrypoints/server/utils.ts +31 -9
- package/src/error_enriching.ts +27 -11
- package/src/events/event_service.ts +24 -14
- package/src/hooks/execution_hooks.ts +32 -12
- package/src/hooks/index.ts +8 -2
- package/src/hooks/resolve_custom_request.ts +24 -0
- package/src/hooks/resolve_tagging_secret_strategy.ts +60 -0
- package/src/logs/log_service.ts +122 -61
- package/src/messages/tx_resolver_service.ts +80 -0
- package/src/node/benchmarked_node.ts +140 -0
- package/src/node/caching_aztec_node.ts +406 -0
- package/src/notes/note_service.ts +20 -14
- package/src/oracle_version.ts +8 -8
- package/src/private_kernel/batch_planner.ts +0 -1
- package/src/private_kernel/hints/private_kernel_reset_private_inputs_builder.ts +11 -1
- package/src/private_kernel/hints/test_utils.ts +1 -1
- package/src/private_kernel/private_kernel_execution_prover.ts +112 -56
- package/src/private_kernel/private_kernel_oracle.ts +23 -4
- package/src/pxe.ts +357 -172
- package/src/storage/allowed_scopes.ts +14 -0
- package/src/storage/anchor_block_store/anchor_block_store.ts +8 -6
- package/src/storage/backwards_compatibility_tests/__snapshots__/AddressStore.json +6 -6
- package/src/storage/backwards_compatibility_tests/__snapshots__/ContractStore.json +1 -1
- package/src/storage/backwards_compatibility_tests/__snapshots__/FactStore.json +40 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/KeyStore.json +12 -12
- package/src/storage/backwards_compatibility_tests/__snapshots__/L2TipsKVStore.json +9 -15
- package/src/storage/backwards_compatibility_tests/__snapshots__/NoteStore.json +24 -4
- package/src/storage/backwards_compatibility_tests/__snapshots__/RecipientTaggingStore.json +11 -3
- package/src/storage/backwards_compatibility_tests/__snapshots__/SenderTaggingStore.json +12 -4
- package/src/storage/backwards_compatibility_tests/__snapshots__/TaggingSecretSourcesStore.json +30 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/opened_stores.json +29 -9
- package/src/storage/backwards_compatibility_tests/schema_tests.ts +141 -50
- package/src/storage/capsule_store/capsule_service.ts +8 -13
- package/src/storage/contract_store/contract_store.ts +88 -94
- 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 +15 -0
- package/src/storage/fact_store/origin_state.ts +84 -0
- package/src/storage/fact_store/stored_fact.ts +80 -0
- package/src/storage/index.ts +2 -1
- package/src/storage/metadata.ts +1 -1
- package/src/storage/note_store/note_store.ts +226 -187
- package/src/storage/note_store/stored_note.ts +5 -27
- package/src/storage/open_pxe_stores.ts +6 -3
- package/src/storage/private_event_store/private_event_store.ts +49 -55
- package/src/storage/store_identity.ts +72 -0
- package/src/storage/tagging_store/index.ts +1 -1
- package/src/storage/tagging_store/sender_tagging_store.ts +113 -41
- package/src/storage/tagging_store/tagging_secret_sources_store.ts +138 -0
- package/src/tagging/constants.ts +42 -10
- package/src/tagging/get_all_logs_by_tags.ts +47 -11
- package/src/tagging/index.ts +7 -2
- package/src/tagging/recipient_sync/sync_tagged_private_logs.ts +161 -46
- package/src/tagging/sender_sync/sync_sender_tagging_indexes.ts +27 -57
- package/src/tagging/sender_sync/utils/classify_pending_txs.ts +91 -0
- package/src/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.ts +46 -40
- package/src/tagging/sender_sync/utils/resolve_pending_txs.ts +64 -0
- package/src/tagging/sender_sync/utils/test_utils.ts +46 -0
- package/src/tagging/testing/tag_query_test_utils.ts +11 -0
- package/dest/contract_function_simulator/benchmarked_node.d.ts +0 -9
- package/dest/contract_function_simulator/benchmarked_node.d.ts.map +0 -1
- package/dest/contract_function_simulator/benchmarked_node.js +0 -77
- package/dest/contract_function_simulator/oracle/oracle.d.ts +0 -89
- package/dest/contract_function_simulator/oracle/oracle.d.ts.map +0 -1
- package/dest/contract_function_simulator/oracle/oracle.js +0 -552
- 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 -51
- package/dest/contract_sync/contract_sync_service.d.ts +0 -42
- package/dest/contract_sync/contract_sync_service.d.ts.map +0 -1
- package/dest/contract_sync/helpers.d.ts +0 -27
- package/dest/contract_sync/helpers.d.ts.map +0 -1
- package/dest/contract_sync/helpers.js +0 -53
- package/dest/messages/message_context_service.d.ts +0 -17
- package/dest/messages/message_context_service.d.ts.map +0 -1
- package/dest/messages/message_context_service.js +0 -38
- package/dest/storage/tagging_store/sender_address_book_store.d.ts +0 -14
- package/dest/storage/tagging_store/sender_address_book_store.d.ts.map +0 -1
- package/dest/storage/tagging_store/sender_address_book_store.js +0 -36
- package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts +0 -17
- package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts.map +0 -1
- package/dest/tagging/sender_sync/utils/get_status_change_of_pending.js +0 -60
- package/src/contract_function_simulator/benchmarked_node.ts +0 -103
- package/src/contract_function_simulator/oracle/oracle.ts +0 -711
- package/src/contract_function_simulator/proxied_contract_data_source.ts +0 -60
- package/src/contract_sync/helpers.ts +0 -86
- package/src/messages/message_context_service.ts +0 -45
- package/src/storage/backwards_compatibility_tests/__snapshots__/SenderAddressBookStore.json +0 -16
- package/src/storage/tagging_store/sender_address_book_store.ts +0 -48
- package/src/tagging/sender_sync/utils/get_status_change_of_pending.ts +0 -66
package/dest/pxe.js
CHANGED
|
@@ -1,26 +1,28 @@
|
|
|
1
1
|
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
2
|
+
import { Point } from '@aztec/foundation/curves/grumpkin';
|
|
2
3
|
import { createLogger } from '@aztec/foundation/log';
|
|
3
4
|
import { SerialQueue } from '@aztec/foundation/queue';
|
|
4
5
|
import { Timer } from '@aztec/foundation/timer';
|
|
5
6
|
import { protocolContractNames } from '@aztec/protocol-contracts';
|
|
6
7
|
import { FunctionType, decodeFunctionSignature } from '@aztec/stdlib/abi';
|
|
7
8
|
import { GENESIS_BLOCK_HEADER_HASH } from '@aztec/stdlib/block';
|
|
8
|
-
import { computeContractAddressFromInstance
|
|
9
|
+
import { computeContractAddressFromInstance } from '@aztec/stdlib/contract';
|
|
9
10
|
import { SimulationError } from '@aztec/stdlib/errors';
|
|
11
|
+
import { computeAddressSecret } from '@aztec/stdlib/keys';
|
|
12
|
+
import { deriveEcdhSharedSecretPoint, protectFromForgery } from '@aztec/stdlib/logs';
|
|
10
13
|
import { PrivateSimulationResult, TxProfileResult, TxProvingResult, TxSimulationResult } from '@aztec/stdlib/tx';
|
|
11
14
|
import { inspect } from 'util';
|
|
12
15
|
import { BlockSynchronizer } from './block_synchronizer/index.js';
|
|
13
|
-
import {
|
|
16
|
+
import { ContractClassService } from './contract/contract_class_service.js';
|
|
17
|
+
import { ContractSyncService } from './contract/contract_sync_service.js';
|
|
14
18
|
import { ContractFunctionSimulator, generateSimulatedProvingResult } from './contract_function_simulator/contract_function_simulator.js';
|
|
15
|
-
import { ProxiedContractStoreFactory } from './contract_function_simulator/proxied_contract_data_source.js';
|
|
16
19
|
import { displayDebugLogs } from './contract_logging.js';
|
|
17
|
-
import { ContractSyncService } from './contract_sync/contract_sync_service.js';
|
|
18
|
-
import { readCurrentClassId } from './contract_sync/helpers.js';
|
|
19
20
|
import { PXEDebugUtils } from './debug/pxe_debug_utils.js';
|
|
20
21
|
import { enrichPublicSimulationError, enrichSimulationError } from './error_enriching.js';
|
|
21
22
|
import { PrivateEventFilterValidator } from './events/private_event_filter_validator.js';
|
|
22
23
|
import { JobCoordinator } from './job_coordinator/job_coordinator.js';
|
|
23
|
-
import {
|
|
24
|
+
import { TxResolverService } from './messages/tx_resolver_service.js';
|
|
25
|
+
import { withCache } from './node/caching_aztec_node.js';
|
|
24
26
|
import { PrivateKernelExecutionProver } from './private_kernel/private_kernel_execution_prover.js';
|
|
25
27
|
import { PrivateKernelOracle } from './private_kernel/private_kernel_oracle.js';
|
|
26
28
|
import { openPxeStores } from './storage/open_pxe_stores.js';
|
|
@@ -30,20 +32,23 @@ import { persistSenderTaggingIndexRangesForTx } from './tagging/index.js';
|
|
|
30
32
|
* manage private state of users.
|
|
31
33
|
*/ export class PXE {
|
|
32
34
|
node;
|
|
35
|
+
nodeDebug;
|
|
33
36
|
db;
|
|
34
37
|
blockStateSynchronizer;
|
|
35
38
|
keyStore;
|
|
36
39
|
contractStore;
|
|
37
40
|
noteStore;
|
|
38
41
|
capsuleStore;
|
|
42
|
+
factStore;
|
|
39
43
|
anchorBlockStore;
|
|
40
44
|
senderTaggingStore;
|
|
41
|
-
|
|
45
|
+
taggingSecretSourcesStore;
|
|
42
46
|
recipientTaggingStore;
|
|
43
47
|
addressStore;
|
|
44
48
|
privateEventStore;
|
|
45
49
|
contractSyncService;
|
|
46
|
-
|
|
50
|
+
contractClassService;
|
|
51
|
+
txResolver;
|
|
47
52
|
l2TipsStore;
|
|
48
53
|
simulator;
|
|
49
54
|
proverEnabled;
|
|
@@ -56,22 +61,25 @@ import { persistSenderTaggingIndexRangesForTx } from './tagging/index.js';
|
|
|
56
61
|
jobCoordinator;
|
|
57
62
|
debug;
|
|
58
63
|
hooks;
|
|
59
|
-
constructor(node, db, blockStateSynchronizer, keyStore, contractStore, noteStore, capsuleStore, anchorBlockStore, senderTaggingStore,
|
|
64
|
+
constructor(node, nodeDebug, db, blockStateSynchronizer, keyStore, contractStore, noteStore, capsuleStore, factStore, anchorBlockStore, senderTaggingStore, taggingSecretSourcesStore, recipientTaggingStore, addressStore, privateEventStore, contractSyncService, contractClassService, txResolver, l2TipsStore, simulator, proverEnabled, autoSync, proofCreator, protocolContractsProvider, preloadedContractsProvider, log, jobQueue, jobCoordinator, debug, hooks){
|
|
60
65
|
this.node = node;
|
|
66
|
+
this.nodeDebug = nodeDebug;
|
|
61
67
|
this.db = db;
|
|
62
68
|
this.blockStateSynchronizer = blockStateSynchronizer;
|
|
63
69
|
this.keyStore = keyStore;
|
|
64
70
|
this.contractStore = contractStore;
|
|
65
71
|
this.noteStore = noteStore;
|
|
66
72
|
this.capsuleStore = capsuleStore;
|
|
73
|
+
this.factStore = factStore;
|
|
67
74
|
this.anchorBlockStore = anchorBlockStore;
|
|
68
75
|
this.senderTaggingStore = senderTaggingStore;
|
|
69
|
-
this.
|
|
76
|
+
this.taggingSecretSourcesStore = taggingSecretSourcesStore;
|
|
70
77
|
this.recipientTaggingStore = recipientTaggingStore;
|
|
71
78
|
this.addressStore = addressStore;
|
|
72
79
|
this.privateEventStore = privateEventStore;
|
|
73
80
|
this.contractSyncService = contractSyncService;
|
|
74
|
-
this.
|
|
81
|
+
this.contractClassService = contractClassService;
|
|
82
|
+
this.txResolver = txResolver;
|
|
75
83
|
this.l2TipsStore = l2TipsStore;
|
|
76
84
|
this.simulator = simulator;
|
|
77
85
|
this.proverEnabled = proverEnabled;
|
|
@@ -91,7 +99,7 @@ import { persistSenderTaggingIndexRangesForTx } from './tagging/index.js';
|
|
|
91
99
|
* can be contacted.
|
|
92
100
|
*
|
|
93
101
|
* @returns A promise that resolves PXE is ready to be used.
|
|
94
|
-
*/ static async create({ node, store, proofCreator, simulator, protocolContractsProvider, preloadedContractsProvider, config, loggerOrSuffix, hooks }) {
|
|
102
|
+
*/ static async create({ node, nodeDebug, store, proofCreator, simulator, protocolContractsProvider, preloadedContractsProvider, config, loggerOrSuffix, hooks }) {
|
|
95
103
|
// Extract bindings from the logger, or use empty bindings if a string suffix is provided.
|
|
96
104
|
const bindings = loggerOrSuffix && typeof loggerOrSuffix !== 'string' ? loggerOrSuffix.getBindings() : undefined;
|
|
97
105
|
const log = !loggerOrSuffix || typeof loggerOrSuffix === 'string' ? createLogger(loggerOrSuffix ? `pxe:service:${loggerOrSuffix}` : `pxe:service`) : loggerOrSuffix;
|
|
@@ -104,10 +112,15 @@ import { persistSenderTaggingIndexRangesForTx } from './tagging/index.js';
|
|
|
104
112
|
// not return a genesis block (older node or test fixture) we fall back to the static constant.
|
|
105
113
|
const initialBlockHash = (await node.getBlock(BlockNumber.ZERO))?.hash ?? GENESIS_BLOCK_HEADER_HASH;
|
|
106
114
|
const proverEnabled = config.proverEnabled !== undefined ? config.proverEnabled : info.realProofs;
|
|
107
|
-
const { addressStore, privateEventStore, contractStore, noteStore, anchorBlockStore, senderTaggingStore,
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
115
|
+
const { addressStore, privateEventStore, contractStore, noteStore, anchorBlockStore, senderTaggingStore, taggingSecretSourcesStore, recipientTaggingStore, capsuleStore, keyStore, l2TipsStore, factStore } = openPxeStores(store, initialBlockHash);
|
|
116
|
+
// Every PXE consumer reads through this one wrapper, so a read cached by one is served to the rest. Only
|
|
117
|
+
// immutable, hash-pinned reads are cached (the rule lives on `withCache`), which makes it safe regardless of
|
|
118
|
+
// the consumer's anchor block; the block synchronizer wipes it on anchor updates to bound memory.
|
|
119
|
+
const readCachedNode = withCache(node);
|
|
120
|
+
const contractClassService = new ContractClassService(readCachedNode, contractStore);
|
|
121
|
+
const contractSyncService = new ContractSyncService(readCachedNode, contractStore, contractClassService, noteStore, createLogger('pxe:contract_sync', bindings));
|
|
122
|
+
const txResolver = new TxResolverService(readCachedNode);
|
|
123
|
+
const synchronizer = new BlockSynchronizer(readCachedNode, store, anchorBlockStore, noteStore, privateEventStore, factStore, l2TipsStore, contractSyncService, config, bindings);
|
|
111
124
|
const jobCoordinator = new JobCoordinator(store, bindings);
|
|
112
125
|
jobCoordinator.registerStores([
|
|
113
126
|
capsuleStore,
|
|
@@ -115,11 +128,12 @@ import { persistSenderTaggingIndexRangesForTx } from './tagging/index.js';
|
|
|
115
128
|
recipientTaggingStore,
|
|
116
129
|
privateEventStore,
|
|
117
130
|
noteStore,
|
|
131
|
+
factStore,
|
|
118
132
|
contractSyncService
|
|
119
133
|
]);
|
|
120
134
|
const debugUtils = new PXEDebugUtils(contractSyncService, noteStore, synchronizer, anchorBlockStore);
|
|
121
135
|
const jobQueue = new SerialQueue();
|
|
122
|
-
const pxe = new PXE(
|
|
136
|
+
const pxe = new PXE(readCachedNode, nodeDebug, store, synchronizer, keyStore, contractStore, noteStore, capsuleStore, factStore, anchorBlockStore, senderTaggingStore, taggingSecretSourcesStore, recipientTaggingStore, addressStore, privateEventStore, contractSyncService, contractClassService, txResolver, l2TipsStore, simulator, proverEnabled, config.autoSync, proofCreator, protocolContractsProvider, preloadedContractsProvider, log, jobQueue, jobCoordinator, debugUtils, hooks);
|
|
123
137
|
debugUtils.setPXEHelpers(pxe.#putInJobQueue.bind(pxe), pxe.#getSimulatorForTx.bind(pxe), pxe.#executeUtility.bind(pxe));
|
|
124
138
|
pxe.jobQueue.start();
|
|
125
139
|
await Promise.all([
|
|
@@ -131,25 +145,43 @@ import { persistSenderTaggingIndexRangesForTx } from './tagging/index.js';
|
|
|
131
145
|
}
|
|
132
146
|
// Internal methods
|
|
133
147
|
#getSimulatorForTx(overrides) {
|
|
134
|
-
const proxyContractStore = ProxiedContractStoreFactory.create(this.contractStore, overrides?.contracts);
|
|
135
148
|
return new ContractFunctionSimulator({
|
|
136
|
-
contractStore:
|
|
149
|
+
contractStore: this.contractStore,
|
|
150
|
+
contractClassService: this.contractClassService,
|
|
151
|
+
overrides: overrides?.contracts,
|
|
137
152
|
noteStore: this.noteStore,
|
|
138
153
|
keyStore: this.keyStore,
|
|
139
154
|
addressStore: this.addressStore,
|
|
140
|
-
aztecNode:
|
|
155
|
+
aztecNode: this.node,
|
|
141
156
|
l2TipsStore: this.l2TipsStore,
|
|
142
157
|
senderTaggingStore: this.senderTaggingStore,
|
|
143
158
|
recipientTaggingStore: this.recipientTaggingStore,
|
|
144
|
-
|
|
159
|
+
taggingSecretSourcesStore: this.taggingSecretSourcesStore,
|
|
145
160
|
capsuleStore: this.capsuleStore,
|
|
161
|
+
factStore: this.factStore,
|
|
146
162
|
privateEventStore: this.privateEventStore,
|
|
147
163
|
simulator: this.simulator,
|
|
148
164
|
contractSyncService: this.contractSyncService,
|
|
149
|
-
|
|
165
|
+
txResolver: this.txResolver,
|
|
150
166
|
hooks: this.hooks
|
|
151
167
|
});
|
|
152
168
|
}
|
|
169
|
+
/** Best-effort debug function name for the class `address` runs at `anchorBlockHeader`. Used for log display only. */ async #getDebugFunctionName(address, selector, anchorBlockHeader) {
|
|
170
|
+
try {
|
|
171
|
+
const classId = await this.contractClassService.getCurrentClassId(address, anchorBlockHeader);
|
|
172
|
+
return classId ? await this.contractStore.getDebugFunctionName(classId, selector) : `${address}:${selector}`;
|
|
173
|
+
} catch {
|
|
174
|
+
return `${address}:${selector}`;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
/** Best-effort debug contract name for the class `address` runs at `anchorBlockHeader`. Used for log display only. */ async #getDebugContractName(address, anchorBlockHeader) {
|
|
178
|
+
try {
|
|
179
|
+
const classId = await this.contractClassService.getCurrentClassId(address, anchorBlockHeader);
|
|
180
|
+
return classId ? await this.contractStore.getDebugContractName(classId) : undefined;
|
|
181
|
+
} catch {
|
|
182
|
+
return undefined;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
153
185
|
#contextualizeError(err, ...context) {
|
|
154
186
|
let contextStr = '';
|
|
155
187
|
if (context.length > 0) {
|
|
@@ -202,10 +234,12 @@ import { persistSenderTaggingIndexRangesForTx } from './tagging/index.js';
|
|
|
202
234
|
}
|
|
203
235
|
async #registerPreloadedContracts() {
|
|
204
236
|
const contracts = await this.preloadedContractsProvider.getPreloadedContracts();
|
|
205
|
-
await Promise.all(contracts.map(({ instance, artifact })=>
|
|
206
|
-
|
|
207
|
-
artifact
|
|
208
|
-
}
|
|
237
|
+
await Promise.all(contracts.map(async ({ instance, artifact })=>{
|
|
238
|
+
if (artifact) {
|
|
239
|
+
await this.registerContractClass(artifact);
|
|
240
|
+
}
|
|
241
|
+
await this.registerContract(instance);
|
|
242
|
+
}));
|
|
209
243
|
this.log.verbose(`Registered preloaded contracts in pxe`, {
|
|
210
244
|
contracts: contracts.map(({ instance })=>instance.address.toString())
|
|
211
245
|
});
|
|
@@ -217,8 +251,6 @@ import { persistSenderTaggingIndexRangesForTx } from './tagging/index.js';
|
|
|
217
251
|
try {
|
|
218
252
|
await this.contractSyncService.ensureContractSynced(contractAddress, functionSelector, (privateSyncCall, execScopes)=>this.#executeUtility(contractFunctionSimulator, privateSyncCall, [], execScopes, jobId), anchorBlockHeader, jobId, scopes);
|
|
219
253
|
const result = await contractFunctionSimulator.run(txRequest, {
|
|
220
|
-
contractAddress,
|
|
221
|
-
selector: functionSelector,
|
|
222
254
|
anchorBlockHeader,
|
|
223
255
|
scopes,
|
|
224
256
|
jobId,
|
|
@@ -228,7 +260,7 @@ import { persistSenderTaggingIndexRangesForTx } from './tagging/index.js';
|
|
|
228
260
|
return result;
|
|
229
261
|
} catch (err) {
|
|
230
262
|
if (err instanceof SimulationError) {
|
|
231
|
-
await enrichSimulationError(err, this.contractStore, this.log);
|
|
263
|
+
await enrichSimulationError(err, this.contractStore, this.contractClassService, anchorBlockHeader, this.log);
|
|
232
264
|
}
|
|
233
265
|
throw err;
|
|
234
266
|
}
|
|
@@ -252,7 +284,8 @@ import { persistSenderTaggingIndexRangesForTx } from './tagging/index.js';
|
|
|
252
284
|
};
|
|
253
285
|
} catch (err) {
|
|
254
286
|
if (err instanceof SimulationError) {
|
|
255
|
-
|
|
287
|
+
const anchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
|
|
288
|
+
await enrichSimulationError(err, this.contractStore, this.contractClassService, anchorBlockHeader, this.log);
|
|
256
289
|
}
|
|
257
290
|
throw err;
|
|
258
291
|
}
|
|
@@ -274,7 +307,8 @@ import { persistSenderTaggingIndexRangesForTx } from './tagging/index.js';
|
|
|
274
307
|
} catch (err) {
|
|
275
308
|
if (err instanceof SimulationError) {
|
|
276
309
|
try {
|
|
277
|
-
|
|
310
|
+
const anchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
|
|
311
|
+
await enrichPublicSimulationError(err, this.contractStore, this.contractClassService, anchorBlockHeader, this.log);
|
|
278
312
|
} catch (enrichErr) {
|
|
279
313
|
this.log.error(`Failed to enrich public simulation error: ${enrichErr}`);
|
|
280
314
|
}
|
|
@@ -293,7 +327,7 @@ import { persistSenderTaggingIndexRangesForTx } from './tagging/index.js';
|
|
|
293
327
|
* @param config - The configuration for the kernel execution prover.
|
|
294
328
|
* @returns An object that contains the output of the kernel execution, including the ChonkProof if proving is enabled.
|
|
295
329
|
*/ async #prove(txExecutionRequest, proofCreator, privateExecutionResult, anchorBlockHeader, config) {
|
|
296
|
-
const kernelOracle = new PrivateKernelOracle(this.contractStore, this.keyStore, this.node, anchorBlockHeader);
|
|
330
|
+
const kernelOracle = new PrivateKernelOracle(this.contractStore, this.contractClassService, this.keyStore, this.node, anchorBlockHeader);
|
|
297
331
|
const kernelTraceProver = new PrivateKernelExecutionProver(kernelOracle, proofCreator, !this.proverEnabled, this.log.getBindings());
|
|
298
332
|
this.log.debug(`Executing kernel trace prover (${JSON.stringify(config)})...`);
|
|
299
333
|
return await kernelTraceProver.proveWithKernels(txExecutionRequest.toTxRequest(), privateExecutionResult, config);
|
|
@@ -324,9 +358,9 @@ import { persistSenderTaggingIndexRangesForTx } from './tagging/index.js';
|
|
|
324
358
|
});
|
|
325
359
|
}
|
|
326
360
|
/**
|
|
327
|
-
* Returns the contract instance
|
|
361
|
+
* Returns the address preimage of the contract instance at a given address, if it's registered in the PXE.
|
|
328
362
|
* @param address - The contract address.
|
|
329
|
-
* @returns The contract instance if found, undefined otherwise.
|
|
363
|
+
* @returns The contract instance address preimage if found, undefined otherwise.
|
|
330
364
|
*/ getContractInstance(address) {
|
|
331
365
|
return this.contractStore.getContractInstance(address);
|
|
332
366
|
}
|
|
@@ -338,17 +372,21 @@ import { persistSenderTaggingIndexRangesForTx } from './tagging/index.js';
|
|
|
338
372
|
return await this.contractStore.getContractArtifact(id);
|
|
339
373
|
}
|
|
340
374
|
/**
|
|
341
|
-
* Registers a user account in PXE
|
|
342
|
-
*
|
|
343
|
-
* the
|
|
344
|
-
*
|
|
375
|
+
* Registers a user account in PXE.
|
|
376
|
+
*
|
|
377
|
+
* PXE holds the account's four privacy secret keys but only the *public* message-signing and fallback keys: their
|
|
378
|
+
* secret keys are withheld, since PXE is not trusted to hold them.
|
|
379
|
+
*
|
|
380
|
+
* Does nothing if the account is already registered.
|
|
345
381
|
*
|
|
346
|
-
*
|
|
382
|
+
* The four privacy secret keys can be retrieved later with {@link getAccountSecretKeys}.
|
|
383
|
+
*
|
|
384
|
+
* @param keys - The account's privacy keys: four secret keys plus the message-signing and fallback public keys.
|
|
347
385
|
* @param partialAddress - The partial address of the account contract corresponding to the account being registered.
|
|
348
386
|
* @returns The complete address of the account.
|
|
349
|
-
*/ async registerAccount(
|
|
387
|
+
*/ async registerAccount(keys, partialAddress) {
|
|
350
388
|
const accounts = await this.keyStore.getAccounts();
|
|
351
|
-
const accountCompleteAddress = await this.keyStore.addAccount(
|
|
389
|
+
const accountCompleteAddress = await this.keyStore.addAccount(keys, partialAddress);
|
|
352
390
|
if (accounts.some((a)=>a.equals(accountCompleteAddress.address))) {
|
|
353
391
|
this.log.info(`Account:\n "${accountCompleteAddress.address.toString()}"\n already registered.`);
|
|
354
392
|
return accountCompleteAddress;
|
|
@@ -360,50 +398,144 @@ import { persistSenderTaggingIndexRangesForTx } from './tagging/index.js';
|
|
|
360
398
|
return accountCompleteAddress;
|
|
361
399
|
}
|
|
362
400
|
/**
|
|
363
|
-
*
|
|
401
|
+
* Retrieves the four privacy secret keys PXE holds for a registered account (nullifier-hiding, incoming-viewing,
|
|
402
|
+
* outgoing-viewing, tagging).
|
|
364
403
|
*
|
|
365
|
-
*
|
|
366
|
-
*
|
|
404
|
+
* These do NOT grant control over an account's assets, e.g. they are insufficient to impersonate the account or to
|
|
405
|
+
* spend notes, but they _do_ guard the account's privacy. Parties that have knowledge of these keys can decrypt all
|
|
406
|
+
* messages sent to the account, discover all of their on-chain activity, including notes, events, etc.
|
|
367
407
|
*
|
|
368
|
-
*
|
|
369
|
-
*
|
|
370
|
-
*
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
408
|
+
* Security is paramount when handling these keys, which should itself be a very rare occurrence. Other than exporting
|
|
409
|
+
* and then importing an account into a separate PXE/wallet, there is typically no need for a wallet to ever access
|
|
410
|
+
* these keys. Applications should NEVER be given access to them.
|
|
411
|
+
*
|
|
412
|
+
* @throws If the account is not registered.
|
|
413
|
+
*/ getAccountSecretKeys(account) {
|
|
414
|
+
return this.keyStore.getAccountSecretKeys(account);
|
|
415
|
+
}
|
|
416
|
+
/**
|
|
417
|
+
* Registers a source from which this PXE derives the tagging secrets it scans for to discover incoming private logs.
|
|
418
|
+
* See {@link TaggingSecretSource} for the meaning of each variant. Does nothing if the source is already registered.
|
|
419
|
+
*
|
|
420
|
+
* After a new source is added we clear the cache tracking which contracts have finished syncing, so every contract
|
|
421
|
+
* re-syncs against the new source's logs (whose notes/events could belong to any contract). Already-discovered
|
|
422
|
+
* notes/events are not discarded.
|
|
423
|
+
*/ async registerTaggingSecretSource(source) {
|
|
424
|
+
let wasAdded;
|
|
425
|
+
switch(source.kind){
|
|
426
|
+
case 'address-derived':
|
|
427
|
+
wasAdded = await this.#registerSender(source.sender);
|
|
428
|
+
break;
|
|
429
|
+
case 'arbitrary-secret':
|
|
430
|
+
wasAdded = await this.#registerSharedSecret(source.recipient, 'arbitrary-secret', source.secret);
|
|
431
|
+
break;
|
|
432
|
+
case 'handshake':
|
|
433
|
+
wasAdded = await this.#registerSharedSecret(source.recipient, 'handshake', await this.#deriveHandshakeSecret(source.recipient, source.ephPk));
|
|
434
|
+
break;
|
|
435
|
+
default:
|
|
436
|
+
{
|
|
437
|
+
const _ = source;
|
|
438
|
+
throw new Error('Unhandled tagging secret source kind');
|
|
439
|
+
}
|
|
379
440
|
}
|
|
380
|
-
const wasAdded = await this.senderAddressBookStore.addSender(sender);
|
|
381
441
|
if (wasAdded) {
|
|
382
|
-
|
|
383
|
-
// Wipe the entire sync cache: the new sender's tagged logs could contain notes/events for any contract, so
|
|
384
|
-
// all contracts must re-sync to discover them. Queued to avoid wiping while a job is in flight.
|
|
442
|
+
// Queued to avoid wiping while a job is in flight.
|
|
385
443
|
await this.#putInJobQueue(()=>Promise.resolve(this.contractSyncService.wipe()));
|
|
386
|
-
} else {
|
|
387
|
-
this.log.info(`Sender:\n "${sender.toString()}"\n already registered.`);
|
|
388
444
|
}
|
|
389
|
-
return sender;
|
|
390
445
|
}
|
|
391
446
|
/**
|
|
392
|
-
*
|
|
393
|
-
* @
|
|
394
|
-
*/
|
|
395
|
-
|
|
447
|
+
* Removes a previously registered tagging secret source, identified by its registered form (see
|
|
448
|
+
* {@link getTaggingSecretSources}). Does nothing if it was not registered.
|
|
449
|
+
*/ async removeTaggingSecretSource(source) {
|
|
450
|
+
switch(source.kind){
|
|
451
|
+
case 'address-derived':
|
|
452
|
+
{
|
|
453
|
+
const { sender } = source;
|
|
454
|
+
const wasRemoved = await this.taggingSecretSourcesStore.removeSender(sender);
|
|
455
|
+
this.log.info(wasRemoved ? `Removed sender:\n ${sender.toString()}` : `Sender:\n "${sender.toString()}"\n not registered in PXE.`);
|
|
456
|
+
break;
|
|
457
|
+
}
|
|
458
|
+
case 'arbitrary-secret':
|
|
459
|
+
case 'handshake':
|
|
460
|
+
{
|
|
461
|
+
const { kind, recipient, secret } = source;
|
|
462
|
+
const wasRemoved = await this.taggingSecretSourcesStore.removeSharedSecret(recipient, kind, secret);
|
|
463
|
+
this.log.info(wasRemoved ? `Removed ${kind} shared secret for recipient:\n ${recipient.toString()}` : `No ${kind} shared secret registered for recipient:\n ${recipient.toString()}`);
|
|
464
|
+
break;
|
|
465
|
+
}
|
|
466
|
+
default:
|
|
467
|
+
{
|
|
468
|
+
const _ = source;
|
|
469
|
+
throw new Error('Unhandled tagging secret source kind');
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
async getTaggingSecretSources(filter) {
|
|
474
|
+
const [senders, secrets] = await Promise.all([
|
|
475
|
+
this.taggingSecretSourcesStore.getSenders(),
|
|
476
|
+
this.taggingSecretSourcesStore.getAllSharedSecrets()
|
|
477
|
+
]);
|
|
478
|
+
const sources = [
|
|
479
|
+
...senders.map((sender)=>({
|
|
480
|
+
kind: 'address-derived',
|
|
481
|
+
sender
|
|
482
|
+
})),
|
|
483
|
+
...secrets.map(({ recipient, kind, secret })=>({
|
|
484
|
+
kind,
|
|
485
|
+
recipient,
|
|
486
|
+
secret
|
|
487
|
+
}))
|
|
488
|
+
];
|
|
489
|
+
return filter?.kind ? sources.filter((source)=>source.kind === filter.kind) : sources;
|
|
490
|
+
}
|
|
491
|
+
/** Registers a sender, skipping addresses that belong to a local account. Returns whether it was newly added. */ async #registerSender(address) {
|
|
492
|
+
if (!await address.isValid()) {
|
|
493
|
+
throw new Error(`Address ${address} is not valid: it does not correspond to a point on the Grumpkin curve. Cannot register it as a sender.`);
|
|
494
|
+
}
|
|
495
|
+
const accounts = await this.keyStore.getAccounts();
|
|
496
|
+
if (accounts.some((a)=>a.equals(address))) {
|
|
497
|
+
this.log.info(`Sender:\n "${address.toString()}"\n already registered.`);
|
|
498
|
+
return false;
|
|
499
|
+
}
|
|
500
|
+
const wasAdded = await this.taggingSecretSourcesStore.addSender(address);
|
|
501
|
+
this.log.info(wasAdded ? `Added sender:\n ${address.toString()}` : `Sender:\n "${address.toString()}"\n already registered.`);
|
|
502
|
+
return wasAdded;
|
|
396
503
|
}
|
|
397
504
|
/**
|
|
398
|
-
*
|
|
399
|
-
*
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
505
|
+
* Derives the shared secret of a handshake from its ephemeral public key: the raw ECDH secret
|
|
506
|
+
* `S = addressSecret(recipient) * ephPk` with the forgery protection applied,
|
|
507
|
+
* matching the protected secret the registry stores and the derivation the recipient-side scan uses for
|
|
508
|
+
* handshakes discovered onchain. The ephemeral key is reconstructed from its x-coordinate with a positive y,
|
|
509
|
+
* matching how the protocol generates it.
|
|
510
|
+
*
|
|
511
|
+
* @throws If `ephPk` is not the x-coordinate of a Grumpkin curve point, or if `recipient` is not an account of
|
|
512
|
+
* this PXE, since the derivation needs its keys.
|
|
513
|
+
*/ async #deriveHandshakeSecret(recipient, ephPk) {
|
|
514
|
+
let ephPkPoint;
|
|
515
|
+
try {
|
|
516
|
+
ephPkPoint = await Point.fromXAndSign(ephPk, true);
|
|
517
|
+
} catch {
|
|
518
|
+
throw new Error(`Ephemeral public key x-coordinate ${ephPk} does not correspond to a Grumpkin curve point.`);
|
|
519
|
+
}
|
|
520
|
+
const completeAddress = await this.addressStore.getCompleteAddress(recipient);
|
|
521
|
+
if (!completeAddress || !await this.keyStore.hasAccount(recipient)) {
|
|
522
|
+
throw new Error(`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.`);
|
|
406
523
|
}
|
|
524
|
+
const ivskM = await this.keyStore.getMasterIncomingViewingSecretKey(recipient);
|
|
525
|
+
const addressSecret = await computeAddressSecret(await completeAddress.getPreaddress(), ivskM);
|
|
526
|
+
const rawSecret = await deriveEcdhSharedSecretPoint(addressSecret, ephPkPoint);
|
|
527
|
+
return protectFromForgery(rawSecret, ephPkPoint, await recipient.toAddressPoint());
|
|
528
|
+
}
|
|
529
|
+
/** Registers a resolved shared secret scoped to a recipient. Returns whether it was newly added. */ async #registerSharedSecret(recipient, kind, secret) {
|
|
530
|
+
if (!await recipient.isValid()) {
|
|
531
|
+
throw new Error(`Recipient ${recipient} is not valid: it does not correspond to a point on the Grumpkin curve. Cannot register a shared secret for it.`);
|
|
532
|
+
}
|
|
533
|
+
if (secret.isZero() || !secret.isOnCurve()) {
|
|
534
|
+
throw new Error(`Shared secret ${secret} is not a valid non-zero point on the Grumpkin curve.`);
|
|
535
|
+
}
|
|
536
|
+
const wasAdded = await this.taggingSecretSourcesStore.addSharedSecret(recipient, kind, secret);
|
|
537
|
+
this.log.info(wasAdded ? `Added ${kind} shared secret for recipient:\n ${recipient.toString()}` : `${kind} shared secret already registered for recipient:\n ${recipient.toString()}`);
|
|
538
|
+
return wasAdded;
|
|
407
539
|
}
|
|
408
540
|
/**
|
|
409
541
|
* Retrieves the user accounts registered on this PXE.
|
|
@@ -421,76 +553,34 @@ import { persistSenderTaggingIndexRangesForTx } from './tagging/index.js';
|
|
|
421
553
|
* @param artifact - The build artifact for the contract class.
|
|
422
554
|
*/ async registerContractClass(artifact) {
|
|
423
555
|
const contractClassId = await this.contractStore.addContractArtifact(artifact);
|
|
556
|
+
// Publishing the artifact's public function signatures to the node is part of "registering a class", so that
|
|
557
|
+
// node-side debugging works regardless of which entrypoint (registerContractClass or registerContract) was used.
|
|
558
|
+
const publicFunctionSignatures = artifact.functions.filter((fn)=>fn.functionType === FunctionType.PUBLIC).map((fn)=>decodeFunctionSignature(fn.name, fn.parameters));
|
|
559
|
+
if (publicFunctionSignatures.length > 0) {
|
|
560
|
+
await this.nodeDebug?.registerContractFunctionSignatures(publicFunctionSignatures);
|
|
561
|
+
}
|
|
424
562
|
this.log.info(`Added contract class ${artifact.name} with id ${contractClassId}`);
|
|
425
563
|
}
|
|
426
564
|
/**
|
|
427
|
-
*
|
|
428
|
-
*
|
|
429
|
-
*
|
|
430
|
-
*
|
|
565
|
+
* Registers a deployed contract instance so its private state can be synced and its functions simulated. The
|
|
566
|
+
* artifact for the class the instance runs must be registered separately via {@link registerContractClass}, before
|
|
567
|
+
* or after this call; registration performs no validation, so a missing or mismatched artifact only surfaces when
|
|
568
|
+
* the contract is later simulated. This is automatically called by aztec.js when deploying a contract.
|
|
431
569
|
*
|
|
432
|
-
* @param
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
if (artifact) {
|
|
437
|
-
// If the user provides an artifact, validate it against the expected class id and register it
|
|
438
|
-
const contractClass = await getContractClassFromArtifact(artifact);
|
|
439
|
-
if (!contractClass.id.equals(instance.currentContractClassId)) {
|
|
440
|
-
throw new Error(`Artifact does not match expected class id (computed ${contractClass.id} but instance refers to ${instance.currentContractClassId})`);
|
|
441
|
-
}
|
|
442
|
-
const computedAddress = await computeContractAddressFromInstance(instance);
|
|
443
|
-
if (!computedAddress.equals(instance.address)) {
|
|
444
|
-
throw new Error('Added a contract in which the address does not match the contract instance.');
|
|
445
|
-
}
|
|
446
|
-
await this.contractStore.addContractArtifact(artifact, contractClass);
|
|
447
|
-
const publicFunctionSignatures = artifact.functions.filter((fn)=>fn.functionType === FunctionType.PUBLIC).map((fn)=>decodeFunctionSignature(fn.name, fn.parameters));
|
|
448
|
-
if (publicFunctionSignatures.length > 0) {
|
|
449
|
-
await this.node.registerContractFunctionSignatures(publicFunctionSignatures);
|
|
450
|
-
}
|
|
451
|
-
} else {
|
|
452
|
-
// Otherwise, make sure there is an artifact already registered for that class id
|
|
453
|
-
artifact = await this.contractStore.getContractArtifact(instance.currentContractClassId);
|
|
454
|
-
if (!artifact) {
|
|
455
|
-
throw new Error(`Artifact not found when registering an instance. Contract class: ${instance.currentContractClassId}.`);
|
|
456
|
-
}
|
|
457
|
-
}
|
|
458
|
-
await this.contractStore.addContractInstance(instance);
|
|
459
|
-
this.log.info(`Added contract ${artifact.name} at ${instance.address.toString()} with class ${instance.currentContractClassId}`);
|
|
460
|
-
}
|
|
461
|
-
/**
|
|
462
|
-
* Updates a deployed contract in the PXE. This is used to update the contract artifact when
|
|
463
|
-
* an update has happened, so the new code can be used in the simulation of local transactions.
|
|
464
|
-
* This is called by aztec.js when instantiating a contract in a given address with a mismatching artifact.
|
|
465
|
-
* @param contractAddress - The address of the contract to update.
|
|
466
|
-
* @param artifact - The updated artifact for the contract.
|
|
467
|
-
* @throws If the artifact's contract class is not found in the PXE or if the contract class is different from
|
|
468
|
-
* the current one (current one from the point of view of the node to which the PXE is connected).
|
|
469
|
-
*/ updateContract(contractAddress, artifact) {
|
|
470
|
-
// We disable concurrently updating contracts to avoid concurrently syncing with the node, or changing a contract's
|
|
471
|
-
// class while we're simulating it.
|
|
570
|
+
* @param instance - The address preimage of the contract instance to register. The address is derived from it.
|
|
571
|
+
* @returns The address of the registered instance.
|
|
572
|
+
*/ registerContract(instance) {
|
|
573
|
+
// Run inside the job queue so we can't race a concurrent simulation while writing the instance to the store.
|
|
472
574
|
return this.#putInJobQueue(async ()=>{
|
|
473
|
-
const
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
throw new Error('Could not update contract to a class different from the current one.');
|
|
483
|
-
}
|
|
484
|
-
const publicFunctionSignatures = artifact.functions.filter((fn)=>fn.functionType === FunctionType.PUBLIC).map((fn)=>decodeFunctionSignature(fn.name, fn.parameters));
|
|
485
|
-
if (publicFunctionSignatures.length > 0) {
|
|
486
|
-
await this.node.registerContractFunctionSignatures(publicFunctionSignatures);
|
|
487
|
-
}
|
|
488
|
-
currentInstance.currentContractClassId = contractClass.id;
|
|
489
|
-
await Promise.all([
|
|
490
|
-
this.contractStore.addContractArtifact(artifact, contractClass),
|
|
491
|
-
this.contractStore.addContractInstance(currentInstance)
|
|
492
|
-
]);
|
|
493
|
-
this.log.info(`Updated contract ${artifact.name} at ${contractAddress.toString()} to class ${contractClass.id}`);
|
|
575
|
+
const address = await computeContractAddressFromInstance(instance);
|
|
576
|
+
await this.contractStore.addContractInstance({
|
|
577
|
+
...instance,
|
|
578
|
+
address
|
|
579
|
+
});
|
|
580
|
+
this.log.info(`Added contract at ${address}`, {
|
|
581
|
+
address
|
|
582
|
+
});
|
|
583
|
+
return address;
|
|
494
584
|
});
|
|
495
585
|
}
|
|
496
586
|
/**
|
|
@@ -514,6 +604,7 @@ import { persistSenderTaggingIndexRangesForTx } from './tagging/index.js';
|
|
|
514
604
|
// computationally demanding that it'd be rare for someone to try to do it concurrently regardless.
|
|
515
605
|
return this.#putInJobQueue(async (jobId)=>{
|
|
516
606
|
const totalTimer = new Timer();
|
|
607
|
+
const recording = this.node.startRecording();
|
|
517
608
|
try {
|
|
518
609
|
const syncTimer = new Timer();
|
|
519
610
|
await this.#maybeSync();
|
|
@@ -551,7 +642,7 @@ import { persistSenderTaggingIndexRangesForTx } from './tagging/index.js';
|
|
|
551
642
|
});
|
|
552
643
|
const txProvingResult = new TxProvingResult(privateExecutionResult, publicInputs, chonkProof, {
|
|
553
644
|
timings,
|
|
554
|
-
nodeRPCCalls:
|
|
645
|
+
nodeRPCCalls: recording.stop()
|
|
555
646
|
});
|
|
556
647
|
// We keep track of which tagging indices we've used in this tx so that we don't repeat them in future txs
|
|
557
648
|
// (which would link them) without having to rely on this tx being mined (and us seeing the indices being used
|
|
@@ -563,6 +654,9 @@ import { persistSenderTaggingIndexRangesForTx } from './tagging/index.js';
|
|
|
563
654
|
return txProvingResult;
|
|
564
655
|
} catch (err) {
|
|
565
656
|
throw this.#contextualizeError(err, inspect(txRequest), inspect(privateExecutionResult));
|
|
657
|
+
} finally{
|
|
658
|
+
// Idempotent cleanup for the error and early-exit paths. The success path already stopped the recording.
|
|
659
|
+
recording.stop();
|
|
566
660
|
}
|
|
567
661
|
});
|
|
568
662
|
}
|
|
@@ -575,6 +669,7 @@ import { persistSenderTaggingIndexRangesForTx } from './tagging/index.js';
|
|
|
575
669
|
// We disable concurrent profiles for consistency with simulateTx.
|
|
576
670
|
return this.#putInJobQueue(async (jobId)=>{
|
|
577
671
|
const totalTimer = new Timer();
|
|
672
|
+
const recording = this.node.startRecording();
|
|
578
673
|
try {
|
|
579
674
|
const txInfo = {
|
|
580
675
|
origin: txRequest.origin,
|
|
@@ -621,13 +716,15 @@ import { persistSenderTaggingIndexRangesForTx } from './tagging/index.js';
|
|
|
621
716
|
perFunction,
|
|
622
717
|
unaccounted: total - ((syncTime ?? 0) + (proving ?? 0) + perFunction.reduce((acc, { time })=>acc + time, 0))
|
|
623
718
|
};
|
|
624
|
-
const simulatorStats = contractFunctionSimulator.getStats();
|
|
625
719
|
return new TxProfileResult(executionSteps, {
|
|
626
720
|
timings,
|
|
627
|
-
nodeRPCCalls:
|
|
721
|
+
nodeRPCCalls: recording.stop()
|
|
628
722
|
});
|
|
629
723
|
} catch (err) {
|
|
630
724
|
throw this.#contextualizeError(err, inspect(txRequest), `profileMode=${profileMode}`);
|
|
725
|
+
} finally{
|
|
726
|
+
// Idempotent cleanup for the error and early-exit paths. The success path already stopped the recording.
|
|
727
|
+
recording.stop();
|
|
631
728
|
}
|
|
632
729
|
});
|
|
633
730
|
}
|
|
@@ -653,6 +750,7 @@ import { persistSenderTaggingIndexRangesForTx } from './tagging/index.js';
|
|
|
653
750
|
// to the capsules), and we need to prevent concurrent runs from interfering with one another (e.g. attempting to
|
|
654
751
|
// delete the same read value, or reading values that another simulation is currently modifying).
|
|
655
752
|
return this.#putInJobQueue(async (jobId)=>{
|
|
753
|
+
const recording = this.node.startRecording();
|
|
656
754
|
try {
|
|
657
755
|
const totalTimer = new Timer();
|
|
658
756
|
const txInfo = {
|
|
@@ -684,7 +782,7 @@ import { persistSenderTaggingIndexRangesForTx } from './tagging/index.js';
|
|
|
684
782
|
let publicInputs;
|
|
685
783
|
let executionSteps = [];
|
|
686
784
|
if (skipKernels) {
|
|
687
|
-
({ publicInputs, executionSteps } = await generateSimulatedProvingResult(privateExecutionResult, (addr, sel)=>this
|
|
785
|
+
({ publicInputs, executionSteps } = await generateSimulatedProvingResult(privateExecutionResult, (addr, sel)=>this.#getDebugFunctionName(addr, sel, anchorBlockHeader), this.node));
|
|
688
786
|
} else {
|
|
689
787
|
// Kernel logic, plus proving of all private functions and kernels.
|
|
690
788
|
({ publicInputs, executionSteps } = await this.#prove(txRequest, this.proofCreator, privateExecutionResult, anchorBlockHeader, {
|
|
@@ -702,7 +800,7 @@ import { persistSenderTaggingIndexRangesForTx } from './tagging/index.js';
|
|
|
702
800
|
publicOutput = await this.#simulatePublicCalls(simulatedTx, skipFeeEnforcement, overrides);
|
|
703
801
|
publicSimulationTime = publicSimulationTimer.ms();
|
|
704
802
|
if (publicOutput?.debugLogs?.length) {
|
|
705
|
-
await displayDebugLogs(publicOutput.debugLogs, (addr)=>this
|
|
803
|
+
await displayDebugLogs(publicOutput.debugLogs, (addr)=>this.#getDebugContractName(addr, anchorBlockHeader));
|
|
706
804
|
}
|
|
707
805
|
}
|
|
708
806
|
let validationTime;
|
|
@@ -742,13 +840,15 @@ import { persistSenderTaggingIndexRangesForTx } from './tagging/index.js';
|
|
|
742
840
|
revertReason: publicOutput.revertReason
|
|
743
841
|
} : {}
|
|
744
842
|
});
|
|
745
|
-
const simulatorStats = contractFunctionSimulator.getStats();
|
|
746
843
|
return TxSimulationResult.fromPrivateSimulationResultAndPublicOutput(privateSimulationResult, publicOutput, {
|
|
747
844
|
timings,
|
|
748
|
-
nodeRPCCalls:
|
|
845
|
+
nodeRPCCalls: recording.stop()
|
|
749
846
|
});
|
|
750
847
|
} catch (err) {
|
|
751
848
|
throw this.#contextualizeError(err, inspect(txRequest), `simulatePublic=${simulatePublic}`, `skipTxValidation=${skipTxValidation}`, `scopes=${scopes.map((s)=>s.toString()).join(', ')}`);
|
|
849
|
+
} finally{
|
|
850
|
+
// Idempotent cleanup for the error and early-exit paths. The success path already stopped the recording.
|
|
851
|
+
recording.stop();
|
|
752
852
|
}
|
|
753
853
|
});
|
|
754
854
|
}
|
|
@@ -762,6 +862,7 @@ import { persistSenderTaggingIndexRangesForTx } from './tagging/index.js';
|
|
|
762
862
|
// to the capsules), and we need to prevent concurrent runs from interfering with one another (e.g. attempting to
|
|
763
863
|
// delete the same read value, or reading values that another execution is currently modifying).
|
|
764
864
|
return this.#putInJobQueue(async (jobId)=>{
|
|
865
|
+
const recording = this.node.startRecording();
|
|
765
866
|
try {
|
|
766
867
|
const totalTimer = new Timer();
|
|
767
868
|
const syncTimer = new Timer();
|
|
@@ -786,20 +887,22 @@ import { persistSenderTaggingIndexRangesForTx } from './tagging/index.js';
|
|
|
786
887
|
perFunction,
|
|
787
888
|
unaccounted: totalTime - (syncTime + perFunction.reduce((acc, { time })=>acc + time, 0))
|
|
788
889
|
};
|
|
789
|
-
const simulationStats = contractFunctionSimulator.getStats();
|
|
790
890
|
return {
|
|
791
891
|
result: executionResult,
|
|
792
892
|
offchainEffects,
|
|
793
893
|
anchorBlockTimestamp: anchorBlockHeader.globalVariables.timestamp,
|
|
794
894
|
stats: {
|
|
795
895
|
timings,
|
|
796
|
-
nodeRPCCalls:
|
|
896
|
+
nodeRPCCalls: recording.stop()
|
|
797
897
|
}
|
|
798
898
|
};
|
|
799
899
|
} catch (err) {
|
|
800
900
|
const { to, name, args } = call;
|
|
801
901
|
const stringifiedArgs = args.map((arg)=>arg.toString()).join(', ');
|
|
802
902
|
throw this.#contextualizeError(err, `executeUtility ${to}:${name}(${stringifiedArgs})`, `scopes=${scopes.map((s)=>s.toString()).join(', ')}`);
|
|
903
|
+
} finally{
|
|
904
|
+
// Idempotent cleanup for the error and early-exit paths. The success path already stopped the recording.
|
|
905
|
+
recording.stop();
|
|
803
906
|
}
|
|
804
907
|
});
|
|
805
908
|
}
|