@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
|
@@ -1,270 +1,106 @@
|
|
|
1
1
|
/* eslint-disable camelcase */
|
|
2
|
-
import {
|
|
3
|
-
ARCHIVE_HEIGHT,
|
|
4
|
-
BLOCK_HEADER_LENGTH,
|
|
5
|
-
KEY_VALIDATION_REQUEST_LENGTH,
|
|
6
|
-
L1_TO_L2_MSG_TREE_HEIGHT,
|
|
7
|
-
MAX_CONTRACT_CLASS_LOGS_PER_TX,
|
|
8
|
-
MAX_L2_TO_L1_MSGS_PER_TX,
|
|
9
|
-
MAX_NOTE_HASHES_PER_TX,
|
|
10
|
-
MAX_NULLIFIERS_PER_TX,
|
|
11
|
-
MAX_PRIVATE_LOGS_PER_TX,
|
|
12
|
-
MAX_TOTAL_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX,
|
|
13
|
-
NOTE_HASH_TREE_HEIGHT,
|
|
14
|
-
} from '@aztec/constants';
|
|
15
|
-
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
16
|
-
import { padArrayEnd } from '@aztec/foundation/collection';
|
|
2
|
+
import { ARCHIVE_HEIGHT, NOTE_HASH_TREE_HEIGHT } from '@aztec/constants';
|
|
17
3
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
18
4
|
import { FieldReader } from '@aztec/foundation/serialize';
|
|
19
|
-
import {
|
|
20
|
-
import
|
|
21
|
-
import { FunctionSelector, NoteSelector } from '@aztec/stdlib/abi';
|
|
22
|
-
import { PublicDataWrite } from '@aztec/stdlib/avm';
|
|
23
|
-
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
24
|
-
import { BlockHash } from '@aztec/stdlib/block';
|
|
25
|
-
import type { ContractInstance, PartialAddress } from '@aztec/stdlib/contract';
|
|
26
|
-
import { KeyValidationRequest } from '@aztec/stdlib/kernel';
|
|
27
|
-
import type { PublicKeys } from '@aztec/stdlib/keys';
|
|
28
|
-
import { ContractClassLog, ContractClassLogFields, FlatPublicLogs, PrivateLog, Tag } from '@aztec/stdlib/logs';
|
|
29
|
-
import { NullifierMembershipWitness, PublicDataWitness } from '@aztec/stdlib/trees';
|
|
30
|
-
import { BlockHeader, TxEffect, TxHash } from '@aztec/stdlib/tx';
|
|
31
|
-
|
|
32
|
-
import { BoundedVec } from '../noir-structs/bounded_vec.js';
|
|
33
|
-
import { Option } from '../noir-structs/option.js';
|
|
34
|
-
import { UtilityContext } from '../noir-structs/utility_context.js';
|
|
35
|
-
import type { NoteData } from './interfaces.js';
|
|
36
|
-
import { MessageLoadOracleInputs } from './message_load_oracle_inputs.js';
|
|
37
|
-
import { packAsHintedNote } from './note_packing_utils.js';
|
|
38
|
-
|
|
39
|
-
const FIELD: TypeMapping<Fr> = {
|
|
40
|
-
serialization: { fn: v => [v] },
|
|
41
|
-
deserialization: { fn: ([reader]) => reader.readField(), slots: 1 },
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
const BOOL: TypeMapping<boolean> = {
|
|
45
|
-
serialization: { fn: v => [new Fr(v ? 1n : 0n)] },
|
|
46
|
-
deserialization: { fn: ([reader]) => !reader.readField().isZero(), slots: 1 },
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
export const U32: TypeMapping<number> = {
|
|
50
|
-
serialization: { fn: v => [new Fr(v)] },
|
|
51
|
-
deserialization: {
|
|
52
|
-
fn: ([reader]) => {
|
|
53
|
-
const value = reader.readField().toBigInt();
|
|
54
|
-
if (value > 0xffffffffn) {
|
|
55
|
-
throw new Error(`U32 overflow: value ${value} exceeds u32 max (${0xffffffffn})`);
|
|
56
|
-
}
|
|
57
|
-
return Number(value);
|
|
58
|
-
},
|
|
59
|
-
slots: 1,
|
|
60
|
-
},
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
const BLOCK_NUMBER: TypeMapping<BlockNumber> = {
|
|
64
|
-
serialization: { fn: v => [new Fr(v)] },
|
|
65
|
-
deserialization: { fn: ([reader]) => BlockNumber(reader.readField().toNumber()), slots: 1 },
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
/** A u8 byte: serializes to a single Fr; deserializes from a single Fr to a number in [0, 255]. */
|
|
69
|
-
export const BYTE: TypeMapping<number> = {
|
|
70
|
-
serialization: { fn: byte => [new Fr(byte)] },
|
|
71
|
-
deserialization: {
|
|
72
|
-
fn: ([reader]) => {
|
|
73
|
-
const value = reader.readField().toBigInt();
|
|
74
|
-
if (value > 0xffn) {
|
|
75
|
-
throw new Error(`BYTE overflow: value ${value} exceeds u8 max (255)`);
|
|
76
|
-
}
|
|
77
|
-
return Number(value);
|
|
78
|
-
},
|
|
79
|
-
slots: 1,
|
|
80
|
-
},
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
/** Reads every field in the slot as a UTF-8 character code. */
|
|
84
|
-
const STR: TypeMapping<string> = {
|
|
85
|
-
serialization: { fn: str => [Array.from(Buffer.from(str, 'utf-8')).map(b => new Fr(b))] },
|
|
86
|
-
deserialization: {
|
|
87
|
-
fn: ([reader]) => {
|
|
88
|
-
const chars: string[] = [];
|
|
89
|
-
while (!reader.isFinished()) {
|
|
90
|
-
chars.push(String.fromCharCode(reader.readField().toNumber()));
|
|
91
|
-
}
|
|
92
|
-
return chars.join('');
|
|
93
|
-
},
|
|
94
|
-
slots: 1,
|
|
95
|
-
},
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
const AZTEC_ADDRESS: TypeMapping<AztecAddress> = {
|
|
99
|
-
serialization: { fn: v => [v.toField()] },
|
|
100
|
-
deserialization: { fn: ([reader]) => AztecAddress.fromField(reader.readField()), slots: 1 },
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
const BLOCK_HASH: TypeMapping<BlockHash> = {
|
|
104
|
-
serialization: { fn: v => [new Fr(v.toBuffer())] },
|
|
105
|
-
deserialization: { fn: ([reader]) => new BlockHash(reader.readField()), slots: 1 },
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
const FUNCTION_SELECTOR: TypeMapping<FunctionSelector> = {
|
|
109
|
-
serialization: { fn: v => [v.toField()] },
|
|
110
|
-
deserialization: { fn: ([reader]) => FunctionSelector.fromField(reader.readField()), slots: 1 },
|
|
111
|
-
};
|
|
112
|
-
|
|
113
|
-
const NOTE_SELECTOR: TypeMapping<NoteSelector> = {
|
|
114
|
-
serialization: { fn: v => [v.toField()] },
|
|
115
|
-
deserialization: { fn: ([reader]) => NoteSelector.fromField(reader.readField()), slots: 1 },
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
const TX_HASH: TypeMapping<TxHash> = {
|
|
119
|
-
serialization: { fn: v => [v.hash] },
|
|
120
|
-
deserialization: { fn: ([reader]) => TxHash.fromField(reader.readField()), slots: 1 },
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
const TAG: TypeMapping<Tag> = {
|
|
124
|
-
serialization: { fn: v => [v.value] },
|
|
125
|
-
deserialization: { fn: ([reader]) => new Tag(reader.readField()), slots: 1 },
|
|
126
|
-
};
|
|
127
|
-
|
|
128
|
-
const BLOCK_HEADER: TypeMapping<BlockHeader> = {
|
|
129
|
-
serialization: { fn: v => v.toFields() },
|
|
130
|
-
deserialization: { fn: ([reader]) => BlockHeader.fromFields(reader.readFieldArray(BLOCK_HEADER_LENGTH)), slots: 1 },
|
|
131
|
-
};
|
|
132
|
-
|
|
133
|
-
const KEY_VALIDATION_REQUEST: TypeMapping<KeyValidationRequest> = {
|
|
134
|
-
serialization: { fn: v => v.toFields() },
|
|
135
|
-
deserialization: {
|
|
136
|
-
fn: ([reader]) => KeyValidationRequest.fromFields(reader.readFieldArray(KEY_VALIDATION_REQUEST_LENGTH)),
|
|
137
|
-
slots: 1,
|
|
138
|
-
},
|
|
139
|
-
};
|
|
140
|
-
|
|
141
|
-
const CONTRACT_INSTANCE: TypeMapping<ContractInstance> = {
|
|
142
|
-
serialization: {
|
|
143
|
-
fn: v => [
|
|
144
|
-
v.salt,
|
|
145
|
-
v.deployer.toField(),
|
|
146
|
-
v.currentContractClassId,
|
|
147
|
-
v.initializationHash,
|
|
148
|
-
v.immutablesHash,
|
|
149
|
-
...v.publicKeys.toFields(),
|
|
150
|
-
],
|
|
151
|
-
},
|
|
152
|
-
};
|
|
153
|
-
|
|
154
|
-
const NULLIFIER_MEMBERSHIP_WITNESS: TypeMapping<NullifierMembershipWitness> = {
|
|
155
|
-
serialization: {
|
|
156
|
-
fn: (w: NullifierMembershipWitness) =>
|
|
157
|
-
w
|
|
158
|
-
.toNoirRepresentation()
|
|
159
|
-
.map(slot => (Array.isArray(slot) ? slot.map(s => Fr.fromString(s)) : Fr.fromString(slot as string))),
|
|
160
|
-
},
|
|
161
|
-
};
|
|
162
|
-
|
|
163
|
-
const PUBLIC_DATA_WITNESS: TypeMapping<PublicDataWitness> = {
|
|
164
|
-
serialization: {
|
|
165
|
-
fn: (w: PublicDataWitness) =>
|
|
166
|
-
w
|
|
167
|
-
.toNoirRepresentation()
|
|
168
|
-
.map(slot => (Array.isArray(slot) ? slot.map(s => Fr.fromString(s)) : Fr.fromString(slot as string))),
|
|
169
|
-
},
|
|
170
|
-
};
|
|
171
|
-
|
|
172
|
-
const MESSAGE_LOAD_ORACLE_INPUTS: TypeMapping<MessageLoadOracleInputs<typeof L1_TO_L2_MSG_TREE_HEIGHT>> = {
|
|
173
|
-
serialization: {
|
|
174
|
-
fn: (m: MessageLoadOracleInputs<typeof L1_TO_L2_MSG_TREE_HEIGHT>) =>
|
|
175
|
-
m
|
|
176
|
-
.toNoirRepresentation()
|
|
177
|
-
.map(slot => (Array.isArray(slot) ? slot.map(s => Fr.fromString(s)) : Fr.fromString(slot as string))),
|
|
178
|
-
},
|
|
179
|
-
};
|
|
180
|
-
|
|
181
|
-
const UTILITY_CONTEXT: TypeMapping<UtilityContext> = {
|
|
182
|
-
serialization: {
|
|
183
|
-
fn: (ctx: UtilityContext) => [...ctx.blockHeader.toFields(), ctx.contractAddress.toField()],
|
|
184
|
-
},
|
|
185
|
-
};
|
|
186
|
-
|
|
187
|
-
const CALL_PRIVATE_RESULT: TypeMapping<{ endSideEffectCounter: Fr; returnsHash: Fr }> = {
|
|
188
|
-
serialization: { fn: v => [[v.endSideEffectCounter, v.returnsHash]] },
|
|
189
|
-
};
|
|
190
|
-
|
|
191
|
-
const PUBLIC_KEYS_AND_PARTIAL_ADDRESS: TypeMapping<{
|
|
192
|
-
publicKeys: PublicKeys;
|
|
193
|
-
partialAddress: PartialAddress;
|
|
194
|
-
}> = {
|
|
195
|
-
serialization: {
|
|
196
|
-
fn: v => [[...v.publicKeys.toFields(), v.partialAddress]],
|
|
197
|
-
},
|
|
198
|
-
};
|
|
199
|
-
|
|
200
|
-
const CONTRACT_CLASS_LOG_INPUT: TypeMapping<ContractClassLog> = {
|
|
201
|
-
deserialization: {
|
|
202
|
-
fn: ([addrReader, fieldsReader, lengthReader]) => {
|
|
203
|
-
const addr = AztecAddress.fromField(addrReader.readField());
|
|
204
|
-
const fields = new ContractClassLogFields([...fieldsReader.readFieldArray(fieldsReader.remainingFields())]);
|
|
205
|
-
const length = lengthReader.readField().toNumber();
|
|
206
|
-
return new ContractClassLog(addr, fields, length);
|
|
207
|
-
},
|
|
208
|
-
// ContractClassLog input occupies 3 ACVM slots: [contractAddress], [message fields...], [length].
|
|
209
|
-
slots: 3,
|
|
210
|
-
},
|
|
211
|
-
};
|
|
5
|
+
import { toACVMField } from '@aztec/simulator/client';
|
|
6
|
+
import type { UnsiloedMessageNullifier } from '@aztec/stdlib/messaging';
|
|
212
7
|
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
8
|
+
import {
|
|
9
|
+
ARRAY,
|
|
10
|
+
AZTEC_ADDRESS,
|
|
11
|
+
BLOCK_HASH,
|
|
12
|
+
BLOCK_HEADER,
|
|
13
|
+
BLOCK_NUMBER,
|
|
14
|
+
BOOL,
|
|
15
|
+
BOUNDED_VEC,
|
|
16
|
+
CALL_PRIVATE_RESULT,
|
|
17
|
+
CONTRACT_CLASS_LOG,
|
|
18
|
+
CONTRACT_INSTANCE,
|
|
19
|
+
DELIVERY_MODE,
|
|
20
|
+
EPHEMERAL_ARRAY,
|
|
21
|
+
EVENT_VALIDATION_REQUEST,
|
|
22
|
+
FACT_COLLECTION,
|
|
23
|
+
FIELD,
|
|
24
|
+
FIXED_ARRAY,
|
|
25
|
+
FUNCTION_SELECTOR,
|
|
26
|
+
type InputSlot,
|
|
27
|
+
KEY_VALIDATION_REQUEST,
|
|
28
|
+
LOG_RETRIEVAL_REQUEST,
|
|
29
|
+
LOG_RETRIEVAL_RESPONSE,
|
|
30
|
+
MEMBERSHIP_WITNESS,
|
|
31
|
+
MESSAGE_LOAD_ORACLE_INPUTS,
|
|
32
|
+
type MaybePromise,
|
|
33
|
+
NOTE,
|
|
34
|
+
NOTE_SELECTOR,
|
|
35
|
+
NOTE_VALIDATION_REQUEST,
|
|
36
|
+
NULLIFIER_MEMBERSHIP_WITNESS,
|
|
37
|
+
OPTION,
|
|
38
|
+
ORIGIN_BLOCK,
|
|
39
|
+
type OutputSlot,
|
|
40
|
+
PENDING_TAGGED_LOG,
|
|
41
|
+
POINT,
|
|
42
|
+
PROVIDED_SECRET,
|
|
43
|
+
PUBLIC_DATA_WITNESS,
|
|
44
|
+
PUBLIC_KEYS_AND_PARTIAL_ADDRESS,
|
|
45
|
+
RESOLVED_TAGGING_STRATEGY,
|
|
46
|
+
RESOLVED_TX,
|
|
47
|
+
STR,
|
|
48
|
+
STRUCT,
|
|
49
|
+
TX_EFFECT,
|
|
50
|
+
TX_HASH,
|
|
51
|
+
type TypeMapping,
|
|
52
|
+
U8,
|
|
53
|
+
U32,
|
|
54
|
+
UTILITY_CONTEXT,
|
|
55
|
+
assertReadersConsumed,
|
|
56
|
+
slotsOf,
|
|
57
|
+
} from './oracle_type_mappings.js';
|
|
58
|
+
|
|
59
|
+
export {
|
|
60
|
+
ARRAY,
|
|
61
|
+
AZTEC_ADDRESS,
|
|
62
|
+
BIGINT,
|
|
63
|
+
BLOCK_NUMBER,
|
|
64
|
+
BOOL,
|
|
65
|
+
BOUNDED_VEC,
|
|
66
|
+
U8,
|
|
67
|
+
CONTRACT_CLASS_LOG,
|
|
68
|
+
DELIVERY_MODE,
|
|
69
|
+
RESOLVED_TAGGING_STRATEGY,
|
|
70
|
+
EPHEMERAL_ARRAY,
|
|
71
|
+
EVENT_VALIDATION_REQUEST,
|
|
72
|
+
FIELD,
|
|
73
|
+
FUNCTION_SELECTOR,
|
|
74
|
+
LOG_RETRIEVAL_REQUEST,
|
|
75
|
+
LOG_RETRIEVAL_RESPONSE,
|
|
76
|
+
MEMBERSHIP_WITNESS,
|
|
77
|
+
NOTE_VALIDATION_REQUEST,
|
|
78
|
+
OPTION,
|
|
79
|
+
PENDING_TAGGED_LOG,
|
|
80
|
+
POINT,
|
|
81
|
+
PROVIDED_SECRET,
|
|
82
|
+
RESOLVED_TX,
|
|
83
|
+
STR,
|
|
84
|
+
U32,
|
|
85
|
+
slotsOf,
|
|
86
|
+
type InputSlot,
|
|
87
|
+
type MaybePromise,
|
|
88
|
+
type OutputSlot,
|
|
89
|
+
type SlotShape,
|
|
90
|
+
type TypeMapping,
|
|
91
|
+
} from './oracle_type_mappings.js';
|
|
92
|
+
|
|
93
|
+
export const ORACLE_REGISTRY = {
|
|
94
|
+
aztec_misc_assertCompatibleOracleVersion: makeEntry({
|
|
259
95
|
params: [
|
|
260
96
|
{ name: 'major', type: U32 },
|
|
261
97
|
{ name: 'minor', type: U32 },
|
|
262
98
|
],
|
|
263
99
|
}),
|
|
264
100
|
|
|
265
|
-
|
|
101
|
+
aztec_misc_getRandomField: makeEntry({ returnType: FIELD }),
|
|
266
102
|
|
|
267
|
-
|
|
103
|
+
aztec_misc_log: makeEntry({
|
|
268
104
|
params: [
|
|
269
105
|
{ name: 'level', type: U32 },
|
|
270
106
|
{ name: 'message', type: STR },
|
|
@@ -276,7 +112,10 @@ const ORACLE_REGISTRY = {
|
|
|
276
112
|
aztec_utl_getUtilityContext: makeEntry({ returnType: UTILITY_CONTEXT }),
|
|
277
113
|
|
|
278
114
|
aztec_utl_getKeyValidationRequest: makeEntry({
|
|
279
|
-
params: [
|
|
115
|
+
params: [
|
|
116
|
+
{ name: 'pkMHash', type: FIELD },
|
|
117
|
+
{ name: 'keyIndex', type: FIELD },
|
|
118
|
+
],
|
|
280
119
|
returnType: KEY_VALIDATION_REQUEST,
|
|
281
120
|
}),
|
|
282
121
|
|
|
@@ -301,6 +140,14 @@ const ORACLE_REGISTRY = {
|
|
|
301
140
|
returnType: OPTION(MEMBERSHIP_WITNESS(ARCHIVE_HEIGHT)),
|
|
302
141
|
}),
|
|
303
142
|
|
|
143
|
+
aztec_utl_areBlockHashesInArchive: makeEntry({
|
|
144
|
+
params: [
|
|
145
|
+
{ name: 'anchorBlockHash', type: BLOCK_HASH },
|
|
146
|
+
{ name: 'blockHashes', type: EPHEMERAL_ARRAY(BLOCK_HASH) },
|
|
147
|
+
],
|
|
148
|
+
returnType: EPHEMERAL_ARRAY(BOOL),
|
|
149
|
+
}),
|
|
150
|
+
|
|
304
151
|
aztec_utl_getNullifierMembershipWitness: makeEntry({
|
|
305
152
|
params: [
|
|
306
153
|
{ name: 'blockHash', type: BLOCK_HASH },
|
|
@@ -345,11 +192,18 @@ const ORACLE_REGISTRY = {
|
|
|
345
192
|
returnType: BOOL,
|
|
346
193
|
}),
|
|
347
194
|
|
|
348
|
-
|
|
195
|
+
aztec_utl_getL1ToL2MembershipWitnessV2: makeEntry({
|
|
349
196
|
params: [
|
|
350
|
-
{ name: 'contractAddress', type: AZTEC_ADDRESS },
|
|
351
197
|
{ name: 'messageHash', type: FIELD },
|
|
352
|
-
{
|
|
198
|
+
{
|
|
199
|
+
name: 'nullifier',
|
|
200
|
+
type: OPTION(
|
|
201
|
+
STRUCT<UnsiloedMessageNullifier>([
|
|
202
|
+
{ name: 'contractAddress', type: AZTEC_ADDRESS },
|
|
203
|
+
{ name: 'nullifier', type: FIELD },
|
|
204
|
+
]),
|
|
205
|
+
),
|
|
206
|
+
},
|
|
353
207
|
],
|
|
354
208
|
returnType: MESSAGE_LOAD_ORACLE_INPUTS,
|
|
355
209
|
}),
|
|
@@ -387,27 +241,30 @@ const ORACLE_REGISTRY = {
|
|
|
387
241
|
returnType: BOUNDED_VEC(NOTE),
|
|
388
242
|
}),
|
|
389
243
|
|
|
390
|
-
|
|
391
|
-
params: [
|
|
392
|
-
|
|
244
|
+
aztec_utl_getPendingTaggedLogsV2: makeEntry({
|
|
245
|
+
params: [
|
|
246
|
+
{ name: 'scope', type: AZTEC_ADDRESS },
|
|
247
|
+
{ name: 'providedSecrets', type: EPHEMERAL_ARRAY(PROVIDED_SECRET) },
|
|
248
|
+
],
|
|
249
|
+
returnType: EPHEMERAL_ARRAY(PENDING_TAGGED_LOG),
|
|
393
250
|
}),
|
|
394
251
|
|
|
395
252
|
aztec_utl_validateAndStoreEnqueuedNotesAndEvents: makeEntry({
|
|
396
253
|
params: [
|
|
397
|
-
{ name: '
|
|
398
|
-
{ name: '
|
|
254
|
+
{ name: 'noteValidationRequests', type: EPHEMERAL_ARRAY(NOTE_VALIDATION_REQUEST) },
|
|
255
|
+
{ name: 'eventValidationRequests', type: EPHEMERAL_ARRAY(EVENT_VALIDATION_REQUEST) },
|
|
399
256
|
{ name: 'scope', type: AZTEC_ADDRESS },
|
|
400
257
|
],
|
|
401
258
|
}),
|
|
402
259
|
|
|
403
|
-
|
|
404
|
-
params: [{ name: '
|
|
405
|
-
returnType:
|
|
260
|
+
aztec_utl_getLogsByTagV2: makeEntry({
|
|
261
|
+
params: [{ name: 'requests', type: EPHEMERAL_ARRAY(LOG_RETRIEVAL_REQUEST) }],
|
|
262
|
+
returnType: EPHEMERAL_ARRAY(EPHEMERAL_ARRAY(LOG_RETRIEVAL_RESPONSE)),
|
|
406
263
|
}),
|
|
407
264
|
|
|
408
|
-
|
|
409
|
-
params: [{ name: '
|
|
410
|
-
returnType:
|
|
265
|
+
aztec_utl_getResolvedTxs: makeEntry({
|
|
266
|
+
params: [{ name: 'requests', type: EPHEMERAL_ARRAY(FIELD) }],
|
|
267
|
+
returnType: EPHEMERAL_ARRAY(OPTION(RESOLVED_TX)),
|
|
411
268
|
}),
|
|
412
269
|
|
|
413
270
|
aztec_utl_getTxEffect: makeEntry({
|
|
@@ -415,6 +272,11 @@ const ORACLE_REGISTRY = {
|
|
|
415
272
|
returnType: OPTION(TX_EFFECT),
|
|
416
273
|
}),
|
|
417
274
|
|
|
275
|
+
aztec_utl_getTxEffects: makeEntry({
|
|
276
|
+
params: [{ name: 'txHashes', type: EPHEMERAL_ARRAY(TX_HASH) }],
|
|
277
|
+
returnType: EPHEMERAL_ARRAY(OPTION(TX_EFFECT)),
|
|
278
|
+
}),
|
|
279
|
+
|
|
418
280
|
aztec_utl_setCapsule: makeEntry({
|
|
419
281
|
params: [
|
|
420
282
|
{ name: 'contractAddress', type: AZTEC_ADDRESS },
|
|
@@ -454,20 +316,20 @@ const ORACLE_REGISTRY = {
|
|
|
454
316
|
|
|
455
317
|
aztec_utl_decryptAes128: makeEntry({
|
|
456
318
|
params: [
|
|
457
|
-
{ name: 'ciphertext', type: BOUNDED_VEC(
|
|
458
|
-
{ name: 'iv', type:
|
|
459
|
-
{ name: 'symKey', type:
|
|
319
|
+
{ name: 'ciphertext', type: BOUNDED_VEC(U8) },
|
|
320
|
+
{ name: 'iv', type: FIXED_ARRAY(U8, 16) },
|
|
321
|
+
{ name: 'symKey', type: FIXED_ARRAY(U8, 16) },
|
|
460
322
|
],
|
|
461
|
-
returnType: OPTION(BOUNDED_VEC(
|
|
323
|
+
returnType: OPTION(BOUNDED_VEC(U8)),
|
|
462
324
|
}),
|
|
463
325
|
|
|
464
326
|
aztec_utl_getSharedSecrets: makeEntry({
|
|
465
327
|
params: [
|
|
466
328
|
{ name: 'address', type: AZTEC_ADDRESS },
|
|
467
|
-
{ name: '
|
|
329
|
+
{ name: 'ephPks', type: EPHEMERAL_ARRAY(POINT) },
|
|
468
330
|
{ name: 'contractAddress', type: AZTEC_ADDRESS },
|
|
469
331
|
],
|
|
470
|
-
returnType: FIELD,
|
|
332
|
+
returnType: EPHEMERAL_ARRAY(FIELD),
|
|
471
333
|
}),
|
|
472
334
|
|
|
473
335
|
aztec_utl_setContractSyncCacheInvalid: makeEntry({
|
|
@@ -481,6 +343,46 @@ const ORACLE_REGISTRY = {
|
|
|
481
343
|
params: [{ name: 'data', type: ARRAY(FIELD) }],
|
|
482
344
|
}),
|
|
483
345
|
|
|
346
|
+
aztec_utl_recordFact: makeEntry({
|
|
347
|
+
params: [
|
|
348
|
+
{ name: 'contractAddress', type: AZTEC_ADDRESS },
|
|
349
|
+
{ name: 'scope', type: AZTEC_ADDRESS },
|
|
350
|
+
{ name: 'factCollectionTypeId', type: FIELD },
|
|
351
|
+
{ name: 'factCollectionId', type: FIELD },
|
|
352
|
+
{ name: 'factTypeId', type: FIELD },
|
|
353
|
+
{ name: 'payload', type: EPHEMERAL_ARRAY(FIELD) },
|
|
354
|
+
{ name: 'originBlock', type: OPTION(ORIGIN_BLOCK) },
|
|
355
|
+
],
|
|
356
|
+
}),
|
|
357
|
+
|
|
358
|
+
aztec_utl_deleteFactCollection: makeEntry({
|
|
359
|
+
params: [
|
|
360
|
+
{ name: 'contractAddress', type: AZTEC_ADDRESS },
|
|
361
|
+
{ name: 'scope', type: AZTEC_ADDRESS },
|
|
362
|
+
{ name: 'factCollectionTypeId', type: FIELD },
|
|
363
|
+
{ name: 'factCollectionId', type: FIELD },
|
|
364
|
+
],
|
|
365
|
+
}),
|
|
366
|
+
|
|
367
|
+
aztec_utl_getFactCollection: makeEntry({
|
|
368
|
+
params: [
|
|
369
|
+
{ name: 'contractAddress', type: AZTEC_ADDRESS },
|
|
370
|
+
{ name: 'scope', type: AZTEC_ADDRESS },
|
|
371
|
+
{ name: 'factCollectionTypeId', type: FIELD },
|
|
372
|
+
{ name: 'factCollectionId', type: FIELD },
|
|
373
|
+
],
|
|
374
|
+
returnType: OPTION(FACT_COLLECTION),
|
|
375
|
+
}),
|
|
376
|
+
|
|
377
|
+
aztec_utl_getFactCollectionsByType: makeEntry({
|
|
378
|
+
params: [
|
|
379
|
+
{ name: 'contractAddress', type: AZTEC_ADDRESS },
|
|
380
|
+
{ name: 'scope', type: AZTEC_ADDRESS },
|
|
381
|
+
{ name: 'factCollectionTypeId', type: FIELD },
|
|
382
|
+
],
|
|
383
|
+
returnType: EPHEMERAL_ARRAY(FACT_COLLECTION),
|
|
384
|
+
}),
|
|
385
|
+
|
|
484
386
|
aztec_utl_callUtilityFunction: makeEntry({
|
|
485
387
|
params: [
|
|
486
388
|
{ name: 'contractAddress', type: AZTEC_ADDRESS },
|
|
@@ -535,6 +437,51 @@ const ORACLE_REGISTRY = {
|
|
|
535
437
|
params: [{ name: 'slot', type: FIELD }],
|
|
536
438
|
}),
|
|
537
439
|
|
|
440
|
+
aztec_utl_pushTransient: makeEntry({
|
|
441
|
+
params: [
|
|
442
|
+
{ name: 'slot', type: FIELD },
|
|
443
|
+
{ name: 'elements', type: ARRAY(FIELD) },
|
|
444
|
+
],
|
|
445
|
+
returnType: U32,
|
|
446
|
+
}),
|
|
447
|
+
|
|
448
|
+
aztec_utl_popTransient: makeEntry({
|
|
449
|
+
params: [{ name: 'slot', type: FIELD }],
|
|
450
|
+
returnType: ARRAY(FIELD),
|
|
451
|
+
}),
|
|
452
|
+
|
|
453
|
+
aztec_utl_getTransient: makeEntry({
|
|
454
|
+
params: [
|
|
455
|
+
{ name: 'slot', type: FIELD },
|
|
456
|
+
{ name: 'index', type: U32 },
|
|
457
|
+
],
|
|
458
|
+
returnType: ARRAY(FIELD),
|
|
459
|
+
}),
|
|
460
|
+
|
|
461
|
+
aztec_utl_setTransient: makeEntry({
|
|
462
|
+
params: [
|
|
463
|
+
{ name: 'slot', type: FIELD },
|
|
464
|
+
{ name: 'index', type: U32 },
|
|
465
|
+
{ name: 'elements', type: ARRAY(FIELD) },
|
|
466
|
+
],
|
|
467
|
+
}),
|
|
468
|
+
|
|
469
|
+
aztec_utl_getTransientLen: makeEntry({
|
|
470
|
+
params: [{ name: 'slot', type: FIELD }],
|
|
471
|
+
returnType: U32,
|
|
472
|
+
}),
|
|
473
|
+
|
|
474
|
+
aztec_utl_removeTransient: makeEntry({
|
|
475
|
+
params: [
|
|
476
|
+
{ name: 'slot', type: FIELD },
|
|
477
|
+
{ name: 'index', type: U32 },
|
|
478
|
+
],
|
|
479
|
+
}),
|
|
480
|
+
|
|
481
|
+
aztec_utl_clearTransient: makeEntry({
|
|
482
|
+
params: [{ name: 'slot', type: FIELD }],
|
|
483
|
+
}),
|
|
484
|
+
|
|
538
485
|
aztec_prv_setHashPreimage: makeEntry({
|
|
539
486
|
params: [
|
|
540
487
|
{ name: 'values', type: ARRAY(FIELD) },
|
|
@@ -581,7 +528,7 @@ const ORACLE_REGISTRY = {
|
|
|
581
528
|
|
|
582
529
|
aztec_prv_notifyCreatedContractClassLog: makeEntry({
|
|
583
530
|
params: [
|
|
584
|
-
{ name: 'log', type:
|
|
531
|
+
{ name: 'log', type: CONTRACT_CLASS_LOG },
|
|
585
532
|
{ name: 'counter', type: U32 },
|
|
586
533
|
],
|
|
587
534
|
}),
|
|
@@ -610,74 +557,43 @@ const ORACLE_REGISTRY = {
|
|
|
610
557
|
returnType: BOOL,
|
|
611
558
|
}),
|
|
612
559
|
|
|
613
|
-
|
|
560
|
+
aztec_prv_getAppTaggingSecret: makeEntry({
|
|
614
561
|
params: [
|
|
615
562
|
{ name: 'sender', type: AZTEC_ADDRESS },
|
|
616
563
|
{ name: 'recipient', type: AZTEC_ADDRESS },
|
|
617
564
|
],
|
|
618
|
-
returnType:
|
|
565
|
+
returnType: OPTION(FIELD),
|
|
619
566
|
}),
|
|
620
567
|
|
|
621
|
-
|
|
622
|
-
params: [
|
|
568
|
+
aztec_prv_getNextTaggingIndex: makeEntry({
|
|
569
|
+
params: [
|
|
570
|
+
{ name: 'secret', type: FIELD },
|
|
571
|
+
{ name: 'deliveryMode', type: DELIVERY_MODE },
|
|
572
|
+
],
|
|
623
573
|
returnType: U32,
|
|
624
574
|
}),
|
|
625
575
|
|
|
626
576
|
aztec_prv_getSenderForTags: makeEntry({ returnType: OPTION(AZTEC_ADDRESS) }),
|
|
627
|
-
} satisfies Record<string, OracleRegistryEntry>;
|
|
628
577
|
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
}
|
|
637
|
-
oracle: K;
|
|
638
|
-
inputs: InputSlot[];
|
|
639
|
-
handler: (
|
|
640
|
-
params: ParamTypes<ReturnType<(typeof ORACLE_REGISTRY)[K]['deserializeParams']>>,
|
|
641
|
-
) => MaybePromise<Parameters<(typeof ORACLE_REGISTRY)[K]['serializeReturn']>[0]>;
|
|
642
|
-
}): Promise<OutputSlot[]> {
|
|
643
|
-
const entry = ORACLE_REGISTRY[oracle] as OracleRegistryEntry;
|
|
644
|
-
const named = entry.deserializeParams(inputs);
|
|
645
|
-
const positional = named.map(p => p.value);
|
|
646
|
-
const result = await handler(positional as any);
|
|
647
|
-
return entry.serializeReturn(result);
|
|
648
|
-
}
|
|
649
|
-
|
|
650
|
-
// ─── Helper Types ─────────────────────────────────────────────────────────────
|
|
651
|
-
|
|
652
|
-
/** One ACVM input slot: an array of hex-encoded field strings. */
|
|
653
|
-
type InputSlot = ACVMField[];
|
|
578
|
+
aztec_prv_resolveTaggingStrategy: makeEntry({
|
|
579
|
+
params: [
|
|
580
|
+
{ name: 'sender', type: AZTEC_ADDRESS },
|
|
581
|
+
{ name: 'recipient', type: AZTEC_ADDRESS },
|
|
582
|
+
{ name: 'deliveryMode', type: DELIVERY_MODE },
|
|
583
|
+
],
|
|
584
|
+
returnType: RESOLVED_TAGGING_STRATEGY,
|
|
585
|
+
}),
|
|
654
586
|
|
|
655
|
-
|
|
656
|
-
|
|
587
|
+
aztec_prv_resolveCustomRequest: makeEntry({
|
|
588
|
+
params: [
|
|
589
|
+
{ name: 'kind', type: FIELD },
|
|
590
|
+
{ name: 'payload', type: ARRAY(FIELD) },
|
|
591
|
+
],
|
|
592
|
+
returnType: ARRAY(FIELD),
|
|
593
|
+
}),
|
|
594
|
+
} satisfies Record<string, OracleRegistryEntry>;
|
|
657
595
|
|
|
658
|
-
|
|
659
|
-
* Describes how to serialize and/or deserialize a single typed value to/from ACVM wire format.
|
|
660
|
-
* Either side is optional — output-only types omit `deserialization`, input-only types omit `serialization`.
|
|
661
|
-
*/
|
|
662
|
-
export interface TypeMapping<T = any> {
|
|
663
|
-
serialization?: {
|
|
664
|
-
/** Convert a typed value to ACVM output slot(s). */
|
|
665
|
-
fn: (value: T) => (Fr | Fr[])[];
|
|
666
|
-
};
|
|
667
|
-
deserialization?: {
|
|
668
|
-
/** Read a typed value from one FieldReader per consumed slot. */
|
|
669
|
-
fn: (readers: FieldReader[]) => T;
|
|
670
|
-
/**
|
|
671
|
-
* Number of InputSlots this type reads from. `deserialization.fn` receives one FieldReader per slot in `readers`.
|
|
672
|
-
*
|
|
673
|
-
* Examples:
|
|
674
|
-
* - `FIELD`, `U32`, `AZTEC_ADDRESS` — single slot → `slots: 1`
|
|
675
|
-
* - `OPTION(T)` — discriminant + inner slots → `slots: T.slots + 1`
|
|
676
|
-
* - `CONTRACT_CLASS_LOG_INPUT` — [addr], [fields], [len] → `slots: 3`
|
|
677
|
-
*/
|
|
678
|
-
slots: number;
|
|
679
|
-
};
|
|
680
|
-
}
|
|
596
|
+
// ─── Registry Infrastructure ─────────────────────────────────────────────────
|
|
681
597
|
|
|
682
598
|
/**
|
|
683
599
|
* A full oracle registry entry describing param and return serialization.
|
|
@@ -685,7 +601,7 @@ export interface TypeMapping<T = any> {
|
|
|
685
601
|
* TDeserializedParams — the array of named pairs returned by `deserializeParams`.
|
|
686
602
|
* TReturnValue — the typed handler return value consumed by `serializeReturn`.
|
|
687
603
|
*/
|
|
688
|
-
interface OracleRegistryEntry<
|
|
604
|
+
export interface OracleRegistryEntry<
|
|
689
605
|
TDeserializedParams extends readonly NamedValue[] = readonly NamedValue[],
|
|
690
606
|
TReturnValue = any,
|
|
691
607
|
> {
|
|
@@ -693,9 +609,13 @@ interface OracleRegistryEntry<
|
|
|
693
609
|
deserializeParams(inputs: InputSlot[]): TDeserializedParams;
|
|
694
610
|
/** Serialize a handler return value into ACVM output slots. */
|
|
695
611
|
serializeReturn(result: TReturnValue): OutputSlot[];
|
|
612
|
+
/** The ordered named parameters with their {@link TypeMapping}s. Lets callers introspect the oracle's wire ABI. */
|
|
613
|
+
readonly params: readonly RegistryParam[];
|
|
614
|
+
/** The return {@link TypeMapping}, or `undefined` for oracles that return nothing. */
|
|
615
|
+
readonly returnType?: TypeMapping<TReturnValue>;
|
|
696
616
|
}
|
|
697
617
|
|
|
698
|
-
function makeEntry<const TParams extends RegistryParam[] = [], TReturnValue = void>({
|
|
618
|
+
export function makeEntry<const TParams extends RegistryParam[] = [], TReturnValue = void>({
|
|
699
619
|
params,
|
|
700
620
|
returnType,
|
|
701
621
|
}: {
|
|
@@ -703,23 +623,34 @@ function makeEntry<const TParams extends RegistryParam[] = [], TReturnValue = vo
|
|
|
703
623
|
returnType?: TypeMapping<TReturnValue>;
|
|
704
624
|
} = {}): OracleRegistryEntry<InferDeserializedParams<TParams>, TReturnValue> {
|
|
705
625
|
return {
|
|
626
|
+
params: params ?? [],
|
|
627
|
+
returnType,
|
|
706
628
|
deserializeParams(inputs: InputSlot[]): InferDeserializedParams<TParams> {
|
|
707
629
|
const resolvedParams: RegistryParam[] = params ?? [];
|
|
708
630
|
// Walk the input slots left-to-right, advancing by each param's slot count.
|
|
709
631
|
let offset = 0;
|
|
710
|
-
|
|
632
|
+
const named = resolvedParams.map(param => {
|
|
711
633
|
if (!param.type.deserialization) {
|
|
712
634
|
throw new Error(`Param '${param.name}' has no deserialization defined`);
|
|
713
635
|
}
|
|
714
636
|
// Collect the slots for this param and wrap each in a FieldReader.
|
|
715
|
-
const slotCount = param.type
|
|
637
|
+
const slotCount = slotsOf(param.type);
|
|
716
638
|
const readers = inputs
|
|
717
639
|
.slice(offset, offset + slotCount)
|
|
718
640
|
.map(slot => new FieldReader(slot.map(hex => Fr.fromString(hex))));
|
|
719
641
|
offset += slotCount;
|
|
720
|
-
// Delegate to the TypeMapping's deserializer
|
|
721
|
-
|
|
722
|
-
|
|
642
|
+
// Delegate to the TypeMapping's deserializer, assert the param's slots are fully consumed, and tag the
|
|
643
|
+
// result with the param name.
|
|
644
|
+
const value = param.type.deserialization.fn(readers);
|
|
645
|
+
assertReadersConsumed(readers);
|
|
646
|
+
return { name: param.name, value };
|
|
647
|
+
});
|
|
648
|
+
// Every input slot must be specified by a param: oracles whose Noir decl passes an extra field must declare it
|
|
649
|
+
// (the handler can ignore it). Otherwise an under-declared shape would silently drop a field into nothing.
|
|
650
|
+
if (offset !== inputs.length) {
|
|
651
|
+
throw new Error(`Oracle received ${inputs.length} input slot(s) but the registry specifies ${offset}`);
|
|
652
|
+
}
|
|
653
|
+
return named as unknown as InferDeserializedParams<TParams>;
|
|
723
654
|
},
|
|
724
655
|
serializeReturn(result: TReturnValue): OutputSlot[] {
|
|
725
656
|
if (returnType?.serialization === undefined) {
|
|
@@ -732,152 +663,14 @@ function makeEntry<const TParams extends RegistryParam[] = [], TReturnValue = vo
|
|
|
732
663
|
};
|
|
733
664
|
}
|
|
734
665
|
|
|
735
|
-
/** `_height` is unused at runtime but lets TypeScript infer the exact `N` for `MembershipWitness<N>`. */
|
|
736
|
-
function MEMBERSHIP_WITNESS<N extends number>(_height: N): TypeMapping<MembershipWitness<N>> {
|
|
737
|
-
return {
|
|
738
|
-
serialization: {
|
|
739
|
-
fn: (witness: MembershipWitness<N>) => [new Fr(witness.leafIndex), [...witness.siblingPath]],
|
|
740
|
-
},
|
|
741
|
-
};
|
|
742
|
-
}
|
|
743
|
-
|
|
744
|
-
function ARRAY<T>(element: TypeMapping<T>): TypeMapping<T[]> {
|
|
745
|
-
return {
|
|
746
|
-
serialization: element.serialization
|
|
747
|
-
? { fn: values => [values.flatMap(v => element.serialization!.fn(v).flat())] }
|
|
748
|
-
: undefined,
|
|
749
|
-
deserialization: element.deserialization
|
|
750
|
-
? {
|
|
751
|
-
fn: ([reader]) => {
|
|
752
|
-
const result: T[] = [];
|
|
753
|
-
while (!reader.isFinished()) {
|
|
754
|
-
result.push(element.deserialization!.fn([reader]));
|
|
755
|
-
}
|
|
756
|
-
return result;
|
|
757
|
-
},
|
|
758
|
-
slots: 1,
|
|
759
|
-
}
|
|
760
|
-
: undefined,
|
|
761
|
-
};
|
|
762
|
-
}
|
|
763
|
-
|
|
764
|
-
/**
|
|
765
|
-
* Maps Noir's `BoundedVec<T, MaxLen>` ↔ TS `BoundedVec<T>` over 2 slots:
|
|
766
|
-
* slot 0 — flat storage, padded/parsed as `maxLength * elementSize` fields
|
|
767
|
-
* slot 1 — length scalar (count of actual items)
|
|
768
|
-
*
|
|
769
|
-
* Both directions are derived from `element`: bidirectional iff `element` has both serialization and deserialization.
|
|
770
|
-
*
|
|
771
|
-
* @example Serializing `BoundedVec.from({ data: [0x41, 0x42], maxLength: 4 })` with `BOUNDED_VEC(BYTE)`:
|
|
772
|
-
* ```
|
|
773
|
-
* slot 0: [Fr(0x41), Fr(0x42), Fr(0), Fr(0)] // data padded to maxLength
|
|
774
|
-
* slot 1: Fr(2) // actual length
|
|
775
|
-
* ```
|
|
776
|
-
*/
|
|
777
|
-
function BOUNDED_VEC<T>(element: TypeMapping<T>): TypeMapping<BoundedVec<T>> {
|
|
778
|
-
return {
|
|
779
|
-
serialization: element.serialization
|
|
780
|
-
? {
|
|
781
|
-
fn: bv => {
|
|
782
|
-
if (bv.data.length > bv.maxLength) {
|
|
783
|
-
throw new Error(`Got ${bv.data.length} items, but maxLength is ${bv.maxLength}`);
|
|
784
|
-
}
|
|
785
|
-
const flat = bv.data.flatMap(item => element.serialization!.fn(item).flat());
|
|
786
|
-
return [padArrayEnd(flat, Fr.ZERO, bv.maxLength * bv.elementSize), new Fr(bv.data.length)];
|
|
787
|
-
},
|
|
788
|
-
}
|
|
789
|
-
: undefined,
|
|
790
|
-
deserialization: element.deserialization
|
|
791
|
-
? {
|
|
792
|
-
fn: ([storageReader, lengthReader]) => {
|
|
793
|
-
const maxLength = storageReader.remainingFields();
|
|
794
|
-
const length = lengthReader.readField().toNumber();
|
|
795
|
-
const elements: T[] = [];
|
|
796
|
-
for (let i = 0; i < length; i++) {
|
|
797
|
-
elements.push(element.deserialization!.fn([storageReader]));
|
|
798
|
-
}
|
|
799
|
-
return BoundedVec.from<T>({ data: elements, maxLength });
|
|
800
|
-
},
|
|
801
|
-
slots: 2,
|
|
802
|
-
}
|
|
803
|
-
: undefined,
|
|
804
|
-
};
|
|
805
|
-
}
|
|
806
|
-
|
|
807
|
-
/**
|
|
808
|
-
* Wraps an inner TypeMapping in Noir-style `Option<T>`. Adds a discriminant slot and uses the handler-provided
|
|
809
|
-
* `Option.none(shape)` template to produce a correctly-sized zero-filled output for the None case.
|
|
810
|
-
*
|
|
811
|
-
* @example Serializing `Option.some(AztecAddress.fromField(Fr(42)))` with `OPTION(AZTEC_ADDRESS)`:
|
|
812
|
-
* ```
|
|
813
|
-
* slot 0: Fr(1) // discriminant: Some
|
|
814
|
-
* slot 1: Fr(42) // inner value
|
|
815
|
-
* ```
|
|
816
|
-
*
|
|
817
|
-
* @example Serializing `Option.empty(AztecAddress.ZERO)` with `OPTION(AZTEC_ADDRESS)`:
|
|
818
|
-
* ```
|
|
819
|
-
* slot 0: Fr(0) // discriminant: None
|
|
820
|
-
* slot 1: Fr(0) // zero-filled using shape
|
|
821
|
-
* ```
|
|
822
|
-
*/
|
|
823
|
-
function OPTION<T>(inner: TypeMapping<T>): TypeMapping<Option<T>> {
|
|
824
|
-
return {
|
|
825
|
-
serialization: inner.serialization
|
|
826
|
-
? {
|
|
827
|
-
fn: opt => {
|
|
828
|
-
if (opt.isSome()) {
|
|
829
|
-
return [Fr.ONE, ...inner.serialization!.fn(opt.value)];
|
|
830
|
-
}
|
|
831
|
-
if (opt.template === undefined) {
|
|
832
|
-
throw new Error(
|
|
833
|
-
'Cannot serialize Option.empty() without an emptyTemplate — provide one via Option.empty(emptyTemplate)',
|
|
834
|
-
);
|
|
835
|
-
}
|
|
836
|
-
const zeroSlots = inner
|
|
837
|
-
.serialization!.fn(opt.template)
|
|
838
|
-
.map(s => (Array.isArray(s) ? Array(s.length).fill(Fr.ZERO) : Fr.ZERO));
|
|
839
|
-
return [Fr.ZERO, ...zeroSlots];
|
|
840
|
-
},
|
|
841
|
-
}
|
|
842
|
-
: undefined,
|
|
843
|
-
deserialization: inner.deserialization
|
|
844
|
-
? {
|
|
845
|
-
fn: readers => {
|
|
846
|
-
if (readers[0].readField().isZero()) {
|
|
847
|
-
return Option.none<T>(undefined as unknown as T);
|
|
848
|
-
}
|
|
849
|
-
return Option.some(inner.deserialization!.fn(readers.slice(1)));
|
|
850
|
-
},
|
|
851
|
-
slots: inner.deserialization.slots + 1,
|
|
852
|
-
}
|
|
853
|
-
: undefined,
|
|
854
|
-
};
|
|
855
|
-
}
|
|
856
|
-
|
|
857
|
-
/** A packed uint buffer (e.g. `[u8; N]` in Noir): 1 slot of packed uint values ↔ `Buffer`. */
|
|
858
|
-
function BUFFER(bitSize: number): TypeMapping<Buffer> {
|
|
859
|
-
return {
|
|
860
|
-
serialization: {
|
|
861
|
-
fn: buf => [Array.from(buf).map(b => new Fr(b))],
|
|
862
|
-
},
|
|
863
|
-
deserialization: {
|
|
864
|
-
fn: ([reader]) => {
|
|
865
|
-
const fields = reader.readFieldArray(reader.remainingFields()).map(f => f.toString());
|
|
866
|
-
return fromUintArray(fields, bitSize);
|
|
867
|
-
},
|
|
868
|
-
slots: 1,
|
|
869
|
-
},
|
|
870
|
-
};
|
|
871
|
-
}
|
|
872
|
-
|
|
873
666
|
/** A named oracle parameter with its TypeMapping. */
|
|
874
|
-
interface RegistryParam<TName extends string = string, T = any> {
|
|
667
|
+
export interface RegistryParam<TName extends string = string, T = any> {
|
|
875
668
|
name: TName;
|
|
876
669
|
type: TypeMapping<T>;
|
|
877
670
|
}
|
|
878
671
|
|
|
879
672
|
/** One named param entry from a deserializeParams result. */
|
|
880
|
-
type NamedValue<TName extends string = string, TValue = any> = { readonly name: TName; readonly value: TValue };
|
|
673
|
+
export type NamedValue<TName extends string = string, TValue = any> = { readonly name: TName; readonly value: TValue };
|
|
881
674
|
|
|
882
675
|
/**
|
|
883
676
|
* Extracts the positional type tuple from a {@link OracleRegistryEntry.deserializeParams} result,
|
|
@@ -885,7 +678,7 @@ type NamedValue<TName extends string = string, TValue = any> = { readonly name:
|
|
|
885
678
|
*
|
|
886
679
|
* @example `ParamTypes<[NamedValue<'addr', AztecAddress>, NamedValue<'slot', Fr>]>` → `[AztecAddress, Fr]`
|
|
887
680
|
*/
|
|
888
|
-
type ParamTypes<T extends readonly NamedValue[]> = {
|
|
681
|
+
export type ParamTypes<T extends readonly NamedValue[]> = {
|
|
889
682
|
[K in keyof T]: T[K] extends NamedValue<string, infer V> ? V : never;
|
|
890
683
|
};
|
|
891
684
|
|
|
@@ -897,8 +690,21 @@ type ParamTypes<T extends readonly NamedValue[]> = {
|
|
|
897
690
|
* @example `InferDeserializedParams<[RegistryParam<'addr', AztecAddress>, RegistryParam<'slot', Fr>]>`
|
|
898
691
|
* → `[NamedValue<'addr', AztecAddress>, NamedValue<'slot', Fr>]`
|
|
899
692
|
*/
|
|
900
|
-
type InferDeserializedParams<T extends RegistryParam[]> = {
|
|
693
|
+
export type InferDeserializedParams<T extends RegistryParam[]> = {
|
|
901
694
|
[K in keyof T]: T[K] extends RegistryParam<infer N, infer V> ? NamedValue<N, V> : never;
|
|
902
695
|
};
|
|
903
696
|
|
|
904
|
-
|
|
697
|
+
// ─── Derived Handler Interfaces ─────────────────────────────────────────────
|
|
698
|
+
|
|
699
|
+
/** Strips the `aztec_{scope}_` prefix from an oracle key to get the handler method name. */
|
|
700
|
+
type StripOraclePrefix<K extends string> = K extends `aztec_${string}_${infer M}` ? M : never;
|
|
701
|
+
|
|
702
|
+
/** Derives the handler function signature from a registry entry's deserialization/serialization types. */
|
|
703
|
+
type HandlerFn<E extends OracleRegistryEntry> = (
|
|
704
|
+
...args: ParamTypes<ReturnType<E['deserializeParams']>>
|
|
705
|
+
) => MaybePromise<Parameters<E['serializeReturn']>[0]>;
|
|
706
|
+
|
|
707
|
+
/** Collects all oracle handler methods for a given name prefix into a single object type. */
|
|
708
|
+
export type HandlersForPrefix<R extends Record<string, OracleRegistryEntry>, P extends string> = {
|
|
709
|
+
[K in keyof R as K extends `aztec_${P}_${string}` ? StripOraclePrefix<K & string> : never]: HandlerFn<R[K]>;
|
|
710
|
+
};
|