@aztec-labs/pxe 6.0.0-nightly.20260829
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/README.md +13 -0
- package/dest/bin/check_oracle_version.d.ts +2 -0
- package/dest/bin/check_oracle_version.d.ts.map +1 -0
- package/dest/bin/check_oracle_version.js +22 -0
- 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 +47 -0
- package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -0
- package/dest/block_synchronizer/block_synchronizer.js +192 -0
- package/dest/block_synchronizer/index.d.ts +2 -0
- package/dest/block_synchronizer/index.d.ts.map +1 -0
- package/dest/block_synchronizer/index.js +1 -0
- package/dest/config/index.d.ts +57 -0
- package/dest/config/index.d.ts.map +1 -0
- package/dest/config/index.js +80 -0
- package/dest/config/package_info.d.ts +5 -0
- package/dest/config/package_info.d.ts.map +1 -0
- package/dest/config/package_info.js +6 -0
- package/dest/contract/contract_call_graph.d.ts +51 -0
- package/dest/contract/contract_call_graph.d.ts.map +1 -0
- package/dest/contract/contract_call_graph.js +91 -0
- 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 +82 -0
- package/dest/contract/contract_sync_service.d.ts.map +1 -0
- package/dest/contract/contract_sync_service.js +210 -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 +114 -0
- package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -0
- package/dest/contract_function_simulator/contract_function_simulator.js +495 -0
- 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 +98 -0
- package/dest/contract_function_simulator/execution_note_cache.d.ts.map +1 -0
- package/dest/contract_function_simulator/execution_note_cache.js +189 -0
- package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts +12 -0
- package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts.map +1 -0
- package/dest/contract_function_simulator/execution_tagging_index_cache.js +30 -0
- package/dest/contract_function_simulator/hashed_values_cache.d.ts +28 -0
- package/dest/contract_function_simulator/hashed_values_cache.d.ts.map +1 -0
- package/dest/contract_function_simulator/hashed_values_cache.js +36 -0
- package/dest/contract_function_simulator/index.d.ts +36 -0
- package/dest/contract_function_simulator/index.d.ts.map +1 -0
- package/dest/contract_function_simulator/index.js +20 -0
- 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 +20 -0
- package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/event_validation_request.js +39 -0
- 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 +25 -0
- package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/log_retrieval_request.js +14 -0
- package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts +19 -0
- package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/log_retrieval_response.js +4 -0
- 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 +22 -0
- package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/note_validation_request.js +47 -0
- package/dest/contract_function_simulator/noir-structs/nullifier_membership_witness_data.d.ts +12 -0
- package/dest/contract_function_simulator/noir-structs/nullifier_membership_witness_data.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/nullifier_membership_witness_data.js +6 -0
- 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/public_data_witness_data.d.ts +13 -0
- package/dest/contract_function_simulator/noir-structs/public_data_witness_data.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/public_data_witness_data.js +3 -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 +11 -0
- package/dest/contract_function_simulator/noir-structs/utility_context.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/utility_context.js +3 -0
- 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 +3 -0
- package/dest/contract_function_simulator/oracle/index.d.ts.map +1 -0
- package/dest/contract_function_simulator/oracle/index.js +2 -0
- package/dest/contract_function_simulator/oracle/interfaces.d.ts +24 -0
- package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -0
- package/dest/contract_function_simulator/oracle/interfaces.js +4 -0
- 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/note_packing_utils.d.ts +28 -0
- package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts.map +1 -0
- package/dest/contract_function_simulator/oracle/note_packing_utils.js +54 -0
- 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 +1024 -0
- package/dest/contract_function_simulator/oracle/oracle_type_mappings.d.ts +292 -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 +1258 -0
- package/dest/contract_function_simulator/oracle/private_execution.d.ts +23 -0
- package/dest/contract_function_simulator/oracle/private_execution.d.ts.map +1 -0
- package/dest/contract_function_simulator/oracle/private_execution.js +88 -0
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +226 -0
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -0
- package/dest/contract_function_simulator/oracle/private_execution_oracle.js +585 -0
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +333 -0
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -0
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +900 -0
- package/dest/contract_function_simulator/pick_notes.d.ts +85 -0
- package/dest/contract_function_simulator/pick_notes.d.ts.map +1 -0
- package/dest/contract_function_simulator/pick_notes.js +68 -0
- 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 +27 -0
- package/dest/contract_logging.d.ts.map +1 -0
- package/dest/contract_logging.js +38 -0
- package/dest/debug/pxe_debug_utils.d.ts +38 -0
- package/dest/debug/pxe_debug_utils.d.ts.map +1 -0
- package/dest/debug/pxe_debug_utils.js +44 -0
- package/dest/entrypoints/client/bundle/index.d.ts +10 -0
- package/dest/entrypoints/client/bundle/index.d.ts.map +1 -0
- package/dest/entrypoints/client/bundle/index.js +8 -0
- package/dest/entrypoints/client/bundle/utils.d.ts +16 -0
- package/dest/entrypoints/client/bundle/utils.d.ts.map +1 -0
- package/dest/entrypoints/client/bundle/utils.js +78 -0
- package/dest/entrypoints/client/lazy/index.d.ts +10 -0
- package/dest/entrypoints/client/lazy/index.d.ts.map +1 -0
- package/dest/entrypoints/client/lazy/index.js +8 -0
- package/dest/entrypoints/client/lazy/utils.d.ts +15 -0
- package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -0
- package/dest/entrypoints/client/lazy/utils.js +77 -0
- 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 +32 -0
- package/dest/entrypoints/pxe_creation_options.d.ts.map +1 -0
- package/dest/entrypoints/pxe_creation_options.js +3 -0
- package/dest/entrypoints/server/circuit_recording/circuit_recorder.d.ts +121 -0
- package/dest/entrypoints/server/circuit_recording/circuit_recorder.d.ts.map +1 -0
- package/dest/entrypoints/server/circuit_recording/circuit_recorder.js +208 -0
- package/dest/entrypoints/server/circuit_recording/file_circuit_recorder.d.ts +20 -0
- package/dest/entrypoints/server/circuit_recording/file_circuit_recorder.d.ts.map +1 -0
- package/dest/entrypoints/server/circuit_recording/file_circuit_recorder.js +131 -0
- package/dest/entrypoints/server/circuit_recording/memory_circuit_recorder.d.ts +10 -0
- package/dest/entrypoints/server/circuit_recording/memory_circuit_recorder.d.ts.map +1 -0
- package/dest/entrypoints/server/circuit_recording/memory_circuit_recorder.js +9 -0
- package/dest/entrypoints/server/circuit_recording/simulator_recorder_wrapper.d.ts +18 -0
- package/dest/entrypoints/server/circuit_recording/simulator_recorder_wrapper.d.ts.map +1 -0
- package/dest/entrypoints/server/circuit_recording/simulator_recorder_wrapper.js +41 -0
- package/dest/entrypoints/server/index.d.ts +17 -0
- package/dest/entrypoints/server/index.d.ts.map +1 -0
- package/dest/entrypoints/server/index.js +14 -0
- 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 +9 -0
- package/dest/entrypoints/server/utils.d.ts.map +1 -0
- package/dest/entrypoints/server/utils.js +84 -0
- package/dest/error_enriching.d.ts +13 -0
- package/dest/error_enriching.d.ts.map +1 -0
- package/dest/error_enriching.js +80 -0
- package/dest/events/event_service.d.ts +30 -0
- package/dest/events/event_service.d.ts.map +1 -0
- package/dest/events/event_service.js +76 -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 +10 -0
- package/dest/events/private_event_filter_validator.d.ts.map +1 -0
- package/dest/events/private_event_filter_validator.js +53 -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 +40 -0
- package/dest/logs/log_service.d.ts.map +1 -0
- package/dest/logs/log_service.js +217 -0
- 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 +62 -0
- package/dest/node/benchmarked_node.d.ts +22 -0
- package/dest/node/benchmarked_node.d.ts.map +1 -0
- package/dest/node/benchmarked_node.js +93 -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 +268 -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 +77 -0
- package/dest/notes/note_service.d.ts.map +1 -0
- package/dest/notes/note_service.js +173 -0
- package/dest/notes_filter.d.ts +24 -0
- package/dest/notes_filter.d.ts.map +1 -0
- package/dest/notes_filter.js +4 -0
- package/dest/operation_lifecycle.d.ts +45 -0
- package/dest/operation_lifecycle.d.ts.map +1 -0
- package/dest/operation_lifecycle.js +68 -0
- package/dest/operation_queue.d.ts +75 -0
- package/dest/operation_queue.d.ts.map +1 -0
- package/dest/operation_queue.js +100 -0
- package/dest/oracle_version.d.ts +4 -0
- package/dest/oracle_version.d.ts.map +1 -0
- package/dest/oracle_version.js +21 -0
- 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/compute_tx_expiration_timestamp.d.ts +4 -0
- package/dest/private_kernel/hints/compute_tx_expiration_timestamp.d.ts.map +1 -0
- package/dest/private_kernel/hints/compute_tx_expiration_timestamp.js +41 -0
- package/dest/private_kernel/hints/index.d.ts +3 -0
- package/dest/private_kernel/hints/index.d.ts.map +1 -0
- package/dest/private_kernel/hints/index.js +2 -0
- package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts +29 -0
- package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts.map +1 -0
- package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.js +343 -0
- package/dest/private_kernel/hints/test_utils.d.ts +122 -0
- package/dest/private_kernel/hints/test_utils.d.ts.map +1 -0
- package/dest/private_kernel/hints/test_utils.js +202 -0
- package/dest/private_kernel/index.d.ts +3 -0
- package/dest/private_kernel/index.d.ts.map +1 -0
- package/dest/private_kernel/index.js +2 -0
- package/dest/private_kernel/private_kernel_execution_prover.d.ts +49 -0
- package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -0
- package/dest/private_kernel/private_kernel_execution_prover.js +408 -0
- package/dest/private_kernel/private_kernel_oracle.d.ts +65 -0
- package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -0
- package/dest/private_kernel/private_kernel_oracle.js +110 -0
- package/dest/pxe.d.ts +364 -0
- package/dest/pxe.d.ts.map +1 -0
- package/dest/pxe.js +903 -0
- 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_store/address_store.js +49 -0
- 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/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 +20 -0
- package/dest/storage/anchor_block_store/anchor_block_store.d.ts.map +1 -0
- package/dest/storage/anchor_block_store/anchor_block_store.js +28 -0
- package/dest/storage/anchor_block_store/index.d.ts +2 -0
- package/dest/storage/anchor_block_store/index.d.ts.map +1 -0
- package/dest/storage/anchor_block_store/index.js +1 -0
- package/dest/storage/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 +674 -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/base_staging_store.d.ts +110 -0
- package/dest/storage/base_staging_store.d.ts.map +1 -0
- package/dest/storage/base_staging_store.js +141 -0
- package/dest/storage/capsule_store/capsule_service.d.ts +22 -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 +72 -0
- package/dest/storage/capsule_store/capsule_store.d.ts.map +1 -0
- package/dest/storage/capsule_store/capsule_store.js +256 -0
- package/dest/storage/capsule_store/index.d.ts +3 -0
- package/dest/storage/capsule_store/index.d.ts.map +1 -0
- package/dest/storage/capsule_store/index.js +2 -0
- package/dest/storage/contract_store/contract_store.d.ts +96 -0
- package/dest/storage/contract_store/contract_store.d.ts.map +1 -0
- package/dest/storage/contract_store/contract_store.js +282 -0
- package/dest/storage/contract_store/index.d.ts +2 -0
- package/dest/storage/contract_store/index.d.ts.map +1 -0
- package/dest/storage/contract_store/index.js +1 -0
- package/dest/storage/contract_store/private_functions_tree.d.ts +27 -0
- package/dest/storage/contract_store/private_functions_tree.d.ts.map +1 -0
- package/dest/storage/contract_store/private_functions_tree.js +48 -0
- package/dest/storage/fact_store/fact_service.d.ts +23 -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 +101 -0
- package/dest/storage/fact_store/fact_store.d.ts.map +1 -0
- package/dest/storage/fact_store/fact_store.js +350 -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 +10 -0
- package/dest/storage/index.d.ts.map +1 -0
- package/dest/storage/index.js +9 -0
- package/dest/storage/metadata.d.ts +2 -0
- package/dest/storage/metadata.d.ts.map +1 -0
- package/dest/storage/metadata.js +1 -0
- package/dest/storage/note_store/index.d.ts +3 -0
- package/dest/storage/note_store/index.d.ts.map +1 -0
- package/dest/storage/note_store/index.js +2 -0
- package/dest/storage/note_store/note_store.d.ts +92 -0
- package/dest/storage/note_store/note_store.d.ts.map +1 -0
- package/dest/storage/note_store/note_store.js +273 -0
- package/dest/storage/note_store/stored_note.d.ts +11 -0
- package/dest/storage/note_store/stored_note.d.ts.map +1 -0
- package/dest/storage/note_store/stored_note.js +27 -0
- package/dest/storage/note_store/test_utils.d.ts +9 -0
- package/dest/storage/note_store/test_utils.d.ts.map +1 -0
- package/dest/storage/note_store/test_utils.js +10 -0
- 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 +90 -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 +276 -0
- package/dest/storage/private_event_store/stored_private_event.d.ts +23 -0
- package/dest/storage/private_event_store/stored_private_event.d.ts.map +1 -0
- package/dest/storage/private_event_store/stored_private_event.js +56 -0
- package/dest/storage/rollbackable.d.ts +15 -0
- package/dest/storage/rollbackable.d.ts.map +1 -0
- package/dest/storage/rollbackable.js +3 -0
- package/dest/storage/staged_write_coordinator.d.ts +103 -0
- package/dest/storage/staged_write_coordinator.d.ts.map +1 -0
- package/dest/storage/staged_write_coordinator.js +141 -0
- 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 +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 +36 -0
- package/dest/storage/tagging_store/recipient_tagging_store.d.ts.map +1 -0
- package/dest/storage/tagging_store/recipient_tagging_store.js +74 -0
- package/dest/storage/tagging_store/sender_tagging_store.d.ts +113 -0
- package/dest/storage/tagging_store/sender_tagging_store.d.ts.map +1 -0
- package/dest/storage/tagging_store/sender_tagging_store.js +432 -0
- 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 -0
- package/dest/tagging/constants.d.ts.map +1 -0
- package/dest/tagging/constants.js +38 -0
- package/dest/tagging/get_all_logs_by_tags.d.ts +69 -0
- package/dest/tagging/get_all_logs_by_tags.d.ts.map +1 -0
- package/dest/tagging/get_all_logs_by_tags.js +79 -0
- package/dest/tagging/index.d.ts +18 -0
- package/dest/tagging/index.d.ts.map +1 -0
- package/dest/tagging/index.js +16 -0
- package/dest/tagging/persist_sender_tagging_index_ranges.d.ts +31 -0
- package/dest/tagging/persist_sender_tagging_index_ranges.d.ts.map +1 -0
- package/dest/tagging/persist_sender_tagging_index_ranges.js +43 -0
- package/dest/tagging/recipient_sync/sync_tagged_private_logs.d.ts +75 -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 +235 -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/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 +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 +77 -0
- 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 +62 -0
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts +30 -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 +74 -0
- 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 +42 -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/dest/test_utils.d.ts +3 -0
- package/dest/test_utils.d.ts.map +1 -0
- package/dest/test_utils.js +1 -0
- package/package.json +119 -0
- package/src/bin/check_oracle_version.ts +28 -0
- package/src/bin/index.ts +1 -0
- package/src/bin/oracle_version_helpers.ts +30 -0
- package/src/block_synchronizer/block_stream_source.ts +48 -0
- package/src/block_synchronizer/block_synchronizer.ts +225 -0
- package/src/block_synchronizer/index.ts +1 -0
- package/src/config/index.ts +141 -0
- package/src/config/package_info.ts +3 -0
- package/src/contract/contract_call_graph.ts +121 -0
- package/src/contract/contract_class_service.ts +45 -0
- package/src/contract/contract_sync_service.ts +349 -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 +928 -0
- package/src/contract_function_simulator/ephemeral_array_service.ts +110 -0
- package/src/contract_function_simulator/execution_note_cache.ts +232 -0
- package/src/contract_function_simulator/execution_tagging_index_cache.ts +33 -0
- package/src/contract_function_simulator/hashed_values_cache.ts +47 -0
- package/src/contract_function_simulator/index.ts +107 -0
- 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 +52 -0
- 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 +35 -0
- package/src/contract_function_simulator/noir-structs/log_retrieval_response.ts +19 -0
- package/src/contract_function_simulator/noir-structs/note_data.ts +27 -0
- package/src/contract_function_simulator/noir-structs/note_validation_request.ts +59 -0
- package/src/contract_function_simulator/noir-structs/nullifier_membership_witness_data.ts +15 -0
- 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/public_data_witness_data.ts +13 -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 +11 -0
- package/src/contract_function_simulator/oracle/acir_callback.ts +154 -0
- package/src/contract_function_simulator/oracle/index.ts +2 -0
- package/src/contract_function_simulator/oracle/interfaces.ts +20 -0
- package/src/contract_function_simulator/oracle/legacy_oracle_registry.ts +147 -0
- package/src/contract_function_simulator/oracle/note_packing_utils.ts +68 -0
- package/src/contract_function_simulator/oracle/oracle_registry.ts +709 -0
- package/src/contract_function_simulator/oracle/oracle_type_mappings.ts +1089 -0
- package/src/contract_function_simulator/oracle/private_execution.ts +140 -0
- package/src/contract_function_simulator/oracle/private_execution_oracle.ts +812 -0
- package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +1341 -0
- package/src/contract_function_simulator/pick_notes.ts +160 -0
- package/src/contract_function_simulator/transient_array_service.ts +91 -0
- package/src/contract_logging.ts +52 -0
- package/src/debug/pxe_debug_utils.ts +89 -0
- package/src/entrypoints/client/bundle/index.ts +9 -0
- package/src/entrypoints/client/bundle/utils.ts +89 -0
- package/src/entrypoints/client/lazy/index.ts +9 -0
- package/src/entrypoints/client/lazy/utils.ts +89 -0
- package/src/entrypoints/client/store.ts +54 -0
- package/src/entrypoints/pxe_creation_options.ts +34 -0
- package/src/entrypoints/server/circuit_recording/circuit_recorder.ts +267 -0
- package/src/entrypoints/server/circuit_recording/file_circuit_recorder.ts +152 -0
- package/src/entrypoints/server/circuit_recording/memory_circuit_recorder.ts +13 -0
- package/src/entrypoints/server/circuit_recording/simulator_recorder_wrapper.ts +90 -0
- package/src/entrypoints/server/index.ts +17 -0
- package/src/entrypoints/server/store.ts +46 -0
- package/src/entrypoints/server/utils.ts +103 -0
- package/src/error_enriching.ts +124 -0
- package/src/events/event_service.ts +129 -0
- package/src/events/index.ts +1 -0
- package/src/events/private_event_filter_validator.ts +66 -0
- 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 +295 -0
- package/src/messages/tx_resolver_service.ts +81 -0
- package/src/node/benchmarked_node.ts +141 -0
- package/src/node/caching_aztec_node.ts +407 -0
- package/src/notes/index.ts +1 -0
- package/src/notes/note_service.ts +238 -0
- package/src/notes_filter.ts +24 -0
- package/src/operation_lifecycle.ts +99 -0
- package/src/operation_queue.ts +149 -0
- package/src/oracle_version.ts +22 -0
- package/src/private_kernel/batch_planner.ts +168 -0
- package/src/private_kernel/hints/compute_tx_expiration_timestamp.ts +58 -0
- package/src/private_kernel/hints/index.ts +2 -0
- package/src/private_kernel/hints/private_kernel_reset_private_inputs_builder.ts +553 -0
- package/src/private_kernel/hints/test_utils.ts +318 -0
- package/src/private_kernel/index.ts +2 -0
- package/src/private_kernel/private_kernel_execution_prover.ts +656 -0
- package/src/private_kernel/private_kernel_oracle.ts +184 -0
- package/src/pxe.ts +1417 -0
- package/src/storage/address_store/address_store.ts +66 -0
- package/src/storage/address_store/index.ts +1 -0
- package/src/storage/allowed_scopes.ts +14 -0
- package/src/storage/anchor_block_store/anchor_block_store.ts +35 -0
- package/src/storage/anchor_block_store/index.ts +1 -0
- 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 +813 -0
- package/src/storage/backwards_compatibility_tests/store_spy.ts +73 -0
- package/src/storage/base_staging_store.ts +227 -0
- package/src/storage/capsule_store/capsule_service.ts +97 -0
- package/src/storage/capsule_store/capsule_store.ts +349 -0
- package/src/storage/capsule_store/index.ts +2 -0
- package/src/storage/contract_store/contract_store.ts +403 -0
- package/src/storage/contract_store/index.ts +1 -0
- package/src/storage/contract_store/private_functions_tree.ts +68 -0
- package/src/storage/fact_store/fact_service.ts +70 -0
- package/src/storage/fact_store/fact_store.ts +424 -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 +9 -0
- package/src/storage/metadata.ts +1 -0
- package/src/storage/note_store/index.ts +2 -0
- package/src/storage/note_store/note_store.ts +367 -0
- package/src/storage/note_store/stored_note.ts +26 -0
- package/src/storage/note_store/test_utils.ts +16 -0
- package/src/storage/open_pxe_stores.ts +52 -0
- package/src/storage/private_event_store/private_event_store.ts +383 -0
- package/src/storage/private_event_store/stored_private_event.ts +73 -0
- package/src/storage/rollbackable.ts +14 -0
- package/src/storage/staged_write_coordinator.ts +218 -0
- package/src/storage/store_identity.ts +72 -0
- package/src/storage/tagging_store/index.ts +3 -0
- package/src/storage/tagging_store/recipient_tagging_store.ts +114 -0
- package/src/storage/tagging_store/sender_tagging_store.ts +564 -0
- package/src/storage/tagging_store/tagging_secret_sources_store.ts +138 -0
- package/src/tagging/constants.ts +42 -0
- package/src/tagging/get_all_logs_by_tags.ts +157 -0
- package/src/tagging/index.ts +25 -0
- package/src/tagging/persist_sender_tagging_index_ranges.ts +59 -0
- package/src/tagging/recipient_sync/sync_tagged_private_logs.ts +357 -0
- package/src/tagging/recipient_sync/utils/find_highest_indexes.ts +34 -0
- package/src/tagging/reconcile_tagging_index_ranges.ts +102 -0
- package/src/tagging/sender_sync/sync_sender_tagging_indexes.ts +113 -0
- package/src/tagging/sender_sync/utils/classify_pending_txs.ts +92 -0
- package/src/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.ts +92 -0
- package/src/tagging/sender_sync/utils/resolve_pending_txs.ts +65 -0
- package/src/tagging/sender_sync/utils/test_utils.ts +46 -0
- package/src/tagging/testing/tag_query_test_utils.ts +11 -0
- package/src/test_utils.ts +2 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { FunctionSelector } from '@aztec-labs/stdlib/abi';
|
|
2
|
+
import { AztecAddress } from '@aztec-labs/stdlib/aztec-address';
|
|
3
|
+
import type { ChangeSetId } from '../storage/staged_write_coordinator.js';
|
|
4
|
+
/** Confidence a call must reach to be predicted. */
|
|
5
|
+
export declare const PREDICTION_THRESHOLD = 2;
|
|
6
|
+
/** Cap on a call's confidence, so a function called by many operations is still dropped within a few missed ones. */
|
|
7
|
+
export declare const MAX_CONFIDENCE = 5;
|
|
8
|
+
/**
|
|
9
|
+
* A call graph over contract functions - who calls whom - learned from the direct calls observed in past operations, so
|
|
10
|
+
* a function's predicted callees can sync their contracts before execution reaches them.
|
|
11
|
+
*
|
|
12
|
+
* A function's direct calls tend to repeat across operations: constrained delivery calls the handshake registry, a
|
|
13
|
+
* transfer may call an authwit, an AMM calls its tokens. The same function does not always make the same calls, though:
|
|
14
|
+
* they can depend on context or storage state. A call must therefore repeat often enough to earn confidence before it
|
|
15
|
+
* is predicted. Calls are keyed per function, not per contract, since different functions of a contract call different
|
|
16
|
+
* contracts. See {@link learn} for how each call's confidence is learned from committed operations.
|
|
17
|
+
*
|
|
18
|
+
* Purely in-memory bookkeeping: the graph is lost when PXE is rebuilt (e.g. on restart).
|
|
19
|
+
*/
|
|
20
|
+
export declare class ContractCallGraph {
|
|
21
|
+
private readonly enabled;
|
|
22
|
+
private readonly activeChangeSets;
|
|
23
|
+
private readonly callConfidence;
|
|
24
|
+
constructor(enabled: boolean);
|
|
25
|
+
/** Records that `caller` directly called `callee` in the given change set. */
|
|
26
|
+
recordCall({ changeSetId, caller, callee }: {
|
|
27
|
+
changeSetId: ChangeSetId;
|
|
28
|
+
caller: ContractFunction;
|
|
29
|
+
callee: ContractFunction;
|
|
30
|
+
}): void;
|
|
31
|
+
/** Predicts the functions `caller` will call directly. */
|
|
32
|
+
predictDirectCallees(caller: ContractFunction): ContractFunction[];
|
|
33
|
+
/**
|
|
34
|
+
* Learns from a committed change set: the calls it observed update each caller's confidence. A function that called
|
|
35
|
+
* nothing keeps its callees untouched, so read-only uses (e.g. reading notes or events) erode nothing.
|
|
36
|
+
*/
|
|
37
|
+
learn(changeSetId: ChangeSetId): void;
|
|
38
|
+
/** Drops a discarded change set without learning. */
|
|
39
|
+
discard(changeSetId: ChangeSetId): void;
|
|
40
|
+
}
|
|
41
|
+
/** A specific function of a contract, as observed in a call. */
|
|
42
|
+
export type ContractFunction = {
|
|
43
|
+
/** The address of the contract the function belongs to. */
|
|
44
|
+
address: AztecAddress;
|
|
45
|
+
/** The selector of the function. */
|
|
46
|
+
selector: FunctionSelector;
|
|
47
|
+
};
|
|
48
|
+
/** A {@link ContractFunction} flattened to a `contractAddress:selector` string, so maps can key on it. */
|
|
49
|
+
export type CallKey = `0x${string}:${string}`;
|
|
50
|
+
export declare function toCallKey({ address, selector }: ContractFunction): CallKey;
|
|
51
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29udHJhY3RfY2FsbF9ncmFwaC5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2NvbnRyYWN0L2NvbnRyYWN0X2NhbGxfZ3JhcGgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLGdCQUFnQixFQUFFLE1BQU0sd0JBQXdCLENBQUM7QUFDMUQsT0FBTyxFQUFFLFlBQVksRUFBRSxNQUFNLGtDQUFrQyxDQUFDO0FBRWhFLE9BQU8sS0FBSyxFQUFFLFdBQVcsRUFBRSxNQUFNLHdDQUF3QyxDQUFDO0FBRTFFLG9EQUFvRDtBQUNwRCxlQUFPLE1BQU0sb0JBQW9CLElBQUksQ0FBQztBQUV0QyxxSEFBcUg7QUFDckgsZUFBTyxNQUFNLGNBQWMsSUFBSSxDQUFDO0FBRWhDOzs7Ozs7Ozs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,0GAA0G;AAC1G,MAAM,MAAM,OAAO,GAAG,KAAK,MAAM,IAAI,MAAM,EAAE,CAAC;AAE9C,wBAAgB,SAAS,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,gBAAgB,GAAG,OAAO,CAE1E"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { FunctionSelector } from '@aztec-labs/stdlib/abi';
|
|
2
|
+
import { AztecAddress } from '@aztec-labs/stdlib/aztec-address';
|
|
3
|
+
/** Confidence a call must reach to be predicted. */ export const PREDICTION_THRESHOLD = 2;
|
|
4
|
+
/** Cap on a call's confidence, so a function called by many operations is still dropped within a few missed ones. */ export const MAX_CONFIDENCE = 5;
|
|
5
|
+
/**
|
|
6
|
+
* A call graph over contract functions - who calls whom - learned from the direct calls observed in past operations, so
|
|
7
|
+
* a function's predicted callees can sync their contracts before execution reaches them.
|
|
8
|
+
*
|
|
9
|
+
* A function's direct calls tend to repeat across operations: constrained delivery calls the handshake registry, a
|
|
10
|
+
* transfer may call an authwit, an AMM calls its tokens. The same function does not always make the same calls, though:
|
|
11
|
+
* they can depend on context or storage state. A call must therefore repeat often enough to earn confidence before it
|
|
12
|
+
* is predicted. Calls are keyed per function, not per contract, since different functions of a contract call different
|
|
13
|
+
* contracts. See {@link learn} for how each call's confidence is learned from committed operations.
|
|
14
|
+
*
|
|
15
|
+
* Purely in-memory bookkeeping: the graph is lost when PXE is rebuilt (e.g. on restart).
|
|
16
|
+
*/ export class ContractCallGraph {
|
|
17
|
+
enabled;
|
|
18
|
+
// change set -> caller function -> functions it called directly
|
|
19
|
+
activeChangeSets;
|
|
20
|
+
// caller function -> function it calls directly -> confidence score
|
|
21
|
+
callConfidence;
|
|
22
|
+
constructor(enabled){
|
|
23
|
+
this.enabled = enabled;
|
|
24
|
+
this.activeChangeSets = new Map();
|
|
25
|
+
this.callConfidence = new Map();
|
|
26
|
+
}
|
|
27
|
+
/** Records that `caller` directly called `callee` in the given change set. */ recordCall({ changeSetId, caller, callee }) {
|
|
28
|
+
// Same-contract calls are ignored: our goal is to warm a callee's contract ahead of use, and the target of such
|
|
29
|
+
// a call is already warm.
|
|
30
|
+
if (!this.enabled || caller.address.equals(callee.address)) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
let callsInChangeSet = this.activeChangeSets.get(changeSetId);
|
|
34
|
+
if (!callsInChangeSet) {
|
|
35
|
+
callsInChangeSet = new Map();
|
|
36
|
+
this.activeChangeSets.set(changeSetId, callsInChangeSet);
|
|
37
|
+
}
|
|
38
|
+
let callees = callsInChangeSet.get(toCallKey(caller));
|
|
39
|
+
if (!callees) {
|
|
40
|
+
callees = new Set();
|
|
41
|
+
callsInChangeSet.set(toCallKey(caller), callees);
|
|
42
|
+
}
|
|
43
|
+
callees.add(toCallKey(callee));
|
|
44
|
+
}
|
|
45
|
+
/** Predicts the functions `caller` will call directly. */ predictDirectCallees(caller) {
|
|
46
|
+
const callees = this.callConfidence.get(toCallKey(caller)) ?? new Map();
|
|
47
|
+
return [
|
|
48
|
+
...callees.entries()
|
|
49
|
+
].filter(([, confidence])=>confidence >= PREDICTION_THRESHOLD).map(([callee])=>fromCallKey(callee));
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Learns from a committed change set: the calls it observed update each caller's confidence. A function that called
|
|
53
|
+
* nothing keeps its callees untouched, so read-only uses (e.g. reading notes or events) erode nothing.
|
|
54
|
+
*/ learn(changeSetId) {
|
|
55
|
+
const callsInChangeSet = this.activeChangeSets.get(changeSetId);
|
|
56
|
+
this.activeChangeSets.delete(changeSetId);
|
|
57
|
+
if (!callsInChangeSet) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
for (const [caller, observed] of callsInChangeSet){
|
|
61
|
+
const callees = this.callConfidence.get(caller) ?? new Map();
|
|
62
|
+
for (const [callee, confidence] of callees){
|
|
63
|
+
const delta = observed.has(callee) ? 1 : -1;
|
|
64
|
+
const updated = Math.min(confidence + delta, MAX_CONFIDENCE);
|
|
65
|
+
if (updated === 0) {
|
|
66
|
+
callees.delete(callee);
|
|
67
|
+
} else {
|
|
68
|
+
callees.set(callee, updated);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
// First-time callees enter at 1, below PREDICTION_THRESHOLD: a call must repeat before it is predicted.
|
|
72
|
+
[
|
|
73
|
+
...observed
|
|
74
|
+
].filter((callee)=>!callees.has(callee)).forEach((callee)=>callees.set(callee, 1));
|
|
75
|
+
this.callConfidence.set(caller, callees);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
/** Drops a discarded change set without learning. */ discard(changeSetId) {
|
|
79
|
+
this.activeChangeSets.delete(changeSetId);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
export function toCallKey({ address, selector }) {
|
|
83
|
+
return `${address.toString()}:${selector.toString()}`;
|
|
84
|
+
}
|
|
85
|
+
function fromCallKey(key) {
|
|
86
|
+
const [address, selector] = key.split(':');
|
|
87
|
+
return {
|
|
88
|
+
address: AztecAddress.fromStringUnsafe(address),
|
|
89
|
+
selector: FunctionSelector.fromString(selector)
|
|
90
|
+
};
|
|
91
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Fr } from '@aztec-labs/foundation/curves/bn254';
|
|
2
|
+
import type { AztecAddress } from '@aztec-labs/stdlib/aztec-address';
|
|
3
|
+
import type { AztecNode } from '@aztec-labs/stdlib/interfaces/client';
|
|
4
|
+
import type { BlockHeader } from '@aztec-labs/stdlib/tx';
|
|
5
|
+
import type { ContractStore } from '../storage/contract_store/contract_store.js';
|
|
6
|
+
/**
|
|
7
|
+
* Resolves the contract class id that an address runs at a given anchor block, as tracked by the chain.
|
|
8
|
+
*
|
|
9
|
+
* PXE does not store a contract's current class id: it is mutable, chain-derived state that changes when a contract is
|
|
10
|
+
* upgraded and can be undone by a reorg. Instead this service asks the node for the current class at an anchor block,
|
|
11
|
+
* falling back to a local instance if no upgrades were scheduled.
|
|
12
|
+
*/
|
|
13
|
+
export declare class ContractClassService {
|
|
14
|
+
private node;
|
|
15
|
+
private contractStore;
|
|
16
|
+
constructor(node: AztecNode, contractStore: ContractStore);
|
|
17
|
+
/**
|
|
18
|
+
* Returns the class id that corresponds to `address` as of `anchorBlockHeader`, or `undefined` if no instance is
|
|
19
|
+
* registered for `address`. A missing instance is an absence the caller decides how to handle, not an error; genuine
|
|
20
|
+
* failures (e.g. the node being unreachable) still throw.
|
|
21
|
+
*/
|
|
22
|
+
getCurrentClassId(address: AztecAddress, anchorBlockHeader: BlockHeader): Promise<Fr | undefined>;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29udHJhY3RfY2xhc3Nfc2VydmljZS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2NvbnRyYWN0L2NvbnRyYWN0X2NsYXNzX3NlcnZpY2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLEVBQUUsRUFBRSxFQUFFLE1BQU0scUNBQXFDLENBQUM7QUFFOUQsT0FBTyxLQUFLLEVBQUUsWUFBWSxFQUFFLE1BQU0sa0NBQWtDLENBQUM7QUFDckUsT0FBTyxLQUFLLEVBQUUsU0FBUyxFQUFFLE1BQU0sc0NBQXNDLENBQUM7QUFDdEUsT0FBTyxLQUFLLEVBQUUsV0FBVyxFQUFFLE1BQU0sdUJBQXVCLENBQUM7QUFFekQsT0FBTyxLQUFLLEVBQUUsYUFBYSxFQUFFLE1BQU0sNkNBQTZDLENBQUM7QUFFakY7Ozs7OztHQU1HO0FBQ0gscUJBQWEsb0JBQW9CO0lBRTdCLE9BQU8sQ0FBQyxJQUFJO0lBQ1osT0FBTyxDQUFDLGFBQWE7SUFGdkIsWUFDVSxJQUFJLEVBQUUsU0FBUyxFQUNmLGFBQWEsRUFBRSxhQUFhLEVBQ2xDO0lBRUo7Ozs7T0FJRztJQUNHLGlCQUFpQixDQUFDLE9BQU8sRUFBRSxZQUFZLEVBQUUsaUJBQWlCLEVBQUUsV0FBVyxHQUFHLE9BQU8sQ0FBQyxFQUFFLEdBQUcsU0FBUyxDQUFDLENBaUJ0RztDQUNGIn0=
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract_class_service.d.ts","sourceRoot":"","sources":["../../src/contract/contract_class_service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,qCAAqC,CAAC;AAE9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AACtE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEzD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6CAA6C,CAAC;AAEjF;;;;;;GAMG;AACH,qBAAa,oBAAoB;IAE7B,OAAO,CAAC,IAAI;IACZ,OAAO,CAAC,aAAa;IAFvB,YACU,IAAI,EAAE,SAAS,EACf,aAAa,EAAE,aAAa,EAClC;IAEJ;;;;OAIG;IACG,iBAAiB,CAAC,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,WAAW,GAAG,OAAO,CAAC,EAAE,GAAG,SAAS,CAAC,CAiBtG;CACF"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { isProtocolContract } from '@aztec-labs/protocol-contracts';
|
|
2
|
+
/**
|
|
3
|
+
* Resolves the contract class id that an address runs at a given anchor block, as tracked by the chain.
|
|
4
|
+
*
|
|
5
|
+
* PXE does not store a contract's current class id: it is mutable, chain-derived state that changes when a contract is
|
|
6
|
+
* upgraded and can be undone by a reorg. Instead this service asks the node for the current class at an anchor block,
|
|
7
|
+
* falling back to a local instance if no upgrades were scheduled.
|
|
8
|
+
*/ export class ContractClassService {
|
|
9
|
+
node;
|
|
10
|
+
contractStore;
|
|
11
|
+
constructor(node, contractStore){
|
|
12
|
+
this.node = node;
|
|
13
|
+
this.contractStore = contractStore;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Returns the class id that corresponds to `address` as of `anchorBlockHeader`, or `undefined` if no instance is
|
|
17
|
+
* registered for `address`. A missing instance is an absence the caller decides how to handle, not an error; genuine
|
|
18
|
+
* failures (e.g. the node being unreachable) still throw.
|
|
19
|
+
*/ async getCurrentClassId(address, anchorBlockHeader) {
|
|
20
|
+
// Protocol contracts are not in the registry and cannot be upgraded, so their original class is always current.
|
|
21
|
+
// Short-circuiting avoids a node round-trip.
|
|
22
|
+
if (isProtocolContract(address)) {
|
|
23
|
+
const instance = await this.contractStore.getContractInstance(address);
|
|
24
|
+
return instance?.originalContractClassId;
|
|
25
|
+
}
|
|
26
|
+
// The node resolves the current class from the same scheduled value change the AVM enforces against the public
|
|
27
|
+
// data tree. If the contract was upgraded the node returns a non-undefined instance; an undefined result means no
|
|
28
|
+
// upgrade happened (or the node has no record of it, e.g. it was never publicly deployed), so the original class
|
|
29
|
+
// is current.
|
|
30
|
+
const nodeInstance = await this.node.getContract(address, await anchorBlockHeader.hash());
|
|
31
|
+
if (nodeInstance) {
|
|
32
|
+
return nodeInstance.currentContractClassId;
|
|
33
|
+
}
|
|
34
|
+
return (await this.contractStore.getContractInstance(address))?.originalContractClassId;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import type { Logger } from '@aztec-labs/foundation/log';
|
|
2
|
+
import { type FunctionCall, FunctionSelector } from '@aztec-labs/stdlib/abi';
|
|
3
|
+
import type { AztecAddress } from '@aztec-labs/stdlib/aztec-address';
|
|
4
|
+
import type { AztecNode } from '@aztec-labs/stdlib/interfaces/client';
|
|
5
|
+
import type { BlockHeader } from '@aztec-labs/stdlib/tx';
|
|
6
|
+
import type { ContractSyncConfig } from '../config/index.js';
|
|
7
|
+
import type { OperationContributor } from '../operation_lifecycle.js';
|
|
8
|
+
import type { ContractStore } from '../storage/contract_store/contract_store.js';
|
|
9
|
+
import type { NoteStore } from '../storage/note_store/note_store.js';
|
|
10
|
+
import type { ChangeSetId } from '../storage/staged_write_coordinator.js';
|
|
11
|
+
import { type ContractFunction } from './contract_call_graph.js';
|
|
12
|
+
import type { ContractClassService } from './contract_class_service.js';
|
|
13
|
+
/**
|
|
14
|
+
* Maximum number of scope syncs running concurrently within a single sync call. Sized to trade off parallelism
|
|
15
|
+
* on non-ACIR work (node RPC, note store reads) against memory pressure from concurrent circuit execution.
|
|
16
|
+
*/
|
|
17
|
+
export declare const MAX_CONCURRENT_SCOPE_SYNCS = 5;
|
|
18
|
+
/**
|
|
19
|
+
* Selector of the macro-generated `sync_state` utility function, which is the same for every contract.
|
|
20
|
+
* Pinned against a compiled artifact in tests, so a macro signature change fails there.
|
|
21
|
+
*/
|
|
22
|
+
export declare const SYNC_STATE_SELECTOR: FunctionSelector;
|
|
23
|
+
/**
|
|
24
|
+
* Service for syncing the private state of contracts. It uses a cache to avoid redundant sync operations - the cache
|
|
25
|
+
* is wiped when the anchor block changes.
|
|
26
|
+
*
|
|
27
|
+
* Contributes to every synced operation (see {@link OperationContributor}): its syncs write into the operation's change
|
|
28
|
+
* set, so it settles them before the change set is decided and releases its per-change-set state on the outcome.
|
|
29
|
+
*/
|
|
30
|
+
export declare class ContractSyncService implements OperationContributor {
|
|
31
|
+
#private;
|
|
32
|
+
private aztecNode;
|
|
33
|
+
private contractStore;
|
|
34
|
+
private contractClassService;
|
|
35
|
+
private noteStore;
|
|
36
|
+
private log;
|
|
37
|
+
private readonly syncedContracts;
|
|
38
|
+
private readonly speculationByChangeSet;
|
|
39
|
+
private readonly callGraph;
|
|
40
|
+
constructor(aztecNode: AztecNode, contractStore: ContractStore, contractClassService: ContractClassService, noteStore: NoteStore, log: Logger, { concurrentContractSyncEnabled }: ContractSyncConfig);
|
|
41
|
+
/**
|
|
42
|
+
* Ensures a contract's private state is synchronized.
|
|
43
|
+
* Uses a cache to avoid redundant sync operations - the cache is wiped when the anchor block changes.
|
|
44
|
+
*/
|
|
45
|
+
ensureContractSynced({ contract, functionToInvokeAfterSync, utilityExecutor, anchorBlockHeader, changeSetId, scopes, triggeredBy }: ContractSyncRequest): Promise<void>;
|
|
46
|
+
/**
|
|
47
|
+
* Waits until every speculative sync the change set fired has finished, then rejects if any failed, so the change set
|
|
48
|
+
* discards instead of committing. This is needed because a sync that fails midway can leave partial staged writes,
|
|
49
|
+
* and a speculative failure might not be surfaced by any request.
|
|
50
|
+
*/
|
|
51
|
+
settle(changeSetId: ChangeSetId): Promise<void>;
|
|
52
|
+
/** Clears sync cache entries for the given scopes of a contract. */
|
|
53
|
+
invalidateContractForScopes(contractAddress: AztecAddress, scopes: AztecAddress[]): void;
|
|
54
|
+
/** Clears sync cache. Called by BlockSynchronizer when anchor block changes. */
|
|
55
|
+
wipe(): void;
|
|
56
|
+
onOperationEnd(changeSetId: ChangeSetId, outcome: 'committed' | 'discarded'): void;
|
|
57
|
+
}
|
|
58
|
+
/** A request to synchronize a contract's private state. */
|
|
59
|
+
type ContractSyncRequest = {
|
|
60
|
+
/** The contract to sync. */
|
|
61
|
+
contract: AztecAddress;
|
|
62
|
+
/**
|
|
63
|
+
* The function that will be invoked after the sync, or null when nothing will be invoked (e.g. reading
|
|
64
|
+
* notes/events directly).
|
|
65
|
+
*/
|
|
66
|
+
functionToInvokeAfterSync: FunctionSelector | null;
|
|
67
|
+
/** Executes a utility function call under the given scopes. Syncs run each contract's sync_state through it. */
|
|
68
|
+
utilityExecutor: (call: FunctionCall, scopes: AztecAddress[]) => Promise<any>;
|
|
69
|
+
/** The anchor block to sync at. */
|
|
70
|
+
anchorBlockHeader: BlockHeader;
|
|
71
|
+
/** The change set requesting the sync. */
|
|
72
|
+
changeSetId: ChangeSetId;
|
|
73
|
+
/** Access scopes to pass through to the utility executor (affects whose account's private state is discovered). */
|
|
74
|
+
scopes: AztecAddress[];
|
|
75
|
+
/**
|
|
76
|
+
* The function whose execution triggered this sync request, or undefined when the request is a change set's top-level
|
|
77
|
+
* use (an entry call or a direct read) rather than a nested call.
|
|
78
|
+
*/
|
|
79
|
+
triggeredBy: ContractFunction | undefined;
|
|
80
|
+
};
|
|
81
|
+
export {};
|
|
82
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29udHJhY3Rfc3luY19zZXJ2aWNlLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvY29udHJhY3QvY29udHJhY3Rfc3luY19zZXJ2aWNlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLE1BQU0sRUFBRSxNQUFNLDRCQUE0QixDQUFDO0FBSXpELE9BQU8sRUFBRSxLQUFLLFlBQVksRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLHdCQUF3QixDQUFDO0FBQzdFLE9BQU8sS0FBSyxFQUFFLFlBQVksRUFBRSxNQUFNLGtDQUFrQyxDQUFDO0FBQ3JFLE9BQU8sS0FBSyxFQUFFLFNBQVMsRUFBRSxNQUFNLHNDQUFzQyxDQUFDO0FBQ3RFLE9BQU8sS0FBSyxFQUFFLFdBQVcsRUFBRSxNQUFNLHVCQUF1QixDQUFDO0FBRXpELE9BQU8sS0FBSyxFQUFFLGtCQUFrQixFQUFFLE1BQU0sb0JBQW9CLENBQUM7QUFFN0QsT0FBTyxLQUFLLEVBQUUsb0JBQW9CLEVBQUUsTUFBTSwyQkFBMkIsQ0FBQztBQUN0RSxPQUFPLEtBQUssRUFBRSxhQUFhLEVBQUUsTUFBTSw2Q0FBNkMsQ0FBQztBQUNqRixPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsTUFBTSxxQ0FBcUMsQ0FBQztBQUNyRSxPQUFPLEtBQUssRUFBRSxXQUFXLEVBQUUsTUFBTSx3Q0FBd0MsQ0FBQztBQUMxRSxPQUFPLEVBQW1DLEtBQUssZ0JBQWdCLEVBQ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tD;IAED;;;OAGG;IACG,oBAAoB,CAAC,EACzB,QAAQ,EACR,yBAAyB,EACzB,eAAe,EACf,iBAAiB,EACjB,WAAW,EACX,MAAM,EACN,WAAW,EACZ,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CAkBrC;IAED;;;;OAIG;IACG,MAAM,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAepD;IAED,oEAAoE;IACpE,2BAA2B,CAAC,eAAe,EAAE,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,GAAG,IAAI,CAKvF;IAED,gFAAgF;IAChF,IAAI,IAAI,IAAI,CAGX;IAED,cAAc,CAAC,WAAW,EAAE,WAAW,EAAE,OAAO,EAAE,WAAW,GAAG,WAAW,GAAG,IAAI,CAUjF;CAiKF;AAED,2DAA2D;AAC3D,KAAK,mBAAmB,GAAG;IACzB,4BAA4B;IAC5B,QAAQ,EAAE,YAAY,CAAC;IACvB;;;OAGG;IACH,yBAAyB,EAAE,gBAAgB,GAAG,IAAI,CAAC;IACnD,gHAAgH;IAChH,eAAe,EAAE,CAAC,IAAI,EAAE,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;IAC9E,mCAAmC;IACnC,iBAAiB,EAAE,WAAW,CAAC;IAC/B,0CAA0C;IAC1C,WAAW,EAAE,WAAW,CAAC;IACzB,mHAAmH;IACnH,MAAM,EAAE,YAAY,EAAE,CAAC;IACvB;;;OAGG;IACH,WAAW,EAAE,gBAAgB,GAAG,SAAS,CAAC;CAC3C,CAAC"}
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
import { allToCompletion } from '@aztec-labs/foundation/promise';
|
|
2
|
+
import { Semaphore } from '@aztec-labs/foundation/queue';
|
|
3
|
+
import { isProtocolContract } from '@aztec-labs/protocol-contracts';
|
|
4
|
+
import { FunctionSelector } from '@aztec-labs/stdlib/abi';
|
|
5
|
+
import { NoteService } from '../notes/note_service.js';
|
|
6
|
+
import { ContractCallGraph, toCallKey } from './contract_call_graph.js';
|
|
7
|
+
import { syncScope } from './helpers.js';
|
|
8
|
+
/**
|
|
9
|
+
* Maximum number of scope syncs running concurrently within a single sync call. Sized to trade off parallelism
|
|
10
|
+
* on non-ACIR work (node RPC, note store reads) against memory pressure from concurrent circuit execution.
|
|
11
|
+
*/ export const MAX_CONCURRENT_SCOPE_SYNCS = 5;
|
|
12
|
+
/**
|
|
13
|
+
* Selector of the macro-generated `sync_state` utility function, which is the same for every contract.
|
|
14
|
+
* Pinned against a compiled artifact in tests, so a macro signature change fails there.
|
|
15
|
+
*/ export const SYNC_STATE_SELECTOR = FunctionSelector.fromString('0x418ef5da');
|
|
16
|
+
/**
|
|
17
|
+
* Service for syncing the private state of contracts. It uses a cache to avoid redundant sync operations - the cache
|
|
18
|
+
* is wiped when the anchor block changes.
|
|
19
|
+
*
|
|
20
|
+
* Contributes to every synced operation (see {@link OperationContributor}): its syncs write into the operation's change
|
|
21
|
+
* set, so it settles them before the change set is decided and releases its per-change-set state on the outcome.
|
|
22
|
+
*/ export class ContractSyncService {
|
|
23
|
+
aztecNode;
|
|
24
|
+
contractStore;
|
|
25
|
+
contractClassService;
|
|
26
|
+
noteStore;
|
|
27
|
+
log;
|
|
28
|
+
// Tracks contracts synced since last wipe. The cache is keyed per individual scope address
|
|
29
|
+
// (`contractAddress:scopeAddress`). The value is a promise that resolves when the contract is synced.
|
|
30
|
+
syncedContracts;
|
|
31
|
+
// Per-change-set speculation state, dropped when the change set commits or discards.
|
|
32
|
+
speculationByChangeSet;
|
|
33
|
+
// Predicts a function's callees from the calls observed in past operations, driving speculative sync.
|
|
34
|
+
callGraph;
|
|
35
|
+
constructor(aztecNode, contractStore, contractClassService, noteStore, log, { concurrentContractSyncEnabled }){
|
|
36
|
+
this.aztecNode = aztecNode;
|
|
37
|
+
this.contractStore = contractStore;
|
|
38
|
+
this.contractClassService = contractClassService;
|
|
39
|
+
this.noteStore = noteStore;
|
|
40
|
+
this.log = log;
|
|
41
|
+
this.syncedContracts = new Map();
|
|
42
|
+
this.speculationByChangeSet = new Map();
|
|
43
|
+
this.callGraph = new ContractCallGraph(concurrentContractSyncEnabled);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Ensures a contract's private state is synchronized.
|
|
47
|
+
* Uses a cache to avoid redundant sync operations - the cache is wiped when the anchor block changes.
|
|
48
|
+
*/ async ensureContractSynced({ contract, functionToInvokeAfterSync, utilityExecutor, anchorBlockHeader, changeSetId, scopes, triggeredBy }) {
|
|
49
|
+
// A call is recorded only when both functions are known: the invoked callee and the caller that triggered it.
|
|
50
|
+
if (functionToInvokeAfterSync && triggeredBy) {
|
|
51
|
+
this.callGraph.recordCall({
|
|
52
|
+
changeSetId,
|
|
53
|
+
caller: triggeredBy,
|
|
54
|
+
callee: {
|
|
55
|
+
address: contract,
|
|
56
|
+
selector: functionToInvokeAfterSync
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
await this.#startSyncIfNeeded(contract, functionToInvokeAfterSync, utilityExecutor, anchorBlockHeader, changeSetId, scopes);
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Waits until every speculative sync the change set fired has finished, then rejects if any failed, so the change set
|
|
64
|
+
* discards instead of committing. This is needed because a sync that fails midway can leave partial staged writes,
|
|
65
|
+
* and a speculative failure might not be surfaced by any request.
|
|
66
|
+
*/ async settle(changeSetId) {
|
|
67
|
+
// A speculative sync's execution can fire more speculative syncs mid-drain, so loop until no new promises
|
|
68
|
+
// appear, and only escalate once nothing is still writing.
|
|
69
|
+
const { syncs } = this.#speculationForChangeSet(changeSetId);
|
|
70
|
+
const failures = [];
|
|
71
|
+
while(syncs.length > 0){
|
|
72
|
+
const results = await Promise.allSettled(syncs.splice(0));
|
|
73
|
+
failures.push(...results.filter((result)=>result.status === 'rejected').map((result)=>result.reason));
|
|
74
|
+
}
|
|
75
|
+
if (failures.length > 0) {
|
|
76
|
+
throw new AggregateError(failures, 'Speculative syncs failed, so the operation must discard its staged writes instead of committing');
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
/** Clears sync cache entries for the given scopes of a contract. */ invalidateContractForScopes(contractAddress, scopes) {
|
|
80
|
+
if (scopes.length === 0) {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
scopes.forEach((scope)=>this.syncedContracts.delete(toKey(contractAddress, scope)));
|
|
84
|
+
}
|
|
85
|
+
/** Clears sync cache. Called by BlockSynchronizer when anchor block changes. */ wipe() {
|
|
86
|
+
this.log.debug(`Wiping contract sync cache (${this.syncedContracts.size} entries)`);
|
|
87
|
+
this.syncedContracts.clear();
|
|
88
|
+
}
|
|
89
|
+
onOperationEnd(changeSetId, outcome) {
|
|
90
|
+
if (outcome === 'committed') {
|
|
91
|
+
this.callGraph.learn(changeSetId);
|
|
92
|
+
} else {
|
|
93
|
+
// We clear the synced contracts cache here because, when the change set is discarded, any associated database
|
|
94
|
+
// writes from the sync are also undone.
|
|
95
|
+
this.syncedContracts.clear();
|
|
96
|
+
this.callGraph.discard(changeSetId);
|
|
97
|
+
}
|
|
98
|
+
this.speculationByChangeSet.delete(changeSetId);
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* For each unsynced scope, creates a promise that waits on:
|
|
102
|
+
* 1. Note nullifier sync (shared, batched across all unsynced scopes).
|
|
103
|
+
* 2. Per-scope sync (individual, semaphore-bounded).
|
|
104
|
+
* When concurrent contract sync is enabled, the predicted direct callees of the invoked function and of the
|
|
105
|
+
* contract's `sync_state` start speculatively too, once the contract's own syncs have started (see
|
|
106
|
+
* {@link #speculativelySync}).
|
|
107
|
+
* @returns A promise that resolves once every requested scope is synced, including syncs already in flight from
|
|
108
|
+
* concurrent calls. Speculative syncs are not included: those are only awaited by a later request that needs
|
|
109
|
+
* their contract, or by the change set's {@link settle}.
|
|
110
|
+
*/ async #startSyncIfNeeded(contractAddress, functionToInvokeAfterSync, utilityExecutor, anchorBlockHeader, changeSetId, scopes) {
|
|
111
|
+
const scopesToSync = scopes.filter((scope)=>!this.syncedContracts.has(toKey(contractAddress, scope)));
|
|
112
|
+
if (scopesToSync.length > 0) {
|
|
113
|
+
this.log.debug(`Syncing contract ${contractAddress} for ${scopesToSync.length} scope(s)`);
|
|
114
|
+
const syncNullifiersPromise = this.#syncNoteNullifiers(contractAddress, anchorBlockHeader, changeSetId, scopesToSync);
|
|
115
|
+
// We build a new semaphore for each sync call, so it rate-limits the scopes within that single call. We do
|
|
116
|
+
// this so that if these scope syncs trigger nested syncs, the nested ones can execute without causing a deadlock.
|
|
117
|
+
const syncSlot = new Semaphore(MAX_CONCURRENT_SCOPE_SYNCS);
|
|
118
|
+
for (const scope of scopesToSync){
|
|
119
|
+
const key = toKey(contractAddress, scope);
|
|
120
|
+
const syncScopePromise = runBounded(syncSlot, ()=>syncScope(contractAddress, this.contractStore, this.contractClassService, anchorBlockHeader, functionToInvokeAfterSync, utilityExecutor, scope));
|
|
121
|
+
// This cached promise is what every later request for this scope awaits, and both branches write staged data,
|
|
122
|
+
// so it must run both to completion even when one fails.
|
|
123
|
+
const promise = allToCompletion([
|
|
124
|
+
syncNullifiersPromise,
|
|
125
|
+
syncScopePromise
|
|
126
|
+
]).then(()=>{}).catch((err)=>{
|
|
127
|
+
this.syncedContracts.delete(key);
|
|
128
|
+
throw err;
|
|
129
|
+
});
|
|
130
|
+
this.syncedContracts.set(key, promise);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
// `sync_state` itself calls other contracts (e.g. most contract syncs query the handshake registry), so its
|
|
134
|
+
// predicted callees start syncing alongside the contract's own syncs.
|
|
135
|
+
this.#speculativelySync(contractAddress, SYNC_STATE_SELECTOR, utilityExecutor, anchorBlockHeader, changeSetId, scopes);
|
|
136
|
+
this.#speculativelySync(contractAddress, functionToInvokeAfterSync, utilityExecutor, anchorBlockHeader, changeSetId, scopes);
|
|
137
|
+
await this.#awaitSync(contractAddress, scopes);
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Starts the syncs of the contracts the given function is predicted to call (see {@link ContractCallGraph} for how
|
|
141
|
+
* predictions are learned). Each started sync speculates from its own function in turn, so the whole predicted call
|
|
142
|
+
* tree syncs in parallel with the contract instead of one contract at a time as execution reaches it.
|
|
143
|
+
*
|
|
144
|
+
* A wrong prediction is cheap: the extra node requests are batched into round trips the operation already makes, and
|
|
145
|
+
* the synced data simply goes unused.
|
|
146
|
+
*/ #speculativelySync(contractAddress, functionToInvokeAfterSync, utilityExecutor, anchorBlockHeader, changeSetId, scopes) {
|
|
147
|
+
// Without a function there is no key to predict from (the request is a direct read).
|
|
148
|
+
if (!functionToInvokeAfterSync) {
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
const speculation = this.#speculationForChangeSet(changeSetId);
|
|
152
|
+
const caller = {
|
|
153
|
+
address: contractAddress,
|
|
154
|
+
selector: functionToInvokeAfterSync
|
|
155
|
+
};
|
|
156
|
+
for (const callee of this.callGraph.predictDirectCallees(caller)){
|
|
157
|
+
// The change set's set of already-speculated functions stops the recursion when the predicted graph has a cycle.
|
|
158
|
+
if (speculation.speculated.has(toCallKey(callee))) {
|
|
159
|
+
continue;
|
|
160
|
+
}
|
|
161
|
+
speculation.speculated.add(toCallKey(callee));
|
|
162
|
+
const syncPromise = this.#startSyncIfNeeded(callee.address, callee.selector, utilityExecutor, anchorBlockHeader, changeSetId, scopes);
|
|
163
|
+
speculation.syncs.push(syncPromise);
|
|
164
|
+
// `settle` only escalates these failures at the end of the change set: catch here so one does not become an
|
|
165
|
+
// unhandled rejection before then, and log it.
|
|
166
|
+
syncPromise.catch((err)=>{
|
|
167
|
+
this.log.warn(`Speculative sync of ${callee.address} failed`, {
|
|
168
|
+
changeSetId,
|
|
169
|
+
error: err?.message
|
|
170
|
+
});
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
/** Syncs note nullifiers across all unsynced scopes in a single batched call. */ async #syncNoteNullifiers(contractAddress, anchorBlockHeader, changeSetId, scopes) {
|
|
175
|
+
// Protocol contracts don't have private state to sync
|
|
176
|
+
if (isProtocolContract(contractAddress)) {
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
// This runs in parallel with per-scope sync (which also writes to the note store). That's safe because
|
|
180
|
+
// the note store handles concurrent operations.
|
|
181
|
+
const noteService = new NoteService(this.noteStore, this.aztecNode, anchorBlockHeader, changeSetId);
|
|
182
|
+
await noteService.syncNoteNullifiers(contractAddress, scopes);
|
|
183
|
+
}
|
|
184
|
+
#speculationForChangeSet(changeSetId) {
|
|
185
|
+
let speculation = this.speculationByChangeSet.get(changeSetId);
|
|
186
|
+
if (!speculation) {
|
|
187
|
+
speculation = {
|
|
188
|
+
speculated: new Set(),
|
|
189
|
+
syncs: []
|
|
190
|
+
};
|
|
191
|
+
this.speculationByChangeSet.set(changeSetId, speculation);
|
|
192
|
+
}
|
|
193
|
+
return speculation;
|
|
194
|
+
}
|
|
195
|
+
/** Collects all relevant scope promises (including in-flight ones from concurrent calls) and awaits them. */ async #awaitSync(contractAddress, scopes) {
|
|
196
|
+
const promises = scopes.map((scope)=>this.syncedContracts.get(toKey(contractAddress, scope))).filter((p)=>p !== undefined);
|
|
197
|
+
await allToCompletion(promises);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
function toKey(contract, scope) {
|
|
201
|
+
return `${contract.toString()}:${scope.toString()}`;
|
|
202
|
+
}
|
|
203
|
+
/** Runs fn while holding a slot in the given semaphore, bounding concurrent scope syncs within a single call. */ async function runBounded(syncSlot, fn) {
|
|
204
|
+
await syncSlot.acquire();
|
|
205
|
+
try {
|
|
206
|
+
return await fn();
|
|
207
|
+
} finally{
|
|
208
|
+
syncSlot.release();
|
|
209
|
+
}
|
|
210
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { FunctionCall, FunctionSelector } from '@aztec-labs/stdlib/abi';
|
|
2
|
+
import type { AztecAddress } from '@aztec-labs/stdlib/aztec-address';
|
|
3
|
+
import type { BlockHeader } from '@aztec-labs/stdlib/tx';
|
|
4
|
+
import type { ContractStore } from '../storage/contract_store/contract_store.js';
|
|
5
|
+
import type { ContractClassService } from './contract_class_service.js';
|
|
6
|
+
export declare function syncScope(contractAddress: AztecAddress, contractStore: ContractStore, contractClassService: ContractClassService, anchorBlockHeader: BlockHeader, functionToInvokeAfterSync: FunctionSelector | null, utilityExecutor: (privateSyncCall: FunctionCall, scopes: AztecAddress[]) => Promise<any>, scope: AztecAddress): Promise<void>;
|
|
7
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaGVscGVycy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2NvbnRyYWN0L2hlbHBlcnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLEVBQUUsWUFBWSxFQUFFLGdCQUFnQixFQUFFLE1BQU0sd0JBQXdCLENBQUM7QUFDN0UsT0FBTyxLQUFLLEVBQUUsWUFBWSxFQUFFLE1BQU0sa0NBQWtDLENBQUM7QUFDckUsT0FBTyxLQUFLLEVBQUUsV0FBVyxFQUFFLE1BQU0sdUJBQXVCLENBQUM7QUFFekQsT0FBTyxLQUFLLEVBQUUsYUFBYSxFQUFFLE1BQU0sNkNBQTZDLENBQUM7QUFDakYsT0FBTyxLQUFLLEVBQUUsb0JBQW9CLEVBQUUsTUFBTSw2QkFBNkIsQ0FBQztBQUd4RSx3QkFBc0IsU0FBUyxDQUM3QixlQUFlLEVBQUUsWUFBWSxFQUM3QixhQUFhLEVBQUUsYUFBYSxFQUM1QixvQkFBb0IsRUFBRSxvQkFBb0IsRUFDMUMsaUJBQWlCLEVBQUUsV0FBVyxFQUM5Qix5QkFBeUIsRUFBRSxnQkFBZ0IsR0FBRyxJQUFJLEVBQ2xELGVBQWUsRUFBRSxDQUFDLGVBQWUsRUFBRSxZQUFZLEVBQUUsTUFBTSxFQUFFLFlBQVksRUFBRSxLQUFLLE9BQU8sQ0FBQyxHQUFHLENBQUMsRUFDeEYsS0FBSyxFQUFFLFlBQVksaUJBbUJwQiJ9
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/contract/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC7E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEzD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6CAA6C,CAAC;AACjF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAGxE,wBAAsB,SAAS,CAC7B,eAAe,EAAE,YAAY,EAC7B,aAAa,EAAE,aAAa,EAC5B,oBAAoB,EAAE,oBAAoB,EAC1C,iBAAiB,EAAE,WAAW,EAC9B,yBAAyB,EAAE,gBAAgB,GAAG,IAAI,EAClD,eAAe,EAAE,CAAC,eAAe,EAAE,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,KAAK,OAAO,CAAC,GAAG,CAAC,EACxF,KAAK,EAAE,YAAY,iBAmBpB"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { isSkipSyncContract } from './skip_sync_contracts.js';
|
|
2
|
+
export async function syncScope(contractAddress, contractStore, contractClassService, anchorBlockHeader, functionToInvokeAfterSync, utilityExecutor, scope) {
|
|
3
|
+
// Some canonical contracts hold no private state, so there is nothing to sync (see `skipSyncContracts`).
|
|
4
|
+
if (isSkipSyncContract(contractAddress)) {
|
|
5
|
+
return;
|
|
6
|
+
}
|
|
7
|
+
const classId = await contractClassService.getCurrentClassId(contractAddress, anchorBlockHeader);
|
|
8
|
+
if (!classId) {
|
|
9
|
+
throw new Error(`Cannot sync contract ${contractAddress}: its instance is not registered nor published.`);
|
|
10
|
+
}
|
|
11
|
+
const syncStateFunctionCall = await contractStore.getFunctionCall('sync_state', [
|
|
12
|
+
scope
|
|
13
|
+
], contractAddress, classId);
|
|
14
|
+
if (functionToInvokeAfterSync && functionToInvokeAfterSync.equals(syncStateFunctionCall.selector)) {
|
|
15
|
+
throw new Error('Forbidden `sync_state` invocation. `sync_state` can only be invoked by PXE, manual execution can lead to inconsistencies.');
|
|
16
|
+
}
|
|
17
|
+
await utilityExecutor(syncStateFunctionCall, [
|
|
18
|
+
scope
|
|
19
|
+
]);
|
|
20
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { AztecAddress } from '@aztec-labs/stdlib/aztec-address';
|
|
2
|
+
/**
|
|
3
|
+
* Canonical contracts that hold no private state and are therefore never synced.
|
|
4
|
+
*
|
|
5
|
+
* The protocol contracts (registries, fee juice) plus the standard AuthRegistry, MultiCallEntrypoint and PublicChecks
|
|
6
|
+
* declare no notes and no events, so their macro-generated `sync_state` has nothing to discover.
|
|
7
|
+
*/
|
|
8
|
+
export declare const skipSyncContracts: AztecAddress[];
|
|
9
|
+
/** Returns whether the given contract should be skipped during private state synchronization. */
|
|
10
|
+
export declare function isSkipSyncContract(address: AztecAddress): boolean;
|
|
11
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2tpcF9zeW5jX2NvbnRyYWN0cy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2NvbnRyYWN0L3NraXBfc3luY19jb250cmFjdHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBSUEsT0FBTyxLQUFLLEVBQUUsWUFBWSxFQUFFLE1BQU0sa0NBQWtDLENBQUM7QUFFckU7Ozs7O0dBS0c7QUFDSCxlQUFPLE1BQU0saUJBQWlCLEVBQUUsWUFBWSxFQUszQyxDQUFDO0FBRUYsaUdBQWlHO0FBQ2pHLHdCQUFnQixrQkFBa0IsQ0FBQyxPQUFPLEVBQUUsWUFBWSxHQUFHLE9BQU8sQ0FFakUifQ==
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skip_sync_contracts.d.ts","sourceRoot":"","sources":["../../src/contract/skip_sync_contracts.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAErE;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,EAAE,YAAY,EAK3C,CAAC;AAEF,iGAAiG;AACjG,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAEjE"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ProtocolContractAddress } from '@aztec-labs/protocol-contracts';
|
|
2
|
+
import { STANDARD_AUTH_REGISTRY_ADDRESS } from '@aztec-labs/standard-contracts/auth-registry/constants';
|
|
3
|
+
import { STANDARD_MULTI_CALL_ENTRYPOINT_ADDRESS } from '@aztec-labs/standard-contracts/multi-call-entrypoint/constants';
|
|
4
|
+
import { STANDARD_PUBLIC_CHECKS_ADDRESS } from '@aztec-labs/standard-contracts/public-checks/constants';
|
|
5
|
+
/**
|
|
6
|
+
* Canonical contracts that hold no private state and are therefore never synced.
|
|
7
|
+
*
|
|
8
|
+
* The protocol contracts (registries, fee juice) plus the standard AuthRegistry, MultiCallEntrypoint and PublicChecks
|
|
9
|
+
* declare no notes and no events, so their macro-generated `sync_state` has nothing to discover.
|
|
10
|
+
*/ export const skipSyncContracts = [
|
|
11
|
+
...Object.values(ProtocolContractAddress),
|
|
12
|
+
STANDARD_AUTH_REGISTRY_ADDRESS,
|
|
13
|
+
STANDARD_MULTI_CALL_ENTRYPOINT_ADDRESS,
|
|
14
|
+
STANDARD_PUBLIC_CHECKS_ADDRESS
|
|
15
|
+
];
|
|
16
|
+
/** Returns whether the given contract should be skipped during private state synchronization. */ export function isSkipSyncContract(address) {
|
|
17
|
+
return skipSyncContracts.some((a)=>a.equals(address));
|
|
18
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { Fr } from '@aztec-labs/foundation/curves/bn254';
|
|
2
|
+
import type { FunctionArtifactWithContractName, FunctionSelector } from '@aztec-labs/stdlib/abi';
|
|
3
|
+
import type { AztecAddress } from '@aztec-labs/stdlib/aztec-address';
|
|
4
|
+
import type { ContractInstancePreimageWithAddress } from '@aztec-labs/stdlib/contract';
|
|
5
|
+
import type { BlockHeader, ContractOverrides } from '@aztec-labs/stdlib/tx';
|
|
6
|
+
import type { ContractClassService } from '../contract/contract_class_service.js';
|
|
7
|
+
import type { ContractStore } from '../storage/contract_store/contract_store.js';
|
|
8
|
+
/**
|
|
9
|
+
* Per-run view of contract data for a single simulation, bound to its anchor block.
|
|
10
|
+
*
|
|
11
|
+
* The {@link ContractStore} is pure class-id-keyed storage and has no notion of which class an address runs. This
|
|
12
|
+
* class bridges that gap: it resolves an address to its current class id (via the {@link ContractClassService}
|
|
13
|
+
* at the run's anchor block) and then serves artifacts from the store. It is also the single place contract
|
|
14
|
+
* overrides are applied — when an address is overridden, both its instance and its class id come from the override
|
|
15
|
+
* rather than the chain, so a simulation can execute different bytecode at that address. Overrides are only set for
|
|
16
|
+
* `simulateTx` (which skips the kernels), so the override path never reaches proving.
|
|
17
|
+
*/
|
|
18
|
+
export declare class AnchoredContractData {
|
|
19
|
+
private readonly store;
|
|
20
|
+
private readonly contractClassService;
|
|
21
|
+
private readonly anchorBlockHeader;
|
|
22
|
+
private readonly overrides?;
|
|
23
|
+
constructor(store: ContractStore, contractClassService: ContractClassService, anchorBlockHeader: BlockHeader, overrides?: ContractOverrides | undefined);
|
|
24
|
+
/** Returns the address preimage of the instance at `address`, from the override if any, else from storage. */
|
|
25
|
+
getContractInstance(address: AztecAddress): Promise<ContractInstancePreimageWithAddress | undefined>;
|
|
26
|
+
/**
|
|
27
|
+
* Resolves the class id `address` runs in this simulation: the override's class if overridden, else resolved against
|
|
28
|
+
* the chain at the anchor block.
|
|
29
|
+
*/
|
|
30
|
+
getCurrentClassId(address: AztecAddress): Promise<Fr | undefined>;
|
|
31
|
+
getFunctionArtifact(address: AztecAddress, selector: FunctionSelector): Promise<FunctionArtifactWithContractName | undefined>;
|
|
32
|
+
getFunctionArtifactWithDebugMetadata(address: AztecAddress, selector: FunctionSelector): Promise<FunctionArtifactWithContractName | undefined>;
|
|
33
|
+
getDebugContractName(address: AztecAddress): Promise<string | undefined>;
|
|
34
|
+
getDebugFunctionName(address: AztecAddress, selector: FunctionSelector): Promise<string>;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYW5jaG9yZWRfY29udHJhY3RfZGF0YS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2NvbnRyYWN0X2Z1bmN0aW9uX3NpbXVsYXRvci9hbmNob3JlZF9jb250cmFjdF9kYXRhLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLEVBQUUsRUFBRSxNQUFNLHFDQUFxQyxDQUFDO0FBQzlELE9BQU8sS0FBSyxFQUFFLGdDQUFnQyxFQUFFLGdCQUFnQixFQUFFLE1BQU0sd0JBQXdCLENBQUM7QUFDakcsT0FBTyxLQUFLLEVBQUUsWUFBWSxFQUFFLE1BQU0sa0NBQWtDLENBQUM7QUFDckUsT0FBTyxLQUFLLEVBQUUsbUNBQW1DLEVBQUUsTUFBTSw2QkFBNkIsQ0FBQztBQUN2RixPQUFPLEtBQUssRUFBRSxXQUFXLEVBQUUsaUJBQWlCLEVBQUUsTUFBTSx1QkFBdUIsQ0FBQztBQUU1RSxPQUFPLEtBQUssRUFBRSxvQkFBb0IsRUFBRSxNQUFNLHVDQUF1QyxDQUFDO0FBQ2xGLE9BQU8sS0FBSyxFQUFFLGFBQWEsRUFBRSxNQUFNLDZDQUE2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