@aztec/pxe 0.0.1-commit.2f68f620 → 0.0.1-commit.3100065
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dest/bin/check_oracle_version.js +10 -20
- 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 +26 -1
- package/dest/bin/oracle_version_helpers.d.ts.map +1 -1
- package/dest/bin/oracle_version_helpers.js +162 -1
- 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 +18 -14
- package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -1
- package/dest/block_synchronizer/block_synchronizer.js +54 -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 +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_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_function_simulator/anchored_contract_data.d.ts +36 -0
- package/dest/contract_function_simulator/anchored_contract_data.d.ts.map +1 -0
- package/dest/contract_function_simulator/anchored_contract_data.js +54 -0
- package/dest/contract_function_simulator/aztec_node_read_cache.d.ts +39 -0
- package/dest/contract_function_simulator/aztec_node_read_cache.d.ts.map +1 -0
- package/dest/contract_function_simulator/aztec_node_read_cache.js +60 -0
- package/dest/contract_function_simulator/contract_function_simulator.d.ts +19 -18
- package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.js +64 -35
- package/dest/contract_function_simulator/execution_note_cache.d.ts +3 -9
- 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 +19 -10
- package/dest/contract_function_simulator/index.d.ts.map +1 -1
- package/dest/contract_function_simulator/index.js +7 -9
- 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/event_validation_request.js +1 -1
- 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_validation_request.js +2 -2
- 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 +6 -9
- package/dest/contract_function_simulator/noir-structs/provided_secret.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/provided_secret.js +1 -24
- package/dest/contract_function_simulator/noir-structs/resolved_tagging_strategy.d.ts +28 -0
- package/dest/contract_function_simulator/noir-structs/resolved_tagging_strategy.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/resolved_tagging_strategy.js +50 -0
- package/dest/contract_function_simulator/noir-structs/resolved_tx.d.ts +21 -0
- package/dest/contract_function_simulator/noir-structs/resolved_tx.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/resolved_tx.js +50 -0
- package/dest/contract_function_simulator/noir-structs/tx_effect_data.d.ts +14 -0
- package/dest/contract_function_simulator/noir-structs/tx_effect_data.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/tx_effect_data.js +5 -0
- package/dest/contract_function_simulator/noir-structs/utility_context.d.ts +6 -11
- package/dest/contract_function_simulator/noir-structs/utility_context.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/utility_context.js +1 -20
- package/dest/contract_function_simulator/oracle/acir_callback.d.ts +21 -0
- package/dest/contract_function_simulator/oracle/acir_callback.d.ts.map +1 -0
- package/dest/contract_function_simulator/oracle/acir_callback.js +115 -0
- package/dest/contract_function_simulator/oracle/index.d.ts +2 -13
- package/dest/contract_function_simulator/oracle/index.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/index.js +1 -1
- package/dest/contract_function_simulator/oracle/interfaces.d.ts +2 -3
- package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -1
- 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 +41 -30
- package/dest/contract_function_simulator/oracle/oracle_registry.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/oracle_registry.js +248 -27
- package/dest/contract_function_simulator/oracle/oracle_type_mappings.d.ts +123 -40
- package/dest/contract_function_simulator/oracle/oracle_type_mappings.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/oracle_type_mappings.js +947 -264
- 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 +21 -8
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.js +128 -17
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +73 -33
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +220 -104
- 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/utils.d.ts +1 -1
- package/dest/entrypoints/client/bundle/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/utils.js +8 -3
- 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 +8 -3
- 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 +5 -3
- package/dest/entrypoints/server/index.d.ts.map +1 -1
- package/dest/entrypoints/server/index.js +3 -2
- 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 +8 -2
- 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/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 +7 -6
- package/dest/logs/log_service.d.ts.map +1 -1
- package/dest/logs/log_service.js +79 -28
- package/dest/messages/tx_resolver_service.d.ts +17 -0
- package/dest/messages/tx_resolver_service.d.ts.map +1 -0
- package/dest/messages/{message_context_service.js → tx_resolver_service.js} +8 -8
- package/dest/oracle_version.d.ts +3 -3
- package/dest/oracle_version.js +5 -5
- 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 +17 -36
- 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 +222 -139
- 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 +64 -75
- package/dest/storage/fact_store/fact_service.d.ts +22 -0
- package/dest/storage/fact_store/fact_service.d.ts.map +1 -0
- package/dest/storage/fact_store/fact_service.js +45 -0
- package/dest/storage/fact_store/fact_store.d.ts +95 -0
- package/dest/storage/fact_store/fact_store.d.ts.map +1 -0
- package/dest/storage/fact_store/fact_store.js +408 -0
- package/dest/storage/fact_store/fact_store_keys.d.ts +34 -0
- package/dest/storage/fact_store/fact_store_keys.d.ts.map +1 -0
- package/dest/storage/fact_store/fact_store_keys.js +50 -0
- package/dest/storage/fact_store/index.d.ts +6 -0
- package/dest/storage/fact_store/index.d.ts.map +1 -0
- package/dest/storage/fact_store/index.js +4 -0
- package/dest/storage/fact_store/origin_state.d.ts +57 -0
- package/dest/storage/fact_store/origin_state.d.ts.map +1 -0
- package/dest/storage/fact_store/origin_state.js +53 -0
- package/dest/storage/fact_store/stored_fact.d.ts +32 -0
- package/dest/storage/fact_store/stored_fact.d.ts.map +1 -0
- package/dest/storage/fact_store/stored_fact.js +64 -0
- package/dest/storage/index.d.ts +3 -2
- package/dest/storage/index.d.ts.map +1 -1
- package/dest/storage/index.js +2 -1
- package/dest/storage/metadata.d.ts +2 -2
- package/dest/storage/metadata.d.ts.map +1 -1
- package/dest/storage/metadata.js +1 -1
- package/dest/storage/note_store/note_store.d.ts +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/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/tagging_secret_sources_store.d.ts +51 -0
- package/dest/storage/tagging_store/tagging_secret_sources_store.d.ts.map +1 -0
- package/dest/storage/tagging_store/tagging_secret_sources_store.js +105 -0
- package/dest/tagging/constants.d.ts +2 -2
- package/dest/tagging/constants.d.ts.map +1 -1
- package/dest/tagging/constants.js +18 -9
- package/dest/tagging/recipient_sync/sync_tagged_private_logs.d.ts +21 -8
- package/dest/tagging/recipient_sync/sync_tagged_private_logs.d.ts.map +1 -1
- package/dest/tagging/recipient_sync/sync_tagged_private_logs.js +56 -16
- package/package.json +17 -17
- package/src/bin/check_oracle_version.ts +10 -19
- package/src/bin/index.ts +5 -1
- package/src/bin/oracle_version_helpers.ts +190 -0
- package/src/block_synchronizer/block_stream_source.ts +6 -45
- package/src/block_synchronizer/block_synchronizer.ts +70 -29
- package/src/config/index.ts +1 -0
- package/src/config/package_info.ts +1 -1
- package/src/contract/contract_class_service.ts +83 -0
- package/src/{contract_sync → contract}/contract_sync_service.ts +37 -50
- package/src/contract/helpers.ts +35 -0
- package/src/contract_function_simulator/anchored_contract_data.ts +74 -0
- package/src/contract_function_simulator/aztec_node_read_cache.ts +89 -0
- package/src/contract_function_simulator/contract_function_simulator.ts +97 -45
- package/src/contract_function_simulator/execution_note_cache.ts +7 -28
- package/src/contract_function_simulator/index.ts +26 -11
- 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/event_validation_request.ts +1 -1
- 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_validation_request.ts +2 -2
- 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 +4 -26
- package/src/contract_function_simulator/noir-structs/resolved_tagging_strategy.ts +66 -0
- package/src/contract_function_simulator/noir-structs/resolved_tx.ts +53 -0
- package/src/contract_function_simulator/noir-structs/tx_effect_data.ts +15 -0
- package/src/contract_function_simulator/noir-structs/utility_context.ts +5 -17
- package/src/contract_function_simulator/oracle/acir_callback.ts +154 -0
- package/src/contract_function_simulator/oracle/index.ts +1 -15
- package/src/contract_function_simulator/oracle/interfaces.ts +1 -2
- 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 +162 -41
- package/src/contract_function_simulator/oracle/oracle_type_mappings.ts +659 -248
- package/src/contract_function_simulator/oracle/private_execution.ts +2 -3
- package/src/contract_function_simulator/oracle/private_execution_oracle.ts +156 -24
- package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +357 -131
- 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/utils.ts +10 -3
- package/src/entrypoints/client/lazy/utils.ts +10 -3
- package/src/entrypoints/pxe_creation_options.ts +8 -2
- package/src/entrypoints/server/index.ts +5 -2
- package/src/entrypoints/server/utils.ts +10 -2
- package/src/error_enriching.ts +27 -11
- 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 +91 -37
- package/src/messages/{message_context_service.ts → tx_resolver_service.ts} +16 -9
- package/src/oracle_version.ts +5 -5
- 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 +22 -52
- package/src/private_kernel/private_kernel_oracle.ts +23 -4
- package/src/pxe.ts +325 -159
- 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 +86 -93
- package/src/storage/fact_store/fact_service.ts +69 -0
- package/src/storage/fact_store/fact_store.ts +487 -0
- package/src/storage/fact_store/fact_store_keys.ts +75 -0
- package/src/storage/fact_store/index.ts +14 -0
- package/src/storage/fact_store/origin_state.ts +75 -0
- package/src/storage/fact_store/stored_fact.ts +80 -0
- package/src/storage/index.ts +2 -1
- package/src/storage/metadata.ts +1 -1
- package/src/storage/note_store/note_store.ts +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/tagging_store/index.ts +1 -1
- package/src/storage/tagging_store/tagging_secret_sources_store.ts +138 -0
- package/src/tagging/constants.ts +19 -9
- package/src/tagging/recipient_sync/sync_tagged_private_logs.ts +77 -16
- 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/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/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/storage/backwards_compatibility_tests/__snapshots__/SenderAddressBookStore.json +0 -16
- package/src/storage/tagging_store/sender_address_book_store.ts +0 -48
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
|
+
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* In-memory store for transient arrays.
|
|
6
|
+
*
|
|
7
|
+
* Unlike {@link EphemeralArrayService} (one instance per call frame), a single `TransientArrayService` instance is shared
|
|
8
|
+
* across all frames of one top-level PXE call (a transaction simulation or utility call), so arrays survive across nested
|
|
9
|
+
* private and utility calls. Entries are keyed by `(contract address, slot)`; the contract address is supplied by the
|
|
10
|
+
* oracle from its execution context, so a contract can only ever name its own arrays. The store is purely in-memory and
|
|
11
|
+
* is discarded when the top-level PXE call completes — it is never persisted.
|
|
12
|
+
*/
|
|
13
|
+
export class TransientArrayService {
|
|
14
|
+
/** Maps a `(contract address, slot)` key to the serialized elements stored there. */
|
|
15
|
+
#arrays: Map<string, Fr[][]> = new Map();
|
|
16
|
+
|
|
17
|
+
#key(contractAddress: AztecAddress, slot: Fr): string {
|
|
18
|
+
return `${contractAddress.toString()}:${slot.toString()}`;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** Returns all elements at the given key, or an empty array if uninitialized. */
|
|
22
|
+
readArrayAt(contractAddress: AztecAddress, slot: Fr): Fr[][] {
|
|
23
|
+
return this.#arrays.get(this.#key(contractAddress, slot)) ?? [];
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
#setArray(contractAddress: AztecAddress, slot: Fr, array: Fr[][]): void {
|
|
27
|
+
this.#arrays.set(this.#key(contractAddress, slot), array);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** Returns the number of elements stored at the given key. */
|
|
31
|
+
len(contractAddress: AztecAddress, slot: Fr): number {
|
|
32
|
+
return this.readArrayAt(contractAddress, slot).length;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** Appends an element and returns the new length. */
|
|
36
|
+
push(contractAddress: AztecAddress, slot: Fr, elements: Fr[]): number {
|
|
37
|
+
const array = this.readArrayAt(contractAddress, slot);
|
|
38
|
+
array.push(elements);
|
|
39
|
+
this.#setArray(contractAddress, slot, array);
|
|
40
|
+
return array.length;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** Removes and returns the last element. Throws if empty. */
|
|
44
|
+
pop(contractAddress: AztecAddress, slot: Fr): Fr[] {
|
|
45
|
+
const array = this.readArrayAt(contractAddress, slot);
|
|
46
|
+
if (array.length === 0) {
|
|
47
|
+
throw new Error(`Transient array at slot ${slot} is empty`);
|
|
48
|
+
}
|
|
49
|
+
const element = array.pop()!;
|
|
50
|
+
this.#setArray(contractAddress, slot, array);
|
|
51
|
+
return element;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/** Returns the element at the given index. Throws if out of bounds. */
|
|
55
|
+
get(contractAddress: AztecAddress, slot: Fr, index: number): Fr[] {
|
|
56
|
+
const array = this.readArrayAt(contractAddress, slot);
|
|
57
|
+
if (index < 0 || index >= array.length) {
|
|
58
|
+
throw new Error(
|
|
59
|
+
`Transient array index ${index} out of bounds for array of length ${array.length} at slot ${slot}`,
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
return array[index];
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/** Overwrites the element at the given index. Throws if out of bounds. */
|
|
66
|
+
set(contractAddress: AztecAddress, slot: Fr, index: number, value: Fr[]): void {
|
|
67
|
+
const array = this.readArrayAt(contractAddress, slot);
|
|
68
|
+
if (index < 0 || index >= array.length) {
|
|
69
|
+
throw new Error(
|
|
70
|
+
`Transient array index ${index} out of bounds for array of length ${array.length} at slot ${slot}`,
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
array[index] = value;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/** Removes the element at the given index, shifting subsequent elements backward. Throws if out of bounds. */
|
|
77
|
+
remove(contractAddress: AztecAddress, slot: Fr, index: number): void {
|
|
78
|
+
const array = this.readArrayAt(contractAddress, slot);
|
|
79
|
+
if (index < 0 || index >= array.length) {
|
|
80
|
+
throw new Error(
|
|
81
|
+
`Transient array index ${index} out of bounds for array of length ${array.length} at slot ${slot}`,
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
array.splice(index, 1);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/** Removes all elements at the given key. */
|
|
88
|
+
clear(contractAddress: AztecAddress, slot: Fr): void {
|
|
89
|
+
this.#arrays.delete(this.#key(contractAddress, slot));
|
|
90
|
+
}
|
|
91
|
+
}
|
|
@@ -5,8 +5,8 @@ import type { NoteDao } from '@aztec/stdlib/note';
|
|
|
5
5
|
import type { ContractOverrides } from '@aztec/stdlib/tx';
|
|
6
6
|
|
|
7
7
|
import type { BlockSynchronizer } from '../block_synchronizer/block_synchronizer.js';
|
|
8
|
+
import type { ContractSyncService } from '../contract/contract_sync_service.js';
|
|
8
9
|
import type { ContractFunctionSimulator } from '../contract_function_simulator/contract_function_simulator.js';
|
|
9
|
-
import type { ContractSyncService } from '../contract_sync/contract_sync_service.js';
|
|
10
10
|
import type { NotesFilter } from '../notes_filter.js';
|
|
11
11
|
import type { AnchorBlockStore } from '../storage/index.js';
|
|
12
12
|
import type { NoteStore } from '../storage/note_store/note_store.js';
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { BBBundlePrivateKernelProver } from '@aztec/bb-prover/client/bundle';
|
|
2
2
|
import { createLogger } from '@aztec/foundation/log';
|
|
3
|
-
import { createStore } from '@aztec/kv-store/
|
|
3
|
+
import { createStore } from '@aztec/kv-store/sqlite-opfs';
|
|
4
4
|
import { BundledProtocolContractsProvider } from '@aztec/protocol-contracts/providers/bundle';
|
|
5
5
|
import { WASMSimulator } from '@aztec/simulator/client';
|
|
6
|
+
import { getStandardAuthRegistry } from '@aztec/standard-contracts/auth-registry';
|
|
7
|
+
import { getStandardHandshakeRegistry } from '@aztec/standard-contracts/handshake-registry';
|
|
6
8
|
import { getStandardMultiCallEntrypoint } from '@aztec/standard-contracts/multi-call-entrypoint';
|
|
7
9
|
import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
8
10
|
|
|
@@ -35,7 +37,7 @@ export async function createPXE(
|
|
|
35
37
|
...l1ContractAddresses,
|
|
36
38
|
} as PXEConfig;
|
|
37
39
|
|
|
38
|
-
const storeLogger = loggers.store ?? createLogger('pxe:data
|
|
40
|
+
const storeLogger = loggers.store ?? createLogger('pxe:data', { actor });
|
|
39
41
|
|
|
40
42
|
const store =
|
|
41
43
|
options.store ?? (await createStore('pxe_data', configWithContracts, PXE_DATA_SCHEMA_VERSION, storeLogger));
|
|
@@ -51,12 +53,17 @@ export async function createPXE(
|
|
|
51
53
|
}
|
|
52
54
|
const protocolContractsProvider = new BundledProtocolContractsProvider();
|
|
53
55
|
const preloadedContractsProvider = options.preloadedContractsProvider ?? {
|
|
54
|
-
getPreloadedContracts: async () => [
|
|
56
|
+
getPreloadedContracts: async () => [
|
|
57
|
+
await getStandardMultiCallEntrypoint(),
|
|
58
|
+
await getStandardAuthRegistry(),
|
|
59
|
+
await getStandardHandshakeRegistry(),
|
|
60
|
+
],
|
|
55
61
|
};
|
|
56
62
|
|
|
57
63
|
const pxeLogger = loggers.pxe ?? createLogger('pxe:service', { actor });
|
|
58
64
|
const pxe = await PXE.create({
|
|
59
65
|
node: aztecNode,
|
|
66
|
+
nodeDebug: options.nodeDebug,
|
|
60
67
|
store,
|
|
61
68
|
proofCreator: prover,
|
|
62
69
|
simulator,
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { BBLazyPrivateKernelProver } from '@aztec/bb-prover/client/lazy';
|
|
2
2
|
import { createLogger } from '@aztec/foundation/log';
|
|
3
|
-
import { createStore } from '@aztec/kv-store/
|
|
3
|
+
import { createStore } from '@aztec/kv-store/sqlite-opfs';
|
|
4
4
|
import { LazyProtocolContractsProvider } from '@aztec/protocol-contracts/providers/lazy';
|
|
5
5
|
import { WASMSimulator } from '@aztec/simulator/client';
|
|
6
|
+
import { getStandardAuthRegistry } from '@aztec/standard-contracts/auth-registry/lazy';
|
|
7
|
+
import { getStandardHandshakeRegistry } from '@aztec/standard-contracts/handshake-registry/lazy';
|
|
6
8
|
import { getStandardMultiCallEntrypoint } from '@aztec/standard-contracts/multi-call-entrypoint/lazy';
|
|
7
9
|
import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
8
10
|
|
|
@@ -35,7 +37,7 @@ export async function createPXE(
|
|
|
35
37
|
|
|
36
38
|
const loggers = options.loggers ?? {};
|
|
37
39
|
|
|
38
|
-
const storeLogger = loggers.store ?? createLogger('pxe:data
|
|
40
|
+
const storeLogger = loggers.store ?? createLogger('pxe:data', { actor });
|
|
39
41
|
|
|
40
42
|
const store =
|
|
41
43
|
options.store ?? (await createStore('pxe_data', configWithContracts, PXE_DATA_SCHEMA_VERSION, storeLogger));
|
|
@@ -51,12 +53,17 @@ export async function createPXE(
|
|
|
51
53
|
}
|
|
52
54
|
const protocolContractsProvider = new LazyProtocolContractsProvider();
|
|
53
55
|
const preloadedContractsProvider = options.preloadedContractsProvider ?? {
|
|
54
|
-
getPreloadedContracts: async () => [
|
|
56
|
+
getPreloadedContracts: async () => [
|
|
57
|
+
await getStandardMultiCallEntrypoint(),
|
|
58
|
+
await getStandardAuthRegistry(),
|
|
59
|
+
await getStandardHandshakeRegistry(),
|
|
60
|
+
],
|
|
55
61
|
};
|
|
56
62
|
|
|
57
63
|
const pxeLogger = loggers.pxe ?? createLogger('pxe:service', { actor });
|
|
58
64
|
const pxe = await PXE.create({
|
|
59
65
|
node: aztecNode,
|
|
66
|
+
nodeDebug: options.nodeDebug,
|
|
60
67
|
store,
|
|
61
68
|
proofCreator: prover,
|
|
62
69
|
simulator,
|
|
@@ -2,7 +2,7 @@ import type { BBPrivateKernelProverOptions } from '@aztec/bb-prover/client';
|
|
|
2
2
|
import type { Logger } from '@aztec/foundation/log';
|
|
3
3
|
import type { AztecAsyncKVStore } from '@aztec/kv-store';
|
|
4
4
|
import type { CircuitSimulator } from '@aztec/simulator/client';
|
|
5
|
-
import type { PrivateKernelProver } from '@aztec/stdlib/interfaces/client';
|
|
5
|
+
import type { AztecNodeDebug, PrivateKernelProver } from '@aztec/stdlib/interfaces/client';
|
|
6
6
|
|
|
7
7
|
import type { ExecutionHooks } from '../hooks/index.js';
|
|
8
8
|
import type { PreloadedContractsProvider } from '../pxe.js';
|
|
@@ -16,8 +16,14 @@ export type PXECreationOptions = {
|
|
|
16
16
|
simulator?: CircuitSimulator;
|
|
17
17
|
/** Optional hooks to observe and influence contract execution. */
|
|
18
18
|
hooks?: ExecutionHooks;
|
|
19
|
-
/** Contracts to preload
|
|
19
|
+
/** Contracts to preload on startup. Replaces the default when set. */
|
|
20
20
|
preloadedContractsProvider?: PreloadedContractsProvider;
|
|
21
|
+
/**
|
|
22
|
+
* Optional debug API client for the same node. When provided, public function signatures are registered so the
|
|
23
|
+
* node can produce named public-execution stack traces. Only available on nodes started with debug endpoints
|
|
24
|
+
* enabled; omitted in prod-like setups.
|
|
25
|
+
*/
|
|
26
|
+
nodeDebug?: AztecNodeDebug;
|
|
21
27
|
};
|
|
22
28
|
|
|
23
29
|
/** Checks if the given value implements the PrivateKernelProver interface via duck-typing. */
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
export { type AccountPrivacyKeys, type AccountPrivacySecretKeys } from '@aztec/key-store';
|
|
2
|
+
|
|
1
3
|
export * from '../../notes_filter.js';
|
|
2
4
|
export * from '../../pxe.js';
|
|
3
|
-
export * from '../../hooks/index.js';
|
|
4
5
|
export * from '../../config/index.js';
|
|
5
6
|
export * from '../../error_enriching.js';
|
|
6
7
|
export * from '../../storage/index.js';
|
|
@@ -9,4 +10,6 @@ export { NoteService } from '../../notes/note_service.js';
|
|
|
9
10
|
export { ORACLE_VERSION_MAJOR, ORACLE_VERSION_MINOR } from '../../oracle_version.js';
|
|
10
11
|
export { type PXECreationOptions } from '../pxe_creation_options.js';
|
|
11
12
|
export { JobCoordinator } from '../../job_coordinator/job_coordinator.js';
|
|
12
|
-
export { ContractSyncService } from '../../
|
|
13
|
+
export { ContractSyncService } from '../../contract/contract_sync_service.js';
|
|
14
|
+
export { ContractClassService } from '../../contract/contract_class_service.js';
|
|
15
|
+
export { AnchoredContractData } from '../../contract_function_simulator/anchored_contract_data.js';
|
|
@@ -3,8 +3,11 @@ import type { L1ContractAddresses } from '@aztec/ethereum/l1-contract-addresses'
|
|
|
3
3
|
import { createLogger } from '@aztec/foundation/log';
|
|
4
4
|
import { createStore } from '@aztec/kv-store/lmdb-v2';
|
|
5
5
|
import { BundledProtocolContractsProvider } from '@aztec/protocol-contracts/providers/bundle';
|
|
6
|
-
import {
|
|
6
|
+
import { WASMSimulator } from '@aztec/simulator/client';
|
|
7
|
+
import { MemoryCircuitRecorder, SimulatorRecorderWrapper } from '@aztec/simulator/server';
|
|
7
8
|
import { FileCircuitRecorder } from '@aztec/simulator/testing';
|
|
9
|
+
import { getStandardAuthRegistry } from '@aztec/standard-contracts/auth-registry';
|
|
10
|
+
import { getStandardHandshakeRegistry } from '@aztec/standard-contracts/handshake-registry';
|
|
8
11
|
import { getStandardMultiCallEntrypoint } from '@aztec/standard-contracts/multi-call-entrypoint';
|
|
9
12
|
import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
10
13
|
|
|
@@ -61,12 +64,17 @@ export async function createPXE(
|
|
|
61
64
|
|
|
62
65
|
const protocolContractsProvider = new BundledProtocolContractsProvider();
|
|
63
66
|
const preloadedContractsProvider = options.preloadedContractsProvider ?? {
|
|
64
|
-
getPreloadedContracts: async () => [
|
|
67
|
+
getPreloadedContracts: async () => [
|
|
68
|
+
await getStandardMultiCallEntrypoint(),
|
|
69
|
+
await getStandardAuthRegistry(),
|
|
70
|
+
await getStandardHandshakeRegistry(),
|
|
71
|
+
],
|
|
65
72
|
};
|
|
66
73
|
|
|
67
74
|
const pxeLogger = loggers.pxe ?? createLogger('pxe:service', { actor });
|
|
68
75
|
const pxe = await PXE.create({
|
|
69
76
|
node: aztecNode,
|
|
77
|
+
nodeDebug: options.nodeDebug,
|
|
70
78
|
store: options.store,
|
|
71
79
|
proofCreator: prover,
|
|
72
80
|
simulator,
|
package/src/error_enriching.ts
CHANGED
|
@@ -3,7 +3,9 @@ import { resolveAssertionMessageFromRevertData, resolveOpcodeLocations } from '@
|
|
|
3
3
|
import { FunctionSelector } from '@aztec/stdlib/abi';
|
|
4
4
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
5
5
|
import { type SimulationError, isNoirCallStackUnresolved } from '@aztec/stdlib/errors';
|
|
6
|
+
import type { BlockHeader } from '@aztec/stdlib/tx';
|
|
6
7
|
|
|
8
|
+
import type { ContractClassService } from './contract/contract_class_service.js';
|
|
7
9
|
import type { ContractStore } from './storage/contract_store/contract_store.js';
|
|
8
10
|
|
|
9
11
|
/**
|
|
@@ -11,7 +13,13 @@ import type { ContractStore } from './storage/contract_store/contract_store.js';
|
|
|
11
13
|
* can be found in the PXE database
|
|
12
14
|
* @param err - The error to enrich.
|
|
13
15
|
*/
|
|
14
|
-
export async function enrichSimulationError(
|
|
16
|
+
export async function enrichSimulationError(
|
|
17
|
+
err: SimulationError,
|
|
18
|
+
contractStore: ContractStore,
|
|
19
|
+
contractClassService: ContractClassService,
|
|
20
|
+
anchorHeader: BlockHeader,
|
|
21
|
+
logger: Logger,
|
|
22
|
+
) {
|
|
15
23
|
// Maps contract addresses to the set of function selectors that were in error.
|
|
16
24
|
// Map and Set do reference equality for their keys instead of value equality, so we store the string
|
|
17
25
|
// representation to get e.g. different contract address objects with the same address value to match.
|
|
@@ -29,14 +37,15 @@ export async function enrichSimulationError(err: SimulationError, contractStore:
|
|
|
29
37
|
|
|
30
38
|
await Promise.all(
|
|
31
39
|
[...mentionedFunctions.entries()].map(async ([contractAddress, fnSelectors]) => {
|
|
32
|
-
const parsedContractAddress = AztecAddress.
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
40
|
+
const parsedContractAddress = AztecAddress.fromStringUnsafe(contractAddress);
|
|
41
|
+
const classId = await contractClassService.getCurrentClassId(parsedContractAddress, anchorHeader);
|
|
42
|
+
const artifact = classId && (await contractStore.getContractArtifact(classId));
|
|
43
|
+
if (artifact) {
|
|
44
|
+
err.enrichWithContractName(parsedContractAddress, artifact.name);
|
|
36
45
|
// Map from function selector to function name. It uses a stringified key for the same reason as mentionedFunctions.
|
|
37
46
|
const selectorToNameMap: Map<string, string> = new Map();
|
|
38
47
|
await Promise.all(
|
|
39
|
-
|
|
48
|
+
artifact.functions.map(async fn => {
|
|
40
49
|
const selector = await FunctionSelector.fromNameAndParameters(fn);
|
|
41
50
|
selectorToNameMap.set(selector.toString(), fn.name);
|
|
42
51
|
}),
|
|
@@ -51,7 +60,7 @@ export async function enrichSimulationError(err: SimulationError, contractStore:
|
|
|
51
60
|
);
|
|
52
61
|
} else {
|
|
53
62
|
logger.warn(
|
|
54
|
-
`Could not find function artifact in contract ${
|
|
63
|
+
`Could not find function artifact in contract ${artifact.name} for function '${fnSelector}' when enriching error callstack`,
|
|
55
64
|
);
|
|
56
65
|
}
|
|
57
66
|
}
|
|
@@ -64,7 +73,13 @@ export async function enrichSimulationError(err: SimulationError, contractStore:
|
|
|
64
73
|
);
|
|
65
74
|
}
|
|
66
75
|
|
|
67
|
-
export async function enrichPublicSimulationError(
|
|
76
|
+
export async function enrichPublicSimulationError(
|
|
77
|
+
err: SimulationError,
|
|
78
|
+
contractStore: ContractStore,
|
|
79
|
+
contractClassService: ContractClassService,
|
|
80
|
+
anchorHeader: BlockHeader,
|
|
81
|
+
logger: Logger,
|
|
82
|
+
) {
|
|
68
83
|
const callStack = err.getCallStack();
|
|
69
84
|
const originalFailingFunction = callStack[callStack.length - 1];
|
|
70
85
|
|
|
@@ -72,7 +87,8 @@ export async function enrichPublicSimulationError(err: SimulationError, contract
|
|
|
72
87
|
throw new Error(`Original failing function not found when enriching public simulation, missing callstack`);
|
|
73
88
|
}
|
|
74
89
|
|
|
75
|
-
const
|
|
90
|
+
const classId = await contractClassService.getCurrentClassId(originalFailingFunction.contractAddress, anchorHeader);
|
|
91
|
+
const artifact = classId && (await contractStore.getPublicFunctionArtifact(classId));
|
|
76
92
|
if (!artifact) {
|
|
77
93
|
throw new Error(
|
|
78
94
|
`Artifact not found when enriching public simulation error. Contract address: ${originalFailingFunction.contractAddress}.`,
|
|
@@ -84,7 +100,7 @@ export async function enrichPublicSimulationError(err: SimulationError, contract
|
|
|
84
100
|
err.setOriginalMessage(err.getOriginalMessage() + `${assertionMessage}`);
|
|
85
101
|
}
|
|
86
102
|
|
|
87
|
-
const debugInfo = await contractStore.getPublicFunctionDebugMetadata(
|
|
103
|
+
const debugInfo = await contractStore.getPublicFunctionDebugMetadata(classId);
|
|
88
104
|
|
|
89
105
|
const noirCallStack = err.getNoirCallStack();
|
|
90
106
|
if (debugInfo) {
|
|
@@ -102,6 +118,6 @@ export async function enrichPublicSimulationError(err: SimulationError, contract
|
|
|
102
118
|
);
|
|
103
119
|
}
|
|
104
120
|
}
|
|
105
|
-
await enrichSimulationError(err, contractStore, logger);
|
|
121
|
+
await enrichSimulationError(err, contractStore, contractClassService, anchorHeader, logger);
|
|
106
122
|
}
|
|
107
123
|
}
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import type { AuthorizeUtilityCall } from './authorize_utility_call.js';
|
|
2
|
+
import type { ResolveCustomRequest } from './resolve_custom_request.js';
|
|
3
|
+
import type { ResolveTaggingSecretStrategy } from './resolve_tagging_secret_strategy.js';
|
|
2
4
|
|
|
3
5
|
/**
|
|
4
|
-
* Hooks that PXE invokes during client-side simulation to gate operations that the protocol
|
|
6
|
+
* Hooks that PXE invokes during client-side simulation to gate or steer operations that the protocol
|
|
5
7
|
* does not restrict on its own. They give the wallet a chance to apply custom policies (e.g.
|
|
6
8
|
* prompting the user, consulting a dynamic allowlist, or inspecting call arguments) before the
|
|
7
|
-
* execution proceeds.
|
|
9
|
+
* execution proceeds. All hooks are optional, and when a hook is absent PXE applies a safe default.
|
|
8
10
|
*
|
|
9
|
-
* For example, {@link authorizeUtilityCall} is called whenever a utility function makes a
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
11
|
+
* For example, {@link authorizeUtilityCall} is called whenever a utility function makes a cross-contract call. A call
|
|
12
|
+
* made by a malicious contract could leak private information, so the hook lets the wallet decide, per-call, whether
|
|
13
|
+
* to allow it. A static allowlist would not work here because neither the app nor the wallet can predict ahead of
|
|
14
|
+
* time which contracts will be invoked during execution. Calls to standard contracts (such as the HandshakeRegistry)
|
|
15
|
+
* bypass this hook and are always authorized. When the hook is absent, cross-contract utility calls are denied.
|
|
14
16
|
*
|
|
15
17
|
* Note: hooks are unrelated to authentication witnesses (authwits). Authwits are an on-chain
|
|
16
18
|
* mechanism where a contract verifies that a caller was authorized by a specific account; hooks
|
|
@@ -27,22 +29,40 @@ import type { AuthorizeUtilityCall } from './authorize_utility_call.js';
|
|
|
27
29
|
* ? { authorized: true }
|
|
28
30
|
* : { authorized: false, reason: 'Unknown target' };
|
|
29
31
|
* },
|
|
32
|
+
* // Apply per-recipient policy: reach a known contact via their address keys (no onchain trace) and use a
|
|
33
|
+
* // non-interactive handshake for everyone else.
|
|
34
|
+
* resolveTaggingSecretStrategy: async ({ recipient }) =>
|
|
35
|
+
* knownContacts.has(recipient.toString())
|
|
36
|
+
* ? { type: 'address-derived' }
|
|
37
|
+
* : { type: 'non-interactive-handshake' },
|
|
30
38
|
* },
|
|
31
39
|
* });
|
|
32
40
|
* ```
|
|
33
41
|
*/
|
|
34
42
|
export interface ExecutionHooks {
|
|
35
|
-
/** Called when a contract attempts a cross-contract utility call. */
|
|
36
|
-
authorizeUtilityCall
|
|
43
|
+
/** Called when a contract attempts a cross-contract utility call. Calls are denied when absent. */
|
|
44
|
+
authorizeUtilityCall?: AuthorizeUtilityCall;
|
|
45
|
+
/**
|
|
46
|
+
* Resolves a message's tagging secret when none is already established for the sender/recipient pair, letting the
|
|
47
|
+
* wallet apply per-recipient policy. PXE applies a default when absent.
|
|
48
|
+
* See {@link ResolveTaggingSecretStrategy} for the request shape and defaults.
|
|
49
|
+
*/
|
|
50
|
+
resolveTaggingSecretStrategy?: ResolveTaggingSecretStrategy;
|
|
51
|
+
/**
|
|
52
|
+
* Resolves a custom, caller-defined request a circuit cannot serve from local state. Any contract can issue one, so
|
|
53
|
+
* an implementor should verify both the request `kind` and the issuing contract (its address and class ID) before
|
|
54
|
+
* fulfilling it. Rejected when absent; see {@link ResolveCustomRequest}.
|
|
55
|
+
*/
|
|
56
|
+
resolveCustomRequest?: ResolveCustomRequest;
|
|
37
57
|
}
|
|
38
58
|
|
|
39
59
|
/**
|
|
40
60
|
* Builds an {@link ExecutionHooks} from individually-constructed hook callbacks. Returns `undefined`
|
|
41
61
|
* when every field is absent, so callers can unconditionally pass the result as `hooks`.
|
|
42
62
|
*/
|
|
43
|
-
export function composeHooks(
|
|
44
|
-
if (Object.values(
|
|
63
|
+
export function composeHooks(hooks: ExecutionHooks): ExecutionHooks | undefined {
|
|
64
|
+
if (Object.values(hooks).every(v => v === undefined)) {
|
|
45
65
|
return undefined;
|
|
46
66
|
}
|
|
47
|
-
return
|
|
67
|
+
return hooks;
|
|
48
68
|
}
|
package/src/hooks/index.ts
CHANGED
|
@@ -3,5 +3,11 @@ export type {
|
|
|
3
3
|
UtilityCallAuthorizationRequest,
|
|
4
4
|
UtilityCallAuthorizationResponse,
|
|
5
5
|
} from './authorize_utility_call.js';
|
|
6
|
-
export type
|
|
7
|
-
export {
|
|
6
|
+
export { type ExecutionHooks, composeHooks } from './execution_hooks.js';
|
|
7
|
+
export { type CustomRequest, type ResolveCustomRequest } from './resolve_custom_request.js';
|
|
8
|
+
export {
|
|
9
|
+
DEFAULT_TAGGING_SECRET_STRATEGY,
|
|
10
|
+
type ResolveTaggingSecretStrategy,
|
|
11
|
+
type TaggingSecretStrategy,
|
|
12
|
+
type TaggingSecretStrategyRequest,
|
|
13
|
+
} from './resolve_tagging_secret_strategy.js';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
|
+
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* A custom, caller-defined request resolved via the {@link ResolveCustomRequest} hook. It carries no fixed meaning:
|
|
6
|
+
* `kind` selects the request type so one hook can serve many such types, and `payload` holds the opaque,
|
|
7
|
+
* request-specific arguments. The resolver answers by whatever means it needs (local state, a third party,
|
|
8
|
+
* offchain data).
|
|
9
|
+
*/
|
|
10
|
+
export type CustomRequest = {
|
|
11
|
+
/** The address of the contract issuing the request. */
|
|
12
|
+
contractAddress: AztecAddress;
|
|
13
|
+
/** The issuing contract's class ID, so resolvers can apply class-level (not just per-address) policy. */
|
|
14
|
+
contractClassId: Fr;
|
|
15
|
+
/** Discriminates the request type, letting one hook serve many such types. */
|
|
16
|
+
kind: Fr;
|
|
17
|
+
/** Opaque, request-specific arguments. */
|
|
18
|
+
payload: Fr[];
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Hook resolving a {@link CustomRequest}. The resolver produces the response however it needs to.
|
|
23
|
+
*/
|
|
24
|
+
export type ResolveCustomRequest = (request: CustomRequest) => Promise<Fr[]>;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
|
+
import type { Point } from '@aztec/foundation/curves/grumpkin';
|
|
3
|
+
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
|
+
import type { AppTaggingSecretKind } from '@aztec/stdlib/logs';
|
|
5
|
+
|
|
6
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- only referenced by a {@link} doc tag
|
|
7
|
+
import type { ResolveCustomRequest } from './resolve_custom_request.js';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* How a message's tagging secret is chosen: the wallet's strategy, returned by the `resolveTaggingSecretStrategy` hook
|
|
11
|
+
* when no onchain handshake has been registered for the sender/recipient pair. This is intent (plus, for an arbitrary
|
|
12
|
+
* secret, the raw material); PXE resolves it into the secret it hands the contract.
|
|
13
|
+
*/
|
|
14
|
+
export type TaggingSecretStrategy =
|
|
15
|
+
| {
|
|
16
|
+
/** Establish a fresh non-interactive handshake via the onchain registry; reveals the recipient onchain. */
|
|
17
|
+
type: 'non-interactive-handshake';
|
|
18
|
+
}
|
|
19
|
+
| {
|
|
20
|
+
/**
|
|
21
|
+
* Establish a fresh interactive handshake via the onchain registry. Reveals nothing about the recipient
|
|
22
|
+
* onchain, but requires the recipient to answer the registry's signed-authorization request (served through
|
|
23
|
+
* the {@link ResolveCustomRequest} hook), so the send fails when it cannot be served.
|
|
24
|
+
*/
|
|
25
|
+
type: 'interactive-handshake';
|
|
26
|
+
}
|
|
27
|
+
| {
|
|
28
|
+
/** Derive the secret from the sender's and recipient's address keys via ECDH. PXE computes and silos it. */
|
|
29
|
+
type: 'address-derived';
|
|
30
|
+
}
|
|
31
|
+
| {
|
|
32
|
+
/**
|
|
33
|
+
* A raw shared secret point the two parties already share offchain (e.g. coordinated out-of-band), supplied by
|
|
34
|
+
* the wallet. PXE app-silos it before use. Only sound for unconstrained delivery, since nothing onchain proves
|
|
35
|
+
* the recipient knows it.
|
|
36
|
+
*/
|
|
37
|
+
type: 'arbitrary-secret';
|
|
38
|
+
/** The raw (un-siloed) shared secret point to derive the tag from. */
|
|
39
|
+
secret: Point;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
/** The strategy PXE applies to both delivery modes when no `resolveTaggingSecretStrategy` hook is configured. */
|
|
43
|
+
export const DEFAULT_TAGGING_SECRET_STRATEGY: TaggingSecretStrategy = { type: 'non-interactive-handshake' };
|
|
44
|
+
|
|
45
|
+
/** Information about the message delivery requesting a tagging secret strategy. */
|
|
46
|
+
export type TaggingSecretStrategyRequest = {
|
|
47
|
+
contractAddress: AztecAddress;
|
|
48
|
+
/**
|
|
49
|
+
* The contract class ID of the executing contract, so wallets can apply class-level (not just per-address) policy.
|
|
50
|
+
*/
|
|
51
|
+
contractClassId: Fr;
|
|
52
|
+
sender: AztecAddress;
|
|
53
|
+
recipient: AztecAddress;
|
|
54
|
+
deliveryMode: AppTaggingSecretKind;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Hook returning the {@link TaggingSecretStrategy} for an outgoing message.
|
|
59
|
+
*/
|
|
60
|
+
export type ResolveTaggingSecretStrategy = (request: TaggingSecretStrategyRequest) => Promise<TaggingSecretStrategy>;
|