@aztec/pxe 0.0.1-commit.9b94fc1 → 0.0.1-commit.c7c42ec
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 +37 -0
- package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -0
- package/dest/{synchronizer/synchronizer.js → block_synchronizer/block_synchronizer.js} +20 -22
- 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/contract_function_simulator/contract_function_simulator.d.ts +41 -12
- package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.js +46 -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 +2 -2
- package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts.map +1 -1
- 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 +12 -12
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +22 -11
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.js +29 -17
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +58 -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 +147 -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.js +2 -2
- 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.js +2 -2
- package/dest/entrypoints/pxe_creation_options.d.ts +3 -1
- 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.js +1 -1
- 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/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/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 +4 -4
- package/dest/private_kernel/private_kernel_oracle.d.ts +3 -2
- package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_oracle_impl.d.ts +7 -6
- package/dest/private_kernel/private_kernel_oracle_impl.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_oracle_impl.js +7 -7
- 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 +38 -46
- package/dest/pxe.d.ts.map +1 -1
- package/dest/pxe.js +130 -141
- 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} +7 -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} +34 -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 +51 -0
- package/dest/storage/private_event_store/private_event_store.d.ts.map +1 -0
- package/dest/storage/{private_event_data_provider/private_event_data_provider.js → private_event_store/private_event_store.js} +37 -27
- 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/index.d.ts +15 -6
- package/dest/tagging/index.d.ts.map +1 -1
- package/dest/tagging/index.js +23 -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} +19 -22
- package/src/block_synchronizer/index.ts +1 -0
- package/src/config/index.ts +3 -3
- package/src/contract_function_simulator/contract_function_simulator.ts +79 -17
- 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 +1 -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 -15
- package/src/contract_function_simulator/oracle/private_execution_oracle.ts +91 -22
- package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +223 -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 +2 -2
- package/src/entrypoints/client/lazy/index.ts +0 -1
- package/src/entrypoints/client/lazy/utils.ts +2 -2
- package/src/entrypoints/pxe_creation_options.ts +2 -0
- package/src/entrypoints/server/index.ts +1 -1
- package/src/entrypoints/server/utils.ts +1 -1
- package/src/error_enriching.ts +7 -15
- package/src/events/event_service.ts +77 -0
- package/src/events/index.ts +1 -0
- package/src/events/private_event_filter_validator.ts +48 -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 +1 -1
- package/src/private_kernel/private_kernel_execution_prover.ts +5 -4
- package/src/private_kernel/private_kernel_oracle.ts +2 -1
- package/src/private_kernel/private_kernel_oracle_impl.ts +10 -9
- package/src/public_storage/public_storage_service.ts +33 -0
- package/src/pxe.ts +151 -179
- 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} +45 -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_data_provider/private_event_data_provider.ts → private_event_store/private_event_store.ts} +60 -41
- 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/index.ts +27 -5
- package/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts +129 -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 +44 -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/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/constants.d.ts +0 -2
- package/dest/tagging/constants.d.ts.map +0 -1
- package/dest/tagging/constants.js +0 -2
- 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/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/constants.ts +0 -2
- package/src/tagging/siloed_tag.ts +0 -22
- package/src/tagging/tag.ts +0 -16
- package/src/tagging/utils.ts +0 -31
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
import { keccak256String } from '@aztec/foundation/crypto';
|
|
1
|
+
import { keccak256String } from '@aztec/foundation/crypto/keccak';
|
|
2
|
+
|
|
3
|
+
import { readFileSync } from 'fs';
|
|
4
|
+
import { dirname, join } from 'path';
|
|
5
|
+
import ts from 'typescript';
|
|
6
|
+
import { fileURLToPath } from 'url';
|
|
2
7
|
|
|
3
|
-
import { Oracle } from '../contract_function_simulator/oracle/oracle.js';
|
|
4
8
|
import { ORACLE_INTERFACE_HASH } from '../oracle_version.js';
|
|
5
9
|
|
|
6
10
|
/**
|
|
@@ -16,6 +20,22 @@ import { ORACLE_INTERFACE_HASH } from '../oracle_version.js';
|
|
|
16
20
|
* oracle interface like we do in PXE (i.e., there is no single Oracle class that contains only the oracles).
|
|
17
21
|
*/
|
|
18
22
|
function assertOracleInterfaceMatches(): void {
|
|
23
|
+
const oracleInterfaceSignature = getOracleInterfaceSignature();
|
|
24
|
+
|
|
25
|
+
// We use keccak256 here just because we already have it in the dependencies.
|
|
26
|
+
const oracleInterfaceHash = keccak256String(oracleInterfaceSignature);
|
|
27
|
+
if (oracleInterfaceHash !== ORACLE_INTERFACE_HASH) {
|
|
28
|
+
// This check exists only to notify you when you need to update the ORACLE_VERSION constant.
|
|
29
|
+
throw new Error(
|
|
30
|
+
`The Oracle interface has changed, which implies a breaking change in the aztec.nr/PXE oracle interface. Update ORACLE_INTERFACE_HASH to ${oracleInterfaceHash} and bump ORACLE_VERSION in pxe/src/oracle_version.ts.`,
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Constructs a signature of the Oracle interface while ignoring methods that are not foreign call handlers.
|
|
37
|
+
*/
|
|
38
|
+
function getOracleInterfaceSignature(): string {
|
|
19
39
|
const excludedProps = [
|
|
20
40
|
'handler',
|
|
21
41
|
'constructor',
|
|
@@ -25,26 +45,116 @@ function assertOracleInterfaceMatches(): void {
|
|
|
25
45
|
'handlerAsPrivate',
|
|
26
46
|
] as const;
|
|
27
47
|
|
|
28
|
-
//
|
|
29
|
-
//
|
|
30
|
-
//
|
|
31
|
-
|
|
32
|
-
//
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
const oracleInterfaceMethodNames = Object.getOwnPropertyNames(Oracle.prototype)
|
|
36
|
-
.filter(name => !excludedProps.includes(name as (typeof excludedProps)[number]))
|
|
37
|
-
.sort()
|
|
38
|
-
.join('');
|
|
48
|
+
// Get the path to Oracle.ts source file
|
|
49
|
+
// The script runs from dest/bin/ after compilation, so we need to go up to the package root
|
|
50
|
+
// then into src/ to find the source file
|
|
51
|
+
const currentDir = dirname(fileURLToPath(import.meta.url));
|
|
52
|
+
// Go up from dest/bin/ or src/bin/ to the package root (pxe/), then into src/
|
|
53
|
+
const packageRoot = dirname(dirname(currentDir)); // Go up from bin/ to pxe/
|
|
54
|
+
const oracleSourcePath = join(packageRoot, 'src/contract_function_simulator/oracle/oracle.ts');
|
|
39
55
|
|
|
40
|
-
//
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
56
|
+
// Read and parse the TypeScript source file
|
|
57
|
+
const sourceCode = readFileSync(oracleSourcePath, 'utf-8');
|
|
58
|
+
const sourceFile = ts.createSourceFile('oracle.ts', sourceCode, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS);
|
|
59
|
+
|
|
60
|
+
// Extract method signatures from the Oracle class
|
|
61
|
+
const methodSignatures: string[] = [];
|
|
62
|
+
|
|
63
|
+
function visit(node: ts.Node) {
|
|
64
|
+
// Look for class declaration named "Oracle"
|
|
65
|
+
if (ts.isClassDeclaration(node) && node.name?.text === 'Oracle') {
|
|
66
|
+
// Visit all members of the class
|
|
67
|
+
node.members.forEach(member => {
|
|
68
|
+
if (ts.isMethodDeclaration(member) && member.name && ts.isIdentifier(member.name)) {
|
|
69
|
+
const methodName = member.name.text;
|
|
70
|
+
|
|
71
|
+
// Skip excluded methods
|
|
72
|
+
if (excludedProps.includes(methodName as (typeof excludedProps)[number])) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// Extract parameter signatures
|
|
77
|
+
const paramSignatures: string[] = [];
|
|
78
|
+
member.parameters.forEach(param => {
|
|
79
|
+
const paramName = extractParameterName(param, sourceFile);
|
|
80
|
+
const paramType = extractTypeString(param.type, sourceFile);
|
|
81
|
+
paramSignatures.push(`${paramName}: ${paramType}`);
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
// Extract return type
|
|
85
|
+
const returnType = extractTypeString(member.type, sourceFile);
|
|
86
|
+
|
|
87
|
+
// Build full signature: methodName(param1: Type1, param2: Type2): ReturnType
|
|
88
|
+
const signature = `${methodName}(${paramSignatures.join(', ')}): ${returnType}`;
|
|
89
|
+
methodSignatures.push(signature);
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
ts.forEachChild(node, visit);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
visit(sourceFile);
|
|
98
|
+
|
|
99
|
+
// Sort signatures alphabetically for consistent hashing
|
|
100
|
+
methodSignatures.sort();
|
|
101
|
+
|
|
102
|
+
// Create a hashable representation by concatenating all signatures
|
|
103
|
+
return methodSignatures.join('');
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Extracts the parameter name from a parameter node, handling destructured parameters.
|
|
108
|
+
*/
|
|
109
|
+
function extractParameterName(param: ts.ParameterDeclaration, sourceFile: ts.SourceFile): string {
|
|
110
|
+
const name = param.name;
|
|
111
|
+
|
|
112
|
+
if (ts.isIdentifier(name)) {
|
|
113
|
+
return name.text;
|
|
47
114
|
}
|
|
115
|
+
|
|
116
|
+
if (ts.isArrayBindingPattern(name)) {
|
|
117
|
+
// Handle destructured parameters like [blockNumber]: ACVMField[]
|
|
118
|
+
// Extract the first element name
|
|
119
|
+
if (name.elements.length > 0) {
|
|
120
|
+
const element = name.elements[0];
|
|
121
|
+
if (ts.isBindingElement(element)) {
|
|
122
|
+
const elementName = element.name;
|
|
123
|
+
if (ts.isIdentifier(elementName)) {
|
|
124
|
+
return elementName.text;
|
|
125
|
+
}
|
|
126
|
+
// Nested destructuring - use text representation
|
|
127
|
+
if (ts.isArrayBindingPattern(elementName) || ts.isObjectBindingPattern(elementName)) {
|
|
128
|
+
return elementName.getText(sourceFile);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
// Fallback: return the text representation
|
|
133
|
+
return name.getText(sourceFile);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
if (ts.isObjectBindingPattern(name)) {
|
|
137
|
+
// Handle object destructuring
|
|
138
|
+
return name.getText(sourceFile);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
// Fallback for any other case - this should never happen but TypeScript needs it
|
|
142
|
+
return (name as ts.Node).getText(sourceFile);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Extracts the type string from a type node, normalizing whitespace.
|
|
147
|
+
*/
|
|
148
|
+
function extractTypeString(typeNode: ts.TypeNode | undefined, sourceFile: ts.SourceFile): string {
|
|
149
|
+
if (!typeNode) {
|
|
150
|
+
return 'void';
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// Get the type text and normalize whitespace
|
|
154
|
+
let typeText = typeNode.getText(sourceFile);
|
|
155
|
+
// Normalize whitespace: remove extra spaces, newlines, and tabs
|
|
156
|
+
typeText = typeText.replace(/\s+/g, ' ').trim();
|
|
157
|
+
return typeText;
|
|
48
158
|
}
|
|
49
159
|
|
|
50
160
|
assertOracleInterfaceMatches();
|
|
@@ -1,35 +1,34 @@
|
|
|
1
|
+
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
1
2
|
import { type Logger, createLogger } from '@aztec/foundation/log';
|
|
2
3
|
import type { L2TipsKVStore } from '@aztec/kv-store/stores';
|
|
3
4
|
import { L2BlockStream, type L2BlockStreamEvent, type L2BlockStreamEventHandler } from '@aztec/stdlib/block';
|
|
4
5
|
import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
5
6
|
|
|
6
7
|
import type { PXEConfig } from '../config/index.js';
|
|
7
|
-
import type {
|
|
8
|
-
import type {
|
|
9
|
-
import type { TaggingDataProvider } from '../storage/tagging_data_provider/tagging_data_provider.js';
|
|
8
|
+
import type { AnchorBlockStore } from '../storage/anchor_block_store/anchor_block_store.js';
|
|
9
|
+
import type { NoteStore } from '../storage/note_store/note_store.js';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
|
-
* The
|
|
12
|
+
* The BlockSynchronizer class orchestrates synchronization between PXE and Aztec node, maintaining an up-to-date
|
|
13
13
|
* view of the L2 chain state. It handles block header retrieval, chain reorganizations, and provides an interface
|
|
14
14
|
* for querying sync status.
|
|
15
15
|
*/
|
|
16
|
-
export class
|
|
16
|
+
export class BlockSynchronizer implements L2BlockStreamEventHandler {
|
|
17
17
|
private log: Logger;
|
|
18
18
|
private isSyncing: Promise<void> | undefined;
|
|
19
19
|
protected readonly blockStream: L2BlockStream;
|
|
20
20
|
|
|
21
21
|
constructor(
|
|
22
22
|
private node: AztecNode,
|
|
23
|
-
private
|
|
24
|
-
private
|
|
25
|
-
private taggingDataProvider: TaggingDataProvider,
|
|
23
|
+
private anchorBlockStore: AnchorBlockStore,
|
|
24
|
+
private noteStore: NoteStore,
|
|
26
25
|
private l2TipsStore: L2TipsKVStore,
|
|
27
26
|
config: Partial<Pick<PXEConfig, 'l2BlockBatchSize'>> = {},
|
|
28
27
|
loggerOrSuffix?: string | Logger,
|
|
29
28
|
) {
|
|
30
29
|
this.log =
|
|
31
30
|
!loggerOrSuffix || typeof loggerOrSuffix === 'string'
|
|
32
|
-
? createLogger(loggerOrSuffix ? `pxe:
|
|
31
|
+
? createLogger(loggerOrSuffix ? `pxe:block_synchronizer:${loggerOrSuffix}` : `pxe:block_synchronizer`)
|
|
33
32
|
: loggerOrSuffix;
|
|
34
33
|
this.blockStream = this.createBlockStream(config);
|
|
35
34
|
}
|
|
@@ -55,23 +54,20 @@ export class Synchronizer implements L2BlockStreamEventHandler {
|
|
|
55
54
|
archive: lastBlock.archive.root.toString(),
|
|
56
55
|
header: lastBlock.header.toInspect(),
|
|
57
56
|
});
|
|
58
|
-
await this.
|
|
57
|
+
await this.anchorBlockStore.setHeader(lastBlock.getBlockHeader());
|
|
59
58
|
break;
|
|
60
59
|
}
|
|
61
60
|
case 'chain-pruned': {
|
|
62
61
|
this.log.warn(`Pruning data after block ${event.block.number} due to reorg`);
|
|
63
62
|
// We first unnullify and then remove so that unnullified notes that were created after the block number end up deleted.
|
|
64
|
-
const lastSynchedBlockNumber = await this.
|
|
65
|
-
await this.
|
|
66
|
-
// Remove all note tagging indexes to force a full resync. This is suboptimal, but unless we track the
|
|
67
|
-
// block number in which each index is used it's all we can do.
|
|
68
|
-
await this.taggingDataProvider.resetNoteSyncData();
|
|
63
|
+
const lastSynchedBlockNumber = (await this.anchorBlockStore.getBlockHeader()).getBlockNumber();
|
|
64
|
+
await this.noteStore.rollbackNotesAndNullifiers(event.block.number, lastSynchedBlockNumber);
|
|
69
65
|
// Update the header to the last block.
|
|
70
66
|
const newHeader = await this.node.getBlockHeader(event.block.number);
|
|
71
67
|
if (!newHeader) {
|
|
72
68
|
this.log.error(`Block header not found for block number ${event.block.number} during chain prune`);
|
|
73
69
|
} else {
|
|
74
|
-
await this.
|
|
70
|
+
await this.anchorBlockStore.setHeader(newHeader);
|
|
75
71
|
}
|
|
76
72
|
break;
|
|
77
73
|
}
|
|
@@ -81,6 +77,11 @@ export class Synchronizer implements L2BlockStreamEventHandler {
|
|
|
81
77
|
/**
|
|
82
78
|
* Syncs PXE and the node by downloading the metadata of the latest blocks, allowing simulations to use
|
|
83
79
|
* recent data (e.g. notes), and handling any reorgs that might have occurred.
|
|
80
|
+
*
|
|
81
|
+
* Note this BlockSynchronizer is designed to let its users control when a synchronization is run,
|
|
82
|
+
* so this component doesn't proactively stay up to date with the blockchain.
|
|
83
|
+
*
|
|
84
|
+
* We do this so PXE can ensure data consistency.
|
|
84
85
|
*/
|
|
85
86
|
public async sync() {
|
|
86
87
|
if (this.isSyncing !== undefined) {
|
|
@@ -103,18 +104,14 @@ export class Synchronizer implements L2BlockStreamEventHandler {
|
|
|
103
104
|
let currentHeader;
|
|
104
105
|
|
|
105
106
|
try {
|
|
106
|
-
currentHeader = await this.
|
|
107
|
+
currentHeader = await this.anchorBlockStore.getBlockHeader();
|
|
107
108
|
} catch {
|
|
108
109
|
this.log.debug('Header is not set, requesting from the node');
|
|
109
110
|
}
|
|
110
111
|
if (!currentHeader) {
|
|
111
112
|
// REFACTOR: We should know the header of the genesis block without having to request it from the node.
|
|
112
|
-
await this.
|
|
113
|
+
await this.anchorBlockStore.setHeader((await this.node.getBlockHeader(BlockNumber.ZERO))!);
|
|
113
114
|
}
|
|
114
115
|
await this.blockStream.sync();
|
|
115
116
|
}
|
|
116
|
-
|
|
117
|
-
public getSynchedBlockNumber() {
|
|
118
|
-
return this.syncDataProvider.getBlockNumber();
|
|
119
|
-
}
|
|
120
117
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './block_synchronizer.js';
|
package/src/config/index.ts
CHANGED
|
@@ -19,14 +19,14 @@ export interface KernelProverConfig {
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
|
-
* Configuration settings for the synchronizer.
|
|
22
|
+
* Configuration settings for the block synchronizer.
|
|
23
23
|
*/
|
|
24
|
-
export interface
|
|
24
|
+
export interface BlockSynchronizerConfig {
|
|
25
25
|
/** Maximum amount of blocks to pull from the stream in one request when synchronizing */
|
|
26
26
|
l2BlockBatchSize: number;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
export type PXEConfig = KernelProverConfig & DataStoreConfig & ChainConfig &
|
|
29
|
+
export type PXEConfig = KernelProverConfig & DataStoreConfig & ChainConfig & BlockSynchronizerConfig;
|
|
30
30
|
|
|
31
31
|
export type CliPXEOptions = {
|
|
32
32
|
/** Custom Aztec Node URL to connect to */
|
|
@@ -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,6 +119,7 @@ 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.
|
|
@@ -108,15 +130,15 @@ export class ContractFunctionSimulator {
|
|
|
108
130
|
contractAddress: AztecAddress,
|
|
109
131
|
selector: FunctionSelector,
|
|
110
132
|
msgSender = AztecAddress.fromField(Fr.MAX_FIELD_VALUE),
|
|
133
|
+
anchorBlockHeader: BlockHeader,
|
|
111
134
|
senderForTags?: AztecAddress,
|
|
112
135
|
scopes?: AztecAddress[],
|
|
113
136
|
): Promise<PrivateExecutionResult> {
|
|
114
137
|
const simulatorSetupTimer = new Timer();
|
|
115
|
-
const anchorBlockHeader = await this.executionDataProvider.getAnchorBlockHeader();
|
|
116
138
|
|
|
117
|
-
await verifyCurrentClassId(contractAddress, this.
|
|
139
|
+
await verifyCurrentClassId(contractAddress, this.aztecNode, this.contractStore, anchorBlockHeader);
|
|
118
140
|
|
|
119
|
-
const entryPointArtifact = await this.
|
|
141
|
+
const entryPointArtifact = await this.contractStore.getFunctionArtifactWithDebugMetadata(contractAddress, selector);
|
|
120
142
|
|
|
121
143
|
if (entryPointArtifact.functionType !== FunctionType.PRIVATE) {
|
|
122
144
|
throw new Error(`Cannot run ${entryPointArtifact.functionType} function as private`);
|
|
@@ -152,7 +174,17 @@ export class ContractFunctionSimulator {
|
|
|
152
174
|
HashedValuesCache.create(request.argsOfCalls),
|
|
153
175
|
noteCache,
|
|
154
176
|
taggingIndexCache,
|
|
155
|
-
this.
|
|
177
|
+
this.contractStore,
|
|
178
|
+
this.noteStore,
|
|
179
|
+
this.keyStore,
|
|
180
|
+
this.addressStore,
|
|
181
|
+
this.aztecNode,
|
|
182
|
+
this.anchorBlockStore,
|
|
183
|
+
this.senderTaggingStore,
|
|
184
|
+
this.recipientTaggingStore,
|
|
185
|
+
this.senderAddressBookStore,
|
|
186
|
+
this.capsuleStore,
|
|
187
|
+
this.privateEventStore,
|
|
156
188
|
0, // totalPublicArgsCount
|
|
157
189
|
startSideEffectCounter,
|
|
158
190
|
undefined, // log
|
|
@@ -213,20 +245,43 @@ export class ContractFunctionSimulator {
|
|
|
213
245
|
* Runs a utility function.
|
|
214
246
|
* @param call - The function call to execute.
|
|
215
247
|
* @param authwits - Authentication witnesses required for the function call.
|
|
248
|
+
* @param anchorBlockHeader - The block header to use as base state for this run.
|
|
216
249
|
* @param scopes - Optional array of account addresses whose notes can be accessed in this call. Defaults to all
|
|
217
250
|
* accounts if not specified.
|
|
218
251
|
* @returns A return value of the utility function in a form as returned by the simulator (Noir fields)
|
|
219
252
|
*/
|
|
220
|
-
public async runUtility(
|
|
221
|
-
|
|
253
|
+
public async runUtility(
|
|
254
|
+
call: FunctionCall,
|
|
255
|
+
authwits: AuthWitness[],
|
|
256
|
+
anchorBlockHeader: BlockHeader,
|
|
257
|
+
scopes?: AztecAddress[],
|
|
258
|
+
): Promise<Fr[]> {
|
|
259
|
+
await verifyCurrentClassId(call.to, this.aztecNode, this.contractStore, anchorBlockHeader);
|
|
222
260
|
|
|
223
|
-
const entryPointArtifact = await this.
|
|
261
|
+
const entryPointArtifact = await this.contractStore.getFunctionArtifactWithDebugMetadata(call.to, call.selector);
|
|
224
262
|
|
|
225
263
|
if (entryPointArtifact.functionType !== FunctionType.UTILITY) {
|
|
226
264
|
throw new Error(`Cannot run ${entryPointArtifact.functionType} function as utility`);
|
|
227
265
|
}
|
|
228
266
|
|
|
229
|
-
const oracle = new UtilityExecutionOracle(
|
|
267
|
+
const oracle = new UtilityExecutionOracle(
|
|
268
|
+
call.to,
|
|
269
|
+
authwits,
|
|
270
|
+
[],
|
|
271
|
+
anchorBlockHeader,
|
|
272
|
+
this.contractStore,
|
|
273
|
+
this.noteStore,
|
|
274
|
+
this.keyStore,
|
|
275
|
+
this.addressStore,
|
|
276
|
+
this.aztecNode,
|
|
277
|
+
this.anchorBlockStore,
|
|
278
|
+
this.recipientTaggingStore,
|
|
279
|
+
this.senderAddressBookStore,
|
|
280
|
+
this.capsuleStore,
|
|
281
|
+
this.privateEventStore,
|
|
282
|
+
undefined,
|
|
283
|
+
scopes,
|
|
284
|
+
);
|
|
230
285
|
|
|
231
286
|
try {
|
|
232
287
|
this.log.verbose(`Executing utility function ${entryPointArtifact.name}`, {
|
|
@@ -258,8 +313,15 @@ export class ContractFunctionSimulator {
|
|
|
258
313
|
}
|
|
259
314
|
// docs:end:execute_utility_function
|
|
260
315
|
|
|
316
|
+
/**
|
|
317
|
+
* Returns the execution statistics collected during the simulator run.
|
|
318
|
+
* @returns The execution statistics.
|
|
319
|
+
*/
|
|
261
320
|
getStats() {
|
|
262
|
-
|
|
321
|
+
const nodeRPCCalls =
|
|
322
|
+
typeof (this.aztecNode as ProxiedNode).getStats === 'function' ? (this.aztecNode as ProxiedNode).getStats() : {};
|
|
323
|
+
|
|
324
|
+
return { nodeRPCCalls };
|
|
263
325
|
}
|
|
264
326
|
}
|
|
265
327
|
|
|
@@ -282,13 +344,13 @@ class OrderedSideEffect<T> {
|
|
|
282
344
|
* @param privateExecutionResult - The result of the private execution.
|
|
283
345
|
* @param nonceGenerator - A nonce generator for note hashes. According to the protocol rules,
|
|
284
346
|
* it can either be the first nullifier in the tx or the hash of the initial tx request if there are none.
|
|
285
|
-
* @param
|
|
347
|
+
* @param contractStore - A provider for contract data in order to get function names and debug info.
|
|
286
348
|
* @returns The simulated proving result.
|
|
287
349
|
*/
|
|
288
350
|
export async function generateSimulatedProvingResult(
|
|
289
351
|
privateExecutionResult: PrivateExecutionResult,
|
|
290
352
|
nonceGenerator: Fr,
|
|
291
|
-
|
|
353
|
+
contractStore: ContractStore,
|
|
292
354
|
): Promise<PrivateKernelExecutionProofOutput<PrivateKernelTailCircuitPublicInputs>> {
|
|
293
355
|
const siloedNoteHashes: OrderedSideEffect<Fr>[] = [];
|
|
294
356
|
const nullifiers: OrderedSideEffect<Fr>[] = [];
|
|
@@ -365,7 +427,7 @@ export async function generateSimulatedProvingResult(
|
|
|
365
427
|
: execution.publicInputs.publicTeardownCallRequest;
|
|
366
428
|
|
|
367
429
|
executionSteps.push({
|
|
368
|
-
functionName: await
|
|
430
|
+
functionName: await contractStore.getDebugFunctionName(
|
|
369
431
|
execution.publicInputs.callContext.contractAddress,
|
|
370
432
|
execution.publicInputs.callContext.functionSelector,
|
|
371
433
|
),
|
|
@@ -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';
|
|
@@ -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';
|