@aztec/pxe 0.0.1-commit.343b43af6 → 0.0.1-commit.350e0a4d
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 +45 -111
- 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 +51 -0
- package/dest/bin/oracle_version_helpers.d.ts.map +1 -0
- package/dest/bin/oracle_version_helpers.js +254 -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 +23 -15
- package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -1
- package/dest/block_synchronizer/block_synchronizer.js +84 -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 +31 -0
- package/dest/contract/contract_class_service.d.ts.map +1 -0
- package/dest/contract/contract_class_service.js +68 -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_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 +30 -18
- package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.js +106 -40
- 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 +7 -11
- package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts.map +1 -1
- package/dest/contract_function_simulator/execution_tagging_index_cache.js +19 -15
- package/dest/contract_function_simulator/index.d.ts +26 -5
- package/dest/contract_function_simulator/index.d.ts.map +1 -1
- package/dest/contract_function_simulator/index.js +12 -3
- 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 +43 -0
- package/dest/contract_function_simulator/noir-structs/resolved_tx.d.ts +21 -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 +50 -0
- package/dest/contract_function_simulator/noir-structs/tx_effect_data.d.ts +14 -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 -101
- 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 +74 -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 +136 -0
- package/dest/contract_function_simulator/oracle/oracle_registry.d.ts.map +1 -0
- package/dest/contract_function_simulator/oracle/oracle_registry.js +989 -0
- package/dest/contract_function_simulator/oracle/oracle_type_mappings.d.ts +222 -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 +1243 -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 +7 -6
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +54 -55
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.js +195 -77
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +162 -73
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +523 -149
- 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 +1 -2
- package/dest/entrypoints/client/bundle/index.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/index.js +0 -1
- package/dest/entrypoints/client/bundle/utils.d.ts +2 -2
- package/dest/entrypoints/client/bundle/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/utils.js +20 -7
- package/dest/entrypoints/client/lazy/index.d.ts +1 -2
- package/dest/entrypoints/client/lazy/index.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/index.js +0 -1
- package/dest/entrypoints/client/lazy/utils.d.ts +2 -2
- package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/utils.js +20 -7
- 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 +6 -4
- package/dest/entrypoints/server/index.d.ts.map +1 -1
- package/dest/entrypoints/server/index.js +4 -3
- 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 +20 -6
- 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 +15 -6
- package/dest/events/event_service.d.ts.map +1 -1
- package/dest/events/event_service.js +44 -11
- 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 +1 -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 +48 -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 +13 -12
- package/dest/logs/log_service.d.ts.map +1 -1
- package/dest/logs/log_service.js +186 -81
- package/dest/messages/tx_resolver_service.d.ts +17 -0
- package/dest/messages/tx_resolver_service.d.ts.map +1 -0
- package/dest/messages/tx_resolver_service.js +55 -0
- package/dest/notes/note_service.d.ts +27 -6
- package/dest/notes/note_service.d.ts.map +1 -1
- package/dest/notes/note_service.js +80 -56
- 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 +169 -54
- package/dest/pxe.d.ts.map +1 -1
- package/dest/pxe.js +348 -204
- 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 +647 -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 +70 -98
- 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 +57 -0
- package/dest/storage/fact_store/origin_state.d.ts.map +1 -0
- package/dest/storage/fact_store/origin_state.js +53 -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/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 +29 -28
- package/dest/storage/tagging_store/sender_tagging_store.d.ts.map +1 -1
- package/dest/storage/tagging_store/sender_tagging_store.js +141 -115
- 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 +2 -2
- package/dest/tagging/constants.d.ts.map +1 -1
- package/dest/tagging/constants.js +5 -8
- package/dest/tagging/get_all_logs_by_tags.d.ts +34 -10
- package/dest/tagging/get_all_logs_by_tags.d.ts.map +1 -1
- package/dest/tagging/get_all_logs_by_tags.js +36 -37
- package/dest/tagging/index.d.ts +6 -5
- package/dest/tagging/index.d.ts.map +1 -1
- package/dest/tagging/index.js +4 -3
- 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 +69 -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 +203 -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 +4 -5
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts.map +1 -1
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.js +31 -10
- package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts +13 -7
- package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts.map +1 -1
- package/dest/tagging/sender_sync/utils/get_status_change_of_pending.js +41 -10
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts +5 -4
- 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 +26 -13
- package/package.json +20 -17
- package/src/bin/check_oracle_version.ts +51 -133
- package/src/bin/index.ts +5 -0
- package/src/bin/oracle_version_helpers.ts +311 -0
- package/src/block_synchronizer/block_stream_source.ts +42 -0
- package/src/block_synchronizer/block_synchronizer.ts +102 -39
- package/src/config/index.ts +15 -8
- package/src/config/package_info.ts +1 -1
- package/src/contract/contract_class_service.ts +83 -0
- package/src/contract/contract_sync_service.ts +176 -0
- package/src/contract/helpers.ts +35 -0
- package/src/contract_function_simulator/anchored_contract_data.ts +74 -0
- package/src/contract_function_simulator/contract_function_simulator.ts +170 -56
- 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 +19 -18
- package/src/contract_function_simulator/index.ts +69 -4
- 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 +58 -0
- package/src/contract_function_simulator/noir-structs/resolved_tx.ts +53 -0
- package/src/contract_function_simulator/noir-structs/tx_effect_data.ts +15 -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 -170
- package/src/contract_function_simulator/oracle/legacy_oracle_registry.ts +120 -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 +689 -0
- package/src/contract_function_simulator/oracle/oracle_type_mappings.ts +964 -0
- package/src/contract_function_simulator/oracle/private_execution.ts +6 -7
- package/src/contract_function_simulator/oracle/private_execution_oracle.ts +241 -103
- package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +804 -238
- 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 +0 -1
- package/src/entrypoints/client/bundle/utils.ts +19 -7
- package/src/entrypoints/client/lazy/index.ts +0 -1
- package/src/entrypoints/client/lazy/utils.ts +19 -7
- package/src/entrypoints/pxe_creation_options.ts +21 -1
- package/src/entrypoints/server/index.ts +6 -3
- package/src/entrypoints/server/utils.ts +24 -7
- package/src/error_enriching.ts +27 -11
- package/src/events/event_service.ts +69 -21
- 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 +12 -0
- package/src/hooks/resolve_custom_request.ts +24 -0
- package/src/hooks/resolve_tagging_secret_strategy.ts +57 -0
- package/src/logs/log_service.ts +224 -146
- package/src/messages/tx_resolver_service.ts +69 -0
- package/src/notes/note_service.ts +119 -85
- 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 +563 -233
- 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 +18 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/SenderTaggingStore.json +22 -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 +774 -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 +96 -124
- 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 +14 -0
- package/src/storage/fact_store/origin_state.ts +75 -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/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 +185 -138
- package/src/storage/tagging_store/tagging_secret_sources_store.ts +138 -0
- package/src/tagging/constants.ts +6 -8
- package/src/tagging/get_all_logs_by_tags.ts +78 -50
- package/src/tagging/index.ts +5 -4
- package/src/tagging/persist_sender_tagging_index_ranges.ts +57 -0
- package/src/tagging/recipient_sync/sync_tagged_private_logs.ts +301 -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 +52 -12
- package/src/tagging/sender_sync/utils/get_status_change_of_pending.ts +44 -14
- package/src/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.ts +23 -14
- 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/oracle/oracle.d.ts +0 -59
- package/dest/contract_function_simulator/oracle/oracle.d.ts.map +0 -1
- package/dest/contract_function_simulator/oracle/oracle.js +0 -406
- 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 -43
- package/dest/contract_sync/contract_sync_service.d.ts.map +0 -1
- package/dest/contract_sync/contract_sync_service.js +0 -97
- 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/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/src/access_scopes.ts +0 -9
- package/src/contract_function_simulator/oracle/oracle.ts +0 -637
- package/src/contract_function_simulator/proxied_contract_data_source.ts +0 -83
- package/src/contract_sync/contract_sync_service.ts +0 -152
- package/src/contract_sync/helpers.ts +0 -98
- 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
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
|
+
import type { FunctionArtifactWithContractName, FunctionSelector } from '@aztec/stdlib/abi';
|
|
3
|
+
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
|
+
import type { ContractInstancePreimageWithAddress } from '@aztec/stdlib/contract';
|
|
5
|
+
import type { BlockHeader, ContractOverrides } from '@aztec/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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYW5jaG9yZWRfY29udHJhY3RfZGF0YS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2NvbnRyYWN0X2Z1bmN0aW9uX3NpbXVsYXRvci9hbmNob3JlZF9jb250cmFjdF9kYXRhLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLEVBQUUsRUFBRSxNQUFNLGdDQUFnQyxDQUFDO0FBQ3pELE9BQU8sS0FBSyxFQUFFLGdDQUFnQyxFQUFFLGdCQUFnQixFQUFFLE1BQU0sbUJBQW1CLENBQUM7QUFDNUYsT0FBTyxLQUFLLEVBQUUsWUFBWSxFQUFFLE1BQU0sNkJBQTZCLENBQUM7QUFDaEUsT0FBTyxLQUFLLEVBQUUsbUNBQW1DLEVBQUUsTUFBTSx3QkFBd0IsQ0FBQztBQUNsRixPQUFPLEtBQUssRUFBRSxXQUFXLEVBQUUsaUJBQWlCLEVBQUUsTUFBTSxrQkFBa0IsQ0FBQztBQUV2RSxPQUFPLEtBQUssRUFBRSxvQkFBb0IsRUFBRSxNQUFNLHVDQUF1QyxDQUFDO0FBQ2xGLE9BQU8sS0FBSyxFQUFFLGFBQWEsRUFBRSxNQUFNLDZDQUE2QyxDQUFDO0FBRWpGOzs7Ozs7Ozs7R0FTRztBQUNILHFCQUFhLG9CQUFvQjtJQUU3QixPQUFPLENBQUMsUUFBUSxDQUFDLEtBQUs7SUFDdEIsT0FBTyxDQUFDLFFBQVEsQ0FBQyxvQkFBb0I7SUFDckMs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AGvD;IAEK,oBAAoB,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAG7E;IAEK,oBAAoB,CAAC,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,gBAAgB,GAAG,OAAO,CAAC,MAAM,CAAC,CAG7F;CACF"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-run view of contract data for a single simulation, bound to its anchor block.
|
|
3
|
+
*
|
|
4
|
+
* The {@link ContractStore} is pure class-id-keyed storage and has no notion of which class an address runs. This
|
|
5
|
+
* class bridges that gap: it resolves an address to its current class id (via the {@link ContractClassService}
|
|
6
|
+
* at the run's anchor block) and then serves artifacts from the store. It is also the single place contract
|
|
7
|
+
* overrides are applied — when an address is overridden, both its instance and its class id come from the override
|
|
8
|
+
* rather than the chain, so a simulation can execute different bytecode at that address. Overrides are only set for
|
|
9
|
+
* `simulateTx` (which skips the kernels), so the override path never reaches proving.
|
|
10
|
+
*/ export class AnchoredContractData {
|
|
11
|
+
store;
|
|
12
|
+
contractClassService;
|
|
13
|
+
anchorBlockHeader;
|
|
14
|
+
overrides;
|
|
15
|
+
constructor(store, contractClassService, anchorBlockHeader, overrides){
|
|
16
|
+
this.store = store;
|
|
17
|
+
this.contractClassService = contractClassService;
|
|
18
|
+
this.anchorBlockHeader = anchorBlockHeader;
|
|
19
|
+
this.overrides = overrides;
|
|
20
|
+
}
|
|
21
|
+
/** Returns the address preimage of the instance at `address`, from the override if any, else from storage. */ getContractInstance(address) {
|
|
22
|
+
const override = this.overrides?.[address.toString()];
|
|
23
|
+
if (override) {
|
|
24
|
+
return Promise.resolve(override.instance);
|
|
25
|
+
}
|
|
26
|
+
return this.store.getContractInstance(address);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Resolves the class id `address` runs in this simulation: the override's class if overridden, else resolved against
|
|
30
|
+
* the chain at the anchor block.
|
|
31
|
+
*/ getCurrentClassId(address) {
|
|
32
|
+
const override = this.overrides?.[address.toString()];
|
|
33
|
+
if (override) {
|
|
34
|
+
return Promise.resolve(override.instance.currentContractClassId);
|
|
35
|
+
}
|
|
36
|
+
return this.contractClassService.getCurrentClassId(address, this.anchorBlockHeader);
|
|
37
|
+
}
|
|
38
|
+
async getFunctionArtifact(address, selector) {
|
|
39
|
+
const classId = await this.getCurrentClassId(address);
|
|
40
|
+
return classId ? this.store.getFunctionArtifact(classId, selector) : undefined;
|
|
41
|
+
}
|
|
42
|
+
async getFunctionArtifactWithDebugMetadata(address, selector) {
|
|
43
|
+
const classId = await this.getCurrentClassId(address);
|
|
44
|
+
return classId ? this.store.getFunctionArtifactWithDebugMetadata(classId, selector) : undefined;
|
|
45
|
+
}
|
|
46
|
+
async getDebugContractName(address) {
|
|
47
|
+
const classId = await this.getCurrentClassId(address);
|
|
48
|
+
return classId ? this.store.getDebugContractName(classId) : undefined;
|
|
49
|
+
}
|
|
50
|
+
async getDebugFunctionName(address, selector) {
|
|
51
|
+
const classId = await this.getCurrentClassId(address);
|
|
52
|
+
return classId ? this.store.getDebugFunctionName(classId, selector) : `${address}:${selector}`;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -5,25 +5,25 @@ import type { FunctionCall } from '@aztec/stdlib/abi';
|
|
|
5
5
|
import { FunctionSelector } from '@aztec/stdlib/abi';
|
|
6
6
|
import type { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
7
7
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
8
|
+
import type { L2TipsProvider } from '@aztec/stdlib/block';
|
|
8
9
|
import type { AztecNode } from '@aztec/stdlib/interfaces/server';
|
|
9
10
|
import { type PrivateKernelExecutionProofOutput, PrivateKernelTailCircuitPublicInputs } from '@aztec/stdlib/kernel';
|
|
10
|
-
import { BlockHeader, PrivateExecutionResult, TxExecutionRequest } from '@aztec/stdlib/tx';
|
|
11
|
-
import type {
|
|
12
|
-
import type { ContractSyncService } from '../
|
|
11
|
+
import { BlockHeader, type ContractOverrides, type OffchainEffect, PrivateExecutionResult, TxExecutionRequest } from '@aztec/stdlib/tx';
|
|
12
|
+
import type { ContractClassService } from '../contract/contract_class_service.js';
|
|
13
|
+
import type { ContractSyncService } from '../contract/contract_sync_service.js';
|
|
14
|
+
import type { ExecutionHooks } from '../hooks/index.js';
|
|
15
|
+
import type { TxResolverService } from '../messages/tx_resolver_service.js';
|
|
13
16
|
import type { AddressStore } from '../storage/address_store/address_store.js';
|
|
14
17
|
import type { CapsuleStore } from '../storage/capsule_store/capsule_store.js';
|
|
15
18
|
import type { ContractStore } from '../storage/contract_store/contract_store.js';
|
|
19
|
+
import type { FactStore } from '../storage/fact_store/index.js';
|
|
16
20
|
import type { NoteStore } from '../storage/note_store/note_store.js';
|
|
17
21
|
import type { PrivateEventStore } from '../storage/private_event_store/private_event_store.js';
|
|
18
22
|
import type { RecipientTaggingStore } from '../storage/tagging_store/recipient_tagging_store.js';
|
|
19
|
-
import type { SenderAddressBookStore } from '../storage/tagging_store/sender_address_book_store.js';
|
|
20
23
|
import type { SenderTaggingStore } from '../storage/tagging_store/sender_tagging_store.js';
|
|
24
|
+
import type { TaggingSecretSourcesStore } from '../storage/tagging_store/tagging_secret_sources_store.js';
|
|
21
25
|
/** Options for ContractFunctionSimulator.run. */
|
|
22
26
|
export type ContractSimulatorRunOpts = {
|
|
23
|
-
/** The address of the contract (should match request.origin). */
|
|
24
|
-
contractAddress: AztecAddress;
|
|
25
|
-
/** The function selector of the entry point. */
|
|
26
|
-
selector: FunctionSelector;
|
|
27
27
|
/** The address calling the function. Can be replaced to simulate a call from another contract or account. */
|
|
28
28
|
msgSender?: AztecAddress;
|
|
29
29
|
/** The block header to use as base state for this run. */
|
|
@@ -31,24 +31,31 @@ export type ContractSimulatorRunOpts = {
|
|
|
31
31
|
/** The address used as a tagging sender when emitting private logs. */
|
|
32
32
|
senderForTags?: AztecAddress;
|
|
33
33
|
/** The accounts whose notes we can access in this call. */
|
|
34
|
-
scopes:
|
|
34
|
+
scopes: AztecAddress[];
|
|
35
35
|
/** The job ID for staged writes. */
|
|
36
36
|
jobId: string;
|
|
37
37
|
};
|
|
38
38
|
/** Args for ContractFunctionSimulator constructor. */
|
|
39
39
|
export type ContractFunctionSimulatorArgs = {
|
|
40
40
|
contractStore: ContractStore;
|
|
41
|
+
contractClassService: ContractClassService;
|
|
42
|
+
/** Per-simulation contract overrides. */
|
|
43
|
+
overrides?: ContractOverrides;
|
|
41
44
|
noteStore: NoteStore;
|
|
42
45
|
keyStore: KeyStore;
|
|
43
46
|
addressStore: AddressStore;
|
|
44
47
|
aztecNode: AztecNode;
|
|
48
|
+
l2TipsStore: L2TipsProvider;
|
|
45
49
|
senderTaggingStore: SenderTaggingStore;
|
|
46
50
|
recipientTaggingStore: RecipientTaggingStore;
|
|
47
|
-
|
|
51
|
+
taggingSecretSourcesStore: TaggingSecretSourcesStore;
|
|
48
52
|
capsuleStore: CapsuleStore;
|
|
53
|
+
factStore: FactStore;
|
|
49
54
|
privateEventStore: PrivateEventStore;
|
|
50
55
|
simulator: CircuitSimulator;
|
|
51
56
|
contractSyncService: ContractSyncService;
|
|
57
|
+
txResolver: TxResolverService;
|
|
58
|
+
hooks?: ExecutionHooks;
|
|
52
59
|
};
|
|
53
60
|
/**
|
|
54
61
|
* The contract function simulator.
|
|
@@ -56,33 +63,38 @@ export type ContractFunctionSimulatorArgs = {
|
|
|
56
63
|
export declare class ContractFunctionSimulator {
|
|
57
64
|
private readonly log;
|
|
58
65
|
private readonly contractStore;
|
|
66
|
+
private readonly contractClassService;
|
|
67
|
+
private readonly overrides;
|
|
59
68
|
private readonly noteStore;
|
|
60
69
|
private readonly keyStore;
|
|
61
70
|
private readonly addressStore;
|
|
62
71
|
private readonly aztecNode;
|
|
72
|
+
private readonly l2TipsStore;
|
|
63
73
|
private readonly senderTaggingStore;
|
|
64
74
|
private readonly recipientTaggingStore;
|
|
65
|
-
private readonly
|
|
75
|
+
private readonly taggingSecretSourcesStore;
|
|
66
76
|
private readonly capsuleStore;
|
|
77
|
+
private readonly factStore;
|
|
67
78
|
private readonly privateEventStore;
|
|
68
79
|
private readonly simulator;
|
|
69
80
|
private readonly contractSyncService;
|
|
81
|
+
private readonly txResolver;
|
|
82
|
+
private readonly hooks;
|
|
70
83
|
constructor(args: ContractFunctionSimulatorArgs);
|
|
71
84
|
/**
|
|
72
85
|
* Runs a private function.
|
|
73
86
|
* @param request - The transaction request.
|
|
74
87
|
*/
|
|
75
|
-
run(request: TxExecutionRequest, {
|
|
88
|
+
run(request: TxExecutionRequest, { msgSender, anchorBlockHeader, senderForTags, scopes, jobId }: ContractSimulatorRunOpts): Promise<PrivateExecutionResult>;
|
|
76
89
|
/**
|
|
77
90
|
* Runs a utility function.
|
|
78
91
|
* @param call - The function call to execute.
|
|
79
|
-
* @param authwits - Authentication witnesses required for the function call.
|
|
80
|
-
* @param anchorBlockHeader - The block header to use as base state for this run.
|
|
81
|
-
* @param scopes - Optional array of account addresses whose notes can be accessed in this call. Defaults to all
|
|
82
|
-
* accounts if not specified.
|
|
83
92
|
* @returns A return value of the utility function in a form as returned by the simulator (Noir fields)
|
|
84
93
|
*/
|
|
85
|
-
runUtility(call: FunctionCall, authwits: AuthWitness[], anchorBlockHeader: BlockHeader, scopes:
|
|
94
|
+
runUtility(call: FunctionCall, authwits: AuthWitness[], anchorBlockHeader: BlockHeader, scopes: AztecAddress[], jobId: string): Promise<{
|
|
95
|
+
result: Fr[];
|
|
96
|
+
offchainEffects: OffchainEffect[];
|
|
97
|
+
}>;
|
|
86
98
|
/**
|
|
87
99
|
* Returns the execution statistics collected during the simulator run.
|
|
88
100
|
* @returns The execution statistics.
|
|
@@ -105,4 +117,4 @@ export declare class ContractFunctionSimulator {
|
|
|
105
117
|
* @returns The simulated proving result.
|
|
106
118
|
*/
|
|
107
119
|
export declare function generateSimulatedProvingResult(privateExecutionResult: PrivateExecutionResult, debugFunctionNameGetter: (contractAddress: AztecAddress, functionSelector: FunctionSelector) => Promise<string>, node: AztecNode, minRevertibleSideEffectCounterOverride?: number): Promise<PrivateKernelExecutionProofOutput<PrivateKernelTailCircuitPublicInputs>>;
|
|
108
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
120
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29udHJhY3RfZnVuY3Rpb25fc2ltdWxhdG9yLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvY29udHJhY3RfZnVuY3Rpb25fc2ltdWxhdG9yL2NvbnRyYWN0X2Z1bmN0aW9uX3NpbXVsYXRvci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUEyQkEsT0FBTyxFQUFFLEVBQUUsRUFBRSxNQUFNLGdDQUFnQyxDQUFDO0FBR3BELE9BQU8sS0FBSyxFQUFFLFFBQVEsRUFBRSxNQUFNLGtCQUFrQixDQUFDO0FBR2pELE9BQU8sRUFDTCxLQUFLLGdCQUFnQixFQU90QixNQUFNLHlCQUF5QixDQUFDO0FBQ2pDLE9BQU8sS0FBSyxFQUFFLFlBQVksRUFBRSxNQUFNLG1CQUFtQixDQUFDO0FBQ3RELE9BQU8sRUFBRSxnQkFBZ0IsRUFBZ0IsTUFBTSxtQkFBbUIsQ0FBQztBQUNuRSxPQUFPLEtBQUssRUFBRSxXQUFXLEVBQUUsTUFBTSw0QkFBNEIsQ0FBQztBQUM5RCxPQUFPLEVBQUUsWUFBWSxFQUFFLE1BQU0sNkJBQTZCLENBQUM7QUFDM0QsT0FBTyxLQUFLLEVBQWtCLGNBQWMsRUFBRSxNQUFNLHFCQUFxQixDQUFDO0FBVTFFLE9BQU8sS0FBSyxFQUFFLFNBQVMsRUFBRSxNQUFNLGlDQUFpQyxDQUFDO0FBQ2pFLE9BQU8sRUFLTCxLQUFLLGlDQUFpQyxFQUN0QyxvQ0FBb0MsRUFhckMsTUFBTSxzQkFBc0IsQ0FBQztBQUs5QixPQUFPLEVBQ0wsV0FBVyxF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xDQUNkLE9BQU8sRUFBRSxrQkFBa0IsRUFDM0IsRUFDRSxTQUF3QyxFQUN4QyxpQkFBaUIsRUFDakIsYUFBYSxFQUNiLE1BQU0sRUFDTixLQUFLLEVBQ04sRUFBRSx3QkFBd0IsR0FDMUIsT0FBTyxDQUFDLHNCQUFzQixDQUFDLENBaUlqQztJQUVEOzs7O09BSUc7SUFDVSxVQUFVLENBQ3JCLElBQUksRUFBRSxZQUFZLEVBQ2xCLFFBQVEsRUFBRSxXQUFXLEVBQUUsRUFDdkIsaUJBQWlCLEVBQUUsV0FBVyxFQUM5QixNQUFNLEVBQUUsWUFBWSxFQUFFLEVBQ3RCLEtBQUssRUFBRSxNQUFNLEdBQ1osT0FBTyxDQUFDO1FBQUUsTUFBTSxFQUFFLEVBQUUsRUFBRSxDQUFDO1FBQUMsZUFBZSxFQUFFLGNBQWMsRUFBRSxDQUFBO0tBQUUsQ0FBQyxDQXNGOUQ7SUFFRDs7O09BR0c7SUFDSCxRQUFROztNQVVQO0NBQ0Y7QUFZRDs7Ozs7Ozs7Ozs7O0dBWUc7QUFDSCx3QkFBc0IsOEJBQThCLENBQ2xELHNCQUFzQixFQUFFLHNCQUFzQixFQUM5Qyx1QkFBdUIsRUFBRSxDQUFDLGVBQWUsRUFBRSxZQUFZLEVBQUUsZ0JBQWdCLEVBQUUsZ0JBQWdCLEtBQUssT0FBTyxDQUFDLE1BQU0sQ0FBQyxFQUMvRyxJQUFJLEVBQUUsU0FBUyxFQUNmLHNDQUFzQyxDQUFDLEVBQUUsTUFBTSxHQUM5QyxPQUFPLENBQUMsaUNBQWlDLENBQUMsb0NBQW9DLENBQUMsQ0FBQyxDQXNSbEYifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract_function_simulator.d.ts","sourceRoot":"","sources":["../../src/contract_function_simulator/contract_function_simulator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"contract_function_simulator.d.ts","sourceRoot":"","sources":["../../src/contract_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,EAAE,WAAW,EAC9B,MAAM,EAAE,YAAY,EAAE,EACtB,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC;QAAE,MAAM,EAAE,EAAE,EAAE,CAAC;QAAC,eAAe,EAAE,cAAc,EAAE,CAAA;KAAE,CAAC,CAsF9D;IAED;;;OAGG;IACH,QAAQ;;MAUP;CACF;AAYD;;;;;;;;;;;;GAYG;AACH,wBAAsB,8BAA8B,CAClD,sBAAsB,EAAE,sBAAsB,EAC9C,uBAAuB,EAAE,CAAC,eAAe,EAAE,YAAY,EAAE,gBAAgB,EAAE,gBAAgB,KAAK,OAAO,CAAC,MAAM,CAAC,EAC/G,IAAI,EAAE,SAAS,EACf,sCAAsC,CAAC,EAAE,MAAM,GAC9C,OAAO,CAAC,iCAAiC,CAAC,oCAAoC,CAAC,CAAC,CAsRlF"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CircuitKind } from '@aztec/bb.js';
|
|
2
|
+
import { AVM_EMITNOTEHASH_BASE_L2_GAS, AVM_EMITNULLIFIER_BASE_L2_GAS, AVM_SENDL2TOL1MSG_BASE_L2_GAS, DA_GAS_PER_FIELD, FIXED_AVM_STARTUP_L2_GAS, L2_GAS_PER_CONTRACT_CLASS_LOG, L2_GAS_PER_L2_TO_L1_MSG, L2_GAS_PER_NOTE_HASH, L2_GAS_PER_NULLIFIER, L2_GAS_PER_PRIVATE_LOG, MAX_CONTRACT_CLASS_LOGS_PER_TX, MAX_ENQUEUED_CALLS_PER_TX, MAX_L2_TO_L1_MSGS_PER_TX, MAX_NOTE_HASHES_PER_TX, MAX_NOTE_HASH_READ_REQUESTS_PER_TX, MAX_NULLIFIERS_PER_TX, MAX_NULLIFIER_READ_REQUESTS_PER_TX, MAX_PRIVATE_LOGS_PER_TX, MAX_TX_LIFETIME, PRIVATE_TX_L2_GAS_OVERHEAD, PUBLIC_DATA_WRITE_LENGTH, PUBLIC_TX_L2_GAS_OVERHEAD, TX_DA_GAS_OVERHEAD } from '@aztec/constants';
|
|
2
3
|
import { arrayNonEmptyLength, padArrayEnd } from '@aztec/foundation/collection';
|
|
3
4
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
4
5
|
import { createLogger } from '@aztec/foundation/log';
|
|
@@ -14,66 +15,90 @@ import { ClaimedLengthArray, PartialPrivateTailPublicInputsForPublic, PartialPri
|
|
|
14
15
|
import { PrivateLog } from '@aztec/stdlib/logs';
|
|
15
16
|
import { ScopedL2ToL1Message } from '@aztec/stdlib/messaging';
|
|
16
17
|
import { ChonkProof } from '@aztec/stdlib/proofs';
|
|
18
|
+
import { MerkleTreeId } from '@aztec/stdlib/trees';
|
|
17
19
|
import { CallContext, HashedValues, PrivateExecutionResult, TxConstantData, collectNested, collectNoteHashNullifierCounterMap, getFinalMinRevertibleSideEffectCounter } from '@aztec/stdlib/tx';
|
|
20
|
+
import { CapsuleService } from '../storage/capsule_store/capsule_service.js';
|
|
21
|
+
import { FactService } from '../storage/fact_store/index.js';
|
|
22
|
+
import { AnchoredContractData } from './anchored_contract_data.js';
|
|
18
23
|
import { ExecutionNoteCache } from './execution_note_cache.js';
|
|
19
24
|
import { ExecutionTaggingIndexCache } from './execution_tagging_index_cache.js';
|
|
20
25
|
import { HashedValuesCache } from './hashed_values_cache.js';
|
|
21
|
-
import {
|
|
26
|
+
import { buildACIRCallback } from './oracle/acir_callback.js';
|
|
22
27
|
import { executePrivateFunction } from './oracle/private_execution.js';
|
|
23
28
|
import { PrivateExecutionOracle } from './oracle/private_execution_oracle.js';
|
|
24
29
|
import { UtilityExecutionOracle } from './oracle/utility_execution_oracle.js';
|
|
30
|
+
import { TransientArrayService } from './transient_array_service.js';
|
|
25
31
|
/**
|
|
26
32
|
* The contract function simulator.
|
|
27
33
|
*/ export class ContractFunctionSimulator {
|
|
28
34
|
log;
|
|
29
35
|
contractStore;
|
|
36
|
+
contractClassService;
|
|
37
|
+
overrides;
|
|
30
38
|
noteStore;
|
|
31
39
|
keyStore;
|
|
32
40
|
addressStore;
|
|
33
41
|
aztecNode;
|
|
42
|
+
l2TipsStore;
|
|
34
43
|
senderTaggingStore;
|
|
35
44
|
recipientTaggingStore;
|
|
36
|
-
|
|
45
|
+
taggingSecretSourcesStore;
|
|
37
46
|
capsuleStore;
|
|
47
|
+
factStore;
|
|
38
48
|
privateEventStore;
|
|
39
49
|
simulator;
|
|
40
50
|
contractSyncService;
|
|
51
|
+
txResolver;
|
|
52
|
+
hooks;
|
|
41
53
|
constructor(args){
|
|
42
54
|
this.contractStore = args.contractStore;
|
|
55
|
+
this.contractClassService = args.contractClassService;
|
|
56
|
+
this.overrides = args.overrides;
|
|
43
57
|
this.noteStore = args.noteStore;
|
|
44
58
|
this.keyStore = args.keyStore;
|
|
45
59
|
this.addressStore = args.addressStore;
|
|
46
60
|
this.aztecNode = args.aztecNode;
|
|
61
|
+
this.l2TipsStore = args.l2TipsStore;
|
|
47
62
|
this.senderTaggingStore = args.senderTaggingStore;
|
|
48
63
|
this.recipientTaggingStore = args.recipientTaggingStore;
|
|
49
|
-
this.
|
|
64
|
+
this.taggingSecretSourcesStore = args.taggingSecretSourcesStore;
|
|
50
65
|
this.capsuleStore = args.capsuleStore;
|
|
66
|
+
this.factStore = args.factStore;
|
|
51
67
|
this.privateEventStore = args.privateEventStore;
|
|
52
68
|
this.simulator = args.simulator;
|
|
53
69
|
this.contractSyncService = args.contractSyncService;
|
|
70
|
+
this.txResolver = args.txResolver;
|
|
71
|
+
this.hooks = args.hooks;
|
|
54
72
|
this.log = createLogger('simulator');
|
|
55
73
|
}
|
|
56
74
|
/**
|
|
57
75
|
* Runs a private function.
|
|
58
76
|
* @param request - The transaction request.
|
|
59
|
-
*/ async run(request, {
|
|
77
|
+
*/ async run(request, { msgSender = AztecAddress.NULL_MSG_SENDER, anchorBlockHeader, senderForTags, scopes, jobId }) {
|
|
60
78
|
const simulatorSetupTimer = new Timer();
|
|
61
|
-
const
|
|
79
|
+
const contractAddress = request.origin;
|
|
80
|
+
const anchoredContractData = new AnchoredContractData(this.contractStore, this.contractClassService, anchorBlockHeader, this.overrides);
|
|
81
|
+
const entryPointArtifact = await anchoredContractData.getFunctionArtifactWithDebugMetadata(contractAddress, request.functionSelector);
|
|
82
|
+
if (!entryPointArtifact) {
|
|
83
|
+
throw new Error(`Cannot run function ${request.functionSelector} on ${contractAddress}: the contract is not registered. ` + `Register it via wallet.registerContract(...).`);
|
|
84
|
+
}
|
|
62
85
|
if (entryPointArtifact.functionType !== FunctionType.PRIVATE) {
|
|
63
86
|
throw new Error(`Cannot run ${entryPointArtifact.functionType} function as private`);
|
|
64
87
|
}
|
|
65
|
-
if (request.origin !== contractAddress) {
|
|
66
|
-
this.log.warn(`Request origin does not match contract address in simulation. Request origin: ${request.origin}, contract address: ${contractAddress}`);
|
|
67
|
-
}
|
|
68
88
|
// reserve the first side effect for the tx hash (inserted by the private kernel)
|
|
69
89
|
const startSideEffectCounter = 2;
|
|
70
90
|
const callContext = new CallContext(msgSender, contractAddress, await FunctionSelector.fromNameAndParameters(entryPointArtifact.name, entryPointArtifact.parameters), entryPointArtifact.isStatic);
|
|
71
91
|
const protocolNullifier = await computeProtocolNullifier(await request.toTxRequest().hash());
|
|
72
92
|
const noteCache = new ExecutionNoteCache(protocolNullifier);
|
|
73
93
|
const taggingIndexCache = new ExecutionTaggingIndexCache();
|
|
94
|
+
// One shared transient store for the whole execution tree rooted at this transaction. Threaded into every child
|
|
95
|
+
// private oracle and inherited by nested utility frames, so that frames of the same contract see each other's
|
|
96
|
+
// transient arrays, then discarded when run() returns.
|
|
97
|
+
const transientArrayService = new TransientArrayService();
|
|
74
98
|
const privateExecutionOracle = new PrivateExecutionOracle({
|
|
75
99
|
argsHash: request.firstCallArgsHash,
|
|
76
100
|
txContext: request.txContext,
|
|
101
|
+
txRequestSalt: request.salt,
|
|
77
102
|
callContext,
|
|
78
103
|
anchorBlockHeader,
|
|
79
104
|
utilityExecutor: async (call, execScopes)=>{
|
|
@@ -84,23 +109,28 @@ import { UtilityExecutionOracle } from './oracle/utility_execution_oracle.js';
|
|
|
84
109
|
executionCache: HashedValuesCache.create(request.argsOfCalls),
|
|
85
110
|
noteCache,
|
|
86
111
|
taggingIndexCache,
|
|
87
|
-
|
|
112
|
+
anchoredContractData,
|
|
88
113
|
noteStore: this.noteStore,
|
|
89
114
|
keyStore: this.keyStore,
|
|
90
115
|
addressStore: this.addressStore,
|
|
91
116
|
aztecNode: this.aztecNode,
|
|
92
117
|
senderTaggingStore: this.senderTaggingStore,
|
|
93
118
|
recipientTaggingStore: this.recipientTaggingStore,
|
|
94
|
-
|
|
95
|
-
|
|
119
|
+
taggingSecretSourcesStore: this.taggingSecretSourcesStore,
|
|
120
|
+
capsuleService: new CapsuleService(this.capsuleStore, scopes),
|
|
121
|
+
factService: new FactService(this.factStore, scopes),
|
|
96
122
|
privateEventStore: this.privateEventStore,
|
|
123
|
+
txResolver: this.txResolver,
|
|
97
124
|
contractSyncService: this.contractSyncService,
|
|
98
125
|
jobId,
|
|
99
126
|
totalPublicCalldataCount: 0,
|
|
100
127
|
sideEffectCounter: startSideEffectCounter,
|
|
101
128
|
scopes,
|
|
102
129
|
senderForTags,
|
|
103
|
-
simulator: this.simulator
|
|
130
|
+
simulator: this.simulator,
|
|
131
|
+
l2TipsStore: this.l2TipsStore,
|
|
132
|
+
hooks: this.hooks,
|
|
133
|
+
transientArrayService
|
|
104
134
|
});
|
|
105
135
|
const setupTime = simulatorSetupTimer.ms();
|
|
106
136
|
try {
|
|
@@ -110,7 +140,6 @@ import { UtilityExecutionOracle } from './oracle/utility_execution_oracle.js';
|
|
|
110
140
|
// within executionResult.nestedExecutionResults).
|
|
111
141
|
const executionResult = await executePrivateFunction(this.simulator, privateExecutionOracle, entryPointArtifact, contractAddress, request.functionSelector);
|
|
112
142
|
const simulatorTeardownTimer = new Timer();
|
|
113
|
-
noteCache.finish();
|
|
114
143
|
const firstNullifierHint = noteCache.getNonceGenerator();
|
|
115
144
|
const publicCallRequests = collectNested([
|
|
116
145
|
executionResult
|
|
@@ -118,7 +147,7 @@ import { UtilityExecutionOracle } from './oracle/utility_execution_oracle.js';
|
|
|
118
147
|
r.publicInputs.publicTeardownCallRequest
|
|
119
148
|
]));
|
|
120
149
|
const publicFunctionsCalldata = await Promise.all(publicCallRequests.map(async (r)=>{
|
|
121
|
-
const calldata = await privateExecutionOracle.
|
|
150
|
+
const calldata = await privateExecutionOracle.getHashPreimage(r.calldataHash);
|
|
122
151
|
return new HashedValues(calldata, r.calldataHash);
|
|
123
152
|
}));
|
|
124
153
|
const teardownTime = simulatorTeardownTimer.ms();
|
|
@@ -134,36 +163,52 @@ import { UtilityExecutionOracle } from './oracle/utility_execution_oracle.js';
|
|
|
134
163
|
throw createSimulationError(err instanceof Error ? err : new Error('Unknown error during private execution'));
|
|
135
164
|
}
|
|
136
165
|
}
|
|
137
|
-
// docs:start:execute_utility_function
|
|
138
166
|
/**
|
|
139
167
|
* Runs a utility function.
|
|
140
168
|
* @param call - The function call to execute.
|
|
141
|
-
* @param authwits - Authentication witnesses required for the function call.
|
|
142
|
-
* @param anchorBlockHeader - The block header to use as base state for this run.
|
|
143
|
-
* @param scopes - Optional array of account addresses whose notes can be accessed in this call. Defaults to all
|
|
144
|
-
* accounts if not specified.
|
|
145
169
|
* @returns A return value of the utility function in a form as returned by the simulator (Noir fields)
|
|
146
170
|
*/ async runUtility(call, authwits, anchorBlockHeader, scopes, jobId) {
|
|
147
|
-
const
|
|
171
|
+
const anchoredContractData = new AnchoredContractData(this.contractStore, this.contractClassService, anchorBlockHeader, this.overrides);
|
|
172
|
+
const entryPointArtifact = await anchoredContractData.getFunctionArtifactWithDebugMetadata(call.to, call.selector);
|
|
173
|
+
if (!entryPointArtifact) {
|
|
174
|
+
throw new Error(`Cannot run function ${call.selector} on ${call.to}: the contract is not registered. ` + `Register it via wallet.registerContract(...).`);
|
|
175
|
+
}
|
|
148
176
|
if (entryPointArtifact.functionType !== FunctionType.UTILITY) {
|
|
149
177
|
throw new Error(`Cannot run ${entryPointArtifact.functionType} function as utility`);
|
|
150
178
|
}
|
|
179
|
+
const utilityExecutor = async (syncCall, execScopes)=>{
|
|
180
|
+
await this.runUtility(syncCall, [], anchorBlockHeader, execScopes, jobId);
|
|
181
|
+
};
|
|
151
182
|
const oracle = new UtilityExecutionOracle({
|
|
152
|
-
|
|
183
|
+
callContext: CallContext.from({
|
|
184
|
+
msgSender: AztecAddress.NULL_MSG_SENDER,
|
|
185
|
+
contractAddress: call.to,
|
|
186
|
+
functionSelector: call.selector,
|
|
187
|
+
isStaticCall: true
|
|
188
|
+
}),
|
|
153
189
|
authWitnesses: authwits,
|
|
154
190
|
capsules: [],
|
|
155
191
|
anchorBlockHeader,
|
|
156
|
-
|
|
192
|
+
anchoredContractData,
|
|
157
193
|
noteStore: this.noteStore,
|
|
158
194
|
keyStore: this.keyStore,
|
|
159
195
|
addressStore: this.addressStore,
|
|
160
196
|
aztecNode: this.aztecNode,
|
|
161
197
|
recipientTaggingStore: this.recipientTaggingStore,
|
|
162
|
-
|
|
163
|
-
|
|
198
|
+
taggingSecretSourcesStore: this.taggingSecretSourcesStore,
|
|
199
|
+
capsuleService: new CapsuleService(this.capsuleStore, scopes),
|
|
200
|
+
factService: new FactService(this.factStore, scopes),
|
|
164
201
|
privateEventStore: this.privateEventStore,
|
|
202
|
+
txResolver: this.txResolver,
|
|
203
|
+
contractSyncService: this.contractSyncService,
|
|
204
|
+
l2TipsStore: this.l2TipsStore,
|
|
165
205
|
jobId,
|
|
166
|
-
scopes
|
|
206
|
+
scopes,
|
|
207
|
+
simulator: this.simulator,
|
|
208
|
+
hooks: this.hooks,
|
|
209
|
+
utilityExecutor,
|
|
210
|
+
// Execution-tree root (top-level utility run or contract sync): own store; nested frames inherit it.
|
|
211
|
+
transientArrayService: new TransientArrayService()
|
|
167
212
|
});
|
|
168
213
|
try {
|
|
169
214
|
this.log.verbose(`Executing utility function ${entryPointArtifact.name}`, {
|
|
@@ -171,7 +216,7 @@ import { UtilityExecutionOracle } from './oracle/utility_execution_oracle.js';
|
|
|
171
216
|
selector: call.selector
|
|
172
217
|
});
|
|
173
218
|
const initialWitness = toACVMWitness(0, call.args);
|
|
174
|
-
const acirExecutionResult = await this.simulator.executeUserCircuit(initialWitness, entryPointArtifact,
|
|
219
|
+
const acirExecutionResult = await this.simulator.executeUserCircuit(initialWitness, entryPointArtifact, buildACIRCallback(oracle)).catch((err)=>{
|
|
175
220
|
err.message = resolveAssertionMessageFromError(err, entryPointArtifact);
|
|
176
221
|
throw new ExecutionError(err.message, {
|
|
177
222
|
contractAddress: call.to,
|
|
@@ -181,12 +226,14 @@ import { UtilityExecutionOracle } from './oracle/utility_execution_oracle.js';
|
|
|
181
226
|
});
|
|
182
227
|
});
|
|
183
228
|
this.log.verbose(`Utility execution for ${call.to}.${call.selector} completed`);
|
|
184
|
-
return
|
|
229
|
+
return {
|
|
230
|
+
result: witnessMapToFields(acirExecutionResult.returnWitness),
|
|
231
|
+
offchainEffects: oracle.getOffchainEffects()
|
|
232
|
+
};
|
|
185
233
|
} catch (err) {
|
|
186
234
|
throw createSimulationError(err instanceof Error ? err : new Error('Unknown error during private execution'));
|
|
187
235
|
}
|
|
188
236
|
}
|
|
189
|
-
// docs:end:execute_utility_function
|
|
190
237
|
/**
|
|
191
238
|
* Returns the execution statistics collected during the simulator run.
|
|
192
239
|
* @returns The execution statistics.
|
|
@@ -239,13 +286,27 @@ class OrderedSideEffect {
|
|
|
239
286
|
const noteHashReadRequests = [];
|
|
240
287
|
const nullifierReadRequests = [];
|
|
241
288
|
let publicTeardownCallRequest;
|
|
289
|
+
// We set expiration timestamp to anchor_block_timestamp + MAX_TX_LIFETIME (24h) just like kernels do
|
|
290
|
+
let expirationTimestamp = privateExecutionResult.entrypoint.publicInputs.anchorBlockHeader.globalVariables.timestamp + BigInt(MAX_TX_LIFETIME);
|
|
291
|
+
let feePayer = AztecAddress.zero();
|
|
242
292
|
const executions = [
|
|
243
293
|
privateExecutionResult.entrypoint
|
|
244
294
|
];
|
|
245
295
|
while(executions.length !== 0){
|
|
246
296
|
const execution = executions.shift();
|
|
247
297
|
executions.unshift(...execution.nestedExecutionResults);
|
|
298
|
+
// Just like kernels we overwrite the default value if the call sets it.
|
|
299
|
+
const callExpirationTimestamp = execution.publicInputs.expirationTimestamp;
|
|
300
|
+
if (callExpirationTimestamp !== 0n && callExpirationTimestamp < expirationTimestamp) {
|
|
301
|
+
expirationTimestamp = callExpirationTimestamp;
|
|
302
|
+
}
|
|
248
303
|
const { contractAddress } = execution.publicInputs.callContext;
|
|
304
|
+
if (execution.publicInputs.isFeePayer) {
|
|
305
|
+
if (!feePayer.isZero()) {
|
|
306
|
+
throw new Error('Multiple fee payers found in private execution result');
|
|
307
|
+
}
|
|
308
|
+
feePayer = contractAddress;
|
|
309
|
+
}
|
|
249
310
|
scopedNoteHashes.push(...execution.publicInputs.noteHashes.getActiveItems().filter((nh)=>!nh.isEmpty()).map((nh)=>nh.scope(contractAddress)));
|
|
250
311
|
scopedNullifiers.push(...execution.publicInputs.nullifiers.getActiveItems().map((n)=>n.scope(contractAddress)));
|
|
251
312
|
taggedPrivateLogs.push(...await Promise.all(execution.publicInputs.privateLogs.getActiveItems().map(async (metadata)=>{
|
|
@@ -267,6 +328,7 @@ class OrderedSideEffect {
|
|
|
267
328
|
witgen: 0,
|
|
268
329
|
oracles: {}
|
|
269
330
|
},
|
|
331
|
+
kind: CircuitKind.App,
|
|
270
332
|
bytecode: execution.acir,
|
|
271
333
|
vk: execution.vk,
|
|
272
334
|
witness: execution.partialWitness
|
|
@@ -289,12 +351,12 @@ class OrderedSideEffect {
|
|
|
289
351
|
const getEffect = (orderedSideEffect)=>orderedSideEffect.sideEffect;
|
|
290
352
|
const isPrivateOnlyTx = privateExecutionResult.publicFunctionCalldata.length === 0;
|
|
291
353
|
const [nonRevertibleNullifiers, revertibleNullifiers] = splitOrderedSideEffects(siloedNullifiers, minRevertibleSideEffectCounter);
|
|
354
|
+
// The protocol nullifier is the nonce generator and the tx's first nullifier. It is injected by the
|
|
355
|
+
// init kernel (at counter 1, index 0) rather than emitted by any private call, so it is absent from
|
|
356
|
+
// the executed nullifiers above. Mirror the kernel here by prepending it as the first non-revertible
|
|
357
|
+
// nullifier.
|
|
292
358
|
const nonceGenerator = privateExecutionResult.firstNullifier;
|
|
293
|
-
|
|
294
|
-
nonRevertibleNullifiers.push(nonceGenerator);
|
|
295
|
-
} else if (!nonRevertibleNullifiers[0].equals(nonceGenerator)) {
|
|
296
|
-
throw new Error('The first non revertible nullifier should be equal to the nonce generator. This is a bug!');
|
|
297
|
-
}
|
|
359
|
+
nonRevertibleNullifiers.unshift(nonceGenerator);
|
|
298
360
|
if (isPrivateOnlyTx) {
|
|
299
361
|
// We must make the note hashes unique by using the
|
|
300
362
|
// nonce generator and their index in the tx.
|
|
@@ -328,7 +390,7 @@ class OrderedSideEffect {
|
|
|
328
390
|
const publicInputs = new PrivateKernelTailCircuitPublicInputs(constantData, /*gasUsed=*/ gasUsed.add(Gas.from({
|
|
329
391
|
l2Gas: isPrivateOnlyTx ? PRIVATE_TX_L2_GAS_OVERHEAD : PUBLIC_TX_L2_GAS_OVERHEAD,
|
|
330
392
|
daGas: TX_DA_GAS_OVERHEAD
|
|
331
|
-
})), /*feePayer=*/
|
|
393
|
+
})), /*feePayer=*/ feePayer, /*expirationTimestamp=*/ expirationTimestamp, hasPublicCalls ? inputsForPublic : undefined, !hasPublicCalls ? inputsForRollup : undefined);
|
|
332
394
|
return {
|
|
333
395
|
publicInputs,
|
|
334
396
|
chonkProof: ChonkProof.empty(),
|
|
@@ -379,17 +441,17 @@ class OrderedSideEffect {
|
|
|
379
441
|
});
|
|
380
442
|
}
|
|
381
443
|
}
|
|
382
|
-
const [
|
|
383
|
-
|
|
384
|
-
|
|
444
|
+
const [noteHashResults, nullifierResults] = await Promise.all([
|
|
445
|
+
settledNoteHashReads.length > 0 ? node.findLeavesIndexes(anchorBlockHash, MerkleTreeId.NOTE_HASH_TREE, settledNoteHashReads.map(({ value })=>value)) : [],
|
|
446
|
+
settledNullifierReads.length > 0 ? node.findLeavesIndexes(anchorBlockHash, MerkleTreeId.NULLIFIER_TREE, settledNullifierReads.map(({ value })=>value)) : []
|
|
385
447
|
]);
|
|
386
448
|
for(let i = 0; i < settledNoteHashReads.length; i++){
|
|
387
|
-
if (!
|
|
449
|
+
if (!noteHashResults[i]) {
|
|
388
450
|
throw new Error(`Note hash read request at index ${settledNoteHashReads[i].index} is reading an unknown note hash: ${settledNoteHashReads[i].value}`);
|
|
389
451
|
}
|
|
390
452
|
}
|
|
391
453
|
for(let i = 0; i < settledNullifierReads.length; i++){
|
|
392
|
-
if (!
|
|
454
|
+
if (!nullifierResults[i]) {
|
|
393
455
|
throw new Error(`Nullifier read request at index ${settledNullifierReads[i].index} is reading an unknown nullifier: ${settledNullifierReads[i].value}`);
|
|
394
456
|
}
|
|
395
457
|
}
|
|
@@ -432,6 +494,10 @@ function meterGasUsed(data, isPrivateOnlyTx) {
|
|
|
432
494
|
// Every contract class log emits its contract address as an additional field
|
|
433
495
|
meteredDAFields += data.contractClassLogsHashes.reduce((acc, log)=>!log.isEmpty() ? acc + log.logHash.length + 1 : acc, 0);
|
|
434
496
|
meteredL2Gas += numContractClassLogs * L2_GAS_PER_CONTRACT_CLASS_LOG;
|
|
497
|
+
if (isPrivateOnlyTx) {
|
|
498
|
+
// The public data write that the private tx base rollup always performs to update the fee payer's balance.
|
|
499
|
+
meteredDAFields += PUBLIC_DATA_WRITE_LENGTH;
|
|
500
|
+
}
|
|
435
501
|
const meteredDAGas = meteredDAFields * DA_GAS_PER_FIELD;
|
|
436
502
|
if (data.publicCallRequests) {
|
|
437
503
|
const dataForPublic = data;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
|
+
/** In-memory store for ephemeral arrays scoped to a single contract call frame. */
|
|
3
|
+
export declare class EphemeralArrayService {
|
|
4
|
+
#private;
|
|
5
|
+
/** Returns all elements in the array, or an empty array if uninitialized. */
|
|
6
|
+
readArrayAt(slot: Fr): Fr[][];
|
|
7
|
+
/** Returns the number of elements in the array at the given slot. */
|
|
8
|
+
len(slot: Fr): number;
|
|
9
|
+
/** Appends an element to the array and returns the new length. */
|
|
10
|
+
push(slot: Fr, elements: Fr[]): number;
|
|
11
|
+
/** Removes and returns the last element. Throws if empty. */
|
|
12
|
+
pop(slot: Fr): Fr[];
|
|
13
|
+
/** Returns the element at the given index. Throws if out of bounds. */
|
|
14
|
+
get(slot: Fr, index: number): Fr[];
|
|
15
|
+
/** Overwrites the element at the given index. Throws if out of bounds. */
|
|
16
|
+
set(slot: Fr, index: number, value: Fr[]): void;
|
|
17
|
+
/** Removes the element at the given index, shifting subsequent elements backward. Throws if out of bounds. */
|
|
18
|
+
remove(slot: Fr, index: number): void;
|
|
19
|
+
/** Removes all elements from the array. */
|
|
20
|
+
clear(slot: Fr): void;
|
|
21
|
+
/** Allocates a fresh, unused slot for a new ephemeral array. */
|
|
22
|
+
allocateSlot(): Fr;
|
|
23
|
+
/** Creates a new ephemeral array pre-populated with the given elements and returns its slot. */
|
|
24
|
+
newArray(elements: Fr[][]): Fr;
|
|
25
|
+
/** Copies `count` elements from the source array to the destination array (overwrites destination). */
|
|
26
|
+
copy(srcSlot: Fr, dstSlot: Fr, count: number): void;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXBoZW1lcmFsX2FycmF5X3NlcnZpY2UuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jb250cmFjdF9mdW5jdGlvbl9zaW11bGF0b3IvZXBoZW1lcmFsX2FycmF5X3NlcnZpY2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLEVBQUUsRUFBRSxNQUFNLGdDQUFnQyxDQUFDO0FBRXBELG1GQUFtRjtBQUNuRixxQkFBYSxxQkFBcUI7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UsS0FBSyxFQUFFLE1BQU0sR0FBRyxJQUFJLENBVWxEO0NBQ0YifQ==
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ephemeral_array_service.d.ts","sourceRoot":"","sources":["../../src/contract_function_simulator/ephemeral_array_service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AAEpD,mFAAmF;AACnF,qBAAa,qBAAqB;;IAOhC,6EAA6E;IAC7E,WAAW,CAAC,IAAI,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,CAE5B;IAMD,qEAAqE;IACrE,GAAG,CAAC,IAAI,EAAE,EAAE,GAAG,MAAM,CAEpB;IAED,kEAAkE;IAClE,IAAI,CAAC,IAAI,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,GAAG,MAAM,CAKrC;IAED,6DAA6D;IAC7D,GAAG,CAAC,IAAI,EAAE,EAAE,GAAG,EAAE,EAAE,CAQlB;IAED,uEAAuE;IACvE,GAAG,CAAC,IAAI,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,EAAE,EAAE,CAQjC;IAED,0EAA0E;IAC1E,GAAG,CAAC,IAAI,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,EAAE,GAAG,IAAI,CAQ9C;IAED,8GAA8G;IAC9G,MAAM,CAAC,IAAI,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAQpC;IAED,2CAA2C;IAC3C,KAAK,CAAC,IAAI,EAAE,EAAE,GAAG,IAAI,CAEpB;IAED,gEAAgE;IAChE,YAAY,IAAI,EAAE,CAMjB;IAED,gGAAgG;IAChG,QAAQ,CAAC,QAAQ,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,CAI7B;IAED,uGAAuG;IACvG,IAAI,CAAC,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAUlD;CACF"}
|