@aztec/pxe 4.0.0-nightly.20250907 → 4.0.0-nightly.20260107
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 +1 -1
- package/dest/bin/check_oracle_version.js +110 -10
- package/dest/block_synchronizer/block_synchronizer.d.ts +39 -0
- package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -0
- package/dest/{synchronizer/synchronizer.js → block_synchronizer/block_synchronizer.js} +23 -23
- 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 +9 -17
- package/dest/config/index.d.ts.map +1 -1
- package/dest/config/index.js +10 -16
- package/dest/config/package_info.d.ts +1 -1
- package/dest/config/package_info.js +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.d.ts +44 -15
- package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.js +142 -57
- package/dest/contract_function_simulator/execution_note_cache.d.ts +11 -9
- package/dest/contract_function_simulator/execution_note_cache.d.ts.map +1 -1
- package/dest/contract_function_simulator/execution_note_cache.js +28 -17
- package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts +16 -0
- package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts.map +1 -0
- package/dest/contract_function_simulator/execution_tagging_index_cache.js +26 -0
- package/dest/contract_function_simulator/hashed_values_cache.d.ts +2 -2
- package/dest/contract_function_simulator/hashed_values_cache.d.ts.map +1 -1
- package/dest/contract_function_simulator/index.d.ts +4 -2
- package/dest/contract_function_simulator/index.d.ts.map +1 -1
- package/dest/contract_function_simulator/index.js +2 -1
- package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts +2 -2
- package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts +5 -4
- package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/log_retrieval_request.js +7 -6
- package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts +3 -3
- package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/log_retrieval_response.js +8 -4
- package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +6 -3
- package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/note_validation_request.js +12 -3
- package/dest/contract_function_simulator/noir-structs/utility_context.d.ts +22 -0
- package/dest/contract_function_simulator/noir-structs/utility_context.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/utility_context.js +33 -0
- package/dest/contract_function_simulator/oracle/index.d.ts +2 -2
- package/dest/contract_function_simulator/oracle/index.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/index.js +1 -1
- package/dest/contract_function_simulator/oracle/interfaces.d.ts +103 -0
- package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -0
- package/dest/contract_function_simulator/oracle/interfaces.js +4 -0
- package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts +2 -4
- package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.js +1 -1
- package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts +10 -4
- package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/note_packing_utils.js +10 -5
- package/dest/contract_function_simulator/oracle/oracle.d.ts +17 -15
- package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/oracle.js +101 -81
- package/dest/contract_function_simulator/oracle/private_execution.d.ts +11 -12
- package/dest/contract_function_simulator/oracle/private_execution.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution.js +15 -24
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +51 -25
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.js +103 -27
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +65 -36
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +171 -69
- package/dest/contract_function_simulator/pick_notes.d.ts +2 -2
- package/dest/contract_function_simulator/pick_notes.d.ts.map +1 -1
- package/dest/contract_function_simulator/pick_notes.js +1 -1
- package/dest/contract_function_simulator/proxied_contract_data_source.d.ts +4 -4
- package/dest/contract_function_simulator/proxied_contract_data_source.d.ts.map +1 -1
- package/dest/contract_function_simulator/proxied_contract_data_source.js +23 -5
- package/dest/contract_function_simulator/proxied_node.d.ts +1 -1
- package/dest/contract_function_simulator/proxied_node.d.ts.map +1 -1
- package/dest/debug/pxe_debug_utils.d.ts +31 -0
- package/dest/debug/pxe_debug_utils.d.ts.map +1 -0
- package/dest/debug/pxe_debug_utils.js +37 -0
- package/dest/entrypoints/client/bundle/index.d.ts +4 -3
- package/dest/entrypoints/client/bundle/index.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/index.js +2 -2
- package/dest/entrypoints/client/bundle/utils.d.ts +9 -9
- package/dest/entrypoints/client/bundle/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/utils.js +21 -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 +8 -8
- package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/utils.js +20 -11
- package/dest/entrypoints/pxe_creation_options.d.ts +5 -2
- package/dest/entrypoints/pxe_creation_options.d.ts.map +1 -1
- package/dest/entrypoints/server/index.d.ts +5 -3
- package/dest/entrypoints/server/index.d.ts.map +1 -1
- package/dest/entrypoints/server/index.js +3 -2
- package/dest/entrypoints/server/utils.d.ts +5 -24
- package/dest/entrypoints/server/utils.d.ts.map +1 -1
- package/dest/entrypoints/server/utils.js +17 -45
- package/dest/error_enriching.d.ts +11 -0
- package/dest/error_enriching.d.ts.map +1 -0
- package/dest/{pxe_service/error_enriching.js → error_enriching.js} +9 -6
- package/dest/events/event_service.d.ts +15 -0
- package/dest/events/event_service.d.ts.map +1 -0
- package/dest/events/event_service.js +47 -0
- package/dest/events/index.d.ts +2 -0
- package/dest/events/index.d.ts.map +1 -0
- package/dest/events/index.js +1 -0
- package/dest/events/private_event_filter_validator.d.ts +9 -0
- package/dest/events/private_event_filter_validator.d.ts.map +1 -0
- package/dest/events/private_event_filter_validator.js +39 -0
- package/dest/logs/log_service.d.ts +26 -0
- package/dest/logs/log_service.d.ts.map +1 -0
- package/dest/logs/log_service.js +120 -0
- package/dest/notes/index.d.ts +2 -0
- package/dest/notes/index.d.ts.map +1 -0
- package/dest/notes/index.js +1 -0
- package/dest/notes/note_service.d.ts +48 -0
- package/dest/notes/note_service.d.ts.map +1 -0
- package/dest/notes/note_service.js +152 -0
- package/dest/oracle_version.d.ts +3 -3
- package/dest/oracle_version.js +2 -2
- package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts +3 -3
- package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts.map +1 -1
- package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.js +7 -7
- package/dest/private_kernel/hints/compute_tx_include_by_timestamp.d.ts +1 -1
- package/dest/private_kernel/hints/compute_tx_include_by_timestamp.js +6 -6
- package/dest/private_kernel/hints/index.d.ts +1 -1
- package/dest/private_kernel/index.d.ts +1 -1
- package/dest/private_kernel/private_kernel_execution_prover.d.ts +9 -2
- package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_execution_prover.js +38 -32
- package/dest/private_kernel/private_kernel_oracle.d.ts +3 -2
- package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_oracle_impl.d.ts +10 -9
- package/dest/private_kernel/private_kernel_oracle_impl.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_oracle_impl.js +7 -7
- package/dest/public_storage/public_storage_service.d.ts +24 -0
- package/dest/public_storage/public_storage_service.d.ts.map +1 -0
- package/dest/public_storage/public_storage_service.js +26 -0
- package/dest/pxe.d.ts +232 -0
- package/dest/pxe.d.ts.map +1 -0
- package/dest/{pxe_service/pxe_service.js → pxe.js} +299 -324
- package/dest/storage/address_store/address_store.d.ts +11 -0
- package/dest/storage/address_store/address_store.d.ts.map +1 -0
- package/dest/storage/{address_data_provider/address_data_provider.js → address_store/address_store.js} +1 -4
- package/dest/storage/address_store/index.d.ts +2 -0
- package/dest/storage/address_store/index.d.ts.map +1 -0
- package/dest/storage/address_store/index.js +1 -0
- package/dest/storage/anchor_block_store/anchor_block_store.d.ts +9 -0
- package/dest/storage/anchor_block_store/anchor_block_store.d.ts.map +1 -0
- package/dest/storage/{sync_data_provider/sync_data_provider.js → anchor_block_store/anchor_block_store.js} +2 -12
- package/dest/storage/anchor_block_store/index.d.ts +2 -0
- package/dest/storage/anchor_block_store/index.d.ts.map +1 -0
- package/dest/storage/anchor_block_store/index.js +1 -0
- package/dest/storage/capsule_store/capsule_store.d.ts +57 -0
- package/dest/storage/capsule_store/capsule_store.d.ts.map +1 -0
- package/dest/storage/{capsule_data_provider/capsule_data_provider.js → capsule_store/capsule_store.js} +34 -10
- 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_data_provider/contract_data_provider.d.ts → contract_store/contract_store.d.ts} +10 -18
- package/dest/storage/contract_store/contract_store.d.ts.map +1 -0
- package/dest/storage/{contract_data_provider/contract_data_provider.js → contract_store/contract_store.js} +46 -18
- package/dest/storage/contract_store/index.d.ts +2 -0
- package/dest/storage/contract_store/index.d.ts.map +1 -0
- package/dest/storage/contract_store/index.js +1 -0
- package/dest/storage/{contract_data_provider → contract_store}/private_functions_tree.d.ts +1 -1
- package/dest/storage/contract_store/private_functions_tree.d.ts.map +1 -0
- package/dest/storage/{contract_data_provider → contract_store}/private_functions_tree.js +1 -1
- package/dest/storage/index.d.ts +8 -9
- package/dest/storage/index.d.ts.map +1 -1
- package/dest/storage/index.js +7 -8
- package/dest/storage/metadata.d.ts +1 -1
- package/dest/storage/note_store/index.d.ts +3 -0
- package/dest/storage/note_store/index.d.ts.map +1 -0
- package/dest/storage/note_store/index.js +2 -0
- package/dest/storage/note_store/note_store.d.ts +84 -0
- package/dest/storage/note_store/note_store.d.ts.map +1 -0
- package/dest/storage/{note_data_provider/note_data_provider.js → note_store/note_store.js} +144 -82
- package/dest/storage/private_event_store/private_event_store.d.ts +56 -0
- package/dest/storage/private_event_store/private_event_store.d.ts.map +1 -0
- package/dest/storage/private_event_store/private_event_store.js +157 -0
- package/dest/storage/tagging_store/index.d.ts +4 -0
- package/dest/storage/tagging_store/index.d.ts.map +1 -0
- package/dest/storage/tagging_store/index.js +3 -0
- package/dest/storage/tagging_store/recipient_tagging_store.d.ts +21 -0
- package/dest/storage/tagging_store/recipient_tagging_store.d.ts.map +1 -0
- package/dest/storage/tagging_store/recipient_tagging_store.js +42 -0
- package/dest/storage/tagging_store/sender_address_book_store.d.ts +14 -0
- package/dest/storage/tagging_store/sender_address_book_store.d.ts.map +1 -0
- package/dest/storage/tagging_store/sender_address_book_store.js +30 -0
- package/dest/storage/tagging_store/sender_tagging_store.d.ts +67 -0
- package/dest/storage/tagging_store/sender_tagging_store.d.ts.map +1 -0
- package/dest/storage/tagging_store/sender_tagging_store.js +196 -0
- package/dest/tagging/index.d.ts +16 -0
- package/dest/tagging/index.d.ts.map +1 -0
- package/dest/tagging/index.js +23 -0
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts +14 -0
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts.map +1 -0
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.js +99 -0
- package/dest/tagging/recipient_sync/utils/find_highest_indexes.d.ts +12 -0
- package/dest/tagging/recipient_sync/utils/find_highest_indexes.d.ts.map +1 -0
- package/dest/tagging/recipient_sync/utils/find_highest_indexes.js +20 -0
- package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts +14 -0
- package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts.map +1 -0
- package/dest/tagging/recipient_sync/utils/load_logs_for_range.js +29 -0
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts +20 -0
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts.map +1 -0
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.js +74 -0
- package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts +11 -0
- package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts.map +1 -0
- package/dest/tagging/sender_sync/utils/get_status_change_of_pending.js +32 -0
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts +18 -0
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts.map +1 -0
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.js +55 -0
- package/dest/tree_membership/tree_membership_service.d.ts +52 -0
- package/dest/tree_membership/tree_membership_service.d.ts.map +1 -0
- package/dest/tree_membership/tree_membership_service.js +84 -0
- package/package.json +22 -24
- package/src/bin/check_oracle_version.ts +134 -10
- package/src/{synchronizer/synchronizer.ts → block_synchronizer/block_synchronizer.ts} +22 -23
- package/src/block_synchronizer/index.ts +1 -0
- package/src/config/index.ts +18 -32
- package/src/config/package_info.ts +1 -1
- package/src/contract_function_simulator/contract_function_simulator.ts +233 -75
- package/src/contract_function_simulator/execution_note_cache.ts +33 -17
- package/src/contract_function_simulator/execution_tagging_index_cache.ts +32 -0
- package/src/contract_function_simulator/hashed_values_cache.ts +1 -1
- package/src/contract_function_simulator/index.ts +3 -1
- package/src/contract_function_simulator/noir-structs/event_validation_request.ts +1 -1
- package/src/contract_function_simulator/noir-structs/log_retrieval_request.ts +6 -5
- package/src/contract_function_simulator/noir-structs/log_retrieval_response.ts +10 -5
- package/src/contract_function_simulator/noir-structs/note_validation_request.ts +14 -2
- package/src/contract_function_simulator/noir-structs/utility_context.ts +42 -0
- package/src/contract_function_simulator/oracle/index.ts +1 -1
- package/src/contract_function_simulator/oracle/interfaces.ts +175 -0
- package/src/contract_function_simulator/oracle/message_load_oracle_inputs.ts +1 -1
- package/src/contract_function_simulator/oracle/note_packing_utils.ts +21 -5
- package/src/contract_function_simulator/oracle/oracle.ts +135 -80
- package/src/contract_function_simulator/oracle/private_execution.ts +22 -28
- package/src/contract_function_simulator/oracle/private_execution_oracle.ts +200 -56
- package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +260 -109
- package/src/contract_function_simulator/pick_notes.ts +1 -1
- package/src/contract_function_simulator/proxied_contract_data_source.ts +24 -7
- package/src/debug/pxe_debug_utils.ts +48 -0
- package/src/entrypoints/client/bundle/index.ts +3 -2
- package/src/entrypoints/client/bundle/utils.ts +21 -23
- package/src/entrypoints/client/lazy/index.ts +3 -2
- package/src/entrypoints/client/lazy/utils.ts +20 -23
- package/src/entrypoints/pxe_creation_options.ts +4 -1
- package/src/entrypoints/server/index.ts +4 -2
- package/src/entrypoints/server/utils.ts +20 -68
- package/src/{pxe_service/error_enriching.ts → error_enriching.ts} +11 -15
- package/src/events/event_service.ts +77 -0
- package/src/events/index.ts +1 -0
- package/src/events/private_event_filter_validator.ts +48 -0
- package/src/logs/log_service.ts +202 -0
- package/src/notes/index.ts +1 -0
- package/src/notes/note_service.ts +200 -0
- package/src/oracle_version.ts +2 -2
- package/src/private_kernel/hints/build_private_kernel_reset_private_inputs.ts +5 -9
- package/src/private_kernel/hints/compute_tx_include_by_timestamp.ts +6 -6
- package/src/private_kernel/private_kernel_execution_prover.ts +51 -43
- package/src/private_kernel/private_kernel_oracle.ts +2 -1
- package/src/private_kernel/private_kernel_oracle_impl.ts +10 -9
- package/src/public_storage/public_storage_service.ts +33 -0
- package/src/{pxe_service/pxe_service.ts → pxe.ts} +349 -410
- package/src/storage/{address_data_provider/address_data_provider.ts → address_store/address_store.ts} +1 -7
- package/src/storage/address_store/index.ts +1 -0
- package/src/storage/{sync_data_provider/sync_data_provider.ts → anchor_block_store/anchor_block_store.ts} +2 -17
- package/src/storage/anchor_block_store/index.ts +1 -0
- package/src/storage/{capsule_data_provider/capsule_data_provider.ts → capsule_store/capsule_store.ts} +34 -12
- package/src/storage/capsule_store/index.ts +1 -0
- package/src/storage/{contract_data_provider/contract_data_provider.ts → contract_store/contract_store.ts} +67 -28
- package/src/storage/contract_store/index.ts +1 -0
- package/src/storage/{contract_data_provider → contract_store}/private_functions_tree.ts +1 -1
- package/src/storage/index.ts +7 -8
- package/src/storage/note_store/index.ts +2 -0
- package/src/storage/{note_data_provider/note_data_provider.ts → note_store/note_store.ts} +173 -111
- package/src/storage/private_event_store/private_event_store.ts +213 -0
- package/src/storage/tagging_store/index.ts +3 -0
- package/src/storage/tagging_store/recipient_tagging_store.ts +53 -0
- package/src/storage/tagging_store/sender_address_book_store.ts +42 -0
- package/src/storage/tagging_store/sender_tagging_store.ts +244 -0
- package/src/tagging/index.ts +28 -0
- package/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts +129 -0
- package/src/tagging/recipient_sync/utils/find_highest_indexes.ts +34 -0
- package/src/tagging/recipient_sync/utils/load_logs_for_range.ts +43 -0
- package/src/tagging/sender_sync/sync_sender_tagging_indexes.ts +96 -0
- package/src/tagging/sender_sync/utils/get_status_change_of_pending.ts +44 -0
- package/src/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.ts +72 -0
- package/src/tree_membership/tree_membership_service.ts +112 -0
- package/dest/bin/index.d.ts +0 -3
- package/dest/bin/index.d.ts.map +0 -1
- package/dest/bin/index.js +0 -48
- package/dest/contract_function_simulator/execution_data_provider.d.ts +0 -285
- package/dest/contract_function_simulator/execution_data_provider.d.ts.map +0 -1
- package/dest/contract_function_simulator/execution_data_provider.js +0 -14
- package/dest/contract_function_simulator/oracle/typed_oracle.d.ts +0 -87
- package/dest/contract_function_simulator/oracle/typed_oracle.d.ts.map +0 -1
- package/dest/contract_function_simulator/oracle/typed_oracle.js +0 -146
- package/dest/contract_function_simulator/pxe_oracle_interface.d.ts +0 -158
- package/dest/contract_function_simulator/pxe_oracle_interface.d.ts.map +0 -1
- package/dest/contract_function_simulator/pxe_oracle_interface.js +0 -701
- package/dest/contract_function_simulator/tagging_utils.d.ts +0 -17
- package/dest/contract_function_simulator/tagging_utils.d.ts.map +0 -1
- package/dest/contract_function_simulator/tagging_utils.js +0 -23
- package/dest/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 -100
- package/dest/pxe_service/pxe_service.d.ts.map +0 -1
- package/dest/storage/address_data_provider/address_data_provider.d.ts +0 -13
- package/dest/storage/address_data_provider/address_data_provider.d.ts.map +0 -1
- package/dest/storage/address_data_provider/index.d.ts +0 -2
- package/dest/storage/address_data_provider/index.d.ts.map +0 -1
- package/dest/storage/address_data_provider/index.js +0 -1
- package/dest/storage/capsule_data_provider/capsule_data_provider.d.ts +0 -27
- package/dest/storage/capsule_data_provider/capsule_data_provider.d.ts.map +0 -1
- package/dest/storage/capsule_data_provider/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.map +0 -1
- package/dest/storage/contract_data_provider/index.d.ts +0 -2
- package/dest/storage/contract_data_provider/index.d.ts.map +0 -1
- package/dest/storage/contract_data_provider/index.js +0 -1
- package/dest/storage/contract_data_provider/private_functions_tree.d.ts.map +0 -1
- package/dest/storage/data_provider.d.ts +0 -4
- package/dest/storage/data_provider.d.ts.map +0 -1
- package/dest/storage/data_provider.js +0 -1
- package/dest/storage/note_data_provider/index.d.ts +0 -3
- package/dest/storage/note_data_provider/index.d.ts.map +0 -1
- package/dest/storage/note_data_provider/index.js +0 -2
- package/dest/storage/note_data_provider/note_dao.d.ts +0 -100
- package/dest/storage/note_data_provider/note_dao.d.ts.map +0 -1
- package/dest/storage/note_data_provider/note_dao.js +0 -102
- package/dest/storage/note_data_provider/note_data_provider.d.ts +0 -20
- package/dest/storage/note_data_provider/note_data_provider.d.ts.map +0 -1
- package/dest/storage/private_event_data_provider/private_event_data_provider.d.ts +0 -37
- package/dest/storage/private_event_data_provider/private_event_data_provider.d.ts.map +0 -1
- package/dest/storage/private_event_data_provider/private_event_data_provider.js +0 -96
- package/dest/storage/sync_data_provider/index.d.ts +0 -2
- package/dest/storage/sync_data_provider/index.d.ts.map +0 -1
- package/dest/storage/sync_data_provider/index.js +0 -1
- package/dest/storage/sync_data_provider/sync_data_provider.d.ts +0 -12
- package/dest/storage/sync_data_provider/sync_data_provider.d.ts.map +0 -1
- package/dest/storage/tagging_data_provider/index.d.ts +0 -2
- package/dest/storage/tagging_data_provider/index.d.ts.map +0 -1
- package/dest/storage/tagging_data_provider/index.js +0 -1
- package/dest/storage/tagging_data_provider/tagging_data_provider.d.ts +0 -18
- package/dest/storage/tagging_data_provider/tagging_data_provider.d.ts.map +0 -1
- package/dest/storage/tagging_data_provider/tagging_data_provider.js +0 -82
- package/dest/synchronizer/index.d.ts +0 -2
- package/dest/synchronizer/index.d.ts.map +0 -1
- package/dest/synchronizer/index.js +0 -1
- package/dest/synchronizer/synchronizer.d.ts +0 -35
- package/dest/synchronizer/synchronizer.d.ts.map +0 -1
- package/dest/test/pxe_test_suite.d.ts +0 -3
- package/dest/test/pxe_test_suite.d.ts.map +0 -1
- package/dest/test/pxe_test_suite.js +0 -97
- package/src/bin/index.ts +0 -62
- package/src/contract_function_simulator/execution_data_provider.ts +0 -361
- package/src/contract_function_simulator/oracle/typed_oracle.ts +0 -289
- package/src/contract_function_simulator/pxe_oracle_interface.ts +0 -1020
- package/src/contract_function_simulator/tagging_utils.ts +0 -32
- package/src/pxe_service/index.ts +0 -2
- package/src/storage/address_data_provider/index.ts +0 -1
- package/src/storage/capsule_data_provider/index.ts +0 -1
- package/src/storage/contract_data_provider/index.ts +0 -1
- package/src/storage/data_provider.ts +0 -3
- package/src/storage/note_data_provider/index.ts +0 -2
- package/src/storage/note_data_provider/note_dao.ts +0 -154
- package/src/storage/private_event_data_provider/private_event_data_provider.ts +0 -134
- package/src/storage/sync_data_provider/index.ts +0 -1
- package/src/storage/tagging_data_provider/index.ts +0 -1
- package/src/storage/tagging_data_provider/tagging_data_provider.ts +0 -123
- package/src/synchronizer/index.ts +0 -1
- package/src/test/pxe_test_suite.ts +0 -113
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
2
|
+
import type { AztecNode } from '@aztec/stdlib/interfaces/server';
|
|
3
|
+
import type { DirectionalAppTaggingSecret } from '@aztec/stdlib/logs';
|
|
4
|
+
import type { SenderTaggingStore } from '../../storage/tagging_store/sender_tagging_store.js';
|
|
5
|
+
/**
|
|
6
|
+
* Syncs tagging indexes. This function needs to be called whenever a private log is being sent.
|
|
7
|
+
*
|
|
8
|
+
* @param secret - The secret that's unique for (sender, recipient, contract) tuple while the direction of
|
|
9
|
+
* sender -> recipient matters.
|
|
10
|
+
* @param app - The address of the contract that the logs are tagged for. Needs to be provided because we perform
|
|
11
|
+
* second round of siloing in this function which is necessary because kernels do it as well (they silo first field
|
|
12
|
+
* of the private log which corresponds to the tag).
|
|
13
|
+
* @remarks When syncing the indexes as sender we don't care about the log contents - we only care about the highest
|
|
14
|
+
* pending and highest finalized indexes as that guides the next index choice when sending a log. The next index choice
|
|
15
|
+
* is simply the highest pending index plus one (or finalized if pending is undefined).
|
|
16
|
+
* @dev This function looks for new indexes, adds them to pending, then it checks status of each pending index and
|
|
17
|
+
* updates its status accordingly.
|
|
18
|
+
*/
|
|
19
|
+
export declare function syncSenderTaggingIndexes(secret: DirectionalAppTaggingSecret, app: AztecAddress, aztecNode: AztecNode, taggingStore: SenderTaggingStore): Promise<void>;
|
|
20
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3luY19zZW5kZXJfdGFnZ2luZ19pbmRleGVzLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvdGFnZ2luZy9zZW5kZXJfc3luYy9zeW5jX3NlbmRlcl90YWdnaW5nX2luZGV4ZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLEVBQUUsWUFBWSxFQUFFLE1BQU0sNkJBQTZCLENBQUM7QUFDaEUsT0FBTyxLQUFLLEVBQUUsU0FBUyxFQUFFLE1BQU0saUNBQWlDLENBQUM7QUFDakUsT0FBTyxLQUFLLEVBQUUsMkJBQTJCLEVBQUUsTUFBTSxvQkFBb0IsQ0FBQztBQUV0RSxPQUFPLEtBQUssRUFBRSxrQkFBa0IsRUFBRSxNQUFNLHFEQUFxRCxDQUFDO0FBSzlGOzs7Ozs7Ozs7Ozs7O0dBYUc7QUFDSCx3QkFBc0Isd0JBQXdCLENBQzVDLE1BQU0sRUFBRSwyQkFBMkIsRUFDbkMsR0FBRyxFQUFFLFlBQVksRUFDakIsU0FBUyxFQUFFLFNBQVMsRUFDcEIsWUFBWSxFQUFFLGtCQUFrQixHQUMvQixPQUFPLENBQUMsSUFBSSxDQUFDLENBbUVmIn0=
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sync_sender_tagging_indexes.d.ts","sourceRoot":"","sources":["../../../src/tagging/sender_sync/sync_sender_tagging_indexes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,oBAAoB,CAAC;AAEtE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qDAAqD,CAAC;AAK9F;;;;;;;;;;;;;GAaG;AACH,wBAAsB,wBAAwB,CAC5C,MAAM,EAAE,2BAA2B,EACnC,GAAG,EAAE,YAAY,EACjB,SAAS,EAAE,SAAS,EACpB,YAAY,EAAE,kBAAkB,GAC/B,OAAO,CAAC,IAAI,CAAC,CAmEf"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN } from '../index.js';
|
|
2
|
+
import { getStatusChangeOfPending } from './utils/get_status_change_of_pending.js';
|
|
3
|
+
import { loadAndStoreNewTaggingIndexes } from './utils/load_and_store_new_tagging_indexes.js';
|
|
4
|
+
/**
|
|
5
|
+
* Syncs tagging indexes. This function needs to be called whenever a private log is being sent.
|
|
6
|
+
*
|
|
7
|
+
* @param secret - The secret that's unique for (sender, recipient, contract) tuple while the direction of
|
|
8
|
+
* sender -> recipient matters.
|
|
9
|
+
* @param app - The address of the contract that the logs are tagged for. Needs to be provided because we perform
|
|
10
|
+
* second round of siloing in this function which is necessary because kernels do it as well (they silo first field
|
|
11
|
+
* of the private log which corresponds to the tag).
|
|
12
|
+
* @remarks When syncing the indexes as sender we don't care about the log contents - we only care about the highest
|
|
13
|
+
* pending and highest finalized indexes as that guides the next index choice when sending a log. The next index choice
|
|
14
|
+
* is simply the highest pending index plus one (or finalized if pending is undefined).
|
|
15
|
+
* @dev This function looks for new indexes, adds them to pending, then it checks status of each pending index and
|
|
16
|
+
* updates its status accordingly.
|
|
17
|
+
*/ export async function syncSenderTaggingIndexes(secret, app, aztecNode, taggingStore) {
|
|
18
|
+
// # Explanation of how syncing works
|
|
19
|
+
//
|
|
20
|
+
// When choosing an index, we select: highest pending index + 1 (or highest finalized index + 1 if no pending).
|
|
21
|
+
// If the chosen index is more than WINDOW_LEN from the highest finalized index, we throw an error. By having this
|
|
22
|
+
// hard limit we give a guarantee to a recipient that he doesn't need to look further than WINDOW_LEN ahead of the
|
|
23
|
+
// highest finalized index.
|
|
24
|
+
//
|
|
25
|
+
// This function synchronizes the finalized and pending indexes by iteratively querying the node for a window of
|
|
26
|
+
// indexes at a time, storing all those indexes as pending, and then checking the status of each pending index to
|
|
27
|
+
// update its finalization status accordingly. If we stumble upon a window with no indexes, we stop the loop.
|
|
28
|
+
//
|
|
29
|
+
// Stopping at that point is safe because of the limit described above - there can never be an index that is more
|
|
30
|
+
// than WINDOW_LEN from the highest finalized index.
|
|
31
|
+
//
|
|
32
|
+
// # Note on performance
|
|
33
|
+
// Each window advance requires two queries (logs + tx status). For example, syncing indexes 0–500 with a window of
|
|
34
|
+
// 100 takes at least 10 round trips (5 windows × 2 queries).
|
|
35
|
+
const finalizedIndex = await taggingStore.getLastFinalizedIndex(secret);
|
|
36
|
+
let start = finalizedIndex === undefined ? 0 : finalizedIndex + 1;
|
|
37
|
+
let end = start + UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN;
|
|
38
|
+
let previousFinalizedIndex = finalizedIndex;
|
|
39
|
+
let newFinalizedIndex = undefined;
|
|
40
|
+
while(true){
|
|
41
|
+
// Load and store indexes for the current window. These indexes may already exist in the database if txs using
|
|
42
|
+
// them were previously sent from this PXE. Any duplicates are handled by the tagging data provider.
|
|
43
|
+
await loadAndStoreNewTaggingIndexes(secret, app, start, end, aztecNode, taggingStore);
|
|
44
|
+
// Retrieve all indexes within the current window from storage and update their status accordingly.
|
|
45
|
+
const pendingTxHashes = await taggingStore.getTxHashesOfPendingIndexes(secret, start, end);
|
|
46
|
+
if (pendingTxHashes.length === 0) {
|
|
47
|
+
break;
|
|
48
|
+
}
|
|
49
|
+
const { txHashesToFinalize, txHashesToDrop } = await getStatusChangeOfPending(pendingTxHashes, aztecNode);
|
|
50
|
+
await taggingStore.dropPendingIndexes(txHashesToDrop);
|
|
51
|
+
await taggingStore.finalizePendingIndexes(txHashesToFinalize);
|
|
52
|
+
// We check if the finalized index has been updated.
|
|
53
|
+
newFinalizedIndex = await taggingStore.getLastFinalizedIndex(secret);
|
|
54
|
+
if (previousFinalizedIndex !== newFinalizedIndex) {
|
|
55
|
+
// A new finalized index was found, so we'll run the loop again. For example:
|
|
56
|
+
// - Previous finalized index: 10
|
|
57
|
+
// - New finalized index: 13
|
|
58
|
+
// - Window length: 10
|
|
59
|
+
//
|
|
60
|
+
// In the last iteration, we processed indexes 11-20. To avoid reprocessing the same logs,
|
|
61
|
+
// we'll only look at the new indexes 21-23:
|
|
62
|
+
//
|
|
63
|
+
// Previous window: [11, 12, 13, 14, 15, 16, 17, 18, 19, 20]
|
|
64
|
+
// New window: [21, 22, 23]
|
|
65
|
+
const previousEnd = end;
|
|
66
|
+
// Add 1 because `end` is exclusive and the known finalized index is not included in the window.
|
|
67
|
+
end = newFinalizedIndex + UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN + 1;
|
|
68
|
+
start = previousEnd;
|
|
69
|
+
previousFinalizedIndex = newFinalizedIndex;
|
|
70
|
+
} else {
|
|
71
|
+
break;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { AztecNode } from '@aztec/stdlib/interfaces/server';
|
|
2
|
+
import { TxHash } from '@aztec/stdlib/tx';
|
|
3
|
+
/**
|
|
4
|
+
* Based on receipts obtained from `aztecNode` returns which pending transactions changed their status to finalized or
|
|
5
|
+
* dropped.
|
|
6
|
+
*/
|
|
7
|
+
export declare function getStatusChangeOfPending(pending: TxHash[], aztecNode: AztecNode): Promise<{
|
|
8
|
+
txHashesToFinalize: TxHash[];
|
|
9
|
+
txHashesToDrop: TxHash[];
|
|
10
|
+
}>;
|
|
11
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2V0X3N0YXR1c19jaGFuZ2Vfb2ZfcGVuZGluZy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vc3JjL3RhZ2dpbmcvc2VuZGVyX3N5bmMvdXRpbHMvZ2V0X3N0YXR1c19jaGFuZ2Vfb2ZfcGVuZGluZy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUNqRSxPQUFPLEVBQUUsTUFBTSxFQUFZLE1BQU0sa0JBQWtCLENBQUM7QUFFcEQ7OztHQUdHO0FBQ0gsd0JBQXNCLHdCQUF3QixDQUM1QyxPQUFPLEVBQUUsTUFBTSxFQUFFLEVBQ2pCLFNBQVMsRUFBRSxTQUFTLEdBQ25CLE9BQU8sQ0FBQztJQUFFLGtCQUFrQixFQUFFLE1BQU0sRUFBRSxDQUFDO0lBQUMsY0FBYyxFQUFFLE1BQU0sRUFBRSxDQUFBO0NBQUUsQ0FBQyxDQWlDckUifQ==
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get_status_change_of_pending.d.ts","sourceRoot":"","sources":["../../../../src/tagging/sender_sync/utils/get_status_change_of_pending.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,MAAM,EAAY,MAAM,kBAAkB,CAAC;AAEpD;;;GAGG;AACH,wBAAsB,wBAAwB,CAC5C,OAAO,EAAE,MAAM,EAAE,EACjB,SAAS,EAAE,SAAS,GACnB,OAAO,CAAC;IAAE,kBAAkB,EAAE,MAAM,EAAE,CAAC;IAAC,cAAc,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CAiCrE"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { TxStatus } from '@aztec/stdlib/tx';
|
|
2
|
+
/**
|
|
3
|
+
* Based on receipts obtained from `aztecNode` returns which pending transactions changed their status to finalized or
|
|
4
|
+
* dropped.
|
|
5
|
+
*/ export async function getStatusChangeOfPending(pending, aztecNode) {
|
|
6
|
+
// Get receipts for all pending tx hashes and the finalized block number.
|
|
7
|
+
const [receipts, { finalized }] = await Promise.all([
|
|
8
|
+
Promise.all(pending.map((pendingTxHash)=>aztecNode.getTxReceipt(pendingTxHash))),
|
|
9
|
+
aztecNode.getL2Tips()
|
|
10
|
+
]);
|
|
11
|
+
const txHashesToFinalize = [];
|
|
12
|
+
const txHashesToDrop = [];
|
|
13
|
+
for(let i = 0; i < receipts.length; i++){
|
|
14
|
+
const receipt = receipts[i];
|
|
15
|
+
const txHash = pending[i];
|
|
16
|
+
if (receipt.status === TxStatus.SUCCESS && receipt.blockNumber && receipt.blockNumber <= finalized.number) {
|
|
17
|
+
// Tx has been included in a block and the corresponding block is finalized --> we mark the indexes as
|
|
18
|
+
// finalized.
|
|
19
|
+
txHashesToFinalize.push(txHash);
|
|
20
|
+
} else if (receipt.status === TxStatus.DROPPED || receipt.status === TxStatus.APP_LOGIC_REVERTED || receipt.status === TxStatus.TEARDOWN_REVERTED || receipt.status === TxStatus.BOTH_REVERTED) {
|
|
21
|
+
// Tx was dropped or reverted --> we drop the corresponding pending indexes.
|
|
22
|
+
// TODO(#17615): Don't drop pending indexes corresponding to non-revertible phases.
|
|
23
|
+
txHashesToDrop.push(txHash);
|
|
24
|
+
} else {
|
|
25
|
+
// Tx is still pending or the corresponding block is not yet finalized --> we don't do anything.
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return {
|
|
29
|
+
txHashesToFinalize,
|
|
30
|
+
txHashesToDrop
|
|
31
|
+
};
|
|
32
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
2
|
+
import type { AztecNode } from '@aztec/stdlib/interfaces/server';
|
|
3
|
+
import type { DirectionalAppTaggingSecret } from '@aztec/stdlib/logs';
|
|
4
|
+
import type { SenderTaggingStore } from '../../../storage/tagging_store/sender_tagging_store.js';
|
|
5
|
+
/**
|
|
6
|
+
* Loads tagging indexes from the Aztec node and stores them in the tagging data provider.
|
|
7
|
+
* @remarks This function is one of two places by which a pending index can get to the tagging data provider. The other
|
|
8
|
+
* place is when a tx is being sent from this PXE.
|
|
9
|
+
* @param secret - The directional app tagging secret that's unique for (sender, recipient, contract) tuple.
|
|
10
|
+
* @param app - The address of the contract that the logs are tagged for. Used for siloing tags to match
|
|
11
|
+
* kernel circuit behavior.
|
|
12
|
+
* @param start - The starting index (inclusive) of the window to process.
|
|
13
|
+
* @param end - The ending index (exclusive) of the window to process.
|
|
14
|
+
* @param aztecNode - The Aztec node instance to query for logs.
|
|
15
|
+
* @param taggingStore - The data provider to store pending indexes.
|
|
16
|
+
*/
|
|
17
|
+
export declare function loadAndStoreNewTaggingIndexes(secret: DirectionalAppTaggingSecret, app: AztecAddress, start: number, end: number, aztecNode: AztecNode, taggingStore: SenderTaggingStore): Promise<void>;
|
|
18
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibG9hZF9hbmRfc3RvcmVfbmV3X3RhZ2dpbmdfaW5kZXhlcy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vc3JjL3RhZ2dpbmcvc2VuZGVyX3N5bmMvdXRpbHMvbG9hZF9hbmRfc3RvcmVfbmV3X3RhZ2dpbmdfaW5kZXhlcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxZQUFZLEVBQUUsTUFBTSw2QkFBNkIsQ0FBQztBQUNoRSxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUNqRSxPQUFPLEtBQUssRUFBRSwyQkFBMkIsRUFBVSxNQUFNLG9CQUFvQixDQUFDO0FBSTlFLE9BQU8sS0FBSyxFQUFFLGtCQUFrQixFQUFFLE1BQU0sd0RBQXdELENBQUM7QUFFakc7Ozs7Ozs7Ozs7O0dBV0c7QUFDSCx3QkFBc0IsNkJBQTZCLENBQ2pELE1BQU0sRUFBRSwyQkFBMkIsRUFDbkMsR0FBRyxFQUFFLFlBQVksRUFDakIsS0FBSyxFQUFFLE1BQU0sRUFDYixHQUFHLEVBQUUsTUFBTSxFQUNYLFNBQVMsRUFBRSxTQUFTLEVBQ3BCLFlBQVksRUFBRSxrQkFBa0IsaUJBa0JqQyJ9
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"load_and_store_new_tagging_indexes.d.ts","sourceRoot":"","sources":["../../../../src/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,KAAK,EAAE,2BAA2B,EAAU,MAAM,oBAAoB,CAAC;AAI9E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wDAAwD,CAAC;AAEjG;;;;;;;;;;;GAWG;AACH,wBAAsB,6BAA6B,CACjD,MAAM,EAAE,2BAA2B,EACnC,GAAG,EAAE,YAAY,EACjB,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,MAAM,EACX,SAAS,EAAE,SAAS,EACpB,YAAY,EAAE,kBAAkB,iBAkBjC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { SiloedTag, Tag } from '@aztec/stdlib/logs';
|
|
2
|
+
import { TxHash } from '@aztec/stdlib/tx';
|
|
3
|
+
/**
|
|
4
|
+
* Loads tagging indexes from the Aztec node and stores them in the tagging data provider.
|
|
5
|
+
* @remarks This function is one of two places by which a pending index can get to the tagging data provider. The other
|
|
6
|
+
* place is when a tx is being sent from this PXE.
|
|
7
|
+
* @param secret - The directional app tagging secret that's unique for (sender, recipient, contract) tuple.
|
|
8
|
+
* @param app - The address of the contract that the logs are tagged for. Used for siloing tags to match
|
|
9
|
+
* kernel circuit behavior.
|
|
10
|
+
* @param start - The starting index (inclusive) of the window to process.
|
|
11
|
+
* @param end - The ending index (exclusive) of the window to process.
|
|
12
|
+
* @param aztecNode - The Aztec node instance to query for logs.
|
|
13
|
+
* @param taggingStore - The data provider to store pending indexes.
|
|
14
|
+
*/ export async function loadAndStoreNewTaggingIndexes(secret, app, start, end, aztecNode, taggingStore) {
|
|
15
|
+
// We compute the tags for the current window of indexes
|
|
16
|
+
const preTagsForWindow = Array(end - start).fill(0).map((_, i)=>({
|
|
17
|
+
secret,
|
|
18
|
+
index: start + i
|
|
19
|
+
}));
|
|
20
|
+
const siloedTagsForWindow = await Promise.all(preTagsForWindow.map(async (preTag)=>SiloedTag.compute(await Tag.compute(preTag), app)));
|
|
21
|
+
const txsForTags = await getTxsContainingTags(siloedTagsForWindow, aztecNode);
|
|
22
|
+
const highestIndexMap = getTxHighestIndexMap(txsForTags, preTagsForWindow);
|
|
23
|
+
// Now we iterate over the map, reconstruct the preTags and tx hash and store them in the db.
|
|
24
|
+
for (const [txHashStr, highestIndex] of highestIndexMap.entries()){
|
|
25
|
+
const txHash = TxHash.fromString(txHashStr);
|
|
26
|
+
await taggingStore.storePendingIndexes([
|
|
27
|
+
{
|
|
28
|
+
secret,
|
|
29
|
+
index: highestIndex
|
|
30
|
+
}
|
|
31
|
+
], txHash);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
// Returns txs that used the given tags. A tag might have been used in multiple txs and for this reason we return
|
|
35
|
+
// an array for each tag.
|
|
36
|
+
async function getTxsContainingTags(tags, aztecNode) {
|
|
37
|
+
const allLogs = await aztecNode.getPrivateLogsByTags(tags);
|
|
38
|
+
return allLogs.map((logs)=>logs.map((log)=>log.txHash));
|
|
39
|
+
}
|
|
40
|
+
// Returns a map of txHash to the highest index for that txHash.
|
|
41
|
+
function getTxHighestIndexMap(txHashesForTags, preTagsForWindow) {
|
|
42
|
+
if (txHashesForTags.length !== preTagsForWindow.length) {
|
|
43
|
+
throw new Error(`Number of tx hashes arrays does not match number of pre-tags. ${txHashesForTags.length} !== ${preTagsForWindow.length}`);
|
|
44
|
+
}
|
|
45
|
+
const highestIndexMap = new Map();
|
|
46
|
+
for(let i = 0; i < txHashesForTags.length; i++){
|
|
47
|
+
const taggingIndex = preTagsForWindow[i].index;
|
|
48
|
+
const txHashesForTag = txHashesForTags[i];
|
|
49
|
+
for (const txHash of txHashesForTag){
|
|
50
|
+
const key = txHash.toString();
|
|
51
|
+
highestIndexMap.set(key, Math.max(highestIndexMap.get(key) ?? 0, taggingIndex));
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return highestIndexMap;
|
|
55
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { L1_TO_L2_MSG_TREE_HEIGHT } from '@aztec/constants';
|
|
2
|
+
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
|
+
import type { SiblingPath } from '@aztec/foundation/trees';
|
|
4
|
+
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
5
|
+
import type { BlockParameter } from '@aztec/stdlib/block';
|
|
6
|
+
import type { AztecNode } from '@aztec/stdlib/interfaces/server';
|
|
7
|
+
import { MerkleTreeId, NullifierMembershipWitness, PublicDataWitness } from '@aztec/stdlib/trees';
|
|
8
|
+
import type { AnchorBlockStore } from '../storage/anchor_block_store/anchor_block_store.js';
|
|
9
|
+
export declare class TreeMembershipService {
|
|
10
|
+
#private;
|
|
11
|
+
private readonly aztecNode;
|
|
12
|
+
private readonly anchorBlockStore;
|
|
13
|
+
constructor(aztecNode: AztecNode, anchorBlockStore: AnchorBlockStore);
|
|
14
|
+
/**
|
|
15
|
+
* Gets the index of a nullifier in the nullifier tree.
|
|
16
|
+
* @returns - The index of the nullifier. Undefined if it does not exist in the tree.
|
|
17
|
+
*/
|
|
18
|
+
getNullifierIndex(nullifier: Fr): Promise<bigint | undefined>;
|
|
19
|
+
/**
|
|
20
|
+
* Fetches the index and sibling path of a leaf at a given block from a given tree.
|
|
21
|
+
* @param blockNumber - The block number at which to get the membership witness.
|
|
22
|
+
* @param treeId - Id of the tree to get the sibling path from.
|
|
23
|
+
* @param leafValue - The leaf value
|
|
24
|
+
* @returns The index and sibling path concatenated [index, sibling_path]
|
|
25
|
+
*/
|
|
26
|
+
getMembershipWitness(blockNumber: BlockParameter, treeId: MerkleTreeId, leafValue: Fr): Promise<Fr[]>;
|
|
27
|
+
/**
|
|
28
|
+
* Returns a low nullifier membership witness for a given nullifier at a given block.
|
|
29
|
+
* @param blockNumber - The block number at which to get the index.
|
|
30
|
+
* @param nullifier - Nullifier we try to find the low nullifier witness for.
|
|
31
|
+
* @returns The low nullifier membership witness (if found).
|
|
32
|
+
* @remarks Low nullifier witness can be used to perform a nullifier non-inclusion proof by leveraging the "linked
|
|
33
|
+
* list structure" of leaves and proving that a lower nullifier is pointing to a bigger next value than the nullifier
|
|
34
|
+
* we are trying to prove non-inclusion for.
|
|
35
|
+
*/
|
|
36
|
+
getLowNullifierMembershipWitness(blockNumber: BlockParameter, nullifier: Fr): Promise<NullifierMembershipWitness | undefined>;
|
|
37
|
+
/**
|
|
38
|
+
* Returns a witness for a given slot of the public data tree at a given block.
|
|
39
|
+
* @param blockNumber - The block number at which to get the witness.
|
|
40
|
+
* @param leafSlot - The slot of the public data in the public data tree.
|
|
41
|
+
*/
|
|
42
|
+
getPublicDataWitness(blockNumber: BlockParameter, leafSlot: Fr): Promise<PublicDataWitness | undefined>;
|
|
43
|
+
/**
|
|
44
|
+
* Looks for the L1 to L2 membership witness of a message at the Aztec node, given its hash.
|
|
45
|
+
* @param contractAddress - Address of a contract by which the message was emitted.
|
|
46
|
+
* @dev Contract address and secret are only used to compute the nullifier to get non-nullified messages.
|
|
47
|
+
* The message nullifier is computed locally, so the secret is not sent to the node.
|
|
48
|
+
* @returns The l1 to l2 membership witness (index of message in the tree and sibling path).
|
|
49
|
+
*/
|
|
50
|
+
getL1ToL2MembershipWitness(contractAddress: AztecAddress, messageHash: Fr, secret: Fr): Promise<[bigint, SiblingPath<typeof L1_TO_L2_MSG_TREE_HEIGHT>]>;
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHJlZV9tZW1iZXJzaGlwX3NlcnZpY2UuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy90cmVlX21lbWJlcnNoaXAvdHJlZV9tZW1iZXJzaGlwX3NlcnZpY2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLEVBQUUsd0JBQXdCLEVBQUUsTUFBTSxrQkFBa0IsQ0FBQztBQUNqRSxPQUFPLEtBQUssRUFBRSxFQUFFLEVBQUUsTUFBTSxnQ0FBZ0MsQ0FBQztBQUN6RCxPQUFPLEtBQUssRUFBRSxXQUFXLEVBQUUsTUFBTSx5QkFBeUIsQ0FBQztBQUMzRCxPQUFPLEtBQUssRUFBRSxZQUFZLEVBQUUsTUFBTSw2QkFBNkIsQ0FBQztBQUNoRSxPQUFPLEtBQUssRUFBRSxjQUFjLEVBQUUsTUFBTSxxQkFBcUIsQ0FBQztBQUMxRCxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUVqRSxPQUFPLEVBQUUsWUFBWSxFQUFFLDBCQUEwQixFQUFFLGlCQUFpQixFQUFFLE1BQU0scUJBQXFCLENBQUM7QUFFbEcsT0FBTyxLQUFLLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSxxREFBcUQsQ0FBQztBQUU1RixxQkFBYSxxQkFBcUI7O0lBRTlCLE9BQU8sQ0FBQyxRQUFRLENBQUMsU0FBUztJQUMxQixPQUFPLENBQUMsUUFBUSxDQUFDLGdCQUFnQjtJQUZuQyxZQUNtQixTQUFTLEVBQUUsU0FBUyxFQUNwQixnQkFBZ0IsRUFBRSxnQkFBZ0IsRUFDakQ7SUFFSjs7O09BR0c7SUFDSSxpQkFBaUIsQ0FBQyxTQUFTLEVBQUUsRUFBRSwrQkFFckM7SUFFRDs7Ozs7O09BTUc7SUFDVSxvQkFBb0IsQ0FBQyxXQUFXLEVBQUUsY0FBYyxFQUFFLE1BQU0sRUFBRSxZQUFZLEVBQUUsU0FBUyxFQUFFLEVBQUUsR0FBRyxPQUFPLENBQUMsRUFBRSxFQUFFLENBQUMsQ0FNakg7SUFFRDs7Ozs7Ozs7T0FRRztJQUNVLGdDQUFnQyxDQUMzQyxXQUFXLEVBQUUsY0FBYyxFQUMzQixTQUFTLEVBQUUsRUFBRSxHQUNaLE9BQU8sQ0FBQywwQkFBMEIsR0FBRyxTQUFTLENBQUMsQ0FNakQ7SUFFRDs7OztPQUlHO0lBQ1Usb0JBQW9CLENBQUMsV0FBVyxFQUFFLGNBQWMsRUFBRSxRQUFRLEVBQUUsRUFBRSxHQUFHLE9BQU8sQ0FBQyxpQkFBaUIsR0FBRyxTQUFTLENBQUMsQ0FNbkg7SUFFRDs7Ozs7O09BTUc7SUFDSSwwQkFBMEIsQ0FDL0IsZUFBZSxFQUFFLFlBQVksRUFDN0IsV0FBVyxFQUFFLEVBQUUsRUFDZixNQUFNLEVBQUUsRUFBRSxHQUNULE9BQU8sQ0FBQyxDQUFDLE1BQU0sRUFBRSxXQUFXLENBQUMsT0FBTyx3QkFBd0IsQ0FBQyxDQUFDLENBQUMsQ0FFakU7Q0F5QkYifQ==
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tree_membership_service.d.ts","sourceRoot":"","sources":["../../src/tree_membership/tree_membership_service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAEjE,OAAO,EAAE,YAAY,EAAE,0BAA0B,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAElG,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qDAAqD,CAAC;AAE5F,qBAAa,qBAAqB;;IAE9B,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IAFnC,YACmB,SAAS,EAAE,SAAS,EACpB,gBAAgB,EAAE,gBAAgB,EACjD;IAEJ;;;OAGG;IACI,iBAAiB,CAAC,SAAS,EAAE,EAAE,+BAErC;IAED;;;;;;OAMG;IACU,oBAAoB,CAAC,WAAW,EAAE,cAAc,EAAE,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,EAAE,GAAG,OAAO,CAAC,EAAE,EAAE,CAAC,CAMjH;IAED;;;;;;;;OAQG;IACU,gCAAgC,CAC3C,WAAW,EAAE,cAAc,EAC3B,SAAS,EAAE,EAAE,GACZ,OAAO,CAAC,0BAA0B,GAAG,SAAS,CAAC,CAMjD;IAED;;;;OAIG;IACU,oBAAoB,CAAC,WAAW,EAAE,cAAc,EAAE,QAAQ,EAAE,EAAE,GAAG,OAAO,CAAC,iBAAiB,GAAG,SAAS,CAAC,CAMnH;IAED;;;;;;OAMG;IACI,0BAA0B,CAC/B,eAAe,EAAE,YAAY,EAC7B,WAAW,EAAE,EAAE,EACf,MAAM,EAAE,EAAE,GACT,OAAO,CAAC,CAAC,MAAM,EAAE,WAAW,CAAC,OAAO,wBAAwB,CAAC,CAAC,CAAC,CAEjE;CAyBF"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { getNonNullifiedL1ToL2MessageWitness } from '@aztec/stdlib/messaging';
|
|
2
|
+
import { MerkleTreeId } from '@aztec/stdlib/trees';
|
|
3
|
+
export class TreeMembershipService {
|
|
4
|
+
aztecNode;
|
|
5
|
+
anchorBlockStore;
|
|
6
|
+
constructor(aztecNode, anchorBlockStore){
|
|
7
|
+
this.aztecNode = aztecNode;
|
|
8
|
+
this.anchorBlockStore = anchorBlockStore;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Gets the index of a nullifier in the nullifier tree.
|
|
12
|
+
* @returns - The index of the nullifier. Undefined if it does not exist in the tree.
|
|
13
|
+
*/ getNullifierIndex(nullifier) {
|
|
14
|
+
return this.#findLeafIndex('latest', MerkleTreeId.NULLIFIER_TREE, nullifier);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Fetches the index and sibling path of a leaf at a given block from a given tree.
|
|
18
|
+
* @param blockNumber - The block number at which to get the membership witness.
|
|
19
|
+
* @param treeId - Id of the tree to get the sibling path from.
|
|
20
|
+
* @param leafValue - The leaf value
|
|
21
|
+
* @returns The index and sibling path concatenated [index, sibling_path]
|
|
22
|
+
*/ async getMembershipWitness(blockNumber, treeId, leafValue) {
|
|
23
|
+
const witness = await this.#tryGetMembershipWitness(blockNumber, treeId, leafValue);
|
|
24
|
+
if (!witness) {
|
|
25
|
+
throw new Error(`Leaf value ${leafValue} not found in tree ${MerkleTreeId[treeId]} at block ${blockNumber}`);
|
|
26
|
+
}
|
|
27
|
+
return witness;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Returns a low nullifier membership witness for a given nullifier at a given block.
|
|
31
|
+
* @param blockNumber - The block number at which to get the index.
|
|
32
|
+
* @param nullifier - Nullifier we try to find the low nullifier witness for.
|
|
33
|
+
* @returns The low nullifier membership witness (if found).
|
|
34
|
+
* @remarks Low nullifier witness can be used to perform a nullifier non-inclusion proof by leveraging the "linked
|
|
35
|
+
* list structure" of leaves and proving that a lower nullifier is pointing to a bigger next value than the nullifier
|
|
36
|
+
* we are trying to prove non-inclusion for.
|
|
37
|
+
*/ async getLowNullifierMembershipWitness(blockNumber, nullifier) {
|
|
38
|
+
const anchorBlockNumber = (await this.anchorBlockStore.getBlockHeader()).getBlockNumber();
|
|
39
|
+
if (blockNumber !== 'latest' && blockNumber > anchorBlockNumber) {
|
|
40
|
+
throw new Error(`Block number ${blockNumber} is higher than current block ${anchorBlockNumber}`);
|
|
41
|
+
}
|
|
42
|
+
return this.aztecNode.getLowNullifierMembershipWitness(blockNumber, nullifier);
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Returns a witness for a given slot of the public data tree at a given block.
|
|
46
|
+
* @param blockNumber - The block number at which to get the witness.
|
|
47
|
+
* @param leafSlot - The slot of the public data in the public data tree.
|
|
48
|
+
*/ async getPublicDataWitness(blockNumber, leafSlot) {
|
|
49
|
+
const anchorBlockNumber = (await this.anchorBlockStore.getBlockHeader()).getBlockNumber();
|
|
50
|
+
if (blockNumber !== 'latest' && blockNumber > anchorBlockNumber) {
|
|
51
|
+
throw new Error(`Block number ${blockNumber} is higher than current block ${anchorBlockNumber}`);
|
|
52
|
+
}
|
|
53
|
+
return await this.aztecNode.getPublicDataWitness(blockNumber, leafSlot);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Looks for the L1 to L2 membership witness of a message at the Aztec node, given its hash.
|
|
57
|
+
* @param contractAddress - Address of a contract by which the message was emitted.
|
|
58
|
+
* @dev Contract address and secret are only used to compute the nullifier to get non-nullified messages.
|
|
59
|
+
* The message nullifier is computed locally, so the secret is not sent to the node.
|
|
60
|
+
* @returns The l1 to l2 membership witness (index of message in the tree and sibling path).
|
|
61
|
+
*/ getL1ToL2MembershipWitness(contractAddress, messageHash, secret) {
|
|
62
|
+
return getNonNullifiedL1ToL2MessageWitness(this.aztecNode, contractAddress, messageHash, secret);
|
|
63
|
+
}
|
|
64
|
+
async #tryGetMembershipWitness(blockNumber, treeId, value) {
|
|
65
|
+
switch(treeId){
|
|
66
|
+
case MerkleTreeId.NULLIFIER_TREE:
|
|
67
|
+
return (await this.aztecNode.getNullifierMembershipWitness(blockNumber, value))?.withoutPreimage().toFields();
|
|
68
|
+
case MerkleTreeId.NOTE_HASH_TREE:
|
|
69
|
+
return (await this.aztecNode.getNoteHashMembershipWitness(blockNumber, value))?.toFields();
|
|
70
|
+
case MerkleTreeId.PUBLIC_DATA_TREE:
|
|
71
|
+
return (await this.aztecNode.getPublicDataWitness(blockNumber, value))?.withoutPreimage().toFields();
|
|
72
|
+
case MerkleTreeId.ARCHIVE:
|
|
73
|
+
return (await this.aztecNode.getArchiveMembershipWitness(blockNumber, value))?.toFields();
|
|
74
|
+
default:
|
|
75
|
+
throw new Error('Not implemented');
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
async #findLeafIndex(blockNumber, treeId, leafValue) {
|
|
79
|
+
const [leafIndex] = await this.aztecNode.findLeavesIndexes(blockNumber, treeId, [
|
|
80
|
+
leafValue
|
|
81
|
+
]);
|
|
82
|
+
return leafIndex?.data;
|
|
83
|
+
}
|
|
84
|
+
}
|
package/package.json
CHANGED
|
@@ -1,22 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/pxe",
|
|
3
|
-
"version": "4.0.0-nightly.
|
|
3
|
+
"version": "4.0.0-nightly.20260107",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./server": "./dest/entrypoints/server/index.js",
|
|
7
7
|
"./client/lazy": "./dest/entrypoints/client/lazy/index.js",
|
|
8
8
|
"./client/bundle": "./dest/entrypoints/client/bundle/index.js",
|
|
9
9
|
"./simulator": "./dest/contract_function_simulator/index.js",
|
|
10
|
-
"./config": "./dest/config/index.js"
|
|
11
|
-
"./testing": "./dest/test/pxe_test_suite.js"
|
|
10
|
+
"./config": "./dest/config/index.js"
|
|
12
11
|
},
|
|
13
12
|
"bin": "./dest/bin/index.js",
|
|
14
13
|
"scripts": {
|
|
15
|
-
"build": "yarn clean && yarn generate &&
|
|
16
|
-
"build:dev": "tsc
|
|
14
|
+
"build": "yarn clean && yarn generate && tsgo -b",
|
|
15
|
+
"build:dev": "../scripts/tsc.sh --watch",
|
|
17
16
|
"clean": "rm -rf ./dest .tsbuildinfo ./src/config/package_info.ts",
|
|
18
17
|
"test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}",
|
|
19
|
-
"start": "LOG_LEVEL=${LOG_LEVEL:-debug} && node ./dest/bin/index.js",
|
|
20
18
|
"generate": "node ./scripts/generate_package_info.js",
|
|
21
19
|
"check_oracle_version": "node ./dest/bin/check_oracle_version.js"
|
|
22
20
|
},
|
|
@@ -63,35 +61,35 @@
|
|
|
63
61
|
]
|
|
64
62
|
},
|
|
65
63
|
"dependencies": {
|
|
66
|
-
"@aztec/bb-prover": "4.0.0-nightly.
|
|
67
|
-
"@aztec/bb.js": "4.0.0-nightly.
|
|
68
|
-
"@aztec/builder": "4.0.0-nightly.
|
|
69
|
-
"@aztec/constants": "4.0.0-nightly.
|
|
70
|
-
"@aztec/ethereum": "4.0.0-nightly.
|
|
71
|
-
"@aztec/foundation": "4.0.0-nightly.
|
|
72
|
-
"@aztec/key-store": "4.0.0-nightly.
|
|
73
|
-
"@aztec/kv-store": "4.0.0-nightly.
|
|
74
|
-
"@aztec/noir-protocol-circuits-types": "4.0.0-nightly.
|
|
75
|
-
"@aztec/noir-types": "4.0.0-nightly.
|
|
76
|
-
"@aztec/protocol-contracts": "4.0.0-nightly.
|
|
77
|
-
"@aztec/simulator": "4.0.0-nightly.
|
|
78
|
-
"@aztec/stdlib": "4.0.0-nightly.
|
|
79
|
-
"json-stringify-deterministic": "1.0.12",
|
|
64
|
+
"@aztec/bb-prover": "4.0.0-nightly.20260107",
|
|
65
|
+
"@aztec/bb.js": "4.0.0-nightly.20260107",
|
|
66
|
+
"@aztec/builder": "4.0.0-nightly.20260107",
|
|
67
|
+
"@aztec/constants": "4.0.0-nightly.20260107",
|
|
68
|
+
"@aztec/ethereum": "4.0.0-nightly.20260107",
|
|
69
|
+
"@aztec/foundation": "4.0.0-nightly.20260107",
|
|
70
|
+
"@aztec/key-store": "4.0.0-nightly.20260107",
|
|
71
|
+
"@aztec/kv-store": "4.0.0-nightly.20260107",
|
|
72
|
+
"@aztec/noir-protocol-circuits-types": "4.0.0-nightly.20260107",
|
|
73
|
+
"@aztec/noir-types": "4.0.0-nightly.20260107",
|
|
74
|
+
"@aztec/protocol-contracts": "4.0.0-nightly.20260107",
|
|
75
|
+
"@aztec/simulator": "4.0.0-nightly.20260107",
|
|
76
|
+
"@aztec/stdlib": "4.0.0-nightly.20260107",
|
|
80
77
|
"koa": "^2.16.1",
|
|
81
|
-
"koa-router": "^
|
|
78
|
+
"koa-router": "^13.1.1",
|
|
82
79
|
"lodash.omit": "^4.5.0",
|
|
83
80
|
"sha3": "^2.1.4",
|
|
84
81
|
"tslib": "^2.4.0",
|
|
85
|
-
"viem": "2.
|
|
82
|
+
"viem": "npm:@aztec/viem@2.38.2"
|
|
86
83
|
},
|
|
87
84
|
"devDependencies": {
|
|
88
|
-
"@aztec/merkle-tree": "4.0.0-nightly.
|
|
89
|
-
"@aztec/noir-test-contracts.js": "4.0.0-nightly.
|
|
85
|
+
"@aztec/merkle-tree": "4.0.0-nightly.20260107",
|
|
86
|
+
"@aztec/noir-test-contracts.js": "4.0.0-nightly.20260107",
|
|
90
87
|
"@jest/globals": "^30.0.0",
|
|
91
88
|
"@types/jest": "^30.0.0",
|
|
92
89
|
"@types/lodash.omit": "^4.5.7",
|
|
93
90
|
"@types/lodash.times": "^4.3.9",
|
|
94
91
|
"@types/node": "^22.15.17",
|
|
92
|
+
"@typescript/native-preview": "7.0.0-dev.20251126.1",
|
|
95
93
|
"jest": "^30.0.0",
|
|
96
94
|
"jest-mock-extended": "^4.0.0",
|
|
97
95
|
"lodash.times": "^4.3.2",
|
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
import { keccak256String } from '@aztec/foundation/crypto';
|
|
1
|
+
import { keccak256String } from '@aztec/foundation/crypto/keccak';
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import { readFileSync } from 'fs';
|
|
4
|
+
import { dirname, join } from 'path';
|
|
5
|
+
import ts from 'typescript';
|
|
6
|
+
import { fileURLToPath } from 'url';
|
|
4
7
|
|
|
5
|
-
import { Oracle } from '../contract_function_simulator/oracle/oracle.js';
|
|
6
|
-
import { TypedOracle } from '../contract_function_simulator/oracle/typed_oracle.js';
|
|
7
8
|
import { ORACLE_INTERFACE_HASH } from '../oracle_version.js';
|
|
8
9
|
|
|
9
|
-
// Create a minimal mock implementation of TypedOracle to instantiate the Oracle class for interface verification.
|
|
10
|
-
class OracleMock extends TypedOracle {}
|
|
11
|
-
|
|
12
10
|
/**
|
|
13
11
|
* Verifies that the Oracle interface matches the expected interface hash.
|
|
14
12
|
*
|
|
@@ -22,15 +20,141 @@ class OracleMock extends TypedOracle {}
|
|
|
22
20
|
* oracle interface like we do in PXE (i.e., there is no single Oracle class that contains only the oracles).
|
|
23
21
|
*/
|
|
24
22
|
function assertOracleInterfaceMatches(): void {
|
|
25
|
-
const
|
|
23
|
+
const oracleInterfaceSignature = getOracleInterfaceSignature();
|
|
24
|
+
|
|
26
25
|
// We use keccak256 here just because we already have it in the dependencies.
|
|
27
|
-
const oracleInterfaceHash = keccak256String(
|
|
26
|
+
const oracleInterfaceHash = keccak256String(oracleInterfaceSignature);
|
|
28
27
|
if (oracleInterfaceHash !== ORACLE_INTERFACE_HASH) {
|
|
29
28
|
// This check exists only to notify you when you need to update the ORACLE_VERSION constant.
|
|
30
29
|
throw new Error(
|
|
31
|
-
`The
|
|
30
|
+
`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
31
|
);
|
|
33
32
|
}
|
|
34
33
|
}
|
|
35
34
|
|
|
35
|
+
/**
|
|
36
|
+
* Constructs a signature of the Oracle interface while ignoring methods that are not foreign call handlers.
|
|
37
|
+
*/
|
|
38
|
+
function getOracleInterfaceSignature(): string {
|
|
39
|
+
const excludedProps = [
|
|
40
|
+
'handler',
|
|
41
|
+
'constructor',
|
|
42
|
+
'toACIRCallback',
|
|
43
|
+
'handlerAsMisc',
|
|
44
|
+
'handlerAsUtility',
|
|
45
|
+
'handlerAsPrivate',
|
|
46
|
+
] as const;
|
|
47
|
+
|
|
48
|
+
// Get the path to Oracle.ts source file
|
|
49
|
+
// The script runs from dest/bin/ after compilation, so we need to go up to the package root
|
|
50
|
+
// then into src/ to find the source file
|
|
51
|
+
const currentDir = dirname(fileURLToPath(import.meta.url));
|
|
52
|
+
// Go up from dest/bin/ or src/bin/ to the package root (pxe/), then into src/
|
|
53
|
+
const packageRoot = dirname(dirname(currentDir)); // Go up from bin/ to pxe/
|
|
54
|
+
const oracleSourcePath = join(packageRoot, 'src/contract_function_simulator/oracle/oracle.ts');
|
|
55
|
+
|
|
56
|
+
// Read and parse the TypeScript source file
|
|
57
|
+
const sourceCode = readFileSync(oracleSourcePath, 'utf-8');
|
|
58
|
+
const sourceFile = ts.createSourceFile('oracle.ts', sourceCode, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS);
|
|
59
|
+
|
|
60
|
+
// Extract method signatures from the Oracle class
|
|
61
|
+
const methodSignatures: string[] = [];
|
|
62
|
+
|
|
63
|
+
function visit(node: ts.Node) {
|
|
64
|
+
// Look for class declaration named "Oracle"
|
|
65
|
+
if (ts.isClassDeclaration(node) && node.name?.text === 'Oracle') {
|
|
66
|
+
// Visit all members of the class
|
|
67
|
+
node.members.forEach(member => {
|
|
68
|
+
if (ts.isMethodDeclaration(member) && member.name && ts.isIdentifier(member.name)) {
|
|
69
|
+
const methodName = member.name.text;
|
|
70
|
+
|
|
71
|
+
// Skip excluded methods
|
|
72
|
+
if (excludedProps.includes(methodName as (typeof excludedProps)[number])) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// Extract parameter signatures
|
|
77
|
+
const paramSignatures: string[] = [];
|
|
78
|
+
member.parameters.forEach(param => {
|
|
79
|
+
const paramName = extractParameterName(param, sourceFile);
|
|
80
|
+
const paramType = extractTypeString(param.type, sourceFile);
|
|
81
|
+
paramSignatures.push(`${paramName}: ${paramType}`);
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
// Extract return type
|
|
85
|
+
const returnType = extractTypeString(member.type, sourceFile);
|
|
86
|
+
|
|
87
|
+
// Build full signature: methodName(param1: Type1, param2: Type2): ReturnType
|
|
88
|
+
const signature = `${methodName}(${paramSignatures.join(', ')}): ${returnType}`;
|
|
89
|
+
methodSignatures.push(signature);
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
ts.forEachChild(node, visit);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
visit(sourceFile);
|
|
98
|
+
|
|
99
|
+
// Sort signatures alphabetically for consistent hashing
|
|
100
|
+
methodSignatures.sort();
|
|
101
|
+
|
|
102
|
+
// Create a hashable representation by concatenating all signatures
|
|
103
|
+
return methodSignatures.join('');
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Extracts the parameter name from a parameter node, handling destructured parameters.
|
|
108
|
+
*/
|
|
109
|
+
function extractParameterName(param: ts.ParameterDeclaration, sourceFile: ts.SourceFile): string {
|
|
110
|
+
const name = param.name;
|
|
111
|
+
|
|
112
|
+
if (ts.isIdentifier(name)) {
|
|
113
|
+
return name.text;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
if (ts.isArrayBindingPattern(name)) {
|
|
117
|
+
// Handle destructured parameters like [blockNumber]: ACVMField[]
|
|
118
|
+
// Extract the first element name
|
|
119
|
+
if (name.elements.length > 0) {
|
|
120
|
+
const element = name.elements[0];
|
|
121
|
+
if (ts.isBindingElement(element)) {
|
|
122
|
+
const elementName = element.name;
|
|
123
|
+
if (ts.isIdentifier(elementName)) {
|
|
124
|
+
return elementName.text;
|
|
125
|
+
}
|
|
126
|
+
// Nested destructuring - use text representation
|
|
127
|
+
if (ts.isArrayBindingPattern(elementName) || ts.isObjectBindingPattern(elementName)) {
|
|
128
|
+
return elementName.getText(sourceFile);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
// Fallback: return the text representation
|
|
133
|
+
return name.getText(sourceFile);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
if (ts.isObjectBindingPattern(name)) {
|
|
137
|
+
// Handle object destructuring
|
|
138
|
+
return name.getText(sourceFile);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
// Fallback for any other case - this should never happen but TypeScript needs it
|
|
142
|
+
return (name as ts.Node).getText(sourceFile);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Extracts the type string from a type node, normalizing whitespace.
|
|
147
|
+
*/
|
|
148
|
+
function extractTypeString(typeNode: ts.TypeNode | undefined, sourceFile: ts.SourceFile): string {
|
|
149
|
+
if (!typeNode) {
|
|
150
|
+
return 'void';
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// Get the type text and normalize whitespace
|
|
154
|
+
let typeText = typeNode.getText(sourceFile);
|
|
155
|
+
// Normalize whitespace: remove extra spaces, newlines, and tabs
|
|
156
|
+
typeText = typeText.replace(/\s+/g, ' ').trim();
|
|
157
|
+
return typeText;
|
|
158
|
+
}
|
|
159
|
+
|
|
36
160
|
assertOracleInterfaceMatches();
|