@aztec/pxe 0.0.1-commit.b655e406 → 0.0.1-commit.b8a057fa
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dest/bin/check_oracle_version.d.ts +1 -1
- package/dest/bin/check_oracle_version.js +53 -29
- package/dest/bin/index.d.ts +2 -0
- package/dest/bin/index.d.ts.map +1 -0
- package/dest/bin/index.js +1 -0
- package/dest/bin/oracle_version_helpers.d.ts +51 -0
- package/dest/bin/oracle_version_helpers.d.ts.map +1 -0
- package/dest/bin/oracle_version_helpers.js +254 -0
- package/dest/block_synchronizer/block_stream_source.d.ts +10 -0
- package/dest/block_synchronizer/block_stream_source.d.ts.map +1 -0
- package/dest/block_synchronizer/block_stream_source.js +37 -0
- package/dest/block_synchronizer/block_synchronizer.d.ts +53 -0
- package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -0
- package/dest/block_synchronizer/block_synchronizer.js +209 -0
- package/dest/block_synchronizer/index.d.ts +2 -0
- package/dest/block_synchronizer/index.d.ts.map +1 -0
- package/dest/block_synchronizer/index.js +1 -0
- package/dest/config/index.d.ts +14 -13
- package/dest/config/index.d.ts.map +1 -1
- package/dest/config/index.js +25 -15
- package/dest/config/package_info.d.ts +1 -1
- package/dest/config/package_info.js +1 -1
- package/dest/contract/contract_class_service.d.ts +31 -0
- package/dest/contract/contract_class_service.d.ts.map +1 -0
- package/dest/contract/contract_class_service.js +68 -0
- package/dest/contract/contract_sync_service.d.ts +48 -0
- package/dest/contract/contract_sync_service.d.ts.map +1 -0
- package/dest/contract/contract_sync_service.js +116 -0
- package/dest/contract/helpers.d.ts +7 -0
- package/dest/contract/helpers.d.ts.map +1 -0
- package/dest/contract/helpers.js +20 -0
- package/dest/contract_function_simulator/anchored_contract_data.d.ts +36 -0
- package/dest/contract_function_simulator/anchored_contract_data.d.ts.map +1 -0
- package/dest/contract_function_simulator/anchored_contract_data.js +54 -0
- package/dest/contract_function_simulator/benchmarked_node.d.ts +9 -0
- package/dest/contract_function_simulator/benchmarked_node.d.ts.map +1 -0
- package/dest/contract_function_simulator/benchmarked_node.js +77 -0
- package/dest/contract_function_simulator/contract_function_simulator.d.ts +93 -29
- package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.js +307 -97
- package/dest/contract_function_simulator/ephemeral_array_service.d.ts +28 -0
- package/dest/contract_function_simulator/ephemeral_array_service.d.ts.map +1 -0
- package/dest/contract_function_simulator/ephemeral_array_service.js +78 -0
- package/dest/contract_function_simulator/execution_note_cache.d.ts +22 -17
- package/dest/contract_function_simulator/execution_note_cache.d.ts.map +1 -1
- package/dest/contract_function_simulator/execution_note_cache.js +41 -36
- package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts +7 -11
- package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts.map +1 -1
- package/dest/contract_function_simulator/execution_tagging_index_cache.js +19 -15
- package/dest/contract_function_simulator/hashed_values_cache.d.ts +2 -2
- package/dest/contract_function_simulator/hashed_values_cache.d.ts.map +1 -1
- package/dest/contract_function_simulator/index.d.ts +27 -6
- package/dest/contract_function_simulator/index.d.ts.map +1 -1
- package/dest/contract_function_simulator/index.js +13 -4
- package/dest/contract_function_simulator/noir-structs/bounded_vec.d.ts +29 -0
- package/dest/contract_function_simulator/noir-structs/bounded_vec.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/bounded_vec.js +30 -0
- package/dest/contract_function_simulator/noir-structs/contract_class_log_data.d.ts +9 -0
- package/dest/contract_function_simulator/noir-structs/contract_class_log_data.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/contract_class_log_data.js +1 -0
- package/dest/contract_function_simulator/noir-structs/embedded_curve_point.d.ts +7 -0
- package/dest/contract_function_simulator/noir-structs/embedded_curve_point.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/embedded_curve_point.js +1 -0
- package/dest/contract_function_simulator/noir-structs/ephemeral_array.d.ts +37 -0
- package/dest/contract_function_simulator/noir-structs/ephemeral_array.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/ephemeral_array.js +59 -0
- package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts +6 -6
- package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/event_validation_request.js +13 -11
- package/dest/contract_function_simulator/noir-structs/fact.d.ts +16 -0
- package/dest/contract_function_simulator/noir-structs/fact.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/fact.js +6 -0
- package/dest/contract_function_simulator/noir-structs/fact_collection.d.ts +27 -0
- package/dest/contract_function_simulator/noir-structs/fact_collection.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/fact_collection.js +31 -0
- package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts +21 -11
- package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/log_retrieval_request.js +12 -23
- package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts +11 -9
- package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/log_retrieval_response.js +2 -63
- package/dest/contract_function_simulator/noir-structs/note_data.d.ts +27 -0
- package/dest/contract_function_simulator/noir-structs/note_data.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/note_data.js +3 -0
- package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +7 -7
- package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/note_validation_request.js +16 -11
- package/dest/contract_function_simulator/noir-structs/option.d.ts +59 -0
- package/dest/contract_function_simulator/noir-structs/option.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/option.js +67 -0
- package/dest/contract_function_simulator/noir-structs/origin_block.d.ts +11 -0
- package/dest/contract_function_simulator/noir-structs/origin_block.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/origin_block.js +5 -0
- package/dest/contract_function_simulator/noir-structs/pending_tagged_log.d.ts +11 -0
- package/dest/contract_function_simulator/noir-structs/pending_tagged_log.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/pending_tagged_log.js +4 -0
- package/dest/contract_function_simulator/noir-structs/provided_secret.d.ts +8 -0
- package/dest/contract_function_simulator/noir-structs/provided_secret.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/provided_secret.js +1 -0
- package/dest/contract_function_simulator/noir-structs/resolved_tagging_strategy.d.ts +28 -0
- package/dest/contract_function_simulator/noir-structs/resolved_tagging_strategy.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/resolved_tagging_strategy.js +43 -0
- package/dest/contract_function_simulator/noir-structs/resolved_tx.d.ts +21 -0
- package/dest/contract_function_simulator/noir-structs/resolved_tx.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/resolved_tx.js +50 -0
- package/dest/contract_function_simulator/noir-structs/tx_effect_data.d.ts +14 -0
- package/dest/contract_function_simulator/noir-structs/tx_effect_data.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/tx_effect_data.js +5 -0
- package/dest/contract_function_simulator/noir-structs/utility_context.d.ts +7 -18
- package/dest/contract_function_simulator/noir-structs/utility_context.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/utility_context.js +1 -31
- package/dest/contract_function_simulator/oracle/acir_callback.d.ts +21 -0
- package/dest/contract_function_simulator/oracle/acir_callback.d.ts.map +1 -0
- package/dest/contract_function_simulator/oracle/acir_callback.js +115 -0
- package/dest/contract_function_simulator/oracle/index.d.ts +2 -13
- package/dest/contract_function_simulator/oracle/index.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/index.js +1 -1
- package/dest/contract_function_simulator/oracle/interfaces.d.ts +15 -88
- package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/interfaces.js +2 -2
- package/dest/contract_function_simulator/oracle/legacy_oracle_registry.d.ts +39 -0
- package/dest/contract_function_simulator/oracle/legacy_oracle_registry.d.ts.map +1 -0
- package/dest/contract_function_simulator/oracle/legacy_oracle_registry.js +74 -0
- package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts +3 -14
- package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.js +1 -24
- package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts +14 -8
- package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/note_packing_utils.js +17 -12
- package/dest/contract_function_simulator/oracle/oracle_registry.d.ts +136 -0
- package/dest/contract_function_simulator/oracle/oracle_registry.d.ts.map +1 -0
- package/dest/contract_function_simulator/oracle/oracle_registry.js +989 -0
- package/dest/contract_function_simulator/oracle/oracle_type_mappings.d.ts +222 -0
- package/dest/contract_function_simulator/oracle/oracle_type_mappings.d.ts.map +1 -0
- package/dest/contract_function_simulator/oracle/oracle_type_mappings.js +1243 -0
- package/dest/contract_function_simulator/oracle/private_execution.d.ts +2 -27
- package/dest/contract_function_simulator/oracle/private_execution.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution.js +8 -43
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +92 -103
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.js +291 -138
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +228 -62
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +632 -129
- package/dest/contract_function_simulator/pick_notes.d.ts +2 -2
- package/dest/contract_function_simulator/pick_notes.d.ts.map +1 -1
- package/dest/contract_function_simulator/pick_notes.js +21 -4
- package/dest/contract_function_simulator/transient_array_service.d.ts +31 -0
- package/dest/contract_function_simulator/transient_array_service.d.ts.map +1 -0
- package/dest/contract_function_simulator/transient_array_service.js +62 -0
- package/dest/contract_logging.d.ts +27 -0
- package/dest/contract_logging.d.ts.map +1 -0
- package/dest/contract_logging.js +38 -0
- package/dest/debug/pxe_debug_utils.d.ts +40 -0
- package/dest/debug/pxe_debug_utils.d.ts.map +1 -0
- package/dest/debug/pxe_debug_utils.js +42 -0
- package/dest/entrypoints/client/bundle/index.d.ts +3 -2
- package/dest/entrypoints/client/bundle/index.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/index.js +2 -1
- package/dest/entrypoints/client/bundle/utils.d.ts +2 -2
- package/dest/entrypoints/client/bundle/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/utils.js +49 -13
- package/dest/entrypoints/client/lazy/index.d.ts +3 -2
- package/dest/entrypoints/client/lazy/index.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/index.js +2 -1
- package/dest/entrypoints/client/lazy/utils.d.ts +3 -3
- package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/utils.js +50 -14
- package/dest/entrypoints/pxe_creation_options.d.ts +22 -4
- package/dest/entrypoints/pxe_creation_options.d.ts.map +1 -1
- package/dest/entrypoints/pxe_creation_options.js +3 -1
- package/dest/entrypoints/server/index.d.ts +9 -3
- package/dest/entrypoints/server/index.d.ts.map +1 -1
- package/dest/entrypoints/server/index.js +7 -2
- package/dest/entrypoints/server/utils.d.ts +4 -3
- package/dest/entrypoints/server/utils.d.ts.map +1 -1
- package/dest/entrypoints/server/utils.js +57 -31
- package/dest/error_enriching.d.ts +6 -4
- package/dest/error_enriching.d.ts.map +1 -1
- package/dest/error_enriching.js +13 -11
- package/dest/events/event_service.d.ts +24 -0
- package/dest/events/event_service.d.ts.map +1 -0
- package/dest/events/event_service.js +77 -0
- package/dest/events/index.d.ts +2 -0
- package/dest/events/index.d.ts.map +1 -0
- package/dest/events/index.js +1 -0
- package/dest/events/private_event_filter_validator.d.ts +10 -0
- package/dest/events/private_event_filter_validator.d.ts.map +1 -0
- package/dest/events/private_event_filter_validator.js +53 -0
- package/dest/hooks/authorize_utility_call.d.ts +41 -0
- package/dest/hooks/authorize_utility_call.d.ts.map +1 -0
- package/dest/hooks/authorize_utility_call.js +4 -0
- package/dest/hooks/execution_hooks.d.ts +62 -0
- package/dest/hooks/execution_hooks.d.ts.map +1 -0
- package/dest/hooks/execution_hooks.js +9 -0
- package/dest/hooks/index.d.ts +5 -0
- package/dest/hooks/index.d.ts.map +1 -0
- package/dest/hooks/index.js +1 -0
- package/dest/hooks/resolve_custom_request.d.ts +23 -0
- package/dest/hooks/resolve_custom_request.d.ts.map +1 -0
- package/dest/hooks/resolve_custom_request.js +3 -0
- package/dest/hooks/resolve_tagging_secret_strategy.d.ts +48 -0
- package/dest/hooks/resolve_tagging_secret_strategy.d.ts.map +1 -0
- package/dest/hooks/resolve_tagging_secret_strategy.js +3 -0
- package/dest/job_coordinator/job_coordinator.d.ts +75 -0
- package/dest/job_coordinator/job_coordinator.d.ts.map +1 -0
- package/dest/job_coordinator/job_coordinator.js +94 -0
- package/dest/logs/log_service.d.ts +30 -0
- package/dest/logs/log_service.d.ts.map +1 -0
- package/dest/logs/log_service.js +223 -0
- package/dest/messages/tx_resolver_service.d.ts +17 -0
- package/dest/messages/tx_resolver_service.d.ts.map +1 -0
- package/dest/messages/tx_resolver_service.js +55 -0
- package/dest/notes/index.d.ts +2 -0
- package/dest/notes/index.d.ts.map +1 -0
- package/dest/notes/index.js +1 -0
- package/dest/notes/note_service.d.ts +70 -0
- package/dest/notes/note_service.d.ts.map +1 -0
- package/dest/notes/note_service.js +172 -0
- package/dest/notes_filter.d.ts +24 -0
- package/dest/notes_filter.d.ts.map +1 -0
- package/dest/notes_filter.js +4 -0
- package/dest/oracle_version.d.ts +4 -3
- package/dest/oracle_version.d.ts.map +1 -1
- package/dest/oracle_version.js +20 -9
- package/dest/private_kernel/batch_planner.d.ts +47 -0
- package/dest/private_kernel/batch_planner.d.ts.map +1 -0
- package/dest/private_kernel/batch_planner.js +104 -0
- package/dest/private_kernel/hints/compute_tx_expiration_timestamp.d.ts +4 -0
- package/dest/private_kernel/hints/compute_tx_expiration_timestamp.d.ts.map +1 -0
- package/dest/private_kernel/hints/{compute_tx_include_by_timestamp.js → compute_tx_expiration_timestamp.js} +12 -12
- package/dest/private_kernel/hints/index.d.ts +3 -3
- package/dest/private_kernel/hints/index.d.ts.map +1 -1
- package/dest/private_kernel/hints/index.js +2 -2
- package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts +29 -0
- package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts.map +1 -0
- package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.js +342 -0
- package/dest/private_kernel/hints/test_utils.d.ts +122 -0
- package/dest/private_kernel/hints/test_utils.d.ts.map +1 -0
- package/dest/private_kernel/hints/test_utils.js +202 -0
- package/dest/private_kernel/index.d.ts +1 -1
- package/dest/private_kernel/private_kernel_execution_prover.d.ts +7 -2
- package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_execution_prover.js +218 -96
- package/dest/private_kernel/private_kernel_oracle.d.ts +32 -29
- package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_oracle.js +108 -2
- package/dest/pxe.d.ts +267 -134
- package/dest/pxe.d.ts.map +1 -1
- package/dest/pxe.js +498 -365
- package/dest/storage/address_store/address_store.d.ts +11 -0
- package/dest/storage/address_store/address_store.d.ts.map +1 -0
- package/dest/storage/{address_data_provider/address_data_provider.js → address_store/address_store.js} +13 -12
- package/dest/storage/address_store/index.d.ts +2 -0
- package/dest/storage/address_store/index.d.ts.map +1 -0
- package/dest/storage/address_store/index.js +1 -0
- package/dest/storage/allowed_scopes.d.ts +6 -0
- package/dest/storage/allowed_scopes.d.ts.map +1 -0
- package/dest/storage/allowed_scopes.js +7 -0
- package/dest/storage/anchor_block_store/anchor_block_store.d.ts +20 -0
- package/dest/storage/anchor_block_store/anchor_block_store.d.ts.map +1 -0
- package/dest/storage/anchor_block_store/anchor_block_store.js +28 -0
- package/dest/storage/anchor_block_store/index.d.ts +2 -0
- package/dest/storage/anchor_block_store/index.d.ts.map +1 -0
- package/dest/storage/anchor_block_store/index.js +1 -0
- package/dest/storage/backwards_compatibility_tests/kv_store_snapshot.d.ts +42 -0
- package/dest/storage/backwards_compatibility_tests/kv_store_snapshot.d.ts.map +1 -0
- package/dest/storage/backwards_compatibility_tests/kv_store_snapshot.js +93 -0
- package/dest/storage/backwards_compatibility_tests/schema_tests.d.ts +15 -0
- package/dest/storage/backwards_compatibility_tests/schema_tests.d.ts.map +1 -0
- package/dest/storage/backwards_compatibility_tests/schema_tests.js +647 -0
- package/dest/storage/backwards_compatibility_tests/store_spy.d.ts +19 -0
- package/dest/storage/backwards_compatibility_tests/store_spy.d.ts.map +1 -0
- package/dest/storage/backwards_compatibility_tests/store_spy.js +63 -0
- package/dest/storage/capsule_store/capsule_service.d.ts +21 -0
- package/dest/storage/capsule_store/capsule_service.d.ts.map +1 -0
- package/dest/storage/capsule_store/capsule_service.js +47 -0
- package/dest/storage/capsule_store/capsule_store.d.ts +72 -0
- package/dest/storage/capsule_store/capsule_store.d.ts.map +1 -0
- package/dest/storage/capsule_store/capsule_store.js +261 -0
- package/dest/storage/capsule_store/index.d.ts +3 -0
- package/dest/storage/capsule_store/index.d.ts.map +1 -0
- package/dest/storage/capsule_store/index.js +2 -0
- package/dest/storage/contract_store/contract_store.d.ts +96 -0
- package/dest/storage/contract_store/contract_store.d.ts.map +1 -0
- package/dest/storage/contract_store/contract_store.js +281 -0
- package/dest/storage/contract_store/index.d.ts +2 -0
- package/dest/storage/contract_store/index.d.ts.map +1 -0
- package/dest/storage/contract_store/index.js +1 -0
- package/dest/storage/{contract_data_provider → contract_store}/private_functions_tree.d.ts +1 -1
- package/dest/storage/contract_store/private_functions_tree.d.ts.map +1 -0
- package/dest/storage/{contract_data_provider → contract_store}/private_functions_tree.js +1 -1
- package/dest/storage/fact_store/fact_service.d.ts +22 -0
- package/dest/storage/fact_store/fact_service.d.ts.map +1 -0
- package/dest/storage/fact_store/fact_service.js +45 -0
- package/dest/storage/fact_store/fact_store.d.ts +95 -0
- package/dest/storage/fact_store/fact_store.d.ts.map +1 -0
- package/dest/storage/fact_store/fact_store.js +408 -0
- package/dest/storage/fact_store/fact_store_keys.d.ts +34 -0
- package/dest/storage/fact_store/fact_store_keys.d.ts.map +1 -0
- package/dest/storage/fact_store/fact_store_keys.js +50 -0
- package/dest/storage/fact_store/index.d.ts +6 -0
- package/dest/storage/fact_store/index.d.ts.map +1 -0
- package/dest/storage/fact_store/index.js +4 -0
- package/dest/storage/fact_store/origin_state.d.ts +57 -0
- package/dest/storage/fact_store/origin_state.d.ts.map +1 -0
- package/dest/storage/fact_store/origin_state.js +53 -0
- package/dest/storage/fact_store/stored_fact.d.ts +32 -0
- package/dest/storage/fact_store/stored_fact.d.ts.map +1 -0
- package/dest/storage/fact_store/stored_fact.js +64 -0
- package/dest/storage/index.d.ts +9 -8
- package/dest/storage/index.d.ts.map +1 -1
- package/dest/storage/index.js +8 -7
- package/dest/storage/metadata.d.ts +2 -2
- package/dest/storage/metadata.d.ts.map +1 -1
- package/dest/storage/metadata.js +1 -1
- package/dest/storage/note_store/index.d.ts +3 -0
- package/dest/storage/note_store/index.d.ts.map +1 -0
- package/dest/storage/note_store/index.js +2 -0
- package/dest/storage/note_store/note_store.d.ts +92 -0
- package/dest/storage/note_store/note_store.d.ts.map +1 -0
- package/dest/storage/note_store/note_store.js +372 -0
- package/dest/storage/note_store/stored_note.d.ts +11 -0
- package/dest/storage/note_store/stored_note.d.ts.map +1 -0
- package/dest/storage/note_store/stored_note.js +27 -0
- package/dest/storage/open_pxe_stores.d.ts +35 -0
- package/dest/storage/open_pxe_stores.d.ts.map +1 -0
- package/dest/storage/open_pxe_stores.js +29 -0
- package/dest/storage/private_event_store/private_event_store.d.ts +88 -0
- package/dest/storage/private_event_store/private_event_store.d.ts.map +1 -0
- package/dest/storage/private_event_store/private_event_store.js +273 -0
- package/dest/storage/private_event_store/stored_private_event.d.ts +23 -0
- package/dest/storage/private_event_store/stored_private_event.d.ts.map +1 -0
- package/dest/storage/private_event_store/stored_private_event.js +56 -0
- package/dest/storage/tagging_store/index.d.ts +4 -0
- package/dest/storage/tagging_store/index.d.ts.map +1 -0
- package/dest/storage/tagging_store/index.js +3 -0
- package/dest/storage/tagging_store/recipient_tagging_store.d.ts +28 -0
- package/dest/storage/tagging_store/recipient_tagging_store.d.ts.map +1 -0
- package/dest/storage/tagging_store/recipient_tagging_store.js +111 -0
- package/dest/storage/tagging_store/sender_tagging_store.d.ts +78 -0
- package/dest/storage/tagging_store/sender_tagging_store.d.ts.map +1 -0
- package/dest/storage/tagging_store/sender_tagging_store.js +374 -0
- package/dest/storage/tagging_store/tagging_secret_sources_store.d.ts +51 -0
- package/dest/storage/tagging_store/tagging_secret_sources_store.d.ts.map +1 -0
- package/dest/storage/tagging_store/tagging_secret_sources_store.js +105 -0
- package/dest/tagging/constants.d.ts +2 -2
- package/dest/tagging/constants.d.ts.map +1 -1
- package/dest/tagging/constants.js +7 -2
- package/dest/tagging/get_all_logs_by_tags.d.ts +48 -0
- package/dest/tagging/get_all_logs_by_tags.d.ts.map +1 -0
- package/dest/tagging/get_all_logs_by_tags.js +59 -0
- package/dest/tagging/index.d.ts +18 -7
- package/dest/tagging/index.d.ts.map +1 -1
- package/dest/tagging/index.js +16 -5
- package/dest/tagging/persist_sender_tagging_index_ranges.d.ts +29 -0
- package/dest/tagging/persist_sender_tagging_index_ranges.d.ts.map +1 -0
- package/dest/tagging/persist_sender_tagging_index_ranges.js +42 -0
- package/dest/tagging/recipient_sync/sync_tagged_private_logs.d.ts +69 -0
- package/dest/tagging/recipient_sync/sync_tagged_private_logs.d.ts.map +1 -0
- package/dest/tagging/recipient_sync/sync_tagged_private_logs.js +203 -0
- package/dest/tagging/recipient_sync/utils/find_highest_indexes.d.ts +12 -0
- package/dest/tagging/recipient_sync/utils/find_highest_indexes.d.ts.map +1 -0
- package/dest/tagging/recipient_sync/utils/find_highest_indexes.js +20 -0
- package/dest/tagging/reconcile_tagging_index_ranges.d.ts +36 -0
- package/dest/tagging/reconcile_tagging_index_ranges.d.ts.map +1 -0
- package/dest/tagging/reconcile_tagging_index_ranges.js +74 -0
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts +16 -0
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts.map +1 -0
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.js +92 -0
- package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts +17 -0
- package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts.map +1 -0
- package/dest/tagging/sender_sync/utils/get_status_change_of_pending.js +60 -0
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts +19 -0
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts.map +1 -0
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.js +72 -0
- package/package.json +33 -20
- package/src/bin/check_oracle_version.ts +62 -33
- package/src/bin/index.ts +5 -0
- package/src/bin/oracle_version_helpers.ts +311 -0
- package/src/block_synchronizer/block_stream_source.ts +42 -0
- package/src/block_synchronizer/block_synchronizer.ts +241 -0
- package/src/block_synchronizer/index.ts +1 -0
- package/src/config/index.ts +32 -26
- package/src/config/package_info.ts +1 -1
- package/src/contract/contract_class_service.ts +83 -0
- package/src/contract/contract_sync_service.ts +176 -0
- package/src/contract/helpers.ts +35 -0
- package/src/contract_function_simulator/anchored_contract_data.ts +74 -0
- package/src/contract_function_simulator/benchmarked_node.ts +103 -0
- package/src/contract_function_simulator/contract_function_simulator.ts +526 -132
- package/src/contract_function_simulator/ephemeral_array_service.ts +110 -0
- package/src/contract_function_simulator/execution_note_cache.ts +42 -33
- package/src/contract_function_simulator/execution_tagging_index_cache.ts +19 -18
- package/src/contract_function_simulator/hashed_values_cache.ts +1 -1
- package/src/contract_function_simulator/index.ts +70 -5
- package/src/contract_function_simulator/noir-structs/bounded_vec.ts +43 -0
- package/src/contract_function_simulator/noir-structs/contract_class_log_data.ts +9 -0
- package/src/contract_function_simulator/noir-structs/embedded_curve_point.ts +4 -0
- package/src/contract_function_simulator/noir-structs/ephemeral_array.ts +66 -0
- package/src/contract_function_simulator/noir-structs/event_validation_request.ts +16 -11
- package/src/contract_function_simulator/noir-structs/fact.ts +13 -0
- package/src/contract_function_simulator/noir-structs/fact_collection.ts +64 -0
- package/src/contract_function_simulator/noir-structs/log_retrieval_request.ts +28 -20
- package/src/contract_function_simulator/noir-structs/log_retrieval_response.ts +14 -64
- package/src/contract_function_simulator/noir-structs/note_data.ts +27 -0
- package/src/contract_function_simulator/noir-structs/note_validation_request.ts +18 -11
- package/src/contract_function_simulator/noir-structs/option.ts +75 -0
- package/src/contract_function_simulator/noir-structs/origin_block.ts +8 -0
- package/src/contract_function_simulator/noir-structs/pending_tagged_log.ts +12 -0
- package/src/contract_function_simulator/noir-structs/provided_secret.ts +5 -0
- package/src/contract_function_simulator/noir-structs/resolved_tagging_strategy.ts +58 -0
- package/src/contract_function_simulator/noir-structs/resolved_tx.ts +53 -0
- package/src/contract_function_simulator/noir-structs/tx_effect_data.ts +15 -0
- package/src/contract_function_simulator/noir-structs/utility_context.ts +6 -37
- package/src/contract_function_simulator/oracle/acir_callback.ts +154 -0
- package/src/contract_function_simulator/oracle/index.ts +1 -15
- package/src/contract_function_simulator/oracle/interfaces.ts +11 -151
- package/src/contract_function_simulator/oracle/legacy_oracle_registry.ts +120 -0
- package/src/contract_function_simulator/oracle/message_load_oracle_inputs.ts +6 -21
- package/src/contract_function_simulator/oracle/note_packing_utils.ts +31 -15
- package/src/contract_function_simulator/oracle/oracle_registry.ts +689 -0
- package/src/contract_function_simulator/oracle/oracle_type_mappings.ts +964 -0
- package/src/contract_function_simulator/oracle/private_execution.ts +8 -75
- package/src/contract_function_simulator/oracle/private_execution_oracle.ts +363 -189
- package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +974 -154
- package/src/contract_function_simulator/pick_notes.ts +23 -4
- package/src/contract_function_simulator/transient_array_service.ts +91 -0
- package/src/contract_logging.ts +52 -0
- package/src/debug/pxe_debug_utils.ts +85 -0
- package/src/entrypoints/client/bundle/index.ts +2 -1
- package/src/entrypoints/client/bundle/utils.ts +41 -22
- package/src/entrypoints/client/lazy/index.ts +2 -1
- package/src/entrypoints/client/lazy/utils.ts +43 -24
- package/src/entrypoints/pxe_creation_options.ts +27 -3
- package/src/entrypoints/server/index.ts +9 -2
- package/src/entrypoints/server/utils.ts +55 -60
- package/src/error_enriching.ts +20 -12
- package/src/events/event_service.ts +119 -0
- package/src/events/index.ts +1 -0
- package/src/events/private_event_filter_validator.ts +66 -0
- package/src/hooks/authorize_utility_call.ts +44 -0
- package/src/hooks/execution_hooks.ts +68 -0
- package/src/hooks/index.ts +12 -0
- package/src/hooks/resolve_custom_request.ts +24 -0
- package/src/hooks/resolve_tagging_secret_strategy.ts +57 -0
- package/src/job_coordinator/job_coordinator.ts +150 -0
- package/src/logs/log_service.ts +291 -0
- package/src/messages/tx_resolver_service.ts +69 -0
- package/src/notes/index.ts +1 -0
- package/src/notes/note_service.ts +230 -0
- package/src/notes_filter.ts +24 -0
- package/src/oracle_version.ts +20 -9
- package/src/private_kernel/batch_planner.ts +168 -0
- package/src/private_kernel/hints/{compute_tx_include_by_timestamp.ts → compute_tx_expiration_timestamp.ts} +13 -13
- package/src/private_kernel/hints/index.ts +2 -2
- package/src/private_kernel/hints/{build_private_kernel_reset_private_inputs.ts → private_kernel_reset_private_inputs_builder.ts} +211 -147
- package/src/private_kernel/hints/test_utils.ts +318 -0
- package/src/private_kernel/private_kernel_execution_prover.ts +358 -140
- package/src/private_kernel/private_kernel_oracle.ts +149 -39
- package/src/pxe.ts +849 -491
- package/src/storage/{address_data_provider/address_data_provider.ts → address_store/address_store.ts} +16 -16
- package/src/storage/address_store/index.ts +1 -0
- package/src/storage/allowed_scopes.ts +14 -0
- package/src/storage/anchor_block_store/anchor_block_store.ts +35 -0
- package/src/storage/anchor_block_store/index.ts +1 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/AddressStore.json +22 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/AnchorBlockStore.json +3 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/CapsuleStore.json +16 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/ContractStore.json +28 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/FactStore.json +40 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/KeyStore.json +52 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/L2TipsKVStore.json +40 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/NoteStore.json +56 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/PrivateEventStore.json +44 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/RecipientTaggingStore.json +18 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/SenderTaggingStore.json +22 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/TaggingSecretSourcesStore.json +30 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/opened_stores.json +117 -0
- package/src/storage/backwards_compatibility_tests/kv_store_snapshot.ts +122 -0
- package/src/storage/backwards_compatibility_tests/schema_tests.ts +774 -0
- package/src/storage/backwards_compatibility_tests/store_spy.ts +73 -0
- package/src/storage/capsule_store/capsule_service.ts +85 -0
- package/src/storage/capsule_store/capsule_store.ts +333 -0
- package/src/storage/capsule_store/index.ts +2 -0
- package/src/storage/contract_store/contract_store.ts +401 -0
- package/src/storage/contract_store/index.ts +1 -0
- package/src/storage/{contract_data_provider → contract_store}/private_functions_tree.ts +1 -1
- package/src/storage/fact_store/fact_service.ts +69 -0
- package/src/storage/fact_store/fact_store.ts +487 -0
- package/src/storage/fact_store/fact_store_keys.ts +75 -0
- package/src/storage/fact_store/index.ts +14 -0
- package/src/storage/fact_store/origin_state.ts +75 -0
- package/src/storage/fact_store/stored_fact.ts +80 -0
- package/src/storage/index.ts +8 -7
- package/src/storage/metadata.ts +1 -1
- package/src/storage/note_store/index.ts +2 -0
- package/src/storage/note_store/note_store.ts +454 -0
- package/src/storage/note_store/stored_note.ts +26 -0
- package/src/storage/open_pxe_stores.ts +52 -0
- package/src/storage/private_event_store/private_event_store.ts +382 -0
- package/src/storage/private_event_store/stored_private_event.ts +73 -0
- package/src/storage/tagging_store/index.ts +3 -0
- package/src/storage/tagging_store/recipient_tagging_store.ts +139 -0
- package/src/storage/tagging_store/sender_tagging_store.ts +476 -0
- package/src/storage/tagging_store/tagging_secret_sources_store.ts +138 -0
- package/src/tagging/constants.ts +8 -2
- package/src/tagging/get_all_logs_by_tags.ts +120 -0
- package/src/tagging/index.ts +20 -6
- package/src/tagging/persist_sender_tagging_index_ranges.ts +57 -0
- package/src/tagging/recipient_sync/sync_tagged_private_logs.ts +301 -0
- package/src/tagging/recipient_sync/utils/find_highest_indexes.ts +34 -0
- package/src/tagging/reconcile_tagging_index_ranges.ts +102 -0
- package/src/tagging/sender_sync/sync_sender_tagging_indexes.ts +134 -0
- package/src/tagging/sender_sync/utils/get_status_change_of_pending.ts +66 -0
- package/src/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.ts +84 -0
- package/dest/contract_function_simulator/execution_data_provider.d.ts +0 -274
- package/dest/contract_function_simulator/execution_data_provider.d.ts.map +0 -1
- package/dest/contract_function_simulator/execution_data_provider.js +0 -14
- package/dest/contract_function_simulator/oracle/oracle.d.ts +0 -57
- package/dest/contract_function_simulator/oracle/oracle.d.ts.map +0 -1
- package/dest/contract_function_simulator/oracle/oracle.js +0 -328
- package/dest/contract_function_simulator/proxied_contract_data_source.d.ts +0 -6
- package/dest/contract_function_simulator/proxied_contract_data_source.d.ts.map +0 -1
- package/dest/contract_function_simulator/proxied_contract_data_source.js +0 -62
- package/dest/contract_function_simulator/proxied_node.d.ts +0 -9
- package/dest/contract_function_simulator/proxied_node.d.ts.map +0 -1
- package/dest/contract_function_simulator/proxied_node.js +0 -27
- package/dest/contract_function_simulator/pxe_oracle_interface.d.ts +0 -122
- package/dest/contract_function_simulator/pxe_oracle_interface.d.ts.map +0 -1
- package/dest/contract_function_simulator/pxe_oracle_interface.js +0 -701
- package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts +0 -28
- package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts.map +0 -1
- package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.js +0 -271
- package/dest/private_kernel/hints/compute_tx_include_by_timestamp.d.ts +0 -4
- package/dest/private_kernel/hints/compute_tx_include_by_timestamp.d.ts.map +0 -1
- package/dest/private_kernel/private_kernel_oracle_impl.d.ts +0 -45
- package/dest/private_kernel/private_kernel_oracle_impl.d.ts.map +0 -1
- package/dest/private_kernel/private_kernel_oracle_impl.js +0 -86
- package/dest/storage/address_data_provider/address_data_provider.d.ts +0 -11
- package/dest/storage/address_data_provider/address_data_provider.d.ts.map +0 -1
- package/dest/storage/address_data_provider/index.d.ts +0 -2
- package/dest/storage/address_data_provider/index.d.ts.map +0 -1
- package/dest/storage/address_data_provider/index.js +0 -1
- package/dest/storage/capsule_data_provider/capsule_data_provider.d.ts +0 -25
- package/dest/storage/capsule_data_provider/capsule_data_provider.d.ts.map +0 -1
- package/dest/storage/capsule_data_provider/capsule_data_provider.js +0 -118
- package/dest/storage/capsule_data_provider/index.d.ts +0 -2
- package/dest/storage/capsule_data_provider/index.d.ts.map +0 -1
- package/dest/storage/capsule_data_provider/index.js +0 -1
- package/dest/storage/contract_data_provider/contract_data_provider.d.ts +0 -74
- package/dest/storage/contract_data_provider/contract_data_provider.d.ts.map +0 -1
- package/dest/storage/contract_data_provider/contract_data_provider.js +0 -205
- package/dest/storage/contract_data_provider/index.d.ts +0 -2
- package/dest/storage/contract_data_provider/index.d.ts.map +0 -1
- package/dest/storage/contract_data_provider/index.js +0 -1
- package/dest/storage/contract_data_provider/private_functions_tree.d.ts.map +0 -1
- package/dest/storage/note_data_provider/index.d.ts +0 -3
- package/dest/storage/note_data_provider/index.d.ts.map +0 -1
- package/dest/storage/note_data_provider/index.js +0 -2
- package/dest/storage/note_data_provider/note_dao.d.ts +0 -100
- package/dest/storage/note_data_provider/note_dao.d.ts.map +0 -1
- package/dest/storage/note_data_provider/note_dao.js +0 -102
- package/dest/storage/note_data_provider/note_data_provider.d.ts +0 -83
- package/dest/storage/note_data_provider/note_data_provider.d.ts.map +0 -1
- package/dest/storage/note_data_provider/note_data_provider.js +0 -308
- package/dest/storage/private_event_data_provider/private_event_data_provider.d.ts +0 -43
- package/dest/storage/private_event_data_provider/private_event_data_provider.d.ts.map +0 -1
- package/dest/storage/private_event_data_provider/private_event_data_provider.js +0 -104
- package/dest/storage/sync_data_provider/index.d.ts +0 -2
- package/dest/storage/sync_data_provider/index.d.ts.map +0 -1
- package/dest/storage/sync_data_provider/index.js +0 -1
- package/dest/storage/sync_data_provider/sync_data_provider.d.ts +0 -10
- package/dest/storage/sync_data_provider/sync_data_provider.d.ts.map +0 -1
- package/dest/storage/sync_data_provider/sync_data_provider.js +0 -26
- package/dest/storage/tagging_data_provider/index.d.ts +0 -2
- package/dest/storage/tagging_data_provider/index.d.ts.map +0 -1
- package/dest/storage/tagging_data_provider/index.js +0 -1
- package/dest/storage/tagging_data_provider/tagging_data_provider.d.ts +0 -40
- package/dest/storage/tagging_data_provider/tagging_data_provider.d.ts.map +0 -1
- package/dest/storage/tagging_data_provider/tagging_data_provider.js +0 -89
- package/dest/synchronizer/index.d.ts +0 -2
- package/dest/synchronizer/index.d.ts.map +0 -1
- package/dest/synchronizer/index.js +0 -1
- package/dest/synchronizer/synchronizer.d.ts +0 -35
- package/dest/synchronizer/synchronizer.d.ts.map +0 -1
- package/dest/synchronizer/synchronizer.js +0 -101
- package/dest/tagging/siloed_tag.d.ts +0 -14
- package/dest/tagging/siloed_tag.d.ts.map +0 -1
- package/dest/tagging/siloed_tag.js +0 -20
- package/dest/tagging/tag.d.ts +0 -12
- package/dest/tagging/tag.d.ts.map +0 -1
- package/dest/tagging/tag.js +0 -17
- package/dest/tagging/utils.d.ts +0 -18
- package/dest/tagging/utils.d.ts.map +0 -1
- package/dest/tagging/utils.js +0 -24
- package/src/contract_function_simulator/execution_data_provider.ts +0 -343
- package/src/contract_function_simulator/oracle/oracle.ts +0 -575
- package/src/contract_function_simulator/proxied_contract_data_source.ts +0 -66
- package/src/contract_function_simulator/proxied_node.ts +0 -33
- package/src/contract_function_simulator/pxe_oracle_interface.ts +0 -1019
- package/src/private_kernel/private_kernel_oracle_impl.ts +0 -132
- package/src/storage/address_data_provider/index.ts +0 -1
- package/src/storage/capsule_data_provider/capsule_data_provider.ts +0 -147
- package/src/storage/capsule_data_provider/index.ts +0 -1
- package/src/storage/contract_data_provider/contract_data_provider.ts +0 -294
- package/src/storage/contract_data_provider/index.ts +0 -1
- package/src/storage/note_data_provider/index.ts +0 -2
- package/src/storage/note_data_provider/note_dao.ts +0 -154
- package/src/storage/note_data_provider/note_data_provider.ts +0 -393
- package/src/storage/private_event_data_provider/private_event_data_provider.ts +0 -148
- package/src/storage/sync_data_provider/index.ts +0 -1
- package/src/storage/sync_data_provider/sync_data_provider.ts +0 -34
- package/src/storage/tagging_data_provider/index.ts +0 -1
- package/src/storage/tagging_data_provider/tagging_data_provider.ts +0 -120
- package/src/synchronizer/index.ts +0 -1
- package/src/synchronizer/synchronizer.ts +0 -120
- package/src/tagging/siloed_tag.ts +0 -22
- package/src/tagging/tag.ts +0 -16
- package/src/tagging/utils.ts +0 -31
|
@@ -1,19 +1,111 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { ARCHIVE_HEIGHT, type NOTE_HASH_TREE_HEIGHT } from '@aztec/constants';
|
|
2
|
+
import type { BlockNumber } from '@aztec/foundation/branded-types';
|
|
3
|
+
import { uniqueBy } from '@aztec/foundation/collection';
|
|
4
|
+
import { Aes128 } from '@aztec/foundation/crypto/aes128';
|
|
5
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
6
|
+
import { Point } from '@aztec/foundation/curves/grumpkin';
|
|
7
|
+
import { LogLevels, type Logger, createLogger } from '@aztec/foundation/log';
|
|
8
|
+
import { MembershipWitness } from '@aztec/foundation/trees';
|
|
9
|
+
import type { KeyStore } from '@aztec/key-store';
|
|
10
|
+
import {
|
|
11
|
+
type CircuitSimulator,
|
|
12
|
+
ExecutionError,
|
|
13
|
+
extractCallStack,
|
|
14
|
+
resolveAssertionMessageFromError,
|
|
15
|
+
toACVMWitness,
|
|
16
|
+
witnessMapToFields,
|
|
17
|
+
} from '@aztec/simulator/client';
|
|
18
|
+
import { STANDARD_HANDSHAKE_REGISTRY_ADDRESS } from '@aztec/standard-contracts/handshake-registry/constants';
|
|
19
|
+
import { type FunctionCall, FunctionSelector } from '@aztec/stdlib/abi';
|
|
4
20
|
import type { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
5
21
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
6
|
-
import
|
|
22
|
+
import { BlockHash, type L2TipsProvider } from '@aztec/stdlib/block';
|
|
23
|
+
import type { CompleteAddress, ContractInstancePreimageWithAddress, PartialAddress } from '@aztec/stdlib/contract';
|
|
7
24
|
import { siloNullifier } from '@aztec/stdlib/hash';
|
|
25
|
+
import type { AztecNode } from '@aztec/stdlib/interfaces/server';
|
|
8
26
|
import type { KeyValidationRequest } from '@aztec/stdlib/kernel';
|
|
27
|
+
import { PublicKeys, computeAddressSecret, hashPublicKey } from '@aztec/stdlib/keys';
|
|
28
|
+
import { AppTaggingSecret, FlatPublicLogs, appSiloEcdhSharedSecret } from '@aztec/stdlib/logs';
|
|
29
|
+
import { getNonNullifiedL1ToL2MessageWitness } from '@aztec/stdlib/messaging';
|
|
9
30
|
import type { NoteStatus } from '@aztec/stdlib/note';
|
|
10
|
-
import {
|
|
11
|
-
import
|
|
31
|
+
import { MerkleTreeId, type NullifierMembershipWitness, PublicDataWitness } from '@aztec/stdlib/trees';
|
|
32
|
+
import {
|
|
33
|
+
type BlockHeader,
|
|
34
|
+
CallContext,
|
|
35
|
+
type Capsule,
|
|
36
|
+
type IndexedTxEffect,
|
|
37
|
+
type OffchainEffect,
|
|
38
|
+
type TxHash,
|
|
39
|
+
} from '@aztec/stdlib/tx';
|
|
12
40
|
|
|
13
|
-
import type {
|
|
14
|
-
import {
|
|
41
|
+
import type { ContractSyncService } from '../../contract/contract_sync_service.js';
|
|
42
|
+
import { createContractLogger, logContractMessage, stripAztecnrLogPrefix } from '../../contract_logging.js';
|
|
43
|
+
import { EventService } from '../../events/event_service.js';
|
|
44
|
+
import type { UtilityCallAuthorizationRequest } from '../../hooks/authorize_utility_call.js';
|
|
45
|
+
import type { ExecutionHooks } from '../../hooks/index.js';
|
|
46
|
+
import { LogService } from '../../logs/log_service.js';
|
|
47
|
+
import { TxResolverService } from '../../messages/tx_resolver_service.js';
|
|
48
|
+
import { NoteService } from '../../notes/note_service.js';
|
|
49
|
+
import { ORACLE_VERSION_MAJOR } from '../../oracle_version.js';
|
|
50
|
+
import type { AddressStore } from '../../storage/address_store/address_store.js';
|
|
51
|
+
import type { CapsuleService } from '../../storage/capsule_store/capsule_service.js';
|
|
52
|
+
import { FactCollectionKey, FactCollectionTypeKey, anchoredTipBlockNumbers } from '../../storage/fact_store/index.js';
|
|
53
|
+
import type { FactService, OriginBlock } from '../../storage/fact_store/index.js';
|
|
54
|
+
import type { NoteStore } from '../../storage/note_store/note_store.js';
|
|
55
|
+
import type { PrivateEventStore } from '../../storage/private_event_store/private_event_store.js';
|
|
56
|
+
import type { RecipientTaggingStore } from '../../storage/tagging_store/recipient_tagging_store.js';
|
|
57
|
+
import type { TaggingSecretSourcesStore } from '../../storage/tagging_store/tagging_secret_sources_store.js';
|
|
58
|
+
import type { AnchoredContractData } from '../anchored_contract_data.js';
|
|
59
|
+
import { EphemeralArrayService } from '../ephemeral_array_service.js';
|
|
60
|
+
import { BoundedVec } from '../noir-structs/bounded_vec.js';
|
|
61
|
+
import type { EmbeddedCurvePoint } from '../noir-structs/embedded_curve_point.js';
|
|
62
|
+
import { EphemeralArray } from '../noir-structs/ephemeral_array.js';
|
|
63
|
+
import type { EventValidationRequest } from '../noir-structs/event_validation_request.js';
|
|
64
|
+
import { type FactCollection, emptyFactCollection, toNoirFactCollection } from '../noir-structs/fact_collection.js';
|
|
65
|
+
import type { LogRetrievalRequest } from '../noir-structs/log_retrieval_request.js';
|
|
66
|
+
import type { LogRetrievalResponse } from '../noir-structs/log_retrieval_response.js';
|
|
67
|
+
import type { NoteData } from '../noir-structs/note_data.js';
|
|
68
|
+
import type { NoteValidationRequest } from '../noir-structs/note_validation_request.js';
|
|
69
|
+
import { Option } from '../noir-structs/option.js';
|
|
70
|
+
import type { PendingTaggedLog } from '../noir-structs/pending_tagged_log.js';
|
|
71
|
+
import type { ProvidedSecret } from '../noir-structs/provided_secret.js';
|
|
72
|
+
import type { ResolvedTx } from '../noir-structs/resolved_tx.js';
|
|
73
|
+
import type { TxEffectData } from '../noir-structs/tx_effect_data.js';
|
|
74
|
+
import type { UtilityContext } from '../noir-structs/utility_context.js';
|
|
15
75
|
import { pickNotes } from '../pick_notes.js';
|
|
16
|
-
import type {
|
|
76
|
+
import type { TransientArrayService } from '../transient_array_service.js';
|
|
77
|
+
import { buildACIRCallback } from './acir_callback.js';
|
|
78
|
+
import type { IMiscOracle, IUtilityExecutionOracle } from './interfaces.js';
|
|
79
|
+
|
|
80
|
+
/** Args for UtilityExecutionOracle constructor. */
|
|
81
|
+
export type UtilityExecutionOracleArgs = {
|
|
82
|
+
callContext: CallContext;
|
|
83
|
+
/** List of transient auth witnesses to be used during this simulation */
|
|
84
|
+
authWitnesses: AuthWitness[];
|
|
85
|
+
capsules: Capsule[]; // TODO(#12425): Rename to transientCapsules
|
|
86
|
+
anchorBlockHeader: BlockHeader;
|
|
87
|
+
anchoredContractData: AnchoredContractData;
|
|
88
|
+
noteStore: NoteStore;
|
|
89
|
+
keyStore: KeyStore;
|
|
90
|
+
addressStore: AddressStore;
|
|
91
|
+
aztecNode: AztecNode;
|
|
92
|
+
recipientTaggingStore: RecipientTaggingStore;
|
|
93
|
+
taggingSecretSourcesStore: TaggingSecretSourcesStore;
|
|
94
|
+
capsuleService: CapsuleService;
|
|
95
|
+
factService: FactService;
|
|
96
|
+
privateEventStore: PrivateEventStore;
|
|
97
|
+
txResolver: TxResolverService;
|
|
98
|
+
contractSyncService: ContractSyncService;
|
|
99
|
+
l2TipsStore: L2TipsProvider;
|
|
100
|
+
jobId: string;
|
|
101
|
+
log?: ReturnType<typeof createLogger>;
|
|
102
|
+
scopes: AztecAddress[];
|
|
103
|
+
simulator: CircuitSimulator;
|
|
104
|
+
hooks?: ExecutionHooks;
|
|
105
|
+
/** Needed to trigger contract synchronization before nested cross-contract calls. */
|
|
106
|
+
utilityExecutor: (call: FunctionCall, scopes: AztecAddress[]) => Promise<void>;
|
|
107
|
+
transientArrayService: TransientArrayService;
|
|
108
|
+
};
|
|
17
109
|
|
|
18
110
|
/**
|
|
19
111
|
* The oracle for an execution of utility contract functions.
|
|
@@ -22,95 +114,216 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
|
|
|
22
114
|
isMisc = true as const;
|
|
23
115
|
isUtility = true as const;
|
|
24
116
|
|
|
25
|
-
private
|
|
117
|
+
private contractLogger: Logger | undefined;
|
|
118
|
+
private aztecnrLogger: Logger | undefined;
|
|
119
|
+
private offchainEffects: OffchainEffect[] = [];
|
|
120
|
+
private readonly ephemeralArrayService = new EphemeralArrayService();
|
|
121
|
+
protected readonly transientArrayService: TransientArrayService;
|
|
122
|
+
|
|
123
|
+
// We store oracle version to be able to show a nice error message when an oracle handler is missing.
|
|
124
|
+
private contractOracleVersion: { major: number; minor: number } | undefined;
|
|
125
|
+
|
|
126
|
+
protected readonly callContext: CallContext;
|
|
127
|
+
protected readonly authWitnesses: AuthWitness[];
|
|
128
|
+
protected readonly capsules: Capsule[];
|
|
129
|
+
protected readonly anchorBlockHeader: BlockHeader;
|
|
130
|
+
protected readonly anchoredContractData: AnchoredContractData;
|
|
131
|
+
protected readonly noteStore: NoteStore;
|
|
132
|
+
protected readonly keyStore: KeyStore;
|
|
133
|
+
protected readonly addressStore: AddressStore;
|
|
134
|
+
protected readonly aztecNode: AztecNode;
|
|
135
|
+
protected readonly recipientTaggingStore: RecipientTaggingStore;
|
|
136
|
+
protected readonly taggingSecretSourcesStore: TaggingSecretSourcesStore;
|
|
137
|
+
protected readonly capsuleService: CapsuleService;
|
|
138
|
+
protected readonly factService: FactService;
|
|
139
|
+
protected readonly privateEventStore: PrivateEventStore;
|
|
140
|
+
protected readonly txResolver: TxResolverService;
|
|
141
|
+
protected readonly contractSyncService: ContractSyncService;
|
|
142
|
+
protected readonly l2TipsStore: L2TipsProvider;
|
|
143
|
+
protected readonly jobId: string;
|
|
144
|
+
protected logger: ReturnType<typeof createLogger>;
|
|
145
|
+
protected readonly scopes: AztecAddress[];
|
|
146
|
+
protected readonly simulator: CircuitSimulator;
|
|
147
|
+
protected readonly hooks: ExecutionHooks | undefined;
|
|
148
|
+
protected readonly utilityExecutor: (call: FunctionCall, scopes: AztecAddress[]) => Promise<void>;
|
|
149
|
+
|
|
150
|
+
constructor(args: UtilityExecutionOracleArgs) {
|
|
151
|
+
this.callContext = args.callContext;
|
|
152
|
+
this.authWitnesses = args.authWitnesses;
|
|
153
|
+
this.capsules = args.capsules;
|
|
154
|
+
this.anchorBlockHeader = args.anchorBlockHeader;
|
|
155
|
+
this.anchoredContractData = args.anchoredContractData;
|
|
156
|
+
this.noteStore = args.noteStore;
|
|
157
|
+
this.keyStore = args.keyStore;
|
|
158
|
+
this.addressStore = args.addressStore;
|
|
159
|
+
this.aztecNode = args.aztecNode;
|
|
160
|
+
this.recipientTaggingStore = args.recipientTaggingStore;
|
|
161
|
+
this.taggingSecretSourcesStore = args.taggingSecretSourcesStore;
|
|
162
|
+
this.capsuleService = args.capsuleService;
|
|
163
|
+
this.factService = args.factService;
|
|
164
|
+
this.privateEventStore = args.privateEventStore;
|
|
165
|
+
this.txResolver = args.txResolver;
|
|
166
|
+
this.contractSyncService = args.contractSyncService;
|
|
167
|
+
this.l2TipsStore = args.l2TipsStore;
|
|
168
|
+
this.jobId = args.jobId;
|
|
169
|
+
this.logger = args.log ?? createLogger('simulator:client_view_context');
|
|
170
|
+
this.scopes = args.scopes;
|
|
171
|
+
this.simulator = args.simulator;
|
|
172
|
+
this.hooks = args.hooks;
|
|
173
|
+
this.utilityExecutor = args.utilityExecutor;
|
|
174
|
+
this.transientArrayService = args.transientArrayService;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
public assertCompatibleOracleVersion(major: number, minor: number): void {
|
|
178
|
+
if (major !== ORACLE_VERSION_MAJOR) {
|
|
179
|
+
const hint =
|
|
180
|
+
major > ORACLE_VERSION_MAJOR
|
|
181
|
+
? 'The contract was compiled with a newer version of Aztec.nr than your private environment supports. Upgrade your private environment to a compatible version.'
|
|
182
|
+
: 'The contract was compiled with an older version of Aztec.nr than your private environment supports. Recompile the contract with a compatible version of Aztec.nr.';
|
|
183
|
+
throw new Error(
|
|
184
|
+
`Incompatible private environment version: ${hint} See https://docs.aztec.network/errors/8 (expected oracle major version ${ORACLE_VERSION_MAJOR}, got ${major})`,
|
|
185
|
+
);
|
|
186
|
+
}
|
|
26
187
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
/** List of transient auth witnesses to be used during this simulation */
|
|
30
|
-
protected readonly authWitnesses: AuthWitness[],
|
|
31
|
-
protected readonly capsules: Capsule[], // TODO(#12425): Rename to transientCapsules
|
|
32
|
-
protected readonly executionDataProvider: ExecutionDataProvider,
|
|
33
|
-
protected log = createLogger('simulator:client_view_context'),
|
|
34
|
-
protected readonly scopes?: AztecAddress[],
|
|
35
|
-
) {}
|
|
188
|
+
this.contractOracleVersion = { major, minor };
|
|
189
|
+
}
|
|
36
190
|
|
|
37
|
-
|
|
38
|
-
|
|
191
|
+
// Prefixed with "nonOracleFunction" as it is not used as an oracle handler.
|
|
192
|
+
public nonOracleFunctionGetContractOracleVersion(): { major: number; minor: number } | undefined {
|
|
193
|
+
return this.contractOracleVersion;
|
|
39
194
|
}
|
|
40
195
|
|
|
41
|
-
public
|
|
196
|
+
public getRandomField(): Fr {
|
|
42
197
|
return Fr.random();
|
|
43
198
|
}
|
|
44
199
|
|
|
45
|
-
public
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
version: blockHeader.globalVariables.version,
|
|
52
|
-
chainId: blockHeader.globalVariables.chainId,
|
|
53
|
-
});
|
|
200
|
+
public getUtilityContext(): UtilityContext {
|
|
201
|
+
return {
|
|
202
|
+
blockHeader: this.anchorBlockHeader,
|
|
203
|
+
contractAddress: this.callContext.contractAddress,
|
|
204
|
+
msgSender: this.callContext.msgSender,
|
|
205
|
+
};
|
|
54
206
|
}
|
|
55
207
|
|
|
56
208
|
/**
|
|
57
209
|
* Retrieve keys associated with a specific master public key and app address.
|
|
58
210
|
* @param pkMHash - The master public key hash.
|
|
211
|
+
* @param _keyIndex - Sent by the Noir oracle caller but unused here; kept to match the oracle signature.
|
|
59
212
|
* @returns A Promise that resolves to nullifier keys.
|
|
60
213
|
* @throws If the keys are not registered in the key store.
|
|
214
|
+
* @throws If scopes are defined and the account is not in the scopes.
|
|
215
|
+
*/
|
|
216
|
+
public async getKeyValidationRequest(pkMHash: Fr, _keyIndex: Fr): Promise<KeyValidationRequest> {
|
|
217
|
+
let hasAccess = false;
|
|
218
|
+
for (let i = 0; i < this.scopes.length && !hasAccess; i++) {
|
|
219
|
+
if (await this.keyStore.accountHasKey(this.scopes[i], pkMHash)) {
|
|
220
|
+
hasAccess = true;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
if (!hasAccess) {
|
|
224
|
+
throw new Error(`Key validation request denied: no scoped account has a key with hash ${pkMHash.toString()}.`);
|
|
225
|
+
}
|
|
226
|
+
return this.keyStore.getKeyValidationRequest(pkMHash, this.contractAddress);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* Fetches the index and sibling path of a leaf at a given block from the note hash tree.
|
|
231
|
+
* @param blockHash - The hash of a block that contains the note hash tree root in which to find the
|
|
232
|
+
* membership witness.
|
|
233
|
+
* @param noteHash - The note hash to find in the note hash tree.
|
|
234
|
+
* @returns The membership witness containing the leaf index and sibling path
|
|
61
235
|
*/
|
|
62
|
-
public
|
|
63
|
-
|
|
236
|
+
public async getNoteHashMembershipWitness(
|
|
237
|
+
blockHash: BlockHash,
|
|
238
|
+
noteHash: Fr,
|
|
239
|
+
): Promise<MembershipWitness<typeof NOTE_HASH_TREE_HEIGHT>> {
|
|
240
|
+
const witness = await this.#queryWithBlockHashNotAfterAnchor(blockHash, () =>
|
|
241
|
+
this.aztecNode.getNoteHashMembershipWitness(blockHash, noteHash),
|
|
242
|
+
);
|
|
243
|
+
if (!witness) {
|
|
244
|
+
throw new Error(`Note hash ${noteHash} not found in the note hash tree at block ${blockHash.toString()}.`);
|
|
245
|
+
}
|
|
246
|
+
return witness;
|
|
64
247
|
}
|
|
65
248
|
|
|
66
249
|
/**
|
|
67
|
-
* Fetches the index and sibling path of a
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
250
|
+
* Fetches the index and sibling path of a block hash in the archive tree.
|
|
251
|
+
*
|
|
252
|
+
* Block hashes are the leaves of the archive tree. Each time a new block is added to the chain,
|
|
253
|
+
* its block hash is appended as a new leaf to the archive tree.
|
|
254
|
+
*
|
|
255
|
+
* @param referenceBlockHash - The hash of a block that contains the archive tree root in which to find the membership
|
|
256
|
+
* witness.
|
|
257
|
+
* @param blockHash - The block hash to find in the archive tree.
|
|
258
|
+
* @returns The membership witness containing the leaf index and sibling path
|
|
72
259
|
*/
|
|
73
|
-
public
|
|
74
|
-
|
|
260
|
+
public async getBlockHashMembershipWitness(
|
|
261
|
+
referenceBlockHash: BlockHash,
|
|
262
|
+
blockHash: BlockHash,
|
|
263
|
+
): Promise<Option<MembershipWitness<typeof ARCHIVE_HEIGHT>>> {
|
|
264
|
+
// Note that we validate that the reference block hash is at or before the anchor block - we don't test the block
|
|
265
|
+
// hash at all. If the block hash did not exist by the reference block hash, then the node will not return the
|
|
266
|
+
// membership witness as there is none.
|
|
267
|
+
const witness = await this.#queryWithBlockHashNotAfterAnchor(referenceBlockHash, () =>
|
|
268
|
+
this.aztecNode.getBlockHashMembershipWitness(referenceBlockHash, blockHash),
|
|
269
|
+
);
|
|
270
|
+
return witness ? Option.some(witness) : Option.none();
|
|
75
271
|
}
|
|
76
272
|
|
|
77
273
|
/**
|
|
78
274
|
* Returns a nullifier membership witness for a given nullifier at a given block.
|
|
79
|
-
* @param
|
|
275
|
+
* @param blockHash - The block hash at which to get the index.
|
|
80
276
|
* @param nullifier - Nullifier we try to find witness for.
|
|
81
277
|
* @returns The nullifier membership witness (if found).
|
|
82
278
|
*/
|
|
83
|
-
public async
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
279
|
+
public async getNullifierMembershipWitness(blockHash: BlockHash, nullifier: Fr): Promise<NullifierMembershipWitness> {
|
|
280
|
+
const witness = await this.#queryWithBlockHashNotAfterAnchor(blockHash, () =>
|
|
281
|
+
this.aztecNode.getNullifierMembershipWitness(blockHash, nullifier),
|
|
282
|
+
);
|
|
283
|
+
if (!witness) {
|
|
284
|
+
throw new Error(`Nullifier membership witness not found at block ${blockHash.toString()}.`);
|
|
285
|
+
}
|
|
286
|
+
return witness;
|
|
88
287
|
}
|
|
89
288
|
|
|
90
289
|
/**
|
|
91
290
|
* Returns a low nullifier membership witness for a given nullifier at a given block.
|
|
92
|
-
* @param
|
|
291
|
+
* @param blockHash - The block hash at which to get the index.
|
|
93
292
|
* @param nullifier - Nullifier we try to find the low nullifier witness for.
|
|
94
293
|
* @returns The low nullifier membership witness (if found).
|
|
95
294
|
* @remarks Low nullifier witness can be used to perform a nullifier non-inclusion proof by leveraging the "linked
|
|
96
295
|
* list structure" of leaves and proving that a lower nullifier is pointing to a bigger next value than the nullifier
|
|
97
296
|
* we are trying to prove non-inclusion for.
|
|
98
297
|
*/
|
|
99
|
-
public async
|
|
100
|
-
|
|
298
|
+
public async getLowNullifierMembershipWitness(
|
|
299
|
+
blockHash: BlockHash,
|
|
101
300
|
nullifier: Fr,
|
|
102
|
-
): Promise<NullifierMembershipWitness
|
|
103
|
-
|
|
301
|
+
): Promise<NullifierMembershipWitness> {
|
|
302
|
+
const witness = await this.#queryWithBlockHashNotAfterAnchor(blockHash, () =>
|
|
303
|
+
this.aztecNode.getLowNullifierMembershipWitness(blockHash, nullifier),
|
|
304
|
+
);
|
|
305
|
+
if (!witness) {
|
|
306
|
+
throw new Error(
|
|
307
|
+
`Low nullifier witness not found for nullifier ${nullifier} at block hash ${blockHash.toString()}.`,
|
|
308
|
+
);
|
|
309
|
+
}
|
|
310
|
+
return witness;
|
|
104
311
|
}
|
|
105
312
|
|
|
106
313
|
/**
|
|
107
314
|
* Returns a public data tree witness for a given leaf slot at a given block.
|
|
108
|
-
* @param
|
|
315
|
+
* @param blockHash - The block hash at which to get the index.
|
|
109
316
|
* @param leafSlot - The slot of the public data tree to get the witness for.
|
|
110
317
|
* @returns - The witness
|
|
111
318
|
*/
|
|
112
|
-
public async
|
|
113
|
-
|
|
319
|
+
public async getPublicDataWitness(blockHash: BlockHash, leafSlot: Fr): Promise<PublicDataWitness> {
|
|
320
|
+
const witness = await this.#queryWithBlockHashNotAfterAnchor(blockHash, () =>
|
|
321
|
+
this.aztecNode.getPublicDataWitness(blockHash, leafSlot),
|
|
322
|
+
);
|
|
323
|
+
if (!witness) {
|
|
324
|
+
throw new Error(`Public data witness not found for slot ${leafSlot} at block hash ${blockHash.toString()}.`);
|
|
325
|
+
}
|
|
326
|
+
return witness;
|
|
114
327
|
}
|
|
115
328
|
|
|
116
329
|
/**
|
|
@@ -118,22 +331,48 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
|
|
|
118
331
|
* @param blockNumber - The number of a block of which to get the block header.
|
|
119
332
|
* @returns Block extracted from a block with block number `blockNumber`.
|
|
120
333
|
*/
|
|
121
|
-
public async
|
|
122
|
-
const
|
|
123
|
-
if (
|
|
124
|
-
|
|
334
|
+
public async getBlockHeader(blockNumber: BlockNumber): Promise<BlockHeader> {
|
|
335
|
+
const anchorBlockNumber = this.anchorBlockHeader.getBlockNumber();
|
|
336
|
+
if (blockNumber > anchorBlockNumber) {
|
|
337
|
+
throw new Error(`Block number ${blockNumber} is higher than current block ${anchorBlockNumber}`);
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
// Most contracts query state at the "current" block, which is the anchor. Skip the RPC when we can.
|
|
341
|
+
if (blockNumber === anchorBlockNumber) {
|
|
342
|
+
return this.anchorBlockHeader;
|
|
125
343
|
}
|
|
126
|
-
|
|
344
|
+
|
|
345
|
+
const block = await this.aztecNode.getBlock(blockNumber);
|
|
346
|
+
if (!block?.header) {
|
|
347
|
+
throw new Error(`Block header not found for block ${blockNumber}.`);
|
|
348
|
+
}
|
|
349
|
+
return block.header;
|
|
127
350
|
}
|
|
128
351
|
|
|
129
352
|
/**
|
|
130
|
-
* Retrieve the
|
|
353
|
+
* Retrieve the public keys and partial address associated to a given address.
|
|
131
354
|
* @param account - The account address.
|
|
132
|
-
* @returns
|
|
133
|
-
* @throws An error if the account is not registered in the database.
|
|
355
|
+
* @returns The public keys and partial address, or `undefined` if the account is not registered.
|
|
134
356
|
*/
|
|
135
|
-
public
|
|
136
|
-
|
|
357
|
+
public async getPublicKeysAndPartialAddress(
|
|
358
|
+
account: AztecAddress,
|
|
359
|
+
): Promise<Option<{ publicKeys: PublicKeys; partialAddress: PartialAddress }>> {
|
|
360
|
+
const completeAddress = await this.addressStore.getCompleteAddress(account);
|
|
361
|
+
if (!completeAddress) {
|
|
362
|
+
return Option.none();
|
|
363
|
+
}
|
|
364
|
+
return Option.some({ publicKeys: completeAddress.publicKeys, partialAddress: completeAddress.partialAddress });
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
protected async getCompleteAddressOrFail(account: AztecAddress): Promise<CompleteAddress> {
|
|
368
|
+
const completeAddress = await this.addressStore.getCompleteAddress(account);
|
|
369
|
+
if (!completeAddress) {
|
|
370
|
+
throw new Error(
|
|
371
|
+
`No public key registered for address ${account}.
|
|
372
|
+
Register it by calling wallet.registerSender(...).\nSee docs for context: https://docs.aztec.network/errors/14`,
|
|
373
|
+
);
|
|
374
|
+
}
|
|
375
|
+
return completeAddress;
|
|
137
376
|
}
|
|
138
377
|
|
|
139
378
|
/**
|
|
@@ -141,18 +380,25 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
|
|
|
141
380
|
* @param address - Address.
|
|
142
381
|
* @returns A contract instance.
|
|
143
382
|
*/
|
|
144
|
-
public
|
|
145
|
-
|
|
383
|
+
public async getContractInstance(address: AztecAddress): Promise<ContractInstancePreimageWithAddress> {
|
|
384
|
+
const instance = await this.anchoredContractData.getContractInstance(address);
|
|
385
|
+
if (!instance) {
|
|
386
|
+
throw new Error(`No contract instance found for address ${address.toString()}`);
|
|
387
|
+
}
|
|
388
|
+
return instance;
|
|
146
389
|
}
|
|
147
390
|
|
|
148
391
|
/**
|
|
149
|
-
* Returns an auth witness for the given message hash
|
|
150
|
-
* for this transaction first, and falls back to the local database if not found.
|
|
392
|
+
* Returns an auth witness for the given message hash from the list of transient witnesses for this transaction.
|
|
151
393
|
* @param messageHash - Hash of the message to authenticate.
|
|
152
|
-
* @returns Authentication witness for the requested message hash.
|
|
394
|
+
* @returns Authentication witness for the requested message hash, or undefined if not found.
|
|
153
395
|
*/
|
|
154
|
-
public
|
|
155
|
-
|
|
396
|
+
public getAuthWitness(messageHash: Fr): Promise<Fr[]> {
|
|
397
|
+
const witness = this.authWitnesses.find(w => w.requestHash.equals(messageHash))?.witness;
|
|
398
|
+
if (!witness) {
|
|
399
|
+
throw new Error(`Unknown auth witness for message hash ${messageHash}`);
|
|
400
|
+
}
|
|
401
|
+
return Promise.resolve(witness);
|
|
156
402
|
}
|
|
157
403
|
|
|
158
404
|
/**
|
|
@@ -164,6 +410,7 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
|
|
|
164
410
|
* Real notes coming from DB will have a leafIndex which
|
|
165
411
|
* represents their index in the note hash tree.
|
|
166
412
|
*
|
|
413
|
+
* @param owner - The owner of the notes. If undefined, returns notes for all owners.
|
|
167
414
|
* @param storageSlot - The storage slot.
|
|
168
415
|
* @param numSelects - The number of valid selects in selectBy and selectValues.
|
|
169
416
|
* @param selectBy - An array of indices of the fields to selects.
|
|
@@ -176,7 +423,8 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
|
|
|
176
423
|
* @param status - The status of notes to fetch.
|
|
177
424
|
* @returns Array of note data.
|
|
178
425
|
*/
|
|
179
|
-
public async
|
|
426
|
+
public async getNotes(
|
|
427
|
+
owner: Option<AztecAddress>,
|
|
180
428
|
storageSlot: Fr,
|
|
181
429
|
numSelects: number,
|
|
182
430
|
selectByIndexes: number[],
|
|
@@ -191,9 +439,13 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
|
|
|
191
439
|
limit: number,
|
|
192
440
|
offset: number,
|
|
193
441
|
status: NoteStatus,
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
442
|
+
maxNotes: number,
|
|
443
|
+
packedHintedNoteLength: number,
|
|
444
|
+
): Promise<BoundedVec<NoteData>> {
|
|
445
|
+
const noteService = new NoteService(this.noteStore, this.aztecNode, this.anchorBlockHeader, this.jobId);
|
|
446
|
+
|
|
447
|
+
const dbNotes = await noteService.getNotes(this.contractAddress, owner.value, storageSlot, status, this.scopes);
|
|
448
|
+
const picked = pickNotes<NoteData>(dbNotes, {
|
|
197
449
|
selects: selectByIndexes.slice(0, numSelects).map((index, i) => ({
|
|
198
450
|
selector: { index, offset: selectByOffsets[i], length: selectByLengths[i] },
|
|
199
451
|
value: selectValues[i],
|
|
@@ -206,6 +458,7 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
|
|
|
206
458
|
limit,
|
|
207
459
|
offset,
|
|
208
460
|
});
|
|
461
|
+
return BoundedVec.from({ data: picked, maxLength: maxNotes, elementSize: packedHintedNoteLength });
|
|
209
462
|
}
|
|
210
463
|
|
|
211
464
|
/**
|
|
@@ -213,146 +466,713 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
|
|
|
213
466
|
* @param innerNullifier - The inner nullifier.
|
|
214
467
|
* @returns A boolean indicating whether the nullifier exists in the tree or not.
|
|
215
468
|
*/
|
|
216
|
-
public async
|
|
217
|
-
const nullifier = await
|
|
218
|
-
|
|
219
|
-
|
|
469
|
+
public async doesNullifierExist(innerNullifier: Fr) {
|
|
470
|
+
const [nullifier, anchorBlockHash] = await Promise.all([
|
|
471
|
+
siloNullifier(this.contractAddress, innerNullifier!),
|
|
472
|
+
this.anchorBlockHeader.hash(),
|
|
473
|
+
]);
|
|
474
|
+
const [leafIndex] = await this.aztecNode.findLeavesIndexes(anchorBlockHash, MerkleTreeId.NULLIFIER_TREE, [
|
|
475
|
+
nullifier,
|
|
476
|
+
]);
|
|
477
|
+
return leafIndex?.data !== undefined;
|
|
220
478
|
}
|
|
221
479
|
|
|
222
480
|
/**
|
|
223
|
-
*
|
|
481
|
+
* Returns the membership witness of an un-nullified L1 to L2 message.
|
|
224
482
|
* @param contractAddress - Address of a contract by which the message was emitted.
|
|
225
483
|
* @param messageHash - Hash of the message.
|
|
226
484
|
* @param secret - Secret used to compute a nullifier.
|
|
227
485
|
* @dev Contract address and secret are only used to compute the nullifier to get non-nullified messages
|
|
228
486
|
* @returns The l1 to l2 membership witness (index of message in the tree and sibling path).
|
|
229
487
|
*/
|
|
230
|
-
public async
|
|
231
|
-
|
|
488
|
+
public async getL1ToL2MembershipWitness(contractAddress: AztecAddress, messageHash: Fr, secret: Fr) {
|
|
489
|
+
const [messageIndex, siblingPath] = await getNonNullifiedL1ToL2MessageWitness(
|
|
490
|
+
this.aztecNode,
|
|
491
|
+
contractAddress,
|
|
492
|
+
messageHash,
|
|
493
|
+
secret,
|
|
494
|
+
await this.anchorBlockHeader.hash(),
|
|
495
|
+
);
|
|
496
|
+
|
|
497
|
+
return { index: messageIndex, siblingPath };
|
|
232
498
|
}
|
|
233
499
|
|
|
234
500
|
/**
|
|
235
501
|
* Read the public storage data.
|
|
502
|
+
* @param blockHash - The block hash to read storage at.
|
|
236
503
|
* @param contractAddress - The address to read storage from.
|
|
237
504
|
* @param startStorageSlot - The starting storage slot.
|
|
238
|
-
* @param blockNumber - The block number to read storage at.
|
|
239
505
|
* @param numberOfElements - Number of elements to read from the starting storage slot.
|
|
240
506
|
*/
|
|
241
|
-
public
|
|
507
|
+
public getFromPublicStorage(
|
|
508
|
+
blockHash: BlockHash,
|
|
242
509
|
contractAddress: AztecAddress,
|
|
243
510
|
startStorageSlot: Fr,
|
|
244
|
-
blockNumber: number,
|
|
245
511
|
numberOfElements: number,
|
|
246
512
|
) {
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
513
|
+
return this.#queryWithBlockHashNotAfterAnchor(blockHash, async () => {
|
|
514
|
+
const slots = Array(numberOfElements)
|
|
515
|
+
.fill(0)
|
|
516
|
+
.map((_, i) => new Fr(startStorageSlot.value + BigInt(i)));
|
|
517
|
+
|
|
518
|
+
const values = await Promise.all(
|
|
519
|
+
slots.map(storageSlot => this.aztecNode.getPublicStorageAt(blockHash, contractAddress, storageSlot)),
|
|
520
|
+
);
|
|
521
|
+
|
|
522
|
+
this.logger.debug(
|
|
523
|
+
`Oracle storage read: slots=[${slots.map(slot => slot.toString()).join(', ')}] address=${contractAddress.toString()} values=[${values.join(', ')}]`,
|
|
524
|
+
);
|
|
525
|
+
|
|
526
|
+
return values;
|
|
527
|
+
});
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
/**
|
|
531
|
+
* Returns a per-contract logger whose output is prefixed with `contract:<name>(<addrAbbrev>)`.
|
|
532
|
+
*/
|
|
533
|
+
async #getContractLogger(): Promise<Logger> {
|
|
534
|
+
if (!this.contractLogger) {
|
|
535
|
+
// Purpose of instanceId is to distinguish logs from different instances of the same component. It makes sense
|
|
536
|
+
// to re-use jobId as instanceId here as executions of different PXE jobs are isolated.
|
|
537
|
+
this.contractLogger = await createContractLogger(
|
|
538
|
+
this.contractAddress,
|
|
539
|
+
addr => this.anchoredContractData.getDebugContractName(addr),
|
|
540
|
+
'user',
|
|
541
|
+
{ instanceId: this.jobId },
|
|
542
|
+
);
|
|
543
|
+
}
|
|
544
|
+
return this.contractLogger;
|
|
545
|
+
}
|
|
251
546
|
|
|
252
|
-
|
|
253
|
-
|
|
547
|
+
/**
|
|
548
|
+
* Returns a per-contract logger whose output is prefixed with `aztecnr:<name>(<addrAbbrev>)`.
|
|
549
|
+
*/
|
|
550
|
+
async #getAztecnrLogger(): Promise<Logger> {
|
|
551
|
+
if (!this.aztecnrLogger) {
|
|
552
|
+
// Purpose of instanceId is to distinguish logs from different instances of the same component. It makes sense
|
|
553
|
+
// to re-use jobId as instanceId here as executions of different PXE jobs are isolated.
|
|
554
|
+
this.aztecnrLogger = await createContractLogger(
|
|
555
|
+
this.contractAddress,
|
|
556
|
+
addr => this.anchoredContractData.getDebugContractName(addr),
|
|
557
|
+
'aztecnr',
|
|
558
|
+
{ instanceId: this.jobId },
|
|
254
559
|
);
|
|
255
|
-
values.push(value);
|
|
256
560
|
}
|
|
257
|
-
return
|
|
561
|
+
return this.aztecnrLogger;
|
|
258
562
|
}
|
|
259
563
|
|
|
260
|
-
public
|
|
564
|
+
public async log(level: number, message: string, _fieldsSize: number, fields: Fr[]): Promise<void> {
|
|
261
565
|
if (!LogLevels[level]) {
|
|
262
|
-
throw new Error(`Invalid
|
|
566
|
+
throw new Error(`Invalid log level: ${level}`);
|
|
263
567
|
}
|
|
264
|
-
|
|
265
|
-
|
|
568
|
+
|
|
569
|
+
const { kind, message: strippedMessage } = stripAztecnrLogPrefix(message);
|
|
570
|
+
|
|
571
|
+
const logger = kind == 'aztecnr' ? await this.#getAztecnrLogger() : await this.#getContractLogger();
|
|
572
|
+
logContractMessage(logger, LogLevels[level], strippedMessage, fields);
|
|
266
573
|
}
|
|
267
574
|
|
|
268
|
-
|
|
269
|
-
|
|
575
|
+
/** Fetches pending tagged logs into a freshly allocated ephemeral array and returns it. */
|
|
576
|
+
public async getPendingTaggedLogsV2(
|
|
577
|
+
scope: AztecAddress,
|
|
578
|
+
providedSecrets: EphemeralArray<ProvidedSecret>,
|
|
579
|
+
): Promise<EphemeralArray<PendingTaggedLog>> {
|
|
580
|
+
const secrets = providedSecrets
|
|
581
|
+
.readAll(this.ephemeralArrayService)
|
|
582
|
+
.map(ps => new AppTaggingSecret(ps.secret, this.contractAddress, ps.mode));
|
|
270
583
|
|
|
271
|
-
|
|
584
|
+
const logService = this.#createLogService();
|
|
585
|
+
const logs = await logService.fetchTaggedLogs(this.contractAddress, scope, secrets);
|
|
586
|
+
return EphemeralArray.fromValues(this.ephemeralArrayService, logs);
|
|
272
587
|
}
|
|
273
588
|
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
589
|
+
#createLogService(): LogService {
|
|
590
|
+
return new LogService(
|
|
591
|
+
this.aztecNode,
|
|
592
|
+
this.anchorBlockHeader,
|
|
593
|
+
this.l2TipsStore,
|
|
594
|
+
this.keyStore,
|
|
595
|
+
this.recipientTaggingStore,
|
|
596
|
+
this.taggingSecretSourcesStore,
|
|
597
|
+
this.addressStore,
|
|
598
|
+
this.jobId,
|
|
599
|
+
this.logger.getBindings(),
|
|
600
|
+
);
|
|
601
|
+
}
|
|
283
602
|
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
603
|
+
public async validateAndStoreEnqueuedNotesAndEvents(
|
|
604
|
+
noteValidationRequests: EphemeralArray<NoteValidationRequest>,
|
|
605
|
+
eventValidationRequests: EphemeralArray<EventValidationRequest>,
|
|
606
|
+
scope: AztecAddress,
|
|
607
|
+
) {
|
|
608
|
+
await this.#processValidationRequests(
|
|
609
|
+
noteValidationRequests.readAll(this.ephemeralArrayService),
|
|
610
|
+
eventValidationRequests.readAll(this.ephemeralArrayService),
|
|
611
|
+
scope,
|
|
288
612
|
);
|
|
289
613
|
}
|
|
290
614
|
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
615
|
+
async #processValidationRequests(
|
|
616
|
+
noteValidationRequests: NoteValidationRequest[],
|
|
617
|
+
eventValidationRequests: EventValidationRequest[],
|
|
618
|
+
scope: AztecAddress,
|
|
295
619
|
) {
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
620
|
+
const txEffects = await this.#fetchTxEffects([
|
|
621
|
+
...noteValidationRequests.map(r => r.txHash),
|
|
622
|
+
...eventValidationRequests.map(r => r.txHash),
|
|
623
|
+
]);
|
|
300
624
|
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
625
|
+
const noteService = new NoteService(this.noteStore, this.aztecNode, this.anchorBlockHeader, this.jobId);
|
|
626
|
+
const eventService = new EventService(this.anchorBlockHeader, this.aztecNode, this.privateEventStore, this.jobId);
|
|
627
|
+
|
|
628
|
+
await Promise.all([
|
|
629
|
+
noteService.validateAndStoreNotes(noteValidationRequests, scope, txEffects),
|
|
630
|
+
eventService.validateAndStoreEvents(eventValidationRequests, scope, txEffects),
|
|
631
|
+
]);
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
public async getLogsByTagV2(
|
|
635
|
+
requests: EphemeralArray<LogRetrievalRequest>,
|
|
636
|
+
): Promise<EphemeralArray<EphemeralArray<LogRetrievalResponse>>> {
|
|
637
|
+
const logRetrievalRequests = requests.readAll(this.ephemeralArrayService);
|
|
638
|
+
const logService = this.#createLogService();
|
|
639
|
+
|
|
640
|
+
const logRetrievalResponses = await logService.fetchLogsByTag(this.contractAddress, logRetrievalRequests);
|
|
641
|
+
|
|
642
|
+
// Create an inner ephemeral array for each request's matching logs, then wrap all slots in an outer array.
|
|
643
|
+
const innerArrays = logRetrievalResponses.map(responses =>
|
|
644
|
+
EphemeralArray.fromValues(this.ephemeralArrayService, responses),
|
|
305
645
|
);
|
|
646
|
+
|
|
647
|
+
return EphemeralArray.fromValues(this.ephemeralArrayService, innerArrays);
|
|
306
648
|
}
|
|
307
649
|
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
650
|
+
/** Given an array of tx hashes, returns an aligned array of tx info if the tx is available. */
|
|
651
|
+
public async getResolvedTxs(requests: EphemeralArray<Fr>): Promise<EphemeralArray<Option<ResolvedTx>>> {
|
|
652
|
+
const txHashes = requests.readAll(this.ephemeralArrayService);
|
|
653
|
+
|
|
654
|
+
const resolved = await this.txResolver.resolveTxs(txHashes, this.anchorBlockHeader.getBlockNumber());
|
|
655
|
+
|
|
656
|
+
const options = resolved.map(r => (r ? Option.some(r) : Option.none<ResolvedTx>()));
|
|
657
|
+
return EphemeralArray.fromValues(this.ephemeralArrayService, options);
|
|
314
658
|
}
|
|
315
659
|
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
660
|
+
/**
|
|
661
|
+
* Fetches the effects of a transaction by its hash. Returns null if the tx is not found or is beyond the anchor
|
|
662
|
+
* block.
|
|
663
|
+
*/
|
|
664
|
+
public async getTxEffect(txHash: TxHash): Promise<Option<TxEffectData>> {
|
|
665
|
+
if (txHash.hash.isZero()) {
|
|
666
|
+
throw new Error('Invalid tx hash passed into aztec_utl_getTxEffect oracle handler');
|
|
320
667
|
}
|
|
321
|
-
return (
|
|
322
|
-
// TODO(#12425): On the following line, the pertinent capsule gets overshadowed by the transient one. Tackle this.
|
|
323
|
-
this.capsules.find(c => c.contractAddress.equals(contractAddress) && c.storageSlot.equals(slot))?.data ??
|
|
324
|
-
(await this.executionDataProvider.loadCapsule(this.contractAddress, slot))
|
|
325
|
-
);
|
|
326
|
-
}
|
|
327
668
|
|
|
328
|
-
|
|
329
|
-
if (!
|
|
330
|
-
|
|
331
|
-
throw new Error(`Contract ${contractAddress} is not allowed to access ${this.contractAddress}'s PXE DB`);
|
|
669
|
+
const receipt = await this.aztecNode.getTxReceipt(txHash, { includeTxEffect: true });
|
|
670
|
+
if (!receipt.isMined() || !receipt.txEffect || receipt.blockNumber > this.anchorBlockHeader.getBlockNumber()) {
|
|
671
|
+
return Option.none();
|
|
332
672
|
}
|
|
333
|
-
|
|
673
|
+
|
|
674
|
+
const txEffect = receipt.txEffect;
|
|
675
|
+
return Option.some({
|
|
676
|
+
...txEffect,
|
|
677
|
+
publicLogs: FlatPublicLogs.fromLogs(txEffect.publicLogs),
|
|
678
|
+
contractClassLogs: txEffect.contractClassLogs.map(log => ({
|
|
679
|
+
contractAddress: log.contractAddress,
|
|
680
|
+
fields: log.fields.toFields(),
|
|
681
|
+
emittedLength: log.emittedLength,
|
|
682
|
+
})),
|
|
683
|
+
});
|
|
334
684
|
}
|
|
335
685
|
|
|
336
|
-
public
|
|
686
|
+
public setCapsule(contractAddress: AztecAddress, slot: Fr, capsule: Fr[], scope: AztecAddress): void {
|
|
687
|
+
this.#assertOwnContract(contractAddress);
|
|
688
|
+
this.capsuleService.setCapsule(contractAddress, slot, capsule, this.jobId, scope);
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
public async getCapsule(
|
|
692
|
+
contractAddress: AztecAddress,
|
|
693
|
+
slot: Fr,
|
|
694
|
+
tSize: number,
|
|
695
|
+
scope: AztecAddress,
|
|
696
|
+
): Promise<Option<Fr[]>> {
|
|
697
|
+
this.#assertOwnContract(contractAddress);
|
|
698
|
+
const values = await this.capsuleService.getCapsule(contractAddress, slot, this.jobId, scope, this.capsules);
|
|
699
|
+
return values ? Option.some(values) : Option.none({ length: tSize });
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
public deleteCapsule(contractAddress: AztecAddress, slot: Fr, scope: AztecAddress): void {
|
|
703
|
+
this.#assertOwnContract(contractAddress);
|
|
704
|
+
this.capsuleService.deleteCapsule(contractAddress, slot, this.jobId, scope);
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
public copyCapsule(
|
|
337
708
|
contractAddress: AztecAddress,
|
|
338
709
|
srcSlot: Fr,
|
|
339
710
|
dstSlot: Fr,
|
|
340
711
|
numEntries: number,
|
|
712
|
+
scope: AztecAddress,
|
|
341
713
|
): Promise<void> {
|
|
714
|
+
this.#assertOwnContract(contractAddress);
|
|
715
|
+
return this.capsuleService.copyCapsule(contractAddress, srcSlot, dstSlot, numEntries, this.jobId, scope);
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
/**
|
|
719
|
+
* Asserts the executing contract may only access its own slice of PXE DB.
|
|
720
|
+
*/
|
|
721
|
+
#assertOwnContract(contractAddress: AztecAddress): void {
|
|
342
722
|
if (!contractAddress.equals(this.contractAddress)) {
|
|
343
|
-
// TODO(#10727): instead of this check that this.contractAddress is allowed to access the external DB
|
|
344
723
|
throw new Error(`Contract ${contractAddress} is not allowed to access ${this.contractAddress}'s PXE DB`);
|
|
345
724
|
}
|
|
346
|
-
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
/**
|
|
728
|
+
* Records a fact into a collection. A `Some` origin block makes the fact retractable (pruned on reorg of that
|
|
729
|
+
* block), a `None` origin block makes it non-retractable, surviving reorgs.
|
|
730
|
+
*/
|
|
731
|
+
public recordFact(
|
|
732
|
+
contractAddress: AztecAddress,
|
|
733
|
+
scope: AztecAddress,
|
|
734
|
+
factCollectionTypeId: Fr,
|
|
735
|
+
factCollectionId: Fr,
|
|
736
|
+
factTypeId: Fr,
|
|
737
|
+
payload: EphemeralArray<Fr>,
|
|
738
|
+
originBlock: Option<OriginBlock>,
|
|
739
|
+
): Promise<void> {
|
|
740
|
+
this.#assertOwnContract(contractAddress);
|
|
741
|
+
return this.factService.recordFact(
|
|
742
|
+
new FactCollectionKey(contractAddress, scope, factCollectionTypeId, factCollectionId),
|
|
743
|
+
factTypeId,
|
|
744
|
+
payload.readAll(this.ephemeralArrayService),
|
|
745
|
+
originBlock.isSome() ? originBlock.value : undefined,
|
|
746
|
+
this.jobId,
|
|
747
|
+
);
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
/**
|
|
751
|
+
* Deletes a fact collection, removing all its facts. A no-op if no such collection exists.
|
|
752
|
+
*/
|
|
753
|
+
public deleteFactCollection(
|
|
754
|
+
contractAddress: AztecAddress,
|
|
755
|
+
scope: AztecAddress,
|
|
756
|
+
factCollectionTypeId: Fr,
|
|
757
|
+
factCollectionId: Fr,
|
|
758
|
+
): Promise<void> {
|
|
759
|
+
this.#assertOwnContract(contractAddress);
|
|
760
|
+
return this.factService.deleteFactCollection(
|
|
761
|
+
new FactCollectionKey(contractAddress, scope, factCollectionTypeId, factCollectionId),
|
|
762
|
+
this.jobId,
|
|
763
|
+
);
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
/**
|
|
767
|
+
* Returns a fact collection.
|
|
768
|
+
*/
|
|
769
|
+
public async getFactCollection(
|
|
770
|
+
contractAddress: AztecAddress,
|
|
771
|
+
scope: AztecAddress,
|
|
772
|
+
factCollectionTypeId: Fr,
|
|
773
|
+
factCollectionId: Fr,
|
|
774
|
+
): Promise<Option<FactCollection>> {
|
|
775
|
+
this.#assertOwnContract(contractAddress);
|
|
776
|
+
const tips = anchoredTipBlockNumbers(await this.l2TipsStore.getL2Tips(), this.anchorBlockHeader.getBlockNumber());
|
|
777
|
+
const collection = await this.factService.getFactCollection(
|
|
778
|
+
new FactCollectionKey(contractAddress, scope, factCollectionTypeId, factCollectionId),
|
|
779
|
+
tips,
|
|
780
|
+
this.jobId,
|
|
781
|
+
);
|
|
782
|
+
return collection
|
|
783
|
+
? Option.some(
|
|
784
|
+
toNoirFactCollection(
|
|
785
|
+
this.ephemeralArrayService,
|
|
786
|
+
contractAddress,
|
|
787
|
+
scope,
|
|
788
|
+
factCollectionTypeId,
|
|
789
|
+
factCollectionId,
|
|
790
|
+
collection.facts,
|
|
791
|
+
),
|
|
792
|
+
)
|
|
793
|
+
: Option.none(emptyFactCollection(this.ephemeralArrayService));
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
/** Returns every fact collection of `factCollectionTypeId`. */
|
|
797
|
+
public async getFactCollectionsByType(
|
|
798
|
+
contractAddress: AztecAddress,
|
|
799
|
+
scope: AztecAddress,
|
|
800
|
+
factCollectionTypeId: Fr,
|
|
801
|
+
): Promise<EphemeralArray<FactCollection>> {
|
|
802
|
+
this.#assertOwnContract(contractAddress);
|
|
803
|
+
const tips = anchoredTipBlockNumbers(await this.l2TipsStore.getL2Tips(), this.anchorBlockHeader.getBlockNumber());
|
|
804
|
+
const collections = await this.factService.getFactCollectionsByType(
|
|
805
|
+
new FactCollectionTypeKey(contractAddress, scope, factCollectionTypeId),
|
|
806
|
+
tips,
|
|
807
|
+
this.jobId,
|
|
808
|
+
);
|
|
809
|
+
return EphemeralArray.fromValues(
|
|
810
|
+
this.ephemeralArrayService,
|
|
811
|
+
collections.map(collection =>
|
|
812
|
+
toNoirFactCollection(
|
|
813
|
+
this.ephemeralArrayService,
|
|
814
|
+
collection.key.contractAddress,
|
|
815
|
+
collection.key.scope,
|
|
816
|
+
collection.key.factCollectionTypeId,
|
|
817
|
+
collection.key.factCollectionId,
|
|
818
|
+
collection.facts,
|
|
819
|
+
),
|
|
820
|
+
),
|
|
821
|
+
);
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
/**
|
|
825
|
+
* Clears cached sync state for a contract for a set of scopes, forcing re-sync on the next query so that newly
|
|
826
|
+
* stored notes or events are discovered.
|
|
827
|
+
*/
|
|
828
|
+
public setContractSyncCacheInvalid(contractAddress: AztecAddress, scopes: BoundedVec<AztecAddress>): void {
|
|
829
|
+
if (!contractAddress.equals(this.contractAddress)) {
|
|
830
|
+
throw new Error(`Contract ${this.contractAddress} cannot invalidate sync cache of ${contractAddress}`);
|
|
831
|
+
}
|
|
832
|
+
this.contractSyncService.invalidateContractForScopes(contractAddress, scopes.data);
|
|
347
833
|
}
|
|
348
834
|
|
|
349
835
|
// TODO(#11849): consider replacing this oracle with a pure Noir implementation of aes decryption.
|
|
350
|
-
public
|
|
351
|
-
|
|
352
|
-
|
|
836
|
+
public async decryptAes128(
|
|
837
|
+
ciphertext: BoundedVec<number>,
|
|
838
|
+
iv: Buffer,
|
|
839
|
+
symKey: Buffer,
|
|
840
|
+
): Promise<Option<BoundedVec<number>>> {
|
|
841
|
+
const capacity = ciphertext.maxLength;
|
|
842
|
+
try {
|
|
843
|
+
const aes128 = new Aes128();
|
|
844
|
+
const plaintext = await aes128.decryptBufferCBC(Buffer.from(ciphertext.data), iv, symKey);
|
|
845
|
+
return Option.some(BoundedVec.from<number>({ data: [...plaintext], maxLength: capacity }));
|
|
846
|
+
} catch {
|
|
847
|
+
return Option.none({ maxLength: capacity });
|
|
848
|
+
}
|
|
849
|
+
}
|
|
850
|
+
|
|
851
|
+
/**
|
|
852
|
+
* Retrieves app-siloed shared secrets for multiple ephemeral public keys stored in an ephemeral array.
|
|
853
|
+
* @param address - The recipient address.
|
|
854
|
+
* @param ephPks - Ephemeral array containing the serialized Points.
|
|
855
|
+
* @param contractAddress - The contract address for app-siloing (validated against execution context).
|
|
856
|
+
* @returns A new ephemeral array containing the computed shared secrets, or an empty array when the PXE does not
|
|
857
|
+
* hold the keys for `address`, signaling that no secrets can be derived for it.
|
|
858
|
+
*/
|
|
859
|
+
public async getSharedSecrets(
|
|
860
|
+
address: AztecAddress,
|
|
861
|
+
ephPks: EphemeralArray<EmbeddedCurvePoint>,
|
|
862
|
+
contractAddress: AztecAddress,
|
|
863
|
+
): Promise<EphemeralArray<Fr>> {
|
|
864
|
+
if (!contractAddress.equals(this.contractAddress)) {
|
|
865
|
+
throw new Error(
|
|
866
|
+
`getSharedSecrets called with contract address ${contractAddress}, expected ${this.contractAddress}`,
|
|
867
|
+
);
|
|
868
|
+
}
|
|
869
|
+
const recipientCompleteAddress = await this.addressStore.getCompleteAddress(address);
|
|
870
|
+
if (!recipientCompleteAddress) {
|
|
871
|
+
this.logger.warn(
|
|
872
|
+
`Computing shared secrets for address ${address} whose keys are not held - returning no secrets`,
|
|
873
|
+
{
|
|
874
|
+
address,
|
|
875
|
+
contractAddress: this.contractAddress,
|
|
876
|
+
},
|
|
877
|
+
);
|
|
878
|
+
return EphemeralArray.fromValues<Fr>(this.ephemeralArrayService, []);
|
|
879
|
+
}
|
|
880
|
+
const ivpkMHash = await hashPublicKey(recipientCompleteAddress.publicKeys.ivpkM);
|
|
881
|
+
const ivskM = await this.keyStore.getMasterSecretKey(ivpkMHash);
|
|
882
|
+
const addressSecret = await computeAddressSecret(await recipientCompleteAddress.getPreaddress(), ivskM);
|
|
883
|
+
|
|
884
|
+
const ephPkPoints = ephPks.readAll(this.ephemeralArrayService);
|
|
885
|
+
const secrets = await Promise.all(
|
|
886
|
+
ephPkPoints.map(({ x, y }) => appSiloEcdhSharedSecret(addressSecret, new Point(x, y), this.contractAddress)),
|
|
887
|
+
);
|
|
888
|
+
|
|
889
|
+
return EphemeralArray.fromValues(this.ephemeralArrayService, secrets);
|
|
890
|
+
}
|
|
891
|
+
|
|
892
|
+
public pushEphemeral(slot: Fr, elements: Fr[]): number {
|
|
893
|
+
return this.ephemeralArrayService.push(slot, elements);
|
|
894
|
+
}
|
|
895
|
+
|
|
896
|
+
public popEphemeral(slot: Fr): Fr[] {
|
|
897
|
+
return this.ephemeralArrayService.pop(slot);
|
|
898
|
+
}
|
|
899
|
+
|
|
900
|
+
public getEphemeral(slot: Fr, index: number): Fr[] {
|
|
901
|
+
return this.ephemeralArrayService.get(slot, index);
|
|
902
|
+
}
|
|
903
|
+
|
|
904
|
+
public setEphemeral(slot: Fr, index: number, elements: Fr[]): void {
|
|
905
|
+
this.ephemeralArrayService.set(slot, index, elements);
|
|
906
|
+
}
|
|
907
|
+
|
|
908
|
+
public getEphemeralLen(slot: Fr): number {
|
|
909
|
+
return this.ephemeralArrayService.len(slot);
|
|
910
|
+
}
|
|
911
|
+
|
|
912
|
+
public removeEphemeral(slot: Fr, index: number): void {
|
|
913
|
+
this.ephemeralArrayService.remove(slot, index);
|
|
914
|
+
}
|
|
915
|
+
|
|
916
|
+
public clearEphemeral(slot: Fr): void {
|
|
917
|
+
this.ephemeralArrayService.clear(slot);
|
|
918
|
+
}
|
|
919
|
+
|
|
920
|
+
public pushTransient(slot: Fr, elements: Fr[]): number {
|
|
921
|
+
return this.transientArrayService.push(this.contractAddress, slot, elements);
|
|
353
922
|
}
|
|
354
923
|
|
|
355
|
-
public
|
|
356
|
-
return this.
|
|
924
|
+
public popTransient(slot: Fr): Fr[] {
|
|
925
|
+
return this.transientArrayService.pop(this.contractAddress, slot);
|
|
357
926
|
}
|
|
927
|
+
|
|
928
|
+
public getTransient(slot: Fr, index: number): Fr[] {
|
|
929
|
+
return this.transientArrayService.get(this.contractAddress, slot, index);
|
|
930
|
+
}
|
|
931
|
+
|
|
932
|
+
public setTransient(slot: Fr, index: number, elements: Fr[]): void {
|
|
933
|
+
this.transientArrayService.set(this.contractAddress, slot, index, elements);
|
|
934
|
+
}
|
|
935
|
+
|
|
936
|
+
public getTransientLen(slot: Fr): number {
|
|
937
|
+
return this.transientArrayService.len(this.contractAddress, slot);
|
|
938
|
+
}
|
|
939
|
+
|
|
940
|
+
public removeTransient(slot: Fr, index: number): void {
|
|
941
|
+
this.transientArrayService.remove(this.contractAddress, slot, index);
|
|
942
|
+
}
|
|
943
|
+
|
|
944
|
+
public clearTransient(slot: Fr): void {
|
|
945
|
+
this.transientArrayService.clear(this.contractAddress, slot);
|
|
946
|
+
}
|
|
947
|
+
|
|
948
|
+
public emitOffchainEffect(data: Fr[]): Promise<void> {
|
|
949
|
+
this.offchainEffects.push({ data, contractAddress: this.contractAddress });
|
|
950
|
+
return Promise.resolve();
|
|
951
|
+
}
|
|
952
|
+
|
|
953
|
+
/** Executes another utility function from within this one and returns its serialized return values. */
|
|
954
|
+
public async callUtilityFunction(
|
|
955
|
+
targetContractAddress: AztecAddress,
|
|
956
|
+
functionSelector: FunctionSelector,
|
|
957
|
+
args: Fr[],
|
|
958
|
+
): Promise<Fr[]> {
|
|
959
|
+
const targetArtifact = await this.anchoredContractData.getFunctionArtifactWithDebugMetadata(
|
|
960
|
+
targetContractAddress,
|
|
961
|
+
functionSelector,
|
|
962
|
+
);
|
|
963
|
+
if (!targetArtifact) {
|
|
964
|
+
throw new Error(
|
|
965
|
+
`Cannot call ${targetContractAddress}:${functionSelector}: the contract is not registered. ` +
|
|
966
|
+
`Register it via wallet.registerContract(...).`,
|
|
967
|
+
);
|
|
968
|
+
}
|
|
969
|
+
|
|
970
|
+
if (!targetContractAddress.equals(this.contractAddress)) {
|
|
971
|
+
// Standard handshake registry reads are authorized by default; every other cross-contract call needs the hook.
|
|
972
|
+
if (!(await isStandardHandshakeRegistryUtilityRead(targetContractAddress, functionSelector))) {
|
|
973
|
+
const [callerClassId, targetClassId] = await Promise.all([
|
|
974
|
+
this.anchoredContractData.getCurrentClassId(this.contractAddress),
|
|
975
|
+
this.anchoredContractData.getCurrentClassId(targetContractAddress),
|
|
976
|
+
]);
|
|
977
|
+
if (!callerClassId || !targetClassId) {
|
|
978
|
+
throw new Error(
|
|
979
|
+
`Cannot authorize utility call from ${this.contractAddress} to ${targetContractAddress}: ` +
|
|
980
|
+
`${!callerClassId ? this.contractAddress : targetContractAddress} is not registered.`,
|
|
981
|
+
);
|
|
982
|
+
}
|
|
983
|
+
const request: UtilityCallAuthorizationRequest = {
|
|
984
|
+
caller: this.contractAddress,
|
|
985
|
+
callerClassId,
|
|
986
|
+
target: targetContractAddress,
|
|
987
|
+
targetClassId,
|
|
988
|
+
functionSelector,
|
|
989
|
+
functionName: targetArtifact.name,
|
|
990
|
+
args,
|
|
991
|
+
callerContext: this.callerContext,
|
|
992
|
+
};
|
|
993
|
+
|
|
994
|
+
const response = this.hooks?.authorizeUtilityCall
|
|
995
|
+
? await this.hooks.authorizeUtilityCall(request)
|
|
996
|
+
: { authorized: false, reason: 'No authorizeUtilityCall hook configured' };
|
|
997
|
+
|
|
998
|
+
if (!response.authorized) {
|
|
999
|
+
const reason = response.reason ? `: ${response.reason}` : '';
|
|
1000
|
+
throw new Error(
|
|
1001
|
+
`Cross-contract utility call denied${reason}. ${this.contractAddress} attempted to call ` +
|
|
1002
|
+
`${targetContractAddress}:${functionSelector} (${targetArtifact.name}). ` +
|
|
1003
|
+
`See https://docs.aztec.network/errors/11`,
|
|
1004
|
+
);
|
|
1005
|
+
}
|
|
1006
|
+
}
|
|
1007
|
+
|
|
1008
|
+
await this.contractSyncService.ensureContractSynced(
|
|
1009
|
+
targetContractAddress,
|
|
1010
|
+
functionSelector,
|
|
1011
|
+
this.utilityExecutor,
|
|
1012
|
+
this.anchorBlockHeader,
|
|
1013
|
+
this.jobId,
|
|
1014
|
+
this.scopes,
|
|
1015
|
+
);
|
|
1016
|
+
}
|
|
1017
|
+
|
|
1018
|
+
this.logger.debug(
|
|
1019
|
+
`Calling nested utility function ${targetContractAddress}:${functionSelector} from ${this.contractAddress}`,
|
|
1020
|
+
);
|
|
1021
|
+
|
|
1022
|
+
const nestedOracle = new UtilityExecutionOracle({
|
|
1023
|
+
callContext: CallContext.from({
|
|
1024
|
+
msgSender: this.contractAddress,
|
|
1025
|
+
contractAddress: targetContractAddress,
|
|
1026
|
+
functionSelector,
|
|
1027
|
+
isStaticCall: true,
|
|
1028
|
+
}),
|
|
1029
|
+
authWitnesses: this.authWitnesses,
|
|
1030
|
+
capsules: this.capsules,
|
|
1031
|
+
anchorBlockHeader: this.anchorBlockHeader,
|
|
1032
|
+
anchoredContractData: this.anchoredContractData,
|
|
1033
|
+
noteStore: this.noteStore,
|
|
1034
|
+
keyStore: this.keyStore,
|
|
1035
|
+
addressStore: this.addressStore,
|
|
1036
|
+
aztecNode: this.aztecNode,
|
|
1037
|
+
recipientTaggingStore: this.recipientTaggingStore,
|
|
1038
|
+
taggingSecretSourcesStore: this.taggingSecretSourcesStore,
|
|
1039
|
+
capsuleService: this.capsuleService,
|
|
1040
|
+
factService: this.factService,
|
|
1041
|
+
privateEventStore: this.privateEventStore,
|
|
1042
|
+
txResolver: this.txResolver,
|
|
1043
|
+
contractSyncService: this.contractSyncService,
|
|
1044
|
+
l2TipsStore: this.l2TipsStore,
|
|
1045
|
+
jobId: this.jobId,
|
|
1046
|
+
scopes: this.scopes,
|
|
1047
|
+
simulator: this.simulator,
|
|
1048
|
+
hooks: this.hooks,
|
|
1049
|
+
utilityExecutor: this.utilityExecutor,
|
|
1050
|
+
log: this.logger,
|
|
1051
|
+
// Shared across the whole execution tree: nested utility frames inherit the caller's transient-array store.
|
|
1052
|
+
transientArrayService: this.transientArrayService,
|
|
1053
|
+
});
|
|
1054
|
+
|
|
1055
|
+
const initialWitness = toACVMWitness(0, args);
|
|
1056
|
+
const acirExecutionResult = await this.simulator
|
|
1057
|
+
.executeUserCircuit(initialWitness, targetArtifact, buildACIRCallback(nestedOracle))
|
|
1058
|
+
.catch((err: Error) => {
|
|
1059
|
+
err.message = resolveAssertionMessageFromError(err, targetArtifact);
|
|
1060
|
+
throw new ExecutionError(
|
|
1061
|
+
err.message,
|
|
1062
|
+
{ contractAddress: targetContractAddress, functionSelector },
|
|
1063
|
+
extractCallStack(err, targetArtifact.debug),
|
|
1064
|
+
{ cause: err },
|
|
1065
|
+
);
|
|
1066
|
+
});
|
|
1067
|
+
|
|
1068
|
+
return witnessMapToFields(acirExecutionResult.returnWitness);
|
|
1069
|
+
}
|
|
1070
|
+
|
|
1071
|
+
/** Returns offchain effects collected during execution. */
|
|
1072
|
+
public getOffchainEffects(): OffchainEffect[] {
|
|
1073
|
+
return this.offchainEffects;
|
|
1074
|
+
}
|
|
1075
|
+
|
|
1076
|
+
/**
|
|
1077
|
+
* Fetches tx effects for the given hashes in parallel, deduplicating repeated hashes so each tx is only requested
|
|
1078
|
+
* once. Returns a map keyed by `TxHash.toString()`; hashes for which the node has no tx effect are omitted.
|
|
1079
|
+
*/
|
|
1080
|
+
async #fetchTxEffects(txHashes: TxHash[]): Promise<Map<string, IndexedTxEffect>> {
|
|
1081
|
+
const uniqueTxHashes = uniqueBy(txHashes, h => h.toString());
|
|
1082
|
+
const fetched = await Promise.all(
|
|
1083
|
+
uniqueTxHashes.map(h => this.aztecNode.getTxReceipt(h, { includeTxEffect: true })),
|
|
1084
|
+
);
|
|
1085
|
+
return new Map(
|
|
1086
|
+
uniqueTxHashes
|
|
1087
|
+
.map((h, i): [string, IndexedTxEffect | undefined] => {
|
|
1088
|
+
const receipt = fetched[i];
|
|
1089
|
+
if (!receipt.isMined() || !receipt.txEffect) {
|
|
1090
|
+
return [h.toString(), undefined];
|
|
1091
|
+
}
|
|
1092
|
+
return [
|
|
1093
|
+
h.toString(),
|
|
1094
|
+
{
|
|
1095
|
+
data: receipt.txEffect,
|
|
1096
|
+
l2BlockNumber: receipt.blockNumber,
|
|
1097
|
+
l2BlockHash: receipt.blockHash,
|
|
1098
|
+
txIndexInBlock: receipt.txIndexInBlock,
|
|
1099
|
+
slotNumber: receipt.slotNumber,
|
|
1100
|
+
},
|
|
1101
|
+
];
|
|
1102
|
+
})
|
|
1103
|
+
.filter((entry): entry is [string, IndexedTxEffect] => entry[1] !== undefined),
|
|
1104
|
+
);
|
|
1105
|
+
}
|
|
1106
|
+
|
|
1107
|
+
/** Runs a query concurrently with a validation that the block hash is not ahead of the anchor block. */
|
|
1108
|
+
async #queryWithBlockHashNotAfterAnchor<T>(blockHash: BlockHash, query: () => Promise<T>): Promise<T> {
|
|
1109
|
+
// Most contracts query state at the "current" block, which is the anchor. Skip the validation when we can.
|
|
1110
|
+
const anchorHash = await this.anchorBlockHeader.hash();
|
|
1111
|
+
if (blockHash.equals(anchorHash)) {
|
|
1112
|
+
return query();
|
|
1113
|
+
}
|
|
1114
|
+
|
|
1115
|
+
const [response] = await Promise.all([
|
|
1116
|
+
query(),
|
|
1117
|
+
(async () => {
|
|
1118
|
+
const block = await this.aztecNode.getBlock(blockHash);
|
|
1119
|
+
const header = block?.header;
|
|
1120
|
+
if (!header) {
|
|
1121
|
+
throw new Error(`Could not find block header for block hash ${blockHash}`);
|
|
1122
|
+
}
|
|
1123
|
+
|
|
1124
|
+
if (header.getBlockNumber() > this.anchorBlockHeader.getBlockNumber()) {
|
|
1125
|
+
throw new Error(
|
|
1126
|
+
`Made a node query with a reference block hash ${blockHash} with block number ${header.getBlockNumber()}, which is ahead of the anchor block number ${this.anchorBlockHeader.getBlockNumber()} (from anchor block hash ${anchorHash}).`,
|
|
1127
|
+
);
|
|
1128
|
+
}
|
|
1129
|
+
})(),
|
|
1130
|
+
]);
|
|
1131
|
+
return response;
|
|
1132
|
+
}
|
|
1133
|
+
|
|
1134
|
+
/** The execution context of the current call. */
|
|
1135
|
+
protected get callerContext(): 'private' | 'private view' | 'utility' {
|
|
1136
|
+
return 'utility';
|
|
1137
|
+
}
|
|
1138
|
+
|
|
1139
|
+
/** The address of the contract whose function is being executed, from the call context. */
|
|
1140
|
+
protected get contractAddress(): AztecAddress {
|
|
1141
|
+
return this.callContext.contractAddress;
|
|
1142
|
+
}
|
|
1143
|
+
}
|
|
1144
|
+
|
|
1145
|
+
// Registry reads that any contract may issue without an `authorizeUtilityCall` hook. The constrained-delivery
|
|
1146
|
+
// library calls these implicitly for the app, and they are safe to default-authorize: `get_app_siloed_secrets`
|
|
1147
|
+
// siloes every returned secret to `msg_sender`, and `get_non_interactive_handshakes` only exposes ephemeral public
|
|
1148
|
+
// keys, from which the shared secret cannot be derived without the recipient's secret keys.
|
|
1149
|
+
const STANDARD_HANDSHAKE_REGISTRY_DEFAULT_AUTHORIZED_READ_SIGNATURES = [
|
|
1150
|
+
'get_non_interactive_handshakes((Field),u32)',
|
|
1151
|
+
'get_app_siloed_secrets((Field),(Field))',
|
|
1152
|
+
];
|
|
1153
|
+
|
|
1154
|
+
async function doesSelectorHaveSignature(functionSelector: FunctionSelector, signature: string): Promise<boolean> {
|
|
1155
|
+
return functionSelector.equals(await FunctionSelector.fromSignature(signature));
|
|
1156
|
+
}
|
|
1157
|
+
|
|
1158
|
+
/**
|
|
1159
|
+
* Whether a cross-contract utility call targets one of the standard handshake registry's read functions.
|
|
1160
|
+
*
|
|
1161
|
+
* These reads are authorized by PXE for every wallet, without consulting the `authorizeUtilityCall` hook, so that
|
|
1162
|
+
* wallets don't need to know the handshake registry exists in order to deliver and discover messages through it.
|
|
1163
|
+
*/
|
|
1164
|
+
async function isStandardHandshakeRegistryUtilityRead(
|
|
1165
|
+
targetContractAddress: AztecAddress,
|
|
1166
|
+
functionSelector: FunctionSelector,
|
|
1167
|
+
): Promise<boolean> {
|
|
1168
|
+
if (!targetContractAddress.equals(STANDARD_HANDSHAKE_REGISTRY_ADDRESS)) {
|
|
1169
|
+
return false;
|
|
1170
|
+
}
|
|
1171
|
+
|
|
1172
|
+
const matches = await Promise.all(
|
|
1173
|
+
STANDARD_HANDSHAKE_REGISTRY_DEFAULT_AUTHORIZED_READ_SIGNATURES.map(signature =>
|
|
1174
|
+
doesSelectorHaveSignature(functionSelector, signature),
|
|
1175
|
+
),
|
|
1176
|
+
);
|
|
1177
|
+
return matches.some(Boolean);
|
|
358
1178
|
}
|