@aztec/pxe 4.0.0-nightly.20250907 → 4.0.0-nightly.20260107
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -5
- package/dest/bin/check_oracle_version.d.ts +1 -1
- package/dest/bin/check_oracle_version.js +110 -10
- package/dest/block_synchronizer/block_synchronizer.d.ts +39 -0
- package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -0
- package/dest/{synchronizer/synchronizer.js → block_synchronizer/block_synchronizer.js} +23 -23
- package/dest/block_synchronizer/index.d.ts +2 -0
- package/dest/block_synchronizer/index.d.ts.map +1 -0
- package/dest/block_synchronizer/index.js +1 -0
- package/dest/config/index.d.ts +9 -17
- package/dest/config/index.d.ts.map +1 -1
- package/dest/config/index.js +10 -16
- package/dest/config/package_info.d.ts +1 -1
- package/dest/config/package_info.js +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.d.ts +44 -15
- package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.js +142 -57
- package/dest/contract_function_simulator/execution_note_cache.d.ts +11 -9
- package/dest/contract_function_simulator/execution_note_cache.d.ts.map +1 -1
- package/dest/contract_function_simulator/execution_note_cache.js +28 -17
- package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts +16 -0
- package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts.map +1 -0
- package/dest/contract_function_simulator/execution_tagging_index_cache.js +26 -0
- package/dest/contract_function_simulator/hashed_values_cache.d.ts +2 -2
- package/dest/contract_function_simulator/hashed_values_cache.d.ts.map +1 -1
- package/dest/contract_function_simulator/index.d.ts +4 -2
- package/dest/contract_function_simulator/index.d.ts.map +1 -1
- package/dest/contract_function_simulator/index.js +2 -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 +3 -3
- 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 +8 -4
- package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +6 -3
- 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 +12 -3
- package/dest/contract_function_simulator/noir-structs/utility_context.d.ts +22 -0
- package/dest/contract_function_simulator/noir-structs/utility_context.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/utility_context.js +33 -0
- package/dest/contract_function_simulator/oracle/index.d.ts +2 -2
- package/dest/contract_function_simulator/oracle/index.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/index.js +1 -1
- package/dest/contract_function_simulator/oracle/interfaces.d.ts +103 -0
- package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -0
- package/dest/contract_function_simulator/oracle/interfaces.js +4 -0
- package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts +2 -4
- 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 +10 -4
- package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/note_packing_utils.js +10 -5
- package/dest/contract_function_simulator/oracle/oracle.d.ts +17 -15
- package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/oracle.js +101 -81
- package/dest/contract_function_simulator/oracle/private_execution.d.ts +11 -12
- package/dest/contract_function_simulator/oracle/private_execution.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution.js +15 -24
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +51 -25
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.js +103 -27
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +65 -36
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +171 -69
- 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/contract_function_simulator/proxied_node.d.ts +1 -1
- package/dest/contract_function_simulator/proxied_node.d.ts.map +1 -1
- package/dest/debug/pxe_debug_utils.d.ts +31 -0
- package/dest/debug/pxe_debug_utils.d.ts.map +1 -0
- package/dest/debug/pxe_debug_utils.js +37 -0
- package/dest/entrypoints/client/bundle/index.d.ts +4 -3
- package/dest/entrypoints/client/bundle/index.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/index.js +2 -2
- package/dest/entrypoints/client/bundle/utils.d.ts +9 -9
- package/dest/entrypoints/client/bundle/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/utils.js +21 -12
- package/dest/entrypoints/client/lazy/index.d.ts +4 -3
- package/dest/entrypoints/client/lazy/index.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/index.js +2 -2
- package/dest/entrypoints/client/lazy/utils.d.ts +8 -8
- package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/utils.js +20 -11
- package/dest/entrypoints/pxe_creation_options.d.ts +5 -2
- package/dest/entrypoints/pxe_creation_options.d.ts.map +1 -1
- package/dest/entrypoints/server/index.d.ts +5 -3
- package/dest/entrypoints/server/index.d.ts.map +1 -1
- package/dest/entrypoints/server/index.js +3 -2
- package/dest/entrypoints/server/utils.d.ts +5 -24
- package/dest/entrypoints/server/utils.d.ts.map +1 -1
- package/dest/entrypoints/server/utils.js +17 -45
- package/dest/error_enriching.d.ts +11 -0
- package/dest/error_enriching.d.ts.map +1 -0
- package/dest/{pxe_service/error_enriching.js → error_enriching.js} +9 -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 +3 -3
- package/dest/oracle_version.js +2 -2
- package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts +3 -3
- package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts.map +1 -1
- package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.js +7 -7
- package/dest/private_kernel/hints/compute_tx_include_by_timestamp.d.ts +1 -1
- package/dest/private_kernel/hints/compute_tx_include_by_timestamp.js +6 -6
- package/dest/private_kernel/hints/index.d.ts +1 -1
- package/dest/private_kernel/index.d.ts +1 -1
- package/dest/private_kernel/private_kernel_execution_prover.d.ts +9 -2
- package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_execution_prover.js +38 -32
- 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 +10 -9
- 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 +232 -0
- package/dest/pxe.d.ts.map +1 -0
- package/dest/{pxe_service/pxe_service.js → pxe.js} +299 -324
- package/dest/storage/address_store/address_store.d.ts +11 -0
- package/dest/storage/address_store/address_store.d.ts.map +1 -0
- package/dest/storage/{address_data_provider/address_data_provider.js → address_store/address_store.js} +1 -4
- package/dest/storage/address_store/index.d.ts +2 -0
- package/dest/storage/address_store/index.d.ts.map +1 -0
- package/dest/storage/address_store/index.js +1 -0
- package/dest/storage/anchor_block_store/anchor_block_store.d.ts +9 -0
- package/dest/storage/anchor_block_store/anchor_block_store.d.ts.map +1 -0
- package/dest/storage/{sync_data_provider/sync_data_provider.js → anchor_block_store/anchor_block_store.js} +2 -12
- package/dest/storage/anchor_block_store/index.d.ts +2 -0
- package/dest/storage/anchor_block_store/index.d.ts.map +1 -0
- package/dest/storage/anchor_block_store/index.js +1 -0
- package/dest/storage/capsule_store/capsule_store.d.ts +57 -0
- package/dest/storage/capsule_store/capsule_store.d.ts.map +1 -0
- package/dest/storage/{capsule_data_provider/capsule_data_provider.js → capsule_store/capsule_store.js} +34 -10
- 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} +10 -18
- 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 -18
- 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 -9
- package/dest/storage/index.d.ts.map +1 -1
- package/dest/storage/index.js +7 -8
- package/dest/storage/metadata.d.ts +1 -1
- package/dest/storage/note_store/index.d.ts +3 -0
- package/dest/storage/note_store/index.d.ts.map +1 -0
- package/dest/storage/note_store/index.js +2 -0
- package/dest/storage/note_store/note_store.d.ts +84 -0
- package/dest/storage/note_store/note_store.d.ts.map +1 -0
- package/dest/storage/{note_data_provider/note_data_provider.js → note_store/note_store.js} +144 -82
- package/dest/storage/private_event_store/private_event_store.d.ts +56 -0
- package/dest/storage/private_event_store/private_event_store.d.ts.map +1 -0
- package/dest/storage/private_event_store/private_event_store.js +157 -0
- package/dest/storage/tagging_store/index.d.ts +4 -0
- package/dest/storage/tagging_store/index.d.ts.map +1 -0
- package/dest/storage/tagging_store/index.js +3 -0
- package/dest/storage/tagging_store/recipient_tagging_store.d.ts +21 -0
- package/dest/storage/tagging_store/recipient_tagging_store.d.ts.map +1 -0
- package/dest/storage/tagging_store/recipient_tagging_store.js +42 -0
- package/dest/storage/tagging_store/sender_address_book_store.d.ts +14 -0
- package/dest/storage/tagging_store/sender_address_book_store.d.ts.map +1 -0
- package/dest/storage/tagging_store/sender_address_book_store.js +30 -0
- package/dest/storage/tagging_store/sender_tagging_store.d.ts +67 -0
- package/dest/storage/tagging_store/sender_tagging_store.d.ts.map +1 -0
- package/dest/storage/tagging_store/sender_tagging_store.js +196 -0
- package/dest/tagging/index.d.ts +16 -0
- package/dest/tagging/index.d.ts.map +1 -0
- package/dest/tagging/index.js +23 -0
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts +14 -0
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts.map +1 -0
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.js +99 -0
- package/dest/tagging/recipient_sync/utils/find_highest_indexes.d.ts +12 -0
- package/dest/tagging/recipient_sync/utils/find_highest_indexes.d.ts.map +1 -0
- package/dest/tagging/recipient_sync/utils/find_highest_indexes.js +20 -0
- package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts +14 -0
- package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts.map +1 -0
- package/dest/tagging/recipient_sync/utils/load_logs_for_range.js +29 -0
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts +20 -0
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts.map +1 -0
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.js +74 -0
- package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts +11 -0
- package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts.map +1 -0
- package/dest/tagging/sender_sync/utils/get_status_change_of_pending.js +32 -0
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts +18 -0
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts.map +1 -0
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.js +55 -0
- package/dest/tree_membership/tree_membership_service.d.ts +52 -0
- package/dest/tree_membership/tree_membership_service.d.ts.map +1 -0
- package/dest/tree_membership/tree_membership_service.js +84 -0
- package/package.json +22 -24
- package/src/bin/check_oracle_version.ts +134 -10
- package/src/{synchronizer/synchronizer.ts → block_synchronizer/block_synchronizer.ts} +22 -23
- package/src/block_synchronizer/index.ts +1 -0
- package/src/config/index.ts +18 -32
- package/src/config/package_info.ts +1 -1
- package/src/contract_function_simulator/contract_function_simulator.ts +233 -75
- package/src/contract_function_simulator/execution_note_cache.ts +33 -17
- package/src/contract_function_simulator/execution_tagging_index_cache.ts +32 -0
- package/src/contract_function_simulator/hashed_values_cache.ts +1 -1
- package/src/contract_function_simulator/index.ts +3 -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 +10 -5
- package/src/contract_function_simulator/noir-structs/note_validation_request.ts +14 -2
- package/src/contract_function_simulator/noir-structs/utility_context.ts +42 -0
- package/src/contract_function_simulator/oracle/index.ts +1 -1
- package/src/contract_function_simulator/oracle/interfaces.ts +175 -0
- package/src/contract_function_simulator/oracle/message_load_oracle_inputs.ts +1 -1
- package/src/contract_function_simulator/oracle/note_packing_utils.ts +21 -5
- package/src/contract_function_simulator/oracle/oracle.ts +135 -80
- package/src/contract_function_simulator/oracle/private_execution.ts +22 -28
- package/src/contract_function_simulator/oracle/private_execution_oracle.ts +200 -56
- package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +260 -109
- 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 +3 -2
- package/src/entrypoints/client/bundle/utils.ts +21 -23
- package/src/entrypoints/client/lazy/index.ts +3 -2
- package/src/entrypoints/client/lazy/utils.ts +20 -23
- package/src/entrypoints/pxe_creation_options.ts +4 -1
- package/src/entrypoints/server/index.ts +4 -2
- package/src/entrypoints/server/utils.ts +20 -68
- package/src/{pxe_service/error_enriching.ts → error_enriching.ts} +11 -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 +5 -9
- package/src/private_kernel/hints/compute_tx_include_by_timestamp.ts +6 -6
- package/src/private_kernel/private_kernel_execution_prover.ts +51 -43
- 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_service/pxe_service.ts → pxe.ts} +349 -410
- package/src/storage/{address_data_provider/address_data_provider.ts → address_store/address_store.ts} +1 -7
- package/src/storage/address_store/index.ts +1 -0
- package/src/storage/{sync_data_provider/sync_data_provider.ts → anchor_block_store/anchor_block_store.ts} +2 -17
- package/src/storage/anchor_block_store/index.ts +1 -0
- package/src/storage/{capsule_data_provider/capsule_data_provider.ts → capsule_store/capsule_store.ts} +34 -12
- package/src/storage/capsule_store/index.ts +1 -0
- package/src/storage/{contract_data_provider/contract_data_provider.ts → contract_store/contract_store.ts} +67 -28
- 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 -8
- package/src/storage/note_store/index.ts +2 -0
- package/src/storage/{note_data_provider/note_data_provider.ts → note_store/note_store.ts} +173 -111
- package/src/storage/private_event_store/private_event_store.ts +213 -0
- package/src/storage/tagging_store/index.ts +3 -0
- package/src/storage/tagging_store/recipient_tagging_store.ts +53 -0
- package/src/storage/tagging_store/sender_address_book_store.ts +42 -0
- package/src/storage/tagging_store/sender_tagging_store.ts +244 -0
- package/src/tagging/index.ts +28 -0
- 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/bin/index.d.ts +0 -3
- package/dest/bin/index.d.ts.map +0 -1
- package/dest/bin/index.js +0 -48
- package/dest/contract_function_simulator/execution_data_provider.d.ts +0 -285
- 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/oracle/typed_oracle.d.ts +0 -87
- package/dest/contract_function_simulator/oracle/typed_oracle.d.ts.map +0 -1
- package/dest/contract_function_simulator/oracle/typed_oracle.js +0 -146
- package/dest/contract_function_simulator/pxe_oracle_interface.d.ts +0 -158
- package/dest/contract_function_simulator/pxe_oracle_interface.d.ts.map +0 -1
- package/dest/contract_function_simulator/pxe_oracle_interface.js +0 -701
- package/dest/contract_function_simulator/tagging_utils.d.ts +0 -17
- package/dest/contract_function_simulator/tagging_utils.d.ts.map +0 -1
- package/dest/contract_function_simulator/tagging_utils.js +0 -23
- package/dest/pxe_service/error_enriching.d.ts +0 -11
- package/dest/pxe_service/error_enriching.d.ts.map +0 -1
- package/dest/pxe_service/index.d.ts +0 -3
- package/dest/pxe_service/index.d.ts.map +0 -1
- package/dest/pxe_service/index.js +0 -2
- package/dest/pxe_service/pxe_service.d.ts +0 -100
- package/dest/pxe_service/pxe_service.d.ts.map +0 -1
- package/dest/storage/address_data_provider/address_data_provider.d.ts +0 -13
- package/dest/storage/address_data_provider/address_data_provider.d.ts.map +0 -1
- package/dest/storage/address_data_provider/index.d.ts +0 -2
- package/dest/storage/address_data_provider/index.d.ts.map +0 -1
- package/dest/storage/address_data_provider/index.js +0 -1
- package/dest/storage/capsule_data_provider/capsule_data_provider.d.ts +0 -27
- 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/data_provider.d.ts +0 -4
- package/dest/storage/data_provider.d.ts.map +0 -1
- package/dest/storage/data_provider.js +0 -1
- package/dest/storage/note_data_provider/index.d.ts +0 -3
- package/dest/storage/note_data_provider/index.d.ts.map +0 -1
- package/dest/storage/note_data_provider/index.js +0 -2
- package/dest/storage/note_data_provider/note_dao.d.ts +0 -100
- package/dest/storage/note_data_provider/note_dao.d.ts.map +0 -1
- package/dest/storage/note_data_provider/note_dao.js +0 -102
- package/dest/storage/note_data_provider/note_data_provider.d.ts +0 -20
- package/dest/storage/note_data_provider/note_data_provider.d.ts.map +0 -1
- package/dest/storage/private_event_data_provider/private_event_data_provider.d.ts +0 -37
- package/dest/storage/private_event_data_provider/private_event_data_provider.d.ts.map +0 -1
- package/dest/storage/private_event_data_provider/private_event_data_provider.js +0 -96
- package/dest/storage/sync_data_provider/index.d.ts +0 -2
- package/dest/storage/sync_data_provider/index.d.ts.map +0 -1
- package/dest/storage/sync_data_provider/index.js +0 -1
- package/dest/storage/sync_data_provider/sync_data_provider.d.ts +0 -12
- package/dest/storage/sync_data_provider/sync_data_provider.d.ts.map +0 -1
- package/dest/storage/tagging_data_provider/index.d.ts +0 -2
- package/dest/storage/tagging_data_provider/index.d.ts.map +0 -1
- package/dest/storage/tagging_data_provider/index.js +0 -1
- package/dest/storage/tagging_data_provider/tagging_data_provider.d.ts +0 -18
- package/dest/storage/tagging_data_provider/tagging_data_provider.d.ts.map +0 -1
- package/dest/storage/tagging_data_provider/tagging_data_provider.js +0 -82
- 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/test/pxe_test_suite.d.ts +0 -3
- package/dest/test/pxe_test_suite.d.ts.map +0 -1
- package/dest/test/pxe_test_suite.js +0 -97
- package/src/bin/index.ts +0 -62
- package/src/contract_function_simulator/execution_data_provider.ts +0 -361
- package/src/contract_function_simulator/oracle/typed_oracle.ts +0 -289
- package/src/contract_function_simulator/pxe_oracle_interface.ts +0 -1020
- package/src/contract_function_simulator/tagging_utils.ts +0 -32
- package/src/pxe_service/index.ts +0 -2
- 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/data_provider.ts +0 -3
- package/src/storage/note_data_provider/index.ts +0 -2
- package/src/storage/note_data_provider/note_dao.ts +0 -154
- package/src/storage/private_event_data_provider/private_event_data_provider.ts +0 -134
- 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 -123
- package/src/synchronizer/index.ts +0 -1
- package/src/test/pxe_test_suite.ts +0 -113
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
|
+
AVM_EMITNOTEHASH_BASE_L2_GAS,
|
|
3
|
+
AVM_EMITNULLIFIER_BASE_L2_GAS,
|
|
4
|
+
AVM_SENDL2TOL1MSG_BASE_L2_GAS,
|
|
5
|
+
DA_BYTES_PER_FIELD,
|
|
6
|
+
DA_GAS_PER_BYTE,
|
|
7
|
+
FIXED_AVM_STARTUP_L2_GAS,
|
|
8
|
+
FIXED_DA_GAS,
|
|
9
|
+
FIXED_L2_GAS,
|
|
10
|
+
L2_GAS_PER_CONTRACT_CLASS_LOG,
|
|
11
|
+
L2_GAS_PER_PRIVATE_LOG,
|
|
2
12
|
MAX_CONTRACT_CLASS_LOGS_PER_TX,
|
|
3
13
|
MAX_ENQUEUED_CALLS_PER_TX,
|
|
4
14
|
MAX_L2_TO_L1_MSGS_PER_TX,
|
|
@@ -6,13 +16,14 @@ import {
|
|
|
6
16
|
MAX_NULLIFIERS_PER_TX,
|
|
7
17
|
MAX_PRIVATE_LOGS_PER_TX,
|
|
8
18
|
} from '@aztec/constants';
|
|
9
|
-
import { padArrayEnd } from '@aztec/foundation/collection';
|
|
10
|
-
import { poseidon2Hash } from '@aztec/foundation/crypto';
|
|
11
|
-
import { Fr } from '@aztec/foundation/
|
|
19
|
+
import { arrayNonEmptyLength, padArrayEnd } from '@aztec/foundation/collection';
|
|
20
|
+
import { poseidon2Hash } from '@aztec/foundation/crypto/poseidon';
|
|
21
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
12
22
|
import { type Logger, createLogger } from '@aztec/foundation/log';
|
|
13
23
|
import { Timer } from '@aztec/foundation/timer';
|
|
24
|
+
import type { KeyStore } from '@aztec/key-store';
|
|
14
25
|
import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
|
|
15
|
-
import {
|
|
26
|
+
import { protocolContractsHash } from '@aztec/protocol-contracts';
|
|
16
27
|
import {
|
|
17
28
|
type CircuitSimulator,
|
|
18
29
|
ExecutionError,
|
|
@@ -22,12 +33,19 @@ import {
|
|
|
22
33
|
toACVMWitness,
|
|
23
34
|
witnessMapToFields,
|
|
24
35
|
} from '@aztec/simulator/client';
|
|
25
|
-
import type {
|
|
26
|
-
import { FunctionSelector, FunctionType
|
|
36
|
+
import type { FunctionCall } from '@aztec/stdlib/abi';
|
|
37
|
+
import { FunctionSelector, FunctionType } from '@aztec/stdlib/abi';
|
|
27
38
|
import type { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
28
39
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
29
40
|
import { Gas } from '@aztec/stdlib/gas';
|
|
30
|
-
import {
|
|
41
|
+
import {
|
|
42
|
+
computeNoteHashNonce,
|
|
43
|
+
computeProtocolNullifier,
|
|
44
|
+
computeUniqueNoteHash,
|
|
45
|
+
siloNoteHash,
|
|
46
|
+
siloNullifier,
|
|
47
|
+
} from '@aztec/stdlib/hash';
|
|
48
|
+
import type { AztecNode } from '@aztec/stdlib/interfaces/server';
|
|
31
49
|
import {
|
|
32
50
|
PartialPrivateTailPublicInputsForPublic,
|
|
33
51
|
PartialPrivateTailPublicInputsForRollup,
|
|
@@ -41,24 +59,35 @@ import {
|
|
|
41
59
|
} from '@aztec/stdlib/kernel';
|
|
42
60
|
import { PrivateLog } from '@aztec/stdlib/logs';
|
|
43
61
|
import { ScopedL2ToL1Message } from '@aztec/stdlib/messaging';
|
|
44
|
-
import {
|
|
62
|
+
import { ChonkProof } from '@aztec/stdlib/proofs';
|
|
45
63
|
import {
|
|
64
|
+
BlockHeader,
|
|
46
65
|
CallContext,
|
|
47
66
|
HashedValues,
|
|
48
67
|
PrivateExecutionResult,
|
|
49
68
|
TxConstantData,
|
|
50
69
|
TxExecutionRequest,
|
|
51
70
|
collectNested,
|
|
71
|
+
getFinalMinRevertibleSideEffectCounter,
|
|
52
72
|
} from '@aztec/stdlib/tx';
|
|
53
73
|
|
|
54
|
-
import type {
|
|
55
|
-
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';
|
|
56
83
|
import { ExecutionNoteCache } from './execution_note_cache.js';
|
|
84
|
+
import { ExecutionTaggingIndexCache } from './execution_tagging_index_cache.js';
|
|
57
85
|
import { HashedValuesCache } from './hashed_values_cache.js';
|
|
58
86
|
import { Oracle } from './oracle/oracle.js';
|
|
59
87
|
import { executePrivateFunction, verifyCurrentClassId } from './oracle/private_execution.js';
|
|
60
88
|
import { PrivateExecutionOracle } from './oracle/private_execution_oracle.js';
|
|
61
89
|
import { UtilityExecutionOracle } from './oracle/utility_execution_oracle.js';
|
|
90
|
+
import type { ProxiedNode } from './proxied_node.js';
|
|
62
91
|
|
|
63
92
|
/**
|
|
64
93
|
* The contract function simulator.
|
|
@@ -67,7 +96,17 @@ export class ContractFunctionSimulator {
|
|
|
67
96
|
private log: Logger;
|
|
68
97
|
|
|
69
98
|
constructor(
|
|
70
|
-
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,
|
|
71
110
|
private simulator: CircuitSimulator,
|
|
72
111
|
) {
|
|
73
112
|
this.log = createLogger('simulator');
|
|
@@ -80,6 +119,7 @@ export class ContractFunctionSimulator {
|
|
|
80
119
|
* @param contractAddress - The address of the contract (should match request.origin)
|
|
81
120
|
* @param msgSender - The address calling the function. This can be replaced to simulate a call from another contract
|
|
82
121
|
* or a specific account.
|
|
122
|
+
* @param anchorBlockHeader - The block header to use as base state for this run.
|
|
83
123
|
* @param senderForTags - The address that is used as a tagging sender when emitting private logs. Returned from
|
|
84
124
|
* the `privateGetSenderForTags` oracle.
|
|
85
125
|
* @param scopes - The accounts whose notes we can access in this call. Currently optional and will default to all.
|
|
@@ -90,15 +130,19 @@ export class ContractFunctionSimulator {
|
|
|
90
130
|
contractAddress: AztecAddress,
|
|
91
131
|
selector: FunctionSelector,
|
|
92
132
|
msgSender = AztecAddress.fromField(Fr.MAX_FIELD_VALUE),
|
|
133
|
+
anchorBlockHeader: BlockHeader,
|
|
93
134
|
senderForTags?: AztecAddress,
|
|
94
135
|
scopes?: AztecAddress[],
|
|
95
136
|
): Promise<PrivateExecutionResult> {
|
|
96
137
|
const simulatorSetupTimer = new Timer();
|
|
97
|
-
const header = await this.executionDataProvider.getBlockHeader();
|
|
98
138
|
|
|
99
|
-
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);
|
|
100
144
|
|
|
101
|
-
const entryPointArtifact = await this.
|
|
145
|
+
const entryPointArtifact = await this.contractStore.getFunctionArtifactWithDebugMetadata(contractAddress, selector);
|
|
102
146
|
|
|
103
147
|
if (entryPointArtifact.functionType !== FunctionType.PRIVATE) {
|
|
104
148
|
throw new Error(`Cannot run ${entryPointArtifact.functionType} function as private`);
|
|
@@ -111,7 +155,7 @@ export class ContractFunctionSimulator {
|
|
|
111
155
|
}
|
|
112
156
|
|
|
113
157
|
// reserve the first side effect for the tx hash (inserted by the private kernel)
|
|
114
|
-
const startSideEffectCounter =
|
|
158
|
+
const startSideEffectCounter = 2;
|
|
115
159
|
|
|
116
160
|
const callContext = new CallContext(
|
|
117
161
|
msgSender,
|
|
@@ -120,25 +164,40 @@ export class ContractFunctionSimulator {
|
|
|
120
164
|
entryPointArtifact.isStatic,
|
|
121
165
|
);
|
|
122
166
|
|
|
123
|
-
const
|
|
124
|
-
const noteCache = new ExecutionNoteCache(
|
|
167
|
+
const protocolNullifier = await computeProtocolNullifier(await request.toTxRequest().hash());
|
|
168
|
+
const noteCache = new ExecutionNoteCache(protocolNullifier);
|
|
169
|
+
const taggingIndexCache = new ExecutionTaggingIndexCache();
|
|
125
170
|
|
|
126
171
|
const privateExecutionOracle = new PrivateExecutionOracle(
|
|
127
172
|
request.firstCallArgsHash,
|
|
128
173
|
request.txContext,
|
|
129
174
|
callContext,
|
|
130
|
-
|
|
175
|
+
anchorBlockHeader,
|
|
176
|
+
async call => {
|
|
177
|
+
await this.runUtility(call, [], anchorBlockHeader, scopes);
|
|
178
|
+
},
|
|
131
179
|
request.authWitnesses,
|
|
132
180
|
request.capsules,
|
|
133
181
|
HashedValuesCache.create(request.argsOfCalls),
|
|
134
182
|
noteCache,
|
|
135
|
-
|
|
136
|
-
this.
|
|
183
|
+
taggingIndexCache,
|
|
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,
|
|
137
195
|
0, // totalPublicArgsCount
|
|
138
196
|
startSideEffectCounter,
|
|
139
197
|
undefined, // log
|
|
140
198
|
scopes,
|
|
141
199
|
senderForTags,
|
|
200
|
+
this.simulator,
|
|
142
201
|
);
|
|
143
202
|
|
|
144
203
|
const setupTime = simulatorSetupTimer.ms();
|
|
@@ -156,8 +215,8 @@ export class ContractFunctionSimulator {
|
|
|
156
215
|
request.functionSelector,
|
|
157
216
|
);
|
|
158
217
|
const simulatorTeardownTimer = new Timer();
|
|
159
|
-
const {
|
|
160
|
-
const firstNullifierHint =
|
|
218
|
+
const { usedProtocolNullifierForNonces } = noteCache.finish();
|
|
219
|
+
const firstNullifierHint = usedProtocolNullifierForNonces ? Fr.ZERO : noteCache.getAllNullifiers()[0];
|
|
161
220
|
|
|
162
221
|
const publicCallRequests = collectNested([executionResult], r =>
|
|
163
222
|
r.publicInputs.publicCallRequests
|
|
@@ -193,20 +252,43 @@ export class ContractFunctionSimulator {
|
|
|
193
252
|
* Runs a utility function.
|
|
194
253
|
* @param call - The function call to execute.
|
|
195
254
|
* @param authwits - Authentication witnesses required for the function call.
|
|
255
|
+
* @param anchorBlockHeader - The block header to use as base state for this run.
|
|
196
256
|
* @param scopes - Optional array of account addresses whose notes can be accessed in this call. Defaults to all
|
|
197
257
|
* accounts if not specified.
|
|
198
|
-
* @returns A
|
|
258
|
+
* @returns A return value of the utility function in a form as returned by the simulator (Noir fields)
|
|
199
259
|
*/
|
|
200
|
-
public async runUtility(
|
|
201
|
-
|
|
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);
|
|
202
267
|
|
|
203
|
-
const entryPointArtifact = await this.
|
|
268
|
+
const entryPointArtifact = await this.contractStore.getFunctionArtifactWithDebugMetadata(call.to, call.selector);
|
|
204
269
|
|
|
205
270
|
if (entryPointArtifact.functionType !== FunctionType.UTILITY) {
|
|
206
271
|
throw new Error(`Cannot run ${entryPointArtifact.functionType} function as utility`);
|
|
207
272
|
}
|
|
208
273
|
|
|
209
|
-
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
|
+
);
|
|
210
292
|
|
|
211
293
|
try {
|
|
212
294
|
this.log.verbose(`Executing utility function ${entryPointArtifact.name}`, {
|
|
@@ -230,17 +312,23 @@ export class ContractFunctionSimulator {
|
|
|
230
312
|
);
|
|
231
313
|
});
|
|
232
314
|
|
|
233
|
-
const returnWitness = witnessMapToFields(acirExecutionResult.returnWitness);
|
|
234
315
|
this.log.verbose(`Utility simulation for ${call.to}.${call.selector} completed`);
|
|
235
|
-
return
|
|
316
|
+
return witnessMapToFields(acirExecutionResult.returnWitness);
|
|
236
317
|
} catch (err) {
|
|
237
318
|
throw createSimulationError(err instanceof Error ? err : new Error('Unknown error during private execution'));
|
|
238
319
|
}
|
|
239
320
|
}
|
|
240
321
|
// docs:end:execute_utility_function
|
|
241
322
|
|
|
323
|
+
/**
|
|
324
|
+
* Returns the execution statistics collected during the simulator run.
|
|
325
|
+
* @returns The execution statistics.
|
|
326
|
+
*/
|
|
242
327
|
getStats() {
|
|
243
|
-
|
|
328
|
+
const nodeRPCCalls =
|
|
329
|
+
typeof (this.aztecNode as ProxiedNode).getStats === 'function' ? (this.aztecNode as ProxiedNode).getStats() : {};
|
|
330
|
+
|
|
331
|
+
return { nodeRPCCalls };
|
|
244
332
|
}
|
|
245
333
|
}
|
|
246
334
|
|
|
@@ -255,7 +343,7 @@ class OrderedSideEffect<T> {
|
|
|
255
343
|
}
|
|
256
344
|
|
|
257
345
|
/**
|
|
258
|
-
* Generates the final public inputs of the tail kernel circuit, an empty
|
|
346
|
+
* Generates the final public inputs of the tail kernel circuit, an empty Chonk proof
|
|
259
347
|
* and the execution steps for a `PrivateExecutionResult` as if it had been
|
|
260
348
|
* processed by the private kernel prover. This skips many of the checks performed by the kernels
|
|
261
349
|
* (allowing state overrides) and is much faster, while still generating a valid
|
|
@@ -263,13 +351,13 @@ class OrderedSideEffect<T> {
|
|
|
263
351
|
* @param privateExecutionResult - The result of the private execution.
|
|
264
352
|
* @param nonceGenerator - A nonce generator for note hashes. According to the protocol rules,
|
|
265
353
|
* it can either be the first nullifier in the tx or the hash of the initial tx request if there are none.
|
|
266
|
-
* @param
|
|
354
|
+
* @param contractStore - A provider for contract data in order to get function names and debug info.
|
|
267
355
|
* @returns The simulated proving result.
|
|
268
356
|
*/
|
|
269
357
|
export async function generateSimulatedProvingResult(
|
|
270
358
|
privateExecutionResult: PrivateExecutionResult,
|
|
271
359
|
nonceGenerator: Fr,
|
|
272
|
-
|
|
360
|
+
contractStore: ContractStore,
|
|
273
361
|
): Promise<PrivateKernelExecutionProofOutput<PrivateKernelTailCircuitPublicInputs>> {
|
|
274
362
|
const siloedNoteHashes: OrderedSideEffect<Fr>[] = [];
|
|
275
363
|
const nullifiers: OrderedSideEffect<Fr>[] = [];
|
|
@@ -346,7 +434,7 @@ export async function generateSimulatedProvingResult(
|
|
|
346
434
|
: execution.publicInputs.publicTeardownCallRequest;
|
|
347
435
|
|
|
348
436
|
executionSteps.push({
|
|
349
|
-
functionName: await
|
|
437
|
+
functionName: await contractStore.getDebugFunctionName(
|
|
350
438
|
execution.publicInputs.callContext.contractAddress,
|
|
351
439
|
execution.publicInputs.callContext.functionSelector,
|
|
352
440
|
),
|
|
@@ -358,30 +446,35 @@ export async function generateSimulatedProvingResult(
|
|
|
358
446
|
}
|
|
359
447
|
|
|
360
448
|
const constantData = new TxConstantData(
|
|
361
|
-
privateExecutionResult.entrypoint.publicInputs.
|
|
449
|
+
privateExecutionResult.entrypoint.publicInputs.anchorBlockHeader,
|
|
362
450
|
privateExecutionResult.entrypoint.publicInputs.txContext,
|
|
363
451
|
getVKTreeRoot(),
|
|
364
|
-
|
|
452
|
+
protocolContractsHash,
|
|
365
453
|
);
|
|
366
454
|
|
|
367
455
|
const hasPublicCalls = privateExecutionResult.publicFunctionCalldata.length !== 0;
|
|
368
456
|
let inputsForRollup;
|
|
369
457
|
let inputsForPublic;
|
|
458
|
+
let gasUsed;
|
|
370
459
|
|
|
371
460
|
const sortByCounter = <T>(a: OrderedSideEffect<T>, b: OrderedSideEffect<T>) => a.counter - b.counter;
|
|
372
461
|
const getEffect = <T>(orderedSideEffect: OrderedSideEffect<T>) => orderedSideEffect.sideEffect;
|
|
373
462
|
|
|
374
|
-
const
|
|
463
|
+
const isPrivateOnlyTx = privateExecutionResult.publicFunctionCalldata.length === 0;
|
|
464
|
+
const minRevertibleSideEffectCounter = getFinalMinRevertibleSideEffectCounter(privateExecutionResult);
|
|
375
465
|
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
466
|
+
const [nonRevertibleNullifiers, revertibleNullifiers] = splitOrderedSideEffects(
|
|
467
|
+
nullifiers.sort(sortByCounter),
|
|
468
|
+
minRevertibleSideEffectCounter,
|
|
469
|
+
);
|
|
470
|
+
if (nonRevertibleNullifiers.length > 0 && !nonRevertibleNullifiers[0].equals(nonceGenerator)) {
|
|
471
|
+
throw new Error('The first non revertible nullifier should be equal to the nonce generator. This is a bug!');
|
|
472
|
+
} else {
|
|
473
|
+
nonRevertibleNullifiers.unshift(nonceGenerator);
|
|
380
474
|
}
|
|
381
475
|
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
// In case the tx only contains private functions, we must make the note hashes unique by using the
|
|
476
|
+
if (isPrivateOnlyTx) {
|
|
477
|
+
// We must make the note hashes unique by using the
|
|
385
478
|
// nonce generator and their index in the tx.
|
|
386
479
|
const uniqueNoteHashes = await Promise.all(
|
|
387
480
|
siloedNoteHashes.sort(sortByCounter).map(async (orderedSideEffect, i) => {
|
|
@@ -393,7 +486,7 @@ export async function generateSimulatedProvingResult(
|
|
|
393
486
|
);
|
|
394
487
|
const accumulatedDataForRollup = new PrivateToRollupAccumulatedData(
|
|
395
488
|
padArrayEnd(uniqueNoteHashes, Fr.ZERO, MAX_NOTE_HASHES_PER_TX),
|
|
396
|
-
padArrayEnd(
|
|
489
|
+
padArrayEnd(nonRevertibleNullifiers.concat(revertibleNullifiers), Fr.ZERO, MAX_NULLIFIERS_PER_TX),
|
|
397
490
|
padArrayEnd(
|
|
398
491
|
l2ToL1Messages.sort(sortByCounter).map(getEffect),
|
|
399
492
|
ScopedL2ToL1Message.empty(),
|
|
@@ -406,39 +499,51 @@ export async function generateSimulatedProvingResult(
|
|
|
406
499
|
MAX_CONTRACT_CLASS_LOGS_PER_TX,
|
|
407
500
|
),
|
|
408
501
|
);
|
|
409
|
-
|
|
502
|
+
gasUsed = meterGasUsed(accumulatedDataForRollup);
|
|
410
503
|
inputsForRollup = new PartialPrivateTailPublicInputsForRollup(accumulatedDataForRollup);
|
|
411
504
|
} else {
|
|
412
|
-
const
|
|
505
|
+
const [nonRevertibleNoteHashes, revertibleNoteHashes] = splitOrderedSideEffects(
|
|
506
|
+
siloedNoteHashes.sort(sortByCounter),
|
|
507
|
+
minRevertibleSideEffectCounter,
|
|
508
|
+
);
|
|
509
|
+
const [nonRevertibleL2ToL1Messages, revertibleL2ToL1Messages] = splitOrderedSideEffects(
|
|
510
|
+
l2ToL1Messages.sort(sortByCounter),
|
|
511
|
+
minRevertibleSideEffectCounter,
|
|
512
|
+
);
|
|
513
|
+
const [nonRevertibleTaggedPrivateLogs, revertibleTaggedPrivateLogs] = splitOrderedSideEffects(
|
|
514
|
+
taggedPrivateLogs,
|
|
515
|
+
minRevertibleSideEffectCounter,
|
|
516
|
+
);
|
|
517
|
+
const [nonRevertibleContractClassLogHashes, revertibleContractClassLogHashes] = splitOrderedSideEffects(
|
|
518
|
+
contractClassLogsHashes.sort(sortByCounter),
|
|
519
|
+
minRevertibleSideEffectCounter,
|
|
520
|
+
);
|
|
521
|
+
const [nonRevertiblePublicCallRequests, revertiblePublicCallRequests] = splitOrderedSideEffects(
|
|
522
|
+
publicCallRequests.sort(sortByCounter),
|
|
523
|
+
minRevertibleSideEffectCounter,
|
|
524
|
+
);
|
|
413
525
|
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
526
|
+
const nonRevertibleData = new PrivateToPublicAccumulatedData(
|
|
527
|
+
padArrayEnd(nonRevertibleNoteHashes, Fr.ZERO, MAX_NOTE_HASHES_PER_TX),
|
|
528
|
+
padArrayEnd(nonRevertibleNullifiers, Fr.ZERO, MAX_NULLIFIERS_PER_TX),
|
|
529
|
+
padArrayEnd(nonRevertibleL2ToL1Messages, ScopedL2ToL1Message.empty(), MAX_L2_TO_L1_MSGS_PER_TX),
|
|
530
|
+
padArrayEnd(nonRevertibleTaggedPrivateLogs, PrivateLog.empty(), MAX_PRIVATE_LOGS_PER_TX),
|
|
531
|
+
padArrayEnd(nonRevertibleContractClassLogHashes, ScopedLogHash.empty(), MAX_CONTRACT_CLASS_LOGS_PER_TX),
|
|
532
|
+
padArrayEnd(nonRevertiblePublicCallRequests, PublicCallRequest.empty(), MAX_ENQUEUED_CALLS_PER_TX),
|
|
533
|
+
);
|
|
421
534
|
|
|
422
535
|
const revertibleData = new PrivateToPublicAccumulatedData(
|
|
423
|
-
padArrayEnd(
|
|
424
|
-
padArrayEnd(
|
|
425
|
-
padArrayEnd(
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
),
|
|
430
|
-
padArrayEnd(taggedPrivateLogs.sort(sortByCounter).map(getEffect), PrivateLog.empty(), MAX_PRIVATE_LOGS_PER_TX),
|
|
431
|
-
padArrayEnd(
|
|
432
|
-
contractClassLogsHashes.sort(sortByCounter).map(getEffect),
|
|
433
|
-
ScopedLogHash.empty(),
|
|
434
|
-
MAX_CONTRACT_CLASS_LOGS_PER_TX,
|
|
435
|
-
),
|
|
436
|
-
padArrayEnd(
|
|
437
|
-
publicCallRequests.sort(sortByCounter).map(getEffect),
|
|
438
|
-
PublicCallRequest.empty(),
|
|
439
|
-
MAX_ENQUEUED_CALLS_PER_TX,
|
|
440
|
-
),
|
|
536
|
+
padArrayEnd(revertibleNoteHashes, Fr.ZERO, MAX_NOTE_HASHES_PER_TX),
|
|
537
|
+
padArrayEnd(revertibleNullifiers, Fr.ZERO, MAX_NULLIFIERS_PER_TX),
|
|
538
|
+
padArrayEnd(revertibleL2ToL1Messages, ScopedL2ToL1Message.empty(), MAX_L2_TO_L1_MSGS_PER_TX),
|
|
539
|
+
padArrayEnd(revertibleTaggedPrivateLogs, PrivateLog.empty(), MAX_PRIVATE_LOGS_PER_TX),
|
|
540
|
+
padArrayEnd(revertibleContractClassLogHashes, ScopedLogHash.empty(), MAX_CONTRACT_CLASS_LOGS_PER_TX),
|
|
541
|
+
padArrayEnd(revertiblePublicCallRequests, PublicCallRequest.empty(), MAX_ENQUEUED_CALLS_PER_TX),
|
|
441
542
|
);
|
|
543
|
+
gasUsed = meterGasUsed(revertibleData).add(meterGasUsed(nonRevertibleData));
|
|
544
|
+
if (publicTeardownCallRequest) {
|
|
545
|
+
gasUsed.add(privateExecutionResult.entrypoint.publicInputs.txContext.gasSettings.teardownGasLimits);
|
|
546
|
+
}
|
|
442
547
|
|
|
443
548
|
inputsForPublic = new PartialPrivateTailPublicInputsForPublic(
|
|
444
549
|
nonRevertibleData,
|
|
@@ -449,7 +554,7 @@ export async function generateSimulatedProvingResult(
|
|
|
449
554
|
|
|
450
555
|
const publicInputs = new PrivateKernelTailCircuitPublicInputs(
|
|
451
556
|
constantData,
|
|
452
|
-
/*gasUsed=*/
|
|
557
|
+
/*gasUsed=*/ gasUsed.add(Gas.from({ l2Gas: FIXED_L2_GAS, daGas: FIXED_DA_GAS })),
|
|
453
558
|
/*feePayer=*/ AztecAddress.zero(),
|
|
454
559
|
/*includeByTimestamp=*/ 0n,
|
|
455
560
|
hasPublicCalls ? inputsForPublic : undefined,
|
|
@@ -458,7 +563,60 @@ export async function generateSimulatedProvingResult(
|
|
|
458
563
|
|
|
459
564
|
return {
|
|
460
565
|
publicInputs,
|
|
461
|
-
|
|
462
|
-
executionSteps
|
|
566
|
+
chonkProof: ChonkProof.empty(),
|
|
567
|
+
executionSteps,
|
|
463
568
|
};
|
|
464
569
|
}
|
|
570
|
+
|
|
571
|
+
function splitOrderedSideEffects<T>(effects: OrderedSideEffect<T>[], minRevertibleSideEffectCounter: number) {
|
|
572
|
+
const revertibleSideEffects: T[] = [];
|
|
573
|
+
const nonRevertibleSideEffects: T[] = [];
|
|
574
|
+
effects.forEach(effect => {
|
|
575
|
+
if (effect.counter < minRevertibleSideEffectCounter) {
|
|
576
|
+
nonRevertibleSideEffects.push(effect.sideEffect);
|
|
577
|
+
} else {
|
|
578
|
+
revertibleSideEffects.push(effect.sideEffect);
|
|
579
|
+
}
|
|
580
|
+
});
|
|
581
|
+
return [nonRevertibleSideEffects, revertibleSideEffects];
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
function meterGasUsed(data: PrivateToRollupAccumulatedData | PrivateToPublicAccumulatedData) {
|
|
585
|
+
let meteredDAFields = 0;
|
|
586
|
+
let meteredL2Gas = 0;
|
|
587
|
+
|
|
588
|
+
const numNoteHashes = arrayNonEmptyLength(data.noteHashes, hash => hash.isEmpty());
|
|
589
|
+
meteredDAFields += numNoteHashes;
|
|
590
|
+
meteredL2Gas += numNoteHashes * AVM_EMITNOTEHASH_BASE_L2_GAS;
|
|
591
|
+
|
|
592
|
+
const numNullifiers = arrayNonEmptyLength(data.nullifiers, nullifier => nullifier.isEmpty());
|
|
593
|
+
meteredDAFields += numNullifiers;
|
|
594
|
+
meteredL2Gas += numNullifiers * AVM_EMITNULLIFIER_BASE_L2_GAS;
|
|
595
|
+
|
|
596
|
+
const numL2toL1Messages = arrayNonEmptyLength(data.l2ToL1Msgs, msg => msg.isEmpty());
|
|
597
|
+
meteredDAFields += numL2toL1Messages;
|
|
598
|
+
meteredL2Gas += numL2toL1Messages * AVM_SENDL2TOL1MSG_BASE_L2_GAS;
|
|
599
|
+
|
|
600
|
+
const numPrivatelogs = arrayNonEmptyLength(data.privateLogs, log => log.isEmpty());
|
|
601
|
+
// Every private log emits its length as an additional field
|
|
602
|
+
meteredDAFields += data.privateLogs.reduce((acc, log) => (!log.isEmpty() ? acc + log.emittedLength + 1 : acc), 0);
|
|
603
|
+
meteredL2Gas += numPrivatelogs * L2_GAS_PER_PRIVATE_LOG;
|
|
604
|
+
|
|
605
|
+
const numContractClassLogs = arrayNonEmptyLength(data.contractClassLogsHashes, log => log.isEmpty());
|
|
606
|
+
// Every contract class log emits its length and contract address as additional fields
|
|
607
|
+
meteredDAFields += data.contractClassLogsHashes.reduce(
|
|
608
|
+
(acc, log) => (!log.isEmpty() ? acc + log.logHash.length + 2 : acc),
|
|
609
|
+
0,
|
|
610
|
+
);
|
|
611
|
+
meteredL2Gas += numContractClassLogs * L2_GAS_PER_CONTRACT_CLASS_LOG;
|
|
612
|
+
|
|
613
|
+
const meteredDAGas = meteredDAFields * DA_BYTES_PER_FIELD * DA_GAS_PER_BYTE;
|
|
614
|
+
|
|
615
|
+
if ((data as PrivateToPublicAccumulatedData).publicCallRequests) {
|
|
616
|
+
const dataForPublic = data as PrivateToPublicAccumulatedData;
|
|
617
|
+
|
|
618
|
+
const numPublicCallRequests = arrayNonEmptyLength(dataForPublic.publicCallRequests, req => req.isEmpty());
|
|
619
|
+
meteredL2Gas += numPublicCallRequests * FIXED_AVM_STARTUP_L2_GAS;
|
|
620
|
+
}
|
|
621
|
+
return Gas.from({ l2Gas: meteredL2Gas, daGas: meteredDAGas });
|
|
622
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
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
|
|
|
5
|
-
import type { NoteData } from './oracle/
|
|
5
|
+
import type { NoteData } from './oracle/interfaces.js';
|
|
6
6
|
|
|
7
7
|
interface PendingNote {
|
|
8
8
|
note: NoteData;
|
|
@@ -44,9 +44,9 @@ export class ExecutionNoteCache {
|
|
|
44
44
|
* We don't need to use the tx request hash for nonces if another non revertible nullifier is emitted.
|
|
45
45
|
* In that case we disable injecting the tx request hash as a nullifier.
|
|
46
46
|
*/
|
|
47
|
-
private
|
|
47
|
+
private usedProtocolNullifierForNonces = true;
|
|
48
48
|
|
|
49
|
-
constructor(private readonly
|
|
49
|
+
constructor(private readonly protocolNullifier: Fr) {}
|
|
50
50
|
|
|
51
51
|
/**
|
|
52
52
|
* Enters the revertible phase of the transaction.
|
|
@@ -60,12 +60,11 @@ export class ExecutionNoteCache {
|
|
|
60
60
|
}
|
|
61
61
|
this.inRevertiblePhase = true;
|
|
62
62
|
this.minRevertibleSideEffectCounter = minRevertibleSideEffectCounter;
|
|
63
|
-
|
|
64
|
-
let nonceGenerator = this.txRequestHash;
|
|
63
|
+
let nonceGenerator = this.protocolNullifier;
|
|
65
64
|
const nullifiers = this.getAllNullifiers();
|
|
66
65
|
if (nullifiers.length > 0) {
|
|
67
66
|
nonceGenerator = new Fr(nullifiers[0]);
|
|
68
|
-
this.
|
|
67
|
+
this.usedProtocolNullifierForNonces = false;
|
|
69
68
|
}
|
|
70
69
|
|
|
71
70
|
// The existing pending notes are all non-revertible.
|
|
@@ -92,14 +91,22 @@ export class ExecutionNoteCache {
|
|
|
92
91
|
updatedNotes.forEach(n => this.#addNote(n));
|
|
93
92
|
}
|
|
94
93
|
|
|
94
|
+
public isSideEffectCounterRevertible(sideEffectCounter: number): boolean {
|
|
95
|
+
if (!this.inRevertiblePhase) {
|
|
96
|
+
return false;
|
|
97
|
+
}
|
|
98
|
+
return sideEffectCounter >= this.minRevertibleSideEffectCounter;
|
|
99
|
+
}
|
|
100
|
+
|
|
95
101
|
public finish() {
|
|
96
|
-
// If we never entered the revertible phase, we need to use the
|
|
102
|
+
// If we never entered the revertible phase, we need to use the protocol nullifier to compute the nonces for the
|
|
103
|
+
// notes if no nullifiers have been emitted.
|
|
97
104
|
if (!this.inRevertiblePhase) {
|
|
98
|
-
this.
|
|
105
|
+
this.usedProtocolNullifierForNonces = this.getAllNullifiers().length === 0;
|
|
99
106
|
}
|
|
100
107
|
// If we entered the revertible phase, the nonce generator was decided based on wether or not a nullifier was emitted before entering.
|
|
101
108
|
return {
|
|
102
|
-
|
|
109
|
+
usedProtocolNullifierForNonces: this.usedProtocolNullifierForNonces,
|
|
103
110
|
};
|
|
104
111
|
}
|
|
105
112
|
|
|
@@ -126,7 +133,7 @@ export class ExecutionNoteCache {
|
|
|
126
133
|
* transaction (and thus not a new note).
|
|
127
134
|
*/
|
|
128
135
|
public async nullifyNote(contractAddress: AztecAddress, innerNullifier: Fr, noteHash: Fr) {
|
|
129
|
-
const siloedNullifier = await siloNullifier(contractAddress, innerNullifier);
|
|
136
|
+
const siloedNullifier = (await siloNullifier(contractAddress, innerNullifier)).toBigInt();
|
|
130
137
|
let nullifiedNoteHashCounter: number | undefined = undefined;
|
|
131
138
|
// Find and remove the matching new note and log(s) if the emitted noteHash is not empty.
|
|
132
139
|
if (!noteHash.isEmpty()) {
|
|
@@ -158,7 +165,7 @@ export class ExecutionNoteCache {
|
|
|
158
165
|
* @param innerNullifier
|
|
159
166
|
*/
|
|
160
167
|
public async nullifierCreated(contractAddress: AztecAddress, innerNullifier: Fr) {
|
|
161
|
-
const siloedNullifier = await siloNullifier(contractAddress, innerNullifier);
|
|
168
|
+
const siloedNullifier = (await siloNullifier(contractAddress, innerNullifier)).toBigInt();
|
|
162
169
|
this.recordNullifier(contractAddress, siloedNullifier);
|
|
163
170
|
}
|
|
164
171
|
|
|
@@ -166,11 +173,15 @@ export class ExecutionNoteCache {
|
|
|
166
173
|
* Return notes created up to current point in execution.
|
|
167
174
|
* If a nullifier for a note in this list is emitted, the note will be deleted.
|
|
168
175
|
* @param contractAddress - Contract address of the notes.
|
|
176
|
+
* @param owner - Owner of the notes. If undefined, returns all notes regardless of owner.
|
|
169
177
|
* @param storageSlot - Storage slot of the notes.
|
|
170
178
|
**/
|
|
171
|
-
public getNotes(contractAddress: AztecAddress, storageSlot: Fr) {
|
|
179
|
+
public getNotes(contractAddress: AztecAddress, owner: AztecAddress | undefined, storageSlot: Fr) {
|
|
172
180
|
const notes = this.noteMap.get(contractAddress.toBigInt()) ?? [];
|
|
173
|
-
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);
|
|
174
185
|
}
|
|
175
186
|
|
|
176
187
|
/**
|
|
@@ -208,10 +219,15 @@ export class ExecutionNoteCache {
|
|
|
208
219
|
return [...this.allNullifiers].map(n => new Fr(n));
|
|
209
220
|
}
|
|
210
221
|
|
|
211
|
-
recordNullifier(contractAddress: AztecAddress, siloedNullifier:
|
|
222
|
+
recordNullifier(contractAddress: AztecAddress, siloedNullifier: bigint) {
|
|
212
223
|
const nullifiers = this.getNullifiers(contractAddress);
|
|
213
|
-
|
|
224
|
+
|
|
225
|
+
if (nullifiers.has(siloedNullifier)) {
|
|
226
|
+
throw new Error(`Duplicate siloed nullifier ${siloedNullifier} emitted by contract ${contractAddress}`);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
nullifiers.add(siloedNullifier);
|
|
214
230
|
this.nullifierMap.set(contractAddress.toBigInt(), nullifiers);
|
|
215
|
-
this.allNullifiers.add(siloedNullifier
|
|
231
|
+
this.allNullifiers.add(siloedNullifier);
|
|
216
232
|
}
|
|
217
233
|
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { DirectionalAppTaggingSecret, type PreTag } from '@aztec/stdlib/logs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A map that stores the tagging index for a given directional app tagging secret.
|
|
5
|
+
* Note: The directional app tagging secret is unique for a (sender, recipient, contract) tuple while the direction
|
|
6
|
+
* of sender -> recipient matters.
|
|
7
|
+
*/
|
|
8
|
+
export class ExecutionTaggingIndexCache {
|
|
9
|
+
private taggingIndexMap: Map<string, number> = new Map();
|
|
10
|
+
|
|
11
|
+
public getLastUsedIndex(secret: DirectionalAppTaggingSecret): number | undefined {
|
|
12
|
+
return this.taggingIndexMap.get(secret.toString());
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
public setLastUsedIndex(secret: DirectionalAppTaggingSecret, index: number) {
|
|
16
|
+
const currentValue = this.taggingIndexMap.get(secret.toString());
|
|
17
|
+
if (currentValue !== undefined && currentValue !== index - 1) {
|
|
18
|
+
throw new Error(`Invalid tagging index update. Current value: ${currentValue}, new value: ${index}`);
|
|
19
|
+
}
|
|
20
|
+
this.taggingIndexMap.set(secret.toString(), index);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Returns the pre-tags that were used in this execution (and that need to be stored in the db).
|
|
25
|
+
*/
|
|
26
|
+
public getUsedPreTags(): PreTag[] {
|
|
27
|
+
return Array.from(this.taggingIndexMap.entries()).map(([secret, index]) => ({
|
|
28
|
+
secret: DirectionalAppTaggingSecret.fromString(secret),
|
|
29
|
+
index,
|
|
30
|
+
}));
|
|
31
|
+
}
|
|
32
|
+
}
|