@aztec/pxe 0.0.1-commit.a89ec08 → 0.0.1-commit.aa0c64f
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dest/bin/check_oracle_version.js +39 -110
- 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 +34 -0
- package/dest/bin/oracle_version_helpers.d.ts.map +1 -0
- package/dest/bin/oracle_version_helpers.js +46 -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 +23 -15
- package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -1
- package/dest/block_synchronizer/block_synchronizer.js +78 -28
- package/dest/config/index.d.ts +9 -2
- package/dest/config/index.d.ts.map +1 -1
- package/dest/config/index.js +14 -15
- package/dest/config/package_info.js +1 -1
- package/dest/contract/contract_class_service.d.ts +31 -0
- package/dest/contract/contract_class_service.d.ts.map +1 -0
- package/dest/contract/contract_class_service.js +68 -0
- package/dest/contract/contract_sync_service.d.ts +48 -0
- package/dest/contract/contract_sync_service.d.ts.map +1 -0
- package/dest/{contract_sync → contract}/contract_sync_service.js +42 -42
- 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/aztec_node_read_cache.d.ts +39 -0
- package/dest/contract_function_simulator/aztec_node_read_cache.d.ts.map +1 -0
- package/dest/contract_function_simulator/aztec_node_read_cache.js +60 -0
- package/dest/contract_function_simulator/contract_function_simulator.d.ts +22 -18
- package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.js +80 -41
- 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/execution_tagging_index_cache.d.ts +5 -9
- package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts.map +1 -1
- package/dest/contract_function_simulator/execution_tagging_index_cache.js +3 -7
- package/dest/contract_function_simulator/index.d.ts +26 -6
- package/dest/contract_function_simulator/index.d.ts.map +1 -1
- package/dest/contract_function_simulator/index.js +11 -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 +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 +4 -3
- 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 +18 -9
- 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 -24
- 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 +5 -4
- 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 +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/note_packing_utils.d.ts +2 -2
- package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/note_packing_utils.js +2 -2
- package/dest/contract_function_simulator/oracle/oracle_registry.d.ts +139 -0
- package/dest/contract_function_simulator/oracle/oracle_registry.d.ts.map +1 -0
- package/dest/contract_function_simulator/oracle/oracle_registry.js +1016 -0
- 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 +1243 -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 +47 -36
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.js +181 -63
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +126 -64
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +430 -195
- package/dest/contract_function_simulator/pick_notes.d.ts +1 -1
- package/dest/contract_function_simulator/pick_notes.d.ts.map +1 -1
- package/dest/contract_function_simulator/pick_notes.js +6 -0
- 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 -7
- package/dest/debug/pxe_debug_utils.d.ts.map +1 -1
- package/dest/debug/pxe_debug_utils.js +0 -6
- 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 +25 -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 +25 -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 +14 -2
- package/dest/entrypoints/pxe_creation_options.d.ts.map +1 -1
- package/dest/entrypoints/server/index.d.ts +6 -2
- package/dest/entrypoints/server/index.d.ts.map +1 -1
- package/dest/entrypoints/server/index.js +4 -1
- 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 +3 -2
- package/dest/entrypoints/server/utils.d.ts.map +1 -1
- package/dest/entrypoints/server/utils.js +26 -6
- 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 -5
- package/dest/events/event_service.d.ts.map +1 -1
- package/dest/events/event_service.js +30 -9
- 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 +2 -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 +12 -9
- package/dest/logs/log_service.d.ts.map +1 -1
- package/dest/logs/log_service.js +186 -62
- 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 +60 -0
- package/dest/notes/note_service.d.ts +26 -4
- package/dest/notes/note_service.d.ts.map +1 -1
- package/dest/notes/note_service.js +81 -66
- package/dest/oracle_version.d.ts +3 -3
- package/dest/oracle_version.js +6 -6
- 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/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 +7 -3
- package/dest/private_kernel/hints/test_utils.d.ts +1 -1
- package/dest/private_kernel/hints/test_utils.d.ts.map +1 -1
- package/dest/private_kernel/hints/test_utils.js +3 -4
- package/dest/private_kernel/private_kernel_execution_prover.d.ts +6 -2
- package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_execution_prover.js +200 -83
- package/dest/private_kernel/private_kernel_oracle.d.ts +12 -10
- package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_oracle.js +40 -26
- package/dest/pxe.d.ts +165 -52
- package/dest/pxe.d.ts.map +1 -1
- package/dest/pxe.js +337 -209
- 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/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 +671 -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 +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 +67 -97
- 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 +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 +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 +43 -43
- package/dest/storage/private_event_store/stored_private_event.js +1 -1
- 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/recipient_tagging_store.d.ts +6 -6
- package/dest/storage/tagging_store/recipient_tagging_store.d.ts.map +1 -1
- package/dest/storage/tagging_store/sender_tagging_store.d.ts +23 -7
- package/dest/storage/tagging_store/sender_tagging_store.d.ts.map +1 -1
- package/dest/storage/tagging_store/sender_tagging_store.js +51 -14
- 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 +3 -2
- package/dest/tagging/constants.d.ts.map +1 -1
- package/dest/tagging/constants.js +28 -10
- package/dest/tagging/get_all_logs_by_tags.d.ts +34 -10
- package/dest/tagging/get_all_logs_by_tags.d.ts.map +1 -1
- package/dest/tagging/get_all_logs_by_tags.js +36 -37
- package/dest/tagging/index.d.ts +6 -5
- package/dest/tagging/index.d.ts.map +1 -1
- package/dest/tagging/index.js +5 -4
- 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 +74 -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 +238 -0
- package/dest/tagging/recipient_sync/utils/find_highest_indexes.d.ts +3 -3
- package/dest/tagging/recipient_sync/utils/find_highest_indexes.d.ts.map +1 -1
- 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 +4 -5
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts.map +1 -1
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.js +26 -14
- package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts +11 -6
- package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts.map +1 -1
- package/dest/tagging/sender_sync/utils/get_status_change_of_pending.js +21 -0
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts +4 -4
- 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 +8 -4
- 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 +20 -17
- package/src/bin/check_oracle_version.ts +44 -133
- package/src/bin/index.ts +1 -0
- package/src/bin/oracle_version_helpers.ts +54 -0
- package/src/block_synchronizer/block_stream_source.ts +42 -0
- package/src/block_synchronizer/block_synchronizer.ts +96 -39
- package/src/config/index.ts +16 -9
- package/src/config/package_info.ts +1 -1
- package/src/contract/contract_class_service.ts +83 -0
- package/src/{contract_sync → contract}/contract_sync_service.ts +61 -61
- 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/aztec_node_read_cache.ts +89 -0
- package/src/contract_function_simulator/contract_function_simulator.ts +130 -53
- package/src/contract_function_simulator/execution_note_cache.ts +8 -29
- package/src/contract_function_simulator/execution_tagging_index_cache.ts +5 -9
- package/src/contract_function_simulator/index.ts +89 -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 +4 -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 +26 -19
- 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 +5 -4
- 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 +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 -204
- 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/note_packing_utils.ts +3 -3
- package/src/contract_function_simulator/oracle/oracle_registry.ts +710 -0
- package/src/contract_function_simulator/oracle/oracle_type_mappings.ts +1052 -0
- package/src/contract_function_simulator/oracle/private_execution.ts +2 -3
- package/src/contract_function_simulator/oracle/private_execution_oracle.ts +232 -83
- package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +676 -367
- package/src/contract_function_simulator/pick_notes.ts +8 -0
- package/src/contract_function_simulator/transient_array_service.ts +91 -0
- package/src/debug/pxe_debug_utils.ts +1 -9
- package/src/entrypoints/client/bundle/index.ts +1 -0
- package/src/entrypoints/client/bundle/utils.ts +30 -5
- package/src/entrypoints/client/lazy/index.ts +1 -0
- package/src/entrypoints/client/lazy/utils.ts +30 -5
- package/src/entrypoints/client/store.ts +54 -0
- package/src/entrypoints/pxe_creation_options.ts +14 -1
- package/src/entrypoints/server/index.ts +6 -1
- package/src/entrypoints/server/store.ts +47 -0
- package/src/entrypoints/server/utils.ts +43 -11
- package/src/error_enriching.ts +27 -11
- package/src/events/event_service.ts +54 -19
- package/src/hooks/authorize_utility_call.ts +44 -0
- package/src/hooks/execution_hooks.ts +68 -0
- package/src/hooks/index.ts +13 -0
- 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 +220 -112
- package/src/messages/tx_resolver_service.ts +69 -0
- package/src/notes/note_service.ts +116 -92
- package/src/oracle_version.ts +6 -6
- package/src/private_kernel/batch_planner.ts +168 -0
- package/src/private_kernel/hints/private_kernel_reset_private_inputs_builder.ts +12 -2
- package/src/private_kernel/hints/test_utils.ts +3 -10
- package/src/private_kernel/private_kernel_execution_prover.ts +333 -114
- package/src/private_kernel/private_kernel_oracle.ts +58 -29
- package/src/pxe.ts +529 -237
- 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 +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 +26 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/SenderTaggingStore.json +30 -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 +803 -0
- package/src/storage/backwards_compatibility_tests/store_spy.ts +73 -0
- package/src/storage/capsule_store/capsule_service.ts +8 -13
- package/src/storage/contract_store/contract_store.ts +90 -120
- 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 +52 -0
- package/src/storage/private_event_store/private_event_store.ts +52 -54
- package/src/storage/private_event_store/stored_private_event.ts +1 -1
- package/src/storage/store_identity.ts +72 -0
- package/src/storage/tagging_store/index.ts +1 -1
- package/src/storage/tagging_store/recipient_tagging_store.ts +5 -9
- package/src/storage/tagging_store/sender_tagging_store.ts +68 -21
- package/src/storage/tagging_store/tagging_secret_sources_store.ts +138 -0
- package/src/tagging/constants.ts +30 -10
- package/src/tagging/get_all_logs_by_tags.ts +78 -50
- package/src/tagging/index.ts +5 -4
- package/src/tagging/persist_sender_tagging_index_ranges.ts +57 -0
- package/src/tagging/recipient_sync/sync_tagged_private_logs.ts +358 -0
- package/src/tagging/recipient_sync/utils/find_highest_indexes.ts +2 -2
- package/src/tagging/reconcile_tagging_index_ranges.ts +102 -0
- package/src/tagging/sender_sync/sync_sender_tagging_indexes.ts +41 -19
- package/src/tagging/sender_sync/utils/get_status_change_of_pending.ts +23 -8
- package/src/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.ts +10 -7
- package/src/tagging/testing/tag_query_test_utils.ts +11 -0
- package/dest/contract_function_simulator/oracle/legacy_oracle_mappings.d.ts +0 -9
- package/dest/contract_function_simulator/oracle/legacy_oracle_mappings.d.ts.map +0 -1
- package/dest/contract_function_simulator/oracle/legacy_oracle_mappings.js +0 -47
- package/dest/contract_function_simulator/oracle/oracle.d.ts +0 -91
- package/dest/contract_function_simulator/oracle/oracle.d.ts.map +0 -1
- package/dest/contract_function_simulator/oracle/oracle.js +0 -553
- 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 -83
- package/dest/contract_sync/contract_sync_service.d.ts +0 -44
- package/dest/contract_sync/contract_sync_service.d.ts.map +0 -1
- package/dest/contract_sync/helpers.d.ts +0 -28
- package/dest/contract_sync/helpers.d.ts.map +0 -1
- package/dest/contract_sync/helpers.js +0 -60
- 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 -36
- 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/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts +0 -14
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts.map +0 -1
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.js +0 -85
- package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts +0 -14
- package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts.map +0 -1
- package/dest/tagging/recipient_sync/utils/load_logs_for_range.js +0 -33
- package/src/contract_function_simulator/oracle/legacy_oracle_mappings.ts +0 -104
- package/src/contract_function_simulator/oracle/oracle.ts +0 -861
- package/src/contract_function_simulator/proxied_contract_data_source.ts +0 -90
- package/src/contract_sync/helpers.ts +0 -98
- package/src/messages/message_context_service.ts +0 -44
- package/src/storage/tagging_store/sender_address_book_store.ts +0 -48
- package/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts +0 -128
- package/src/tagging/recipient_sync/utils/load_logs_for_range.ts +0 -44
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
AztecAsyncArray,
|
|
3
|
+
AztecAsyncCounter,
|
|
4
|
+
AztecAsyncKVStore,
|
|
5
|
+
AztecAsyncMap,
|
|
6
|
+
AztecAsyncMultiMap,
|
|
7
|
+
AztecAsyncSet,
|
|
8
|
+
AztecAsyncSingleton,
|
|
9
|
+
Key,
|
|
10
|
+
} from '@aztec/kv-store';
|
|
11
|
+
|
|
12
|
+
type Value = NonNullable<any>;
|
|
13
|
+
|
|
14
|
+
/** The kind of named sub-store opened on an `AztecAsyncKVStore`. */
|
|
15
|
+
export type StoreKind = 'map' | 'multimap' | 'array' | 'singleton' | 'set' | 'counter';
|
|
16
|
+
|
|
17
|
+
/** A single recorded `open*()` call against a spied store. */
|
|
18
|
+
export interface OpenedStoreEntry {
|
|
19
|
+
name: string;
|
|
20
|
+
kind: StoreKind;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** A spied `AztecAsyncKVStore` together with a function that returns the sorted log of `open*()` calls. */
|
|
24
|
+
export interface StoreSpy {
|
|
25
|
+
store: AztecAsyncKVStore;
|
|
26
|
+
getOpenedStores: () => OpenedStoreEntry[];
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Wraps an `AztecAsyncKVStore` so every `openMap`/`openMultiMap`/`openArray`/`openSingleton`/`openSet`/`openCounter`
|
|
31
|
+
* call is recorded before being delegated to the inner store.
|
|
32
|
+
*/
|
|
33
|
+
export function createStoreSpy(inner: AztecAsyncKVStore): StoreSpy {
|
|
34
|
+
const entries: OpenedStoreEntry[] = [];
|
|
35
|
+
|
|
36
|
+
const store: AztecAsyncKVStore = {
|
|
37
|
+
openMap<K extends Key, V extends Value>(name: string): AztecAsyncMap<K, V> {
|
|
38
|
+
entries.push({ name, kind: 'map' });
|
|
39
|
+
return inner.openMap<K, V>(name);
|
|
40
|
+
},
|
|
41
|
+
openMultiMap<K extends Key, V extends Value>(name: string): AztecAsyncMultiMap<K, V> {
|
|
42
|
+
entries.push({ name, kind: 'multimap' });
|
|
43
|
+
return inner.openMultiMap<K, V>(name);
|
|
44
|
+
},
|
|
45
|
+
openArray<T extends Value>(name: string): AztecAsyncArray<T> {
|
|
46
|
+
entries.push({ name, kind: 'array' });
|
|
47
|
+
return inner.openArray<T>(name);
|
|
48
|
+
},
|
|
49
|
+
openSingleton<T extends Value>(name: string): AztecAsyncSingleton<T> {
|
|
50
|
+
entries.push({ name, kind: 'singleton' });
|
|
51
|
+
return inner.openSingleton<T>(name);
|
|
52
|
+
},
|
|
53
|
+
openSet<K extends Key>(name: string): AztecAsyncSet<K> {
|
|
54
|
+
entries.push({ name, kind: 'set' });
|
|
55
|
+
return inner.openSet<K>(name);
|
|
56
|
+
},
|
|
57
|
+
openCounter<K extends Key>(name: string): AztecAsyncCounter<K> {
|
|
58
|
+
entries.push({ name, kind: 'counter' });
|
|
59
|
+
return inner.openCounter<K>(name);
|
|
60
|
+
},
|
|
61
|
+
transactionAsync: callback => inner.transactionAsync(callback),
|
|
62
|
+
clear: () => inner.clear(),
|
|
63
|
+
delete: () => inner.delete(),
|
|
64
|
+
estimateSize: () => inner.estimateSize(),
|
|
65
|
+
close: () => inner.close(),
|
|
66
|
+
backupTo: (dstPath, compact) => inner.backupTo(dstPath, compact),
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const getOpenedStores = () =>
|
|
70
|
+
[...entries].sort((a, b) => (a.name === b.name ? a.kind.localeCompare(b.kind) : a.name.localeCompare(b.name)));
|
|
71
|
+
|
|
72
|
+
return { store, getOpenedStores };
|
|
73
|
+
}
|
|
@@ -2,6 +2,7 @@ import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
|
2
2
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
3
3
|
import type { Capsule } from '@aztec/stdlib/tx';
|
|
4
4
|
|
|
5
|
+
import { assertAllowedScope } from '../allowed_scopes.js';
|
|
5
6
|
import type { CapsuleStore } from './capsule_store.js';
|
|
6
7
|
|
|
7
8
|
/**
|
|
@@ -9,10 +10,15 @@ import type { CapsuleStore } from './capsule_store.js';
|
|
|
9
10
|
* allowed scopes list before delegating to the underlying store.
|
|
10
11
|
*/
|
|
11
12
|
export class CapsuleService {
|
|
13
|
+
private readonly allowedScopes: AztecAddress[];
|
|
14
|
+
|
|
12
15
|
constructor(
|
|
13
16
|
private readonly capsuleStore: CapsuleStore,
|
|
14
|
-
|
|
15
|
-
) {
|
|
17
|
+
allowedScopes: AztecAddress[],
|
|
18
|
+
) {
|
|
19
|
+
// The zero address denotes the global capsule scope, which is always permitted.
|
|
20
|
+
this.allowedScopes = [...allowedScopes, AztecAddress.ZERO];
|
|
21
|
+
}
|
|
16
22
|
|
|
17
23
|
setCapsule(contractAddress: AztecAddress, slot: Fr, capsule: Fr[], jobId: string, scope: AztecAddress) {
|
|
18
24
|
assertAllowedScope(scope, this.allowedScopes);
|
|
@@ -77,14 +83,3 @@ export class CapsuleService {
|
|
|
77
83
|
return this.capsuleStore.setCapsuleArray(contractAddress, baseSlot, content, jobId, scope);
|
|
78
84
|
}
|
|
79
85
|
}
|
|
80
|
-
|
|
81
|
-
function assertAllowedScope(scope: AztecAddress, allowedScopes: AztecAddress[]) {
|
|
82
|
-
if (scope.equals(AztecAddress.ZERO)) {
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
85
|
-
if (!allowedScopes.some((allowed: AztecAddress) => allowed.equals(scope))) {
|
|
86
|
-
throw new Error(
|
|
87
|
-
`Scope ${scope.toString()} is not in the allowed scopes list: [${allowedScopes.map((s: AztecAddress) => s.toString()).join(', ')}]. See https://docs.aztec.network/errors/10`,
|
|
88
|
-
);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
@@ -6,8 +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
|
-
type FunctionArtifact,
|
|
11
9
|
type FunctionArtifactWithContractName,
|
|
12
10
|
FunctionCall,
|
|
13
11
|
type FunctionDebugMetadata,
|
|
@@ -16,14 +14,16 @@ import {
|
|
|
16
14
|
contractArtifactFromBuffer,
|
|
17
15
|
contractArtifactToBuffer,
|
|
18
16
|
encodeArguments,
|
|
17
|
+
findFunctionAbiBySelector,
|
|
18
|
+
findFunctionArtifactBySelector,
|
|
19
19
|
getFunctionDebugMetadata,
|
|
20
20
|
} from '@aztec/stdlib/abi';
|
|
21
21
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
22
22
|
import {
|
|
23
23
|
type ContractClassIdPreimage,
|
|
24
24
|
type ContractClassWithId,
|
|
25
|
-
type
|
|
26
|
-
|
|
25
|
+
type ContractInstancePreimageWithAddress,
|
|
26
|
+
SerializableContractInstancePreimage,
|
|
27
27
|
getContractClassFromArtifact,
|
|
28
28
|
} from '@aztec/stdlib/contract';
|
|
29
29
|
|
|
@@ -111,9 +111,6 @@ export class ContractStore {
|
|
|
111
111
|
// TODO: Update it to be LRU cache so that it doesn't keep all the data all the time.
|
|
112
112
|
#contractArtifactCache: Map<string, ContractArtifact> = new Map();
|
|
113
113
|
|
|
114
|
-
/** Map from contract address to contract class id (avoids KV round-trip on hot path). */
|
|
115
|
-
#contractClassIdMap: Map<string, Fr> = new Map();
|
|
116
|
-
|
|
117
114
|
#store: AztecAsyncKVStore;
|
|
118
115
|
#contractArtifacts: AztecAsyncMap<string, Buffer>;
|
|
119
116
|
#contractClassData: AztecAsyncMap<string, Buffer>;
|
|
@@ -130,9 +127,10 @@ export class ContractStore {
|
|
|
130
127
|
|
|
131
128
|
/**
|
|
132
129
|
* Registers a new contract artifact and its corresponding class data.
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
*
|
|
130
|
+
*
|
|
131
|
+
* IMPORTANT: This method does not verify that the provided artifact matches the class data or that the class id
|
|
132
|
+
* matches the artifact. It is the caller's responsibility to ensure the consistency and correctness of the provided
|
|
133
|
+
* data. This is done to avoid redundant, expensive contract class computations.
|
|
136
134
|
*/
|
|
137
135
|
public async addContractArtifact(
|
|
138
136
|
contract: ContractArtifact,
|
|
@@ -167,31 +165,17 @@ export class ContractStore {
|
|
|
167
165
|
return contractClass.id;
|
|
168
166
|
}
|
|
169
167
|
|
|
170
|
-
async addContractInstance(contract:
|
|
168
|
+
async addContractInstance(contract: ContractInstancePreimageWithAddress): Promise<void> {
|
|
171
169
|
await this.#store.transactionAsync(async () => {
|
|
172
170
|
await this.#contractInstances.set(
|
|
173
171
|
contract.address.toString(),
|
|
174
|
-
new
|
|
172
|
+
new SerializableContractInstancePreimage(contract).toBuffer(),
|
|
175
173
|
);
|
|
176
174
|
});
|
|
177
|
-
|
|
178
|
-
this.#contractClassIdMap.set(contract.address.toString(), contract.currentContractClassId);
|
|
179
175
|
}
|
|
180
176
|
|
|
181
177
|
// Private getters
|
|
182
178
|
|
|
183
|
-
async #getContractClassId(contractAddress: AztecAddress): Promise<Fr | undefined> {
|
|
184
|
-
const key = contractAddress.toString();
|
|
185
|
-
if (!this.#contractClassIdMap.has(key)) {
|
|
186
|
-
const instance = await this.getContractInstance(contractAddress);
|
|
187
|
-
if (!instance) {
|
|
188
|
-
return;
|
|
189
|
-
}
|
|
190
|
-
this.#contractClassIdMap.set(key, instance.currentContractClassId);
|
|
191
|
-
}
|
|
192
|
-
return this.#contractClassIdMap.get(key);
|
|
193
|
-
}
|
|
194
|
-
|
|
195
179
|
async #getPrivateFunctionTreeForClassId(classId: Fr): Promise<PrivateFunctionsTree | undefined> {
|
|
196
180
|
if (!this.#privateFunctionTrees.has(classId.toString())) {
|
|
197
181
|
const artifact = await this.getContractArtifact(classId);
|
|
@@ -204,25 +188,20 @@ export class ContractStore {
|
|
|
204
188
|
return this.#privateFunctionTrees.get(classId.toString())!;
|
|
205
189
|
}
|
|
206
190
|
|
|
207
|
-
async #getArtifactByAddress(contractAddress: AztecAddress): Promise<ContractArtifact | undefined> {
|
|
208
|
-
const classId = await this.#getContractClassId(contractAddress);
|
|
209
|
-
return classId && this.getContractArtifact(classId);
|
|
210
|
-
}
|
|
211
|
-
|
|
212
191
|
// Public getters
|
|
213
192
|
|
|
214
193
|
getContractsAddresses(): Promise<AztecAddress[]> {
|
|
215
194
|
return this.#store.transactionAsync(async () => {
|
|
216
195
|
const keys = await toArray(this.#contractInstances.keysAsync());
|
|
217
|
-
return keys.map(AztecAddress.
|
|
196
|
+
return keys.map(AztecAddress.fromStringUnsafe);
|
|
218
197
|
});
|
|
219
198
|
}
|
|
220
199
|
|
|
221
|
-
/** Returns
|
|
222
|
-
public getContractInstance(contractAddress: AztecAddress): Promise<
|
|
200
|
+
/** Returns the address preimage of a given address. */
|
|
201
|
+
public getContractInstance(contractAddress: AztecAddress): Promise<ContractInstancePreimageWithAddress | undefined> {
|
|
223
202
|
return this.#store.transactionAsync(async () => {
|
|
224
203
|
const contract = await this.#contractInstances.getAsync(contractAddress.toString());
|
|
225
|
-
return contract &&
|
|
204
|
+
return contract && SerializableContractInstancePreimage.fromBuffer(contract).withAddress(contractAddress);
|
|
226
205
|
});
|
|
227
206
|
}
|
|
228
207
|
|
|
@@ -261,93 +240,78 @@ export class ContractStore {
|
|
|
261
240
|
return { ...classData, packedBytecode };
|
|
262
241
|
}
|
|
263
242
|
|
|
264
|
-
public async getContract(
|
|
265
|
-
address: AztecAddress,
|
|
266
|
-
): Promise<(ContractInstanceWithAddress & ContractArtifact) | undefined> {
|
|
267
|
-
const instance = await this.getContractInstance(address);
|
|
268
|
-
if (!instance) {
|
|
269
|
-
return;
|
|
270
|
-
}
|
|
271
|
-
const artifact = await this.getContractArtifact(instance.currentContractClassId);
|
|
272
|
-
if (!artifact) {
|
|
273
|
-
return;
|
|
274
|
-
}
|
|
275
|
-
return { ...instance, ...artifact };
|
|
276
|
-
}
|
|
277
|
-
|
|
278
243
|
/**
|
|
279
|
-
* Retrieves the artifact of a specified function within a given contract.
|
|
244
|
+
* Retrieves the artifact of a specified function within a given contract class.
|
|
280
245
|
*
|
|
281
|
-
* @param
|
|
246
|
+
* @param contractClassId - The id of the contract class containing the function.
|
|
282
247
|
* @param selector - The function selector.
|
|
283
|
-
* @returns The corresponding function's artifact as an object.
|
|
248
|
+
* @returns The corresponding function's artifact as an object, or `undefined` if the class is not registered.
|
|
284
249
|
*/
|
|
285
250
|
public async getFunctionArtifact(
|
|
286
|
-
|
|
251
|
+
contractClassId: Fr,
|
|
287
252
|
selector: FunctionSelector,
|
|
288
253
|
): Promise<FunctionArtifactWithContractName | undefined> {
|
|
289
|
-
const artifact = await this
|
|
254
|
+
const artifact = await this.getContractArtifact(contractClassId);
|
|
290
255
|
if (!artifact) {
|
|
291
256
|
return undefined;
|
|
292
257
|
}
|
|
293
|
-
const fn = await
|
|
294
|
-
|
|
258
|
+
const fn = assertSelectorInArtifact(artifact, await findFunctionArtifactBySelector(artifact, selector), {
|
|
259
|
+
contractClassId,
|
|
260
|
+
selector,
|
|
261
|
+
});
|
|
262
|
+
return { ...fn, contractName: artifact.name };
|
|
295
263
|
}
|
|
296
264
|
|
|
265
|
+
/**
|
|
266
|
+
* Same as {@link getFunctionArtifact} but with debug metadata attached. Returns `undefined` when the class artifact
|
|
267
|
+
* is not registered.
|
|
268
|
+
*/
|
|
297
269
|
public async getFunctionArtifactWithDebugMetadata(
|
|
298
|
-
|
|
270
|
+
contractClassId: Fr,
|
|
299
271
|
selector: FunctionSelector,
|
|
300
|
-
): Promise<FunctionArtifactWithContractName> {
|
|
301
|
-
const artifact = await this.
|
|
272
|
+
): Promise<FunctionArtifactWithContractName | undefined> {
|
|
273
|
+
const artifact = await this.getContractArtifact(contractClassId);
|
|
302
274
|
if (!artifact) {
|
|
303
|
-
|
|
275
|
+
return undefined;
|
|
304
276
|
}
|
|
305
|
-
const
|
|
277
|
+
const fn = assertSelectorInArtifact(artifact, await findFunctionArtifactBySelector(artifact, selector), {
|
|
278
|
+
contractClassId,
|
|
279
|
+
selector,
|
|
280
|
+
});
|
|
306
281
|
return {
|
|
307
|
-
...
|
|
308
|
-
|
|
282
|
+
...fn,
|
|
283
|
+
contractName: artifact.name,
|
|
284
|
+
debug: getFunctionDebugMetadata(artifact, fn),
|
|
309
285
|
};
|
|
310
286
|
}
|
|
311
287
|
|
|
312
|
-
public async getPublicFunctionArtifact(
|
|
313
|
-
|
|
314
|
-
): Promise<FunctionArtifactWithContractName | undefined> {
|
|
315
|
-
const artifact = await this.#getArtifactByAddress(contractAddress);
|
|
288
|
+
public async getPublicFunctionArtifact(contractClassId: Fr): Promise<FunctionArtifactWithContractName | undefined> {
|
|
289
|
+
const artifact = await this.getContractArtifact(contractClassId);
|
|
316
290
|
const fn = artifact && artifact.functions.find(f => f.functionType === FunctionType.PUBLIC);
|
|
317
291
|
return fn && { ...fn, contractName: artifact.name };
|
|
318
292
|
}
|
|
319
293
|
|
|
320
|
-
public async getFunctionAbi(
|
|
321
|
-
contractAddress: AztecAddress,
|
|
322
|
-
selector: FunctionSelector,
|
|
323
|
-
): Promise<FunctionAbi | undefined> {
|
|
324
|
-
const artifact = await this.#getArtifactByAddress(contractAddress);
|
|
325
|
-
return artifact && (await this.#findFunctionAbiBySelector(artifact, selector));
|
|
326
|
-
}
|
|
327
|
-
|
|
328
294
|
/**
|
|
329
|
-
* Retrieves the debug metadata of a specified function within a given contract.
|
|
295
|
+
* Retrieves the debug metadata of a specified function within a given contract class.
|
|
330
296
|
*
|
|
331
|
-
* @param
|
|
297
|
+
* @param contractClassId - The id of the contract class containing the function.
|
|
332
298
|
* @param selector - The function selector.
|
|
333
299
|
* @returns The corresponding function's debug metadata, or undefined.
|
|
334
300
|
*/
|
|
335
301
|
public async getFunctionDebugMetadata(
|
|
336
|
-
|
|
302
|
+
contractClassId: Fr,
|
|
337
303
|
selector: FunctionSelector,
|
|
338
304
|
): Promise<FunctionDebugMetadata | undefined> {
|
|
339
|
-
const artifact = await this
|
|
305
|
+
const artifact = await this.getContractArtifact(contractClassId);
|
|
340
306
|
if (!artifact) {
|
|
341
307
|
return undefined;
|
|
342
308
|
}
|
|
343
|
-
const fn = await
|
|
309
|
+
const fn = await findFunctionArtifactBySelector(artifact, selector);
|
|
344
310
|
return fn && getFunctionDebugMetadata(artifact, fn);
|
|
345
311
|
}
|
|
346
312
|
|
|
347
|
-
public async getPublicFunctionDebugMetadata(
|
|
348
|
-
|
|
349
|
-
): Promise<FunctionDebugMetadata | undefined> {
|
|
350
|
-
const artifact = await this.#getArtifactByAddress(contractAddress);
|
|
313
|
+
public async getPublicFunctionDebugMetadata(contractClassId: Fr): Promise<FunctionDebugMetadata | undefined> {
|
|
314
|
+
const artifact = await this.getContractArtifact(contractClassId);
|
|
351
315
|
const fn = artifact && artifact.functions.find(f => f.functionType === FunctionType.PUBLIC);
|
|
352
316
|
return fn && getFunctionDebugMetadata(artifact, fn);
|
|
353
317
|
}
|
|
@@ -367,52 +331,34 @@ export class ContractStore {
|
|
|
367
331
|
return tree?.getFunctionMembershipWitness(selector);
|
|
368
332
|
}
|
|
369
333
|
|
|
370
|
-
public async getDebugContractName(
|
|
371
|
-
const artifact = await this
|
|
334
|
+
public async getDebugContractName(contractClassId: Fr) {
|
|
335
|
+
const artifact = await this.getContractArtifact(contractClassId);
|
|
372
336
|
return artifact?.name;
|
|
373
337
|
}
|
|
374
338
|
|
|
375
|
-
public async getDebugFunctionName(
|
|
376
|
-
const artifact = await this
|
|
377
|
-
const fn = artifact && (await
|
|
378
|
-
return `${artifact?.name ??
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
async #findFunctionArtifactBySelector(
|
|
382
|
-
artifact: ContractArtifact,
|
|
383
|
-
selector: FunctionSelector,
|
|
384
|
-
): Promise<FunctionArtifact | undefined> {
|
|
385
|
-
for (const fn of artifact.functions) {
|
|
386
|
-
const fnSelector = await FunctionSelector.fromNameAndParameters(fn.name, fn.parameters);
|
|
387
|
-
if (fnSelector.equals(selector)) {
|
|
388
|
-
return fn;
|
|
389
|
-
}
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
async #findFunctionAbiBySelector(
|
|
394
|
-
artifact: ContractArtifact,
|
|
395
|
-
selector: FunctionSelector,
|
|
396
|
-
): Promise<FunctionAbi | undefined> {
|
|
397
|
-
for (const fn of [...artifact.functions, ...(artifact.nonDispatchPublicFunctions ?? [])]) {
|
|
398
|
-
const fnSelector = await FunctionSelector.fromNameAndParameters(fn.name, fn.parameters);
|
|
399
|
-
if (fnSelector.equals(selector)) {
|
|
400
|
-
return fn;
|
|
401
|
-
}
|
|
402
|
-
}
|
|
339
|
+
public async getDebugFunctionName(contractClassId: Fr, selector: FunctionSelector) {
|
|
340
|
+
const artifact = await this.getContractArtifact(contractClassId);
|
|
341
|
+
const fn = artifact && (await findFunctionAbiBySelector(artifact, selector));
|
|
342
|
+
return `${artifact?.name ?? contractClassId}:${fn?.name ?? selector}`;
|
|
403
343
|
}
|
|
404
344
|
|
|
405
|
-
public async getFunctionCall(
|
|
406
|
-
|
|
407
|
-
|
|
345
|
+
public async getFunctionCall(
|
|
346
|
+
functionName: string,
|
|
347
|
+
args: any[],
|
|
348
|
+
to: AztecAddress,
|
|
349
|
+
contractClassId: Fr,
|
|
350
|
+
): Promise<FunctionCall> {
|
|
351
|
+
const artifact = await this.getContractArtifact(contractClassId);
|
|
352
|
+
if (!artifact) {
|
|
408
353
|
throw new Error(
|
|
409
|
-
`
|
|
354
|
+
`No artifact registered for contract class ${contractClassId} (contract ${to}): register it by calling ` +
|
|
355
|
+
`wallet.registerContract(...).\nSee docs for context: https://docs.aztec.network/errors/14`,
|
|
410
356
|
);
|
|
411
357
|
}
|
|
412
358
|
|
|
413
|
-
const functionDao =
|
|
359
|
+
const functionDao = artifact.functions.find(f => f.name === functionName);
|
|
414
360
|
if (!functionDao) {
|
|
415
|
-
throw new Error(`Unknown function ${functionName} in contract ${
|
|
361
|
+
throw new Error(`Unknown function ${functionName} in contract ${artifact.name}.`);
|
|
416
362
|
}
|
|
417
363
|
|
|
418
364
|
const selector = await FunctionSelector.fromNameAndParameters(functionDao.name, functionDao.parameters);
|
|
@@ -429,3 +375,27 @@ export class ContractStore {
|
|
|
429
375
|
});
|
|
430
376
|
}
|
|
431
377
|
}
|
|
378
|
+
|
|
379
|
+
/**
|
|
380
|
+
* Narrows the result of a selector lookup against a registered artifact. A missing class artifact is reported as
|
|
381
|
+
* `undefined` by the callers (an absence they can handle), but a selector that is absent from an artifact we *do* have
|
|
382
|
+
* is exceptional and throws rather than returning undefined. We cannot tell from here why the selector is missing: it
|
|
383
|
+
* may be that no such function exists in the contract (a wrong selector), or that the registered artifact does not
|
|
384
|
+
* correspond to the resolved class id (registration performs no validation, so a mismatched artifact is possible). The
|
|
385
|
+
* error names both possibilities.
|
|
386
|
+
*/
|
|
387
|
+
function assertSelectorInArtifact<T>(
|
|
388
|
+
artifact: ContractArtifact,
|
|
389
|
+
fn: T | undefined,
|
|
390
|
+
context: { contractClassId: Fr; selector: FunctionSelector },
|
|
391
|
+
): T {
|
|
392
|
+
if (!fn) {
|
|
393
|
+
throw new Error(
|
|
394
|
+
`Function with selector ${context.selector} not found in the registered artifact for contract class ` +
|
|
395
|
+
`${context.contractClassId} (${artifact.name}). Either no function with this selector exists in the ` +
|
|
396
|
+
`contract, or the registered artifact does not match the class id (re-register it via ` +
|
|
397
|
+
`wallet.registerContract(...)).`,
|
|
398
|
+
);
|
|
399
|
+
}
|
|
400
|
+
return fn;
|
|
401
|
+
}
|
|
@@ -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
|
+
}
|