@aztec/pxe 0.0.1-commit.96bb3f7 → 0.0.1-commit.993d240
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 +12 -2
- package/dest/bin/check_oracle_version.d.ts.map +1 -1
- package/dest/bin/check_oracle_version.js +32 -26
- package/dest/bin/index.d.ts +2 -0
- package/dest/bin/index.d.ts.map +1 -0
- package/dest/bin/index.js +1 -0
- package/dest/block_synchronizer/block_stream_source.d.ts +10 -0
- package/dest/block_synchronizer/block_stream_source.d.ts.map +1 -0
- package/dest/block_synchronizer/block_stream_source.js +62 -0
- package/dest/block_synchronizer/block_synchronizer.d.ts +16 -6
- package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -1
- package/dest/block_synchronizer/block_synchronizer.js +94 -23
- package/dest/config/index.d.ts +10 -2
- package/dest/config/index.d.ts.map +1 -1
- package/dest/config/index.js +17 -2
- package/dest/config/package_info.js +1 -1
- package/dest/contract_function_simulator/benchmarked_node.d.ts +9 -0
- package/dest/contract_function_simulator/benchmarked_node.d.ts.map +1 -0
- package/dest/contract_function_simulator/benchmarked_node.js +77 -0
- package/dest/contract_function_simulator/contract_function_simulator.d.ts +69 -36
- package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.js +240 -91
- package/dest/contract_function_simulator/ephemeral_array_service.d.ts +28 -0
- package/dest/contract_function_simulator/ephemeral_array_service.d.ts.map +1 -0
- package/dest/contract_function_simulator/ephemeral_array_service.js +78 -0
- package/dest/contract_function_simulator/execution_note_cache.d.ts +18 -9
- package/dest/contract_function_simulator/execution_note_cache.d.ts.map +1 -1
- package/dest/contract_function_simulator/execution_note_cache.js +45 -28
- package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts +7 -11
- package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts.map +1 -1
- package/dest/contract_function_simulator/execution_tagging_index_cache.js +19 -15
- package/dest/contract_function_simulator/index.d.ts +5 -2
- package/dest/contract_function_simulator/index.d.ts.map +1 -1
- package/dest/contract_function_simulator/index.js +4 -1
- package/dest/contract_function_simulator/noir-structs/bounded_vec.d.ts +48 -0
- package/dest/contract_function_simulator/noir-structs/bounded_vec.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/bounded_vec.js +45 -0
- package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts +5 -7
- 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 +9 -10
- package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts +13 -3
- 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 +35 -4
- package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts +2 -2
- 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 +2 -4
- package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +5 -8
- 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 +7 -11
- package/dest/contract_function_simulator/noir-structs/option.d.ts +61 -0
- package/dest/contract_function_simulator/noir-structs/option.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/option.js +62 -0
- package/dest/contract_function_simulator/noir-structs/utility_context.d.ts +4 -10
- package/dest/contract_function_simulator/noir-structs/utility_context.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/utility_context.js +7 -18
- package/dest/contract_function_simulator/oracle/interfaces.d.ts +70 -50
- package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts +3 -1
- package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts +7 -7
- package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/note_packing_utils.js +10 -10
- package/dest/contract_function_simulator/oracle/oracle.d.ts +74 -43
- package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/oracle.js +471 -264
- package/dest/contract_function_simulator/oracle/oracle_registry.d.ts +147 -0
- package/dest/contract_function_simulator/oracle/oracle_registry.d.ts.map +1 -0
- package/dest/contract_function_simulator/oracle/oracle_registry.js +1199 -0
- package/dest/contract_function_simulator/oracle/private_execution.d.ts +2 -26
- package/dest/contract_function_simulator/oracle/private_execution.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution.js +5 -38
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +74 -91
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.js +164 -110
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +156 -78
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +459 -186
- package/dest/contract_function_simulator/pick_notes.d.ts +1 -1
- package/dest/contract_function_simulator/pick_notes.d.ts.map +1 -1
- package/dest/contract_function_simulator/pick_notes.js +20 -3
- package/dest/contract_function_simulator/proxied_contract_data_source.d.ts +1 -1
- package/dest/contract_function_simulator/proxied_contract_data_source.d.ts.map +1 -1
- package/dest/contract_function_simulator/proxied_contract_data_source.js +35 -64
- package/dest/contract_logging.d.ts +27 -0
- package/dest/contract_logging.d.ts.map +1 -0
- package/dest/contract_logging.js +38 -0
- package/dest/contract_sync/contract_sync_service.d.ts +42 -0
- package/dest/contract_sync/contract_sync_service.d.ts.map +1 -0
- package/dest/contract_sync/contract_sync_service.js +135 -0
- package/dest/contract_sync/helpers.d.ts +27 -0
- package/dest/contract_sync/helpers.d.ts.map +1 -0
- package/dest/contract_sync/helpers.js +53 -0
- package/dest/debug/pxe_debug_utils.d.ts +19 -10
- package/dest/debug/pxe_debug_utils.d.ts.map +1 -1
- package/dest/debug/pxe_debug_utils.js +22 -17
- package/dest/entrypoints/client/bundle/index.d.ts +3 -1
- package/dest/entrypoints/client/bundle/index.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/index.js +2 -0
- package/dest/entrypoints/client/bundle/utils.d.ts +2 -2
- package/dest/entrypoints/client/bundle/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/utils.js +33 -11
- package/dest/entrypoints/client/lazy/index.d.ts +3 -1
- package/dest/entrypoints/client/lazy/index.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/index.js +2 -0
- package/dest/entrypoints/client/lazy/utils.d.ts +3 -3
- package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/utils.js +34 -12
- package/dest/entrypoints/pxe_creation_options.d.ts +11 -2
- package/dest/entrypoints/pxe_creation_options.d.ts.map +1 -1
- package/dest/entrypoints/pxe_creation_options.js +3 -1
- package/dest/entrypoints/server/index.d.ts +6 -2
- package/dest/entrypoints/server/index.d.ts.map +1 -1
- package/dest/entrypoints/server/index.js +5 -1
- package/dest/entrypoints/server/utils.d.ts +4 -3
- package/dest/entrypoints/server/utils.d.ts.map +1 -1
- package/dest/entrypoints/server/utils.js +40 -13
- package/dest/events/event_service.d.ts +17 -8
- package/dest/events/event_service.d.ts.map +1 -1
- package/dest/events/event_service.js +58 -28
- package/dest/events/private_event_filter_validator.d.ts +6 -5
- package/dest/events/private_event_filter_validator.d.ts.map +1 -1
- package/dest/events/private_event_filter_validator.js +20 -6
- package/dest/hooks/authorize_utility_call.d.ts +41 -0
- package/dest/hooks/authorize_utility_call.d.ts.map +1 -0
- package/dest/hooks/authorize_utility_call.js +4 -0
- package/dest/hooks/execution_hooks.d.ts +42 -0
- package/dest/hooks/execution_hooks.d.ts.map +1 -0
- package/dest/hooks/execution_hooks.js +9 -0
- package/dest/hooks/index.d.ts +4 -0
- package/dest/hooks/index.d.ts.map +1 -0
- package/dest/hooks/index.js +1 -0
- package/dest/job_coordinator/job_coordinator.d.ts +3 -2
- package/dest/job_coordinator/job_coordinator.d.ts.map +1 -1
- package/dest/job_coordinator/job_coordinator.js +3 -2
- package/dest/logs/log_service.d.ts +13 -10
- package/dest/logs/log_service.d.ts.map +1 -1
- package/dest/logs/log_service.js +132 -84
- package/dest/messages/message_context_service.d.ts +17 -0
- package/dest/messages/message_context_service.d.ts.map +1 -0
- package/dest/messages/message_context_service.js +38 -0
- package/dest/notes/note_service.d.ts +31 -9
- package/dest/notes/note_service.d.ts.map +1 -1
- package/dest/notes/note_service.js +97 -77
- package/dest/notes_filter.d.ts +24 -0
- package/dest/notes_filter.d.ts.map +1 -0
- package/dest/notes_filter.js +4 -0
- package/dest/oracle_version.d.ts +4 -3
- package/dest/oracle_version.d.ts.map +1 -1
- package/dest/oracle_version.js +20 -9
- package/dest/private_kernel/batch_planner.d.ts +47 -0
- package/dest/private_kernel/batch_planner.d.ts.map +1 -0
- package/dest/private_kernel/batch_planner.js +104 -0
- package/dest/private_kernel/hints/compute_tx_expiration_timestamp.d.ts +4 -0
- package/dest/private_kernel/hints/compute_tx_expiration_timestamp.d.ts.map +1 -0
- package/dest/private_kernel/hints/{compute_tx_include_by_timestamp.js → compute_tx_expiration_timestamp.js} +12 -12
- package/dest/private_kernel/hints/index.d.ts +3 -3
- package/dest/private_kernel/hints/index.d.ts.map +1 -1
- package/dest/private_kernel/hints/index.js +2 -2
- package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts +29 -0
- package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts.map +1 -0
- package/dest/private_kernel/hints/{build_private_kernel_reset_private_inputs.js → private_kernel_reset_private_inputs_builder.js} +141 -74
- package/dest/private_kernel/hints/test_utils.d.ts +122 -0
- package/dest/private_kernel/hints/test_utils.d.ts.map +1 -0
- package/dest/private_kernel/hints/test_utils.js +202 -0
- package/dest/private_kernel/private_kernel_execution_prover.d.ts +7 -2
- package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_execution_prover.js +168 -67
- package/dest/private_kernel/private_kernel_oracle.d.ts +28 -29
- package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_oracle.js +96 -2
- package/dest/pxe.d.ts +126 -59
- package/dest/pxe.d.ts.map +1 -1
- package/dest/pxe.js +257 -200
- package/dest/storage/address_store/address_store.d.ts +1 -1
- package/dest/storage/address_store/address_store.d.ts.map +1 -1
- package/dest/storage/address_store/address_store.js +12 -11
- package/dest/storage/anchor_block_store/anchor_block_store.d.ts +9 -1
- package/dest/storage/anchor_block_store/anchor_block_store.d.ts.map +1 -1
- package/dest/storage/anchor_block_store/anchor_block_store.js +9 -2
- package/dest/storage/backwards_compatibility_tests/kv_store_snapshot.d.ts +42 -0
- package/dest/storage/backwards_compatibility_tests/kv_store_snapshot.d.ts.map +1 -0
- package/dest/storage/backwards_compatibility_tests/kv_store_snapshot.js +93 -0
- package/dest/storage/backwards_compatibility_tests/schema_tests.d.ts +15 -0
- package/dest/storage/backwards_compatibility_tests/schema_tests.d.ts.map +1 -0
- package/dest/storage/backwards_compatibility_tests/schema_tests.js +591 -0
- package/dest/storage/backwards_compatibility_tests/store_spy.d.ts +19 -0
- package/dest/storage/backwards_compatibility_tests/store_spy.d.ts.map +1 -0
- package/dest/storage/backwards_compatibility_tests/store_spy.js +63 -0
- package/dest/storage/capsule_store/capsule_service.d.ts +21 -0
- package/dest/storage/capsule_store/capsule_service.d.ts.map +1 -0
- package/dest/storage/capsule_store/capsule_service.js +50 -0
- package/dest/storage/capsule_store/capsule_store.d.ts +25 -10
- package/dest/storage/capsule_store/capsule_store.d.ts.map +1 -1
- package/dest/storage/capsule_store/capsule_store.js +143 -28
- package/dest/storage/capsule_store/index.d.ts +2 -1
- package/dest/storage/capsule_store/index.d.ts.map +1 -1
- package/dest/storage/capsule_store/index.js +1 -0
- package/dest/storage/contract_store/contract_store.d.ts +42 -16
- package/dest/storage/contract_store/contract_store.d.ts.map +1 -1
- package/dest/storage/contract_store/contract_store.js +158 -102
- package/dest/storage/metadata.d.ts +1 -1
- package/dest/storage/metadata.js +1 -1
- package/dest/storage/note_store/note_store.d.ts +50 -51
- package/dest/storage/note_store/note_store.d.ts.map +1 -1
- package/dest/storage/note_store/note_store.js +284 -263
- package/dest/storage/note_store/stored_note.d.ts +16 -0
- package/dest/storage/note_store/stored_note.d.ts.map +1 -0
- package/dest/storage/note_store/stored_note.js +43 -0
- package/dest/storage/open_pxe_stores.d.ts +33 -0
- package/dest/storage/open_pxe_stores.d.ts.map +1 -0
- package/dest/storage/open_pxe_stores.js +27 -0
- package/dest/storage/private_event_store/private_event_store.d.ts +43 -8
- package/dest/storage/private_event_store/private_event_store.d.ts.map +1 -1
- package/dest/storage/private_event_store/private_event_store.js +229 -111
- package/dest/storage/private_event_store/stored_private_event.d.ts +23 -0
- package/dest/storage/private_event_store/stored_private_event.d.ts.map +1 -0
- package/dest/storage/private_event_store/stored_private_event.js +56 -0
- package/dest/storage/tagging_store/recipient_tagging_store.d.ts +16 -9
- package/dest/storage/tagging_store/recipient_tagging_store.d.ts.map +1 -1
- package/dest/storage/tagging_store/recipient_tagging_store.js +88 -19
- package/dest/storage/tagging_store/sender_address_book_store.d.ts +1 -1
- package/dest/storage/tagging_store/sender_address_book_store.d.ts.map +1 -1
- package/dest/storage/tagging_store/sender_address_book_store.js +20 -14
- package/dest/storage/tagging_store/sender_tagging_store.d.ts +43 -32
- package/dest/storage/tagging_store/sender_tagging_store.d.ts.map +1 -1
- package/dest/storage/tagging_store/sender_tagging_store.js +300 -122
- package/dest/tagging/get_all_logs_by_tags.d.ts +48 -0
- package/dest/tagging/get_all_logs_by_tags.d.ts.map +1 -0
- package/dest/tagging/get_all_logs_by_tags.js +59 -0
- package/dest/tagging/index.d.ts +7 -5
- package/dest/tagging/index.d.ts.map +1 -1
- package/dest/tagging/index.js +5 -3
- package/dest/tagging/persist_sender_tagging_index_ranges.d.ts +29 -0
- package/dest/tagging/persist_sender_tagging_index_ranges.d.ts.map +1 -0
- package/dest/tagging/persist_sender_tagging_index_ranges.js +42 -0
- package/dest/tagging/recipient_sync/sync_tagged_private_logs.d.ts +56 -0
- package/dest/tagging/recipient_sync/sync_tagged_private_logs.d.ts.map +1 -0
- package/dest/tagging/recipient_sync/sync_tagged_private_logs.js +163 -0
- package/dest/tagging/recipient_sync/utils/find_highest_indexes.d.ts +3 -3
- package/dest/tagging/recipient_sync/utils/find_highest_indexes.d.ts.map +1 -1
- package/dest/tagging/recipient_sync/utils/find_highest_indexes.js +2 -2
- package/dest/tagging/reconcile_tagging_index_ranges.d.ts +36 -0
- package/dest/tagging/reconcile_tagging_index_ranges.d.ts.map +1 -0
- package/dest/tagging/reconcile_tagging_index_ranges.js +74 -0
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts +5 -9
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts.map +1 -1
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.js +34 -18
- package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts +13 -7
- package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts.map +1 -1
- package/dest/tagging/sender_sync/utils/get_status_change_of_pending.js +44 -16
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts +8 -7
- 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 +44 -27
- package/package.json +31 -19
- package/src/bin/check_oracle_version.ts +42 -31
- package/src/bin/index.ts +1 -0
- package/src/block_synchronizer/block_stream_source.ts +81 -0
- package/src/block_synchronizer/block_synchronizer.ts +116 -36
- package/src/config/index.ts +21 -1
- package/src/config/package_info.ts +1 -1
- package/src/contract_function_simulator/benchmarked_node.ts +103 -0
- package/src/contract_function_simulator/contract_function_simulator.ts +417 -156
- package/src/contract_function_simulator/ephemeral_array_service.ts +110 -0
- package/src/contract_function_simulator/execution_note_cache.ts +44 -25
- package/src/contract_function_simulator/execution_tagging_index_cache.ts +19 -18
- package/src/contract_function_simulator/index.ts +4 -1
- package/src/contract_function_simulator/noir-structs/bounded_vec.ts +55 -0
- package/src/contract_function_simulator/noir-structs/event_validation_request.ts +11 -10
- package/src/contract_function_simulator/noir-structs/log_retrieval_request.ts +36 -3
- package/src/contract_function_simulator/noir-structs/log_retrieval_response.ts +2 -5
- package/src/contract_function_simulator/noir-structs/note_validation_request.ts +6 -11
- package/src/contract_function_simulator/noir-structs/option.ts +69 -0
- package/src/contract_function_simulator/noir-structs/utility_context.ts +6 -25
- package/src/contract_function_simulator/oracle/interfaces.ts +93 -70
- package/src/contract_function_simulator/oracle/note_packing_utils.ts +13 -13
- package/src/contract_function_simulator/oracle/oracle.ts +567 -461
- package/src/contract_function_simulator/oracle/oracle_registry.ts +904 -0
- package/src/contract_function_simulator/oracle/private_execution.ts +5 -71
- package/src/contract_function_simulator/oracle/private_execution_oracle.ts +213 -209
- package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +657 -254
- package/src/contract_function_simulator/pick_notes.ts +22 -3
- package/src/contract_function_simulator/proxied_contract_data_source.ts +41 -64
- package/src/contract_logging.ts +52 -0
- package/src/contract_sync/contract_sync_service.ts +189 -0
- package/src/contract_sync/helpers.ts +86 -0
- package/src/debug/pxe_debug_utils.ts +55 -18
- package/src/entrypoints/client/bundle/index.ts +2 -0
- package/src/entrypoints/client/bundle/utils.ts +26 -20
- package/src/entrypoints/client/lazy/index.ts +2 -0
- package/src/entrypoints/client/lazy/utils.ts +28 -21
- package/src/entrypoints/pxe_creation_options.ts +16 -1
- package/src/entrypoints/server/index.ts +5 -1
- package/src/entrypoints/server/utils.ts +37 -32
- package/src/events/event_service.ts +79 -39
- package/src/events/private_event_filter_validator.ts +23 -5
- package/src/hooks/authorize_utility_call.ts +44 -0
- package/src/hooks/execution_hooks.ts +48 -0
- package/src/hooks/index.ts +7 -0
- package/src/job_coordinator/job_coordinator.ts +4 -3
- package/src/logs/log_service.ts +171 -141
- package/src/messages/message_context_service.ts +45 -0
- package/src/notes/note_service.ts +137 -107
- package/src/notes_filter.ts +24 -0
- package/src/oracle_version.ts +20 -9
- package/src/private_kernel/batch_planner.ts +169 -0
- package/src/private_kernel/hints/{compute_tx_include_by_timestamp.ts → compute_tx_expiration_timestamp.ts} +13 -13
- package/src/private_kernel/hints/index.ts +2 -2
- package/src/private_kernel/hints/{build_private_kernel_reset_private_inputs.ts → private_kernel_reset_private_inputs_builder.ts} +196 -137
- package/src/private_kernel/hints/test_utils.ts +318 -0
- package/src/private_kernel/private_kernel_execution_prover.ts +261 -93
- package/src/private_kernel/private_kernel_oracle.ts +129 -40
- package/src/pxe.ts +467 -273
- package/src/storage/address_store/address_store.ts +15 -15
- package/src/storage/anchor_block_store/anchor_block_store.ts +9 -1
- package/src/storage/backwards_compatibility_tests/__snapshots__/AddressStore.json +22 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/AnchorBlockStore.json +3 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/CapsuleStore.json +16 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/ContractStore.json +28 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/KeyStore.json +52 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/L2TipsKVStore.json +46 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/NoteStore.json +36 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/PrivateEventStore.json +44 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/RecipientTaggingStore.json +18 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/SenderAddressBookStore.json +16 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/SenderTaggingStore.json +22 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/opened_stores.json +97 -0
- package/src/storage/backwards_compatibility_tests/kv_store_snapshot.ts +122 -0
- package/src/storage/backwards_compatibility_tests/schema_tests.ts +712 -0
- package/src/storage/backwards_compatibility_tests/store_spy.ts +73 -0
- package/src/storage/capsule_store/capsule_service.ts +90 -0
- package/src/storage/capsule_store/capsule_store.ts +183 -29
- package/src/storage/capsule_store/index.ts +1 -0
- package/src/storage/contract_store/contract_store.ts +194 -125
- package/src/storage/metadata.ts +1 -1
- package/src/storage/note_store/note_store.ts +323 -320
- package/src/storage/note_store/stored_note.ts +48 -0
- package/src/storage/open_pxe_stores.ts +49 -0
- package/src/storage/private_event_store/private_event_store.ts +296 -124
- package/src/storage/private_event_store/stored_private_event.ts +73 -0
- package/src/storage/tagging_store/recipient_tagging_store.ts +107 -21
- package/src/storage/tagging_store/sender_address_book_store.ts +20 -14
- package/src/storage/tagging_store/sender_tagging_store.ts +366 -134
- package/src/tagging/get_all_logs_by_tags.ts +120 -0
- package/src/tagging/index.ts +6 -4
- package/src/tagging/persist_sender_tagging_index_ranges.ts +57 -0
- package/src/tagging/recipient_sync/sync_tagged_private_logs.ts +240 -0
- package/src/tagging/recipient_sync/utils/find_highest_indexes.ts +4 -4
- package/src/tagging/reconcile_tagging_index_ranges.ts +102 -0
- package/src/tagging/sender_sync/sync_sender_tagging_indexes.ts +59 -21
- package/src/tagging/sender_sync/utils/get_status_change_of_pending.ts +47 -29
- package/src/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.ts +41 -29
- package/dest/contract_function_simulator/proxied_node.d.ts +0 -9
- package/dest/contract_function_simulator/proxied_node.d.ts.map +0 -1
- package/dest/contract_function_simulator/proxied_node.js +0 -27
- package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts +0 -28
- package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts.map +0 -1
- package/dest/private_kernel/hints/compute_tx_include_by_timestamp.d.ts +0 -4
- package/dest/private_kernel/hints/compute_tx_include_by_timestamp.d.ts.map +0 -1
- package/dest/private_kernel/private_kernel_oracle_impl.d.ts +0 -46
- package/dest/private_kernel/private_kernel_oracle_impl.d.ts.map +0 -1
- package/dest/private_kernel/private_kernel_oracle_impl.js +0 -85
- package/dest/public_storage/public_storage_service.d.ts +0 -24
- package/dest/public_storage/public_storage_service.d.ts.map +0 -1
- package/dest/public_storage/public_storage_service.js +0 -26
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts +0 -14
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts.map +0 -1
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.js +0 -99
- package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts +0 -14
- package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts.map +0 -1
- package/dest/tagging/recipient_sync/utils/load_logs_for_range.js +0 -29
- package/dest/tree_membership/tree_membership_service.d.ts +0 -52
- package/dest/tree_membership/tree_membership_service.d.ts.map +0 -1
- package/dest/tree_membership/tree_membership_service.js +0 -84
- package/src/contract_function_simulator/proxied_node.ts +0 -33
- package/src/private_kernel/private_kernel_oracle_impl.ts +0 -127
- package/src/public_storage/public_storage_service.ts +0 -33
- package/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts +0 -132
- package/src/tagging/recipient_sync/utils/load_logs_for_range.ts +0 -43
- package/src/tree_membership/tree_membership_service.ts +0 -112
|
@@ -0,0 +1,1199 @@
|
|
|
1
|
+
/* eslint-disable camelcase */ import { ARCHIVE_HEIGHT, BLOCK_HEADER_LENGTH, KEY_VALIDATION_REQUEST_LENGTH, MAX_CONTRACT_CLASS_LOGS_PER_TX, MAX_L2_TO_L1_MSGS_PER_TX, MAX_NOTE_HASHES_PER_TX, MAX_NULLIFIERS_PER_TX, MAX_PRIVATE_LOGS_PER_TX, MAX_TOTAL_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX, NOTE_HASH_TREE_HEIGHT } from '@aztec/constants';
|
|
2
|
+
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
3
|
+
import { padArrayEnd } from '@aztec/foundation/collection';
|
|
4
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
5
|
+
import { FieldReader } from '@aztec/foundation/serialize';
|
|
6
|
+
import { fromUintArray, toACVMField } from '@aztec/simulator/client';
|
|
7
|
+
import { FunctionSelector, NoteSelector } from '@aztec/stdlib/abi';
|
|
8
|
+
import { PublicDataWrite } from '@aztec/stdlib/avm';
|
|
9
|
+
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
10
|
+
import { BlockHash } from '@aztec/stdlib/block';
|
|
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({
|
|
293
|
+
params: [
|
|
294
|
+
{
|
|
295
|
+
name: 'major',
|
|
296
|
+
type: U32
|
|
297
|
+
},
|
|
298
|
+
{
|
|
299
|
+
name: 'minor',
|
|
300
|
+
type: U32
|
|
301
|
+
}
|
|
302
|
+
]
|
|
303
|
+
}),
|
|
304
|
+
aztec_utl_getRandomField: makeEntry({
|
|
305
|
+
returnType: FIELD
|
|
306
|
+
}),
|
|
307
|
+
aztec_utl_log: makeEntry({
|
|
308
|
+
params: [
|
|
309
|
+
{
|
|
310
|
+
name: 'level',
|
|
311
|
+
type: U32
|
|
312
|
+
},
|
|
313
|
+
{
|
|
314
|
+
name: 'message',
|
|
315
|
+
type: STR
|
|
316
|
+
},
|
|
317
|
+
{
|
|
318
|
+
name: 'fieldsSize',
|
|
319
|
+
type: U32
|
|
320
|
+
},
|
|
321
|
+
{
|
|
322
|
+
name: 'fields',
|
|
323
|
+
type: ARRAY(FIELD)
|
|
324
|
+
}
|
|
325
|
+
]
|
|
326
|
+
}),
|
|
327
|
+
aztec_utl_getUtilityContext: makeEntry({
|
|
328
|
+
returnType: UTILITY_CONTEXT
|
|
329
|
+
}),
|
|
330
|
+
aztec_utl_getKeyValidationRequest: makeEntry({
|
|
331
|
+
params: [
|
|
332
|
+
{
|
|
333
|
+
name: 'pkMHash',
|
|
334
|
+
type: FIELD
|
|
335
|
+
}
|
|
336
|
+
],
|
|
337
|
+
returnType: KEY_VALIDATION_REQUEST
|
|
338
|
+
}),
|
|
339
|
+
aztec_utl_getContractInstance: makeEntry({
|
|
340
|
+
params: [
|
|
341
|
+
{
|
|
342
|
+
name: 'address',
|
|
343
|
+
type: AZTEC_ADDRESS
|
|
344
|
+
}
|
|
345
|
+
],
|
|
346
|
+
returnType: CONTRACT_INSTANCE
|
|
347
|
+
}),
|
|
348
|
+
aztec_utl_getNoteHashMembershipWitness: makeEntry({
|
|
349
|
+
params: [
|
|
350
|
+
{
|
|
351
|
+
name: 'anchorBlockHash',
|
|
352
|
+
type: BLOCK_HASH
|
|
353
|
+
},
|
|
354
|
+
{
|
|
355
|
+
name: 'noteHash',
|
|
356
|
+
type: FIELD
|
|
357
|
+
}
|
|
358
|
+
],
|
|
359
|
+
returnType: MEMBERSHIP_WITNESS(NOTE_HASH_TREE_HEIGHT)
|
|
360
|
+
}),
|
|
361
|
+
aztec_utl_getBlockHashMembershipWitness: makeEntry({
|
|
362
|
+
params: [
|
|
363
|
+
{
|
|
364
|
+
name: 'anchorBlockHash',
|
|
365
|
+
type: BLOCK_HASH
|
|
366
|
+
},
|
|
367
|
+
{
|
|
368
|
+
name: 'blockHash',
|
|
369
|
+
type: BLOCK_HASH
|
|
370
|
+
}
|
|
371
|
+
],
|
|
372
|
+
returnType: OPTION(MEMBERSHIP_WITNESS(ARCHIVE_HEIGHT))
|
|
373
|
+
}),
|
|
374
|
+
aztec_utl_getNullifierMembershipWitness: makeEntry({
|
|
375
|
+
params: [
|
|
376
|
+
{
|
|
377
|
+
name: 'blockHash',
|
|
378
|
+
type: BLOCK_HASH
|
|
379
|
+
},
|
|
380
|
+
{
|
|
381
|
+
name: 'nullifier',
|
|
382
|
+
type: FIELD
|
|
383
|
+
}
|
|
384
|
+
],
|
|
385
|
+
returnType: NULLIFIER_MEMBERSHIP_WITNESS
|
|
386
|
+
}),
|
|
387
|
+
aztec_utl_getLowNullifierMembershipWitness: makeEntry({
|
|
388
|
+
params: [
|
|
389
|
+
{
|
|
390
|
+
name: 'blockHash',
|
|
391
|
+
type: BLOCK_HASH
|
|
392
|
+
},
|
|
393
|
+
{
|
|
394
|
+
name: 'nullifier',
|
|
395
|
+
type: FIELD
|
|
396
|
+
}
|
|
397
|
+
],
|
|
398
|
+
returnType: NULLIFIER_MEMBERSHIP_WITNESS
|
|
399
|
+
}),
|
|
400
|
+
aztec_utl_getPublicDataWitness: makeEntry({
|
|
401
|
+
params: [
|
|
402
|
+
{
|
|
403
|
+
name: 'blockHash',
|
|
404
|
+
type: BLOCK_HASH
|
|
405
|
+
},
|
|
406
|
+
{
|
|
407
|
+
name: 'leafSlot',
|
|
408
|
+
type: FIELD
|
|
409
|
+
}
|
|
410
|
+
],
|
|
411
|
+
returnType: PUBLIC_DATA_WITNESS
|
|
412
|
+
}),
|
|
413
|
+
aztec_utl_getBlockHeader: makeEntry({
|
|
414
|
+
params: [
|
|
415
|
+
{
|
|
416
|
+
name: 'blockNumber',
|
|
417
|
+
type: BLOCK_NUMBER
|
|
418
|
+
}
|
|
419
|
+
],
|
|
420
|
+
returnType: BLOCK_HEADER
|
|
421
|
+
}),
|
|
422
|
+
aztec_utl_getAuthWitness: makeEntry({
|
|
423
|
+
params: [
|
|
424
|
+
{
|
|
425
|
+
name: 'messageHash',
|
|
426
|
+
type: FIELD
|
|
427
|
+
}
|
|
428
|
+
],
|
|
429
|
+
returnType: ARRAY(FIELD)
|
|
430
|
+
}),
|
|
431
|
+
aztec_utl_getPublicKeysAndPartialAddress: makeEntry({
|
|
432
|
+
params: [
|
|
433
|
+
{
|
|
434
|
+
name: 'address',
|
|
435
|
+
type: AZTEC_ADDRESS
|
|
436
|
+
}
|
|
437
|
+
],
|
|
438
|
+
returnType: OPTION(PUBLIC_KEYS_AND_PARTIAL_ADDRESS)
|
|
439
|
+
}),
|
|
440
|
+
aztec_utl_doesNullifierExist: makeEntry({
|
|
441
|
+
params: [
|
|
442
|
+
{
|
|
443
|
+
name: 'innerNullifier',
|
|
444
|
+
type: FIELD
|
|
445
|
+
}
|
|
446
|
+
],
|
|
447
|
+
returnType: BOOL
|
|
448
|
+
}),
|
|
449
|
+
aztec_utl_getL1ToL2MembershipWitness: makeEntry({
|
|
450
|
+
params: [
|
|
451
|
+
{
|
|
452
|
+
name: 'contractAddress',
|
|
453
|
+
type: AZTEC_ADDRESS
|
|
454
|
+
},
|
|
455
|
+
{
|
|
456
|
+
name: 'messageHash',
|
|
457
|
+
type: FIELD
|
|
458
|
+
},
|
|
459
|
+
{
|
|
460
|
+
name: 'secret',
|
|
461
|
+
type: FIELD
|
|
462
|
+
}
|
|
463
|
+
],
|
|
464
|
+
returnType: MESSAGE_LOAD_ORACLE_INPUTS
|
|
465
|
+
}),
|
|
466
|
+
aztec_utl_getFromPublicStorage: makeEntry({
|
|
467
|
+
params: [
|
|
468
|
+
{
|
|
469
|
+
name: 'blockHash',
|
|
470
|
+
type: BLOCK_HASH
|
|
471
|
+
},
|
|
472
|
+
{
|
|
473
|
+
name: 'contractAddress',
|
|
474
|
+
type: AZTEC_ADDRESS
|
|
475
|
+
},
|
|
476
|
+
{
|
|
477
|
+
name: 'startStorageSlot',
|
|
478
|
+
type: FIELD
|
|
479
|
+
},
|
|
480
|
+
{
|
|
481
|
+
name: 'numberOfElements',
|
|
482
|
+
type: U32
|
|
483
|
+
}
|
|
484
|
+
],
|
|
485
|
+
returnType: ARRAY(FIELD)
|
|
486
|
+
}),
|
|
487
|
+
aztec_utl_getNotes: makeEntry({
|
|
488
|
+
params: [
|
|
489
|
+
{
|
|
490
|
+
name: 'owner',
|
|
491
|
+
type: OPTION(AZTEC_ADDRESS)
|
|
492
|
+
},
|
|
493
|
+
{
|
|
494
|
+
name: 'storageSlot',
|
|
495
|
+
type: FIELD
|
|
496
|
+
},
|
|
497
|
+
{
|
|
498
|
+
name: 'numSelects',
|
|
499
|
+
type: U32
|
|
500
|
+
},
|
|
501
|
+
{
|
|
502
|
+
name: 'selectByIndexes',
|
|
503
|
+
type: ARRAY(U32)
|
|
504
|
+
},
|
|
505
|
+
{
|
|
506
|
+
name: 'selectByOffsets',
|
|
507
|
+
type: ARRAY(U32)
|
|
508
|
+
},
|
|
509
|
+
{
|
|
510
|
+
name: 'selectByLengths',
|
|
511
|
+
type: ARRAY(U32)
|
|
512
|
+
},
|
|
513
|
+
{
|
|
514
|
+
name: 'selectValues',
|
|
515
|
+
type: ARRAY(FIELD)
|
|
516
|
+
},
|
|
517
|
+
{
|
|
518
|
+
name: 'selectComparators',
|
|
519
|
+
type: ARRAY(U32)
|
|
520
|
+
},
|
|
521
|
+
{
|
|
522
|
+
name: 'sortByIndexes',
|
|
523
|
+
type: ARRAY(U32)
|
|
524
|
+
},
|
|
525
|
+
{
|
|
526
|
+
name: 'sortByOffsets',
|
|
527
|
+
type: ARRAY(U32)
|
|
528
|
+
},
|
|
529
|
+
{
|
|
530
|
+
name: 'sortByLengths',
|
|
531
|
+
type: ARRAY(U32)
|
|
532
|
+
},
|
|
533
|
+
{
|
|
534
|
+
name: 'sortOrder',
|
|
535
|
+
type: ARRAY(U32)
|
|
536
|
+
},
|
|
537
|
+
{
|
|
538
|
+
name: 'limit',
|
|
539
|
+
type: U32
|
|
540
|
+
},
|
|
541
|
+
{
|
|
542
|
+
name: 'offset',
|
|
543
|
+
type: U32
|
|
544
|
+
},
|
|
545
|
+
{
|
|
546
|
+
name: 'status',
|
|
547
|
+
type: U32
|
|
548
|
+
},
|
|
549
|
+
{
|
|
550
|
+
name: 'maxNotes',
|
|
551
|
+
type: U32
|
|
552
|
+
},
|
|
553
|
+
{
|
|
554
|
+
name: 'packedHintedNoteLength',
|
|
555
|
+
type: U32
|
|
556
|
+
}
|
|
557
|
+
],
|
|
558
|
+
returnType: BOUNDED_VEC(NOTE)
|
|
559
|
+
}),
|
|
560
|
+
aztec_utl_getPendingTaggedLogs: makeEntry({
|
|
561
|
+
params: [
|
|
562
|
+
{
|
|
563
|
+
name: 'scope',
|
|
564
|
+
type: AZTEC_ADDRESS
|
|
565
|
+
}
|
|
566
|
+
],
|
|
567
|
+
returnType: FIELD
|
|
568
|
+
}),
|
|
569
|
+
aztec_utl_validateAndStoreEnqueuedNotesAndEvents: makeEntry({
|
|
570
|
+
params: [
|
|
571
|
+
{
|
|
572
|
+
name: 'noteValidationRequestsArrayBaseSlot',
|
|
573
|
+
type: FIELD
|
|
574
|
+
},
|
|
575
|
+
{
|
|
576
|
+
name: 'eventValidationRequestsArrayBaseSlot',
|
|
577
|
+
type: FIELD
|
|
578
|
+
},
|
|
579
|
+
{
|
|
580
|
+
name: 'scope',
|
|
581
|
+
type: AZTEC_ADDRESS
|
|
582
|
+
}
|
|
583
|
+
]
|
|
584
|
+
}),
|
|
585
|
+
aztec_utl_getLogsByTag: makeEntry({
|
|
586
|
+
params: [
|
|
587
|
+
{
|
|
588
|
+
name: 'requestArrayBaseSlot',
|
|
589
|
+
type: FIELD
|
|
590
|
+
}
|
|
591
|
+
],
|
|
592
|
+
returnType: FIELD
|
|
593
|
+
}),
|
|
594
|
+
aztec_utl_getMessageContextsByTxHash: makeEntry({
|
|
595
|
+
params: [
|
|
596
|
+
{
|
|
597
|
+
name: 'requestArrayBaseSlot',
|
|
598
|
+
type: FIELD
|
|
599
|
+
}
|
|
600
|
+
],
|
|
601
|
+
returnType: FIELD
|
|
602
|
+
}),
|
|
603
|
+
aztec_utl_getTxEffect: makeEntry({
|
|
604
|
+
params: [
|
|
605
|
+
{
|
|
606
|
+
name: 'txHash',
|
|
607
|
+
type: TX_HASH
|
|
608
|
+
}
|
|
609
|
+
],
|
|
610
|
+
returnType: OPTION(TX_EFFECT)
|
|
611
|
+
}),
|
|
612
|
+
aztec_utl_setCapsule: makeEntry({
|
|
613
|
+
params: [
|
|
614
|
+
{
|
|
615
|
+
name: 'contractAddress',
|
|
616
|
+
type: AZTEC_ADDRESS
|
|
617
|
+
},
|
|
618
|
+
{
|
|
619
|
+
name: 'slot',
|
|
620
|
+
type: FIELD
|
|
621
|
+
},
|
|
622
|
+
{
|
|
623
|
+
name: 'capsule',
|
|
624
|
+
type: ARRAY(FIELD)
|
|
625
|
+
},
|
|
626
|
+
{
|
|
627
|
+
name: 'scope',
|
|
628
|
+
type: AZTEC_ADDRESS
|
|
629
|
+
}
|
|
630
|
+
]
|
|
631
|
+
}),
|
|
632
|
+
aztec_utl_getCapsule: makeEntry({
|
|
633
|
+
params: [
|
|
634
|
+
{
|
|
635
|
+
name: 'contractAddress',
|
|
636
|
+
type: AZTEC_ADDRESS
|
|
637
|
+
},
|
|
638
|
+
{
|
|
639
|
+
name: 'slot',
|
|
640
|
+
type: FIELD
|
|
641
|
+
},
|
|
642
|
+
{
|
|
643
|
+
name: 'tSize',
|
|
644
|
+
type: U32
|
|
645
|
+
},
|
|
646
|
+
{
|
|
647
|
+
name: 'scope',
|
|
648
|
+
type: AZTEC_ADDRESS
|
|
649
|
+
}
|
|
650
|
+
],
|
|
651
|
+
returnType: OPTION(ARRAY(FIELD))
|
|
652
|
+
}),
|
|
653
|
+
aztec_utl_deleteCapsule: makeEntry({
|
|
654
|
+
params: [
|
|
655
|
+
{
|
|
656
|
+
name: 'contractAddress',
|
|
657
|
+
type: AZTEC_ADDRESS
|
|
658
|
+
},
|
|
659
|
+
{
|
|
660
|
+
name: 'slot',
|
|
661
|
+
type: FIELD
|
|
662
|
+
},
|
|
663
|
+
{
|
|
664
|
+
name: 'scope',
|
|
665
|
+
type: AZTEC_ADDRESS
|
|
666
|
+
}
|
|
667
|
+
]
|
|
668
|
+
}),
|
|
669
|
+
aztec_utl_copyCapsule: makeEntry({
|
|
670
|
+
params: [
|
|
671
|
+
{
|
|
672
|
+
name: 'contractAddress',
|
|
673
|
+
type: AZTEC_ADDRESS
|
|
674
|
+
},
|
|
675
|
+
{
|
|
676
|
+
name: 'srcSlot',
|
|
677
|
+
type: FIELD
|
|
678
|
+
},
|
|
679
|
+
{
|
|
680
|
+
name: 'dstSlot',
|
|
681
|
+
type: FIELD
|
|
682
|
+
},
|
|
683
|
+
{
|
|
684
|
+
name: 'numEntries',
|
|
685
|
+
type: U32
|
|
686
|
+
},
|
|
687
|
+
{
|
|
688
|
+
name: 'scope',
|
|
689
|
+
type: AZTEC_ADDRESS
|
|
690
|
+
}
|
|
691
|
+
]
|
|
692
|
+
}),
|
|
693
|
+
aztec_utl_decryptAes128: makeEntry({
|
|
694
|
+
params: [
|
|
695
|
+
{
|
|
696
|
+
name: 'ciphertext',
|
|
697
|
+
type: BOUNDED_VEC(BYTE)
|
|
698
|
+
},
|
|
699
|
+
{
|
|
700
|
+
name: 'iv',
|
|
701
|
+
type: BUFFER(8)
|
|
702
|
+
},
|
|
703
|
+
{
|
|
704
|
+
name: 'symKey',
|
|
705
|
+
type: BUFFER(8)
|
|
706
|
+
}
|
|
707
|
+
],
|
|
708
|
+
returnType: OPTION(BOUNDED_VEC(BYTE))
|
|
709
|
+
}),
|
|
710
|
+
aztec_utl_getSharedSecrets: makeEntry({
|
|
711
|
+
params: [
|
|
712
|
+
{
|
|
713
|
+
name: 'address',
|
|
714
|
+
type: AZTEC_ADDRESS
|
|
715
|
+
},
|
|
716
|
+
{
|
|
717
|
+
name: 'ephPksSlot',
|
|
718
|
+
type: FIELD
|
|
719
|
+
},
|
|
720
|
+
{
|
|
721
|
+
name: 'contractAddress',
|
|
722
|
+
type: AZTEC_ADDRESS
|
|
723
|
+
}
|
|
724
|
+
],
|
|
725
|
+
returnType: FIELD
|
|
726
|
+
}),
|
|
727
|
+
aztec_utl_setContractSyncCacheInvalid: makeEntry({
|
|
728
|
+
params: [
|
|
729
|
+
{
|
|
730
|
+
name: 'contractAddress',
|
|
731
|
+
type: AZTEC_ADDRESS
|
|
732
|
+
},
|
|
733
|
+
{
|
|
734
|
+
name: 'scopes',
|
|
735
|
+
type: BOUNDED_VEC(AZTEC_ADDRESS)
|
|
736
|
+
}
|
|
737
|
+
]
|
|
738
|
+
}),
|
|
739
|
+
aztec_utl_emitOffchainEffect: makeEntry({
|
|
740
|
+
params: [
|
|
741
|
+
{
|
|
742
|
+
name: 'data',
|
|
743
|
+
type: ARRAY(FIELD)
|
|
744
|
+
}
|
|
745
|
+
]
|
|
746
|
+
}),
|
|
747
|
+
aztec_utl_callUtilityFunction: makeEntry({
|
|
748
|
+
params: [
|
|
749
|
+
{
|
|
750
|
+
name: 'contractAddress',
|
|
751
|
+
type: AZTEC_ADDRESS
|
|
752
|
+
},
|
|
753
|
+
{
|
|
754
|
+
name: 'functionSelector',
|
|
755
|
+
type: FUNCTION_SELECTOR
|
|
756
|
+
},
|
|
757
|
+
{
|
|
758
|
+
name: 'args',
|
|
759
|
+
type: ARRAY(FIELD)
|
|
760
|
+
}
|
|
761
|
+
],
|
|
762
|
+
returnType: ARRAY(FIELD)
|
|
763
|
+
}),
|
|
764
|
+
aztec_utl_pushEphemeral: makeEntry({
|
|
765
|
+
params: [
|
|
766
|
+
{
|
|
767
|
+
name: 'slot',
|
|
768
|
+
type: FIELD
|
|
769
|
+
},
|
|
770
|
+
{
|
|
771
|
+
name: 'elements',
|
|
772
|
+
type: ARRAY(FIELD)
|
|
773
|
+
}
|
|
774
|
+
],
|
|
775
|
+
returnType: U32
|
|
776
|
+
}),
|
|
777
|
+
aztec_utl_popEphemeral: makeEntry({
|
|
778
|
+
params: [
|
|
779
|
+
{
|
|
780
|
+
name: 'slot',
|
|
781
|
+
type: FIELD
|
|
782
|
+
}
|
|
783
|
+
],
|
|
784
|
+
returnType: ARRAY(FIELD)
|
|
785
|
+
}),
|
|
786
|
+
aztec_utl_getEphemeral: makeEntry({
|
|
787
|
+
params: [
|
|
788
|
+
{
|
|
789
|
+
name: 'slot',
|
|
790
|
+
type: FIELD
|
|
791
|
+
},
|
|
792
|
+
{
|
|
793
|
+
name: 'index',
|
|
794
|
+
type: U32
|
|
795
|
+
}
|
|
796
|
+
],
|
|
797
|
+
returnType: ARRAY(FIELD)
|
|
798
|
+
}),
|
|
799
|
+
aztec_utl_setEphemeral: makeEntry({
|
|
800
|
+
params: [
|
|
801
|
+
{
|
|
802
|
+
name: 'slot',
|
|
803
|
+
type: FIELD
|
|
804
|
+
},
|
|
805
|
+
{
|
|
806
|
+
name: 'index',
|
|
807
|
+
type: U32
|
|
808
|
+
},
|
|
809
|
+
{
|
|
810
|
+
name: 'elements',
|
|
811
|
+
type: ARRAY(FIELD)
|
|
812
|
+
}
|
|
813
|
+
]
|
|
814
|
+
}),
|
|
815
|
+
aztec_utl_getEphemeralLen: makeEntry({
|
|
816
|
+
params: [
|
|
817
|
+
{
|
|
818
|
+
name: 'slot',
|
|
819
|
+
type: FIELD
|
|
820
|
+
}
|
|
821
|
+
],
|
|
822
|
+
returnType: U32
|
|
823
|
+
}),
|
|
824
|
+
aztec_utl_removeEphemeral: makeEntry({
|
|
825
|
+
params: [
|
|
826
|
+
{
|
|
827
|
+
name: 'slot',
|
|
828
|
+
type: FIELD
|
|
829
|
+
},
|
|
830
|
+
{
|
|
831
|
+
name: 'index',
|
|
832
|
+
type: U32
|
|
833
|
+
}
|
|
834
|
+
]
|
|
835
|
+
}),
|
|
836
|
+
aztec_utl_clearEphemeral: makeEntry({
|
|
837
|
+
params: [
|
|
838
|
+
{
|
|
839
|
+
name: 'slot',
|
|
840
|
+
type: FIELD
|
|
841
|
+
}
|
|
842
|
+
]
|
|
843
|
+
}),
|
|
844
|
+
aztec_prv_setHashPreimage: makeEntry({
|
|
845
|
+
params: [
|
|
846
|
+
{
|
|
847
|
+
name: 'values',
|
|
848
|
+
type: ARRAY(FIELD)
|
|
849
|
+
},
|
|
850
|
+
{
|
|
851
|
+
name: 'hash',
|
|
852
|
+
type: FIELD
|
|
853
|
+
}
|
|
854
|
+
]
|
|
855
|
+
}),
|
|
856
|
+
aztec_prv_getHashPreimage: makeEntry({
|
|
857
|
+
params: [
|
|
858
|
+
{
|
|
859
|
+
name: 'returnsHash',
|
|
860
|
+
type: FIELD
|
|
861
|
+
}
|
|
862
|
+
],
|
|
863
|
+
returnType: ARRAY(FIELD)
|
|
864
|
+
}),
|
|
865
|
+
aztec_prv_notifyCreatedNote: makeEntry({
|
|
866
|
+
params: [
|
|
867
|
+
{
|
|
868
|
+
name: 'owner',
|
|
869
|
+
type: AZTEC_ADDRESS
|
|
870
|
+
},
|
|
871
|
+
{
|
|
872
|
+
name: 'storageSlot',
|
|
873
|
+
type: FIELD
|
|
874
|
+
},
|
|
875
|
+
{
|
|
876
|
+
name: 'randomness',
|
|
877
|
+
type: FIELD
|
|
878
|
+
},
|
|
879
|
+
{
|
|
880
|
+
name: 'noteTypeId',
|
|
881
|
+
type: NOTE_SELECTOR
|
|
882
|
+
},
|
|
883
|
+
{
|
|
884
|
+
name: 'note',
|
|
885
|
+
type: ARRAY(FIELD)
|
|
886
|
+
},
|
|
887
|
+
{
|
|
888
|
+
name: 'noteHash',
|
|
889
|
+
type: FIELD
|
|
890
|
+
},
|
|
891
|
+
{
|
|
892
|
+
name: 'counter',
|
|
893
|
+
type: U32
|
|
894
|
+
}
|
|
895
|
+
]
|
|
896
|
+
}),
|
|
897
|
+
aztec_prv_notifyNullifiedNote: makeEntry({
|
|
898
|
+
params: [
|
|
899
|
+
{
|
|
900
|
+
name: 'innerNullifier',
|
|
901
|
+
type: FIELD
|
|
902
|
+
},
|
|
903
|
+
{
|
|
904
|
+
name: 'noteHash',
|
|
905
|
+
type: FIELD
|
|
906
|
+
},
|
|
907
|
+
{
|
|
908
|
+
name: 'counter',
|
|
909
|
+
type: U32
|
|
910
|
+
}
|
|
911
|
+
]
|
|
912
|
+
}),
|
|
913
|
+
aztec_prv_notifyCreatedNullifier: makeEntry({
|
|
914
|
+
params: [
|
|
915
|
+
{
|
|
916
|
+
name: 'innerNullifier',
|
|
917
|
+
type: FIELD
|
|
918
|
+
}
|
|
919
|
+
]
|
|
920
|
+
}),
|
|
921
|
+
aztec_prv_isNullifierPending: makeEntry({
|
|
922
|
+
params: [
|
|
923
|
+
{
|
|
924
|
+
name: 'innerNullifier',
|
|
925
|
+
type: FIELD
|
|
926
|
+
},
|
|
927
|
+
{
|
|
928
|
+
name: 'contractAddress',
|
|
929
|
+
type: AZTEC_ADDRESS
|
|
930
|
+
}
|
|
931
|
+
],
|
|
932
|
+
returnType: BOOL
|
|
933
|
+
}),
|
|
934
|
+
aztec_prv_notifyCreatedContractClassLog: makeEntry({
|
|
935
|
+
params: [
|
|
936
|
+
{
|
|
937
|
+
name: 'log',
|
|
938
|
+
type: CONTRACT_CLASS_LOG_INPUT
|
|
939
|
+
},
|
|
940
|
+
{
|
|
941
|
+
name: 'counter',
|
|
942
|
+
type: U32
|
|
943
|
+
}
|
|
944
|
+
]
|
|
945
|
+
}),
|
|
946
|
+
aztec_prv_callPrivateFunction: makeEntry({
|
|
947
|
+
params: [
|
|
948
|
+
{
|
|
949
|
+
name: 'contractAddress',
|
|
950
|
+
type: AZTEC_ADDRESS
|
|
951
|
+
},
|
|
952
|
+
{
|
|
953
|
+
name: 'functionSelector',
|
|
954
|
+
type: FUNCTION_SELECTOR
|
|
955
|
+
},
|
|
956
|
+
{
|
|
957
|
+
name: 'argsHash',
|
|
958
|
+
type: FIELD
|
|
959
|
+
},
|
|
960
|
+
{
|
|
961
|
+
name: 'sideEffectCounter',
|
|
962
|
+
type: U32
|
|
963
|
+
},
|
|
964
|
+
{
|
|
965
|
+
name: 'isStaticCall',
|
|
966
|
+
type: BOOL
|
|
967
|
+
}
|
|
968
|
+
],
|
|
969
|
+
returnType: CALL_PRIVATE_RESULT
|
|
970
|
+
}),
|
|
971
|
+
aztec_prv_assertValidPublicCalldata: makeEntry({
|
|
972
|
+
params: [
|
|
973
|
+
{
|
|
974
|
+
name: 'calldataHash',
|
|
975
|
+
type: FIELD
|
|
976
|
+
}
|
|
977
|
+
]
|
|
978
|
+
}),
|
|
979
|
+
aztec_prv_notifyRevertiblePhaseStart: makeEntry({
|
|
980
|
+
params: [
|
|
981
|
+
{
|
|
982
|
+
name: 'minRevertibleSideEffectCounter',
|
|
983
|
+
type: U32
|
|
984
|
+
}
|
|
985
|
+
]
|
|
986
|
+
}),
|
|
987
|
+
aztec_prv_isExecutionInRevertiblePhase: makeEntry({
|
|
988
|
+
params: [
|
|
989
|
+
{
|
|
990
|
+
name: 'sideEffectCounter',
|
|
991
|
+
type: U32
|
|
992
|
+
}
|
|
993
|
+
],
|
|
994
|
+
returnType: BOOL
|
|
995
|
+
}),
|
|
996
|
+
aztec_prv_getNextAppTagAsSender: makeEntry({
|
|
997
|
+
params: [
|
|
998
|
+
{
|
|
999
|
+
name: 'sender',
|
|
1000
|
+
type: AZTEC_ADDRESS
|
|
1001
|
+
},
|
|
1002
|
+
{
|
|
1003
|
+
name: 'recipient',
|
|
1004
|
+
type: AZTEC_ADDRESS
|
|
1005
|
+
}
|
|
1006
|
+
],
|
|
1007
|
+
returnType: TAG
|
|
1008
|
+
}),
|
|
1009
|
+
aztec_prv_getNextConstrainedTaggingIndex: makeEntry({
|
|
1010
|
+
params: [
|
|
1011
|
+
{
|
|
1012
|
+
name: 'appSiloedSecret',
|
|
1013
|
+
type: FIELD
|
|
1014
|
+
}
|
|
1015
|
+
],
|
|
1016
|
+
returnType: U32
|
|
1017
|
+
}),
|
|
1018
|
+
aztec_prv_getSenderForTags: makeEntry({
|
|
1019
|
+
returnType: OPTION(AZTEC_ADDRESS)
|
|
1020
|
+
})
|
|
1021
|
+
};
|
|
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 } = {}) {
|
|
1032
|
+
return {
|
|
1033
|
+
deserializeParams (inputs) {
|
|
1034
|
+
const resolvedParams = params ?? [];
|
|
1035
|
+
// Walk the input slots left-to-right, advancing by each param's slot count.
|
|
1036
|
+
let offset = 0;
|
|
1037
|
+
return resolvedParams.map((param)=>{
|
|
1038
|
+
if (!param.type.deserialization) {
|
|
1039
|
+
throw new Error(`Param '${param.name}' has no deserialization defined`);
|
|
1040
|
+
}
|
|
1041
|
+
// Collect the slots for this param and wrap each in a FieldReader.
|
|
1042
|
+
const slotCount = param.type.deserialization.slots;
|
|
1043
|
+
const readers = inputs.slice(offset, offset + slotCount).map((slot)=>new FieldReader(slot.map((hex)=>Fr.fromString(hex))));
|
|
1044
|
+
offset += slotCount;
|
|
1045
|
+
// Delegate to the TypeMapping's deserializer and tag the result with the param name.
|
|
1046
|
+
return {
|
|
1047
|
+
name: param.name,
|
|
1048
|
+
value: param.type.deserialization.fn(readers)
|
|
1049
|
+
};
|
|
1050
|
+
});
|
|
1051
|
+
},
|
|
1052
|
+
serializeReturn (result) {
|
|
1053
|
+
if (returnType?.serialization === undefined) {
|
|
1054
|
+
return [];
|
|
1055
|
+
}
|
|
1056
|
+
return returnType.serialization.fn(result).map((slot)=>Array.isArray(slot) ? slot.map(toACVMField) : toACVMField(slot));
|
|
1057
|
+
}
|
|
1058
|
+
};
|
|
1059
|
+
}
|
|
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
|
+
}
|