@aztec/pxe 0.0.0-test.1 → 0.0.1-commit.017a351
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 +73 -0
- package/dest/bin/index.d.ts +2 -3
- package/dest/bin/index.d.ts.map +1 -1
- package/dest/bin/index.js +1 -28
- package/dest/bin/oracle_version_helpers.d.ts +26 -0
- package/dest/bin/oracle_version_helpers.d.ts.map +1 -0
- package/dest/bin/oracle_version_helpers.js +93 -0
- package/dest/block_synchronizer/block_stream_source.d.ts +10 -0
- package/dest/block_synchronizer/block_stream_source.d.ts.map +1 -0
- package/dest/block_synchronizer/block_stream_source.js +62 -0
- package/dest/block_synchronizer/block_synchronizer.d.ts +49 -0
- package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -0
- package/dest/block_synchronizer/block_synchronizer.js +173 -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 +20 -25
- package/dest/config/index.d.ts.map +1 -1
- package/dest/config/index.js +35 -35
- 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 +119 -0
- package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -0
- package/dest/contract_function_simulator/contract_function_simulator.js +480 -0
- package/dest/contract_function_simulator/ephemeral_array_service.d.ts +28 -0
- package/dest/contract_function_simulator/ephemeral_array_service.d.ts.map +1 -0
- package/dest/contract_function_simulator/ephemeral_array_service.js +78 -0
- package/dest/contract_function_simulator/execution_note_cache.d.ts +104 -0
- package/dest/contract_function_simulator/execution_note_cache.d.ts.map +1 -0
- package/dest/contract_function_simulator/execution_note_cache.js +208 -0
- package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts +12 -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 +30 -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 +26 -0
- package/dest/contract_function_simulator/index.d.ts.map +1 -0
- package/dest/contract_function_simulator/index.js +23 -0
- package/dest/contract_function_simulator/noir-structs/bounded_vec.d.ts +48 -0
- package/dest/contract_function_simulator/noir-structs/bounded_vec.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/bounded_vec.js +45 -0
- package/dest/contract_function_simulator/noir-structs/ephemeral_array.d.ts +37 -0
- package/dest/contract_function_simulator/noir-structs/ephemeral_array.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/ephemeral_array.js +59 -0
- package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts +20 -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 +39 -0
- package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts +26 -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 +57 -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 +63 -0
- package/dest/contract_function_simulator/noir-structs/note_data.d.ts +27 -0
- package/dest/contract_function_simulator/noir-structs/note_data.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/note_data.js +3 -0
- package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +22 -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 +47 -0
- package/dest/contract_function_simulator/noir-structs/option.d.ts +61 -0
- package/dest/contract_function_simulator/noir-structs/option.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/option.js +62 -0
- package/dest/contract_function_simulator/noir-structs/provided_secret.d.ts +11 -0
- package/dest/contract_function_simulator/noir-structs/provided_secret.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/provided_secret.js +24 -0
- 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 +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 +25 -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 +19 -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 +89 -0
- package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -0
- package/dest/contract_function_simulator/oracle/oracle.js +552 -0
- package/dest/contract_function_simulator/oracle/oracle_registry.d.ts +127 -0
- package/dest/contract_function_simulator/oracle/oracle_registry.d.ts.map +1 -0
- package/dest/contract_function_simulator/oracle/oracle_registry.js +786 -0
- package/dest/contract_function_simulator/oracle/oracle_type_mappings.d.ts +139 -0
- package/dest/contract_function_simulator/oracle/oracle_type_mappings.d.ts.map +1 -0
- package/dest/contract_function_simulator/oracle/oracle_type_mappings.js +560 -0
- package/dest/contract_function_simulator/oracle/private_execution.d.ts +23 -0
- package/dest/contract_function_simulator/oracle/private_execution.d.ts.map +1 -0
- package/dest/contract_function_simulator/oracle/private_execution.js +89 -0
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +212 -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 +457 -0
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +283 -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 +654 -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 +68 -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 +51 -0
- package/dest/contract_logging.d.ts +27 -0
- package/dest/contract_logging.d.ts.map +1 -0
- package/dest/contract_logging.js +38 -0
- package/dest/contract_sync/contract_sync_service.d.ts +42 -0
- package/dest/contract_sync/contract_sync_service.d.ts.map +1 -0
- package/dest/contract_sync/contract_sync_service.js +135 -0
- package/dest/contract_sync/helpers.d.ts +27 -0
- package/dest/contract_sync/helpers.d.ts.map +1 -0
- package/dest/contract_sync/helpers.js +53 -0
- package/dest/debug/pxe_debug_utils.d.ts +40 -0
- package/dest/debug/pxe_debug_utils.d.ts.map +1 -0
- package/dest/debug/pxe_debug_utils.js +42 -0
- package/dest/entrypoints/client/bundle/index.d.ts +6 -3
- package/dest/entrypoints/client/bundle/index.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/index.js +4 -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 +51 -14
- package/dest/entrypoints/client/lazy/index.d.ts +6 -3
- package/dest/entrypoints/client/lazy/index.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/index.js +4 -2
- package/dest/entrypoints/client/lazy/utils.d.ts +10 -10
- package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/utils.js +51 -14
- package/dest/entrypoints/pxe_creation_options.d.ts +26 -0
- package/dest/entrypoints/pxe_creation_options.d.ts.map +1 -0
- package/dest/entrypoints/pxe_creation_options.js +3 -0
- package/dest/entrypoints/server/index.d.ts +10 -4
- package/dest/entrypoints/server/index.d.ts.map +1 -1
- package/dest/entrypoints/server/index.js +8 -3
- package/dest/entrypoints/server/utils.d.ts +9 -16
- package/dest/entrypoints/server/utils.d.ts.map +1 -1
- package/dest/entrypoints/server/utils.js +62 -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 +24 -0
- package/dest/events/event_service.d.ts.map +1 -0
- package/dest/events/event_service.js +77 -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 +10 -0
- package/dest/events/private_event_filter_validator.d.ts.map +1 -0
- package/dest/events/private_event_filter_validator.js +53 -0
- package/dest/hooks/authorize_utility_call.d.ts +41 -0
- package/dest/hooks/authorize_utility_call.d.ts.map +1 -0
- package/dest/hooks/authorize_utility_call.js +4 -0
- package/dest/hooks/execution_hooks.d.ts +42 -0
- package/dest/hooks/execution_hooks.d.ts.map +1 -0
- package/dest/hooks/execution_hooks.js +9 -0
- package/dest/hooks/index.d.ts +4 -0
- package/dest/hooks/index.d.ts.map +1 -0
- package/dest/hooks/index.js +1 -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 +172 -0
- package/dest/messages/message_context_service.d.ts +17 -0
- package/dest/messages/message_context_service.d.ts.map +1 -0
- package/dest/messages/message_context_service.js +55 -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 +70 -0
- package/dest/notes/note_service.d.ts.map +1 -0
- package/dest/notes/note_service.js +172 -0
- package/dest/notes_filter.d.ts +24 -0
- package/dest/notes_filter.d.ts.map +1 -0
- package/dest/notes_filter.js +4 -0
- package/dest/oracle_version.d.ts +4 -0
- package/dest/oracle_version.d.ts.map +1 -0
- package/dest/oracle_version.js +21 -0
- package/dest/private_kernel/batch_planner.d.ts +47 -0
- package/dest/private_kernel/batch_planner.d.ts.map +1 -0
- package/dest/private_kernel/batch_planner.js +104 -0
- 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 -0
- package/dest/private_kernel/hints/index.d.ts.map +1 -0
- package/dest/private_kernel/hints/index.js +2 -0
- package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts +29 -0
- package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts.map +1 -0
- package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.js +338 -0
- package/dest/private_kernel/hints/test_utils.d.ts +122 -0
- package/dest/private_kernel/hints/test_utils.d.ts.map +1 -0
- package/dest/private_kernel/hints/test_utils.js +202 -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 +49 -0
- package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -0
- package/dest/private_kernel/private_kernel_execution_prover.js +386 -0
- package/dest/private_kernel/private_kernel_oracle.d.ts +63 -0
- package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -0
- package/dest/private_kernel/private_kernel_oracle.js +98 -0
- package/dest/pxe.d.ts +300 -0
- package/dest/pxe.d.ts.map +1 -0
- package/dest/pxe.js +839 -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/anchor_block_store/anchor_block_store.js +26 -0
- 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/backwards_compatibility_tests/kv_store_snapshot.d.ts +42 -0
- package/dest/storage/backwards_compatibility_tests/kv_store_snapshot.d.ts.map +1 -0
- package/dest/storage/backwards_compatibility_tests/kv_store_snapshot.js +93 -0
- package/dest/storage/backwards_compatibility_tests/schema_tests.d.ts +15 -0
- package/dest/storage/backwards_compatibility_tests/schema_tests.d.ts.map +1 -0
- package/dest/storage/backwards_compatibility_tests/schema_tests.js +591 -0
- package/dest/storage/backwards_compatibility_tests/store_spy.d.ts +19 -0
- package/dest/storage/backwards_compatibility_tests/store_spy.d.ts.map +1 -0
- package/dest/storage/backwards_compatibility_tests/store_spy.js +63 -0
- package/dest/storage/capsule_store/capsule_service.d.ts +21 -0
- package/dest/storage/capsule_store/capsule_service.d.ts.map +1 -0
- package/dest/storage/capsule_store/capsule_service.js +50 -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 +261 -0
- package/dest/storage/capsule_store/index.d.ts +3 -0
- package/dest/storage/capsule_store/index.d.ts.map +1 -0
- package/dest/storage/capsule_store/index.js +2 -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 +292 -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 +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/open_pxe_stores.d.ts +33 -0
- package/dest/storage/open_pxe_stores.d.ts.map +1 -0
- package/dest/storage/open_pxe_stores.js +27 -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 +276 -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 +78 -0
- package/dest/storage/tagging_store/sender_tagging_store.d.ts.map +1 -0
- package/dest/storage/tagging_store/sender_tagging_store.js +374 -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 +48 -0
- package/dest/tagging/get_all_logs_by_tags.d.ts.map +1 -0
- package/dest/tagging/get_all_logs_by_tags.js +59 -0
- package/dest/tagging/index.d.ts +18 -0
- package/dest/tagging/index.d.ts.map +1 -0
- package/dest/tagging/index.js +16 -0
- package/dest/tagging/persist_sender_tagging_index_ranges.d.ts +29 -0
- package/dest/tagging/persist_sender_tagging_index_ranges.d.ts.map +1 -0
- package/dest/tagging/persist_sender_tagging_index_ranges.js +42 -0
- package/dest/tagging/recipient_sync/sync_tagged_private_logs.d.ts +56 -0
- package/dest/tagging/recipient_sync/sync_tagged_private_logs.d.ts.map +1 -0
- package/dest/tagging/recipient_sync/sync_tagged_private_logs.js +163 -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/reconcile_tagging_index_ranges.d.ts +36 -0
- package/dest/tagging/reconcile_tagging_index_ranges.d.ts.map +1 -0
- package/dest/tagging/reconcile_tagging_index_ranges.js +74 -0
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts +16 -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 +92 -0
- package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts +17 -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 +60 -0
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts +19 -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 +72 -0
- package/package.json +48 -33
- package/src/bin/check_oracle_version.ts +88 -0
- package/src/bin/index.ts +1 -38
- package/src/bin/oracle_version_helpers.ts +121 -0
- package/src/block_synchronizer/block_stream_source.ts +81 -0
- package/src/block_synchronizer/block_synchronizer.ts +200 -0
- package/src/block_synchronizer/index.ts +1 -0
- package/src/config/index.ts +48 -56
- 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 +888 -0
- package/src/contract_function_simulator/ephemeral_array_service.ts +110 -0
- package/src/contract_function_simulator/execution_note_cache.ts +252 -0
- package/src/contract_function_simulator/execution_tagging_index_cache.ts +33 -0
- package/src/contract_function_simulator/hashed_values_cache.ts +47 -0
- package/src/contract_function_simulator/index.ts +63 -0
- package/src/contract_function_simulator/noir-structs/bounded_vec.ts +55 -0
- package/src/contract_function_simulator/noir-structs/ephemeral_array.ts +66 -0
- package/src/contract_function_simulator/noir-structs/event_validation_request.ts +52 -0
- package/src/contract_function_simulator/noir-structs/log_retrieval_request.ts +61 -0
- package/src/contract_function_simulator/noir-structs/log_retrieval_response.ts +66 -0
- package/src/contract_function_simulator/noir-structs/note_data.ts +27 -0
- package/src/contract_function_simulator/noir-structs/note_validation_request.ts +59 -0
- package/src/contract_function_simulator/noir-structs/option.ts +69 -0
- package/src/contract_function_simulator/noir-structs/provided_secret.ts +27 -0
- package/src/contract_function_simulator/noir-structs/utility_context.ts +23 -0
- package/src/contract_function_simulator/oracle/index.ts +16 -0
- package/src/contract_function_simulator/oracle/interfaces.ts +21 -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 +711 -0
- package/src/contract_function_simulator/oracle/oracle_registry.ts +585 -0
- package/src/contract_function_simulator/oracle/oracle_type_mappings.ts +553 -0
- package/src/contract_function_simulator/oracle/private_execution.ts +141 -0
- package/src/contract_function_simulator/oracle/private_execution_oracle.ts +667 -0
- package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +967 -0
- package/src/contract_function_simulator/pick_notes.ts +160 -0
- package/src/contract_function_simulator/proxied_contract_data_source.ts +60 -0
- package/src/contract_logging.ts +52 -0
- package/src/contract_sync/contract_sync_service.ts +189 -0
- package/src/contract_sync/helpers.ts +86 -0
- package/src/debug/pxe_debug_utils.ts +85 -0
- package/src/entrypoints/client/bundle/index.ts +5 -2
- package/src/entrypoints/client/bundle/utils.ts +47 -35
- package/src/entrypoints/client/lazy/index.ts +5 -2
- package/src/entrypoints/client/lazy/utils.ts +48 -31
- package/src/entrypoints/pxe_creation_options.ts +28 -0
- package/src/entrypoints/server/index.ts +9 -3
- package/src/entrypoints/server/utils.ts +65 -56
- package/src/{pxe_service/error_enriching.ts → error_enriching.ts} +40 -39
- package/src/events/event_service.ts +119 -0
- package/src/events/index.ts +1 -0
- package/src/events/private_event_filter_validator.ts +66 -0
- package/src/hooks/authorize_utility_call.ts +44 -0
- package/src/hooks/execution_hooks.ts +48 -0
- package/src/hooks/index.ts +7 -0
- package/src/job_coordinator/job_coordinator.ts +150 -0
- package/src/logs/log_service.ts +237 -0
- package/src/messages/message_context_service.ts +62 -0
- package/src/notes/index.ts +1 -0
- package/src/notes/note_service.ts +230 -0
- package/src/notes_filter.ts +24 -0
- package/src/oracle_version.ts +22 -0
- package/src/private_kernel/batch_planner.ts +169 -0
- package/src/private_kernel/hints/compute_tx_expiration_timestamp.ts +58 -0
- package/src/private_kernel/hints/index.ts +2 -0
- package/src/private_kernel/hints/private_kernel_reset_private_inputs_builder.ts +542 -0
- package/src/private_kernel/hints/test_utils.ts +318 -0
- package/src/private_kernel/index.ts +2 -0
- package/src/private_kernel/private_kernel_execution_prover.ts +598 -0
- package/src/private_kernel/private_kernel_oracle.ts +162 -0
- package/src/pxe.ts +1305 -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/anchor_block_store/anchor_block_store.ts +33 -0
- package/src/storage/anchor_block_store/index.ts +1 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/AddressStore.json +22 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/AnchorBlockStore.json +3 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/CapsuleStore.json +16 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/ContractStore.json +28 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/KeyStore.json +52 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/L2TipsKVStore.json +46 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/NoteStore.json +36 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/PrivateEventStore.json +44 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/RecipientTaggingStore.json +18 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/SenderAddressBookStore.json +16 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/SenderTaggingStore.json +22 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/opened_stores.json +97 -0
- package/src/storage/backwards_compatibility_tests/kv_store_snapshot.ts +122 -0
- package/src/storage/backwards_compatibility_tests/schema_tests.ts +712 -0
- package/src/storage/backwards_compatibility_tests/store_spy.ts +73 -0
- package/src/storage/capsule_store/capsule_service.ts +90 -0
- package/src/storage/capsule_store/capsule_store.ts +333 -0
- package/src/storage/capsule_store/index.ts +2 -0
- package/src/storage/contract_store/contract_store.ts +408 -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_store/note_store.ts +415 -0
- package/src/storage/note_store/stored_note.ts +48 -0
- package/src/storage/open_pxe_stores.ts +49 -0
- package/src/storage/private_event_store/private_event_store.ts +388 -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 +476 -0
- package/src/tagging/constants.ts +10 -0
- package/src/tagging/get_all_logs_by_tags.ts +120 -0
- package/src/tagging/index.ts +20 -0
- package/src/tagging/persist_sender_tagging_index_ranges.ts +57 -0
- package/src/tagging/recipient_sync/sync_tagged_private_logs.ts +240 -0
- package/src/tagging/recipient_sync/utils/find_highest_indexes.ts +34 -0
- package/src/tagging/reconcile_tagging_index_ranges.ts +102 -0
- package/src/tagging/sender_sync/sync_sender_tagging_indexes.ts +134 -0
- package/src/tagging/sender_sync/utils/get_status_change_of_pending.ts +66 -0
- package/src/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.ts +84 -0
- 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/entrypoints/client/pxe_creation_options.js +0 -1
- package/dest/kernel_oracle/index.d.ts +0 -45
- package/dest/kernel_oracle/index.d.ts.map +0 -1
- package/dest/kernel_oracle/index.js +0 -76
- 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/hints/index.js +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/sync_data_provider/sync_data_provider.js +0 -29
- 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/synchronizer/synchronizer.js +0 -103
- 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/entrypoints/client/pxe_creation_options.ts +0 -7
- package/src/kernel_oracle/index.ts +0 -117
- package/src/kernel_prover/hints/build_private_kernel_reset_private_inputs.ts +0 -472
- package/src/kernel_prover/hints/index.ts +0 -1
- package/src/kernel_prover/index.ts +0 -2
- package/src/kernel_prover/kernel_prover.ts +0 -351
- package/src/kernel_prover/proving_data_oracle.ts +0 -83
- 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/note_data_provider/note_data_provider.ts +0 -345
- package/src/storage/sync_data_provider/index.ts +0 -1
- package/src/storage/sync_data_provider/sync_data_provider.ts +0 -40
- 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/synchronizer/synchronizer.ts +0 -121
- package/src/test/pxe_test_suite.ts +0 -111
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { ClaimedLengthArray, PrivateAccumulatedData, PrivateKernelCircuitPublicInputs, PrivateValidationRequests, ScopedKeyValidationRequestAndSeparator, ScopedPrivateLogData } from '@aztec/stdlib/kernel';
|
|
2
|
+
import { VerificationKeyData } from '@aztec/stdlib/vks';
|
|
3
|
+
import { PrivateKernelResetPrivateInputsBuilder } from './hints/private_kernel_reset_private_inputs_builder.js';
|
|
4
|
+
/**
|
|
5
|
+
* Decides how many apps from the top of the execution stack the next kernel iteration should
|
|
6
|
+
* absorb. The decision is made by keeping track of an app-by-app accumulator calling
|
|
7
|
+
* `PrivateKernelResetPrivateInputsBuilder.needsReset()` whether a reset would be required before
|
|
8
|
+
* taking each candidate.
|
|
9
|
+
*
|
|
10
|
+
* The K-batched kernels are mathematically equivalent to running K sequential `init`/`inner`
|
|
11
|
+
* iterations so a multi-app fit-check reduces to a sequence of single-app fit-checks against a rolling
|
|
12
|
+
* accumulator.
|
|
13
|
+
*/ export class BatchPlanner {
|
|
14
|
+
noteHashNullifierCounterMap;
|
|
15
|
+
splitCounter;
|
|
16
|
+
maxBatchSize;
|
|
17
|
+
constructor(noteHashNullifierCounterMap, splitCounter, maxBatchSize){
|
|
18
|
+
this.noteHashNullifierCounterMap = noteHashNullifierCounterMap;
|
|
19
|
+
this.splitCounter = splitCounter;
|
|
20
|
+
this.maxBatchSize = maxBatchSize;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Returns the number of apps from the top of `stack` that the next kernel iteration should
|
|
24
|
+
* batch. Always at least 1 — the caller is expected to have run any pending resets first, so
|
|
25
|
+
* the next single app must always fit.
|
|
26
|
+
*
|
|
27
|
+
* The walk mirrors `consumeNextApp`'s stack manipulation (pop top, push reversed nested
|
|
28
|
+
* children, then DFS into them) on a copy of the stack, so the planner can look ahead past
|
|
29
|
+
* the parent's children without mutating the real prover stack.
|
|
30
|
+
*/ decideBatchSize(currentAccumulator, stack) {
|
|
31
|
+
const virtualStack = [
|
|
32
|
+
...stack
|
|
33
|
+
];
|
|
34
|
+
let projected = currentAccumulator;
|
|
35
|
+
let chosen = 0;
|
|
36
|
+
for(let i = 0; i < this.maxBatchSize && virtualStack.length > 0; i++){
|
|
37
|
+
const probe = new PrivateKernelResetPrivateInputsBuilder({
|
|
38
|
+
publicInputs: projected,
|
|
39
|
+
verificationKey: VerificationKeyData.empty(),
|
|
40
|
+
outputWitness: new Map(),
|
|
41
|
+
bytecode: Buffer.from([])
|
|
42
|
+
}, virtualStack, this.noteHashNullifierCounterMap, this.splitCounter);
|
|
43
|
+
if (probe.needsReset()) {
|
|
44
|
+
break;
|
|
45
|
+
}
|
|
46
|
+
// Speculatively consume the top of the virtual stack the same way `consumeNextApp` does
|
|
47
|
+
// on the real stack: pop the candidate, push its reversed nested children so the next
|
|
48
|
+
// iteration's top is the next DFS app.
|
|
49
|
+
const candidate = virtualStack.pop();
|
|
50
|
+
virtualStack.push(...[
|
|
51
|
+
...candidate.nestedExecutionResults
|
|
52
|
+
].reverse());
|
|
53
|
+
projected = appendApp(projected, candidate);
|
|
54
|
+
chosen++;
|
|
55
|
+
}
|
|
56
|
+
return Math.max(1, chosen);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Returns a new `PrivateKernelCircuitPublicInputs` representing the accumulator after one kernel
|
|
61
|
+
* iteration has absorbed `app`. Mirrors the kernel composer's accumulator-update step
|
|
62
|
+
* (`PrivateKernelCircuitOutputComposer::scope_and_propagate_from_private_call`) for the six
|
|
63
|
+
* fields that `PrivateKernelResetPrivateInputsBuilder.needsReset()` inspects:
|
|
64
|
+
*
|
|
65
|
+
* - `validationRequests.noteHashReadRequests` (already scoped per app; appended as-is)
|
|
66
|
+
* - `validationRequests.nullifierReadRequests` (already scoped per app; appended as-is)
|
|
67
|
+
* - `validationRequests.scopedKeyValidationRequestsAndSeparators` (scope with call's contract address)
|
|
68
|
+
* - `end.noteHashes` (scope)
|
|
69
|
+
* - `end.nullifiers` (scope)
|
|
70
|
+
* - `end.privateLogs` (scope)
|
|
71
|
+
*
|
|
72
|
+
* Other fields on `PrivateKernelCircuitPublicInputs` (constants, fee_payer, expiration_timestamp,
|
|
73
|
+
* public_call_requests, l2_to_l1_msgs, contract_class_logs_hashes, etc.) are not read by
|
|
74
|
+
* `needsReset()` and are carried over unchanged from `acc`.
|
|
75
|
+
*/ export function appendApp(acc, app) {
|
|
76
|
+
const ca = app.publicInputs.callContext.contractAddress;
|
|
77
|
+
const appPi = app.publicInputs;
|
|
78
|
+
const newNoteHashReadRequests = cloneClaimedLengthArray(acc.validationRequests.noteHashReadRequests);
|
|
79
|
+
pushAll(newNoteHashReadRequests, appPi.noteHashReadRequests.getActiveItems());
|
|
80
|
+
const newNullifierReadRequests = cloneClaimedLengthArray(acc.validationRequests.nullifierReadRequests);
|
|
81
|
+
pushAll(newNullifierReadRequests, appPi.nullifierReadRequests.getActiveItems());
|
|
82
|
+
const newScopedKvrs = cloneClaimedLengthArray(acc.validationRequests.scopedKeyValidationRequestsAndSeparators);
|
|
83
|
+
pushAll(newScopedKvrs, appPi.keyValidationRequestsAndSeparators.getActiveItems().map((kvr)=>new ScopedKeyValidationRequestAndSeparator(kvr, ca)));
|
|
84
|
+
const newNoteHashes = cloneClaimedLengthArray(acc.end.noteHashes);
|
|
85
|
+
pushAll(newNoteHashes, appPi.noteHashes.getActiveItems().map((nh)=>nh.scope(ca)));
|
|
86
|
+
const newNullifiers = cloneClaimedLengthArray(acc.end.nullifiers);
|
|
87
|
+
pushAll(newNullifiers, appPi.nullifiers.getActiveItems().map((n)=>n.scope(ca)));
|
|
88
|
+
const newPrivateLogs = cloneClaimedLengthArray(acc.end.privateLogs);
|
|
89
|
+
pushAll(newPrivateLogs, appPi.privateLogs.getActiveItems().map((pl)=>new ScopedPrivateLogData(pl, ca)));
|
|
90
|
+
const validationRequests = new PrivateValidationRequests(newNoteHashReadRequests, newNullifierReadRequests, newScopedKvrs);
|
|
91
|
+
const end = new PrivateAccumulatedData(newNoteHashes, newNullifiers, acc.end.l2ToL1Msgs, newPrivateLogs, acc.end.contractClassLogsHashes, acc.end.publicCallRequests, acc.end.privateCallStack);
|
|
92
|
+
return new PrivateKernelCircuitPublicInputs(acc.constants, acc.minRevertibleSideEffectCounter, validationRequests, end, acc.publicTeardownCallRequest, acc.feePayer, acc.expirationTimestamp, acc.isPrivateOnly, acc.claimedFirstNullifier, acc.claimedRevertibleCounter);
|
|
93
|
+
}
|
|
94
|
+
function cloneClaimedLengthArray(src) {
|
|
95
|
+
return new ClaimedLengthArray([
|
|
96
|
+
...src.array
|
|
97
|
+
], src.claimedLength);
|
|
98
|
+
}
|
|
99
|
+
function pushAll(arr, items) {
|
|
100
|
+
for (const item of items){
|
|
101
|
+
arr.array[arr.claimedLength] = item;
|
|
102
|
+
arr.claimedLength++;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { PrivateKernelCircuitPublicInputs } from '@aztec/stdlib/kernel';
|
|
2
|
+
import type { UInt64 } from '@aztec/stdlib/types';
|
|
3
|
+
export declare function computeTxExpirationTimestamp(previousKernel: PrivateKernelCircuitPublicInputs, txLifetime?: number): UInt64;
|
|
4
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29tcHV0ZV90eF9leHBpcmF0aW9uX3RpbWVzdGFtcC5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL3ByaXZhdGVfa2VybmVsL2hpbnRzL2NvbXB1dGVfdHhfZXhwaXJhdGlvbl90aW1lc3RhbXAudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQ0EsT0FBTyxLQUFLLEVBQUUsZ0NBQWdDLEVBQUUsTUFBTSxzQkFBc0IsQ0FBQztBQUM3RSxPQUFPLEtBQUssRUFBRSxNQUFNLEVBQUUsTUFBTSxxQkFBcUIsQ0FBQztBQXFCbEQsd0JBQWdCLDRCQUE0QixDQUMxQyxjQUFjLEVBQUUsZ0NBQWdDLEVBQ2hELFVBQVUsU0FBa0IsR0FDM0IsTUFBTSxDQStCUiJ9
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compute_tx_expiration_timestamp.d.ts","sourceRoot":"","sources":["../../../src/private_kernel/hints/compute_tx_expiration_timestamp.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,sBAAsB,CAAC;AAC7E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAqBlD,wBAAgB,4BAA4B,CAC1C,cAAc,EAAE,gCAAgC,EAChD,UAAU,SAAkB,GAC3B,MAAM,CA+BR"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { MAX_TX_LIFETIME } from '@aztec/constants';
|
|
2
|
+
const ROUNDED_DURATIONS = [
|
|
3
|
+
3600,
|
|
4
|
+
1800,
|
|
5
|
+
1
|
|
6
|
+
];
|
|
7
|
+
function roundTimestamp(blockTimestamp, expirationTimestamp) {
|
|
8
|
+
return ROUNDED_DURATIONS.reduce((timestamp, duration)=>{
|
|
9
|
+
if (timestamp <= blockTimestamp) {
|
|
10
|
+
// The timestamp must be greater than the block timestamp.
|
|
11
|
+
// If it is too small, round it down again using a smaller duration.
|
|
12
|
+
const totalDuration = expirationTimestamp - blockTimestamp;
|
|
13
|
+
const roundedDuration = totalDuration - totalDuration % BigInt(duration);
|
|
14
|
+
return blockTimestamp + roundedDuration;
|
|
15
|
+
}
|
|
16
|
+
return timestamp;
|
|
17
|
+
}, 0n);
|
|
18
|
+
}
|
|
19
|
+
export function computeTxExpirationTimestamp(previousKernel, txLifetime = MAX_TX_LIFETIME) {
|
|
20
|
+
if (txLifetime > MAX_TX_LIFETIME) {
|
|
21
|
+
throw new Error(`Custom tx lifetime cannot be greater than the max allowed. Max allowed: ${MAX_TX_LIFETIME}. Custom value: ${txLifetime}.`);
|
|
22
|
+
}
|
|
23
|
+
const anchorBlockTimestamp = previousKernel.constants.anchorBlockHeader.globalVariables.timestamp;
|
|
24
|
+
const maxTimestamp = anchorBlockTimestamp + BigInt(txLifetime);
|
|
25
|
+
const expirationTimestamp = previousKernel.expirationTimestamp;
|
|
26
|
+
// If the expirationTimestamp set during the tx execution is greater than or equal to the max allowed duration,
|
|
27
|
+
// use the maximum allowed timestamp.
|
|
28
|
+
// Note: It shouldn't be larger than the max allowed duration, but we check for it anyway.
|
|
29
|
+
if (expirationTimestamp >= maxTimestamp) {
|
|
30
|
+
return maxTimestamp;
|
|
31
|
+
}
|
|
32
|
+
// Round it down to the nearest hour/min/second to reduce precision and avoid revealing the exact value.
|
|
33
|
+
// This makes it harder for others to infer what function calls may have been used to produce a specific timestamp.
|
|
34
|
+
const roundedTimestamp = roundTimestamp(anchorBlockTimestamp, expirationTimestamp);
|
|
35
|
+
// The tx can't be published if the timestamp is the same or less than the anchor block's timestamp.
|
|
36
|
+
// Future blocks will have a greater timestamp, so the tx would never be included.
|
|
37
|
+
if (roundedTimestamp <= anchorBlockTimestamp) {
|
|
38
|
+
throw new Error(`Include-by timestamp must be greater than the anchor block timestamp. Anchor block timestamp: ${anchorBlockTimestamp}. Include-by timestamp: ${expirationTimestamp}.`);
|
|
39
|
+
}
|
|
40
|
+
return roundedTimestamp;
|
|
41
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export * from './private_kernel_reset_private_inputs_builder.js';
|
|
2
|
+
export * from './compute_tx_expiration_timestamp.js';
|
|
3
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9wcml2YXRlX2tlcm5lbC9oaW50cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxjQUFjLGtEQUFrRCxDQUFDO0FBQ2pFLGNBQWMsc0NBQXNDLENBQUMifQ==
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/private_kernel/hints/index.ts"],"names":[],"mappings":"AAAA,cAAc,kDAAkD,CAAC;AACjE,cAAc,sCAAsC,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type PrivateKernelCircuitPublicInputs, PrivateKernelResetCircuitPrivateInputs, PrivateKernelResetDimensions, type PrivateKernelSimulateOutput } from '@aztec/stdlib/kernel';
|
|
2
|
+
import { type PrivateCallExecutionResult } from '@aztec/stdlib/tx';
|
|
3
|
+
import type { PrivateKernelOracle } from '../private_kernel_oracle.js';
|
|
4
|
+
export declare class PrivateKernelResetPrivateInputsBuilder {
|
|
5
|
+
private previousKernelOutput;
|
|
6
|
+
private executionStack;
|
|
7
|
+
private noteHashNullifierCounterMap;
|
|
8
|
+
private splitCounter;
|
|
9
|
+
private previousKernel;
|
|
10
|
+
private nextIteration?;
|
|
11
|
+
private noteHashResetActions;
|
|
12
|
+
private nullifierResetActions;
|
|
13
|
+
private numTransientData?;
|
|
14
|
+
private transientDataSquashingHints;
|
|
15
|
+
private requestedDimensions;
|
|
16
|
+
constructor(previousKernelOutput: PrivateKernelSimulateOutput<PrivateKernelCircuitPublicInputs>, executionStack: PrivateCallExecutionResult[], noteHashNullifierCounterMap: Map<number, number>, splitCounter: number);
|
|
17
|
+
getRequestedDimensions(): PrivateKernelResetDimensions;
|
|
18
|
+
needsReset(): boolean;
|
|
19
|
+
build(oracle: PrivateKernelOracle): Promise<PrivateKernelResetCircuitPrivateInputs>;
|
|
20
|
+
private reduceReadRequestActions;
|
|
21
|
+
private needsResetNoteHashReadRequests;
|
|
22
|
+
private needsResetNullifierReadRequests;
|
|
23
|
+
private needsResetKeyValidationRequests;
|
|
24
|
+
private needsResetTransientData;
|
|
25
|
+
private needsSiloNoteHashes;
|
|
26
|
+
private needsSiloNullifiers;
|
|
27
|
+
private needsSiloPrivateLogs;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJpdmF0ZV9rZXJuZWxfcmVzZXRfcHJpdmF0ZV9pbnB1dHNfYnVpbGRlci5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL3ByaXZhdGVfa2VybmVsL2hpbnRzL3ByaXZhdGVfa2VybmVsX3Jlc2V0X3ByaXZhdGVfaW5wdXRzX2J1aWxkZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBZUEsT0FBTyxFQUtMLEtBQUssZ0NBQWdDLEVBRXJDLHNDQUFzQyxFQUN0Qyw0QkFBNEIsRUFFNUIsS0FBSywyQkFBMkIsRUFhakMsTUFBTSxzQkFBc0IsQ0FBQztBQUM5QixPQUFPLEVBQUUsS0FBSywwQkFBMEIsRUFBaUIsTUFBTSxrQkFBa0IsQ0FBQztBQUdsRixPQUFPLEtBQUssRUFBRSxtQkFBbUIsRUFBRSxNQUFNLDZCQUE2QixDQUFDO0FBbUN2RSxxQkFBYSxzQ0FBc0M7SUFlL0MsT0FBTyxDQUFDLG9CQUFvQjtJQUM1QixPQUFPLENBQUMsY0FBYztJQUN0QixPQUFPLENBQUMsMkJBQTJCO0lBQ25DLE9BQU8sQ0FBQyxZQUFZO0lBakJ0QixPQUFPLENBQUMsY0FBYyxDQUFtQztJQUV6RCxPQUFPLENBQUMsYUFBYSxDQUFDLENBQTZCO0lBRW5ELE9BQU8sQ0FBQyxvQkFBb0IsQ0FBcUU7SUFDakcsT0FBTyxDQUFDLHFCQUFxQixDQUFxRTtJQUNsRyxPQUFPLENBQUMsZ0JBQWdCLENBQUMsQ0FBUztJQUNsQyxPQUFPLENBQUMsMkJBQTJCLENBR2pDO0lBQ0YsT0FBTyxDQUFDLG1CQUFtQixDQUF3QztJQUVuRSxZQUNVLG9CQUFvQixFQUFFLDJCQUEyQixDQUFDLGdDQUFnQyxDQUFDLEVBQ25GLGNBQWMsRUFBRSwwQkFBMEIsRUFBRSxFQUM1QywyQkFBMkIsRUFBRSxHQUFHLENBQUMsTUFBTSxFQUFFLE1BQU0sQ0FBQyxFQUNoRCxZQUFZLEVBQUUsTUFBTSxFQUk3QjtJQUVELHNCQUFzQixJQUFJLDRCQUE0QixDQUVyRDtJQUVELFVBQVUsSUFBSSxPQUFPLENBc0JwQjtJQUVLLEtBQUssQ0FBQyxNQUFNLEVBQUUsbUJBQW1CLG1EQThFdEM7SUFFRCxPQUFPLENBQUMsd0JBQXdCO0lBMkJoQyxPQUFPLENBQUMsOEJBQThCO0lBMEV0QyxPQUFPLENBQUMsK0JBQStCO0lBeUV2QyxPQUFPLENBQUMsK0JBQStCO0lBYXZDLE9BQU8sQ0FBQyx1QkFBdUI7SUEwRi9CLE9BQU8sQ0FBQyxtQkFBbUI7SUFpQjNCLE9BQU8sQ0FBQyxtQkFBbUI7SUFpQjNCLE9BQU8sQ0FBQyxvQkFBb0I7Q0FxQjdCIn0=
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"private_kernel_reset_private_inputs_builder.d.ts","sourceRoot":"","sources":["../../../src/private_kernel/hints/private_kernel_reset_private_inputs_builder.ts"],"names":[],"mappings":"AAeA,OAAO,EAKL,KAAK,gCAAgC,EAErC,sCAAsC,EACtC,4BAA4B,EAE5B,KAAK,2BAA2B,EAajC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,KAAK,0BAA0B,EAAiB,MAAM,kBAAkB,CAAC;AAGlF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAmCvE,qBAAa,sCAAsC;IAe/C,OAAO,CAAC,oBAAoB;IAC5B,OAAO,CAAC,cAAc;IACtB,OAAO,CAAC,2BAA2B;IACnC,OAAO,CAAC,YAAY;IAjBtB,OAAO,CAAC,cAAc,CAAmC;IAEzD,OAAO,CAAC,aAAa,CAAC,CAA6B;IAEnD,OAAO,CAAC,oBAAoB,CAAqE;IACjG,OAAO,CAAC,qBAAqB,CAAqE;IAClG,OAAO,CAAC,gBAAgB,CAAC,CAAS;IAClC,OAAO,CAAC,2BAA2B,CAGjC;IACF,OAAO,CAAC,mBAAmB,CAAwC;IAEnE,YACU,oBAAoB,EAAE,2BAA2B,CAAC,gCAAgC,CAAC,EACnF,cAAc,EAAE,0BAA0B,EAAE,EAC5C,2BAA2B,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EAChD,YAAY,EAAE,MAAM,EAI7B;IAED,sBAAsB,IAAI,4BAA4B,CAErD;IAED,UAAU,IAAI,OAAO,CAsBpB;IAEK,KAAK,CAAC,MAAM,EAAE,mBAAmB,mDA8EtC;IAED,OAAO,CAAC,wBAAwB;IA2BhC,OAAO,CAAC,8BAA8B;IA0EtC,OAAO,CAAC,+BAA+B;IAyEvC,OAAO,CAAC,+BAA+B;IAavC,OAAO,CAAC,uBAAuB;IA0F/B,OAAO,CAAC,mBAAmB;IAiB3B,OAAO,CAAC,mBAAmB;IAiB3B,OAAO,CAAC,oBAAoB;CAqB7B"}
|
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
import { MAX_KEY_VALIDATION_REQUESTS_PER_TX, MAX_NOTE_HASHES_PER_TX, MAX_NOTE_HASH_READ_REQUESTS_PER_TX, MAX_NULLIFIERS_PER_TX, MAX_NULLIFIER_READ_REQUESTS_PER_TX, MAX_PRIVATE_LOGS_PER_TX, NULLIFIER_TREE_HEIGHT } from '@aztec/constants';
|
|
2
|
+
import { makeTuple } from '@aztec/foundation/array';
|
|
3
|
+
import { padArrayEnd } from '@aztec/foundation/collection';
|
|
4
|
+
import { assertLength } from '@aztec/foundation/serialize';
|
|
5
|
+
import { MembershipWitness } from '@aztec/foundation/trees';
|
|
6
|
+
import { privateKernelResetDimensionsConfig } from '@aztec/noir-protocol-circuits-types/client';
|
|
7
|
+
import { KeyValidationHint, PaddedSideEffects, PrivateKernelData, PrivateKernelResetCircuitPrivateInputs, PrivateKernelResetDimensions, PrivateKernelResetHints, ReadRequestActionEnum, ReadRequestResetActions, TransientDataSquashingHint, buildNoteHashReadRequestHintsFromResetActions, buildNullifierReadRequestHintsFromResetActions, buildTransientDataHints, countSquashedLogs, findPrivateKernelResetDimensions, getNoteHashReadRequestResetActions, getNullifierReadRequestResetActions, privateKernelResetDimensionNames } from '@aztec/stdlib/kernel';
|
|
8
|
+
import { collectNested } from '@aztec/stdlib/tx';
|
|
9
|
+
import { VkData } from '@aztec/stdlib/vks';
|
|
10
|
+
function getNullifierMembershipWitnessResolver(oracle) {
|
|
11
|
+
return async (nullifier)=>{
|
|
12
|
+
const res = await oracle.getNullifierMembershipWitness(nullifier);
|
|
13
|
+
if (!res) {
|
|
14
|
+
throw new Error(`Cannot find the leaf for nullifier ${nullifier}.`);
|
|
15
|
+
}
|
|
16
|
+
const { index, siblingPath, leafPreimage } = res;
|
|
17
|
+
return {
|
|
18
|
+
membershipWitness: new MembershipWitness(NULLIFIER_TREE_HEIGHT, index, siblingPath.toTuple()),
|
|
19
|
+
leafPreimage
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
async function getMasterSecretKeysAndKeyTypeDomainSeparators(keyValidationRequests, numRequestsToVerify, oracle) {
|
|
24
|
+
const numRequestsToProcess = Math.min(keyValidationRequests.claimedLength, numRequestsToVerify);
|
|
25
|
+
const keysHints = await Promise.all(keyValidationRequests.array.slice(0, numRequestsToProcess).map(async ({ request })=>{
|
|
26
|
+
const secretKeys = await oracle.getMasterSecretKey(request.request.pkMHash);
|
|
27
|
+
return new KeyValidationHint(secretKeys);
|
|
28
|
+
}));
|
|
29
|
+
return padArrayEnd(keysHints, KeyValidationHint.empty(), MAX_KEY_VALIDATION_REQUESTS_PER_TX);
|
|
30
|
+
}
|
|
31
|
+
export class PrivateKernelResetPrivateInputsBuilder {
|
|
32
|
+
previousKernelOutput;
|
|
33
|
+
executionStack;
|
|
34
|
+
noteHashNullifierCounterMap;
|
|
35
|
+
splitCounter;
|
|
36
|
+
previousKernel;
|
|
37
|
+
// If there's no next iteration, it's the final reset.
|
|
38
|
+
nextIteration;
|
|
39
|
+
noteHashResetActions;
|
|
40
|
+
nullifierResetActions;
|
|
41
|
+
numTransientData;
|
|
42
|
+
transientDataSquashingHints;
|
|
43
|
+
requestedDimensions;
|
|
44
|
+
constructor(previousKernelOutput, executionStack, noteHashNullifierCounterMap, splitCounter){
|
|
45
|
+
this.previousKernelOutput = previousKernelOutput;
|
|
46
|
+
this.executionStack = executionStack;
|
|
47
|
+
this.noteHashNullifierCounterMap = noteHashNullifierCounterMap;
|
|
48
|
+
this.splitCounter = splitCounter;
|
|
49
|
+
this.noteHashResetActions = ReadRequestResetActions.empty(MAX_NOTE_HASH_READ_REQUESTS_PER_TX);
|
|
50
|
+
this.nullifierResetActions = ReadRequestResetActions.empty(MAX_NULLIFIER_READ_REQUESTS_PER_TX);
|
|
51
|
+
this.transientDataSquashingHints = makeTuple(MAX_NULLIFIERS_PER_TX, ()=>new TransientDataSquashingHint(MAX_NULLIFIERS_PER_TX, MAX_NOTE_HASHES_PER_TX));
|
|
52
|
+
this.requestedDimensions = PrivateKernelResetDimensions.empty();
|
|
53
|
+
this.previousKernel = previousKernelOutput.publicInputs;
|
|
54
|
+
this.nextIteration = executionStack[this.executionStack.length - 1]?.publicInputs;
|
|
55
|
+
}
|
|
56
|
+
getRequestedDimensions() {
|
|
57
|
+
return this.requestedDimensions;
|
|
58
|
+
}
|
|
59
|
+
needsReset() {
|
|
60
|
+
const fns = [
|
|
61
|
+
()=>this.needsResetNoteHashReadRequests(),
|
|
62
|
+
()=>this.needsResetNullifierReadRequests(),
|
|
63
|
+
()=>this.needsResetKeyValidationRequests(),
|
|
64
|
+
()=>this.needsResetTransientData()
|
|
65
|
+
];
|
|
66
|
+
if (this.nextIteration) {
|
|
67
|
+
// If there's a next iteration, reset is needed only when data of a dimension is about to overflow.
|
|
68
|
+
// fns are executed until a dimension that needs reset is found.
|
|
69
|
+
return fns.some((fn)=>fn());
|
|
70
|
+
} else {
|
|
71
|
+
// Siloing is only needed after processing all iterations.
|
|
72
|
+
fns.push(...[
|
|
73
|
+
()=>this.needsSiloNoteHashes(),
|
|
74
|
+
()=>this.needsSiloNullifiers(),
|
|
75
|
+
()=>this.needsSiloPrivateLogs()
|
|
76
|
+
]);
|
|
77
|
+
// If there's no next iteration, reset is needed when any of the dimension has non empty data.
|
|
78
|
+
// All the fns should to be executed so that data in all dimensions will be reset.
|
|
79
|
+
const result = fns.map((fn)=>fn());
|
|
80
|
+
return result.some((r)=>r);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
async build(oracle) {
|
|
84
|
+
if (privateKernelResetDimensionNames.every((name)=>!this.requestedDimensions[name])) {
|
|
85
|
+
throw new Error('Reset is not required.');
|
|
86
|
+
}
|
|
87
|
+
const isInner = !!this.nextIteration;
|
|
88
|
+
// "final" reset must be done exactly once, because siloing can't be run repeatedly.
|
|
89
|
+
// The dimensions found must be big enough to reset all values, i.e. empty remainder.
|
|
90
|
+
const allowRemainder = isInner;
|
|
91
|
+
const dimensions = findPrivateKernelResetDimensions(this.requestedDimensions, privateKernelResetDimensionsConfig, isInner, allowRemainder);
|
|
92
|
+
this.reduceReadRequestActions(this.noteHashResetActions, dimensions.NOTE_HASH_PENDING_READ, dimensions.NOTE_HASH_SETTLED_READ);
|
|
93
|
+
this.reduceReadRequestActions(this.nullifierResetActions, dimensions.NULLIFIER_PENDING_READ, dimensions.NULLIFIER_SETTLED_READ);
|
|
94
|
+
// Execute all the expensive node querying operations in parallel.
|
|
95
|
+
const [previousVkMembershipWitness, noteHashReadRequestHints, nullifierReadRequestHints, keyValidationHints] = await Promise.all([
|
|
96
|
+
oracle.getVkMembershipWitness(this.previousKernelOutput.verificationKey.keyAsFields),
|
|
97
|
+
buildNoteHashReadRequestHintsFromResetActions(oracle, this.previousKernel.validationRequests.noteHashReadRequests, this.previousKernel.end.noteHashes, this.noteHashResetActions),
|
|
98
|
+
buildNullifierReadRequestHintsFromResetActions({
|
|
99
|
+
getNullifierMembershipWitness: getNullifierMembershipWitnessResolver(oracle)
|
|
100
|
+
}, this.previousKernel.validationRequests.nullifierReadRequests, this.nullifierResetActions),
|
|
101
|
+
getMasterSecretKeysAndKeyTypeDomainSeparators(this.previousKernel.validationRequests.scopedKeyValidationRequestsAndSeparators, dimensions.KEY_VALIDATION, oracle)
|
|
102
|
+
]);
|
|
103
|
+
const vkData = new VkData(this.previousKernelOutput.verificationKey, Number(previousVkMembershipWitness.leafIndex), previousVkMembershipWitness.siblingPath);
|
|
104
|
+
const previousKernelData = new PrivateKernelData(this.previousKernelOutput.publicInputs, vkData);
|
|
105
|
+
// TODO: Enable padding when we have a better idea what are the final amounts we should pad to.
|
|
106
|
+
const paddedSideEffects = PaddedSideEffects.empty();
|
|
107
|
+
return new PrivateKernelResetCircuitPrivateInputs(previousKernelData, paddedSideEffects, new PrivateKernelResetHints(noteHashReadRequestHints, nullifierReadRequestHints, keyValidationHints, this.transientDataSquashingHints), dimensions);
|
|
108
|
+
}
|
|
109
|
+
reduceReadRequestActions(resetActions, maxPending, maxSettled) {
|
|
110
|
+
let numPending = 0;
|
|
111
|
+
let numSettled = 0;
|
|
112
|
+
for(let i = 0; i < resetActions.actions.length; i++){
|
|
113
|
+
const action = resetActions.actions[i];
|
|
114
|
+
if (action === ReadRequestActionEnum.READ_AS_PENDING) {
|
|
115
|
+
if (numPending < maxPending) {
|
|
116
|
+
numPending++;
|
|
117
|
+
} else {
|
|
118
|
+
resetActions.actions[i] = ReadRequestActionEnum.SKIP;
|
|
119
|
+
}
|
|
120
|
+
} else if (action === ReadRequestActionEnum.READ_AS_SETTLED) {
|
|
121
|
+
if (numSettled < maxSettled) {
|
|
122
|
+
numSettled++;
|
|
123
|
+
} else {
|
|
124
|
+
resetActions.actions[i] = ReadRequestActionEnum.SKIP;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
resetActions.pendingReadHints = resetActions.pendingReadHints.slice(0, maxPending);
|
|
129
|
+
}
|
|
130
|
+
needsResetNoteHashReadRequests(forceReset = false) {
|
|
131
|
+
const numCurr = this.previousKernel.validationRequests.noteHashReadRequests.claimedLength;
|
|
132
|
+
const numNext = this.nextIteration ? this.nextIteration.noteHashReadRequests.claimedLength : 0;
|
|
133
|
+
const maxAmountToKeep = !this.nextIteration || forceReset ? 0 : MAX_NOTE_HASH_READ_REQUESTS_PER_TX;
|
|
134
|
+
if (numCurr + numNext <= maxAmountToKeep) {
|
|
135
|
+
return false;
|
|
136
|
+
}
|
|
137
|
+
const resetActions = getNoteHashReadRequestResetActions(this.previousKernel.validationRequests.noteHashReadRequests, this.previousKernel.end.noteHashes);
|
|
138
|
+
const numPendingReads = resetActions.pendingReadHints.length;
|
|
139
|
+
const numSettledReads = resetActions.actions.reduce((accum, action)=>accum + (action === ReadRequestActionEnum.READ_AS_SETTLED ? 1 : 0), 0);
|
|
140
|
+
const totalReadsToReset = numPendingReads + numSettledReads;
|
|
141
|
+
const minResetNeeded = numCurr + numNext - maxAmountToKeep;
|
|
142
|
+
if (totalReadsToReset < minResetNeeded) {
|
|
143
|
+
if (!this.nextIteration) {
|
|
144
|
+
// In the final reset, all note hashes have been emitted. So if we can't reset all requests, at least one
|
|
145
|
+
// pending read request doesn't match any of them.
|
|
146
|
+
throw new Error('No matching note hash found for note hash read request.');
|
|
147
|
+
} else if (!forceReset) {
|
|
148
|
+
// A pending read request can only be reset if its note hash has already been included (e.g. a parent call might
|
|
149
|
+
// be reading a note hash emitted by a child call. The read request of the parent call is included before the note
|
|
150
|
+
// hash of the child call).
|
|
151
|
+
// If we can't clear enough read requests to make room for the next iteration's reads, we're stuck.
|
|
152
|
+
throw new Error('Number of note hash read requests exceeds the limit.');
|
|
153
|
+
} else if (totalReadsToReset == 0) {
|
|
154
|
+
// It's transient data squashing asking for the read requests to be reset first (forceReset == true), and
|
|
155
|
+
// there's nothing to reset, returns false and let needsResetTransientData throw a more descriptive error.
|
|
156
|
+
return false;
|
|
157
|
+
}
|
|
158
|
+
// Otherwise, forceReset is true, we should proceed to reset as many as we can.
|
|
159
|
+
}
|
|
160
|
+
if (!this.nextIteration) {
|
|
161
|
+
// If there's no next iteration, we need to reset all the read requests.
|
|
162
|
+
this.noteHashResetActions = resetActions;
|
|
163
|
+
this.requestedDimensions.NOTE_HASH_PENDING_READ = numPendingReads;
|
|
164
|
+
this.requestedDimensions.NOTE_HASH_SETTLED_READ = numSettledReads;
|
|
165
|
+
} else {
|
|
166
|
+
// If there's a next iteration, only one dimension can be reset at a time.
|
|
167
|
+
// So we pick the dimension that has more read requests to reset.
|
|
168
|
+
if (numPendingReads > numSettledReads) {
|
|
169
|
+
// Reset the pending read requests.
|
|
170
|
+
const pendingOnlyActions = assertLength(resetActions.actions.map((action)=>action === ReadRequestActionEnum.READ_AS_PENDING ? action : ReadRequestActionEnum.SKIP), MAX_NOTE_HASH_READ_REQUESTS_PER_TX);
|
|
171
|
+
this.noteHashResetActions = new ReadRequestResetActions(pendingOnlyActions, resetActions.pendingReadHints);
|
|
172
|
+
this.requestedDimensions.NOTE_HASH_PENDING_READ = numPendingReads;
|
|
173
|
+
} else {
|
|
174
|
+
// Reset the settled read requests.
|
|
175
|
+
const settledOnlyActions = assertLength(resetActions.actions.map((action)=>action === ReadRequestActionEnum.READ_AS_SETTLED ? action : ReadRequestActionEnum.SKIP), MAX_NOTE_HASH_READ_REQUESTS_PER_TX);
|
|
176
|
+
this.noteHashResetActions = new ReadRequestResetActions(settledOnlyActions, []);
|
|
177
|
+
this.requestedDimensions.NOTE_HASH_SETTLED_READ = numSettledReads;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
return true;
|
|
181
|
+
}
|
|
182
|
+
needsResetNullifierReadRequests(forceReset = false) {
|
|
183
|
+
const numCurr = this.previousKernel.validationRequests.nullifierReadRequests.claimedLength;
|
|
184
|
+
const numNext = this.nextIteration ? this.nextIteration.nullifierReadRequests.claimedLength : 0;
|
|
185
|
+
const maxAmountToKeep = !this.nextIteration || forceReset ? 0 : MAX_NULLIFIER_READ_REQUESTS_PER_TX;
|
|
186
|
+
if (numCurr + numNext <= maxAmountToKeep) {
|
|
187
|
+
return false;
|
|
188
|
+
}
|
|
189
|
+
const resetActions = getNullifierReadRequestResetActions(this.previousKernel.validationRequests.nullifierReadRequests, this.previousKernel.end.nullifiers);
|
|
190
|
+
const numPendingReads = resetActions.pendingReadHints.length;
|
|
191
|
+
const numSettledReads = resetActions.actions.reduce((accum, action)=>accum + (action === ReadRequestActionEnum.READ_AS_SETTLED ? 1 : 0), 0);
|
|
192
|
+
const totalReadsToReset = numPendingReads + numSettledReads;
|
|
193
|
+
const minResetNeeded = numCurr + numNext - maxAmountToKeep;
|
|
194
|
+
if (totalReadsToReset < minResetNeeded) {
|
|
195
|
+
if (!this.nextIteration) {
|
|
196
|
+
// In the final reset, all nullifiers have been emitted. So if we can't reset all requests, at least one pending
|
|
197
|
+
// read request doesn't match any of them.
|
|
198
|
+
throw new Error('No matching nullifier found for nullifier read request.');
|
|
199
|
+
} else if (!forceReset) {
|
|
200
|
+
// A pending read request can only be reset if its nullifier has already been included (e.g. a parent call might
|
|
201
|
+
// be reading a nullifier emitted by a child call. The read request of the parent call is included before the
|
|
202
|
+
// nullifier of the child call).
|
|
203
|
+
// If we can't clear enough read requests to make room for the next iteration's reads, we're stuck.
|
|
204
|
+
throw new Error('Number of nullifier read requests exceeds the limit.');
|
|
205
|
+
} else if (totalReadsToReset == 0) {
|
|
206
|
+
// It's transient data squashing asking for the read requests to be reset first (forceReset == true), and
|
|
207
|
+
// there's nothing to reset, returns false and let needsResetTransientData throw a more descriptive error.
|
|
208
|
+
return false;
|
|
209
|
+
}
|
|
210
|
+
// Otherwise, forceReset is true, we should proceed to reset as many as we can.
|
|
211
|
+
}
|
|
212
|
+
if (!this.nextIteration) {
|
|
213
|
+
// If there's no next iteration, we need to reset all the read requests.
|
|
214
|
+
this.nullifierResetActions = resetActions;
|
|
215
|
+
this.requestedDimensions.NULLIFIER_PENDING_READ = numPendingReads;
|
|
216
|
+
this.requestedDimensions.NULLIFIER_SETTLED_READ = numSettledReads;
|
|
217
|
+
} else {
|
|
218
|
+
// If there's a next iteration, we can only reset one dimension at a time.
|
|
219
|
+
if (numPendingReads > numSettledReads) {
|
|
220
|
+
// Reset the pending read requests.
|
|
221
|
+
const pendingOnlyActions = assertLength(resetActions.actions.map((action)=>action === ReadRequestActionEnum.READ_AS_PENDING ? action : ReadRequestActionEnum.SKIP), MAX_NULLIFIER_READ_REQUESTS_PER_TX);
|
|
222
|
+
this.nullifierResetActions = new ReadRequestResetActions(pendingOnlyActions, resetActions.pendingReadHints);
|
|
223
|
+
this.requestedDimensions.NULLIFIER_PENDING_READ = numPendingReads;
|
|
224
|
+
} else {
|
|
225
|
+
// Reset the settled read requests.
|
|
226
|
+
const settledOnlyActions = assertLength(resetActions.actions.map((action)=>action === ReadRequestActionEnum.READ_AS_SETTLED ? action : ReadRequestActionEnum.SKIP), MAX_NULLIFIER_READ_REQUESTS_PER_TX);
|
|
227
|
+
this.nullifierResetActions = new ReadRequestResetActions(settledOnlyActions, []);
|
|
228
|
+
this.requestedDimensions.NULLIFIER_SETTLED_READ = numSettledReads;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
return true;
|
|
232
|
+
}
|
|
233
|
+
needsResetKeyValidationRequests() {
|
|
234
|
+
const numCurr = this.previousKernel.validationRequests.scopedKeyValidationRequestsAndSeparators.claimedLength;
|
|
235
|
+
const numNext = this.nextIteration ? this.nextIteration.keyValidationRequestsAndSeparators.claimedLength : 0;
|
|
236
|
+
const maxAmountToKeep = !this.nextIteration ? 0 : MAX_KEY_VALIDATION_REQUESTS_PER_TX;
|
|
237
|
+
if (numCurr + numNext <= maxAmountToKeep) {
|
|
238
|
+
return false;
|
|
239
|
+
}
|
|
240
|
+
this.requestedDimensions.KEY_VALIDATION = numCurr;
|
|
241
|
+
return true;
|
|
242
|
+
}
|
|
243
|
+
needsResetTransientData() {
|
|
244
|
+
const nextAccumNoteHashes = this.previousKernel.end.noteHashes.claimedLength + (this.nextIteration?.noteHashes.claimedLength ?? 0);
|
|
245
|
+
const noteHashWillOverflow = nextAccumNoteHashes > MAX_NOTE_HASHES_PER_TX;
|
|
246
|
+
const nextAccumNullifiers = this.previousKernel.end.nullifiers.claimedLength + (this.nextIteration?.nullifiers.claimedLength ?? 0);
|
|
247
|
+
const nullifierWillOverflow = nextAccumNullifiers > MAX_NULLIFIERS_PER_TX;
|
|
248
|
+
const nextAccumLogs = this.previousKernel.end.privateLogs.claimedLength + (this.nextIteration?.privateLogs.claimedLength ?? 0);
|
|
249
|
+
const logsWillOverflow = nextAccumLogs > MAX_PRIVATE_LOGS_PER_TX;
|
|
250
|
+
if (this.nextIteration && !noteHashWillOverflow && !nullifierWillOverflow && !logsWillOverflow) {
|
|
251
|
+
return false;
|
|
252
|
+
}
|
|
253
|
+
const futureNoteHashReads = collectNested(this.executionStack, (executionResult)=>executionResult.publicInputs.noteHashReadRequests.getActiveItems());
|
|
254
|
+
const futureNullifierReads = collectNested(this.executionStack, (executionResult)=>executionResult.publicInputs.nullifierReadRequests.getActiveItems());
|
|
255
|
+
const futureLogs = collectNested(this.executionStack, (executionResult)=>executionResult.publicInputs.privateLogs.getActiveItems());
|
|
256
|
+
if (this.nextIteration) {
|
|
257
|
+
// If it's not the final reset, only one dimension will be reset at a time. Since we are resetting the transient
|
|
258
|
+
// data, the note hash and nullifier read requests in the previous kernel won't be squashed and need to be
|
|
259
|
+
// included in the future read requests.
|
|
260
|
+
futureNoteHashReads.push(...this.previousKernel.validationRequests.noteHashReadRequests.getActiveItems());
|
|
261
|
+
futureNullifierReads.push(...this.previousKernel.validationRequests.nullifierReadRequests.getActiveItems());
|
|
262
|
+
}
|
|
263
|
+
const { numTransientData, hints: transientDataSquashingHints } = buildTransientDataHints(this.previousKernel.end.noteHashes, this.previousKernel.end.nullifiers, futureNoteHashReads, futureNullifierReads, futureLogs, this.noteHashNullifierCounterMap, this.splitCounter);
|
|
264
|
+
if (this.nextIteration) {
|
|
265
|
+
const noteHashOverflowBy = noteHashWillOverflow ? nextAccumNoteHashes - MAX_NOTE_HASHES_PER_TX - numTransientData : 0;
|
|
266
|
+
const nullifierOverflowBy = nullifierWillOverflow ? nextAccumNullifiers - MAX_NULLIFIERS_PER_TX - numTransientData : 0;
|
|
267
|
+
const numSquashedLogs = logsWillOverflow ? countSquashedLogs(this.previousKernel.end.noteHashes, this.previousKernel.end.privateLogs, transientDataSquashingHints.slice(0, numTransientData)) : 0;
|
|
268
|
+
const logsOverflowBy = logsWillOverflow ? nextAccumLogs - MAX_PRIVATE_LOGS_PER_TX - numSquashedLogs : 0;
|
|
269
|
+
if (noteHashOverflowBy > 0 || nullifierOverflowBy > 0 || logsOverflowBy > 0) {
|
|
270
|
+
// There's not enough transient data to squash to clear space for the overflow. It may be because some data is
|
|
271
|
+
// still required for read requests. Force a reset of the read requests first, and return to transient data
|
|
272
|
+
// squashing in the next round of reset.
|
|
273
|
+
// Note that clearing the read requests might not be enough to clear more space for the overflow. In this case,
|
|
274
|
+
// running the next reset will fail at the following check.
|
|
275
|
+
// Only one dimension can be reset at a time for an inner reset, so we try the note hash read requests first
|
|
276
|
+
// (which also helps with log overflow), then fall back to nullifier read requests.
|
|
277
|
+
const forceReset = true;
|
|
278
|
+
if ((noteHashOverflowBy > 0 || logsOverflowBy > 0) && this.needsResetNoteHashReadRequests(forceReset)) {
|
|
279
|
+
return true;
|
|
280
|
+
}
|
|
281
|
+
if (nullifierOverflowBy > 0 && this.needsResetNullifierReadRequests(forceReset)) {
|
|
282
|
+
return true;
|
|
283
|
+
}
|
|
284
|
+
if (noteHashWillOverflow) {
|
|
285
|
+
throw new Error('Number of note hashes exceeds the limit.');
|
|
286
|
+
}
|
|
287
|
+
if (nullifierWillOverflow) {
|
|
288
|
+
throw new Error('Number of nullifiers exceeds the limit.');
|
|
289
|
+
}
|
|
290
|
+
throw new Error('Number of private logs exceeds the limit.');
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
this.numTransientData = numTransientData;
|
|
294
|
+
this.transientDataSquashingHints = transientDataSquashingHints;
|
|
295
|
+
this.requestedDimensions.TRANSIENT_DATA_SQUASHING = numTransientData;
|
|
296
|
+
return numTransientData > 0;
|
|
297
|
+
}
|
|
298
|
+
needsSiloNoteHashes() {
|
|
299
|
+
if (this.numTransientData === undefined) {
|
|
300
|
+
throw new Error('`needsResetTransientData` must be run before `needsSiloNoteHashes`.');
|
|
301
|
+
}
|
|
302
|
+
const noteHashes = this.previousKernel.end.noteHashes;
|
|
303
|
+
if (noteHashes.claimedLength > 0 && noteHashes.array[0].contractAddress.isZero()) {
|
|
304
|
+
// Already siloed.
|
|
305
|
+
return false;
|
|
306
|
+
}
|
|
307
|
+
const numToSilo = noteHashes.claimedLength - this.numTransientData;
|
|
308
|
+
this.requestedDimensions.NOTE_HASH_SILOING = numToSilo;
|
|
309
|
+
return numToSilo > 0;
|
|
310
|
+
}
|
|
311
|
+
needsSiloNullifiers() {
|
|
312
|
+
if (this.numTransientData === undefined) {
|
|
313
|
+
throw new Error('`needsResetTransientData` must be run before `needsSiloNullifiers`.');
|
|
314
|
+
}
|
|
315
|
+
const nullifiers = this.previousKernel.end.nullifiers;
|
|
316
|
+
if (nullifiers.claimedLength > 0 && nullifiers.array[0].contractAddress.isZero()) {
|
|
317
|
+
// Already siloed.
|
|
318
|
+
return false;
|
|
319
|
+
}
|
|
320
|
+
const numToSilo = nullifiers.claimedLength - this.numTransientData;
|
|
321
|
+
this.requestedDimensions.NULLIFIER_SILOING = numToSilo;
|
|
322
|
+
return numToSilo > 0;
|
|
323
|
+
}
|
|
324
|
+
needsSiloPrivateLogs() {
|
|
325
|
+
if (this.numTransientData === undefined) {
|
|
326
|
+
throw new Error('`needsResetTransientData` must be run before `needsSiloPrivateLogs`.');
|
|
327
|
+
}
|
|
328
|
+
const privateLogs = this.previousKernel.end.privateLogs;
|
|
329
|
+
if (privateLogs.claimedLength > 0 && privateLogs.array[0].contractAddress.isZero()) {
|
|
330
|
+
// Already siloed.
|
|
331
|
+
return false;
|
|
332
|
+
}
|
|
333
|
+
const numSquashedLogs = countSquashedLogs(this.previousKernel.end.noteHashes, privateLogs, this.transientDataSquashingHints.slice(0, this.numTransientData));
|
|
334
|
+
const numToSilo = privateLogs.claimedLength - numSquashedLogs;
|
|
335
|
+
this.requestedDimensions.PRIVATE_LOG_SILOING = numToSilo;
|
|
336
|
+
return numToSilo > 0;
|
|
337
|
+
}
|
|
338
|
+
}
|