@aztec/pxe 0.0.1-commit.9593d84 → 0.0.1-commit.96bb3f7
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.js +105 -15
- 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} +24 -23
- 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 +4 -4
- package/dest/config/index.d.ts.map +1 -1
- package/dest/config/package_info.js +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.d.ts +42 -12
- package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.js +50 -19
- package/dest/contract_function_simulator/execution_note_cache.d.ts +4 -3
- package/dest/contract_function_simulator/execution_note_cache.d.ts.map +1 -1
- package/dest/contract_function_simulator/execution_note_cache.js +4 -3
- package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts +1 -1
- package/dest/contract_function_simulator/execution_tagging_index_cache.js +1 -1
- package/dest/contract_function_simulator/hashed_values_cache.d.ts +2 -2
- package/dest/contract_function_simulator/hashed_values_cache.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts +4 -3
- 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 +5 -2
- package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts +5 -4
- 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 +7 -6
- 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 +1 -1
- package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +5 -4
- 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 +6 -3
- package/dest/contract_function_simulator/noir-structs/utility_context.d.ts +2 -2
- package/dest/contract_function_simulator/noir-structs/utility_context.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/utility_context.js +1 -1
- package/dest/contract_function_simulator/oracle/interfaces.d.ts +16 -13
- package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts +2 -2
- package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.js +1 -1
- package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts +7 -3
- package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/note_packing_utils.js +7 -3
- package/dest/contract_function_simulator/oracle/oracle.d.ts +3 -3
- package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/oracle.js +27 -15
- package/dest/contract_function_simulator/oracle/private_execution.d.ts +9 -10
- package/dest/contract_function_simulator/oracle/private_execution.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution.js +13 -14
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +27 -27
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.js +32 -46
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +59 -16
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +149 -40
- package/dest/contract_function_simulator/pick_notes.d.ts +2 -2
- package/dest/contract_function_simulator/pick_notes.d.ts.map +1 -1
- package/dest/contract_function_simulator/pick_notes.js +1 -1
- package/dest/contract_function_simulator/proxied_contract_data_source.d.ts +4 -4
- package/dest/contract_function_simulator/proxied_contract_data_source.d.ts.map +1 -1
- package/dest/contract_function_simulator/proxied_contract_data_source.js +23 -5
- 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 +1 -2
- package/dest/entrypoints/client/bundle/index.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/index.js +0 -1
- package/dest/entrypoints/client/bundle/utils.d.ts +1 -1
- package/dest/entrypoints/client/bundle/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/utils.js +12 -3
- package/dest/entrypoints/client/lazy/index.d.ts +1 -2
- package/dest/entrypoints/client/lazy/index.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/index.js +0 -1
- package/dest/entrypoints/client/lazy/utils.d.ts +1 -1
- package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/utils.js +12 -3
- package/dest/entrypoints/pxe_creation_options.d.ts +5 -2
- package/dest/entrypoints/pxe_creation_options.d.ts.map +1 -1
- package/dest/entrypoints/server/index.d.ts +2 -2
- package/dest/entrypoints/server/index.d.ts.map +1 -1
- package/dest/entrypoints/server/index.js +1 -1
- package/dest/entrypoints/server/utils.d.ts +1 -1
- package/dest/entrypoints/server/utils.d.ts.map +1 -1
- package/dest/entrypoints/server/utils.js +12 -8
- package/dest/error_enriching.d.ts +4 -4
- package/dest/error_enriching.d.ts.map +1 -1
- package/dest/error_enriching.js +6 -6
- 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 +2 -2
- package/dest/oracle_version.js +2 -2
- package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts +2 -2
- package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts.map +1 -1
- package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.js +2 -2
- package/dest/private_kernel/private_kernel_execution_prover.d.ts +1 -1
- package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_execution_prover.js +7 -8
- package/dest/private_kernel/private_kernel_oracle.d.ts +5 -3
- package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_oracle_impl.d.ts +8 -7
- package/dest/private_kernel/private_kernel_oracle_impl.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_oracle_impl.js +9 -10
- 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 +39 -46
- package/dest/pxe.d.ts.map +1 -1
- package/dest/pxe.js +165 -154
- 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 -1
- 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/{sync_data_provider/sync_data_provider.d.ts → anchor_block_store/anchor_block_store.d.ts} +2 -3
- 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 -9
- package/dest/storage/{sync_data_provider → anchor_block_store}/index.d.ts +2 -2
- 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_data_provider/capsule_data_provider.js → capsule_store/capsule_store.js} +34 -6
- 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_data_provider/contract_data_provider.d.ts → contract_store/contract_store.d.ts} +8 -5
- package/dest/storage/contract_store/contract_store.d.ts.map +1 -0
- package/dest/storage/{contract_data_provider/contract_data_provider.js → contract_store/contract_store.js} +46 -3
- 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_data_provider → contract_store}/private_functions_tree.d.ts +1 -1
- package/dest/storage/contract_store/private_functions_tree.d.ts.map +1 -0
- package/dest/storage/{contract_data_provider → contract_store}/private_functions_tree.js +1 -1
- package/dest/storage/index.d.ts +8 -8
- package/dest/storage/index.d.ts.map +1 -1
- package/dest/storage/index.js +7 -7
- 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_data_provider/note_data_provider.d.ts → note_store/note_store.d.ts} +13 -12
- package/dest/storage/note_store/note_store.d.ts.map +1 -0
- package/dest/storage/{note_data_provider/note_data_provider.js → note_store/note_store.js} +20 -9
- 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 -2
- package/dest/tagging/constants.d.ts.map +1 -1
- package/dest/tagging/constants.js +10 -2
- package/dest/tagging/index.d.ts +15 -6
- package/dest/tagging/index.d.ts.map +1 -1
- package/dest/tagging/index.js +14 -5
- 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 +17 -17
- package/src/bin/check_oracle_version.ts +130 -20
- package/src/{synchronizer/synchronizer.ts → block_synchronizer/block_synchronizer.ts} +23 -23
- package/src/block_synchronizer/index.ts +1 -0
- package/src/config/index.ts +3 -3
- package/src/config/package_info.ts +1 -1
- package/src/contract_function_simulator/contract_function_simulator.ts +93 -19
- package/src/contract_function_simulator/execution_note_cache.ts +7 -3
- package/src/contract_function_simulator/execution_tagging_index_cache.ts +1 -1
- package/src/contract_function_simulator/hashed_values_cache.ts +1 -1
- package/src/contract_function_simulator/noir-structs/event_validation_request.ts +5 -1
- package/src/contract_function_simulator/noir-structs/log_retrieval_request.ts +6 -5
- package/src/contract_function_simulator/noir-structs/log_retrieval_response.ts +1 -1
- package/src/contract_function_simulator/noir-structs/note_validation_request.ts +5 -2
- package/src/contract_function_simulator/noir-structs/utility_context.ts +1 -1
- package/src/contract_function_simulator/oracle/interfaces.ts +15 -10
- package/src/contract_function_simulator/oracle/message_load_oracle_inputs.ts +1 -1
- package/src/contract_function_simulator/oracle/note_packing_utils.ts +17 -3
- package/src/contract_function_simulator/oracle/oracle.ts +33 -11
- package/src/contract_function_simulator/oracle/private_execution.ts +17 -17
- package/src/contract_function_simulator/oracle/private_execution_oracle.ts +101 -58
- package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +225 -47
- package/src/contract_function_simulator/pick_notes.ts +1 -1
- package/src/contract_function_simulator/proxied_contract_data_source.ts +24 -7
- package/src/debug/pxe_debug_utils.ts +48 -0
- package/src/entrypoints/client/bundle/index.ts +0 -1
- package/src/entrypoints/client/bundle/utils.ts +9 -3
- package/src/entrypoints/client/lazy/index.ts +0 -1
- package/src/entrypoints/client/lazy/utils.ts +9 -4
- package/src/entrypoints/pxe_creation_options.ts +4 -1
- package/src/entrypoints/server/index.ts +1 -1
- package/src/entrypoints/server/utils.ts +12 -16
- package/src/error_enriching.ts +7 -15
- 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 +2 -2
- package/src/private_kernel/hints/build_private_kernel_reset_private_inputs.ts +2 -3
- package/src/private_kernel/private_kernel_execution_prover.ts +7 -8
- package/src/private_kernel/private_kernel_oracle.ts +4 -2
- package/src/private_kernel/private_kernel_oracle_impl.ts +12 -17
- package/src/public_storage/public_storage_service.ts +33 -0
- package/src/pxe.ts +214 -188
- package/src/storage/{address_data_provider/address_data_provider.ts → address_store/address_store.ts} +1 -1
- 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 -11
- package/src/storage/anchor_block_store/index.ts +1 -0
- package/src/storage/{capsule_data_provider/capsule_data_provider.ts → capsule_store/capsule_store.ts} +34 -2
- package/src/storage/capsule_store/index.ts +1 -0
- package/src/storage/{contract_data_provider/contract_data_provider.ts → contract_store/contract_store.ts} +65 -3
- package/src/storage/contract_store/index.ts +1 -0
- package/src/storage/{contract_data_provider → contract_store}/private_functions_tree.ts +1 -1
- package/src/storage/index.ts +7 -7
- package/src/storage/note_store/index.ts +2 -0
- package/src/storage/{note_data_provider/note_data_provider.ts → note_store/note_store.ts} +26 -13
- 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 -2
- package/src/tagging/index.ts +17 -5
- 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/contract_function_simulator/execution_data_provider.d.ts +0 -265
- package/dest/contract_function_simulator/execution_data_provider.d.ts.map +0 -1
- package/dest/contract_function_simulator/execution_data_provider.js +0 -14
- package/dest/contract_function_simulator/pxe_oracle_interface.d.ts +0 -122
- package/dest/contract_function_simulator/pxe_oracle_interface.d.ts.map +0 -1
- package/dest/contract_function_simulator/pxe_oracle_interface.js +0 -694
- package/dest/storage/address_data_provider/address_data_provider.d.ts +0 -11
- 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/capsule_data_provider/capsule_data_provider.d.ts +0 -25
- package/dest/storage/capsule_data_provider/capsule_data_provider.d.ts.map +0 -1
- 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.map +0 -1
- package/dest/storage/contract_data_provider/index.d.ts +0 -2
- package/dest/storage/contract_data_provider/index.d.ts.map +0 -1
- package/dest/storage/contract_data_provider/index.js +0 -1
- package/dest/storage/contract_data_provider/private_functions_tree.d.ts.map +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_data_provider.d.ts.map +0 -1
- package/dest/storage/private_event_data_provider/private_event_data_provider.d.ts +0 -37
- package/dest/storage/private_event_data_provider/private_event_data_provider.d.ts.map +0 -1
- package/dest/storage/private_event_data_provider/private_event_data_provider.js +0 -105
- 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.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 -40
- 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 -89
- 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 -35
- package/dest/synchronizer/synchronizer.d.ts.map +0 -1
- package/dest/tagging/siloed_tag.d.ts +0 -14
- package/dest/tagging/siloed_tag.d.ts.map +0 -1
- package/dest/tagging/siloed_tag.js +0 -20
- package/dest/tagging/tag.d.ts +0 -12
- package/dest/tagging/tag.d.ts.map +0 -1
- package/dest/tagging/tag.js +0 -17
- package/dest/tagging/utils.d.ts +0 -18
- package/dest/tagging/utils.d.ts.map +0 -1
- package/dest/tagging/utils.js +0 -24
- package/src/contract_function_simulator/execution_data_provider.ts +0 -333
- package/src/contract_function_simulator/pxe_oracle_interface.ts +0 -1008
- package/src/storage/address_data_provider/index.ts +0 -1
- package/src/storage/capsule_data_provider/index.ts +0 -1
- package/src/storage/contract_data_provider/index.ts +0 -1
- package/src/storage/note_data_provider/index.ts +0 -2
- package/src/storage/private_event_data_provider/private_event_data_provider.ts +0 -143
- 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 -120
- package/src/synchronizer/index.ts +0 -1
- package/src/tagging/siloed_tag.ts +0 -22
- package/src/tagging/tag.ts +0 -16
- package/src/tagging/utils.ts +0 -31
|
@@ -17,10 +17,11 @@ import {
|
|
|
17
17
|
MAX_PRIVATE_LOGS_PER_TX,
|
|
18
18
|
} from '@aztec/constants';
|
|
19
19
|
import { arrayNonEmptyLength, padArrayEnd } from '@aztec/foundation/collection';
|
|
20
|
-
import { poseidon2Hash } from '@aztec/foundation/crypto';
|
|
21
|
-
import { Fr } from '@aztec/foundation/
|
|
20
|
+
import { poseidon2Hash } from '@aztec/foundation/crypto/poseidon';
|
|
21
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
22
22
|
import { type Logger, createLogger } from '@aztec/foundation/log';
|
|
23
23
|
import { Timer } from '@aztec/foundation/timer';
|
|
24
|
+
import type { KeyStore } from '@aztec/key-store';
|
|
24
25
|
import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
|
|
25
26
|
import { protocolContractsHash } from '@aztec/protocol-contracts';
|
|
26
27
|
import {
|
|
@@ -44,6 +45,7 @@ import {
|
|
|
44
45
|
siloNoteHash,
|
|
45
46
|
siloNullifier,
|
|
46
47
|
} from '@aztec/stdlib/hash';
|
|
48
|
+
import type { AztecNode } from '@aztec/stdlib/interfaces/server';
|
|
47
49
|
import {
|
|
48
50
|
PartialPrivateTailPublicInputsForPublic,
|
|
49
51
|
PartialPrivateTailPublicInputsForRollup,
|
|
@@ -59,6 +61,7 @@ import { PrivateLog } from '@aztec/stdlib/logs';
|
|
|
59
61
|
import { ScopedL2ToL1Message } from '@aztec/stdlib/messaging';
|
|
60
62
|
import { ChonkProof } from '@aztec/stdlib/proofs';
|
|
61
63
|
import {
|
|
64
|
+
BlockHeader,
|
|
62
65
|
CallContext,
|
|
63
66
|
HashedValues,
|
|
64
67
|
PrivateExecutionResult,
|
|
@@ -68,8 +71,15 @@ import {
|
|
|
68
71
|
getFinalMinRevertibleSideEffectCounter,
|
|
69
72
|
} from '@aztec/stdlib/tx';
|
|
70
73
|
|
|
71
|
-
import type {
|
|
72
|
-
import type {
|
|
74
|
+
import type { AddressStore } from '../storage/address_store/address_store.js';
|
|
75
|
+
import type { AnchorBlockStore } from '../storage/anchor_block_store/anchor_block_store.js';
|
|
76
|
+
import type { CapsuleStore } from '../storage/capsule_store/capsule_store.js';
|
|
77
|
+
import type { ContractStore } from '../storage/contract_store/contract_store.js';
|
|
78
|
+
import type { NoteStore } from '../storage/note_store/note_store.js';
|
|
79
|
+
import type { PrivateEventStore } from '../storage/private_event_store/private_event_store.js';
|
|
80
|
+
import type { RecipientTaggingStore } from '../storage/tagging_store/recipient_tagging_store.js';
|
|
81
|
+
import type { SenderAddressBookStore } from '../storage/tagging_store/sender_address_book_store.js';
|
|
82
|
+
import type { SenderTaggingStore } from '../storage/tagging_store/sender_tagging_store.js';
|
|
73
83
|
import { ExecutionNoteCache } from './execution_note_cache.js';
|
|
74
84
|
import { ExecutionTaggingIndexCache } from './execution_tagging_index_cache.js';
|
|
75
85
|
import { HashedValuesCache } from './hashed_values_cache.js';
|
|
@@ -77,6 +87,7 @@ import { Oracle } from './oracle/oracle.js';
|
|
|
77
87
|
import { executePrivateFunction, verifyCurrentClassId } from './oracle/private_execution.js';
|
|
78
88
|
import { PrivateExecutionOracle } from './oracle/private_execution_oracle.js';
|
|
79
89
|
import { UtilityExecutionOracle } from './oracle/utility_execution_oracle.js';
|
|
90
|
+
import type { ProxiedNode } from './proxied_node.js';
|
|
80
91
|
|
|
81
92
|
/**
|
|
82
93
|
* The contract function simulator.
|
|
@@ -85,7 +96,17 @@ export class ContractFunctionSimulator {
|
|
|
85
96
|
private log: Logger;
|
|
86
97
|
|
|
87
98
|
constructor(
|
|
88
|
-
private
|
|
99
|
+
private contractStore: ContractStore,
|
|
100
|
+
private noteStore: NoteStore,
|
|
101
|
+
private keyStore: KeyStore,
|
|
102
|
+
private addressStore: AddressStore,
|
|
103
|
+
private aztecNode: AztecNode,
|
|
104
|
+
private anchorBlockStore: AnchorBlockStore,
|
|
105
|
+
private senderTaggingStore: SenderTaggingStore,
|
|
106
|
+
private recipientTaggingStore: RecipientTaggingStore,
|
|
107
|
+
private senderAddressBookStore: SenderAddressBookStore,
|
|
108
|
+
private capsuleStore: CapsuleStore,
|
|
109
|
+
private privateEventStore: PrivateEventStore,
|
|
89
110
|
private simulator: CircuitSimulator,
|
|
90
111
|
) {
|
|
91
112
|
this.log = createLogger('simulator');
|
|
@@ -98,9 +119,11 @@ export class ContractFunctionSimulator {
|
|
|
98
119
|
* @param contractAddress - The address of the contract (should match request.origin)
|
|
99
120
|
* @param msgSender - The address calling the function. This can be replaced to simulate a call from another contract
|
|
100
121
|
* or a specific account.
|
|
122
|
+
* @param anchorBlockHeader - The block header to use as base state for this run.
|
|
101
123
|
* @param senderForTags - The address that is used as a tagging sender when emitting private logs. Returned from
|
|
102
124
|
* the `privateGetSenderForTags` oracle.
|
|
103
125
|
* @param scopes - The accounts whose notes we can access in this call. Currently optional and will default to all.
|
|
126
|
+
* @param jobId - The job ID for staged writes.
|
|
104
127
|
* @returns The result of the execution.
|
|
105
128
|
*/
|
|
106
129
|
public async run(
|
|
@@ -108,15 +131,20 @@ export class ContractFunctionSimulator {
|
|
|
108
131
|
contractAddress: AztecAddress,
|
|
109
132
|
selector: FunctionSelector,
|
|
110
133
|
msgSender = AztecAddress.fromField(Fr.MAX_FIELD_VALUE),
|
|
111
|
-
|
|
112
|
-
|
|
134
|
+
anchorBlockHeader: BlockHeader,
|
|
135
|
+
senderForTags: AztecAddress | undefined,
|
|
136
|
+
scopes: AztecAddress[] | undefined,
|
|
137
|
+
jobId: string,
|
|
113
138
|
): Promise<PrivateExecutionResult> {
|
|
114
139
|
const simulatorSetupTimer = new Timer();
|
|
115
|
-
const anchorBlockHeader = await this.executionDataProvider.getAnchorBlockHeader();
|
|
116
140
|
|
|
117
|
-
await
|
|
141
|
+
await this.contractStore.syncPrivateState(contractAddress, selector, privateSyncCall =>
|
|
142
|
+
this.runUtility(privateSyncCall, [], anchorBlockHeader, scopes, jobId),
|
|
143
|
+
);
|
|
144
|
+
|
|
145
|
+
await verifyCurrentClassId(contractAddress, this.aztecNode, this.contractStore, anchorBlockHeader);
|
|
118
146
|
|
|
119
|
-
const entryPointArtifact = await this.
|
|
147
|
+
const entryPointArtifact = await this.contractStore.getFunctionArtifactWithDebugMetadata(contractAddress, selector);
|
|
120
148
|
|
|
121
149
|
if (entryPointArtifact.functionType !== FunctionType.PRIVATE) {
|
|
122
150
|
throw new Error(`Cannot run ${entryPointArtifact.functionType} function as private`);
|
|
@@ -147,12 +175,26 @@ export class ContractFunctionSimulator {
|
|
|
147
175
|
request.txContext,
|
|
148
176
|
callContext,
|
|
149
177
|
anchorBlockHeader,
|
|
178
|
+
async call => {
|
|
179
|
+
await this.runUtility(call, [], anchorBlockHeader, scopes, jobId);
|
|
180
|
+
},
|
|
150
181
|
request.authWitnesses,
|
|
151
182
|
request.capsules,
|
|
152
183
|
HashedValuesCache.create(request.argsOfCalls),
|
|
153
184
|
noteCache,
|
|
154
185
|
taggingIndexCache,
|
|
155
|
-
this.
|
|
186
|
+
this.contractStore,
|
|
187
|
+
this.noteStore,
|
|
188
|
+
this.keyStore,
|
|
189
|
+
this.addressStore,
|
|
190
|
+
this.aztecNode,
|
|
191
|
+
this.anchorBlockStore,
|
|
192
|
+
this.senderTaggingStore,
|
|
193
|
+
this.recipientTaggingStore,
|
|
194
|
+
this.senderAddressBookStore,
|
|
195
|
+
this.capsuleStore,
|
|
196
|
+
this.privateEventStore,
|
|
197
|
+
jobId,
|
|
156
198
|
0, // totalPublicArgsCount
|
|
157
199
|
startSideEffectCounter,
|
|
158
200
|
undefined, // log
|
|
@@ -213,20 +255,45 @@ export class ContractFunctionSimulator {
|
|
|
213
255
|
* Runs a utility function.
|
|
214
256
|
* @param call - The function call to execute.
|
|
215
257
|
* @param authwits - Authentication witnesses required for the function call.
|
|
258
|
+
* @param anchorBlockHeader - The block header to use as base state for this run.
|
|
216
259
|
* @param scopes - Optional array of account addresses whose notes can be accessed in this call. Defaults to all
|
|
217
260
|
* accounts if not specified.
|
|
218
261
|
* @returns A return value of the utility function in a form as returned by the simulator (Noir fields)
|
|
219
262
|
*/
|
|
220
|
-
public async runUtility(
|
|
221
|
-
|
|
263
|
+
public async runUtility(
|
|
264
|
+
call: FunctionCall,
|
|
265
|
+
authwits: AuthWitness[],
|
|
266
|
+
anchorBlockHeader: BlockHeader,
|
|
267
|
+
scopes: AztecAddress[] | undefined,
|
|
268
|
+
jobId: string,
|
|
269
|
+
): Promise<Fr[]> {
|
|
270
|
+
await verifyCurrentClassId(call.to, this.aztecNode, this.contractStore, anchorBlockHeader);
|
|
222
271
|
|
|
223
|
-
const entryPointArtifact = await this.
|
|
272
|
+
const entryPointArtifact = await this.contractStore.getFunctionArtifactWithDebugMetadata(call.to, call.selector);
|
|
224
273
|
|
|
225
274
|
if (entryPointArtifact.functionType !== FunctionType.UTILITY) {
|
|
226
275
|
throw new Error(`Cannot run ${entryPointArtifact.functionType} function as utility`);
|
|
227
276
|
}
|
|
228
277
|
|
|
229
|
-
const oracle = new UtilityExecutionOracle(
|
|
278
|
+
const oracle = new UtilityExecutionOracle(
|
|
279
|
+
call.to,
|
|
280
|
+
authwits,
|
|
281
|
+
[],
|
|
282
|
+
anchorBlockHeader,
|
|
283
|
+
this.contractStore,
|
|
284
|
+
this.noteStore,
|
|
285
|
+
this.keyStore,
|
|
286
|
+
this.addressStore,
|
|
287
|
+
this.aztecNode,
|
|
288
|
+
this.anchorBlockStore,
|
|
289
|
+
this.recipientTaggingStore,
|
|
290
|
+
this.senderAddressBookStore,
|
|
291
|
+
this.capsuleStore,
|
|
292
|
+
this.privateEventStore,
|
|
293
|
+
jobId,
|
|
294
|
+
undefined,
|
|
295
|
+
scopes,
|
|
296
|
+
);
|
|
230
297
|
|
|
231
298
|
try {
|
|
232
299
|
this.log.verbose(`Executing utility function ${entryPointArtifact.name}`, {
|
|
@@ -258,8 +325,15 @@ export class ContractFunctionSimulator {
|
|
|
258
325
|
}
|
|
259
326
|
// docs:end:execute_utility_function
|
|
260
327
|
|
|
328
|
+
/**
|
|
329
|
+
* Returns the execution statistics collected during the simulator run.
|
|
330
|
+
* @returns The execution statistics.
|
|
331
|
+
*/
|
|
261
332
|
getStats() {
|
|
262
|
-
|
|
333
|
+
const nodeRPCCalls =
|
|
334
|
+
typeof (this.aztecNode as ProxiedNode).getStats === 'function' ? (this.aztecNode as ProxiedNode).getStats() : {};
|
|
335
|
+
|
|
336
|
+
return { nodeRPCCalls };
|
|
263
337
|
}
|
|
264
338
|
}
|
|
265
339
|
|
|
@@ -282,13 +356,13 @@ class OrderedSideEffect<T> {
|
|
|
282
356
|
* @param privateExecutionResult - The result of the private execution.
|
|
283
357
|
* @param nonceGenerator - A nonce generator for note hashes. According to the protocol rules,
|
|
284
358
|
* it can either be the first nullifier in the tx or the hash of the initial tx request if there are none.
|
|
285
|
-
* @param
|
|
359
|
+
* @param contractStore - A provider for contract data in order to get function names and debug info.
|
|
286
360
|
* @returns The simulated proving result.
|
|
287
361
|
*/
|
|
288
362
|
export async function generateSimulatedProvingResult(
|
|
289
363
|
privateExecutionResult: PrivateExecutionResult,
|
|
290
364
|
nonceGenerator: Fr,
|
|
291
|
-
|
|
365
|
+
contractStore: ContractStore,
|
|
292
366
|
): Promise<PrivateKernelExecutionProofOutput<PrivateKernelTailCircuitPublicInputs>> {
|
|
293
367
|
const siloedNoteHashes: OrderedSideEffect<Fr>[] = [];
|
|
294
368
|
const nullifiers: OrderedSideEffect<Fr>[] = [];
|
|
@@ -365,7 +439,7 @@ export async function generateSimulatedProvingResult(
|
|
|
365
439
|
: execution.publicInputs.publicTeardownCallRequest;
|
|
366
440
|
|
|
367
441
|
executionSteps.push({
|
|
368
|
-
functionName: await
|
|
442
|
+
functionName: await contractStore.getDebugFunctionName(
|
|
369
443
|
execution.publicInputs.callContext.contractAddress,
|
|
370
444
|
execution.publicInputs.callContext.functionSelector,
|
|
371
445
|
),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Fr } from '@aztec/foundation/
|
|
1
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
2
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
3
3
|
import { computeNoteHashNonce, computeUniqueNoteHash, siloNoteHash, siloNullifier } from '@aztec/stdlib/hash';
|
|
4
4
|
|
|
@@ -173,11 +173,15 @@ export class ExecutionNoteCache {
|
|
|
173
173
|
* Return notes created up to current point in execution.
|
|
174
174
|
* If a nullifier for a note in this list is emitted, the note will be deleted.
|
|
175
175
|
* @param contractAddress - Contract address of the notes.
|
|
176
|
+
* @param owner - Owner of the notes. If undefined, returns all notes regardless of owner.
|
|
176
177
|
* @param storageSlot - Storage slot of the notes.
|
|
177
178
|
**/
|
|
178
|
-
public getNotes(contractAddress: AztecAddress, storageSlot: Fr) {
|
|
179
|
+
public getNotes(contractAddress: AztecAddress, owner: AztecAddress | undefined, storageSlot: Fr) {
|
|
179
180
|
const notes = this.noteMap.get(contractAddress.toBigInt()) ?? [];
|
|
180
|
-
return notes
|
|
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);
|
|
181
185
|
}
|
|
182
186
|
|
|
183
187
|
/**
|
|
@@ -21,7 +21,7 @@ export class ExecutionTaggingIndexCache {
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
|
-
* Returns the pre
|
|
24
|
+
* Returns the pre-tags that were used in this execution (and that need to be stored in the db).
|
|
25
25
|
*/
|
|
26
26
|
public getUsedPreTags(): PreTag[] {
|
|
27
27
|
return Array.from(this.taggingIndexMap.entries()).map(([secret, index]) => ({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Fr } from '@aztec/foundation/
|
|
1
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
2
|
import { FieldReader } from '@aztec/foundation/serialize';
|
|
3
3
|
import { EventSelector } from '@aztec/stdlib/abi';
|
|
4
4
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
@@ -15,6 +15,7 @@ export class EventValidationRequest {
|
|
|
15
15
|
constructor(
|
|
16
16
|
public contractAddress: AztecAddress,
|
|
17
17
|
public eventTypeId: EventSelector,
|
|
18
|
+
public randomness: Fr,
|
|
18
19
|
public serializedEvent: Fr[],
|
|
19
20
|
public eventCommitment: Fr,
|
|
20
21
|
public txHash: TxHash,
|
|
@@ -27,6 +28,8 @@ export class EventValidationRequest {
|
|
|
27
28
|
const contractAddress = AztecAddress.fromField(reader.readField());
|
|
28
29
|
const eventTypeId = EventSelector.fromField(reader.readField());
|
|
29
30
|
|
|
31
|
+
const randomness = reader.readField();
|
|
32
|
+
|
|
30
33
|
const eventStorage = reader.readFieldArray(MAX_EVENT_SERIALIZED_LEN);
|
|
31
34
|
const eventLen = reader.readField().toNumber();
|
|
32
35
|
const serializedEvent = eventStorage.slice(0, eventLen);
|
|
@@ -38,6 +41,7 @@ export class EventValidationRequest {
|
|
|
38
41
|
return new EventValidationRequest(
|
|
39
42
|
contractAddress,
|
|
40
43
|
eventTypeId,
|
|
44
|
+
randomness,
|
|
41
45
|
serializedEvent,
|
|
42
46
|
eventCommitment,
|
|
43
47
|
txHash,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { Fr } from '@aztec/foundation/
|
|
1
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
2
|
import { FieldReader } from '@aztec/foundation/serialize';
|
|
3
3
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
|
+
import { Tag } from '@aztec/stdlib/logs';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Intermediate struct used to perform batch log retrieval by PXE. The `utilityBulkRetrieveLogs` oracle expects values of this
|
|
@@ -9,19 +10,19 @@ import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
|
9
10
|
export class LogRetrievalRequest {
|
|
10
11
|
constructor(
|
|
11
12
|
public contractAddress: AztecAddress,
|
|
12
|
-
public
|
|
13
|
+
public tag: Tag,
|
|
13
14
|
) {}
|
|
14
15
|
|
|
15
16
|
toFields(): Fr[] {
|
|
16
|
-
return [this.contractAddress.toField(), this.
|
|
17
|
+
return [this.contractAddress.toField(), this.tag.value];
|
|
17
18
|
}
|
|
18
19
|
|
|
19
20
|
static fromFields(fields: Fr[] | FieldReader): LogRetrievalRequest {
|
|
20
21
|
const reader = FieldReader.asReader(fields);
|
|
21
22
|
|
|
22
23
|
const contractAddress = AztecAddress.fromField(reader.readField());
|
|
23
|
-
const
|
|
24
|
+
const tag = new Tag(reader.readField());
|
|
24
25
|
|
|
25
|
-
return new LogRetrievalRequest(contractAddress,
|
|
26
|
+
return new LogRetrievalRequest(contractAddress, tag);
|
|
26
27
|
}
|
|
27
28
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { MAX_NOTE_HASHES_PER_TX, PRIVATE_LOG_CIPHERTEXT_LEN } from '@aztec/constants';
|
|
2
2
|
import { range } from '@aztec/foundation/array';
|
|
3
|
-
import { Fr } from '@aztec/foundation/
|
|
3
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
4
4
|
import type { TxHash } from '@aztec/stdlib/tx';
|
|
5
5
|
|
|
6
6
|
import { MAX_NOTE_PACKED_LEN } from './note_validation_request.js';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Fr } from '@aztec/foundation/
|
|
1
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
2
|
import { FieldReader } from '@aztec/foundation/serialize';
|
|
3
3
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
4
|
import { TxHash } from '@aztec/stdlib/tx';
|
|
5
5
|
|
|
6
6
|
// TODO(#14617): should we compute this from constants? This value is aztec-nr specific.
|
|
7
|
-
export const MAX_NOTE_PACKED_LEN =
|
|
7
|
+
export const MAX_NOTE_PACKED_LEN = 10;
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Intermediate struct used to perform batch note validation by PXE. The `utilityValidateEnqueuedNotesAndEvents` oracle
|
|
@@ -13,6 +13,7 @@ export const MAX_NOTE_PACKED_LEN = 11;
|
|
|
13
13
|
export class NoteValidationRequest {
|
|
14
14
|
constructor(
|
|
15
15
|
public contractAddress: AztecAddress,
|
|
16
|
+
public owner: AztecAddress,
|
|
16
17
|
public storageSlot: Fr,
|
|
17
18
|
public randomness: Fr,
|
|
18
19
|
public noteNonce: Fr,
|
|
@@ -27,6 +28,7 @@ export class NoteValidationRequest {
|
|
|
27
28
|
const reader = FieldReader.asReader(fields);
|
|
28
29
|
|
|
29
30
|
const contractAddress = AztecAddress.fromField(reader.readField());
|
|
31
|
+
const owner = AztecAddress.fromField(reader.readField());
|
|
30
32
|
const storageSlot = reader.readField();
|
|
31
33
|
const randomness = reader.readField();
|
|
32
34
|
const noteNonce = reader.readField();
|
|
@@ -48,6 +50,7 @@ export class NoteValidationRequest {
|
|
|
48
50
|
|
|
49
51
|
return new NoteValidationRequest(
|
|
50
52
|
contractAddress,
|
|
53
|
+
owner,
|
|
51
54
|
storageSlot,
|
|
52
55
|
randomness,
|
|
53
56
|
noteNonce,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Fr } from '@aztec/foundation/
|
|
1
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
2
|
import type { FieldsOf } from '@aztec/foundation/types';
|
|
3
3
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
4
|
import type { UInt64 } from '@aztec/stdlib/types';
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import type { L1_TO_L2_MSG_TREE_HEIGHT } from '@aztec/constants';
|
|
2
|
-
import {
|
|
2
|
+
import type { BlockNumber } from '@aztec/foundation/branded-types';
|
|
3
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
4
|
+
import { Point } from '@aztec/foundation/curves/grumpkin';
|
|
3
5
|
import type { FunctionSelector, NoteSelector } from '@aztec/stdlib/abi';
|
|
4
6
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
5
7
|
import type { CompleteAddress, ContractInstance } from '@aztec/stdlib/contract';
|
|
6
8
|
import type { KeyValidationRequest } from '@aztec/stdlib/kernel';
|
|
7
|
-
import type { ContractClassLog } from '@aztec/stdlib/logs';
|
|
9
|
+
import type { ContractClassLog, Tag } from '@aztec/stdlib/logs';
|
|
8
10
|
import type { Note, NoteStatus } from '@aztec/stdlib/note';
|
|
9
11
|
import { type MerkleTreeId, type NullifierMembershipWitness, PublicDataWitness } from '@aztec/stdlib/trees';
|
|
10
12
|
import type { BlockHeader } from '@aztec/stdlib/tx';
|
|
11
13
|
|
|
12
|
-
import type { Tag } from '../../tagging/tag.js';
|
|
13
14
|
import type { UtilityContext } from '../noir-structs/utility_context.js';
|
|
14
15
|
import type { MessageLoadOracleInputs } from './message_load_oracle_inputs.js';
|
|
15
16
|
|
|
@@ -21,6 +22,8 @@ export interface NoteData {
|
|
|
21
22
|
note: Note;
|
|
22
23
|
/** The address of the contract that owns the note. */
|
|
23
24
|
contractAddress: AztecAddress;
|
|
25
|
+
/** The owner of the note. */
|
|
26
|
+
owner: AztecAddress;
|
|
24
27
|
/** The storage slot of the note. */
|
|
25
28
|
storageSlot: Fr;
|
|
26
29
|
/** The randomness injected to the note */
|
|
@@ -59,23 +62,24 @@ export interface IMiscOracle {
|
|
|
59
62
|
export interface IUtilityExecutionOracle {
|
|
60
63
|
isUtility: true;
|
|
61
64
|
|
|
62
|
-
utilityGetUtilityContext():
|
|
65
|
+
utilityGetUtilityContext(): UtilityContext;
|
|
63
66
|
utilityGetKeyValidationRequest(pkMHash: Fr): Promise<KeyValidationRequest>;
|
|
64
67
|
utilityGetContractInstance(address: AztecAddress): Promise<ContractInstance>;
|
|
65
|
-
utilityGetMembershipWitness(blockNumber:
|
|
68
|
+
utilityGetMembershipWitness(blockNumber: BlockNumber, treeId: MerkleTreeId, leafValue: Fr): Promise<Fr[] | undefined>;
|
|
66
69
|
utilityGetNullifierMembershipWitness(
|
|
67
|
-
blockNumber:
|
|
70
|
+
blockNumber: BlockNumber,
|
|
68
71
|
nullifier: Fr,
|
|
69
72
|
): Promise<NullifierMembershipWitness | undefined>;
|
|
70
|
-
utilityGetPublicDataWitness(blockNumber:
|
|
73
|
+
utilityGetPublicDataWitness(blockNumber: BlockNumber, leafSlot: Fr): Promise<PublicDataWitness | undefined>;
|
|
71
74
|
utilityGetLowNullifierMembershipWitness(
|
|
72
|
-
blockNumber:
|
|
75
|
+
blockNumber: BlockNumber,
|
|
73
76
|
nullifier: Fr,
|
|
74
77
|
): Promise<NullifierMembershipWitness | undefined>;
|
|
75
|
-
utilityGetBlockHeader(blockNumber:
|
|
78
|
+
utilityGetBlockHeader(blockNumber: BlockNumber): Promise<BlockHeader | undefined>;
|
|
76
79
|
utilityGetPublicKeysAndPartialAddress(account: AztecAddress): Promise<CompleteAddress>;
|
|
77
80
|
utilityGetAuthWitness(messageHash: Fr): Promise<Fr[] | undefined>;
|
|
78
81
|
utilityGetNotes(
|
|
82
|
+
owner: AztecAddress | undefined,
|
|
79
83
|
storageSlot: Fr,
|
|
80
84
|
numSelects: number,
|
|
81
85
|
selectByIndexes: number[],
|
|
@@ -100,7 +104,7 @@ export interface IUtilityExecutionOracle {
|
|
|
100
104
|
utilityStorageRead(
|
|
101
105
|
contractAddress: AztecAddress,
|
|
102
106
|
startStorageSlot: Fr,
|
|
103
|
-
blockNumber:
|
|
107
|
+
blockNumber: BlockNumber,
|
|
104
108
|
numberOfElements: number,
|
|
105
109
|
): Promise<Fr[]>;
|
|
106
110
|
utilityFetchTaggedLogs(pendingTaggedLogArrayBaseSlot: Fr): Promise<void>;
|
|
@@ -132,6 +136,7 @@ export interface IPrivateExecutionOracle {
|
|
|
132
136
|
privateStoreInExecutionCache(values: Fr[], hash: Fr): void;
|
|
133
137
|
privateLoadFromExecutionCache(hash: Fr): Promise<Fr[]>;
|
|
134
138
|
privateNotifyCreatedNote(
|
|
139
|
+
owner: AztecAddress,
|
|
135
140
|
storageSlot: Fr,
|
|
136
141
|
randomness: Fr,
|
|
137
142
|
noteTypeId: NoteSelector,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Fr } from '@aztec/foundation/
|
|
1
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
2
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
3
3
|
import type { Note } from '@aztec/stdlib/note';
|
|
4
4
|
|
|
@@ -24,7 +24,9 @@ function fromRawData(nonzeroNoteHashCounter: boolean, maybeNoteNonce: Fr): { sta
|
|
|
24
24
|
* and only after that it packs the retrieved note. Hence it doesn't map one to one with `RetrievedNote::pack()`.
|
|
25
25
|
*
|
|
26
26
|
* @param contractAddress - The address of the contract that owns the note
|
|
27
|
+
* @param owner - The owner of the note
|
|
27
28
|
* @param randomness - The randomness injected into the note to get the hiding property of commitments
|
|
29
|
+
* @param storageSlot - The storage slot of the note
|
|
28
30
|
* @param noteNonce - The nonce injected into the note hash preimage by kernels.
|
|
29
31
|
* @param index - Optional index in the note hash tree. If undefined, indicates a transient note
|
|
30
32
|
* @param note - The note content containing the actual note data
|
|
@@ -32,13 +34,17 @@ function fromRawData(nonzeroNoteHashCounter: boolean, maybeNoteNonce: Fr): { sta
|
|
|
32
34
|
*/
|
|
33
35
|
export function packAsRetrievedNote({
|
|
34
36
|
contractAddress,
|
|
37
|
+
owner,
|
|
35
38
|
randomness,
|
|
39
|
+
storageSlot,
|
|
36
40
|
noteNonce,
|
|
37
41
|
index,
|
|
38
42
|
note,
|
|
39
43
|
}: {
|
|
40
44
|
contractAddress: AztecAddress;
|
|
45
|
+
owner: AztecAddress;
|
|
41
46
|
randomness: Fr;
|
|
47
|
+
storageSlot: Fr;
|
|
42
48
|
noteNonce: Fr;
|
|
43
49
|
index?: bigint;
|
|
44
50
|
note: Note;
|
|
@@ -49,6 +55,14 @@ export function packAsRetrievedNote({
|
|
|
49
55
|
// To pack the note as retrieved note we first need to reconstruct the note metadata.
|
|
50
56
|
const noteMetadata = fromRawData(nonzeroNoteHashCounter, noteNonce);
|
|
51
57
|
|
|
52
|
-
// Pack
|
|
53
|
-
return [
|
|
58
|
+
// Pack in order: note, contract_address, owner, randomness, storage_slot, metadata (stage, maybe_note_nonce)
|
|
59
|
+
return [
|
|
60
|
+
...note.items,
|
|
61
|
+
contractAddress,
|
|
62
|
+
owner,
|
|
63
|
+
randomness,
|
|
64
|
+
storageSlot,
|
|
65
|
+
new Fr(noteMetadata.stage),
|
|
66
|
+
noteMetadata.maybeNoteNonce,
|
|
67
|
+
];
|
|
54
68
|
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
2
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
|
+
import { Point } from '@aztec/foundation/curves/grumpkin';
|
|
2
4
|
import {
|
|
3
5
|
type ACIRCallback,
|
|
4
6
|
type ACVMField,
|
|
@@ -110,9 +112,9 @@ export class Oracle {
|
|
|
110
112
|
return [values.map(toACVMField)];
|
|
111
113
|
}
|
|
112
114
|
|
|
113
|
-
|
|
114
|
-
const context =
|
|
115
|
-
return context.toNoirRepresentation();
|
|
115
|
+
utilityGetUtilityContext(): Promise<(ACVMField | ACVMField[])[]> {
|
|
116
|
+
const context = this.handlerAsUtility().utilityGetUtilityContext();
|
|
117
|
+
return Promise.resolve(context.toNoirRepresentation());
|
|
116
118
|
}
|
|
117
119
|
|
|
118
120
|
async utilityGetKeyValidationRequest([pkMHash]: ACVMField[]): Promise<ACVMField[]> {
|
|
@@ -145,7 +147,7 @@ export class Oracle {
|
|
|
145
147
|
const parsedLeafValue = Fr.fromString(leafValue);
|
|
146
148
|
|
|
147
149
|
const witness = await this.handlerAsUtility().utilityGetMembershipWitness(
|
|
148
|
-
parsedBlockNumber,
|
|
150
|
+
BlockNumber(parsedBlockNumber),
|
|
149
151
|
parsedTreeId,
|
|
150
152
|
parsedLeafValue,
|
|
151
153
|
);
|
|
@@ -165,7 +167,7 @@ export class Oracle {
|
|
|
165
167
|
const parsedNullifier = Fr.fromString(nullifier);
|
|
166
168
|
|
|
167
169
|
const witness = await this.handlerAsUtility().utilityGetNullifierMembershipWitness(
|
|
168
|
-
parsedBlockNumber,
|
|
170
|
+
BlockNumber(parsedBlockNumber),
|
|
169
171
|
parsedNullifier,
|
|
170
172
|
);
|
|
171
173
|
if (!witness) {
|
|
@@ -182,7 +184,7 @@ export class Oracle {
|
|
|
182
184
|
const parsedNullifier = Fr.fromString(nullifier);
|
|
183
185
|
|
|
184
186
|
const witness = await this.handlerAsUtility().utilityGetLowNullifierMembershipWitness(
|
|
185
|
-
parsedBlockNumber,
|
|
187
|
+
BlockNumber(parsedBlockNumber),
|
|
186
188
|
parsedNullifier,
|
|
187
189
|
);
|
|
188
190
|
if (!witness) {
|
|
@@ -200,7 +202,10 @@ export class Oracle {
|
|
|
200
202
|
const parsedBlockNumber = Fr.fromString(blockNumber).toNumber();
|
|
201
203
|
const parsedLeafSlot = Fr.fromString(leafSlot);
|
|
202
204
|
|
|
203
|
-
const witness = await this.handlerAsUtility().utilityGetPublicDataWitness(
|
|
205
|
+
const witness = await this.handlerAsUtility().utilityGetPublicDataWitness(
|
|
206
|
+
BlockNumber(parsedBlockNumber),
|
|
207
|
+
parsedLeafSlot,
|
|
208
|
+
);
|
|
204
209
|
if (!witness) {
|
|
205
210
|
throw new Error(`Public data witness not found for slot ${parsedLeafSlot} at block ${parsedBlockNumber}.`);
|
|
206
211
|
}
|
|
@@ -210,7 +215,7 @@ export class Oracle {
|
|
|
210
215
|
async utilityGetBlockHeader([blockNumber]: ACVMField[]): Promise<ACVMField[]> {
|
|
211
216
|
const parsedBlockNumber = Fr.fromString(blockNumber).toNumber();
|
|
212
217
|
|
|
213
|
-
const header = await this.handlerAsUtility().utilityGetBlockHeader(parsedBlockNumber);
|
|
218
|
+
const header = await this.handlerAsUtility().utilityGetBlockHeader(BlockNumber(parsedBlockNumber));
|
|
214
219
|
if (!header) {
|
|
215
220
|
throw new Error(`Block header not found for block ${parsedBlockNumber}.`);
|
|
216
221
|
}
|
|
@@ -235,6 +240,8 @@ export class Oracle {
|
|
|
235
240
|
}
|
|
236
241
|
|
|
237
242
|
async utilityGetNotes(
|
|
243
|
+
[ownerSome]: ACVMField[],
|
|
244
|
+
[ownerValue]: ACVMField[],
|
|
238
245
|
[storageSlot]: ACVMField[],
|
|
239
246
|
[numSelects]: ACVMField[],
|
|
240
247
|
selectByIndexes: ACVMField[],
|
|
@@ -252,7 +259,10 @@ export class Oracle {
|
|
|
252
259
|
[maxNotes]: ACVMField[],
|
|
253
260
|
[packedRetrievedNoteLength]: ACVMField[],
|
|
254
261
|
): Promise<(ACVMField | ACVMField[])[]> {
|
|
262
|
+
// Parse Option<AztecAddress>: ownerSome is 0 for None, 1 for Some
|
|
263
|
+
const owner = Fr.fromString(ownerSome).toNumber() === 1 ? AztecAddress.fromString(ownerValue) : undefined;
|
|
255
264
|
const noteDatas = await this.handlerAsUtility().utilityGetNotes(
|
|
265
|
+
owner,
|
|
256
266
|
Fr.fromString(storageSlot),
|
|
257
267
|
+numSelects,
|
|
258
268
|
selectByIndexes.map(s => +s),
|
|
@@ -269,7 +279,17 @@ export class Oracle {
|
|
|
269
279
|
+status,
|
|
270
280
|
);
|
|
271
281
|
|
|
272
|
-
const returnDataAsArrayOfPackedRetrievedNotes = noteDatas.map(
|
|
282
|
+
const returnDataAsArrayOfPackedRetrievedNotes = noteDatas.map(noteData =>
|
|
283
|
+
packAsRetrievedNote({
|
|
284
|
+
contractAddress: noteData.contractAddress,
|
|
285
|
+
owner: noteData.owner,
|
|
286
|
+
randomness: noteData.randomness,
|
|
287
|
+
storageSlot: noteData.storageSlot,
|
|
288
|
+
noteNonce: noteData.noteNonce,
|
|
289
|
+
index: noteData.index,
|
|
290
|
+
note: noteData.note,
|
|
291
|
+
}),
|
|
292
|
+
);
|
|
273
293
|
|
|
274
294
|
// Now we convert each sub-array to an array of ACVMField
|
|
275
295
|
const returnDataAsArrayOfACVMFieldArrays = returnDataAsArrayOfPackedRetrievedNotes.map(subArray =>
|
|
@@ -281,6 +301,7 @@ export class Oracle {
|
|
|
281
301
|
}
|
|
282
302
|
|
|
283
303
|
privateNotifyCreatedNote(
|
|
304
|
+
[owner]: ACVMField[],
|
|
284
305
|
[storageSlot]: ACVMField[],
|
|
285
306
|
[randomness]: ACVMField[],
|
|
286
307
|
[noteTypeId]: ACVMField[],
|
|
@@ -289,6 +310,7 @@ export class Oracle {
|
|
|
289
310
|
[counter]: ACVMField[],
|
|
290
311
|
): Promise<ACVMField[]> {
|
|
291
312
|
this.handlerAsPrivate().privateNotifyCreatedNote(
|
|
313
|
+
AztecAddress.fromString(owner),
|
|
292
314
|
Fr.fromString(storageSlot),
|
|
293
315
|
Fr.fromString(randomness),
|
|
294
316
|
NoteSelector.fromField(Fr.fromString(noteTypeId)),
|
|
@@ -344,7 +366,7 @@ export class Oracle {
|
|
|
344
366
|
const values = await this.handlerAsUtility().utilityStorageRead(
|
|
345
367
|
new AztecAddress(Fr.fromString(contractAddress)),
|
|
346
368
|
Fr.fromString(startStorageSlot),
|
|
347
|
-
+blockNumber,
|
|
369
|
+
BlockNumber(+blockNumber),
|
|
348
370
|
+numberOfElements,
|
|
349
371
|
);
|
|
350
372
|
return [values.map(toACVMField)];
|