@aztec/pxe 0.0.0-test.1 → 0.0.1-commit.023c3e5
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 +43 -0
- package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -0
- package/dest/block_synchronizer/block_synchronizer.js +147 -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 +13 -24
- package/dest/config/index.d.ts.map +1 -1
- package/dest/config/index.js +35 -33
- 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 +82 -0
- package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -0
- package/dest/contract_function_simulator/contract_function_simulator.js +339 -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 +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 +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 +107 -0
- package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -0
- package/dest/contract_function_simulator/oracle/interfaces.js +4 -0
- package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts +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 +60 -0
- package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -0
- package/dest/contract_function_simulator/oracle/oracle.js +356 -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 +87 -0
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +239 -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 +426 -0
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +209 -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 +376 -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_sync/index.d.ts +23 -0
- package/dest/contract_sync/index.d.ts.map +1 -0
- package/dest/contract_sync/index.js +54 -0
- package/dest/debug/pxe_debug_utils.d.ts +41 -0
- package/dest/debug/pxe_debug_utils.d.ts.map +1 -0
- package/dest/debug/pxe_debug_utils.js +47 -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 +33 -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 +10 -10
- package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/utils.js +33 -12
- package/dest/entrypoints/pxe_creation_options.d.ts +18 -0
- package/dest/entrypoints/pxe_creation_options.d.ts.map +1 -0
- package/dest/entrypoints/server/index.d.ts +8 -4
- package/dest/entrypoints/server/index.d.ts.map +1 -1
- package/dest/entrypoints/server/index.js +6 -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 +46 -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 +44 -0
- package/dest/events/index.d.ts +2 -0
- package/dest/events/index.d.ts.map +1 -0
- package/dest/events/index.js +1 -0
- package/dest/events/private_event_filter_validator.d.ts +9 -0
- package/dest/events/private_event_filter_validator.d.ts.map +1 -0
- package/dest/events/private_event_filter_validator.js +38 -0
- package/dest/job_coordinator/job_coordinator.d.ts +75 -0
- package/dest/job_coordinator/job_coordinator.d.ts.map +1 -0
- package/dest/job_coordinator/job_coordinator.js +94 -0
- package/dest/logs/log_service.d.ts +28 -0
- package/dest/logs/log_service.d.ts.map +1 -0
- package/dest/logs/log_service.js +125 -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 +147 -0
- package/dest/oracle_version.d.ts +3 -0
- package/dest/oracle_version.d.ts.map +1 -0
- package/dest/oracle_version.js +11 -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/private_kernel/hints/index.js +2 -0
- package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts +28 -0
- package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts.map +1 -0
- package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.js +277 -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 +45 -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 +59 -0
- package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -0
- package/dest/private_kernel/private_kernel_oracle.js +92 -0
- package/dest/pxe.d.ts +204 -0
- package/dest/pxe.d.ts.map +1 -0
- package/dest/pxe.js +742 -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/capsule_store/capsule_store.d.ts +72 -0
- package/dest/storage/capsule_store/capsule_store.d.ts.map +1 -0
- package/dest/storage/capsule_store/capsule_store.js +253 -0
- package/dest/storage/capsule_store/index.d.ts +2 -0
- package/dest/storage/capsule_store/index.d.ts.map +1 -0
- package/dest/storage/capsule_store/index.js +1 -0
- package/dest/storage/contract_store/contract_store.d.ts +66 -0
- package/dest/storage/contract_store/contract_store.d.ts.map +1 -0
- package/dest/storage/contract_store/contract_store.js +233 -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 +341 -0
- package/dest/storage/note_store/stored_note.d.ts +16 -0
- package/dest/storage/note_store/stored_note.d.ts.map +1 -0
- package/dest/storage/note_store/stored_note.js +43 -0
- package/dest/storage/private_event_store/private_event_store.d.ts +91 -0
- package/dest/storage/private_event_store/private_event_store.d.ts.map +1 -0
- package/dest/storage/private_event_store/private_event_store.js +273 -0
- package/dest/storage/private_event_store/stored_private_event.d.ts +23 -0
- package/dest/storage/private_event_store/stored_private_event.d.ts.map +1 -0
- package/dest/storage/private_event_store/stored_private_event.js +56 -0
- package/dest/storage/tagging_store/index.d.ts +4 -0
- package/dest/storage/tagging_store/index.d.ts.map +1 -0
- package/dest/storage/tagging_store/index.js +3 -0
- package/dest/storage/tagging_store/recipient_tagging_store.d.ts +28 -0
- package/dest/storage/tagging_store/recipient_tagging_store.d.ts.map +1 -0
- package/dest/storage/tagging_store/recipient_tagging_store.js +111 -0
- package/dest/storage/tagging_store/sender_address_book_store.d.ts +14 -0
- package/dest/storage/tagging_store/sender_address_book_store.d.ts.map +1 -0
- package/dest/storage/tagging_store/sender_address_book_store.js +36 -0
- package/dest/storage/tagging_store/sender_tagging_store.d.ts +77 -0
- package/dest/storage/tagging_store/sender_tagging_store.d.ts.map +1 -0
- package/dest/storage/tagging_store/sender_tagging_store.js +348 -0
- package/dest/tagging/constants.d.ts +2 -0
- package/dest/tagging/constants.d.ts.map +1 -0
- package/dest/tagging/constants.js +10 -0
- package/dest/tagging/get_all_logs_by_tags.d.ts +24 -0
- package/dest/tagging/get_all_logs_by_tags.d.ts.map +1 -0
- package/dest/tagging/get_all_logs_by_tags.js +46 -0
- package/dest/tagging/index.d.ts +17 -0
- package/dest/tagging/index.d.ts.map +1 -0
- package/dest/tagging/index.js +15 -0
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts +15 -0
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts.map +1 -0
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.js +99 -0
- package/dest/tagging/recipient_sync/utils/find_highest_indexes.d.ts +12 -0
- package/dest/tagging/recipient_sync/utils/find_highest_indexes.d.ts.map +1 -0
- package/dest/tagging/recipient_sync/utils/find_highest_indexes.js +20 -0
- package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts +15 -0
- package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts.map +1 -0
- package/dest/tagging/recipient_sync/utils/load_logs_for_range.js +32 -0
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts +21 -0
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts.map +1 -0
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.js +74 -0
- package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts +11 -0
- package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts.map +1 -0
- package/dest/tagging/sender_sync/utils/get_status_change_of_pending.js +29 -0
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts +21 -0
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts.map +1 -0
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.js +60 -0
- package/package.json +37 -34
- package/src/bin/check_oracle_version.ts +161 -0
- package/src/block_synchronizer/block_synchronizer.ts +172 -0
- package/src/block_synchronizer/index.ts +1 -0
- package/src/config/index.ts +41 -55
- 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 +633 -0
- package/src/contract_function_simulator/execution_note_cache.ts +252 -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 +23 -0
- package/src/contract_function_simulator/oracle/index.ts +16 -0
- package/src/contract_function_simulator/oracle/interfaces.ts +185 -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 +630 -0
- package/src/contract_function_simulator/oracle/private_execution.ts +141 -0
- package/src/contract_function_simulator/oracle/private_execution_oracle.ts +699 -0
- package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +554 -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_sync/index.ts +98 -0
- package/src/debug/pxe_debug_utils.ts +63 -0
- package/src/entrypoints/client/bundle/index.ts +3 -2
- package/src/entrypoints/client/bundle/utils.ts +35 -36
- package/src/entrypoints/client/lazy/index.ts +3 -2
- package/src/entrypoints/client/lazy/utils.ts +36 -32
- package/src/entrypoints/pxe_creation_options.ts +14 -0
- package/src/entrypoints/server/index.ts +7 -3
- package/src/entrypoints/server/utils.ts +52 -52
- package/src/{pxe_service/error_enriching.ts → error_enriching.ts} +40 -39
- package/src/events/event_service.ts +71 -0
- package/src/events/index.ts +1 -0
- package/src/events/private_event_filter_validator.ts +46 -0
- package/src/job_coordinator/job_coordinator.ts +150 -0
- package/src/logs/log_service.ts +220 -0
- package/src/notes/index.ts +1 -0
- package/src/notes/note_service.ts +195 -0
- package/src/oracle_version.ts +12 -0
- package/src/private_kernel/hints/compute_tx_include_by_timestamp.ts +58 -0
- package/src/private_kernel/hints/index.ts +2 -0
- package/src/{kernel_prover/hints/build_private_kernel_reset_private_inputs.ts → private_kernel/hints/private_kernel_reset_private_inputs_builder.ts} +179 -156
- package/src/private_kernel/index.ts +2 -0
- package/src/private_kernel/private_kernel_execution_prover.ts +433 -0
- package/src/private_kernel/private_kernel_oracle.ts +152 -0
- package/src/pxe.ts +1070 -0
- package/src/storage/{address_data_provider/address_data_provider.ts → address_store/address_store.ts} +15 -21
- package/src/storage/address_store/index.ts +1 -0
- package/src/storage/{sync_data_provider/sync_data_provider.ts → anchor_block_store/anchor_block_store.ts} +10 -17
- package/src/storage/anchor_block_store/index.ts +1 -0
- package/src/storage/capsule_store/capsule_store.ts +315 -0
- package/src/storage/capsule_store/index.ts +1 -0
- package/src/storage/contract_store/contract_store.ts +330 -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 +411 -0
- package/src/storage/note_store/stored_note.ts +48 -0
- package/src/storage/private_event_store/private_event_store.ts +384 -0
- package/src/storage/private_event_store/stored_private_event.ts +73 -0
- package/src/storage/tagging_store/index.ts +3 -0
- package/src/storage/tagging_store/recipient_tagging_store.ts +139 -0
- package/src/storage/tagging_store/sender_address_book_store.ts +48 -0
- package/src/storage/tagging_store/sender_tagging_store.ts +429 -0
- package/src/tagging/constants.ts +10 -0
- package/src/tagging/get_all_logs_by_tags.ts +68 -0
- package/src/tagging/index.ts +19 -0
- package/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts +143 -0
- package/src/tagging/recipient_sync/utils/find_highest_indexes.ts +34 -0
- package/src/tagging/recipient_sync/utils/load_logs_for_range.ts +49 -0
- package/src/tagging/sender_sync/sync_sender_tagging_indexes.ts +99 -0
- package/src/tagging/sender_sync/utils/get_status_change_of_pending.ts +36 -0
- package/src/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.ts +84 -0
- package/dest/bin/index.d.ts +0 -3
- package/dest/bin/index.d.ts.map +0 -1
- package/dest/bin/index.js +0 -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_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/bin/index.ts +0 -38
- package/src/entrypoints/client/pxe_creation_options.ts +0 -7
- package/src/kernel_oracle/index.ts +0 -117
- 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/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
- /package/dest/entrypoints/{client/pxe_creation_options.js → pxe_creation_options.js} +0 -0
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
/* eslint-disable import-x/no-named-as-default-member */
|
|
2
|
+
import { keccak256String } from '@aztec/foundation/crypto/keccak';
|
|
3
|
+
|
|
4
|
+
import { readFileSync } from 'fs';
|
|
5
|
+
import { dirname, join } from 'path';
|
|
6
|
+
import ts from 'typescript';
|
|
7
|
+
import { fileURLToPath } from 'url';
|
|
8
|
+
|
|
9
|
+
import { ORACLE_INTERFACE_HASH } from '../oracle_version.js';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Verifies that the Oracle interface matches the expected interface hash.
|
|
13
|
+
*
|
|
14
|
+
* The Oracle interface needs to be versioned to ensure compatibility between Aztec.nr and PXE. This function computes
|
|
15
|
+
* a hash of the Oracle interface and compares it against a known hash. If they don't match, it means the interface has
|
|
16
|
+
* changed and the ORACLE_VERSION constant needs to be incremented and the ORACLE_INTERFACE_HASH constant needs to be
|
|
17
|
+
* updated.
|
|
18
|
+
*
|
|
19
|
+
* TODO(#16581): The following only takes into consideration changes to the oracles defined in Oracle.ts and omits TXE
|
|
20
|
+
* oracles. Ensure this checks TXE oracles as well. This hasn't been implemented yet since we don't have a clean TXE
|
|
21
|
+
* oracle interface like we do in PXE (i.e., there is no single Oracle class that contains only the oracles).
|
|
22
|
+
*/
|
|
23
|
+
function assertOracleInterfaceMatches(): void {
|
|
24
|
+
const oracleInterfaceSignature = getOracleInterfaceSignature();
|
|
25
|
+
|
|
26
|
+
// We use keccak256 here just because we already have it in the dependencies.
|
|
27
|
+
const oracleInterfaceHash = keccak256String(oracleInterfaceSignature);
|
|
28
|
+
if (oracleInterfaceHash !== ORACLE_INTERFACE_HASH) {
|
|
29
|
+
// This check exists only to notify you when you need to update the ORACLE_VERSION constant.
|
|
30
|
+
throw new Error(
|
|
31
|
+
`The Oracle interface has changed, which implies a breaking change in the aztec.nr/PXE oracle interface. Update ORACLE_INTERFACE_HASH to ${oracleInterfaceHash} and bump ORACLE_VERSION in pxe/src/oracle_version.ts.`,
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Constructs a signature of the Oracle interface while ignoring methods that are not foreign call handlers.
|
|
38
|
+
*/
|
|
39
|
+
function getOracleInterfaceSignature(): string {
|
|
40
|
+
const excludedProps = [
|
|
41
|
+
'handler',
|
|
42
|
+
'constructor',
|
|
43
|
+
'toACIRCallback',
|
|
44
|
+
'handlerAsMisc',
|
|
45
|
+
'handlerAsUtility',
|
|
46
|
+
'handlerAsPrivate',
|
|
47
|
+
] as const;
|
|
48
|
+
|
|
49
|
+
// Get the path to Oracle.ts source file
|
|
50
|
+
// The script runs from dest/bin/ after compilation, so we need to go up to the package root
|
|
51
|
+
// then into src/ to find the source file
|
|
52
|
+
const currentDir = dirname(fileURLToPath(import.meta.url));
|
|
53
|
+
// Go up from dest/bin/ or src/bin/ to the package root (pxe/), then into src/
|
|
54
|
+
const packageRoot = dirname(dirname(currentDir)); // Go up from bin/ to pxe/
|
|
55
|
+
const oracleSourcePath = join(packageRoot, 'src/contract_function_simulator/oracle/oracle.ts');
|
|
56
|
+
|
|
57
|
+
// Read and parse the TypeScript source file
|
|
58
|
+
const sourceCode = readFileSync(oracleSourcePath, 'utf-8');
|
|
59
|
+
const sourceFile = ts.createSourceFile('oracle.ts', sourceCode, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS);
|
|
60
|
+
|
|
61
|
+
// Extract method signatures from the Oracle class
|
|
62
|
+
const methodSignatures: string[] = [];
|
|
63
|
+
|
|
64
|
+
function visit(node: ts.Node) {
|
|
65
|
+
// Look for class declaration named "Oracle"
|
|
66
|
+
if (ts.isClassDeclaration(node) && node.name?.text === 'Oracle') {
|
|
67
|
+
// Visit all members of the class
|
|
68
|
+
node.members.forEach(member => {
|
|
69
|
+
if (ts.isMethodDeclaration(member) && member.name && ts.isIdentifier(member.name)) {
|
|
70
|
+
const methodName = member.name.text;
|
|
71
|
+
|
|
72
|
+
// Skip excluded methods
|
|
73
|
+
if (excludedProps.includes(methodName as (typeof excludedProps)[number])) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// Extract parameter signatures
|
|
78
|
+
const paramSignatures: string[] = [];
|
|
79
|
+
member.parameters.forEach(param => {
|
|
80
|
+
const paramName = extractParameterName(param, sourceFile);
|
|
81
|
+
const paramType = extractTypeString(param.type, sourceFile);
|
|
82
|
+
paramSignatures.push(`${paramName}: ${paramType}`);
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
// Extract return type
|
|
86
|
+
const returnType = extractTypeString(member.type, sourceFile);
|
|
87
|
+
|
|
88
|
+
// Build full signature: methodName(param1: Type1, param2: Type2): ReturnType
|
|
89
|
+
const signature = `${methodName}(${paramSignatures.join(', ')}): ${returnType}`;
|
|
90
|
+
methodSignatures.push(signature);
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
ts.forEachChild(node, visit);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
visit(sourceFile);
|
|
99
|
+
|
|
100
|
+
// Sort signatures alphabetically for consistent hashing
|
|
101
|
+
methodSignatures.sort();
|
|
102
|
+
|
|
103
|
+
// Create a hashable representation by concatenating all signatures
|
|
104
|
+
return methodSignatures.join('');
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Extracts the parameter name from a parameter node, handling destructured parameters.
|
|
109
|
+
*/
|
|
110
|
+
function extractParameterName(param: ts.ParameterDeclaration, sourceFile: ts.SourceFile): string {
|
|
111
|
+
const name = param.name;
|
|
112
|
+
|
|
113
|
+
if (ts.isIdentifier(name)) {
|
|
114
|
+
return name.text;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
if (ts.isArrayBindingPattern(name)) {
|
|
118
|
+
// Handle destructured parameters like [blockNumber]: ACVMField[]
|
|
119
|
+
// Extract the first element name
|
|
120
|
+
if (name.elements.length > 0) {
|
|
121
|
+
const element = name.elements[0];
|
|
122
|
+
if (ts.isBindingElement(element)) {
|
|
123
|
+
const elementName = element.name;
|
|
124
|
+
if (ts.isIdentifier(elementName)) {
|
|
125
|
+
return elementName.text;
|
|
126
|
+
}
|
|
127
|
+
// Nested destructuring - use text representation
|
|
128
|
+
if (ts.isArrayBindingPattern(elementName) || ts.isObjectBindingPattern(elementName)) {
|
|
129
|
+
return elementName.getText(sourceFile);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
// Fallback: return the text representation
|
|
134
|
+
return name.getText(sourceFile);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
if (ts.isObjectBindingPattern(name)) {
|
|
138
|
+
// Handle object destructuring
|
|
139
|
+
return name.getText(sourceFile);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// Fallback for any other case - this should never happen but TypeScript needs it
|
|
143
|
+
return (name as ts.Node).getText(sourceFile);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Extracts the type string from a type node, normalizing whitespace.
|
|
148
|
+
*/
|
|
149
|
+
function extractTypeString(typeNode: ts.TypeNode | undefined, sourceFile: ts.SourceFile): string {
|
|
150
|
+
if (!typeNode) {
|
|
151
|
+
return 'void';
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
// Get the type text and normalize whitespace
|
|
155
|
+
let typeText = typeNode.getText(sourceFile);
|
|
156
|
+
// Normalize whitespace: remove extra spaces, newlines, and tabs
|
|
157
|
+
typeText = typeText.replace(/\s+/g, ' ').trim();
|
|
158
|
+
return typeText;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
assertOracleInterfaceMatches();
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
2
|
+
import { type Logger, type LoggerBindings, createLogger } from '@aztec/foundation/log';
|
|
3
|
+
import type { AztecAsyncKVStore } from '@aztec/kv-store';
|
|
4
|
+
import type { L2TipsKVStore } from '@aztec/kv-store/stores';
|
|
5
|
+
import { BlockHash, L2BlockStream, type L2BlockStreamEvent, type L2BlockStreamEventHandler } from '@aztec/stdlib/block';
|
|
6
|
+
import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
7
|
+
import type { BlockHeader } from '@aztec/stdlib/tx';
|
|
8
|
+
|
|
9
|
+
import type { BlockSynchronizerConfig } from '../config/index.js';
|
|
10
|
+
import type { AnchorBlockStore } from '../storage/anchor_block_store/anchor_block_store.js';
|
|
11
|
+
import type { NoteStore } from '../storage/note_store/note_store.js';
|
|
12
|
+
import type { PrivateEventStore } from '../storage/private_event_store/private_event_store.js';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* The BlockSynchronizer class orchestrates synchronization between PXE and Aztec node, maintaining an up-to-date
|
|
16
|
+
* view of the L2 chain state. It handles block header retrieval, chain reorganizations, and provides an interface
|
|
17
|
+
* for querying sync status.
|
|
18
|
+
*/
|
|
19
|
+
export class BlockSynchronizer implements L2BlockStreamEventHandler {
|
|
20
|
+
private log: Logger;
|
|
21
|
+
private isSyncing: Promise<void> | undefined;
|
|
22
|
+
protected readonly blockStream: L2BlockStream;
|
|
23
|
+
|
|
24
|
+
constructor(
|
|
25
|
+
private node: AztecNode,
|
|
26
|
+
private store: AztecAsyncKVStore,
|
|
27
|
+
private anchorBlockStore: AnchorBlockStore,
|
|
28
|
+
private noteStore: NoteStore,
|
|
29
|
+
private privateEventStore: PrivateEventStore,
|
|
30
|
+
private l2TipsStore: L2TipsKVStore,
|
|
31
|
+
private config: Partial<BlockSynchronizerConfig> = {},
|
|
32
|
+
bindings?: LoggerBindings,
|
|
33
|
+
) {
|
|
34
|
+
this.log = createLogger('pxe:block_synchronizer', bindings);
|
|
35
|
+
this.blockStream = this.createBlockStream(config);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
protected createBlockStream(config: Partial<BlockSynchronizerConfig>): L2BlockStream {
|
|
39
|
+
return new L2BlockStream(
|
|
40
|
+
this.node,
|
|
41
|
+
this.l2TipsStore,
|
|
42
|
+
this,
|
|
43
|
+
createLogger('pxe:block_stream', this.log.getBindings()),
|
|
44
|
+
{
|
|
45
|
+
batchSize: config.l2BlockBatchSize,
|
|
46
|
+
// Skipping finalized blocks makes us sync much faster - we only need to download blocks other than the latest one
|
|
47
|
+
// in order to detect reorgs, and there can be no reorgs on finalized block, making this safe.
|
|
48
|
+
skipFinalized: true,
|
|
49
|
+
},
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** Handle events emitted by the block stream. */
|
|
54
|
+
public async handleBlockStreamEvent(event: L2BlockStreamEvent): Promise<void> {
|
|
55
|
+
await this.l2TipsStore.handleBlockStreamEvent(event);
|
|
56
|
+
|
|
57
|
+
switch (event.type) {
|
|
58
|
+
case 'blocks-added': {
|
|
59
|
+
if (this.config.syncChainTip === undefined || this.config.syncChainTip === 'proposed') {
|
|
60
|
+
const lastBlock = event.blocks.at(-1)!;
|
|
61
|
+
await this.updateAnchorBlockHeader(lastBlock.header);
|
|
62
|
+
}
|
|
63
|
+
break;
|
|
64
|
+
}
|
|
65
|
+
case 'chain-checkpointed': {
|
|
66
|
+
if (this.config.syncChainTip === 'checkpointed') {
|
|
67
|
+
// Get the last block header from the checkpoint
|
|
68
|
+
const lastBlock = event.checkpoint.checkpoint.blocks.at(-1)!;
|
|
69
|
+
await this.updateAnchorBlockHeader(lastBlock.header);
|
|
70
|
+
}
|
|
71
|
+
break;
|
|
72
|
+
}
|
|
73
|
+
case 'chain-proven': {
|
|
74
|
+
if (this.config.syncChainTip === 'proven') {
|
|
75
|
+
const blockHeader = await this.node.getBlockHeader(BlockNumber(event.block.number));
|
|
76
|
+
if (blockHeader) {
|
|
77
|
+
await this.updateAnchorBlockHeader(blockHeader);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
break;
|
|
81
|
+
}
|
|
82
|
+
case 'chain-finalized': {
|
|
83
|
+
if (this.config.syncChainTip === 'finalized') {
|
|
84
|
+
const blockHeader = await this.node.getBlockHeader(BlockNumber(event.block.number));
|
|
85
|
+
if (blockHeader) {
|
|
86
|
+
await this.updateAnchorBlockHeader(blockHeader);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
break;
|
|
90
|
+
}
|
|
91
|
+
case 'chain-pruned': {
|
|
92
|
+
const currentAnchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
|
|
93
|
+
const currentAnchorBlockNumber = currentAnchorBlockHeader.getBlockNumber();
|
|
94
|
+
if (currentAnchorBlockNumber <= event.block.number) {
|
|
95
|
+
this.log.verbose(
|
|
96
|
+
`Ignoring prune event to block ${event.block.number} greater than current anchor block ${currentAnchorBlockNumber}`,
|
|
97
|
+
{ pruneEvent: event, currentAnchorBlockHeader: currentAnchorBlockHeader.toInspect() },
|
|
98
|
+
);
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
this.log.warn(`Pruning data after block ${event.block.number} due to reorg`);
|
|
103
|
+
|
|
104
|
+
// Note that the following is not necessarily the anchor block that will be used in the transaction - if
|
|
105
|
+
// the chain has already moved past the reorg, we'll also see blocks-added events that will push the anchor
|
|
106
|
+
// forward.
|
|
107
|
+
const newAnchorBlockHeader = await this.node.getBlockHeader(BlockHash.fromString(event.block.hash));
|
|
108
|
+
|
|
109
|
+
if (!newAnchorBlockHeader) {
|
|
110
|
+
throw new Error(
|
|
111
|
+
`Block header for block number ${event.block.number} and hash ${event.block.hash} not found during chain prune. This likely indicates a bug in the node, as we receive block stream events and fetch block headers from the same node.`,
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// Operations are wrapped in a single transaction to ensure atomicity.
|
|
116
|
+
await this.store.transactionAsync(async () => {
|
|
117
|
+
await this.noteStore.rollback(event.block.number, currentAnchorBlockNumber);
|
|
118
|
+
await this.privateEventStore.rollback(event.block.number, currentAnchorBlockNumber);
|
|
119
|
+
await this.updateAnchorBlockHeader(newAnchorBlockHeader);
|
|
120
|
+
});
|
|
121
|
+
break;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/** Updates the anchor block header to the target block */
|
|
127
|
+
private async updateAnchorBlockHeader(blockHeader: BlockHeader) {
|
|
128
|
+
this.log.verbose(`Updated pxe last block to ${blockHeader.getBlockNumber()}`, blockHeader.toInspect());
|
|
129
|
+
await this.anchorBlockStore.setHeader(blockHeader);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Syncs PXE and the node by downloading the metadata of the latest blocks, allowing simulations to use
|
|
134
|
+
* recent data (e.g. notes), and handling any reorgs that might have occurred.
|
|
135
|
+
*
|
|
136
|
+
* Note this BlockSynchronizer is designed to let its users control when a synchronization is run,
|
|
137
|
+
* so this component doesn't proactively stay up to date with the blockchain.
|
|
138
|
+
*
|
|
139
|
+
* We do this so PXE can ensure data consistency.
|
|
140
|
+
*/
|
|
141
|
+
public async sync() {
|
|
142
|
+
if (this.isSyncing !== undefined) {
|
|
143
|
+
this.log.debug(`Waiting for the ongoing sync to finish`);
|
|
144
|
+
await this.isSyncing;
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
this.log.debug(`Syncing PXE with the node`);
|
|
149
|
+
const isSyncing = this.doSync();
|
|
150
|
+
this.isSyncing = isSyncing;
|
|
151
|
+
try {
|
|
152
|
+
await isSyncing;
|
|
153
|
+
} finally {
|
|
154
|
+
this.isSyncing = undefined;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
private async doSync() {
|
|
159
|
+
let currentHeader;
|
|
160
|
+
|
|
161
|
+
try {
|
|
162
|
+
currentHeader = await this.anchorBlockStore.getBlockHeader();
|
|
163
|
+
} catch {
|
|
164
|
+
this.log.debug('Header is not set, requesting from the node');
|
|
165
|
+
}
|
|
166
|
+
if (!currentHeader) {
|
|
167
|
+
// REFACTOR: We should know the header of the genesis block without having to request it from the node.
|
|
168
|
+
await this.anchorBlockStore.setHeader((await this.node.getBlockHeader(BlockNumber.ZERO))!);
|
|
169
|
+
}
|
|
170
|
+
await this.blockStream.sync();
|
|
171
|
+
}
|
|
172
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './block_synchronizer.js';
|
package/src/config/index.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { INITIAL_L2_BLOCK_NUM } from '@aztec/constants';
|
|
2
1
|
import {
|
|
3
2
|
type ConfigMappingsType,
|
|
4
3
|
booleanConfigHelper,
|
|
@@ -8,19 +7,9 @@ import {
|
|
|
8
7
|
} from '@aztec/foundation/config';
|
|
9
8
|
import { type DataStoreConfig, dataConfigMappings } from '@aztec/kv-store/config';
|
|
10
9
|
import { type ChainConfig, chainConfigMappings } from '@aztec/stdlib/config';
|
|
11
|
-
import type { Network } from '@aztec/stdlib/network';
|
|
12
10
|
|
|
13
11
|
export { getPackageInfo } from './package_info.js';
|
|
14
12
|
|
|
15
|
-
/**
|
|
16
|
-
* Temporary configuration until WASM can be used instead of native
|
|
17
|
-
*/
|
|
18
|
-
export interface BBProverConfig {
|
|
19
|
-
bbWorkingDirectory?: string;
|
|
20
|
-
bbBinaryPath?: string;
|
|
21
|
-
bbSkipCleanup?: boolean;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
13
|
/**
|
|
25
14
|
* Configuration settings for the prover factory
|
|
26
15
|
*/
|
|
@@ -28,77 +17,73 @@ export interface KernelProverConfig {
|
|
|
28
17
|
/** Whether we are running with real proofs */
|
|
29
18
|
proverEnabled?: boolean;
|
|
30
19
|
}
|
|
20
|
+
|
|
31
21
|
/**
|
|
32
|
-
* Configuration settings for the
|
|
22
|
+
* Configuration settings for the block synchronizer.
|
|
33
23
|
*/
|
|
34
|
-
export interface
|
|
35
|
-
/**
|
|
36
|
-
|
|
24
|
+
export interface BlockSynchronizerConfig {
|
|
25
|
+
/** Maximum amount of blocks to pull from the stream in one request when synchronizing */
|
|
26
|
+
l2BlockBatchSize: number;
|
|
27
|
+
/** Which chain tip to sync to (proposed, checkpointed, proven, finalized) */
|
|
28
|
+
syncChainTip?: 'proposed' | 'checkpointed' | 'proven' | 'finalized';
|
|
37
29
|
}
|
|
38
30
|
|
|
39
|
-
export type
|
|
31
|
+
export type PXEConfig = KernelProverConfig & DataStoreConfig & ChainConfig & BlockSynchronizerConfig;
|
|
40
32
|
|
|
41
33
|
export type CliPXEOptions = {
|
|
42
|
-
/** External Aztec network to connect to. e.g. devnet */
|
|
43
|
-
network?: Network;
|
|
44
|
-
/** API Key required by the external network's node */
|
|
45
|
-
apiKey?: string;
|
|
46
34
|
/** Custom Aztec Node URL to connect to */
|
|
47
35
|
nodeUrl?: string;
|
|
48
36
|
};
|
|
49
37
|
|
|
50
|
-
export const pxeConfigMappings: ConfigMappingsType<
|
|
38
|
+
export const pxeConfigMappings: ConfigMappingsType<PXEConfig> = {
|
|
51
39
|
...dataConfigMappings,
|
|
52
40
|
...chainConfigMappings,
|
|
53
|
-
|
|
54
|
-
env: '
|
|
55
|
-
...numberConfigHelper(
|
|
56
|
-
description: '
|
|
57
|
-
},
|
|
58
|
-
bbBinaryPath: {
|
|
59
|
-
env: 'BB_BINARY_PATH',
|
|
60
|
-
description: 'Path to the BB binary',
|
|
61
|
-
},
|
|
62
|
-
bbWorkingDirectory: {
|
|
63
|
-
env: 'BB_WORKING_DIRECTORY',
|
|
64
|
-
description: 'Working directory for the BB binary',
|
|
65
|
-
},
|
|
66
|
-
bbSkipCleanup: {
|
|
67
|
-
env: 'BB_SKIP_CLEANUP',
|
|
68
|
-
description: 'True to skip cleanup of temporary files for debugging purposes',
|
|
69
|
-
...booleanConfigHelper(),
|
|
41
|
+
l2BlockBatchSize: {
|
|
42
|
+
env: 'PXE_L2_BLOCK_BATCH_SIZE',
|
|
43
|
+
...numberConfigHelper(50),
|
|
44
|
+
description: 'Maximum amount of blocks to pull from the stream in one request when synchronizing',
|
|
70
45
|
},
|
|
46
|
+
// TODO: We're losing this feature in moving to bb.js api.
|
|
47
|
+
// Reimplement it as a setting that dumps the msgpack data on the bb.js backend if needed.
|
|
48
|
+
// bbSkipCleanup: {
|
|
49
|
+
// env: 'BB_SKIP_CLEANUP',
|
|
50
|
+
// description: 'True to skip cleanup of temporary files for debugging purposes',
|
|
51
|
+
// ...booleanConfigHelper(),
|
|
52
|
+
// },
|
|
71
53
|
proverEnabled: {
|
|
72
54
|
env: 'PXE_PROVER_ENABLED',
|
|
73
55
|
description: 'Enable real proofs',
|
|
74
|
-
...booleanConfigHelper(),
|
|
56
|
+
...booleanConfigHelper(true),
|
|
57
|
+
},
|
|
58
|
+
syncChainTip: {
|
|
59
|
+
env: 'PXE_SYNC_CHAIN_TIP',
|
|
60
|
+
description: 'Which chain tip to sync to (proposed, checkpointed, proven, finalized)',
|
|
61
|
+
defaultValue: 'proposed',
|
|
62
|
+
parseEnv: (val: string) => {
|
|
63
|
+
const allowedValues = ['proposed', 'checkpointed', 'proven', 'finalized'];
|
|
64
|
+
if (allowedValues.includes(val)) {
|
|
65
|
+
return val;
|
|
66
|
+
}
|
|
67
|
+
throw new Error(`Invalid value for PXE_SYNC_CHAIN_TIP: ${val}. Allowed values are: ${allowedValues.join(', ')}`);
|
|
68
|
+
},
|
|
75
69
|
},
|
|
76
70
|
};
|
|
77
71
|
|
|
78
72
|
/**
|
|
79
|
-
* Creates an instance of
|
|
73
|
+
* Creates an instance of PXEConfig out of environment variables using sensible defaults for integration testing if not set.
|
|
80
74
|
*/
|
|
81
|
-
export function
|
|
82
|
-
return getConfigFromMappings<
|
|
75
|
+
export function getPXEConfig(): PXEConfig {
|
|
76
|
+
return getConfigFromMappings<PXEConfig>(pxeConfigMappings);
|
|
83
77
|
}
|
|
84
78
|
|
|
85
79
|
export const pxeCliConfigMappings: ConfigMappingsType<CliPXEOptions> = {
|
|
86
|
-
network: {
|
|
87
|
-
env: 'NETWORK',
|
|
88
|
-
parseEnv: (val: string) => val as Network,
|
|
89
|
-
description: 'External Aztec network to connect to. e.g. devnet',
|
|
90
|
-
},
|
|
91
|
-
apiKey: {
|
|
92
|
-
env: 'API_KEY',
|
|
93
|
-
description: "API Key required by the external network's node",
|
|
94
|
-
},
|
|
95
80
|
nodeUrl: {
|
|
96
81
|
env: 'AZTEC_NODE_URL',
|
|
97
82
|
description: 'Custom Aztec Node URL to connect to',
|
|
98
83
|
},
|
|
99
84
|
};
|
|
100
85
|
|
|
101
|
-
export const allPxeConfigMappings: ConfigMappingsType<CliPXEOptions &
|
|
86
|
+
export const allPxeConfigMappings: ConfigMappingsType<CliPXEOptions & PXEConfig> = {
|
|
102
87
|
...pxeConfigMappings,
|
|
103
88
|
...pxeCliConfigMappings,
|
|
104
89
|
...dataConfigMappings,
|
|
@@ -107,18 +92,19 @@ export const allPxeConfigMappings: ConfigMappingsType<CliPXEOptions & PXEService
|
|
|
107
92
|
parseEnv: (val: string) => parseBooleanEnv(val) || !!process.env.NETWORK,
|
|
108
93
|
description: 'Enable real proofs',
|
|
109
94
|
isBoolean: true,
|
|
95
|
+
defaultValue: true,
|
|
110
96
|
},
|
|
111
97
|
};
|
|
112
98
|
|
|
113
99
|
/**
|
|
114
100
|
* Creates an instance of CliPxeOptions out of environment variables
|
|
115
101
|
*/
|
|
116
|
-
export function getCliPXEOptions(): CliPXEOptions &
|
|
117
|
-
const pxeConfig =
|
|
102
|
+
export function getCliPXEOptions(): CliPXEOptions & PXEConfig {
|
|
103
|
+
const pxeConfig = getPXEConfig();
|
|
118
104
|
const cliOptions = getConfigFromMappings<CliPXEOptions>(pxeCliConfigMappings);
|
|
119
105
|
return {
|
|
120
106
|
...pxeConfig,
|
|
121
107
|
...cliOptions,
|
|
122
|
-
proverEnabled: pxeConfig.proverEnabled
|
|
108
|
+
proverEnabled: pxeConfig.proverEnabled,
|
|
123
109
|
};
|
|
124
110
|
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { Timer } from '@aztec/foundation/timer';
|
|
2
|
+
import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
3
|
+
import type { NodeStats, RoundTripStats } from '@aztec/stdlib/tx';
|
|
4
|
+
|
|
5
|
+
/*
|
|
6
|
+
* Proxy generator for an AztecNode that tracks the time taken for each RPC call and the number of round trips (actual
|
|
7
|
+
* blocking waits for node responses).
|
|
8
|
+
*
|
|
9
|
+
* A round trip is counted when we transition from 0 to 1 in-flight calls, and ends when all concurrent calls complete.
|
|
10
|
+
* This means parallel calls in Promise.all count as a single round trip.
|
|
11
|
+
*
|
|
12
|
+
* Note that batching of RPC calls in `safe_json_rpc_client.ts` could affect the round trip counts but in places we
|
|
13
|
+
* currently use this information we do not even use HTTP as we have direct access to the Aztec Node instance in TS
|
|
14
|
+
* (i.e. not running against external node) so this is not a problem for now.
|
|
15
|
+
*
|
|
16
|
+
* If you want to use this against external node and the info gets skewed by batching you can set the `maxBatchSize`
|
|
17
|
+
* value in `safe_json_rpc_client.ts` to 1 (the main motivation for batching was to get around parallel http requests
|
|
18
|
+
* limits in web browsers which is not a problem when debugging in node.js).
|
|
19
|
+
*/
|
|
20
|
+
export type BenchmarkedNode = AztecNode & { getStats(): NodeStats };
|
|
21
|
+
|
|
22
|
+
export class BenchmarkedNodeFactory {
|
|
23
|
+
static create(node: AztecNode): BenchmarkedNode {
|
|
24
|
+
// Per-method call stats
|
|
25
|
+
const perMethod: Partial<Record<keyof AztecNode, { times: number[] }>> = {};
|
|
26
|
+
|
|
27
|
+
// Round trip tracking
|
|
28
|
+
let inFlightCount = 0;
|
|
29
|
+
let currentRoundTripTimer: Timer | null = null;
|
|
30
|
+
let currentRoundTripMethods: string[] = [];
|
|
31
|
+
const roundTrips: RoundTripStats = {
|
|
32
|
+
roundTrips: 0,
|
|
33
|
+
totalBlockingTime: 0,
|
|
34
|
+
roundTripDurations: [],
|
|
35
|
+
roundTripMethods: [],
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
return new Proxy(node, {
|
|
39
|
+
get(target, prop: keyof BenchmarkedNode) {
|
|
40
|
+
if (prop === 'getStats') {
|
|
41
|
+
return (): NodeStats => {
|
|
42
|
+
return { perMethod, roundTrips };
|
|
43
|
+
};
|
|
44
|
+
} else {
|
|
45
|
+
return function (...args: any[]) {
|
|
46
|
+
// Track per-method stats
|
|
47
|
+
if (!perMethod[prop]) {
|
|
48
|
+
perMethod[prop] = { times: [] };
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// Start of a new round trip batch?
|
|
52
|
+
if (inFlightCount === 0) {
|
|
53
|
+
roundTrips.roundTrips++;
|
|
54
|
+
currentRoundTripTimer = new Timer();
|
|
55
|
+
currentRoundTripMethods = [];
|
|
56
|
+
}
|
|
57
|
+
inFlightCount++;
|
|
58
|
+
currentRoundTripMethods.push(prop);
|
|
59
|
+
|
|
60
|
+
const callTimer = new Timer();
|
|
61
|
+
const result = (target[prop] as any).apply(target, args);
|
|
62
|
+
|
|
63
|
+
// Handle completion - called when the call finishes (after Promise resolves)
|
|
64
|
+
const handleCompletion = () => {
|
|
65
|
+
const callTime = callTimer.ms();
|
|
66
|
+
perMethod[prop]!.times.push(callTime);
|
|
67
|
+
|
|
68
|
+
inFlightCount--;
|
|
69
|
+
|
|
70
|
+
// End of round trip batch - all concurrent calls completed
|
|
71
|
+
if (inFlightCount === 0 && currentRoundTripTimer) {
|
|
72
|
+
const roundTripTime = currentRoundTripTimer.ms();
|
|
73
|
+
roundTrips.totalBlockingTime += roundTripTime;
|
|
74
|
+
roundTrips.roundTripDurations.push(roundTripTime);
|
|
75
|
+
roundTrips.roundTripMethods.push(currentRoundTripMethods);
|
|
76
|
+
currentRoundTripTimer = null;
|
|
77
|
+
currentRoundTripMethods = [];
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
// If the result is a Promise, chain the completion handler
|
|
82
|
+
if (result && typeof result.then === 'function') {
|
|
83
|
+
return result.then(
|
|
84
|
+
(value: any) => {
|
|
85
|
+
handleCompletion();
|
|
86
|
+
return value;
|
|
87
|
+
},
|
|
88
|
+
(error: any) => {
|
|
89
|
+
handleCompletion();
|
|
90
|
+
throw error;
|
|
91
|
+
},
|
|
92
|
+
);
|
|
93
|
+
} else {
|
|
94
|
+
// Synchronous method - handle completion immediately
|
|
95
|
+
handleCompletion();
|
|
96
|
+
return result;
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
}) as BenchmarkedNode;
|
|
102
|
+
}
|
|
103
|
+
}
|