@aztec/pxe 0.0.1-commit.c2eed6949 → 0.0.1-commit.c52d6e7
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 +11 -118
- package/dest/bin/index.d.ts +2 -0
- package/dest/bin/index.d.ts.map +1 -0
- package/dest/bin/index.js +1 -0
- package/dest/bin/oracle_version_helpers.d.ts +20 -0
- package/dest/bin/oracle_version_helpers.d.ts.map +1 -0
- package/dest/bin/oracle_version_helpers.js +25 -0
- package/dest/block_synchronizer/block_stream_source.d.ts +10 -0
- package/dest/block_synchronizer/block_stream_source.d.ts.map +1 -0
- package/dest/block_synchronizer/block_stream_source.js +37 -0
- package/dest/block_synchronizer/block_synchronizer.d.ts +22 -16
- package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -1
- package/dest/block_synchronizer/block_synchronizer.js +71 -28
- package/dest/config/index.d.ts +8 -1
- package/dest/config/index.d.ts.map +1 -1
- package/dest/config/index.js +13 -14
- package/dest/config/package_info.js +1 -1
- package/dest/contract/contract_class_service.d.ts +24 -0
- package/dest/contract/contract_class_service.d.ts.map +1 -0
- package/dest/contract/contract_class_service.js +36 -0
- package/dest/contract/contract_sync_service.d.ts +48 -0
- package/dest/contract/contract_sync_service.d.ts.map +1 -0
- package/dest/contract/contract_sync_service.js +116 -0
- package/dest/contract/helpers.d.ts +7 -0
- package/dest/contract/helpers.d.ts.map +1 -0
- package/dest/contract/helpers.js +20 -0
- package/dest/contract/skip_sync_contracts.d.ts +11 -0
- package/dest/contract/skip_sync_contracts.d.ts.map +1 -0
- package/dest/contract/skip_sync_contracts.js +18 -0
- package/dest/contract_function_simulator/anchored_contract_data.d.ts +36 -0
- package/dest/contract_function_simulator/anchored_contract_data.d.ts.map +1 -0
- package/dest/contract_function_simulator/anchored_contract_data.js +54 -0
- package/dest/contract_function_simulator/contract_function_simulator.d.ts +27 -28
- package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.js +86 -59
- package/dest/contract_function_simulator/ephemeral_array_service.d.ts +28 -0
- package/dest/contract_function_simulator/ephemeral_array_service.d.ts.map +1 -0
- package/dest/contract_function_simulator/ephemeral_array_service.js +78 -0
- package/dest/contract_function_simulator/execution_note_cache.d.ts +4 -10
- package/dest/contract_function_simulator/execution_note_cache.d.ts.map +1 -1
- package/dest/contract_function_simulator/execution_note_cache.js +8 -28
- package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts +5 -9
- package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts.map +1 -1
- package/dest/contract_function_simulator/execution_tagging_index_cache.js +3 -7
- package/dest/contract_function_simulator/index.d.ts +26 -6
- package/dest/contract_function_simulator/index.d.ts.map +1 -1
- package/dest/contract_function_simulator/index.js +11 -4
- package/dest/contract_function_simulator/noir-structs/bounded_vec.d.ts +29 -0
- package/dest/contract_function_simulator/noir-structs/bounded_vec.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/bounded_vec.js +30 -0
- package/dest/contract_function_simulator/noir-structs/contract_class_log_data.d.ts +9 -0
- package/dest/contract_function_simulator/noir-structs/contract_class_log_data.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/contract_class_log_data.js +1 -0
- package/dest/contract_function_simulator/noir-structs/embedded_curve_point.d.ts +7 -0
- package/dest/contract_function_simulator/noir-structs/embedded_curve_point.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/embedded_curve_point.js +1 -0
- package/dest/contract_function_simulator/noir-structs/ephemeral_array.d.ts +37 -0
- package/dest/contract_function_simulator/noir-structs/ephemeral_array.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/ephemeral_array.js +59 -0
- package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts +5 -5
- 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 -9
- package/dest/contract_function_simulator/noir-structs/fact.d.ts +16 -0
- package/dest/contract_function_simulator/noir-structs/fact.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/fact.js +6 -0
- package/dest/contract_function_simulator/noir-structs/fact_collection.d.ts +27 -0
- package/dest/contract_function_simulator/noir-structs/fact_collection.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/fact_collection.js +31 -0
- package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts +19 -10
- 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 +12 -24
- package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts +11 -9
- 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 +2 -61
- package/dest/contract_function_simulator/noir-structs/note_data.d.ts +27 -0
- package/dest/contract_function_simulator/noir-structs/note_data.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/note_data.js +3 -0
- package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +5 -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 +8 -10
- package/dest/contract_function_simulator/noir-structs/option.d.ts +59 -0
- package/dest/contract_function_simulator/noir-structs/option.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/option.js +67 -0
- package/dest/contract_function_simulator/noir-structs/origin_block.d.ts +11 -0
- package/dest/contract_function_simulator/noir-structs/origin_block.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/origin_block.js +5 -0
- package/dest/contract_function_simulator/noir-structs/pending_tagged_log.d.ts +11 -0
- package/dest/contract_function_simulator/noir-structs/pending_tagged_log.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/pending_tagged_log.js +4 -0
- package/dest/contract_function_simulator/noir-structs/provided_secret.d.ts +8 -0
- package/dest/contract_function_simulator/noir-structs/provided_secret.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/provided_secret.js +1 -0
- package/dest/contract_function_simulator/noir-structs/resolved_tagging_strategy.d.ts +28 -0
- package/dest/contract_function_simulator/noir-structs/resolved_tagging_strategy.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/resolved_tagging_strategy.js +50 -0
- package/dest/contract_function_simulator/noir-structs/resolved_tx.d.ts +19 -0
- package/dest/contract_function_simulator/noir-structs/resolved_tx.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/resolved_tx.js +9 -0
- package/dest/contract_function_simulator/noir-structs/tx_effect_data.d.ts +15 -0
- package/dest/contract_function_simulator/noir-structs/tx_effect_data.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/tx_effect_data.js +5 -0
- package/dest/contract_function_simulator/noir-structs/utility_context.d.ts +6 -11
- package/dest/contract_function_simulator/noir-structs/utility_context.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/utility_context.js +1 -20
- package/dest/contract_function_simulator/oracle/acir_callback.d.ts +21 -0
- package/dest/contract_function_simulator/oracle/acir_callback.d.ts.map +1 -0
- package/dest/contract_function_simulator/oracle/acir_callback.js +115 -0
- package/dest/contract_function_simulator/oracle/index.d.ts +2 -13
- package/dest/contract_function_simulator/oracle/index.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/index.js +1 -1
- package/dest/contract_function_simulator/oracle/interfaces.d.ts +15 -103
- package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/interfaces.js +2 -2
- package/dest/contract_function_simulator/oracle/legacy_oracle_registry.d.ts +39 -0
- package/dest/contract_function_simulator/oracle/legacy_oracle_registry.d.ts.map +1 -0
- package/dest/contract_function_simulator/oracle/legacy_oracle_registry.js +107 -0
- package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts +3 -14
- 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 -24
- package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts +2 -2
- package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/note_packing_utils.js +2 -2
- package/dest/contract_function_simulator/oracle/oracle_registry.d.ts +139 -0
- package/dest/contract_function_simulator/oracle/oracle_registry.d.ts.map +1 -0
- package/dest/contract_function_simulator/oracle/oracle_registry.js +1016 -0
- package/dest/contract_function_simulator/oracle/oracle_type_mappings.d.ts +274 -0
- package/dest/contract_function_simulator/oracle/oracle_type_mappings.d.ts.map +1 -0
- package/dest/contract_function_simulator/oracle/oracle_type_mappings.js +1253 -0
- package/dest/contract_function_simulator/oracle/private_execution.d.ts +1 -1
- package/dest/contract_function_simulator/oracle/private_execution.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution.js +3 -4
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +52 -42
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.js +197 -65
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +164 -77
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +607 -193
- package/dest/contract_function_simulator/pick_notes.d.ts +1 -1
- package/dest/contract_function_simulator/pick_notes.d.ts.map +1 -1
- package/dest/contract_function_simulator/pick_notes.js +20 -3
- package/dest/contract_function_simulator/transient_array_service.d.ts +31 -0
- package/dest/contract_function_simulator/transient_array_service.d.ts.map +1 -0
- package/dest/contract_function_simulator/transient_array_service.js +62 -0
- package/dest/contract_logging.d.ts +9 -4
- package/dest/contract_logging.d.ts.map +1 -1
- package/dest/contract_logging.js +21 -6
- package/dest/debug/pxe_debug_utils.d.ts +4 -9
- package/dest/debug/pxe_debug_utils.d.ts.map +1 -1
- package/dest/debug/pxe_debug_utils.js +0 -6
- package/dest/entrypoints/client/bundle/index.d.ts +2 -2
- package/dest/entrypoints/client/bundle/index.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/index.js +1 -1
- package/dest/entrypoints/client/bundle/utils.d.ts +2 -2
- package/dest/entrypoints/client/bundle/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/utils.js +27 -8
- package/dest/entrypoints/client/lazy/index.d.ts +2 -2
- package/dest/entrypoints/client/lazy/index.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/index.js +1 -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 +27 -8
- package/dest/entrypoints/client/store.d.ts +14 -0
- package/dest/entrypoints/client/store.d.ts.map +1 -0
- package/dest/entrypoints/client/store.js +42 -0
- package/dest/entrypoints/pxe_creation_options.d.ts +16 -2
- package/dest/entrypoints/pxe_creation_options.d.ts.map +1 -1
- package/dest/entrypoints/pxe_creation_options.js +3 -1
- package/dest/entrypoints/server/index.d.ts +7 -4
- package/dest/entrypoints/server/index.d.ts.map +1 -1
- package/dest/entrypoints/server/index.js +5 -3
- package/dest/entrypoints/server/store.d.ts +18 -0
- package/dest/entrypoints/server/store.d.ts.map +1 -0
- package/dest/entrypoints/server/store.js +28 -0
- package/dest/entrypoints/server/utils.d.ts +4 -3
- package/dest/entrypoints/server/utils.d.ts.map +1 -1
- package/dest/entrypoints/server/utils.js +28 -8
- package/dest/error_enriching.d.ts +5 -3
- package/dest/error_enriching.d.ts.map +1 -1
- package/dest/error_enriching.js +13 -11
- package/dest/events/event_service.d.ts +21 -5
- package/dest/events/event_service.d.ts.map +1 -1
- package/dest/events/event_service.js +50 -17
- package/dest/events/private_event_filter_validator.d.ts +3 -2
- package/dest/events/private_event_filter_validator.d.ts.map +1 -1
- package/dest/events/private_event_filter_validator.js +15 -0
- package/dest/hooks/authorize_utility_call.d.ts +41 -0
- package/dest/hooks/authorize_utility_call.d.ts.map +1 -0
- package/dest/hooks/authorize_utility_call.js +4 -0
- package/dest/hooks/execution_hooks.d.ts +62 -0
- package/dest/hooks/execution_hooks.d.ts.map +1 -0
- package/dest/hooks/execution_hooks.js +9 -0
- package/dest/hooks/index.d.ts +5 -0
- package/dest/hooks/index.d.ts.map +1 -0
- package/dest/hooks/index.js +2 -0
- package/dest/hooks/resolve_custom_request.d.ts +23 -0
- package/dest/hooks/resolve_custom_request.d.ts.map +1 -0
- package/dest/hooks/resolve_custom_request.js +3 -0
- package/dest/hooks/resolve_tagging_secret_strategy.d.ts +50 -0
- package/dest/hooks/resolve_tagging_secret_strategy.d.ts.map +1 -0
- package/dest/hooks/resolve_tagging_secret_strategy.js +3 -0
- package/dest/logs/log_service.d.ts +21 -11
- package/dest/logs/log_service.d.ts.map +1 -1
- package/dest/logs/log_service.js +180 -82
- package/dest/messages/tx_resolver_service.d.ts +28 -0
- package/dest/messages/tx_resolver_service.d.ts.map +1 -0
- package/dest/messages/tx_resolver_service.js +61 -0
- package/dest/node/benchmarked_node.d.ts +20 -0
- package/dest/node/benchmarked_node.d.ts.map +1 -0
- package/dest/node/benchmarked_node.js +94 -0
- package/dest/node/caching_aztec_node.d.ts +24 -0
- package/dest/node/caching_aztec_node.d.ts.map +1 -0
- package/dest/node/caching_aztec_node.js +267 -0
- package/dest/notes/note_service.d.ts +34 -7
- package/dest/notes/note_service.d.ts.map +1 -1
- package/dest/notes/note_service.js +81 -57
- package/dest/notes_filter.d.ts +2 -3
- package/dest/notes_filter.d.ts.map +1 -1
- package/dest/oracle_version.d.ts +4 -3
- package/dest/oracle_version.d.ts.map +1 -1
- package/dest/oracle_version.js +20 -10
- package/dest/private_kernel/batch_planner.d.ts +47 -0
- package/dest/private_kernel/batch_planner.d.ts.map +1 -0
- package/dest/private_kernel/batch_planner.js +104 -0
- package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts +1 -1
- package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts.map +1 -1
- package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.js +7 -3
- package/dest/private_kernel/hints/test_utils.d.ts +1 -1
- package/dest/private_kernel/hints/test_utils.d.ts.map +1 -1
- package/dest/private_kernel/hints/test_utils.js +3 -4
- package/dest/private_kernel/private_kernel_execution_prover.d.ts +6 -2
- package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_execution_prover.js +203 -89
- package/dest/private_kernel/private_kernel_oracle.d.ts +12 -10
- package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_oracle.js +40 -26
- package/dest/pxe.d.ts +167 -55
- package/dest/pxe.d.ts.map +1 -1
- package/dest/pxe.js +366 -216
- package/dest/storage/allowed_scopes.d.ts +6 -0
- package/dest/storage/allowed_scopes.d.ts.map +1 -0
- package/dest/storage/allowed_scopes.js +7 -0
- package/dest/storage/anchor_block_store/anchor_block_store.d.ts +9 -6
- package/dest/storage/anchor_block_store/anchor_block_store.d.ts.map +1 -1
- package/dest/storage/anchor_block_store/anchor_block_store.js +9 -7
- package/dest/storage/backwards_compatibility_tests/kv_store_snapshot.d.ts +42 -0
- package/dest/storage/backwards_compatibility_tests/kv_store_snapshot.d.ts.map +1 -0
- package/dest/storage/backwards_compatibility_tests/kv_store_snapshot.js +93 -0
- package/dest/storage/backwards_compatibility_tests/schema_tests.d.ts +15 -0
- package/dest/storage/backwards_compatibility_tests/schema_tests.d.ts.map +1 -0
- package/dest/storage/backwards_compatibility_tests/schema_tests.js +671 -0
- package/dest/storage/backwards_compatibility_tests/store_spy.d.ts +19 -0
- package/dest/storage/backwards_compatibility_tests/store_spy.d.ts.map +1 -0
- package/dest/storage/backwards_compatibility_tests/store_spy.js +63 -0
- package/dest/storage/capsule_store/capsule_service.d.ts +21 -0
- package/dest/storage/capsule_store/capsule_service.d.ts.map +1 -0
- package/dest/storage/capsule_store/capsule_service.js +47 -0
- package/dest/storage/capsule_store/capsule_store.d.ts +9 -9
- package/dest/storage/capsule_store/capsule_store.d.ts.map +1 -1
- package/dest/storage/capsule_store/capsule_store.js +36 -28
- package/dest/storage/capsule_store/index.d.ts +2 -1
- package/dest/storage/capsule_store/index.d.ts.map +1 -1
- package/dest/storage/capsule_store/index.js +1 -0
- package/dest/storage/contract_store/contract_store.d.ts +27 -24
- package/dest/storage/contract_store/contract_store.d.ts.map +1 -1
- package/dest/storage/contract_store/contract_store.js +71 -99
- package/dest/storage/fact_store/fact_service.d.ts +22 -0
- package/dest/storage/fact_store/fact_service.d.ts.map +1 -0
- package/dest/storage/fact_store/fact_service.js +45 -0
- package/dest/storage/fact_store/fact_store.d.ts +95 -0
- package/dest/storage/fact_store/fact_store.d.ts.map +1 -0
- package/dest/storage/fact_store/fact_store.js +408 -0
- package/dest/storage/fact_store/fact_store_keys.d.ts +34 -0
- package/dest/storage/fact_store/fact_store_keys.d.ts.map +1 -0
- package/dest/storage/fact_store/fact_store_keys.js +50 -0
- package/dest/storage/fact_store/index.d.ts +6 -0
- package/dest/storage/fact_store/index.d.ts.map +1 -0
- package/dest/storage/fact_store/index.js +4 -0
- package/dest/storage/fact_store/origin_state.d.ts +59 -0
- package/dest/storage/fact_store/origin_state.d.ts.map +1 -0
- package/dest/storage/fact_store/origin_state.js +60 -0
- package/dest/storage/fact_store/stored_fact.d.ts +32 -0
- package/dest/storage/fact_store/stored_fact.d.ts.map +1 -0
- package/dest/storage/fact_store/stored_fact.js +64 -0
- package/dest/storage/index.d.ts +3 -2
- package/dest/storage/index.d.ts.map +1 -1
- package/dest/storage/index.js +2 -1
- package/dest/storage/metadata.d.ts +2 -2
- package/dest/storage/metadata.d.ts.map +1 -1
- package/dest/storage/metadata.js +1 -1
- package/dest/storage/note_store/note_store.d.ts +42 -33
- package/dest/storage/note_store/note_store.d.ts.map +1 -1
- package/dest/storage/note_store/note_store.js +199 -170
- package/dest/storage/note_store/stored_note.d.ts +3 -8
- package/dest/storage/note_store/stored_note.d.ts.map +1 -1
- package/dest/storage/note_store/stored_note.js +4 -20
- package/dest/storage/open_pxe_stores.d.ts +35 -0
- package/dest/storage/open_pxe_stores.d.ts.map +1 -0
- package/dest/storage/open_pxe_stores.js +29 -0
- package/dest/storage/private_event_store/private_event_store.d.ts +13 -16
- package/dest/storage/private_event_store/private_event_store.d.ts.map +1 -1
- package/dest/storage/private_event_store/private_event_store.js +43 -43
- package/dest/storage/private_event_store/stored_private_event.js +1 -1
- package/dest/storage/store_identity.d.ts +35 -0
- package/dest/storage/store_identity.d.ts.map +1 -0
- package/dest/storage/store_identity.js +44 -0
- package/dest/storage/tagging_store/index.d.ts +2 -2
- package/dest/storage/tagging_store/index.d.ts.map +1 -1
- package/dest/storage/tagging_store/index.js +1 -1
- package/dest/storage/tagging_store/recipient_tagging_store.d.ts +6 -6
- package/dest/storage/tagging_store/recipient_tagging_store.d.ts.map +1 -1
- package/dest/storage/tagging_store/sender_tagging_store.d.ts +44 -13
- package/dest/storage/tagging_store/sender_tagging_store.d.ts.map +1 -1
- package/dest/storage/tagging_store/sender_tagging_store.js +84 -32
- package/dest/storage/tagging_store/tagging_secret_sources_store.d.ts +51 -0
- package/dest/storage/tagging_store/tagging_secret_sources_store.d.ts.map +1 -0
- package/dest/storage/tagging_store/tagging_secret_sources_store.js +105 -0
- package/dest/tagging/constants.d.ts +11 -2
- package/dest/tagging/constants.d.ts.map +1 -1
- package/dest/tagging/constants.js +38 -10
- package/dest/tagging/get_all_logs_by_tags.d.ts +55 -10
- package/dest/tagging/get_all_logs_by_tags.d.ts.map +1 -1
- package/dest/tagging/get_all_logs_by_tags.js +53 -35
- package/dest/tagging/index.d.ts +7 -6
- package/dest/tagging/index.d.ts.map +1 -1
- package/dest/tagging/index.js +6 -5
- package/dest/tagging/persist_sender_tagging_index_ranges.d.ts +29 -0
- package/dest/tagging/persist_sender_tagging_index_ranges.d.ts.map +1 -0
- package/dest/tagging/persist_sender_tagging_index_ranges.js +42 -0
- package/dest/tagging/recipient_sync/sync_tagged_private_logs.d.ts +74 -0
- package/dest/tagging/recipient_sync/sync_tagged_private_logs.d.ts.map +1 -0
- package/dest/tagging/recipient_sync/sync_tagged_private_logs.js +234 -0
- package/dest/tagging/recipient_sync/utils/find_highest_indexes.d.ts +3 -3
- package/dest/tagging/recipient_sync/utils/find_highest_indexes.d.ts.map +1 -1
- package/dest/tagging/reconcile_tagging_index_ranges.d.ts +36 -0
- package/dest/tagging/reconcile_tagging_index_ranges.d.ts.map +1 -0
- package/dest/tagging/reconcile_tagging_index_ranges.js +74 -0
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts +8 -6
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts.map +1 -1
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.js +24 -27
- package/dest/tagging/sender_sync/utils/classify_pending_txs.d.ts +22 -0
- package/dest/tagging/sender_sync/utils/classify_pending_txs.d.ts.map +1 -0
- package/dest/tagging/sender_sync/utils/classify_pending_txs.js +61 -0
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts +17 -7
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts.map +1 -1
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.js +37 -36
- package/dest/tagging/sender_sync/utils/resolve_pending_txs.d.ts +29 -0
- package/dest/tagging/sender_sync/utils/resolve_pending_txs.d.ts.map +1 -0
- package/dest/tagging/sender_sync/utils/resolve_pending_txs.js +41 -0
- package/dest/tagging/sender_sync/utils/test_utils.d.ts +16 -0
- package/dest/tagging/sender_sync/utils/test_utils.d.ts.map +1 -0
- package/dest/tagging/sender_sync/utils/test_utils.js +24 -0
- package/dest/tagging/testing/tag_query_test_utils.d.ts +6 -0
- package/dest/tagging/testing/tag_query_test_utils.d.ts.map +1 -0
- package/dest/tagging/testing/tag_query_test_utils.js +10 -0
- package/package.json +20 -17
- package/src/bin/check_oracle_version.ts +10 -143
- package/src/bin/index.ts +1 -0
- package/src/bin/oracle_version_helpers.ts +30 -0
- package/src/block_synchronizer/block_stream_source.ts +42 -0
- package/src/block_synchronizer/block_synchronizer.ts +86 -40
- package/src/config/index.ts +15 -8
- package/src/config/package_info.ts +1 -1
- package/src/contract/contract_class_service.ts +45 -0
- package/src/contract/contract_sync_service.ts +176 -0
- package/src/contract/helpers.ts +35 -0
- package/src/contract/skip_sync_contracts.ts +23 -0
- package/src/contract_function_simulator/anchored_contract_data.ts +74 -0
- package/src/contract_function_simulator/contract_function_simulator.ts +140 -75
- package/src/contract_function_simulator/ephemeral_array_service.ts +110 -0
- package/src/contract_function_simulator/execution_note_cache.ts +8 -29
- package/src/contract_function_simulator/execution_tagging_index_cache.ts +5 -9
- package/src/contract_function_simulator/index.ts +89 -5
- package/src/contract_function_simulator/noir-structs/bounded_vec.ts +43 -0
- package/src/contract_function_simulator/noir-structs/contract_class_log_data.ts +9 -0
- package/src/contract_function_simulator/noir-structs/embedded_curve_point.ts +4 -0
- package/src/contract_function_simulator/noir-structs/ephemeral_array.ts +66 -0
- package/src/contract_function_simulator/noir-structs/event_validation_request.ts +5 -7
- package/src/contract_function_simulator/noir-structs/fact.ts +13 -0
- package/src/contract_function_simulator/noir-structs/fact_collection.ts +64 -0
- package/src/contract_function_simulator/noir-structs/log_retrieval_request.ts +27 -20
- package/src/contract_function_simulator/noir-structs/log_retrieval_response.ts +14 -61
- package/src/contract_function_simulator/noir-structs/note_data.ts +27 -0
- package/src/contract_function_simulator/noir-structs/note_validation_request.ts +6 -8
- package/src/contract_function_simulator/noir-structs/option.ts +75 -0
- package/src/contract_function_simulator/noir-structs/origin_block.ts +8 -0
- package/src/contract_function_simulator/noir-structs/pending_tagged_log.ts +12 -0
- package/src/contract_function_simulator/noir-structs/provided_secret.ts +5 -0
- package/src/contract_function_simulator/noir-structs/resolved_tagging_strategy.ts +66 -0
- package/src/contract_function_simulator/noir-structs/resolved_tx.ts +19 -0
- package/src/contract_function_simulator/noir-structs/tx_effect_data.ts +16 -0
- package/src/contract_function_simulator/noir-structs/utility_context.ts +5 -17
- package/src/contract_function_simulator/oracle/acir_callback.ts +154 -0
- package/src/contract_function_simulator/oracle/index.ts +1 -15
- package/src/contract_function_simulator/oracle/interfaces.ts +11 -176
- package/src/contract_function_simulator/oracle/legacy_oracle_registry.ts +147 -0
- package/src/contract_function_simulator/oracle/message_load_oracle_inputs.ts +6 -21
- package/src/contract_function_simulator/oracle/note_packing_utils.ts +3 -3
- package/src/contract_function_simulator/oracle/oracle_registry.ts +710 -0
- package/src/contract_function_simulator/oracle/oracle_type_mappings.ts +1067 -0
- package/src/contract_function_simulator/oracle/private_execution.ts +3 -4
- package/src/contract_function_simulator/oracle/private_execution_oracle.ts +247 -83
- package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +890 -305
- package/src/contract_function_simulator/pick_notes.ts +22 -3
- package/src/contract_function_simulator/transient_array_service.ts +91 -0
- package/src/contract_logging.ts +18 -5
- package/src/debug/pxe_debug_utils.ts +4 -12
- package/src/entrypoints/client/bundle/index.ts +1 -1
- package/src/entrypoints/client/bundle/utils.ts +32 -8
- package/src/entrypoints/client/lazy/index.ts +1 -1
- package/src/entrypoints/client/lazy/utils.ts +32 -8
- package/src/entrypoints/client/store.ts +54 -0
- package/src/entrypoints/pxe_creation_options.ts +21 -1
- package/src/entrypoints/server/index.ts +7 -3
- package/src/entrypoints/server/store.ts +47 -0
- package/src/entrypoints/server/utils.ts +45 -14
- package/src/error_enriching.ts +27 -11
- package/src/events/event_service.ts +84 -26
- package/src/events/private_event_filter_validator.ts +21 -1
- package/src/hooks/authorize_utility_call.ts +44 -0
- package/src/hooks/execution_hooks.ts +68 -0
- package/src/hooks/index.ts +13 -0
- package/src/hooks/resolve_custom_request.ts +24 -0
- package/src/hooks/resolve_tagging_secret_strategy.ts +60 -0
- package/src/logs/log_service.ts +225 -145
- package/src/messages/tx_resolver_service.ts +80 -0
- package/src/node/benchmarked_node.ts +140 -0
- package/src/node/caching_aztec_node.ts +406 -0
- package/src/notes/note_service.ts +126 -86
- package/src/notes_filter.ts +1 -3
- package/src/oracle_version.ts +20 -10
- package/src/private_kernel/batch_planner.ts +168 -0
- package/src/private_kernel/hints/private_kernel_reset_private_inputs_builder.ts +12 -2
- package/src/private_kernel/hints/test_utils.ts +3 -10
- package/src/private_kernel/private_kernel_execution_prover.ts +335 -121
- package/src/private_kernel/private_kernel_oracle.ts +58 -29
- package/src/pxe.ts +565 -249
- package/src/storage/allowed_scopes.ts +14 -0
- package/src/storage/anchor_block_store/anchor_block_store.ts +9 -7
- package/src/storage/backwards_compatibility_tests/__snapshots__/AddressStore.json +22 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/AnchorBlockStore.json +3 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/CapsuleStore.json +16 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/ContractStore.json +28 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/FactStore.json +40 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/KeyStore.json +52 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/L2TipsKVStore.json +40 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/NoteStore.json +56 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/PrivateEventStore.json +44 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/RecipientTaggingStore.json +26 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/SenderTaggingStore.json +30 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/TaggingSecretSourcesStore.json +30 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/opened_stores.json +117 -0
- package/src/storage/backwards_compatibility_tests/kv_store_snapshot.ts +122 -0
- package/src/storage/backwards_compatibility_tests/schema_tests.ts +803 -0
- package/src/storage/backwards_compatibility_tests/store_spy.ts +73 -0
- package/src/storage/capsule_store/capsule_service.ts +85 -0
- package/src/storage/capsule_store/capsule_store.ts +44 -26
- package/src/storage/capsule_store/index.ts +1 -0
- package/src/storage/contract_store/contract_store.ts +98 -125
- package/src/storage/fact_store/fact_service.ts +69 -0
- package/src/storage/fact_store/fact_store.ts +487 -0
- package/src/storage/fact_store/fact_store_keys.ts +75 -0
- package/src/storage/fact_store/index.ts +15 -0
- package/src/storage/fact_store/origin_state.ts +84 -0
- package/src/storage/fact_store/stored_fact.ts +80 -0
- package/src/storage/index.ts +2 -1
- package/src/storage/metadata.ts +1 -1
- package/src/storage/note_store/note_store.ts +228 -192
- package/src/storage/note_store/stored_note.ts +5 -27
- package/src/storage/open_pxe_stores.ts +52 -0
- package/src/storage/private_event_store/private_event_store.ts +52 -54
- package/src/storage/private_event_store/stored_private_event.ts +1 -1
- package/src/storage/store_identity.ts +72 -0
- package/src/storage/tagging_store/index.ts +1 -1
- package/src/storage/tagging_store/recipient_tagging_store.ts +5 -9
- package/src/storage/tagging_store/sender_tagging_store.ts +118 -46
- package/src/storage/tagging_store/tagging_secret_sources_store.ts +138 -0
- package/src/tagging/constants.ts +42 -10
- package/src/tagging/get_all_logs_by_tags.ts +113 -49
- package/src/tagging/index.ts +11 -5
- package/src/tagging/persist_sender_tagging_index_ranges.ts +57 -0
- package/src/tagging/recipient_sync/sync_tagged_private_logs.ts +355 -0
- package/src/tagging/recipient_sync/utils/find_highest_indexes.ts +2 -2
- package/src/tagging/reconcile_tagging_index_ranges.ts +102 -0
- package/src/tagging/sender_sync/sync_sender_tagging_indexes.ts +30 -38
- package/src/tagging/sender_sync/utils/classify_pending_txs.ts +91 -0
- package/src/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.ts +48 -43
- package/src/tagging/sender_sync/utils/resolve_pending_txs.ts +64 -0
- package/src/tagging/sender_sync/utils/test_utils.ts +46 -0
- package/src/tagging/testing/tag_query_test_utils.ts +11 -0
- package/dest/access_scopes.d.ts +0 -9
- package/dest/access_scopes.d.ts.map +0 -1
- package/dest/access_scopes.js +0 -6
- package/dest/contract_function_simulator/benchmarked_node.d.ts +0 -9
- package/dest/contract_function_simulator/benchmarked_node.d.ts.map +0 -1
- package/dest/contract_function_simulator/benchmarked_node.js +0 -77
- package/dest/contract_function_simulator/noir-structs/message_tx_context.d.ts +0 -16
- package/dest/contract_function_simulator/noir-structs/message_tx_context.d.ts.map +0 -1
- package/dest/contract_function_simulator/noir-structs/message_tx_context.js +0 -57
- package/dest/contract_function_simulator/oracle/legacy_oracle_mappings.d.ts +0 -9
- package/dest/contract_function_simulator/oracle/legacy_oracle_mappings.d.ts.map +0 -1
- package/dest/contract_function_simulator/oracle/legacy_oracle_mappings.js +0 -42
- package/dest/contract_function_simulator/oracle/oracle.d.ts +0 -61
- package/dest/contract_function_simulator/oracle/oracle.d.ts.map +0 -1
- package/dest/contract_function_simulator/oracle/oracle.js +0 -437
- package/dest/contract_function_simulator/proxied_contract_data_source.d.ts +0 -6
- package/dest/contract_function_simulator/proxied_contract_data_source.d.ts.map +0 -1
- package/dest/contract_function_simulator/proxied_contract_data_source.js +0 -80
- package/dest/contract_sync/contract_sync_service.d.ts +0 -45
- package/dest/contract_sync/contract_sync_service.d.ts.map +0 -1
- package/dest/contract_sync/contract_sync_service.js +0 -114
- package/dest/contract_sync/helpers.d.ts +0 -29
- package/dest/contract_sync/helpers.d.ts.map +0 -1
- package/dest/contract_sync/helpers.js +0 -55
- package/dest/messages/message_context_service.d.ts +0 -17
- package/dest/messages/message_context_service.d.ts.map +0 -1
- package/dest/messages/message_context_service.js +0 -36
- package/dest/storage/tagging_store/sender_address_book_store.d.ts +0 -14
- package/dest/storage/tagging_store/sender_address_book_store.d.ts.map +0 -1
- package/dest/storage/tagging_store/sender_address_book_store.js +0 -36
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts +0 -14
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts.map +0 -1
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.js +0 -99
- package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts +0 -14
- package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts.map +0 -1
- package/dest/tagging/recipient_sync/utils/load_logs_for_range.js +0 -33
- package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts +0 -12
- package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts.map +0 -1
- package/dest/tagging/sender_sync/utils/get_status_change_of_pending.js +0 -39
- package/src/access_scopes.ts +0 -9
- package/src/contract_function_simulator/benchmarked_node.ts +0 -103
- package/src/contract_function_simulator/noir-structs/message_tx_context.ts +0 -55
- package/src/contract_function_simulator/oracle/legacy_oracle_mappings.ts +0 -135
- package/src/contract_function_simulator/oracle/oracle.ts +0 -675
- package/src/contract_function_simulator/proxied_contract_data_source.ts +0 -83
- package/src/contract_sync/contract_sync_service.ts +0 -181
- package/src/contract_sync/helpers.ts +0 -98
- package/src/messages/message_context_service.ts +0 -45
- package/src/storage/tagging_store/sender_address_book_store.ts +0 -48
- package/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts +0 -140
- package/src/tagging/recipient_sync/utils/load_logs_for_range.ts +0 -44
- package/src/tagging/sender_sync/utils/get_status_change_of_pending.ts +0 -51
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import type { Logger } from '@aztec/foundation/log';
|
|
2
|
-
import type { FunctionCall, FunctionSelector } from '@aztec/stdlib/abi';
|
|
3
|
-
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
|
-
import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
5
|
-
import type { BlockHeader } from '@aztec/stdlib/tx';
|
|
6
|
-
import type { AccessScopes } from '../access_scopes.js';
|
|
7
|
-
import type { StagedStore } from '../job_coordinator/job_coordinator.js';
|
|
8
|
-
import type { ContractStore } from '../storage/contract_store/contract_store.js';
|
|
9
|
-
import type { NoteStore } from '../storage/note_store/note_store.js';
|
|
10
|
-
/**
|
|
11
|
-
* Service for syncing the private state of contracts and verifying that the PXE holds the current class artifact.
|
|
12
|
-
* It uses a cache to avoid redundant sync operations - the cache is wiped when the anchor block changes.
|
|
13
|
-
*
|
|
14
|
-
* TODO: The StagedStore naming is broken here. Figure out a better name.
|
|
15
|
-
*/
|
|
16
|
-
export declare class ContractSyncService implements StagedStore {
|
|
17
|
-
#private;
|
|
18
|
-
private aztecNode;
|
|
19
|
-
private contractStore;
|
|
20
|
-
private noteStore;
|
|
21
|
-
private log;
|
|
22
|
-
readonly storeName = "contract_sync";
|
|
23
|
-
private syncedContracts;
|
|
24
|
-
private excludedFromSync;
|
|
25
|
-
constructor(aztecNode: AztecNode, contractStore: ContractStore, noteStore: NoteStore, log: Logger);
|
|
26
|
-
/** Sets contracts that should be skipped during sync for a specific job. */
|
|
27
|
-
setExcludedFromSync(jobId: string, addresses: Set<string>): void;
|
|
28
|
-
/**
|
|
29
|
-
* Ensures a contract's private state is synchronized and that the PXE holds the current class artifact.
|
|
30
|
-
* Uses a cache to avoid redundant sync operations - the cache is wiped when the anchor block changes.
|
|
31
|
-
* @param contractAddress - The address of the contract to sync.
|
|
32
|
-
* @param functionToInvokeAfterSync - The function selector that will be called after sync (used to validate it's
|
|
33
|
-
* not sync_state itself).
|
|
34
|
-
* @param utilityExecutor - Executor function for running the sync_state utility function.
|
|
35
|
-
* @param scopes - Access scopes to pass through to the utility executor (affects whose account's private state is discovered).
|
|
36
|
-
*/
|
|
37
|
-
ensureContractSynced(contractAddress: AztecAddress, functionToInvokeAfterSync: FunctionSelector | null, utilityExecutor: (call: FunctionCall, scopes: AccessScopes) => Promise<any>, anchorBlockHeader: BlockHeader, jobId: string, scopes: AccessScopes): Promise<void>;
|
|
38
|
-
/** Clears sync cache entries for the given scopes of a contract. Also clears the ALL_SCOPES entry. */
|
|
39
|
-
invalidateContractForScopes(contractAddress: AztecAddress, scopes: AztecAddress[]): void;
|
|
40
|
-
/** Clears sync cache. Called by BlockSynchronizer when anchor block changes. */
|
|
41
|
-
wipe(): void;
|
|
42
|
-
commit(jobId: string): Promise<void>;
|
|
43
|
-
discardStaged(jobId: string): Promise<void>;
|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AAO,CAAC,GAAG,CAAC,EAC3E,iBAAiB,EAAE,WAAW,EAC9B,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,YAAY,GACnB,OAAO,CAAC,IAAI,CAAC,CAiBf;IAED,sGAAsG;IACtG,2BAA2B,CAAC,eAAe,EAAE,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,GAAG,IAAI,CAMvF;IA4BD,gFAAgF;IAChF,IAAI,IAAI,IAAI,CAGX;IAED,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAInC;IAED,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAM1C;CA2CF"}
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
import { syncState, verifyCurrentClassId } from './helpers.js';
|
|
2
|
-
/**
|
|
3
|
-
* Service for syncing the private state of contracts and verifying that the PXE holds the current class artifact.
|
|
4
|
-
* It uses a cache to avoid redundant sync operations - the cache is wiped when the anchor block changes.
|
|
5
|
-
*
|
|
6
|
-
* TODO: The StagedStore naming is broken here. Figure out a better name.
|
|
7
|
-
*/ export class ContractSyncService {
|
|
8
|
-
aztecNode;
|
|
9
|
-
contractStore;
|
|
10
|
-
noteStore;
|
|
11
|
-
log;
|
|
12
|
-
storeName;
|
|
13
|
-
// Tracks contracts synced since last wipe. The cache is keyed per individual scope address
|
|
14
|
-
// (`contractAddress:scopeAddress`), or `contractAddress:*` for all scopes (all accounts).
|
|
15
|
-
// The value is a promise that resolves when the contract is synced.
|
|
16
|
-
syncedContracts;
|
|
17
|
-
// Per-job excluded contract addresses - these contracts should not be synced.
|
|
18
|
-
excludedFromSync;
|
|
19
|
-
constructor(aztecNode, contractStore, noteStore, log){
|
|
20
|
-
this.aztecNode = aztecNode;
|
|
21
|
-
this.contractStore = contractStore;
|
|
22
|
-
this.noteStore = noteStore;
|
|
23
|
-
this.log = log;
|
|
24
|
-
this.storeName = 'contract_sync';
|
|
25
|
-
this.syncedContracts = new Map();
|
|
26
|
-
this.excludedFromSync = new Map();
|
|
27
|
-
}
|
|
28
|
-
/** Sets contracts that should be skipped during sync for a specific job. */ setExcludedFromSync(jobId, addresses) {
|
|
29
|
-
this.excludedFromSync.set(jobId, addresses);
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Ensures a contract's private state is synchronized and that the PXE holds the current class artifact.
|
|
33
|
-
* Uses a cache to avoid redundant sync operations - the cache is wiped when the anchor block changes.
|
|
34
|
-
* @param contractAddress - The address of the contract to sync.
|
|
35
|
-
* @param functionToInvokeAfterSync - The function selector that will be called after sync (used to validate it's
|
|
36
|
-
* not sync_state itself).
|
|
37
|
-
* @param utilityExecutor - Executor function for running the sync_state utility function.
|
|
38
|
-
* @param scopes - Access scopes to pass through to the utility executor (affects whose account's private state is discovered).
|
|
39
|
-
*/ async ensureContractSynced(contractAddress, functionToInvokeAfterSync, utilityExecutor, anchorBlockHeader, jobId, scopes) {
|
|
40
|
-
if (this.#shouldSkipSync(jobId, contractAddress)) {
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
this.#startSyncIfNeeded(contractAddress, scopes, (scopesToSync)=>this.#syncContract(contractAddress, functionToInvokeAfterSync, utilityExecutor, anchorBlockHeader, jobId, scopesToSync));
|
|
44
|
-
await this.#awaitSync(contractAddress, scopes);
|
|
45
|
-
}
|
|
46
|
-
/** Clears sync cache entries for the given scopes of a contract. Also clears the ALL_SCOPES entry. */ invalidateContractForScopes(contractAddress, scopes) {
|
|
47
|
-
if (scopes.length === 0) {
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
scopes.forEach((scope)=>this.syncedContracts.delete(toKey(contractAddress, scope)));
|
|
51
|
-
this.syncedContracts.delete(toKey(contractAddress, 'ALL_SCOPES'));
|
|
52
|
-
}
|
|
53
|
-
async #syncContract(contractAddress, functionToInvokeAfterSync, utilityExecutor, anchorBlockHeader, jobId, scopes) {
|
|
54
|
-
this.log.debug(`Syncing contract ${contractAddress}`);
|
|
55
|
-
await Promise.all([
|
|
56
|
-
syncState(contractAddress, this.contractStore, functionToInvokeAfterSync, utilityExecutor, this.noteStore, this.aztecNode, anchorBlockHeader, jobId, scopes),
|
|
57
|
-
verifyCurrentClassId(contractAddress, this.aztecNode, this.contractStore, anchorBlockHeader)
|
|
58
|
-
]);
|
|
59
|
-
this.log.debug(`Contract ${contractAddress} synced`);
|
|
60
|
-
}
|
|
61
|
-
/** Clears sync cache. Called by BlockSynchronizer when anchor block changes. */ wipe() {
|
|
62
|
-
this.log.debug(`Wiping contract sync cache (${this.syncedContracts.size} entries)`);
|
|
63
|
-
this.syncedContracts.clear();
|
|
64
|
-
}
|
|
65
|
-
commit(jobId) {
|
|
66
|
-
// Clear excluded contracts for this job
|
|
67
|
-
this.excludedFromSync.delete(jobId);
|
|
68
|
-
return Promise.resolve();
|
|
69
|
-
}
|
|
70
|
-
discardStaged(jobId) {
|
|
71
|
-
// We clear the synced contracts cache here because, when the job is discarded, any associated database writes from
|
|
72
|
-
// the sync are also undone.
|
|
73
|
-
this.syncedContracts.clear();
|
|
74
|
-
this.excludedFromSync.delete(jobId);
|
|
75
|
-
return Promise.resolve();
|
|
76
|
-
}
|
|
77
|
-
/** Returns true if sync should be skipped for this contract */ #shouldSkipSync(jobId, contractAddress) {
|
|
78
|
-
return !!this.excludedFromSync.get(jobId)?.has(contractAddress.toString());
|
|
79
|
-
}
|
|
80
|
-
/** If there are unsynced scopes, starts sync and stores the promise in cache with error cleanup. */ #startSyncIfNeeded(contractAddress, scopes, syncFn) {
|
|
81
|
-
const scopesToSync = this.#getScopesToSync(contractAddress, scopes);
|
|
82
|
-
const keys = toKeys(contractAddress, scopesToSync);
|
|
83
|
-
if (keys.length === 0) {
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
const promise = syncFn(scopesToSync).catch((err)=>{
|
|
87
|
-
keys.forEach((key)=>this.syncedContracts.delete(key));
|
|
88
|
-
throw err;
|
|
89
|
-
});
|
|
90
|
-
keys.forEach((key)=>this.syncedContracts.set(key, promise));
|
|
91
|
-
}
|
|
92
|
-
/** Filters out scopes that are already cached, returning only those that still need syncing. */ #getScopesToSync(contractAddress, scopes) {
|
|
93
|
-
if (this.syncedContracts.has(toKey(contractAddress, 'ALL_SCOPES'))) {
|
|
94
|
-
// If we are already syncing all scopes, then return an empty list
|
|
95
|
-
return [];
|
|
96
|
-
}
|
|
97
|
-
if (scopes === 'ALL_SCOPES') {
|
|
98
|
-
return 'ALL_SCOPES';
|
|
99
|
-
}
|
|
100
|
-
return scopes.filter((scope)=>!this.syncedContracts.has(toKey(contractAddress, scope)));
|
|
101
|
-
}
|
|
102
|
-
/** Collects all relevant scope promises (including in-flight ones from concurrent calls) and awaits them. */ async #awaitSync(contractAddress, scopes) {
|
|
103
|
-
const promises = toKeys(contractAddress, scopes).map((key)=>this.syncedContracts.get(key)).filter((p)=>p !== undefined);
|
|
104
|
-
await Promise.all(promises);
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
function toKeys(contract, scopes) {
|
|
108
|
-
return scopes === 'ALL_SCOPES' ? [
|
|
109
|
-
toKey(contract, scopes)
|
|
110
|
-
] : scopes.map((scope)=>toKey(contract, scope));
|
|
111
|
-
}
|
|
112
|
-
function toKey(contract, scope) {
|
|
113
|
-
return scope === 'ALL_SCOPES' ? `${contract.toString()}:*` : `${contract.toString()}:${scope.toString()}`;
|
|
114
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import type { FunctionCall, FunctionSelector } from '@aztec/stdlib/abi';
|
|
2
|
-
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
3
|
-
import type { ContractInstance } from '@aztec/stdlib/contract';
|
|
4
|
-
import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
5
|
-
import type { BlockHeader } from '@aztec/stdlib/tx';
|
|
6
|
-
import type { AccessScopes } from '../access_scopes.js';
|
|
7
|
-
import type { ContractStore } from '../storage/contract_store/contract_store.js';
|
|
8
|
-
import type { NoteStore } from '../storage/note_store/note_store.js';
|
|
9
|
-
/**
|
|
10
|
-
* Read the current class id of a contract from the execution data provider or AztecNode. If not found, class id
|
|
11
|
-
* from the instance is used.
|
|
12
|
-
* @param contractAddress - The address of the contract to read the class id for.
|
|
13
|
-
* @param instance - The instance of the contract.
|
|
14
|
-
* @param aztecNode - The Aztec node to query for storage.
|
|
15
|
-
* @param header - The header of the block at which to load the DelayedPublicMutable storing the class id.
|
|
16
|
-
* @returns The current class id.
|
|
17
|
-
*/
|
|
18
|
-
export declare function readCurrentClassId(contractAddress: AztecAddress, instance: ContractInstance, aztecNode: AztecNode, header: BlockHeader): Promise<import("@aztec/foundation/schemas").Fr>;
|
|
19
|
-
export declare function syncState(contractAddress: AztecAddress, contractStore: ContractStore, functionToInvokeAfterSync: FunctionSelector | null, utilityExecutor: (privateSyncCall: FunctionCall, scopes: AccessScopes) => Promise<any>, noteStore: NoteStore, aztecNode: AztecNode, anchorBlockHeader: BlockHeader, jobId: string, scopes: AccessScopes): Promise<void>;
|
|
20
|
-
/**
|
|
21
|
-
* Verify that the current class id of a contract obtained from AztecNode is the same as the one in contract data
|
|
22
|
-
* provider (i.e. PXE's own storage).
|
|
23
|
-
* @param contractAddress - The address of the contract to verify.
|
|
24
|
-
* @param aztecNode - The Aztec node to query for storage.
|
|
25
|
-
* @param contractStore - The contract store to fetch the local instance from.
|
|
26
|
-
* @param header - The header of the block at which to verify the current class id.
|
|
27
|
-
*/
|
|
28
|
-
export declare function verifyCurrentClassId(contractAddress: AztecAddress, aztecNode: AztecNode, contractStore: ContractStore, header: BlockHeader): Promise<void>;
|
|
29
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaGVscGVycy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2NvbnRyYWN0X3N5bmMvaGVscGVycy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFDQSx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AE,SAAS,EACpB,iBAAiB,EAAE,WAAW,EAC9B,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,YAAY,iBAoBrB;AAED;;;;;;;GAOG;AACH,wBAAsB,oBAAoB,CACxC,eAAe,EAAE,YAAY,EAC7B,SAAS,EAAE,SAAS,EACpB,aAAa,EAAE,aAAa,EAC5B,MAAM,EAAE,WAAW,iBAapB"}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { ProtocolContractAddress, isProtocolContract } from '@aztec/protocol-contracts';
|
|
2
|
-
import { DelayedPublicMutableValues, DelayedPublicMutableValuesWithHash } from '@aztec/stdlib/delayed-public-mutable';
|
|
3
|
-
import { NoteService } from '../notes/note_service.js';
|
|
4
|
-
/**
|
|
5
|
-
* Read the current class id of a contract from the execution data provider or AztecNode. If not found, class id
|
|
6
|
-
* from the instance is used.
|
|
7
|
-
* @param contractAddress - The address of the contract to read the class id for.
|
|
8
|
-
* @param instance - The instance of the contract.
|
|
9
|
-
* @param aztecNode - The Aztec node to query for storage.
|
|
10
|
-
* @param header - The header of the block at which to load the DelayedPublicMutable storing the class id.
|
|
11
|
-
* @returns The current class id.
|
|
12
|
-
*/ export async function readCurrentClassId(contractAddress, instance, aztecNode, header) {
|
|
13
|
-
const blockHash = await header.hash();
|
|
14
|
-
const timestamp = header.globalVariables.timestamp;
|
|
15
|
-
const { delayedPublicMutableSlot } = await DelayedPublicMutableValuesWithHash.getContractUpdateSlots(contractAddress);
|
|
16
|
-
const delayedPublicMutableValues = await DelayedPublicMutableValues.readFromTree(delayedPublicMutableSlot, (slot)=>aztecNode.getPublicStorageAt(blockHash, ProtocolContractAddress.ContractInstanceRegistry, slot));
|
|
17
|
-
let currentClassId = delayedPublicMutableValues.svc.getCurrentAt(timestamp)[0];
|
|
18
|
-
if (currentClassId.isZero()) {
|
|
19
|
-
currentClassId = instance.originalContractClassId;
|
|
20
|
-
}
|
|
21
|
-
return currentClassId;
|
|
22
|
-
}
|
|
23
|
-
export async function syncState(contractAddress, contractStore, functionToInvokeAfterSync, utilityExecutor, noteStore, aztecNode, anchorBlockHeader, jobId, scopes) {
|
|
24
|
-
// Protocol contracts don't have private state to sync
|
|
25
|
-
if (!isProtocolContract(contractAddress)) {
|
|
26
|
-
const syncStateFunctionCall = await contractStore.getFunctionCall('sync_state', [], contractAddress);
|
|
27
|
-
if (functionToInvokeAfterSync && functionToInvokeAfterSync.equals(syncStateFunctionCall.selector)) {
|
|
28
|
-
throw new Error('Forbidden `sync_state` invocation. `sync_state` can only be invoked by PXE, manual execution can lead to inconsistencies.');
|
|
29
|
-
}
|
|
30
|
-
const noteService = new NoteService(noteStore, aztecNode, anchorBlockHeader, jobId);
|
|
31
|
-
// Both sync_state and syncNoteNullifiers interact with the note store, but running them in parallel is safe
|
|
32
|
-
// because note store is designed to handle concurrent operations.
|
|
33
|
-
await Promise.all([
|
|
34
|
-
utilityExecutor(syncStateFunctionCall, scopes),
|
|
35
|
-
noteService.syncNoteNullifiers(contractAddress, scopes)
|
|
36
|
-
]);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Verify that the current class id of a contract obtained from AztecNode is the same as the one in contract data
|
|
41
|
-
* provider (i.e. PXE's own storage).
|
|
42
|
-
* @param contractAddress - The address of the contract to verify.
|
|
43
|
-
* @param aztecNode - The Aztec node to query for storage.
|
|
44
|
-
* @param contractStore - The contract store to fetch the local instance from.
|
|
45
|
-
* @param header - The header of the block at which to verify the current class id.
|
|
46
|
-
*/ export async function verifyCurrentClassId(contractAddress, aztecNode, contractStore, header) {
|
|
47
|
-
const instance = await contractStore.getContractInstance(contractAddress);
|
|
48
|
-
if (!instance) {
|
|
49
|
-
throw new Error(`No contract instance found for address ${contractAddress.toString()}`);
|
|
50
|
-
}
|
|
51
|
-
const currentClassId = await readCurrentClassId(contractAddress, instance, aztecNode, header);
|
|
52
|
-
if (!instance.currentContractClassId.equals(currentClassId)) {
|
|
53
|
-
throw new Error(`Contract ${contractAddress} is outdated, current class id is ${currentClassId}, local class id is ${instance.currentContractClassId}`);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
|
-
import type { AztecNode } from '@aztec/stdlib/interfaces/server';
|
|
3
|
-
import { MessageTxContext } from '../contract_function_simulator/noir-structs/message_tx_context.js';
|
|
4
|
-
/** Resolves transaction hashes into the context needed to process messages. */
|
|
5
|
-
export declare class MessageContextService {
|
|
6
|
-
private readonly aztecNode;
|
|
7
|
-
constructor(aztecNode: AztecNode);
|
|
8
|
-
/**
|
|
9
|
-
* Resolves a list of tx hashes into their message contexts.
|
|
10
|
-
*
|
|
11
|
-
* For each tx hash, looks up the corresponding tx effect and extracts the note hashes and first nullifier needed to
|
|
12
|
-
* process messages that originated from that transaction. Returns `null` for tx hashes that are zero, not yet
|
|
13
|
-
* available, or in blocks beyond the anchor block.
|
|
14
|
-
*/
|
|
15
|
-
resolveMessageContexts(txHashes: Fr[], anchorBlockNumber: number): Promise<(MessageTxContext | null)[]>;
|
|
16
|
-
}
|
|
17
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWVzc2FnZV9jb250ZXh0X3NlcnZpY2UuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9tZXNzYWdlcy9tZXNzYWdlX2NvbnRleHRfc2VydmljZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsRUFBRSxFQUFFLE1BQU0sZ0NBQWdDLENBQUM7QUFDcEQsT0FBTyxLQUFLLEVBQUUsU0FBUyxFQUFFLE1BQU0saUNBQWlDLENBQUM7QUFHakUsT0FBTyxFQUFFLGdCQUFnQixFQUFFLE1BQU0sbUVBQW1FLENBQUM7QUFFckcsK0VBQStFO0FBQy9FLHFCQUFhLHFCQUFxQjtJQUNwQixPQUFPLENBQUMsUUFBUSxDQUFDLFNBQVM7SUFBdEMsWUFBNkIsU0FBUyxFQUFFLFNBQVMsRUFBSTtJQUVyRDs7Ozs7O09BTUc7SUFDSCxzQkFBc0IsQ0FBQyxRQUFRLEVBQUUsRUFBRSxFQUFFLEVBQUUsaUJBQWlCLEVBQUUsTUFBTSxHQUFHLE9BQU8sQ0FBQyxDQUFDLGdCQUFnQixHQUFHLElBQUksQ0FBQyxFQUFFLENBQUMsQ0EwQnRHO0NBQ0YifQ==
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"message_context_service.d.ts","sourceRoot":"","sources":["../../src/messages/message_context_service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACpD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAGjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,mEAAmE,CAAC;AAErG,+EAA+E;AAC/E,qBAAa,qBAAqB;IACpB,OAAO,CAAC,QAAQ,CAAC,SAAS;IAAtC,YAA6B,SAAS,EAAE,SAAS,EAAI;IAErD;;;;;;OAMG;IACH,sBAAsB,CAAC,QAAQ,EAAE,EAAE,EAAE,EAAE,iBAAiB,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,gBAAgB,GAAG,IAAI,CAAC,EAAE,CAAC,CA0BtG;CACF"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { TxHash } from '@aztec/stdlib/tx';
|
|
2
|
-
import { MessageTxContext } from '../contract_function_simulator/noir-structs/message_tx_context.js';
|
|
3
|
-
/** Resolves transaction hashes into the context needed to process messages. */ export class MessageContextService {
|
|
4
|
-
aztecNode;
|
|
5
|
-
constructor(aztecNode){
|
|
6
|
-
this.aztecNode = aztecNode;
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* Resolves a list of tx hashes into their message contexts.
|
|
10
|
-
*
|
|
11
|
-
* For each tx hash, looks up the corresponding tx effect and extracts the note hashes and first nullifier needed to
|
|
12
|
-
* process messages that originated from that transaction. Returns `null` for tx hashes that are zero, not yet
|
|
13
|
-
* available, or in blocks beyond the anchor block.
|
|
14
|
-
*/ resolveMessageContexts(txHashes, anchorBlockNumber) {
|
|
15
|
-
// TODO: optimize, we might be hitting the node to get the same txHash repeatedly
|
|
16
|
-
return Promise.all(txHashes.map(async (txHashField)=>{
|
|
17
|
-
// A zero tx hash indicates a tx-less offchain message (e.g. one not tied to any onchain transaction).
|
|
18
|
-
// These messages don't have a transaction context to resolve, so we return null.
|
|
19
|
-
if (txHashField.isZero()) {
|
|
20
|
-
return null;
|
|
21
|
-
}
|
|
22
|
-
const txHash = TxHash.fromField(txHashField);
|
|
23
|
-
const txEffect = await this.aztecNode.getTxEffect(txHash);
|
|
24
|
-
if (!txEffect || txEffect.l2BlockNumber > anchorBlockNumber) {
|
|
25
|
-
return null;
|
|
26
|
-
}
|
|
27
|
-
// Every tx has at least one nullifier (the first nullifier derived from the tx hash). Hitting this condition
|
|
28
|
-
// would mean a buggy node, but since we need to access data.nullifiers[0], the defensive check does no harm.
|
|
29
|
-
const data = txEffect.data;
|
|
30
|
-
if (data.nullifiers.length === 0) {
|
|
31
|
-
throw new Error(`Tx effect for ${txHash} has no nullifiers`);
|
|
32
|
-
}
|
|
33
|
-
return new MessageTxContext(data.txHash, data.noteHashes, data.nullifiers[0]);
|
|
34
|
-
}));
|
|
35
|
-
}
|
|
36
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { AztecAsyncKVStore } from '@aztec/kv-store';
|
|
2
|
-
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
3
|
-
/**
|
|
4
|
-
* Stores sender addresses. During recipient log synchronization, these senders are used, along with a given recipient,
|
|
5
|
-
* to derive directional app tagging secrets that are then used to sync the logs.
|
|
6
|
-
*/
|
|
7
|
-
export declare class SenderAddressBookStore {
|
|
8
|
-
#private;
|
|
9
|
-
constructor(store: AztecAsyncKVStore);
|
|
10
|
-
addSender(address: AztecAddress): Promise<boolean>;
|
|
11
|
-
getSenders(): Promise<AztecAddress[]>;
|
|
12
|
-
removeSender(address: AztecAddress): Promise<boolean>;
|
|
13
|
-
}
|
|
14
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2VuZGVyX2FkZHJlc3NfYm9va19zdG9yZS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL3N0b3JhZ2UvdGFnZ2luZ19zdG9yZS9zZW5kZXJfYWRkcmVzc19ib29rX3N0b3JlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUNBLE9BQU8sS0FBSyxFQUFFLGlCQUFpQixFQUFpQixNQUFNLGlCQUFpQixDQUFDO0FBQ3hFLE9BQU8sRUFBRSxZQUFZLEVBQUUsTUFBTSw2QkFBNkIsQ0FBQztBQUUzRDs7O0dBR0c7QUFDSCxxQkFBYSxzQkFBc0I7O0lBSWpDLFlBQVksS0FBSyxFQUFFLGlCQUFpQixFQUluQztJQUVELFNBQVMsQ0FBQyxPQUFPLEVBQUUsWUFBWSxHQUFHLE9BQU8sQ0FBQyxPQUFPLENBQUMsQ0FVakQ7SUFFRCxVQUFVLElBQUksT0FBTyxDQUFDLFlBQVksRUFBRSxDQUFDLENBSXBDO0lBRUQsWUFBWSxDQUFDLE9BQU8sRUFBRSxZQUFZLEdBQUcsT0FBTyxDQUFDLE9BQU8sQ0FBQyxDQVVwRDtDQUNGIn0=
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sender_address_book_store.d.ts","sourceRoot":"","sources":["../../../src/storage/tagging_store/sender_address_book_store.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAiB,MAAM,iBAAiB,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAE3D;;;GAGG;AACH,qBAAa,sBAAsB;;IAIjC,YAAY,KAAK,EAAE,iBAAiB,EAInC;IAED,SAAS,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC,CAUjD;IAED,UAAU,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC,CAIpC;IAED,YAAY,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC,CAUpD;CACF"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { toArray } from '@aztec/foundation/iterable';
|
|
2
|
-
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
3
|
-
/**
|
|
4
|
-
* Stores sender addresses. During recipient log synchronization, these senders are used, along with a given recipient,
|
|
5
|
-
* to derive directional app tagging secrets that are then used to sync the logs.
|
|
6
|
-
*/ export class SenderAddressBookStore {
|
|
7
|
-
#store;
|
|
8
|
-
#addressBook;
|
|
9
|
-
constructor(store){
|
|
10
|
-
this.#store = store;
|
|
11
|
-
this.#addressBook = this.#store.openMap('address_book');
|
|
12
|
-
}
|
|
13
|
-
addSender(address) {
|
|
14
|
-
return this.#store.transactionAsync(async ()=>{
|
|
15
|
-
if (await this.#addressBook.hasAsync(address.toString())) {
|
|
16
|
-
return false;
|
|
17
|
-
}
|
|
18
|
-
await this.#addressBook.set(address.toString(), true);
|
|
19
|
-
return true;
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
getSenders() {
|
|
23
|
-
return this.#store.transactionAsync(async ()=>{
|
|
24
|
-
return (await toArray(this.#addressBook.keysAsync())).map(AztecAddress.fromString);
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
removeSender(address) {
|
|
28
|
-
return this.#store.transactionAsync(async ()=>{
|
|
29
|
-
if (!await this.#addressBook.hasAsync(address.toString())) {
|
|
30
|
-
return false;
|
|
31
|
-
}
|
|
32
|
-
await this.#addressBook.delete(address.toString());
|
|
33
|
-
return true;
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { BlockNumber } from '@aztec/foundation/branded-types';
|
|
2
|
-
import type { BlockHash } from '@aztec/stdlib/block';
|
|
3
|
-
import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
4
|
-
import type { ExtendedDirectionalAppTaggingSecret, TxScopedL2Log } from '@aztec/stdlib/logs';
|
|
5
|
-
import type { RecipientTaggingStore } from '../../storage/tagging_store/recipient_tagging_store.js';
|
|
6
|
-
/**
|
|
7
|
-
* Loads private logs for the app-sender-recipient triplet defined by `secret` and updates the highest aged and
|
|
8
|
-
* finalized indexes in the db. At most load logs from blocks up to and including `anchorBlockNumber`.
|
|
9
|
-
*
|
|
10
|
-
* @dev This function can be safely executed "in parallel" for other sender-recipient pairs because the data in
|
|
11
|
-
* in the tagging data provider is indexed by the secret and hence completely disjoint.
|
|
12
|
-
*/
|
|
13
|
-
export declare function loadPrivateLogsForSenderRecipientPair(secret: ExtendedDirectionalAppTaggingSecret, aztecNode: AztecNode, taggingStore: RecipientTaggingStore, anchorBlockNumber: BlockNumber, anchorBlockHash: BlockHash, jobId: string): Promise<TxScopedL2Log[]>;
|
|
14
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibG9hZF9wcml2YXRlX2xvZ3NfZm9yX3NlbmRlcl9yZWNpcGllbnRfcGFpci5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL3RhZ2dpbmcvcmVjaXBpZW50X3N5bmMvbG9hZF9wcml2YXRlX2xvZ3NfZm9yX3NlbmRlcl9yZWNpcGllbnRfcGFpci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxXQUFXLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUNuRSxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsTUFBTSxxQkFBcUIsQ0FBQztBQUNyRCxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUNqRSxPQUFPLEtBQUssRUFBRSxtQ0FBbUMsRUFBRSxhQUFhLEVBQUUsTUFBTSxvQkFBb0IsQ0FBQztBQUU3RixPQUFPLEtBQUssRUFBRSxxQkFBcUIsRUFBRSxNQUFNLHdEQUF3RCxDQUFDO0FBS3BHOzs7Ozs7R0FNRztBQUNILHdCQUFzQixxQ0FBcUMsQ0FDekQsTUFBTSxFQUFFLG1DQUFtQyxFQUMzQyxTQUFTLEVBQUUsU0FBUyxFQUNwQixZQUFZLEVBQUUscUJBQXFCLEVBQ25DLGlCQUFpQixFQUFFLFdBQVcsRUFDOUIsZUFBZSxFQUFFLFNBQVMsRUFDMUIsS0FBSyxFQUFFLE1BQU0sR0FDWixPQUFPLENBQUMsYUFBYSxFQUFFLENBQUMsQ0FtSDFCIn0=
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"load_private_logs_for_sender_recipient_pair.d.ts","sourceRoot":"","sources":["../../../src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,KAAK,EAAE,mCAAmC,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAE7F,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,wDAAwD,CAAC;AAKpG;;;;;;GAMG;AACH,wBAAsB,qCAAqC,CACzD,MAAM,EAAE,mCAAmC,EAC3C,SAAS,EAAE,SAAS,EACpB,YAAY,EAAE,qBAAqB,EACnC,iBAAiB,EAAE,WAAW,EAC9B,eAAe,EAAE,SAAS,EAC1B,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,aAAa,EAAE,CAAC,CAmH1B"}
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import { UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN } from '../constants.js';
|
|
2
|
-
import { findHighestIndexes } from './utils/find_highest_indexes.js';
|
|
3
|
-
import { loadLogsForRange } from './utils/load_logs_for_range.js';
|
|
4
|
-
/**
|
|
5
|
-
* Loads private logs for the app-sender-recipient triplet defined by `secret` and updates the highest aged and
|
|
6
|
-
* finalized indexes in the db. At most load logs from blocks up to and including `anchorBlockNumber`.
|
|
7
|
-
*
|
|
8
|
-
* @dev This function can be safely executed "in parallel" for other sender-recipient pairs because the data in
|
|
9
|
-
* in the tagging data provider is indexed by the secret and hence completely disjoint.
|
|
10
|
-
*/ export async function loadPrivateLogsForSenderRecipientPair(secret, aztecNode, taggingStore, anchorBlockNumber, anchorBlockHash, jobId) {
|
|
11
|
-
// # Explanation of how the algorithm works
|
|
12
|
-
// When we perform the sync we will look at logs that correspond to the tagging index range
|
|
13
|
-
// (highestAgedIndex, highestFinalizedIndex + WINDOW_LEN]
|
|
14
|
-
//
|
|
15
|
-
// highestAgedIndex is the highest index that was used in a tx that is included in a block at least
|
|
16
|
-
// `MAX_TX_LIFETIME` seconds ago.
|
|
17
|
-
// highestFinalizedIndex is the highest index that was used in a tx that is included in a finalized block.
|
|
18
|
-
//
|
|
19
|
-
// "(" denotes an open end of the range - the index is not included in the range.
|
|
20
|
-
// "]" denotes a closed end of the range - the index is included in the range.
|
|
21
|
-
//
|
|
22
|
-
// ## Explanation of highestAgedIndex
|
|
23
|
-
//
|
|
24
|
-
// highestAgedIndex is chosen such that for all tagging indexes `i <= highestAgedIndex` we know that no new logs can
|
|
25
|
-
// ever appear.
|
|
26
|
-
//
|
|
27
|
-
// This relies on the "maximum inclusion timestamp" rule enforced by the kernel and rollup circuits:
|
|
28
|
-
// - a transaction's maximum inclusion timestamp is at most `MAX_TX_LIFETIME` seconds after
|
|
29
|
-
// the timestamp of its anchor block; and
|
|
30
|
-
// - a rollup only includes transactions whose inclusion timestamp is >= the L2 block's timestamp.
|
|
31
|
-
//
|
|
32
|
-
// Suppose some device used index `I` in a transaction anchored to block `B_N` at time `N`, and that block is now at
|
|
33
|
-
// least `MAX_TX_LIFETIME` seconds in the past. Then there is no possibility of any *other* device
|
|
34
|
-
// trying to use an index <= `I` while anchoring to a *newer* block than `B_N` because if we were anchoring to
|
|
35
|
-
// a newer block than `B_N` then we would already have seen the log with index `I` and hence the device would have
|
|
36
|
-
// chosen a larger index.
|
|
37
|
-
// If that *other* device would anchor to a block older than `B_N` then that tx could never be included in a block
|
|
38
|
-
// because it would already have been expired.
|
|
39
|
-
//
|
|
40
|
-
// Therefore, once we see that index `I` has been used in a block that is at least `MAX_TX_LIFETIME`
|
|
41
|
-
// seconds old, we can safely stop syncing logs for all indexes <= `I` and set highestAgedIndex = `I`.
|
|
42
|
-
//
|
|
43
|
-
// ## Explanation of the upper bound `highestFinalizedIndex + WINDOW_LEN`
|
|
44
|
-
//
|
|
45
|
-
// When a sender chooses a tagging index, they will select an index that is at most `WINDOW_LEN` greater than
|
|
46
|
-
// the highest finalized index. If that index was already used, they will throw an error. For this reason we
|
|
47
|
-
// don't have to look further than `highestFinalizedIndex + WINDOW_LEN`.
|
|
48
|
-
let finalizedBlockNumber, currentTimestamp;
|
|
49
|
-
{
|
|
50
|
-
const [l2Tips, latestBlockHeader] = await Promise.all([
|
|
51
|
-
aztecNode.getL2Tips(),
|
|
52
|
-
aztecNode.getBlockHeader('latest')
|
|
53
|
-
]);
|
|
54
|
-
if (!latestBlockHeader) {
|
|
55
|
-
throw new Error('Node failed to return latest block header when syncing logs');
|
|
56
|
-
}
|
|
57
|
-
[finalizedBlockNumber, currentTimestamp] = [
|
|
58
|
-
l2Tips.finalized.block.number,
|
|
59
|
-
latestBlockHeader.globalVariables.timestamp
|
|
60
|
-
];
|
|
61
|
-
}
|
|
62
|
-
let start, end;
|
|
63
|
-
{
|
|
64
|
-
const currentHighestAgedIndex = await taggingStore.getHighestAgedIndex(secret, jobId);
|
|
65
|
-
const currentHighestFinalizedIndex = await taggingStore.getHighestFinalizedIndex(secret, jobId);
|
|
66
|
-
// We don't want to include the highest aged index so we start from `currentHighestAgedIndex + 1` (or 0 if not set)
|
|
67
|
-
start = currentHighestAgedIndex === undefined ? 0 : currentHighestAgedIndex + 1;
|
|
68
|
-
// The highest index a sender can choose is "highest finalized index + window length" but given that
|
|
69
|
-
// `loadLogsForRange` expects an exclusive `end` we add 1.
|
|
70
|
-
end = (currentHighestFinalizedIndex ?? 0) + UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN + 1;
|
|
71
|
-
}
|
|
72
|
-
const logs = [];
|
|
73
|
-
while(true){
|
|
74
|
-
// Get private logs with their block timestamps and corresponding tagging indexes
|
|
75
|
-
const privateLogsWithIndexes = await loadLogsForRange(secret, aztecNode, start, end, anchorBlockNumber, anchorBlockHash);
|
|
76
|
-
if (privateLogsWithIndexes.length === 0) {
|
|
77
|
-
break;
|
|
78
|
-
}
|
|
79
|
-
logs.push(...privateLogsWithIndexes.map(({ log })=>log));
|
|
80
|
-
const { highestAgedIndex, highestFinalizedIndex } = findHighestIndexes(privateLogsWithIndexes, currentTimestamp, finalizedBlockNumber);
|
|
81
|
-
// Store updates in data provider and update local variables
|
|
82
|
-
if (highestAgedIndex !== undefined) {
|
|
83
|
-
await taggingStore.updateHighestAgedIndex(secret, highestAgedIndex, jobId);
|
|
84
|
-
}
|
|
85
|
-
if (highestFinalizedIndex === undefined) {
|
|
86
|
-
break;
|
|
87
|
-
}
|
|
88
|
-
if (highestAgedIndex !== undefined && highestAgedIndex > highestFinalizedIndex) {
|
|
89
|
-
// This is just a sanity check as this should never happen.
|
|
90
|
-
throw new Error('Highest aged index lower than highest finalized index invariant violated');
|
|
91
|
-
}
|
|
92
|
-
await taggingStore.updateHighestFinalizedIndex(secret, highestFinalizedIndex, jobId);
|
|
93
|
-
// For the next iteration we want to look only at indexes for which we have not attempted to load logs yet while
|
|
94
|
-
// ensuring that we do not look further than WINDOW_LEN ahead of the highest finalized index.
|
|
95
|
-
start = end;
|
|
96
|
-
end = highestFinalizedIndex + UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN + 1; // `end` is exclusive so we add 1.
|
|
97
|
-
}
|
|
98
|
-
return logs;
|
|
99
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { BlockNumber } from '@aztec/foundation/branded-types';
|
|
2
|
-
import type { BlockHash } from '@aztec/stdlib/block';
|
|
3
|
-
import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
4
|
-
import type { ExtendedDirectionalAppTaggingSecret, TxScopedL2Log } from '@aztec/stdlib/logs';
|
|
5
|
-
/**
|
|
6
|
-
* Gets private logs with their corresponding block timestamps and tagging indexes for the given index range and
|
|
7
|
-
* `extendedSecret`. At most load logs from blocks up to and including `anchorBlockNumber`. `start` is inclusive and
|
|
8
|
-
* `end` is exclusive.
|
|
9
|
-
*/
|
|
10
|
-
export declare function loadLogsForRange(extendedSecret: ExtendedDirectionalAppTaggingSecret, aztecNode: AztecNode, start: number, end: number, anchorBlockNumber: BlockNumber, anchorBlockHash: BlockHash): Promise<Array<{
|
|
11
|
-
log: TxScopedL2Log;
|
|
12
|
-
taggingIndex: number;
|
|
13
|
-
}>>;
|
|
14
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibG9hZF9sb2dzX2Zvcl9yYW5nZS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vc3JjL3RhZ2dpbmcvcmVjaXBpZW50X3N5bmMvdXRpbHMvbG9hZF9sb2dzX2Zvcl9yYW5nZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxXQUFXLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUNuRSxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsTUFBTSxxQkF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IAAC,YAAY,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC,CAuB9D"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { SiloedTag } from '@aztec/stdlib/logs';
|
|
2
|
-
import { getAllPrivateLogsByTags } from '../../get_all_logs_by_tags.js';
|
|
3
|
-
/**
|
|
4
|
-
* Gets private logs with their corresponding block timestamps and tagging indexes for the given index range and
|
|
5
|
-
* `extendedSecret`. At most load logs from blocks up to and including `anchorBlockNumber`. `start` is inclusive and
|
|
6
|
-
* `end` is exclusive.
|
|
7
|
-
*/ export async function loadLogsForRange(extendedSecret, aztecNode, start, end, anchorBlockNumber, anchorBlockHash) {
|
|
8
|
-
// Derive siloed tags for the window
|
|
9
|
-
const siloedTags = await Promise.all(Array.from({
|
|
10
|
-
length: end - start
|
|
11
|
-
}, (_, i)=>SiloedTag.compute({
|
|
12
|
-
extendedSecret,
|
|
13
|
-
index: start + i
|
|
14
|
-
})));
|
|
15
|
-
// We use the utility function below to retrieve all logs for the tags across all pages, so we don't need to handle
|
|
16
|
-
// pagination here.
|
|
17
|
-
const logs = await getAllPrivateLogsByTags(aztecNode, siloedTags, anchorBlockHash);
|
|
18
|
-
// Pair logs with their corresponding tagging indexes
|
|
19
|
-
const logsWithIndexes = [];
|
|
20
|
-
for(let i = 0; i < logs.length; i++){
|
|
21
|
-
const logsForTag = logs[i];
|
|
22
|
-
const taggingIndex = start + i;
|
|
23
|
-
for (const log of logsForTag){
|
|
24
|
-
if (log.blockNumber <= anchorBlockNumber) {
|
|
25
|
-
logsWithIndexes.push({
|
|
26
|
-
log,
|
|
27
|
-
taggingIndex
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
return logsWithIndexes;
|
|
33
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { AztecNode } from '@aztec/stdlib/interfaces/server';
|
|
2
|
-
import { TxHash } from '@aztec/stdlib/tx';
|
|
3
|
-
/**
|
|
4
|
-
* Based on receipts obtained from `aztecNode` returns which pending transactions changed their status to finalized,
|
|
5
|
-
* dropped, or execution-reverted (but mined).
|
|
6
|
-
*/
|
|
7
|
-
export declare function getStatusChangeOfPending(pending: TxHash[], aztecNode: AztecNode): Promise<{
|
|
8
|
-
txHashesToFinalize: TxHash[];
|
|
9
|
-
txHashesToDrop: TxHash[];
|
|
10
|
-
txHashesWithExecutionReverted: TxHash[];
|
|
11
|
-
}>;
|
|
12
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2V0X3N0YXR1c19jaGFuZ2Vfb2ZfcGVuZGluZy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vc3JjL3RhZ2dpbmcvc2VuZGVyX3N5bmMvdXRpbHMvZ2V0X3N0YXR1c19jaGFuZ2Vfb2ZfcGVuZGluZy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUNqRSxPQUFPLEVBQUUsTUFBTSxFQUFZLE1BQU0sa0JBQWtCLENBQUM7QUFFcEQ7OztHQUdHO0FBQ0gsd0JBQXNCLHdCQUF3QixDQUM1QyxPQUFPLEVBQUUsTUFBTSxFQUFFLEVBQ2pCLFNBQVMsRUFBRSxTQUFTLEdBQ25CLE9BQU8sQ0FBQztJQUNULGtCQUFrQixFQUFFLE1BQU0sRUFBRSxDQUFDO0lBQzdCLGNBQWMsRUFBRSxNQUFNLEVBQUUsQ0FBQztJQUN6Qiw2QkFBNkIsRUFBRSxNQUFNLEVBQUUsQ0FBQztDQUN6QyxDQUFDLENBb0NEIn0=
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get_status_change_of_pending.d.ts","sourceRoot":"","sources":["../../../../src/tagging/sender_sync/utils/get_status_change_of_pending.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,MAAM,EAAY,MAAM,kBAAkB,CAAC;AAEpD;;;GAGG;AACH,wBAAsB,wBAAwB,CAC5C,OAAO,EAAE,MAAM,EAAE,EACjB,SAAS,EAAE,SAAS,GACnB,OAAO,CAAC;IACT,kBAAkB,EAAE,MAAM,EAAE,CAAC;IAC7B,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,6BAA6B,EAAE,MAAM,EAAE,CAAC;CACzC,CAAC,CAoCD"}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { TxStatus } from '@aztec/stdlib/tx';
|
|
2
|
-
/**
|
|
3
|
-
* Based on receipts obtained from `aztecNode` returns which pending transactions changed their status to finalized,
|
|
4
|
-
* dropped, or execution-reverted (but mined).
|
|
5
|
-
*/ export async function getStatusChangeOfPending(pending, aztecNode) {
|
|
6
|
-
// Get receipts for all pending tx hashes.
|
|
7
|
-
const receipts = await Promise.all(pending.map((pendingTxHash)=>aztecNode.getTxReceipt(pendingTxHash)));
|
|
8
|
-
const txHashesToFinalize = [];
|
|
9
|
-
const txHashesToDrop = [];
|
|
10
|
-
const txHashesWithExecutionReverted = [];
|
|
11
|
-
for(let i = 0; i < receipts.length; i++){
|
|
12
|
-
const receipt = receipts[i];
|
|
13
|
-
const txHash = pending[i];
|
|
14
|
-
if (receipt.status === TxStatus.FINALIZED) {
|
|
15
|
-
// Tx has been included in a block and the corresponding block is finalized
|
|
16
|
-
if (receipt.hasExecutionSucceeded()) {
|
|
17
|
-
// No part of execution reverted - we just finalize all the indexes.
|
|
18
|
-
txHashesToFinalize.push(txHash);
|
|
19
|
-
} else if (receipt.hasExecutionReverted()) {
|
|
20
|
-
// Tx was mined but execution reverted (app logic, teardown, or both). Some logs from the non-revertible
|
|
21
|
-
// phase may still be onchain. We check which tags made it onchain and finalize those; drop the rest.
|
|
22
|
-
txHashesWithExecutionReverted.push(txHash);
|
|
23
|
-
} else {
|
|
24
|
-
// Defensive check - this branch should never be triggered
|
|
25
|
-
throw new Error('Both hasExecutionSucceeded and hasExecutionReverted on the receipt returned false. This should never happen and it implies a bug. Please open an issue.');
|
|
26
|
-
}
|
|
27
|
-
} else if (receipt.isDropped()) {
|
|
28
|
-
// Tx was dropped from the mempool --> we drop the corresponding pending indexes.
|
|
29
|
-
txHashesToDrop.push(txHash);
|
|
30
|
-
} else {
|
|
31
|
-
// Tx is still pending, not yet finalized, or was mined successfully but not yet finalized --> we don't do anything.
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
return {
|
|
35
|
-
txHashesToFinalize,
|
|
36
|
-
txHashesToDrop,
|
|
37
|
-
txHashesWithExecutionReverted
|
|
38
|
-
};
|
|
39
|
-
}
|
package/src/access_scopes.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Controls which accounts' private state and keys are accessible during execution.
|
|
5
|
-
* - `'ALL_SCOPES'`: All registered accounts' private state and keys are accessible.
|
|
6
|
-
* - `AztecAddress[]` with entries: Only the specified accounts' private state and keys are accessible.
|
|
7
|
-
* - `[]` (empty array): Deny-all. No private state is visible and no keys are accessible.
|
|
8
|
-
*/
|
|
9
|
-
export type AccessScopes = 'ALL_SCOPES' | AztecAddress[];
|