@aztec/pxe 0.0.0-test.1 → 0.0.1-commit.1142ef1
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/README.md +5 -5
- package/dest/bin/check_oracle_version.d.ts +2 -0
- package/dest/bin/check_oracle_version.d.ts.map +1 -0
- package/dest/bin/check_oracle_version.js +129 -0
- package/dest/block_synchronizer/block_synchronizer.d.ts +39 -0
- package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -0
- package/dest/{synchronizer/synchronizer.js → block_synchronizer/block_synchronizer.js} +34 -35
- package/dest/block_synchronizer/index.d.ts +2 -0
- package/dest/block_synchronizer/index.d.ts.map +1 -0
- package/dest/block_synchronizer/index.js +1 -0
- package/dest/config/index.d.ts +11 -24
- package/dest/config/index.d.ts.map +1 -1
- package/dest/config/index.js +18 -33
- package/dest/config/package_info.d.ts +1 -1
- package/dest/config/package_info.js +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.d.ts +86 -0
- package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -0
- package/dest/contract_function_simulator/contract_function_simulator.js +331 -0
- package/dest/contract_function_simulator/execution_note_cache.d.ts +95 -0
- package/dest/contract_function_simulator/execution_note_cache.d.ts.map +1 -0
- package/dest/contract_function_simulator/execution_note_cache.js +191 -0
- package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts +16 -0
- package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts.map +1 -0
- package/dest/contract_function_simulator/execution_tagging_index_cache.js +26 -0
- package/dest/contract_function_simulator/hashed_values_cache.d.ts +28 -0
- package/dest/contract_function_simulator/hashed_values_cache.d.ts.map +1 -0
- package/dest/contract_function_simulator/hashed_values_cache.js +36 -0
- package/dest/contract_function_simulator/index.d.ts +14 -0
- package/dest/contract_function_simulator/index.d.ts.map +1 -0
- package/dest/contract_function_simulator/index.js +12 -0
- package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts +21 -0
- package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/event_validation_request.js +40 -0
- package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts +16 -0
- package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/log_retrieval_request.js +26 -0
- package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts +17 -0
- package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/log_retrieval_response.js +65 -0
- package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +24 -0
- package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/note_validation_request.js +51 -0
- package/dest/contract_function_simulator/noir-structs/utility_context.d.ts +22 -0
- package/dest/contract_function_simulator/noir-structs/utility_context.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/utility_context.js +33 -0
- package/dest/contract_function_simulator/oracle/index.d.ts +14 -0
- package/dest/contract_function_simulator/oracle/index.d.ts.map +1 -0
- package/dest/contract_function_simulator/oracle/index.js +2 -0
- package/dest/contract_function_simulator/oracle/interfaces.d.ts +103 -0
- package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -0
- package/dest/contract_function_simulator/oracle/interfaces.js +4 -0
- package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts +17 -0
- package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts.map +1 -0
- package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.js +24 -0
- package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts +28 -0
- package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts.map +1 -0
- package/dest/contract_function_simulator/oracle/note_packing_utils.js +54 -0
- package/dest/contract_function_simulator/oracle/oracle.d.ts +58 -0
- package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -0
- package/dest/contract_function_simulator/oracle/oracle.js +345 -0
- package/dest/contract_function_simulator/oracle/private_execution.d.ts +47 -0
- package/dest/contract_function_simulator/oracle/private_execution.d.ts.map +1 -0
- package/dest/contract_function_simulator/oracle/private_execution.js +122 -0
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +231 -0
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -0
- package/dest/contract_function_simulator/oracle/private_execution_oracle.js +414 -0
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +196 -0
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -0
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +374 -0
- package/dest/contract_function_simulator/pick_notes.d.ts +85 -0
- package/dest/contract_function_simulator/pick_notes.d.ts.map +1 -0
- package/dest/contract_function_simulator/pick_notes.js +51 -0
- package/dest/contract_function_simulator/proxied_contract_data_source.d.ts +6 -0
- package/dest/contract_function_simulator/proxied_contract_data_source.d.ts.map +1 -0
- package/dest/contract_function_simulator/proxied_contract_data_source.js +80 -0
- package/dest/contract_function_simulator/proxied_node.d.ts +9 -0
- package/dest/contract_function_simulator/proxied_node.d.ts.map +1 -0
- package/dest/contract_function_simulator/proxied_node.js +27 -0
- package/dest/debug/pxe_debug_utils.d.ts +31 -0
- package/dest/debug/pxe_debug_utils.d.ts.map +1 -0
- package/dest/debug/pxe_debug_utils.js +37 -0
- package/dest/entrypoints/client/bundle/index.d.ts +4 -3
- package/dest/entrypoints/client/bundle/index.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/index.js +2 -2
- package/dest/entrypoints/client/bundle/utils.d.ts +10 -10
- package/dest/entrypoints/client/bundle/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/utils.js +27 -12
- package/dest/entrypoints/client/lazy/index.d.ts +4 -3
- package/dest/entrypoints/client/lazy/index.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/index.js +2 -2
- package/dest/entrypoints/client/lazy/utils.d.ts +9 -9
- package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/utils.js +26 -11
- package/dest/entrypoints/pxe_creation_options.d.ts +17 -0
- package/dest/entrypoints/pxe_creation_options.d.ts.map +1 -0
- package/dest/entrypoints/server/index.d.ts +6 -4
- package/dest/entrypoints/server/index.d.ts.map +1 -1
- package/dest/entrypoints/server/index.js +4 -3
- package/dest/entrypoints/server/utils.d.ts +8 -16
- package/dest/entrypoints/server/utils.d.ts.map +1 -1
- package/dest/entrypoints/server/utils.js +35 -36
- package/dest/error_enriching.d.ts +11 -0
- package/dest/error_enriching.d.ts.map +1 -0
- package/dest/{pxe_service/error_enriching.js → error_enriching.js} +30 -22
- package/dest/events/event_service.d.ts +15 -0
- package/dest/events/event_service.d.ts.map +1 -0
- package/dest/events/event_service.js +47 -0
- package/dest/events/index.d.ts +2 -0
- package/dest/events/index.d.ts.map +1 -0
- package/dest/events/index.js +1 -0
- package/dest/events/private_event_filter_validator.d.ts +9 -0
- package/dest/events/private_event_filter_validator.d.ts.map +1 -0
- package/dest/events/private_event_filter_validator.js +39 -0
- package/dest/job_coordinator/job_coordinator.d.ts +74 -0
- package/dest/job_coordinator/job_coordinator.d.ts.map +1 -0
- package/dest/job_coordinator/job_coordinator.js +93 -0
- package/dest/logs/log_service.d.ts +26 -0
- package/dest/logs/log_service.d.ts.map +1 -0
- package/dest/logs/log_service.js +120 -0
- package/dest/notes/index.d.ts +2 -0
- package/dest/notes/index.d.ts.map +1 -0
- package/dest/notes/index.js +1 -0
- package/dest/notes/note_service.d.ts +48 -0
- package/dest/notes/note_service.d.ts.map +1 -0
- package/dest/notes/note_service.js +152 -0
- package/dest/oracle_version.d.ts +3 -0
- package/dest/oracle_version.d.ts.map +1 -0
- package/dest/oracle_version.js +10 -0
- package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts +28 -0
- package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts.map +1 -0
- package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.js +271 -0
- package/dest/private_kernel/hints/compute_tx_include_by_timestamp.d.ts +4 -0
- package/dest/private_kernel/hints/compute_tx_include_by_timestamp.d.ts.map +1 -0
- package/dest/private_kernel/hints/compute_tx_include_by_timestamp.js +41 -0
- package/dest/private_kernel/hints/index.d.ts +3 -0
- package/dest/private_kernel/hints/index.d.ts.map +1 -0
- package/dest/{kernel_prover → private_kernel}/hints/index.js +1 -0
- package/dest/private_kernel/index.d.ts +3 -0
- package/dest/private_kernel/index.d.ts.map +1 -0
- package/dest/private_kernel/index.js +2 -0
- package/dest/private_kernel/private_kernel_execution_prover.d.ts +44 -0
- package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -0
- package/dest/private_kernel/private_kernel_execution_prover.js +285 -0
- package/dest/private_kernel/private_kernel_oracle.d.ts +64 -0
- package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -0
- package/dest/private_kernel/private_kernel_oracle.js +4 -0
- package/dest/private_kernel/private_kernel_oracle_impl.d.ts +46 -0
- package/dest/private_kernel/private_kernel_oracle_impl.d.ts.map +1 -0
- package/dest/{kernel_oracle/index.js → private_kernel/private_kernel_oracle_impl.js} +27 -18
- package/dest/public_storage/public_storage_service.d.ts +24 -0
- package/dest/public_storage/public_storage_service.d.ts.map +1 -0
- package/dest/public_storage/public_storage_service.js +26 -0
- package/dest/pxe.d.ts +233 -0
- package/dest/pxe.d.ts.map +1 -0
- package/dest/pxe.js +782 -0
- package/dest/storage/address_store/address_store.d.ts +11 -0
- package/dest/storage/address_store/address_store.d.ts.map +1 -0
- package/dest/storage/{address_data_provider/address_data_provider.js → address_store/address_store.js} +1 -4
- package/dest/storage/address_store/index.d.ts +2 -0
- package/dest/storage/address_store/index.d.ts.map +1 -0
- package/dest/storage/address_store/index.js +1 -0
- package/dest/storage/anchor_block_store/anchor_block_store.d.ts +9 -0
- package/dest/storage/anchor_block_store/anchor_block_store.d.ts.map +1 -0
- package/dest/storage/{sync_data_provider/sync_data_provider.js → anchor_block_store/anchor_block_store.js} +2 -12
- package/dest/storage/anchor_block_store/index.d.ts +2 -0
- package/dest/storage/anchor_block_store/index.d.ts.map +1 -0
- package/dest/storage/anchor_block_store/index.js +1 -0
- package/dest/storage/capsule_store/capsule_store.d.ts +57 -0
- package/dest/storage/capsule_store/capsule_store.d.ts.map +1 -0
- package/dest/storage/capsule_store/capsule_store.js +146 -0
- package/dest/storage/capsule_store/index.d.ts +2 -0
- package/dest/storage/capsule_store/index.d.ts.map +1 -0
- package/dest/storage/capsule_store/index.js +1 -0
- package/dest/storage/contract_store/contract_store.d.ts +67 -0
- package/dest/storage/contract_store/contract_store.d.ts.map +1 -0
- package/dest/storage/contract_store/contract_store.js +236 -0
- package/dest/storage/contract_store/index.d.ts +2 -0
- package/dest/storage/contract_store/index.d.ts.map +1 -0
- package/dest/storage/contract_store/index.js +1 -0
- package/dest/storage/contract_store/private_functions_tree.d.ts +27 -0
- package/dest/storage/contract_store/private_functions_tree.d.ts.map +1 -0
- package/dest/storage/contract_store/private_functions_tree.js +47 -0
- package/dest/storage/index.d.ts +9 -10
- package/dest/storage/index.d.ts.map +1 -1
- package/dest/storage/index.js +8 -9
- package/dest/storage/metadata.d.ts +2 -0
- package/dest/storage/metadata.d.ts.map +1 -0
- package/dest/storage/metadata.js +1 -0
- package/dest/storage/note_store/index.d.ts +3 -0
- package/dest/storage/note_store/index.d.ts.map +1 -0
- package/dest/storage/note_store/index.js +2 -0
- package/dest/storage/note_store/note_store.d.ts +84 -0
- package/dest/storage/note_store/note_store.d.ts.map +1 -0
- package/dest/storage/note_store/note_store.js +322 -0
- package/dest/storage/private_event_store/private_event_store.d.ts +56 -0
- package/dest/storage/private_event_store/private_event_store.d.ts.map +1 -0
- package/dest/storage/private_event_store/private_event_store.js +158 -0
- package/dest/storage/tagging_store/index.d.ts +4 -0
- package/dest/storage/tagging_store/index.d.ts.map +1 -0
- package/dest/storage/tagging_store/index.js +3 -0
- package/dest/storage/tagging_store/recipient_tagging_store.d.ts +21 -0
- package/dest/storage/tagging_store/recipient_tagging_store.d.ts.map +1 -0
- package/dest/storage/tagging_store/recipient_tagging_store.js +42 -0
- package/dest/storage/tagging_store/sender_address_book_store.d.ts +14 -0
- package/dest/storage/tagging_store/sender_address_book_store.d.ts.map +1 -0
- package/dest/storage/tagging_store/sender_address_book_store.js +30 -0
- package/dest/storage/tagging_store/sender_tagging_store.d.ts +67 -0
- package/dest/storage/tagging_store/sender_tagging_store.d.ts.map +1 -0
- package/dest/storage/tagging_store/sender_tagging_store.js +196 -0
- package/dest/tagging/constants.d.ts +2 -0
- package/dest/tagging/constants.d.ts.map +1 -0
- package/dest/tagging/constants.js +10 -0
- package/dest/tagging/index.d.ts +16 -0
- package/dest/tagging/index.d.ts.map +1 -0
- package/dest/tagging/index.js +14 -0
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts +14 -0
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts.map +1 -0
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.js +99 -0
- package/dest/tagging/recipient_sync/utils/find_highest_indexes.d.ts +12 -0
- package/dest/tagging/recipient_sync/utils/find_highest_indexes.d.ts.map +1 -0
- package/dest/tagging/recipient_sync/utils/find_highest_indexes.js +20 -0
- package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts +14 -0
- package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts.map +1 -0
- package/dest/tagging/recipient_sync/utils/load_logs_for_range.js +29 -0
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts +20 -0
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts.map +1 -0
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.js +74 -0
- package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts +11 -0
- package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts.map +1 -0
- package/dest/tagging/sender_sync/utils/get_status_change_of_pending.js +32 -0
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts +18 -0
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts.map +1 -0
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.js +55 -0
- package/dest/tree_membership/tree_membership_service.d.ts +52 -0
- package/dest/tree_membership/tree_membership_service.d.ts.map +1 -0
- package/dest/tree_membership/tree_membership_service.js +84 -0
- package/package.json +37 -34
- package/src/bin/check_oracle_version.ts +160 -0
- package/src/{synchronizer/synchronizer.ts → block_synchronizer/block_synchronizer.ts} +37 -38
- package/src/block_synchronizer/index.ts +1 -0
- package/src/config/index.ts +27 -55
- package/src/config/package_info.ts +1 -1
- package/src/contract_function_simulator/contract_function_simulator.ts +627 -0
- package/src/contract_function_simulator/execution_note_cache.ts +233 -0
- package/src/contract_function_simulator/execution_tagging_index_cache.ts +32 -0
- package/src/contract_function_simulator/hashed_values_cache.ts +47 -0
- package/src/contract_function_simulator/index.ts +13 -0
- package/src/contract_function_simulator/noir-structs/event_validation_request.ts +51 -0
- package/src/contract_function_simulator/noir-structs/log_retrieval_request.ts +28 -0
- package/src/contract_function_simulator/noir-structs/log_retrieval_response.ts +69 -0
- package/src/contract_function_simulator/noir-structs/note_validation_request.ts +64 -0
- package/src/contract_function_simulator/noir-structs/utility_context.ts +42 -0
- package/src/contract_function_simulator/oracle/index.ts +16 -0
- package/src/contract_function_simulator/oracle/interfaces.ts +175 -0
- package/src/contract_function_simulator/oracle/message_load_oracle_inputs.ts +23 -0
- package/src/contract_function_simulator/oracle/note_packing_utils.ts +68 -0
- package/src/contract_function_simulator/oracle/oracle.ts +605 -0
- package/src/contract_function_simulator/oracle/private_execution.ts +207 -0
- package/src/contract_function_simulator/oracle/private_execution_oracle.ts +676 -0
- package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +536 -0
- package/src/contract_function_simulator/pick_notes.ts +141 -0
- package/src/contract_function_simulator/proxied_contract_data_source.ts +83 -0
- package/src/contract_function_simulator/proxied_node.ts +33 -0
- package/src/debug/pxe_debug_utils.ts +48 -0
- package/src/entrypoints/client/bundle/index.ts +3 -2
- package/src/entrypoints/client/bundle/utils.ts +42 -36
- package/src/entrypoints/client/lazy/index.ts +3 -2
- package/src/entrypoints/client/lazy/utils.ts +41 -31
- package/src/entrypoints/pxe_creation_options.ts +13 -0
- package/src/entrypoints/server/index.ts +5 -3
- package/src/entrypoints/server/utils.ts +55 -51
- package/src/{pxe_service/error_enriching.ts → error_enriching.ts} +40 -39
- package/src/events/event_service.ts +79 -0
- package/src/events/index.ts +1 -0
- package/src/events/private_event_filter_validator.ts +48 -0
- package/src/job_coordinator/job_coordinator.ts +149 -0
- package/src/logs/log_service.ts +202 -0
- package/src/notes/index.ts +1 -0
- package/src/notes/note_service.ts +200 -0
- package/src/oracle_version.ts +11 -0
- package/src/{kernel_prover → private_kernel}/hints/build_private_kernel_reset_private_inputs.ts +159 -148
- package/src/private_kernel/hints/compute_tx_include_by_timestamp.ts +58 -0
- package/src/{kernel_prover → private_kernel}/hints/index.ts +1 -0
- package/src/private_kernel/index.ts +2 -0
- package/src/private_kernel/private_kernel_execution_prover.ts +430 -0
- package/src/{kernel_prover/proving_data_oracle.ts → private_kernel/private_kernel_oracle.ts} +19 -29
- package/src/{kernel_oracle/index.ts → private_kernel/private_kernel_oracle_impl.ts} +40 -30
- package/src/public_storage/public_storage_service.ts +33 -0
- package/src/pxe.ts +1111 -0
- package/src/storage/{address_data_provider/address_data_provider.ts → address_store/address_store.ts} +1 -7
- package/src/storage/address_store/index.ts +1 -0
- package/src/storage/{sync_data_provider/sync_data_provider.ts → anchor_block_store/anchor_block_store.ts} +2 -17
- package/src/storage/anchor_block_store/index.ts +1 -0
- package/src/storage/capsule_store/capsule_store.ts +179 -0
- package/src/storage/capsule_store/index.ts +1 -0
- package/src/storage/contract_store/contract_store.ts +339 -0
- package/src/storage/contract_store/index.ts +1 -0
- package/src/storage/contract_store/private_functions_tree.ts +67 -0
- package/src/storage/index.ts +8 -10
- package/src/storage/metadata.ts +1 -0
- package/src/storage/note_store/index.ts +2 -0
- package/src/storage/{note_data_provider/note_data_provider.ts → note_store/note_store.ts} +190 -123
- package/src/storage/private_event_store/private_event_store.ts +216 -0
- package/src/storage/tagging_store/index.ts +3 -0
- package/src/storage/tagging_store/recipient_tagging_store.ts +53 -0
- package/src/storage/tagging_store/sender_address_book_store.ts +42 -0
- package/src/storage/tagging_store/sender_tagging_store.ts +244 -0
- package/src/tagging/constants.ts +10 -0
- package/src/tagging/index.ts +18 -0
- package/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts +132 -0
- package/src/tagging/recipient_sync/utils/find_highest_indexes.ts +34 -0
- package/src/tagging/recipient_sync/utils/load_logs_for_range.ts +43 -0
- package/src/tagging/sender_sync/sync_sender_tagging_indexes.ts +96 -0
- package/src/tagging/sender_sync/utils/get_status_change_of_pending.ts +48 -0
- package/src/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.ts +72 -0
- package/src/tree_membership/tree_membership_service.ts +112 -0
- package/dest/bin/index.d.ts +0 -3
- package/dest/bin/index.d.ts.map +0 -1
- package/dest/bin/index.js +0 -28
- package/dest/entrypoints/client/pxe_creation_options.d.ts +0 -11
- package/dest/entrypoints/client/pxe_creation_options.d.ts.map +0 -1
- package/dest/kernel_oracle/index.d.ts +0 -45
- package/dest/kernel_oracle/index.d.ts.map +0 -1
- package/dest/kernel_prover/hints/build_private_kernel_reset_private_inputs.d.ts +0 -28
- package/dest/kernel_prover/hints/build_private_kernel_reset_private_inputs.d.ts.map +0 -1
- package/dest/kernel_prover/hints/build_private_kernel_reset_private_inputs.js +0 -270
- package/dest/kernel_prover/hints/index.d.ts +0 -2
- package/dest/kernel_prover/hints/index.d.ts.map +0 -1
- package/dest/kernel_prover/index.d.ts +0 -3
- package/dest/kernel_prover/index.d.ts.map +0 -1
- package/dest/kernel_prover/index.js +0 -2
- package/dest/kernel_prover/kernel_prover.d.ts +0 -38
- package/dest/kernel_prover/kernel_prover.d.ts.map +0 -1
- package/dest/kernel_prover/kernel_prover.js +0 -217
- package/dest/kernel_prover/proving_data_oracle.d.ts +0 -73
- package/dest/kernel_prover/proving_data_oracle.d.ts.map +0 -1
- package/dest/kernel_prover/proving_data_oracle.js +0 -4
- package/dest/note_decryption_utils/add_public_values_to_payload.d.ts +0 -11
- package/dest/note_decryption_utils/add_public_values_to_payload.d.ts.map +0 -1
- package/dest/note_decryption_utils/add_public_values_to_payload.js +0 -47
- package/dest/pxe_http/index.d.ts +0 -2
- package/dest/pxe_http/index.d.ts.map +0 -1
- package/dest/pxe_http/index.js +0 -1
- package/dest/pxe_http/pxe_http_server.d.ts +0 -16
- package/dest/pxe_http/pxe_http_server.d.ts.map +0 -1
- package/dest/pxe_http/pxe_http_server.js +0 -27
- package/dest/pxe_oracle_interface/index.d.ts +0 -159
- package/dest/pxe_oracle_interface/index.d.ts.map +0 -1
- package/dest/pxe_oracle_interface/index.js +0 -692
- package/dest/pxe_oracle_interface/tagging_utils.d.ts +0 -17
- package/dest/pxe_oracle_interface/tagging_utils.d.ts.map +0 -1
- package/dest/pxe_oracle_interface/tagging_utils.js +0 -23
- package/dest/pxe_service/error_enriching.d.ts +0 -11
- package/dest/pxe_service/error_enriching.d.ts.map +0 -1
- package/dest/pxe_service/index.d.ts +0 -3
- package/dest/pxe_service/index.d.ts.map +0 -1
- package/dest/pxe_service/index.js +0 -2
- package/dest/pxe_service/pxe_service.d.ts +0 -111
- package/dest/pxe_service/pxe_service.d.ts.map +0 -1
- package/dest/pxe_service/pxe_service.js +0 -664
- package/dest/storage/address_data_provider/address_data_provider.d.ts +0 -13
- package/dest/storage/address_data_provider/address_data_provider.d.ts.map +0 -1
- package/dest/storage/address_data_provider/index.d.ts +0 -2
- package/dest/storage/address_data_provider/index.d.ts.map +0 -1
- package/dest/storage/address_data_provider/index.js +0 -1
- package/dest/storage/auth_witness_data_provider/auth_witness_data_provider.d.ts +0 -11
- package/dest/storage/auth_witness_data_provider/auth_witness_data_provider.d.ts.map +0 -1
- package/dest/storage/auth_witness_data_provider/auth_witness_data_provider.js +0 -20
- package/dest/storage/auth_witness_data_provider/index.d.ts +0 -2
- package/dest/storage/auth_witness_data_provider/index.d.ts.map +0 -1
- package/dest/storage/auth_witness_data_provider/index.js +0 -1
- package/dest/storage/capsule_data_provider/capsule_data_provider.d.ts +0 -16
- package/dest/storage/capsule_data_provider/capsule_data_provider.d.ts.map +0 -1
- package/dest/storage/capsule_data_provider/capsule_data_provider.js +0 -57
- package/dest/storage/capsule_data_provider/index.d.ts +0 -2
- package/dest/storage/capsule_data_provider/index.d.ts.map +0 -1
- package/dest/storage/capsule_data_provider/index.js +0 -1
- package/dest/storage/contract_data_provider/contract_data_provider.d.ts +0 -109
- package/dest/storage/contract_data_provider/contract_data_provider.d.ts.map +0 -1
- package/dest/storage/contract_data_provider/contract_data_provider.js +0 -183
- package/dest/storage/contract_data_provider/index.d.ts +0 -3
- package/dest/storage/contract_data_provider/index.d.ts.map +0 -1
- package/dest/storage/contract_data_provider/index.js +0 -2
- package/dest/storage/contract_data_provider/private_functions_tree.d.ts +0 -66
- package/dest/storage/contract_data_provider/private_functions_tree.d.ts.map +0 -1
- package/dest/storage/contract_data_provider/private_functions_tree.js +0 -99
- package/dest/storage/data_provider.d.ts +0 -4
- package/dest/storage/data_provider.d.ts.map +0 -1
- package/dest/storage/data_provider.js +0 -1
- package/dest/storage/note_data_provider/index.d.ts +0 -3
- package/dest/storage/note_data_provider/index.d.ts.map +0 -1
- package/dest/storage/note_data_provider/index.js +0 -2
- package/dest/storage/note_data_provider/note_dao.d.ts +0 -106
- package/dest/storage/note_data_provider/note_dao.d.ts.map +0 -1
- package/dest/storage/note_data_provider/note_dao.js +0 -106
- package/dest/storage/note_data_provider/note_data_provider.d.ts +0 -20
- package/dest/storage/note_data_provider/note_data_provider.d.ts.map +0 -1
- package/dest/storage/note_data_provider/note_data_provider.js +0 -249
- package/dest/storage/sync_data_provider/index.d.ts +0 -2
- package/dest/storage/sync_data_provider/index.d.ts.map +0 -1
- package/dest/storage/sync_data_provider/index.js +0 -1
- package/dest/storage/sync_data_provider/sync_data_provider.d.ts +0 -12
- package/dest/storage/sync_data_provider/sync_data_provider.d.ts.map +0 -1
- package/dest/storage/tagging_data_provider/index.d.ts +0 -2
- package/dest/storage/tagging_data_provider/index.d.ts.map +0 -1
- package/dest/storage/tagging_data_provider/index.js +0 -1
- package/dest/storage/tagging_data_provider/tagging_data_provider.d.ts +0 -18
- package/dest/storage/tagging_data_provider/tagging_data_provider.d.ts.map +0 -1
- package/dest/storage/tagging_data_provider/tagging_data_provider.js +0 -65
- package/dest/synchronizer/index.d.ts +0 -2
- package/dest/synchronizer/index.d.ts.map +0 -1
- package/dest/synchronizer/index.js +0 -1
- package/dest/synchronizer/synchronizer.d.ts +0 -37
- package/dest/synchronizer/synchronizer.d.ts.map +0 -1
- package/dest/test/pxe_test_suite.d.ts +0 -3
- package/dest/test/pxe_test_suite.d.ts.map +0 -1
- package/dest/test/pxe_test_suite.js +0 -97
- package/src/bin/index.ts +0 -38
- package/src/entrypoints/client/pxe_creation_options.ts +0 -7
- package/src/kernel_prover/index.ts +0 -2
- package/src/kernel_prover/kernel_prover.ts +0 -351
- package/src/note_decryption_utils/add_public_values_to_payload.ts +0 -64
- package/src/pxe_http/index.ts +0 -1
- package/src/pxe_http/pxe_http_server.ts +0 -29
- package/src/pxe_oracle_interface/index.ts +0 -925
- package/src/pxe_oracle_interface/tagging_utils.ts +0 -32
- package/src/pxe_service/index.ts +0 -2
- package/src/pxe_service/pxe_service.ts +0 -949
- package/src/storage/address_data_provider/index.ts +0 -1
- package/src/storage/auth_witness_data_provider/auth_witness_data_provider.ts +0 -34
- package/src/storage/auth_witness_data_provider/index.ts +0 -1
- package/src/storage/capsule_data_provider/capsule_data_provider.ts +0 -80
- package/src/storage/capsule_data_provider/index.ts +0 -1
- package/src/storage/contract_data_provider/contract_data_provider.ts +0 -261
- package/src/storage/contract_data_provider/index.ts +0 -2
- package/src/storage/contract_data_provider/private_functions_tree.ts +0 -131
- package/src/storage/data_provider.ts +0 -3
- package/src/storage/note_data_provider/index.ts +0 -2
- package/src/storage/note_data_provider/note_dao.ts +0 -162
- package/src/storage/sync_data_provider/index.ts +0 -1
- package/src/storage/tagging_data_provider/index.ts +0 -1
- package/src/storage/tagging_data_provider/tagging_data_provider.ts +0 -92
- package/src/synchronizer/index.ts +0 -1
- package/src/test/pxe_test_suite.ts +0 -111
- /package/dest/entrypoints/{client/pxe_creation_options.js → pxe_creation_options.js} +0 -0
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
|
+
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
3
|
+
import { computeNoteHashNonce, computeUniqueNoteHash, siloNoteHash, siloNullifier } from '@aztec/stdlib/hash';
|
|
4
|
+
|
|
5
|
+
import type { NoteData } from './oracle/interfaces.js';
|
|
6
|
+
|
|
7
|
+
interface PendingNote {
|
|
8
|
+
note: NoteData;
|
|
9
|
+
counter: number;
|
|
10
|
+
noteHashForConsumption: Fr;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Data that's accessible by all the function calls in an execution.
|
|
15
|
+
*/
|
|
16
|
+
export class ExecutionNoteCache {
|
|
17
|
+
/**
|
|
18
|
+
* New notes created in this transaction.
|
|
19
|
+
* They are pushed to this array in the same order as they are emitted.
|
|
20
|
+
*/
|
|
21
|
+
private notes: PendingNote[] = [];
|
|
22
|
+
/**
|
|
23
|
+
* This mapping maps from a contract address to the notes in the contract.
|
|
24
|
+
*/
|
|
25
|
+
private noteMap: Map<bigint, PendingNote[]> = new Map();
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* This maps from a contract address to the nullifiers emitted from the contract.
|
|
29
|
+
* The note which is nullified might be new or not (i.e., was generated in a previous transaction).
|
|
30
|
+
* Note that their value (bigint representation) is used because Frs cannot be looked up in Sets.
|
|
31
|
+
*/
|
|
32
|
+
private nullifierMap: Map<bigint, Set<bigint>> = new Map();
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* All nullifiers emitted in this transaction.
|
|
36
|
+
*/
|
|
37
|
+
private allNullifiers: Set<bigint> = new Set();
|
|
38
|
+
|
|
39
|
+
private minRevertibleSideEffectCounter = 0;
|
|
40
|
+
|
|
41
|
+
private inRevertiblePhase = false;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* We don't need to use the tx request hash for nonces if another non revertible nullifier is emitted.
|
|
45
|
+
* In that case we disable injecting the tx request hash as a nullifier.
|
|
46
|
+
*/
|
|
47
|
+
private usedProtocolNullifierForNonces = true;
|
|
48
|
+
|
|
49
|
+
constructor(private readonly protocolNullifier: Fr) {}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Enters the revertible phase of the transaction.
|
|
53
|
+
* @param minRevertibleSideEffectCounter - The counter at which the transaction enters the revertible phase.
|
|
54
|
+
*/
|
|
55
|
+
public async setMinRevertibleSideEffectCounter(minRevertibleSideEffectCounter: number) {
|
|
56
|
+
if (this.inRevertiblePhase) {
|
|
57
|
+
throw new Error(
|
|
58
|
+
`Cannot enter the revertible phase twice. Current counter: ${minRevertibleSideEffectCounter}. Previous enter counter: ${this.minRevertibleSideEffectCounter}`,
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
this.inRevertiblePhase = true;
|
|
62
|
+
this.minRevertibleSideEffectCounter = minRevertibleSideEffectCounter;
|
|
63
|
+
let nonceGenerator = this.protocolNullifier;
|
|
64
|
+
const nullifiers = this.getAllNullifiers();
|
|
65
|
+
if (nullifiers.length > 0) {
|
|
66
|
+
nonceGenerator = new Fr(nullifiers[0]);
|
|
67
|
+
this.usedProtocolNullifierForNonces = false;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// The existing pending notes are all non-revertible.
|
|
71
|
+
// They cannot be squashed by nullifiers emitted after minRevertibleSideEffectCounter is set.
|
|
72
|
+
// Their indexes in the tx are known at this point and won't change. So we can assign a nonce to each one of them.
|
|
73
|
+
// The nonces will be used to create the "complete" nullifier.
|
|
74
|
+
const updatedNotes = await Promise.all(
|
|
75
|
+
this.notes.map(async ({ note, counter }, i) => {
|
|
76
|
+
const noteNonce = await computeNoteHashNonce(nonceGenerator, i);
|
|
77
|
+
const uniqueNoteHash = await computeUniqueNoteHash(
|
|
78
|
+
noteNonce,
|
|
79
|
+
await siloNoteHash(note.contractAddress, note.noteHash),
|
|
80
|
+
);
|
|
81
|
+
return {
|
|
82
|
+
counter,
|
|
83
|
+
note: { ...note, noteNonce },
|
|
84
|
+
noteHashForConsumption: uniqueNoteHash,
|
|
85
|
+
};
|
|
86
|
+
}),
|
|
87
|
+
);
|
|
88
|
+
// Rebuild the data.
|
|
89
|
+
this.notes = [];
|
|
90
|
+
this.noteMap = new Map();
|
|
91
|
+
updatedNotes.forEach(n => this.#addNote(n));
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
public isSideEffectCounterRevertible(sideEffectCounter: number): boolean {
|
|
95
|
+
if (!this.inRevertiblePhase) {
|
|
96
|
+
return false;
|
|
97
|
+
}
|
|
98
|
+
return sideEffectCounter >= this.minRevertibleSideEffectCounter;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
public finish() {
|
|
102
|
+
// If we never entered the revertible phase, we need to use the protocol nullifier to compute the nonces for the
|
|
103
|
+
// notes if no nullifiers have been emitted.
|
|
104
|
+
if (!this.inRevertiblePhase) {
|
|
105
|
+
this.usedProtocolNullifierForNonces = this.getAllNullifiers().length === 0;
|
|
106
|
+
}
|
|
107
|
+
// If we entered the revertible phase, the nonce generator was decided based on wether or not a nullifier was emitted before entering.
|
|
108
|
+
return {
|
|
109
|
+
usedProtocolNullifierForNonces: this.usedProtocolNullifierForNonces,
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Add a new note to cache.
|
|
115
|
+
* @param note - New note created during execution.
|
|
116
|
+
*/
|
|
117
|
+
public addNewNote(note: NoteData, counter: number) {
|
|
118
|
+
const previousNote = this.notes[this.notes.length - 1];
|
|
119
|
+
if (previousNote && previousNote.counter >= counter) {
|
|
120
|
+
throw new Error(
|
|
121
|
+
`Note hash counters must be strictly increasing. Current counter: ${counter}. Previous counter: ${previousNote.counter}.`,
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
this.#addNote({ note, counter, noteHashForConsumption: note.noteHash });
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Add a nullifier to cache. It could be for a db note or a new note created during execution.
|
|
130
|
+
* @param contractAddress - Contract address of the note.
|
|
131
|
+
* @param innerNullifier - Inner nullifier of the note.
|
|
132
|
+
* @param noteHash - A hash of the note. If this value equals 0, it means the note being nullified is from a previous
|
|
133
|
+
* transaction (and thus not a new note).
|
|
134
|
+
*/
|
|
135
|
+
public async nullifyNote(contractAddress: AztecAddress, innerNullifier: Fr, noteHash: Fr) {
|
|
136
|
+
const siloedNullifier = (await siloNullifier(contractAddress, innerNullifier)).toBigInt();
|
|
137
|
+
let nullifiedNoteHashCounter: number | undefined = undefined;
|
|
138
|
+
// Find and remove the matching new note and log(s) if the emitted noteHash is not empty.
|
|
139
|
+
if (!noteHash.isEmpty()) {
|
|
140
|
+
const notesInContract = this.noteMap.get(contractAddress.toBigInt()) ?? [];
|
|
141
|
+
const noteIndexToRemove = notesInContract.findIndex(n => n.noteHashForConsumption.equals(noteHash));
|
|
142
|
+
if (noteIndexToRemove === -1) {
|
|
143
|
+
throw new Error('Attempt to remove a pending note that does not exist.');
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
const note = notesInContract.splice(noteIndexToRemove, 1)[0];
|
|
147
|
+
nullifiedNoteHashCounter = note.counter;
|
|
148
|
+
this.noteMap.set(contractAddress.toBigInt(), notesInContract);
|
|
149
|
+
this.notes = this.notes.filter(n => n.counter !== note.counter);
|
|
150
|
+
|
|
151
|
+
// If the note is non revertible and the nullifier was emitted in the revertible phase, both the note hash and the nullifier will be emitted
|
|
152
|
+
if (this.inRevertiblePhase && note.counter < this.minRevertibleSideEffectCounter) {
|
|
153
|
+
this.recordNullifier(contractAddress, siloedNullifier);
|
|
154
|
+
}
|
|
155
|
+
} else {
|
|
156
|
+
// If the note being nullified comes from a previous tx the nullifier will be emitted.
|
|
157
|
+
this.recordNullifier(contractAddress, siloedNullifier);
|
|
158
|
+
}
|
|
159
|
+
return nullifiedNoteHashCounter;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Adds a nullifier to the cache. Note cache needs to track all nullifiers to decide which nullifier to use for note siloing.
|
|
164
|
+
* @param contractAddress - Contract address that emitted the nullifier.
|
|
165
|
+
* @param innerNullifier
|
|
166
|
+
*/
|
|
167
|
+
public async nullifierCreated(contractAddress: AztecAddress, innerNullifier: Fr) {
|
|
168
|
+
const siloedNullifier = (await siloNullifier(contractAddress, innerNullifier)).toBigInt();
|
|
169
|
+
this.recordNullifier(contractAddress, siloedNullifier);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Return notes created up to current point in execution.
|
|
174
|
+
* If a nullifier for a note in this list is emitted, the note will be deleted.
|
|
175
|
+
* @param contractAddress - Contract address of the notes.
|
|
176
|
+
* @param owner - Owner of the notes. If undefined, returns all notes regardless of owner.
|
|
177
|
+
* @param storageSlot - Storage slot of the notes.
|
|
178
|
+
**/
|
|
179
|
+
public getNotes(contractAddress: AztecAddress, owner: AztecAddress | undefined, storageSlot: Fr) {
|
|
180
|
+
const notes = this.noteMap.get(contractAddress.toBigInt()) ?? [];
|
|
181
|
+
return notes
|
|
182
|
+
.filter(n => owner === undefined || n.note.owner.equals(owner))
|
|
183
|
+
.filter(n => n.note.storageSlot.equals(storageSlot))
|
|
184
|
+
.map(n => n.note);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Check if a note exists in the newNotes array.
|
|
189
|
+
* @param contractAddress - Contract address of the note.
|
|
190
|
+
* @param storageSlot - Storage slot of the note.
|
|
191
|
+
* @param noteHash - A hash of the note.
|
|
192
|
+
**/
|
|
193
|
+
public checkNoteExists(contractAddress: AztecAddress, noteHash: Fr) {
|
|
194
|
+
const notes = this.noteMap.get(contractAddress.toBigInt()) ?? [];
|
|
195
|
+
return notes.some(n => n.note.noteHash.equals(noteHash));
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Return all nullifiers emitted from a contract.
|
|
200
|
+
* @param contractAddress - Address of the contract.
|
|
201
|
+
*/
|
|
202
|
+
public getNullifiers(contractAddress: AztecAddress): Set<bigint> {
|
|
203
|
+
return this.nullifierMap.get(contractAddress.toBigInt()) ?? new Set();
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
#addNote(note: PendingNote) {
|
|
207
|
+
this.notes.push(note);
|
|
208
|
+
|
|
209
|
+
const notes = this.noteMap.get(note.note.contractAddress.toBigInt()) ?? [];
|
|
210
|
+
notes.push(note);
|
|
211
|
+
this.noteMap.set(note.note.contractAddress.toBigInt(), notes);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
getAllNotes(): PendingNote[] {
|
|
215
|
+
return this.notes;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
getAllNullifiers(): Fr[] {
|
|
219
|
+
return [...this.allNullifiers].map(n => new Fr(n));
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
recordNullifier(contractAddress: AztecAddress, siloedNullifier: bigint) {
|
|
223
|
+
const nullifiers = this.getNullifiers(contractAddress);
|
|
224
|
+
|
|
225
|
+
if (nullifiers.has(siloedNullifier)) {
|
|
226
|
+
throw new Error(`Duplicate siloed nullifier ${siloedNullifier} emitted by contract ${contractAddress}`);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
nullifiers.add(siloedNullifier);
|
|
230
|
+
this.nullifierMap.set(contractAddress.toBigInt(), nullifiers);
|
|
231
|
+
this.allNullifiers.add(siloedNullifier);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { DirectionalAppTaggingSecret, type PreTag } from '@aztec/stdlib/logs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A map that stores the tagging index for a given directional app tagging secret.
|
|
5
|
+
* Note: The directional app tagging secret is unique for a (sender, recipient, contract) tuple while the direction
|
|
6
|
+
* of sender -> recipient matters.
|
|
7
|
+
*/
|
|
8
|
+
export class ExecutionTaggingIndexCache {
|
|
9
|
+
private taggingIndexMap: Map<string, number> = new Map();
|
|
10
|
+
|
|
11
|
+
public getLastUsedIndex(secret: DirectionalAppTaggingSecret): number | undefined {
|
|
12
|
+
return this.taggingIndexMap.get(secret.toString());
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
public setLastUsedIndex(secret: DirectionalAppTaggingSecret, index: number) {
|
|
16
|
+
const currentValue = this.taggingIndexMap.get(secret.toString());
|
|
17
|
+
if (currentValue !== undefined && currentValue !== index - 1) {
|
|
18
|
+
throw new Error(`Invalid tagging index update. Current value: ${currentValue}, new value: ${index}`);
|
|
19
|
+
}
|
|
20
|
+
this.taggingIndexMap.set(secret.toString(), index);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Returns the pre-tags that were used in this execution (and that need to be stored in the db).
|
|
25
|
+
*/
|
|
26
|
+
public getUsedPreTags(): PreTag[] {
|
|
27
|
+
return Array.from(this.taggingIndexMap.entries()).map(([secret, index]) => ({
|
|
28
|
+
secret: DirectionalAppTaggingSecret.fromString(secret),
|
|
29
|
+
index,
|
|
30
|
+
}));
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
|
+
import { HashedValues } from '@aztec/stdlib/tx';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* A cache for hashed values (arguments, returns) during transaction execution.
|
|
6
|
+
*/
|
|
7
|
+
export class HashedValuesCache {
|
|
8
|
+
private cache: Map<bigint, Fr[]>;
|
|
9
|
+
|
|
10
|
+
constructor(initialArguments: HashedValues[] = []) {
|
|
11
|
+
this.cache = new Map();
|
|
12
|
+
for (const initialArg of initialArguments) {
|
|
13
|
+
this.cache.set(initialArg.hash.toBigInt(), initialArg.values);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Creates a new hashed values cache.
|
|
19
|
+
* @param initialArguments - The initial arguments to add to the cache.
|
|
20
|
+
* @returns The new hashed values cache.
|
|
21
|
+
*/
|
|
22
|
+
public static create(initialArguments: HashedValues[] = []) {
|
|
23
|
+
return new HashedValuesCache(initialArguments);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Gets preimage of a hash.
|
|
28
|
+
* @param hash - The hash to get the preimage of.
|
|
29
|
+
* @returns The preimage.
|
|
30
|
+
*/
|
|
31
|
+
public getPreimage(hash: Fr): Fr[] | undefined {
|
|
32
|
+
if (hash.isEmpty()) {
|
|
33
|
+
return [];
|
|
34
|
+
} else {
|
|
35
|
+
return this.cache.get(hash.toBigInt());
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Stores values in cache and returns its hash.
|
|
41
|
+
* @param values - The values to store.
|
|
42
|
+
* @returns The hash of the values.
|
|
43
|
+
*/
|
|
44
|
+
public store(values: Fr[], hash: Fr) {
|
|
45
|
+
this.cache.set(hash.toBigInt(), values);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export { ExecutionNoteCache } from './execution_note_cache.js';
|
|
2
|
+
export { ExecutionTaggingIndexCache } from './execution_tagging_index_cache.js';
|
|
3
|
+
export { HashedValuesCache } from './hashed_values_cache.js';
|
|
4
|
+
export { pickNotes } from './pick_notes.js';
|
|
5
|
+
export type { NoteData, IMiscOracle, IUtilityExecutionOracle, IPrivateExecutionOracle } from './oracle/interfaces.js';
|
|
6
|
+
export { MessageLoadOracleInputs } from './oracle/message_load_oracle_inputs.js';
|
|
7
|
+
export { UtilityExecutionOracle } from './oracle/utility_execution_oracle.js';
|
|
8
|
+
export { PrivateExecutionOracle } from './oracle/private_execution_oracle.js';
|
|
9
|
+
export { Oracle } from './oracle/oracle.js';
|
|
10
|
+
export { executePrivateFunction, extractPrivateCircuitPublicInputs } from './oracle/private_execution.js';
|
|
11
|
+
export { generateSimulatedProvingResult } from './contract_function_simulator.js';
|
|
12
|
+
export { packAsRetrievedNote } from './oracle/note_packing_utils.js';
|
|
13
|
+
export { UtilityContext } from './noir-structs/utility_context.js';
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
|
+
import { FieldReader } from '@aztec/foundation/serialize';
|
|
3
|
+
import { EventSelector } from '@aztec/stdlib/abi';
|
|
4
|
+
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
5
|
+
import { TxHash } from '@aztec/stdlib/tx';
|
|
6
|
+
|
|
7
|
+
// TODO(#14617): should we compute this from constants? This value is aztec-nr specific.
|
|
8
|
+
const MAX_EVENT_SERIALIZED_LEN = 12;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Intermediate struct used to perform batch event validation by PXE. The `utilityValidateEnqueuedNotesAndEvents` oracle
|
|
12
|
+
* expects for values of this type to be stored in a `CapsuleArray`.
|
|
13
|
+
*/
|
|
14
|
+
export class EventValidationRequest {
|
|
15
|
+
constructor(
|
|
16
|
+
public contractAddress: AztecAddress,
|
|
17
|
+
public eventTypeId: EventSelector,
|
|
18
|
+
public randomness: Fr,
|
|
19
|
+
public serializedEvent: Fr[],
|
|
20
|
+
public eventCommitment: Fr,
|
|
21
|
+
public txHash: TxHash,
|
|
22
|
+
public recipient: AztecAddress,
|
|
23
|
+
) {}
|
|
24
|
+
|
|
25
|
+
static fromFields(fields: Fr[] | FieldReader): EventValidationRequest {
|
|
26
|
+
const reader = FieldReader.asReader(fields);
|
|
27
|
+
|
|
28
|
+
const contractAddress = AztecAddress.fromField(reader.readField());
|
|
29
|
+
const eventTypeId = EventSelector.fromField(reader.readField());
|
|
30
|
+
|
|
31
|
+
const randomness = reader.readField();
|
|
32
|
+
|
|
33
|
+
const eventStorage = reader.readFieldArray(MAX_EVENT_SERIALIZED_LEN);
|
|
34
|
+
const eventLen = reader.readField().toNumber();
|
|
35
|
+
const serializedEvent = eventStorage.slice(0, eventLen);
|
|
36
|
+
|
|
37
|
+
const eventCommitment = reader.readField();
|
|
38
|
+
const txHash = TxHash.fromField(reader.readField());
|
|
39
|
+
const recipient = AztecAddress.fromField(reader.readField());
|
|
40
|
+
|
|
41
|
+
return new EventValidationRequest(
|
|
42
|
+
contractAddress,
|
|
43
|
+
eventTypeId,
|
|
44
|
+
randomness,
|
|
45
|
+
serializedEvent,
|
|
46
|
+
eventCommitment,
|
|
47
|
+
txHash,
|
|
48
|
+
recipient,
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
|
+
import { FieldReader } from '@aztec/foundation/serialize';
|
|
3
|
+
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
|
+
import { Tag } from '@aztec/stdlib/logs';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Intermediate struct used to perform batch log retrieval by PXE. The `utilityBulkRetrieveLogs` oracle expects values of this
|
|
8
|
+
* type to be stored in a `CapsuleArray`.
|
|
9
|
+
*/
|
|
10
|
+
export class LogRetrievalRequest {
|
|
11
|
+
constructor(
|
|
12
|
+
public contractAddress: AztecAddress,
|
|
13
|
+
public tag: Tag,
|
|
14
|
+
) {}
|
|
15
|
+
|
|
16
|
+
toFields(): Fr[] {
|
|
17
|
+
return [this.contractAddress.toField(), this.tag.value];
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
static fromFields(fields: Fr[] | FieldReader): LogRetrievalRequest {
|
|
21
|
+
const reader = FieldReader.asReader(fields);
|
|
22
|
+
|
|
23
|
+
const contractAddress = AztecAddress.fromField(reader.readField());
|
|
24
|
+
const tag = new Tag(reader.readField());
|
|
25
|
+
|
|
26
|
+
return new LogRetrievalRequest(contractAddress, tag);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { MAX_NOTE_HASHES_PER_TX, PRIVATE_LOG_CIPHERTEXT_LEN } from '@aztec/constants';
|
|
2
|
+
import { range } from '@aztec/foundation/array';
|
|
3
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
4
|
+
import type { TxHash } from '@aztec/stdlib/tx';
|
|
5
|
+
|
|
6
|
+
import { MAX_NOTE_PACKED_LEN } from './note_validation_request.js';
|
|
7
|
+
|
|
8
|
+
const MAX_PUBLIC_LOG_LEN_FOR_NOTE_COMPLETION = MAX_NOTE_PACKED_LEN;
|
|
9
|
+
const MAX_LOG_CONTENT_LEN = Math.max(MAX_PUBLIC_LOG_LEN_FOR_NOTE_COMPLETION, PRIVATE_LOG_CIPHERTEXT_LEN);
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Intermediate struct used to perform batch log retrieval by PXE. The `utilityBulkRetrieveLogs` oracle stores values of this
|
|
13
|
+
* type in a `CapsuleArray`.
|
|
14
|
+
*/
|
|
15
|
+
export class LogRetrievalResponse {
|
|
16
|
+
constructor(
|
|
17
|
+
public logPayload: Fr[],
|
|
18
|
+
public txHash: TxHash,
|
|
19
|
+
public uniqueNoteHashesInTx: Fr[],
|
|
20
|
+
public firstNullifierInTx: Fr,
|
|
21
|
+
) {}
|
|
22
|
+
|
|
23
|
+
toFields(): Fr[] {
|
|
24
|
+
return [
|
|
25
|
+
// We need to trim the payload since public logs can be larger than MAX_LOG_CONTENT_LEN.
|
|
26
|
+
// This is currently not a problem since this class is only used with public logs for note completion.
|
|
27
|
+
...serializeBoundedVec(this.logPayload.slice(0, MAX_LOG_CONTENT_LEN), MAX_LOG_CONTENT_LEN),
|
|
28
|
+
this.txHash.hash,
|
|
29
|
+
...serializeBoundedVec(this.uniqueNoteHashesInTx, MAX_NOTE_HASHES_PER_TX),
|
|
30
|
+
this.firstNullifierInTx,
|
|
31
|
+
];
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
static toEmptyFields(): Fr[] {
|
|
35
|
+
const serializationLen =
|
|
36
|
+
MAX_LOG_CONTENT_LEN +
|
|
37
|
+
1 /* logPayload BVec */ +
|
|
38
|
+
1 /* txHash */ +
|
|
39
|
+
MAX_NOTE_HASHES_PER_TX +
|
|
40
|
+
1 /* uniqueNoteHashesInTx BVec */ +
|
|
41
|
+
1; /* firstNullifierInTx */
|
|
42
|
+
return range(serializationLen).map(_ => Fr.zero());
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
static toSerializedOption(response: LogRetrievalResponse | null): Fr[] {
|
|
46
|
+
if (response) {
|
|
47
|
+
return [new Fr(1), ...response.toFields()];
|
|
48
|
+
} else {
|
|
49
|
+
return [new Fr(0), ...LogRetrievalResponse.toEmptyFields()];
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Helper function to serialize a bounded vector according to Noir's BoundedVec format
|
|
56
|
+
* @param values - The values to serialize
|
|
57
|
+
* @param maxLength - The maximum length of the bounded vector
|
|
58
|
+
* @returns The serialized bounded vector as Fr[]
|
|
59
|
+
*/
|
|
60
|
+
function serializeBoundedVec(values: Fr[], maxLength: number): Fr[] {
|
|
61
|
+
if (values.length > maxLength) {
|
|
62
|
+
throw new Error(`Attempted to serialize ${values} values into a BoundedVec with max length ${maxLength}`);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const lengthDiff = maxLength - values.length;
|
|
66
|
+
const zeroPaddingArray = Array(lengthDiff).fill(Fr.ZERO);
|
|
67
|
+
const storage = values.concat(zeroPaddingArray);
|
|
68
|
+
return [...storage, new Fr(values.length)];
|
|
69
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
|
+
import { FieldReader } from '@aztec/foundation/serialize';
|
|
3
|
+
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
|
+
import { TxHash } from '@aztec/stdlib/tx';
|
|
5
|
+
|
|
6
|
+
// TODO(#14617): should we compute this from constants? This value is aztec-nr specific.
|
|
7
|
+
export const MAX_NOTE_PACKED_LEN = 10;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Intermediate struct used to perform batch note validation by PXE. The `utilityValidateEnqueuedNotesAndEvents` oracle
|
|
11
|
+
* expects for values of this type to be stored in a `CapsuleArray`.
|
|
12
|
+
*/
|
|
13
|
+
export class NoteValidationRequest {
|
|
14
|
+
constructor(
|
|
15
|
+
public contractAddress: AztecAddress,
|
|
16
|
+
public owner: AztecAddress,
|
|
17
|
+
public storageSlot: Fr,
|
|
18
|
+
public randomness: Fr,
|
|
19
|
+
public noteNonce: Fr,
|
|
20
|
+
public content: Fr[],
|
|
21
|
+
public noteHash: Fr,
|
|
22
|
+
public nullifier: Fr,
|
|
23
|
+
public txHash: TxHash,
|
|
24
|
+
public recipient: AztecAddress,
|
|
25
|
+
) {}
|
|
26
|
+
|
|
27
|
+
static fromFields(fields: Fr[] | FieldReader): NoteValidationRequest {
|
|
28
|
+
const reader = FieldReader.asReader(fields);
|
|
29
|
+
|
|
30
|
+
const contractAddress = AztecAddress.fromField(reader.readField());
|
|
31
|
+
const owner = AztecAddress.fromField(reader.readField());
|
|
32
|
+
const storageSlot = reader.readField();
|
|
33
|
+
const randomness = reader.readField();
|
|
34
|
+
const noteNonce = reader.readField();
|
|
35
|
+
|
|
36
|
+
const contentStorage = reader.readFieldArray(MAX_NOTE_PACKED_LEN);
|
|
37
|
+
const contentLen = reader.readField().toNumber();
|
|
38
|
+
const content = contentStorage.slice(0, contentLen);
|
|
39
|
+
|
|
40
|
+
const noteHash = reader.readField();
|
|
41
|
+
const nullifier = reader.readField();
|
|
42
|
+
const txHash = TxHash.fromField(reader.readField());
|
|
43
|
+
const recipient = AztecAddress.fromField(reader.readField());
|
|
44
|
+
|
|
45
|
+
if (reader.remainingFields() !== 0) {
|
|
46
|
+
throw new Error(
|
|
47
|
+
`Error converting array of fields to NoteValidationRequest. Hint: check that MAX_NOTE_PACKED_LEN is consistent with private_notes::MAX_NOTE_PACKED_LEN in Aztec-nr.`,
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return new NoteValidationRequest(
|
|
52
|
+
contractAddress,
|
|
53
|
+
owner,
|
|
54
|
+
storageSlot,
|
|
55
|
+
randomness,
|
|
56
|
+
noteNonce,
|
|
57
|
+
content,
|
|
58
|
+
noteHash,
|
|
59
|
+
nullifier,
|
|
60
|
+
txHash,
|
|
61
|
+
recipient,
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
|
+
import type { FieldsOf } from '@aztec/foundation/types';
|
|
3
|
+
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
|
+
import type { UInt64 } from '@aztec/stdlib/types';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* TypeScript counterpart of utility_context.nr. Used only as a return value for the utilityGetUtilityContext oracle.
|
|
8
|
+
*/
|
|
9
|
+
export class UtilityContext {
|
|
10
|
+
private constructor(
|
|
11
|
+
public readonly blockNumber: number,
|
|
12
|
+
public readonly timestamp: UInt64,
|
|
13
|
+
public readonly contractAddress: AztecAddress,
|
|
14
|
+
public readonly version: Fr,
|
|
15
|
+
public readonly chainId: Fr,
|
|
16
|
+
) {}
|
|
17
|
+
|
|
18
|
+
static from(fields: FieldsOf<UtilityContext>) {
|
|
19
|
+
return new UtilityContext(
|
|
20
|
+
fields.blockNumber,
|
|
21
|
+
fields.timestamp,
|
|
22
|
+
fields.contractAddress,
|
|
23
|
+
fields.version,
|
|
24
|
+
fields.chainId,
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Returns a representation of the utility context as expected by intrinsic Noir deserialization.
|
|
30
|
+
* The order of the fields has to be the same as the order of the fields in the utility_context.nr.
|
|
31
|
+
*/
|
|
32
|
+
public toNoirRepresentation(): (string | string[])[] {
|
|
33
|
+
// TODO(#12874): remove the stupid as string conversion by modifying ForeignCallOutput type in acvm.js
|
|
34
|
+
return [
|
|
35
|
+
new Fr(this.blockNumber).toString() as string,
|
|
36
|
+
new Fr(this.timestamp).toString() as string,
|
|
37
|
+
this.contractAddress.toString() as string,
|
|
38
|
+
this.version.toString() as string,
|
|
39
|
+
this.chainId.toString() as string,
|
|
40
|
+
];
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Oracle } from './oracle.js';
|
|
2
|
+
|
|
3
|
+
export * from './oracle.js';
|
|
4
|
+
export * from './interfaces.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* A conditional type that takes a type `T` and returns a union of its method names.
|
|
8
|
+
*/
|
|
9
|
+
type MethodNames<T> = {
|
|
10
|
+
[K in keyof T]: T[K] extends (...args: any[]) => any ? K : never;
|
|
11
|
+
}[keyof T];
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Available oracle function names.
|
|
15
|
+
*/
|
|
16
|
+
export type ORACLE_NAMES = MethodNames<Oracle>;
|