@aztec/pxe 0.0.1-fake-ceab37513c → 0.0.6-commit.a2d1860fe9
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/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 +110 -10
- 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 +11 -17
- package/dest/config/index.d.ts.map +1 -1
- package/dest/config/index.js +27 -16
- 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 +79 -27
- package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.js +287 -87
- package/dest/contract_function_simulator/execution_note_cache.d.ts +26 -15
- package/dest/contract_function_simulator/execution_note_cache.d.ts.map +1 -1
- package/dest/contract_function_simulator/execution_note_cache.js +65 -37
- 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 +5 -3
- package/dest/contract_function_simulator/index.d.ts.map +1 -1
- package/dest/contract_function_simulator/index.js +3 -2
- 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 +8 -4
- package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +7 -4
- package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/note_validation_request.js +13 -4
- package/dest/contract_function_simulator/noir-structs/utility_context.d.ts +16 -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 +22 -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 +107 -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 -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 +26 -22
- package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/oracle.js +156 -113
- 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 +3 -48
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +72 -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 +173 -68
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +116 -53
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +217 -94
- 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 +7 -3
- package/dest/entrypoints/client/bundle/index.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/index.js +5 -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 +40 -17
- package/dest/entrypoints/client/lazy/index.d.ts +7 -3
- package/dest/entrypoints/client/lazy/index.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/index.js +5 -2
- package/dest/entrypoints/client/lazy/utils.d.ts +9 -9
- package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/utils.js +40 -17
- 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 +9 -3
- package/dest/entrypoints/server/index.d.ts.map +1 -1
- package/dest/entrypoints/server/index.js +7 -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 +42 -51
- 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 +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_expiration_timestamp.js +41 -0
- 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 +28 -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} +22 -16
- package/dest/private_kernel/index.d.ts +1 -1
- package/dest/private_kernel/private_kernel_execution_prover.d.ts +11 -3
- package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_execution_prover.js +48 -43
- 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 +250 -0
- package/dest/pxe.d.ts.map +1 -0
- package/dest/pxe.js +774 -0
- 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 -15
- 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 -13
- 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 -9
- package/dest/storage/index.d.ts.map +1 -1
- package/dest/storage/index.js +7 -8
- 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 -0
- package/dest/tagging/constants.d.ts.map +1 -0
- package/dest/tagging/constants.js +10 -0
- 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 +17 -0
- package/dest/tagging/index.d.ts.map +1 -0
- package/dest/tagging/index.js +15 -0
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts +15 -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 +15 -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 +32 -0
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts +21 -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 +29 -0
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts +21 -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 +60 -0
- package/package.json +30 -23
- package/src/access_scopes.ts +9 -0
- package/src/bin/check_oracle_version.ts +135 -10
- package/src/block_synchronizer/block_synchronizer.ts +178 -0
- package/src/block_synchronizer/index.ts +1 -0
- package/src/config/index.ts +32 -32
- 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 +505 -140
- package/src/contract_function_simulator/execution_note_cache.ts +67 -32
- 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 +4 -2
- 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 +10 -5
- package/src/contract_function_simulator/noir-structs/note_validation_request.ts +15 -3
- package/src/contract_function_simulator/noir-structs/utility_context.ts +23 -0
- package/src/contract_function_simulator/oracle/index.ts +1 -1
- package/src/contract_function_simulator/oracle/interfaces.ts +185 -0
- 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 +197 -110
- package/src/contract_function_simulator/oracle/private_execution.ts +4 -78
- package/src/contract_function_simulator/oracle/private_execution_oracle.ts +248 -122
- package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +372 -138
- 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 +6 -2
- package/src/entrypoints/client/bundle/utils.ts +31 -32
- package/src/entrypoints/client/lazy/index.ts +6 -2
- package/src/entrypoints/client/lazy/utils.ts +31 -32
- package/src/entrypoints/pxe_creation_options.ts +6 -2
- package/src/entrypoints/server/index.ts +8 -2
- package/src/entrypoints/server/utils.ts +39 -91
- package/src/{pxe_service/error_enriching.ts → error_enriching.ts} +11 -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 +208 -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} +16 -16
- 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} +44 -37
- package/src/private_kernel/private_kernel_execution_prover.ts +64 -55
- package/src/private_kernel/private_kernel_oracle.ts +118 -37
- package/src/pxe.ts +1137 -0
- package/src/storage/{address_data_provider/address_data_provider.ts → address_store/address_store.ts} +15 -21
- 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 -17
- 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 -8
- 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 +139 -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 -0
- package/src/tagging/get_all_logs_by_tags.ts +92 -0
- package/src/tagging/index.ts +19 -0
- package/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts +143 -0
- package/src/tagging/recipient_sync/utils/find_highest_indexes.ts +34 -0
- package/src/tagging/recipient_sync/utils/load_logs_for_range.ts +49 -0
- package/src/tagging/sender_sync/sync_sender_tagging_indexes.ts +99 -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 +84 -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/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 -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/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/hints/compute_tx_include_by_timestamp.js +0 -41
- 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/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 -101
- package/dest/pxe_service/pxe_service.d.ts.map +0 -1
- package/dest/pxe_service/pxe_service.js +0 -791
- 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/capsule_data_provider.js +0 -122
- 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 -75
- 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 -208
- 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/note_data_provider/note_data_provider.js +0 -260
- 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/synchronizer/synchronizer.js +0 -102
- 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/proxied_node.ts +0 -33
- package/src/contract_function_simulator/pxe_oracle_interface.ts +0 -1020
- package/src/contract_function_simulator/tagging_utils.ts +0 -32
- package/src/private_kernel/private_kernel_oracle_impl.ts +0 -132
- package/src/pxe_service/index.ts +0 -2
- package/src/pxe_service/pxe_service.ts +0 -1139
- package/src/storage/address_data_provider/index.ts +0 -1
- package/src/storage/capsule_data_provider/capsule_data_provider.ts +0 -157
- package/src/storage/capsule_data_provider/index.ts +0 -1
- package/src/storage/contract_data_provider/contract_data_provider.ts +0 -300
- 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/note_data_provider/note_data_provider.ts +0 -350
- 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/synchronizer/synchronizer.ts +0 -121
- package/src/test/pxe_test_suite.ts +0 -113
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
} from '@aztec/constants';
|
|
10
10
|
import { makeTuple } from '@aztec/foundation/array';
|
|
11
11
|
import { padArrayEnd } from '@aztec/foundation/collection';
|
|
12
|
-
import type { Fr } from '@aztec/foundation/
|
|
12
|
+
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
13
13
|
import { type Tuple, assertLength } from '@aztec/foundation/serialize';
|
|
14
14
|
import { MembershipWitness } from '@aztec/foundation/trees';
|
|
15
15
|
import { privateKernelResetDimensionsConfig } from '@aztec/noir-protocol-circuits-types/client';
|
|
@@ -24,10 +24,9 @@ import {
|
|
|
24
24
|
PrivateKernelResetDimensions,
|
|
25
25
|
PrivateKernelResetHints,
|
|
26
26
|
type PrivateKernelSimulateOutput,
|
|
27
|
-
type ReadRequest,
|
|
28
27
|
ReadRequestActionEnum,
|
|
29
28
|
ReadRequestResetActions,
|
|
30
|
-
type
|
|
29
|
+
type ScopedKeyValidationRequestAndSeparator,
|
|
31
30
|
ScopedNoteHash,
|
|
32
31
|
ScopedNullifier,
|
|
33
32
|
ScopedReadRequest,
|
|
@@ -47,12 +46,10 @@ import type { PrivateKernelOracle } from '../private_kernel_oracle.js';
|
|
|
47
46
|
|
|
48
47
|
function collectNestedReadRequests<N extends number>(
|
|
49
48
|
executionStack: PrivateCallExecutionResult[],
|
|
50
|
-
extractReadRequests: (execution: PrivateCallExecutionResult) => ClaimedLengthArray<
|
|
49
|
+
extractReadRequests: (execution: PrivateCallExecutionResult) => ClaimedLengthArray<ScopedReadRequest, N>,
|
|
51
50
|
): ScopedReadRequest[] {
|
|
52
51
|
return collectNested(executionStack, executionResult => {
|
|
53
|
-
return extractReadRequests(executionResult)
|
|
54
|
-
.getActiveItems()
|
|
55
|
-
.map(readRequest => new ScopedReadRequest(readRequest, executionResult.publicInputs.callContext.contractAddress));
|
|
52
|
+
return extractReadRequests(executionResult).getActiveItems();
|
|
56
53
|
});
|
|
57
54
|
}
|
|
58
55
|
|
|
@@ -71,9 +68,9 @@ function getNullifierMembershipWitnessResolver(oracle: PrivateKernelOracle) {
|
|
|
71
68
|
};
|
|
72
69
|
}
|
|
73
70
|
|
|
74
|
-
async function
|
|
71
|
+
async function getMasterSecretKeysAndKeyTypeDomainSeparators(
|
|
75
72
|
keyValidationRequests: ClaimedLengthArray<
|
|
76
|
-
|
|
73
|
+
ScopedKeyValidationRequestAndSeparator,
|
|
77
74
|
typeof MAX_KEY_VALIDATION_REQUESTS_PER_TX
|
|
78
75
|
>,
|
|
79
76
|
numRequestsToVerify: number,
|
|
@@ -104,7 +101,7 @@ export class PrivateKernelResetPrivateInputsBuilder {
|
|
|
104
101
|
private previousKernelOutput: PrivateKernelSimulateOutput<PrivateKernelCircuitPublicInputs>,
|
|
105
102
|
private executionStack: PrivateCallExecutionResult[],
|
|
106
103
|
private noteHashNullifierCounterMap: Map<number, number>,
|
|
107
|
-
private
|
|
104
|
+
private splitCounter: number,
|
|
108
105
|
) {
|
|
109
106
|
this.previousKernel = previousKernelOutput.publicInputs;
|
|
110
107
|
this.requestedDimensions = PrivateKernelResetDimensions.empty();
|
|
@@ -141,7 +138,7 @@ export class PrivateKernelResetPrivateInputsBuilder {
|
|
|
141
138
|
}
|
|
142
139
|
}
|
|
143
140
|
|
|
144
|
-
async build(oracle: PrivateKernelOracle
|
|
141
|
+
async build(oracle: PrivateKernelOracle) {
|
|
145
142
|
if (privateKernelResetDimensionNames.every(name => !this.requestedDimensions[name])) {
|
|
146
143
|
throw new Error('Reset is not required.');
|
|
147
144
|
}
|
|
@@ -160,16 +157,6 @@ export class PrivateKernelResetPrivateInputsBuilder {
|
|
|
160
157
|
allowRemainder,
|
|
161
158
|
);
|
|
162
159
|
|
|
163
|
-
const previousVkMembershipWitness = await oracle.getVkMembershipWitness(
|
|
164
|
-
this.previousKernelOutput.verificationKey.keyAsFields,
|
|
165
|
-
);
|
|
166
|
-
const vkData = new VkData(
|
|
167
|
-
this.previousKernelOutput.verificationKey,
|
|
168
|
-
Number(previousVkMembershipWitness.leafIndex),
|
|
169
|
-
previousVkMembershipWitness.siblingPath,
|
|
170
|
-
);
|
|
171
|
-
const previousKernelData = new PrivateKernelData(this.previousKernelOutput.publicInputs, vkData);
|
|
172
|
-
|
|
173
160
|
this.reduceReadRequestActions(
|
|
174
161
|
this.noteHashResetActions,
|
|
175
162
|
dimensions.NOTE_HASH_PENDING_READ,
|
|
@@ -181,32 +168,52 @@ export class PrivateKernelResetPrivateInputsBuilder {
|
|
|
181
168
|
dimensions.NULLIFIER_SETTLED_READ,
|
|
182
169
|
);
|
|
183
170
|
|
|
184
|
-
//
|
|
185
|
-
const
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
171
|
+
// Execute all the expensive node querying operations in parallel.
|
|
172
|
+
const [previousVkMembershipWitness, noteHashReadRequestHints, nullifierReadRequestHints, keyValidationHints] =
|
|
173
|
+
await Promise.all([
|
|
174
|
+
oracle.getVkMembershipWitness(this.previousKernelOutput.verificationKey.keyAsFields),
|
|
175
|
+
buildNoteHashReadRequestHintsFromResetActions<
|
|
176
|
+
typeof MAX_NOTE_HASH_READ_REQUESTS_PER_TX,
|
|
177
|
+
typeof MAX_NOTE_HASH_READ_REQUESTS_PER_TX
|
|
178
|
+
>(
|
|
192
179
|
oracle,
|
|
193
180
|
this.previousKernel.validationRequests.noteHashReadRequests,
|
|
194
181
|
this.previousKernel.end.noteHashes,
|
|
195
182
|
this.noteHashResetActions,
|
|
196
|
-
noteHashLeafIndexMap,
|
|
197
183
|
),
|
|
198
|
-
|
|
184
|
+
buildNullifierReadRequestHintsFromResetActions<
|
|
185
|
+
typeof MAX_NULLIFIER_READ_REQUESTS_PER_TX,
|
|
186
|
+
typeof MAX_NULLIFIER_READ_REQUESTS_PER_TX
|
|
187
|
+
>(
|
|
199
188
|
{ getNullifierMembershipWitness: getNullifierMembershipWitnessResolver(oracle) },
|
|
200
189
|
this.previousKernel.validationRequests.nullifierReadRequests,
|
|
201
190
|
this.nullifierResetActions,
|
|
202
191
|
),
|
|
203
|
-
|
|
204
|
-
this.previousKernel.validationRequests.
|
|
192
|
+
getMasterSecretKeysAndKeyTypeDomainSeparators(
|
|
193
|
+
this.previousKernel.validationRequests.scopedKeyValidationRequestsAndSeparators,
|
|
205
194
|
dimensions.KEY_VALIDATION,
|
|
206
195
|
oracle,
|
|
207
196
|
),
|
|
197
|
+
]);
|
|
198
|
+
|
|
199
|
+
const vkData = new VkData(
|
|
200
|
+
this.previousKernelOutput.verificationKey,
|
|
201
|
+
Number(previousVkMembershipWitness.leafIndex),
|
|
202
|
+
previousVkMembershipWitness.siblingPath,
|
|
203
|
+
);
|
|
204
|
+
const previousKernelData = new PrivateKernelData(this.previousKernelOutput.publicInputs, vkData);
|
|
205
|
+
|
|
206
|
+
// TODO: Enable padding when we have a better idea what are the final amounts we should pad to.
|
|
207
|
+
const paddedSideEffects = PaddedSideEffects.empty();
|
|
208
|
+
|
|
209
|
+
return new PrivateKernelResetCircuitPrivateInputs(
|
|
210
|
+
previousKernelData,
|
|
211
|
+
paddedSideEffects,
|
|
212
|
+
new PrivateKernelResetHints(
|
|
213
|
+
noteHashReadRequestHints,
|
|
214
|
+
nullifierReadRequestHints,
|
|
215
|
+
keyValidationHints,
|
|
208
216
|
this.transientDataSquashingHints,
|
|
209
|
-
this.validationRequestsSplitCounter,
|
|
210
217
|
),
|
|
211
218
|
dimensions,
|
|
212
219
|
);
|
|
@@ -350,8 +357,8 @@ export class PrivateKernelResetPrivateInputsBuilder {
|
|
|
350
357
|
}
|
|
351
358
|
|
|
352
359
|
private needsResetNullifierKeys() {
|
|
353
|
-
const numCurr = this.previousKernel.validationRequests.
|
|
354
|
-
const numNext = this.nextIteration ? this.nextIteration.
|
|
360
|
+
const numCurr = this.previousKernel.validationRequests.scopedKeyValidationRequestsAndSeparators.claimedLength;
|
|
361
|
+
const numNext = this.nextIteration ? this.nextIteration.keyValidationRequestsAndSeparators.claimedLength : 0;
|
|
355
362
|
const maxAmountToKeep = !this.nextIteration ? 0 : MAX_KEY_VALIDATION_REQUESTS_PER_TX;
|
|
356
363
|
if (numCurr + numNext <= maxAmountToKeep) {
|
|
357
364
|
return false;
|
|
@@ -403,7 +410,7 @@ export class PrivateKernelResetPrivateInputsBuilder {
|
|
|
403
410
|
futureNoteHashReads,
|
|
404
411
|
futureNullifierReads,
|
|
405
412
|
this.noteHashNullifierCounterMap,
|
|
406
|
-
this.
|
|
413
|
+
this.splitCounter,
|
|
407
414
|
);
|
|
408
415
|
|
|
409
416
|
if (this.nextIteration && !numTransientData) {
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import { vkAsFieldsMegaHonk } from '@aztec/foundation/crypto';
|
|
2
|
-
import { Fr } from '@aztec/foundation/
|
|
3
|
-
import { createLogger } from '@aztec/foundation/log';
|
|
1
|
+
import { vkAsFieldsMegaHonk } from '@aztec/foundation/crypto/keys';
|
|
2
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
|
+
import { type Logger, type LoggerBindings, createLogger } from '@aztec/foundation/log';
|
|
4
4
|
import { pushTestData } from '@aztec/foundation/testing';
|
|
5
5
|
import { Timer } from '@aztec/foundation/timer';
|
|
6
6
|
import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
|
|
7
|
-
import {
|
|
7
|
+
import { ProtocolContractsList } from '@aztec/protocol-contracts';
|
|
8
8
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
9
|
-
import { computeContractAddressFromInstance } from '@aztec/stdlib/contract';
|
|
10
9
|
import type { PrivateKernelProver } from '@aztec/stdlib/interfaces/client';
|
|
11
10
|
import {
|
|
12
11
|
HidingKernelToPublicPrivateInputs,
|
|
@@ -24,18 +23,17 @@ import {
|
|
|
24
23
|
type PrivateKernelTailCircuitPublicInputs,
|
|
25
24
|
PrivateVerificationKeyHints,
|
|
26
25
|
} from '@aztec/stdlib/kernel';
|
|
27
|
-
import {
|
|
26
|
+
import { ChonkProof, ChonkProofWithPublicInputs } from '@aztec/stdlib/proofs';
|
|
28
27
|
import {
|
|
29
28
|
type PrivateCallExecutionResult,
|
|
30
29
|
type PrivateExecutionResult,
|
|
31
30
|
TxRequest,
|
|
32
|
-
collectNoteHashLeafIndexMap,
|
|
33
31
|
collectNoteHashNullifierCounterMap,
|
|
34
32
|
getFinalMinRevertibleSideEffectCounter,
|
|
35
33
|
} from '@aztec/stdlib/tx';
|
|
36
34
|
import { VerificationKeyAsFields, VerificationKeyData, VkData } from '@aztec/stdlib/vks';
|
|
37
35
|
|
|
38
|
-
import { PrivateKernelResetPrivateInputsBuilder } from './hints/
|
|
36
|
+
import { PrivateKernelResetPrivateInputsBuilder } from './hints/private_kernel_reset_private_inputs_builder.js';
|
|
39
37
|
import type { PrivateKernelOracle } from './private_kernel_oracle.js';
|
|
40
38
|
|
|
41
39
|
const NULL_SIMULATE_OUTPUT: PrivateKernelSimulateOutput<PrivateKernelCircuitPublicInputs> = {
|
|
@@ -54,17 +52,20 @@ export interface PrivateKernelExecutionProverConfig {
|
|
|
54
52
|
/**
|
|
55
53
|
* The PrivateKernelExecutionProver class is responsible for taking a transaction request and sequencing the
|
|
56
54
|
* the execution of the private functions within, sequenced with private kernel "glue" to check protocol rules.
|
|
57
|
-
* The result can be a
|
|
55
|
+
* The result can be a chonk proof of the private transaction portion, or just a simulation that can e.g.
|
|
58
56
|
* inform state tree updates.
|
|
59
57
|
*/
|
|
60
58
|
export class PrivateKernelExecutionProver {
|
|
61
|
-
private log
|
|
59
|
+
private log: Logger;
|
|
62
60
|
|
|
63
61
|
constructor(
|
|
64
62
|
private oracle: PrivateKernelOracle,
|
|
65
63
|
private proofCreator: PrivateKernelProver,
|
|
66
64
|
private fakeProofs = false,
|
|
67
|
-
|
|
65
|
+
bindings?: LoggerBindings,
|
|
66
|
+
) {
|
|
67
|
+
this.log = createLogger('pxe:private-kernel-execution-prover', bindings);
|
|
68
|
+
}
|
|
68
69
|
|
|
69
70
|
/**
|
|
70
71
|
* Generate a proof for a given transaction request and execution result.
|
|
@@ -102,11 +103,9 @@ export class PrivateKernelExecutionProver {
|
|
|
102
103
|
|
|
103
104
|
const executionSteps: PrivateExecutionStep[] = [];
|
|
104
105
|
|
|
105
|
-
const noteHashLeafIndexMap = collectNoteHashLeafIndexMap(executionResult);
|
|
106
106
|
const noteHashNullifierCounterMap = collectNoteHashNullifierCounterMap(executionResult);
|
|
107
|
-
const
|
|
108
|
-
|
|
109
|
-
: getFinalMinRevertibleSideEffectCounter(executionResult);
|
|
107
|
+
const minRevertibleSideEffectCounter = getFinalMinRevertibleSideEffectCounter(executionResult);
|
|
108
|
+
const splitCounter = isPrivateOnlyTx ? 0 : minRevertibleSideEffectCounter;
|
|
110
109
|
|
|
111
110
|
while (executionStack.length) {
|
|
112
111
|
if (!firstIteration) {
|
|
@@ -114,11 +113,11 @@ export class PrivateKernelExecutionProver {
|
|
|
114
113
|
output,
|
|
115
114
|
executionStack,
|
|
116
115
|
noteHashNullifierCounterMap,
|
|
117
|
-
|
|
116
|
+
splitCounter,
|
|
118
117
|
);
|
|
119
118
|
while (resetBuilder.needsReset()) {
|
|
120
119
|
const witgenTimer = new Timer();
|
|
121
|
-
const privateInputs = await resetBuilder.build(this.oracle
|
|
120
|
+
const privateInputs = await resetBuilder.build(this.oracle);
|
|
122
121
|
output = generateWitnesses
|
|
123
122
|
? await this.proofCreator.generateResetOutput(privateInputs)
|
|
124
123
|
: await this.proofCreator.simulateReset(privateInputs);
|
|
@@ -135,7 +134,7 @@ export class PrivateKernelExecutionProver {
|
|
|
135
134
|
output,
|
|
136
135
|
executionStack,
|
|
137
136
|
noteHashNullifierCounterMap,
|
|
138
|
-
|
|
137
|
+
splitCounter,
|
|
139
138
|
);
|
|
140
139
|
}
|
|
141
140
|
}
|
|
@@ -168,10 +167,11 @@ export class PrivateKernelExecutionProver {
|
|
|
168
167
|
const proofInput = new PrivateKernelInitCircuitPrivateInputs(
|
|
169
168
|
txRequest,
|
|
170
169
|
getVKTreeRoot(),
|
|
171
|
-
|
|
170
|
+
ProtocolContractsList,
|
|
172
171
|
privateCallData,
|
|
173
172
|
isPrivateOnlyTx,
|
|
174
173
|
executionResult.firstNullifier,
|
|
174
|
+
minRevertibleSideEffectCounter,
|
|
175
175
|
);
|
|
176
176
|
this.log.debug(
|
|
177
177
|
`Calling private kernel init with isPrivateOnly ${isPrivateOnlyTx} and firstNullifierHint ${proofInput.firstNullifierHint}`,
|
|
@@ -221,11 +221,11 @@ export class PrivateKernelExecutionProver {
|
|
|
221
221
|
output,
|
|
222
222
|
[],
|
|
223
223
|
noteHashNullifierCounterMap,
|
|
224
|
-
|
|
224
|
+
splitCounter,
|
|
225
225
|
);
|
|
226
226
|
while (resetBuilder.needsReset()) {
|
|
227
227
|
const witgenTimer = new Timer();
|
|
228
|
-
const privateInputs = await resetBuilder.build(this.oracle
|
|
228
|
+
const privateInputs = await resetBuilder.build(this.oracle);
|
|
229
229
|
output = generateWitnesses
|
|
230
230
|
? await this.proofCreator.generateResetOutput(privateInputs)
|
|
231
231
|
: await this.proofCreator.simulateReset(privateInputs);
|
|
@@ -240,12 +240,7 @@ export class PrivateKernelExecutionProver {
|
|
|
240
240
|
},
|
|
241
241
|
});
|
|
242
242
|
|
|
243
|
-
resetBuilder = new PrivateKernelResetPrivateInputsBuilder(
|
|
244
|
-
output,
|
|
245
|
-
[],
|
|
246
|
-
noteHashNullifierCounterMap,
|
|
247
|
-
validationRequestsSplitCounter,
|
|
248
|
-
);
|
|
243
|
+
resetBuilder = new PrivateKernelResetPrivateInputsBuilder(output, [], noteHashNullifierCounterMap, splitCounter);
|
|
249
244
|
}
|
|
250
245
|
|
|
251
246
|
if (output.publicInputs.feePayer.isZero() && skipFeeEnforcement) {
|
|
@@ -265,24 +260,22 @@ export class PrivateKernelExecutionProver {
|
|
|
265
260
|
// TODO: Enable padding once we better understand the final amounts to pad to.
|
|
266
261
|
const paddedSideEffectAmounts = PaddedSideEffectAmounts.empty();
|
|
267
262
|
|
|
268
|
-
// Use the aggregated
|
|
269
|
-
// TODO: Call `
|
|
270
|
-
const
|
|
271
|
-
const
|
|
272
|
-
if (
|
|
263
|
+
// Use the aggregated expirationTimestamp set throughout the tx execution.
|
|
264
|
+
// TODO: Call `computeTxExpirationTimestamp` to round the value down and reduce precision, improving privacy.
|
|
265
|
+
const expirationTimestampUpperBound = previousKernelData.publicInputs.expirationTimestamp;
|
|
266
|
+
const anchorBlockTimestamp = previousKernelData.publicInputs.constants.anchorBlockHeader.globalVariables.timestamp;
|
|
267
|
+
if (expirationTimestampUpperBound <= anchorBlockTimestamp) {
|
|
273
268
|
throw new Error(
|
|
274
|
-
`Include-by timestamp must be greater than the
|
|
269
|
+
`Include-by timestamp must be greater than the anchor block timestamp. Anchor block timestamp: ${anchorBlockTimestamp}. Include-by timestamp: ${expirationTimestampUpperBound}.`,
|
|
275
270
|
);
|
|
276
271
|
}
|
|
277
272
|
|
|
278
273
|
const privateInputs = new PrivateKernelTailCircuitPrivateInputs(
|
|
279
274
|
previousKernelData,
|
|
280
275
|
paddedSideEffectAmounts,
|
|
281
|
-
|
|
276
|
+
expirationTimestampUpperBound,
|
|
282
277
|
);
|
|
283
278
|
|
|
284
|
-
pushTestData('private-kernel-inputs-ordering', privateInputs);
|
|
285
|
-
|
|
286
279
|
const witgenTimer = new Timer();
|
|
287
280
|
const tailOutput = generateWitnesses
|
|
288
281
|
? await this.proofCreator.generateTailOutput(privateInputs)
|
|
@@ -298,8 +291,8 @@ export class PrivateKernelExecutionProver {
|
|
|
298
291
|
},
|
|
299
292
|
});
|
|
300
293
|
|
|
301
|
-
// Hiding
|
|
302
|
-
// For simulation, we can end with the tail, since the
|
|
294
|
+
// Hiding kernel is only executed if we are generating witnesses.
|
|
295
|
+
// For simulation, we can end with the tail, since the Hiding kernel will simply return the same tail output.
|
|
303
296
|
if (generateWitnesses) {
|
|
304
297
|
const previousKernelVkData = await this.getVkData(tailOutput.verificationKey);
|
|
305
298
|
|
|
@@ -350,25 +343,53 @@ export class PrivateKernelExecutionProver {
|
|
|
350
343
|
this.log.info(`Private kernel witness generation took ${timer.ms()}ms`);
|
|
351
344
|
}
|
|
352
345
|
|
|
353
|
-
let
|
|
346
|
+
let chonkProof: ChonkProof;
|
|
354
347
|
// TODO(#7368) how do we 'bincode' encode these inputs?
|
|
355
348
|
let provingTime;
|
|
356
349
|
if (!skipProofGeneration) {
|
|
357
350
|
const provingTimer = new Timer();
|
|
358
|
-
|
|
351
|
+
const proofWithPublicInputs = await this.proofCreator.createChonkProof(executionSteps);
|
|
359
352
|
provingTime = provingTimer.ms();
|
|
353
|
+
this.ensurePublicInputsMatch(proofWithPublicInputs, tailOutput.publicInputs);
|
|
354
|
+
chonkProof = proofWithPublicInputs.removePublicInputs();
|
|
360
355
|
} else {
|
|
361
|
-
|
|
356
|
+
chonkProof = ChonkProof.random();
|
|
362
357
|
}
|
|
363
358
|
|
|
364
359
|
return {
|
|
365
360
|
publicInputs: tailOutput.publicInputs,
|
|
366
361
|
executionSteps,
|
|
367
|
-
|
|
362
|
+
chonkProof,
|
|
368
363
|
timings: provingTime ? { proving: provingTime } : undefined,
|
|
369
364
|
};
|
|
370
365
|
}
|
|
371
366
|
|
|
367
|
+
/**
|
|
368
|
+
* Checks that the public inputs of the chonk proof match the public inputs of the tail circuit.
|
|
369
|
+
* This can only mismatch if there is a circuit / noir / bb bug.
|
|
370
|
+
* @param chonkProof - The chonk proof with public inputs.
|
|
371
|
+
* @param tailPublicInputs - The public inputs resulting from witness generation of the tail circuit.
|
|
372
|
+
*/
|
|
373
|
+
private ensurePublicInputsMatch(
|
|
374
|
+
chonkProof: ChonkProofWithPublicInputs,
|
|
375
|
+
tailPublicInputs: PrivateKernelTailCircuitPublicInputs,
|
|
376
|
+
) {
|
|
377
|
+
const serializedChonkProofPublicInputs = chonkProof.getPublicInputs();
|
|
378
|
+
const serializedTailPublicInputs = tailPublicInputs.publicInputs().toFields();
|
|
379
|
+
if (serializedChonkProofPublicInputs.length !== serializedTailPublicInputs.length) {
|
|
380
|
+
throw new Error(
|
|
381
|
+
`Public inputs length mismatch: ${serializedChonkProofPublicInputs.length} !== ${serializedTailPublicInputs.length}`,
|
|
382
|
+
);
|
|
383
|
+
}
|
|
384
|
+
if (
|
|
385
|
+
!serializedChonkProofPublicInputs.every((input: Fr, index: number) =>
|
|
386
|
+
input.equals(serializedTailPublicInputs[index]),
|
|
387
|
+
)
|
|
388
|
+
) {
|
|
389
|
+
throw new Error(`Public inputs mismatch between kernel and chonk proof`);
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
|
|
372
393
|
private async getVkData(verificationKey: VerificationKeyData) {
|
|
373
394
|
const previousVkMembershipWitness = await this.oracle.getVkMembershipWitness(verificationKey.keyAsFields);
|
|
374
395
|
return new VkData(
|
|
@@ -394,18 +415,8 @@ export class PrivateKernelExecutionProver {
|
|
|
394
415
|
const { artifactHash: contractClassArtifactHash, publicBytecodeCommitment: contractClassPublicBytecodeCommitment } =
|
|
395
416
|
await this.oracle.getContractClassIdPreimage(currentContractClassId);
|
|
396
417
|
|
|
397
|
-
// This will be the address computed in the kernel by the executed class. We need to provide non membership of it in the protocol contract tree.
|
|
398
|
-
// This would only be equal to contractAddress if the currentClassId is equal to the original class id (no update happened).
|
|
399
|
-
const computedAddress = await computeContractAddressFromInstance({
|
|
400
|
-
originalContractClassId: currentContractClassId,
|
|
401
|
-
saltedInitializationHash,
|
|
402
|
-
publicKeys,
|
|
403
|
-
});
|
|
404
|
-
|
|
405
|
-
const { lowLeaf: protocolContractLeaf, witness: protocolContractMembershipWitness } =
|
|
406
|
-
await getProtocolContractLeafAndMembershipWitness(contractAddress, computedAddress);
|
|
407
|
-
|
|
408
418
|
const updatedClassIdHints = await this.oracle.getUpdatedClassIdHints(contractAddress);
|
|
419
|
+
|
|
409
420
|
return PrivateCallData.from({
|
|
410
421
|
publicInputs,
|
|
411
422
|
vk,
|
|
@@ -415,8 +426,6 @@ export class PrivateKernelExecutionProver {
|
|
|
415
426
|
contractClassPublicBytecodeCommitment,
|
|
416
427
|
saltedInitializationHash,
|
|
417
428
|
functionLeafMembershipWitness,
|
|
418
|
-
protocolContractMembershipWitness,
|
|
419
|
-
protocolContractLeaf,
|
|
420
429
|
updatedClassIdHints,
|
|
421
430
|
}),
|
|
422
431
|
});
|
|
@@ -1,71 +1,152 @@
|
|
|
1
|
-
import { FUNCTION_TREE_HEIGHT, NOTE_HASH_TREE_HEIGHT, VK_TREE_HEIGHT } from '@aztec/constants';
|
|
2
|
-
import type { Fr
|
|
1
|
+
import { FUNCTION_TREE_HEIGHT, NOTE_HASH_TREE_HEIGHT, PUBLIC_DATA_TREE_HEIGHT, VK_TREE_HEIGHT } from '@aztec/constants';
|
|
2
|
+
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
|
+
import type { GrumpkinScalar, Point } from '@aztec/foundation/curves/grumpkin';
|
|
3
4
|
import { MembershipWitness } from '@aztec/foundation/trees';
|
|
5
|
+
import type { KeyStore } from '@aztec/key-store';
|
|
6
|
+
import { getVKIndex, getVKSiblingPath } from '@aztec/noir-protocol-circuits-types/vk-tree';
|
|
7
|
+
import { ProtocolContractAddress } from '@aztec/protocol-contracts';
|
|
4
8
|
import type { FunctionSelector } from '@aztec/stdlib/abi';
|
|
5
9
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
10
|
+
import { BlockHash } from '@aztec/stdlib/block';
|
|
11
|
+
import { type ContractInstanceWithAddress, computeSaltedInitializationHash } from '@aztec/stdlib/contract';
|
|
12
|
+
import { DelayedPublicMutableValues, DelayedPublicMutableValuesWithHash } from '@aztec/stdlib/delayed-public-mutable';
|
|
13
|
+
import { computePublicDataTreeLeafSlot } from '@aztec/stdlib/hash';
|
|
14
|
+
import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
6
15
|
import { UpdatedClassIdHints } from '@aztec/stdlib/kernel';
|
|
7
|
-
import type { PublicKeys } from '@aztec/stdlib/keys';
|
|
8
16
|
import type { NullifierMembershipWitness } from '@aztec/stdlib/trees';
|
|
9
17
|
import type { VerificationKeyAsFields } from '@aztec/stdlib/vks';
|
|
10
18
|
|
|
19
|
+
import type { ContractStore } from '../storage/contract_store/contract_store.js';
|
|
20
|
+
|
|
11
21
|
/**
|
|
12
22
|
* Provides functionality needed by the private kernel for interacting with our state trees.
|
|
13
|
-
* This is either PrivateKernelOracleImpl, or a mocked test implementation.
|
|
14
23
|
*/
|
|
15
|
-
export
|
|
24
|
+
export class PrivateKernelOracle {
|
|
25
|
+
constructor(
|
|
26
|
+
private contractStore: ContractStore,
|
|
27
|
+
private keyStore: KeyStore,
|
|
28
|
+
private node: AztecNode,
|
|
29
|
+
private blockHash: BlockHash,
|
|
30
|
+
) {}
|
|
31
|
+
|
|
16
32
|
/** Retrieves the preimage of a contract address from the registered contract instances db. */
|
|
17
|
-
getContractAddressPreimage(
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
33
|
+
public async getContractAddressPreimage(
|
|
34
|
+
address: AztecAddress,
|
|
35
|
+
): Promise<ContractInstanceWithAddress & { saltedInitializationHash: Fr }> {
|
|
36
|
+
const instance = await this.contractStore.getContractInstance(address);
|
|
37
|
+
if (!instance) {
|
|
38
|
+
throw new Error(`Contract instance not found when getting address preimage. Contract address: ${address}.`);
|
|
39
|
+
}
|
|
40
|
+
return {
|
|
41
|
+
saltedInitializationHash: await computeSaltedInitializationHash(instance),
|
|
42
|
+
...instance,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
23
45
|
|
|
24
46
|
/** Retrieves the preimage of a contract class id from the contract classes db. */
|
|
25
|
-
getContractClassIdPreimage(
|
|
26
|
-
contractClassId
|
|
27
|
-
|
|
47
|
+
public async getContractClassIdPreimage(contractClassId: Fr) {
|
|
48
|
+
const contractClass = await this.contractStore.getContractClassWithPreimage(contractClassId);
|
|
49
|
+
if (!contractClass) {
|
|
50
|
+
throw new Error(`Contract class not found when getting class id preimage. Class id: ${contractClassId}.`);
|
|
51
|
+
}
|
|
52
|
+
return {
|
|
53
|
+
artifactHash: contractClass.artifactHash,
|
|
54
|
+
privateFunctionsRoot: contractClass.privateFunctionsRoot,
|
|
55
|
+
publicBytecodeCommitment: contractClass.publicBytecodeCommitment,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
28
58
|
|
|
29
|
-
/**
|
|
30
|
-
|
|
31
|
-
*/
|
|
32
|
-
getFunctionMembershipWitness(
|
|
59
|
+
/** Returns a membership witness with the sibling path and leaf index in our private functions tree. */
|
|
60
|
+
public async getFunctionMembershipWitness(
|
|
33
61
|
contractClassId: Fr,
|
|
34
62
|
selector: FunctionSelector,
|
|
35
|
-
): Promise<MembershipWitness<typeof FUNCTION_TREE_HEIGHT
|
|
63
|
+
): Promise<MembershipWitness<typeof FUNCTION_TREE_HEIGHT>> {
|
|
64
|
+
const membershipWitness = await this.contractStore.getFunctionMembershipWitness(contractClassId, selector);
|
|
65
|
+
if (!membershipWitness) {
|
|
66
|
+
throw new Error(
|
|
67
|
+
`Membership witness not found for contract class id ${contractClassId} and selector ${selector}.`,
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
return membershipWitness;
|
|
71
|
+
}
|
|
36
72
|
|
|
37
73
|
/**
|
|
38
74
|
* Returns a membership witness with the sibling path and leaf index in our protocol VK indexed merkle tree.
|
|
39
75
|
* Used to validate the previous kernel's verification key.
|
|
40
76
|
*/
|
|
41
|
-
getVkMembershipWitness(vk: VerificationKeyAsFields): Promise<MembershipWitness<typeof VK_TREE_HEIGHT
|
|
77
|
+
public getVkMembershipWitness(vk: VerificationKeyAsFields): Promise<MembershipWitness<typeof VK_TREE_HEIGHT>> {
|
|
78
|
+
const leafIndex = getVKIndex(vk);
|
|
79
|
+
return Promise.resolve(new MembershipWitness(VK_TREE_HEIGHT, BigInt(leafIndex), getVKSiblingPath(leafIndex)));
|
|
80
|
+
}
|
|
42
81
|
|
|
43
|
-
/**
|
|
44
|
-
|
|
45
|
-
|
|
82
|
+
/** Returns a membership witness with the sibling path and leaf index in our note hash tree. */
|
|
83
|
+
getNoteHashMembershipWitness(noteHash: Fr): Promise<MembershipWitness<typeof NOTE_HASH_TREE_HEIGHT> | undefined> {
|
|
84
|
+
return this.node.getNoteHashMembershipWitness(this.blockHash, noteHash);
|
|
85
|
+
}
|
|
46
86
|
|
|
47
|
-
/**
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
87
|
+
/** Returns a membership witness with the sibling path and leaf index in our nullifier indexed merkle tree. */
|
|
88
|
+
getNullifierMembershipWitness(nullifier: Fr): Promise<NullifierMembershipWitness | undefined> {
|
|
89
|
+
return this.node.getNullifierMembershipWitness(this.blockHash, nullifier);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/** Returns the root of our note hash merkle tree. */
|
|
93
|
+
async getNoteHashTreeRoot(): Promise<Fr> {
|
|
94
|
+
const header = await this.node.getBlockHeader(this.blockHash);
|
|
95
|
+
if (!header) {
|
|
96
|
+
throw new Error(`No block header found for block hash ${this.blockHash}`);
|
|
97
|
+
}
|
|
98
|
+
return header.state.partial.noteHashTree.root;
|
|
99
|
+
}
|
|
55
100
|
|
|
56
101
|
/**
|
|
57
102
|
* Retrieves the sk_m corresponding to the pk_m.
|
|
58
103
|
* @throws If the provided public key is not associated with any of the registered accounts.
|
|
59
|
-
* @param
|
|
104
|
+
* @param masterPublicKey - The master public key to get secret key for.
|
|
60
105
|
* @returns A Promise that resolves to sk_m.
|
|
61
106
|
* @dev Used when feeding the sk_m to the kernel circuit for keys verification.
|
|
62
107
|
*/
|
|
63
|
-
getMasterSecretKey(masterPublicKey: Point): Promise<GrumpkinScalar
|
|
108
|
+
public getMasterSecretKey(masterPublicKey: Point): Promise<GrumpkinScalar> {
|
|
109
|
+
return this.keyStore.getMasterSecretKey(masterPublicKey);
|
|
110
|
+
}
|
|
64
111
|
|
|
65
112
|
/** Use debug data to get the function name corresponding to a selector. */
|
|
66
|
-
getDebugFunctionName(contractAddress: AztecAddress, selector: FunctionSelector): Promise<string | undefined
|
|
113
|
+
public getDebugFunctionName(contractAddress: AztecAddress, selector: FunctionSelector): Promise<string | undefined> {
|
|
114
|
+
return this.contractStore.getDebugFunctionName(contractAddress, selector);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Returns a membership witness and leaf index to our public data indexed merkle tree,
|
|
119
|
+
* along with an associated DelayedPublicMutable containing the class ID to update.
|
|
120
|
+
*/
|
|
121
|
+
public async getUpdatedClassIdHints(contractAddress: AztecAddress): Promise<UpdatedClassIdHints> {
|
|
122
|
+
const { delayedPublicMutableSlot, delayedPublicMutableHashSlot } =
|
|
123
|
+
await DelayedPublicMutableValuesWithHash.getContractUpdateSlots(contractAddress);
|
|
124
|
+
|
|
125
|
+
const hashLeafSlot = await computePublicDataTreeLeafSlot(
|
|
126
|
+
ProtocolContractAddress.ContractInstanceRegistry,
|
|
127
|
+
delayedPublicMutableHashSlot,
|
|
128
|
+
);
|
|
129
|
+
const updatedClassIdWitness = await this.node.getPublicDataWitness(this.blockHash, hashLeafSlot);
|
|
130
|
+
|
|
131
|
+
if (!updatedClassIdWitness) {
|
|
132
|
+
throw new Error(`No public data tree witness found for ${hashLeafSlot}`);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
const readStorage = (storageSlot: Fr) =>
|
|
136
|
+
this.node.getPublicStorageAt(this.blockHash, ProtocolContractAddress.ContractInstanceRegistry, storageSlot);
|
|
137
|
+
const delayedPublicMutableValues = await DelayedPublicMutableValues.readFromTree(
|
|
138
|
+
delayedPublicMutableSlot,
|
|
139
|
+
readStorage,
|
|
140
|
+
);
|
|
67
141
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
142
|
+
return new UpdatedClassIdHints(
|
|
143
|
+
new MembershipWitness(
|
|
144
|
+
PUBLIC_DATA_TREE_HEIGHT,
|
|
145
|
+
updatedClassIdWitness.index,
|
|
146
|
+
updatedClassIdWitness.siblingPath.toTuple(),
|
|
147
|
+
),
|
|
148
|
+
updatedClassIdWitness.leafPreimage,
|
|
149
|
+
delayedPublicMutableValues,
|
|
150
|
+
);
|
|
151
|
+
}
|
|
71
152
|
}
|