@aztec/pxe 0.0.1-commit.d3ec352c → 0.0.1-commit.fcb71a6
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} +19 -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 +49 -19
- package/dest/contract_function_simulator/execution_note_cache.d.ts +4 -4
- package/dest/contract_function_simulator/execution_note_cache.d.ts.map +1 -1
- package/dest/contract_function_simulator/execution_note_cache.js +3 -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 +2 -2
- package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts.map +1 -1
- 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 +6 -6
- 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 +2 -2
- package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/oracle.js +18 -7
- package/dest/contract_function_simulator/oracle/private_execution.d.ts +8 -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 +25 -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 +26 -14
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +51 -11
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +146 -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.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 +6 -5
- 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 +135 -143
- 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 -4
- 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} +10 -9
- 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} +16 -8
- 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 +16 -16
- package/src/bin/check_oracle_version.ts +130 -20
- package/src/{synchronizer/synchronizer.ts → block_synchronizer/block_synchronizer.ts} +18 -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 +86 -17
- package/src/contract_function_simulator/execution_note_cache.ts +7 -4
- 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 +1 -1
- package/src/contract_function_simulator/noir-structs/utility_context.ts +1 -1
- package/src/contract_function_simulator/oracle/interfaces.ts +5 -5
- 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 +21 -7
- package/src/contract_function_simulator/oracle/private_execution.ts +15 -14
- package/src/contract_function_simulator/oracle/private_execution_oracle.ts +92 -22
- package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +213 -49
- 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 +4 -4
- package/src/private_kernel/private_kernel_oracle.ts +2 -1
- package/src/private_kernel/private_kernel_oracle_impl.ts +8 -7
- package/src/public_storage/public_storage_service.ts +33 -0
- package/src/pxe.ts +162 -181
- 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 -12
- 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} +19 -10
- 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 -267
- 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 -123
- package/dest/contract_function_simulator/pxe_oracle_interface.d.ts.map +0 -1
- package/dest/contract_function_simulator/pxe_oracle_interface.js +0 -696
- 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 -36
- 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 -342
- package/src/contract_function_simulator/pxe_oracle_interface.ts +0 -1023
- 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();
|
|
@@ -5,32 +5,30 @@ import { L2BlockStream, type L2BlockStreamEvent, type L2BlockStreamEventHandler
|
|
|
5
5
|
import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
6
6
|
|
|
7
7
|
import type { PXEConfig } from '../config/index.js';
|
|
8
|
-
import type {
|
|
9
|
-
import type {
|
|
10
|
-
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';
|
|
11
10
|
|
|
12
11
|
/**
|
|
13
|
-
* The
|
|
12
|
+
* The BlockSynchronizer class orchestrates synchronization between PXE and Aztec node, maintaining an up-to-date
|
|
14
13
|
* view of the L2 chain state. It handles block header retrieval, chain reorganizations, and provides an interface
|
|
15
14
|
* for querying sync status.
|
|
16
15
|
*/
|
|
17
|
-
export class
|
|
16
|
+
export class BlockSynchronizer implements L2BlockStreamEventHandler {
|
|
18
17
|
private log: Logger;
|
|
19
18
|
private isSyncing: Promise<void> | undefined;
|
|
20
19
|
protected readonly blockStream: L2BlockStream;
|
|
21
20
|
|
|
22
21
|
constructor(
|
|
23
22
|
private node: AztecNode,
|
|
24
|
-
private
|
|
25
|
-
private
|
|
26
|
-
private taggingDataProvider: TaggingDataProvider,
|
|
23
|
+
private anchorBlockStore: AnchorBlockStore,
|
|
24
|
+
private noteStore: NoteStore,
|
|
27
25
|
private l2TipsStore: L2TipsKVStore,
|
|
28
26
|
config: Partial<Pick<PXEConfig, 'l2BlockBatchSize'>> = {},
|
|
29
27
|
loggerOrSuffix?: string | Logger,
|
|
30
28
|
) {
|
|
31
29
|
this.log =
|
|
32
30
|
!loggerOrSuffix || typeof loggerOrSuffix === 'string'
|
|
33
|
-
? createLogger(loggerOrSuffix ? `pxe:
|
|
31
|
+
? createLogger(loggerOrSuffix ? `pxe:block_synchronizer:${loggerOrSuffix}` : `pxe:block_synchronizer`)
|
|
34
32
|
: loggerOrSuffix;
|
|
35
33
|
this.blockStream = this.createBlockStream(config);
|
|
36
34
|
}
|
|
@@ -56,23 +54,20 @@ export class Synchronizer implements L2BlockStreamEventHandler {
|
|
|
56
54
|
archive: lastBlock.archive.root.toString(),
|
|
57
55
|
header: lastBlock.header.toInspect(),
|
|
58
56
|
});
|
|
59
|
-
await this.
|
|
57
|
+
await this.anchorBlockStore.setHeader(lastBlock.getBlockHeader());
|
|
60
58
|
break;
|
|
61
59
|
}
|
|
62
60
|
case 'chain-pruned': {
|
|
63
61
|
this.log.warn(`Pruning data after block ${event.block.number} due to reorg`);
|
|
64
62
|
// We first unnullify and then remove so that unnullified notes that were created after the block number end up deleted.
|
|
65
|
-
const lastSynchedBlockNumber = await this.
|
|
66
|
-
await this.
|
|
67
|
-
// Remove all note tagging indexes to force a full resync. This is suboptimal, but unless we track the
|
|
68
|
-
// block number in which each index is used it's all we can do.
|
|
69
|
-
await this.taggingDataProvider.resetNoteSyncData();
|
|
63
|
+
const lastSynchedBlockNumber = (await this.anchorBlockStore.getBlockHeader()).getBlockNumber();
|
|
64
|
+
await this.noteStore.rollbackNotesAndNullifiers(event.block.number, lastSynchedBlockNumber);
|
|
70
65
|
// Update the header to the last block.
|
|
71
66
|
const newHeader = await this.node.getBlockHeader(event.block.number);
|
|
72
67
|
if (!newHeader) {
|
|
73
68
|
this.log.error(`Block header not found for block number ${event.block.number} during chain prune`);
|
|
74
69
|
} else {
|
|
75
|
-
await this.
|
|
70
|
+
await this.anchorBlockStore.setHeader(newHeader);
|
|
76
71
|
}
|
|
77
72
|
break;
|
|
78
73
|
}
|
|
@@ -82,6 +77,11 @@ export class Synchronizer implements L2BlockStreamEventHandler {
|
|
|
82
77
|
/**
|
|
83
78
|
* Syncs PXE and the node by downloading the metadata of the latest blocks, allowing simulations to use
|
|
84
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.
|
|
85
85
|
*/
|
|
86
86
|
public async sync() {
|
|
87
87
|
if (this.isSyncing !== undefined) {
|
|
@@ -104,18 +104,14 @@ export class Synchronizer implements L2BlockStreamEventHandler {
|
|
|
104
104
|
let currentHeader;
|
|
105
105
|
|
|
106
106
|
try {
|
|
107
|
-
currentHeader = await this.
|
|
107
|
+
currentHeader = await this.anchorBlockStore.getBlockHeader();
|
|
108
108
|
} catch {
|
|
109
109
|
this.log.debug('Header is not set, requesting from the node');
|
|
110
110
|
}
|
|
111
111
|
if (!currentHeader) {
|
|
112
112
|
// REFACTOR: We should know the header of the genesis block without having to request it from the node.
|
|
113
|
-
await this.
|
|
113
|
+
await this.anchorBlockStore.setHeader((await this.node.getBlockHeader(BlockNumber.ZERO))!);
|
|
114
114
|
}
|
|
115
115
|
await this.blockStream.sync();
|
|
116
116
|
}
|
|
117
|
-
|
|
118
|
-
public getSynchedBlockNumber() {
|
|
119
|
-
return this.syncDataProvider.getBlockNumber();
|
|
120
|
-
}
|
|
121
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,19 @@ 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
|
|
139
|
+
await this.contractStore.syncPrivateState(contractAddress, selector, privateSyncCall =>
|
|
140
|
+
this.runUtility(privateSyncCall, [], anchorBlockHeader, scopes),
|
|
141
|
+
);
|
|
142
|
+
|
|
143
|
+
await verifyCurrentClassId(contractAddress, this.aztecNode, this.contractStore, anchorBlockHeader);
|
|
118
144
|
|
|
119
|
-
const entryPointArtifact = await this.
|
|
145
|
+
const entryPointArtifact = await this.contractStore.getFunctionArtifactWithDebugMetadata(contractAddress, selector);
|
|
120
146
|
|
|
121
147
|
if (entryPointArtifact.functionType !== FunctionType.PRIVATE) {
|
|
122
148
|
throw new Error(`Cannot run ${entryPointArtifact.functionType} function as private`);
|
|
@@ -147,12 +173,25 @@ export class ContractFunctionSimulator {
|
|
|
147
173
|
request.txContext,
|
|
148
174
|
callContext,
|
|
149
175
|
anchorBlockHeader,
|
|
176
|
+
async call => {
|
|
177
|
+
await this.runUtility(call, [], anchorBlockHeader, scopes);
|
|
178
|
+
},
|
|
150
179
|
request.authWitnesses,
|
|
151
180
|
request.capsules,
|
|
152
181
|
HashedValuesCache.create(request.argsOfCalls),
|
|
153
182
|
noteCache,
|
|
154
183
|
taggingIndexCache,
|
|
155
|
-
this.
|
|
184
|
+
this.contractStore,
|
|
185
|
+
this.noteStore,
|
|
186
|
+
this.keyStore,
|
|
187
|
+
this.addressStore,
|
|
188
|
+
this.aztecNode,
|
|
189
|
+
this.anchorBlockStore,
|
|
190
|
+
this.senderTaggingStore,
|
|
191
|
+
this.recipientTaggingStore,
|
|
192
|
+
this.senderAddressBookStore,
|
|
193
|
+
this.capsuleStore,
|
|
194
|
+
this.privateEventStore,
|
|
156
195
|
0, // totalPublicArgsCount
|
|
157
196
|
startSideEffectCounter,
|
|
158
197
|
undefined, // log
|
|
@@ -213,20 +252,43 @@ export class ContractFunctionSimulator {
|
|
|
213
252
|
* Runs a utility function.
|
|
214
253
|
* @param call - The function call to execute.
|
|
215
254
|
* @param authwits - Authentication witnesses required for the function call.
|
|
255
|
+
* @param anchorBlockHeader - The block header to use as base state for this run.
|
|
216
256
|
* @param scopes - Optional array of account addresses whose notes can be accessed in this call. Defaults to all
|
|
217
257
|
* accounts if not specified.
|
|
218
258
|
* @returns A return value of the utility function in a form as returned by the simulator (Noir fields)
|
|
219
259
|
*/
|
|
220
|
-
public async runUtility(
|
|
221
|
-
|
|
260
|
+
public async runUtility(
|
|
261
|
+
call: FunctionCall,
|
|
262
|
+
authwits: AuthWitness[],
|
|
263
|
+
anchorBlockHeader: BlockHeader,
|
|
264
|
+
scopes?: AztecAddress[],
|
|
265
|
+
): Promise<Fr[]> {
|
|
266
|
+
await verifyCurrentClassId(call.to, this.aztecNode, this.contractStore, anchorBlockHeader);
|
|
222
267
|
|
|
223
|
-
const entryPointArtifact = await this.
|
|
268
|
+
const entryPointArtifact = await this.contractStore.getFunctionArtifactWithDebugMetadata(call.to, call.selector);
|
|
224
269
|
|
|
225
270
|
if (entryPointArtifact.functionType !== FunctionType.UTILITY) {
|
|
226
271
|
throw new Error(`Cannot run ${entryPointArtifact.functionType} function as utility`);
|
|
227
272
|
}
|
|
228
273
|
|
|
229
|
-
const oracle = new UtilityExecutionOracle(
|
|
274
|
+
const oracle = new UtilityExecutionOracle(
|
|
275
|
+
call.to,
|
|
276
|
+
authwits,
|
|
277
|
+
[],
|
|
278
|
+
anchorBlockHeader,
|
|
279
|
+
this.contractStore,
|
|
280
|
+
this.noteStore,
|
|
281
|
+
this.keyStore,
|
|
282
|
+
this.addressStore,
|
|
283
|
+
this.aztecNode,
|
|
284
|
+
this.anchorBlockStore,
|
|
285
|
+
this.recipientTaggingStore,
|
|
286
|
+
this.senderAddressBookStore,
|
|
287
|
+
this.capsuleStore,
|
|
288
|
+
this.privateEventStore,
|
|
289
|
+
undefined,
|
|
290
|
+
scopes,
|
|
291
|
+
);
|
|
230
292
|
|
|
231
293
|
try {
|
|
232
294
|
this.log.verbose(`Executing utility function ${entryPointArtifact.name}`, {
|
|
@@ -258,8 +320,15 @@ export class ContractFunctionSimulator {
|
|
|
258
320
|
}
|
|
259
321
|
// docs:end:execute_utility_function
|
|
260
322
|
|
|
323
|
+
/**
|
|
324
|
+
* Returns the execution statistics collected during the simulator run.
|
|
325
|
+
* @returns The execution statistics.
|
|
326
|
+
*/
|
|
261
327
|
getStats() {
|
|
262
|
-
|
|
328
|
+
const nodeRPCCalls =
|
|
329
|
+
typeof (this.aztecNode as ProxiedNode).getStats === 'function' ? (this.aztecNode as ProxiedNode).getStats() : {};
|
|
330
|
+
|
|
331
|
+
return { nodeRPCCalls };
|
|
263
332
|
}
|
|
264
333
|
}
|
|
265
334
|
|
|
@@ -282,13 +351,13 @@ class OrderedSideEffect<T> {
|
|
|
282
351
|
* @param privateExecutionResult - The result of the private execution.
|
|
283
352
|
* @param nonceGenerator - A nonce generator for note hashes. According to the protocol rules,
|
|
284
353
|
* it can either be the first nullifier in the tx or the hash of the initial tx request if there are none.
|
|
285
|
-
* @param
|
|
354
|
+
* @param contractStore - A provider for contract data in order to get function names and debug info.
|
|
286
355
|
* @returns The simulated proving result.
|
|
287
356
|
*/
|
|
288
357
|
export async function generateSimulatedProvingResult(
|
|
289
358
|
privateExecutionResult: PrivateExecutionResult,
|
|
290
359
|
nonceGenerator: Fr,
|
|
291
|
-
|
|
360
|
+
contractStore: ContractStore,
|
|
292
361
|
): Promise<PrivateKernelExecutionProofOutput<PrivateKernelTailCircuitPublicInputs>> {
|
|
293
362
|
const siloedNoteHashes: OrderedSideEffect<Fr>[] = [];
|
|
294
363
|
const nullifiers: OrderedSideEffect<Fr>[] = [];
|
|
@@ -365,7 +434,7 @@ export async function generateSimulatedProvingResult(
|
|
|
365
434
|
: execution.publicInputs.publicTeardownCallRequest;
|
|
366
435
|
|
|
367
436
|
executionSteps.push({
|
|
368
|
-
functionName: await
|
|
437
|
+
functionName: await contractStore.getDebugFunctionName(
|
|
369
438
|
execution.publicInputs.callContext.contractAddress,
|
|
370
439
|
execution.publicInputs.callContext.functionSelector,
|
|
371
440
|
),
|
|
@@ -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,12 +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.
|
|
176
|
+
* @param owner - Owner of the notes. If undefined, returns all notes regardless of owner.
|
|
177
177
|
* @param storageSlot - Storage slot of the notes.
|
|
178
178
|
**/
|
|
179
|
-
public getNotes(contractAddress: AztecAddress, owner: AztecAddress, storageSlot: Fr) {
|
|
179
|
+
public getNotes(contractAddress: AztecAddress, owner: AztecAddress | undefined, storageSlot: Fr) {
|
|
180
180
|
const notes = this.noteMap.get(contractAddress.toBigInt()) ?? [];
|
|
181
|
-
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);
|
|
182
185
|
}
|
|
183
186
|
|
|
184
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,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';
|