@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,22 +1,23 @@
|
|
|
1
|
-
import { MAX_CONTRACT_CLASS_LOGS_PER_TX, MAX_ENQUEUED_CALLS_PER_TX, MAX_L2_TO_L1_MSGS_PER_TX, MAX_NOTE_HASHES_PER_TX, MAX_NULLIFIERS_PER_TX, MAX_PRIVATE_LOGS_PER_TX } from '@aztec/constants';
|
|
2
|
-
import { padArrayEnd } from '@aztec/foundation/collection';
|
|
3
|
-
import { poseidon2Hash } from '@aztec/foundation/crypto';
|
|
4
|
-
import { Fr } from '@aztec/foundation/
|
|
1
|
+
import { AVM_EMITNOTEHASH_BASE_L2_GAS, AVM_EMITNULLIFIER_BASE_L2_GAS, AVM_SENDL2TOL1MSG_BASE_L2_GAS, DA_BYTES_PER_FIELD, DA_GAS_PER_BYTE, FIXED_AVM_STARTUP_L2_GAS, FIXED_DA_GAS, FIXED_L2_GAS, L2_GAS_PER_CONTRACT_CLASS_LOG, L2_GAS_PER_PRIVATE_LOG, MAX_CONTRACT_CLASS_LOGS_PER_TX, MAX_ENQUEUED_CALLS_PER_TX, MAX_L2_TO_L1_MSGS_PER_TX, MAX_NOTE_HASHES_PER_TX, MAX_NULLIFIERS_PER_TX, MAX_PRIVATE_LOGS_PER_TX } from '@aztec/constants';
|
|
2
|
+
import { arrayNonEmptyLength, padArrayEnd } from '@aztec/foundation/collection';
|
|
3
|
+
import { poseidon2Hash } from '@aztec/foundation/crypto/poseidon';
|
|
4
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
5
5
|
import { createLogger } from '@aztec/foundation/log';
|
|
6
6
|
import { Timer } from '@aztec/foundation/timer';
|
|
7
7
|
import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
|
|
8
|
-
import {
|
|
8
|
+
import { protocolContractsHash } from '@aztec/protocol-contracts';
|
|
9
9
|
import { ExecutionError, createSimulationError, extractCallStack, resolveAssertionMessageFromError, toACVMWitness, witnessMapToFields } from '@aztec/simulator/client';
|
|
10
|
-
import { FunctionSelector, FunctionType
|
|
10
|
+
import { FunctionSelector, FunctionType } from '@aztec/stdlib/abi';
|
|
11
11
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
12
12
|
import { Gas } from '@aztec/stdlib/gas';
|
|
13
|
-
import { computeNoteHashNonce, computeUniqueNoteHash, siloNoteHash, siloNullifier } from '@aztec/stdlib/hash';
|
|
13
|
+
import { computeNoteHashNonce, computeProtocolNullifier, computeUniqueNoteHash, siloNoteHash, siloNullifier } from '@aztec/stdlib/hash';
|
|
14
14
|
import { PartialPrivateTailPublicInputsForPublic, PartialPrivateTailPublicInputsForRollup, PrivateKernelTailCircuitPublicInputs, PrivateToPublicAccumulatedData, PrivateToRollupAccumulatedData, PublicCallRequest, ScopedLogHash } from '@aztec/stdlib/kernel';
|
|
15
15
|
import { PrivateLog } from '@aztec/stdlib/logs';
|
|
16
16
|
import { ScopedL2ToL1Message } from '@aztec/stdlib/messaging';
|
|
17
|
-
import {
|
|
18
|
-
import { CallContext, HashedValues, PrivateExecutionResult, TxConstantData, collectNested } from '@aztec/stdlib/tx';
|
|
17
|
+
import { ChonkProof } from '@aztec/stdlib/proofs';
|
|
18
|
+
import { CallContext, HashedValues, PrivateExecutionResult, TxConstantData, collectNested, getFinalMinRevertibleSideEffectCounter } from '@aztec/stdlib/tx';
|
|
19
19
|
import { ExecutionNoteCache } from './execution_note_cache.js';
|
|
20
|
+
import { ExecutionTaggingIndexCache } from './execution_tagging_index_cache.js';
|
|
20
21
|
import { HashedValuesCache } from './hashed_values_cache.js';
|
|
21
22
|
import { Oracle } from './oracle/oracle.js';
|
|
22
23
|
import { executePrivateFunction, verifyCurrentClassId } from './oracle/private_execution.js';
|
|
@@ -25,11 +26,31 @@ import { UtilityExecutionOracle } from './oracle/utility_execution_oracle.js';
|
|
|
25
26
|
/**
|
|
26
27
|
* The contract function simulator.
|
|
27
28
|
*/ export class ContractFunctionSimulator {
|
|
28
|
-
|
|
29
|
+
contractStore;
|
|
30
|
+
noteStore;
|
|
31
|
+
keyStore;
|
|
32
|
+
addressStore;
|
|
33
|
+
aztecNode;
|
|
34
|
+
anchorBlockStore;
|
|
35
|
+
senderTaggingStore;
|
|
36
|
+
recipientTaggingStore;
|
|
37
|
+
senderAddressBookStore;
|
|
38
|
+
capsuleStore;
|
|
39
|
+
privateEventStore;
|
|
29
40
|
simulator;
|
|
30
41
|
log;
|
|
31
|
-
constructor(
|
|
32
|
-
this.
|
|
42
|
+
constructor(contractStore, noteStore, keyStore, addressStore, aztecNode, anchorBlockStore, senderTaggingStore, recipientTaggingStore, senderAddressBookStore, capsuleStore, privateEventStore, simulator){
|
|
43
|
+
this.contractStore = contractStore;
|
|
44
|
+
this.noteStore = noteStore;
|
|
45
|
+
this.keyStore = keyStore;
|
|
46
|
+
this.addressStore = addressStore;
|
|
47
|
+
this.aztecNode = aztecNode;
|
|
48
|
+
this.anchorBlockStore = anchorBlockStore;
|
|
49
|
+
this.senderTaggingStore = senderTaggingStore;
|
|
50
|
+
this.recipientTaggingStore = recipientTaggingStore;
|
|
51
|
+
this.senderAddressBookStore = senderAddressBookStore;
|
|
52
|
+
this.capsuleStore = capsuleStore;
|
|
53
|
+
this.privateEventStore = privateEventStore;
|
|
33
54
|
this.simulator = simulator;
|
|
34
55
|
this.log = createLogger('simulator');
|
|
35
56
|
}
|
|
@@ -40,15 +61,16 @@ import { UtilityExecutionOracle } from './oracle/utility_execution_oracle.js';
|
|
|
40
61
|
* @param contractAddress - The address of the contract (should match request.origin)
|
|
41
62
|
* @param msgSender - The address calling the function. This can be replaced to simulate a call from another contract
|
|
42
63
|
* or a specific account.
|
|
64
|
+
* @param anchorBlockHeader - The block header to use as base state for this run.
|
|
43
65
|
* @param senderForTags - The address that is used as a tagging sender when emitting private logs. Returned from
|
|
44
66
|
* the `privateGetSenderForTags` oracle.
|
|
45
67
|
* @param scopes - The accounts whose notes we can access in this call. Currently optional and will default to all.
|
|
46
68
|
* @returns The result of the execution.
|
|
47
|
-
*/ async run(request, contractAddress, selector, msgSender = AztecAddress.fromField(Fr.MAX_FIELD_VALUE), senderForTags, scopes) {
|
|
69
|
+
*/ async run(request, contractAddress, selector, msgSender = AztecAddress.fromField(Fr.MAX_FIELD_VALUE), anchorBlockHeader, senderForTags, scopes) {
|
|
48
70
|
const simulatorSetupTimer = new Timer();
|
|
49
|
-
|
|
50
|
-
await verifyCurrentClassId(contractAddress, this.
|
|
51
|
-
const entryPointArtifact = await this.
|
|
71
|
+
await this.contractStore.syncPrivateState(contractAddress, selector, (privateSyncCall)=>this.runUtility(privateSyncCall, [], anchorBlockHeader, scopes));
|
|
72
|
+
await verifyCurrentClassId(contractAddress, this.aztecNode, this.contractStore, anchorBlockHeader);
|
|
73
|
+
const entryPointArtifact = await this.contractStore.getFunctionArtifactWithDebugMetadata(contractAddress, selector);
|
|
52
74
|
if (entryPointArtifact.functionType !== FunctionType.PRIVATE) {
|
|
53
75
|
throw new Error(`Cannot run ${entryPointArtifact.functionType} function as private`);
|
|
54
76
|
}
|
|
@@ -56,11 +78,14 @@ import { UtilityExecutionOracle } from './oracle/utility_execution_oracle.js';
|
|
|
56
78
|
this.log.warn(`Request origin does not match contract address in simulation. Request origin: ${request.origin}, contract address: ${contractAddress}`);
|
|
57
79
|
}
|
|
58
80
|
// reserve the first side effect for the tx hash (inserted by the private kernel)
|
|
59
|
-
const startSideEffectCounter =
|
|
81
|
+
const startSideEffectCounter = 2;
|
|
60
82
|
const callContext = new CallContext(msgSender, contractAddress, await FunctionSelector.fromNameAndParameters(entryPointArtifact.name, entryPointArtifact.parameters), entryPointArtifact.isStatic);
|
|
61
|
-
const
|
|
62
|
-
const noteCache = new ExecutionNoteCache(
|
|
63
|
-
const
|
|
83
|
+
const protocolNullifier = await computeProtocolNullifier(await request.toTxRequest().hash());
|
|
84
|
+
const noteCache = new ExecutionNoteCache(protocolNullifier);
|
|
85
|
+
const taggingIndexCache = new ExecutionTaggingIndexCache();
|
|
86
|
+
const privateExecutionOracle = new PrivateExecutionOracle(request.firstCallArgsHash, request.txContext, callContext, anchorBlockHeader, async (call)=>{
|
|
87
|
+
await this.runUtility(call, [], anchorBlockHeader, scopes);
|
|
88
|
+
}, request.authWitnesses, request.capsules, HashedValuesCache.create(request.argsOfCalls), noteCache, taggingIndexCache, this.contractStore, this.noteStore, this.keyStore, this.addressStore, this.aztecNode, this.anchorBlockStore, this.senderTaggingStore, this.recipientTaggingStore, this.senderAddressBookStore, this.capsuleStore, this.privateEventStore, 0, startSideEffectCounter, undefined, scopes, senderForTags, this.simulator);
|
|
64
89
|
const setupTime = simulatorSetupTimer.ms();
|
|
65
90
|
try {
|
|
66
91
|
// Note: any nested private function calls are made recursively within this
|
|
@@ -69,8 +94,8 @@ import { UtilityExecutionOracle } from './oracle/utility_execution_oracle.js';
|
|
|
69
94
|
// within executionResult.nestedExecutionResults).
|
|
70
95
|
const executionResult = await executePrivateFunction(this.simulator, privateExecutionOracle, entryPointArtifact, contractAddress, request.functionSelector);
|
|
71
96
|
const simulatorTeardownTimer = new Timer();
|
|
72
|
-
const {
|
|
73
|
-
const firstNullifierHint =
|
|
97
|
+
const { usedProtocolNullifierForNonces } = noteCache.finish();
|
|
98
|
+
const firstNullifierHint = usedProtocolNullifierForNonces ? Fr.ZERO : noteCache.getAllNullifiers()[0];
|
|
74
99
|
const publicCallRequests = collectNested([
|
|
75
100
|
executionResult
|
|
76
101
|
], (r)=>r.publicInputs.publicCallRequests.getActiveItems().map((r)=>r.inner).concat(r.publicInputs.publicTeardownCallRequest.isEmpty() ? [] : [
|
|
@@ -98,16 +123,17 @@ import { UtilityExecutionOracle } from './oracle/utility_execution_oracle.js';
|
|
|
98
123
|
* Runs a utility function.
|
|
99
124
|
* @param call - The function call to execute.
|
|
100
125
|
* @param authwits - Authentication witnesses required for the function call.
|
|
126
|
+
* @param anchorBlockHeader - The block header to use as base state for this run.
|
|
101
127
|
* @param scopes - Optional array of account addresses whose notes can be accessed in this call. Defaults to all
|
|
102
128
|
* accounts if not specified.
|
|
103
|
-
* @returns A
|
|
104
|
-
*/ async runUtility(call, authwits, scopes) {
|
|
105
|
-
await verifyCurrentClassId(call.to, this.
|
|
106
|
-
const entryPointArtifact = await this.
|
|
129
|
+
* @returns A return value of the utility function in a form as returned by the simulator (Noir fields)
|
|
130
|
+
*/ async runUtility(call, authwits, anchorBlockHeader, scopes) {
|
|
131
|
+
await verifyCurrentClassId(call.to, this.aztecNode, this.contractStore, anchorBlockHeader);
|
|
132
|
+
const entryPointArtifact = await this.contractStore.getFunctionArtifactWithDebugMetadata(call.to, call.selector);
|
|
107
133
|
if (entryPointArtifact.functionType !== FunctionType.UTILITY) {
|
|
108
134
|
throw new Error(`Cannot run ${entryPointArtifact.functionType} function as utility`);
|
|
109
135
|
}
|
|
110
|
-
const oracle = new UtilityExecutionOracle(call.to, authwits, [], this.
|
|
136
|
+
const oracle = new UtilityExecutionOracle(call.to, authwits, [], anchorBlockHeader, this.contractStore, this.noteStore, this.keyStore, this.addressStore, this.aztecNode, this.anchorBlockStore, this.recipientTaggingStore, this.senderAddressBookStore, this.capsuleStore, this.privateEventStore, undefined, scopes);
|
|
111
137
|
try {
|
|
112
138
|
this.log.verbose(`Executing utility function ${entryPointArtifact.name}`, {
|
|
113
139
|
contract: call.to,
|
|
@@ -123,16 +149,21 @@ import { UtilityExecutionOracle } from './oracle/utility_execution_oracle.js';
|
|
|
123
149
|
cause: err
|
|
124
150
|
});
|
|
125
151
|
});
|
|
126
|
-
const returnWitness = witnessMapToFields(acirExecutionResult.returnWitness);
|
|
127
152
|
this.log.verbose(`Utility simulation for ${call.to}.${call.selector} completed`);
|
|
128
|
-
return
|
|
153
|
+
return witnessMapToFields(acirExecutionResult.returnWitness);
|
|
129
154
|
} catch (err) {
|
|
130
155
|
throw createSimulationError(err instanceof Error ? err : new Error('Unknown error during private execution'));
|
|
131
156
|
}
|
|
132
157
|
}
|
|
133
158
|
// docs:end:execute_utility_function
|
|
134
|
-
|
|
135
|
-
|
|
159
|
+
/**
|
|
160
|
+
* Returns the execution statistics collected during the simulator run.
|
|
161
|
+
* @returns The execution statistics.
|
|
162
|
+
*/ getStats() {
|
|
163
|
+
const nodeRPCCalls = typeof this.aztecNode.getStats === 'function' ? this.aztecNode.getStats() : {};
|
|
164
|
+
return {
|
|
165
|
+
nodeRPCCalls
|
|
166
|
+
};
|
|
136
167
|
}
|
|
137
168
|
}
|
|
138
169
|
class OrderedSideEffect {
|
|
@@ -144,7 +175,7 @@ class OrderedSideEffect {
|
|
|
144
175
|
}
|
|
145
176
|
}
|
|
146
177
|
/**
|
|
147
|
-
* Generates the final public inputs of the tail kernel circuit, an empty
|
|
178
|
+
* Generates the final public inputs of the tail kernel circuit, an empty Chonk proof
|
|
148
179
|
* and the execution steps for a `PrivateExecutionResult` as if it had been
|
|
149
180
|
* processed by the private kernel prover. This skips many of the checks performed by the kernels
|
|
150
181
|
* (allowing state overrides) and is much faster, while still generating a valid
|
|
@@ -152,9 +183,9 @@ class OrderedSideEffect {
|
|
|
152
183
|
* @param privateExecutionResult - The result of the private execution.
|
|
153
184
|
* @param nonceGenerator - A nonce generator for note hashes. According to the protocol rules,
|
|
154
185
|
* it can either be the first nullifier in the tx or the hash of the initial tx request if there are none.
|
|
155
|
-
* @param
|
|
186
|
+
* @param contractStore - A provider for contract data in order to get function names and debug info.
|
|
156
187
|
* @returns The simulated proving result.
|
|
157
|
-
*/ export async function generateSimulatedProvingResult(privateExecutionResult, nonceGenerator,
|
|
188
|
+
*/ export async function generateSimulatedProvingResult(privateExecutionResult, nonceGenerator, contractStore) {
|
|
158
189
|
const siloedNoteHashes = [];
|
|
159
190
|
const nullifiers = [];
|
|
160
191
|
const taggedPrivateLogs = [];
|
|
@@ -190,7 +221,7 @@ class OrderedSideEffect {
|
|
|
190
221
|
}
|
|
191
222
|
publicTeardownCallRequest = execution.publicInputs.publicTeardownCallRequest.isEmpty() ? publicTeardownCallRequest : execution.publicInputs.publicTeardownCallRequest;
|
|
192
223
|
executionSteps.push({
|
|
193
|
-
functionName: await
|
|
224
|
+
functionName: await contractStore.getDebugFunctionName(execution.publicInputs.callContext.contractAddress, execution.publicInputs.callContext.functionSelector),
|
|
194
225
|
timings: execution.profileResult?.timings ?? {
|
|
195
226
|
witgen: 0,
|
|
196
227
|
oracles: {}
|
|
@@ -200,21 +231,23 @@ class OrderedSideEffect {
|
|
|
200
231
|
witness: execution.partialWitness
|
|
201
232
|
});
|
|
202
233
|
}
|
|
203
|
-
const constantData = new TxConstantData(privateExecutionResult.entrypoint.publicInputs.
|
|
234
|
+
const constantData = new TxConstantData(privateExecutionResult.entrypoint.publicInputs.anchorBlockHeader, privateExecutionResult.entrypoint.publicInputs.txContext, getVKTreeRoot(), protocolContractsHash);
|
|
204
235
|
const hasPublicCalls = privateExecutionResult.publicFunctionCalldata.length !== 0;
|
|
205
236
|
let inputsForRollup;
|
|
206
237
|
let inputsForPublic;
|
|
238
|
+
let gasUsed;
|
|
207
239
|
const sortByCounter = (a, b)=>a.counter - b.counter;
|
|
208
240
|
const getEffect = (orderedSideEffect)=>orderedSideEffect.sideEffect;
|
|
209
|
-
const
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
if (
|
|
213
|
-
|
|
241
|
+
const isPrivateOnlyTx = privateExecutionResult.publicFunctionCalldata.length === 0;
|
|
242
|
+
const minRevertibleSideEffectCounter = getFinalMinRevertibleSideEffectCounter(privateExecutionResult);
|
|
243
|
+
const [nonRevertibleNullifiers, revertibleNullifiers] = splitOrderedSideEffects(nullifiers.sort(sortByCounter), minRevertibleSideEffectCounter);
|
|
244
|
+
if (nonRevertibleNullifiers.length > 0 && !nonRevertibleNullifiers[0].equals(nonceGenerator)) {
|
|
245
|
+
throw new Error('The first non revertible nullifier should be equal to the nonce generator. This is a bug!');
|
|
246
|
+
} else {
|
|
247
|
+
nonRevertibleNullifiers.unshift(nonceGenerator);
|
|
214
248
|
}
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
// In case the tx only contains private functions, we must make the note hashes unique by using the
|
|
249
|
+
if (isPrivateOnlyTx) {
|
|
250
|
+
// We must make the note hashes unique by using the
|
|
218
251
|
// nonce generator and their index in the tx.
|
|
219
252
|
const uniqueNoteHashes = await Promise.all(siloedNoteHashes.sort(sortByCounter).map(async (orderedSideEffect, i)=>{
|
|
220
253
|
const siloedNoteHash = orderedSideEffect.sideEffect;
|
|
@@ -222,24 +255,76 @@ class OrderedSideEffect {
|
|
|
222
255
|
const uniqueNoteHash = await computeUniqueNoteHash(nonce, siloedNoteHash);
|
|
223
256
|
return uniqueNoteHash;
|
|
224
257
|
}));
|
|
225
|
-
const accumulatedDataForRollup = new PrivateToRollupAccumulatedData(padArrayEnd(uniqueNoteHashes, Fr.ZERO, MAX_NOTE_HASHES_PER_TX), padArrayEnd(
|
|
258
|
+
const accumulatedDataForRollup = new PrivateToRollupAccumulatedData(padArrayEnd(uniqueNoteHashes, Fr.ZERO, MAX_NOTE_HASHES_PER_TX), padArrayEnd(nonRevertibleNullifiers.concat(revertibleNullifiers), Fr.ZERO, MAX_NULLIFIERS_PER_TX), padArrayEnd(l2ToL1Messages.sort(sortByCounter).map(getEffect), ScopedL2ToL1Message.empty(), MAX_L2_TO_L1_MSGS_PER_TX), padArrayEnd(taggedPrivateLogs.sort(sortByCounter).map(getEffect), PrivateLog.empty(), MAX_PRIVATE_LOGS_PER_TX), padArrayEnd(contractClassLogsHashes.sort(sortByCounter).map(getEffect), ScopedLogHash.empty(), MAX_CONTRACT_CLASS_LOGS_PER_TX));
|
|
259
|
+
gasUsed = meterGasUsed(accumulatedDataForRollup);
|
|
226
260
|
inputsForRollup = new PartialPrivateTailPublicInputsForRollup(accumulatedDataForRollup);
|
|
227
261
|
} else {
|
|
228
|
-
const
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
const
|
|
235
|
-
|
|
236
|
-
|
|
262
|
+
const [nonRevertibleNoteHashes, revertibleNoteHashes] = splitOrderedSideEffects(siloedNoteHashes.sort(sortByCounter), minRevertibleSideEffectCounter);
|
|
263
|
+
const [nonRevertibleL2ToL1Messages, revertibleL2ToL1Messages] = splitOrderedSideEffects(l2ToL1Messages.sort(sortByCounter), minRevertibleSideEffectCounter);
|
|
264
|
+
const [nonRevertibleTaggedPrivateLogs, revertibleTaggedPrivateLogs] = splitOrderedSideEffects(taggedPrivateLogs, minRevertibleSideEffectCounter);
|
|
265
|
+
const [nonRevertibleContractClassLogHashes, revertibleContractClassLogHashes] = splitOrderedSideEffects(contractClassLogsHashes.sort(sortByCounter), minRevertibleSideEffectCounter);
|
|
266
|
+
const [nonRevertiblePublicCallRequests, revertiblePublicCallRequests] = splitOrderedSideEffects(publicCallRequests.sort(sortByCounter), minRevertibleSideEffectCounter);
|
|
267
|
+
const nonRevertibleData = new PrivateToPublicAccumulatedData(padArrayEnd(nonRevertibleNoteHashes, Fr.ZERO, MAX_NOTE_HASHES_PER_TX), padArrayEnd(nonRevertibleNullifiers, Fr.ZERO, MAX_NULLIFIERS_PER_TX), padArrayEnd(nonRevertibleL2ToL1Messages, ScopedL2ToL1Message.empty(), MAX_L2_TO_L1_MSGS_PER_TX), padArrayEnd(nonRevertibleTaggedPrivateLogs, PrivateLog.empty(), MAX_PRIVATE_LOGS_PER_TX), padArrayEnd(nonRevertibleContractClassLogHashes, ScopedLogHash.empty(), MAX_CONTRACT_CLASS_LOGS_PER_TX), padArrayEnd(nonRevertiblePublicCallRequests, PublicCallRequest.empty(), MAX_ENQUEUED_CALLS_PER_TX));
|
|
268
|
+
const revertibleData = new PrivateToPublicAccumulatedData(padArrayEnd(revertibleNoteHashes, Fr.ZERO, MAX_NOTE_HASHES_PER_TX), padArrayEnd(revertibleNullifiers, Fr.ZERO, MAX_NULLIFIERS_PER_TX), padArrayEnd(revertibleL2ToL1Messages, ScopedL2ToL1Message.empty(), MAX_L2_TO_L1_MSGS_PER_TX), padArrayEnd(revertibleTaggedPrivateLogs, PrivateLog.empty(), MAX_PRIVATE_LOGS_PER_TX), padArrayEnd(revertibleContractClassLogHashes, ScopedLogHash.empty(), MAX_CONTRACT_CLASS_LOGS_PER_TX), padArrayEnd(revertiblePublicCallRequests, PublicCallRequest.empty(), MAX_ENQUEUED_CALLS_PER_TX));
|
|
269
|
+
gasUsed = meterGasUsed(revertibleData).add(meterGasUsed(nonRevertibleData));
|
|
270
|
+
if (publicTeardownCallRequest) {
|
|
271
|
+
gasUsed.add(privateExecutionResult.entrypoint.publicInputs.txContext.gasSettings.teardownGasLimits);
|
|
272
|
+
}
|
|
237
273
|
inputsForPublic = new PartialPrivateTailPublicInputsForPublic(nonRevertibleData, revertibleData, publicTeardownCallRequest ?? PublicCallRequest.empty());
|
|
238
274
|
}
|
|
239
|
-
const publicInputs = new PrivateKernelTailCircuitPublicInputs(constantData, /*gasUsed=*/
|
|
275
|
+
const publicInputs = new PrivateKernelTailCircuitPublicInputs(constantData, /*gasUsed=*/ gasUsed.add(Gas.from({
|
|
276
|
+
l2Gas: FIXED_L2_GAS,
|
|
277
|
+
daGas: FIXED_DA_GAS
|
|
278
|
+
})), /*feePayer=*/ AztecAddress.zero(), /*includeByTimestamp=*/ 0n, hasPublicCalls ? inputsForPublic : undefined, !hasPublicCalls ? inputsForRollup : undefined);
|
|
240
279
|
return {
|
|
241
280
|
publicInputs,
|
|
242
|
-
|
|
243
|
-
executionSteps
|
|
281
|
+
chonkProof: ChonkProof.empty(),
|
|
282
|
+
executionSteps
|
|
244
283
|
};
|
|
245
284
|
}
|
|
285
|
+
function splitOrderedSideEffects(effects, minRevertibleSideEffectCounter) {
|
|
286
|
+
const revertibleSideEffects = [];
|
|
287
|
+
const nonRevertibleSideEffects = [];
|
|
288
|
+
effects.forEach((effect)=>{
|
|
289
|
+
if (effect.counter < minRevertibleSideEffectCounter) {
|
|
290
|
+
nonRevertibleSideEffects.push(effect.sideEffect);
|
|
291
|
+
} else {
|
|
292
|
+
revertibleSideEffects.push(effect.sideEffect);
|
|
293
|
+
}
|
|
294
|
+
});
|
|
295
|
+
return [
|
|
296
|
+
nonRevertibleSideEffects,
|
|
297
|
+
revertibleSideEffects
|
|
298
|
+
];
|
|
299
|
+
}
|
|
300
|
+
function meterGasUsed(data) {
|
|
301
|
+
let meteredDAFields = 0;
|
|
302
|
+
let meteredL2Gas = 0;
|
|
303
|
+
const numNoteHashes = arrayNonEmptyLength(data.noteHashes, (hash)=>hash.isEmpty());
|
|
304
|
+
meteredDAFields += numNoteHashes;
|
|
305
|
+
meteredL2Gas += numNoteHashes * AVM_EMITNOTEHASH_BASE_L2_GAS;
|
|
306
|
+
const numNullifiers = arrayNonEmptyLength(data.nullifiers, (nullifier)=>nullifier.isEmpty());
|
|
307
|
+
meteredDAFields += numNullifiers;
|
|
308
|
+
meteredL2Gas += numNullifiers * AVM_EMITNULLIFIER_BASE_L2_GAS;
|
|
309
|
+
const numL2toL1Messages = arrayNonEmptyLength(data.l2ToL1Msgs, (msg)=>msg.isEmpty());
|
|
310
|
+
meteredDAFields += numL2toL1Messages;
|
|
311
|
+
meteredL2Gas += numL2toL1Messages * AVM_SENDL2TOL1MSG_BASE_L2_GAS;
|
|
312
|
+
const numPrivatelogs = arrayNonEmptyLength(data.privateLogs, (log)=>log.isEmpty());
|
|
313
|
+
// Every private log emits its length as an additional field
|
|
314
|
+
meteredDAFields += data.privateLogs.reduce((acc, log)=>!log.isEmpty() ? acc + log.emittedLength + 1 : acc, 0);
|
|
315
|
+
meteredL2Gas += numPrivatelogs * L2_GAS_PER_PRIVATE_LOG;
|
|
316
|
+
const numContractClassLogs = arrayNonEmptyLength(data.contractClassLogsHashes, (log)=>log.isEmpty());
|
|
317
|
+
// Every contract class log emits its length and contract address as additional fields
|
|
318
|
+
meteredDAFields += data.contractClassLogsHashes.reduce((acc, log)=>!log.isEmpty() ? acc + log.logHash.length + 2 : acc, 0);
|
|
319
|
+
meteredL2Gas += numContractClassLogs * L2_GAS_PER_CONTRACT_CLASS_LOG;
|
|
320
|
+
const meteredDAGas = meteredDAFields * DA_BYTES_PER_FIELD * DA_GAS_PER_BYTE;
|
|
321
|
+
if (data.publicCallRequests) {
|
|
322
|
+
const dataForPublic = data;
|
|
323
|
+
const numPublicCallRequests = arrayNonEmptyLength(dataForPublic.publicCallRequests, (req)=>req.isEmpty());
|
|
324
|
+
meteredL2Gas += numPublicCallRequests * FIXED_AVM_STARTUP_L2_GAS;
|
|
325
|
+
}
|
|
326
|
+
return Gas.from({
|
|
327
|
+
l2Gas: meteredL2Gas,
|
|
328
|
+
daGas: meteredDAGas
|
|
329
|
+
});
|
|
330
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
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
|
-
import type { NoteData } from './oracle/
|
|
3
|
+
import type { NoteData } from './oracle/interfaces.js';
|
|
4
4
|
interface PendingNote {
|
|
5
5
|
note: NoteData;
|
|
6
6
|
counter: number;
|
|
@@ -11,7 +11,7 @@ interface PendingNote {
|
|
|
11
11
|
*/
|
|
12
12
|
export declare class ExecutionNoteCache {
|
|
13
13
|
#private;
|
|
14
|
-
private readonly
|
|
14
|
+
private readonly protocolNullifier;
|
|
15
15
|
/**
|
|
16
16
|
* New notes created in this transaction.
|
|
17
17
|
* They are pushed to this array in the same order as they are emitted.
|
|
@@ -37,15 +37,16 @@ export declare class ExecutionNoteCache {
|
|
|
37
37
|
* We don't need to use the tx request hash for nonces if another non revertible nullifier is emitted.
|
|
38
38
|
* In that case we disable injecting the tx request hash as a nullifier.
|
|
39
39
|
*/
|
|
40
|
-
private
|
|
41
|
-
constructor(
|
|
40
|
+
private usedProtocolNullifierForNonces;
|
|
41
|
+
constructor(protocolNullifier: Fr);
|
|
42
42
|
/**
|
|
43
43
|
* Enters the revertible phase of the transaction.
|
|
44
44
|
* @param minRevertibleSideEffectCounter - The counter at which the transaction enters the revertible phase.
|
|
45
45
|
*/
|
|
46
46
|
setMinRevertibleSideEffectCounter(minRevertibleSideEffectCounter: number): Promise<void>;
|
|
47
|
+
isSideEffectCounterRevertible(sideEffectCounter: number): boolean;
|
|
47
48
|
finish(): {
|
|
48
|
-
|
|
49
|
+
usedProtocolNullifierForNonces: boolean;
|
|
49
50
|
};
|
|
50
51
|
/**
|
|
51
52
|
* Add a new note to cache.
|
|
@@ -70,9 +71,10 @@ export declare class ExecutionNoteCache {
|
|
|
70
71
|
* Return notes created up to current point in execution.
|
|
71
72
|
* If a nullifier for a note in this list is emitted, the note will be deleted.
|
|
72
73
|
* @param contractAddress - Contract address of the notes.
|
|
74
|
+
* @param owner - Owner of the notes. If undefined, returns all notes regardless of owner.
|
|
73
75
|
* @param storageSlot - Storage slot of the notes.
|
|
74
76
|
**/
|
|
75
|
-
getNotes(contractAddress: AztecAddress, storageSlot: Fr): NoteData[];
|
|
77
|
+
getNotes(contractAddress: AztecAddress, owner: AztecAddress | undefined, storageSlot: Fr): NoteData[];
|
|
76
78
|
/**
|
|
77
79
|
* Check if a note exists in the newNotes array.
|
|
78
80
|
* @param contractAddress - Contract address of the note.
|
|
@@ -87,7 +89,7 @@ export declare class ExecutionNoteCache {
|
|
|
87
89
|
getNullifiers(contractAddress: AztecAddress): Set<bigint>;
|
|
88
90
|
getAllNotes(): PendingNote[];
|
|
89
91
|
getAllNullifiers(): Fr[];
|
|
90
|
-
recordNullifier(contractAddress: AztecAddress, siloedNullifier:
|
|
92
|
+
recordNullifier(contractAddress: AztecAddress, siloedNullifier: bigint): void;
|
|
91
93
|
}
|
|
92
94
|
export {};
|
|
93
|
-
//# sourceMappingURL=
|
|
95
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXhlY3V0aW9uX25vdGVfY2FjaGUuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jb250cmFjdF9mdW5jdGlvbl9zaW11bGF0b3IvZXhlY3V0aW9uX25vdGVfY2FjaGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLEVBQUUsRUFBRSxNQUFNLGdDQUFnQyxDQUFDO0FBQ3BELE9BQU8sS0FBSyxFQUFFLFlBQVksRUFBRSxNQUFNLDZCQUE2QixDQUFDO0FBR2hFLE9BQU8sS0FBSyxFQUFFLFFBQVEsRUFBRSxNQUFNLHdCQUF3QixDQUFDO0FBRXZELFVBQVUsV0FBVztJQUNuQixJQUFJLEVBQUUsUUFBUSxDQUFDO0lBQ2YsT0FBTyxFQUFFLE1BQU0sQ0FBQztJQUNoQixzQkFBc0IsRUFBRSxFQUFFLENBQUM7Q0FDNUI7QUFFRDs7R0FFRztBQUNILHFCQUFhLGtCQUFrQjs7SUFpQ2pCLE9BQU8sQ0FBQyxRQUFRLENBQUMsaUJBQWlCO0lBaEM5Qzs7O09BR0c7SUFDSCxPQUFPLENBQUMsS0FBSyxDQUFxQjtJQUNsQzs7T0FFRztJQUNILE9BQU8sQ0FBQyxPQUFPLENBQXlDO0lBRXhEOzs7O09BSUc7SUFDSCxPQUFPLENBQUMsWUFBWSxDQUF1QztJQUUzRDs7T0FFRztJQUNILE9BQU8sQ0FBQyxhQUFhLENBQTBCO0lBRS9DLE9BQU8sQ0FBQyw4QkFBOEIsQ0FBSztJQUUzQyxPQUFPLENBQUMsaUJBQWlCLENBQVM7SUFFbEM7OztPQUdHO0lBQ0gsT0FBTyxDQUFDLDhCQUE4QixDQUFRO0lBRTlDLFlBQTZCLGlCQUFpQixFQUFFLEVBQUUsRUFBSTtJQUV0RDs7O09BR0c7SUFDVSxpQ0FBaUMsQ0FBQyw4QkFBOEIsRUFBRSxNQUFNLGlCQXFDcEY7SUFFTSw2QkFBNkIsQ0FBQyxpQkFBaUIsRUFBRSxNQUFNLEdBQUcsT0FBTyxDQUt2RTtJQUVNLE1BQU07O01BVVo7SUFFRDs7O09BR0c7SUFDSSxVQUFVLENBQUMsSUFBSSxFQUFFLFFBQVEsRUFBRSxPQUFPLEVBQUUsTUFBTSxRQVNoRDtJQUVEOzs7Ozs7T0FNRztJQUNVLFdBQVcsQ0FBQyxlQUFlLEVBQUUsWUFBWSxFQUFFLGNBQWMsRUFBRSxFQUFFLEVBQUUsUUFBUSxFQUFFLEVBQUUsK0JBeUJ2RjtJQUVEOzs7O09BSUc7SUFDVSxnQkFBZ0IsQ0FBQyxlQUFlLEVBQUUsWUFBWSxFQUFFLGNBQWMsRUFBRSxFQUFFLGlCQUc5RTtJQUVEOzs7Ozs7UUFNSTtJQUNHLFFBQVEsQ0FBQyxlQUFlLEVBQUUsWUFBWSxFQUFFLEtBQUssRUFBRSxZQUFZLEdBQUcsU0FBUyxFQUFFLFdBQVcsRUFBRSxFQUFFLGNBTTlGO0lBRUQ7Ozs7O1FBS0k7SUFDRyxlQUFlLENBQUMsZUFBZSxFQUFFLFlBQVksRUFBRSxRQUFRLEVBQUUsRUFBRSxXQUdqRTtJQUVEOzs7T0FHRztJQUNJLGFBQWEsQ0FBQyxlQUFlLEVBQUUsWUFBWSxHQUFHLEdBQUcsQ0FBQyxNQUFNLENBQUMsQ0FFL0Q7SUFVRCxXQUFXLElBQUksV0FBVyxFQUFFLENBRTNCO0lBRUQsZ0JBQWdCLElBQUksRUFBRSxFQUFFLENBRXZCO0lBRUQsZUFBZSxDQUFDLGVBQWUsRUFBRSxZQUFZLEVBQUUsZUFBZSxFQUFFLE1BQU0sUUFVckU7Q0FDRiJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execution_note_cache.d.ts","sourceRoot":"","sources":["../../src/contract_function_simulator/execution_note_cache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"execution_note_cache.d.ts","sourceRoot":"","sources":["../../src/contract_function_simulator/execution_note_cache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACpD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAGhE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAEvD,UAAU,WAAW;IACnB,IAAI,EAAE,QAAQ,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,sBAAsB,EAAE,EAAE,CAAC;CAC5B;AAED;;GAEG;AACH,qBAAa,kBAAkB;;IAiCjB,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IAhC9C;;;OAGG;IACH,OAAO,CAAC,KAAK,CAAqB;IAClC;;OAEG;IACH,OAAO,CAAC,OAAO,CAAyC;IAExD;;;;OAIG;IACH,OAAO,CAAC,YAAY,CAAuC;IAE3D;;OAEG;IACH,OAAO,CAAC,aAAa,CAA0B;IAE/C,OAAO,CAAC,8BAA8B,CAAK;IAE3C,OAAO,CAAC,iBAAiB,CAAS;IAElC;;;OAGG;IACH,OAAO,CAAC,8BAA8B,CAAQ;IAE9C,YAA6B,iBAAiB,EAAE,EAAE,EAAI;IAEtD;;;OAGG;IACU,iCAAiC,CAAC,8BAA8B,EAAE,MAAM,iBAqCpF;IAEM,6BAA6B,CAAC,iBAAiB,EAAE,MAAM,GAAG,OAAO,CAKvE;IAEM,MAAM;;MAUZ;IAED;;;OAGG;IACI,UAAU,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,QAShD;IAED;;;;;;OAMG;IACU,WAAW,CAAC,eAAe,EAAE,YAAY,EAAE,cAAc,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,+BAyBvF;IAED;;;;OAIG;IACU,gBAAgB,CAAC,eAAe,EAAE,YAAY,EAAE,cAAc,EAAE,EAAE,iBAG9E;IAED;;;;;;QAMI;IACG,QAAQ,CAAC,eAAe,EAAE,YAAY,EAAE,KAAK,EAAE,YAAY,GAAG,SAAS,EAAE,WAAW,EAAE,EAAE,cAM9F;IAED;;;;;QAKI;IACG,eAAe,CAAC,eAAe,EAAE,YAAY,EAAE,QAAQ,EAAE,EAAE,WAGjE;IAED;;;OAGG;IACI,aAAa,CAAC,eAAe,EAAE,YAAY,GAAG,GAAG,CAAC,MAAM,CAAC,CAE/D;IAUD,WAAW,IAAI,WAAW,EAAE,CAE3B;IAED,gBAAgB,IAAI,EAAE,EAAE,CAEvB;IAED,eAAe,CAAC,eAAe,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,QAUrE;CACF"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Fr } from '@aztec/foundation/
|
|
1
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
2
|
import { computeNoteHashNonce, computeUniqueNoteHash, siloNoteHash, siloNullifier } from '@aztec/stdlib/hash';
|
|
3
3
|
/**
|
|
4
4
|
* Data that's accessible by all the function calls in an execution.
|
|
5
5
|
*/ export class ExecutionNoteCache {
|
|
6
|
-
|
|
6
|
+
protocolNullifier;
|
|
7
7
|
/**
|
|
8
8
|
* New notes created in this transaction.
|
|
9
9
|
* They are pushed to this array in the same order as they are emitted.
|
|
@@ -24,16 +24,16 @@ import { computeNoteHashNonce, computeUniqueNoteHash, siloNoteHash, siloNullifie
|
|
|
24
24
|
/**
|
|
25
25
|
* We don't need to use the tx request hash for nonces if another non revertible nullifier is emitted.
|
|
26
26
|
* In that case we disable injecting the tx request hash as a nullifier.
|
|
27
|
-
*/
|
|
28
|
-
constructor(
|
|
29
|
-
this.
|
|
27
|
+
*/ usedProtocolNullifierForNonces;
|
|
28
|
+
constructor(protocolNullifier){
|
|
29
|
+
this.protocolNullifier = protocolNullifier;
|
|
30
30
|
this.notes = [];
|
|
31
31
|
this.noteMap = new Map();
|
|
32
32
|
this.nullifierMap = new Map();
|
|
33
33
|
this.allNullifiers = new Set();
|
|
34
34
|
this.minRevertibleSideEffectCounter = 0;
|
|
35
35
|
this.inRevertiblePhase = false;
|
|
36
|
-
this.
|
|
36
|
+
this.usedProtocolNullifierForNonces = true;
|
|
37
37
|
}
|
|
38
38
|
/**
|
|
39
39
|
* Enters the revertible phase of the transaction.
|
|
@@ -44,11 +44,11 @@ import { computeNoteHashNonce, computeUniqueNoteHash, siloNoteHash, siloNullifie
|
|
|
44
44
|
}
|
|
45
45
|
this.inRevertiblePhase = true;
|
|
46
46
|
this.minRevertibleSideEffectCounter = minRevertibleSideEffectCounter;
|
|
47
|
-
let nonceGenerator = this.
|
|
47
|
+
let nonceGenerator = this.protocolNullifier;
|
|
48
48
|
const nullifiers = this.getAllNullifiers();
|
|
49
49
|
if (nullifiers.length > 0) {
|
|
50
50
|
nonceGenerator = new Fr(nullifiers[0]);
|
|
51
|
-
this.
|
|
51
|
+
this.usedProtocolNullifierForNonces = false;
|
|
52
52
|
}
|
|
53
53
|
// The existing pending notes are all non-revertible.
|
|
54
54
|
// They cannot be squashed by nullifiers emitted after minRevertibleSideEffectCounter is set.
|
|
@@ -71,14 +71,21 @@ import { computeNoteHashNonce, computeUniqueNoteHash, siloNoteHash, siloNullifie
|
|
|
71
71
|
this.noteMap = new Map();
|
|
72
72
|
updatedNotes.forEach((n)=>this.#addNote(n));
|
|
73
73
|
}
|
|
74
|
+
isSideEffectCounterRevertible(sideEffectCounter) {
|
|
75
|
+
if (!this.inRevertiblePhase) {
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
78
|
+
return sideEffectCounter >= this.minRevertibleSideEffectCounter;
|
|
79
|
+
}
|
|
74
80
|
finish() {
|
|
75
|
-
// If we never entered the revertible phase, we need to use the
|
|
81
|
+
// If we never entered the revertible phase, we need to use the protocol nullifier to compute the nonces for the
|
|
82
|
+
// notes if no nullifiers have been emitted.
|
|
76
83
|
if (!this.inRevertiblePhase) {
|
|
77
|
-
this.
|
|
84
|
+
this.usedProtocolNullifierForNonces = this.getAllNullifiers().length === 0;
|
|
78
85
|
}
|
|
79
86
|
// If we entered the revertible phase, the nonce generator was decided based on wether or not a nullifier was emitted before entering.
|
|
80
87
|
return {
|
|
81
|
-
|
|
88
|
+
usedProtocolNullifierForNonces: this.usedProtocolNullifierForNonces
|
|
82
89
|
};
|
|
83
90
|
}
|
|
84
91
|
/**
|
|
@@ -102,7 +109,7 @@ import { computeNoteHashNonce, computeUniqueNoteHash, siloNoteHash, siloNullifie
|
|
|
102
109
|
* @param noteHash - A hash of the note. If this value equals 0, it means the note being nullified is from a previous
|
|
103
110
|
* transaction (and thus not a new note).
|
|
104
111
|
*/ async nullifyNote(contractAddress, innerNullifier, noteHash) {
|
|
105
|
-
const siloedNullifier = await siloNullifier(contractAddress, innerNullifier);
|
|
112
|
+
const siloedNullifier = (await siloNullifier(contractAddress, innerNullifier)).toBigInt();
|
|
106
113
|
let nullifiedNoteHashCounter = undefined;
|
|
107
114
|
// Find and remove the matching new note and log(s) if the emitted noteHash is not empty.
|
|
108
115
|
if (!noteHash.isEmpty()) {
|
|
@@ -130,17 +137,18 @@ import { computeNoteHashNonce, computeUniqueNoteHash, siloNoteHash, siloNullifie
|
|
|
130
137
|
* @param contractAddress - Contract address that emitted the nullifier.
|
|
131
138
|
* @param innerNullifier
|
|
132
139
|
*/ async nullifierCreated(contractAddress, innerNullifier) {
|
|
133
|
-
const siloedNullifier = await siloNullifier(contractAddress, innerNullifier);
|
|
140
|
+
const siloedNullifier = (await siloNullifier(contractAddress, innerNullifier)).toBigInt();
|
|
134
141
|
this.recordNullifier(contractAddress, siloedNullifier);
|
|
135
142
|
}
|
|
136
143
|
/**
|
|
137
144
|
* Return notes created up to current point in execution.
|
|
138
145
|
* If a nullifier for a note in this list is emitted, the note will be deleted.
|
|
139
146
|
* @param contractAddress - Contract address of the notes.
|
|
147
|
+
* @param owner - Owner of the notes. If undefined, returns all notes regardless of owner.
|
|
140
148
|
* @param storageSlot - Storage slot of the notes.
|
|
141
|
-
**/ getNotes(contractAddress, storageSlot) {
|
|
149
|
+
**/ getNotes(contractAddress, owner, storageSlot) {
|
|
142
150
|
const notes = this.noteMap.get(contractAddress.toBigInt()) ?? [];
|
|
143
|
-
return notes.filter((n)=>n.note.storageSlot.equals(storageSlot)).map((n)=>n.note);
|
|
151
|
+
return notes.filter((n)=>owner === undefined || n.note.owner.equals(owner)).filter((n)=>n.note.storageSlot.equals(storageSlot)).map((n)=>n.note);
|
|
144
152
|
}
|
|
145
153
|
/**
|
|
146
154
|
* Check if a note exists in the newNotes array.
|
|
@@ -173,8 +181,11 @@ import { computeNoteHashNonce, computeUniqueNoteHash, siloNoteHash, siloNullifie
|
|
|
173
181
|
}
|
|
174
182
|
recordNullifier(contractAddress, siloedNullifier) {
|
|
175
183
|
const nullifiers = this.getNullifiers(contractAddress);
|
|
176
|
-
nullifiers.
|
|
184
|
+
if (nullifiers.has(siloedNullifier)) {
|
|
185
|
+
throw new Error(`Duplicate siloed nullifier ${siloedNullifier} emitted by contract ${contractAddress}`);
|
|
186
|
+
}
|
|
187
|
+
nullifiers.add(siloedNullifier);
|
|
177
188
|
this.nullifierMap.set(contractAddress.toBigInt(), nullifiers);
|
|
178
|
-
this.allNullifiers.add(siloedNullifier
|
|
189
|
+
this.allNullifiers.add(siloedNullifier);
|
|
179
190
|
}
|
|
180
191
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { DirectionalAppTaggingSecret, type PreTag } from '@aztec/stdlib/logs';
|
|
2
|
+
/**
|
|
3
|
+
* A map that stores the tagging index for a given directional app tagging secret.
|
|
4
|
+
* Note: The directional app tagging secret is unique for a (sender, recipient, contract) tuple while the direction
|
|
5
|
+
* of sender -> recipient matters.
|
|
6
|
+
*/
|
|
7
|
+
export declare class ExecutionTaggingIndexCache {
|
|
8
|
+
private taggingIndexMap;
|
|
9
|
+
getLastUsedIndex(secret: DirectionalAppTaggingSecret): number | undefined;
|
|
10
|
+
setLastUsedIndex(secret: DirectionalAppTaggingSecret, index: number): void;
|
|
11
|
+
/**
|
|
12
|
+
* Returns the pre-tags that were used in this execution (and that need to be stored in the db).
|
|
13
|
+
*/
|
|
14
|
+
getUsedPreTags(): PreTag[];
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXhlY3V0aW9uX3RhZ2dpbmdfaW5kZXhfY2FjaGUuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jb250cmFjdF9mdW5jdGlvbl9zaW11bGF0b3IvZXhlY3V0aW9uX3RhZ2dpbmdfaW5kZXhfY2FjaGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLDJCQUEyQixFQUFFLEtBQUssTUFBTSxFQUFFLE1BQU0sb0JBQW9CLENBQUM7QUFFOUU7Ozs7R0FJRztBQUNILHFCQUFhLDBCQUEwQjtJQUNyQyxPQUFPLENBQUMsZUFBZSxDQUFrQztJQUVsRCxnQkFBZ0IsQ0FBQyxNQUFNLEVBQUUsMkJBQTJCLEdBQUcsTUFBTSxHQUFHLFNBQVMsQ0FFL0U7SUFFTSxnQkFBZ0IsQ0FBQyxNQUFNLEVBQUUsMkJBQTJCLEVBQUUsS0FBSyxFQUFFLE1BQU0sUUFNekU7SUFFRDs7T0FFRztJQUNJLGNBQWMsSUFBSSxNQUFNLEVBQUUsQ0FLaEM7Q0FDRiJ9
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"execution_tagging_index_cache.d.ts","sourceRoot":"","sources":["../../src/contract_function_simulator/execution_tagging_index_cache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,KAAK,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE9E;;;;GAIG;AACH,qBAAa,0BAA0B;IACrC,OAAO,CAAC,eAAe,CAAkC;IAElD,gBAAgB,CAAC,MAAM,EAAE,2BAA2B,GAAG,MAAM,GAAG,SAAS,CAE/E;IAEM,gBAAgB,CAAC,MAAM,EAAE,2BAA2B,EAAE,KAAK,EAAE,MAAM,QAMzE;IAED;;OAEG;IACI,cAAc,IAAI,MAAM,EAAE,CAKhC;CACF"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { DirectionalAppTaggingSecret } from '@aztec/stdlib/logs';
|
|
2
|
+
/**
|
|
3
|
+
* A map that stores the tagging index for a given directional app tagging secret.
|
|
4
|
+
* Note: The directional app tagging secret is unique for a (sender, recipient, contract) tuple while the direction
|
|
5
|
+
* of sender -> recipient matters.
|
|
6
|
+
*/ export class ExecutionTaggingIndexCache {
|
|
7
|
+
taggingIndexMap = new Map();
|
|
8
|
+
getLastUsedIndex(secret) {
|
|
9
|
+
return this.taggingIndexMap.get(secret.toString());
|
|
10
|
+
}
|
|
11
|
+
setLastUsedIndex(secret, index) {
|
|
12
|
+
const currentValue = this.taggingIndexMap.get(secret.toString());
|
|
13
|
+
if (currentValue !== undefined && currentValue !== index - 1) {
|
|
14
|
+
throw new Error(`Invalid tagging index update. Current value: ${currentValue}, new value: ${index}`);
|
|
15
|
+
}
|
|
16
|
+
this.taggingIndexMap.set(secret.toString(), index);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Returns the pre-tags that were used in this execution (and that need to be stored in the db).
|
|
20
|
+
*/ getUsedPreTags() {
|
|
21
|
+
return Array.from(this.taggingIndexMap.entries()).map(([secret, index])=>({
|
|
22
|
+
secret: DirectionalAppTaggingSecret.fromString(secret),
|
|
23
|
+
index
|
|
24
|
+
}));
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Fr } from '@aztec/foundation/
|
|
1
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
2
|
import { HashedValues } from '@aztec/stdlib/tx';
|
|
3
3
|
/**
|
|
4
4
|
* A cache for hashed values (arguments, returns) during transaction execution.
|
|
@@ -25,4 +25,4 @@ export declare class HashedValuesCache {
|
|
|
25
25
|
*/
|
|
26
26
|
store(values: Fr[], hash: Fr): void;
|
|
27
27
|
}
|
|
28
|
-
//# sourceMappingURL=
|
|
28
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaGFzaGVkX3ZhbHVlc19jYWNoZS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2NvbnRyYWN0X2Z1bmN0aW9uX3NpbXVsYXRvci9oYXNoZWRfdmFsdWVzX2NhY2hlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxFQUFFLEVBQUUsTUFBTSxnQ0FBZ0MsQ0FBQztBQUNwRCxPQUFPLEVBQUUsWUFBWSxFQUFFLE1BQU0sa0JBQWtCLENBQUM7QUFFaEQ7O0dBRUc7QUFDSCxxQkFBYSxpQkFBaUI7SUFDNUIsT0FBTyxDQUFDLEtBQUssQ0FBb0I7SUFFakMsWUFBWSxnQkFBZ0IsR0FBRSxZQUFZLEVBQU8sRUFLaEQ7SUFFRDs7OztPQUlHO0lBQ0gsT0FBYyxNQUFNLENBQUMsZ0JBQWdCLEdBQUUsWUFBWSxFQUFPLHFCQUV6RDtJQUVEOzs7O09BSUc7SUFDSSxXQUFXLENBQUMsSUFBSSxFQUFFLEVBQUUsR0FBRyxFQUFFLEVBQUUsR0FBRyxTQUFTLENBTTdDO0lBRUQ7Ozs7T0FJRztJQUNJLEtBQUssQ0FBQyxNQUFNLEVBQUUsRUFBRSxFQUFFLEVBQUUsSUFBSSxFQUFFLEVBQUUsUUFFbEM7Q0FDRiJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hashed_values_cache.d.ts","sourceRoot":"","sources":["../../src/contract_function_simulator/hashed_values_cache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"hashed_values_cache.d.ts","sourceRoot":"","sources":["../../src/contract_function_simulator/hashed_values_cache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhD;;GAEG;AACH,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,KAAK,CAAoB;IAEjC,YAAY,gBAAgB,GAAE,YAAY,EAAO,EAKhD;IAED;;;;OAIG;IACH,OAAc,MAAM,CAAC,gBAAgB,GAAE,YAAY,EAAO,qBAEzD;IAED;;;;OAIG;IACI,WAAW,CAAC,IAAI,EAAE,EAAE,GAAG,EAAE,EAAE,GAAG,SAAS,CAM7C;IAED;;;;OAIG;IACI,KAAK,CAAC,MAAM,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,QAElC;CACF"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export { ExecutionNoteCache } from './execution_note_cache.js';
|
|
2
|
+
export { ExecutionTaggingIndexCache } from './execution_tagging_index_cache.js';
|
|
2
3
|
export { HashedValuesCache } from './hashed_values_cache.js';
|
|
3
4
|
export { pickNotes } from './pick_notes.js';
|
|
4
|
-
export {
|
|
5
|
+
export type { NoteData, IMiscOracle, IUtilityExecutionOracle, IPrivateExecutionOracle } from './oracle/interfaces.js';
|
|
5
6
|
export { MessageLoadOracleInputs } from './oracle/message_load_oracle_inputs.js';
|
|
6
7
|
export { UtilityExecutionOracle } from './oracle/utility_execution_oracle.js';
|
|
7
8
|
export { PrivateExecutionOracle } from './oracle/private_execution_oracle.js';
|
|
@@ -9,4 +10,5 @@ export { Oracle } from './oracle/oracle.js';
|
|
|
9
10
|
export { executePrivateFunction, extractPrivateCircuitPublicInputs } from './oracle/private_execution.js';
|
|
10
11
|
export { generateSimulatedProvingResult } from './contract_function_simulator.js';
|
|
11
12
|
export { packAsRetrievedNote } from './oracle/note_packing_utils.js';
|
|
12
|
-
|
|
13
|
+
export { UtilityContext } from './noir-structs/utility_context.js';
|
|
14
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jb250cmFjdF9mdW5jdGlvbl9zaW11bGF0b3IvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLGtCQUFrQixFQUFFLE1BQU0sMkJBQTJCLENBQUM7QUFDL0QsT0FBTyxFQUFFLDBCQUEwQixFQUFFLE1BQU0sb0NBQW9DLENBQUM7QUFDaEYsT0FBTyxFQUFFLGlCQUFpQixFQUFFLE1BQU0sMEJBQTBCLENBQUM7QUFDN0QsT0FBTyxFQUFFLFNBQVMsRUFBRSxNQUFNLGlCQUFpQixDQUFDO0FBQzVDLFlBQVksRUFBRSxRQUFRLEVBQUUsV0FBVyxFQUFFLHVCQUF1QixFQUFFLHVCQUF1QixFQUFFLE1BQU0sd0JBQXdCLENBQUM7QUFDdEgsT0FBTyxFQUFFLHVCQUF1QixFQUFFLE1BQU0sd0NBQXdDLENBQUM7QUFDakYsT0FBTyxFQUFFLHNCQUFzQixFQUFFLE1BQU0sc0NBQXNDLENBQUM7QUFDOUUsT0FBTyxFQUFFLHNCQUFzQixFQUFFLE1BQU0sc0NBQXNDLENBQUM7QUFDOUUsT0FBTyxFQUFFLE1BQU0sRUFBRSxNQUFNLG9CQUFvQixDQUFDO0FBQzVDLE9BQU8sRUFBRSxzQkFBc0IsRUFBRSxpQ0FBaUMsRUFBRSxNQUFNLCtCQUErQixDQUFDO0FBQzFHLE9BQU8sRUFBRSw4QkFBOEIsRUFBRSxNQUFNLGtDQUFrQyxDQUFDO0FBQ2xGLE9BQU8sRUFBRSxtQkFBbUIsRUFBRSxNQUFNLGdDQUFnQyxDQUFDO0FBQ3JFLE9BQU8sRUFBRSxjQUFjLEVBQUUsTUFBTSxtQ0FBbUMsQ0FBQyJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/contract_function_simulator/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/contract_function_simulator/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAChF,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,YAAY,EAAE,QAAQ,EAAE,WAAW,EAAE,uBAAuB,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACtH,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AACjF,OAAO,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AAC9E,OAAO,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AAC9E,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,sBAAsB,EAAE,iCAAiC,EAAE,MAAM,+BAA+B,CAAC;AAC1G,OAAO,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAC;AAClF,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC"}
|