@aztec/pxe 5.0.0-rc.1 → 5.0.0
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/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 +16 -12
- package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -1
- package/dest/block_synchronizer/block_synchronizer.js +49 -15
- 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/contract/contract_class_service.d.ts +31 -0
- package/dest/contract/contract_class_service.d.ts.map +1 -0
- package/dest/contract/contract_class_service.js +68 -0
- package/dest/{contract_sync → contract}/contract_sync_service.d.ts +7 -6
- package/dest/contract/contract_sync_service.d.ts.map +1 -0
- package/dest/{contract_sync → contract}/contract_sync_service.js +10 -30
- package/dest/contract/helpers.d.ts +7 -0
- package/dest/contract/helpers.d.ts.map +1 -0
- package/dest/contract/helpers.js +20 -0
- package/dest/contract_function_simulator/anchored_contract_data.d.ts +36 -0
- package/dest/contract_function_simulator/anchored_contract_data.d.ts.map +1 -0
- package/dest/contract_function_simulator/anchored_contract_data.js +54 -0
- package/dest/contract_function_simulator/aztec_node_read_cache.d.ts +39 -0
- package/dest/contract_function_simulator/aztec_node_read_cache.d.ts.map +1 -0
- package/dest/contract_function_simulator/aztec_node_read_cache.js +60 -0
- package/dest/contract_function_simulator/contract_function_simulator.d.ts +19 -18
- package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.js +52 -31
- package/dest/contract_function_simulator/execution_note_cache.d.ts +3 -9
- 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 +17 -9
- package/dest/contract_function_simulator/index.d.ts.map +1 -1
- package/dest/contract_function_simulator/index.js +4 -7
- 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/event_validation_request.js +1 -1
- 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_validation_request.js +2 -2
- 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 +6 -9
- package/dest/contract_function_simulator/noir-structs/provided_secret.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/provided_secret.js +1 -14
- 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 +21 -0
- package/dest/contract_function_simulator/noir-structs/resolved_tx.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/resolved_tx.js +50 -0
- package/dest/contract_function_simulator/noir-structs/tx_effect_data.d.ts +14 -0
- package/dest/contract_function_simulator/noir-structs/tx_effect_data.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/tx_effect_data.js +5 -0
- package/dest/contract_function_simulator/noir-structs/utility_context.d.ts +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 +7 -2
- package/dest/contract_function_simulator/oracle/acir_callback.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/acir_callback.js +55 -11
- 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 +86 -8
- package/dest/contract_function_simulator/oracle/oracle_registry.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/oracle_registry.js +168 -18
- package/dest/contract_function_simulator/oracle/oracle_type_mappings.d.ts +123 -40
- package/dest/contract_function_simulator/oracle/oracle_type_mappings.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/oracle_type_mappings.js +947 -264
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +21 -8
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.js +126 -16
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +63 -33
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +175 -90
- 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/utils.d.ts +1 -1
- package/dest/entrypoints/client/bundle/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/utils.js +3 -2
- 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 +3 -2
- package/dest/entrypoints/pxe_creation_options.d.ts +8 -2
- package/dest/entrypoints/pxe_creation_options.d.ts.map +1 -1
- package/dest/entrypoints/server/index.d.ts +5 -3
- package/dest/entrypoints/server/index.d.ts.map +1 -1
- package/dest/entrypoints/server/index.js +3 -2
- 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 +3 -1
- 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/hooks/execution_hooks.d.ts +27 -7
- 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 +7 -6
- package/dest/logs/log_service.d.ts.map +1 -1
- package/dest/logs/log_service.js +79 -28
- package/dest/messages/tx_resolver_service.d.ts +17 -0
- package/dest/messages/tx_resolver_service.d.ts.map +1 -0
- package/dest/messages/{message_context_service.js → tx_resolver_service.js} +8 -8
- package/dest/oracle_version.d.ts +3 -3
- package/dest/oracle_version.js +3 -3
- 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 +17 -36
- 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 +109 -47
- package/dest/pxe.d.ts.map +1 -1
- package/dest/pxe.js +222 -139
- 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/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 +114 -37
- 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 +64 -75
- package/dest/storage/fact_store/fact_service.d.ts +22 -0
- package/dest/storage/fact_store/fact_service.d.ts.map +1 -0
- package/dest/storage/fact_store/fact_service.js +45 -0
- package/dest/storage/fact_store/fact_store.d.ts +95 -0
- package/dest/storage/fact_store/fact_store.d.ts.map +1 -0
- package/dest/storage/fact_store/fact_store.js +408 -0
- package/dest/storage/fact_store/fact_store_keys.d.ts +34 -0
- package/dest/storage/fact_store/fact_store_keys.d.ts.map +1 -0
- package/dest/storage/fact_store/fact_store_keys.js +50 -0
- package/dest/storage/fact_store/index.d.ts +6 -0
- package/dest/storage/fact_store/index.d.ts.map +1 -0
- package/dest/storage/fact_store/index.js +4 -0
- package/dest/storage/fact_store/origin_state.d.ts +57 -0
- package/dest/storage/fact_store/origin_state.d.ts.map +1 -0
- package/dest/storage/fact_store/origin_state.js +53 -0
- package/dest/storage/fact_store/stored_fact.d.ts +32 -0
- package/dest/storage/fact_store/stored_fact.d.ts.map +1 -0
- package/dest/storage/fact_store/stored_fact.js +64 -0
- package/dest/storage/index.d.ts +2 -1
- package/dest/storage/index.d.ts.map +1 -1
- package/dest/storage/index.js +1 -0
- 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/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/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/tagging_secret_sources_store.d.ts +51 -0
- package/dest/storage/tagging_store/tagging_secret_sources_store.d.ts.map +1 -0
- package/dest/storage/tagging_store/tagging_secret_sources_store.js +105 -0
- package/dest/tagging/constants.d.ts +2 -2
- package/dest/tagging/constants.d.ts.map +1 -1
- package/dest/tagging/constants.js +18 -9
- package/package.json +17 -17
- package/src/block_synchronizer/block_stream_source.ts +6 -45
- package/src/block_synchronizer/block_synchronizer.ts +65 -24
- package/src/config/index.ts +1 -0
- package/src/contract/contract_class_service.ts +83 -0
- package/src/{contract_sync → contract}/contract_sync_service.ts +18 -37
- package/src/contract/helpers.ts +35 -0
- package/src/contract_function_simulator/anchored_contract_data.ts +74 -0
- package/src/contract_function_simulator/aztec_node_read_cache.ts +89 -0
- package/src/contract_function_simulator/contract_function_simulator.ts +86 -43
- package/src/contract_function_simulator/execution_note_cache.ts +7 -28
- package/src/contract_function_simulator/index.ts +24 -9
- 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/event_validation_request.ts +1 -1
- 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_validation_request.ts +2 -2
- 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 +4 -15
- package/src/contract_function_simulator/noir-structs/resolved_tagging_strategy.ts +66 -0
- package/src/contract_function_simulator/noir-structs/resolved_tx.ts +53 -0
- package/src/contract_function_simulator/noir-structs/tx_effect_data.ts +15 -0
- package/src/contract_function_simulator/noir-structs/utility_context.ts +5 -17
- package/src/contract_function_simulator/oracle/acir_callback.ts +58 -12
- 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 +119 -86
- package/src/contract_function_simulator/oracle/oracle_type_mappings.ts +659 -248
- package/src/contract_function_simulator/oracle/private_execution_oracle.ts +155 -24
- package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +300 -115
- package/src/debug/pxe_debug_utils.ts +1 -1
- package/src/entrypoints/client/bundle/utils.ts +3 -2
- package/src/entrypoints/client/lazy/utils.ts +3 -2
- package/src/entrypoints/pxe_creation_options.ts +7 -1
- package/src/entrypoints/server/index.ts +5 -2
- package/src/entrypoints/server/utils.ts +3 -1
- package/src/error_enriching.ts +27 -11
- package/src/hooks/execution_hooks.ts +28 -8
- 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 +91 -37
- package/src/messages/{message_context_service.ts → tx_resolver_service.ts} +16 -9
- package/src/oracle_version.ts +3 -3
- 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 +22 -52
- package/src/private_kernel/private_kernel_oracle.ts +23 -4
- package/src/pxe.ts +320 -158
- package/src/storage/allowed_scopes.ts +14 -0
- 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 +1 -1
- 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 +21 -5
- package/src/storage/backwards_compatibility_tests/schema_tests.ts +125 -36
- package/src/storage/capsule_store/capsule_service.ts +8 -13
- package/src/storage/contract_store/contract_store.ts +86 -93
- package/src/storage/fact_store/fact_service.ts +69 -0
- package/src/storage/fact_store/fact_store.ts +487 -0
- package/src/storage/fact_store/fact_store_keys.ts +75 -0
- package/src/storage/fact_store/index.ts +14 -0
- package/src/storage/fact_store/origin_state.ts +75 -0
- package/src/storage/fact_store/stored_fact.ts +80 -0
- package/src/storage/index.ts +1 -0
- package/src/storage/metadata.ts +1 -1
- package/src/storage/open_pxe_stores.ts +6 -3
- package/src/storage/tagging_store/index.ts +1 -1
- package/src/storage/tagging_store/tagging_secret_sources_store.ts +138 -0
- package/src/tagging/constants.ts +19 -9
- 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.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/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/src/contract_function_simulator/proxied_contract_data_source.ts +0 -60
- package/src/contract_sync/helpers.ts +0 -86
- package/src/storage/backwards_compatibility_tests/__snapshots__/SenderAddressBookStore.json +0 -16
- package/src/storage/tagging_store/sender_address_book_store.ts +0 -48
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
/* eslint-disable camelcase */
|
|
2
|
+
import { MAX_NOTE_HASHES_PER_TX, PRIVATE_LOG_CIPHERTEXT_LEN, PRIVATE_LOG_SIZE_IN_FIELDS } from '@aztec/constants';
|
|
3
|
+
import { computeFeeJuiceMessageNullifier } from '@aztec/stdlib/messaging';
|
|
4
|
+
|
|
5
|
+
import type { EphemeralArray } from '../noir-structs/ephemeral_array.js';
|
|
6
|
+
import type { LogRetrievalResponse } from '../noir-structs/log_retrieval_response.js';
|
|
7
|
+
import { Option } from '../noir-structs/option.js';
|
|
8
|
+
import type { PendingTaggedLog } from '../noir-structs/pending_tagged_log.js';
|
|
9
|
+
import type { ResolvedTx } from '../noir-structs/resolved_tx.js';
|
|
10
|
+
import {
|
|
11
|
+
type InferDeserializedParams,
|
|
12
|
+
ORACLE_REGISTRY,
|
|
13
|
+
type OracleRegistryEntry,
|
|
14
|
+
type ParamTypes,
|
|
15
|
+
type RegistryParam,
|
|
16
|
+
} from './oracle_registry.js';
|
|
17
|
+
import {
|
|
18
|
+
AZTEC_ADDRESS,
|
|
19
|
+
EPHEMERAL_ARRAY,
|
|
20
|
+
FIELD,
|
|
21
|
+
FIXED_BOUNDED_VEC,
|
|
22
|
+
STRUCT,
|
|
23
|
+
TX_HASH,
|
|
24
|
+
type TypeMapping,
|
|
25
|
+
} from './oracle_type_mappings.js';
|
|
26
|
+
|
|
27
|
+
const LEGACY_LOG_RETRIEVAL_RESPONSE: TypeMapping<LegacyLogRetrievalResponse> = STRUCT([
|
|
28
|
+
{ name: 'logPayload', type: FIXED_BOUNDED_VEC(FIELD, PRIVATE_LOG_CIPHERTEXT_LEN) },
|
|
29
|
+
{ name: 'txHash', type: TX_HASH },
|
|
30
|
+
{ name: 'uniqueNoteHashesInTx', type: FIXED_BOUNDED_VEC(FIELD, MAX_NOTE_HASHES_PER_TX) },
|
|
31
|
+
{ name: 'firstNullifierInTx', type: FIELD },
|
|
32
|
+
]);
|
|
33
|
+
|
|
34
|
+
// Block-less transaction context: the prefix of `ResolvedTx`'s wire carried by the original `getPendingTaggedLogs`
|
|
35
|
+
// oracle. Known as `MessageContext` in the Aztec.nr versions that call that oracle.
|
|
36
|
+
const LEGACY_MESSAGE_CONTEXT: TypeMapping<LegacyMessageContext> = STRUCT<LegacyMessageContext>([
|
|
37
|
+
{ name: 'txHash', type: TX_HASH },
|
|
38
|
+
{ name: 'uniqueNoteHashesInTx', type: FIXED_BOUNDED_VEC(FIELD, MAX_NOTE_HASHES_PER_TX) },
|
|
39
|
+
{ name: 'firstNullifierInTx', type: FIELD },
|
|
40
|
+
]);
|
|
41
|
+
|
|
42
|
+
const LEGACY_PENDING_TAGGED_LOG: TypeMapping<LegacyPendingTaggedLog> = STRUCT<LegacyPendingTaggedLog>([
|
|
43
|
+
{ name: 'log', type: FIXED_BOUNDED_VEC(FIELD, PRIVATE_LOG_SIZE_IN_FIELDS) },
|
|
44
|
+
{ name: 'context', type: LEGACY_MESSAGE_CONTEXT },
|
|
45
|
+
]);
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Wire shapes that already-deployed contracts still call by their original oracle name, keyed by that retired name.
|
|
49
|
+
* New Aztec.nr calls the current name in `ORACLE_REGISTRY`; old bytecode keeps calling the name compiled into it and
|
|
50
|
+
* is served from here, so versioning an oracle's wire (e.g. adding return fields) stops being a breaking change.
|
|
51
|
+
*
|
|
52
|
+
* Append-only. Drop an entry only once the `ORACLE_VERSION_MAJOR` that introduced its successor is retired, since
|
|
53
|
+
* older contracts can no longer run against this environment.
|
|
54
|
+
*/
|
|
55
|
+
export const LEGACY_ORACLE_REGISTRY: Record<string, LegacyOracleEntry> = {
|
|
56
|
+
aztec_utl_getL1ToL2MembershipWitness: legacyOracle({
|
|
57
|
+
modernOracle: 'aztec_utl_getL1ToL2MembershipWitnessV2',
|
|
58
|
+
// The old wire passed the contract address and secret, the modern oracle takes the unsiloed nullifier (plus the
|
|
59
|
+
// address to silo it with) instead. We derive it here so already-deployed contracts that still emit the old call
|
|
60
|
+
// keep working.
|
|
61
|
+
//
|
|
62
|
+
// This is the fee juice message nullifier derivation: only contracts using that scheme call this retired oracle.
|
|
63
|
+
params: {
|
|
64
|
+
legacyType: [
|
|
65
|
+
{ name: 'contractAddress', type: AZTEC_ADDRESS },
|
|
66
|
+
{ name: 'messageHash', type: FIELD },
|
|
67
|
+
{ name: 'secret', type: FIELD },
|
|
68
|
+
],
|
|
69
|
+
mapping: async ([contractAddress, messageHash, secret]) => [
|
|
70
|
+
messageHash,
|
|
71
|
+
Option.some({ contractAddress, nullifier: await computeFeeJuiceMessageNullifier(messageHash, secret) }),
|
|
72
|
+
],
|
|
73
|
+
},
|
|
74
|
+
}),
|
|
75
|
+
aztec_utl_getLogsByTag: legacyOracle({
|
|
76
|
+
modernOracle: 'aztec_utl_getLogsByTagV2',
|
|
77
|
+
returnType: {
|
|
78
|
+
legacyType: EPHEMERAL_ARRAY(EPHEMERAL_ARRAY(LEGACY_LOG_RETRIEVAL_RESPONSE)),
|
|
79
|
+
// We can map this directly, since the new type is a superset of the old type
|
|
80
|
+
mapping: result => result as unknown as EphemeralArray<EphemeralArray<LegacyLogRetrievalResponse>>,
|
|
81
|
+
},
|
|
82
|
+
}),
|
|
83
|
+
aztec_utl_getPendingTaggedLogs: legacyOracle({
|
|
84
|
+
modernOracle: 'aztec_utl_getPendingTaggedLogsV2',
|
|
85
|
+
returnType: {
|
|
86
|
+
legacyType: EPHEMERAL_ARRAY(LEGACY_PENDING_TAGGED_LOG),
|
|
87
|
+
// We can map this directly, since `ResolvedTx` carries the legacy context's fields under the same names
|
|
88
|
+
mapping: result => result as unknown as EphemeralArray<LegacyPendingTaggedLog>,
|
|
89
|
+
},
|
|
90
|
+
}),
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
type LegacyLogRetrievalResponse = Pick<
|
|
94
|
+
LogRetrievalResponse,
|
|
95
|
+
'logPayload' | 'txHash' | 'uniqueNoteHashesInTx' | 'firstNullifierInTx'
|
|
96
|
+
>;
|
|
97
|
+
|
|
98
|
+
type LegacyMessageContext = Pick<ResolvedTx, 'txHash' | 'uniqueNoteHashesInTx' | 'firstNullifierInTx'>;
|
|
99
|
+
|
|
100
|
+
type LegacyPendingTaggedLog = {
|
|
101
|
+
log: PendingTaggedLog['log'];
|
|
102
|
+
context: LegacyMessageContext;
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
type Registry = typeof ORACLE_REGISTRY;
|
|
106
|
+
|
|
107
|
+
/** The handler return value type of a modern oracle entry. */
|
|
108
|
+
type ReturnValueOf<K extends keyof Registry> = Registry[K] extends OracleRegistryEntry<any, infer R> ? R : never;
|
|
109
|
+
|
|
110
|
+
/** The modern handler's positional argument tuple, derived from the oracle's declared params. */
|
|
111
|
+
type HandlerArgsOf<K extends keyof Registry> = ParamTypes<ReturnType<Registry[K]['deserializeParams']>>;
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* A legacy oracle adapter, stored under the retired oracle name that already-deployed contracts still call. It reuses
|
|
115
|
+
* the handler of `modernOracle` and overrides only the wire side(s) that changed; an omitted side falls back to that
|
|
116
|
+
* modern entry.
|
|
117
|
+
*/
|
|
118
|
+
export interface LegacyOracleEntry {
|
|
119
|
+
/** The current oracle whose handler this reuses and whose param/return wire it inherits by default. */
|
|
120
|
+
modernOracle: keyof Registry;
|
|
121
|
+
/**
|
|
122
|
+
* Old param wire. `legacyType` deserializes the old wire; `mapping` bridges the deserialized legacy args to the
|
|
123
|
+
* modern handler's args. The mapping may be async. Omit when the param wire is unchanged.
|
|
124
|
+
*/
|
|
125
|
+
params?: {
|
|
126
|
+
legacyType: readonly RegistryParam[];
|
|
127
|
+
mapping: (legacyArgs: any) => readonly unknown[] | Promise<readonly unknown[]>;
|
|
128
|
+
};
|
|
129
|
+
/**
|
|
130
|
+
* Old return wire. `legacyType` serializes the subset the old contract reads; `mapping` bridges the handler's
|
|
131
|
+
* current result to that subset's value type. Omit when the return wire is unchanged.
|
|
132
|
+
*/
|
|
133
|
+
returnType?: { legacyType: TypeMapping; mapping: (result: any) => unknown };
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
function legacyOracle<K extends keyof Registry, W = never, const TLegacyParams extends RegistryParam[] = []>(entry: {
|
|
137
|
+
modernOracle: K;
|
|
138
|
+
params?: {
|
|
139
|
+
legacyType: [...TLegacyParams];
|
|
140
|
+
mapping: (
|
|
141
|
+
legacyArgs: ParamTypes<InferDeserializedParams<TLegacyParams>>,
|
|
142
|
+
) => HandlerArgsOf<K> | Promise<HandlerArgsOf<K>>;
|
|
143
|
+
};
|
|
144
|
+
returnType?: { legacyType: TypeMapping<W>; mapping: (result: ReturnValueOf<K>) => W };
|
|
145
|
+
}): LegacyOracleEntry {
|
|
146
|
+
return entry;
|
|
147
|
+
}
|
|
@@ -1,23 +1,8 @@
|
|
|
1
|
-
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
1
|
import type { SiblingPath } from '@aztec/foundation/trees';
|
|
3
2
|
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
) {}
|
|
11
|
-
|
|
12
|
-
toFields(): Fr[] {
|
|
13
|
-
return [new Fr(this.index), ...this.siblingPath.toFields()];
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Returns a representation of the public data witness as expected by intrinsic Noir deserialization.
|
|
18
|
-
*/
|
|
19
|
-
public toNoirRepresentation(): (string | string[])[] {
|
|
20
|
-
// TODO(#12874): remove the stupid as string conversion by modifying ForeignCallOutput type in acvm.js
|
|
21
|
-
return [new Fr(this.index).toString() as string, this.siblingPath.toFields().map(fr => fr.toString()) as string[]];
|
|
22
|
-
}
|
|
23
|
-
}
|
|
3
|
+
export type MessageLoadOracleInputs<N extends number> = {
|
|
4
|
+
/** The index of the message commitment in the merkle tree. */
|
|
5
|
+
index: bigint;
|
|
6
|
+
/** The path in the merkle tree to the message. */
|
|
7
|
+
siblingPath: SiblingPath<N>;
|
|
8
|
+
};
|
|
@@ -3,6 +3,7 @@ import { ARCHIVE_HEIGHT, NOTE_HASH_TREE_HEIGHT } from '@aztec/constants';
|
|
|
3
3
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
4
4
|
import { FieldReader } from '@aztec/foundation/serialize';
|
|
5
5
|
import { toACVMField } from '@aztec/simulator/client';
|
|
6
|
+
import type { UnsiloedMessageNullifier } from '@aztec/stdlib/messaging';
|
|
6
7
|
|
|
7
8
|
import {
|
|
8
9
|
ARRAY,
|
|
@@ -15,11 +16,12 @@ import {
|
|
|
15
16
|
BUFFER,
|
|
16
17
|
BYTE,
|
|
17
18
|
CALL_PRIVATE_RESULT,
|
|
18
|
-
|
|
19
|
+
CONTRACT_CLASS_LOG,
|
|
19
20
|
CONTRACT_INSTANCE,
|
|
20
21
|
DELIVERY_MODE,
|
|
21
22
|
EPHEMERAL_ARRAY,
|
|
22
23
|
EVENT_VALIDATION_REQUEST,
|
|
24
|
+
FACT_COLLECTION,
|
|
23
25
|
FIELD,
|
|
24
26
|
FUNCTION_SELECTOR,
|
|
25
27
|
type InputSlot,
|
|
@@ -27,7 +29,6 @@ import {
|
|
|
27
29
|
LOG_RETRIEVAL_REQUEST,
|
|
28
30
|
LOG_RETRIEVAL_RESPONSE,
|
|
29
31
|
MEMBERSHIP_WITNESS,
|
|
30
|
-
MESSAGE_CONTEXT,
|
|
31
32
|
MESSAGE_LOAD_ORACLE_INPUTS,
|
|
32
33
|
type MaybePromise,
|
|
33
34
|
NOTE,
|
|
@@ -35,19 +36,24 @@ import {
|
|
|
35
36
|
NOTE_VALIDATION_REQUEST,
|
|
36
37
|
NULLIFIER_MEMBERSHIP_WITNESS,
|
|
37
38
|
OPTION,
|
|
39
|
+
ORIGIN_BLOCK,
|
|
38
40
|
type OutputSlot,
|
|
39
41
|
PENDING_TAGGED_LOG,
|
|
40
42
|
POINT,
|
|
41
43
|
PROVIDED_SECRET,
|
|
42
44
|
PUBLIC_DATA_WITNESS,
|
|
43
45
|
PUBLIC_KEYS_AND_PARTIAL_ADDRESS,
|
|
46
|
+
RESOLVED_TAGGING_STRATEGY,
|
|
47
|
+
RESOLVED_TX,
|
|
44
48
|
STR,
|
|
49
|
+
STRUCT,
|
|
45
50
|
TX_EFFECT,
|
|
46
51
|
TX_HASH,
|
|
47
52
|
type TypeMapping,
|
|
48
53
|
U32,
|
|
49
54
|
UTILITY_CONTEXT,
|
|
50
55
|
assertReadersConsumed,
|
|
56
|
+
slotsOf,
|
|
51
57
|
} from './oracle_type_mappings.js';
|
|
52
58
|
|
|
53
59
|
export {
|
|
@@ -59,7 +65,9 @@ export {
|
|
|
59
65
|
BOUNDED_VEC,
|
|
60
66
|
BUFFER,
|
|
61
67
|
BYTE,
|
|
68
|
+
CONTRACT_CLASS_LOG,
|
|
62
69
|
DELIVERY_MODE,
|
|
70
|
+
RESOLVED_TAGGING_STRATEGY,
|
|
63
71
|
EPHEMERAL_ARRAY,
|
|
64
72
|
EVENT_VALIDATION_REQUEST,
|
|
65
73
|
FIELD,
|
|
@@ -67,85 +75,23 @@ export {
|
|
|
67
75
|
LOG_RETRIEVAL_REQUEST,
|
|
68
76
|
LOG_RETRIEVAL_RESPONSE,
|
|
69
77
|
MEMBERSHIP_WITNESS,
|
|
70
|
-
MESSAGE_CONTEXT,
|
|
71
78
|
NOTE_VALIDATION_REQUEST,
|
|
72
79
|
OPTION,
|
|
73
80
|
PENDING_TAGGED_LOG,
|
|
74
81
|
POINT,
|
|
75
82
|
PROVIDED_SECRET,
|
|
83
|
+
RESOLVED_TX,
|
|
76
84
|
STR,
|
|
77
85
|
U32,
|
|
86
|
+
slotsOf,
|
|
78
87
|
type InputSlot,
|
|
79
88
|
type MaybePromise,
|
|
80
89
|
type OutputSlot,
|
|
90
|
+
type SlotShape,
|
|
81
91
|
type TypeMapping,
|
|
82
92
|
} from './oracle_type_mappings.js';
|
|
83
93
|
|
|
84
|
-
|
|
85
|
-
| 'aztec_misc_assertCompatibleOracleVersion'
|
|
86
|
-
| 'aztec_misc_getRandomField'
|
|
87
|
-
| 'aztec_misc_log'
|
|
88
|
-
| 'aztec_utl_getUtilityContext'
|
|
89
|
-
| 'aztec_utl_getKeyValidationRequest'
|
|
90
|
-
| 'aztec_utl_getContractInstance'
|
|
91
|
-
| 'aztec_utl_getNoteHashMembershipWitness'
|
|
92
|
-
| 'aztec_utl_getBlockHashMembershipWitness'
|
|
93
|
-
| 'aztec_utl_getNullifierMembershipWitness'
|
|
94
|
-
| 'aztec_utl_getLowNullifierMembershipWitness'
|
|
95
|
-
| 'aztec_utl_getPublicDataWitness'
|
|
96
|
-
| 'aztec_utl_getBlockHeader'
|
|
97
|
-
| 'aztec_utl_getAuthWitness'
|
|
98
|
-
| 'aztec_utl_getPublicKeysAndPartialAddress'
|
|
99
|
-
| 'aztec_utl_doesNullifierExist'
|
|
100
|
-
| 'aztec_utl_getL1ToL2MembershipWitness'
|
|
101
|
-
| 'aztec_utl_getFromPublicStorage'
|
|
102
|
-
| 'aztec_utl_getNotes'
|
|
103
|
-
| 'aztec_utl_getPendingTaggedLogs'
|
|
104
|
-
| 'aztec_utl_validateAndStoreEnqueuedNotesAndEvents'
|
|
105
|
-
| 'aztec_utl_getLogsByTag'
|
|
106
|
-
| 'aztec_utl_getMessageContextsByTxHash'
|
|
107
|
-
| 'aztec_utl_getTxEffect'
|
|
108
|
-
| 'aztec_utl_setCapsule'
|
|
109
|
-
| 'aztec_utl_getCapsule'
|
|
110
|
-
| 'aztec_utl_deleteCapsule'
|
|
111
|
-
| 'aztec_utl_copyCapsule'
|
|
112
|
-
| 'aztec_utl_decryptAes128'
|
|
113
|
-
| 'aztec_utl_getSharedSecrets'
|
|
114
|
-
| 'aztec_utl_setContractSyncCacheInvalid'
|
|
115
|
-
| 'aztec_utl_emitOffchainEffect'
|
|
116
|
-
| 'aztec_utl_callUtilityFunction'
|
|
117
|
-
| 'aztec_utl_pushEphemeral'
|
|
118
|
-
| 'aztec_utl_popEphemeral'
|
|
119
|
-
| 'aztec_utl_getEphemeral'
|
|
120
|
-
| 'aztec_utl_setEphemeral'
|
|
121
|
-
| 'aztec_utl_getEphemeralLen'
|
|
122
|
-
| 'aztec_utl_removeEphemeral'
|
|
123
|
-
| 'aztec_utl_clearEphemeral'
|
|
124
|
-
| 'aztec_utl_pushTransient'
|
|
125
|
-
| 'aztec_utl_popTransient'
|
|
126
|
-
| 'aztec_utl_getTransient'
|
|
127
|
-
| 'aztec_utl_setTransient'
|
|
128
|
-
| 'aztec_utl_getTransientLen'
|
|
129
|
-
| 'aztec_utl_removeTransient'
|
|
130
|
-
| 'aztec_utl_clearTransient'
|
|
131
|
-
| 'aztec_prv_setHashPreimage'
|
|
132
|
-
| 'aztec_prv_getHashPreimage'
|
|
133
|
-
| 'aztec_prv_notifyCreatedNote'
|
|
134
|
-
| 'aztec_prv_notifyNullifiedNote'
|
|
135
|
-
| 'aztec_prv_notifyCreatedNullifier'
|
|
136
|
-
| 'aztec_prv_isNullifierPending'
|
|
137
|
-
| 'aztec_prv_notifyCreatedContractClassLog'
|
|
138
|
-
| 'aztec_prv_callPrivateFunction'
|
|
139
|
-
| 'aztec_prv_assertValidPublicCalldata'
|
|
140
|
-
| 'aztec_prv_notifyRevertiblePhaseStart'
|
|
141
|
-
| 'aztec_prv_isExecutionInRevertiblePhase'
|
|
142
|
-
| 'aztec_prv_getAppTaggingSecret'
|
|
143
|
-
| 'aztec_prv_getNextTaggingIndex'
|
|
144
|
-
| 'aztec_prv_getSenderForTags';
|
|
145
|
-
|
|
146
|
-
type OracleRegistry = Record<OracleRegistryName, OracleRegistryEntry>;
|
|
147
|
-
|
|
148
|
-
export const ORACLE_REGISTRY: OracleRegistry = {
|
|
94
|
+
export const ORACLE_REGISTRY = {
|
|
149
95
|
aztec_misc_assertCompatibleOracleVersion: makeEntry({
|
|
150
96
|
params: [
|
|
151
97
|
{ name: 'major', type: U32 },
|
|
@@ -167,7 +113,10 @@ export const ORACLE_REGISTRY: OracleRegistry = {
|
|
|
167
113
|
aztec_utl_getUtilityContext: makeEntry({ returnType: UTILITY_CONTEXT }),
|
|
168
114
|
|
|
169
115
|
aztec_utl_getKeyValidationRequest: makeEntry({
|
|
170
|
-
params: [
|
|
116
|
+
params: [
|
|
117
|
+
{ name: 'pkMHash', type: FIELD },
|
|
118
|
+
{ name: 'keyIndex', type: FIELD },
|
|
119
|
+
],
|
|
171
120
|
returnType: KEY_VALIDATION_REQUEST,
|
|
172
121
|
}),
|
|
173
122
|
|
|
@@ -192,6 +141,14 @@ export const ORACLE_REGISTRY: OracleRegistry = {
|
|
|
192
141
|
returnType: OPTION(MEMBERSHIP_WITNESS(ARCHIVE_HEIGHT)),
|
|
193
142
|
}),
|
|
194
143
|
|
|
144
|
+
aztec_utl_areBlockHashesInArchive: makeEntry({
|
|
145
|
+
params: [
|
|
146
|
+
{ name: 'anchorBlockHash', type: BLOCK_HASH },
|
|
147
|
+
{ name: 'blockHashes', type: EPHEMERAL_ARRAY(BLOCK_HASH) },
|
|
148
|
+
],
|
|
149
|
+
returnType: EPHEMERAL_ARRAY(BOOL),
|
|
150
|
+
}),
|
|
151
|
+
|
|
195
152
|
aztec_utl_getNullifierMembershipWitness: makeEntry({
|
|
196
153
|
params: [
|
|
197
154
|
{ name: 'blockHash', type: BLOCK_HASH },
|
|
@@ -236,11 +193,18 @@ export const ORACLE_REGISTRY: OracleRegistry = {
|
|
|
236
193
|
returnType: BOOL,
|
|
237
194
|
}),
|
|
238
195
|
|
|
239
|
-
|
|
196
|
+
aztec_utl_getL1ToL2MembershipWitnessV2: makeEntry({
|
|
240
197
|
params: [
|
|
241
|
-
{ name: 'contractAddress', type: AZTEC_ADDRESS },
|
|
242
198
|
{ name: 'messageHash', type: FIELD },
|
|
243
|
-
{
|
|
199
|
+
{
|
|
200
|
+
name: 'nullifier',
|
|
201
|
+
type: OPTION(
|
|
202
|
+
STRUCT<UnsiloedMessageNullifier>([
|
|
203
|
+
{ name: 'contractAddress', type: AZTEC_ADDRESS },
|
|
204
|
+
{ name: 'nullifier', type: FIELD },
|
|
205
|
+
]),
|
|
206
|
+
),
|
|
207
|
+
},
|
|
244
208
|
],
|
|
245
209
|
returnType: MESSAGE_LOAD_ORACLE_INPUTS,
|
|
246
210
|
}),
|
|
@@ -278,7 +242,7 @@ export const ORACLE_REGISTRY: OracleRegistry = {
|
|
|
278
242
|
returnType: BOUNDED_VEC(NOTE),
|
|
279
243
|
}),
|
|
280
244
|
|
|
281
|
-
|
|
245
|
+
aztec_utl_getPendingTaggedLogsV2: makeEntry({
|
|
282
246
|
params: [
|
|
283
247
|
{ name: 'scope', type: AZTEC_ADDRESS },
|
|
284
248
|
{ name: 'providedSecrets', type: EPHEMERAL_ARRAY(PROVIDED_SECRET) },
|
|
@@ -294,14 +258,14 @@ export const ORACLE_REGISTRY: OracleRegistry = {
|
|
|
294
258
|
],
|
|
295
259
|
}),
|
|
296
260
|
|
|
297
|
-
|
|
261
|
+
aztec_utl_getLogsByTagV2: makeEntry({
|
|
298
262
|
params: [{ name: 'requests', type: EPHEMERAL_ARRAY(LOG_RETRIEVAL_REQUEST) }],
|
|
299
263
|
returnType: EPHEMERAL_ARRAY(EPHEMERAL_ARRAY(LOG_RETRIEVAL_RESPONSE)),
|
|
300
264
|
}),
|
|
301
265
|
|
|
302
|
-
|
|
266
|
+
aztec_utl_getResolvedTxs: makeEntry({
|
|
303
267
|
params: [{ name: 'requests', type: EPHEMERAL_ARRAY(FIELD) }],
|
|
304
|
-
returnType: EPHEMERAL_ARRAY(OPTION(
|
|
268
|
+
returnType: EPHEMERAL_ARRAY(OPTION(RESOLVED_TX)),
|
|
305
269
|
}),
|
|
306
270
|
|
|
307
271
|
aztec_utl_getTxEffect: makeEntry({
|
|
@@ -349,8 +313,8 @@ export const ORACLE_REGISTRY: OracleRegistry = {
|
|
|
349
313
|
aztec_utl_decryptAes128: makeEntry({
|
|
350
314
|
params: [
|
|
351
315
|
{ name: 'ciphertext', type: BOUNDED_VEC(BYTE) },
|
|
352
|
-
{ name: 'iv', type: BUFFER(8) },
|
|
353
|
-
{ name: 'symKey', type: BUFFER(8) },
|
|
316
|
+
{ name: 'iv', type: BUFFER(8, 16) },
|
|
317
|
+
{ name: 'symKey', type: BUFFER(8, 16) },
|
|
354
318
|
],
|
|
355
319
|
returnType: OPTION(BOUNDED_VEC(BYTE)),
|
|
356
320
|
}),
|
|
@@ -375,6 +339,46 @@ export const ORACLE_REGISTRY: OracleRegistry = {
|
|
|
375
339
|
params: [{ name: 'data', type: ARRAY(FIELD) }],
|
|
376
340
|
}),
|
|
377
341
|
|
|
342
|
+
aztec_utl_recordFact: makeEntry({
|
|
343
|
+
params: [
|
|
344
|
+
{ name: 'contractAddress', type: AZTEC_ADDRESS },
|
|
345
|
+
{ name: 'scope', type: AZTEC_ADDRESS },
|
|
346
|
+
{ name: 'factCollectionTypeId', type: FIELD },
|
|
347
|
+
{ name: 'factCollectionId', type: FIELD },
|
|
348
|
+
{ name: 'factTypeId', type: FIELD },
|
|
349
|
+
{ name: 'payload', type: EPHEMERAL_ARRAY(FIELD) },
|
|
350
|
+
{ name: 'originBlock', type: OPTION(ORIGIN_BLOCK) },
|
|
351
|
+
],
|
|
352
|
+
}),
|
|
353
|
+
|
|
354
|
+
aztec_utl_deleteFactCollection: makeEntry({
|
|
355
|
+
params: [
|
|
356
|
+
{ name: 'contractAddress', type: AZTEC_ADDRESS },
|
|
357
|
+
{ name: 'scope', type: AZTEC_ADDRESS },
|
|
358
|
+
{ name: 'factCollectionTypeId', type: FIELD },
|
|
359
|
+
{ name: 'factCollectionId', type: FIELD },
|
|
360
|
+
],
|
|
361
|
+
}),
|
|
362
|
+
|
|
363
|
+
aztec_utl_getFactCollection: makeEntry({
|
|
364
|
+
params: [
|
|
365
|
+
{ name: 'contractAddress', type: AZTEC_ADDRESS },
|
|
366
|
+
{ name: 'scope', type: AZTEC_ADDRESS },
|
|
367
|
+
{ name: 'factCollectionTypeId', type: FIELD },
|
|
368
|
+
{ name: 'factCollectionId', type: FIELD },
|
|
369
|
+
],
|
|
370
|
+
returnType: OPTION(FACT_COLLECTION),
|
|
371
|
+
}),
|
|
372
|
+
|
|
373
|
+
aztec_utl_getFactCollectionsByType: makeEntry({
|
|
374
|
+
params: [
|
|
375
|
+
{ name: 'contractAddress', type: AZTEC_ADDRESS },
|
|
376
|
+
{ name: 'scope', type: AZTEC_ADDRESS },
|
|
377
|
+
{ name: 'factCollectionTypeId', type: FIELD },
|
|
378
|
+
],
|
|
379
|
+
returnType: EPHEMERAL_ARRAY(FACT_COLLECTION),
|
|
380
|
+
}),
|
|
381
|
+
|
|
378
382
|
aztec_utl_callUtilityFunction: makeEntry({
|
|
379
383
|
params: [
|
|
380
384
|
{ name: 'contractAddress', type: AZTEC_ADDRESS },
|
|
@@ -520,7 +524,7 @@ export const ORACLE_REGISTRY: OracleRegistry = {
|
|
|
520
524
|
|
|
521
525
|
aztec_prv_notifyCreatedContractClassLog: makeEntry({
|
|
522
526
|
params: [
|
|
523
|
-
{ name: 'log', type:
|
|
527
|
+
{ name: 'log', type: CONTRACT_CLASS_LOG },
|
|
524
528
|
{ name: 'counter', type: U32 },
|
|
525
529
|
],
|
|
526
530
|
}),
|
|
@@ -566,7 +570,24 @@ export const ORACLE_REGISTRY: OracleRegistry = {
|
|
|
566
570
|
}),
|
|
567
571
|
|
|
568
572
|
aztec_prv_getSenderForTags: makeEntry({ returnType: OPTION(AZTEC_ADDRESS) }),
|
|
569
|
-
|
|
573
|
+
|
|
574
|
+
aztec_prv_resolveTaggingStrategy: makeEntry({
|
|
575
|
+
params: [
|
|
576
|
+
{ name: 'sender', type: AZTEC_ADDRESS },
|
|
577
|
+
{ name: 'recipient', type: AZTEC_ADDRESS },
|
|
578
|
+
{ name: 'deliveryMode', type: DELIVERY_MODE },
|
|
579
|
+
],
|
|
580
|
+
returnType: RESOLVED_TAGGING_STRATEGY,
|
|
581
|
+
}),
|
|
582
|
+
|
|
583
|
+
aztec_prv_resolveCustomRequest: makeEntry({
|
|
584
|
+
params: [
|
|
585
|
+
{ name: 'kind', type: FIELD },
|
|
586
|
+
{ name: 'payload', type: ARRAY(FIELD) },
|
|
587
|
+
],
|
|
588
|
+
returnType: ARRAY(FIELD),
|
|
589
|
+
}),
|
|
590
|
+
} satisfies Record<string, OracleRegistryEntry>;
|
|
570
591
|
|
|
571
592
|
// ─── Registry Infrastructure ─────────────────────────────────────────────────
|
|
572
593
|
|
|
@@ -584,6 +605,10 @@ export interface OracleRegistryEntry<
|
|
|
584
605
|
deserializeParams(inputs: InputSlot[]): TDeserializedParams;
|
|
585
606
|
/** Serialize a handler return value into ACVM output slots. */
|
|
586
607
|
serializeReturn(result: TReturnValue): OutputSlot[];
|
|
608
|
+
/** The ordered named parameters with their {@link TypeMapping}s. Lets callers introspect the oracle's wire ABI. */
|
|
609
|
+
readonly params: readonly RegistryParam[];
|
|
610
|
+
/** The return {@link TypeMapping}, or `undefined` for oracles that return nothing. */
|
|
611
|
+
readonly returnType?: TypeMapping<TReturnValue>;
|
|
587
612
|
}
|
|
588
613
|
|
|
589
614
|
export function makeEntry<const TParams extends RegistryParam[] = [], TReturnValue = void>({
|
|
@@ -594,16 +619,18 @@ export function makeEntry<const TParams extends RegistryParam[] = [], TReturnVal
|
|
|
594
619
|
returnType?: TypeMapping<TReturnValue>;
|
|
595
620
|
} = {}): OracleRegistryEntry<InferDeserializedParams<TParams>, TReturnValue> {
|
|
596
621
|
return {
|
|
622
|
+
params: params ?? [],
|
|
623
|
+
returnType,
|
|
597
624
|
deserializeParams(inputs: InputSlot[]): InferDeserializedParams<TParams> {
|
|
598
625
|
const resolvedParams: RegistryParam[] = params ?? [];
|
|
599
626
|
// Walk the input slots left-to-right, advancing by each param's slot count.
|
|
600
627
|
let offset = 0;
|
|
601
|
-
|
|
628
|
+
const named = resolvedParams.map(param => {
|
|
602
629
|
if (!param.type.deserialization) {
|
|
603
630
|
throw new Error(`Param '${param.name}' has no deserialization defined`);
|
|
604
631
|
}
|
|
605
632
|
// Collect the slots for this param and wrap each in a FieldReader.
|
|
606
|
-
const slotCount = param.type
|
|
633
|
+
const slotCount = slotsOf(param.type);
|
|
607
634
|
const readers = inputs
|
|
608
635
|
.slice(offset, offset + slotCount)
|
|
609
636
|
.map(slot => new FieldReader(slot.map(hex => Fr.fromString(hex))));
|
|
@@ -613,7 +640,13 @@ export function makeEntry<const TParams extends RegistryParam[] = [], TReturnVal
|
|
|
613
640
|
const value = param.type.deserialization.fn(readers);
|
|
614
641
|
assertReadersConsumed(readers);
|
|
615
642
|
return { name: param.name, value };
|
|
616
|
-
})
|
|
643
|
+
});
|
|
644
|
+
// Every input slot must be specified by a param: oracles whose Noir decl passes an extra field must declare it
|
|
645
|
+
// (the handler can ignore it). Otherwise an under-declared shape would silently drop a field into nothing.
|
|
646
|
+
if (offset !== inputs.length) {
|
|
647
|
+
throw new Error(`Oracle received ${inputs.length} input slot(s) but the registry specifies ${offset}`);
|
|
648
|
+
}
|
|
649
|
+
return named as unknown as InferDeserializedParams<TParams>;
|
|
617
650
|
},
|
|
618
651
|
serializeReturn(result: TReturnValue): OutputSlot[] {
|
|
619
652
|
if (returnType?.serialization === undefined) {
|
|
@@ -627,7 +660,7 @@ export function makeEntry<const TParams extends RegistryParam[] = [], TReturnVal
|
|
|
627
660
|
}
|
|
628
661
|
|
|
629
662
|
/** A named oracle parameter with its TypeMapping. */
|
|
630
|
-
interface RegistryParam<TName extends string = string, T = any> {
|
|
663
|
+
export interface RegistryParam<TName extends string = string, T = any> {
|
|
631
664
|
name: TName;
|
|
632
665
|
type: TypeMapping<T>;
|
|
633
666
|
}
|
|
@@ -653,14 +686,14 @@ export type ParamTypes<T extends readonly NamedValue[]> = {
|
|
|
653
686
|
* @example `InferDeserializedParams<[RegistryParam<'addr', AztecAddress>, RegistryParam<'slot', Fr>]>`
|
|
654
687
|
* → `[NamedValue<'addr', AztecAddress>, NamedValue<'slot', Fr>]`
|
|
655
688
|
*/
|
|
656
|
-
type InferDeserializedParams<T extends RegistryParam[]> = {
|
|
689
|
+
export type InferDeserializedParams<T extends RegistryParam[]> = {
|
|
657
690
|
[K in keyof T]: T[K] extends RegistryParam<infer N, infer V> ? NamedValue<N, V> : never;
|
|
658
691
|
};
|
|
659
692
|
|
|
660
693
|
// ─── Derived Handler Interfaces ─────────────────────────────────────────────
|
|
661
694
|
|
|
662
695
|
/** Strips the `aztec_{scope}_` prefix from an oracle key to get the handler method name. */
|
|
663
|
-
|
|
696
|
+
type StripOraclePrefix<K extends string> = K extends `aztec_${string}_${infer M}` ? M : never;
|
|
664
697
|
|
|
665
698
|
/** Derives the handler function signature from a registry entry's deserialization/serialization types. */
|
|
666
699
|
type HandlerFn<E extends OracleRegistryEntry> = (
|