@aztec/pxe 0.0.1-commit.fce3e4f → 0.0.1-commit.ff7989d6c
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/dest/access_scopes.d.ts +9 -0
- package/dest/access_scopes.d.ts.map +1 -0
- package/dest/access_scopes.js +6 -0
- package/dest/bin/check_oracle_version.js +105 -15
- package/dest/block_synchronizer/block_synchronizer.d.ts +45 -0
- package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -0
- package/dest/block_synchronizer/block_synchronizer.js +153 -0
- package/dest/block_synchronizer/index.d.ts +2 -0
- package/dest/block_synchronizer/index.d.ts.map +1 -0
- package/dest/block_synchronizer/index.js +1 -0
- package/dest/config/index.d.ts +6 -4
- package/dest/config/index.d.ts.map +1 -1
- package/dest/config/index.js +17 -0
- 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 +76 -24
- package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.js +218 -73
- package/dest/contract_function_simulator/execution_note_cache.d.ts +21 -11
- package/dest/contract_function_simulator/execution_note_cache.d.ts.map +1 -1
- package/dest/contract_function_simulator/execution_note_cache.js +49 -31
- package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts +1 -1
- package/dest/contract_function_simulator/execution_tagging_index_cache.js +1 -1
- 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 +2 -2
- package/dest/contract_function_simulator/index.d.ts.map +1 -1
- package/dest/contract_function_simulator/index.js +1 -1
- package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts +5 -4
- package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/event_validation_request.js +7 -4
- package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts +5 -4
- package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/log_retrieval_request.js +7 -6
- package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts +2 -2
- 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 +1 -1
- package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +6 -5
- 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 +7 -4
- package/dest/contract_function_simulator/noir-structs/utility_context.d.ts +4 -10
- package/dest/contract_function_simulator/noir-structs/utility_context.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/utility_context.js +7 -18
- package/dest/contract_function_simulator/oracle/interfaces.d.ts +27 -20
- package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts +4 -2
- package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.js +1 -1
- package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts +11 -7
- package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/note_packing_utils.js +14 -10
- package/dest/contract_function_simulator/oracle/oracle.d.ts +13 -11
- package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/oracle.js +86 -51
- package/dest/contract_function_simulator/oracle/private_execution.d.ts +2 -27
- package/dest/contract_function_simulator/oracle/private_execution.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution.js +2 -38
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +54 -45
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.js +105 -62
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +114 -38
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +214 -86
- package/dest/contract_function_simulator/pick_notes.d.ts +2 -2
- package/dest/contract_function_simulator/pick_notes.d.ts.map +1 -1
- package/dest/contract_function_simulator/pick_notes.js +1 -1
- package/dest/contract_function_simulator/proxied_contract_data_source.d.ts +4 -4
- package/dest/contract_function_simulator/proxied_contract_data_source.d.ts.map +1 -1
- package/dest/contract_function_simulator/proxied_contract_data_source.js +23 -5
- package/dest/contract_logging.d.ts +22 -0
- package/dest/contract_logging.d.ts.map +1 -0
- package/dest/contract_logging.js +23 -0
- package/dest/contract_sync/contract_sync_service.d.ts +43 -0
- package/dest/contract_sync/contract_sync_service.d.ts.map +1 -0
- package/dest/contract_sync/contract_sync_service.js +97 -0
- package/dest/contract_sync/helpers.d.ts +29 -0
- package/dest/contract_sync/helpers.d.ts.map +1 -0
- package/dest/contract_sync/helpers.js +55 -0
- package/dest/debug/pxe_debug_utils.d.ts +45 -0
- package/dest/debug/pxe_debug_utils.d.ts.map +1 -0
- package/dest/debug/pxe_debug_utils.js +48 -0
- package/dest/entrypoints/client/bundle/index.d.ts +4 -2
- package/dest/entrypoints/client/bundle/index.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/index.js +3 -1
- package/dest/entrypoints/client/bundle/utils.d.ts +1 -1
- package/dest/entrypoints/client/bundle/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/utils.js +32 -9
- package/dest/entrypoints/client/lazy/index.d.ts +4 -2
- package/dest/entrypoints/client/lazy/index.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/index.js +3 -1
- package/dest/entrypoints/client/lazy/utils.d.ts +2 -2
- package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/utils.js +33 -10
- package/dest/entrypoints/pxe_creation_options.d.ts +7 -3
- package/dest/entrypoints/pxe_creation_options.d.ts.map +1 -1
- package/dest/entrypoints/server/index.d.ts +6 -2
- package/dest/entrypoints/server/index.d.ts.map +1 -1
- package/dest/entrypoints/server/index.js +5 -1
- package/dest/entrypoints/server/utils.d.ts +1 -1
- package/dest/entrypoints/server/utils.d.ts.map +1 -1
- package/dest/entrypoints/server/utils.js +39 -16
- package/dest/error_enriching.d.ts +4 -4
- package/dest/error_enriching.d.ts.map +1 -1
- package/dest/error_enriching.js +6 -6
- package/dest/events/event_service.d.ts +15 -0
- package/dest/events/event_service.d.ts.map +1 -0
- package/dest/events/event_service.js +44 -0
- package/dest/events/index.d.ts +2 -0
- package/dest/events/index.d.ts.map +1 -0
- package/dest/events/index.js +1 -0
- package/dest/events/private_event_filter_validator.d.ts +9 -0
- package/dest/events/private_event_filter_validator.d.ts.map +1 -0
- package/dest/events/private_event_filter_validator.js +38 -0
- package/dest/job_coordinator/job_coordinator.d.ts +75 -0
- package/dest/job_coordinator/job_coordinator.d.ts.map +1 -0
- package/dest/job_coordinator/job_coordinator.js +94 -0
- package/dest/logs/log_service.d.ts +29 -0
- package/dest/logs/log_service.d.ts.map +1 -0
- package/dest/logs/log_service.js +118 -0
- package/dest/notes/index.d.ts +2 -0
- package/dest/notes/index.d.ts.map +1 -0
- package/dest/notes/index.js +1 -0
- package/dest/notes/note_service.d.ts +49 -0
- package/dest/notes/note_service.d.ts.map +1 -0
- package/dest/notes/note_service.js +148 -0
- package/dest/notes_filter.d.ts +25 -0
- package/dest/notes_filter.d.ts.map +1 -0
- package/dest/notes_filter.js +4 -0
- package/dest/oracle_version.d.ts +3 -3
- package/dest/oracle_version.d.ts.map +1 -1
- package/dest/oracle_version.js +4 -3
- package/dest/private_kernel/hints/compute_tx_expiration_timestamp.d.ts +4 -0
- package/dest/private_kernel/hints/compute_tx_expiration_timestamp.d.ts.map +1 -0
- package/dest/private_kernel/hints/{compute_tx_include_by_timestamp.js → compute_tx_expiration_timestamp.js} +12 -12
- package/dest/private_kernel/hints/index.d.ts +3 -3
- package/dest/private_kernel/hints/index.d.ts.map +1 -1
- package/dest/private_kernel/hints/index.js +2 -2
- package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts +28 -0
- package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts.map +1 -0
- package/dest/private_kernel/hints/{build_private_kernel_reset_private_inputs.js → private_kernel_reset_private_inputs_builder.js} +16 -10
- package/dest/private_kernel/private_kernel_execution_prover.d.ts +3 -2
- package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_execution_prover.js +16 -17
- package/dest/private_kernel/private_kernel_oracle.d.ts +26 -25
- package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_oracle.js +94 -2
- package/dest/pxe.d.ts +112 -102
- package/dest/pxe.d.ts.map +1 -1
- package/dest/pxe.js +255 -252
- 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 -12
- package/dest/storage/address_store/index.d.ts +2 -0
- package/dest/storage/address_store/index.d.ts.map +1 -0
- package/dest/storage/address_store/index.js +1 -0
- package/dest/storage/anchor_block_store/anchor_block_store.d.ts +17 -0
- package/dest/storage/anchor_block_store/anchor_block_store.d.ts.map +1 -0
- package/dest/storage/{sync_data_provider/sync_data_provider.js → anchor_block_store/anchor_block_store.js} +10 -10
- package/dest/storage/{sync_data_provider → anchor_block_store}/index.d.ts +2 -2
- package/dest/storage/anchor_block_store/index.d.ts.map +1 -0
- package/dest/storage/anchor_block_store/index.js +1 -0
- package/dest/storage/capsule_store/capsule_store.d.ts +72 -0
- package/dest/storage/capsule_store/capsule_store.d.ts.map +1 -0
- package/dest/storage/capsule_store/capsule_store.js +253 -0
- package/dest/storage/capsule_store/index.d.ts +2 -0
- package/dest/storage/capsule_store/index.d.ts.map +1 -0
- package/dest/storage/capsule_store/index.js +1 -0
- package/dest/storage/contract_store/contract_store.d.ts +93 -0
- package/dest/storage/contract_store/contract_store.d.ts.map +1 -0
- package/dest/storage/contract_store/contract_store.js +309 -0
- package/dest/storage/contract_store/index.d.ts +2 -0
- package/dest/storage/contract_store/index.d.ts.map +1 -0
- package/dest/storage/contract_store/index.js +1 -0
- package/dest/storage/{contract_data_provider → contract_store}/private_functions_tree.d.ts +1 -1
- package/dest/storage/contract_store/private_functions_tree.d.ts.map +1 -0
- package/dest/storage/{contract_data_provider → contract_store}/private_functions_tree.js +1 -1
- package/dest/storage/index.d.ts +8 -8
- package/dest/storage/index.d.ts.map +1 -1
- package/dest/storage/index.js +7 -7
- package/dest/storage/metadata.d.ts +1 -1
- package/dest/storage/metadata.js +1 -1
- package/dest/storage/note_store/index.d.ts +3 -0
- package/dest/storage/note_store/index.d.ts.map +1 -0
- package/dest/storage/note_store/index.js +2 -0
- package/dest/storage/note_store/note_store.d.ts +83 -0
- package/dest/storage/note_store/note_store.d.ts.map +1 -0
- package/dest/storage/note_store/note_store.js +343 -0
- package/dest/storage/note_store/stored_note.d.ts +16 -0
- package/dest/storage/note_store/stored_note.d.ts.map +1 -0
- package/dest/storage/note_store/stored_note.js +43 -0
- package/dest/storage/private_event_store/private_event_store.d.ts +91 -0
- package/dest/storage/private_event_store/private_event_store.d.ts.map +1 -0
- package/dest/storage/private_event_store/private_event_store.js +273 -0
- package/dest/storage/private_event_store/stored_private_event.d.ts +23 -0
- package/dest/storage/private_event_store/stored_private_event.d.ts.map +1 -0
- package/dest/storage/private_event_store/stored_private_event.js +56 -0
- package/dest/storage/tagging_store/index.d.ts +4 -0
- package/dest/storage/tagging_store/index.d.ts.map +1 -0
- package/dest/storage/tagging_store/index.js +3 -0
- package/dest/storage/tagging_store/recipient_tagging_store.d.ts +28 -0
- package/dest/storage/tagging_store/recipient_tagging_store.d.ts.map +1 -0
- package/dest/storage/tagging_store/recipient_tagging_store.js +111 -0
- package/dest/storage/tagging_store/sender_address_book_store.d.ts +14 -0
- package/dest/storage/tagging_store/sender_address_book_store.d.ts.map +1 -0
- package/dest/storage/tagging_store/sender_address_book_store.js +36 -0
- package/dest/storage/tagging_store/sender_tagging_store.d.ts +77 -0
- package/dest/storage/tagging_store/sender_tagging_store.d.ts.map +1 -0
- package/dest/storage/tagging_store/sender_tagging_store.js +348 -0
- package/dest/tagging/constants.d.ts +2 -2
- package/dest/tagging/constants.d.ts.map +1 -1
- package/dest/tagging/constants.js +10 -2
- package/dest/tagging/get_all_logs_by_tags.d.ts +24 -0
- package/dest/tagging/get_all_logs_by_tags.d.ts.map +1 -0
- package/dest/tagging/get_all_logs_by_tags.js +60 -0
- package/dest/tagging/index.d.ts +16 -6
- package/dest/tagging/index.d.ts.map +1 -1
- package/dest/tagging/index.js +15 -5
- 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 +28 -19
- package/src/access_scopes.ts +9 -0
- package/src/bin/check_oracle_version.ts +131 -20
- package/src/block_synchronizer/block_synchronizer.ts +178 -0
- package/src/block_synchronizer/index.ts +1 -0
- package/src/config/index.ts +17 -3
- 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 +380 -104
- package/src/contract_function_simulator/execution_note_cache.ts +51 -28
- package/src/contract_function_simulator/execution_tagging_index_cache.ts +1 -1
- package/src/contract_function_simulator/hashed_values_cache.ts +1 -1
- package/src/contract_function_simulator/index.ts +1 -1
- package/src/contract_function_simulator/noir-structs/event_validation_request.ts +7 -3
- package/src/contract_function_simulator/noir-structs/log_retrieval_request.ts +6 -5
- package/src/contract_function_simulator/noir-structs/log_retrieval_response.ts +1 -1
- package/src/contract_function_simulator/noir-structs/note_validation_request.ts +6 -3
- package/src/contract_function_simulator/noir-structs/utility_context.ts +6 -25
- package/src/contract_function_simulator/oracle/interfaces.ts +32 -17
- package/src/contract_function_simulator/oracle/message_load_oracle_inputs.ts +1 -1
- package/src/contract_function_simulator/oracle/note_packing_utils.ts +27 -13
- package/src/contract_function_simulator/oracle/oracle.ts +101 -47
- package/src/contract_function_simulator/oracle/private_execution.ts +2 -68
- package/src/contract_function_simulator/oracle/private_execution_oracle.ts +154 -97
- package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +350 -91
- package/src/contract_function_simulator/pick_notes.ts +1 -1
- package/src/contract_function_simulator/proxied_contract_data_source.ts +24 -7
- package/src/contract_logging.ts +39 -0
- package/src/contract_sync/contract_sync_service.ts +152 -0
- package/src/contract_sync/helpers.ts +98 -0
- package/src/debug/pxe_debug_utils.ts +93 -0
- package/src/entrypoints/client/bundle/index.ts +3 -1
- package/src/entrypoints/client/bundle/utils.ts +24 -17
- package/src/entrypoints/client/lazy/index.ts +3 -1
- package/src/entrypoints/client/lazy/utils.ts +25 -18
- package/src/entrypoints/pxe_creation_options.ts +6 -2
- package/src/entrypoints/server/index.ts +5 -1
- package/src/entrypoints/server/utils.ts +33 -41
- package/src/error_enriching.ts +7 -15
- package/src/events/event_service.ts +71 -0
- package/src/events/index.ts +1 -0
- package/src/events/private_event_filter_validator.ts +46 -0
- package/src/job_coordinator/job_coordinator.ts +150 -0
- package/src/logs/log_service.ts +208 -0
- package/src/notes/index.ts +1 -0
- package/src/notes/note_service.ts +196 -0
- package/src/notes_filter.ts +26 -0
- package/src/oracle_version.ts +4 -3
- package/src/private_kernel/hints/{compute_tx_include_by_timestamp.ts → compute_tx_expiration_timestamp.ts} +13 -13
- package/src/private_kernel/hints/index.ts +2 -2
- package/src/private_kernel/hints/{build_private_kernel_reset_private_inputs.ts → private_kernel_reset_private_inputs_builder.ts} +40 -29
- package/src/private_kernel/private_kernel_execution_prover.ts +20 -18
- package/src/private_kernel/private_kernel_oracle.ts +118 -37
- package/src/pxe.ts +395 -343
- package/src/storage/{address_data_provider/address_data_provider.ts → address_store/address_store.ts} +16 -16
- 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 -11
- package/src/storage/anchor_block_store/index.ts +1 -0
- package/src/storage/capsule_store/capsule_store.ts +315 -0
- package/src/storage/capsule_store/index.ts +1 -0
- package/src/storage/contract_store/contract_store.ts +429 -0
- package/src/storage/contract_store/index.ts +1 -0
- package/src/storage/{contract_data_provider → contract_store}/private_functions_tree.ts +1 -1
- package/src/storage/index.ts +7 -7
- package/src/storage/metadata.ts +1 -1
- package/src/storage/note_store/index.ts +2 -0
- package/src/storage/note_store/note_store.ts +418 -0
- package/src/storage/note_store/stored_note.ts +48 -0
- package/src/storage/private_event_store/private_event_store.ts +384 -0
- package/src/storage/private_event_store/stored_private_event.ts +73 -0
- package/src/storage/tagging_store/index.ts +3 -0
- package/src/storage/tagging_store/recipient_tagging_store.ts +139 -0
- package/src/storage/tagging_store/sender_address_book_store.ts +48 -0
- package/src/storage/tagging_store/sender_tagging_store.ts +429 -0
- package/src/tagging/constants.ts +10 -2
- package/src/tagging/get_all_logs_by_tags.ts +92 -0
- package/src/tagging/index.ts +18 -5
- 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/contract_function_simulator/execution_data_provider.d.ts +0 -265
- 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/proxied_node.d.ts +0 -9
- package/dest/contract_function_simulator/proxied_node.d.ts.map +0 -1
- package/dest/contract_function_simulator/proxied_node.js +0 -27
- package/dest/contract_function_simulator/pxe_oracle_interface.d.ts +0 -122
- package/dest/contract_function_simulator/pxe_oracle_interface.d.ts.map +0 -1
- package/dest/contract_function_simulator/pxe_oracle_interface.js +0 -694
- package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts +0 -28
- package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts.map +0 -1
- package/dest/private_kernel/hints/compute_tx_include_by_timestamp.d.ts +0 -4
- package/dest/private_kernel/hints/compute_tx_include_by_timestamp.d.ts.map +0 -1
- package/dest/private_kernel/private_kernel_oracle_impl.d.ts +0 -45
- package/dest/private_kernel/private_kernel_oracle_impl.d.ts.map +0 -1
- package/dest/private_kernel/private_kernel_oracle_impl.js +0 -86
- package/dest/storage/address_data_provider/address_data_provider.d.ts +0 -11
- 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 -25
- 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 -118
- 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 -64
- 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 -193
- 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/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_data_provider.d.ts +0 -83
- 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 -311
- 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 -105
- 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 -10
- 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 -40
- 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 -89
- package/dest/synchronizer/index.d.ts +0 -2
- package/dest/synchronizer/index.d.ts.map +0 -1
- package/dest/synchronizer/index.js +0 -1
- package/dest/synchronizer/synchronizer.d.ts +0 -35
- package/dest/synchronizer/synchronizer.d.ts.map +0 -1
- package/dest/synchronizer/synchronizer.js +0 -101
- package/dest/tagging/siloed_tag.d.ts +0 -14
- package/dest/tagging/siloed_tag.d.ts.map +0 -1
- package/dest/tagging/siloed_tag.js +0 -20
- package/dest/tagging/tag.d.ts +0 -12
- package/dest/tagging/tag.d.ts.map +0 -1
- package/dest/tagging/tag.js +0 -17
- package/dest/tagging/utils.d.ts +0 -18
- package/dest/tagging/utils.d.ts.map +0 -1
- package/dest/tagging/utils.js +0 -24
- package/src/contract_function_simulator/execution_data_provider.ts +0 -333
- package/src/contract_function_simulator/proxied_node.ts +0 -33
- package/src/contract_function_simulator/pxe_oracle_interface.ts +0 -1008
- package/src/private_kernel/private_kernel_oracle_impl.ts +0 -132
- package/src/storage/address_data_provider/index.ts +0 -1
- package/src/storage/capsule_data_provider/capsule_data_provider.ts +0 -147
- package/src/storage/capsule_data_provider/index.ts +0 -1
- package/src/storage/contract_data_provider/contract_data_provider.ts +0 -277
- package/src/storage/contract_data_provider/index.ts +0 -1
- package/src/storage/note_data_provider/index.ts +0 -2
- package/src/storage/note_data_provider/note_data_provider.ts +0 -399
- package/src/storage/private_event_data_provider/private_event_data_provider.ts +0 -143
- 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 -120
- package/src/synchronizer/index.ts +0 -1
- package/src/synchronizer/synchronizer.ts +0 -120
- package/src/tagging/siloed_tag.ts +0 -22
- package/src/tagging/tag.ts +0 -16
- package/src/tagging/utils.ts +0 -31
|
@@ -0,0 +1,429 @@
|
|
|
1
|
+
import type { FUNCTION_TREE_HEIGHT } from '@aztec/constants';
|
|
2
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
|
+
import { toArray } from '@aztec/foundation/iterable';
|
|
4
|
+
import { BufferReader, numToUInt8, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
5
|
+
import type { MembershipWitness } from '@aztec/foundation/trees';
|
|
6
|
+
import type { AztecAsyncKVStore, AztecAsyncMap } from '@aztec/kv-store';
|
|
7
|
+
import {
|
|
8
|
+
type ContractArtifact,
|
|
9
|
+
type FunctionAbi,
|
|
10
|
+
type FunctionArtifact,
|
|
11
|
+
type FunctionArtifactWithContractName,
|
|
12
|
+
FunctionCall,
|
|
13
|
+
type FunctionDebugMetadata,
|
|
14
|
+
FunctionSelector,
|
|
15
|
+
FunctionType,
|
|
16
|
+
contractArtifactFromBuffer,
|
|
17
|
+
contractArtifactToBuffer,
|
|
18
|
+
encodeArguments,
|
|
19
|
+
getFunctionDebugMetadata,
|
|
20
|
+
} from '@aztec/stdlib/abi';
|
|
21
|
+
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
22
|
+
import {
|
|
23
|
+
type ContractClassIdPreimage,
|
|
24
|
+
type ContractClassWithId,
|
|
25
|
+
type ContractInstanceWithAddress,
|
|
26
|
+
SerializableContractInstance,
|
|
27
|
+
getContractClassFromArtifact,
|
|
28
|
+
} from '@aztec/stdlib/contract';
|
|
29
|
+
|
|
30
|
+
import { PrivateFunctionsTree } from './private_functions_tree.js';
|
|
31
|
+
|
|
32
|
+
const VERSION = 1 as const;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* All contract class data except the large packedBytecode.
|
|
36
|
+
* The expensive data from the ContractClass is precomputed and stored in this format to avoid redundant hashing.
|
|
37
|
+
* Since we have to store the artifacts anyway, the final ContractClass is reconstructed by combining this data
|
|
38
|
+
* with the packedBytecode obtained from the former. That way we can have quick class lookups without wasted storage.
|
|
39
|
+
*/
|
|
40
|
+
export class SerializableContractClassData {
|
|
41
|
+
public readonly version = VERSION;
|
|
42
|
+
public readonly id: Fr;
|
|
43
|
+
public readonly artifactHash: Fr;
|
|
44
|
+
public readonly privateFunctionsRoot: Fr;
|
|
45
|
+
public readonly publicBytecodeCommitment: Fr;
|
|
46
|
+
public readonly privateFunctions: { selector: FunctionSelector; vkHash: Fr }[];
|
|
47
|
+
|
|
48
|
+
constructor(
|
|
49
|
+
data: ContractClassIdPreimage & {
|
|
50
|
+
id: Fr;
|
|
51
|
+
privateFunctions: { selector: FunctionSelector; vkHash: Fr }[];
|
|
52
|
+
},
|
|
53
|
+
) {
|
|
54
|
+
this.id = data.id;
|
|
55
|
+
this.artifactHash = data.artifactHash;
|
|
56
|
+
this.privateFunctionsRoot = data.privateFunctionsRoot;
|
|
57
|
+
this.publicBytecodeCommitment = data.publicBytecodeCommitment;
|
|
58
|
+
this.privateFunctions = data.privateFunctions;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
toBuffer(): Buffer {
|
|
62
|
+
return serializeToBuffer(
|
|
63
|
+
numToUInt8(this.version),
|
|
64
|
+
this.id,
|
|
65
|
+
this.artifactHash,
|
|
66
|
+
this.privateFunctionsRoot,
|
|
67
|
+
this.publicBytecodeCommitment,
|
|
68
|
+
this.privateFunctions.length,
|
|
69
|
+
...this.privateFunctions.map(fn => serializeToBuffer(fn.selector, fn.vkHash)),
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
static fromBuffer(bufferOrReader: Buffer | BufferReader): SerializableContractClassData {
|
|
74
|
+
const reader = BufferReader.asReader(bufferOrReader);
|
|
75
|
+
const version = reader.readUInt8();
|
|
76
|
+
if (version !== VERSION) {
|
|
77
|
+
throw new Error(`Unexpected contract class data version ${version}`);
|
|
78
|
+
}
|
|
79
|
+
return new SerializableContractClassData({
|
|
80
|
+
id: reader.readObject(Fr),
|
|
81
|
+
artifactHash: reader.readObject(Fr),
|
|
82
|
+
privateFunctionsRoot: reader.readObject(Fr),
|
|
83
|
+
publicBytecodeCommitment: reader.readObject(Fr),
|
|
84
|
+
privateFunctions: reader.readVector({
|
|
85
|
+
fromBuffer: (r: BufferReader) => ({
|
|
86
|
+
selector: r.readObject(FunctionSelector),
|
|
87
|
+
vkHash: r.readObject(Fr),
|
|
88
|
+
}),
|
|
89
|
+
}),
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* ContractStore serves as a data manager and retriever for Aztec.nr contracts.
|
|
96
|
+
* It provides methods to obtain contract addresses, function ABI, bytecode, and membership witnesses
|
|
97
|
+
* from a given contract address and function selector. The class maintains a cache of ContractTree instances
|
|
98
|
+
* to efficiently serve the requested data. It interacts with the ContractDatabase and AztecNode to fetch
|
|
99
|
+
* the required information and facilitate cryptographic proof generation.
|
|
100
|
+
*/
|
|
101
|
+
export class ContractStore {
|
|
102
|
+
/** Map from contract class id to private function tree. */
|
|
103
|
+
// TODO: Update it to be LRU cache so that it doesn't keep all the data all the time.
|
|
104
|
+
#privateFunctionTrees: Map<string, PrivateFunctionsTree> = new Map();
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* In-memory cache of deserialized ContractArtifact objects, keyed by class id string.
|
|
108
|
+
* Avoids repeated LMDB reads + JSON.parse + Zod validation on every oracle call.
|
|
109
|
+
* Artifacts are large but immutable after registration — safe to cache for the lifetime of the store.
|
|
110
|
+
*/
|
|
111
|
+
// TODO: Update it to be LRU cache so that it doesn't keep all the data all the time.
|
|
112
|
+
#contractArtifactCache: Map<string, ContractArtifact> = new Map();
|
|
113
|
+
|
|
114
|
+
/** Map from contract address to contract class id (avoids KV round-trip on hot path). */
|
|
115
|
+
#contractClassIdMap: Map<string, Fr> = new Map();
|
|
116
|
+
|
|
117
|
+
#store: AztecAsyncKVStore;
|
|
118
|
+
#contractArtifacts: AztecAsyncMap<string, Buffer>;
|
|
119
|
+
#contractClassData: AztecAsyncMap<string, Buffer>;
|
|
120
|
+
#contractInstances: AztecAsyncMap<string, Buffer>;
|
|
121
|
+
|
|
122
|
+
constructor(store: AztecAsyncKVStore) {
|
|
123
|
+
this.#store = store;
|
|
124
|
+
this.#contractArtifacts = store.openMap('contract_artifacts');
|
|
125
|
+
this.#contractClassData = store.openMap('contract_classes');
|
|
126
|
+
this.#contractInstances = store.openMap('contracts_instances');
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// Setters
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Registers a new contract artifact and its corresponding class data.
|
|
133
|
+
* IMPORTANT: This method does not verify that the provided artifact matches the class data or that the class id matches the artifact.
|
|
134
|
+
* It is the caller's responsibility to ensure the consistency and correctness of the provided data.
|
|
135
|
+
* This is done to avoid redundant, expensive contract class computations
|
|
136
|
+
*/
|
|
137
|
+
public async addContractArtifact(
|
|
138
|
+
contract: ContractArtifact,
|
|
139
|
+
contractClassWithIdAndPreimage?: ContractClassWithId & ContractClassIdPreimage,
|
|
140
|
+
): Promise<Fr> {
|
|
141
|
+
const contractClass = contractClassWithIdAndPreimage ?? (await getContractClassFromArtifact(contract));
|
|
142
|
+
const key = contractClass.id.toString();
|
|
143
|
+
|
|
144
|
+
if (this.#contractArtifactCache.has(key)) {
|
|
145
|
+
return contractClass.id;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
const privateFunctions = contract.functions.filter(
|
|
149
|
+
functionArtifact => functionArtifact.functionType === FunctionType.PRIVATE,
|
|
150
|
+
);
|
|
151
|
+
const privateSelectors = await Promise.all(
|
|
152
|
+
privateFunctions.map(async fn =>
|
|
153
|
+
(await FunctionSelector.fromNameAndParameters(fn.name, fn.parameters)).toString(),
|
|
154
|
+
),
|
|
155
|
+
);
|
|
156
|
+
if (privateSelectors.length !== new Set(privateSelectors).size) {
|
|
157
|
+
throw new Error('Repeated function selectors of private functions');
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
this.#contractArtifactCache.set(key, contract);
|
|
161
|
+
|
|
162
|
+
await this.#store.transactionAsync(async () => {
|
|
163
|
+
await this.#contractArtifacts.set(key, contractArtifactToBuffer(contract));
|
|
164
|
+
await this.#contractClassData.set(key, new SerializableContractClassData(contractClass).toBuffer());
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
return contractClass.id;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
async addContractInstance(contract: ContractInstanceWithAddress): Promise<void> {
|
|
171
|
+
this.#contractClassIdMap.set(contract.address.toString(), contract.currentContractClassId);
|
|
172
|
+
|
|
173
|
+
await this.#contractInstances.set(
|
|
174
|
+
contract.address.toString(),
|
|
175
|
+
new SerializableContractInstance(contract).toBuffer(),
|
|
176
|
+
);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
// Private getters
|
|
180
|
+
|
|
181
|
+
async #getContractClassId(contractAddress: AztecAddress): Promise<Fr | undefined> {
|
|
182
|
+
const key = contractAddress.toString();
|
|
183
|
+
if (!this.#contractClassIdMap.has(key)) {
|
|
184
|
+
const instance = await this.getContractInstance(contractAddress);
|
|
185
|
+
if (!instance) {
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
this.#contractClassIdMap.set(key, instance.currentContractClassId);
|
|
189
|
+
}
|
|
190
|
+
return this.#contractClassIdMap.get(key);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
async #getPrivateFunctionTreeForClassId(classId: Fr): Promise<PrivateFunctionsTree | undefined> {
|
|
194
|
+
if (!this.#privateFunctionTrees.has(classId.toString())) {
|
|
195
|
+
const artifact = await this.getContractArtifact(classId);
|
|
196
|
+
if (!artifact) {
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
const tree = await PrivateFunctionsTree.create(artifact);
|
|
200
|
+
this.#privateFunctionTrees.set(classId.toString(), tree);
|
|
201
|
+
}
|
|
202
|
+
return this.#privateFunctionTrees.get(classId.toString())!;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
async #getArtifactByAddress(contractAddress: AztecAddress): Promise<ContractArtifact | undefined> {
|
|
206
|
+
const classId = await this.#getContractClassId(contractAddress);
|
|
207
|
+
return classId && this.getContractArtifact(classId);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
// Public getters
|
|
211
|
+
|
|
212
|
+
getContractsAddresses(): Promise<AztecAddress[]> {
|
|
213
|
+
return this.#store.transactionAsync(async () => {
|
|
214
|
+
const keys = await toArray(this.#contractInstances.keysAsync());
|
|
215
|
+
return keys.map(AztecAddress.fromString);
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/** Returns a contract instance for a given address. */
|
|
220
|
+
public getContractInstance(contractAddress: AztecAddress): Promise<ContractInstanceWithAddress | undefined> {
|
|
221
|
+
return this.#store.transactionAsync(async () => {
|
|
222
|
+
const contract = await this.#contractInstances.getAsync(contractAddress.toString());
|
|
223
|
+
return contract && SerializableContractInstance.fromBuffer(contract).withAddress(contractAddress);
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
/** Returns the raw contract artifact for a given class id. */
|
|
228
|
+
public async getContractArtifact(contractClassId: Fr): Promise<ContractArtifact | undefined> {
|
|
229
|
+
const key = contractClassId.toString();
|
|
230
|
+
const cached = this.#contractArtifactCache.get(key);
|
|
231
|
+
if (cached) {
|
|
232
|
+
return cached;
|
|
233
|
+
}
|
|
234
|
+
const artifact = await this.#store.transactionAsync(async () => {
|
|
235
|
+
const buf = await this.#contractArtifacts.getAsync(key);
|
|
236
|
+
return buf && contractArtifactFromBuffer(buf);
|
|
237
|
+
});
|
|
238
|
+
if (artifact) {
|
|
239
|
+
this.#contractArtifactCache.set(key, artifact);
|
|
240
|
+
}
|
|
241
|
+
return artifact;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
/** Returns a contract class for a given class id. */
|
|
245
|
+
public async getContractClassWithPreimage(
|
|
246
|
+
contractClassId: Fr,
|
|
247
|
+
): Promise<(ContractClassWithId & ContractClassIdPreimage) | undefined> {
|
|
248
|
+
const key = contractClassId.toString();
|
|
249
|
+
const buf = await this.#contractClassData.getAsync(key);
|
|
250
|
+
if (!buf) {
|
|
251
|
+
return undefined;
|
|
252
|
+
}
|
|
253
|
+
const classData = SerializableContractClassData.fromBuffer(buf);
|
|
254
|
+
const artifact = await this.getContractArtifact(contractClassId);
|
|
255
|
+
if (!artifact) {
|
|
256
|
+
return undefined;
|
|
257
|
+
}
|
|
258
|
+
const packedBytecode = artifact.functions.find(f => f.name === 'public_dispatch')?.bytecode ?? Buffer.alloc(0);
|
|
259
|
+
return { ...classData, packedBytecode };
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
public async getContract(
|
|
263
|
+
address: AztecAddress,
|
|
264
|
+
): Promise<(ContractInstanceWithAddress & ContractArtifact) | undefined> {
|
|
265
|
+
const instance = await this.getContractInstance(address);
|
|
266
|
+
if (!instance) {
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
269
|
+
const artifact = await this.getContractArtifact(instance.currentContractClassId);
|
|
270
|
+
if (!artifact) {
|
|
271
|
+
return;
|
|
272
|
+
}
|
|
273
|
+
return { ...instance, ...artifact };
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* Retrieves the artifact of a specified function within a given contract.
|
|
278
|
+
*
|
|
279
|
+
* @param contractAddress - The AztecAddress representing the contract containing the function.
|
|
280
|
+
* @param selector - The function selector.
|
|
281
|
+
* @returns The corresponding function's artifact as an object.
|
|
282
|
+
*/
|
|
283
|
+
public async getFunctionArtifact(
|
|
284
|
+
contractAddress: AztecAddress,
|
|
285
|
+
selector: FunctionSelector,
|
|
286
|
+
): Promise<FunctionArtifactWithContractName | undefined> {
|
|
287
|
+
const artifact = await this.#getArtifactByAddress(contractAddress);
|
|
288
|
+
if (!artifact) {
|
|
289
|
+
return undefined;
|
|
290
|
+
}
|
|
291
|
+
const fn = await this.#findFunctionArtifactBySelector(artifact, selector);
|
|
292
|
+
return fn && { ...fn, contractName: artifact.name };
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
public async getFunctionArtifactWithDebugMetadata(
|
|
296
|
+
contractAddress: AztecAddress,
|
|
297
|
+
selector: FunctionSelector,
|
|
298
|
+
): Promise<FunctionArtifactWithContractName> {
|
|
299
|
+
const artifact = await this.getFunctionArtifact(contractAddress, selector);
|
|
300
|
+
if (!artifact) {
|
|
301
|
+
throw new Error(`Function artifact not found for contract ${contractAddress} and selector ${selector}.`);
|
|
302
|
+
}
|
|
303
|
+
const debug = await this.getFunctionDebugMetadata(contractAddress, selector);
|
|
304
|
+
return {
|
|
305
|
+
...artifact,
|
|
306
|
+
debug,
|
|
307
|
+
};
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
public async getPublicFunctionArtifact(
|
|
311
|
+
contractAddress: AztecAddress,
|
|
312
|
+
): Promise<FunctionArtifactWithContractName | undefined> {
|
|
313
|
+
const artifact = await this.#getArtifactByAddress(contractAddress);
|
|
314
|
+
const fn = artifact && artifact.functions.find(f => f.functionType === FunctionType.PUBLIC);
|
|
315
|
+
return fn && { ...fn, contractName: artifact.name };
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
public async getFunctionAbi(
|
|
319
|
+
contractAddress: AztecAddress,
|
|
320
|
+
selector: FunctionSelector,
|
|
321
|
+
): Promise<FunctionAbi | undefined> {
|
|
322
|
+
const artifact = await this.#getArtifactByAddress(contractAddress);
|
|
323
|
+
return artifact && (await this.#findFunctionAbiBySelector(artifact, selector));
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
/**
|
|
327
|
+
* Retrieves the debug metadata of a specified function within a given contract.
|
|
328
|
+
*
|
|
329
|
+
* @param contractAddress - The AztecAddress representing the contract containing the function.
|
|
330
|
+
* @param selector - The function selector.
|
|
331
|
+
* @returns The corresponding function's debug metadata, or undefined.
|
|
332
|
+
*/
|
|
333
|
+
public async getFunctionDebugMetadata(
|
|
334
|
+
contractAddress: AztecAddress,
|
|
335
|
+
selector: FunctionSelector,
|
|
336
|
+
): Promise<FunctionDebugMetadata | undefined> {
|
|
337
|
+
const artifact = await this.#getArtifactByAddress(contractAddress);
|
|
338
|
+
if (!artifact) {
|
|
339
|
+
return undefined;
|
|
340
|
+
}
|
|
341
|
+
const fn = await this.#findFunctionArtifactBySelector(artifact, selector);
|
|
342
|
+
return fn && getFunctionDebugMetadata(artifact, fn);
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
public async getPublicFunctionDebugMetadata(
|
|
346
|
+
contractAddress: AztecAddress,
|
|
347
|
+
): Promise<FunctionDebugMetadata | undefined> {
|
|
348
|
+
const artifact = await this.#getArtifactByAddress(contractAddress);
|
|
349
|
+
const fn = artifact && artifact.functions.find(f => f.functionType === FunctionType.PUBLIC);
|
|
350
|
+
return fn && getFunctionDebugMetadata(artifact, fn);
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
/**
|
|
354
|
+
* Retrieve the function membership witness for the given contract class and function selector.
|
|
355
|
+
*
|
|
356
|
+
* @param contractClassId - The id of the class.
|
|
357
|
+
* @param selector - The function selector.
|
|
358
|
+
* @returns A promise that resolves with the MembershipWitness instance for the specified contract's function.
|
|
359
|
+
*/
|
|
360
|
+
public async getFunctionMembershipWitness(
|
|
361
|
+
contractClassId: Fr,
|
|
362
|
+
selector: FunctionSelector,
|
|
363
|
+
): Promise<MembershipWitness<typeof FUNCTION_TREE_HEIGHT> | undefined> {
|
|
364
|
+
const tree = await this.#getPrivateFunctionTreeForClassId(contractClassId);
|
|
365
|
+
return tree?.getFunctionMembershipWitness(selector);
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
public async getDebugContractName(contractAddress: AztecAddress) {
|
|
369
|
+
const artifact = await this.#getArtifactByAddress(contractAddress);
|
|
370
|
+
return artifact?.name;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
public async getDebugFunctionName(contractAddress: AztecAddress, selector: FunctionSelector) {
|
|
374
|
+
const artifact = await this.#getArtifactByAddress(contractAddress);
|
|
375
|
+
const fn = artifact && (await this.#findFunctionAbiBySelector(artifact, selector));
|
|
376
|
+
return `${artifact?.name ?? contractAddress}:${fn?.name ?? selector}`;
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
async #findFunctionArtifactBySelector(
|
|
380
|
+
artifact: ContractArtifact,
|
|
381
|
+
selector: FunctionSelector,
|
|
382
|
+
): Promise<FunctionArtifact | undefined> {
|
|
383
|
+
for (const fn of artifact.functions) {
|
|
384
|
+
const fnSelector = await FunctionSelector.fromNameAndParameters(fn.name, fn.parameters);
|
|
385
|
+
if (fnSelector.equals(selector)) {
|
|
386
|
+
return fn;
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
async #findFunctionAbiBySelector(
|
|
392
|
+
artifact: ContractArtifact,
|
|
393
|
+
selector: FunctionSelector,
|
|
394
|
+
): Promise<FunctionAbi | undefined> {
|
|
395
|
+
for (const fn of [...artifact.functions, ...(artifact.nonDispatchPublicFunctions ?? [])]) {
|
|
396
|
+
const fnSelector = await FunctionSelector.fromNameAndParameters(fn.name, fn.parameters);
|
|
397
|
+
if (fnSelector.equals(selector)) {
|
|
398
|
+
return fn;
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
public async getFunctionCall(functionName: string, args: any[], to: AztecAddress): Promise<FunctionCall> {
|
|
404
|
+
const contract = await this.getContract(to);
|
|
405
|
+
if (!contract) {
|
|
406
|
+
throw new Error(
|
|
407
|
+
`Unknown contract ${to}: add it to PXE by calling server.addContracts(...).\nSee docs for context: https://docs.aztec.network/developers/resources/debugging/aztecnr-errors#unknown-contract-0x0-add-it-to-pxe-by-calling-serveraddcontracts`,
|
|
408
|
+
);
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
const functionDao = contract.functions.find(f => f.name === functionName);
|
|
412
|
+
if (!functionDao) {
|
|
413
|
+
throw new Error(`Unknown function ${functionName} in contract ${contract.name}.`);
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
const selector = await FunctionSelector.fromNameAndParameters(functionDao.name, functionDao.parameters);
|
|
417
|
+
|
|
418
|
+
return FunctionCall.from({
|
|
419
|
+
name: functionDao.name,
|
|
420
|
+
to,
|
|
421
|
+
selector,
|
|
422
|
+
type: functionDao.functionType,
|
|
423
|
+
hideMsgSender: false,
|
|
424
|
+
isStatic: functionDao.isStatic,
|
|
425
|
+
args: encodeArguments(functionDao, args),
|
|
426
|
+
returnTypes: functionDao.returnTypes,
|
|
427
|
+
});
|
|
428
|
+
}
|
|
429
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ContractStore } from './contract_store.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FUNCTION_TREE_HEIGHT } from '@aztec/constants';
|
|
2
|
-
import { Fr } from '@aztec/foundation/
|
|
2
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
3
|
import { assertLength } from '@aztec/foundation/serialize';
|
|
4
4
|
import { MembershipWitness, type MerkleTree } from '@aztec/foundation/trees';
|
|
5
5
|
import { type ContractArtifact, FunctionSelector, FunctionType } from '@aztec/stdlib/abi';
|
package/src/storage/index.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export * from './
|
|
2
|
-
export * from './
|
|
3
|
-
export * from './
|
|
4
|
-
export * from './
|
|
5
|
-
export * from './
|
|
6
|
-
export * from './
|
|
1
|
+
export * from './address_store/index.js';
|
|
2
|
+
export * from './capsule_store/index.js';
|
|
3
|
+
export * from './contract_store/index.js';
|
|
4
|
+
export * from './note_store/index.js';
|
|
5
|
+
export * from './anchor_block_store/index.js';
|
|
6
|
+
export * from './tagging_store/index.js';
|
|
7
7
|
export * from './metadata.js';
|
|
8
|
-
export * from './
|
|
8
|
+
export * from './private_event_store/private_event_store.js';
|
package/src/storage/metadata.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const PXE_DATA_SCHEMA_VERSION =
|
|
1
|
+
export const PXE_DATA_SCHEMA_VERSION = 3;
|