@aztec/pxe 0.0.1-commit.993d240 → 0.0.1-commit.9a89641
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dest/bin/check_oracle_version.d.ts +2 -12
- package/dest/bin/check_oracle_version.d.ts.map +1 -1
- package/dest/bin/check_oracle_version.js +9 -122
- package/dest/bin/index.d.ts +2 -2
- package/dest/bin/index.d.ts.map +1 -1
- package/dest/bin/index.js +1 -1
- package/dest/bin/oracle_version_helpers.d.ts +20 -0
- package/dest/bin/oracle_version_helpers.d.ts.map +1 -0
- package/dest/bin/oracle_version_helpers.js +25 -0
- package/dest/block_synchronizer/block_stream_source.d.ts +5 -5
- package/dest/block_synchronizer/block_stream_source.d.ts.map +1 -1
- package/dest/block_synchronizer/block_stream_source.js +4 -29
- package/dest/block_synchronizer/block_synchronizer.d.ts +17 -15
- package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -1
- package/dest/block_synchronizer/block_synchronizer.js +41 -18
- package/dest/config/index.d.ts +2 -1
- package/dest/config/index.d.ts.map +1 -1
- package/dest/config/index.js +1 -0
- package/dest/config/package_info.js +1 -1
- package/dest/contract/contract_class_service.d.ts +24 -0
- package/dest/contract/contract_class_service.d.ts.map +1 -0
- package/dest/contract/contract_class_service.js +36 -0
- package/dest/contract/contract_sync_service.d.ts +48 -0
- package/dest/contract/contract_sync_service.d.ts.map +1 -0
- package/dest/{contract_sync → contract}/contract_sync_service.js +26 -45
- package/dest/contract/helpers.d.ts +7 -0
- package/dest/contract/helpers.d.ts.map +1 -0
- package/dest/contract/helpers.js +20 -0
- package/dest/contract/skip_sync_contracts.d.ts +11 -0
- package/dest/contract/skip_sync_contracts.d.ts.map +1 -0
- package/dest/contract/skip_sync_contracts.js +18 -0
- package/dest/contract_function_simulator/anchored_contract_data.d.ts +36 -0
- package/dest/contract_function_simulator/anchored_contract_data.d.ts.map +1 -0
- package/dest/contract_function_simulator/anchored_contract_data.js +54 -0
- package/dest/contract_function_simulator/contract_function_simulator.d.ts +19 -25
- package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.js +63 -49
- package/dest/contract_function_simulator/execution_note_cache.d.ts +4 -10
- package/dest/contract_function_simulator/execution_note_cache.d.ts.map +1 -1
- package/dest/contract_function_simulator/execution_note_cache.js +8 -28
- package/dest/contract_function_simulator/index.d.ts +24 -6
- package/dest/contract_function_simulator/index.d.ts.map +1 -1
- package/dest/contract_function_simulator/index.js +9 -4
- package/dest/contract_function_simulator/noir-structs/bounded_vec.d.ts +8 -27
- package/dest/contract_function_simulator/noir-structs/bounded_vec.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/bounded_vec.js +8 -23
- package/dest/contract_function_simulator/noir-structs/contract_class_log_data.d.ts +9 -0
- package/dest/contract_function_simulator/noir-structs/contract_class_log_data.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/contract_class_log_data.js +1 -0
- package/dest/contract_function_simulator/noir-structs/embedded_curve_point.d.ts +7 -0
- package/dest/contract_function_simulator/noir-structs/embedded_curve_point.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/embedded_curve_point.js +1 -0
- package/dest/contract_function_simulator/noir-structs/ephemeral_array.d.ts +37 -0
- package/dest/contract_function_simulator/noir-structs/ephemeral_array.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/ephemeral_array.js +59 -0
- package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts +3 -2
- package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/event_validation_request.js +2 -2
- package/dest/contract_function_simulator/noir-structs/fact.d.ts +16 -0
- package/dest/contract_function_simulator/noir-structs/fact.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/fact.js +6 -0
- package/dest/contract_function_simulator/noir-structs/fact_collection.d.ts +27 -0
- package/dest/contract_function_simulator/noir-structs/fact_collection.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/fact_collection.js +31 -0
- package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts +11 -12
- package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/log_retrieval_request.js +6 -49
- package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts +10 -8
- package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/log_retrieval_response.js +1 -60
- package/dest/contract_function_simulator/noir-structs/note_data.d.ts +27 -0
- package/dest/contract_function_simulator/noir-structs/note_data.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/note_data.js +3 -0
- package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +3 -2
- package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/note_validation_request.js +3 -3
- package/dest/contract_function_simulator/noir-structs/option.d.ts +9 -11
- package/dest/contract_function_simulator/noir-structs/option.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/option.js +18 -13
- package/dest/contract_function_simulator/noir-structs/origin_block.d.ts +11 -0
- package/dest/contract_function_simulator/noir-structs/origin_block.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/origin_block.js +5 -0
- package/dest/contract_function_simulator/noir-structs/pending_tagged_log.d.ts +11 -0
- package/dest/contract_function_simulator/noir-structs/pending_tagged_log.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/pending_tagged_log.js +4 -0
- package/dest/contract_function_simulator/noir-structs/provided_secret.d.ts +8 -0
- package/dest/contract_function_simulator/noir-structs/provided_secret.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/provided_secret.js +1 -0
- package/dest/contract_function_simulator/noir-structs/resolved_tagging_strategy.d.ts +28 -0
- package/dest/contract_function_simulator/noir-structs/resolved_tagging_strategy.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/resolved_tagging_strategy.js +50 -0
- package/dest/contract_function_simulator/noir-structs/resolved_tx.d.ts +19 -0
- package/dest/contract_function_simulator/noir-structs/resolved_tx.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/resolved_tx.js +9 -0
- package/dest/contract_function_simulator/noir-structs/tx_effect_data.d.ts +15 -0
- package/dest/contract_function_simulator/noir-structs/tx_effect_data.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/tx_effect_data.js +5 -0
- package/dest/contract_function_simulator/noir-structs/utility_context.d.ts +6 -11
- package/dest/contract_function_simulator/noir-structs/utility_context.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/utility_context.js +1 -20
- package/dest/contract_function_simulator/oracle/acir_callback.d.ts +21 -0
- package/dest/contract_function_simulator/oracle/acir_callback.d.ts.map +1 -0
- package/dest/contract_function_simulator/oracle/acir_callback.js +115 -0
- package/dest/contract_function_simulator/oracle/index.d.ts +2 -13
- package/dest/contract_function_simulator/oracle/index.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/index.js +1 -1
- package/dest/contract_function_simulator/oracle/interfaces.d.ts +15 -114
- package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/interfaces.js +2 -2
- package/dest/contract_function_simulator/oracle/legacy_oracle_registry.d.ts +39 -0
- package/dest/contract_function_simulator/oracle/legacy_oracle_registry.d.ts.map +1 -0
- package/dest/contract_function_simulator/oracle/legacy_oracle_registry.js +107 -0
- package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts +3 -14
- package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.js +1 -24
- package/dest/contract_function_simulator/oracle/oracle_registry.d.ts +92 -100
- package/dest/contract_function_simulator/oracle/oracle_registry.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/oracle_registry.js +296 -479
- package/dest/contract_function_simulator/oracle/oracle_type_mappings.d.ts +274 -0
- package/dest/contract_function_simulator/oracle/oracle_type_mappings.d.ts.map +1 -0
- package/dest/contract_function_simulator/oracle/oracle_type_mappings.js +1253 -0
- package/dest/contract_function_simulator/oracle/private_execution.d.ts +1 -1
- package/dest/contract_function_simulator/oracle/private_execution.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution.js +2 -3
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +32 -21
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.js +152 -49
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +97 -37
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +376 -138
- package/dest/contract_function_simulator/transient_array_service.d.ts +31 -0
- package/dest/contract_function_simulator/transient_array_service.d.ts.map +1 -0
- package/dest/contract_function_simulator/transient_array_service.js +62 -0
- package/dest/debug/pxe_debug_utils.d.ts +2 -2
- package/dest/debug/pxe_debug_utils.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/index.d.ts +2 -1
- package/dest/entrypoints/client/bundle/index.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/index.js +1 -0
- package/dest/entrypoints/client/bundle/utils.d.ts +1 -1
- package/dest/entrypoints/client/bundle/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/utils.js +17 -6
- package/dest/entrypoints/client/lazy/index.d.ts +2 -1
- package/dest/entrypoints/client/lazy/index.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/index.js +1 -0
- package/dest/entrypoints/client/lazy/utils.d.ts +1 -1
- package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/utils.js +17 -6
- package/dest/entrypoints/client/store.d.ts +14 -0
- package/dest/entrypoints/client/store.d.ts.map +1 -0
- package/dest/entrypoints/client/store.js +42 -0
- package/dest/entrypoints/pxe_creation_options.d.ts +9 -3
- package/dest/entrypoints/pxe_creation_options.d.ts.map +1 -1
- package/dest/entrypoints/server/index.d.ts +6 -3
- package/dest/entrypoints/server/index.d.ts.map +1 -1
- package/dest/entrypoints/server/index.js +4 -2
- package/dest/entrypoints/server/store.d.ts +18 -0
- package/dest/entrypoints/server/store.d.ts.map +1 -0
- package/dest/entrypoints/server/store.js +28 -0
- package/dest/entrypoints/server/utils.d.ts +1 -1
- package/dest/entrypoints/server/utils.d.ts.map +1 -1
- package/dest/entrypoints/server/utils.js +16 -4
- package/dest/error_enriching.d.ts +5 -3
- package/dest/error_enriching.d.ts.map +1 -1
- package/dest/error_enriching.js +13 -11
- package/dest/events/event_service.d.ts +13 -6
- package/dest/events/event_service.d.ts.map +1 -1
- package/dest/events/event_service.js +13 -13
- package/dest/hooks/execution_hooks.d.ts +31 -11
- package/dest/hooks/execution_hooks.d.ts.map +1 -1
- package/dest/hooks/execution_hooks.js +3 -3
- package/dest/hooks/index.d.ts +4 -3
- package/dest/hooks/index.d.ts.map +1 -1
- package/dest/hooks/index.js +1 -0
- package/dest/hooks/resolve_custom_request.d.ts +23 -0
- package/dest/hooks/resolve_custom_request.d.ts.map +1 -0
- package/dest/hooks/resolve_custom_request.js +3 -0
- package/dest/hooks/resolve_tagging_secret_strategy.d.ts +50 -0
- package/dest/hooks/resolve_tagging_secret_strategy.d.ts.map +1 -0
- package/dest/hooks/resolve_tagging_secret_strategy.js +3 -0
- package/dest/logs/log_service.d.ts +18 -8
- package/dest/logs/log_service.d.ts.map +1 -1
- package/dest/logs/log_service.js +93 -45
- package/dest/messages/tx_resolver_service.d.ts +28 -0
- package/dest/messages/tx_resolver_service.d.ts.map +1 -0
- package/dest/messages/tx_resolver_service.js +61 -0
- package/dest/node/benchmarked_node.d.ts +20 -0
- package/dest/node/benchmarked_node.d.ts.map +1 -0
- package/dest/node/benchmarked_node.js +94 -0
- package/dest/node/caching_aztec_node.d.ts +24 -0
- package/dest/node/caching_aztec_node.d.ts.map +1 -0
- package/dest/node/caching_aztec_node.js +267 -0
- package/dest/notes/note_service.d.ts +13 -7
- package/dest/notes/note_service.d.ts.map +1 -1
- package/dest/notes/note_service.js +10 -10
- package/dest/oracle_version.d.ts +3 -3
- package/dest/oracle_version.js +8 -8
- package/dest/private_kernel/batch_planner.d.ts +1 -1
- package/dest/private_kernel/batch_planner.d.ts.map +1 -1
- package/dest/private_kernel/batch_planner.js +1 -1
- package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts +1 -1
- package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts.map +1 -1
- package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.js +6 -2
- package/dest/private_kernel/hints/test_utils.js +1 -1
- package/dest/private_kernel/private_kernel_execution_prover.d.ts +1 -1
- package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_execution_prover.js +61 -40
- package/dest/private_kernel/private_kernel_oracle.d.ts +4 -2
- package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_oracle.js +17 -5
- package/dest/pxe.d.ts +114 -48
- package/dest/pxe.d.ts.map +1 -1
- package/dest/pxe.js +251 -148
- package/dest/storage/allowed_scopes.d.ts +6 -0
- package/dest/storage/allowed_scopes.d.ts.map +1 -0
- package/dest/storage/allowed_scopes.js +7 -0
- package/dest/storage/anchor_block_store/anchor_block_store.d.ts +9 -6
- package/dest/storage/anchor_block_store/anchor_block_store.d.ts.map +1 -1
- package/dest/storage/anchor_block_store/anchor_block_store.js +8 -6
- package/dest/storage/backwards_compatibility_tests/schema_tests.d.ts +1 -1
- package/dest/storage/backwards_compatibility_tests/schema_tests.d.ts.map +1 -1
- package/dest/storage/backwards_compatibility_tests/schema_tests.js +129 -49
- package/dest/storage/capsule_store/capsule_service.d.ts +1 -1
- package/dest/storage/capsule_store/capsule_service.d.ts.map +1 -1
- package/dest/storage/capsule_store/capsule_service.js +6 -9
- package/dest/storage/contract_store/contract_store.d.ts +27 -24
- package/dest/storage/contract_store/contract_store.d.ts.map +1 -1
- package/dest/storage/contract_store/contract_store.js +66 -77
- package/dest/storage/fact_store/fact_service.d.ts +22 -0
- package/dest/storage/fact_store/fact_service.d.ts.map +1 -0
- package/dest/storage/fact_store/fact_service.js +45 -0
- package/dest/storage/fact_store/fact_store.d.ts +95 -0
- package/dest/storage/fact_store/fact_store.d.ts.map +1 -0
- package/dest/storage/fact_store/fact_store.js +408 -0
- package/dest/storage/fact_store/fact_store_keys.d.ts +34 -0
- package/dest/storage/fact_store/fact_store_keys.d.ts.map +1 -0
- package/dest/storage/fact_store/fact_store_keys.js +50 -0
- package/dest/storage/fact_store/index.d.ts +6 -0
- package/dest/storage/fact_store/index.d.ts.map +1 -0
- package/dest/storage/fact_store/index.js +4 -0
- package/dest/storage/fact_store/origin_state.d.ts +59 -0
- package/dest/storage/fact_store/origin_state.d.ts.map +1 -0
- package/dest/storage/fact_store/origin_state.js +60 -0
- package/dest/storage/fact_store/stored_fact.d.ts +32 -0
- package/dest/storage/fact_store/stored_fact.d.ts.map +1 -0
- package/dest/storage/fact_store/stored_fact.js +64 -0
- package/dest/storage/index.d.ts +3 -2
- package/dest/storage/index.d.ts.map +1 -1
- package/dest/storage/index.js +2 -1
- package/dest/storage/metadata.d.ts +2 -2
- package/dest/storage/metadata.d.ts.map +1 -1
- package/dest/storage/metadata.js +1 -1
- package/dest/storage/note_store/note_store.d.ts +42 -33
- package/dest/storage/note_store/note_store.d.ts.map +1 -1
- package/dest/storage/note_store/note_store.js +197 -168
- package/dest/storage/note_store/stored_note.d.ts +3 -8
- package/dest/storage/note_store/stored_note.d.ts.map +1 -1
- package/dest/storage/note_store/stored_note.js +4 -20
- package/dest/storage/open_pxe_stores.d.ts +5 -3
- package/dest/storage/open_pxe_stores.d.ts.map +1 -1
- package/dest/storage/open_pxe_stores.js +5 -3
- package/dest/storage/private_event_store/private_event_store.d.ts +13 -16
- package/dest/storage/private_event_store/private_event_store.d.ts.map +1 -1
- package/dest/storage/private_event_store/private_event_store.js +40 -43
- package/dest/storage/store_identity.d.ts +35 -0
- package/dest/storage/store_identity.d.ts.map +1 -0
- package/dest/storage/store_identity.js +44 -0
- package/dest/storage/tagging_store/index.d.ts +2 -2
- package/dest/storage/tagging_store/index.d.ts.map +1 -1
- package/dest/storage/tagging_store/index.js +1 -1
- package/dest/storage/tagging_store/sender_tagging_store.d.ts +41 -10
- package/dest/storage/tagging_store/sender_tagging_store.d.ts.map +1 -1
- package/dest/storage/tagging_store/sender_tagging_store.js +81 -29
- package/dest/storage/tagging_store/tagging_secret_sources_store.d.ts +51 -0
- package/dest/storage/tagging_store/tagging_secret_sources_store.d.ts.map +1 -0
- package/dest/storage/tagging_store/tagging_secret_sources_store.js +105 -0
- package/dest/tagging/constants.d.ts +11 -2
- package/dest/tagging/constants.d.ts.map +1 -1
- package/dest/tagging/constants.js +38 -10
- package/dest/tagging/get_all_logs_by_tags.d.ts +29 -8
- package/dest/tagging/get_all_logs_by_tags.d.ts.map +1 -1
- package/dest/tagging/get_all_logs_by_tags.js +29 -10
- package/dest/tagging/index.d.ts +3 -3
- package/dest/tagging/index.d.ts.map +1 -1
- package/dest/tagging/index.js +2 -2
- package/dest/tagging/recipient_sync/sync_tagged_private_logs.d.ts +27 -9
- package/dest/tagging/recipient_sync/sync_tagged_private_logs.d.ts.map +1 -1
- package/dest/tagging/recipient_sync/sync_tagged_private_logs.js +104 -33
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts +6 -3
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts.map +1 -1
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.js +23 -36
- package/dest/tagging/sender_sync/utils/classify_pending_txs.d.ts +22 -0
- package/dest/tagging/sender_sync/utils/classify_pending_txs.d.ts.map +1 -0
- package/dest/tagging/sender_sync/utils/classify_pending_txs.js +61 -0
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts +15 -5
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts.map +1 -1
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.js +36 -35
- package/dest/tagging/sender_sync/utils/resolve_pending_txs.d.ts +29 -0
- package/dest/tagging/sender_sync/utils/resolve_pending_txs.d.ts.map +1 -0
- package/dest/tagging/sender_sync/utils/resolve_pending_txs.js +41 -0
- package/dest/tagging/sender_sync/utils/test_utils.d.ts +16 -0
- package/dest/tagging/sender_sync/utils/test_utils.d.ts.map +1 -0
- package/dest/tagging/sender_sync/utils/test_utils.js +24 -0
- package/dest/tagging/testing/tag_query_test_utils.d.ts +6 -0
- package/dest/tagging/testing/tag_query_test_utils.d.ts.map +1 -0
- package/dest/tagging/testing/tag_query_test_utils.js +10 -0
- package/package.json +17 -17
- package/src/bin/check_oracle_version.ts +8 -151
- package/src/bin/index.ts +1 -1
- package/src/bin/oracle_version_helpers.ts +30 -0
- package/src/block_synchronizer/block_stream_source.ts +6 -45
- package/src/block_synchronizer/block_synchronizer.ts +54 -30
- package/src/config/index.ts +1 -0
- package/src/config/package_info.ts +1 -1
- package/src/contract/contract_class_service.ts +45 -0
- package/src/{contract_sync → contract}/contract_sync_service.ts +37 -50
- package/src/contract/helpers.ts +35 -0
- package/src/contract/skip_sync_contracts.ts +23 -0
- package/src/contract_function_simulator/anchored_contract_data.ts +74 -0
- package/src/contract_function_simulator/contract_function_simulator.ts +96 -59
- package/src/contract_function_simulator/execution_note_cache.ts +8 -29
- package/src/contract_function_simulator/index.ts +87 -5
- package/src/contract_function_simulator/noir-structs/bounded_vec.ts +12 -24
- package/src/contract_function_simulator/noir-structs/contract_class_log_data.ts +9 -0
- package/src/contract_function_simulator/noir-structs/embedded_curve_point.ts +4 -0
- package/src/contract_function_simulator/noir-structs/ephemeral_array.ts +66 -0
- package/src/contract_function_simulator/noir-structs/event_validation_request.ts +3 -3
- package/src/contract_function_simulator/noir-structs/fact.ts +13 -0
- package/src/contract_function_simulator/noir-structs/fact_collection.ts +64 -0
- package/src/contract_function_simulator/noir-structs/log_retrieval_request.ts +20 -46
- package/src/contract_function_simulator/noir-structs/log_retrieval_response.ts +13 -60
- package/src/contract_function_simulator/noir-structs/note_data.ts +27 -0
- package/src/contract_function_simulator/noir-structs/note_validation_request.ts +4 -4
- package/src/contract_function_simulator/noir-structs/option.ts +17 -11
- package/src/contract_function_simulator/noir-structs/origin_block.ts +8 -0
- package/src/contract_function_simulator/noir-structs/pending_tagged_log.ts +12 -0
- package/src/contract_function_simulator/noir-structs/provided_secret.ts +5 -0
- package/src/contract_function_simulator/noir-structs/resolved_tagging_strategy.ts +66 -0
- package/src/contract_function_simulator/noir-structs/resolved_tx.ts +19 -0
- package/src/contract_function_simulator/noir-structs/tx_effect_data.ts +16 -0
- package/src/contract_function_simulator/noir-structs/utility_context.ts +5 -17
- package/src/contract_function_simulator/oracle/acir_callback.ts +154 -0
- package/src/contract_function_simulator/oracle/index.ts +1 -15
- package/src/contract_function_simulator/oracle/interfaces.ts +11 -189
- package/src/contract_function_simulator/oracle/legacy_oracle_registry.ts +147 -0
- package/src/contract_function_simulator/oracle/message_load_oracle_inputs.ts +6 -21
- package/src/contract_function_simulator/oracle/oracle_registry.ts +289 -483
- package/src/contract_function_simulator/oracle/oracle_type_mappings.ts +1067 -0
- package/src/contract_function_simulator/oracle/private_execution.ts +2 -3
- package/src/contract_function_simulator/oracle/private_execution_oracle.ts +190 -61
- package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +556 -174
- package/src/contract_function_simulator/transient_array_service.ts +91 -0
- package/src/debug/pxe_debug_utils.ts +1 -1
- package/src/entrypoints/client/bundle/index.ts +1 -0
- package/src/entrypoints/client/bundle/utils.ts +24 -5
- package/src/entrypoints/client/lazy/index.ts +1 -0
- package/src/entrypoints/client/lazy/utils.ts +24 -5
- package/src/entrypoints/client/store.ts +54 -0
- package/src/entrypoints/pxe_creation_options.ts +8 -2
- package/src/entrypoints/server/index.ts +6 -2
- package/src/entrypoints/server/store.ts +47 -0
- package/src/entrypoints/server/utils.ts +31 -9
- package/src/error_enriching.ts +27 -11
- package/src/events/event_service.ts +24 -14
- package/src/hooks/execution_hooks.ts +32 -12
- package/src/hooks/index.ts +8 -2
- package/src/hooks/resolve_custom_request.ts +24 -0
- package/src/hooks/resolve_tagging_secret_strategy.ts +60 -0
- package/src/logs/log_service.ts +122 -61
- package/src/messages/tx_resolver_service.ts +80 -0
- package/src/node/benchmarked_node.ts +140 -0
- package/src/node/caching_aztec_node.ts +406 -0
- package/src/notes/note_service.ts +20 -14
- package/src/oracle_version.ts +8 -8
- package/src/private_kernel/batch_planner.ts +0 -1
- package/src/private_kernel/hints/private_kernel_reset_private_inputs_builder.ts +11 -1
- package/src/private_kernel/hints/test_utils.ts +1 -1
- package/src/private_kernel/private_kernel_execution_prover.ts +112 -56
- package/src/private_kernel/private_kernel_oracle.ts +23 -4
- package/src/pxe.ts +357 -172
- package/src/storage/allowed_scopes.ts +14 -0
- package/src/storage/anchor_block_store/anchor_block_store.ts +8 -6
- package/src/storage/backwards_compatibility_tests/__snapshots__/AddressStore.json +6 -6
- package/src/storage/backwards_compatibility_tests/__snapshots__/ContractStore.json +1 -1
- package/src/storage/backwards_compatibility_tests/__snapshots__/FactStore.json +40 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/KeyStore.json +12 -12
- package/src/storage/backwards_compatibility_tests/__snapshots__/L2TipsKVStore.json +9 -15
- package/src/storage/backwards_compatibility_tests/__snapshots__/NoteStore.json +24 -4
- package/src/storage/backwards_compatibility_tests/__snapshots__/RecipientTaggingStore.json +11 -3
- package/src/storage/backwards_compatibility_tests/__snapshots__/SenderTaggingStore.json +12 -4
- package/src/storage/backwards_compatibility_tests/__snapshots__/TaggingSecretSourcesStore.json +30 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/opened_stores.json +29 -9
- package/src/storage/backwards_compatibility_tests/schema_tests.ts +141 -50
- package/src/storage/capsule_store/capsule_service.ts +8 -13
- package/src/storage/contract_store/contract_store.ts +88 -94
- package/src/storage/fact_store/fact_service.ts +69 -0
- package/src/storage/fact_store/fact_store.ts +487 -0
- package/src/storage/fact_store/fact_store_keys.ts +75 -0
- package/src/storage/fact_store/index.ts +15 -0
- package/src/storage/fact_store/origin_state.ts +84 -0
- package/src/storage/fact_store/stored_fact.ts +80 -0
- package/src/storage/index.ts +2 -1
- package/src/storage/metadata.ts +1 -1
- package/src/storage/note_store/note_store.ts +226 -187
- package/src/storage/note_store/stored_note.ts +5 -27
- package/src/storage/open_pxe_stores.ts +6 -3
- package/src/storage/private_event_store/private_event_store.ts +49 -55
- package/src/storage/store_identity.ts +72 -0
- package/src/storage/tagging_store/index.ts +1 -1
- package/src/storage/tagging_store/sender_tagging_store.ts +113 -41
- package/src/storage/tagging_store/tagging_secret_sources_store.ts +138 -0
- package/src/tagging/constants.ts +42 -10
- package/src/tagging/get_all_logs_by_tags.ts +47 -11
- package/src/tagging/index.ts +7 -2
- package/src/tagging/recipient_sync/sync_tagged_private_logs.ts +161 -46
- package/src/tagging/sender_sync/sync_sender_tagging_indexes.ts +27 -57
- package/src/tagging/sender_sync/utils/classify_pending_txs.ts +91 -0
- package/src/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.ts +46 -40
- package/src/tagging/sender_sync/utils/resolve_pending_txs.ts +64 -0
- package/src/tagging/sender_sync/utils/test_utils.ts +46 -0
- package/src/tagging/testing/tag_query_test_utils.ts +11 -0
- package/dest/contract_function_simulator/benchmarked_node.d.ts +0 -9
- package/dest/contract_function_simulator/benchmarked_node.d.ts.map +0 -1
- package/dest/contract_function_simulator/benchmarked_node.js +0 -77
- package/dest/contract_function_simulator/oracle/oracle.d.ts +0 -89
- package/dest/contract_function_simulator/oracle/oracle.d.ts.map +0 -1
- package/dest/contract_function_simulator/oracle/oracle.js +0 -552
- package/dest/contract_function_simulator/proxied_contract_data_source.d.ts +0 -6
- package/dest/contract_function_simulator/proxied_contract_data_source.d.ts.map +0 -1
- package/dest/contract_function_simulator/proxied_contract_data_source.js +0 -51
- package/dest/contract_sync/contract_sync_service.d.ts +0 -42
- package/dest/contract_sync/contract_sync_service.d.ts.map +0 -1
- package/dest/contract_sync/helpers.d.ts +0 -27
- package/dest/contract_sync/helpers.d.ts.map +0 -1
- package/dest/contract_sync/helpers.js +0 -53
- package/dest/messages/message_context_service.d.ts +0 -17
- package/dest/messages/message_context_service.d.ts.map +0 -1
- package/dest/messages/message_context_service.js +0 -38
- package/dest/storage/tagging_store/sender_address_book_store.d.ts +0 -14
- package/dest/storage/tagging_store/sender_address_book_store.d.ts.map +0 -1
- package/dest/storage/tagging_store/sender_address_book_store.js +0 -36
- package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts +0 -17
- package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts.map +0 -1
- package/dest/tagging/sender_sync/utils/get_status_change_of_pending.js +0 -60
- package/src/contract_function_simulator/benchmarked_node.ts +0 -103
- package/src/contract_function_simulator/oracle/oracle.ts +0 -711
- package/src/contract_function_simulator/proxied_contract_data_source.ts +0 -60
- package/src/contract_sync/helpers.ts +0 -86
- package/src/messages/message_context_service.ts +0 -45
- package/src/storage/backwards_compatibility_tests/__snapshots__/SenderAddressBookStore.json +0 -16
- package/src/storage/tagging_store/sender_address_book_store.ts +0 -48
- package/src/tagging/sender_sync/utils/get_status_change_of_pending.ts +0 -66
|
@@ -6,7 +6,6 @@ import type { MembershipWitness } from '@aztec/foundation/trees';
|
|
|
6
6
|
import type { AztecAsyncKVStore, AztecAsyncMap } from '@aztec/kv-store';
|
|
7
7
|
import {
|
|
8
8
|
type ContractArtifact,
|
|
9
|
-
type FunctionAbi,
|
|
10
9
|
type FunctionArtifactWithContractName,
|
|
11
10
|
FunctionCall,
|
|
12
11
|
type FunctionDebugMetadata,
|
|
@@ -18,13 +17,14 @@ import {
|
|
|
18
17
|
findFunctionAbiBySelector,
|
|
19
18
|
findFunctionArtifactBySelector,
|
|
20
19
|
getFunctionDebugMetadata,
|
|
20
|
+
getFunctionReturnType,
|
|
21
21
|
} from '@aztec/stdlib/abi';
|
|
22
22
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
23
23
|
import {
|
|
24
24
|
type ContractClassIdPreimage,
|
|
25
25
|
type ContractClassWithId,
|
|
26
|
-
type
|
|
27
|
-
|
|
26
|
+
type ContractInstancePreimageWithAddress,
|
|
27
|
+
SerializableContractInstancePreimage,
|
|
28
28
|
getContractClassFromArtifact,
|
|
29
29
|
} from '@aztec/stdlib/contract';
|
|
30
30
|
|
|
@@ -112,9 +112,6 @@ export class ContractStore {
|
|
|
112
112
|
// TODO: Update it to be LRU cache so that it doesn't keep all the data all the time.
|
|
113
113
|
#contractArtifactCache: Map<string, ContractArtifact> = new Map();
|
|
114
114
|
|
|
115
|
-
/** Map from contract address to contract class id (avoids KV round-trip on hot path). */
|
|
116
|
-
#contractClassIdMap: Map<string, Fr> = new Map();
|
|
117
|
-
|
|
118
115
|
#store: AztecAsyncKVStore;
|
|
119
116
|
#contractArtifacts: AztecAsyncMap<string, Buffer>;
|
|
120
117
|
#contractClassData: AztecAsyncMap<string, Buffer>;
|
|
@@ -131,9 +128,10 @@ export class ContractStore {
|
|
|
131
128
|
|
|
132
129
|
/**
|
|
133
130
|
* Registers a new contract artifact and its corresponding class data.
|
|
134
|
-
*
|
|
135
|
-
*
|
|
136
|
-
*
|
|
131
|
+
*
|
|
132
|
+
* IMPORTANT: This method does not verify that the provided artifact matches the class data or that the class id
|
|
133
|
+
* matches the artifact. It is the caller's responsibility to ensure the consistency and correctness of the provided
|
|
134
|
+
* data. This is done to avoid redundant, expensive contract class computations.
|
|
137
135
|
*/
|
|
138
136
|
public async addContractArtifact(
|
|
139
137
|
contract: ContractArtifact,
|
|
@@ -168,31 +166,17 @@ export class ContractStore {
|
|
|
168
166
|
return contractClass.id;
|
|
169
167
|
}
|
|
170
168
|
|
|
171
|
-
async addContractInstance(contract:
|
|
169
|
+
async addContractInstance(contract: ContractInstancePreimageWithAddress): Promise<void> {
|
|
172
170
|
await this.#store.transactionAsync(async () => {
|
|
173
171
|
await this.#contractInstances.set(
|
|
174
172
|
contract.address.toString(),
|
|
175
|
-
new
|
|
173
|
+
new SerializableContractInstancePreimage(contract).toBuffer(),
|
|
176
174
|
);
|
|
177
175
|
});
|
|
178
|
-
|
|
179
|
-
this.#contractClassIdMap.set(contract.address.toString(), contract.currentContractClassId);
|
|
180
176
|
}
|
|
181
177
|
|
|
182
178
|
// Private getters
|
|
183
179
|
|
|
184
|
-
async #getContractClassId(contractAddress: AztecAddress): Promise<Fr | undefined> {
|
|
185
|
-
const key = contractAddress.toString();
|
|
186
|
-
if (!this.#contractClassIdMap.has(key)) {
|
|
187
|
-
const instance = await this.getContractInstance(contractAddress);
|
|
188
|
-
if (!instance) {
|
|
189
|
-
return;
|
|
190
|
-
}
|
|
191
|
-
this.#contractClassIdMap.set(key, instance.currentContractClassId);
|
|
192
|
-
}
|
|
193
|
-
return this.#contractClassIdMap.get(key);
|
|
194
|
-
}
|
|
195
|
-
|
|
196
180
|
async #getPrivateFunctionTreeForClassId(classId: Fr): Promise<PrivateFunctionsTree | undefined> {
|
|
197
181
|
if (!this.#privateFunctionTrees.has(classId.toString())) {
|
|
198
182
|
const artifact = await this.getContractArtifact(classId);
|
|
@@ -205,25 +189,20 @@ export class ContractStore {
|
|
|
205
189
|
return this.#privateFunctionTrees.get(classId.toString())!;
|
|
206
190
|
}
|
|
207
191
|
|
|
208
|
-
async #getArtifactByAddress(contractAddress: AztecAddress): Promise<ContractArtifact | undefined> {
|
|
209
|
-
const classId = await this.#getContractClassId(contractAddress);
|
|
210
|
-
return classId && this.getContractArtifact(classId);
|
|
211
|
-
}
|
|
212
|
-
|
|
213
192
|
// Public getters
|
|
214
193
|
|
|
215
194
|
getContractsAddresses(): Promise<AztecAddress[]> {
|
|
216
195
|
return this.#store.transactionAsync(async () => {
|
|
217
196
|
const keys = await toArray(this.#contractInstances.keysAsync());
|
|
218
|
-
return keys.map(AztecAddress.
|
|
197
|
+
return keys.map(AztecAddress.fromStringUnsafe);
|
|
219
198
|
});
|
|
220
199
|
}
|
|
221
200
|
|
|
222
|
-
/** Returns
|
|
223
|
-
public getContractInstance(contractAddress: AztecAddress): Promise<
|
|
201
|
+
/** Returns the address preimage of a given address. */
|
|
202
|
+
public getContractInstance(contractAddress: AztecAddress): Promise<ContractInstancePreimageWithAddress | undefined> {
|
|
224
203
|
return this.#store.transactionAsync(async () => {
|
|
225
204
|
const contract = await this.#contractInstances.getAsync(contractAddress.toString());
|
|
226
|
-
return contract &&
|
|
205
|
+
return contract && SerializableContractInstancePreimage.fromBuffer(contract).withAddress(contractAddress);
|
|
227
206
|
});
|
|
228
207
|
}
|
|
229
208
|
|
|
@@ -262,82 +241,69 @@ export class ContractStore {
|
|
|
262
241
|
return { ...classData, packedBytecode };
|
|
263
242
|
}
|
|
264
243
|
|
|
265
|
-
public async getContract(
|
|
266
|
-
address: AztecAddress,
|
|
267
|
-
): Promise<(ContractInstanceWithAddress & ContractArtifact) | undefined> {
|
|
268
|
-
const instance = await this.getContractInstance(address);
|
|
269
|
-
if (!instance) {
|
|
270
|
-
return;
|
|
271
|
-
}
|
|
272
|
-
const artifact = await this.getContractArtifact(instance.currentContractClassId);
|
|
273
|
-
if (!artifact) {
|
|
274
|
-
return;
|
|
275
|
-
}
|
|
276
|
-
return { ...instance, ...artifact };
|
|
277
|
-
}
|
|
278
|
-
|
|
279
244
|
/**
|
|
280
|
-
* Retrieves the artifact of a specified function within a given contract.
|
|
245
|
+
* Retrieves the artifact of a specified function within a given contract class.
|
|
281
246
|
*
|
|
282
|
-
* @param
|
|
247
|
+
* @param contractClassId - The id of the contract class containing the function.
|
|
283
248
|
* @param selector - The function selector.
|
|
284
|
-
* @returns The corresponding function's artifact as an object.
|
|
249
|
+
* @returns The corresponding function's artifact as an object, or `undefined` if the class is not registered.
|
|
285
250
|
*/
|
|
286
251
|
public async getFunctionArtifact(
|
|
287
|
-
|
|
252
|
+
contractClassId: Fr,
|
|
288
253
|
selector: FunctionSelector,
|
|
289
254
|
): Promise<FunctionArtifactWithContractName | undefined> {
|
|
290
|
-
const artifact = await this
|
|
255
|
+
const artifact = await this.getContractArtifact(contractClassId);
|
|
291
256
|
if (!artifact) {
|
|
292
257
|
return undefined;
|
|
293
258
|
}
|
|
294
|
-
const fn = await findFunctionArtifactBySelector(artifact, selector)
|
|
295
|
-
|
|
259
|
+
const fn = assertSelectorInArtifact(artifact, await findFunctionArtifactBySelector(artifact, selector), {
|
|
260
|
+
contractClassId,
|
|
261
|
+
selector,
|
|
262
|
+
});
|
|
263
|
+
return { ...fn, contractName: artifact.name };
|
|
296
264
|
}
|
|
297
265
|
|
|
266
|
+
/**
|
|
267
|
+
* Same as {@link getFunctionArtifact} but with debug metadata attached. Returns `undefined` when the class artifact
|
|
268
|
+
* is not registered.
|
|
269
|
+
*/
|
|
298
270
|
public async getFunctionArtifactWithDebugMetadata(
|
|
299
|
-
|
|
271
|
+
contractClassId: Fr,
|
|
300
272
|
selector: FunctionSelector,
|
|
301
|
-
): Promise<FunctionArtifactWithContractName> {
|
|
302
|
-
const artifact = await this.
|
|
273
|
+
): Promise<FunctionArtifactWithContractName | undefined> {
|
|
274
|
+
const artifact = await this.getContractArtifact(contractClassId);
|
|
303
275
|
if (!artifact) {
|
|
304
|
-
|
|
276
|
+
return undefined;
|
|
305
277
|
}
|
|
306
|
-
const
|
|
278
|
+
const fn = assertSelectorInArtifact(artifact, await findFunctionArtifactBySelector(artifact, selector), {
|
|
279
|
+
contractClassId,
|
|
280
|
+
selector,
|
|
281
|
+
});
|
|
307
282
|
return {
|
|
308
|
-
...
|
|
309
|
-
|
|
283
|
+
...fn,
|
|
284
|
+
contractName: artifact.name,
|
|
285
|
+
debug: getFunctionDebugMetadata(artifact, fn),
|
|
310
286
|
};
|
|
311
287
|
}
|
|
312
288
|
|
|
313
|
-
public async getPublicFunctionArtifact(
|
|
314
|
-
|
|
315
|
-
): Promise<FunctionArtifactWithContractName | undefined> {
|
|
316
|
-
const artifact = await this.#getArtifactByAddress(contractAddress);
|
|
289
|
+
public async getPublicFunctionArtifact(contractClassId: Fr): Promise<FunctionArtifactWithContractName | undefined> {
|
|
290
|
+
const artifact = await this.getContractArtifact(contractClassId);
|
|
317
291
|
const fn = artifact && artifact.functions.find(f => f.functionType === FunctionType.PUBLIC);
|
|
318
292
|
return fn && { ...fn, contractName: artifact.name };
|
|
319
293
|
}
|
|
320
294
|
|
|
321
|
-
public async getFunctionAbi(
|
|
322
|
-
contractAddress: AztecAddress,
|
|
323
|
-
selector: FunctionSelector,
|
|
324
|
-
): Promise<FunctionAbi | undefined> {
|
|
325
|
-
const artifact = await this.#getArtifactByAddress(contractAddress);
|
|
326
|
-
return artifact && (await findFunctionAbiBySelector(artifact, selector));
|
|
327
|
-
}
|
|
328
|
-
|
|
329
295
|
/**
|
|
330
|
-
* Retrieves the debug metadata of a specified function within a given contract.
|
|
296
|
+
* Retrieves the debug metadata of a specified function within a given contract class.
|
|
331
297
|
*
|
|
332
|
-
* @param
|
|
298
|
+
* @param contractClassId - The id of the contract class containing the function.
|
|
333
299
|
* @param selector - The function selector.
|
|
334
300
|
* @returns The corresponding function's debug metadata, or undefined.
|
|
335
301
|
*/
|
|
336
302
|
public async getFunctionDebugMetadata(
|
|
337
|
-
|
|
303
|
+
contractClassId: Fr,
|
|
338
304
|
selector: FunctionSelector,
|
|
339
305
|
): Promise<FunctionDebugMetadata | undefined> {
|
|
340
|
-
const artifact = await this
|
|
306
|
+
const artifact = await this.getContractArtifact(contractClassId);
|
|
341
307
|
if (!artifact) {
|
|
342
308
|
return undefined;
|
|
343
309
|
}
|
|
@@ -345,10 +311,8 @@ export class ContractStore {
|
|
|
345
311
|
return fn && getFunctionDebugMetadata(artifact, fn);
|
|
346
312
|
}
|
|
347
313
|
|
|
348
|
-
public async getPublicFunctionDebugMetadata(
|
|
349
|
-
|
|
350
|
-
): Promise<FunctionDebugMetadata | undefined> {
|
|
351
|
-
const artifact = await this.#getArtifactByAddress(contractAddress);
|
|
314
|
+
public async getPublicFunctionDebugMetadata(contractClassId: Fr): Promise<FunctionDebugMetadata | undefined> {
|
|
315
|
+
const artifact = await this.getContractArtifact(contractClassId);
|
|
352
316
|
const fn = artifact && artifact.functions.find(f => f.functionType === FunctionType.PUBLIC);
|
|
353
317
|
return fn && getFunctionDebugMetadata(artifact, fn);
|
|
354
318
|
}
|
|
@@ -368,28 +332,34 @@ export class ContractStore {
|
|
|
368
332
|
return tree?.getFunctionMembershipWitness(selector);
|
|
369
333
|
}
|
|
370
334
|
|
|
371
|
-
public async getDebugContractName(
|
|
372
|
-
const artifact = await this
|
|
335
|
+
public async getDebugContractName(contractClassId: Fr) {
|
|
336
|
+
const artifact = await this.getContractArtifact(contractClassId);
|
|
373
337
|
return artifact?.name;
|
|
374
338
|
}
|
|
375
339
|
|
|
376
|
-
public async getDebugFunctionName(
|
|
377
|
-
const artifact = await this
|
|
340
|
+
public async getDebugFunctionName(contractClassId: Fr, selector: FunctionSelector) {
|
|
341
|
+
const artifact = await this.getContractArtifact(contractClassId);
|
|
378
342
|
const fn = artifact && (await findFunctionAbiBySelector(artifact, selector));
|
|
379
|
-
return `${artifact?.name ??
|
|
343
|
+
return `${artifact?.name ?? contractClassId}:${fn?.name ?? selector}`;
|
|
380
344
|
}
|
|
381
345
|
|
|
382
|
-
public async getFunctionCall(
|
|
383
|
-
|
|
384
|
-
|
|
346
|
+
public async getFunctionCall(
|
|
347
|
+
functionName: string,
|
|
348
|
+
args: any[],
|
|
349
|
+
to: AztecAddress,
|
|
350
|
+
contractClassId: Fr,
|
|
351
|
+
): Promise<FunctionCall> {
|
|
352
|
+
const artifact = await this.getContractArtifact(contractClassId);
|
|
353
|
+
if (!artifact) {
|
|
385
354
|
throw new Error(
|
|
386
|
-
`
|
|
355
|
+
`No artifact registered for contract class ${contractClassId} (contract ${to}): register it by calling ` +
|
|
356
|
+
`wallet.registerContract(...).\nSee docs for context: https://docs.aztec.network/errors/14`,
|
|
387
357
|
);
|
|
388
358
|
}
|
|
389
359
|
|
|
390
|
-
const functionDao =
|
|
360
|
+
const functionDao = artifact.functions.find(f => f.name === functionName);
|
|
391
361
|
if (!functionDao) {
|
|
392
|
-
throw new Error(`Unknown function ${functionName} in contract ${
|
|
362
|
+
throw new Error(`Unknown function ${functionName} in contract ${artifact.name}.`);
|
|
393
363
|
}
|
|
394
364
|
|
|
395
365
|
const selector = await FunctionSelector.fromNameAndParameters(functionDao.name, functionDao.parameters);
|
|
@@ -402,7 +372,31 @@ export class ContractStore {
|
|
|
402
372
|
hideMsgSender: false,
|
|
403
373
|
isStatic: functionDao.isStatic,
|
|
404
374
|
args: encodeArguments(functionDao, args),
|
|
405
|
-
|
|
375
|
+
returnType: getFunctionReturnType(functionDao),
|
|
406
376
|
});
|
|
407
377
|
}
|
|
408
378
|
}
|
|
379
|
+
|
|
380
|
+
/**
|
|
381
|
+
* Narrows the result of a selector lookup against a registered artifact. A missing class artifact is reported as
|
|
382
|
+
* `undefined` by the callers (an absence they can handle), but a selector that is absent from an artifact we *do* have
|
|
383
|
+
* is exceptional and throws rather than returning undefined. We cannot tell from here why the selector is missing: it
|
|
384
|
+
* may be that no such function exists in the contract (a wrong selector), or that the registered artifact does not
|
|
385
|
+
* correspond to the resolved class id (registration performs no validation, so a mismatched artifact is possible). The
|
|
386
|
+
* error names both possibilities.
|
|
387
|
+
*/
|
|
388
|
+
function assertSelectorInArtifact<T>(
|
|
389
|
+
artifact: ContractArtifact,
|
|
390
|
+
fn: T | undefined,
|
|
391
|
+
context: { contractClassId: Fr; selector: FunctionSelector },
|
|
392
|
+
): T {
|
|
393
|
+
if (!fn) {
|
|
394
|
+
throw new Error(
|
|
395
|
+
`Function with selector ${context.selector} not found in the registered artifact for contract class ` +
|
|
396
|
+
`${context.contractClassId} (${artifact.name}). Either no function with this selector exists in the ` +
|
|
397
|
+
`contract, or the registered artifact does not match the class id (re-register it via ` +
|
|
398
|
+
`wallet.registerContract(...)).`,
|
|
399
|
+
);
|
|
400
|
+
}
|
|
401
|
+
return fn;
|
|
402
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
|
+
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
3
|
+
|
|
4
|
+
import { assertAllowedScope } from '../allowed_scopes.js';
|
|
5
|
+
import type { FactStore } from './fact_store.js';
|
|
6
|
+
import type { FactCollectionKey, FactCollectionTypeKey, OriginBlock } from './fact_store_keys.js';
|
|
7
|
+
import {
|
|
8
|
+
type FactCollectionWithOriginState,
|
|
9
|
+
type FactWithOriginState,
|
|
10
|
+
type TipBlockNumbers,
|
|
11
|
+
toFactWithOriginState,
|
|
12
|
+
} from './origin_state.js';
|
|
13
|
+
import type { Fact } from './stored_fact.js';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Wraps a {@link FactStore} with scope-based access control.
|
|
17
|
+
*
|
|
18
|
+
* Each method asserts scope validity before delegating to FactStore, gating which accounts a contract may record facts
|
|
19
|
+
* under or read facts from.
|
|
20
|
+
*/
|
|
21
|
+
export class FactService {
|
|
22
|
+
constructor(
|
|
23
|
+
private readonly factStore: FactStore,
|
|
24
|
+
private readonly allowedScopes: AztecAddress[],
|
|
25
|
+
) {}
|
|
26
|
+
|
|
27
|
+
recordFact(
|
|
28
|
+
factCollectionKey: FactCollectionKey,
|
|
29
|
+
factTypeId: Fr,
|
|
30
|
+
payload: Fr[],
|
|
31
|
+
originBlock: OriginBlock | undefined,
|
|
32
|
+
jobId: string,
|
|
33
|
+
): Promise<void> {
|
|
34
|
+
assertAllowedScope(factCollectionKey.scope, this.allowedScopes);
|
|
35
|
+
return this.factStore.recordFact(factCollectionKey, factTypeId, payload, originBlock, jobId);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
deleteFactCollection(factCollectionKey: FactCollectionKey, jobId: string): Promise<void> {
|
|
39
|
+
assertAllowedScope(factCollectionKey.scope, this.allowedScopes);
|
|
40
|
+
return this.factStore.deleteFactCollection(factCollectionKey, jobId);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
async getFactCollection(
|
|
44
|
+
factCollectionKey: FactCollectionKey,
|
|
45
|
+
tips: TipBlockNumbers,
|
|
46
|
+
jobId: string,
|
|
47
|
+
): Promise<FactCollectionWithOriginState | undefined> {
|
|
48
|
+
assertAllowedScope(factCollectionKey.scope, this.allowedScopes);
|
|
49
|
+
const collection = await this.factStore.getFactCollection(factCollectionKey, jobId);
|
|
50
|
+
if (!collection) {
|
|
51
|
+
return undefined;
|
|
52
|
+
}
|
|
53
|
+
return { key: collection.key, facts: this.#annotate(collection.facts, tips) };
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
async getFactCollectionsByType(
|
|
57
|
+
factCollectionTypeKey: FactCollectionTypeKey,
|
|
58
|
+
tips: TipBlockNumbers,
|
|
59
|
+
jobId: string,
|
|
60
|
+
): Promise<FactCollectionWithOriginState[]> {
|
|
61
|
+
assertAllowedScope(factCollectionTypeKey.scope, this.allowedScopes);
|
|
62
|
+
const collections = await this.factStore.getFactCollectionsByType(factCollectionTypeKey, jobId);
|
|
63
|
+
return collections.map(collection => ({ key: collection.key, facts: this.#annotate(collection.facts, tips) }));
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
#annotate(facts: Fact[], tips: TipBlockNumbers): FactWithOriginState[] {
|
|
67
|
+
return facts.map(fact => toFactWithOriginState(fact, tips));
|
|
68
|
+
}
|
|
69
|
+
}
|