@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,295 +1,11 @@
|
|
|
1
|
-
/* eslint-disable camelcase */ import { ARCHIVE_HEIGHT,
|
|
2
|
-
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
3
|
-
import { padArrayEnd } from '@aztec/foundation/collection';
|
|
1
|
+
/* eslint-disable camelcase */ import { ARCHIVE_HEIGHT, NOTE_HASH_TREE_HEIGHT } from '@aztec/constants';
|
|
4
2
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
5
3
|
import { FieldReader } from '@aztec/foundation/serialize';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
import { KeyValidationRequest } from '@aztec/stdlib/kernel';
|
|
12
|
-
import { ContractClassLog, ContractClassLogFields, FlatPublicLogs, PrivateLog, Tag } from '@aztec/stdlib/logs';
|
|
13
|
-
import { BlockHeader, TxHash } from '@aztec/stdlib/tx';
|
|
14
|
-
import { BoundedVec } from '../noir-structs/bounded_vec.js';
|
|
15
|
-
import { Option } from '../noir-structs/option.js';
|
|
16
|
-
import { packAsHintedNote } from './note_packing_utils.js';
|
|
17
|
-
const FIELD = {
|
|
18
|
-
serialization: {
|
|
19
|
-
fn: (v)=>[
|
|
20
|
-
v
|
|
21
|
-
]
|
|
22
|
-
},
|
|
23
|
-
deserialization: {
|
|
24
|
-
fn: ([reader])=>reader.readField(),
|
|
25
|
-
slots: 1
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
const BOOL = {
|
|
29
|
-
serialization: {
|
|
30
|
-
fn: (v)=>[
|
|
31
|
-
new Fr(v ? 1n : 0n)
|
|
32
|
-
]
|
|
33
|
-
},
|
|
34
|
-
deserialization: {
|
|
35
|
-
fn: ([reader])=>!reader.readField().isZero(),
|
|
36
|
-
slots: 1
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
export const U32 = {
|
|
40
|
-
serialization: {
|
|
41
|
-
fn: (v)=>[
|
|
42
|
-
new Fr(v)
|
|
43
|
-
]
|
|
44
|
-
},
|
|
45
|
-
deserialization: {
|
|
46
|
-
fn: ([reader])=>{
|
|
47
|
-
const value = reader.readField().toBigInt();
|
|
48
|
-
if (value > 0xffffffffn) {
|
|
49
|
-
throw new Error(`U32 overflow: value ${value} exceeds u32 max (${0xffffffffn})`);
|
|
50
|
-
}
|
|
51
|
-
return Number(value);
|
|
52
|
-
},
|
|
53
|
-
slots: 1
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
const BLOCK_NUMBER = {
|
|
57
|
-
serialization: {
|
|
58
|
-
fn: (v)=>[
|
|
59
|
-
new Fr(v)
|
|
60
|
-
]
|
|
61
|
-
},
|
|
62
|
-
deserialization: {
|
|
63
|
-
fn: ([reader])=>BlockNumber(reader.readField().toNumber()),
|
|
64
|
-
slots: 1
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
/** A u8 byte: serializes to a single Fr; deserializes from a single Fr to a number in [0, 255]. */ export const BYTE = {
|
|
68
|
-
serialization: {
|
|
69
|
-
fn: (byte)=>[
|
|
70
|
-
new Fr(byte)
|
|
71
|
-
]
|
|
72
|
-
},
|
|
73
|
-
deserialization: {
|
|
74
|
-
fn: ([reader])=>{
|
|
75
|
-
const value = reader.readField().toBigInt();
|
|
76
|
-
if (value > 0xffn) {
|
|
77
|
-
throw new Error(`BYTE overflow: value ${value} exceeds u8 max (255)`);
|
|
78
|
-
}
|
|
79
|
-
return Number(value);
|
|
80
|
-
},
|
|
81
|
-
slots: 1
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
/** Reads every field in the slot as a UTF-8 character code. */ const STR = {
|
|
85
|
-
serialization: {
|
|
86
|
-
fn: (str)=>[
|
|
87
|
-
Array.from(Buffer.from(str, 'utf-8')).map((b)=>new Fr(b))
|
|
88
|
-
]
|
|
89
|
-
},
|
|
90
|
-
deserialization: {
|
|
91
|
-
fn: ([reader])=>{
|
|
92
|
-
const chars = [];
|
|
93
|
-
while(!reader.isFinished()){
|
|
94
|
-
chars.push(String.fromCharCode(reader.readField().toNumber()));
|
|
95
|
-
}
|
|
96
|
-
return chars.join('');
|
|
97
|
-
},
|
|
98
|
-
slots: 1
|
|
99
|
-
}
|
|
100
|
-
};
|
|
101
|
-
const AZTEC_ADDRESS = {
|
|
102
|
-
serialization: {
|
|
103
|
-
fn: (v)=>[
|
|
104
|
-
v.toField()
|
|
105
|
-
]
|
|
106
|
-
},
|
|
107
|
-
deserialization: {
|
|
108
|
-
fn: ([reader])=>AztecAddress.fromField(reader.readField()),
|
|
109
|
-
slots: 1
|
|
110
|
-
}
|
|
111
|
-
};
|
|
112
|
-
const BLOCK_HASH = {
|
|
113
|
-
serialization: {
|
|
114
|
-
fn: (v)=>[
|
|
115
|
-
new Fr(v.toBuffer())
|
|
116
|
-
]
|
|
117
|
-
},
|
|
118
|
-
deserialization: {
|
|
119
|
-
fn: ([reader])=>new BlockHash(reader.readField()),
|
|
120
|
-
slots: 1
|
|
121
|
-
}
|
|
122
|
-
};
|
|
123
|
-
const FUNCTION_SELECTOR = {
|
|
124
|
-
serialization: {
|
|
125
|
-
fn: (v)=>[
|
|
126
|
-
v.toField()
|
|
127
|
-
]
|
|
128
|
-
},
|
|
129
|
-
deserialization: {
|
|
130
|
-
fn: ([reader])=>FunctionSelector.fromField(reader.readField()),
|
|
131
|
-
slots: 1
|
|
132
|
-
}
|
|
133
|
-
};
|
|
134
|
-
const NOTE_SELECTOR = {
|
|
135
|
-
serialization: {
|
|
136
|
-
fn: (v)=>[
|
|
137
|
-
v.toField()
|
|
138
|
-
]
|
|
139
|
-
},
|
|
140
|
-
deserialization: {
|
|
141
|
-
fn: ([reader])=>NoteSelector.fromField(reader.readField()),
|
|
142
|
-
slots: 1
|
|
143
|
-
}
|
|
144
|
-
};
|
|
145
|
-
const TX_HASH = {
|
|
146
|
-
serialization: {
|
|
147
|
-
fn: (v)=>[
|
|
148
|
-
v.hash
|
|
149
|
-
]
|
|
150
|
-
},
|
|
151
|
-
deserialization: {
|
|
152
|
-
fn: ([reader])=>TxHash.fromField(reader.readField()),
|
|
153
|
-
slots: 1
|
|
154
|
-
}
|
|
155
|
-
};
|
|
156
|
-
const TAG = {
|
|
157
|
-
serialization: {
|
|
158
|
-
fn: (v)=>[
|
|
159
|
-
v.value
|
|
160
|
-
]
|
|
161
|
-
},
|
|
162
|
-
deserialization: {
|
|
163
|
-
fn: ([reader])=>new Tag(reader.readField()),
|
|
164
|
-
slots: 1
|
|
165
|
-
}
|
|
166
|
-
};
|
|
167
|
-
const BLOCK_HEADER = {
|
|
168
|
-
serialization: {
|
|
169
|
-
fn: (v)=>v.toFields()
|
|
170
|
-
},
|
|
171
|
-
deserialization: {
|
|
172
|
-
fn: ([reader])=>BlockHeader.fromFields(reader.readFieldArray(BLOCK_HEADER_LENGTH)),
|
|
173
|
-
slots: 1
|
|
174
|
-
}
|
|
175
|
-
};
|
|
176
|
-
const KEY_VALIDATION_REQUEST = {
|
|
177
|
-
serialization: {
|
|
178
|
-
fn: (v)=>v.toFields()
|
|
179
|
-
},
|
|
180
|
-
deserialization: {
|
|
181
|
-
fn: ([reader])=>KeyValidationRequest.fromFields(reader.readFieldArray(KEY_VALIDATION_REQUEST_LENGTH)),
|
|
182
|
-
slots: 1
|
|
183
|
-
}
|
|
184
|
-
};
|
|
185
|
-
const CONTRACT_INSTANCE = {
|
|
186
|
-
serialization: {
|
|
187
|
-
fn: (v)=>[
|
|
188
|
-
v.salt,
|
|
189
|
-
v.deployer.toField(),
|
|
190
|
-
v.currentContractClassId,
|
|
191
|
-
v.initializationHash,
|
|
192
|
-
v.immutablesHash,
|
|
193
|
-
...v.publicKeys.toFields()
|
|
194
|
-
]
|
|
195
|
-
}
|
|
196
|
-
};
|
|
197
|
-
const NULLIFIER_MEMBERSHIP_WITNESS = {
|
|
198
|
-
serialization: {
|
|
199
|
-
fn: (w)=>w.toNoirRepresentation().map((slot)=>Array.isArray(slot) ? slot.map((s)=>Fr.fromString(s)) : Fr.fromString(slot))
|
|
200
|
-
}
|
|
201
|
-
};
|
|
202
|
-
const PUBLIC_DATA_WITNESS = {
|
|
203
|
-
serialization: {
|
|
204
|
-
fn: (w)=>w.toNoirRepresentation().map((slot)=>Array.isArray(slot) ? slot.map((s)=>Fr.fromString(s)) : Fr.fromString(slot))
|
|
205
|
-
}
|
|
206
|
-
};
|
|
207
|
-
const MESSAGE_LOAD_ORACLE_INPUTS = {
|
|
208
|
-
serialization: {
|
|
209
|
-
fn: (m)=>m.toNoirRepresentation().map((slot)=>Array.isArray(slot) ? slot.map((s)=>Fr.fromString(s)) : Fr.fromString(slot))
|
|
210
|
-
}
|
|
211
|
-
};
|
|
212
|
-
const UTILITY_CONTEXT = {
|
|
213
|
-
serialization: {
|
|
214
|
-
fn: (ctx)=>[
|
|
215
|
-
...ctx.blockHeader.toFields(),
|
|
216
|
-
ctx.contractAddress.toField()
|
|
217
|
-
]
|
|
218
|
-
}
|
|
219
|
-
};
|
|
220
|
-
const CALL_PRIVATE_RESULT = {
|
|
221
|
-
serialization: {
|
|
222
|
-
fn: (v)=>[
|
|
223
|
-
[
|
|
224
|
-
v.endSideEffectCounter,
|
|
225
|
-
v.returnsHash
|
|
226
|
-
]
|
|
227
|
-
]
|
|
228
|
-
}
|
|
229
|
-
};
|
|
230
|
-
const PUBLIC_KEYS_AND_PARTIAL_ADDRESS = {
|
|
231
|
-
serialization: {
|
|
232
|
-
fn: (v)=>[
|
|
233
|
-
[
|
|
234
|
-
...v.publicKeys.toFields(),
|
|
235
|
-
v.partialAddress
|
|
236
|
-
]
|
|
237
|
-
]
|
|
238
|
-
}
|
|
239
|
-
};
|
|
240
|
-
const CONTRACT_CLASS_LOG_INPUT = {
|
|
241
|
-
deserialization: {
|
|
242
|
-
fn: ([addrReader, fieldsReader, lengthReader])=>{
|
|
243
|
-
const addr = AztecAddress.fromField(addrReader.readField());
|
|
244
|
-
const fields = new ContractClassLogFields([
|
|
245
|
-
...fieldsReader.readFieldArray(fieldsReader.remainingFields())
|
|
246
|
-
]);
|
|
247
|
-
const length = lengthReader.readField().toNumber();
|
|
248
|
-
return new ContractClassLog(addr, fields, length);
|
|
249
|
-
},
|
|
250
|
-
// ContractClassLog input occupies 3 ACVM slots: [contractAddress], [message fields...], [length].
|
|
251
|
-
slots: 3
|
|
252
|
-
}
|
|
253
|
-
};
|
|
254
|
-
const TX_EFFECT = {
|
|
255
|
-
serialization: {
|
|
256
|
-
fn: (effect)=>{
|
|
257
|
-
const flatPublicLogs = FlatPublicLogs.fromLogs(effect.publicLogs);
|
|
258
|
-
return [
|
|
259
|
-
effect.revertCode.toField(),
|
|
260
|
-
effect.txHash.hash,
|
|
261
|
-
effect.transactionFee,
|
|
262
|
-
padArrayEnd(effect.noteHashes, Fr.ZERO, MAX_NOTE_HASHES_PER_TX),
|
|
263
|
-
padArrayEnd(effect.nullifiers, Fr.ZERO, MAX_NULLIFIERS_PER_TX),
|
|
264
|
-
padArrayEnd(effect.l2ToL1Msgs, Fr.ZERO, MAX_L2_TO_L1_MSGS_PER_TX),
|
|
265
|
-
padArrayEnd(effect.publicDataWrites, PublicDataWrite.empty(), MAX_TOTAL_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX).flatMap((w)=>w.toFields()),
|
|
266
|
-
padArrayEnd(effect.privateLogs, PrivateLog.empty(), MAX_PRIVATE_LOGS_PER_TX).flatMap((l)=>l.toFields()),
|
|
267
|
-
new Fr(flatPublicLogs.length),
|
|
268
|
-
flatPublicLogs.payload,
|
|
269
|
-
padArrayEnd(effect.contractClassLogs, ContractClassLog.empty(), MAX_CONTRACT_CLASS_LOGS_PER_TX).flatMap((l)=>[
|
|
270
|
-
...l.fields.toFields(),
|
|
271
|
-
new Fr(l.emittedLength),
|
|
272
|
-
l.contractAddress.toField()
|
|
273
|
-
])
|
|
274
|
-
];
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
};
|
|
278
|
-
const NOTE = {
|
|
279
|
-
serialization: {
|
|
280
|
-
fn: (noteData)=>packAsHintedNote({
|
|
281
|
-
contractAddress: noteData.contractAddress,
|
|
282
|
-
owner: noteData.owner,
|
|
283
|
-
randomness: noteData.randomness,
|
|
284
|
-
storageSlot: noteData.storageSlot,
|
|
285
|
-
noteNonce: noteData.noteNonce,
|
|
286
|
-
isPending: noteData.isPending,
|
|
287
|
-
note: noteData.note
|
|
288
|
-
})
|
|
289
|
-
}
|
|
290
|
-
};
|
|
291
|
-
const ORACLE_REGISTRY = {
|
|
292
|
-
aztec_utl_assertCompatibleOracleVersion: makeEntry({
|
|
4
|
+
import { toACVMField } from '@aztec/simulator/client';
|
|
5
|
+
import { ARRAY, AZTEC_ADDRESS, BLOCK_HASH, BLOCK_HEADER, BLOCK_NUMBER, BOOL, BOUNDED_VEC, CALL_PRIVATE_RESULT, CONTRACT_CLASS_LOG, CONTRACT_INSTANCE, DELIVERY_MODE, EPHEMERAL_ARRAY, EVENT_VALIDATION_REQUEST, FACT_COLLECTION, FIELD, FIXED_ARRAY, FUNCTION_SELECTOR, KEY_VALIDATION_REQUEST, LOG_RETRIEVAL_REQUEST, LOG_RETRIEVAL_RESPONSE, MEMBERSHIP_WITNESS, MESSAGE_LOAD_ORACLE_INPUTS, NOTE, NOTE_SELECTOR, NOTE_VALIDATION_REQUEST, NULLIFIER_MEMBERSHIP_WITNESS, OPTION, ORIGIN_BLOCK, PENDING_TAGGED_LOG, POINT, PROVIDED_SECRET, PUBLIC_DATA_WITNESS, PUBLIC_KEYS_AND_PARTIAL_ADDRESS, RESOLVED_TAGGING_STRATEGY, RESOLVED_TX, STR, STRUCT, TX_EFFECT, TX_HASH, U8, U32, UTILITY_CONTEXT, assertReadersConsumed, slotsOf } from './oracle_type_mappings.js';
|
|
6
|
+
export { ARRAY, AZTEC_ADDRESS, BIGINT, BLOCK_NUMBER, BOOL, BOUNDED_VEC, U8, CONTRACT_CLASS_LOG, DELIVERY_MODE, RESOLVED_TAGGING_STRATEGY, EPHEMERAL_ARRAY, EVENT_VALIDATION_REQUEST, FIELD, FUNCTION_SELECTOR, LOG_RETRIEVAL_REQUEST, LOG_RETRIEVAL_RESPONSE, MEMBERSHIP_WITNESS, NOTE_VALIDATION_REQUEST, OPTION, PENDING_TAGGED_LOG, POINT, PROVIDED_SECRET, RESOLVED_TX, STR, U32, slotsOf } from './oracle_type_mappings.js';
|
|
7
|
+
export const ORACLE_REGISTRY = {
|
|
8
|
+
aztec_misc_assertCompatibleOracleVersion: makeEntry({
|
|
293
9
|
params: [
|
|
294
10
|
{
|
|
295
11
|
name: 'major',
|
|
@@ -301,10 +17,10 @@ const ORACLE_REGISTRY = {
|
|
|
301
17
|
}
|
|
302
18
|
]
|
|
303
19
|
}),
|
|
304
|
-
|
|
20
|
+
aztec_misc_getRandomField: makeEntry({
|
|
305
21
|
returnType: FIELD
|
|
306
22
|
}),
|
|
307
|
-
|
|
23
|
+
aztec_misc_log: makeEntry({
|
|
308
24
|
params: [
|
|
309
25
|
{
|
|
310
26
|
name: 'level',
|
|
@@ -332,6 +48,10 @@ const ORACLE_REGISTRY = {
|
|
|
332
48
|
{
|
|
333
49
|
name: 'pkMHash',
|
|
334
50
|
type: FIELD
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
name: 'keyIndex',
|
|
54
|
+
type: FIELD
|
|
335
55
|
}
|
|
336
56
|
],
|
|
337
57
|
returnType: KEY_VALIDATION_REQUEST
|
|
@@ -371,6 +91,19 @@ const ORACLE_REGISTRY = {
|
|
|
371
91
|
],
|
|
372
92
|
returnType: OPTION(MEMBERSHIP_WITNESS(ARCHIVE_HEIGHT))
|
|
373
93
|
}),
|
|
94
|
+
aztec_utl_areBlockHashesInArchive: makeEntry({
|
|
95
|
+
params: [
|
|
96
|
+
{
|
|
97
|
+
name: 'anchorBlockHash',
|
|
98
|
+
type: BLOCK_HASH
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
name: 'blockHashes',
|
|
102
|
+
type: EPHEMERAL_ARRAY(BLOCK_HASH)
|
|
103
|
+
}
|
|
104
|
+
],
|
|
105
|
+
returnType: EPHEMERAL_ARRAY(BOOL)
|
|
106
|
+
}),
|
|
374
107
|
aztec_utl_getNullifierMembershipWitness: makeEntry({
|
|
375
108
|
params: [
|
|
376
109
|
{
|
|
@@ -446,19 +179,24 @@ const ORACLE_REGISTRY = {
|
|
|
446
179
|
],
|
|
447
180
|
returnType: BOOL
|
|
448
181
|
}),
|
|
449
|
-
|
|
182
|
+
aztec_utl_getL1ToL2MembershipWitnessV2: makeEntry({
|
|
450
183
|
params: [
|
|
451
|
-
{
|
|
452
|
-
name: 'contractAddress',
|
|
453
|
-
type: AZTEC_ADDRESS
|
|
454
|
-
},
|
|
455
184
|
{
|
|
456
185
|
name: 'messageHash',
|
|
457
186
|
type: FIELD
|
|
458
187
|
},
|
|
459
188
|
{
|
|
460
|
-
name: '
|
|
461
|
-
type:
|
|
189
|
+
name: 'nullifier',
|
|
190
|
+
type: OPTION(STRUCT([
|
|
191
|
+
{
|
|
192
|
+
name: 'contractAddress',
|
|
193
|
+
type: AZTEC_ADDRESS
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
name: 'nullifier',
|
|
197
|
+
type: FIELD
|
|
198
|
+
}
|
|
199
|
+
]))
|
|
462
200
|
}
|
|
463
201
|
],
|
|
464
202
|
returnType: MESSAGE_LOAD_ORACLE_INPUTS
|
|
@@ -557,24 +295,28 @@ const ORACLE_REGISTRY = {
|
|
|
557
295
|
],
|
|
558
296
|
returnType: BOUNDED_VEC(NOTE)
|
|
559
297
|
}),
|
|
560
|
-
|
|
298
|
+
aztec_utl_getPendingTaggedLogsV2: makeEntry({
|
|
561
299
|
params: [
|
|
562
300
|
{
|
|
563
301
|
name: 'scope',
|
|
564
302
|
type: AZTEC_ADDRESS
|
|
303
|
+
},
|
|
304
|
+
{
|
|
305
|
+
name: 'providedSecrets',
|
|
306
|
+
type: EPHEMERAL_ARRAY(PROVIDED_SECRET)
|
|
565
307
|
}
|
|
566
308
|
],
|
|
567
|
-
returnType:
|
|
309
|
+
returnType: EPHEMERAL_ARRAY(PENDING_TAGGED_LOG)
|
|
568
310
|
}),
|
|
569
311
|
aztec_utl_validateAndStoreEnqueuedNotesAndEvents: makeEntry({
|
|
570
312
|
params: [
|
|
571
313
|
{
|
|
572
|
-
name: '
|
|
573
|
-
type:
|
|
314
|
+
name: 'noteValidationRequests',
|
|
315
|
+
type: EPHEMERAL_ARRAY(NOTE_VALIDATION_REQUEST)
|
|
574
316
|
},
|
|
575
317
|
{
|
|
576
|
-
name: '
|
|
577
|
-
type:
|
|
318
|
+
name: 'eventValidationRequests',
|
|
319
|
+
type: EPHEMERAL_ARRAY(EVENT_VALIDATION_REQUEST)
|
|
578
320
|
},
|
|
579
321
|
{
|
|
580
322
|
name: 'scope',
|
|
@@ -582,23 +324,23 @@ const ORACLE_REGISTRY = {
|
|
|
582
324
|
}
|
|
583
325
|
]
|
|
584
326
|
}),
|
|
585
|
-
|
|
327
|
+
aztec_utl_getLogsByTagV2: makeEntry({
|
|
586
328
|
params: [
|
|
587
329
|
{
|
|
588
|
-
name: '
|
|
589
|
-
type:
|
|
330
|
+
name: 'requests',
|
|
331
|
+
type: EPHEMERAL_ARRAY(LOG_RETRIEVAL_REQUEST)
|
|
590
332
|
}
|
|
591
333
|
],
|
|
592
|
-
returnType:
|
|
334
|
+
returnType: EPHEMERAL_ARRAY(EPHEMERAL_ARRAY(LOG_RETRIEVAL_RESPONSE))
|
|
593
335
|
}),
|
|
594
|
-
|
|
336
|
+
aztec_utl_getResolvedTxs: makeEntry({
|
|
595
337
|
params: [
|
|
596
338
|
{
|
|
597
|
-
name: '
|
|
598
|
-
type: FIELD
|
|
339
|
+
name: 'requests',
|
|
340
|
+
type: EPHEMERAL_ARRAY(FIELD)
|
|
599
341
|
}
|
|
600
342
|
],
|
|
601
|
-
returnType:
|
|
343
|
+
returnType: EPHEMERAL_ARRAY(OPTION(RESOLVED_TX))
|
|
602
344
|
}),
|
|
603
345
|
aztec_utl_getTxEffect: makeEntry({
|
|
604
346
|
params: [
|
|
@@ -609,6 +351,15 @@ const ORACLE_REGISTRY = {
|
|
|
609
351
|
],
|
|
610
352
|
returnType: OPTION(TX_EFFECT)
|
|
611
353
|
}),
|
|
354
|
+
aztec_utl_getTxEffects: makeEntry({
|
|
355
|
+
params: [
|
|
356
|
+
{
|
|
357
|
+
name: 'txHashes',
|
|
358
|
+
type: EPHEMERAL_ARRAY(TX_HASH)
|
|
359
|
+
}
|
|
360
|
+
],
|
|
361
|
+
returnType: EPHEMERAL_ARRAY(OPTION(TX_EFFECT))
|
|
362
|
+
}),
|
|
612
363
|
aztec_utl_setCapsule: makeEntry({
|
|
613
364
|
params: [
|
|
614
365
|
{
|
|
@@ -694,18 +445,18 @@ const ORACLE_REGISTRY = {
|
|
|
694
445
|
params: [
|
|
695
446
|
{
|
|
696
447
|
name: 'ciphertext',
|
|
697
|
-
type: BOUNDED_VEC(
|
|
448
|
+
type: BOUNDED_VEC(U8)
|
|
698
449
|
},
|
|
699
450
|
{
|
|
700
451
|
name: 'iv',
|
|
701
|
-
type:
|
|
452
|
+
type: FIXED_ARRAY(U8, 16)
|
|
702
453
|
},
|
|
703
454
|
{
|
|
704
455
|
name: 'symKey',
|
|
705
|
-
type:
|
|
456
|
+
type: FIXED_ARRAY(U8, 16)
|
|
706
457
|
}
|
|
707
458
|
],
|
|
708
|
-
returnType: OPTION(BOUNDED_VEC(
|
|
459
|
+
returnType: OPTION(BOUNDED_VEC(U8))
|
|
709
460
|
}),
|
|
710
461
|
aztec_utl_getSharedSecrets: makeEntry({
|
|
711
462
|
params: [
|
|
@@ -714,15 +465,15 @@ const ORACLE_REGISTRY = {
|
|
|
714
465
|
type: AZTEC_ADDRESS
|
|
715
466
|
},
|
|
716
467
|
{
|
|
717
|
-
name: '
|
|
718
|
-
type:
|
|
468
|
+
name: 'ephPks',
|
|
469
|
+
type: EPHEMERAL_ARRAY(POINT)
|
|
719
470
|
},
|
|
720
471
|
{
|
|
721
472
|
name: 'contractAddress',
|
|
722
473
|
type: AZTEC_ADDRESS
|
|
723
474
|
}
|
|
724
475
|
],
|
|
725
|
-
returnType: FIELD
|
|
476
|
+
returnType: EPHEMERAL_ARRAY(FIELD)
|
|
726
477
|
}),
|
|
727
478
|
aztec_utl_setContractSyncCacheInvalid: makeEntry({
|
|
728
479
|
params: [
|
|
@@ -744,6 +495,96 @@ const ORACLE_REGISTRY = {
|
|
|
744
495
|
}
|
|
745
496
|
]
|
|
746
497
|
}),
|
|
498
|
+
aztec_utl_recordFact: makeEntry({
|
|
499
|
+
params: [
|
|
500
|
+
{
|
|
501
|
+
name: 'contractAddress',
|
|
502
|
+
type: AZTEC_ADDRESS
|
|
503
|
+
},
|
|
504
|
+
{
|
|
505
|
+
name: 'scope',
|
|
506
|
+
type: AZTEC_ADDRESS
|
|
507
|
+
},
|
|
508
|
+
{
|
|
509
|
+
name: 'factCollectionTypeId',
|
|
510
|
+
type: FIELD
|
|
511
|
+
},
|
|
512
|
+
{
|
|
513
|
+
name: 'factCollectionId',
|
|
514
|
+
type: FIELD
|
|
515
|
+
},
|
|
516
|
+
{
|
|
517
|
+
name: 'factTypeId',
|
|
518
|
+
type: FIELD
|
|
519
|
+
},
|
|
520
|
+
{
|
|
521
|
+
name: 'payload',
|
|
522
|
+
type: EPHEMERAL_ARRAY(FIELD)
|
|
523
|
+
},
|
|
524
|
+
{
|
|
525
|
+
name: 'originBlock',
|
|
526
|
+
type: OPTION(ORIGIN_BLOCK)
|
|
527
|
+
}
|
|
528
|
+
]
|
|
529
|
+
}),
|
|
530
|
+
aztec_utl_deleteFactCollection: makeEntry({
|
|
531
|
+
params: [
|
|
532
|
+
{
|
|
533
|
+
name: 'contractAddress',
|
|
534
|
+
type: AZTEC_ADDRESS
|
|
535
|
+
},
|
|
536
|
+
{
|
|
537
|
+
name: 'scope',
|
|
538
|
+
type: AZTEC_ADDRESS
|
|
539
|
+
},
|
|
540
|
+
{
|
|
541
|
+
name: 'factCollectionTypeId',
|
|
542
|
+
type: FIELD
|
|
543
|
+
},
|
|
544
|
+
{
|
|
545
|
+
name: 'factCollectionId',
|
|
546
|
+
type: FIELD
|
|
547
|
+
}
|
|
548
|
+
]
|
|
549
|
+
}),
|
|
550
|
+
aztec_utl_getFactCollection: makeEntry({
|
|
551
|
+
params: [
|
|
552
|
+
{
|
|
553
|
+
name: 'contractAddress',
|
|
554
|
+
type: AZTEC_ADDRESS
|
|
555
|
+
},
|
|
556
|
+
{
|
|
557
|
+
name: 'scope',
|
|
558
|
+
type: AZTEC_ADDRESS
|
|
559
|
+
},
|
|
560
|
+
{
|
|
561
|
+
name: 'factCollectionTypeId',
|
|
562
|
+
type: FIELD
|
|
563
|
+
},
|
|
564
|
+
{
|
|
565
|
+
name: 'factCollectionId',
|
|
566
|
+
type: FIELD
|
|
567
|
+
}
|
|
568
|
+
],
|
|
569
|
+
returnType: OPTION(FACT_COLLECTION)
|
|
570
|
+
}),
|
|
571
|
+
aztec_utl_getFactCollectionsByType: makeEntry({
|
|
572
|
+
params: [
|
|
573
|
+
{
|
|
574
|
+
name: 'contractAddress',
|
|
575
|
+
type: AZTEC_ADDRESS
|
|
576
|
+
},
|
|
577
|
+
{
|
|
578
|
+
name: 'scope',
|
|
579
|
+
type: AZTEC_ADDRESS
|
|
580
|
+
},
|
|
581
|
+
{
|
|
582
|
+
name: 'factCollectionTypeId',
|
|
583
|
+
type: FIELD
|
|
584
|
+
}
|
|
585
|
+
],
|
|
586
|
+
returnType: EPHEMERAL_ARRAY(FACT_COLLECTION)
|
|
587
|
+
}),
|
|
747
588
|
aztec_utl_callUtilityFunction: makeEntry({
|
|
748
589
|
params: [
|
|
749
590
|
{
|
|
@@ -841,6 +682,86 @@ const ORACLE_REGISTRY = {
|
|
|
841
682
|
}
|
|
842
683
|
]
|
|
843
684
|
}),
|
|
685
|
+
aztec_utl_pushTransient: makeEntry({
|
|
686
|
+
params: [
|
|
687
|
+
{
|
|
688
|
+
name: 'slot',
|
|
689
|
+
type: FIELD
|
|
690
|
+
},
|
|
691
|
+
{
|
|
692
|
+
name: 'elements',
|
|
693
|
+
type: ARRAY(FIELD)
|
|
694
|
+
}
|
|
695
|
+
],
|
|
696
|
+
returnType: U32
|
|
697
|
+
}),
|
|
698
|
+
aztec_utl_popTransient: makeEntry({
|
|
699
|
+
params: [
|
|
700
|
+
{
|
|
701
|
+
name: 'slot',
|
|
702
|
+
type: FIELD
|
|
703
|
+
}
|
|
704
|
+
],
|
|
705
|
+
returnType: ARRAY(FIELD)
|
|
706
|
+
}),
|
|
707
|
+
aztec_utl_getTransient: makeEntry({
|
|
708
|
+
params: [
|
|
709
|
+
{
|
|
710
|
+
name: 'slot',
|
|
711
|
+
type: FIELD
|
|
712
|
+
},
|
|
713
|
+
{
|
|
714
|
+
name: 'index',
|
|
715
|
+
type: U32
|
|
716
|
+
}
|
|
717
|
+
],
|
|
718
|
+
returnType: ARRAY(FIELD)
|
|
719
|
+
}),
|
|
720
|
+
aztec_utl_setTransient: makeEntry({
|
|
721
|
+
params: [
|
|
722
|
+
{
|
|
723
|
+
name: 'slot',
|
|
724
|
+
type: FIELD
|
|
725
|
+
},
|
|
726
|
+
{
|
|
727
|
+
name: 'index',
|
|
728
|
+
type: U32
|
|
729
|
+
},
|
|
730
|
+
{
|
|
731
|
+
name: 'elements',
|
|
732
|
+
type: ARRAY(FIELD)
|
|
733
|
+
}
|
|
734
|
+
]
|
|
735
|
+
}),
|
|
736
|
+
aztec_utl_getTransientLen: makeEntry({
|
|
737
|
+
params: [
|
|
738
|
+
{
|
|
739
|
+
name: 'slot',
|
|
740
|
+
type: FIELD
|
|
741
|
+
}
|
|
742
|
+
],
|
|
743
|
+
returnType: U32
|
|
744
|
+
}),
|
|
745
|
+
aztec_utl_removeTransient: makeEntry({
|
|
746
|
+
params: [
|
|
747
|
+
{
|
|
748
|
+
name: 'slot',
|
|
749
|
+
type: FIELD
|
|
750
|
+
},
|
|
751
|
+
{
|
|
752
|
+
name: 'index',
|
|
753
|
+
type: U32
|
|
754
|
+
}
|
|
755
|
+
]
|
|
756
|
+
}),
|
|
757
|
+
aztec_utl_clearTransient: makeEntry({
|
|
758
|
+
params: [
|
|
759
|
+
{
|
|
760
|
+
name: 'slot',
|
|
761
|
+
type: FIELD
|
|
762
|
+
}
|
|
763
|
+
]
|
|
764
|
+
}),
|
|
844
765
|
aztec_prv_setHashPreimage: makeEntry({
|
|
845
766
|
params: [
|
|
846
767
|
{
|
|
@@ -935,7 +856,7 @@ const ORACLE_REGISTRY = {
|
|
|
935
856
|
params: [
|
|
936
857
|
{
|
|
937
858
|
name: 'log',
|
|
938
|
-
type:
|
|
859
|
+
type: CONTRACT_CLASS_LOG
|
|
939
860
|
},
|
|
940
861
|
{
|
|
941
862
|
name: 'counter',
|
|
@@ -993,7 +914,7 @@ const ORACLE_REGISTRY = {
|
|
|
993
914
|
],
|
|
994
915
|
returnType: BOOL
|
|
995
916
|
}),
|
|
996
|
-
|
|
917
|
+
aztec_prv_getAppTaggingSecret: makeEntry({
|
|
997
918
|
params: [
|
|
998
919
|
{
|
|
999
920
|
name: 'sender',
|
|
@@ -1004,50 +925,86 @@ const ORACLE_REGISTRY = {
|
|
|
1004
925
|
type: AZTEC_ADDRESS
|
|
1005
926
|
}
|
|
1006
927
|
],
|
|
1007
|
-
returnType:
|
|
928
|
+
returnType: OPTION(FIELD)
|
|
1008
929
|
}),
|
|
1009
|
-
|
|
930
|
+
aztec_prv_getNextTaggingIndex: makeEntry({
|
|
1010
931
|
params: [
|
|
1011
932
|
{
|
|
1012
|
-
name: '
|
|
933
|
+
name: 'secret',
|
|
1013
934
|
type: FIELD
|
|
935
|
+
},
|
|
936
|
+
{
|
|
937
|
+
name: 'deliveryMode',
|
|
938
|
+
type: DELIVERY_MODE
|
|
1014
939
|
}
|
|
1015
940
|
],
|
|
1016
941
|
returnType: U32
|
|
1017
942
|
}),
|
|
1018
943
|
aztec_prv_getSenderForTags: makeEntry({
|
|
1019
944
|
returnType: OPTION(AZTEC_ADDRESS)
|
|
945
|
+
}),
|
|
946
|
+
aztec_prv_resolveTaggingStrategy: makeEntry({
|
|
947
|
+
params: [
|
|
948
|
+
{
|
|
949
|
+
name: 'sender',
|
|
950
|
+
type: AZTEC_ADDRESS
|
|
951
|
+
},
|
|
952
|
+
{
|
|
953
|
+
name: 'recipient',
|
|
954
|
+
type: AZTEC_ADDRESS
|
|
955
|
+
},
|
|
956
|
+
{
|
|
957
|
+
name: 'deliveryMode',
|
|
958
|
+
type: DELIVERY_MODE
|
|
959
|
+
}
|
|
960
|
+
],
|
|
961
|
+
returnType: RESOLVED_TAGGING_STRATEGY
|
|
962
|
+
}),
|
|
963
|
+
aztec_prv_resolveCustomRequest: makeEntry({
|
|
964
|
+
params: [
|
|
965
|
+
{
|
|
966
|
+
name: 'kind',
|
|
967
|
+
type: FIELD
|
|
968
|
+
},
|
|
969
|
+
{
|
|
970
|
+
name: 'payload',
|
|
971
|
+
type: ARRAY(FIELD)
|
|
972
|
+
}
|
|
973
|
+
],
|
|
974
|
+
returnType: ARRAY(FIELD)
|
|
1020
975
|
})
|
|
1021
976
|
};
|
|
1022
|
-
|
|
1023
|
-
* Deserializes oracle inputs, calls the handler with typed params, and serializes the result.
|
|
1024
|
-
*/ export async function callHandler({ oracle, inputs, handler }) {
|
|
1025
|
-
const entry = ORACLE_REGISTRY[oracle];
|
|
1026
|
-
const named = entry.deserializeParams(inputs);
|
|
1027
|
-
const positional = named.map((p)=>p.value);
|
|
1028
|
-
const result = await handler(positional);
|
|
1029
|
-
return entry.serializeReturn(result);
|
|
1030
|
-
}
|
|
1031
|
-
function makeEntry({ params, returnType } = {}) {
|
|
977
|
+
export function makeEntry({ params, returnType } = {}) {
|
|
1032
978
|
return {
|
|
979
|
+
params: params ?? [],
|
|
980
|
+
returnType,
|
|
1033
981
|
deserializeParams (inputs) {
|
|
1034
982
|
const resolvedParams = params ?? [];
|
|
1035
983
|
// Walk the input slots left-to-right, advancing by each param's slot count.
|
|
1036
984
|
let offset = 0;
|
|
1037
|
-
|
|
985
|
+
const named = resolvedParams.map((param)=>{
|
|
1038
986
|
if (!param.type.deserialization) {
|
|
1039
987
|
throw new Error(`Param '${param.name}' has no deserialization defined`);
|
|
1040
988
|
}
|
|
1041
989
|
// Collect the slots for this param and wrap each in a FieldReader.
|
|
1042
|
-
const slotCount = param.type
|
|
990
|
+
const slotCount = slotsOf(param.type);
|
|
1043
991
|
const readers = inputs.slice(offset, offset + slotCount).map((slot)=>new FieldReader(slot.map((hex)=>Fr.fromString(hex))));
|
|
1044
992
|
offset += slotCount;
|
|
1045
|
-
// Delegate to the TypeMapping's deserializer
|
|
993
|
+
// Delegate to the TypeMapping's deserializer, assert the param's slots are fully consumed, and tag the
|
|
994
|
+
// result with the param name.
|
|
995
|
+
const value = param.type.deserialization.fn(readers);
|
|
996
|
+
assertReadersConsumed(readers);
|
|
1046
997
|
return {
|
|
1047
998
|
name: param.name,
|
|
1048
|
-
value
|
|
999
|
+
value
|
|
1049
1000
|
};
|
|
1050
1001
|
});
|
|
1002
|
+
// Every input slot must be specified by a param: oracles whose Noir decl passes an extra field must declare it
|
|
1003
|
+
// (the handler can ignore it). Otherwise an under-declared shape would silently drop a field into nothing.
|
|
1004
|
+
if (offset !== inputs.length) {
|
|
1005
|
+
throw new Error(`Oracle received ${inputs.length} input slot(s) but the registry specifies ${offset}`);
|
|
1006
|
+
}
|
|
1007
|
+
return named;
|
|
1051
1008
|
},
|
|
1052
1009
|
serializeReturn (result) {
|
|
1053
1010
|
if (returnType?.serialization === undefined) {
|
|
@@ -1057,143 +1014,3 @@ function makeEntry({ params, returnType } = {}) {
|
|
|
1057
1014
|
}
|
|
1058
1015
|
};
|
|
1059
1016
|
}
|
|
1060
|
-
/** `_height` is unused at runtime but lets TypeScript infer the exact `N` for `MembershipWitness<N>`. */ function MEMBERSHIP_WITNESS(_height) {
|
|
1061
|
-
return {
|
|
1062
|
-
serialization: {
|
|
1063
|
-
fn: (witness)=>[
|
|
1064
|
-
new Fr(witness.leafIndex),
|
|
1065
|
-
[
|
|
1066
|
-
...witness.siblingPath
|
|
1067
|
-
]
|
|
1068
|
-
]
|
|
1069
|
-
}
|
|
1070
|
-
};
|
|
1071
|
-
}
|
|
1072
|
-
function ARRAY(element) {
|
|
1073
|
-
return {
|
|
1074
|
-
serialization: element.serialization ? {
|
|
1075
|
-
fn: (values)=>[
|
|
1076
|
-
values.flatMap((v)=>element.serialization.fn(v).flat())
|
|
1077
|
-
]
|
|
1078
|
-
} : undefined,
|
|
1079
|
-
deserialization: element.deserialization ? {
|
|
1080
|
-
fn: ([reader])=>{
|
|
1081
|
-
const result = [];
|
|
1082
|
-
while(!reader.isFinished()){
|
|
1083
|
-
result.push(element.deserialization.fn([
|
|
1084
|
-
reader
|
|
1085
|
-
]));
|
|
1086
|
-
}
|
|
1087
|
-
return result;
|
|
1088
|
-
},
|
|
1089
|
-
slots: 1
|
|
1090
|
-
} : undefined
|
|
1091
|
-
};
|
|
1092
|
-
}
|
|
1093
|
-
/**
|
|
1094
|
-
* Maps Noir's `BoundedVec<T, MaxLen>` ↔ TS `BoundedVec<T>` over 2 slots:
|
|
1095
|
-
* slot 0 — flat storage, padded/parsed as `maxLength * elementSize` fields
|
|
1096
|
-
* slot 1 — length scalar (count of actual items)
|
|
1097
|
-
*
|
|
1098
|
-
* Both directions are derived from `element`: bidirectional iff `element` has both serialization and deserialization.
|
|
1099
|
-
*
|
|
1100
|
-
* @example Serializing `BoundedVec.from({ data: [0x41, 0x42], maxLength: 4 })` with `BOUNDED_VEC(BYTE)`:
|
|
1101
|
-
* ```
|
|
1102
|
-
* slot 0: [Fr(0x41), Fr(0x42), Fr(0), Fr(0)] // data padded to maxLength
|
|
1103
|
-
* slot 1: Fr(2) // actual length
|
|
1104
|
-
* ```
|
|
1105
|
-
*/ function BOUNDED_VEC(element) {
|
|
1106
|
-
return {
|
|
1107
|
-
serialization: element.serialization ? {
|
|
1108
|
-
fn: (bv)=>{
|
|
1109
|
-
if (bv.data.length > bv.maxLength) {
|
|
1110
|
-
throw new Error(`Got ${bv.data.length} items, but maxLength is ${bv.maxLength}`);
|
|
1111
|
-
}
|
|
1112
|
-
const flat = bv.data.flatMap((item)=>element.serialization.fn(item).flat());
|
|
1113
|
-
return [
|
|
1114
|
-
padArrayEnd(flat, Fr.ZERO, bv.maxLength * bv.elementSize),
|
|
1115
|
-
new Fr(bv.data.length)
|
|
1116
|
-
];
|
|
1117
|
-
}
|
|
1118
|
-
} : undefined,
|
|
1119
|
-
deserialization: element.deserialization ? {
|
|
1120
|
-
fn: ([storageReader, lengthReader])=>{
|
|
1121
|
-
const maxLength = storageReader.remainingFields();
|
|
1122
|
-
const length = lengthReader.readField().toNumber();
|
|
1123
|
-
const elements = [];
|
|
1124
|
-
for(let i = 0; i < length; i++){
|
|
1125
|
-
elements.push(element.deserialization.fn([
|
|
1126
|
-
storageReader
|
|
1127
|
-
]));
|
|
1128
|
-
}
|
|
1129
|
-
return BoundedVec.from({
|
|
1130
|
-
data: elements,
|
|
1131
|
-
maxLength
|
|
1132
|
-
});
|
|
1133
|
-
},
|
|
1134
|
-
slots: 2
|
|
1135
|
-
} : undefined
|
|
1136
|
-
};
|
|
1137
|
-
}
|
|
1138
|
-
/**
|
|
1139
|
-
* Wraps an inner TypeMapping in Noir-style `Option<T>`. Adds a discriminant slot and uses the handler-provided
|
|
1140
|
-
* `Option.none(shape)` template to produce a correctly-sized zero-filled output for the None case.
|
|
1141
|
-
*
|
|
1142
|
-
* @example Serializing `Option.some(AztecAddress.fromField(Fr(42)))` with `OPTION(AZTEC_ADDRESS)`:
|
|
1143
|
-
* ```
|
|
1144
|
-
* slot 0: Fr(1) // discriminant: Some
|
|
1145
|
-
* slot 1: Fr(42) // inner value
|
|
1146
|
-
* ```
|
|
1147
|
-
*
|
|
1148
|
-
* @example Serializing `Option.empty(AztecAddress.ZERO)` with `OPTION(AZTEC_ADDRESS)`:
|
|
1149
|
-
* ```
|
|
1150
|
-
* slot 0: Fr(0) // discriminant: None
|
|
1151
|
-
* slot 1: Fr(0) // zero-filled using shape
|
|
1152
|
-
* ```
|
|
1153
|
-
*/ function OPTION(inner) {
|
|
1154
|
-
return {
|
|
1155
|
-
serialization: inner.serialization ? {
|
|
1156
|
-
fn: (opt)=>{
|
|
1157
|
-
if (opt.isSome()) {
|
|
1158
|
-
return [
|
|
1159
|
-
Fr.ONE,
|
|
1160
|
-
...inner.serialization.fn(opt.value)
|
|
1161
|
-
];
|
|
1162
|
-
}
|
|
1163
|
-
if (opt.template === undefined) {
|
|
1164
|
-
throw new Error('Cannot serialize Option.empty() without an emptyTemplate — provide one via Option.empty(emptyTemplate)');
|
|
1165
|
-
}
|
|
1166
|
-
const zeroSlots = inner.serialization.fn(opt.template).map((s)=>Array.isArray(s) ? Array(s.length).fill(Fr.ZERO) : Fr.ZERO);
|
|
1167
|
-
return [
|
|
1168
|
-
Fr.ZERO,
|
|
1169
|
-
...zeroSlots
|
|
1170
|
-
];
|
|
1171
|
-
}
|
|
1172
|
-
} : undefined,
|
|
1173
|
-
deserialization: inner.deserialization ? {
|
|
1174
|
-
fn: (readers)=>{
|
|
1175
|
-
if (readers[0].readField().isZero()) {
|
|
1176
|
-
return Option.none(undefined);
|
|
1177
|
-
}
|
|
1178
|
-
return Option.some(inner.deserialization.fn(readers.slice(1)));
|
|
1179
|
-
},
|
|
1180
|
-
slots: inner.deserialization.slots + 1
|
|
1181
|
-
} : undefined
|
|
1182
|
-
};
|
|
1183
|
-
}
|
|
1184
|
-
/** A packed uint buffer (e.g. `[u8; N]` in Noir): 1 slot of packed uint values ↔ `Buffer`. */ function BUFFER(bitSize) {
|
|
1185
|
-
return {
|
|
1186
|
-
serialization: {
|
|
1187
|
-
fn: (buf)=>[
|
|
1188
|
-
Array.from(buf).map((b)=>new Fr(b))
|
|
1189
|
-
]
|
|
1190
|
-
},
|
|
1191
|
-
deserialization: {
|
|
1192
|
-
fn: ([reader])=>{
|
|
1193
|
-
const fields = reader.readFieldArray(reader.remainingFields()).map((f)=>f.toString());
|
|
1194
|
-
return fromUintArray(fields, bitSize);
|
|
1195
|
-
},
|
|
1196
|
-
slots: 1
|
|
1197
|
-
}
|
|
1198
|
-
};
|
|
1199
|
-
}
|