@aztec/pxe 0.0.1-commit.b655e406 → 0.0.1-commit.c0b82b2
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.d.ts +1 -1
- 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 -12
- package/dest/config/index.d.ts.map +1 -1
- package/dest/config/index.js +24 -13
- package/dest/config/package_info.d.ts +1 -1
- package/dest/config/package_info.js +1 -1
- package/dest/contract_function_simulator/benchmarked_node.d.ts +9 -0
- package/dest/contract_function_simulator/benchmarked_node.d.ts.map +1 -0
- package/dest/contract_function_simulator/benchmarked_node.js +77 -0
- package/dest/contract_function_simulator/contract_function_simulator.d.ts +78 -26
- package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.js +226 -82
- package/dest/contract_function_simulator/execution_note_cache.d.ts +25 -14
- package/dest/contract_function_simulator/execution_note_cache.d.ts.map +1 -1
- package/dest/contract_function_simulator/execution_note_cache.js +59 -34
- package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts +6 -6
- package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts.map +1 -1
- package/dest/contract_function_simulator/execution_tagging_index_cache.js +4 -4
- 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 +3 -3
- package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/log_retrieval_response.js +1 -1
- package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +7 -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 +13 -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/index.d.ts +1 -1
- package/dest/contract_function_simulator/oracle/interfaces.d.ts +30 -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 +2 -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 +14 -8
- package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/note_packing_utils.js +16 -11
- package/dest/contract_function_simulator/oracle/oracle.d.ts +15 -12
- package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/oracle.js +93 -53
- 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 +56 -52
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.js +120 -66
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +114 -39
- 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 +33 -10
- 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 +34 -11
- 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 +40 -28
- 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 +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} +144 -77
- 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/index.d.ts +1 -1
- 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 +33 -25
- 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 +121 -103
- package/dest/pxe.d.ts.map +1 -1
- package/dest/pxe.js +268 -279
- 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/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/{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 +2 -2
- 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 +14 -0
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts.map +1 -0
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.js +99 -0
- package/dest/tagging/recipient_sync/utils/find_highest_indexes.d.ts +12 -0
- package/dest/tagging/recipient_sync/utils/find_highest_indexes.d.ts.map +1 -0
- package/dest/tagging/recipient_sync/utils/find_highest_indexes.js +20 -0
- package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts +14 -0
- package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts.map +1 -0
- package/dest/tagging/recipient_sync/utils/load_logs_for_range.js +33 -0
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts +17 -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 +71 -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 +18 -0
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts.map +1 -0
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.js +59 -0
- package/package.json +29 -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 +24 -25
- 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 +396 -116
- package/src/contract_function_simulator/execution_note_cache.ts +58 -28
- package/src/contract_function_simulator/execution_tagging_index_cache.ts +6 -6
- 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 +2 -2
- package/src/contract_function_simulator/noir-structs/note_validation_request.ts +15 -3
- package/src/contract_function_simulator/noir-structs/utility_context.ts +6 -25
- package/src/contract_function_simulator/oracle/interfaces.ts +43 -18
- package/src/contract_function_simulator/oracle/message_load_oracle_inputs.ts +1 -1
- package/src/contract_function_simulator/oracle/note_packing_utils.ts +30 -14
- package/src/contract_function_simulator/oracle/oracle.ts +111 -49
- package/src/contract_function_simulator/oracle/private_execution.ts +2 -68
- package/src/contract_function_simulator/oracle/private_execution_oracle.ts +166 -98
- 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 +25 -18
- package/src/entrypoints/client/lazy/index.ts +3 -1
- package/src/entrypoints/client/lazy/utils.ts +26 -19
- package/src/entrypoints/pxe_creation_options.ts +6 -2
- package/src/entrypoints/server/index.ts +5 -1
- package/src/entrypoints/server/utils.ts +34 -56
- 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 +213 -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} +199 -145
- package/src/private_kernel/hints/test_utils.ts +325 -0
- package/src/private_kernel/private_kernel_execution_prover.ts +38 -34
- package/src/private_kernel/private_kernel_oracle.ts +118 -37
- package/src/pxe.ts +410 -382
- 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 +143 -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 +140 -0
- package/src/tagging/recipient_sync/utils/find_highest_indexes.ts +34 -0
- package/src/tagging/recipient_sync/utils/load_logs_for_range.ts +44 -0
- package/src/tagging/sender_sync/sync_sender_tagging_indexes.ts +94 -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 +75 -0
- package/dest/contract_function_simulator/execution_data_provider.d.ts +0 -274
- 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 -701
- 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 -74
- 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 -205
- 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_dao.d.ts +0 -100
- package/dest/storage/note_data_provider/note_dao.d.ts.map +0 -1
- package/dest/storage/note_data_provider/note_dao.js +0 -102
- package/dest/storage/note_data_provider/note_data_provider.d.ts +0 -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 -308
- package/dest/storage/private_event_data_provider/private_event_data_provider.d.ts +0 -43
- 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 -104
- package/dest/storage/sync_data_provider/index.d.ts +0 -2
- package/dest/storage/sync_data_provider/index.d.ts.map +0 -1
- package/dest/storage/sync_data_provider/index.js +0 -1
- package/dest/storage/sync_data_provider/sync_data_provider.d.ts +0 -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 -343
- package/src/contract_function_simulator/proxied_node.ts +0 -33
- package/src/contract_function_simulator/pxe_oracle_interface.ts +0 -1019
- 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 -294
- 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_dao.ts +0 -154
- package/src/storage/note_data_provider/note_data_provider.ts +0 -393
- package/src/storage/private_event_data_provider/private_event_data_provider.ts +0 -148
- 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
|
@@ -1,205 +0,0 @@
|
|
|
1
|
-
import { toArray } from '@aztec/foundation/iterable';
|
|
2
|
-
import { FunctionSelector, FunctionType, contractArtifactFromBuffer, contractArtifactToBuffer, 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 getPublicFunctionArtifact(contractAddress) {
|
|
119
|
-
const artifact = await this.#getContractArtifactByAddress(contractAddress);
|
|
120
|
-
const fnArtifact = artifact && artifact.functions.find((fn)=>fn.functionType === FunctionType.PUBLIC);
|
|
121
|
-
return fnArtifact && {
|
|
122
|
-
...fnArtifact,
|
|
123
|
-
contractName: artifact.name
|
|
124
|
-
};
|
|
125
|
-
}
|
|
126
|
-
/**
|
|
127
|
-
* Retrieves the artifact of a specified function within a given contract.
|
|
128
|
-
* The function is identified by its name, which is unique within a contract.
|
|
129
|
-
* Throws if the contract has not been added to the database.
|
|
130
|
-
*
|
|
131
|
-
* @param contractAddress - The AztecAddress representing the contract containing the function.
|
|
132
|
-
* @param functionName - The name of the function.
|
|
133
|
-
* @returns The corresponding function's artifact as an object
|
|
134
|
-
*/ async getFunctionArtifactByName(contractAddress, functionName) {
|
|
135
|
-
const artifact = await this.#getContractArtifactByAddress(contractAddress);
|
|
136
|
-
return artifact?.functions.find((fn)=>fn.name === functionName);
|
|
137
|
-
}
|
|
138
|
-
async getFunctionAbi(contractAddress, selector) {
|
|
139
|
-
const artifact = await this.#getContractArtifactByAddress(contractAddress);
|
|
140
|
-
return artifact && await this.#findFunctionAbiBySelector(artifact, selector);
|
|
141
|
-
}
|
|
142
|
-
/**
|
|
143
|
-
* Retrieves the debug metadata of a specified function within a given contract.
|
|
144
|
-
* The function is identified by its selector, which is a unique code generated from the function's signature.
|
|
145
|
-
* Returns undefined if the debug metadata for the given function is not found.
|
|
146
|
-
* Throws if the contract has not been added to the database.
|
|
147
|
-
*
|
|
148
|
-
* @param contractAddress - The AztecAddress representing the contract containing the function.
|
|
149
|
-
* @param selector - The function selector.
|
|
150
|
-
* @returns The corresponding function's artifact as an object.
|
|
151
|
-
*/ async getFunctionDebugMetadata(contractAddress, selector) {
|
|
152
|
-
const artifact = await this.#getContractArtifactByAddress(contractAddress);
|
|
153
|
-
const fnArtifact = artifact && await this.#findFunctionArtifactBySelector(artifact, selector);
|
|
154
|
-
return fnArtifact && getFunctionDebugMetadata(artifact, fnArtifact);
|
|
155
|
-
}
|
|
156
|
-
async getPublicFunctionDebugMetadata(contractAddress) {
|
|
157
|
-
const artifact = await this.#getContractArtifactByAddress(contractAddress);
|
|
158
|
-
const fnArtifact = artifact && artifact.functions.find((fn)=>fn.functionType === FunctionType.PUBLIC);
|
|
159
|
-
return fnArtifact && getFunctionDebugMetadata(artifact, fnArtifact);
|
|
160
|
-
}
|
|
161
|
-
/**
|
|
162
|
-
* Retrieve the function membership witness for the given contract class and function selector.
|
|
163
|
-
* The function membership witness represents a proof that the function belongs to the specified contract.
|
|
164
|
-
* Throws an error if the contract address or function selector is unknown.
|
|
165
|
-
*
|
|
166
|
-
* @param contractClassId - The id of the class.
|
|
167
|
-
* @param selector - The function selector.
|
|
168
|
-
* @returns A promise that resolves with the MembershipWitness instance for the specified contract's function.
|
|
169
|
-
*/ async getFunctionMembershipWitness(contractClassId, selector) {
|
|
170
|
-
const tree = await this.#getPrivateFunctionTreeForClassId(contractClassId);
|
|
171
|
-
return tree?.getFunctionMembershipWitness(selector);
|
|
172
|
-
}
|
|
173
|
-
async getDebugContractName(contractAddress) {
|
|
174
|
-
const artifact = await this.#getContractArtifactByAddress(contractAddress);
|
|
175
|
-
return artifact?.name;
|
|
176
|
-
}
|
|
177
|
-
async getDebugFunctionName(contractAddress, selector) {
|
|
178
|
-
const artifact = await this.#getContractArtifactByAddress(contractAddress);
|
|
179
|
-
const fnArtifact = artifact && await this.#findFunctionAbiBySelector(artifact, selector);
|
|
180
|
-
return `${artifact?.name ?? contractAddress}:${fnArtifact?.name ?? selector}`;
|
|
181
|
-
}
|
|
182
|
-
async #findFunctionArtifactBySelector(artifact, selector) {
|
|
183
|
-
const functions = artifact.functions;
|
|
184
|
-
for(let i = 0; i < functions.length; i++){
|
|
185
|
-
const fn = functions[i];
|
|
186
|
-
const fnSelector = await FunctionSelector.fromNameAndParameters(fn.name, fn.parameters);
|
|
187
|
-
if (fnSelector.equals(selector)) {
|
|
188
|
-
return fn;
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
async #findFunctionAbiBySelector(artifact, selector) {
|
|
193
|
-
const functions = [
|
|
194
|
-
...artifact.functions,
|
|
195
|
-
...artifact.nonDispatchPublicFunctions ?? []
|
|
196
|
-
];
|
|
197
|
-
for(let i = 0; i < functions.length; i++){
|
|
198
|
-
const fn = functions[i];
|
|
199
|
-
const fnSelector = await FunctionSelector.fromNameAndParameters(fn.name, fn.parameters);
|
|
200
|
-
if (fnSelector.equals(selector)) {
|
|
201
|
-
return fn;
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
}
|
|
@@ -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;WAEM,MAAM,CAAC,QAAQ,EAAE,gBAAgB;IAS9C;;;;;;;;OAQG;IACU,4BAA4B,CACvC,QAAQ,EAAE,gBAAgB,GACzB,OAAO,CAAC,iBAAiB,CAAC,OAAO,oBAAoB,CAAC,CAAC;YAiB5C,OAAO;CAMtB"}
|
|
@@ -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,eAAe,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC"}
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import { Fr } from '@aztec/foundation/fields';
|
|
2
|
-
import { BufferReader } from '@aztec/foundation/serialize';
|
|
3
|
-
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
|
-
import { Note } from '@aztec/stdlib/note';
|
|
5
|
-
import { TxHash } from '@aztec/stdlib/tx';
|
|
6
|
-
import type { NoteData } from '../../contract_function_simulator/oracle/interfaces.js';
|
|
7
|
-
/**
|
|
8
|
-
* A Note Data Access Object, representing a note that was committed to the note hash tree, holding all of the
|
|
9
|
-
* information required to use it during execution and manage its state.
|
|
10
|
-
*/
|
|
11
|
-
export declare class NoteDao implements NoteData {
|
|
12
|
-
/** The packed content of the note, as will be returned in the getNotes oracle. */
|
|
13
|
-
note: Note;
|
|
14
|
-
/** The address of the contract that created the note (i.e. the address used by the kernel during siloing). */
|
|
15
|
-
contractAddress: AztecAddress;
|
|
16
|
-
/**
|
|
17
|
-
* The storage location of the note. This value is not used for anything in PXE, but we do index by storage slot
|
|
18
|
-
* since contracts typically make queries based on it.
|
|
19
|
-
*/
|
|
20
|
-
storageSlot: Fr;
|
|
21
|
-
/** The nonce that was injected into the note hash preimage in order to guarantee uniqueness. */
|
|
22
|
-
noteNonce: Fr;
|
|
23
|
-
/**
|
|
24
|
-
* The inner hash (non-unique, non-siloed) of the note. Each contract determines how the note is hashed. Can
|
|
25
|
-
* be used alongside contractAddress and nonce to compute the uniqueNoteHash and the siloedNoteHash.
|
|
26
|
-
*/
|
|
27
|
-
noteHash: Fr;
|
|
28
|
-
/**
|
|
29
|
-
* The nullifier of the note, siloed by contract address.
|
|
30
|
-
* Note: Might be set as 0 if the note was added to PXE as nullified.
|
|
31
|
-
*/
|
|
32
|
-
siloedNullifier: Fr;
|
|
33
|
-
/** The hash of the tx in which this note was created. Knowing the tx hash allows for efficient node queries e.g.
|
|
34
|
-
* when searching for txEffects.
|
|
35
|
-
*/
|
|
36
|
-
txHash: TxHash;
|
|
37
|
-
/** The L2 block number in which the tx with this note was included. Used for note management while processing
|
|
38
|
-
* reorgs.*/
|
|
39
|
-
l2BlockNumber: number;
|
|
40
|
-
/** The L2 block hash in which the tx with this note was included. Used for note management while processing
|
|
41
|
-
* reorgs.*/
|
|
42
|
-
l2BlockHash: string;
|
|
43
|
-
/** The index of the leaf in the global note hash tree the note is stored at */
|
|
44
|
-
index: bigint;
|
|
45
|
-
/**
|
|
46
|
-
* The address whose public key was used to encrypt the note log during delivery.
|
|
47
|
-
* (This is the x-coordinate of the public key.)
|
|
48
|
-
*/
|
|
49
|
-
recipient: AztecAddress;
|
|
50
|
-
constructor(
|
|
51
|
-
/** The packed content of the note, as will be returned in the getNotes oracle. */
|
|
52
|
-
note: Note,
|
|
53
|
-
/** The address of the contract that created the note (i.e. the address used by the kernel during siloing). */
|
|
54
|
-
contractAddress: AztecAddress,
|
|
55
|
-
/**
|
|
56
|
-
* The storage location of the note. This value is not used for anything in PXE, but we do index by storage slot
|
|
57
|
-
* since contracts typically make queries based on it.
|
|
58
|
-
*/
|
|
59
|
-
storageSlot: Fr,
|
|
60
|
-
/** The nonce that was injected into the note hash preimage in order to guarantee uniqueness. */
|
|
61
|
-
noteNonce: Fr,
|
|
62
|
-
/**
|
|
63
|
-
* The inner hash (non-unique, non-siloed) of the note. Each contract determines how the note is hashed. Can
|
|
64
|
-
* be used alongside contractAddress and nonce to compute the uniqueNoteHash and the siloedNoteHash.
|
|
65
|
-
*/
|
|
66
|
-
noteHash: Fr,
|
|
67
|
-
/**
|
|
68
|
-
* The nullifier of the note, siloed by contract address.
|
|
69
|
-
* Note: Might be set as 0 if the note was added to PXE as nullified.
|
|
70
|
-
*/
|
|
71
|
-
siloedNullifier: Fr,
|
|
72
|
-
/** The hash of the tx in which this note was created. Knowing the tx hash allows for efficient node queries e.g.
|
|
73
|
-
* when searching for txEffects.
|
|
74
|
-
*/
|
|
75
|
-
txHash: TxHash,
|
|
76
|
-
/** The L2 block number in which the tx with this note was included. Used for note management while processing
|
|
77
|
-
* reorgs.*/
|
|
78
|
-
l2BlockNumber: number,
|
|
79
|
-
/** The L2 block hash in which the tx with this note was included. Used for note management while processing
|
|
80
|
-
* reorgs.*/
|
|
81
|
-
l2BlockHash: string,
|
|
82
|
-
/** The index of the leaf in the global note hash tree the note is stored at */
|
|
83
|
-
index: bigint,
|
|
84
|
-
/**
|
|
85
|
-
* The address whose public key was used to encrypt the note log during delivery.
|
|
86
|
-
* (This is the x-coordinate of the public key.)
|
|
87
|
-
*/
|
|
88
|
-
recipient: AztecAddress);
|
|
89
|
-
toBuffer(): Buffer;
|
|
90
|
-
static fromBuffer(buffer: Buffer | BufferReader): NoteDao;
|
|
91
|
-
toString(): string;
|
|
92
|
-
static fromString(str: string): NoteDao;
|
|
93
|
-
/**
|
|
94
|
-
* Returns the size in bytes of the Note Dao.
|
|
95
|
-
* @returns - Its size in bytes.
|
|
96
|
-
*/
|
|
97
|
-
getSize(): number;
|
|
98
|
-
static random({ note, contractAddress, storageSlot, noteNonce, noteHash, siloedNullifier, txHash, l2BlockNumber, l2BlockHash, index, recipient, }?: Partial<NoteDao>): Promise<NoteDao>;
|
|
99
|
-
}
|
|
100
|
-
//# sourceMappingURL=note_dao.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"note_dao.d.ts","sourceRoot":"","sources":["../../../src/storage/note_data_provider/note_dao.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAS,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAE,YAAY,EAAqB,MAAM,6BAA6B,CAAC;AAC9E,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE1C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wDAAwD,CAAC;AAEvF;;;GAGG;AACH,qBAAa,OAAQ,YAAW,QAAQ;IAIpC,kFAAkF;IAC3E,IAAI,EAAE,IAAI;IACjB,8GAA8G;IACvG,eAAe,EAAE,YAAY;IACpC;;;OAGG;IACI,WAAW,EAAE,EAAE;IACtB,gGAAgG;IACzF,SAAS,EAAE,EAAE;IAGpB;;;OAGG;IACI,QAAQ,EAAE,EAAE;IACnB;;;OAGG;IACI,eAAe,EAAE,EAAE;IAG1B;;OAEG;IACI,MAAM,EAAE,MAAM;IACrB;gBACY;IACL,aAAa,EAAE,MAAM;IAC5B;gBACY;IACL,WAAW,EAAE,MAAM;IAC1B,+EAA+E;IACxE,KAAK,EAAE,MAAM;IACpB;;;OAGG;IACI,SAAS,EAAE,YAAY;;IAzC9B,kFAAkF;IAC3E,IAAI,EAAE,IAAI;IACjB,8GAA8G;IACvG,eAAe,EAAE,YAAY;IACpC;;;OAGG;IACI,WAAW,EAAE,EAAE;IACtB,gGAAgG;IACzF,SAAS,EAAE,EAAE;IAGpB;;;OAGG;IACI,QAAQ,EAAE,EAAE;IACnB;;;OAGG;IACI,eAAe,EAAE,EAAE;IAG1B;;OAEG;IACI,MAAM,EAAE,MAAM;IACrB;gBACY;IACL,aAAa,EAAE,MAAM;IAC5B;gBACY;IACL,WAAW,EAAE,MAAM;IAC1B,+EAA+E;IACxE,KAAK,EAAE,MAAM;IACpB;;;OAGG;IACI,SAAS,EAAE,YAAY;IAGhC,QAAQ,IAAI,MAAM;IAgBlB,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY;IA8B/C,QAAQ;IAIR,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,MAAM;IAK7B;;;OAGG;IACI,OAAO;WAMD,MAAM,CAAC,EAClB,IAAoB,EACpB,eAA2B,EAC3B,WAAyB,EACzB,SAAuB,EACvB,QAAsB,EACtB,eAA6B,EAC7B,MAAwB,EACxB,aAAgD,EAChD,WAAoC,EACpC,KAA8B,EAC9B,SAAqB,GACtB,GAAE,OAAO,CAAC,OAAO,CAAM;CAezB"}
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import { toBigIntBE } from '@aztec/foundation/bigint-buffer';
|
|
2
|
-
import { Fr, Point } from '@aztec/foundation/fields';
|
|
3
|
-
import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
4
|
-
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
5
|
-
import { Note } from '@aztec/stdlib/note';
|
|
6
|
-
import { TxHash } from '@aztec/stdlib/tx';
|
|
7
|
-
/**
|
|
8
|
-
* A Note Data Access Object, representing a note that was committed to the note hash tree, holding all of the
|
|
9
|
-
* information required to use it during execution and manage its state.
|
|
10
|
-
*/ export class NoteDao {
|
|
11
|
-
note;
|
|
12
|
-
contractAddress;
|
|
13
|
-
storageSlot;
|
|
14
|
-
noteNonce;
|
|
15
|
-
noteHash;
|
|
16
|
-
siloedNullifier;
|
|
17
|
-
txHash;
|
|
18
|
-
l2BlockNumber;
|
|
19
|
-
l2BlockHash;
|
|
20
|
-
index;
|
|
21
|
-
recipient;
|
|
22
|
-
constructor(// Note information
|
|
23
|
-
/** The packed content of the note, as will be returned in the getNotes oracle. */ note, /** The address of the contract that created the note (i.e. the address used by the kernel during siloing). */ contractAddress, /**
|
|
24
|
-
* The storage location of the note. This value is not used for anything in PXE, but we do index by storage slot
|
|
25
|
-
* since contracts typically make queries based on it.
|
|
26
|
-
*/ storageSlot, /** The nonce that was injected into the note hash preimage in order to guarantee uniqueness. */ noteNonce, // Computed values
|
|
27
|
-
/**
|
|
28
|
-
* The inner hash (non-unique, non-siloed) of the note. Each contract determines how the note is hashed. Can
|
|
29
|
-
* be used alongside contractAddress and nonce to compute the uniqueNoteHash and the siloedNoteHash.
|
|
30
|
-
*/ noteHash, /**
|
|
31
|
-
* The nullifier of the note, siloed by contract address.
|
|
32
|
-
* Note: Might be set as 0 if the note was added to PXE as nullified.
|
|
33
|
-
*/ siloedNullifier, // Metadata
|
|
34
|
-
/** The hash of the tx in which this note was created. Knowing the tx hash allows for efficient node queries e.g.
|
|
35
|
-
* when searching for txEffects.
|
|
36
|
-
*/ txHash, /** The L2 block number in which the tx with this note was included. Used for note management while processing
|
|
37
|
-
* reorgs.*/ l2BlockNumber, /** The L2 block hash in which the tx with this note was included. Used for note management while processing
|
|
38
|
-
* reorgs.*/ l2BlockHash, /** The index of the leaf in the global note hash tree the note is stored at */ index, /**
|
|
39
|
-
* The address whose public key was used to encrypt the note log during delivery.
|
|
40
|
-
* (This is the x-coordinate of the public key.)
|
|
41
|
-
*/ recipient){
|
|
42
|
-
this.note = note;
|
|
43
|
-
this.contractAddress = contractAddress;
|
|
44
|
-
this.storageSlot = storageSlot;
|
|
45
|
-
this.noteNonce = noteNonce;
|
|
46
|
-
this.noteHash = noteHash;
|
|
47
|
-
this.siloedNullifier = siloedNullifier;
|
|
48
|
-
this.txHash = txHash;
|
|
49
|
-
this.l2BlockNumber = l2BlockNumber;
|
|
50
|
-
this.l2BlockHash = l2BlockHash;
|
|
51
|
-
this.index = index;
|
|
52
|
-
this.recipient = recipient;
|
|
53
|
-
}
|
|
54
|
-
toBuffer() {
|
|
55
|
-
return serializeToBuffer([
|
|
56
|
-
this.note,
|
|
57
|
-
this.contractAddress,
|
|
58
|
-
this.storageSlot,
|
|
59
|
-
this.noteNonce,
|
|
60
|
-
this.noteHash,
|
|
61
|
-
this.siloedNullifier,
|
|
62
|
-
this.txHash,
|
|
63
|
-
this.l2BlockNumber,
|
|
64
|
-
Fr.fromHexString(this.l2BlockHash),
|
|
65
|
-
this.index,
|
|
66
|
-
this.recipient
|
|
67
|
-
]);
|
|
68
|
-
}
|
|
69
|
-
static fromBuffer(buffer) {
|
|
70
|
-
const reader = BufferReader.asReader(buffer);
|
|
71
|
-
const note = Note.fromBuffer(reader);
|
|
72
|
-
const contractAddress = AztecAddress.fromBuffer(reader);
|
|
73
|
-
const storageSlot = Fr.fromBuffer(reader);
|
|
74
|
-
const noteNonce = Fr.fromBuffer(reader);
|
|
75
|
-
const noteHash = Fr.fromBuffer(reader);
|
|
76
|
-
const siloedNullifier = Fr.fromBuffer(reader);
|
|
77
|
-
const txHash = reader.readObject(TxHash);
|
|
78
|
-
const l2BlockNumber = reader.readNumber();
|
|
79
|
-
const l2BlockHash = Fr.fromBuffer(reader).toString();
|
|
80
|
-
const index = toBigIntBE(reader.readBytes(32));
|
|
81
|
-
const recipient = AztecAddress.fromBuffer(reader);
|
|
82
|
-
return new NoteDao(note, contractAddress, storageSlot, noteNonce, noteHash, siloedNullifier, txHash, l2BlockNumber, l2BlockHash, index, recipient);
|
|
83
|
-
}
|
|
84
|
-
toString() {
|
|
85
|
-
return '0x' + this.toBuffer().toString('hex');
|
|
86
|
-
}
|
|
87
|
-
static fromString(str) {
|
|
88
|
-
const hex = str.replace(/^0x/, '');
|
|
89
|
-
return NoteDao.fromBuffer(Buffer.from(hex, 'hex'));
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* Returns the size in bytes of the Note Dao.
|
|
93
|
-
* @returns - Its size in bytes.
|
|
94
|
-
*/ getSize() {
|
|
95
|
-
const indexSize = Math.ceil(Math.log2(Number(this.index)));
|
|
96
|
-
const noteSize = 4 + this.note.items.length * Fr.SIZE_IN_BYTES;
|
|
97
|
-
return noteSize + AztecAddress.SIZE_IN_BYTES + Fr.SIZE_IN_BYTES * 4 + TxHash.SIZE + Point.SIZE_IN_BYTES + indexSize;
|
|
98
|
-
}
|
|
99
|
-
static async random({ note = Note.random(), contractAddress = undefined, storageSlot = Fr.random(), noteNonce = Fr.random(), noteHash = Fr.random(), siloedNullifier = Fr.random(), txHash = TxHash.random(), l2BlockNumber = Math.floor(Math.random() * 1000), l2BlockHash = Fr.random().toString(), index = Fr.random().toBigInt(), recipient = undefined } = {}) {
|
|
100
|
-
return new NoteDao(note, contractAddress ?? await AztecAddress.random(), storageSlot, noteNonce, noteHash, siloedNullifier, txHash, l2BlockNumber, l2BlockHash, index, recipient ?? await AztecAddress.random());
|
|
101
|
-
}
|
|
102
|
-
}
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import type { Fr } from '@aztec/foundation/fields';
|
|
2
|
-
import type { AztecAsyncKVStore } from '@aztec/kv-store';
|
|
3
|
-
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
|
-
import type { InBlock } from '@aztec/stdlib/block';
|
|
5
|
-
import { type NotesFilter } from '@aztec/stdlib/note';
|
|
6
|
-
import { NoteDao } from './note_dao.js';
|
|
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
|
-
* storageSlot, status, scopes and siloedNullifier.
|
|
66
|
-
* @returns Promise resolving to array of NoteDao objects matching the filter
|
|
67
|
-
* @throws If filtering by an empty scopes array. Scopes have to be set to undefined or to a non-empty array.
|
|
68
|
-
*/
|
|
69
|
-
getNotes(filter: NotesFilter): Promise<NoteDao[]>;
|
|
70
|
-
/**
|
|
71
|
-
* Transitions notes from "active" to "nullified" state.
|
|
72
|
-
*
|
|
73
|
-
* This operation processes a batch of nullifiers to mark the corresponding notes
|
|
74
|
-
* as spent/nullified. The operation is atomic - if any nullifier is not found,
|
|
75
|
-
* the entire operation fails and no notes are modified.
|
|
76
|
-
*
|
|
77
|
-
* @param nullifiers - Array of nullifiers with their block numbers to process
|
|
78
|
-
* @returns Promise resolving to array of nullified NoteDao objects
|
|
79
|
-
* @throws Error if any nullifier is not found in the active notes
|
|
80
|
-
*/
|
|
81
|
-
applyNullifiers(nullifiers: InBlock<Fr>[]): Promise<NoteDao[]>;
|
|
82
|
-
}
|
|
83
|
-
//# sourceMappingURL=note_data_provider.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"note_data_provider.d.ts","sourceRoot":"","sources":["../../../src/storage/note_data_provider/note_data_provider.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAEnD,OAAO,KAAK,EAAE,iBAAiB,EAAqC,MAAM,iBAAiB,CAAC;AAC5F,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAc,KAAK,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAElE,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC;;;;;IAKI;AACJ,qBAAa,gBAAgB;;IAiB3B,OAAO;IAkBP;;;;;;;;OAQG;WACiB,MAAM,CAAC,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAS/E;;;;;;;;OAQG;IACU,QAAQ,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC;IAc5D;;;;;;;;;OASG;IACH,QAAQ,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAkB9D;;;;;;;;;OASG;IACU,0BAA0B,CAAC,WAAW,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAwFvG;;;;;;;;;;OAUG;IACG,QAAQ,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IA8FvD;;;;;;;;;;OAUG;IACH,eAAe,CAAC,UAAU,EAAE,OAAO,CAAC,EAAE,CAAC,EAAE,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;CA0D/D"}
|