@aztec/pxe 0.0.1-commit.f504929 → 0.0.1-commit.f5a9928
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 +41 -112
- 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 +34 -0
- package/dest/bin/oracle_version_helpers.d.ts.map +1 -0
- package/dest/bin/oracle_version_helpers.js +46 -0
- package/dest/block_synchronizer/block_stream_source.d.ts +10 -0
- package/dest/block_synchronizer/block_stream_source.d.ts.map +1 -0
- package/dest/block_synchronizer/block_stream_source.js +37 -0
- package/dest/block_synchronizer/block_synchronizer.d.ts +22 -16
- package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -1
- package/dest/block_synchronizer/block_synchronizer.js +71 -28
- package/dest/config/index.d.ts +9 -2
- package/dest/config/index.d.ts.map +1 -1
- package/dest/config/index.js +14 -15
- package/dest/config/package_info.js +1 -1
- package/dest/contract/contract_class_service.d.ts +24 -0
- package/dest/contract/contract_class_service.d.ts.map +1 -0
- package/dest/contract/contract_class_service.js +36 -0
- package/dest/contract/contract_sync_service.d.ts +48 -0
- package/dest/contract/contract_sync_service.d.ts.map +1 -0
- package/dest/contract/contract_sync_service.js +119 -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 +30 -25
- package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.js +114 -66
- 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 +10 -29
- 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 +11 -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 +3 -4
- package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/event_validation_request.js +9 -10
- 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 -63
- 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 +3 -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 -12
- package/dest/contract_function_simulator/noir-structs/option.d.ts +59 -0
- package/dest/contract_function_simulator/noir-structs/option.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/option.js +67 -0
- package/dest/contract_function_simulator/noir-structs/origin_block.d.ts +11 -0
- package/dest/contract_function_simulator/noir-structs/origin_block.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/origin_block.js +5 -0
- package/dest/contract_function_simulator/noir-structs/pending_tagged_log.d.ts +11 -0
- package/dest/contract_function_simulator/noir-structs/pending_tagged_log.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/pending_tagged_log.js +4 -0
- package/dest/contract_function_simulator/noir-structs/provided_secret.d.ts +8 -0
- package/dest/contract_function_simulator/noir-structs/provided_secret.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/provided_secret.js +1 -0
- package/dest/contract_function_simulator/noir-structs/resolved_tagging_strategy.d.ts +28 -0
- package/dest/contract_function_simulator/noir-structs/resolved_tagging_strategy.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/resolved_tagging_strategy.js +50 -0
- package/dest/contract_function_simulator/noir-structs/resolved_tx.d.ts +19 -0
- package/dest/contract_function_simulator/noir-structs/resolved_tx.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/resolved_tx.js +9 -0
- package/dest/contract_function_simulator/noir-structs/tx_effect_data.d.ts +15 -0
- package/dest/contract_function_simulator/noir-structs/tx_effect_data.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/tx_effect_data.js +5 -0
- package/dest/contract_function_simulator/noir-structs/utility_context.d.ts +6 -11
- package/dest/contract_function_simulator/noir-structs/utility_context.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/utility_context.js +1 -20
- package/dest/contract_function_simulator/oracle/acir_callback.d.ts +21 -0
- package/dest/contract_function_simulator/oracle/acir_callback.d.ts.map +1 -0
- package/dest/contract_function_simulator/oracle/acir_callback.js +115 -0
- package/dest/contract_function_simulator/oracle/index.d.ts +2 -13
- package/dest/contract_function_simulator/oracle/index.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/index.js +1 -1
- package/dest/contract_function_simulator/oracle/interfaces.d.ts +15 -98
- package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/interfaces.js +2 -2
- package/dest/contract_function_simulator/oracle/legacy_oracle_registry.d.ts +39 -0
- package/dest/contract_function_simulator/oracle/legacy_oracle_registry.d.ts.map +1 -0
- package/dest/contract_function_simulator/oracle/legacy_oracle_registry.js +107 -0
- package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts +3 -14
- package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.js +1 -24
- package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts +2 -2
- package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/note_packing_utils.js +2 -2
- package/dest/contract_function_simulator/oracle/oracle_registry.d.ts +139 -0
- package/dest/contract_function_simulator/oracle/oracle_registry.d.ts.map +1 -0
- package/dest/contract_function_simulator/oracle/oracle_registry.js +1016 -0
- package/dest/contract_function_simulator/oracle/oracle_type_mappings.d.ts +274 -0
- package/dest/contract_function_simulator/oracle/oracle_type_mappings.d.ts.map +1 -0
- package/dest/contract_function_simulator/oracle/oracle_type_mappings.js +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 +56 -71
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.js +200 -99
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +183 -76
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +662 -156
- package/dest/contract_function_simulator/pick_notes.d.ts +1 -1
- package/dest/contract_function_simulator/pick_notes.d.ts.map +1 -1
- package/dest/contract_function_simulator/pick_notes.js +20 -3
- package/dest/contract_function_simulator/transient_array_service.d.ts +31 -0
- package/dest/contract_function_simulator/transient_array_service.d.ts.map +1 -0
- package/dest/contract_function_simulator/transient_array_service.js +62 -0
- package/dest/contract_logging.d.ts +9 -4
- package/dest/contract_logging.d.ts.map +1 -1
- package/dest/contract_logging.js +21 -6
- package/dest/debug/pxe_debug_utils.d.ts +4 -9
- package/dest/debug/pxe_debug_utils.d.ts.map +1 -1
- package/dest/debug/pxe_debug_utils.js +0 -6
- package/dest/entrypoints/client/bundle/index.d.ts +2 -2
- package/dest/entrypoints/client/bundle/index.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/index.js +1 -1
- package/dest/entrypoints/client/bundle/utils.d.ts +2 -2
- package/dest/entrypoints/client/bundle/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/utils.js +21 -8
- package/dest/entrypoints/client/lazy/index.d.ts +2 -2
- package/dest/entrypoints/client/lazy/index.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/index.js +1 -1
- package/dest/entrypoints/client/lazy/utils.d.ts +2 -2
- package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/utils.js +21 -8
- package/dest/entrypoints/client/store.d.ts +14 -0
- package/dest/entrypoints/client/store.d.ts.map +1 -0
- package/dest/entrypoints/client/store.js +42 -0
- package/dest/entrypoints/pxe_creation_options.d.ts +16 -2
- package/dest/entrypoints/pxe_creation_options.d.ts.map +1 -1
- package/dest/entrypoints/pxe_creation_options.js +3 -1
- package/dest/entrypoints/server/index.d.ts +7 -4
- package/dest/entrypoints/server/index.d.ts.map +1 -1
- package/dest/entrypoints/server/index.js +5 -3
- package/dest/entrypoints/server/store.d.ts +18 -0
- package/dest/entrypoints/server/store.d.ts.map +1 -0
- package/dest/entrypoints/server/store.js +28 -0
- package/dest/entrypoints/server/utils.d.ts +4 -3
- package/dest/entrypoints/server/utils.d.ts.map +1 -1
- package/dest/entrypoints/server/utils.js +22 -8
- package/dest/error_enriching.d.ts +5 -3
- package/dest/error_enriching.d.ts.map +1 -1
- package/dest/error_enriching.js +15 -12
- package/dest/events/event_service.d.ts +21 -5
- package/dest/events/event_service.d.ts.map +1 -1
- package/dest/events/event_service.js +51 -17
- package/dest/events/private_event_filter_validator.d.ts +3 -2
- package/dest/events/private_event_filter_validator.d.ts.map +1 -1
- package/dest/events/private_event_filter_validator.js +15 -0
- package/dest/hooks/authorize_utility_call.d.ts +41 -0
- package/dest/hooks/authorize_utility_call.d.ts.map +1 -0
- package/dest/hooks/authorize_utility_call.js +4 -0
- package/dest/hooks/execution_hooks.d.ts +62 -0
- package/dest/hooks/execution_hooks.d.ts.map +1 -0
- package/dest/hooks/execution_hooks.js +9 -0
- package/dest/hooks/index.d.ts +5 -0
- package/dest/hooks/index.d.ts.map +1 -0
- package/dest/hooks/index.js +2 -0
- package/dest/hooks/resolve_custom_request.d.ts +23 -0
- package/dest/hooks/resolve_custom_request.d.ts.map +1 -0
- package/dest/hooks/resolve_custom_request.js +3 -0
- package/dest/hooks/resolve_tagging_secret_strategy.d.ts +50 -0
- package/dest/hooks/resolve_tagging_secret_strategy.d.ts.map +1 -0
- package/dest/hooks/resolve_tagging_secret_strategy.js +3 -0
- package/dest/logs/log_service.d.ts +21 -11
- package/dest/logs/log_service.d.ts.map +1 -1
- package/dest/logs/log_service.js +181 -82
- package/dest/messages/tx_resolver_service.d.ts +28 -0
- package/dest/messages/tx_resolver_service.d.ts.map +1 -0
- package/dest/messages/tx_resolver_service.js +62 -0
- package/dest/node/benchmarked_node.d.ts +20 -0
- package/dest/node/benchmarked_node.d.ts.map +1 -0
- package/dest/node/benchmarked_node.js +94 -0
- package/dest/node/caching_aztec_node.d.ts +24 -0
- package/dest/node/caching_aztec_node.d.ts.map +1 -0
- package/dest/node/caching_aztec_node.js +268 -0
- package/dest/notes/note_service.d.ts +34 -7
- package/dest/notes/note_service.d.ts.map +1 -1
- package/dest/notes/note_service.js +82 -57
- package/dest/notes_filter.d.ts +2 -3
- package/dest/notes_filter.d.ts.map +1 -1
- package/dest/oracle_version.d.ts +4 -3
- package/dest/oracle_version.d.ts.map +1 -1
- package/dest/oracle_version.js +20 -10
- package/dest/private_kernel/batch_planner.d.ts +47 -0
- package/dest/private_kernel/batch_planner.d.ts.map +1 -0
- package/dest/private_kernel/batch_planner.js +104 -0
- package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts +1 -1
- package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts.map +1 -1
- package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.js +10 -5
- 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 +160 -85
- 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 +378 -213
- package/dest/storage/address_store/address_store.d.ts +1 -1
- package/dest/storage/address_store/address_store.d.ts.map +1 -1
- package/dest/storage/address_store/address_store.js +2 -1
- package/dest/storage/allowed_scopes.d.ts +6 -0
- package/dest/storage/allowed_scopes.d.ts.map +1 -0
- package/dest/storage/allowed_scopes.js +7 -0
- package/dest/storage/anchor_block_store/anchor_block_store.d.ts +9 -6
- package/dest/storage/anchor_block_store/anchor_block_store.d.ts.map +1 -1
- package/dest/storage/anchor_block_store/anchor_block_store.js +9 -7
- package/dest/storage/backwards_compatibility_tests/kv_store_snapshot.d.ts +42 -0
- package/dest/storage/backwards_compatibility_tests/kv_store_snapshot.d.ts.map +1 -0
- package/dest/storage/backwards_compatibility_tests/kv_store_snapshot.js +93 -0
- package/dest/storage/backwards_compatibility_tests/schema_tests.d.ts +15 -0
- package/dest/storage/backwards_compatibility_tests/schema_tests.d.ts.map +1 -0
- package/dest/storage/backwards_compatibility_tests/schema_tests.js +671 -0
- package/dest/storage/backwards_compatibility_tests/store_spy.d.ts +19 -0
- package/dest/storage/backwards_compatibility_tests/store_spy.d.ts.map +1 -0
- package/dest/storage/backwards_compatibility_tests/store_spy.js +63 -0
- package/dest/storage/capsule_store/capsule_service.d.ts +21 -0
- package/dest/storage/capsule_store/capsule_service.d.ts.map +1 -0
- package/dest/storage/capsule_store/capsule_service.js +47 -0
- package/dest/storage/capsule_store/capsule_store.d.ts +9 -9
- package/dest/storage/capsule_store/capsule_store.d.ts.map +1 -1
- package/dest/storage/capsule_store/capsule_store.js +37 -29
- 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 +72 -99
- package/dest/storage/contract_store/private_functions_tree.d.ts +1 -1
- package/dest/storage/contract_store/private_functions_tree.d.ts.map +1 -1
- package/dest/storage/contract_store/private_functions_tree.js +2 -1
- 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 +411 -0
- package/dest/storage/fact_store/fact_store_keys.d.ts +34 -0
- package/dest/storage/fact_store/fact_store_keys.d.ts.map +1 -0
- package/dest/storage/fact_store/fact_store_keys.js +50 -0
- package/dest/storage/fact_store/index.d.ts +6 -0
- package/dest/storage/fact_store/index.d.ts.map +1 -0
- package/dest/storage/fact_store/index.js +4 -0
- package/dest/storage/fact_store/origin_state.d.ts +59 -0
- package/dest/storage/fact_store/origin_state.d.ts.map +1 -0
- package/dest/storage/fact_store/origin_state.js +60 -0
- package/dest/storage/fact_store/stored_fact.d.ts +32 -0
- package/dest/storage/fact_store/stored_fact.d.ts.map +1 -0
- package/dest/storage/fact_store/stored_fact.js +64 -0
- package/dest/storage/index.d.ts +3 -2
- package/dest/storage/index.d.ts.map +1 -1
- package/dest/storage/index.js +2 -1
- package/dest/storage/metadata.d.ts +2 -2
- package/dest/storage/metadata.d.ts.map +1 -1
- package/dest/storage/metadata.js +1 -1
- package/dest/storage/note_store/note_store.d.ts +42 -33
- package/dest/storage/note_store/note_store.d.ts.map +1 -1
- package/dest/storage/note_store/note_store.js +202 -172
- 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 +48 -45
- package/dest/storage/private_event_store/stored_private_event.js +1 -1
- package/dest/storage/store_identity.d.ts +35 -0
- package/dest/storage/store_identity.d.ts.map +1 -0
- package/dest/storage/store_identity.js +44 -0
- package/dest/storage/tagging_store/index.d.ts +2 -2
- package/dest/storage/tagging_store/index.d.ts.map +1 -1
- package/dest/storage/tagging_store/index.js +1 -1
- package/dest/storage/tagging_store/recipient_tagging_store.d.ts +6 -6
- package/dest/storage/tagging_store/recipient_tagging_store.d.ts.map +1 -1
- package/dest/storage/tagging_store/sender_tagging_store.d.ts +63 -31
- package/dest/storage/tagging_store/sender_tagging_store.d.ts.map +1 -1
- package/dest/storage/tagging_store/sender_tagging_store.js +210 -129
- package/dest/storage/tagging_store/tagging_secret_sources_store.d.ts +51 -0
- package/dest/storage/tagging_store/tagging_secret_sources_store.d.ts.map +1 -0
- package/dest/storage/tagging_store/tagging_secret_sources_store.js +105 -0
- package/dest/tagging/constants.d.ts +11 -2
- package/dest/tagging/constants.d.ts.map +1 -1
- package/dest/tagging/constants.js +38 -10
- package/dest/tagging/get_all_logs_by_tags.d.ts +55 -10
- package/dest/tagging/get_all_logs_by_tags.d.ts.map +1 -1
- package/dest/tagging/get_all_logs_by_tags.js +55 -36
- package/dest/tagging/index.d.ts +8 -7
- package/dest/tagging/index.d.ts.map +1 -1
- package/dest/tagging/index.js +6 -5
- package/dest/tagging/persist_sender_tagging_index_ranges.d.ts +29 -0
- package/dest/tagging/persist_sender_tagging_index_ranges.d.ts.map +1 -0
- package/dest/tagging/persist_sender_tagging_index_ranges.js +42 -0
- package/dest/tagging/recipient_sync/sync_tagged_private_logs.d.ts +74 -0
- package/dest/tagging/recipient_sync/sync_tagged_private_logs.d.ts.map +1 -0
- package/dest/tagging/recipient_sync/sync_tagged_private_logs.js +235 -0
- package/dest/tagging/recipient_sync/utils/find_highest_indexes.d.ts +3 -3
- package/dest/tagging/recipient_sync/utils/find_highest_indexes.d.ts.map +1 -1
- package/dest/tagging/reconcile_tagging_index_ranges.d.ts +36 -0
- package/dest/tagging/reconcile_tagging_index_ranges.d.ts.map +1 -0
- package/dest/tagging/reconcile_tagging_index_ranges.js +74 -0
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts +8 -6
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts.map +1 -1
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.js +25 -19
- 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 +17 -6
- 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 +46 -31
- 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/package.json +20 -17
- package/src/bin/check_oracle_version.ts +46 -135
- package/src/bin/index.ts +1 -0
- package/src/bin/oracle_version_helpers.ts +54 -0
- package/src/block_synchronizer/block_stream_source.ts +42 -0
- package/src/block_synchronizer/block_synchronizer.ts +86 -40
- package/src/config/index.ts +16 -9
- package/src/config/package_info.ts +1 -1
- package/src/contract/contract_class_service.ts +45 -0
- package/src/contract/contract_sync_service.ts +179 -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 +178 -82
- package/src/contract_function_simulator/ephemeral_array_service.ts +110 -0
- package/src/contract_function_simulator/execution_note_cache.ts +10 -30
- package/src/contract_function_simulator/execution_tagging_index_cache.ts +19 -18
- package/src/contract_function_simulator/index.ts +89 -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 +10 -9
- 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 -64
- package/src/contract_function_simulator/noir-structs/note_data.ts +27 -0
- package/src/contract_function_simulator/noir-structs/note_validation_request.ts +6 -11
- package/src/contract_function_simulator/noir-structs/option.ts +75 -0
- package/src/contract_function_simulator/noir-structs/origin_block.ts +8 -0
- package/src/contract_function_simulator/noir-structs/pending_tagged_log.ts +12 -0
- package/src/contract_function_simulator/noir-structs/provided_secret.ts +5 -0
- package/src/contract_function_simulator/noir-structs/resolved_tagging_strategy.ts +66 -0
- package/src/contract_function_simulator/noir-structs/resolved_tx.ts +19 -0
- package/src/contract_function_simulator/noir-structs/tx_effect_data.ts +16 -0
- package/src/contract_function_simulator/noir-structs/utility_context.ts +5 -17
- package/src/contract_function_simulator/oracle/acir_callback.ts +154 -0
- package/src/contract_function_simulator/oracle/index.ts +1 -15
- package/src/contract_function_simulator/oracle/interfaces.ts +11 -176
- package/src/contract_function_simulator/oracle/legacy_oracle_registry.ts +147 -0
- package/src/contract_function_simulator/oracle/message_load_oracle_inputs.ts +6 -21
- package/src/contract_function_simulator/oracle/note_packing_utils.ts +3 -3
- package/src/contract_function_simulator/oracle/oracle_registry.ts +710 -0
- package/src/contract_function_simulator/oracle/oracle_type_mappings.ts +1052 -0
- package/src/contract_function_simulator/oracle/private_execution.ts +6 -7
- package/src/contract_function_simulator/oracle/private_execution_oracle.ts +249 -132
- package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +978 -249
- package/src/contract_function_simulator/pick_notes.ts +22 -3
- package/src/contract_function_simulator/transient_array_service.ts +91 -0
- package/src/contract_logging.ts +18 -5
- package/src/debug/pxe_debug_utils.ts +4 -12
- package/src/entrypoints/client/bundle/index.ts +1 -1
- package/src/entrypoints/client/bundle/utils.ts +26 -8
- package/src/entrypoints/client/lazy/index.ts +1 -1
- package/src/entrypoints/client/lazy/utils.ts +26 -8
- package/src/entrypoints/client/store.ts +54 -0
- package/src/entrypoints/pxe_creation_options.ts +21 -1
- package/src/entrypoints/server/index.ts +7 -3
- package/src/entrypoints/server/store.ts +47 -0
- package/src/entrypoints/server/utils.ts +39 -14
- package/src/error_enriching.ts +30 -13
- package/src/events/event_service.ts +85 -26
- package/src/events/private_event_filter_validator.ts +21 -1
- package/src/hooks/authorize_utility_call.ts +44 -0
- package/src/hooks/execution_hooks.ts +68 -0
- package/src/hooks/index.ts +13 -0
- package/src/hooks/resolve_custom_request.ts +24 -0
- package/src/hooks/resolve_tagging_secret_strategy.ts +60 -0
- package/src/logs/log_service.ts +228 -147
- package/src/messages/tx_resolver_service.ts +81 -0
- package/src/node/benchmarked_node.ts +140 -0
- package/src/node/caching_aztec_node.ts +407 -0
- package/src/notes/note_service.ts +127 -86
- package/src/notes_filter.ts +1 -3
- package/src/oracle_version.ts +20 -10
- package/src/private_kernel/batch_planner.ts +169 -0
- package/src/private_kernel/hints/private_kernel_reset_private_inputs_builder.ts +15 -4
- package/src/private_kernel/hints/test_utils.ts +3 -10
- package/src/private_kernel/private_kernel_execution_prover.ts +246 -117
- package/src/private_kernel/private_kernel_oracle.ts +58 -29
- package/src/pxe.ts +595 -245
- package/src/storage/address_store/address_store.ts +2 -1
- package/src/storage/allowed_scopes.ts +14 -0
- package/src/storage/anchor_block_store/anchor_block_store.ts +9 -7
- package/src/storage/backwards_compatibility_tests/__snapshots__/AddressStore.json +22 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/AnchorBlockStore.json +3 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/CapsuleStore.json +16 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/ContractStore.json +28 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/FactStore.json +40 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/KeyStore.json +52 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/L2TipsKVStore.json +40 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/NoteStore.json +56 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/PrivateEventStore.json +44 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/RecipientTaggingStore.json +26 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/SenderTaggingStore.json +30 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/TaggingSecretSourcesStore.json +30 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/opened_stores.json +117 -0
- package/src/storage/backwards_compatibility_tests/kv_store_snapshot.ts +122 -0
- package/src/storage/backwards_compatibility_tests/schema_tests.ts +803 -0
- package/src/storage/backwards_compatibility_tests/store_spy.ts +73 -0
- package/src/storage/capsule_store/capsule_service.ts +85 -0
- package/src/storage/capsule_store/capsule_store.ts +45 -27
- package/src/storage/capsule_store/index.ts +1 -0
- package/src/storage/contract_store/contract_store.ts +98 -125
- package/src/storage/contract_store/private_functions_tree.ts +2 -1
- package/src/storage/fact_store/fact_service.ts +69 -0
- package/src/storage/fact_store/fact_store.ts +488 -0
- package/src/storage/fact_store/fact_store_keys.ts +75 -0
- package/src/storage/fact_store/index.ts +15 -0
- package/src/storage/fact_store/origin_state.ts +84 -0
- package/src/storage/fact_store/stored_fact.ts +80 -0
- package/src/storage/index.ts +2 -1
- package/src/storage/metadata.ts +1 -1
- package/src/storage/note_store/note_store.ts +233 -194
- 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 +55 -56
- package/src/storage/private_event_store/stored_private_event.ts +1 -1
- package/src/storage/store_identity.ts +72 -0
- package/src/storage/tagging_store/index.ts +1 -1
- package/src/storage/tagging_store/recipient_tagging_store.ts +5 -9
- package/src/storage/tagging_store/sender_tagging_store.ts +278 -158
- package/src/storage/tagging_store/tagging_secret_sources_store.ts +138 -0
- package/src/tagging/constants.ts +42 -10
- package/src/tagging/get_all_logs_by_tags.ts +115 -50
- package/src/tagging/index.ts +12 -6
- package/src/tagging/persist_sender_tagging_index_ranges.ts +57 -0
- package/src/tagging/recipient_sync/sync_tagged_private_logs.ts +356 -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 +32 -22
- 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 +55 -39
- 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/dest/access_scopes.d.ts +0 -9
- package/dest/access_scopes.d.ts.map +0 -1
- package/dest/access_scopes.js +0 -6
- package/dest/contract_function_simulator/benchmarked_node.d.ts +0 -9
- package/dest/contract_function_simulator/benchmarked_node.d.ts.map +0 -1
- package/dest/contract_function_simulator/benchmarked_node.js +0 -77
- package/dest/contract_function_simulator/oracle/oracle.d.ts +0 -60
- package/dest/contract_function_simulator/oracle/oracle.d.ts.map +0 -1
- package/dest/contract_function_simulator/oracle/oracle.js +0 -411
- 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/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts +0 -11
- package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts.map +0 -1
- package/dest/tagging/sender_sync/utils/get_status_change_of_pending.js +0 -29
- package/src/access_scopes.ts +0 -9
- package/src/contract_function_simulator/benchmarked_node.ts +0 -103
- package/src/contract_function_simulator/oracle/oracle.ts +0 -665
- 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
- package/src/tagging/sender_sync/utils/get_status_change_of_pending.ts +0 -36
|
@@ -1,411 +0,0 @@
|
|
|
1
|
-
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
2
|
-
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
|
-
import { Point } from '@aztec/foundation/curves/grumpkin';
|
|
4
|
-
import { arrayOfArraysToBoundedVecOfArrays, bufferToBoundedVec, fromUintArray, fromUintBoundedVec, toACVMField } from '@aztec/simulator/client';
|
|
5
|
-
import { FunctionSelector, NoteSelector } from '@aztec/stdlib/abi';
|
|
6
|
-
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
7
|
-
import { BlockHash } from '@aztec/stdlib/block';
|
|
8
|
-
import { ContractClassLog, ContractClassLogFields } from '@aztec/stdlib/logs';
|
|
9
|
-
import { packAsHintedNote } from './note_packing_utils.js';
|
|
10
|
-
export class UnavailableOracleError extends Error {
|
|
11
|
-
constructor(oracleName){
|
|
12
|
-
super(`${oracleName} oracles not available with the current handler`);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* A data source that has all the apis required by Aztec.nr.
|
|
17
|
-
*/ export class Oracle {
|
|
18
|
-
handler;
|
|
19
|
-
constructor(handler){
|
|
20
|
-
this.handler = handler;
|
|
21
|
-
}
|
|
22
|
-
handlerAsMisc() {
|
|
23
|
-
if (!('isMisc' in this.handler)) {
|
|
24
|
-
throw new UnavailableOracleError('Misc');
|
|
25
|
-
}
|
|
26
|
-
return this.handler;
|
|
27
|
-
}
|
|
28
|
-
handlerAsUtility() {
|
|
29
|
-
if (!('isUtility' in this.handler)) {
|
|
30
|
-
throw new UnavailableOracleError('Utility');
|
|
31
|
-
}
|
|
32
|
-
return this.handler;
|
|
33
|
-
}
|
|
34
|
-
handlerAsPrivate() {
|
|
35
|
-
if (!('isPrivate' in this.handler)) {
|
|
36
|
-
throw new UnavailableOracleError('Private');
|
|
37
|
-
}
|
|
38
|
-
return this.handler;
|
|
39
|
-
}
|
|
40
|
-
toACIRCallback() {
|
|
41
|
-
const excludedProps = [
|
|
42
|
-
'handler',
|
|
43
|
-
'constructor',
|
|
44
|
-
'toACIRCallback',
|
|
45
|
-
'handlerAsMisc',
|
|
46
|
-
'handlerAsUtility',
|
|
47
|
-
'handlerAsPrivate'
|
|
48
|
-
];
|
|
49
|
-
// Get all the oracle function names
|
|
50
|
-
const oracleNames = Object.getOwnPropertyNames(Oracle.prototype).filter((name)=>!excludedProps.includes(name));
|
|
51
|
-
// Validate oracle names - these must be prefixed with either "aztec_prv_" or "aztec_utl_" to indicate their scope
|
|
52
|
-
// and must correspond to a function on the Oracle class.
|
|
53
|
-
oracleNames.forEach((name)=>{
|
|
54
|
-
if (!name.startsWith('aztec_prv_') && !name.startsWith('aztec_utl_')) {
|
|
55
|
-
throw new Error(`Oracle function "${name}" must be prefixed with either "aztec_prv_" or "aztec_utl_" to indicate its scope`);
|
|
56
|
-
}
|
|
57
|
-
const method = this[name];
|
|
58
|
-
if (typeof method !== 'function') {
|
|
59
|
-
throw new Error(`Oracle property "${name}" must be a function`);
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
// Build callback object and return it
|
|
63
|
-
return oracleNames.reduce((acc, name)=>{
|
|
64
|
-
const method = this[name];
|
|
65
|
-
acc[name] = method.bind(this);
|
|
66
|
-
return acc;
|
|
67
|
-
}, {});
|
|
68
|
-
}
|
|
69
|
-
// eslint-disable-next-line camelcase
|
|
70
|
-
aztec_utl_assertCompatibleOracleVersion([version]) {
|
|
71
|
-
this.handlerAsMisc().assertCompatibleOracleVersion(Fr.fromString(version).toNumber());
|
|
72
|
-
return Promise.resolve([]);
|
|
73
|
-
}
|
|
74
|
-
// eslint-disable-next-line camelcase
|
|
75
|
-
aztec_utl_getRandomField() {
|
|
76
|
-
const val = this.handlerAsMisc().getRandomField();
|
|
77
|
-
return Promise.resolve([
|
|
78
|
-
toACVMField(val)
|
|
79
|
-
]);
|
|
80
|
-
}
|
|
81
|
-
// eslint-disable-next-line camelcase
|
|
82
|
-
aztec_prv_storeInExecutionCache(values, [hash]) {
|
|
83
|
-
this.handlerAsPrivate().storeInExecutionCache(values.map(Fr.fromString), Fr.fromString(hash));
|
|
84
|
-
return Promise.resolve([]);
|
|
85
|
-
}
|
|
86
|
-
// eslint-disable-next-line camelcase
|
|
87
|
-
async aztec_prv_loadFromExecutionCache([returnsHash]) {
|
|
88
|
-
const values = await this.handlerAsPrivate().loadFromExecutionCache(Fr.fromString(returnsHash));
|
|
89
|
-
return [
|
|
90
|
-
values.map(toACVMField)
|
|
91
|
-
];
|
|
92
|
-
}
|
|
93
|
-
// eslint-disable-next-line camelcase
|
|
94
|
-
aztec_utl_getUtilityContext() {
|
|
95
|
-
const context = this.handlerAsUtility().getUtilityContext();
|
|
96
|
-
return Promise.resolve(context.toNoirRepresentation());
|
|
97
|
-
}
|
|
98
|
-
// eslint-disable-next-line camelcase
|
|
99
|
-
async aztec_utl_getKeyValidationRequest([pkMHash]) {
|
|
100
|
-
const keyValidationRequest = await this.handlerAsUtility().getKeyValidationRequest(Fr.fromString(pkMHash));
|
|
101
|
-
return keyValidationRequest.toFields().map(toACVMField);
|
|
102
|
-
}
|
|
103
|
-
// eslint-disable-next-line camelcase
|
|
104
|
-
async aztec_utl_getContractInstance([address]) {
|
|
105
|
-
const instance = await this.handlerAsUtility().getContractInstance(AztecAddress.fromField(Fr.fromString(address)));
|
|
106
|
-
return [
|
|
107
|
-
instance.salt,
|
|
108
|
-
instance.deployer,
|
|
109
|
-
instance.currentContractClassId,
|
|
110
|
-
instance.initializationHash,
|
|
111
|
-
...instance.publicKeys.toFields()
|
|
112
|
-
].map(toACVMField);
|
|
113
|
-
}
|
|
114
|
-
// eslint-disable-next-line camelcase
|
|
115
|
-
async aztec_utl_getNoteHashMembershipWitness([anchorBlockHash], [noteHash]) {
|
|
116
|
-
const parsedAnchorBlockHash = BlockHash.fromString(anchorBlockHash);
|
|
117
|
-
const parsedNoteHash = Fr.fromString(noteHash);
|
|
118
|
-
const witness = await this.handlerAsUtility().getNoteHashMembershipWitness(parsedAnchorBlockHash, parsedNoteHash);
|
|
119
|
-
if (!witness) {
|
|
120
|
-
throw new Error(`Note hash ${noteHash} not found in the note hash tree at anchor block hash ${parsedAnchorBlockHash.toString()}.`);
|
|
121
|
-
}
|
|
122
|
-
return witness.toNoirRepresentation();
|
|
123
|
-
}
|
|
124
|
-
// eslint-disable-next-line camelcase
|
|
125
|
-
async aztec_utl_getBlockHashMembershipWitness([anchorBlockHash], [blockHash]) {
|
|
126
|
-
const parsedAnchorBlockHash = BlockHash.fromString(anchorBlockHash);
|
|
127
|
-
const parsedBlockHash = BlockHash.fromString(blockHash);
|
|
128
|
-
const witness = await this.handlerAsUtility().getBlockHashMembershipWitness(parsedAnchorBlockHash, parsedBlockHash);
|
|
129
|
-
if (!witness) {
|
|
130
|
-
throw new Error(`Block hash ${parsedBlockHash.toString()} not found in the archive tree at anchor block ${parsedAnchorBlockHash.toString()}.`);
|
|
131
|
-
}
|
|
132
|
-
return witness.toNoirRepresentation();
|
|
133
|
-
}
|
|
134
|
-
// eslint-disable-next-line camelcase
|
|
135
|
-
async aztec_utl_getNullifierMembershipWitness([blockHash], [nullifier]) {
|
|
136
|
-
const parsedBlockHash = BlockHash.fromString(blockHash);
|
|
137
|
-
const parsedNullifier = Fr.fromString(nullifier);
|
|
138
|
-
const witness = await this.handlerAsUtility().getNullifierMembershipWitness(parsedBlockHash, parsedNullifier);
|
|
139
|
-
if (!witness) {
|
|
140
|
-
throw new Error(`Nullifier witness not found for nullifier ${parsedNullifier} at block hash ${parsedBlockHash.toString()}.`);
|
|
141
|
-
}
|
|
142
|
-
return witness.toNoirRepresentation();
|
|
143
|
-
}
|
|
144
|
-
// eslint-disable-next-line camelcase
|
|
145
|
-
async aztec_utl_getLowNullifierMembershipWitness([blockHash], [nullifier]) {
|
|
146
|
-
const parsedBlockHash = BlockHash.fromString(blockHash);
|
|
147
|
-
const parsedNullifier = Fr.fromString(nullifier);
|
|
148
|
-
const witness = await this.handlerAsUtility().getLowNullifierMembershipWitness(parsedBlockHash, parsedNullifier);
|
|
149
|
-
if (!witness) {
|
|
150
|
-
throw new Error(`Low nullifier witness not found for nullifier ${parsedNullifier} at block hash ${parsedBlockHash.toString()}.`);
|
|
151
|
-
}
|
|
152
|
-
return witness.toNoirRepresentation();
|
|
153
|
-
}
|
|
154
|
-
// eslint-disable-next-line camelcase
|
|
155
|
-
async aztec_utl_getPublicDataWitness([blockHash], [leafSlot]) {
|
|
156
|
-
const parsedBlockHash = BlockHash.fromString(blockHash);
|
|
157
|
-
const parsedLeafSlot = Fr.fromString(leafSlot);
|
|
158
|
-
const witness = await this.handlerAsUtility().getPublicDataWitness(parsedBlockHash, parsedLeafSlot);
|
|
159
|
-
if (!witness) {
|
|
160
|
-
throw new Error(`Public data witness not found for slot ${parsedLeafSlot} at block hash ${parsedBlockHash.toString()}.`);
|
|
161
|
-
}
|
|
162
|
-
return witness.toNoirRepresentation();
|
|
163
|
-
}
|
|
164
|
-
// eslint-disable-next-line camelcase
|
|
165
|
-
async aztec_utl_getBlockHeader([blockNumber]) {
|
|
166
|
-
const parsedBlockNumber = Fr.fromString(blockNumber).toNumber();
|
|
167
|
-
const header = await this.handlerAsUtility().getBlockHeader(BlockNumber(parsedBlockNumber));
|
|
168
|
-
if (!header) {
|
|
169
|
-
throw new Error(`Block header not found for block ${parsedBlockNumber}.`);
|
|
170
|
-
}
|
|
171
|
-
return header.toFields().map(toACVMField);
|
|
172
|
-
}
|
|
173
|
-
// eslint-disable-next-line camelcase
|
|
174
|
-
async aztec_utl_getAuthWitness([messageHash]) {
|
|
175
|
-
const messageHashField = Fr.fromString(messageHash);
|
|
176
|
-
const witness = await this.handlerAsUtility().getAuthWitness(messageHashField);
|
|
177
|
-
if (!witness) {
|
|
178
|
-
throw new Error(`Unknown auth witness for message hash ${messageHashField}`);
|
|
179
|
-
}
|
|
180
|
-
return [
|
|
181
|
-
witness.map(toACVMField)
|
|
182
|
-
];
|
|
183
|
-
}
|
|
184
|
-
// eslint-disable-next-line camelcase
|
|
185
|
-
async aztec_utl_tryGetPublicKeysAndPartialAddress([address]) {
|
|
186
|
-
const parsedAddress = AztecAddress.fromField(Fr.fromString(address));
|
|
187
|
-
const result = await this.handlerAsUtility().tryGetPublicKeysAndPartialAddress(parsedAddress);
|
|
188
|
-
// We are going to return a Noir Option struct to represent the possibility of null values. Options are a struct
|
|
189
|
-
// with two fields: `some` (a boolean) and `value` (a field array in this case).
|
|
190
|
-
if (result === undefined) {
|
|
191
|
-
// No data was found so we set `some` to 0 and pad `value` with zeros get the correct return size.
|
|
192
|
-
return [
|
|
193
|
-
toACVMField(0),
|
|
194
|
-
Array(13).fill(toACVMField(0))
|
|
195
|
-
];
|
|
196
|
-
} else {
|
|
197
|
-
// Data was found so we set `some` to 1 and return it along with `value`.
|
|
198
|
-
return [
|
|
199
|
-
toACVMField(1),
|
|
200
|
-
[
|
|
201
|
-
...result.publicKeys.toFields(),
|
|
202
|
-
result.partialAddress
|
|
203
|
-
].map(toACVMField)
|
|
204
|
-
];
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
// eslint-disable-next-line camelcase
|
|
208
|
-
async aztec_utl_getNotes([ownerSome], [ownerValue], [storageSlot], [numSelects], selectByIndexes, selectByOffsets, selectByLengths, selectValues, selectComparators, sortByIndexes, sortByOffsets, sortByLengths, sortOrder, [limit], [offset], [status], [maxNotes], [packedHintedNoteLength]) {
|
|
209
|
-
// Parse Option<AztecAddress>: ownerSome is 0 for None, 1 for Some
|
|
210
|
-
const owner = Fr.fromString(ownerSome).toNumber() === 1 ? AztecAddress.fromString(ownerValue) : undefined;
|
|
211
|
-
const noteDatas = await this.handlerAsUtility().getNotes(owner, Fr.fromString(storageSlot), +numSelects, selectByIndexes.map((s)=>+s), selectByOffsets.map((s)=>+s), selectByLengths.map((s)=>+s), selectValues.map(Fr.fromString), selectComparators.map((s)=>+s), sortByIndexes.map((s)=>+s), sortByOffsets.map((s)=>+s), sortByLengths.map((s)=>+s), sortOrder.map((s)=>+s), +limit, +offset, +status);
|
|
212
|
-
const returnDataAsArrayOfPackedHintedNotes = noteDatas.map((noteData)=>packAsHintedNote({
|
|
213
|
-
contractAddress: noteData.contractAddress,
|
|
214
|
-
owner: noteData.owner,
|
|
215
|
-
randomness: noteData.randomness,
|
|
216
|
-
storageSlot: noteData.storageSlot,
|
|
217
|
-
noteNonce: noteData.noteNonce,
|
|
218
|
-
isPending: noteData.isPending,
|
|
219
|
-
note: noteData.note
|
|
220
|
-
}));
|
|
221
|
-
// Now we convert each sub-array to an array of ACVMField
|
|
222
|
-
const returnDataAsArrayOfACVMFieldArrays = returnDataAsArrayOfPackedHintedNotes.map((subArray)=>subArray.map(toACVMField));
|
|
223
|
-
// At last we convert the array of arrays to a bounded vec of arrays
|
|
224
|
-
return arrayOfArraysToBoundedVecOfArrays(returnDataAsArrayOfACVMFieldArrays, +maxNotes, +packedHintedNoteLength);
|
|
225
|
-
}
|
|
226
|
-
// eslint-disable-next-line camelcase
|
|
227
|
-
aztec_prv_notifyCreatedNote([owner], [storageSlot], [randomness], [noteTypeId], note, [noteHash], [counter]) {
|
|
228
|
-
this.handlerAsPrivate().notifyCreatedNote(AztecAddress.fromString(owner), Fr.fromString(storageSlot), Fr.fromString(randomness), NoteSelector.fromField(Fr.fromString(noteTypeId)), note.map(Fr.fromString), Fr.fromString(noteHash), +counter);
|
|
229
|
-
return Promise.resolve([]);
|
|
230
|
-
}
|
|
231
|
-
// eslint-disable-next-line camelcase
|
|
232
|
-
async aztec_prv_notifyNullifiedNote([innerNullifier], [noteHash], [counter]) {
|
|
233
|
-
await this.handlerAsPrivate().notifyNullifiedNote(Fr.fromString(innerNullifier), Fr.fromString(noteHash), +counter);
|
|
234
|
-
return [];
|
|
235
|
-
}
|
|
236
|
-
// eslint-disable-next-line camelcase
|
|
237
|
-
async aztec_prv_notifyCreatedNullifier([innerNullifier]) {
|
|
238
|
-
await this.handlerAsPrivate().notifyCreatedNullifier(Fr.fromString(innerNullifier));
|
|
239
|
-
return [];
|
|
240
|
-
}
|
|
241
|
-
// eslint-disable-next-line camelcase
|
|
242
|
-
async aztec_prv_isNullifierPending([innerNullifier], [contractAddress]) {
|
|
243
|
-
const isPending = await this.handlerAsPrivate().isNullifierPending(Fr.fromString(innerNullifier), AztecAddress.fromString(contractAddress));
|
|
244
|
-
return [
|
|
245
|
-
toACVMField(isPending)
|
|
246
|
-
];
|
|
247
|
-
}
|
|
248
|
-
// eslint-disable-next-line camelcase
|
|
249
|
-
async aztec_utl_checkNullifierExists([innerNullifier]) {
|
|
250
|
-
const exists = await this.handlerAsUtility().checkNullifierExists(Fr.fromString(innerNullifier));
|
|
251
|
-
return [
|
|
252
|
-
toACVMField(exists)
|
|
253
|
-
];
|
|
254
|
-
}
|
|
255
|
-
// eslint-disable-next-line camelcase
|
|
256
|
-
async aztec_utl_getL1ToL2MembershipWitness([contractAddress], [messageHash], [secret]) {
|
|
257
|
-
const message = await this.handlerAsUtility().getL1ToL2MembershipWitness(AztecAddress.fromString(contractAddress), Fr.fromString(messageHash), Fr.fromString(secret));
|
|
258
|
-
return message.toNoirRepresentation();
|
|
259
|
-
}
|
|
260
|
-
// eslint-disable-next-line camelcase
|
|
261
|
-
async aztec_utl_storageRead([blockHash], [contractAddress], [startStorageSlot], [numberOfElements]) {
|
|
262
|
-
const values = await this.handlerAsUtility().storageRead(BlockHash.fromString(blockHash), new AztecAddress(Fr.fromString(contractAddress)), Fr.fromString(startStorageSlot), +numberOfElements);
|
|
263
|
-
return [
|
|
264
|
-
values.map(toACVMField)
|
|
265
|
-
];
|
|
266
|
-
}
|
|
267
|
-
// eslint-disable-next-line camelcase
|
|
268
|
-
aztec_prv_notifyCreatedContractClassLog([contractAddress], message, [length], [counter]) {
|
|
269
|
-
const logFields = new ContractClassLogFields(message.map(Fr.fromString));
|
|
270
|
-
const log = new ContractClassLog(new AztecAddress(Fr.fromString(contractAddress)), logFields, +length);
|
|
271
|
-
this.handlerAsPrivate().notifyCreatedContractClassLog(log, +counter);
|
|
272
|
-
return Promise.resolve([]);
|
|
273
|
-
}
|
|
274
|
-
// eslint-disable-next-line camelcase
|
|
275
|
-
async aztec_utl_log(level, message, _ignoredFieldsSize, fields) {
|
|
276
|
-
const levelFr = Fr.fromString(level[0]);
|
|
277
|
-
const messageStr = message.map((acvmField)=>String.fromCharCode(Fr.fromString(acvmField).toNumber())).join('');
|
|
278
|
-
const fieldsFr = fields.map(Fr.fromString);
|
|
279
|
-
await this.handlerAsMisc().log(levelFr.toNumber(), messageStr, fieldsFr);
|
|
280
|
-
return [];
|
|
281
|
-
}
|
|
282
|
-
// This function's name is directly hardcoded in `circuit_recorder.ts`. Don't forget to update it there if you
|
|
283
|
-
// change the name here.
|
|
284
|
-
// eslint-disable-next-line camelcase
|
|
285
|
-
async aztec_prv_callPrivateFunction([contractAddress], [functionSelector], [argsHash], [sideEffectCounter], [isStaticCall]) {
|
|
286
|
-
const { endSideEffectCounter, returnsHash } = await this.handlerAsPrivate().callPrivateFunction(AztecAddress.fromField(Fr.fromString(contractAddress)), FunctionSelector.fromField(Fr.fromString(functionSelector)), Fr.fromString(argsHash), Fr.fromString(sideEffectCounter).toNumber(), Fr.fromString(isStaticCall).toBool());
|
|
287
|
-
return [
|
|
288
|
-
[
|
|
289
|
-
endSideEffectCounter,
|
|
290
|
-
returnsHash
|
|
291
|
-
].map(toACVMField)
|
|
292
|
-
];
|
|
293
|
-
}
|
|
294
|
-
// eslint-disable-next-line camelcase
|
|
295
|
-
async aztec_prv_notifyEnqueuedPublicFunctionCall([contractAddress], [calldataHash], [sideEffectCounter], [isStaticCall]) {
|
|
296
|
-
await this.handlerAsPrivate().notifyEnqueuedPublicFunctionCall(AztecAddress.fromString(contractAddress), Fr.fromString(calldataHash), Fr.fromString(sideEffectCounter).toNumber(), Fr.fromString(isStaticCall).toBool());
|
|
297
|
-
return [];
|
|
298
|
-
}
|
|
299
|
-
// eslint-disable-next-line camelcase
|
|
300
|
-
async aztec_prv_notifySetPublicTeardownFunctionCall([contractAddress], [calldataHash], [sideEffectCounter], [isStaticCall]) {
|
|
301
|
-
await this.handlerAsPrivate().notifySetPublicTeardownFunctionCall(AztecAddress.fromString(contractAddress), Fr.fromString(calldataHash), Fr.fromString(sideEffectCounter).toNumber(), Fr.fromString(isStaticCall).toBool());
|
|
302
|
-
return [];
|
|
303
|
-
}
|
|
304
|
-
// eslint-disable-next-line camelcase
|
|
305
|
-
async aztec_prv_notifySetMinRevertibleSideEffectCounter([minRevertibleSideEffectCounter]) {
|
|
306
|
-
await this.handlerAsPrivate().notifySetMinRevertibleSideEffectCounter(Fr.fromString(minRevertibleSideEffectCounter).toNumber());
|
|
307
|
-
return Promise.resolve([]);
|
|
308
|
-
}
|
|
309
|
-
// eslint-disable-next-line camelcase
|
|
310
|
-
async aztec_prv_isSideEffectCounterRevertible([sideEffectCounter]) {
|
|
311
|
-
const isRevertible = await this.handlerAsPrivate().isSideEffectCounterRevertible(Fr.fromString(sideEffectCounter).toNumber());
|
|
312
|
-
return Promise.resolve([
|
|
313
|
-
toACVMField(isRevertible)
|
|
314
|
-
]);
|
|
315
|
-
}
|
|
316
|
-
// eslint-disable-next-line camelcase
|
|
317
|
-
async aztec_prv_getNextAppTagAsSender([sender], [recipient]) {
|
|
318
|
-
const tag = await this.handlerAsPrivate().getNextAppTagAsSender(AztecAddress.fromString(sender), AztecAddress.fromString(recipient));
|
|
319
|
-
return [
|
|
320
|
-
toACVMField(tag.value)
|
|
321
|
-
];
|
|
322
|
-
}
|
|
323
|
-
// eslint-disable-next-line camelcase
|
|
324
|
-
async aztec_utl_fetchTaggedLogs([pendingTaggedLogArrayBaseSlot]) {
|
|
325
|
-
await this.handlerAsUtility().fetchTaggedLogs(Fr.fromString(pendingTaggedLogArrayBaseSlot));
|
|
326
|
-
return [];
|
|
327
|
-
}
|
|
328
|
-
// eslint-disable-next-line camelcase
|
|
329
|
-
async aztec_utl_validateAndStoreEnqueuedNotesAndEvents([contractAddress], [noteValidationRequestsArrayBaseSlot], [eventValidationRequestsArrayBaseSlot]) {
|
|
330
|
-
await this.handlerAsUtility().validateAndStoreEnqueuedNotesAndEvents(AztecAddress.fromString(contractAddress), Fr.fromString(noteValidationRequestsArrayBaseSlot), Fr.fromString(eventValidationRequestsArrayBaseSlot));
|
|
331
|
-
return [];
|
|
332
|
-
}
|
|
333
|
-
// eslint-disable-next-line camelcase
|
|
334
|
-
async aztec_utl_bulkRetrieveLogs([contractAddress], [logRetrievalRequestsArrayBaseSlot], [logRetrievalResponsesArrayBaseSlot]) {
|
|
335
|
-
await this.handlerAsUtility().bulkRetrieveLogs(AztecAddress.fromString(contractAddress), Fr.fromString(logRetrievalRequestsArrayBaseSlot), Fr.fromString(logRetrievalResponsesArrayBaseSlot));
|
|
336
|
-
return [];
|
|
337
|
-
}
|
|
338
|
-
// eslint-disable-next-line camelcase
|
|
339
|
-
async aztec_utl_storeCapsule([contractAddress], [slot], capsule) {
|
|
340
|
-
await this.handlerAsUtility().storeCapsule(AztecAddress.fromField(Fr.fromString(contractAddress)), Fr.fromString(slot), capsule.map(Fr.fromString));
|
|
341
|
-
return [];
|
|
342
|
-
}
|
|
343
|
-
// eslint-disable-next-line camelcase
|
|
344
|
-
async aztec_utl_loadCapsule([contractAddress], [slot], [tSize]) {
|
|
345
|
-
const values = await this.handlerAsUtility().loadCapsule(AztecAddress.fromField(Fr.fromString(contractAddress)), Fr.fromString(slot));
|
|
346
|
-
// We are going to return a Noir Option struct to represent the possibility of null values. Options are a struct
|
|
347
|
-
// with two fields: `some` (a boolean) and `value` (a field array in this case).
|
|
348
|
-
if (values === null) {
|
|
349
|
-
// No data was found so we set `some` to 0 and pad `value` with zeros get the correct return size.
|
|
350
|
-
return [
|
|
351
|
-
toACVMField(0),
|
|
352
|
-
Array(Fr.fromString(tSize).toNumber()).fill(toACVMField(0))
|
|
353
|
-
];
|
|
354
|
-
} else {
|
|
355
|
-
// Data was found so we set `some` to 1 and return it along with `value`.
|
|
356
|
-
return [
|
|
357
|
-
toACVMField(1),
|
|
358
|
-
values.map(toACVMField)
|
|
359
|
-
];
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
// eslint-disable-next-line camelcase
|
|
363
|
-
async aztec_utl_deleteCapsule([contractAddress], [slot]) {
|
|
364
|
-
await this.handlerAsUtility().deleteCapsule(AztecAddress.fromField(Fr.fromString(contractAddress)), Fr.fromString(slot));
|
|
365
|
-
return [];
|
|
366
|
-
}
|
|
367
|
-
// eslint-disable-next-line camelcase
|
|
368
|
-
async aztec_utl_copyCapsule([contractAddress], [srcSlot], [dstSlot], [numEntries]) {
|
|
369
|
-
await this.handlerAsUtility().copyCapsule(AztecAddress.fromField(Fr.fromString(contractAddress)), Fr.fromString(srcSlot), Fr.fromString(dstSlot), Fr.fromString(numEntries).toNumber());
|
|
370
|
-
return [];
|
|
371
|
-
}
|
|
372
|
-
// eslint-disable-next-line camelcase
|
|
373
|
-
async aztec_utl_aes128Decrypt(ciphertextBVecStorage, [ciphertextLength], iv, symKey) {
|
|
374
|
-
const ciphertext = fromUintBoundedVec(ciphertextBVecStorage, ciphertextLength, 8);
|
|
375
|
-
const ivBuffer = fromUintArray(iv, 8);
|
|
376
|
-
const symKeyBuffer = fromUintArray(symKey, 8);
|
|
377
|
-
const plaintext = await this.handlerAsUtility().aes128Decrypt(ciphertext, ivBuffer, symKeyBuffer);
|
|
378
|
-
return bufferToBoundedVec(plaintext, ciphertextBVecStorage.length);
|
|
379
|
-
}
|
|
380
|
-
// eslint-disable-next-line camelcase
|
|
381
|
-
async aztec_utl_getSharedSecret([address], [ephPKField0], [ephPKField1], [ephPKField2]) {
|
|
382
|
-
const secret = await this.handlerAsUtility().getSharedSecret(AztecAddress.fromField(Fr.fromString(address)), Point.fromFields([
|
|
383
|
-
ephPKField0,
|
|
384
|
-
ephPKField1,
|
|
385
|
-
ephPKField2
|
|
386
|
-
].map(Fr.fromString)));
|
|
387
|
-
return secret.toFields().map(toACVMField);
|
|
388
|
-
}
|
|
389
|
-
// eslint-disable-next-line camelcase
|
|
390
|
-
async aztec_utl_emitOffchainEffect(data) {
|
|
391
|
-
await this.handlerAsPrivate().emitOffchainEffect(data.map(Fr.fromString));
|
|
392
|
-
return [];
|
|
393
|
-
}
|
|
394
|
-
// eslint-disable-next-line camelcase
|
|
395
|
-
async aztec_prv_getSenderForTags() {
|
|
396
|
-
const sender = await this.handlerAsPrivate().getSenderForTags();
|
|
397
|
-
// Return [1, address] for Some(address), [0, 0] for None
|
|
398
|
-
return sender ? [
|
|
399
|
-
toACVMField(1n),
|
|
400
|
-
toACVMField(sender)
|
|
401
|
-
] : [
|
|
402
|
-
toACVMField(0n),
|
|
403
|
-
toACVMField(0n)
|
|
404
|
-
];
|
|
405
|
-
}
|
|
406
|
-
// eslint-disable-next-line camelcase
|
|
407
|
-
async aztec_prv_setSenderForTags([senderForTags]) {
|
|
408
|
-
await this.handlerAsPrivate().setSenderForTags(AztecAddress.fromField(Fr.fromString(senderForTags)));
|
|
409
|
-
return [];
|
|
410
|
-
}
|
|
411
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { ContractOverrides } from '@aztec/stdlib/tx';
|
|
2
|
-
import type { ContractStore } from '../storage/contract_store/contract_store.js';
|
|
3
|
-
export declare class ProxiedContractStoreFactory {
|
|
4
|
-
static create(contractStore: ContractStore, overrides?: ContractOverrides): ContractStore;
|
|
5
|
-
}
|
|
6
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJveGllZF9jb250cmFjdF9kYXRhX3NvdXJjZS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2NvbnRyYWN0X2Z1bmN0aW9uX3NpbXVsYXRvci9wcm94aWVkX2NvbnRyYWN0X2RhdGFfc291cmNlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUVBLE9BQU8sS0FBSyxFQUFFLGlCQUFpQixFQUFFLE1BQU0sa0JBQWtCLENBQUM7QUFFMUQsT0FBTyxLQUFLLEVBQUUsYUFBYSxFQUFFLE1BQU0sNkNBQTZDLENBQUM7QUFPakYscUJBQWEsMkJBQTJCO0lBQ3RDLE1BQU0sQ0FBQyxNQUFNLENBQUMsYUFBYSxFQUFFLGFBQWEsRUFBRSxTQUFTLENBQUMsRUFBRSxpQkFBaUIsaUJBcUV4RTtDQUNGIn0=
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"proxied_contract_data_source.d.ts","sourceRoot":"","sources":["../../src/contract_function_simulator/proxied_contract_data_source.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAE1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6CAA6C,CAAC;AAOjF,qBAAa,2BAA2B;IACtC,MAAM,CAAC,MAAM,CAAC,aAAa,EAAE,aAAa,EAAE,SAAS,CAAC,EAAE,iBAAiB,iBAqExE;CACF"}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { FunctionSelector } from '@aztec/stdlib/abi';
|
|
2
|
-
/*
|
|
3
|
-
* Proxy generator for a ContractStore that allows overriding contract instances and artifacts, so
|
|
4
|
-
* the contract function simulator can execute different bytecode on certain addresses. An example use case
|
|
5
|
-
* would be overriding your own account contract so that valid signatures don't have to be provided while simulating.
|
|
6
|
-
*/ export class ProxiedContractStoreFactory {
|
|
7
|
-
static create(contractStore, overrides) {
|
|
8
|
-
if (!overrides) {
|
|
9
|
-
return contractStore;
|
|
10
|
-
}
|
|
11
|
-
return new Proxy(contractStore, {
|
|
12
|
-
get (target, prop) {
|
|
13
|
-
switch(prop){
|
|
14
|
-
case 'getContractInstance':
|
|
15
|
-
{
|
|
16
|
-
return async (address)=>{
|
|
17
|
-
if (overrides[address.toString()]) {
|
|
18
|
-
const { instance } = overrides[address.toString()];
|
|
19
|
-
instance.address = address;
|
|
20
|
-
const realInstance = await target.getContractInstance(address);
|
|
21
|
-
if (!realInstance) {
|
|
22
|
-
throw new Error(`Contract instance not found for address: ${address}`);
|
|
23
|
-
}
|
|
24
|
-
instance.currentContractClassId = realInstance.currentContractClassId;
|
|
25
|
-
instance.originalContractClassId = realInstance.originalContractClassId;
|
|
26
|
-
return instance;
|
|
27
|
-
} else {
|
|
28
|
-
return target.getContractInstance(address);
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
case 'getFunctionArtifact':
|
|
33
|
-
{
|
|
34
|
-
return async (contractAddress, selector)=>{
|
|
35
|
-
if (overrides[contractAddress.toString()]) {
|
|
36
|
-
const { artifact } = overrides[contractAddress.toString()];
|
|
37
|
-
const functions = artifact.functions;
|
|
38
|
-
for(let i = 0; i < functions.length; i++){
|
|
39
|
-
const fn = functions[i];
|
|
40
|
-
const fnSelector = await FunctionSelector.fromNameAndParameters(fn.name, fn.parameters);
|
|
41
|
-
if (fnSelector.equals(selector)) {
|
|
42
|
-
return fn;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
} else {
|
|
46
|
-
return target.getFunctionArtifact(contractAddress, selector);
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
case 'getFunctionArtifactWithDebugMetadata':
|
|
51
|
-
{
|
|
52
|
-
return async (contractAddress, selector)=>{
|
|
53
|
-
if (overrides[contractAddress.toString()]) {
|
|
54
|
-
const { artifact } = overrides[contractAddress.toString()];
|
|
55
|
-
const functions = artifact.functions;
|
|
56
|
-
for(let i = 0; i < functions.length; i++){
|
|
57
|
-
const fn = functions[i];
|
|
58
|
-
const fnSelector = await FunctionSelector.fromNameAndParameters(fn.name, fn.parameters);
|
|
59
|
-
if (fnSelector.equals(selector)) {
|
|
60
|
-
return fn;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
} else {
|
|
64
|
-
return target.getFunctionArtifactWithDebugMetadata(contractAddress, selector);
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
default:
|
|
69
|
-
{
|
|
70
|
-
const value = Reflect.get(target, prop);
|
|
71
|
-
if (typeof value === 'function') {
|
|
72
|
-
return value.bind(target);
|
|
73
|
-
}
|
|
74
|
-
return value;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import type { Logger } from '@aztec/foundation/log';
|
|
2
|
-
import type { FunctionCall, FunctionSelector } from '@aztec/stdlib/abi';
|
|
3
|
-
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
|
-
import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
5
|
-
import type { BlockHeader } from '@aztec/stdlib/tx';
|
|
6
|
-
import type { AccessScopes } from '../access_scopes.js';
|
|
7
|
-
import type { StagedStore } from '../job_coordinator/job_coordinator.js';
|
|
8
|
-
import type { ContractStore } from '../storage/contract_store/contract_store.js';
|
|
9
|
-
import type { NoteStore } from '../storage/note_store/note_store.js';
|
|
10
|
-
/**
|
|
11
|
-
* Service for syncing the private state of contracts and verifying that the PXE holds the current class artifact.
|
|
12
|
-
* It uses a cache to avoid redundant sync operations - the cache is wiped when the anchor block changes.
|
|
13
|
-
*
|
|
14
|
-
* TODO: The StagedStore naming is broken here. Figure out a better name.
|
|
15
|
-
*/
|
|
16
|
-
export declare class ContractSyncService implements StagedStore {
|
|
17
|
-
#private;
|
|
18
|
-
private aztecNode;
|
|
19
|
-
private contractStore;
|
|
20
|
-
private noteStore;
|
|
21
|
-
private log;
|
|
22
|
-
readonly storeName = "contract_sync";
|
|
23
|
-
private syncedContracts;
|
|
24
|
-
private overriddenContracts;
|
|
25
|
-
constructor(aztecNode: AztecNode, contractStore: ContractStore, noteStore: NoteStore, log: Logger);
|
|
26
|
-
/** Sets contracts that should be skipped during sync for a specific job. */
|
|
27
|
-
setOverriddenContracts(jobId: string, addresses: Set<string>): void;
|
|
28
|
-
/**
|
|
29
|
-
* Ensures a contract's private state is synchronized and that the PXE holds the current class artifact.
|
|
30
|
-
* Uses a cache to avoid redundant sync operations - the cache is wiped when the anchor block changes.
|
|
31
|
-
* @param contractAddress - The address of the contract to sync.
|
|
32
|
-
* @param functionToInvokeAfterSync - The function selector that will be called after sync (used to validate it's
|
|
33
|
-
* not sync_state itself).
|
|
34
|
-
* @param utilityExecutor - Executor function for running the sync_state utility function.
|
|
35
|
-
* @param scopes - Access scopes to pass through to the utility executor (affects whose account's private state is discovered).
|
|
36
|
-
*/
|
|
37
|
-
ensureContractSynced(contractAddress: AztecAddress, functionToInvokeAfterSync: FunctionSelector | null, utilityExecutor: (call: FunctionCall, scopes: AccessScopes) => Promise<any>, anchorBlockHeader: BlockHeader, jobId: string, scopes: AccessScopes): Promise<void>;
|
|
38
|
-
/** Clears sync cache. Called by BlockSynchronizer when anchor block changes. */
|
|
39
|
-
wipe(): void;
|
|
40
|
-
commit(jobId: string): Promise<void>;
|
|
41
|
-
discardStaged(jobId: string): Promise<void>;
|
|
42
|
-
}
|
|
43
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29udHJhY3Rfc3luY19zZXJ2aWNlLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvY29udHJhY3Rfc3luYy9jb250cmFjdF9zeW5jX3NlcnZpY2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLEVBQUUsTUFBTSxFQUFFLE1BQU0sdUJBQXVCLENBQUM7QUFDcEQsT0FBTyxLQUFLLEVBQUUsWUFBWSxFQUFFLGdCQUFnQixFQUFFLE1BQU0sbUJBQW1CLENBQUM7QUFDeEUsT0FBTyxLQUFLLEVBQUUsWUFBWSxFQUFFLE1BQU0sNkJBQTZCLENBQUM7QUFDaEUsT0FBTyxLQUFLLEVBQUUsU0FBUyxFQUFFLE1BQU0saUNBQWlDLENBQUM7QUFDakUsT0FBTyxLQUFLLEVBQUUsV0FBVyxFQUFFLE1BQU0sa0JBQWtCLENBQUM7QUFFcEQsT0FBTyxLQUFLLEVBQUUsWUFBWSxFQUFFLE1BQU0scUJBQXFCLENBQUM7QUFDeEQsT0FBTyxLQUFLLEVBQUUsV0FBVyxFQUFFLE1BQU0sdUNBQXVDLENBQUM7QUFDekUsT0FBTyxLQUFLLEVBQUUsYUFBYSxFQUFFLE1BQU0sNkNBQTZDLENBQUM7QUFDakYsT0FBTyxLQUFLLEVBQUUsU0FBUyxFQUFFLE1BQU0scUNBQXFDLENBQUM7QUFHckU7Ozs7O0dBS0c7QUFDSCxxQkFBYSxtQkFBb0IsWUFBVyxXQUFXOztJQVluRCxPQUFPLENBQUMsU0FBUztJQUNqQixPQUFPLENBQUMsYUFBYTtJQUNyQixPQUFPLENBQUMsU0FBUztJQUNqQixPQUFPLENBQUMsR0FBRztJQWRiLFFBQVEsQ0FBQyxTQUFTLG1CQUFtQjtJQUtyQyxPQUFPLENBQUMsZUFBZSxDQUF5QztJQUdoRSxPQUFPLENBQUMsbUJBQW1CLENBQXVDO0lBRWxFLFlBQ1UsU0FBUyxFQUFFLFNBQVMsRUFDcEIsYUFBYSxFQUFFLGFBQWEsRUFDNUIsU0FBUyxFQUFFLFNBQVMsRUFDcEIsR0FBRyxFQUFFLE1BQU0sRUFDakI7SUFFSiw0RUFBNEU7SUFDNUUsc0JBQXNCLENBQUMsS0FBSyxFQUFFLE1BQU0sRUFBRSxTQUFTLEVBQUUsR0FBRyxDQUFDLE1BQU0sQ0FBQyxHQUFHLElBQUksQ0FFbEU7SUFFRDs7Ozs7Ozs7T0FRRztJQUNHLG9CQUFvQixDQUN4QixlQUFlLEVBQUUsWUFBWSxFQUM3Qix5QkFBeUIsRUFBRSxnQkFBZ0IsR0FBRyxJQUFJLEVBQ2xELGVBQWUsRUFBRSxDQUFDLElBQUksRUFBRSxZQUFZLEVBQUUsTUFBTSxFQUFFLFlBQVksS0FBSyxPQUFPLENBQUMsR0FBRyxDQUFDLEVBQzNFLGlCQUFpQixFQUFFLFdBQVcsRUFDOUIsS0FBSyxFQUFFLE1BQU0sRUFDYixNQUFNLEVBQUUsWUFBWSxHQUNuQixPQUFPLENBQUMsSUFBSSxDQUFDLENBdUNmO0lBNEJELGdGQUFnRjtJQUNoRixJQUFJLElBQUksSUFBSSxDQUdYO0lBRUQsTUFBTSxDQUFDLEtBQUssRUFBRSxNQUFNLEdBQUcsT0FBTyxDQUFDLElBQUksQ0FBQyxDQUluQztJQUVELGFBQWEsQ0FBQyxLQUFLLEVBQUUsTUFBTSxHQUFHLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FNMUM7Q0FDRiJ9
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"contract_sync_service.d.ts","sourceRoot":"","sources":["../../src/contract_sync/contract_sync_service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACxE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AACzE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6CAA6C,CAAC;AACjF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qCAAqC,CAAC;AAGrE;;;;;GAKG;AACH,qBAAa,mBAAoB,YAAW,WAAW;;IAYnD,OAAO,CAAC,SAAS;IACjB,OAAO,CAAC,aAAa;IACrB,OAAO,CAAC,SAAS;IACjB,OAAO,CAAC,GAAG;IAdb,QAAQ,CAAC,SAAS,mBAAmB;IAKrC,OAAO,CAAC,eAAe,CAAyC;IAGhE,OAAO,CAAC,mBAAmB,CAAuC;IAElE,YACU,SAAS,EAAE,SAAS,EACpB,aAAa,EAAE,aAAa,EAC5B,SAAS,EAAE,SAAS,EACpB,GAAG,EAAE,MAAM,EACjB;IAEJ,4EAA4E;IAC5E,sBAAsB,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,IAAI,CAElE;IAED;;;;;;;;OAQG;IACG,oBAAoB,CACxB,eAAe,EAAE,YAAY,EAC7B,yBAAyB,EAAE,gBAAgB,GAAG,IAAI,EAClD,eAAe,EAAE,CAAC,IAAI,EAAE,YAAY,EAAE,MAAM,EAAE,YAAY,KAAK,OAAO,CAAC,GAAG,CAAC,EAC3E,iBAAiB,EAAE,WAAW,EAC9B,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,YAAY,GACnB,OAAO,CAAC,IAAI,CAAC,CAuCf;IA4BD,gFAAgF;IAChF,IAAI,IAAI,IAAI,CAGX;IAED,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAInC;IAED,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAM1C;CACF"}
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import { syncState, verifyCurrentClassId } from './helpers.js';
|
|
2
|
-
/**
|
|
3
|
-
* Service for syncing the private state of contracts and verifying that the PXE holds the current class artifact.
|
|
4
|
-
* It uses a cache to avoid redundant sync operations - the cache is wiped when the anchor block changes.
|
|
5
|
-
*
|
|
6
|
-
* TODO: The StagedStore naming is broken here. Figure out a better name.
|
|
7
|
-
*/ export class ContractSyncService {
|
|
8
|
-
aztecNode;
|
|
9
|
-
contractStore;
|
|
10
|
-
noteStore;
|
|
11
|
-
log;
|
|
12
|
-
storeName;
|
|
13
|
-
// Tracks contracts synced since last wipe. The cache is keyed per individual scope address
|
|
14
|
-
// (`contractAddress:scopeAddress`), or `contractAddress:*` for undefined scopes (all accounts).
|
|
15
|
-
// The value is a promise that resolves when the contract is synced.
|
|
16
|
-
syncedContracts;
|
|
17
|
-
// Per-job overridden contract addresses - these contracts should not be synced.
|
|
18
|
-
overriddenContracts;
|
|
19
|
-
constructor(aztecNode, contractStore, noteStore, log){
|
|
20
|
-
this.aztecNode = aztecNode;
|
|
21
|
-
this.contractStore = contractStore;
|
|
22
|
-
this.noteStore = noteStore;
|
|
23
|
-
this.log = log;
|
|
24
|
-
this.storeName = 'contract_sync';
|
|
25
|
-
this.syncedContracts = new Map();
|
|
26
|
-
this.overriddenContracts = new Map();
|
|
27
|
-
}
|
|
28
|
-
/** Sets contracts that should be skipped during sync for a specific job. */ setOverriddenContracts(jobId, addresses) {
|
|
29
|
-
this.overriddenContracts.set(jobId, addresses);
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Ensures a contract's private state is synchronized and that the PXE holds the current class artifact.
|
|
33
|
-
* Uses a cache to avoid redundant sync operations - the cache is wiped when the anchor block changes.
|
|
34
|
-
* @param contractAddress - The address of the contract to sync.
|
|
35
|
-
* @param functionToInvokeAfterSync - The function selector that will be called after sync (used to validate it's
|
|
36
|
-
* not sync_state itself).
|
|
37
|
-
* @param utilityExecutor - Executor function for running the sync_state utility function.
|
|
38
|
-
* @param scopes - Access scopes to pass through to the utility executor (affects whose account's private state is discovered).
|
|
39
|
-
*/ async ensureContractSynced(contractAddress, functionToInvokeAfterSync, utilityExecutor, anchorBlockHeader, jobId, scopes) {
|
|
40
|
-
// Skip sync if this contract has an override for this job (overrides are keyed by contract address only)
|
|
41
|
-
const overrides = this.overriddenContracts.get(jobId);
|
|
42
|
-
if (overrides?.has(contractAddress.toString())) {
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
// Skip sync if we already synced for "all scopes", or if we have an empty list of scopes
|
|
46
|
-
const allScopesKey = toKey(contractAddress, 'ALL_SCOPES');
|
|
47
|
-
const allScopesExisting = this.syncedContracts.get(allScopesKey);
|
|
48
|
-
if (allScopesExisting || scopes !== 'ALL_SCOPES' && scopes.length == 0) {
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
const unsyncedScopes = scopes === 'ALL_SCOPES' ? scopes : scopes.filter((scope)=>!this.syncedContracts.has(toKey(contractAddress, scope)));
|
|
52
|
-
const unsyncedScopesKeys = toKeys(contractAddress, unsyncedScopes);
|
|
53
|
-
if (unsyncedScopesKeys.length > 0) {
|
|
54
|
-
// Start sync and store the promise for all unsynced scopes
|
|
55
|
-
const promise = this.#doSync(contractAddress, functionToInvokeAfterSync, utilityExecutor, anchorBlockHeader, jobId, unsyncedScopes).catch((err)=>{
|
|
56
|
-
// There was an error syncing the contract, so we remove it from the cache so that it can be retried.
|
|
57
|
-
unsyncedScopesKeys.forEach((key)=>this.syncedContracts.delete(key));
|
|
58
|
-
throw err;
|
|
59
|
-
});
|
|
60
|
-
unsyncedScopesKeys.forEach((key)=>this.syncedContracts.set(key, promise));
|
|
61
|
-
}
|
|
62
|
-
const promises = toKeys(contractAddress, scopes).map((key)=>this.syncedContracts.get(key));
|
|
63
|
-
await Promise.all(promises);
|
|
64
|
-
}
|
|
65
|
-
async #doSync(contractAddress, functionToInvokeAfterSync, utilityExecutor, anchorBlockHeader, jobId, scopes) {
|
|
66
|
-
this.log.debug(`Syncing contract ${contractAddress}`);
|
|
67
|
-
await Promise.all([
|
|
68
|
-
syncState(contractAddress, this.contractStore, functionToInvokeAfterSync, utilityExecutor, this.noteStore, this.aztecNode, anchorBlockHeader, jobId, scopes),
|
|
69
|
-
verifyCurrentClassId(contractAddress, this.aztecNode, this.contractStore, anchorBlockHeader)
|
|
70
|
-
]);
|
|
71
|
-
this.log.debug(`Contract ${contractAddress} synced`);
|
|
72
|
-
}
|
|
73
|
-
/** Clears sync cache. Called by BlockSynchronizer when anchor block changes. */ wipe() {
|
|
74
|
-
this.log.debug(`Wiping contract sync cache (${this.syncedContracts.size} entries)`);
|
|
75
|
-
this.syncedContracts.clear();
|
|
76
|
-
}
|
|
77
|
-
commit(jobId) {
|
|
78
|
-
// Clear overridden contracts for this job
|
|
79
|
-
this.overriddenContracts.delete(jobId);
|
|
80
|
-
return Promise.resolve();
|
|
81
|
-
}
|
|
82
|
-
discardStaged(jobId) {
|
|
83
|
-
// We clear the synced contracts cache here because, when the job is discarded, any associated database writes from
|
|
84
|
-
// the sync are also undone.
|
|
85
|
-
this.syncedContracts.clear();
|
|
86
|
-
this.overriddenContracts.delete(jobId);
|
|
87
|
-
return Promise.resolve();
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
function toKeys(contract, scopes) {
|
|
91
|
-
return scopes === 'ALL_SCOPES' ? [
|
|
92
|
-
toKey(contract, scopes)
|
|
93
|
-
] : scopes.map((scope)=>toKey(contract, scope));
|
|
94
|
-
}
|
|
95
|
-
function toKey(contract, scope) {
|
|
96
|
-
return scope === 'ALL_SCOPES' ? `${contract.toString()}:*` : `${contract.toString()}:${scope.toString()}`;
|
|
97
|
-
}
|