@aztec/pxe 0.0.0-test.1 → 0.0.1-commit.1142ef1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -5
- package/dest/bin/check_oracle_version.d.ts +2 -0
- package/dest/bin/check_oracle_version.d.ts.map +1 -0
- package/dest/bin/check_oracle_version.js +129 -0
- package/dest/block_synchronizer/block_synchronizer.d.ts +39 -0
- package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -0
- package/dest/{synchronizer/synchronizer.js → block_synchronizer/block_synchronizer.js} +34 -35
- 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 -24
- package/dest/config/index.d.ts.map +1 -1
- package/dest/config/index.js +18 -33
- package/dest/config/package_info.d.ts +1 -1
- package/dest/config/package_info.js +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.d.ts +86 -0
- package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -0
- package/dest/contract_function_simulator/contract_function_simulator.js +331 -0
- package/dest/contract_function_simulator/execution_note_cache.d.ts +95 -0
- package/dest/contract_function_simulator/execution_note_cache.d.ts.map +1 -0
- package/dest/contract_function_simulator/execution_note_cache.js +191 -0
- 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 +28 -0
- package/dest/contract_function_simulator/hashed_values_cache.d.ts.map +1 -0
- package/dest/contract_function_simulator/hashed_values_cache.js +36 -0
- package/dest/contract_function_simulator/index.d.ts +14 -0
- package/dest/contract_function_simulator/index.d.ts.map +1 -0
- package/dest/contract_function_simulator/index.js +12 -0
- package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts +21 -0
- package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/event_validation_request.js +40 -0
- package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts +16 -0
- package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/log_retrieval_request.js +26 -0
- package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts +17 -0
- package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/log_retrieval_response.js +65 -0
- package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +24 -0
- package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/note_validation_request.js +51 -0
- package/dest/contract_function_simulator/noir-structs/utility_context.d.ts +22 -0
- package/dest/contract_function_simulator/noir-structs/utility_context.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/utility_context.js +33 -0
- package/dest/contract_function_simulator/oracle/index.d.ts +14 -0
- package/dest/contract_function_simulator/oracle/index.d.ts.map +1 -0
- package/dest/contract_function_simulator/oracle/index.js +2 -0
- package/dest/contract_function_simulator/oracle/interfaces.d.ts +103 -0
- package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -0
- package/dest/contract_function_simulator/oracle/interfaces.js +4 -0
- package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts +17 -0
- package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts.map +1 -0
- package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.js +24 -0
- package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts +28 -0
- package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts.map +1 -0
- package/dest/contract_function_simulator/oracle/note_packing_utils.js +54 -0
- package/dest/contract_function_simulator/oracle/oracle.d.ts +58 -0
- package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -0
- package/dest/contract_function_simulator/oracle/oracle.js +345 -0
- package/dest/contract_function_simulator/oracle/private_execution.d.ts +47 -0
- package/dest/contract_function_simulator/oracle/private_execution.d.ts.map +1 -0
- package/dest/contract_function_simulator/oracle/private_execution.js +122 -0
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +231 -0
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -0
- package/dest/contract_function_simulator/oracle/private_execution_oracle.js +414 -0
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +196 -0
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -0
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +374 -0
- package/dest/contract_function_simulator/pick_notes.d.ts +85 -0
- package/dest/contract_function_simulator/pick_notes.d.ts.map +1 -0
- package/dest/contract_function_simulator/pick_notes.js +51 -0
- package/dest/contract_function_simulator/proxied_contract_data_source.d.ts +6 -0
- package/dest/contract_function_simulator/proxied_contract_data_source.d.ts.map +1 -0
- package/dest/contract_function_simulator/proxied_contract_data_source.js +80 -0
- package/dest/contract_function_simulator/proxied_node.d.ts +9 -0
- package/dest/contract_function_simulator/proxied_node.d.ts.map +1 -0
- package/dest/contract_function_simulator/proxied_node.js +27 -0
- package/dest/debug/pxe_debug_utils.d.ts +31 -0
- package/dest/debug/pxe_debug_utils.d.ts.map +1 -0
- package/dest/debug/pxe_debug_utils.js +37 -0
- package/dest/entrypoints/client/bundle/index.d.ts +4 -3
- package/dest/entrypoints/client/bundle/index.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/index.js +2 -2
- package/dest/entrypoints/client/bundle/utils.d.ts +10 -10
- package/dest/entrypoints/client/bundle/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/utils.js +27 -12
- package/dest/entrypoints/client/lazy/index.d.ts +4 -3
- package/dest/entrypoints/client/lazy/index.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/index.js +2 -2
- package/dest/entrypoints/client/lazy/utils.d.ts +9 -9
- package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/utils.js +26 -11
- package/dest/entrypoints/pxe_creation_options.d.ts +17 -0
- package/dest/entrypoints/pxe_creation_options.d.ts.map +1 -0
- package/dest/entrypoints/server/index.d.ts +6 -4
- package/dest/entrypoints/server/index.d.ts.map +1 -1
- package/dest/entrypoints/server/index.js +4 -3
- package/dest/entrypoints/server/utils.d.ts +8 -16
- package/dest/entrypoints/server/utils.d.ts.map +1 -1
- package/dest/entrypoints/server/utils.js +35 -36
- 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} +30 -22
- package/dest/events/event_service.d.ts +15 -0
- package/dest/events/event_service.d.ts.map +1 -0
- package/dest/events/event_service.js +47 -0
- package/dest/events/index.d.ts +2 -0
- package/dest/events/index.d.ts.map +1 -0
- package/dest/events/index.js +1 -0
- package/dest/events/private_event_filter_validator.d.ts +9 -0
- package/dest/events/private_event_filter_validator.d.ts.map +1 -0
- package/dest/events/private_event_filter_validator.js +39 -0
- package/dest/job_coordinator/job_coordinator.d.ts +74 -0
- package/dest/job_coordinator/job_coordinator.d.ts.map +1 -0
- package/dest/job_coordinator/job_coordinator.js +93 -0
- package/dest/logs/log_service.d.ts +26 -0
- package/dest/logs/log_service.d.ts.map +1 -0
- package/dest/logs/log_service.js +120 -0
- package/dest/notes/index.d.ts +2 -0
- package/dest/notes/index.d.ts.map +1 -0
- package/dest/notes/index.js +1 -0
- package/dest/notes/note_service.d.ts +48 -0
- package/dest/notes/note_service.d.ts.map +1 -0
- package/dest/notes/note_service.js +152 -0
- package/dest/oracle_version.d.ts +3 -0
- package/dest/oracle_version.d.ts.map +1 -0
- package/dest/oracle_version.js +10 -0
- package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts +28 -0
- package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts.map +1 -0
- package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.js +271 -0
- package/dest/private_kernel/hints/compute_tx_include_by_timestamp.d.ts +4 -0
- package/dest/private_kernel/hints/compute_tx_include_by_timestamp.d.ts.map +1 -0
- package/dest/private_kernel/hints/compute_tx_include_by_timestamp.js +41 -0
- package/dest/private_kernel/hints/index.d.ts +3 -0
- package/dest/private_kernel/hints/index.d.ts.map +1 -0
- package/dest/{kernel_prover → private_kernel}/hints/index.js +1 -0
- package/dest/private_kernel/index.d.ts +3 -0
- package/dest/private_kernel/index.d.ts.map +1 -0
- package/dest/private_kernel/index.js +2 -0
- package/dest/private_kernel/private_kernel_execution_prover.d.ts +44 -0
- package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -0
- package/dest/private_kernel/private_kernel_execution_prover.js +285 -0
- package/dest/private_kernel/private_kernel_oracle.d.ts +64 -0
- package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -0
- package/dest/private_kernel/private_kernel_oracle.js +4 -0
- package/dest/private_kernel/private_kernel_oracle_impl.d.ts +46 -0
- package/dest/private_kernel/private_kernel_oracle_impl.d.ts.map +1 -0
- package/dest/{kernel_oracle/index.js → private_kernel/private_kernel_oracle_impl.js} +27 -18
- package/dest/public_storage/public_storage_service.d.ts +24 -0
- package/dest/public_storage/public_storage_service.d.ts.map +1 -0
- package/dest/public_storage/public_storage_service.js +26 -0
- package/dest/pxe.d.ts +233 -0
- package/dest/pxe.d.ts.map +1 -0
- package/dest/pxe.js +782 -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} +1 -4
- package/dest/storage/address_store/index.d.ts +2 -0
- package/dest/storage/address_store/index.d.ts.map +1 -0
- package/dest/storage/address_store/index.js +1 -0
- package/dest/storage/anchor_block_store/anchor_block_store.d.ts +9 -0
- package/dest/storage/anchor_block_store/anchor_block_store.d.ts.map +1 -0
- package/dest/storage/{sync_data_provider/sync_data_provider.js → anchor_block_store/anchor_block_store.js} +2 -12
- package/dest/storage/anchor_block_store/index.d.ts +2 -0
- package/dest/storage/anchor_block_store/index.d.ts.map +1 -0
- package/dest/storage/anchor_block_store/index.js +1 -0
- package/dest/storage/capsule_store/capsule_store.d.ts +57 -0
- package/dest/storage/capsule_store/capsule_store.d.ts.map +1 -0
- package/dest/storage/capsule_store/capsule_store.js +146 -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 +67 -0
- package/dest/storage/contract_store/contract_store.d.ts.map +1 -0
- package/dest/storage/contract_store/contract_store.js +236 -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_store/private_functions_tree.d.ts +27 -0
- package/dest/storage/contract_store/private_functions_tree.d.ts.map +1 -0
- package/dest/storage/contract_store/private_functions_tree.js +47 -0
- package/dest/storage/index.d.ts +9 -10
- package/dest/storage/index.d.ts.map +1 -1
- package/dest/storage/index.js +8 -9
- package/dest/storage/metadata.d.ts +2 -0
- package/dest/storage/metadata.d.ts.map +1 -0
- package/dest/storage/metadata.js +1 -0
- package/dest/storage/note_store/index.d.ts +3 -0
- package/dest/storage/note_store/index.d.ts.map +1 -0
- package/dest/storage/note_store/index.js +2 -0
- package/dest/storage/note_store/note_store.d.ts +84 -0
- package/dest/storage/note_store/note_store.d.ts.map +1 -0
- package/dest/storage/note_store/note_store.js +322 -0
- package/dest/storage/private_event_store/private_event_store.d.ts +56 -0
- package/dest/storage/private_event_store/private_event_store.d.ts.map +1 -0
- package/dest/storage/private_event_store/private_event_store.js +158 -0
- package/dest/storage/tagging_store/index.d.ts +4 -0
- package/dest/storage/tagging_store/index.d.ts.map +1 -0
- package/dest/storage/tagging_store/index.js +3 -0
- package/dest/storage/tagging_store/recipient_tagging_store.d.ts +21 -0
- package/dest/storage/tagging_store/recipient_tagging_store.d.ts.map +1 -0
- package/dest/storage/tagging_store/recipient_tagging_store.js +42 -0
- package/dest/storage/tagging_store/sender_address_book_store.d.ts +14 -0
- package/dest/storage/tagging_store/sender_address_book_store.d.ts.map +1 -0
- package/dest/storage/tagging_store/sender_address_book_store.js +30 -0
- package/dest/storage/tagging_store/sender_tagging_store.d.ts +67 -0
- package/dest/storage/tagging_store/sender_tagging_store.d.ts.map +1 -0
- package/dest/storage/tagging_store/sender_tagging_store.js +196 -0
- package/dest/tagging/constants.d.ts +2 -0
- package/dest/tagging/constants.d.ts.map +1 -0
- package/dest/tagging/constants.js +10 -0
- package/dest/tagging/index.d.ts +16 -0
- package/dest/tagging/index.d.ts.map +1 -0
- package/dest/tagging/index.js +14 -0
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts +14 -0
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts.map +1 -0
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.js +99 -0
- package/dest/tagging/recipient_sync/utils/find_highest_indexes.d.ts +12 -0
- package/dest/tagging/recipient_sync/utils/find_highest_indexes.d.ts.map +1 -0
- package/dest/tagging/recipient_sync/utils/find_highest_indexes.js +20 -0
- package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts +14 -0
- package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts.map +1 -0
- package/dest/tagging/recipient_sync/utils/load_logs_for_range.js +29 -0
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts +20 -0
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts.map +1 -0
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.js +74 -0
- package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts +11 -0
- package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts.map +1 -0
- package/dest/tagging/sender_sync/utils/get_status_change_of_pending.js +32 -0
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts +18 -0
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts.map +1 -0
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.js +55 -0
- package/dest/tree_membership/tree_membership_service.d.ts +52 -0
- package/dest/tree_membership/tree_membership_service.d.ts.map +1 -0
- package/dest/tree_membership/tree_membership_service.js +84 -0
- package/package.json +37 -34
- package/src/bin/check_oracle_version.ts +160 -0
- package/src/{synchronizer/synchronizer.ts → block_synchronizer/block_synchronizer.ts} +37 -38
- package/src/block_synchronizer/index.ts +1 -0
- package/src/config/index.ts +27 -55
- package/src/config/package_info.ts +1 -1
- package/src/contract_function_simulator/contract_function_simulator.ts +627 -0
- package/src/contract_function_simulator/execution_note_cache.ts +233 -0
- package/src/contract_function_simulator/execution_tagging_index_cache.ts +32 -0
- package/src/contract_function_simulator/hashed_values_cache.ts +47 -0
- package/src/contract_function_simulator/index.ts +13 -0
- package/src/contract_function_simulator/noir-structs/event_validation_request.ts +51 -0
- package/src/contract_function_simulator/noir-structs/log_retrieval_request.ts +28 -0
- package/src/contract_function_simulator/noir-structs/log_retrieval_response.ts +69 -0
- package/src/contract_function_simulator/noir-structs/note_validation_request.ts +64 -0
- package/src/contract_function_simulator/noir-structs/utility_context.ts +42 -0
- package/src/contract_function_simulator/oracle/index.ts +16 -0
- package/src/contract_function_simulator/oracle/interfaces.ts +175 -0
- package/src/contract_function_simulator/oracle/message_load_oracle_inputs.ts +23 -0
- package/src/contract_function_simulator/oracle/note_packing_utils.ts +68 -0
- package/src/contract_function_simulator/oracle/oracle.ts +605 -0
- package/src/contract_function_simulator/oracle/private_execution.ts +207 -0
- package/src/contract_function_simulator/oracle/private_execution_oracle.ts +676 -0
- package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +536 -0
- package/src/contract_function_simulator/pick_notes.ts +141 -0
- package/src/contract_function_simulator/proxied_contract_data_source.ts +83 -0
- package/src/contract_function_simulator/proxied_node.ts +33 -0
- package/src/debug/pxe_debug_utils.ts +48 -0
- package/src/entrypoints/client/bundle/index.ts +3 -2
- package/src/entrypoints/client/bundle/utils.ts +42 -36
- package/src/entrypoints/client/lazy/index.ts +3 -2
- package/src/entrypoints/client/lazy/utils.ts +41 -31
- package/src/entrypoints/pxe_creation_options.ts +13 -0
- package/src/entrypoints/server/index.ts +5 -3
- package/src/entrypoints/server/utils.ts +55 -51
- package/src/{pxe_service/error_enriching.ts → error_enriching.ts} +40 -39
- package/src/events/event_service.ts +79 -0
- package/src/events/index.ts +1 -0
- package/src/events/private_event_filter_validator.ts +48 -0
- package/src/job_coordinator/job_coordinator.ts +149 -0
- package/src/logs/log_service.ts +202 -0
- package/src/notes/index.ts +1 -0
- package/src/notes/note_service.ts +200 -0
- package/src/oracle_version.ts +11 -0
- package/src/{kernel_prover → private_kernel}/hints/build_private_kernel_reset_private_inputs.ts +159 -148
- package/src/private_kernel/hints/compute_tx_include_by_timestamp.ts +58 -0
- package/src/{kernel_prover → private_kernel}/hints/index.ts +1 -0
- package/src/private_kernel/index.ts +2 -0
- package/src/private_kernel/private_kernel_execution_prover.ts +430 -0
- package/src/{kernel_prover/proving_data_oracle.ts → private_kernel/private_kernel_oracle.ts} +19 -29
- package/src/{kernel_oracle/index.ts → private_kernel/private_kernel_oracle_impl.ts} +40 -30
- package/src/public_storage/public_storage_service.ts +33 -0
- package/src/pxe.ts +1111 -0
- package/src/storage/{address_data_provider/address_data_provider.ts → address_store/address_store.ts} +1 -7
- package/src/storage/address_store/index.ts +1 -0
- package/src/storage/{sync_data_provider/sync_data_provider.ts → anchor_block_store/anchor_block_store.ts} +2 -17
- package/src/storage/anchor_block_store/index.ts +1 -0
- package/src/storage/capsule_store/capsule_store.ts +179 -0
- package/src/storage/capsule_store/index.ts +1 -0
- package/src/storage/contract_store/contract_store.ts +339 -0
- package/src/storage/contract_store/index.ts +1 -0
- package/src/storage/contract_store/private_functions_tree.ts +67 -0
- package/src/storage/index.ts +8 -10
- package/src/storage/metadata.ts +1 -0
- package/src/storage/note_store/index.ts +2 -0
- package/src/storage/{note_data_provider/note_data_provider.ts → note_store/note_store.ts} +190 -123
- package/src/storage/private_event_store/private_event_store.ts +216 -0
- package/src/storage/tagging_store/index.ts +3 -0
- package/src/storage/tagging_store/recipient_tagging_store.ts +53 -0
- package/src/storage/tagging_store/sender_address_book_store.ts +42 -0
- package/src/storage/tagging_store/sender_tagging_store.ts +244 -0
- package/src/tagging/constants.ts +10 -0
- package/src/tagging/index.ts +18 -0
- package/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts +132 -0
- package/src/tagging/recipient_sync/utils/find_highest_indexes.ts +34 -0
- package/src/tagging/recipient_sync/utils/load_logs_for_range.ts +43 -0
- package/src/tagging/sender_sync/sync_sender_tagging_indexes.ts +96 -0
- package/src/tagging/sender_sync/utils/get_status_change_of_pending.ts +48 -0
- package/src/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.ts +72 -0
- package/src/tree_membership/tree_membership_service.ts +112 -0
- package/dest/bin/index.d.ts +0 -3
- package/dest/bin/index.d.ts.map +0 -1
- package/dest/bin/index.js +0 -28
- package/dest/entrypoints/client/pxe_creation_options.d.ts +0 -11
- package/dest/entrypoints/client/pxe_creation_options.d.ts.map +0 -1
- package/dest/kernel_oracle/index.d.ts +0 -45
- package/dest/kernel_oracle/index.d.ts.map +0 -1
- package/dest/kernel_prover/hints/build_private_kernel_reset_private_inputs.d.ts +0 -28
- package/dest/kernel_prover/hints/build_private_kernel_reset_private_inputs.d.ts.map +0 -1
- package/dest/kernel_prover/hints/build_private_kernel_reset_private_inputs.js +0 -270
- package/dest/kernel_prover/hints/index.d.ts +0 -2
- package/dest/kernel_prover/hints/index.d.ts.map +0 -1
- package/dest/kernel_prover/index.d.ts +0 -3
- package/dest/kernel_prover/index.d.ts.map +0 -1
- package/dest/kernel_prover/index.js +0 -2
- package/dest/kernel_prover/kernel_prover.d.ts +0 -38
- package/dest/kernel_prover/kernel_prover.d.ts.map +0 -1
- package/dest/kernel_prover/kernel_prover.js +0 -217
- package/dest/kernel_prover/proving_data_oracle.d.ts +0 -73
- package/dest/kernel_prover/proving_data_oracle.d.ts.map +0 -1
- package/dest/kernel_prover/proving_data_oracle.js +0 -4
- package/dest/note_decryption_utils/add_public_values_to_payload.d.ts +0 -11
- package/dest/note_decryption_utils/add_public_values_to_payload.d.ts.map +0 -1
- package/dest/note_decryption_utils/add_public_values_to_payload.js +0 -47
- package/dest/pxe_http/index.d.ts +0 -2
- package/dest/pxe_http/index.d.ts.map +0 -1
- package/dest/pxe_http/index.js +0 -1
- package/dest/pxe_http/pxe_http_server.d.ts +0 -16
- package/dest/pxe_http/pxe_http_server.d.ts.map +0 -1
- package/dest/pxe_http/pxe_http_server.js +0 -27
- package/dest/pxe_oracle_interface/index.d.ts +0 -159
- package/dest/pxe_oracle_interface/index.d.ts.map +0 -1
- package/dest/pxe_oracle_interface/index.js +0 -692
- package/dest/pxe_oracle_interface/tagging_utils.d.ts +0 -17
- package/dest/pxe_oracle_interface/tagging_utils.d.ts.map +0 -1
- package/dest/pxe_oracle_interface/tagging_utils.js +0 -23
- package/dest/pxe_service/error_enriching.d.ts +0 -11
- package/dest/pxe_service/error_enriching.d.ts.map +0 -1
- package/dest/pxe_service/index.d.ts +0 -3
- package/dest/pxe_service/index.d.ts.map +0 -1
- package/dest/pxe_service/index.js +0 -2
- package/dest/pxe_service/pxe_service.d.ts +0 -111
- package/dest/pxe_service/pxe_service.d.ts.map +0 -1
- package/dest/pxe_service/pxe_service.js +0 -664
- 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/auth_witness_data_provider/auth_witness_data_provider.d.ts +0 -11
- package/dest/storage/auth_witness_data_provider/auth_witness_data_provider.d.ts.map +0 -1
- package/dest/storage/auth_witness_data_provider/auth_witness_data_provider.js +0 -20
- package/dest/storage/auth_witness_data_provider/index.d.ts +0 -2
- package/dest/storage/auth_witness_data_provider/index.d.ts.map +0 -1
- package/dest/storage/auth_witness_data_provider/index.js +0 -1
- package/dest/storage/capsule_data_provider/capsule_data_provider.d.ts +0 -16
- 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 -57
- 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 -109
- 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 -183
- package/dest/storage/contract_data_provider/index.d.ts +0 -3
- package/dest/storage/contract_data_provider/index.d.ts.map +0 -1
- package/dest/storage/contract_data_provider/index.js +0 -2
- package/dest/storage/contract_data_provider/private_functions_tree.d.ts +0 -66
- package/dest/storage/contract_data_provider/private_functions_tree.d.ts.map +0 -1
- package/dest/storage/contract_data_provider/private_functions_tree.js +0 -99
- 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 -106
- package/dest/storage/note_data_provider/note_dao.d.ts.map +0 -1
- package/dest/storage/note_data_provider/note_dao.js +0 -106
- 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 -249
- 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 -65
- 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 -37
- package/dest/synchronizer/synchronizer.d.ts.map +0 -1
- package/dest/test/pxe_test_suite.d.ts +0 -3
- package/dest/test/pxe_test_suite.d.ts.map +0 -1
- package/dest/test/pxe_test_suite.js +0 -97
- package/src/bin/index.ts +0 -38
- package/src/entrypoints/client/pxe_creation_options.ts +0 -7
- package/src/kernel_prover/index.ts +0 -2
- package/src/kernel_prover/kernel_prover.ts +0 -351
- package/src/note_decryption_utils/add_public_values_to_payload.ts +0 -64
- package/src/pxe_http/index.ts +0 -1
- package/src/pxe_http/pxe_http_server.ts +0 -29
- package/src/pxe_oracle_interface/index.ts +0 -925
- package/src/pxe_oracle_interface/tagging_utils.ts +0 -32
- package/src/pxe_service/index.ts +0 -2
- package/src/pxe_service/pxe_service.ts +0 -949
- package/src/storage/address_data_provider/index.ts +0 -1
- package/src/storage/auth_witness_data_provider/auth_witness_data_provider.ts +0 -34
- package/src/storage/auth_witness_data_provider/index.ts +0 -1
- package/src/storage/capsule_data_provider/capsule_data_provider.ts +0 -80
- package/src/storage/capsule_data_provider/index.ts +0 -1
- package/src/storage/contract_data_provider/contract_data_provider.ts +0 -261
- package/src/storage/contract_data_provider/index.ts +0 -2
- package/src/storage/contract_data_provider/private_functions_tree.ts +0 -131
- 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 -162
- 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 -92
- package/src/synchronizer/index.ts +0 -1
- package/src/test/pxe_test_suite.ts +0 -111
- /package/dest/entrypoints/{client/pxe_creation_options.js → pxe_creation_options.js} +0 -0
package/src/{kernel_prover → private_kernel}/hints/build_private_kernel_reset_private_inputs.ts
RENAMED
|
@@ -4,17 +4,19 @@ import {
|
|
|
4
4
|
MAX_NOTE_HASH_READ_REQUESTS_PER_TX,
|
|
5
5
|
MAX_NULLIFIERS_PER_TX,
|
|
6
6
|
MAX_NULLIFIER_READ_REQUESTS_PER_TX,
|
|
7
|
+
MAX_PRIVATE_LOGS_PER_TX,
|
|
7
8
|
NULLIFIER_TREE_HEIGHT,
|
|
8
|
-
VK_TREE_HEIGHT,
|
|
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';
|
|
16
16
|
import {
|
|
17
|
+
ClaimedLengthArray,
|
|
17
18
|
KeyValidationHint,
|
|
19
|
+
PaddedSideEffects,
|
|
18
20
|
type PrivateCircuitPublicInputs,
|
|
19
21
|
type PrivateKernelCircuitPublicInputs,
|
|
20
22
|
PrivateKernelData,
|
|
@@ -22,41 +24,36 @@ import {
|
|
|
22
24
|
PrivateKernelResetDimensions,
|
|
23
25
|
PrivateKernelResetHints,
|
|
24
26
|
type PrivateKernelSimulateOutput,
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
ReadRequestState,
|
|
27
|
+
ReadRequestActionEnum,
|
|
28
|
+
ReadRequestResetActions,
|
|
28
29
|
type ScopedKeyValidationRequestAndGenerator,
|
|
29
30
|
ScopedNoteHash,
|
|
30
31
|
ScopedNullifier,
|
|
31
32
|
ScopedReadRequest,
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
TransientDataSquashingHint,
|
|
34
|
+
buildNoteHashReadRequestHintsFromResetActions,
|
|
35
|
+
buildNullifierReadRequestHintsFromResetActions,
|
|
35
36
|
buildTransientDataHints,
|
|
36
|
-
countAccumulatedItems,
|
|
37
37
|
findPrivateKernelResetDimensions,
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
getNullifierReadRequestResetStates,
|
|
38
|
+
getNoteHashReadRequestResetActions,
|
|
39
|
+
getNullifierReadRequestResetActions,
|
|
41
40
|
privateKernelResetDimensionNames,
|
|
42
41
|
} from '@aztec/stdlib/kernel';
|
|
43
42
|
import { type PrivateCallExecutionResult, collectNested } from '@aztec/stdlib/tx';
|
|
43
|
+
import { VkData } from '@aztec/stdlib/vks';
|
|
44
44
|
|
|
45
|
-
import type {
|
|
45
|
+
import type { PrivateKernelOracle } from '../private_kernel_oracle.js';
|
|
46
46
|
|
|
47
|
-
function collectNestedReadRequests(
|
|
47
|
+
function collectNestedReadRequests<N extends number>(
|
|
48
48
|
executionStack: PrivateCallExecutionResult[],
|
|
49
|
-
extractReadRequests: (execution: PrivateCallExecutionResult) =>
|
|
49
|
+
extractReadRequests: (execution: PrivateCallExecutionResult) => ClaimedLengthArray<ScopedReadRequest, N>,
|
|
50
50
|
): ScopedReadRequest[] {
|
|
51
51
|
return collectNested(executionStack, executionResult => {
|
|
52
|
-
|
|
53
|
-
return nonEmptyReadRequests.map(
|
|
54
|
-
readRequest => new ScopedReadRequest(readRequest, executionResult.publicInputs.callContext.contractAddress),
|
|
55
|
-
);
|
|
52
|
+
return extractReadRequests(executionResult).getActiveItems();
|
|
56
53
|
});
|
|
57
54
|
}
|
|
58
55
|
|
|
59
|
-
function getNullifierMembershipWitnessResolver(oracle:
|
|
56
|
+
function getNullifierMembershipWitnessResolver(oracle: PrivateKernelOracle) {
|
|
60
57
|
return async (nullifier: Fr) => {
|
|
61
58
|
const res = await oracle.getNullifierMembershipWitness(nullifier);
|
|
62
59
|
if (!res) {
|
|
@@ -72,23 +69,21 @@ function getNullifierMembershipWitnessResolver(oracle: ProvingDataOracle) {
|
|
|
72
69
|
}
|
|
73
70
|
|
|
74
71
|
async function getMasterSecretKeysAndAppKeyGenerators(
|
|
75
|
-
keyValidationRequests:
|
|
76
|
-
|
|
72
|
+
keyValidationRequests: ClaimedLengthArray<
|
|
73
|
+
ScopedKeyValidationRequestAndGenerator,
|
|
74
|
+
typeof MAX_KEY_VALIDATION_REQUESTS_PER_TX
|
|
75
|
+
>,
|
|
76
|
+
numRequestsToVerify: number,
|
|
77
|
+
oracle: PrivateKernelOracle,
|
|
77
78
|
) {
|
|
78
|
-
const
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
}
|
|
84
|
-
const secretKeys = await oracle.getMasterSecretKey(request.request.pkM);
|
|
85
|
-
keysHints.push(new KeyValidationHint(secretKeys, i));
|
|
86
|
-
}
|
|
87
|
-
return padArrayEnd(
|
|
88
|
-
keysHints,
|
|
89
|
-
KeyValidationHint.nada(MAX_KEY_VALIDATION_REQUESTS_PER_TX),
|
|
90
|
-
MAX_KEY_VALIDATION_REQUESTS_PER_TX,
|
|
79
|
+
const numRequestsToProcess = Math.min(keyValidationRequests.claimedLength, numRequestsToVerify);
|
|
80
|
+
const keysHints = await Promise.all(
|
|
81
|
+
keyValidationRequests.array.slice(0, numRequestsToProcess).map(async ({ request }) => {
|
|
82
|
+
const secretKeys = await oracle.getMasterSecretKey(request.request.pkM);
|
|
83
|
+
return new KeyValidationHint(secretKeys);
|
|
84
|
+
}),
|
|
91
85
|
);
|
|
86
|
+
return padArrayEnd(keysHints, KeyValidationHint.empty(), MAX_KEY_VALIDATION_REQUESTS_PER_TX);
|
|
92
87
|
}
|
|
93
88
|
|
|
94
89
|
export class PrivateKernelResetPrivateInputsBuilder {
|
|
@@ -96,25 +91,25 @@ export class PrivateKernelResetPrivateInputsBuilder {
|
|
|
96
91
|
// If there's no next iteration, it's the final reset.
|
|
97
92
|
private nextIteration?: PrivateCircuitPublicInputs;
|
|
98
93
|
|
|
99
|
-
private
|
|
100
|
-
private
|
|
94
|
+
private noteHashResetActions: ReadRequestResetActions<typeof MAX_NOTE_HASH_READ_REQUESTS_PER_TX>;
|
|
95
|
+
private nullifierResetActions: ReadRequestResetActions<typeof MAX_NULLIFIER_READ_REQUESTS_PER_TX>;
|
|
101
96
|
private numTransientData?: number;
|
|
102
|
-
private
|
|
97
|
+
private transientDataSquashingHints: Tuple<TransientDataSquashingHint, typeof MAX_NULLIFIERS_PER_TX>;
|
|
103
98
|
private requestedDimensions: PrivateKernelResetDimensions;
|
|
104
99
|
|
|
105
100
|
constructor(
|
|
106
101
|
private previousKernelOutput: PrivateKernelSimulateOutput<PrivateKernelCircuitPublicInputs>,
|
|
107
102
|
private executionStack: PrivateCallExecutionResult[],
|
|
108
103
|
private noteHashNullifierCounterMap: Map<number, number>,
|
|
109
|
-
private
|
|
104
|
+
private splitCounter: number,
|
|
110
105
|
) {
|
|
111
106
|
this.previousKernel = previousKernelOutput.publicInputs;
|
|
112
107
|
this.requestedDimensions = PrivateKernelResetDimensions.empty();
|
|
113
|
-
this.
|
|
114
|
-
this.
|
|
115
|
-
this.
|
|
108
|
+
this.noteHashResetActions = ReadRequestResetActions.empty(MAX_NOTE_HASH_READ_REQUESTS_PER_TX);
|
|
109
|
+
this.nullifierResetActions = ReadRequestResetActions.empty(MAX_NULLIFIER_READ_REQUESTS_PER_TX);
|
|
110
|
+
this.transientDataSquashingHints = makeTuple(
|
|
116
111
|
MAX_NULLIFIERS_PER_TX,
|
|
117
|
-
() => new
|
|
112
|
+
() => new TransientDataSquashingHint(MAX_NULLIFIERS_PER_TX, MAX_NOTE_HASHES_PER_TX),
|
|
118
113
|
);
|
|
119
114
|
this.nextIteration = executionStack[this.executionStack.length - 1]?.publicInputs;
|
|
120
115
|
}
|
|
@@ -143,7 +138,7 @@ export class PrivateKernelResetPrivateInputsBuilder {
|
|
|
143
138
|
}
|
|
144
139
|
}
|
|
145
140
|
|
|
146
|
-
async build(oracle:
|
|
141
|
+
async build(oracle: PrivateKernelOracle) {
|
|
147
142
|
if (privateKernelResetDimensionNames.every(name => !this.requestedDimensions[name])) {
|
|
148
143
|
throw new Error('Reset is not required.');
|
|
149
144
|
}
|
|
@@ -162,122 +157,130 @@ export class PrivateKernelResetPrivateInputsBuilder {
|
|
|
162
157
|
allowRemainder,
|
|
163
158
|
);
|
|
164
159
|
|
|
165
|
-
const previousVkMembershipWitness = await oracle.getVkMembershipWitness(
|
|
166
|
-
|
|
167
|
-
|
|
160
|
+
const previousVkMembershipWitness = await oracle.getVkMembershipWitness(
|
|
161
|
+
this.previousKernelOutput.verificationKey.keyAsFields,
|
|
162
|
+
);
|
|
163
|
+
const vkData = new VkData(
|
|
168
164
|
this.previousKernelOutput.verificationKey,
|
|
169
165
|
Number(previousVkMembershipWitness.leafIndex),
|
|
170
|
-
|
|
166
|
+
previousVkMembershipWitness.siblingPath,
|
|
171
167
|
);
|
|
168
|
+
const previousKernelData = new PrivateKernelData(this.previousKernelOutput.publicInputs, vkData);
|
|
172
169
|
|
|
173
|
-
this.
|
|
174
|
-
this.
|
|
175
|
-
dimensions.
|
|
176
|
-
dimensions.
|
|
170
|
+
this.reduceReadRequestActions(
|
|
171
|
+
this.noteHashResetActions,
|
|
172
|
+
dimensions.NOTE_HASH_PENDING_READ,
|
|
173
|
+
dimensions.NOTE_HASH_SETTLED_READ,
|
|
177
174
|
);
|
|
178
|
-
this.
|
|
179
|
-
this.
|
|
180
|
-
dimensions.
|
|
181
|
-
dimensions.
|
|
175
|
+
this.reduceReadRequestActions(
|
|
176
|
+
this.nullifierResetActions,
|
|
177
|
+
dimensions.NULLIFIER_PENDING_READ,
|
|
178
|
+
dimensions.NULLIFIER_SETTLED_READ,
|
|
182
179
|
);
|
|
183
180
|
|
|
181
|
+
// TODO: Enable padding when we have a better idea what are the final amounts we should pad to.
|
|
182
|
+
const paddedSideEffects = PaddedSideEffects.empty();
|
|
183
|
+
|
|
184
184
|
return new PrivateKernelResetCircuitPrivateInputs(
|
|
185
185
|
previousKernelData,
|
|
186
|
+
paddedSideEffects,
|
|
186
187
|
new PrivateKernelResetHints(
|
|
187
|
-
await
|
|
188
|
+
await buildNoteHashReadRequestHintsFromResetActions(
|
|
188
189
|
oracle,
|
|
189
190
|
this.previousKernel.validationRequests.noteHashReadRequests,
|
|
190
191
|
this.previousKernel.end.noteHashes,
|
|
191
|
-
this.
|
|
192
|
-
noteHashLeafIndexMap,
|
|
192
|
+
this.noteHashResetActions,
|
|
193
193
|
),
|
|
194
|
-
await
|
|
194
|
+
await buildNullifierReadRequestHintsFromResetActions(
|
|
195
195
|
{ getNullifierMembershipWitness: getNullifierMembershipWitnessResolver(oracle) },
|
|
196
196
|
this.previousKernel.validationRequests.nullifierReadRequests,
|
|
197
|
-
this.
|
|
197
|
+
this.nullifierResetActions,
|
|
198
198
|
),
|
|
199
199
|
await getMasterSecretKeysAndAppKeyGenerators(
|
|
200
200
|
this.previousKernel.validationRequests.scopedKeyValidationRequestsAndGenerators,
|
|
201
|
+
dimensions.KEY_VALIDATION,
|
|
201
202
|
oracle,
|
|
202
203
|
),
|
|
203
|
-
this.
|
|
204
|
-
this.validationRequestsSplitCounter,
|
|
204
|
+
this.transientDataSquashingHints,
|
|
205
205
|
),
|
|
206
206
|
dimensions,
|
|
207
207
|
);
|
|
208
208
|
}
|
|
209
209
|
|
|
210
|
-
private
|
|
211
|
-
|
|
210
|
+
private reduceReadRequestActions<NUM_READS extends number>(
|
|
211
|
+
resetActions: ReadRequestResetActions<NUM_READS>,
|
|
212
212
|
maxPending: number,
|
|
213
213
|
maxSettled: number,
|
|
214
214
|
) {
|
|
215
215
|
let numPending = 0;
|
|
216
216
|
let numSettled = 0;
|
|
217
|
-
for (let i = 0; i <
|
|
218
|
-
const
|
|
219
|
-
if (
|
|
217
|
+
for (let i = 0; i < resetActions.actions.length; i++) {
|
|
218
|
+
const action = resetActions.actions[i];
|
|
219
|
+
if (action === ReadRequestActionEnum.READ_AS_PENDING) {
|
|
220
220
|
if (numPending < maxPending) {
|
|
221
221
|
numPending++;
|
|
222
222
|
} else {
|
|
223
|
-
|
|
223
|
+
resetActions.actions[i] = ReadRequestActionEnum.SKIP;
|
|
224
224
|
}
|
|
225
|
-
} else if (
|
|
225
|
+
} else if (action === ReadRequestActionEnum.READ_AS_SETTLED) {
|
|
226
226
|
if (numSettled < maxSettled) {
|
|
227
227
|
numSettled++;
|
|
228
228
|
} else {
|
|
229
|
-
|
|
229
|
+
resetActions.actions[i] = ReadRequestActionEnum.SKIP;
|
|
230
230
|
}
|
|
231
231
|
}
|
|
232
232
|
}
|
|
233
233
|
|
|
234
|
-
|
|
234
|
+
resetActions.pendingReadHints = resetActions.pendingReadHints.slice(0, maxPending);
|
|
235
235
|
}
|
|
236
236
|
|
|
237
237
|
private needsResetNoteHashReadRequests(forceResetAll = false) {
|
|
238
|
-
const numCurr =
|
|
239
|
-
const numNext = this.nextIteration ?
|
|
238
|
+
const numCurr = this.previousKernel.validationRequests.noteHashReadRequests.claimedLength;
|
|
239
|
+
const numNext = this.nextIteration ? this.nextIteration.noteHashReadRequests.claimedLength : 0;
|
|
240
240
|
const maxAmountToKeep = !this.nextIteration || forceResetAll ? 0 : MAX_NOTE_HASH_READ_REQUESTS_PER_TX;
|
|
241
241
|
if (numCurr + numNext <= maxAmountToKeep) {
|
|
242
242
|
return false;
|
|
243
243
|
}
|
|
244
244
|
|
|
245
245
|
const futureNoteHashes = collectNested(this.executionStack, executionResult => {
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
noteHash => new ScopedNoteHash(noteHash, executionResult.publicInputs.callContext.contractAddress)
|
|
249
|
-
);
|
|
246
|
+
return executionResult.publicInputs.noteHashes
|
|
247
|
+
.getActiveItems()
|
|
248
|
+
.map(noteHash => new ScopedNoteHash(noteHash, executionResult.publicInputs.callContext.contractAddress));
|
|
250
249
|
});
|
|
251
250
|
|
|
252
|
-
const
|
|
251
|
+
const resetActions = getNoteHashReadRequestResetActions(
|
|
253
252
|
this.previousKernel.validationRequests.noteHashReadRequests,
|
|
254
253
|
this.previousKernel.end.noteHashes,
|
|
255
254
|
futureNoteHashes,
|
|
256
255
|
);
|
|
257
256
|
|
|
258
|
-
const numPendingReads =
|
|
259
|
-
const numSettledReads =
|
|
260
|
-
(accum,
|
|
257
|
+
const numPendingReads = resetActions.pendingReadHints.length;
|
|
258
|
+
const numSettledReads = resetActions.actions.reduce(
|
|
259
|
+
(accum, action) => accum + (action === ReadRequestActionEnum.READ_AS_SETTLED ? 1 : 0),
|
|
261
260
|
0,
|
|
262
261
|
);
|
|
263
262
|
|
|
264
263
|
if (!this.nextIteration) {
|
|
265
|
-
this.
|
|
266
|
-
this.requestedDimensions.
|
|
267
|
-
this.requestedDimensions.
|
|
264
|
+
this.noteHashResetActions = resetActions;
|
|
265
|
+
this.requestedDimensions.NOTE_HASH_PENDING_READ = numPendingReads;
|
|
266
|
+
this.requestedDimensions.NOTE_HASH_SETTLED_READ = numSettledReads;
|
|
268
267
|
} else {
|
|
269
268
|
// Pick only one dimension to reset if next iteration is not empty.
|
|
270
269
|
if (numPendingReads > numSettledReads) {
|
|
271
|
-
this.requestedDimensions.
|
|
272
|
-
this.
|
|
273
|
-
|
|
270
|
+
this.requestedDimensions.NOTE_HASH_PENDING_READ = numPendingReads;
|
|
271
|
+
this.noteHashResetActions.actions = assertLength(
|
|
272
|
+
resetActions.actions.map(action =>
|
|
273
|
+
action === ReadRequestActionEnum.READ_AS_PENDING ? action : ReadRequestActionEnum.SKIP,
|
|
274
|
+
),
|
|
274
275
|
MAX_NOTE_HASH_READ_REQUESTS_PER_TX,
|
|
275
276
|
);
|
|
276
|
-
this.
|
|
277
|
+
this.noteHashResetActions.pendingReadHints = resetActions.pendingReadHints;
|
|
277
278
|
} else {
|
|
278
|
-
this.requestedDimensions.
|
|
279
|
-
this.
|
|
280
|
-
|
|
279
|
+
this.requestedDimensions.NOTE_HASH_SETTLED_READ = numSettledReads;
|
|
280
|
+
this.noteHashResetActions.actions = assertLength(
|
|
281
|
+
resetActions.actions.map(action =>
|
|
282
|
+
action === ReadRequestActionEnum.READ_AS_SETTLED ? action : ReadRequestActionEnum.SKIP,
|
|
283
|
+
),
|
|
281
284
|
MAX_NOTE_HASH_READ_REQUESTS_PER_TX,
|
|
282
285
|
);
|
|
283
286
|
}
|
|
@@ -287,49 +290,52 @@ export class PrivateKernelResetPrivateInputsBuilder {
|
|
|
287
290
|
}
|
|
288
291
|
|
|
289
292
|
private needsResetNullifierReadRequests(forceResetAll = false) {
|
|
290
|
-
const numCurr =
|
|
291
|
-
const numNext = this.nextIteration ?
|
|
293
|
+
const numCurr = this.previousKernel.validationRequests.nullifierReadRequests.claimedLength;
|
|
294
|
+
const numNext = this.nextIteration ? this.nextIteration.nullifierReadRequests.claimedLength : 0;
|
|
292
295
|
const maxAmountToKeep = !this.nextIteration || forceResetAll ? 0 : MAX_NULLIFIER_READ_REQUESTS_PER_TX;
|
|
293
296
|
if (numCurr + numNext <= maxAmountToKeep) {
|
|
294
297
|
return false;
|
|
295
298
|
}
|
|
296
299
|
|
|
297
300
|
const futureNullifiers = collectNested(this.executionStack, executionResult => {
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
nullifier => new ScopedNullifier(nullifier, executionResult.publicInputs.callContext.contractAddress)
|
|
301
|
-
);
|
|
301
|
+
return executionResult.publicInputs.nullifiers
|
|
302
|
+
.getActiveItems()
|
|
303
|
+
.map(nullifier => new ScopedNullifier(nullifier, executionResult.publicInputs.callContext.contractAddress));
|
|
302
304
|
});
|
|
303
305
|
|
|
304
|
-
const
|
|
306
|
+
const resetActions = getNullifierReadRequestResetActions(
|
|
305
307
|
this.previousKernel.validationRequests.nullifierReadRequests,
|
|
306
308
|
this.previousKernel.end.nullifiers,
|
|
307
309
|
futureNullifiers,
|
|
308
310
|
);
|
|
309
311
|
|
|
310
|
-
const numPendingReads =
|
|
311
|
-
const numSettledReads =
|
|
312
|
-
(accum,
|
|
312
|
+
const numPendingReads = resetActions.pendingReadHints.length;
|
|
313
|
+
const numSettledReads = resetActions.actions.reduce(
|
|
314
|
+
(accum, action) => accum + (action === ReadRequestActionEnum.READ_AS_SETTLED ? 1 : 0),
|
|
313
315
|
0,
|
|
314
316
|
);
|
|
315
317
|
|
|
316
318
|
if (!this.nextIteration) {
|
|
317
|
-
this.
|
|
318
|
-
this.requestedDimensions.
|
|
319
|
-
this.requestedDimensions.
|
|
319
|
+
this.nullifierResetActions = resetActions;
|
|
320
|
+
this.requestedDimensions.NULLIFIER_PENDING_READ = numPendingReads;
|
|
321
|
+
this.requestedDimensions.NULLIFIER_SETTLED_READ = numSettledReads;
|
|
320
322
|
} else {
|
|
321
323
|
// Pick only one dimension to reset if next iteration is not empty.
|
|
322
324
|
if (numPendingReads > numSettledReads) {
|
|
323
|
-
this.requestedDimensions.
|
|
324
|
-
this.
|
|
325
|
-
|
|
325
|
+
this.requestedDimensions.NULLIFIER_PENDING_READ = numPendingReads;
|
|
326
|
+
this.nullifierResetActions.actions = assertLength(
|
|
327
|
+
resetActions.actions.map(action =>
|
|
328
|
+
action === ReadRequestActionEnum.READ_AS_PENDING ? action : ReadRequestActionEnum.SKIP,
|
|
329
|
+
),
|
|
326
330
|
MAX_NULLIFIER_READ_REQUESTS_PER_TX,
|
|
327
331
|
);
|
|
328
|
-
this.
|
|
332
|
+
this.nullifierResetActions.pendingReadHints = resetActions.pendingReadHints;
|
|
329
333
|
} else {
|
|
330
|
-
this.requestedDimensions.
|
|
331
|
-
this.
|
|
332
|
-
|
|
334
|
+
this.requestedDimensions.NULLIFIER_SETTLED_READ = numSettledReads;
|
|
335
|
+
this.nullifierResetActions.actions = assertLength(
|
|
336
|
+
resetActions.actions.map(action =>
|
|
337
|
+
action === ReadRequestActionEnum.READ_AS_SETTLED ? action : ReadRequestActionEnum.SKIP,
|
|
338
|
+
),
|
|
333
339
|
MAX_NULLIFIER_READ_REQUESTS_PER_TX,
|
|
334
340
|
);
|
|
335
341
|
}
|
|
@@ -339,18 +345,14 @@ export class PrivateKernelResetPrivateInputsBuilder {
|
|
|
339
345
|
}
|
|
340
346
|
|
|
341
347
|
private needsResetNullifierKeys() {
|
|
342
|
-
const numCurr =
|
|
343
|
-
|
|
344
|
-
);
|
|
345
|
-
const numNext = this.nextIteration
|
|
346
|
-
? countAccumulatedItems(this.nextIteration.keyValidationRequestsAndGenerators)
|
|
347
|
-
: 0;
|
|
348
|
+
const numCurr = this.previousKernel.validationRequests.scopedKeyValidationRequestsAndGenerators.claimedLength;
|
|
349
|
+
const numNext = this.nextIteration ? this.nextIteration.keyValidationRequestsAndGenerators.claimedLength : 0;
|
|
348
350
|
const maxAmountToKeep = !this.nextIteration ? 0 : MAX_KEY_VALIDATION_REQUESTS_PER_TX;
|
|
349
351
|
if (numCurr + numNext <= maxAmountToKeep) {
|
|
350
352
|
return false;
|
|
351
353
|
}
|
|
352
354
|
|
|
353
|
-
this.requestedDimensions.
|
|
355
|
+
this.requestedDimensions.KEY_VALIDATION = numCurr;
|
|
354
356
|
|
|
355
357
|
return true;
|
|
356
358
|
}
|
|
@@ -360,14 +362,16 @@ export class PrivateKernelResetPrivateInputsBuilder {
|
|
|
360
362
|
this.numTransientData = 0;
|
|
361
363
|
|
|
362
364
|
const nextAccumNoteHashes =
|
|
363
|
-
|
|
364
|
-
countAccumulatedItems(this.nextIteration?.noteHashes ?? []);
|
|
365
|
+
this.previousKernel.end.noteHashes.claimedLength + (this.nextIteration?.noteHashes.claimedLength ?? 0);
|
|
365
366
|
const noteHashWillOverflow = nextAccumNoteHashes > MAX_NOTE_HASHES_PER_TX;
|
|
366
367
|
const nextAccumNullifiers =
|
|
367
|
-
|
|
368
|
-
countAccumulatedItems(this.nextIteration?.nullifiers ?? []);
|
|
368
|
+
this.previousKernel.end.nullifiers.claimedLength + (this.nextIteration?.nullifiers.claimedLength ?? 0);
|
|
369
369
|
const nullifierWillOverflow = nextAccumNullifiers > MAX_NULLIFIERS_PER_TX;
|
|
370
|
-
|
|
370
|
+
const nextAccumLogs =
|
|
371
|
+
this.previousKernel.end.privateLogs.claimedLength + (this.nextIteration?.privateLogs.claimedLength ?? 0);
|
|
372
|
+
const logsWillOverflow = nextAccumLogs > MAX_PRIVATE_LOGS_PER_TX;
|
|
373
|
+
|
|
374
|
+
if (this.nextIteration && !noteHashWillOverflow && !nullifierWillOverflow && !logsWillOverflow) {
|
|
371
375
|
return false;
|
|
372
376
|
}
|
|
373
377
|
|
|
@@ -379,35 +383,36 @@ export class PrivateKernelResetPrivateInputsBuilder {
|
|
|
379
383
|
this.executionStack,
|
|
380
384
|
executionResult => executionResult.publicInputs.nullifierReadRequests,
|
|
381
385
|
);
|
|
386
|
+
// TODO(#15902): Collect future logs and only allow squashing a note hash when all its logs have been emitted
|
|
387
|
+
// (i.e. none of the future logs are linked to the to-be-squashed note hashes).
|
|
382
388
|
if (this.nextIteration) {
|
|
383
389
|
// If it's not the final reset, only one dimension will be reset at a time.
|
|
384
390
|
// The note hashes and nullifiers for the remaining read requests can't be squashed.
|
|
385
|
-
futureNoteHashReads.push(
|
|
386
|
-
|
|
387
|
-
);
|
|
388
|
-
futureNullifierReads.push(
|
|
389
|
-
...this.previousKernel.validationRequests.nullifierReadRequests.filter(r => !r.isEmpty()),
|
|
390
|
-
);
|
|
391
|
+
futureNoteHashReads.push(...this.previousKernel.validationRequests.noteHashReadRequests.getActiveItems());
|
|
392
|
+
futureNullifierReads.push(...this.previousKernel.validationRequests.nullifierReadRequests.getActiveItems());
|
|
391
393
|
}
|
|
392
394
|
|
|
393
|
-
const { numTransientData, hints:
|
|
395
|
+
const { numTransientData, hints: transientDataSquashingHints } = buildTransientDataHints(
|
|
394
396
|
this.previousKernel.end.noteHashes,
|
|
395
397
|
this.previousKernel.end.nullifiers,
|
|
396
398
|
futureNoteHashReads,
|
|
397
399
|
futureNullifierReads,
|
|
398
400
|
this.noteHashNullifierCounterMap,
|
|
399
|
-
this.
|
|
400
|
-
MAX_NOTE_HASHES_PER_TX,
|
|
401
|
-
MAX_NULLIFIERS_PER_TX,
|
|
401
|
+
this.splitCounter,
|
|
402
402
|
);
|
|
403
403
|
|
|
404
404
|
if (this.nextIteration && !numTransientData) {
|
|
405
405
|
const forceResetAll = true;
|
|
406
406
|
const canClearReadRequests =
|
|
407
407
|
(noteHashWillOverflow && this.needsResetNoteHashReadRequests(forceResetAll)) ||
|
|
408
|
-
(nullifierWillOverflow && this.needsResetNullifierReadRequests(forceResetAll))
|
|
408
|
+
(nullifierWillOverflow && this.needsResetNullifierReadRequests(forceResetAll)) ||
|
|
409
|
+
(logsWillOverflow && this.needsResetNoteHashReadRequests(forceResetAll));
|
|
409
410
|
if (!canClearReadRequests) {
|
|
410
|
-
const overflownData = noteHashWillOverflow
|
|
411
|
+
const overflownData = noteHashWillOverflow
|
|
412
|
+
? 'note hashes'
|
|
413
|
+
: nullifierWillOverflow
|
|
414
|
+
? 'nullifiers'
|
|
415
|
+
: 'private logs';
|
|
411
416
|
throw new Error(`Number of ${overflownData} exceeds the limit.`);
|
|
412
417
|
}
|
|
413
418
|
// Clearing the read requests might not be enough to squash the overflown data.
|
|
@@ -416,8 +421,8 @@ export class PrivateKernelResetPrivateInputsBuilder {
|
|
|
416
421
|
}
|
|
417
422
|
|
|
418
423
|
this.numTransientData = numTransientData;
|
|
419
|
-
this.
|
|
420
|
-
this.requestedDimensions.
|
|
424
|
+
this.transientDataSquashingHints = transientDataSquashingHints;
|
|
425
|
+
this.requestedDimensions.TRANSIENT_DATA_SQUASHING = numTransientData;
|
|
421
426
|
|
|
422
427
|
return numTransientData > 0;
|
|
423
428
|
}
|
|
@@ -427,9 +432,11 @@ export class PrivateKernelResetPrivateInputsBuilder {
|
|
|
427
432
|
throw new Error('`needsResetTransientData` must be run before `needsSiloNoteHashes`.');
|
|
428
433
|
}
|
|
429
434
|
|
|
430
|
-
const numNoteHashes = this.previousKernel.end.noteHashes
|
|
435
|
+
const numNoteHashes = this.previousKernel.end.noteHashes
|
|
436
|
+
.getActiveItems()
|
|
437
|
+
.filter(n => !n.contractAddress.isZero()).length;
|
|
431
438
|
const numToSilo = Math.max(0, numNoteHashes - this.numTransientData);
|
|
432
|
-
this.requestedDimensions.
|
|
439
|
+
this.requestedDimensions.NOTE_HASH_SILOING = numToSilo;
|
|
433
440
|
|
|
434
441
|
return numToSilo > 0;
|
|
435
442
|
}
|
|
@@ -439,13 +446,15 @@ export class PrivateKernelResetPrivateInputsBuilder {
|
|
|
439
446
|
throw new Error('`needsResetTransientData` must be run before `needsSiloNullifiers`.');
|
|
440
447
|
}
|
|
441
448
|
|
|
442
|
-
const numNullifiers = this.previousKernel.end.nullifiers
|
|
449
|
+
const numNullifiers = this.previousKernel.end.nullifiers
|
|
450
|
+
.getActiveItems()
|
|
451
|
+
.filter(n => !n.contractAddress.isZero()).length;
|
|
443
452
|
const numToSilo = Math.max(0, numNullifiers - this.numTransientData);
|
|
444
453
|
// Include the first nullifier if there's something to silo.
|
|
445
454
|
// The reset circuit checks that capped_size must be greater than or equal to all non-empty nullifiers.
|
|
446
455
|
// Which includes the first nullifier, even though its contract address is always zero and doesn't need siloing.
|
|
447
456
|
const cappedSize = numToSilo ? numToSilo + 1 : 0;
|
|
448
|
-
this.requestedDimensions.
|
|
457
|
+
this.requestedDimensions.NULLIFIER_SILOING = cappedSize;
|
|
449
458
|
|
|
450
459
|
return numToSilo > 0;
|
|
451
460
|
}
|
|
@@ -456,16 +465,18 @@ export class PrivateKernelResetPrivateInputsBuilder {
|
|
|
456
465
|
}
|
|
457
466
|
|
|
458
467
|
const privateLogs = this.previousKernel.end.privateLogs;
|
|
459
|
-
const numLogs = privateLogs.filter(l => !l.contractAddress.isZero()).length;
|
|
468
|
+
const numLogs = privateLogs.getActiveItems().filter(l => !l.contractAddress.isZero()).length;
|
|
460
469
|
|
|
461
470
|
const noteHashes = this.previousKernel.end.noteHashes;
|
|
462
|
-
const squashedNoteHashCounters = this.
|
|
463
|
-
.filter(h => h.noteHashIndex < noteHashes.
|
|
464
|
-
.map(h => noteHashes[h.noteHashIndex].counter);
|
|
465
|
-
const numSquashedLogs = privateLogs
|
|
471
|
+
const squashedNoteHashCounters = this.transientDataSquashingHints
|
|
472
|
+
.filter(h => h.noteHashIndex < noteHashes.claimedLength)
|
|
473
|
+
.map(h => noteHashes.array[h.noteHashIndex].counter);
|
|
474
|
+
const numSquashedLogs = privateLogs
|
|
475
|
+
.getActiveItems()
|
|
476
|
+
.filter(l => squashedNoteHashCounters.includes(l.inner.noteHashCounter)).length;
|
|
466
477
|
|
|
467
478
|
const numToSilo = numLogs - numSquashedLogs;
|
|
468
|
-
this.requestedDimensions.
|
|
479
|
+
this.requestedDimensions.PRIVATE_LOG_SILOING = numToSilo;
|
|
469
480
|
|
|
470
481
|
return numToSilo > 0;
|
|
471
482
|
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { MAX_INCLUDE_BY_TIMESTAMP_DURATION } from '@aztec/constants';
|
|
2
|
+
import type { PrivateKernelCircuitPublicInputs } from '@aztec/stdlib/kernel';
|
|
3
|
+
import type { UInt64 } from '@aztec/stdlib/types';
|
|
4
|
+
|
|
5
|
+
const ROUNDED_DURATIONS = [
|
|
6
|
+
3600, // 1 hour
|
|
7
|
+
1800, // 30 mins
|
|
8
|
+
1, // 1 second
|
|
9
|
+
];
|
|
10
|
+
|
|
11
|
+
function roundTimestamp(blockTimestamp: bigint, includeByTimestamp: bigint): UInt64 {
|
|
12
|
+
return ROUNDED_DURATIONS.reduce((timestamp, duration) => {
|
|
13
|
+
if (timestamp <= blockTimestamp) {
|
|
14
|
+
// The timestamp must be greater than the block timestamp.
|
|
15
|
+
// If it is too small, round it down again using a smaller duration.
|
|
16
|
+
const totalDuration = includeByTimestamp - blockTimestamp;
|
|
17
|
+
const roundedDuration = totalDuration - (totalDuration % BigInt(duration));
|
|
18
|
+
return blockTimestamp + roundedDuration;
|
|
19
|
+
}
|
|
20
|
+
return timestamp;
|
|
21
|
+
}, 0n);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function computeTxIncludeByTimestamp(
|
|
25
|
+
previousKernel: PrivateKernelCircuitPublicInputs,
|
|
26
|
+
maxDuration = MAX_INCLUDE_BY_TIMESTAMP_DURATION,
|
|
27
|
+
): UInt64 {
|
|
28
|
+
if (maxDuration > MAX_INCLUDE_BY_TIMESTAMP_DURATION) {
|
|
29
|
+
throw new Error(
|
|
30
|
+
`Custom max duration cannot be greater than the max allowed. Max allowed: ${MAX_INCLUDE_BY_TIMESTAMP_DURATION}. Custom value: ${maxDuration}.`,
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const anchorBlockTimestamp = previousKernel.constants.anchorBlockHeader.globalVariables.timestamp;
|
|
35
|
+
const maxTimestamp = anchorBlockTimestamp + BigInt(maxDuration);
|
|
36
|
+
const includeByTimestamp = previousKernel.includeByTimestamp;
|
|
37
|
+
|
|
38
|
+
// If the includeByTimestamp set during the tx execution is greater than or equal to the max allowed duration,
|
|
39
|
+
// use the maximum allowed timestamp.
|
|
40
|
+
// Note: It shouldn't be larger than the max allowed duration, but we check for it anyway.
|
|
41
|
+
if (includeByTimestamp >= maxTimestamp) {
|
|
42
|
+
return maxTimestamp;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Round it down to the nearest hour/min/second to reduce precision and avoid revealing the exact value.
|
|
46
|
+
// This makes it harder for others to infer what function calls may have been used to produce a specific timestamp.
|
|
47
|
+
const roundedTimestamp = roundTimestamp(anchorBlockTimestamp, includeByTimestamp);
|
|
48
|
+
|
|
49
|
+
// The tx can't be published if the timestamp is the same or less than the anchor block's timestamp.
|
|
50
|
+
// Future blocks will have a greater timestamp, so the tx would never be included.
|
|
51
|
+
if (roundedTimestamp <= anchorBlockTimestamp) {
|
|
52
|
+
throw new Error(
|
|
53
|
+
`Include-by timestamp must be greater than the anchor block timestamp. Anchor block timestamp: ${anchorBlockTimestamp}. Include-by timestamp: ${includeByTimestamp}.`,
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return roundedTimestamp;
|
|
58
|
+
}
|