@aztec/pxe 0.0.1-commit.d3ec352c → 0.0.1-commit.f295ac2
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/bin/check_oracle_version.js +105 -15
- package/dest/block_synchronizer/block_synchronizer.d.ts +41 -0
- package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -0
- package/dest/{synchronizer/synchronizer.js → block_synchronizer/block_synchronizer.js} +35 -30
- 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 +4 -4
- package/dest/config/index.d.ts.map +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 +42 -14
- package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.js +73 -29
- package/dest/contract_function_simulator/execution_note_cache.d.ts +21 -12
- package/dest/contract_function_simulator/execution_note_cache.d.ts.map +1 -1
- package/dest/contract_function_simulator/execution_note_cache.js +48 -31
- package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts +1 -1
- package/dest/contract_function_simulator/execution_tagging_index_cache.js +1 -1
- package/dest/contract_function_simulator/hashed_values_cache.d.ts +2 -2
- package/dest/contract_function_simulator/hashed_values_cache.d.ts.map +1 -1
- package/dest/contract_function_simulator/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 +5 -2
- package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts +5 -4
- package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/log_retrieval_request.js +7 -6
- package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts +2 -2
- package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/log_retrieval_response.js +1 -1
- package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +2 -2
- package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts.map +1 -1
- 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 +14 -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 +4 -2
- package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.js +1 -1
- package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts +9 -5
- package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/note_packing_utils.js +11 -7
- package/dest/contract_function_simulator/oracle/oracle.d.ts +7 -7
- package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/oracle.js +37 -25
- package/dest/contract_function_simulator/oracle/private_execution.d.ts +10 -16
- package/dest/contract_function_simulator/oracle/private_execution.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution.js +19 -18
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +25 -25
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.js +29 -44
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +63 -21
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +162 -54
- 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/debug/pxe_debug_utils.d.ts +31 -0
- package/dest/debug/pxe_debug_utils.d.ts.map +1 -0
- package/dest/debug/pxe_debug_utils.js +37 -0
- package/dest/entrypoints/client/bundle/index.d.ts +1 -2
- package/dest/entrypoints/client/bundle/index.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/index.js +0 -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 +12 -3
- package/dest/entrypoints/client/lazy/index.d.ts +1 -2
- package/dest/entrypoints/client/lazy/index.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/index.js +0 -1
- package/dest/entrypoints/client/lazy/utils.d.ts +1 -1
- package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/utils.js +12 -3
- package/dest/entrypoints/pxe_creation_options.d.ts +5 -2
- package/dest/entrypoints/pxe_creation_options.d.ts.map +1 -1
- package/dest/entrypoints/server/index.d.ts +3 -2
- package/dest/entrypoints/server/index.d.ts.map +1 -1
- package/dest/entrypoints/server/index.js +2 -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 +12 -8
- 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 +16 -0
- package/dest/events/event_service.d.ts.map +1 -0
- package/dest/events/event_service.js +45 -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 +74 -0
- package/dest/job_coordinator/job_coordinator.d.ts.map +1 -0
- package/dest/job_coordinator/job_coordinator.js +93 -0
- package/dest/logs/log_service.d.ts +27 -0
- package/dest/logs/log_service.d.ts.map +1 -0
- package/dest/logs/log_service.js +122 -0
- package/dest/notes/index.d.ts +2 -0
- package/dest/notes/index.d.ts.map +1 -0
- package/dest/notes/index.js +1 -0
- package/dest/notes/note_service.d.ts +48 -0
- package/dest/notes/note_service.d.ts.map +1 -0
- package/dest/notes/note_service.js +147 -0
- package/dest/oracle_version.d.ts +2 -2
- package/dest/oracle_version.js +2 -2
- package/dest/private_kernel/hints/index.d.ts +2 -2
- package/dest/private_kernel/hints/index.d.ts.map +1 -1
- package/dest/private_kernel/hints/index.js +1 -1
- package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts +28 -0
- package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts.map +1 -0
- package/dest/private_kernel/hints/{build_private_kernel_reset_private_inputs.js → private_kernel_reset_private_inputs_builder.js} +13 -7
- package/dest/private_kernel/private_kernel_execution_prover.d.ts +1 -1
- package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_execution_prover.js +8 -9
- package/dest/private_kernel/private_kernel_oracle.d.ts +26 -29
- package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_oracle.js +90 -2
- package/dest/pxe.d.ts +45 -81
- package/dest/pxe.d.ts.map +1 -1
- package/dest/pxe.js +182 -215
- package/dest/storage/address_store/address_store.d.ts +11 -0
- package/dest/storage/address_store/address_store.d.ts.map +1 -0
- package/dest/storage/{address_data_provider/address_data_provider.js → address_store/address_store.js} +1 -1
- 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/{sync_data_provider/sync_data_provider.d.ts → anchor_block_store/anchor_block_store.d.ts} +2 -4
- package/dest/storage/anchor_block_store/anchor_block_store.d.ts.map +1 -0
- package/dest/storage/{sync_data_provider/sync_data_provider.js → anchor_block_store/anchor_block_store.js} +2 -9
- package/dest/storage/{sync_data_provider → anchor_block_store}/index.d.ts +2 -2
- package/dest/storage/anchor_block_store/index.d.ts.map +1 -0
- package/dest/storage/anchor_block_store/index.js +1 -0
- package/dest/storage/capsule_store/capsule_store.d.ts +72 -0
- package/dest/storage/capsule_store/capsule_store.d.ts.map +1 -0
- package/dest/storage/capsule_store/capsule_store.js +255 -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_data_provider/contract_data_provider.d.ts → contract_store/contract_store.d.ts} +8 -5
- package/dest/storage/contract_store/contract_store.d.ts.map +1 -0
- package/dest/storage/{contract_data_provider/contract_data_provider.js → contract_store/contract_store.js} +46 -3
- 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/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_data_provider/note_data_provider.d.ts → note_store/note_store.d.ts} +15 -13
- package/dest/storage/note_store/note_store.d.ts.map +1 -0
- package/dest/storage/{note_data_provider/note_data_provider.js → note_store/note_store.js} +105 -102
- package/dest/storage/private_event_store/private_event_store.d.ts +78 -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 +222 -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 +99 -0
- package/dest/storage/tagging_store/sender_address_book_store.d.ts +14 -0
- package/dest/storage/tagging_store/sender_address_book_store.d.ts.map +1 -0
- package/dest/storage/tagging_store/sender_address_book_store.js +30 -0
- package/dest/storage/tagging_store/sender_tagging_store.d.ts +77 -0
- package/dest/storage/tagging_store/sender_tagging_store.d.ts.map +1 -0
- package/dest/storage/tagging_store/sender_tagging_store.js +278 -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/index.d.ts +15 -6
- package/dest/tagging/index.d.ts.map +1 -1
- package/dest/tagging/index.js +14 -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 +29 -0
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts +20 -0
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts.map +1 -0
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.js +74 -0
- package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts +11 -0
- package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts.map +1 -0
- package/dest/tagging/sender_sync/utils/get_status_change_of_pending.js +32 -0
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts +20 -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 +57 -0
- package/dest/tree_membership/tree_membership_service.d.ts +50 -0
- package/dest/tree_membership/tree_membership_service.d.ts.map +1 -0
- package/dest/tree_membership/tree_membership_service.js +75 -0
- package/package.json +18 -18
- package/src/bin/check_oracle_version.ts +130 -20
- package/src/{synchronizer/synchronizer.ts → block_synchronizer/block_synchronizer.ts} +44 -30
- package/src/block_synchronizer/index.ts +1 -0
- package/src/config/index.ts +3 -3
- package/src/config/package_info.ts +1 -1
- package/src/contract_function_simulator/benchmarked_node.ts +103 -0
- package/src/contract_function_simulator/contract_function_simulator.ts +118 -30
- package/src/contract_function_simulator/execution_note_cache.ts +51 -29
- package/src/contract_function_simulator/execution_tagging_index_cache.ts +1 -1
- package/src/contract_function_simulator/hashed_values_cache.ts +1 -1
- package/src/contract_function_simulator/noir-structs/event_validation_request.ts +5 -1
- package/src/contract_function_simulator/noir-structs/log_retrieval_request.ts +6 -5
- package/src/contract_function_simulator/noir-structs/log_retrieval_response.ts +1 -1
- package/src/contract_function_simulator/noir-structs/note_validation_request.ts +1 -1
- package/src/contract_function_simulator/noir-structs/utility_context.ts +6 -25
- package/src/contract_function_simulator/oracle/interfaces.ts +13 -12
- package/src/contract_function_simulator/oracle/message_load_oracle_inputs.ts +1 -1
- package/src/contract_function_simulator/oracle/note_packing_utils.ts +23 -9
- package/src/contract_function_simulator/oracle/oracle.ts +44 -28
- package/src/contract_function_simulator/oracle/private_execution.ts +22 -30
- package/src/contract_function_simulator/oracle/private_execution_oracle.ts +97 -58
- package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +233 -63
- package/src/contract_function_simulator/pick_notes.ts +1 -1
- package/src/contract_function_simulator/proxied_contract_data_source.ts +24 -7
- package/src/debug/pxe_debug_utils.ts +48 -0
- package/src/entrypoints/client/bundle/index.ts +0 -1
- package/src/entrypoints/client/bundle/utils.ts +9 -3
- package/src/entrypoints/client/lazy/index.ts +0 -1
- package/src/entrypoints/client/lazy/utils.ts +9 -4
- package/src/entrypoints/pxe_creation_options.ts +4 -1
- package/src/entrypoints/server/index.ts +2 -1
- package/src/entrypoints/server/utils.ts +12 -16
- package/src/error_enriching.ts +7 -15
- package/src/events/event_service.ts +73 -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 +149 -0
- package/src/logs/log_service.ts +204 -0
- package/src/notes/index.ts +1 -0
- package/src/notes/note_service.ts +194 -0
- package/src/oracle_version.ts +2 -2
- package/src/private_kernel/hints/index.ts +1 -1
- package/src/private_kernel/hints/{build_private_kernel_reset_private_inputs.ts → private_kernel_reset_private_inputs_builder.ts} +34 -23
- package/src/private_kernel/private_kernel_execution_prover.ts +7 -9
- package/src/private_kernel/private_kernel_oracle.ts +118 -37
- package/src/pxe.ts +233 -279
- package/src/storage/{address_data_provider/address_data_provider.ts → address_store/address_store.ts} +1 -1
- package/src/storage/address_store/index.ts +1 -0
- package/src/storage/{sync_data_provider/sync_data_provider.ts → anchor_block_store/anchor_block_store.ts} +2 -12
- 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_data_provider/contract_data_provider.ts → contract_store/contract_store.ts} +65 -3
- 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/note_store/index.ts +2 -0
- package/src/storage/{note_data_provider/note_data_provider.ts → note_store/note_store.ts} +117 -105
- package/src/storage/private_event_store/private_event_store.ts +324 -0
- package/src/storage/tagging_store/index.ts +3 -0
- package/src/storage/tagging_store/recipient_tagging_store.ts +129 -0
- package/src/storage/tagging_store/sender_address_book_store.ts +42 -0
- package/src/storage/tagging_store/sender_tagging_store.ts +345 -0
- package/src/tagging/constants.ts +10 -2
- package/src/tagging/index.ts +17 -5
- package/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts +133 -0
- package/src/tagging/recipient_sync/utils/find_highest_indexes.ts +34 -0
- package/src/tagging/recipient_sync/utils/load_logs_for_range.ts +43 -0
- package/src/tagging/sender_sync/sync_sender_tagging_indexes.ts +97 -0
- package/src/tagging/sender_sync/utils/get_status_change_of_pending.ts +48 -0
- package/src/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.ts +75 -0
- package/src/tree_membership/tree_membership_service.ts +97 -0
- package/dest/contract_function_simulator/execution_data_provider.d.ts +0 -267
- 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 -123
- package/dest/contract_function_simulator/pxe_oracle_interface.d.ts.map +0 -1
- package/dest/contract_function_simulator/pxe_oracle_interface.js +0 -696
- 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/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.map +0 -1
- package/dest/storage/contract_data_provider/index.d.ts +0 -2
- package/dest/storage/contract_data_provider/index.d.ts.map +0 -1
- package/dest/storage/contract_data_provider/index.js +0 -1
- package/dest/storage/contract_data_provider/private_functions_tree.d.ts.map +0 -1
- package/dest/storage/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.map +0 -1
- package/dest/storage/private_event_data_provider/private_event_data_provider.d.ts +0 -37
- package/dest/storage/private_event_data_provider/private_event_data_provider.d.ts.map +0 -1
- package/dest/storage/private_event_data_provider/private_event_data_provider.js +0 -105
- package/dest/storage/sync_data_provider/index.d.ts.map +0 -1
- package/dest/storage/sync_data_provider/index.js +0 -1
- package/dest/storage/sync_data_provider/sync_data_provider.d.ts.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 -36
- package/dest/synchronizer/synchronizer.d.ts.map +0 -1
- 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 -342
- package/src/contract_function_simulator/proxied_node.ts +0 -33
- package/src/contract_function_simulator/pxe_oracle_interface.ts +0 -1023
- 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/index.ts +0 -1
- package/src/storage/note_data_provider/index.ts +0 -2
- package/src/storage/private_event_data_provider/private_event_data_provider.ts +0 -143
- package/src/storage/sync_data_provider/index.ts +0 -1
- package/src/storage/tagging_data_provider/index.ts +0 -1
- package/src/storage/tagging_data_provider/tagging_data_provider.ts +0 -120
- package/src/synchronizer/index.ts +0 -1
- package/src/tagging/siloed_tag.ts +0 -22
- package/src/tagging/tag.ts +0 -16
- package/src/tagging/utils.ts +0 -31
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
|
+
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
3
|
+
import type { DataInBlock } from '@aztec/stdlib/block';
|
|
4
|
+
import { L2BlockHash } from '@aztec/stdlib/block';
|
|
5
|
+
import { computeUniqueNoteHash, siloNoteHash, siloNullifier } from '@aztec/stdlib/hash';
|
|
6
|
+
import { type AztecNode, MAX_RPC_LEN } from '@aztec/stdlib/interfaces/client';
|
|
7
|
+
import { Note, NoteDao, NoteStatus } from '@aztec/stdlib/note';
|
|
8
|
+
import { MerkleTreeId } from '@aztec/stdlib/trees';
|
|
9
|
+
import type { TxHash } from '@aztec/stdlib/tx';
|
|
10
|
+
|
|
11
|
+
import type { AnchorBlockStore } from '../storage/anchor_block_store/anchor_block_store.js';
|
|
12
|
+
import type { NoteStore } from '../storage/note_store/note_store.js';
|
|
13
|
+
|
|
14
|
+
export class NoteService {
|
|
15
|
+
constructor(
|
|
16
|
+
private readonly noteStore: NoteStore,
|
|
17
|
+
private readonly aztecNode: AztecNode,
|
|
18
|
+
private readonly anchorBlockStore: AnchorBlockStore,
|
|
19
|
+
) {}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Retrieves a set of notes stored in the database for a given contract address and storage slot.
|
|
23
|
+
* The query result is paginated using 'limit' and 'offset' values.
|
|
24
|
+
* Returns an object containing an array of note data.
|
|
25
|
+
*
|
|
26
|
+
* @param owner - The owner of the notes. If undefined, returns notes for all known owners.
|
|
27
|
+
* @param status - The status of notes to fetch.
|
|
28
|
+
* @param scopes - The accounts whose notes we can access in this call. Currently optional and will default to all.
|
|
29
|
+
*/
|
|
30
|
+
public async getNotes(
|
|
31
|
+
contractAddress: AztecAddress,
|
|
32
|
+
owner: AztecAddress | undefined,
|
|
33
|
+
storageSlot: Fr,
|
|
34
|
+
status: NoteStatus,
|
|
35
|
+
scopes?: AztecAddress[],
|
|
36
|
+
) {
|
|
37
|
+
const noteDaos = await this.noteStore.getNotes({
|
|
38
|
+
contractAddress,
|
|
39
|
+
owner,
|
|
40
|
+
storageSlot,
|
|
41
|
+
status,
|
|
42
|
+
scopes,
|
|
43
|
+
});
|
|
44
|
+
return noteDaos.map(
|
|
45
|
+
({ contractAddress, owner, storageSlot, randomness, noteNonce, note, noteHash, siloedNullifier }) => ({
|
|
46
|
+
contractAddress,
|
|
47
|
+
owner,
|
|
48
|
+
storageSlot,
|
|
49
|
+
randomness,
|
|
50
|
+
noteNonce,
|
|
51
|
+
note,
|
|
52
|
+
noteHash,
|
|
53
|
+
isPending: false, // Note service deals only with settled notes
|
|
54
|
+
siloedNullifier,
|
|
55
|
+
}),
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Looks for nullifiers of active contract notes and marks them as nullified if a nullifier is found.
|
|
61
|
+
*
|
|
62
|
+
* Fetches notes from the NoteStore and checks which nullifiers are present in the
|
|
63
|
+
* onchain nullifier Merkle tree - up to the latest locally synced block. We use the
|
|
64
|
+
* locally synced block instead of querying the chain's 'latest' block to ensure correctness:
|
|
65
|
+
* notes are only marked nullified once their corresponding nullifier has been included in a
|
|
66
|
+
* block up to which the PXE has synced.
|
|
67
|
+
* This allows recent nullifications to be processed even if the node is not an archive node.
|
|
68
|
+
*
|
|
69
|
+
* @param contractAddress - The contract whose notes should be checked and nullified.
|
|
70
|
+
*/
|
|
71
|
+
public async syncNoteNullifiers(contractAddress: AztecAddress): Promise<void> {
|
|
72
|
+
const anchorBlockHash = L2BlockHash.fromField(await (await this.anchorBlockStore.getBlockHeader()).hash());
|
|
73
|
+
|
|
74
|
+
const contractNotes = await this.noteStore.getNotes({ contractAddress });
|
|
75
|
+
|
|
76
|
+
if (contractNotes.length === 0) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const nullifiersToCheck = contractNotes.map(note => note.siloedNullifier);
|
|
81
|
+
const nullifierBatches = nullifiersToCheck.reduce(
|
|
82
|
+
(acc, nullifier) => {
|
|
83
|
+
if (acc[acc.length - 1].length < MAX_RPC_LEN) {
|
|
84
|
+
acc[acc.length - 1].push(nullifier);
|
|
85
|
+
} else {
|
|
86
|
+
acc.push([nullifier]);
|
|
87
|
+
}
|
|
88
|
+
return acc;
|
|
89
|
+
},
|
|
90
|
+
[[]] as Fr[][],
|
|
91
|
+
);
|
|
92
|
+
const nullifierIndexes = (
|
|
93
|
+
await Promise.all(
|
|
94
|
+
nullifierBatches.map(batch =>
|
|
95
|
+
this.aztecNode.findLeavesIndexes(anchorBlockHash, MerkleTreeId.NULLIFIER_TREE, batch),
|
|
96
|
+
),
|
|
97
|
+
)
|
|
98
|
+
).flat();
|
|
99
|
+
|
|
100
|
+
const foundNullifiers = nullifiersToCheck
|
|
101
|
+
.map((nullifier, i) => {
|
|
102
|
+
if (nullifierIndexes[i] !== undefined) {
|
|
103
|
+
return { ...nullifierIndexes[i], ...{ data: nullifier } } as DataInBlock<Fr>;
|
|
104
|
+
}
|
|
105
|
+
})
|
|
106
|
+
.filter(nullifier => nullifier !== undefined) as DataInBlock<Fr>[];
|
|
107
|
+
|
|
108
|
+
await this.noteStore.applyNullifiers(foundNullifiers);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
public async storeNote(
|
|
112
|
+
contractAddress: AztecAddress,
|
|
113
|
+
owner: AztecAddress,
|
|
114
|
+
storageSlot: Fr,
|
|
115
|
+
randomness: Fr,
|
|
116
|
+
noteNonce: Fr,
|
|
117
|
+
content: Fr[],
|
|
118
|
+
noteHash: Fr,
|
|
119
|
+
nullifier: Fr,
|
|
120
|
+
txHash: TxHash,
|
|
121
|
+
recipient: AztecAddress,
|
|
122
|
+
): Promise<void> {
|
|
123
|
+
// We are going to store the new note in the NoteStore, which will let us later return it via `getNotes`.
|
|
124
|
+
// There's two things we need to check before we do this however:
|
|
125
|
+
// - we must make sure the note does actually exist in the note hash tree
|
|
126
|
+
// - we need to check if the note has already been nullified
|
|
127
|
+
//
|
|
128
|
+
// Failing to do either of the above would result in circuits getting either non-existent notes and failing to
|
|
129
|
+
// produce inclusion proofs for them, or getting nullified notes and producing duplicate nullifiers, both of which
|
|
130
|
+
// are catastrophic failure modes.
|
|
131
|
+
//
|
|
132
|
+
// Note that adding a note and removing it is *not* equivalent to never adding it in the first place. A nullifier
|
|
133
|
+
// emitted in a block that comes after note creation might result in the note being de-nullified by a chain reorg,
|
|
134
|
+
// so we must store both the note hash and nullifier block information.
|
|
135
|
+
|
|
136
|
+
// We avoid making node queries at 'latest' since we don't want to process notes or nullifiers that only exist ahead
|
|
137
|
+
// in time of the locally synced state.
|
|
138
|
+
// Note that while this technically results in historical queries, we perform it at the latest locally synced block
|
|
139
|
+
// number which *should* be recent enough to be available, even for non-archive nodes.
|
|
140
|
+
// Also note that the note should never be ahead of the synced block here since `fetchTaggedLogs` only processes
|
|
141
|
+
// logs up to the synced block making this only an additional safety check.
|
|
142
|
+
const anchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
|
|
143
|
+
const anchorBlockNumber = anchorBlockHeader.getBlockNumber();
|
|
144
|
+
const anchorBlockHash = L2BlockHash.fromField(await anchorBlockHeader.hash());
|
|
145
|
+
|
|
146
|
+
// By computing siloed and unique note hashes ourselves we prevent contracts from interfering with the note storage
|
|
147
|
+
// of other contracts, which would constitute a security breach.
|
|
148
|
+
const uniqueNoteHash = await computeUniqueNoteHash(noteNonce, await siloNoteHash(contractAddress, noteHash));
|
|
149
|
+
const siloedNullifier = await siloNullifier(contractAddress, nullifier);
|
|
150
|
+
|
|
151
|
+
const [txEffect, [nullifierIndex]] = await Promise.all([
|
|
152
|
+
this.aztecNode.getTxEffect(txHash),
|
|
153
|
+
this.aztecNode.findLeavesIndexes(anchorBlockHash, MerkleTreeId.NULLIFIER_TREE, [siloedNullifier]),
|
|
154
|
+
]);
|
|
155
|
+
if (!txEffect) {
|
|
156
|
+
throw new Error(`Could not find tx effect for tx hash ${txHash}`);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
if (txEffect.l2BlockNumber > anchorBlockNumber) {
|
|
160
|
+
throw new Error(`Could not find tx effect for tx hash ${txHash} as of block number ${anchorBlockNumber}`);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
// Find the index of the note hash in the noteHashes array to determine note ordering within the tx
|
|
164
|
+
const noteIndexInTx = txEffect.data.noteHashes.findIndex(nh => nh.equals(uniqueNoteHash));
|
|
165
|
+
if (noteIndexInTx === -1) {
|
|
166
|
+
throw new Error(`Note hash ${noteHash} (uniqued as ${uniqueNoteHash}) is not present in tx ${txHash}`);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
const noteDao = new NoteDao(
|
|
170
|
+
new Note(content),
|
|
171
|
+
contractAddress,
|
|
172
|
+
owner,
|
|
173
|
+
storageSlot,
|
|
174
|
+
randomness,
|
|
175
|
+
noteNonce,
|
|
176
|
+
noteHash,
|
|
177
|
+
siloedNullifier,
|
|
178
|
+
txHash,
|
|
179
|
+
txEffect.l2BlockNumber,
|
|
180
|
+
txEffect.l2BlockHash.toString(),
|
|
181
|
+
txEffect.txIndexInBlock,
|
|
182
|
+
noteIndexInTx,
|
|
183
|
+
);
|
|
184
|
+
|
|
185
|
+
// The note was found by `recipient`, so we use that as the scope when storing the note.
|
|
186
|
+
await this.noteStore.addNotes([noteDao], recipient);
|
|
187
|
+
|
|
188
|
+
if (nullifierIndex !== undefined) {
|
|
189
|
+
// We found nullifier index which implies that the note has already been nullified.
|
|
190
|
+
const { data: _, ...blockHashAndNum } = nullifierIndex;
|
|
191
|
+
await this.noteStore.applyNullifiers([{ data: siloedNullifier, ...blockHashAndNum }]);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
package/src/oracle_version.ts
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
///
|
|
5
5
|
/// @dev Whenever a contract function or Noir test is run, the `utilityAssertCompatibleOracleVersion` oracle is called
|
|
6
6
|
/// and if the oracle version is incompatible an error is thrown.
|
|
7
|
-
export const ORACLE_VERSION =
|
|
7
|
+
export const ORACLE_VERSION = 6;
|
|
8
8
|
|
|
9
9
|
/// This hash is computed as by hashing the Oracle interface and it is used to detect when the Oracle interface changes,
|
|
10
10
|
/// which in turn implies that you need to update the ORACLE_VERSION constant.
|
|
11
|
-
export const ORACLE_INTERFACE_HASH = '
|
|
11
|
+
export const ORACLE_INTERFACE_HASH = 'cc2a1f26a3b39ef194d710f94683929f63939d725f10b4fe2c82749a47a74c7b';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './
|
|
1
|
+
export * from './private_kernel_reset_private_inputs_builder.js';
|
|
2
2
|
export * from './compute_tx_include_by_timestamp.js';
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
} from '@aztec/constants';
|
|
10
10
|
import { makeTuple } from '@aztec/foundation/array';
|
|
11
11
|
import { padArrayEnd } from '@aztec/foundation/collection';
|
|
12
|
-
import type { Fr } from '@aztec/foundation/
|
|
12
|
+
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
13
13
|
import { type Tuple, assertLength } from '@aztec/foundation/serialize';
|
|
14
14
|
import { MembershipWitness } from '@aztec/foundation/trees';
|
|
15
15
|
import { privateKernelResetDimensionsConfig } from '@aztec/noir-protocol-circuits-types/client';
|
|
@@ -138,7 +138,7 @@ export class PrivateKernelResetPrivateInputsBuilder {
|
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
140
|
|
|
141
|
-
async build(oracle: PrivateKernelOracle
|
|
141
|
+
async build(oracle: PrivateKernelOracle) {
|
|
142
142
|
if (privateKernelResetDimensionNames.every(name => !this.requestedDimensions[name])) {
|
|
143
143
|
throw new Error('Reset is not required.');
|
|
144
144
|
}
|
|
@@ -157,16 +157,6 @@ export class PrivateKernelResetPrivateInputsBuilder {
|
|
|
157
157
|
allowRemainder,
|
|
158
158
|
);
|
|
159
159
|
|
|
160
|
-
const previousVkMembershipWitness = await oracle.getVkMembershipWitness(
|
|
161
|
-
this.previousKernelOutput.verificationKey.keyAsFields,
|
|
162
|
-
);
|
|
163
|
-
const vkData = new VkData(
|
|
164
|
-
this.previousKernelOutput.verificationKey,
|
|
165
|
-
Number(previousVkMembershipWitness.leafIndex),
|
|
166
|
-
previousVkMembershipWitness.siblingPath,
|
|
167
|
-
);
|
|
168
|
-
const previousKernelData = new PrivateKernelData(this.previousKernelOutput.publicInputs, vkData);
|
|
169
|
-
|
|
170
160
|
this.reduceReadRequestActions(
|
|
171
161
|
this.noteHashResetActions,
|
|
172
162
|
dimensions.NOTE_HASH_PENDING_READ,
|
|
@@ -178,30 +168,51 @@ export class PrivateKernelResetPrivateInputsBuilder {
|
|
|
178
168
|
dimensions.NULLIFIER_SETTLED_READ,
|
|
179
169
|
);
|
|
180
170
|
|
|
181
|
-
//
|
|
182
|
-
const
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
171
|
+
// Execute all the expensive node querying operations in parallel.
|
|
172
|
+
const [previousVkMembershipWitness, noteHashReadRequestHints, nullifierReadRequestHints, keyValidationHints] =
|
|
173
|
+
await Promise.all([
|
|
174
|
+
oracle.getVkMembershipWitness(this.previousKernelOutput.verificationKey.keyAsFields),
|
|
175
|
+
buildNoteHashReadRequestHintsFromResetActions<
|
|
176
|
+
typeof MAX_NOTE_HASH_READ_REQUESTS_PER_TX,
|
|
177
|
+
typeof MAX_NOTE_HASH_READ_REQUESTS_PER_TX
|
|
178
|
+
>(
|
|
189
179
|
oracle,
|
|
190
180
|
this.previousKernel.validationRequests.noteHashReadRequests,
|
|
191
181
|
this.previousKernel.end.noteHashes,
|
|
192
182
|
this.noteHashResetActions,
|
|
193
|
-
noteHashLeafIndexMap,
|
|
194
183
|
),
|
|
195
|
-
|
|
184
|
+
buildNullifierReadRequestHintsFromResetActions<
|
|
185
|
+
typeof MAX_NULLIFIER_READ_REQUESTS_PER_TX,
|
|
186
|
+
typeof MAX_NULLIFIER_READ_REQUESTS_PER_TX
|
|
187
|
+
>(
|
|
196
188
|
{ getNullifierMembershipWitness: getNullifierMembershipWitnessResolver(oracle) },
|
|
197
189
|
this.previousKernel.validationRequests.nullifierReadRequests,
|
|
198
190
|
this.nullifierResetActions,
|
|
199
191
|
),
|
|
200
|
-
|
|
192
|
+
getMasterSecretKeysAndAppKeyGenerators(
|
|
201
193
|
this.previousKernel.validationRequests.scopedKeyValidationRequestsAndGenerators,
|
|
202
194
|
dimensions.KEY_VALIDATION,
|
|
203
195
|
oracle,
|
|
204
196
|
),
|
|
197
|
+
]);
|
|
198
|
+
|
|
199
|
+
const vkData = new VkData(
|
|
200
|
+
this.previousKernelOutput.verificationKey,
|
|
201
|
+
Number(previousVkMembershipWitness.leafIndex),
|
|
202
|
+
previousVkMembershipWitness.siblingPath,
|
|
203
|
+
);
|
|
204
|
+
const previousKernelData = new PrivateKernelData(this.previousKernelOutput.publicInputs, vkData);
|
|
205
|
+
|
|
206
|
+
// TODO: Enable padding when we have a better idea what are the final amounts we should pad to.
|
|
207
|
+
const paddedSideEffects = PaddedSideEffects.empty();
|
|
208
|
+
|
|
209
|
+
return new PrivateKernelResetCircuitPrivateInputs(
|
|
210
|
+
previousKernelData,
|
|
211
|
+
paddedSideEffects,
|
|
212
|
+
new PrivateKernelResetHints(
|
|
213
|
+
noteHashReadRequestHints,
|
|
214
|
+
nullifierReadRequestHints,
|
|
215
|
+
keyValidationHints,
|
|
205
216
|
this.transientDataSquashingHints,
|
|
206
217
|
),
|
|
207
218
|
dimensions,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { vkAsFieldsMegaHonk } from '@aztec/foundation/crypto';
|
|
2
|
-
import { Fr } from '@aztec/foundation/
|
|
1
|
+
import { vkAsFieldsMegaHonk } from '@aztec/foundation/crypto/keys';
|
|
2
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
3
|
import { createLogger } from '@aztec/foundation/log';
|
|
4
4
|
import { pushTestData } from '@aztec/foundation/testing';
|
|
5
5
|
import { Timer } from '@aztec/foundation/timer';
|
|
@@ -28,13 +28,12 @@ import {
|
|
|
28
28
|
type PrivateCallExecutionResult,
|
|
29
29
|
type PrivateExecutionResult,
|
|
30
30
|
TxRequest,
|
|
31
|
-
collectNoteHashLeafIndexMap,
|
|
32
31
|
collectNoteHashNullifierCounterMap,
|
|
33
32
|
getFinalMinRevertibleSideEffectCounter,
|
|
34
33
|
} from '@aztec/stdlib/tx';
|
|
35
34
|
import { VerificationKeyAsFields, VerificationKeyData, VkData } from '@aztec/stdlib/vks';
|
|
36
35
|
|
|
37
|
-
import { PrivateKernelResetPrivateInputsBuilder } from './hints/
|
|
36
|
+
import { PrivateKernelResetPrivateInputsBuilder } from './hints/private_kernel_reset_private_inputs_builder.js';
|
|
38
37
|
import type { PrivateKernelOracle } from './private_kernel_oracle.js';
|
|
39
38
|
|
|
40
39
|
const NULL_SIMULATE_OUTPUT: PrivateKernelSimulateOutput<PrivateKernelCircuitPublicInputs> = {
|
|
@@ -101,7 +100,6 @@ export class PrivateKernelExecutionProver {
|
|
|
101
100
|
|
|
102
101
|
const executionSteps: PrivateExecutionStep[] = [];
|
|
103
102
|
|
|
104
|
-
const noteHashLeafIndexMap = collectNoteHashLeafIndexMap(executionResult);
|
|
105
103
|
const noteHashNullifierCounterMap = collectNoteHashNullifierCounterMap(executionResult);
|
|
106
104
|
const minRevertibleSideEffectCounter = getFinalMinRevertibleSideEffectCounter(executionResult);
|
|
107
105
|
const splitCounter = isPrivateOnlyTx ? 0 : minRevertibleSideEffectCounter;
|
|
@@ -116,7 +114,7 @@ export class PrivateKernelExecutionProver {
|
|
|
116
114
|
);
|
|
117
115
|
while (resetBuilder.needsReset()) {
|
|
118
116
|
const witgenTimer = new Timer();
|
|
119
|
-
const privateInputs = await resetBuilder.build(this.oracle
|
|
117
|
+
const privateInputs = await resetBuilder.build(this.oracle);
|
|
120
118
|
output = generateWitnesses
|
|
121
119
|
? await this.proofCreator.generateResetOutput(privateInputs)
|
|
122
120
|
: await this.proofCreator.simulateReset(privateInputs);
|
|
@@ -224,7 +222,7 @@ export class PrivateKernelExecutionProver {
|
|
|
224
222
|
);
|
|
225
223
|
while (resetBuilder.needsReset()) {
|
|
226
224
|
const witgenTimer = new Timer();
|
|
227
|
-
const privateInputs = await resetBuilder.build(this.oracle
|
|
225
|
+
const privateInputs = await resetBuilder.build(this.oracle);
|
|
228
226
|
output = generateWitnesses
|
|
229
227
|
? await this.proofCreator.generateResetOutput(privateInputs)
|
|
230
228
|
: await this.proofCreator.simulateReset(privateInputs);
|
|
@@ -290,8 +288,8 @@ export class PrivateKernelExecutionProver {
|
|
|
290
288
|
},
|
|
291
289
|
});
|
|
292
290
|
|
|
293
|
-
// Hiding
|
|
294
|
-
// For simulation, we can end with the tail, since the
|
|
291
|
+
// Hiding kernel is only executed if we are generating witnesses.
|
|
292
|
+
// For simulation, we can end with the tail, since the Hiding kernel will simply return the same tail output.
|
|
295
293
|
if (generateWitnesses) {
|
|
296
294
|
const previousKernelVkData = await this.getVkData(tailOutput.verificationKey);
|
|
297
295
|
|
|
@@ -1,71 +1,152 @@
|
|
|
1
|
-
import { FUNCTION_TREE_HEIGHT, NOTE_HASH_TREE_HEIGHT, VK_TREE_HEIGHT } from '@aztec/constants';
|
|
2
|
-
import type { Fr
|
|
1
|
+
import { FUNCTION_TREE_HEIGHT, NOTE_HASH_TREE_HEIGHT, PUBLIC_DATA_TREE_HEIGHT, VK_TREE_HEIGHT } from '@aztec/constants';
|
|
2
|
+
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
|
+
import type { GrumpkinScalar, Point } from '@aztec/foundation/curves/grumpkin';
|
|
3
4
|
import { MembershipWitness } from '@aztec/foundation/trees';
|
|
5
|
+
import type { KeyStore } from '@aztec/key-store';
|
|
6
|
+
import { getVKIndex, getVKSiblingPath } from '@aztec/noir-protocol-circuits-types/vk-tree';
|
|
7
|
+
import { ProtocolContractAddress } from '@aztec/protocol-contracts';
|
|
4
8
|
import type { FunctionSelector } from '@aztec/stdlib/abi';
|
|
5
9
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
10
|
+
import { L2BlockHash } from '@aztec/stdlib/block';
|
|
11
|
+
import {
|
|
12
|
+
type ContractInstanceWithAddress,
|
|
13
|
+
computeContractClassIdPreimage,
|
|
14
|
+
computeSaltedInitializationHash,
|
|
15
|
+
} from '@aztec/stdlib/contract';
|
|
16
|
+
import { DelayedPublicMutableValues, DelayedPublicMutableValuesWithHash } from '@aztec/stdlib/delayed-public-mutable';
|
|
17
|
+
import { computePublicDataTreeLeafSlot } from '@aztec/stdlib/hash';
|
|
18
|
+
import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
6
19
|
import { UpdatedClassIdHints } from '@aztec/stdlib/kernel';
|
|
7
|
-
import type { PublicKeys } from '@aztec/stdlib/keys';
|
|
8
20
|
import type { NullifierMembershipWitness } from '@aztec/stdlib/trees';
|
|
9
21
|
import type { VerificationKeyAsFields } from '@aztec/stdlib/vks';
|
|
10
22
|
|
|
23
|
+
import type { ContractStore } from '../storage/contract_store/contract_store.js';
|
|
24
|
+
|
|
11
25
|
/**
|
|
12
26
|
* Provides functionality needed by the private kernel for interacting with our state trees.
|
|
13
|
-
* This is either PrivateKernelOracleImpl, or a mocked test implementation.
|
|
14
27
|
*/
|
|
15
|
-
export
|
|
28
|
+
export class PrivateKernelOracle {
|
|
29
|
+
constructor(
|
|
30
|
+
private contractStore: ContractStore,
|
|
31
|
+
private keyStore: KeyStore,
|
|
32
|
+
private node: AztecNode,
|
|
33
|
+
private blockHash: L2BlockHash,
|
|
34
|
+
) {}
|
|
35
|
+
|
|
16
36
|
/** Retrieves the preimage of a contract address from the registered contract instances db. */
|
|
17
|
-
getContractAddressPreimage(
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
37
|
+
public async getContractAddressPreimage(
|
|
38
|
+
address: AztecAddress,
|
|
39
|
+
): Promise<ContractInstanceWithAddress & { saltedInitializationHash: Fr }> {
|
|
40
|
+
const instance = await this.contractStore.getContractInstance(address);
|
|
41
|
+
if (!instance) {
|
|
42
|
+
throw new Error(`Contract instance not found when getting address preimage. Contract address: ${address}.`);
|
|
43
|
+
}
|
|
44
|
+
return {
|
|
45
|
+
saltedInitializationHash: await computeSaltedInitializationHash(instance),
|
|
46
|
+
...instance,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
23
49
|
|
|
24
50
|
/** Retrieves the preimage of a contract class id from the contract classes db. */
|
|
25
|
-
getContractClassIdPreimage(
|
|
26
|
-
contractClassId
|
|
27
|
-
|
|
51
|
+
public async getContractClassIdPreimage(contractClassId: Fr) {
|
|
52
|
+
const contractClass = await this.contractStore.getContractClass(contractClassId);
|
|
53
|
+
if (!contractClass) {
|
|
54
|
+
throw new Error(`Contract class not found when getting class id preimage. Class id: ${contractClassId}.`);
|
|
55
|
+
}
|
|
56
|
+
return computeContractClassIdPreimage(contractClass);
|
|
57
|
+
}
|
|
28
58
|
|
|
29
|
-
/**
|
|
30
|
-
|
|
31
|
-
*/
|
|
32
|
-
getFunctionMembershipWitness(
|
|
59
|
+
/** Returns a membership witness with the sibling path and leaf index in our private functions tree. */
|
|
60
|
+
public async getFunctionMembershipWitness(
|
|
33
61
|
contractClassId: Fr,
|
|
34
62
|
selector: FunctionSelector,
|
|
35
|
-
): Promise<MembershipWitness<typeof FUNCTION_TREE_HEIGHT
|
|
63
|
+
): Promise<MembershipWitness<typeof FUNCTION_TREE_HEIGHT>> {
|
|
64
|
+
const membershipWitness = await this.contractStore.getFunctionMembershipWitness(contractClassId, selector);
|
|
65
|
+
if (!membershipWitness) {
|
|
66
|
+
throw new Error(
|
|
67
|
+
`Membership witness not found for contract class id ${contractClassId} and selector ${selector}.`,
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
return membershipWitness;
|
|
71
|
+
}
|
|
36
72
|
|
|
37
73
|
/**
|
|
38
74
|
* Returns a membership witness with the sibling path and leaf index in our protocol VK indexed merkle tree.
|
|
39
75
|
* Used to validate the previous kernel's verification key.
|
|
40
76
|
*/
|
|
41
|
-
getVkMembershipWitness(vk: VerificationKeyAsFields): Promise<MembershipWitness<typeof VK_TREE_HEIGHT
|
|
77
|
+
public getVkMembershipWitness(vk: VerificationKeyAsFields): Promise<MembershipWitness<typeof VK_TREE_HEIGHT>> {
|
|
78
|
+
const leafIndex = getVKIndex(vk);
|
|
79
|
+
return Promise.resolve(new MembershipWitness(VK_TREE_HEIGHT, BigInt(leafIndex), getVKSiblingPath(leafIndex)));
|
|
80
|
+
}
|
|
42
81
|
|
|
43
|
-
/**
|
|
44
|
-
|
|
45
|
-
|
|
82
|
+
/** Returns a membership witness with the sibling path and leaf index in our note hash tree. */
|
|
83
|
+
getNoteHashMembershipWitness(noteHash: Fr): Promise<MembershipWitness<typeof NOTE_HASH_TREE_HEIGHT> | undefined> {
|
|
84
|
+
return this.node.getNoteHashMembershipWitness(this.blockHash, noteHash);
|
|
85
|
+
}
|
|
46
86
|
|
|
47
|
-
/**
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
87
|
+
/** Returns a membership witness with the sibling path and leaf index in our nullifier indexed merkle tree. */
|
|
88
|
+
getNullifierMembershipWitness(nullifier: Fr): Promise<NullifierMembershipWitness | undefined> {
|
|
89
|
+
return this.node.getNullifierMembershipWitness(this.blockHash, nullifier);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/** Returns the root of our note hash merkle tree. */
|
|
93
|
+
async getNoteHashTreeRoot(): Promise<Fr> {
|
|
94
|
+
const header = await this.node.getBlockHeader(this.blockHash);
|
|
95
|
+
if (!header) {
|
|
96
|
+
throw new Error(`No block header found for block hash ${this.blockHash}`);
|
|
97
|
+
}
|
|
98
|
+
return header.state.partial.noteHashTree.root;
|
|
99
|
+
}
|
|
55
100
|
|
|
56
101
|
/**
|
|
57
102
|
* Retrieves the sk_m corresponding to the pk_m.
|
|
58
103
|
* @throws If the provided public key is not associated with any of the registered accounts.
|
|
59
|
-
* @param
|
|
104
|
+
* @param masterPublicKey - The master public key to get secret key for.
|
|
60
105
|
* @returns A Promise that resolves to sk_m.
|
|
61
106
|
* @dev Used when feeding the sk_m to the kernel circuit for keys verification.
|
|
62
107
|
*/
|
|
63
|
-
getMasterSecretKey(masterPublicKey: Point): Promise<GrumpkinScalar
|
|
108
|
+
public getMasterSecretKey(masterPublicKey: Point): Promise<GrumpkinScalar> {
|
|
109
|
+
return this.keyStore.getMasterSecretKey(masterPublicKey);
|
|
110
|
+
}
|
|
64
111
|
|
|
65
112
|
/** Use debug data to get the function name corresponding to a selector. */
|
|
66
|
-
getDebugFunctionName(contractAddress: AztecAddress, selector: FunctionSelector): Promise<string | undefined
|
|
113
|
+
public getDebugFunctionName(contractAddress: AztecAddress, selector: FunctionSelector): Promise<string | undefined> {
|
|
114
|
+
return this.contractStore.getDebugFunctionName(contractAddress, selector);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Returns a membership witness and leaf index to our public data indexed merkle tree,
|
|
119
|
+
* along with an associated DelayedPublicMutable containing the class ID to update.
|
|
120
|
+
*/
|
|
121
|
+
public async getUpdatedClassIdHints(contractAddress: AztecAddress): Promise<UpdatedClassIdHints> {
|
|
122
|
+
const { delayedPublicMutableSlot, delayedPublicMutableHashSlot } =
|
|
123
|
+
await DelayedPublicMutableValuesWithHash.getContractUpdateSlots(contractAddress);
|
|
124
|
+
|
|
125
|
+
const hashLeafSlot = await computePublicDataTreeLeafSlot(
|
|
126
|
+
ProtocolContractAddress.ContractInstanceRegistry,
|
|
127
|
+
delayedPublicMutableHashSlot,
|
|
128
|
+
);
|
|
129
|
+
const updatedClassIdWitness = await this.node.getPublicDataWitness(this.blockHash, hashLeafSlot);
|
|
130
|
+
|
|
131
|
+
if (!updatedClassIdWitness) {
|
|
132
|
+
throw new Error(`No public data tree witness found for ${hashLeafSlot}`);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
const readStorage = (storageSlot: Fr) =>
|
|
136
|
+
this.node.getPublicStorageAt(this.blockHash, ProtocolContractAddress.ContractInstanceRegistry, storageSlot);
|
|
137
|
+
const delayedPublicMutableValues = await DelayedPublicMutableValues.readFromTree(
|
|
138
|
+
delayedPublicMutableSlot,
|
|
139
|
+
readStorage,
|
|
140
|
+
);
|
|
67
141
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
142
|
+
return new UpdatedClassIdHints(
|
|
143
|
+
new MembershipWitness(
|
|
144
|
+
PUBLIC_DATA_TREE_HEIGHT,
|
|
145
|
+
updatedClassIdWitness.index,
|
|
146
|
+
updatedClassIdWitness.siblingPath.toTuple(),
|
|
147
|
+
),
|
|
148
|
+
updatedClassIdWitness.leafPreimage,
|
|
149
|
+
delayedPublicMutableValues,
|
|
150
|
+
);
|
|
151
|
+
}
|
|
71
152
|
}
|