@aztec/pxe 0.0.1-commit.b655e406 → 0.0.1-commit.c0b82b2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dest/access_scopes.d.ts +9 -0
- package/dest/access_scopes.d.ts.map +1 -0
- package/dest/access_scopes.js +6 -0
- package/dest/bin/check_oracle_version.d.ts +1 -1
- package/dest/bin/check_oracle_version.js +105 -15
- package/dest/block_synchronizer/block_synchronizer.d.ts +45 -0
- package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -0
- package/dest/block_synchronizer/block_synchronizer.js +153 -0
- 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 +6 -12
- package/dest/config/index.d.ts.map +1 -1
- package/dest/config/index.js +24 -13
- package/dest/config/package_info.d.ts +1 -1
- package/dest/config/package_info.js +1 -1
- package/dest/contract_function_simulator/benchmarked_node.d.ts +9 -0
- package/dest/contract_function_simulator/benchmarked_node.d.ts.map +1 -0
- package/dest/contract_function_simulator/benchmarked_node.js +77 -0
- package/dest/contract_function_simulator/contract_function_simulator.d.ts +78 -26
- package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.js +226 -82
- package/dest/contract_function_simulator/execution_note_cache.d.ts +25 -14
- package/dest/contract_function_simulator/execution_note_cache.d.ts.map +1 -1
- package/dest/contract_function_simulator/execution_note_cache.js +59 -34
- package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts +6 -6
- package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts.map +1 -1
- package/dest/contract_function_simulator/execution_tagging_index_cache.js +4 -4
- 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 +2 -2
- package/dest/contract_function_simulator/index.d.ts.map +1 -1
- package/dest/contract_function_simulator/index.js +1 -1
- package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts +5 -4
- package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/event_validation_request.js +7 -4
- 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 +1 -1
- package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +7 -5
- 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 +13 -4
- package/dest/contract_function_simulator/noir-structs/utility_context.d.ts +4 -10
- package/dest/contract_function_simulator/noir-structs/utility_context.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/utility_context.js +7 -18
- package/dest/contract_function_simulator/oracle/index.d.ts +1 -1
- package/dest/contract_function_simulator/oracle/interfaces.d.ts +30 -20
- package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts +2 -2
- package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.js +1 -1
- package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts +14 -8
- package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/note_packing_utils.js +16 -11
- package/dest/contract_function_simulator/oracle/oracle.d.ts +15 -12
- package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/oracle.js +93 -53
- package/dest/contract_function_simulator/oracle/private_execution.d.ts +2 -27
- package/dest/contract_function_simulator/oracle/private_execution.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution.js +2 -38
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +56 -52
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.js +120 -66
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +114 -39
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +214 -86
- 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_logging.d.ts +22 -0
- package/dest/contract_logging.d.ts.map +1 -0
- package/dest/contract_logging.js +23 -0
- package/dest/contract_sync/contract_sync_service.d.ts +43 -0
- package/dest/contract_sync/contract_sync_service.d.ts.map +1 -0
- package/dest/contract_sync/contract_sync_service.js +97 -0
- package/dest/contract_sync/helpers.d.ts +29 -0
- package/dest/contract_sync/helpers.d.ts.map +1 -0
- package/dest/contract_sync/helpers.js +55 -0
- package/dest/debug/pxe_debug_utils.d.ts +45 -0
- package/dest/debug/pxe_debug_utils.d.ts.map +1 -0
- package/dest/debug/pxe_debug_utils.js +48 -0
- package/dest/entrypoints/client/bundle/index.d.ts +4 -2
- package/dest/entrypoints/client/bundle/index.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/index.js +3 -1
- package/dest/entrypoints/client/bundle/utils.d.ts +1 -1
- package/dest/entrypoints/client/bundle/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/utils.js +33 -10
- package/dest/entrypoints/client/lazy/index.d.ts +4 -2
- package/dest/entrypoints/client/lazy/index.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/index.js +3 -1
- package/dest/entrypoints/client/lazy/utils.d.ts +2 -2
- package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/utils.js +34 -11
- package/dest/entrypoints/pxe_creation_options.d.ts +7 -3
- package/dest/entrypoints/pxe_creation_options.d.ts.map +1 -1
- package/dest/entrypoints/server/index.d.ts +6 -2
- package/dest/entrypoints/server/index.d.ts.map +1 -1
- package/dest/entrypoints/server/index.js +5 -1
- package/dest/entrypoints/server/utils.d.ts +1 -1
- package/dest/entrypoints/server/utils.d.ts.map +1 -1
- package/dest/entrypoints/server/utils.js +40 -28
- package/dest/error_enriching.d.ts +4 -4
- package/dest/error_enriching.d.ts.map +1 -1
- package/dest/error_enriching.js +6 -6
- package/dest/events/event_service.d.ts +15 -0
- package/dest/events/event_service.d.ts.map +1 -0
- package/dest/events/event_service.js +44 -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 +38 -0
- package/dest/job_coordinator/job_coordinator.d.ts +75 -0
- package/dest/job_coordinator/job_coordinator.d.ts.map +1 -0
- package/dest/job_coordinator/job_coordinator.js +94 -0
- package/dest/logs/log_service.d.ts +29 -0
- package/dest/logs/log_service.d.ts.map +1 -0
- package/dest/logs/log_service.js +118 -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 +49 -0
- package/dest/notes/note_service.d.ts.map +1 -0
- package/dest/notes/note_service.js +148 -0
- package/dest/notes_filter.d.ts +25 -0
- package/dest/notes_filter.d.ts.map +1 -0
- package/dest/notes_filter.js +4 -0
- package/dest/oracle_version.d.ts +3 -3
- package/dest/oracle_version.d.ts.map +1 -1
- package/dest/oracle_version.js +4 -3
- package/dest/private_kernel/hints/compute_tx_expiration_timestamp.d.ts +4 -0
- package/dest/private_kernel/hints/compute_tx_expiration_timestamp.d.ts.map +1 -0
- package/dest/private_kernel/hints/{compute_tx_include_by_timestamp.js → compute_tx_expiration_timestamp.js} +12 -12
- package/dest/private_kernel/hints/index.d.ts +3 -3
- package/dest/private_kernel/hints/index.d.ts.map +1 -1
- package/dest/private_kernel/hints/index.js +2 -2
- package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts +29 -0
- package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts.map +1 -0
- package/dest/private_kernel/hints/{build_private_kernel_reset_private_inputs.js → private_kernel_reset_private_inputs_builder.js} +144 -77
- package/dest/private_kernel/hints/test_utils.d.ts +122 -0
- package/dest/private_kernel/hints/test_utils.d.ts.map +1 -0
- package/dest/private_kernel/hints/test_utils.js +203 -0
- package/dest/private_kernel/index.d.ts +1 -1
- package/dest/private_kernel/private_kernel_execution_prover.d.ts +3 -2
- package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_execution_prover.js +33 -25
- package/dest/private_kernel/private_kernel_oracle.d.ts +26 -25
- package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_oracle.js +94 -2
- package/dest/pxe.d.ts +121 -103
- package/dest/pxe.d.ts.map +1 -1
- package/dest/pxe.js +268 -279
- 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} +13 -12
- 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 +17 -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} +10 -10
- 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 +72 -0
- package/dest/storage/capsule_store/capsule_store.d.ts.map +1 -0
- package/dest/storage/capsule_store/capsule_store.js +253 -0
- 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_store/contract_store.d.ts +93 -0
- package/dest/storage/contract_store/contract_store.d.ts.map +1 -0
- package/dest/storage/contract_store/contract_store.js +309 -0
- package/dest/storage/contract_store/index.d.ts +2 -0
- package/dest/storage/contract_store/index.d.ts.map +1 -0
- package/dest/storage/contract_store/index.js +1 -0
- package/dest/storage/{contract_data_provider → contract_store}/private_functions_tree.d.ts +1 -1
- package/dest/storage/contract_store/private_functions_tree.d.ts.map +1 -0
- package/dest/storage/{contract_data_provider → contract_store}/private_functions_tree.js +1 -1
- package/dest/storage/index.d.ts +8 -8
- package/dest/storage/index.d.ts.map +1 -1
- package/dest/storage/index.js +7 -7
- package/dest/storage/metadata.d.ts +2 -2
- package/dest/storage/metadata.js +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 +83 -0
- package/dest/storage/note_store/note_store.d.ts.map +1 -0
- package/dest/storage/note_store/note_store.js +343 -0
- package/dest/storage/note_store/stored_note.d.ts +16 -0
- package/dest/storage/note_store/stored_note.d.ts.map +1 -0
- package/dest/storage/note_store/stored_note.js +43 -0
- package/dest/storage/private_event_store/private_event_store.d.ts +91 -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 +273 -0
- package/dest/storage/private_event_store/stored_private_event.d.ts +23 -0
- package/dest/storage/private_event_store/stored_private_event.d.ts.map +1 -0
- package/dest/storage/private_event_store/stored_private_event.js +56 -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 +28 -0
- package/dest/storage/tagging_store/recipient_tagging_store.d.ts.map +1 -0
- package/dest/storage/tagging_store/recipient_tagging_store.js +111 -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 +36 -0
- package/dest/storage/tagging_store/sender_tagging_store.d.ts +77 -0
- package/dest/storage/tagging_store/sender_tagging_store.d.ts.map +1 -0
- package/dest/storage/tagging_store/sender_tagging_store.js +348 -0
- package/dest/tagging/constants.d.ts +2 -2
- package/dest/tagging/constants.d.ts.map +1 -1
- package/dest/tagging/constants.js +10 -2
- package/dest/tagging/get_all_logs_by_tags.d.ts +24 -0
- package/dest/tagging/get_all_logs_by_tags.d.ts.map +1 -0
- package/dest/tagging/get_all_logs_by_tags.js +60 -0
- package/dest/tagging/index.d.ts +16 -6
- package/dest/tagging/index.d.ts.map +1 -1
- package/dest/tagging/index.js +15 -5
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts +14 -0
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts.map +1 -0
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.js +99 -0
- package/dest/tagging/recipient_sync/utils/find_highest_indexes.d.ts +12 -0
- package/dest/tagging/recipient_sync/utils/find_highest_indexes.d.ts.map +1 -0
- package/dest/tagging/recipient_sync/utils/find_highest_indexes.js +20 -0
- package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts +14 -0
- package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts.map +1 -0
- package/dest/tagging/recipient_sync/utils/load_logs_for_range.js +33 -0
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts +17 -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 +71 -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 +29 -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 +59 -0
- package/package.json +29 -19
- package/src/access_scopes.ts +9 -0
- package/src/bin/check_oracle_version.ts +131 -20
- package/src/block_synchronizer/block_synchronizer.ts +178 -0
- package/src/block_synchronizer/index.ts +1 -0
- package/src/config/index.ts +24 -25
- package/src/config/package_info.ts +1 -1
- package/src/contract_function_simulator/benchmarked_node.ts +103 -0
- package/src/contract_function_simulator/contract_function_simulator.ts +396 -116
- package/src/contract_function_simulator/execution_note_cache.ts +58 -28
- package/src/contract_function_simulator/execution_tagging_index_cache.ts +6 -6
- package/src/contract_function_simulator/hashed_values_cache.ts +1 -1
- package/src/contract_function_simulator/index.ts +1 -1
- package/src/contract_function_simulator/noir-structs/event_validation_request.ts +7 -3
- package/src/contract_function_simulator/noir-structs/log_retrieval_request.ts +6 -5
- package/src/contract_function_simulator/noir-structs/log_retrieval_response.ts +2 -2
- package/src/contract_function_simulator/noir-structs/note_validation_request.ts +15 -3
- package/src/contract_function_simulator/noir-structs/utility_context.ts +6 -25
- package/src/contract_function_simulator/oracle/interfaces.ts +43 -18
- package/src/contract_function_simulator/oracle/message_load_oracle_inputs.ts +1 -1
- package/src/contract_function_simulator/oracle/note_packing_utils.ts +30 -14
- package/src/contract_function_simulator/oracle/oracle.ts +111 -49
- package/src/contract_function_simulator/oracle/private_execution.ts +2 -68
- package/src/contract_function_simulator/oracle/private_execution_oracle.ts +166 -98
- package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +350 -91
- package/src/contract_function_simulator/pick_notes.ts +1 -1
- package/src/contract_function_simulator/proxied_contract_data_source.ts +24 -7
- package/src/contract_logging.ts +39 -0
- package/src/contract_sync/contract_sync_service.ts +152 -0
- package/src/contract_sync/helpers.ts +98 -0
- package/src/debug/pxe_debug_utils.ts +93 -0
- package/src/entrypoints/client/bundle/index.ts +3 -1
- package/src/entrypoints/client/bundle/utils.ts +25 -18
- package/src/entrypoints/client/lazy/index.ts +3 -1
- package/src/entrypoints/client/lazy/utils.ts +26 -19
- package/src/entrypoints/pxe_creation_options.ts +6 -2
- package/src/entrypoints/server/index.ts +5 -1
- package/src/entrypoints/server/utils.ts +34 -56
- package/src/error_enriching.ts +7 -15
- package/src/events/event_service.ts +71 -0
- package/src/events/index.ts +1 -0
- package/src/events/private_event_filter_validator.ts +46 -0
- package/src/job_coordinator/job_coordinator.ts +150 -0
- package/src/logs/log_service.ts +213 -0
- package/src/notes/index.ts +1 -0
- package/src/notes/note_service.ts +196 -0
- package/src/notes_filter.ts +26 -0
- package/src/oracle_version.ts +4 -3
- package/src/private_kernel/hints/{compute_tx_include_by_timestamp.ts → compute_tx_expiration_timestamp.ts} +13 -13
- package/src/private_kernel/hints/index.ts +2 -2
- package/src/private_kernel/hints/{build_private_kernel_reset_private_inputs.ts → private_kernel_reset_private_inputs_builder.ts} +199 -145
- package/src/private_kernel/hints/test_utils.ts +325 -0
- package/src/private_kernel/private_kernel_execution_prover.ts +38 -34
- package/src/private_kernel/private_kernel_oracle.ts +118 -37
- package/src/pxe.ts +410 -382
- package/src/storage/{address_data_provider/address_data_provider.ts → address_store/address_store.ts} +16 -16
- 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} +10 -11
- package/src/storage/anchor_block_store/index.ts +1 -0
- package/src/storage/capsule_store/capsule_store.ts +315 -0
- package/src/storage/capsule_store/index.ts +1 -0
- package/src/storage/contract_store/contract_store.ts +429 -0
- package/src/storage/contract_store/index.ts +1 -0
- package/src/storage/{contract_data_provider → contract_store}/private_functions_tree.ts +1 -1
- package/src/storage/index.ts +7 -7
- package/src/storage/metadata.ts +1 -1
- package/src/storage/note_store/index.ts +2 -0
- package/src/storage/note_store/note_store.ts +418 -0
- package/src/storage/note_store/stored_note.ts +48 -0
- package/src/storage/private_event_store/private_event_store.ts +384 -0
- package/src/storage/private_event_store/stored_private_event.ts +73 -0
- package/src/storage/tagging_store/index.ts +3 -0
- package/src/storage/tagging_store/recipient_tagging_store.ts +143 -0
- package/src/storage/tagging_store/sender_address_book_store.ts +48 -0
- package/src/storage/tagging_store/sender_tagging_store.ts +429 -0
- package/src/tagging/constants.ts +10 -2
- package/src/tagging/get_all_logs_by_tags.ts +92 -0
- package/src/tagging/index.ts +18 -5
- package/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts +140 -0
- package/src/tagging/recipient_sync/utils/find_highest_indexes.ts +34 -0
- package/src/tagging/recipient_sync/utils/load_logs_for_range.ts +44 -0
- package/src/tagging/sender_sync/sync_sender_tagging_indexes.ts +94 -0
- package/src/tagging/sender_sync/utils/get_status_change_of_pending.ts +36 -0
- package/src/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.ts +75 -0
- package/dest/contract_function_simulator/execution_data_provider.d.ts +0 -274
- 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/proxied_node.d.ts +0 -9
- package/dest/contract_function_simulator/proxied_node.d.ts.map +0 -1
- package/dest/contract_function_simulator/proxied_node.js +0 -27
- package/dest/contract_function_simulator/pxe_oracle_interface.d.ts +0 -122
- package/dest/contract_function_simulator/pxe_oracle_interface.d.ts.map +0 -1
- package/dest/contract_function_simulator/pxe_oracle_interface.js +0 -701
- package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts +0 -28
- package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts.map +0 -1
- package/dest/private_kernel/hints/compute_tx_include_by_timestamp.d.ts +0 -4
- package/dest/private_kernel/hints/compute_tx_include_by_timestamp.d.ts.map +0 -1
- package/dest/private_kernel/private_kernel_oracle_impl.d.ts +0 -45
- package/dest/private_kernel/private_kernel_oracle_impl.d.ts.map +0 -1
- package/dest/private_kernel/private_kernel_oracle_impl.js +0 -86
- package/dest/storage/address_data_provider/address_data_provider.d.ts +0 -11
- package/dest/storage/address_data_provider/address_data_provider.d.ts.map +0 -1
- package/dest/storage/address_data_provider/index.d.ts +0 -2
- package/dest/storage/address_data_provider/index.d.ts.map +0 -1
- package/dest/storage/address_data_provider/index.js +0 -1
- package/dest/storage/capsule_data_provider/capsule_data_provider.d.ts +0 -25
- package/dest/storage/capsule_data_provider/capsule_data_provider.d.ts.map +0 -1
- package/dest/storage/capsule_data_provider/capsule_data_provider.js +0 -118
- 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 +0 -74
- package/dest/storage/contract_data_provider/contract_data_provider.d.ts.map +0 -1
- package/dest/storage/contract_data_provider/contract_data_provider.js +0 -205
- package/dest/storage/contract_data_provider/index.d.ts +0 -2
- package/dest/storage/contract_data_provider/index.d.ts.map +0 -1
- package/dest/storage/contract_data_provider/index.js +0 -1
- package/dest/storage/contract_data_provider/private_functions_tree.d.ts.map +0 -1
- package/dest/storage/note_data_provider/index.d.ts +0 -3
- package/dest/storage/note_data_provider/index.d.ts.map +0 -1
- package/dest/storage/note_data_provider/index.js +0 -2
- package/dest/storage/note_data_provider/note_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 -83
- package/dest/storage/note_data_provider/note_data_provider.d.ts.map +0 -1
- package/dest/storage/note_data_provider/note_data_provider.js +0 -308
- package/dest/storage/private_event_data_provider/private_event_data_provider.d.ts +0 -43
- 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 -104
- 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 -10
- package/dest/storage/sync_data_provider/sync_data_provider.d.ts.map +0 -1
- package/dest/storage/tagging_data_provider/index.d.ts +0 -2
- package/dest/storage/tagging_data_provider/index.d.ts.map +0 -1
- package/dest/storage/tagging_data_provider/index.js +0 -1
- package/dest/storage/tagging_data_provider/tagging_data_provider.d.ts +0 -40
- package/dest/storage/tagging_data_provider/tagging_data_provider.d.ts.map +0 -1
- package/dest/storage/tagging_data_provider/tagging_data_provider.js +0 -89
- package/dest/synchronizer/index.d.ts +0 -2
- package/dest/synchronizer/index.d.ts.map +0 -1
- package/dest/synchronizer/index.js +0 -1
- package/dest/synchronizer/synchronizer.d.ts +0 -35
- package/dest/synchronizer/synchronizer.d.ts.map +0 -1
- package/dest/synchronizer/synchronizer.js +0 -101
- package/dest/tagging/siloed_tag.d.ts +0 -14
- package/dest/tagging/siloed_tag.d.ts.map +0 -1
- package/dest/tagging/siloed_tag.js +0 -20
- package/dest/tagging/tag.d.ts +0 -12
- package/dest/tagging/tag.d.ts.map +0 -1
- package/dest/tagging/tag.js +0 -17
- package/dest/tagging/utils.d.ts +0 -18
- package/dest/tagging/utils.d.ts.map +0 -1
- package/dest/tagging/utils.js +0 -24
- package/src/contract_function_simulator/execution_data_provider.ts +0 -343
- package/src/contract_function_simulator/proxied_node.ts +0 -33
- package/src/contract_function_simulator/pxe_oracle_interface.ts +0 -1019
- package/src/private_kernel/private_kernel_oracle_impl.ts +0 -132
- package/src/storage/address_data_provider/index.ts +0 -1
- package/src/storage/capsule_data_provider/capsule_data_provider.ts +0 -147
- package/src/storage/capsule_data_provider/index.ts +0 -1
- package/src/storage/contract_data_provider/contract_data_provider.ts +0 -294
- package/src/storage/contract_data_provider/index.ts +0 -1
- package/src/storage/note_data_provider/index.ts +0 -2
- package/src/storage/note_data_provider/note_dao.ts +0 -154
- package/src/storage/note_data_provider/note_data_provider.ts +0 -393
- package/src/storage/private_event_data_provider/private_event_data_provider.ts +0 -148
- package/src/storage/sync_data_provider/index.ts +0 -1
- package/src/storage/tagging_data_provider/index.ts +0 -1
- package/src/storage/tagging_data_provider/tagging_data_provider.ts +0 -120
- package/src/synchronizer/index.ts +0 -1
- package/src/synchronizer/synchronizer.ts +0 -120
- package/src/tagging/siloed_tag.ts +0 -22
- package/src/tagging/tag.ts +0 -16
- package/src/tagging/utils.ts +0 -31
|
@@ -1,55 +1,64 @@
|
|
|
1
|
-
import { AVM_EMITNOTEHASH_BASE_L2_GAS, AVM_EMITNULLIFIER_BASE_L2_GAS, AVM_SENDL2TOL1MSG_BASE_L2_GAS,
|
|
1
|
+
import { AVM_EMITNOTEHASH_BASE_L2_GAS, AVM_EMITNULLIFIER_BASE_L2_GAS, AVM_SENDL2TOL1MSG_BASE_L2_GAS, DA_GAS_PER_FIELD, FIXED_AVM_STARTUP_L2_GAS, L2_GAS_PER_CONTRACT_CLASS_LOG, L2_GAS_PER_L2_TO_L1_MSG, L2_GAS_PER_NOTE_HASH, L2_GAS_PER_NULLIFIER, 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_NOTE_HASH_READ_REQUESTS_PER_TX, MAX_NULLIFIERS_PER_TX, MAX_NULLIFIER_READ_REQUESTS_PER_TX, MAX_PRIVATE_LOGS_PER_TX, PRIVATE_TX_L2_GAS_OVERHEAD, PUBLIC_TX_L2_GAS_OVERHEAD, TX_DA_GAS_OVERHEAD } from '@aztec/constants';
|
|
2
2
|
import { arrayNonEmptyLength, padArrayEnd } from '@aztec/foundation/collection';
|
|
3
|
-
import {
|
|
4
|
-
import { Fr } from '@aztec/foundation/fields';
|
|
3
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
5
4
|
import { createLogger } from '@aztec/foundation/log';
|
|
6
5
|
import { Timer } from '@aztec/foundation/timer';
|
|
7
6
|
import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
|
|
8
7
|
import { protocolContractsHash } from '@aztec/protocol-contracts';
|
|
9
8
|
import { ExecutionError, createSimulationError, extractCallStack, resolveAssertionMessageFromError, toACVMWitness, witnessMapToFields } from '@aztec/simulator/client';
|
|
10
|
-
import { FunctionSelector, FunctionType
|
|
9
|
+
import { FunctionSelector, FunctionType } from '@aztec/stdlib/abi';
|
|
11
10
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
12
11
|
import { Gas } from '@aztec/stdlib/gas';
|
|
13
|
-
import { computeNoteHashNonce, computeUniqueNoteHash, siloNoteHash, siloNullifier } from '@aztec/stdlib/hash';
|
|
14
|
-
import { PartialPrivateTailPublicInputsForPublic, PartialPrivateTailPublicInputsForRollup, PrivateKernelTailCircuitPublicInputs, PrivateToPublicAccumulatedData, PrivateToRollupAccumulatedData, PublicCallRequest, ScopedLogHash } from '@aztec/stdlib/kernel';
|
|
12
|
+
import { computeNoteHashNonce, computeProtocolNullifier, computeSiloedPrivateLogFirstField, computeUniqueNoteHash, siloNoteHash, siloNullifier } from '@aztec/stdlib/hash';
|
|
13
|
+
import { ClaimedLengthArray, PartialPrivateTailPublicInputsForPublic, PartialPrivateTailPublicInputsForRollup, PrivateKernelTailCircuitPublicInputs, PrivateToPublicAccumulatedData, PrivateToRollupAccumulatedData, PublicCallRequest, ReadRequestActionEnum, ScopedLogHash, ScopedNoteHash, ScopedNullifier, ScopedReadRequest, buildTransientDataHints, getNoteHashReadRequestResetActions, getNullifierReadRequestResetActions } from '@aztec/stdlib/kernel';
|
|
15
14
|
import { PrivateLog } from '@aztec/stdlib/logs';
|
|
16
15
|
import { ScopedL2ToL1Message } from '@aztec/stdlib/messaging';
|
|
17
16
|
import { ChonkProof } from '@aztec/stdlib/proofs';
|
|
18
|
-
import { CallContext, HashedValues, PrivateExecutionResult, TxConstantData, collectNested, getFinalMinRevertibleSideEffectCounter } from '@aztec/stdlib/tx';
|
|
17
|
+
import { CallContext, HashedValues, PrivateExecutionResult, TxConstantData, collectNested, collectNoteHashNullifierCounterMap, getFinalMinRevertibleSideEffectCounter } from '@aztec/stdlib/tx';
|
|
19
18
|
import { ExecutionNoteCache } from './execution_note_cache.js';
|
|
20
19
|
import { ExecutionTaggingIndexCache } from './execution_tagging_index_cache.js';
|
|
21
20
|
import { HashedValuesCache } from './hashed_values_cache.js';
|
|
22
21
|
import { Oracle } from './oracle/oracle.js';
|
|
23
|
-
import { executePrivateFunction
|
|
22
|
+
import { executePrivateFunction } from './oracle/private_execution.js';
|
|
24
23
|
import { PrivateExecutionOracle } from './oracle/private_execution_oracle.js';
|
|
25
24
|
import { UtilityExecutionOracle } from './oracle/utility_execution_oracle.js';
|
|
26
25
|
/**
|
|
27
26
|
* The contract function simulator.
|
|
28
27
|
*/ export class ContractFunctionSimulator {
|
|
29
|
-
executionDataProvider;
|
|
30
|
-
simulator;
|
|
31
28
|
log;
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
29
|
+
contractStore;
|
|
30
|
+
noteStore;
|
|
31
|
+
keyStore;
|
|
32
|
+
addressStore;
|
|
33
|
+
aztecNode;
|
|
34
|
+
senderTaggingStore;
|
|
35
|
+
recipientTaggingStore;
|
|
36
|
+
senderAddressBookStore;
|
|
37
|
+
capsuleStore;
|
|
38
|
+
privateEventStore;
|
|
39
|
+
simulator;
|
|
40
|
+
contractSyncService;
|
|
41
|
+
constructor(args){
|
|
42
|
+
this.contractStore = args.contractStore;
|
|
43
|
+
this.noteStore = args.noteStore;
|
|
44
|
+
this.keyStore = args.keyStore;
|
|
45
|
+
this.addressStore = args.addressStore;
|
|
46
|
+
this.aztecNode = args.aztecNode;
|
|
47
|
+
this.senderTaggingStore = args.senderTaggingStore;
|
|
48
|
+
this.recipientTaggingStore = args.recipientTaggingStore;
|
|
49
|
+
this.senderAddressBookStore = args.senderAddressBookStore;
|
|
50
|
+
this.capsuleStore = args.capsuleStore;
|
|
51
|
+
this.privateEventStore = args.privateEventStore;
|
|
52
|
+
this.simulator = args.simulator;
|
|
53
|
+
this.contractSyncService = args.contractSyncService;
|
|
35
54
|
this.log = createLogger('simulator');
|
|
36
55
|
}
|
|
37
56
|
/**
|
|
38
57
|
* Runs a private function.
|
|
39
58
|
* @param request - The transaction request.
|
|
40
|
-
|
|
41
|
-
* @param contractAddress - The address of the contract (should match request.origin)
|
|
42
|
-
* @param msgSender - The address calling the function. This can be replaced to simulate a call from another contract
|
|
43
|
-
* or a specific account.
|
|
44
|
-
* @param senderForTags - The address that is used as a tagging sender when emitting private logs. Returned from
|
|
45
|
-
* the `privateGetSenderForTags` oracle.
|
|
46
|
-
* @param scopes - The accounts whose notes we can access in this call. Currently optional and will default to all.
|
|
47
|
-
* @returns The result of the execution.
|
|
48
|
-
*/ async run(request, contractAddress, selector, msgSender = AztecAddress.fromField(Fr.MAX_FIELD_VALUE), senderForTags, scopes) {
|
|
59
|
+
*/ async run(request, { contractAddress, selector, msgSender = AztecAddress.fromField(Fr.MAX_FIELD_VALUE), anchorBlockHeader, senderForTags, scopes, jobId }) {
|
|
49
60
|
const simulatorSetupTimer = new Timer();
|
|
50
|
-
const
|
|
51
|
-
await verifyCurrentClassId(contractAddress, this.executionDataProvider);
|
|
52
|
-
const entryPointArtifact = await this.executionDataProvider.getFunctionArtifact(contractAddress, selector);
|
|
61
|
+
const entryPointArtifact = await this.contractStore.getFunctionArtifactWithDebugMetadata(contractAddress, selector);
|
|
53
62
|
if (entryPointArtifact.functionType !== FunctionType.PRIVATE) {
|
|
54
63
|
throw new Error(`Cannot run ${entryPointArtifact.functionType} function as private`);
|
|
55
64
|
}
|
|
@@ -57,12 +66,42 @@ import { UtilityExecutionOracle } from './oracle/utility_execution_oracle.js';
|
|
|
57
66
|
this.log.warn(`Request origin does not match contract address in simulation. Request origin: ${request.origin}, contract address: ${contractAddress}`);
|
|
58
67
|
}
|
|
59
68
|
// reserve the first side effect for the tx hash (inserted by the private kernel)
|
|
60
|
-
const startSideEffectCounter =
|
|
69
|
+
const startSideEffectCounter = 2;
|
|
61
70
|
const callContext = new CallContext(msgSender, contractAddress, await FunctionSelector.fromNameAndParameters(entryPointArtifact.name, entryPointArtifact.parameters), entryPointArtifact.isStatic);
|
|
62
|
-
const
|
|
63
|
-
const noteCache = new ExecutionNoteCache(
|
|
71
|
+
const protocolNullifier = await computeProtocolNullifier(await request.toTxRequest().hash());
|
|
72
|
+
const noteCache = new ExecutionNoteCache(protocolNullifier);
|
|
64
73
|
const taggingIndexCache = new ExecutionTaggingIndexCache();
|
|
65
|
-
const privateExecutionOracle = new PrivateExecutionOracle(
|
|
74
|
+
const privateExecutionOracle = new PrivateExecutionOracle({
|
|
75
|
+
argsHash: request.firstCallArgsHash,
|
|
76
|
+
txContext: request.txContext,
|
|
77
|
+
callContext,
|
|
78
|
+
anchorBlockHeader,
|
|
79
|
+
utilityExecutor: async (call, execScopes)=>{
|
|
80
|
+
await this.runUtility(call, [], anchorBlockHeader, execScopes, jobId);
|
|
81
|
+
},
|
|
82
|
+
authWitnesses: request.authWitnesses,
|
|
83
|
+
capsules: request.capsules,
|
|
84
|
+
executionCache: HashedValuesCache.create(request.argsOfCalls),
|
|
85
|
+
noteCache,
|
|
86
|
+
taggingIndexCache,
|
|
87
|
+
contractStore: this.contractStore,
|
|
88
|
+
noteStore: this.noteStore,
|
|
89
|
+
keyStore: this.keyStore,
|
|
90
|
+
addressStore: this.addressStore,
|
|
91
|
+
aztecNode: this.aztecNode,
|
|
92
|
+
senderTaggingStore: this.senderTaggingStore,
|
|
93
|
+
recipientTaggingStore: this.recipientTaggingStore,
|
|
94
|
+
senderAddressBookStore: this.senderAddressBookStore,
|
|
95
|
+
capsuleStore: this.capsuleStore,
|
|
96
|
+
privateEventStore: this.privateEventStore,
|
|
97
|
+
contractSyncService: this.contractSyncService,
|
|
98
|
+
jobId,
|
|
99
|
+
totalPublicCalldataCount: 0,
|
|
100
|
+
sideEffectCounter: startSideEffectCounter,
|
|
101
|
+
scopes,
|
|
102
|
+
senderForTags,
|
|
103
|
+
simulator: this.simulator
|
|
104
|
+
});
|
|
66
105
|
const setupTime = simulatorSetupTimer.ms();
|
|
67
106
|
try {
|
|
68
107
|
// Note: any nested private function calls are made recursively within this
|
|
@@ -71,8 +110,8 @@ import { UtilityExecutionOracle } from './oracle/utility_execution_oracle.js';
|
|
|
71
110
|
// within executionResult.nestedExecutionResults).
|
|
72
111
|
const executionResult = await executePrivateFunction(this.simulator, privateExecutionOracle, entryPointArtifact, contractAddress, request.functionSelector);
|
|
73
112
|
const simulatorTeardownTimer = new Timer();
|
|
74
|
-
|
|
75
|
-
const firstNullifierHint =
|
|
113
|
+
noteCache.finish();
|
|
114
|
+
const firstNullifierHint = noteCache.getNonceGenerator();
|
|
76
115
|
const publicCallRequests = collectNested([
|
|
77
116
|
executionResult
|
|
78
117
|
], (r)=>r.publicInputs.publicCallRequests.getActiveItems().map((r)=>r.inner).concat(r.publicInputs.publicTeardownCallRequest.isEmpty() ? [] : [
|
|
@@ -100,16 +139,32 @@ import { UtilityExecutionOracle } from './oracle/utility_execution_oracle.js';
|
|
|
100
139
|
* Runs a utility function.
|
|
101
140
|
* @param call - The function call to execute.
|
|
102
141
|
* @param authwits - Authentication witnesses required for the function call.
|
|
142
|
+
* @param anchorBlockHeader - The block header to use as base state for this run.
|
|
103
143
|
* @param scopes - Optional array of account addresses whose notes can be accessed in this call. Defaults to all
|
|
104
144
|
* accounts if not specified.
|
|
105
|
-
* @returns A
|
|
106
|
-
*/ async runUtility(call, authwits, scopes) {
|
|
107
|
-
await
|
|
108
|
-
const entryPointArtifact = await this.executionDataProvider.getFunctionArtifact(call.to, call.selector);
|
|
145
|
+
* @returns A return value of the utility function in a form as returned by the simulator (Noir fields)
|
|
146
|
+
*/ async runUtility(call, authwits, anchorBlockHeader, scopes, jobId) {
|
|
147
|
+
const entryPointArtifact = await this.contractStore.getFunctionArtifactWithDebugMetadata(call.to, call.selector);
|
|
109
148
|
if (entryPointArtifact.functionType !== FunctionType.UTILITY) {
|
|
110
149
|
throw new Error(`Cannot run ${entryPointArtifact.functionType} function as utility`);
|
|
111
150
|
}
|
|
112
|
-
const oracle = new UtilityExecutionOracle(
|
|
151
|
+
const oracle = new UtilityExecutionOracle({
|
|
152
|
+
contractAddress: call.to,
|
|
153
|
+
authWitnesses: authwits,
|
|
154
|
+
capsules: [],
|
|
155
|
+
anchorBlockHeader,
|
|
156
|
+
contractStore: this.contractStore,
|
|
157
|
+
noteStore: this.noteStore,
|
|
158
|
+
keyStore: this.keyStore,
|
|
159
|
+
addressStore: this.addressStore,
|
|
160
|
+
aztecNode: this.aztecNode,
|
|
161
|
+
recipientTaggingStore: this.recipientTaggingStore,
|
|
162
|
+
senderAddressBookStore: this.senderAddressBookStore,
|
|
163
|
+
capsuleStore: this.capsuleStore,
|
|
164
|
+
privateEventStore: this.privateEventStore,
|
|
165
|
+
jobId,
|
|
166
|
+
scopes
|
|
167
|
+
});
|
|
113
168
|
try {
|
|
114
169
|
this.log.verbose(`Executing utility function ${entryPointArtifact.name}`, {
|
|
115
170
|
contract: call.to,
|
|
@@ -125,16 +180,29 @@ import { UtilityExecutionOracle } from './oracle/utility_execution_oracle.js';
|
|
|
125
180
|
cause: err
|
|
126
181
|
});
|
|
127
182
|
});
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
return decodeFromAbi(entryPointArtifact.returnTypes, returnWitness);
|
|
183
|
+
this.log.verbose(`Utility execution for ${call.to}.${call.selector} completed`);
|
|
184
|
+
return witnessMapToFields(acirExecutionResult.returnWitness);
|
|
131
185
|
} catch (err) {
|
|
132
186
|
throw createSimulationError(err instanceof Error ? err : new Error('Unknown error during private execution'));
|
|
133
187
|
}
|
|
134
188
|
}
|
|
135
189
|
// docs:end:execute_utility_function
|
|
136
|
-
|
|
137
|
-
|
|
190
|
+
/**
|
|
191
|
+
* Returns the execution statistics collected during the simulator run.
|
|
192
|
+
* @returns The execution statistics.
|
|
193
|
+
*/ getStats() {
|
|
194
|
+
const nodeRPCCalls = typeof this.aztecNode.getStats === 'function' ? this.aztecNode.getStats() : {
|
|
195
|
+
perMethod: {},
|
|
196
|
+
roundTrips: {
|
|
197
|
+
roundTrips: 0,
|
|
198
|
+
totalBlockingTime: 0,
|
|
199
|
+
roundTripDurations: [],
|
|
200
|
+
roundTripMethods: []
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
return {
|
|
204
|
+
nodeRPCCalls
|
|
205
|
+
};
|
|
138
206
|
}
|
|
139
207
|
}
|
|
140
208
|
class OrderedSideEffect {
|
|
@@ -152,18 +220,24 @@ class OrderedSideEffect {
|
|
|
152
220
|
* (allowing state overrides) and is much faster, while still generating a valid
|
|
153
221
|
* output that can be sent to the node for public simulation
|
|
154
222
|
* @param privateExecutionResult - The result of the private execution.
|
|
155
|
-
* @param
|
|
156
|
-
*
|
|
157
|
-
* @param
|
|
223
|
+
* @param debugFunctionNameGetter - A provider for contract data in order to get function names and debug info.
|
|
224
|
+
* @param node - AztecNode for verifying settled read requests against the note hash and nullifier trees.
|
|
225
|
+
* @param minRevertibleSideEffectCounterOverride - Optional override for the min revertible side effect counter.
|
|
226
|
+
* Used by TXE to simulate account contract behavior (setting the counter before app execution).
|
|
158
227
|
* @returns The simulated proving result.
|
|
159
|
-
*/ export async function generateSimulatedProvingResult(privateExecutionResult,
|
|
160
|
-
const siloedNoteHashes = [];
|
|
161
|
-
const nullifiers = [];
|
|
228
|
+
*/ export async function generateSimulatedProvingResult(privateExecutionResult, debugFunctionNameGetter, node, minRevertibleSideEffectCounterOverride) {
|
|
162
229
|
const taggedPrivateLogs = [];
|
|
163
230
|
const l2ToL1Messages = [];
|
|
164
231
|
const contractClassLogsHashes = [];
|
|
165
232
|
const publicCallRequests = [];
|
|
166
233
|
const executionSteps = [];
|
|
234
|
+
// Unsiloed scoped arrays — used for squashing, read request verification,
|
|
235
|
+
// and siloed at the end only for the surviving items
|
|
236
|
+
const scopedNoteHashes = [];
|
|
237
|
+
const scopedNullifiers = [];
|
|
238
|
+
// Read requests for verification
|
|
239
|
+
const noteHashReadRequests = [];
|
|
240
|
+
const nullifierReadRequests = [];
|
|
167
241
|
let publicTeardownCallRequest;
|
|
168
242
|
const executions = [
|
|
169
243
|
privateExecutionResult.entrypoint
|
|
@@ -172,18 +246,14 @@ class OrderedSideEffect {
|
|
|
172
246
|
const execution = executions.shift();
|
|
173
247
|
executions.unshift(...execution.nestedExecutionResults);
|
|
174
248
|
const { contractAddress } = execution.publicInputs.callContext;
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
metadata.log.fields[0] = await
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
}));
|
|
184
|
-
siloedNoteHashes.push(...noteHashesFromExecution);
|
|
185
|
-
taggedPrivateLogs.push(...privateLogsFromExecution);
|
|
186
|
-
nullifiers.push(...nullifiersFromExecution);
|
|
249
|
+
scopedNoteHashes.push(...execution.publicInputs.noteHashes.getActiveItems().filter((nh)=>!nh.isEmpty()).map((nh)=>nh.scope(contractAddress)));
|
|
250
|
+
scopedNullifiers.push(...execution.publicInputs.nullifiers.getActiveItems().map((n)=>n.scope(contractAddress)));
|
|
251
|
+
taggedPrivateLogs.push(...await Promise.all(execution.publicInputs.privateLogs.getActiveItems().map(async (metadata)=>{
|
|
252
|
+
metadata.log.fields[0] = await computeSiloedPrivateLogFirstField(contractAddress, metadata.log.fields[0]);
|
|
253
|
+
return new OrderedSideEffect(metadata, metadata.counter);
|
|
254
|
+
})));
|
|
255
|
+
noteHashReadRequests.push(...execution.publicInputs.noteHashReadRequests.getActiveItems());
|
|
256
|
+
nullifierReadRequests.push(...execution.publicInputs.nullifierReadRequests.getActiveItems());
|
|
187
257
|
l2ToL1Messages.push(...execution.publicInputs.l2ToL1Msgs.getActiveItems().map((message)=>new OrderedSideEffect(message.message.scope(contractAddress), message.counter)));
|
|
188
258
|
contractClassLogsHashes.push(...execution.publicInputs.contractClassLogsHashes.getActiveItems().map((contractClassLogHash)=>new OrderedSideEffect(contractClassLogHash.logHash.scope(contractAddress), contractClassLogHash.counter)));
|
|
189
259
|
publicCallRequests.push(...execution.publicInputs.publicCallRequests.getActiveItems().map((callRequest)=>new OrderedSideEffect(callRequest.inner, callRequest.counter)));
|
|
@@ -192,7 +262,7 @@ class OrderedSideEffect {
|
|
|
192
262
|
}
|
|
193
263
|
publicTeardownCallRequest = execution.publicInputs.publicTeardownCallRequest.isEmpty() ? publicTeardownCallRequest : execution.publicInputs.publicTeardownCallRequest;
|
|
194
264
|
executionSteps.push({
|
|
195
|
-
functionName: await
|
|
265
|
+
functionName: await debugFunctionNameGetter(execution.publicInputs.callContext.contractAddress, execution.publicInputs.callContext.functionSelector),
|
|
196
266
|
timings: execution.profileResult?.timings ?? {
|
|
197
267
|
witgen: 0,
|
|
198
268
|
oracles: {}
|
|
@@ -202,6 +272,14 @@ class OrderedSideEffect {
|
|
|
202
272
|
witness: execution.partialWitness
|
|
203
273
|
});
|
|
204
274
|
}
|
|
275
|
+
const noteHashNullifierCounterMap = collectNoteHashNullifierCounterMap(privateExecutionResult);
|
|
276
|
+
const minRevertibleSideEffectCounter = minRevertibleSideEffectCounterOverride ?? getFinalMinRevertibleSideEffectCounter(privateExecutionResult);
|
|
277
|
+
const scopedNoteHashesCLA = new ClaimedLengthArray(padArrayEnd(scopedNoteHashes, ScopedNoteHash.empty(), MAX_NOTE_HASHES_PER_TX), scopedNoteHashes.length);
|
|
278
|
+
const scopedNullifiersCLA = new ClaimedLengthArray(padArrayEnd(scopedNullifiers, ScopedNullifier.empty(), MAX_NULLIFIERS_PER_TX), scopedNullifiers.length);
|
|
279
|
+
const { filteredNoteHashes, filteredNullifiers, filteredPrivateLogs } = squashTransientSideEffects(taggedPrivateLogs, scopedNoteHashesCLA, scopedNullifiersCLA, noteHashNullifierCounterMap, minRevertibleSideEffectCounter);
|
|
280
|
+
await verifyReadRequests(node, await privateExecutionResult.entrypoint.publicInputs.anchorBlockHeader.hash(), noteHashReadRequests, nullifierReadRequests, scopedNoteHashesCLA, scopedNullifiersCLA);
|
|
281
|
+
const siloedNoteHashes = await Promise.all(filteredNoteHashes.sort((a, b)=>a.counter - b.counter).map(async (nh)=>new OrderedSideEffect(await siloNoteHash(nh.contractAddress, nh.value), nh.counter)));
|
|
282
|
+
const siloedNullifiers = await Promise.all(filteredNullifiers.sort((a, b)=>a.counter - b.counter).map(async (n)=>new OrderedSideEffect(await siloNullifier(n.contractAddress, n.value), n.counter)));
|
|
205
283
|
const constantData = new TxConstantData(privateExecutionResult.entrypoint.publicInputs.anchorBlockHeader, privateExecutionResult.entrypoint.publicInputs.txContext, getVKTreeRoot(), protocolContractsHash);
|
|
206
284
|
const hasPublicCalls = privateExecutionResult.publicFunctionCalldata.length !== 0;
|
|
207
285
|
let inputsForRollup;
|
|
@@ -210,54 +288,117 @@ class OrderedSideEffect {
|
|
|
210
288
|
const sortByCounter = (a, b)=>a.counter - b.counter;
|
|
211
289
|
const getEffect = (orderedSideEffect)=>orderedSideEffect.sideEffect;
|
|
212
290
|
const isPrivateOnlyTx = privateExecutionResult.publicFunctionCalldata.length === 0;
|
|
213
|
-
const
|
|
214
|
-
const
|
|
215
|
-
if (nonRevertibleNullifiers.length
|
|
291
|
+
const [nonRevertibleNullifiers, revertibleNullifiers] = splitOrderedSideEffects(siloedNullifiers, minRevertibleSideEffectCounter);
|
|
292
|
+
const nonceGenerator = privateExecutionResult.firstNullifier;
|
|
293
|
+
if (nonRevertibleNullifiers.length === 0) {
|
|
294
|
+
nonRevertibleNullifiers.push(nonceGenerator);
|
|
295
|
+
} else if (!nonRevertibleNullifiers[0].equals(nonceGenerator)) {
|
|
216
296
|
throw new Error('The first non revertible nullifier should be equal to the nonce generator. This is a bug!');
|
|
217
|
-
} else {
|
|
218
|
-
nonRevertibleNullifiers.unshift(nonceGenerator);
|
|
219
297
|
}
|
|
220
298
|
if (isPrivateOnlyTx) {
|
|
221
299
|
// We must make the note hashes unique by using the
|
|
222
300
|
// nonce generator and their index in the tx.
|
|
223
|
-
const uniqueNoteHashes = await Promise.all(siloedNoteHashes.
|
|
301
|
+
const uniqueNoteHashes = await Promise.all(siloedNoteHashes.map(async (orderedSideEffect, i)=>{
|
|
224
302
|
const siloedNoteHash = orderedSideEffect.sideEffect;
|
|
225
303
|
const nonce = await computeNoteHashNonce(nonceGenerator, i);
|
|
226
304
|
const uniqueNoteHash = await computeUniqueNoteHash(nonce, siloedNoteHash);
|
|
227
305
|
return uniqueNoteHash;
|
|
228
306
|
}));
|
|
229
|
-
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(
|
|
230
|
-
gasUsed = meterGasUsed(accumulatedDataForRollup);
|
|
307
|
+
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(filteredPrivateLogs.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));
|
|
308
|
+
gasUsed = meterGasUsed(accumulatedDataForRollup, isPrivateOnlyTx);
|
|
231
309
|
inputsForRollup = new PartialPrivateTailPublicInputsForRollup(accumulatedDataForRollup);
|
|
232
310
|
} else {
|
|
233
|
-
const [nonRevertibleNoteHashes, revertibleNoteHashes] = splitOrderedSideEffects(siloedNoteHashes
|
|
311
|
+
const [nonRevertibleNoteHashes, revertibleNoteHashes] = splitOrderedSideEffects(siloedNoteHashes, minRevertibleSideEffectCounter);
|
|
312
|
+
const nonRevertibleUniqueNoteHashes = await Promise.all(nonRevertibleNoteHashes.map(async (noteHash, i)=>{
|
|
313
|
+
const nonce = await computeNoteHashNonce(nonceGenerator, i);
|
|
314
|
+
return await computeUniqueNoteHash(nonce, noteHash);
|
|
315
|
+
}));
|
|
234
316
|
const [nonRevertibleL2ToL1Messages, revertibleL2ToL1Messages] = splitOrderedSideEffects(l2ToL1Messages.sort(sortByCounter), minRevertibleSideEffectCounter);
|
|
235
|
-
const [nonRevertibleTaggedPrivateLogs, revertibleTaggedPrivateLogs] = splitOrderedSideEffects(
|
|
317
|
+
const [nonRevertibleTaggedPrivateLogs, revertibleTaggedPrivateLogs] = splitOrderedSideEffects(filteredPrivateLogs, minRevertibleSideEffectCounter);
|
|
236
318
|
const [nonRevertibleContractClassLogHashes, revertibleContractClassLogHashes] = splitOrderedSideEffects(contractClassLogsHashes.sort(sortByCounter), minRevertibleSideEffectCounter);
|
|
237
319
|
const [nonRevertiblePublicCallRequests, revertiblePublicCallRequests] = splitOrderedSideEffects(publicCallRequests.sort(sortByCounter), minRevertibleSideEffectCounter);
|
|
238
|
-
const nonRevertibleData = new PrivateToPublicAccumulatedData(padArrayEnd(
|
|
320
|
+
const nonRevertibleData = new PrivateToPublicAccumulatedData(padArrayEnd(nonRevertibleUniqueNoteHashes, 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));
|
|
239
321
|
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));
|
|
240
|
-
gasUsed = meterGasUsed(revertibleData).add(meterGasUsed(nonRevertibleData));
|
|
322
|
+
gasUsed = meterGasUsed(revertibleData, isPrivateOnlyTx).add(meterGasUsed(nonRevertibleData, isPrivateOnlyTx));
|
|
241
323
|
if (publicTeardownCallRequest) {
|
|
242
|
-
gasUsed.add(privateExecutionResult.entrypoint.publicInputs.txContext.gasSettings.teardownGasLimits);
|
|
324
|
+
gasUsed = gasUsed.add(privateExecutionResult.entrypoint.publicInputs.txContext.gasSettings.teardownGasLimits);
|
|
243
325
|
}
|
|
244
326
|
inputsForPublic = new PartialPrivateTailPublicInputsForPublic(nonRevertibleData, revertibleData, publicTeardownCallRequest ?? PublicCallRequest.empty());
|
|
245
327
|
}
|
|
246
328
|
const publicInputs = new PrivateKernelTailCircuitPublicInputs(constantData, /*gasUsed=*/ gasUsed.add(Gas.from({
|
|
247
|
-
l2Gas:
|
|
248
|
-
daGas:
|
|
249
|
-
})), /*feePayer=*/ AztecAddress.zero(), /*
|
|
329
|
+
l2Gas: isPrivateOnlyTx ? PRIVATE_TX_L2_GAS_OVERHEAD : PUBLIC_TX_L2_GAS_OVERHEAD,
|
|
330
|
+
daGas: TX_DA_GAS_OVERHEAD
|
|
331
|
+
})), /*feePayer=*/ AztecAddress.zero(), /*expirationTimestamp=*/ 0n, hasPublicCalls ? inputsForPublic : undefined, !hasPublicCalls ? inputsForRollup : undefined);
|
|
250
332
|
return {
|
|
251
333
|
publicInputs,
|
|
252
334
|
chonkProof: ChonkProof.empty(),
|
|
253
335
|
executionSteps
|
|
254
336
|
};
|
|
255
337
|
}
|
|
338
|
+
/**
|
|
339
|
+
* Squashes transient note hashes and nullifiers, mimicking the behavior
|
|
340
|
+
* of the reset kernels. Returns the filtered (surviving) scoped items and private logs.
|
|
341
|
+
*/ function squashTransientSideEffects(taggedPrivateLogs, scopedNoteHashesCLA, scopedNullifiersCLA, noteHashNullifierCounterMap, minRevertibleSideEffectCounter) {
|
|
342
|
+
const { numTransientData, hints: transientDataHints } = buildTransientDataHints(scopedNoteHashesCLA, scopedNullifiersCLA, /*futureNoteHashReads=*/ [], /*futureNullifierReads=*/ [], /*futureLogs=*/ [], noteHashNullifierCounterMap, minRevertibleSideEffectCounter);
|
|
343
|
+
const squashedNoteHashCounters = new Set();
|
|
344
|
+
const squashedNullifierCounters = new Set();
|
|
345
|
+
for(let i = 0; i < numTransientData; i++){
|
|
346
|
+
const hint = transientDataHints[i];
|
|
347
|
+
squashedNoteHashCounters.add(scopedNoteHashesCLA.array[hint.noteHashIndex].counter);
|
|
348
|
+
squashedNullifierCounters.add(scopedNullifiersCLA.array[hint.nullifierIndex].counter);
|
|
349
|
+
}
|
|
350
|
+
return {
|
|
351
|
+
filteredNoteHashes: scopedNoteHashesCLA.getActiveItems().filter((nh)=>!squashedNoteHashCounters.has(nh.counter)),
|
|
352
|
+
filteredNullifiers: scopedNullifiersCLA.getActiveItems().filter((n)=>!squashedNullifierCounters.has(n.counter)),
|
|
353
|
+
filteredPrivateLogs: taggedPrivateLogs.filter((item)=>!squashedNoteHashCounters.has(item.sideEffect.noteHashCounter)).map((item)=>new OrderedSideEffect(item.sideEffect.log, item.counter))
|
|
354
|
+
};
|
|
355
|
+
}
|
|
356
|
+
/**
|
|
357
|
+
* Verifies settled read requests by checking membership in the note hash and nullifier trees
|
|
358
|
+
* at the tx's anchor block, mimicking the behavior of the kernels
|
|
359
|
+
*/ async function verifyReadRequests(node, anchorBlockHash, noteHashReadRequests, nullifierReadRequests, scopedNoteHashesCLA, scopedNullifiersCLA) {
|
|
360
|
+
const noteHashReadRequestsCLA = new ClaimedLengthArray(padArrayEnd(noteHashReadRequests, ScopedReadRequest.empty(), MAX_NOTE_HASH_READ_REQUESTS_PER_TX), noteHashReadRequests.length);
|
|
361
|
+
const nullifierReadRequestsCLA = new ClaimedLengthArray(padArrayEnd(nullifierReadRequests, ScopedReadRequest.empty(), MAX_NULLIFIER_READ_REQUESTS_PER_TX), nullifierReadRequests.length);
|
|
362
|
+
const noteHashResetActions = getNoteHashReadRequestResetActions(noteHashReadRequestsCLA, scopedNoteHashesCLA);
|
|
363
|
+
const nullifierResetActions = getNullifierReadRequestResetActions(nullifierReadRequestsCLA, scopedNullifiersCLA);
|
|
364
|
+
const settledNoteHashReads = [];
|
|
365
|
+
for(let i = 0; i < noteHashResetActions.actions.length; i++){
|
|
366
|
+
if (noteHashResetActions.actions[i] === ReadRequestActionEnum.READ_AS_SETTLED) {
|
|
367
|
+
settledNoteHashReads.push({
|
|
368
|
+
index: i,
|
|
369
|
+
value: noteHashReadRequests[i].value
|
|
370
|
+
});
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
const settledNullifierReads = [];
|
|
374
|
+
for(let i = 0; i < nullifierResetActions.actions.length; i++){
|
|
375
|
+
if (nullifierResetActions.actions[i] === ReadRequestActionEnum.READ_AS_SETTLED) {
|
|
376
|
+
settledNullifierReads.push({
|
|
377
|
+
index: i,
|
|
378
|
+
value: nullifierReadRequests[i].value
|
|
379
|
+
});
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
const [noteHashWitnesses, nullifierWitnesses] = await Promise.all([
|
|
383
|
+
Promise.all(settledNoteHashReads.map(({ value })=>node.getNoteHashMembershipWitness(anchorBlockHash, value))),
|
|
384
|
+
Promise.all(settledNullifierReads.map(({ value })=>node.getNullifierMembershipWitness(anchorBlockHash, value)))
|
|
385
|
+
]);
|
|
386
|
+
for(let i = 0; i < settledNoteHashReads.length; i++){
|
|
387
|
+
if (!noteHashWitnesses[i]) {
|
|
388
|
+
throw new Error(`Note hash read request at index ${settledNoteHashReads[i].index} is reading an unknown note hash: ${settledNoteHashReads[i].value}`);
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
for(let i = 0; i < settledNullifierReads.length; i++){
|
|
392
|
+
if (!nullifierWitnesses[i]) {
|
|
393
|
+
throw new Error(`Nullifier read request at index ${settledNullifierReads[i].index} is reading an unknown nullifier: ${settledNullifierReads[i].value}`);
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
}
|
|
256
397
|
function splitOrderedSideEffects(effects, minRevertibleSideEffectCounter) {
|
|
257
398
|
const revertibleSideEffects = [];
|
|
258
399
|
const nonRevertibleSideEffects = [];
|
|
259
400
|
effects.forEach((effect)=>{
|
|
260
|
-
if (effect.counter < minRevertibleSideEffectCounter) {
|
|
401
|
+
if (minRevertibleSideEffectCounter === 0 || effect.counter < minRevertibleSideEffectCounter) {
|
|
261
402
|
nonRevertibleSideEffects.push(effect.sideEffect);
|
|
262
403
|
} else {
|
|
263
404
|
revertibleSideEffects.push(effect.sideEffect);
|
|
@@ -268,18 +409,21 @@ function splitOrderedSideEffects(effects, minRevertibleSideEffectCounter) {
|
|
|
268
409
|
revertibleSideEffects
|
|
269
410
|
];
|
|
270
411
|
}
|
|
271
|
-
function meterGasUsed(data) {
|
|
412
|
+
function meterGasUsed(data, isPrivateOnlyTx) {
|
|
272
413
|
let meteredDAFields = 0;
|
|
273
414
|
let meteredL2Gas = 0;
|
|
274
415
|
const numNoteHashes = arrayNonEmptyLength(data.noteHashes, (hash)=>hash.isEmpty());
|
|
275
416
|
meteredDAFields += numNoteHashes;
|
|
276
|
-
|
|
417
|
+
const noteHashBaseGas = isPrivateOnlyTx ? L2_GAS_PER_NOTE_HASH : AVM_EMITNOTEHASH_BASE_L2_GAS;
|
|
418
|
+
meteredL2Gas += numNoteHashes * noteHashBaseGas;
|
|
277
419
|
const numNullifiers = arrayNonEmptyLength(data.nullifiers, (nullifier)=>nullifier.isEmpty());
|
|
278
420
|
meteredDAFields += numNullifiers;
|
|
279
|
-
|
|
421
|
+
const nullifierBaseGas = isPrivateOnlyTx ? L2_GAS_PER_NULLIFIER : AVM_EMITNULLIFIER_BASE_L2_GAS;
|
|
422
|
+
meteredL2Gas += numNullifiers * nullifierBaseGas;
|
|
280
423
|
const numL2toL1Messages = arrayNonEmptyLength(data.l2ToL1Msgs, (msg)=>msg.isEmpty());
|
|
281
424
|
meteredDAFields += numL2toL1Messages;
|
|
282
|
-
|
|
425
|
+
const l2ToL1MessageBaseGas = isPrivateOnlyTx ? L2_GAS_PER_L2_TO_L1_MSG : AVM_SENDL2TOL1MSG_BASE_L2_GAS;
|
|
426
|
+
meteredL2Gas += numL2toL1Messages * l2ToL1MessageBaseGas;
|
|
283
427
|
const numPrivatelogs = arrayNonEmptyLength(data.privateLogs, (log)=>log.isEmpty());
|
|
284
428
|
// Every private log emits its length as an additional field
|
|
285
429
|
meteredDAFields += data.privateLogs.reduce((acc, log)=>!log.isEmpty() ? acc + log.emittedLength + 1 : acc, 0);
|
|
@@ -288,7 +432,7 @@ function meterGasUsed(data) {
|
|
|
288
432
|
// Every contract class log emits its length and contract address as additional fields
|
|
289
433
|
meteredDAFields += data.contractClassLogsHashes.reduce((acc, log)=>!log.isEmpty() ? acc + log.logHash.length + 2 : acc, 0);
|
|
290
434
|
meteredL2Gas += numContractClassLogs * L2_GAS_PER_CONTRACT_CLASS_LOG;
|
|
291
|
-
const meteredDAGas = meteredDAFields *
|
|
435
|
+
const meteredDAGas = meteredDAFields * DA_GAS_PER_FIELD;
|
|
292
436
|
if (data.publicCallRequests) {
|
|
293
437
|
const dataForPublic = data;
|
|
294
438
|
const numPublicCallRequests = arrayNonEmptyLength(dataForPublic.publicCallRequests, (req)=>req.isEmpty());
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Fr } from '@aztec/foundation/
|
|
1
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
2
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
3
3
|
import type { NoteData } from './oracle/interfaces.js';
|
|
4
4
|
interface PendingNote {
|
|
@@ -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.
|
|
@@ -28,25 +28,27 @@ export declare class ExecutionNoteCache {
|
|
|
28
28
|
*/
|
|
29
29
|
private nullifierMap;
|
|
30
30
|
/**
|
|
31
|
-
*
|
|
31
|
+
* Nullifiers emitted by private calls in this transaction.
|
|
32
|
+
*/
|
|
33
|
+
private emittedNullifiers;
|
|
34
|
+
/**
|
|
35
|
+
* The counter that separates non-revertible side effects (which persist even if the tx reverts) from revertible ones.
|
|
32
36
|
*/
|
|
33
|
-
private allNullifiers;
|
|
34
37
|
private minRevertibleSideEffectCounter;
|
|
35
38
|
private inRevertiblePhase;
|
|
36
39
|
/**
|
|
37
|
-
*
|
|
38
|
-
*
|
|
40
|
+
* Whether the protocol nullifier was used for nonce generation.
|
|
41
|
+
* We don't need to use the protocol nullifier if a non-revertible nullifier is emitted.
|
|
39
42
|
*/
|
|
40
|
-
private
|
|
41
|
-
constructor(
|
|
43
|
+
private usedProtocolNullifierForNonces;
|
|
44
|
+
constructor(protocolNullifier: Fr);
|
|
42
45
|
/**
|
|
43
46
|
* Enters the revertible phase of the transaction.
|
|
44
47
|
* @param minRevertibleSideEffectCounter - The counter at which the transaction enters the revertible phase.
|
|
45
48
|
*/
|
|
46
49
|
setMinRevertibleSideEffectCounter(minRevertibleSideEffectCounter: number): Promise<void>;
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
};
|
|
50
|
+
isSideEffectCounterRevertible(sideEffectCounter: number): boolean;
|
|
51
|
+
finish(): void;
|
|
50
52
|
/**
|
|
51
53
|
* Add a new note to cache.
|
|
52
54
|
* @param note - New note created during execution.
|
|
@@ -70,9 +72,10 @@ export declare class ExecutionNoteCache {
|
|
|
70
72
|
* Return notes created up to current point in execution.
|
|
71
73
|
* If a nullifier for a note in this list is emitted, the note will be deleted.
|
|
72
74
|
* @param contractAddress - Contract address of the notes.
|
|
75
|
+
* @param owner - Owner of the notes. If undefined, returns all notes regardless of owner.
|
|
73
76
|
* @param storageSlot - Storage slot of the notes.
|
|
74
77
|
**/
|
|
75
|
-
getNotes(contractAddress: AztecAddress, storageSlot: Fr): NoteData[];
|
|
78
|
+
getNotes(contractAddress: AztecAddress, owner: AztecAddress | undefined, storageSlot: Fr): NoteData[];
|
|
76
79
|
/**
|
|
77
80
|
* Check if a note exists in the newNotes array.
|
|
78
81
|
* @param contractAddress - Contract address of the note.
|
|
@@ -86,8 +89,16 @@ export declare class ExecutionNoteCache {
|
|
|
86
89
|
*/
|
|
87
90
|
getNullifiers(contractAddress: AztecAddress): Set<bigint>;
|
|
88
91
|
getAllNotes(): PendingNote[];
|
|
92
|
+
/**
|
|
93
|
+
* @returns All nullifiers emitted by private calls in this transaction.
|
|
94
|
+
*/
|
|
95
|
+
getEmittedNullifiers(): Fr[];
|
|
96
|
+
/**
|
|
97
|
+
* @returns All nullifiers emitted by private calls in this transaction. If the protocol nullifier was used as the
|
|
98
|
+
* nonce generator, it is injected as the first nullifier.
|
|
99
|
+
*/
|
|
89
100
|
getAllNullifiers(): Fr[];
|
|
90
|
-
|
|
101
|
+
getNonceGenerator(): Fr;
|
|
91
102
|
}
|
|
92
103
|
export {};
|
|
93
|
-
//# sourceMappingURL=
|
|
104
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXhlY3V0aW9uX25vdGVfY2FjaGUuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jb250cmFjdF9mdW5jdGlvbl9zaW11bGF0b3IvZXhlY3V0aW9uX25vdGVfY2FjaGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLEVBQUUsRUFBRSxNQUFNLGdDQUFnQyxDQUFDO0FBQ3BELE9BQU8sS0FBSyxFQUFFLFlBQVksRUFBRSxNQUFNLDZCQUE2QixDQUFDO0FBR2hFLE9BQU8sS0FBSyxFQUFFLFFBQVEsRUFBRSxNQUFNLHdCQUF3QixDQUFDO0FBRXZELFVBQVUsV0FBVztJQUNuQixJQUFJLEVBQUUsUUFBUSxDQUFDO0lBQ2YsT0FBTyxFQUFFLE1BQU0sQ0FBQztJQUNoQixzQkFBc0IsRUFBRSxFQUFFLENBQUM7Q0FDNUI7QUFFRDs7R0FFRztBQUNILHFCQUFhLGtCQUFrQjs7SUFvQ2pCLE9BQU8sQ0FBQyxRQUFRLENBQUMsaUJBQWlCO0lBbkM5Qzs7O09BR0c7SUFDSCxPQUFPLENBQUMsS0FBSyxDQUFxQjtJQUNsQzs7T0FFRztJQUNILE9BQU8sQ0FBQyxPQUFPLENBQXlDO0lBRXhEOzs7O09BSUc7SUFDSCxPQUFPLENBQUMsWUFBWSxDQUF1QztJQUUzRDs7T0FFRztJQUNILE9BQU8sQ0FBQyxpQkFBaUIsQ0FBMEI7SUFFbkQ7O09BRUc7SUFDSCxPQUFPLENBQUMsOEJBQThCLENBQUs7SUFFM0MsT0FBTyxDQUFDLGlCQUFpQixDQUFTO0lBRWxDOzs7T0FHRztJQUNILE9BQU8sQ0FBQyw4QkFBOEIsQ0FBc0I7SUFFNUQsWUFBNkIsaUJBQWlCLEVBQUUsRUFBRSxFQUFJO0lBRXREOzs7T0FHRztJQUNVLGlDQUFpQyxDQUFDLDhCQUE4QixFQUFFLE1BQU0saUJBc0NwRjtJQUVNLDZCQUE2QixDQUFDLGlCQUFpQixFQUFFLE1BQU0sR0FBRyxPQUFPLENBS3ZFO0lBRU0sTUFBTSxTQU1aO0lBRUQ7OztPQUdHO0lBQ0ksVUFBVSxDQUFDLElBQUksRUFBRSxRQUFRLEVBQUUsT0FBTyxFQUFFLE1BQU0sUUFTaEQ7SUFFRDs7Ozs7O09BTUc7SUFDVSxXQUFXLENBQUMsZUFBZSxFQUFFLFlBQVksRUFBRSxjQUFjLEVBQUUsRUFBRSxFQUFFLFFBQVEsRUFBRSxFQUFFLCtCQXlCdkY7SUFFRDs7OztPQUlHO0lBQ1UsZ0JBQWdCLENBQUMsZUFBZSxFQUFFLFlBQVksRUFBRSxjQUFjLEVBQUUsRUFBRSxpQkFHOUU7SUFFRDs7Ozs7O1FBTUk7SUFDRyxRQUFRLENBQUMsZUFBZSxFQUFFLFlBQVksRUFBRSxLQUFLLEVBQUUsWUFBWSxHQUFHLFNBQVMsRUFBRSxXQUFXLEVBQUUsRUFBRSxjQU05RjtJQUVEOzs7OztRQUtJO0lBQ0csZUFBZSxDQUFDLGVBQWUsRUFBRSxZQUFZLEVBQUUsUUFBUSxFQUFFLEVBQUUsV0FHakU7SUFFRDs7O09BR0c7SUFDSSxhQUFhLENBQUMsZUFBZSxFQUFFLFlBQVksR0FBRyxHQUFHLENBQUMsTUFBTSxDQUFDLENBRS9EO0lBVUQsV0FBVyxJQUFJLFdBQVcsRUFBRSxDQUUzQjtJQUVEOztPQUVHO0lBQ0gsb0JBQW9CLElBQUksRUFBRSxFQUFFLENBRTNCO0lBRUQ7OztPQUdHO0lBQ0gsZ0JBQWdCLElBQUksRUFBRSxFQUFFLENBTXZCO0lBRUQsaUJBQWlCLElBQUksRUFBRSxDQUV0QjtDQWFGIn0=
|
|
@@ -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;;IAoCjB,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IAnC9C;;;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,iBAAiB,CAA0B;IAEnD;;OAEG;IACH,OAAO,CAAC,8BAA8B,CAAK;IAE3C,OAAO,CAAC,iBAAiB,CAAS;IAElC;;;OAGG;IACH,OAAO,CAAC,8BAA8B,CAAsB;IAE5D,YAA6B,iBAAiB,EAAE,EAAE,EAAI;IAEtD;;;OAGG;IACU,iCAAiC,CAAC,8BAA8B,EAAE,MAAM,iBAsCpF;IAEM,6BAA6B,CAAC,iBAAiB,EAAE,MAAM,GAAG,OAAO,CAKvE;IAEM,MAAM,SAMZ;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;;OAEG;IACH,oBAAoB,IAAI,EAAE,EAAE,CAE3B;IAED;;;OAGG;IACH,gBAAgB,IAAI,EAAE,EAAE,CAMvB;IAED,iBAAiB,IAAI,EAAE,CAEtB;CAaF"}
|