@aztec/pxe 0.0.1-commit.03f7ef2 → 0.0.1-commit.0658669b3
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 +1 -1
- package/dest/block_synchronizer/block_synchronizer.d.ts +17 -11
- package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -1
- package/dest/block_synchronizer/block_synchronizer.js +80 -34
- package/dest/config/index.d.ts +3 -1
- 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 +65 -40
- package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.js +209 -89
- package/dest/contract_function_simulator/execution_note_cache.d.ts +18 -9
- package/dest/contract_function_simulator/execution_note_cache.d.ts.map +1 -1
- package/dest/contract_function_simulator/execution_note_cache.js +45 -28
- 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 +4 -3
- 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/note_validation_request.d.ts +3 -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 +2 -2
- 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 +17 -13
- package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts +3 -1
- package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts +6 -6
- package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/note_packing_utils.js +8 -8
- package/dest/contract_function_simulator/oracle/oracle.d.ts +12 -10
- package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/oracle.js +67 -44
- package/dest/contract_function_simulator/oracle/private_execution.d.ts +2 -26
- package/dest/contract_function_simulator/oracle/private_execution.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution.js +1 -37
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +46 -46
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.js +88 -56
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +82 -48
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +141 -120
- 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 +5 -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 +26 -12
- package/dest/debug/pxe_debug_utils.d.ts.map +1 -1
- package/dest/debug/pxe_debug_utils.js +30 -19
- package/dest/entrypoints/client/bundle/index.d.ts +4 -1
- package/dest/entrypoints/client/bundle/index.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/index.js +3 -0
- 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 +31 -8
- package/dest/entrypoints/client/lazy/index.d.ts +4 -1
- package/dest/entrypoints/client/lazy/index.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/index.js +3 -0
- 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 +32 -9
- package/dest/entrypoints/pxe_creation_options.d.ts +5 -3
- package/dest/entrypoints/pxe_creation_options.d.ts.map +1 -1
- package/dest/entrypoints/server/index.d.ts +5 -1
- package/dest/entrypoints/server/index.d.ts.map +1 -1
- package/dest/entrypoints/server/index.js +4 -0
- 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 +8 -8
- package/dest/events/event_service.d.ts.map +1 -1
- package/dest/events/event_service.js +21 -24
- package/dest/events/private_event_filter_validator.d.ts +6 -6
- package/dest/events/private_event_filter_validator.d.ts.map +1 -1
- package/dest/events/private_event_filter_validator.js +5 -6
- 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 +18 -32
- package/dest/logs/log_service.d.ts.map +1 -1
- package/dest/logs/log_service.js +76 -197
- package/dest/notes/note_service.d.ts +13 -12
- package/dest/notes/note_service.d.ts.map +1 -1
- package/dest/notes/note_service.js +42 -46
- 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 +29 -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} +141 -74
- package/dest/private_kernel/hints/test_utils.d.ts +122 -0
- package/dest/private_kernel/hints/test_utils.d.ts.map +1 -0
- package/dest/private_kernel/hints/test_utils.js +203 -0
- 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 +24 -17
- package/dest/private_kernel/private_kernel_oracle.d.ts +24 -24
- 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 +85 -66
- package/dest/pxe.d.ts.map +1 -1
- package/dest/pxe.js +203 -185
- 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/{anchor_block_data_provider/anchor_block_data_provider.js → anchor_block_store/anchor_block_store.js} +9 -2
- package/dest/storage/anchor_block_store/index.d.ts +2 -0
- package/dest/storage/anchor_block_store/index.d.ts.map +1 -0
- package/dest/storage/anchor_block_store/index.js +1 -0
- package/dest/storage/capsule_store/capsule_store.d.ts +72 -0
- package/dest/storage/capsule_store/capsule_store.d.ts.map +1 -0
- package/dest/storage/capsule_store/capsule_store.js +253 -0
- package/dest/storage/capsule_store/index.d.ts +2 -0
- package/dest/storage/capsule_store/index.d.ts.map +1 -0
- package/dest/storage/capsule_store/index.js +1 -0
- package/dest/storage/contract_store/contract_store.d.ts +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/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_data_provider/sender_tagging_data_provider.d.ts → tagging_store/sender_tagging_store.d.ts} +19 -9
- 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 -3
- 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 +15 -3
- package/dest/tagging/index.d.ts.map +1 -1
- package/dest/tagging/index.js +14 -2
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts +4 -3
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts.map +1 -1
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.js +12 -12
- package/dest/tagging/recipient_sync/utils/find_highest_indexes.js +2 -2
- package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts +3 -2
- package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts.map +1 -1
- package/dest/tagging/recipient_sync/utils/load_logs_for_range.js +5 -2
- package/dest/tagging/{sync → sender_sync}/sync_sender_tagging_indexes.d.ts +4 -4
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts.map +1 -0
- package/dest/tagging/{sync → sender_sync}/sync_sender_tagging_indexes.js +8 -23
- package/dest/tagging/{sync → sender_sync}/utils/get_status_change_of_pending.d.ts +1 -1
- package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts.map +1 -0
- package/dest/tagging/{sync → sender_sync}/utils/get_status_change_of_pending.js +5 -8
- package/dest/tagging/{sync → sender_sync}/utils/load_and_store_new_tagging_indexes.d.ts +7 -4
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts.map +1 -0
- package/dest/tagging/{sync → sender_sync}/utils/load_and_store_new_tagging_indexes.js +12 -7
- package/package.json +27 -18
- package/src/access_scopes.ts +9 -0
- package/src/bin/check_oracle_version.ts +1 -0
- package/src/block_synchronizer/block_synchronizer.ts +99 -46
- package/src/config/index.ts +14 -0
- 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 +363 -153
- package/src/contract_function_simulator/execution_note_cache.ts +44 -25
- package/src/contract_function_simulator/index.ts +1 -1
- package/src/contract_function_simulator/noir-structs/event_validation_request.ts +6 -2
- package/src/contract_function_simulator/noir-structs/note_validation_request.ts +2 -2
- package/src/contract_function_simulator/noir-structs/utility_context.ts +6 -25
- package/src/contract_function_simulator/oracle/interfaces.ts +22 -12
- package/src/contract_function_simulator/oracle/note_packing_utils.ts +10 -10
- package/src/contract_function_simulator/oracle/oracle.ts +79 -47
- package/src/contract_function_simulator/oracle/private_execution.ts +1 -69
- package/src/contract_function_simulator/oracle/private_execution_oracle.ts +121 -135
- package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +217 -132
- package/src/contract_function_simulator/proxied_contract_data_source.ts +7 -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 +65 -20
- package/src/entrypoints/client/bundle/index.ts +3 -0
- package/src/entrypoints/client/bundle/utils.ts +23 -16
- package/src/entrypoints/client/lazy/index.ts +3 -0
- package/src/entrypoints/client/lazy/utils.ts +24 -17
- package/src/entrypoints/pxe_creation_options.ts +4 -2
- package/src/entrypoints/server/index.ts +4 -0
- package/src/entrypoints/server/utils.ts +33 -41
- package/src/error_enriching.ts +7 -15
- package/src/events/event_service.ts +22 -28
- package/src/events/private_event_filter_validator.ts +4 -6
- package/src/job_coordinator/job_coordinator.ts +150 -0
- package/src/logs/log_service.ts +118 -274
- package/src/notes/note_service.ts +45 -49
- 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} +196 -138
- package/src/private_kernel/hints/test_utils.ts +325 -0
- package/src/private_kernel/private_kernel_execution_prover.ts +27 -19
- package/src/private_kernel/private_kernel_oracle.ts +116 -36
- package/src/pxe.ts +331 -257
- 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/{anchor_block_data_provider/anchor_block_data_provider.ts → anchor_block_store/anchor_block_store.ts} +9 -1
- 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/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 -3
- package/src/tagging/get_all_logs_by_tags.ts +92 -0
- package/src/tagging/index.ts +17 -2
- package/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts +27 -13
- package/src/tagging/recipient_sync/utils/find_highest_indexes.ts +2 -2
- package/src/tagging/recipient_sync/utils/load_logs_for_range.ts +7 -1
- package/src/tagging/{sync → sender_sync}/sync_sender_tagging_indexes.ts +12 -25
- package/src/tagging/{sync → sender_sync}/utils/get_status_change_of_pending.ts +5 -13
- package/src/tagging/{sync → sender_sync}/utils/load_and_store_new_tagging_indexes.ts +19 -7
- 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/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 -46
- 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/public_storage/public_storage_service.d.ts +0 -24
- package/dest/public_storage/public_storage_service.d.ts.map +0 -1
- package/dest/public_storage/public_storage_service.js +0 -26
- 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/anchor_block_data_provider/anchor_block_data_provider.d.ts +0 -9
- package/dest/storage/anchor_block_data_provider/anchor_block_data_provider.d.ts.map +0 -1
- package/dest/storage/anchor_block_data_provider/index.d.ts +0 -2
- package/dest/storage/anchor_block_data_provider/index.d.ts.map +0 -1
- package/dest/storage/anchor_block_data_provider/index.js +0 -1
- package/dest/storage/capsule_data_provider/capsule_data_provider.d.ts +0 -57
- 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 -146
- 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 -66
- 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 -224
- 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 -84
- 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 -322
- package/dest/storage/private_event_data_provider/private_event_data_provider.d.ts +0 -51
- 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 -115
- package/dest/storage/tagging_data_provider/index.d.ts +0 -3
- package/dest/storage/tagging_data_provider/index.d.ts.map +0 -1
- package/dest/storage/tagging_data_provider/index.js +0 -2
- package/dest/storage/tagging_data_provider/recipient_tagging_data_provider.d.ts +0 -31
- package/dest/storage/tagging_data_provider/recipient_tagging_data_provider.d.ts.map +0 -1
- package/dest/storage/tagging_data_provider/recipient_tagging_data_provider.js +0 -65
- package/dest/storage/tagging_data_provider/sender_tagging_data_provider.d.ts.map +0 -1
- package/dest/storage/tagging_data_provider/sender_tagging_data_provider.js +0 -196
- package/dest/tagging/recipient_sync/new_recipient_tagging_data_provider.d.ts +0 -21
- package/dest/tagging/recipient_sync/new_recipient_tagging_data_provider.d.ts.map +0 -1
- package/dest/tagging/recipient_sync/new_recipient_tagging_data_provider.js +0 -42
- package/dest/tagging/sync/sync_sender_tagging_indexes.d.ts.map +0 -1
- package/dest/tagging/sync/utils/get_status_change_of_pending.d.ts.map +0 -1
- package/dest/tagging/sync/utils/load_and_store_new_tagging_indexes.d.ts.map +0 -1
- package/dest/tagging/utils.d.ts +0 -18
- package/dest/tagging/utils.d.ts.map +0 -1
- package/dest/tagging/utils.js +0 -25
- package/dest/tree_membership/tree_membership_service.d.ts +0 -52
- package/dest/tree_membership/tree_membership_service.d.ts.map +0 -1
- package/dest/tree_membership/tree_membership_service.js +0 -84
- package/src/contract_function_simulator/proxied_node.ts +0 -33
- package/src/private_kernel/private_kernel_oracle_impl.ts +0 -133
- package/src/public_storage/public_storage_service.ts +0 -33
- package/src/storage/address_data_provider/index.ts +0 -1
- package/src/storage/anchor_block_data_provider/index.ts +0 -1
- package/src/storage/capsule_data_provider/capsule_data_provider.ts +0 -179
- package/src/storage/capsule_data_provider/index.ts +0 -1
- package/src/storage/contract_data_provider/contract_data_provider.ts +0 -319
- 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 -412
- package/src/storage/private_event_data_provider/private_event_data_provider.ts +0 -162
- package/src/storage/tagging_data_provider/index.ts +0 -2
- package/src/storage/tagging_data_provider/recipient_tagging_data_provider.ts +0 -86
- package/src/storage/tagging_data_provider/sender_tagging_data_provider.ts +0 -244
- package/src/tagging/recipient_sync/new_recipient_tagging_data_provider.ts +0 -53
- package/src/tagging/utils.ts +0 -32
- package/src/tree_membership/tree_membership_service.ts +0 -112
- /package/dest/storage/{contract_data_provider → contract_store}/private_functions_tree.js +0 -0
- /package/src/storage/{contract_data_provider → contract_store}/private_functions_tree.ts +0 -0
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
|
-
import { type Logger } from '@aztec/foundation/log';
|
|
3
|
-
import type { AztecAsyncKVStore } from '@aztec/kv-store';
|
|
4
|
-
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
5
|
-
export declare class CapsuleDataProvider {
|
|
6
|
-
#private;
|
|
7
|
-
logger: Logger;
|
|
8
|
-
constructor(store: AztecAsyncKVStore);
|
|
9
|
-
/**
|
|
10
|
-
* Stores arbitrary information in a per-contract non-volatile database, which can later be retrieved with `loadCapsule`.
|
|
11
|
-
* * If data was already stored at this slot, it is overwritten.
|
|
12
|
-
* @param contractAddress - The contract address to scope the data under.
|
|
13
|
-
* @param slot - The slot in the database in which to store the value. Slots need not be contiguous.
|
|
14
|
-
* @param capsule - An array of field elements representing the capsule.
|
|
15
|
-
* @remarks A capsule is a "blob" of data that is passed to the contract through an oracle. It works similarly
|
|
16
|
-
* to public contract storage in that it's indexed by the contract address and storage slot but instead of the global
|
|
17
|
-
* network state it's backed by local PXE db.
|
|
18
|
-
*/
|
|
19
|
-
storeCapsule(contractAddress: AztecAddress, slot: Fr, capsule: Fr[]): Promise<void>;
|
|
20
|
-
/**
|
|
21
|
-
* Returns data previously stored via `storeCapsule` in the per-contract non-volatile database.
|
|
22
|
-
* @param contractAddress - The contract address under which the data is scoped.
|
|
23
|
-
* @param slot - The slot in the database to read.
|
|
24
|
-
* @returns The stored data or `null` if no data is stored under the slot.
|
|
25
|
-
*/
|
|
26
|
-
loadCapsule(contractAddress: AztecAddress, slot: Fr): Promise<Fr[] | null>;
|
|
27
|
-
/**
|
|
28
|
-
* Deletes data in the per-contract non-volatile database. Does nothing if no data was present.
|
|
29
|
-
* @param contractAddress - The contract address under which the data is scoped.
|
|
30
|
-
* @param slot - The slot in the database to delete.
|
|
31
|
-
*/
|
|
32
|
-
deleteCapsule(contractAddress: AztecAddress, slot: Fr): Promise<void>;
|
|
33
|
-
/**
|
|
34
|
-
* Copies a number of contiguous entries in the per-contract non-volatile database. This allows for efficient data
|
|
35
|
-
* structures by avoiding repeated calls to `loadCapsule` and `storeCapsule`.
|
|
36
|
-
* Supports overlapping source and destination regions (which will result in the overlapped source values being
|
|
37
|
-
* overwritten). All copied slots must exist in the database (i.e. have been stored and not deleted)
|
|
38
|
-
*
|
|
39
|
-
* @param contractAddress - The contract address under which the data is scoped.
|
|
40
|
-
* @param srcSlot - The first slot to copy from.
|
|
41
|
-
* @param dstSlot - The first slot to copy to.
|
|
42
|
-
* @param numEntries - The number of entries to copy.
|
|
43
|
-
*/
|
|
44
|
-
copyCapsule(contractAddress: AztecAddress, srcSlot: Fr, dstSlot: Fr, numEntries: number): Promise<void>;
|
|
45
|
-
/**
|
|
46
|
-
* Appends multiple capsules to a capsule array stored at the base slot.
|
|
47
|
-
* The array length is stored at the base slot, and elements are stored in consecutive slots after it.
|
|
48
|
-
* All operations are performed in a single transaction.
|
|
49
|
-
* @param contractAddress - The contract address that owns the capsule array
|
|
50
|
-
* @param baseSlot - The slot where the array length is stored
|
|
51
|
-
* @param content - Array of capsule data to append
|
|
52
|
-
*/
|
|
53
|
-
appendToCapsuleArray(contractAddress: AztecAddress, baseSlot: Fr, content: Fr[][]): Promise<void>;
|
|
54
|
-
readCapsuleArray(contractAddress: AztecAddress, baseSlot: Fr): Promise<Fr[][]>;
|
|
55
|
-
setCapsuleArray(contractAddress: AztecAddress, baseSlot: Fr, content: Fr[][]): Promise<void>;
|
|
56
|
-
}
|
|
57
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2Fwc3VsZV9kYXRhX3Byb3ZpZGVyLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvc3RvcmFnZS9jYXBzdWxlX2RhdGFfcHJvdmlkZXIvY2Fwc3VsZV9kYXRhX3Byb3ZpZGVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxFQUFFLEVBQUUsTUFBTSxnQ0FBZ0MsQ0FBQztBQUNwRCxPQUFPLEVBQUUsS0FBSyxNQUFNLEVBQWdCLE1BQU0sdUJBQXVCLENBQUM7QUFDbEUsT0FBTyxLQUFLLEVBQUUsaUJBQWlCLEVBQWlCLE1BQU0saUJBQWlCLENBQUM7QUFDeEUsT0FBTyxLQUFLLEVBQUUsWUFBWSxFQUFFLE1BQU0sNkJBQTZCLENBQUM7QUFFaEUscUJBQWEsbUJBQW1COztJQU05QixNQUFNLEVBQUUsTUFBTSxDQUFDO0lBRWYsWUFBWSxLQUFLLEVBQUUsaUJBQWlCLEVBTW5DO0lBRUQ7Ozs7Ozs7OztPQVNHO0lBQ0csWUFBWSxDQUFDLGVBQWUsRUFBRSxZQUFZLEVBQUUsSUFBSSxFQUFFLEVBQUUsRUFBRSxPQUFPLEVBQUUsRUFBRSxFQUFFLEdBQUcsT0FBTyxDQUFDLElBQUksQ0FBQyxDQUV4RjtJQUVEOzs7OztPQUtHO0lBQ0csV0FBVyxDQUFDLGVBQWUsRUFBRSxZQUFZLEVBQUUsSUFBSSxFQUFFLEVBQUUsR0FBRyxPQUFPLENBQUMsRUFBRSxFQUFFLEdBQ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arbitrary data stored by contracts. Key is computed as `${contractAddress}:${key}`
|
|
6
|
-
#capsules;
|
|
7
|
-
logger;
|
|
8
|
-
constructor(store){
|
|
9
|
-
this.#store = store;
|
|
10
|
-
this.#capsules = this.#store.openMap('capsules');
|
|
11
|
-
this.logger = createLogger('pxe:capsule-data-provider');
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Stores arbitrary information in a per-contract non-volatile database, which can later be retrieved with `loadCapsule`.
|
|
15
|
-
* * If data was already stored at this slot, it is overwritten.
|
|
16
|
-
* @param contractAddress - The contract address to scope the data under.
|
|
17
|
-
* @param slot - The slot in the database in which to store the value. Slots need not be contiguous.
|
|
18
|
-
* @param capsule - An array of field elements representing the capsule.
|
|
19
|
-
* @remarks A capsule is a "blob" of data that is passed to the contract through an oracle. It works similarly
|
|
20
|
-
* to public contract storage in that it's indexed by the contract address and storage slot but instead of the global
|
|
21
|
-
* network state it's backed by local PXE db.
|
|
22
|
-
*/ async storeCapsule(contractAddress, slot, capsule) {
|
|
23
|
-
await this.#capsules.set(dbSlotToKey(contractAddress, slot), Buffer.concat(capsule.map((value)=>value.toBuffer())));
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Returns data previously stored via `storeCapsule` in the per-contract non-volatile database.
|
|
27
|
-
* @param contractAddress - The contract address under which the data is scoped.
|
|
28
|
-
* @param slot - The slot in the database to read.
|
|
29
|
-
* @returns The stored data or `null` if no data is stored under the slot.
|
|
30
|
-
*/ async loadCapsule(contractAddress, slot) {
|
|
31
|
-
const dataBuffer = await this.#capsules.getAsync(dbSlotToKey(contractAddress, slot));
|
|
32
|
-
if (!dataBuffer) {
|
|
33
|
-
this.logger.trace(`Data not found for contract ${contractAddress.toString()} and slot ${slot.toString()}`);
|
|
34
|
-
return null;
|
|
35
|
-
}
|
|
36
|
-
const capsule = [];
|
|
37
|
-
for(let i = 0; i < dataBuffer.length; i += Fr.SIZE_IN_BYTES){
|
|
38
|
-
capsule.push(Fr.fromBuffer(dataBuffer.subarray(i, i + Fr.SIZE_IN_BYTES)));
|
|
39
|
-
}
|
|
40
|
-
return capsule;
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Deletes data in the per-contract non-volatile database. Does nothing if no data was present.
|
|
44
|
-
* @param contractAddress - The contract address under which the data is scoped.
|
|
45
|
-
* @param slot - The slot in the database to delete.
|
|
46
|
-
*/ async deleteCapsule(contractAddress, slot) {
|
|
47
|
-
await this.#capsules.delete(dbSlotToKey(contractAddress, slot));
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Copies a number of contiguous entries in the per-contract non-volatile database. This allows for efficient data
|
|
51
|
-
* structures by avoiding repeated calls to `loadCapsule` and `storeCapsule`.
|
|
52
|
-
* Supports overlapping source and destination regions (which will result in the overlapped source values being
|
|
53
|
-
* overwritten). All copied slots must exist in the database (i.e. have been stored and not deleted)
|
|
54
|
-
*
|
|
55
|
-
* @param contractAddress - The contract address under which the data is scoped.
|
|
56
|
-
* @param srcSlot - The first slot to copy from.
|
|
57
|
-
* @param dstSlot - The first slot to copy to.
|
|
58
|
-
* @param numEntries - The number of entries to copy.
|
|
59
|
-
*/ copyCapsule(contractAddress, srcSlot, dstSlot, numEntries) {
|
|
60
|
-
return this.#store.transactionAsync(async ()=>{
|
|
61
|
-
// In order to support overlapping source and destination regions, we need to check the relative positions of source
|
|
62
|
-
// and destination. If destination is ahead of source, then by the time we overwrite source elements using forward
|
|
63
|
-
// indexes we'll have already read those. On the contrary, if source is ahead of destination we need to use backward
|
|
64
|
-
// indexes to avoid reading elements that've been overwritten.
|
|
65
|
-
const indexes = Array.from(Array(numEntries).keys());
|
|
66
|
-
if (srcSlot.lt(dstSlot)) {
|
|
67
|
-
indexes.reverse();
|
|
68
|
-
}
|
|
69
|
-
for (const i of indexes){
|
|
70
|
-
const currentSrcSlot = dbSlotToKey(contractAddress, srcSlot.add(new Fr(i)));
|
|
71
|
-
const currentDstSlot = dbSlotToKey(contractAddress, dstSlot.add(new Fr(i)));
|
|
72
|
-
const toCopy = await this.#capsules.getAsync(currentSrcSlot);
|
|
73
|
-
if (!toCopy) {
|
|
74
|
-
throw new Error(`Attempted to copy empty slot ${currentSrcSlot} for contract ${contractAddress.toString()}`);
|
|
75
|
-
}
|
|
76
|
-
await this.#capsules.set(currentDstSlot, toCopy);
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Appends multiple capsules to a capsule array stored at the base slot.
|
|
82
|
-
* The array length is stored at the base slot, and elements are stored in consecutive slots after it.
|
|
83
|
-
* All operations are performed in a single transaction.
|
|
84
|
-
* @param contractAddress - The contract address that owns the capsule array
|
|
85
|
-
* @param baseSlot - The slot where the array length is stored
|
|
86
|
-
* @param content - Array of capsule data to append
|
|
87
|
-
*/ appendToCapsuleArray(contractAddress, baseSlot, content) {
|
|
88
|
-
return this.#store.transactionAsync(async ()=>{
|
|
89
|
-
// Load current length, defaulting to 0 if not found
|
|
90
|
-
const lengthData = await this.loadCapsule(contractAddress, baseSlot);
|
|
91
|
-
const currentLength = lengthData ? lengthData[0].toNumber() : 0;
|
|
92
|
-
// Store each capsule at consecutive slots after baseSlot + 1 + currentLength
|
|
93
|
-
for(let i = 0; i < content.length; i++){
|
|
94
|
-
const nextSlot = arraySlot(baseSlot, currentLength + i);
|
|
95
|
-
await this.storeCapsule(contractAddress, nextSlot, content[i]);
|
|
96
|
-
}
|
|
97
|
-
// Update length to include all new capsules
|
|
98
|
-
const newLength = currentLength + content.length;
|
|
99
|
-
await this.storeCapsule(contractAddress, baseSlot, [
|
|
100
|
-
new Fr(newLength)
|
|
101
|
-
]);
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
readCapsuleArray(contractAddress, baseSlot) {
|
|
105
|
-
return this.#store.transactionAsync(async ()=>{
|
|
106
|
-
// Load length, defaulting to 0 if not found
|
|
107
|
-
const maybeLength = await this.loadCapsule(contractAddress, baseSlot);
|
|
108
|
-
const length = maybeLength ? maybeLength[0].toBigInt() : 0n;
|
|
109
|
-
const values = [];
|
|
110
|
-
// Read each capsule at consecutive slots after baseSlot
|
|
111
|
-
for(let i = 0; i < length; i++){
|
|
112
|
-
const currentValue = await this.loadCapsule(contractAddress, arraySlot(baseSlot, i));
|
|
113
|
-
if (currentValue == undefined) {
|
|
114
|
-
throw new Error(`Expected non-empty value at capsule array in base slot ${baseSlot} at index ${i} for contract ${contractAddress}`);
|
|
115
|
-
}
|
|
116
|
-
values.push(currentValue);
|
|
117
|
-
}
|
|
118
|
-
return values;
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
setCapsuleArray(contractAddress, baseSlot, content) {
|
|
122
|
-
return this.#store.transactionAsync(async ()=>{
|
|
123
|
-
// Load current length, defaulting to 0 if not found
|
|
124
|
-
const maybeLength = await this.loadCapsule(contractAddress, baseSlot);
|
|
125
|
-
const originalLength = maybeLength ? maybeLength[0].toNumber() : 0;
|
|
126
|
-
// Set the new length
|
|
127
|
-
await this.storeCapsule(contractAddress, baseSlot, [
|
|
128
|
-
new Fr(content.length)
|
|
129
|
-
]);
|
|
130
|
-
// Store the new content, possibly overwriting existing values
|
|
131
|
-
for(let i = 0; i < content.length; i++){
|
|
132
|
-
await this.storeCapsule(contractAddress, arraySlot(baseSlot, i), content[i]);
|
|
133
|
-
}
|
|
134
|
-
// Clear any stragglers
|
|
135
|
-
for(let i = content.length; i < originalLength; i++){
|
|
136
|
-
await this.deleteCapsule(contractAddress, arraySlot(baseSlot, i));
|
|
137
|
-
}
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
function dbSlotToKey(contractAddress, slot) {
|
|
142
|
-
return `${contractAddress.toString()}:${slot.toString()}`;
|
|
143
|
-
}
|
|
144
|
-
function arraySlot(baseSlot, index) {
|
|
145
|
-
return baseSlot.add(new Fr(1)).add(new Fr(index));
|
|
146
|
-
}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
export { CapsuleDataProvider } from './capsule_data_provider.js';
|
|
2
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9zdG9yYWdlL2NhcHN1bGVfZGF0YV9wcm92aWRlci9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsbUJBQW1CLEVBQUUsTUFBTSw0QkFBNEIsQ0FBQyJ9
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/storage/capsule_data_provider/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { CapsuleDataProvider } from './capsule_data_provider.js';
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import type { FUNCTION_TREE_HEIGHT } from '@aztec/constants';
|
|
2
|
-
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
|
-
import type { MembershipWitness } from '@aztec/foundation/trees';
|
|
4
|
-
import type { AztecAsyncKVStore } from '@aztec/kv-store';
|
|
5
|
-
import { type ContractArtifact, type FunctionAbi, type FunctionArtifactWithContractName, FunctionCall, type FunctionDebugMetadata, FunctionSelector } from '@aztec/stdlib/abi';
|
|
6
|
-
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
7
|
-
import { type ContractClass, type ContractInstanceWithAddress } from '@aztec/stdlib/contract';
|
|
8
|
-
/**
|
|
9
|
-
* ContractDataProvider serves as a data manager and retriever for Aztec.nr contracts.
|
|
10
|
-
* It provides methods to obtain contract addresses, function ABI, bytecode, and membership witnesses
|
|
11
|
-
* from a given contract address and function selector. The class maintains a cache of ContractTree instances
|
|
12
|
-
* to efficiently serve the requested data. It interacts with the ContractDatabase and AztecNode to fetch
|
|
13
|
-
* the required information and facilitate cryptographic proof generation.
|
|
14
|
-
*/
|
|
15
|
-
export declare class ContractDataProvider {
|
|
16
|
-
#private;
|
|
17
|
-
constructor(store: AztecAsyncKVStore);
|
|
18
|
-
addContractArtifact(id: Fr, contract: ContractArtifact): Promise<void>;
|
|
19
|
-
addContractInstance(contract: ContractInstanceWithAddress): Promise<void>;
|
|
20
|
-
getContractsAddresses(): Promise<AztecAddress[]>;
|
|
21
|
-
/** Returns a contract instance for a given address. Throws if not found. */
|
|
22
|
-
getContractInstance(contractAddress: AztecAddress): Promise<ContractInstanceWithAddress | undefined>;
|
|
23
|
-
getContractArtifact(contractClassId: Fr): Promise<ContractArtifact | undefined>;
|
|
24
|
-
/** Returns a contract class for a given class id. Throws if not found. */
|
|
25
|
-
getContractClass(contractClassId: Fr): Promise<ContractClass | undefined>;
|
|
26
|
-
getContract(address: AztecAddress): Promise<(ContractInstanceWithAddress & ContractArtifact) | undefined>;
|
|
27
|
-
/**
|
|
28
|
-
* Retrieves the artifact of a specified function within a given contract.
|
|
29
|
-
* The function is identified by its selector, which is a unique code generated from the function's signature.
|
|
30
|
-
* Throws an error if the contract address or function selector are invalid or not found.
|
|
31
|
-
*
|
|
32
|
-
* @param contractAddress - The AztecAddress representing the contract containing the function.
|
|
33
|
-
* @param selector - The function selector.
|
|
34
|
-
* @returns The corresponding function's artifact as an object.
|
|
35
|
-
*/
|
|
36
|
-
getFunctionArtifact(contractAddress: AztecAddress, selector: FunctionSelector): Promise<FunctionArtifactWithContractName | undefined>;
|
|
37
|
-
getFunctionArtifactWithDebugMetadata(contractAddress: AztecAddress, selector: FunctionSelector): Promise<FunctionArtifactWithContractName>;
|
|
38
|
-
getPublicFunctionArtifact(contractAddress: AztecAddress): Promise<FunctionArtifactWithContractName | undefined>;
|
|
39
|
-
getFunctionAbi(contractAddress: AztecAddress, selector: FunctionSelector): Promise<FunctionAbi | undefined>;
|
|
40
|
-
/**
|
|
41
|
-
* Retrieves the debug metadata of a specified function within a given contract.
|
|
42
|
-
* The function is identified by its selector, which is a unique code generated from the function's signature.
|
|
43
|
-
* Returns undefined if the debug metadata for the given function is not found.
|
|
44
|
-
* Throws if the contract has not been added to the database.
|
|
45
|
-
*
|
|
46
|
-
* @param contractAddress - The AztecAddress representing the contract containing the function.
|
|
47
|
-
* @param selector - The function selector.
|
|
48
|
-
* @returns The corresponding function's artifact as an object.
|
|
49
|
-
*/
|
|
50
|
-
getFunctionDebugMetadata(contractAddress: AztecAddress, selector: FunctionSelector): Promise<FunctionDebugMetadata | undefined>;
|
|
51
|
-
getPublicFunctionDebugMetadata(contractAddress: AztecAddress): Promise<FunctionDebugMetadata | undefined>;
|
|
52
|
-
/**
|
|
53
|
-
* Retrieve the function membership witness for the given contract class and function selector.
|
|
54
|
-
* The function membership witness represents a proof that the function belongs to the specified contract.
|
|
55
|
-
* Throws an error if the contract address or function selector is unknown.
|
|
56
|
-
*
|
|
57
|
-
* @param contractClassId - The id of the class.
|
|
58
|
-
* @param selector - The function selector.
|
|
59
|
-
* @returns A promise that resolves with the MembershipWitness instance for the specified contract's function.
|
|
60
|
-
*/
|
|
61
|
-
getFunctionMembershipWitness(contractClassId: Fr, selector: FunctionSelector): Promise<MembershipWitness<typeof FUNCTION_TREE_HEIGHT> | undefined>;
|
|
62
|
-
getDebugContractName(contractAddress: AztecAddress): Promise<string | undefined>;
|
|
63
|
-
getDebugFunctionName(contractAddress: AztecAddress, selector: FunctionSelector): Promise<string>;
|
|
64
|
-
getFunctionCall(functionName: string, args: any[], to: AztecAddress): Promise<FunctionCall>;
|
|
65
|
-
}
|
|
66
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29udHJhY3RfZGF0YV9wcm92aWRlci5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL3N0b3JhZ2UvY29udHJhY3RfZGF0YV9wcm92aWRlci9jb250cmFjdF9kYXRhX3Byb3ZpZGVyLnRzI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DQUFDLENBSTVDO0lBRVksOEJBQThCLENBQ3pDLGVBQWUsRUFBRSxZQUFZLEdBQzVCLE9BQU8sQ0FBQyxxQkFBcUIsR0FBRyxTQUFTLENBQUMsQ0FJNUM7SUFFRDs7Ozs7Ozs7T0FRRztJQUNVLDRCQUE0QixDQUN2QyxlQUFlLEVBQUUsRUFBRSxFQUNuQixRQUFRLEVBQUUsZ0JBQWdCLEdBQ3pCLE9BQU8sQ0FBQyxpQkFBaUIsQ0FBQyxPQUFPLG9CQUFvQixDQUFDLEdBQUcsU0FBUyxDQUFDLENBR3JFO0lBRVksb0JBQW9CLENBQUMsZUFBZSxFQUFFLFlBQVksK0JBRzlEO0lBRVksb0JBQW9CLENBQUMsZUFBZSxFQUFFLFlBQVksRUFBRSxRQUFRLEVBQUUsZ0JBQWdCLG1CQUkxRjtJQThCWSxlQUFlLENBQUMsWUFBWSxFQUFFLE1BQU0sRUFBRSxJQUFJLEVBQUUsR0FBRyxFQUFFLEVBQUUsRUFBRSxFQUFFLFlBQVksR0FBRyxPQUFPLENBQUMsWUFBWSxDQUFDLENBdUJ2RztDQUNGIn0=
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"contract_data_provider.d.ts","sourceRoot":"","sources":["../../../src/storage/contract_data_provider/contract_data_provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AAEzD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,KAAK,EAAE,iBAAiB,EAAiB,MAAM,iBAAiB,CAAC;AACxE,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAEhB,KAAK,gCAAgC,EACrC,YAAY,EACZ,KAAK,qBAAqB,EAC1B,gBAAgB,EAMjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,YAAY,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AE,gBAAgB,GACzB,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC,CAGlC;IAED;;;;;;;;;OASG;IACU,wBAAwB,CACnC,eAAe,EAAE,YAAY,EAC7B,QAAQ,EAAE,gBAAgB,GACzB,OAAO,CAAC,qBAAqB,GAAG,SAAS,CAAC,CAI5C;IAEY,8BAA8B,CACzC,eAAe,EAAE,YAAY,GAC5B,OAAO,CAAC,qBAAqB,GAAG,SAAS,CAAC,CAI5C;IAED;;;;;;;;OAQG;IACU,4BAA4B,CACvC,eAAe,EAAE,EAAE,EACnB,QAAQ,EAAE,gBAAgB,GACzB,OAAO,CAAC,iBAAiB,CAAC,OAAO,oBAAoB,CAAC,GAAG,SAAS,CAAC,CAGrE;IAEY,oBAAoB,CAAC,eAAe,EAAE,YAAY,+BAG9D;IAEY,oBAAoB,CAAC,eAAe,EAAE,YAAY,EAAE,QAAQ,EAAE,gBAAgB,mBAI1F;IA8BY,eAAe,CAAC,YAAY,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,EAAE,EAAE,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC,CAuBvG;CACF"}
|
|
@@ -1,224 +0,0 @@
|
|
|
1
|
-
import { toArray } from '@aztec/foundation/iterable';
|
|
2
|
-
import { FunctionSelector, FunctionType, contractArtifactFromBuffer, contractArtifactToBuffer, encodeArguments, getFunctionDebugMetadata } from '@aztec/stdlib/abi';
|
|
3
|
-
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
|
-
import { SerializableContractInstance, getContractClassFromArtifact } from '@aztec/stdlib/contract';
|
|
5
|
-
import { PrivateFunctionsTree } from './private_functions_tree.js';
|
|
6
|
-
/**
|
|
7
|
-
* ContractDataProvider serves as a data manager and retriever for Aztec.nr contracts.
|
|
8
|
-
* It provides methods to obtain contract addresses, function ABI, bytecode, and membership witnesses
|
|
9
|
-
* from a given contract address and function selector. The class maintains a cache of ContractTree instances
|
|
10
|
-
* to efficiently serve the requested data. It interacts with the ContractDatabase and AztecNode to fetch
|
|
11
|
-
* the required information and facilitate cryptographic proof generation.
|
|
12
|
-
*/ export class ContractDataProvider {
|
|
13
|
-
/** Map from contract class id to private function tree. */ // TODO: Update it to be LRU cache so that it doesn't keep all the data all the time.
|
|
14
|
-
#privateFunctionTrees = new Map();
|
|
15
|
-
/** Map from contract address to contract class id */ #contractClassIdMap = new Map();
|
|
16
|
-
#contractArtifacts;
|
|
17
|
-
#contractInstances;
|
|
18
|
-
constructor(store){
|
|
19
|
-
this.#contractArtifacts = store.openMap('contract_artifacts');
|
|
20
|
-
this.#contractInstances = store.openMap('contracts_instances');
|
|
21
|
-
}
|
|
22
|
-
// Setters
|
|
23
|
-
async addContractArtifact(id, contract) {
|
|
24
|
-
const privateFunctions = contract.functions.filter((functionArtifact)=>functionArtifact.functionType === FunctionType.PRIVATE);
|
|
25
|
-
const privateSelectors = await Promise.all(privateFunctions.map(async (privateFunctionArtifact)=>(await FunctionSelector.fromNameAndParameters(privateFunctionArtifact.name, privateFunctionArtifact.parameters)).toString()));
|
|
26
|
-
if (privateSelectors.length !== new Set(privateSelectors).size) {
|
|
27
|
-
throw new Error('Repeated function selectors of private functions');
|
|
28
|
-
}
|
|
29
|
-
await this.#contractArtifacts.set(id.toString(), contractArtifactToBuffer(contract));
|
|
30
|
-
}
|
|
31
|
-
async addContractInstance(contract) {
|
|
32
|
-
this.#contractClassIdMap.set(contract.address.toString(), contract.currentContractClassId);
|
|
33
|
-
await this.#contractInstances.set(contract.address.toString(), new SerializableContractInstance(contract).toBuffer());
|
|
34
|
-
}
|
|
35
|
-
// Private getters
|
|
36
|
-
async #getContractClassId(contractAddress) {
|
|
37
|
-
if (!this.#contractClassIdMap.has(contractAddress.toString())) {
|
|
38
|
-
const instance = await this.getContractInstance(contractAddress);
|
|
39
|
-
if (!instance) {
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
this.#contractClassIdMap.set(contractAddress.toString(), instance.currentContractClassId);
|
|
43
|
-
}
|
|
44
|
-
return this.#contractClassIdMap.get(contractAddress.toString());
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Retrieve or create a ContractTree instance based on the provided class id.
|
|
48
|
-
* If an existing tree with the same class id is found in the cache, it will be returned.
|
|
49
|
-
* Otherwise, a new ContractTree instance will be created using the contract data from the database
|
|
50
|
-
* and added to the cache before returning.
|
|
51
|
-
*
|
|
52
|
-
* @param classId - The class id of the contract for which the ContractTree is required.
|
|
53
|
-
* @returns A ContractTree instance associated with the specified contract address.
|
|
54
|
-
* @throws An Error if the contract is not found in the ContractDatabase.
|
|
55
|
-
*/ async #getPrivateFunctionTreeForClassId(classId) {
|
|
56
|
-
if (!this.#privateFunctionTrees.has(classId.toString())) {
|
|
57
|
-
const artifact = await this.getContractArtifact(classId);
|
|
58
|
-
if (!artifact) {
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
const tree = await PrivateFunctionsTree.create(artifact);
|
|
62
|
-
this.#privateFunctionTrees.set(classId.toString(), tree);
|
|
63
|
-
}
|
|
64
|
-
return this.#privateFunctionTrees.get(classId.toString());
|
|
65
|
-
}
|
|
66
|
-
async #getContractArtifactByAddress(contractAddress) {
|
|
67
|
-
const contractClassId = await this.#getContractClassId(contractAddress);
|
|
68
|
-
return contractClassId && this.getContractArtifact(contractClassId);
|
|
69
|
-
}
|
|
70
|
-
// Public getters
|
|
71
|
-
async getContractsAddresses() {
|
|
72
|
-
const keys = await toArray(this.#contractInstances.keysAsync());
|
|
73
|
-
return keys.map(AztecAddress.fromString);
|
|
74
|
-
}
|
|
75
|
-
/** Returns a contract instance for a given address. Throws if not found. */ async getContractInstance(contractAddress) {
|
|
76
|
-
const contract = await this.#contractInstances.getAsync(contractAddress.toString());
|
|
77
|
-
return contract && SerializableContractInstance.fromBuffer(contract).withAddress(contractAddress);
|
|
78
|
-
}
|
|
79
|
-
async getContractArtifact(contractClassId) {
|
|
80
|
-
const contract = await this.#contractArtifacts.getAsync(contractClassId.toString());
|
|
81
|
-
// TODO(@spalladino): AztecAsyncMap lies and returns Uint8Arrays instead of Buffers, hence the extra Buffer.from.
|
|
82
|
-
return contract && contractArtifactFromBuffer(Buffer.from(contract));
|
|
83
|
-
}
|
|
84
|
-
/** Returns a contract class for a given class id. Throws if not found. */ async getContractClass(contractClassId) {
|
|
85
|
-
const artifact = await this.getContractArtifact(contractClassId);
|
|
86
|
-
return artifact && getContractClassFromArtifact(artifact);
|
|
87
|
-
}
|
|
88
|
-
async getContract(address) {
|
|
89
|
-
const instance = await this.getContractInstance(address);
|
|
90
|
-
if (!instance) {
|
|
91
|
-
return;
|
|
92
|
-
}
|
|
93
|
-
const artifact = await this.getContractArtifact(instance.currentContractClassId);
|
|
94
|
-
if (!artifact) {
|
|
95
|
-
return;
|
|
96
|
-
}
|
|
97
|
-
return {
|
|
98
|
-
...instance,
|
|
99
|
-
...artifact
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* Retrieves the artifact of a specified function within a given contract.
|
|
104
|
-
* The function is identified by its selector, which is a unique code generated from the function's signature.
|
|
105
|
-
* Throws an error if the contract address or function selector are invalid or not found.
|
|
106
|
-
*
|
|
107
|
-
* @param contractAddress - The AztecAddress representing the contract containing the function.
|
|
108
|
-
* @param selector - The function selector.
|
|
109
|
-
* @returns The corresponding function's artifact as an object.
|
|
110
|
-
*/ async getFunctionArtifact(contractAddress, selector) {
|
|
111
|
-
const artifact = await this.#getContractArtifactByAddress(contractAddress);
|
|
112
|
-
const fnArtifact = artifact && await this.#findFunctionArtifactBySelector(artifact, selector);
|
|
113
|
-
return fnArtifact && {
|
|
114
|
-
...fnArtifact,
|
|
115
|
-
contractName: artifact.name
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
async getFunctionArtifactWithDebugMetadata(contractAddress, selector) {
|
|
119
|
-
const artifact = await this.getFunctionArtifact(contractAddress, selector);
|
|
120
|
-
if (!artifact) {
|
|
121
|
-
throw new Error(`Function artifact not found for contract ${contractAddress} and selector ${selector}.`);
|
|
122
|
-
}
|
|
123
|
-
const debug = await this.getFunctionDebugMetadata(contractAddress, selector);
|
|
124
|
-
return {
|
|
125
|
-
...artifact,
|
|
126
|
-
debug
|
|
127
|
-
};
|
|
128
|
-
}
|
|
129
|
-
async getPublicFunctionArtifact(contractAddress) {
|
|
130
|
-
const artifact = await this.#getContractArtifactByAddress(contractAddress);
|
|
131
|
-
const fnArtifact = artifact && artifact.functions.find((fn)=>fn.functionType === FunctionType.PUBLIC);
|
|
132
|
-
return fnArtifact && {
|
|
133
|
-
...fnArtifact,
|
|
134
|
-
contractName: artifact.name
|
|
135
|
-
};
|
|
136
|
-
}
|
|
137
|
-
async getFunctionAbi(contractAddress, selector) {
|
|
138
|
-
const artifact = await this.#getContractArtifactByAddress(contractAddress);
|
|
139
|
-
return artifact && await this.#findFunctionAbiBySelector(artifact, selector);
|
|
140
|
-
}
|
|
141
|
-
/**
|
|
142
|
-
* Retrieves the debug metadata of a specified function within a given contract.
|
|
143
|
-
* The function is identified by its selector, which is a unique code generated from the function's signature.
|
|
144
|
-
* Returns undefined if the debug metadata for the given function is not found.
|
|
145
|
-
* Throws if the contract has not been added to the database.
|
|
146
|
-
*
|
|
147
|
-
* @param contractAddress - The AztecAddress representing the contract containing the function.
|
|
148
|
-
* @param selector - The function selector.
|
|
149
|
-
* @returns The corresponding function's artifact as an object.
|
|
150
|
-
*/ async getFunctionDebugMetadata(contractAddress, selector) {
|
|
151
|
-
const artifact = await this.#getContractArtifactByAddress(contractAddress);
|
|
152
|
-
const fnArtifact = artifact && await this.#findFunctionArtifactBySelector(artifact, selector);
|
|
153
|
-
return fnArtifact && getFunctionDebugMetadata(artifact, fnArtifact);
|
|
154
|
-
}
|
|
155
|
-
async getPublicFunctionDebugMetadata(contractAddress) {
|
|
156
|
-
const artifact = await this.#getContractArtifactByAddress(contractAddress);
|
|
157
|
-
const fnArtifact = artifact && artifact.functions.find((fn)=>fn.functionType === FunctionType.PUBLIC);
|
|
158
|
-
return fnArtifact && getFunctionDebugMetadata(artifact, fnArtifact);
|
|
159
|
-
}
|
|
160
|
-
/**
|
|
161
|
-
* Retrieve the function membership witness for the given contract class and function selector.
|
|
162
|
-
* The function membership witness represents a proof that the function belongs to the specified contract.
|
|
163
|
-
* Throws an error if the contract address or function selector is unknown.
|
|
164
|
-
*
|
|
165
|
-
* @param contractClassId - The id of the class.
|
|
166
|
-
* @param selector - The function selector.
|
|
167
|
-
* @returns A promise that resolves with the MembershipWitness instance for the specified contract's function.
|
|
168
|
-
*/ async getFunctionMembershipWitness(contractClassId, selector) {
|
|
169
|
-
const tree = await this.#getPrivateFunctionTreeForClassId(contractClassId);
|
|
170
|
-
return tree?.getFunctionMembershipWitness(selector);
|
|
171
|
-
}
|
|
172
|
-
async getDebugContractName(contractAddress) {
|
|
173
|
-
const artifact = await this.#getContractArtifactByAddress(contractAddress);
|
|
174
|
-
return artifact?.name;
|
|
175
|
-
}
|
|
176
|
-
async getDebugFunctionName(contractAddress, selector) {
|
|
177
|
-
const artifact = await this.#getContractArtifactByAddress(contractAddress);
|
|
178
|
-
const fnArtifact = artifact && await this.#findFunctionAbiBySelector(artifact, selector);
|
|
179
|
-
return `${artifact?.name ?? contractAddress}:${fnArtifact?.name ?? selector}`;
|
|
180
|
-
}
|
|
181
|
-
async #findFunctionArtifactBySelector(artifact, selector) {
|
|
182
|
-
const functions = artifact.functions;
|
|
183
|
-
for(let i = 0; i < functions.length; i++){
|
|
184
|
-
const fn = functions[i];
|
|
185
|
-
const fnSelector = await FunctionSelector.fromNameAndParameters(fn.name, fn.parameters);
|
|
186
|
-
if (fnSelector.equals(selector)) {
|
|
187
|
-
return fn;
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
async #findFunctionAbiBySelector(artifact, selector) {
|
|
192
|
-
const functions = [
|
|
193
|
-
...artifact.functions,
|
|
194
|
-
...artifact.nonDispatchPublicFunctions ?? []
|
|
195
|
-
];
|
|
196
|
-
for(let i = 0; i < functions.length; i++){
|
|
197
|
-
const fn = functions[i];
|
|
198
|
-
const fnSelector = await FunctionSelector.fromNameAndParameters(fn.name, fn.parameters);
|
|
199
|
-
if (fnSelector.equals(selector)) {
|
|
200
|
-
return fn;
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
async getFunctionCall(functionName, args, to) {
|
|
205
|
-
const contract = await this.getContract(to);
|
|
206
|
-
if (!contract) {
|
|
207
|
-
throw new Error(`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`);
|
|
208
|
-
}
|
|
209
|
-
const functionDao = contract.functions.find((f)=>f.name === functionName);
|
|
210
|
-
if (!functionDao) {
|
|
211
|
-
throw new Error(`Unknown function ${functionName} in contract ${contract.name}.`);
|
|
212
|
-
}
|
|
213
|
-
return {
|
|
214
|
-
name: functionDao.name,
|
|
215
|
-
args: encodeArguments(functionDao, args),
|
|
216
|
-
selector: await FunctionSelector.fromNameAndParameters(functionDao.name, functionDao.parameters),
|
|
217
|
-
type: functionDao.functionType,
|
|
218
|
-
to,
|
|
219
|
-
hideMsgSender: false,
|
|
220
|
-
isStatic: functionDao.isStatic,
|
|
221
|
-
returnTypes: functionDao.returnTypes
|
|
222
|
-
};
|
|
223
|
-
}
|
|
224
|
-
}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
export { ContractDataProvider } from './contract_data_provider.js';
|
|
2
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9zdG9yYWdlL2NvbnRyYWN0X2RhdGFfcHJvdmlkZXIvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLG9CQUFvQixFQUFFLE1BQU0sNkJBQTZCLENBQUMifQ==
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/storage/contract_data_provider/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { ContractDataProvider } from './contract_data_provider.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"private_functions_tree.d.ts","sourceRoot":"","sources":["../../../src/storage/contract_data_provider/private_functions_tree.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAGxD,OAAO,EAAE,iBAAiB,EAAmB,MAAM,yBAAyB,CAAC;AAC7E,OAAO,EAAE,KAAK,gBAAgB,EAAE,gBAAgB,EAAgB,MAAM,mBAAmB,CAAC;AAQ1F;;;;;GAKG;AACH,qBAAa,oBAAoB;IAGX,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IAFrD,OAAO,CAAC,IAAI,CAAC,CAAa;IAE1B,OAAO,eAAqE;IAE5E,OAAa,MAAM,CAAC,QAAQ,EAAE,gBAAgB,iCAO7C;IAED;;;;;;;;OAQG;IACU,4BAA4B,CACvC,QAAQ,EAAE,gBAAgB,GACzB,OAAO,CAAC,iBAAiB,CAAC,OAAO,oBAAoB,CAAC,CAAC,CAezD;YAEa,OAAO;CAMtB"}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
export { NoteDao } from '@aztec/stdlib/note';
|
|
2
|
-
export { NoteDataProvider } from './note_data_provider.js';
|
|
3
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9zdG9yYWdlL25vdGVfZGF0YV9wcm92aWRlci9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsT0FBTyxFQUFFLE1BQU0sb0JBQW9CLENBQUM7QUFDN0MsT0FBTyxFQUFFLGdCQUFnQixFQUFFLE1BQU0seUJBQXlCLENBQUMifQ==
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/storage/note_data_provider/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC"}
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
|
-
import type { AztecAsyncKVStore } from '@aztec/kv-store';
|
|
3
|
-
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
|
-
import type { DataInBlock } from '@aztec/stdlib/block';
|
|
5
|
-
import { type NotesFilter } from '@aztec/stdlib/note';
|
|
6
|
-
import { NoteDao } from '@aztec/stdlib/note';
|
|
7
|
-
/**
|
|
8
|
-
* NoteDataProvider manages the storage and retrieval of notes.
|
|
9
|
-
*
|
|
10
|
-
* Notes can be active or nullified. This class processes new notes, nullifications,
|
|
11
|
-
* and performs rollback handling in the case of a reorg.
|
|
12
|
-
**/
|
|
13
|
-
export declare class NoteDataProvider {
|
|
14
|
-
#private;
|
|
15
|
-
private constructor();
|
|
16
|
-
/**
|
|
17
|
-
* Creates and initializes a new NoteDataProvider instance.
|
|
18
|
-
*
|
|
19
|
-
* This factory method creates a NoteDataProvider and restores any existing
|
|
20
|
-
* scope-specific indexes from the database.
|
|
21
|
-
*
|
|
22
|
-
* @param store - The key-value store to use for persistence
|
|
23
|
-
* @returns Promise resolving to a fully initialized NoteDataProvider instance
|
|
24
|
-
*/
|
|
25
|
-
static create(store: AztecAsyncKVStore): Promise<NoteDataProvider>;
|
|
26
|
-
/**
|
|
27
|
-
* Adds a new scope to the note data provider.
|
|
28
|
-
*
|
|
29
|
-
* Scopes provide privacy isolation by creating separate indexes for each user.
|
|
30
|
-
* Each scope gets its own set of indexes for efficient note retrieval by various criteria.
|
|
31
|
-
*
|
|
32
|
-
* @param scope - The AztecAddress representing the scope/user to add
|
|
33
|
-
* @returns Promise resolving to true if scope was added, false if it already existed
|
|
34
|
-
*/
|
|
35
|
-
addScope(scope: AztecAddress): Promise<boolean>;
|
|
36
|
-
/**
|
|
37
|
-
* Adds multiple notes to the data provider under the specified scope.
|
|
38
|
-
*
|
|
39
|
-
* Notes are stored using their index from the notes hash tree as the key, which provides
|
|
40
|
-
* uniqueness and maintains creation order. Each note is indexed by multiple criteria
|
|
41
|
-
* for efficient retrieval.
|
|
42
|
-
*
|
|
43
|
-
* @param notes - Notes to store
|
|
44
|
-
* @param scope - The scope (user/account) under which to store the notes
|
|
45
|
-
*/
|
|
46
|
-
addNotes(notes: NoteDao[], scope: AztecAddress): Promise<void>;
|
|
47
|
-
/**
|
|
48
|
-
* Synchronizes notes and nullifiers to a specific block number.
|
|
49
|
-
*
|
|
50
|
-
* This method ensures that the state of notes and nullifiers is consistent with the
|
|
51
|
-
* specified block number. It restores any notes that were nullified after the given block
|
|
52
|
-
* and deletes any active notes created after that block.
|
|
53
|
-
*
|
|
54
|
-
* @param blockNumber - The new chain tip after a reorg
|
|
55
|
-
* @param synchedBlockNumber - The block number up to which PXE managed to sync before the reorg happened.
|
|
56
|
-
*/
|
|
57
|
-
rollbackNotesAndNullifiers(blockNumber: number, synchedBlockNumber: number): Promise<void>;
|
|
58
|
-
/**
|
|
59
|
-
* Retrieves notes based on the provided filter criteria.
|
|
60
|
-
*
|
|
61
|
-
* This method queries both active and optionally nullified notes based on the filter
|
|
62
|
-
* parameters.
|
|
63
|
-
*
|
|
64
|
-
* @param filter - Filter criteria including contractAddress (required), and optional
|
|
65
|
-
* owner, storageSlot, status, scopes, and siloedNullifier.
|
|
66
|
-
* @returns Filtered and deduplicated notes (a note might be present in multiple scopes - we ensure it is only
|
|
67
|
-
* returned once if this is the case)
|
|
68
|
-
* @throws If filtering by an empty scopes array. Scopes have to be set to undefined or to a non-empty array.
|
|
69
|
-
*/
|
|
70
|
-
getNotes(filter: NotesFilter): Promise<NoteDao[]>;
|
|
71
|
-
/**
|
|
72
|
-
* Transitions notes from "active" to "nullified" state.
|
|
73
|
-
*
|
|
74
|
-
* This operation processes a batch of nullifiers to mark the corresponding notes
|
|
75
|
-
* as spent/nullified. The operation is atomic - if any nullifier is not found,
|
|
76
|
-
* the entire operation fails and no notes are modified.
|
|
77
|
-
*
|
|
78
|
-
* @param nullifiers - Array of nullifiers with their block numbers to process
|
|
79
|
-
* @returns Promise resolving to array of nullified NoteDao objects
|
|
80
|
-
* @throws Error if any nullifier is not found in the active notes
|
|
81
|
-
*/
|
|
82
|
-
applyNullifiers(nullifiers: DataInBlock<Fr>[]): Promise<NoteDao[]>;
|
|
83
|
-
}
|
|
84
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibm90ZV9kYXRhX3Byb3ZpZGVyLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvc3RvcmFnZS9ub3RlX2RhdGFfcHJvdmlkZXIvbm90ZV9kYXRhX3Byb3ZpZGVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUNBLE9BQU8sS0FBSyxFQUFFLEVBQUUsRUFBRSxNQUFNLGdDQUFnQyxDQUFDO0FBRXpELE9BQU8sS0FBSyxFQUFFLGlCQUFpQixFQUFxQyxNQUFNLGlCQUFpQixDQUFDO0FBQzVGLE9BQU8sRUFBRSxZQUFZLEVBQUUsTUFBTSw2QkFBNkIsQ0FBQztBQUMzRCxPQUFPLEtBQUssRUFBRSxXQUFXLEVBQUUsTUFBTSxxQkFBcUIsQ0FBQztBQUN2RCxPQUFPLEVBQWMsS0FBSyxXQUFXLEVBQUUsTUF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