@aztec/pxe 0.0.1-commit.b9865e97 → 0.0.1-commit.be03c316
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 +8 -23
- package/dest/bin/index.d.ts +2 -2
- package/dest/bin/index.d.ts.map +1 -1
- package/dest/bin/index.js +1 -1
- package/dest/bin/oracle_version_helpers.d.ts +16 -8
- package/dest/bin/oracle_version_helpers.d.ts.map +1 -1
- package/dest/bin/oracle_version_helpers.js +22 -69
- package/dest/block_synchronizer/block_stream_source.d.ts +5 -5
- package/dest/block_synchronizer/block_stream_source.d.ts.map +1 -1
- package/dest/block_synchronizer/block_stream_source.js +4 -29
- package/dest/block_synchronizer/block_synchronizer.d.ts +18 -14
- package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -1
- package/dest/block_synchronizer/block_synchronizer.js +54 -18
- package/dest/config/index.d.ts +2 -1
- package/dest/config/index.d.ts.map +1 -1
- package/dest/config/index.js +1 -0
- 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_sync → contract}/contract_sync_service.js +26 -45
- 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/aztec_node_read_cache.d.ts +39 -0
- package/dest/contract_function_simulator/aztec_node_read_cache.d.ts.map +1 -0
- package/dest/contract_function_simulator/aztec_node_read_cache.js +60 -0
- package/dest/contract_function_simulator/contract_function_simulator.d.ts +19 -18
- package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.js +63 -32
- package/dest/contract_function_simulator/execution_note_cache.d.ts +3 -9
- 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/index.d.ts +19 -10
- package/dest/contract_function_simulator/index.d.ts.map +1 -1
- package/dest/contract_function_simulator/index.js +6 -9
- package/dest/contract_function_simulator/noir-structs/bounded_vec.d.ts +8 -27
- package/dest/contract_function_simulator/noir-structs/bounded_vec.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/bounded_vec.js +8 -23
- 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/event_validation_request.js +1 -1
- 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 +11 -12
- 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 +6 -49
- package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts +10 -8
- package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/log_retrieval_response.js +1 -60
- package/dest/contract_function_simulator/noir-structs/note_validation_request.js +2 -2
- package/dest/contract_function_simulator/noir-structs/option.d.ts +9 -11
- package/dest/contract_function_simulator/noir-structs/option.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/option.js +18 -13
- 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 +6 -9
- package/dest/contract_function_simulator/noir-structs/provided_secret.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/provided_secret.js +1 -24
- 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 +2 -3
- package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -1
- 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/oracle_registry.d.ts +43 -31
- package/dest/contract_function_simulator/oracle/oracle_registry.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/oracle_registry.js +259 -29
- package/dest/contract_function_simulator/oracle/oracle_type_mappings.d.ts +180 -45
- package/dest/contract_function_simulator/oracle/oracle_type_mappings.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/oracle_type_mappings.js +1024 -341
- 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 +2 -3
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +21 -8
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.js +132 -22
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +77 -34
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +247 -106
- 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/debug/pxe_debug_utils.d.ts +2 -2
- package/dest/debug/pxe_debug_utils.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/index.d.ts +2 -1
- package/dest/entrypoints/client/bundle/index.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/index.js +1 -0
- package/dest/entrypoints/client/bundle/utils.d.ts +1 -1
- package/dest/entrypoints/client/bundle/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/utils.js +17 -6
- package/dest/entrypoints/client/lazy/index.d.ts +2 -1
- package/dest/entrypoints/client/lazy/index.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/index.js +1 -0
- package/dest/entrypoints/client/lazy/utils.d.ts +1 -1
- package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/utils.js +17 -6
- 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 +9 -3
- package/dest/entrypoints/pxe_creation_options.d.ts.map +1 -1
- package/dest/entrypoints/server/index.d.ts +6 -3
- package/dest/entrypoints/server/index.d.ts.map +1 -1
- package/dest/entrypoints/server/index.js +4 -2
- 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 +1 -1
- package/dest/entrypoints/server/utils.d.ts.map +1 -1
- package/dest/entrypoints/server/utils.js +16 -4
- 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/hooks/execution_hooks.d.ts +31 -11
- package/dest/hooks/execution_hooks.d.ts.map +1 -1
- package/dest/hooks/execution_hooks.js +3 -3
- package/dest/hooks/index.d.ts +4 -3
- package/dest/hooks/index.d.ts.map +1 -1
- 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 +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 +8 -6
- package/dest/logs/log_service.d.ts.map +1 -1
- package/dest/logs/log_service.js +88 -28
- package/dest/messages/tx_resolver_service.d.ts +17 -0
- package/dest/messages/tx_resolver_service.d.ts.map +1 -0
- package/dest/messages/{message_context_service.js → tx_resolver_service.js} +13 -8
- package/dest/notes/note_service.d.ts +1 -1
- package/dest/notes/note_service.js +1 -1
- package/dest/oracle_version.d.ts +3 -3
- package/dest/oracle_version.js +5 -5
- package/dest/private_kernel/batch_planner.d.ts +1 -1
- package/dest/private_kernel/batch_planner.d.ts.map +1 -1
- package/dest/private_kernel/batch_planner.js +1 -1
- 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 +6 -2
- package/dest/private_kernel/hints/test_utils.js +1 -1
- package/dest/private_kernel/private_kernel_execution_prover.d.ts +1 -1
- package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_execution_prover.js +61 -40
- package/dest/private_kernel/private_kernel_oracle.d.ts +4 -2
- package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_oracle.js +17 -5
- package/dest/pxe.d.ts +114 -48
- package/dest/pxe.d.ts.map +1 -1
- package/dest/pxe.js +225 -139
- 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 +8 -6
- package/dest/storage/backwards_compatibility_tests/schema_tests.d.ts +1 -1
- package/dest/storage/backwards_compatibility_tests/schema_tests.d.ts.map +1 -1
- package/dest/storage/backwards_compatibility_tests/schema_tests.js +129 -49
- package/dest/storage/capsule_store/capsule_service.d.ts +1 -1
- package/dest/storage/capsule_store/capsule_service.d.ts.map +1 -1
- package/dest/storage/capsule_store/capsule_service.js +6 -9
- 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 +64 -75
- package/dest/storage/fact_store/fact_service.d.ts +22 -0
- package/dest/storage/fact_store/fact_service.d.ts.map +1 -0
- package/dest/storage/fact_store/fact_service.js +45 -0
- package/dest/storage/fact_store/fact_store.d.ts +95 -0
- package/dest/storage/fact_store/fact_store.d.ts.map +1 -0
- package/dest/storage/fact_store/fact_store.js +408 -0
- package/dest/storage/fact_store/fact_store_keys.d.ts +34 -0
- package/dest/storage/fact_store/fact_store_keys.d.ts.map +1 -0
- package/dest/storage/fact_store/fact_store_keys.js +50 -0
- package/dest/storage/fact_store/index.d.ts +6 -0
- package/dest/storage/fact_store/index.d.ts.map +1 -0
- package/dest/storage/fact_store/index.js +4 -0
- package/dest/storage/fact_store/origin_state.d.ts +59 -0
- package/dest/storage/fact_store/origin_state.d.ts.map +1 -0
- package/dest/storage/fact_store/origin_state.js +60 -0
- package/dest/storage/fact_store/stored_fact.d.ts +32 -0
- package/dest/storage/fact_store/stored_fact.d.ts.map +1 -0
- package/dest/storage/fact_store/stored_fact.js +64 -0
- package/dest/storage/index.d.ts +3 -2
- package/dest/storage/index.d.ts.map +1 -1
- package/dest/storage/index.js +2 -1
- package/dest/storage/metadata.d.ts +2 -2
- package/dest/storage/metadata.d.ts.map +1 -1
- package/dest/storage/metadata.js +1 -1
- package/dest/storage/note_store/note_store.d.ts +42 -33
- package/dest/storage/note_store/note_store.d.ts.map +1 -1
- package/dest/storage/note_store/note_store.js +197 -168
- 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 +5 -3
- package/dest/storage/open_pxe_stores.d.ts.map +1 -1
- package/dest/storage/open_pxe_stores.js +5 -3
- 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 +40 -43
- 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/sender_tagging_store.d.ts +19 -3
- package/dest/storage/tagging_store/sender_tagging_store.d.ts.map +1 -1
- package/dest/storage/tagging_store/sender_tagging_store.js +48 -11
- 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 +3 -2
- package/dest/tagging/constants.d.ts.map +1 -1
- package/dest/tagging/constants.js +28 -10
- package/dest/tagging/index.d.ts +2 -2
- package/dest/tagging/index.d.ts.map +1 -1
- package/dest/tagging/index.js +1 -1
- package/dest/tagging/recipient_sync/sync_tagged_private_logs.d.ts +26 -8
- package/dest/tagging/recipient_sync/sync_tagged_private_logs.d.ts.map +1 -1
- package/dest/tagging/recipient_sync/sync_tagged_private_logs.js +95 -20
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.js +1 -1
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts +1 -1
- 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 +6 -2
- 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 +17 -17
- package/src/bin/check_oracle_version.ts +8 -24
- package/src/bin/index.ts +1 -1
- package/src/bin/oracle_version_helpers.ts +23 -90
- package/src/block_synchronizer/block_stream_source.ts +6 -45
- package/src/block_synchronizer/block_synchronizer.ts +70 -29
- package/src/config/index.ts +1 -0
- package/src/contract/contract_class_service.ts +83 -0
- package/src/{contract_sync → contract}/contract_sync_service.ts +37 -50
- 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/aztec_node_read_cache.ts +89 -0
- package/src/contract_function_simulator/contract_function_simulator.ts +96 -42
- package/src/contract_function_simulator/execution_note_cache.ts +7 -28
- package/src/contract_function_simulator/index.ts +48 -13
- package/src/contract_function_simulator/noir-structs/bounded_vec.ts +12 -24
- 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/event_validation_request.ts +1 -1
- 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 +20 -46
- package/src/contract_function_simulator/noir-structs/log_retrieval_response.ts +13 -60
- package/src/contract_function_simulator/noir-structs/note_validation_request.ts +2 -2
- package/src/contract_function_simulator/noir-structs/option.ts +17 -11
- 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 +4 -26
- 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 +1 -2
- 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/oracle_registry.ts +172 -47
- package/src/contract_function_simulator/oracle/oracle_type_mappings.ts +814 -315
- package/src/contract_function_simulator/oracle/private_execution.ts +2 -3
- package/src/contract_function_simulator/oracle/private_execution_oracle.ts +167 -30
- package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +399 -135
- package/src/contract_function_simulator/transient_array_service.ts +91 -0
- package/src/debug/pxe_debug_utils.ts +1 -1
- package/src/entrypoints/client/bundle/index.ts +1 -0
- package/src/entrypoints/client/bundle/utils.ts +24 -5
- package/src/entrypoints/client/lazy/index.ts +1 -0
- package/src/entrypoints/client/lazy/utils.ts +24 -5
- package/src/entrypoints/client/store.ts +54 -0
- package/src/entrypoints/pxe_creation_options.ts +8 -2
- package/src/entrypoints/server/index.ts +6 -2
- package/src/entrypoints/server/store.ts +47 -0
- package/src/entrypoints/server/utils.ts +31 -9
- package/src/error_enriching.ts +27 -11
- package/src/hooks/execution_hooks.ts +32 -12
- package/src/hooks/index.ts +8 -2
- 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 +100 -37
- package/src/messages/{message_context_service.ts → tx_resolver_service.ts} +16 -9
- package/src/notes/note_service.ts +1 -1
- package/src/oracle_version.ts +5 -5
- package/src/private_kernel/batch_planner.ts +0 -1
- package/src/private_kernel/hints/private_kernel_reset_private_inputs_builder.ts +11 -1
- package/src/private_kernel/hints/test_utils.ts +1 -1
- package/src/private_kernel/private_kernel_execution_prover.ts +112 -56
- package/src/private_kernel/private_kernel_oracle.ts +23 -4
- package/src/pxe.ts +328 -159
- package/src/storage/allowed_scopes.ts +14 -0
- package/src/storage/anchor_block_store/anchor_block_store.ts +8 -6
- package/src/storage/backwards_compatibility_tests/__snapshots__/AddressStore.json +6 -6
- package/src/storage/backwards_compatibility_tests/__snapshots__/ContractStore.json +1 -1
- package/src/storage/backwards_compatibility_tests/__snapshots__/FactStore.json +40 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/KeyStore.json +12 -12
- package/src/storage/backwards_compatibility_tests/__snapshots__/L2TipsKVStore.json +9 -15
- package/src/storage/backwards_compatibility_tests/__snapshots__/NoteStore.json +24 -4
- package/src/storage/backwards_compatibility_tests/__snapshots__/RecipientTaggingStore.json +11 -3
- package/src/storage/backwards_compatibility_tests/__snapshots__/SenderTaggingStore.json +12 -4
- package/src/storage/backwards_compatibility_tests/__snapshots__/TaggingSecretSourcesStore.json +30 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/opened_stores.json +29 -9
- package/src/storage/backwards_compatibility_tests/schema_tests.ts +141 -50
- package/src/storage/capsule_store/capsule_service.ts +8 -13
- package/src/storage/contract_store/contract_store.ts +86 -93
- package/src/storage/fact_store/fact_service.ts +69 -0
- package/src/storage/fact_store/fact_store.ts +487 -0
- package/src/storage/fact_store/fact_store_keys.ts +75 -0
- package/src/storage/fact_store/index.ts +15 -0
- package/src/storage/fact_store/origin_state.ts +84 -0
- package/src/storage/fact_store/stored_fact.ts +80 -0
- package/src/storage/index.ts +2 -1
- package/src/storage/metadata.ts +1 -1
- package/src/storage/note_store/note_store.ts +226 -187
- package/src/storage/note_store/stored_note.ts +5 -27
- package/src/storage/open_pxe_stores.ts +6 -3
- package/src/storage/private_event_store/private_event_store.ts +49 -55
- package/src/storage/store_identity.ts +72 -0
- package/src/storage/tagging_store/index.ts +1 -1
- package/src/storage/tagging_store/sender_tagging_store.ts +62 -15
- package/src/storage/tagging_store/tagging_secret_sources_store.ts +138 -0
- package/src/tagging/constants.ts +30 -10
- package/src/tagging/index.ts +1 -1
- package/src/tagging/recipient_sync/sync_tagged_private_logs.ts +148 -30
- package/src/tagging/sender_sync/sync_sender_tagging_indexes.ts +1 -1
- package/src/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.ts +6 -2
- package/src/tagging/testing/tag_query_test_utils.ts +11 -0
- package/dest/contract_function_simulator/oracle/oracle.d.ts +0 -89
- package/dest/contract_function_simulator/oracle/oracle.d.ts.map +0 -1
- package/dest/contract_function_simulator/oracle/oracle.js +0 -552
- 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 -51
- package/dest/contract_sync/contract_sync_service.d.ts +0 -42
- package/dest/contract_sync/contract_sync_service.d.ts.map +0 -1
- package/dest/contract_sync/helpers.d.ts +0 -27
- package/dest/contract_sync/helpers.d.ts.map +0 -1
- package/dest/contract_sync/helpers.js +0 -53
- package/dest/messages/message_context_service.d.ts +0 -17
- package/dest/messages/message_context_service.d.ts.map +0 -1
- 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/src/contract_function_simulator/oracle/oracle.ts +0 -711
- package/src/contract_function_simulator/proxied_contract_data_source.ts +0 -60
- package/src/contract_sync/helpers.ts +0 -86
- package/src/storage/backwards_compatibility_tests/__snapshots__/SenderAddressBookStore.json +0 -16
- package/src/storage/tagging_store/sender_address_book_store.ts +0 -48
|
@@ -1,10 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
//
|
|
3
|
-
//
|
|
4
|
-
//
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
//
|
|
9
|
-
//
|
|
10
|
-
|
|
1
|
+
import { MAX_PRIVATE_LOGS_PER_TX } from '@aztec/constants';
|
|
2
|
+
// This window bounds how far a sender's next tag index for a directional app tagging secret can run ahead of that
|
|
3
|
+
// secret's highest finalized index before `PXE::proveTx` throws.
|
|
4
|
+
//
|
|
5
|
+
// MAX_PRIVATE_LOGS_PER_TX is a floor for ordinary transaction patterns: the private kernel accumulates every
|
|
6
|
+
// surviving private log into a single tx-wide array of exactly this size, so a fresh secret's very first
|
|
7
|
+
// ordinary tx can consume that many indexes before anything is finalized.
|
|
8
|
+
//
|
|
9
|
+
// The +20 on top is headroom for multiple pending ordinary txs to the same counterparty stacking up
|
|
10
|
+
// before the first one is observed as mined. Only a run of near-MAX_PRIVATE_LOGS_PER_TX txs back-to-back would
|
|
11
|
+
// exhaust this; ordinary transfers use far fewer logs per tx, so the same margin covers many more of those. Keep the
|
|
12
|
+
// margin additive rather than another multiple of the floor. A larger window also makes recipient-side sync more
|
|
13
|
+
// expensive, since discovery has to probe ahead of the last finalized index for every active secret.
|
|
14
|
+
//
|
|
15
|
+
// TODO(F-783): MAX_PRIVATE_LOGS_PER_TX is not a hard ceiling in general — a tx that creates and nullifies (squashes)
|
|
16
|
+
// many notes/logs to the same secret can drive that secret's raw tag index arbitrarily higher, since indexes are
|
|
17
|
+
// reserved at log emission time, before squashing is decided, and the kernel's reset/squash loop is not bounded by
|
|
18
|
+
// MAX_PRIVATE_LOGS_PER_TX. No fixed window value closes that gap.
|
|
19
|
+
export const UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN = MAX_PRIVATE_LOGS_PER_TX + 20;
|
|
20
|
+
// The number of tags probed per constrained secret in the first round.
|
|
21
|
+
//
|
|
22
|
+
// The probe doubles each round (2, 4, 8, ..., capped at UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN) while every probed
|
|
23
|
+
// index is a hit, stopping at the first missing tag. Constrained delivery is gapless, so a single missing tag proves
|
|
24
|
+
// the stream has ended: at steady state this turns a full WINDOW_LEN probe into two tags. A secret K logs behind
|
|
25
|
+
// catches up in ~log2(K) round-trips while the probe is still doubling (2, 4, 8, 16, 32), but once it saturates the cap
|
|
26
|
+
// and advances WINDOW_LEN tags per round, deeper catch-up is linear at ~K/WINDOW_LEN rounds. Either way it beats both
|
|
27
|
+
// the full window every round and one round per log.
|
|
28
|
+
export const INITIAL_CONSTRAINED_PROBE_LEN = 2;
|
package/dest/tagging/index.d.ts
CHANGED
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
export { syncTaggedPrivateLogs } from './recipient_sync/sync_tagged_private_logs.js';
|
|
12
12
|
export { syncSenderTaggingIndexes } from './sender_sync/sync_sender_tagging_indexes.js';
|
|
13
13
|
export { persistSenderTaggingIndexRangesForTx } from './persist_sender_tagging_index_ranges.js';
|
|
14
|
-
export { UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN } from './constants.js';
|
|
14
|
+
export { UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN, INITIAL_CONSTRAINED_PROBE_LEN } from './constants.js';
|
|
15
15
|
export { getAllPrivateLogsByTags, getAllPublicLogsByTagsFromContract } from './get_all_logs_by_tags.js';
|
|
16
16
|
export { AppTaggingSecret, Tag, SiloedTag } from '@aztec/stdlib/logs';
|
|
17
17
|
export { type PreTag, type TaggingIndexRange } from '@aztec/stdlib/logs';
|
|
18
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
18
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy90YWdnaW5nL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOzs7Ozs7Ozs7R0FTRztBQUVILE9BQU8sRUFBRSxxQkFBcUIsRUFBRSxNQUFNLDhDQUE4QyxDQUFDO0FBQ3JGLE9BQU8sRUFBRSx3QkFBd0IsRUFBRSxNQUFNLDhDQUE4QyxDQUFDO0FBQ3hGLE9BQU8sRUFBRSxvQ0FBb0MsRUFBRSxNQUFNLDBDQUEwQyxDQUFDO0FBQ2hHLE9BQU8sRUFBRSxzQ0FBc0MsRUFBRSw2QkFBNkIsRUFBRSxNQUFNLGdCQUFnQixDQUFDO0FBQ3ZHLE9BQU8sRUFBRSx1QkFBdUIsRUFBRSxrQ0FBa0MsRUFBRSxNQUFNLDJCQUEyQixDQUFDO0FBR3hHLE9BQU8sRUFBRSxnQkFBZ0IsRUFBRSxHQUFHLEVBQUUsU0FBUyxFQUFFLE1BQU0sb0JBQW9CLENBQUM7QUFDdEUsT0FBTyxFQUFFLEtBQUssTUFBTSxFQUFFLEtBQUssaUJBQWlCLEVBQUUsTUFBTSxvQkFBb0IsQ0FBQyJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tagging/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,qBAAqB,EAAE,MAAM,8CAA8C,CAAC;AACrF,OAAO,EAAE,wBAAwB,EAAE,MAAM,8CAA8C,CAAC;AACxF,OAAO,EAAE,oCAAoC,EAAE,MAAM,0CAA0C,CAAC;AAChG,OAAO,EAAE,sCAAsC,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tagging/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,qBAAqB,EAAE,MAAM,8CAA8C,CAAC;AACrF,OAAO,EAAE,wBAAwB,EAAE,MAAM,8CAA8C,CAAC;AACxF,OAAO,EAAE,oCAAoC,EAAE,MAAM,0CAA0C,CAAC;AAChG,OAAO,EAAE,sCAAsC,EAAE,6BAA6B,EAAE,MAAM,gBAAgB,CAAC;AACvG,OAAO,EAAE,uBAAuB,EAAE,kCAAkC,EAAE,MAAM,2BAA2B,CAAC;AAGxG,OAAO,EAAE,gBAAgB,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACtE,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,iBAAiB,EAAE,MAAM,oBAAoB,CAAC"}
|
package/dest/tagging/index.js
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
*/ export { syncTaggedPrivateLogs } from './recipient_sync/sync_tagged_private_logs.js';
|
|
11
11
|
export { syncSenderTaggingIndexes } from './sender_sync/sync_sender_tagging_indexes.js';
|
|
12
12
|
export { persistSenderTaggingIndexRangesForTx } from './persist_sender_tagging_index_ranges.js';
|
|
13
|
-
export { UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN } from './constants.js';
|
|
13
|
+
export { UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN, INITIAL_CONSTRAINED_PROBE_LEN } from './constants.js';
|
|
14
14
|
export { getAllPrivateLogsByTags, getAllPublicLogsByTagsFromContract } from './get_all_logs_by_tags.js';
|
|
15
15
|
// Re-export tagging-related types from stdlib
|
|
16
16
|
export { AppTaggingSecret, Tag, SiloedTag } from '@aztec/stdlib/logs';
|
|
@@ -5,11 +5,12 @@ import type { BlockHeader } from '@aztec/stdlib/tx';
|
|
|
5
5
|
import type { RecipientTaggingStore } from '../../storage/tagging_store/recipient_tagging_store.js';
|
|
6
6
|
/**
|
|
7
7
|
* Fetches and syncs tagged private logs for multiple sender-recipient pairs, batching tag queries across all secrets
|
|
8
|
-
* into shared RPC calls.
|
|
8
|
+
* into shared RPC calls. Handles both constrained and unconstrained secrets, which differ in their scan strategy
|
|
9
|
+
* but share the same batching infrastructure.
|
|
9
10
|
*
|
|
10
|
-
* #
|
|
11
|
+
* # Unconstrained secrets
|
|
11
12
|
*
|
|
12
|
-
* For each secret we sync logs that correspond to the tagging index range
|
|
13
|
+
* For each unconstrained secret we sync logs that correspond to the tagging index range
|
|
13
14
|
* (highestAgedIndex, highestFinalizedIndex + WINDOW_LEN]
|
|
14
15
|
*
|
|
15
16
|
* highestAgedIndex is the highest index that was used in a tx that is included in a block at least
|
|
@@ -46,11 +47,28 @@ import type { RecipientTaggingStore } from '../../storage/tagging_store/recipien
|
|
|
46
47
|
* the highest finalized index. If that index was already used, they will throw an error. For this reason we
|
|
47
48
|
* don't have to look further than `highestFinalizedIndex + WINDOW_LEN`.
|
|
48
49
|
*
|
|
49
|
-
*
|
|
50
|
+
* # Constrained secrets
|
|
50
51
|
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
52
|
+
* Constrained delivery enforces a contiguous index sequence (each send proves the predecessor's nullifier,
|
|
53
|
+
* chaining back to the handshake), so there is only one sender and indexes are sequential. This means:
|
|
54
|
+
* - The lower bound is `highestFinalizedIndex + 1`. The `highestAgedIndex` mechanism is unnecessary because
|
|
55
|
+
* the nullifier chain prevents out-of-order index usage: no device can fill in a lower index after a higher
|
|
56
|
+
* one is already on-chain.
|
|
57
|
+
* - Because the sequence is gapless, the scan stops at the first missing index: that gap proves the sequence has
|
|
58
|
+
* ended and no further logs exist. We exploit this with a doubling first-miss probe (see
|
|
59
|
+
* `INITIAL_CONSTRAINED_PROBE_LEN` in ../constants.ts), so a
|
|
60
|
+
* steady-state sync with no new logs costs two tags instead of the whole window. The probe length is in-memory
|
|
61
|
+
* state scoped to one sync call, so every sync restarts at the initial probe.
|
|
62
|
+
* - The upper bound is the same as unconstrained: `highestFinalizedIndex + WINDOW_LEN`. Advancing the probe is
|
|
63
|
+
* decoupled from persisting the finalized index, so unfinalized logs at the top of the run are still fetched
|
|
64
|
+
* while only the finalized prefix is persisted.
|
|
65
|
+
*
|
|
66
|
+
* # Batching across secrets
|
|
67
|
+
*
|
|
68
|
+
* Instead of running one RPC call per secret, we merge tags from all pending secrets (both constrained and
|
|
69
|
+
* unconstrained) into a single flat array, make one batched `getAllPrivateLogsByTags` call (which internally
|
|
70
|
+
* chunks at MAX_RPC_LEN), then split results back per secret using tracked offsets. Only secrets whose window
|
|
71
|
+
* advanced are kept for the next iteration.
|
|
54
72
|
*/
|
|
55
73
|
export declare function syncTaggedPrivateLogs(secrets: AppTaggingSecret[], aztecNode: AztecNode, taggingStore: RecipientTaggingStore, anchorBlockHeader: BlockHeader, finalizedBlockNumber: BlockNumber, jobId: string): Promise<LogResult[]>;
|
|
56
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
74
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3luY190YWdnZWRfcHJpdmF0ZV9sb2dzLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvdGFnZ2luZy9yZWNpcGllbnRfc3luYy9zeW5jX3RhZ2dlZF9wcml2YXRlX2xvZ3MudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFdBQVcsRUFBRSxNQUFNLGlDQUFpQyxDQUFDO0FBRzlELE9BQU8sS0FBSyxFQUFFLFNBQVMsRUFBRSxNQUFNLGlDQUFpQyxDQUFDO0FBQ2pFLE9BQU8sS0FBSyxFQUFFLGdCQUFnQixFQUFFLFNBQVMsRUFBRSxNQUFNLG9CQUFvQixDQUFDO0FBRXRFLE9BQU8sS0FBSyxFQUFFLFdBQVcsRUFBRSxNQUFNLGtCQUFrQixDQUFDO0FBRXBELE9BQU8sS0FBSyxFQUFFLHFCQUFxQixFQUFFLE1BQU0sd0RBQXdELENBQUM7QUFLcEc7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OztHQWtFRztBQUNILHdCQUFzQixxQkFBcUIsQ0FDekMsT0FBTyxFQUFFLGdCQUFnQixFQUFFLEVBQzNCLFNBQVMsRUFBRSxTQUFTLEVBQ3BCLFlBQVksRUFBRSxxQkFBcUIsRUFDbkMsaUJBQWlCLEVBQUUsV0FBVyxFQUM5QixvQkFBb0IsRUFBRSxXQUFXLEVBQ2pDLEtBQUssRUFBRSxNQUFNLEdBQ1osT0FBTyxDQUFDLFNBQVMsRUFBRSxDQUFDLENBcUR0QiJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sync_tagged_private_logs.d.ts","sourceRoot":"","sources":["../../../src/tagging/recipient_sync/sync_tagged_private_logs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAG9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,KAAK,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEtE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,wDAAwD,CAAC;AAKpG
|
|
1
|
+
{"version":3,"file":"sync_tagged_private_logs.d.ts","sourceRoot":"","sources":["../../../src/tagging/recipient_sync/sync_tagged_private_logs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAG9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,KAAK,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEtE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,wDAAwD,CAAC;AAKpG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkEG;AACH,wBAAsB,qBAAqB,CACzC,OAAO,EAAE,gBAAgB,EAAE,EAC3B,SAAS,EAAE,SAAS,EACpB,YAAY,EAAE,qBAAqB,EACnC,iBAAiB,EAAE,WAAW,EAC9B,oBAAoB,EAAE,WAAW,EACjC,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,SAAS,EAAE,CAAC,CAqDtB"}
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
2
2
|
import { isDefined } from '@aztec/foundation/types';
|
|
3
|
-
import { SiloedTag } from '@aztec/stdlib/logs';
|
|
4
|
-
import { UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN } from '../constants.js';
|
|
3
|
+
import { AppTaggingSecretKind, SiloedTag } from '@aztec/stdlib/logs';
|
|
4
|
+
import { INITIAL_CONSTRAINED_PROBE_LEN, UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN } from '../constants.js';
|
|
5
5
|
import { getAllPrivateLogsByTags } from '../get_all_logs_by_tags.js';
|
|
6
6
|
import { findHighestIndexes } from './utils/find_highest_indexes.js';
|
|
7
7
|
/**
|
|
8
8
|
* Fetches and syncs tagged private logs for multiple sender-recipient pairs, batching tag queries across all secrets
|
|
9
|
-
* into shared RPC calls.
|
|
9
|
+
* into shared RPC calls. Handles both constrained and unconstrained secrets, which differ in their scan strategy
|
|
10
|
+
* but share the same batching infrastructure.
|
|
10
11
|
*
|
|
11
|
-
* #
|
|
12
|
+
* # Unconstrained secrets
|
|
12
13
|
*
|
|
13
|
-
* For each secret we sync logs that correspond to the tagging index range
|
|
14
|
+
* For each unconstrained secret we sync logs that correspond to the tagging index range
|
|
14
15
|
* (highestAgedIndex, highestFinalizedIndex + WINDOW_LEN]
|
|
15
16
|
*
|
|
16
17
|
* highestAgedIndex is the highest index that was used in a tx that is included in a block at least
|
|
@@ -47,11 +48,28 @@ import { findHighestIndexes } from './utils/find_highest_indexes.js';
|
|
|
47
48
|
* the highest finalized index. If that index was already used, they will throw an error. For this reason we
|
|
48
49
|
* don't have to look further than `highestFinalizedIndex + WINDOW_LEN`.
|
|
49
50
|
*
|
|
50
|
-
*
|
|
51
|
+
* # Constrained secrets
|
|
51
52
|
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
53
|
+
* Constrained delivery enforces a contiguous index sequence (each send proves the predecessor's nullifier,
|
|
54
|
+
* chaining back to the handshake), so there is only one sender and indexes are sequential. This means:
|
|
55
|
+
* - The lower bound is `highestFinalizedIndex + 1`. The `highestAgedIndex` mechanism is unnecessary because
|
|
56
|
+
* the nullifier chain prevents out-of-order index usage: no device can fill in a lower index after a higher
|
|
57
|
+
* one is already on-chain.
|
|
58
|
+
* - Because the sequence is gapless, the scan stops at the first missing index: that gap proves the sequence has
|
|
59
|
+
* ended and no further logs exist. We exploit this with a doubling first-miss probe (see
|
|
60
|
+
* `INITIAL_CONSTRAINED_PROBE_LEN` in ../constants.ts), so a
|
|
61
|
+
* steady-state sync with no new logs costs two tags instead of the whole window. The probe length is in-memory
|
|
62
|
+
* state scoped to one sync call, so every sync restarts at the initial probe.
|
|
63
|
+
* - The upper bound is the same as unconstrained: `highestFinalizedIndex + WINDOW_LEN`. Advancing the probe is
|
|
64
|
+
* decoupled from persisting the finalized index, so unfinalized logs at the top of the run are still fetched
|
|
65
|
+
* while only the finalized prefix is persisted.
|
|
66
|
+
*
|
|
67
|
+
* # Batching across secrets
|
|
68
|
+
*
|
|
69
|
+
* Instead of running one RPC call per secret, we merge tags from all pending secrets (both constrained and
|
|
70
|
+
* unconstrained) into a single flat array, make one batched `getAllPrivateLogsByTags` call (which internally
|
|
71
|
+
* chunks at MAX_RPC_LEN), then split results back per secret using tracked offsets. Only secrets whose window
|
|
72
|
+
* advanced are kept for the next iteration.
|
|
55
73
|
*/ export async function syncTaggedPrivateLogs(secrets, aztecNode, taggingStore, anchorBlockHeader, finalizedBlockNumber, jobId) {
|
|
56
74
|
if (secrets.length === 0) {
|
|
57
75
|
return [];
|
|
@@ -74,7 +92,7 @@ import { findHighestIndexes } from './utils/find_highest_indexes.js';
|
|
|
74
92
|
allLogs.push(...logsFoundWithSecret.map(({ log })=>log));
|
|
75
93
|
// Persist new indexes. If the finalized index moved forward, the window advances
|
|
76
94
|
// and we need another round for this secret.
|
|
77
|
-
return await
|
|
95
|
+
return pendingSecret.kind === AppTaggingSecretKind.CONSTRAINED ? await processConstrainedResults(pendingSecret, logsFoundWithSecret, taggingStore, currentTimestamp, finalizedBlockNumber, jobId) : await processUnconstrainedResults(pendingSecret, logsFoundWithSecret, taggingStore, currentTimestamp, finalizedBlockNumber, jobId);
|
|
78
96
|
}));
|
|
79
97
|
pending = nextRound.filter(isDefined);
|
|
80
98
|
}
|
|
@@ -82,16 +100,30 @@ import { findHighestIndexes } from './utils/find_highest_indexes.js';
|
|
|
82
100
|
}
|
|
83
101
|
/** Reads stored indexes for each secret and computes the initial index range to query. */ function getIndexRangesForSecrets(secrets, taggingStore, jobId) {
|
|
84
102
|
return Promise.all(secrets.map(async (secret)=>{
|
|
85
|
-
const
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
103
|
+
const currentHighestFinalizedIndex = await taggingStore.getHighestFinalizedIndex(secret, jobId);
|
|
104
|
+
const boundEnd = (currentHighestFinalizedIndex ?? 0) + UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN + 1;
|
|
105
|
+
if (secret.kind === AppTaggingSecretKind.CONSTRAINED) {
|
|
106
|
+
// Constrained streams are gapless and resume at the finalized index, so probe a small initial window and stop
|
|
107
|
+
// at the first missing tag instead of always fetching the full window. The probe grows each round up to the
|
|
108
|
+
// window cap.
|
|
109
|
+
const start = currentHighestFinalizedIndex === undefined ? 0 : currentHighestFinalizedIndex + 1;
|
|
110
|
+
return {
|
|
111
|
+
kind: AppTaggingSecretKind.CONSTRAINED,
|
|
112
|
+
secret,
|
|
113
|
+
start,
|
|
114
|
+
end: Math.min(boundEnd, start + INITIAL_CONSTRAINED_PROBE_LEN),
|
|
115
|
+
boundEnd,
|
|
116
|
+
probeLen: INITIAL_CONSTRAINED_PROBE_LEN
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
// Unconstrained secrets can have gaps, so they scan the whole window starting past the highest aged index.
|
|
120
|
+
const highestAgedIndex = await taggingStore.getHighestAgedIndex(secret, jobId);
|
|
121
|
+
const start = highestAgedIndex === undefined ? 0 : highestAgedIndex + 1;
|
|
91
122
|
return {
|
|
123
|
+
kind: AppTaggingSecretKind.UNCONSTRAINED,
|
|
92
124
|
secret,
|
|
93
125
|
start,
|
|
94
|
-
end
|
|
126
|
+
end: boundEnd
|
|
95
127
|
};
|
|
96
128
|
}));
|
|
97
129
|
}
|
|
@@ -136,9 +168,50 @@ import { findHighestIndexes } from './utils/find_highest_indexes.js';
|
|
|
136
168
|
return logsPerSecret;
|
|
137
169
|
}
|
|
138
170
|
/**
|
|
139
|
-
* Processes a
|
|
171
|
+
* Processes fetched logs for a constrained secret: persists the finalized index and advances the probe. See the
|
|
172
|
+
* "# Constrained secrets" section above for why the scan stops at the first missing index. Only `highestFinalizedIndex`
|
|
173
|
+
* is tracked (no aged index).
|
|
174
|
+
*/ async function processConstrainedResults(pending, logsWithIndexes, taggingStore, currentTimestamp, finalizedBlockNumber, jobId) {
|
|
175
|
+
// Find where the contiguous run of indexes ends; all logs in the batch fall within this prefix.
|
|
176
|
+
const indexesWithLogs = new Set(logsWithIndexes.map((l)=>l.taggingIndex));
|
|
177
|
+
let firstMissingIndex = pending.start;
|
|
178
|
+
while(firstMissingIndex < pending.end && indexesWithLogs.has(firstMissingIndex)){
|
|
179
|
+
firstMissingIndex++;
|
|
180
|
+
}
|
|
181
|
+
// Persist the highest finalized index found. The nullifier for a constrained-delivery log is emitted in the same
|
|
182
|
+
// transaction, guaranteeing the log cannot disappear once included, so we persist even when a gap stops the scan.
|
|
183
|
+
// This lets the next sync round skip already-finalized indexes.
|
|
184
|
+
const { highestFinalizedIndex } = findHighestIndexes(logsWithIndexes, currentTimestamp, finalizedBlockNumber);
|
|
185
|
+
if (highestFinalizedIndex !== undefined) {
|
|
186
|
+
await taggingStore.updateHighestFinalizedIndex(pending.secret, highestFinalizedIndex, jobId);
|
|
187
|
+
}
|
|
188
|
+
// Advancing the probe is decoupled from persisting the finalized index: keep scanning as long as the probe was
|
|
189
|
+
// entirely hits (no gap) and there is room before the protocol bound, even if none of those hits is finalized yet.
|
|
190
|
+
// Gating this on finalization would drop logs in unfinalized blocks, which sit at the top of the contiguous run.
|
|
191
|
+
// The bound re-anchors to any finalized index found this round.
|
|
192
|
+
const probeFullyConsumed = firstMissingIndex >= pending.end;
|
|
193
|
+
const boundEnd = highestFinalizedIndex !== undefined ? Math.max(pending.boundEnd, highestFinalizedIndex + UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN + 1) : pending.boundEnd;
|
|
194
|
+
// Double the probe each round, capped at the window (see INITIAL_CONSTRAINED_PROBE_LEN in ../constants.ts).
|
|
195
|
+
// The queried range is already bounded by boundEnd (a probe can never reach
|
|
196
|
+
// more than WINDOW_LEN past the finalized frontier); this cap just keeps the stored length from growing unbounded
|
|
197
|
+
// once the probe saturates the window.
|
|
198
|
+
const nextProbeLen = Math.min(pending.probeLen * 2, UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN);
|
|
199
|
+
if (probeFullyConsumed && pending.end < boundEnd) {
|
|
200
|
+
return {
|
|
201
|
+
kind: AppTaggingSecretKind.CONSTRAINED,
|
|
202
|
+
secret: pending.secret,
|
|
203
|
+
start: pending.end,
|
|
204
|
+
end: Math.min(boundEnd, pending.end + nextProbeLen),
|
|
205
|
+
boundEnd,
|
|
206
|
+
probeLen: nextProbeLen
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
return undefined;
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Processes a single unconstrained secret's fetched logs: updates stored indexes and returns a new PendingSecret
|
|
140
213
|
* if the window needs to advance, or undefined if this secret is done.
|
|
141
|
-
*/ async function
|
|
214
|
+
*/ async function processUnconstrainedResults(pending, logsWithIndexes, taggingStore, currentTimestamp, finalizedBlockNumber, jobId) {
|
|
142
215
|
const { highestAgedIndex, highestFinalizedIndex } = findHighestIndexes(logsWithIndexes, currentTimestamp, finalizedBlockNumber);
|
|
143
216
|
// Store updates in data provider and update local variables
|
|
144
217
|
if (highestAgedIndex !== undefined) {
|
|
@@ -155,9 +228,11 @@ import { findHighestIndexes } from './utils/find_highest_indexes.js';
|
|
|
155
228
|
await taggingStore.updateHighestFinalizedIndex(pending.secret, highestFinalizedIndex, jobId);
|
|
156
229
|
// For the next iteration we want to look only at indexes for which we have not yet fetched logs while
|
|
157
230
|
// ensuring that we do not look further than WINDOW_LEN ahead of the highest finalized index.
|
|
231
|
+
const end = highestFinalizedIndex + UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN + 1;
|
|
158
232
|
return {
|
|
233
|
+
kind: AppTaggingSecretKind.UNCONSTRAINED,
|
|
159
234
|
secret: pending.secret,
|
|
160
235
|
start: pending.end,
|
|
161
|
-
end
|
|
236
|
+
end
|
|
162
237
|
};
|
|
163
238
|
}
|
|
@@ -48,7 +48,7 @@ import { loadAndStoreNewTaggingIndexes } from './utils/load_and_store_new_taggin
|
|
|
48
48
|
break;
|
|
49
49
|
}
|
|
50
50
|
// Receipts for pending tx hashes that the logs query just surfaced still need a sequential follow-up call.
|
|
51
|
-
// `
|
|
51
|
+
// `mergePendingIndexes` is idempotent on (secret, txHash), so a re-discovered hash stays classified as known
|
|
52
52
|
// and is not re-fetched here.
|
|
53
53
|
const knownSet = new Set(knownPendingTxHashes.map((h)=>h.toString()));
|
|
54
54
|
const newPendingTxHashes = allPendingTxHashes.filter((h)=>!knownSet.has(h.toString()));
|
|
@@ -16,4 +16,4 @@ import type { SenderTaggingStore } from '../../../storage/tagging_store/sender_t
|
|
|
16
16
|
* preserving way.
|
|
17
17
|
*/
|
|
18
18
|
export declare function loadAndStoreNewTaggingIndexes(extendedSecret: AppTaggingSecret, start: number, end: number, aztecNode: AztecNode, taggingStore: SenderTaggingStore, anchorBlockHash: BlockHash, jobId: string): Promise<void>;
|
|
19
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
19
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibG9hZF9hbmRfc3RvcmVfbmV3X3RhZ2dpbmdfaW5kZXhlcy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vc3JjL3RhZ2dpbmcvc2VuZGVyX3N5bmMvdXRpbHMvbG9hZF9hbmRfc3RvcmVfbmV3X3RhZ2dpbmdfaW5kZXhlcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsTUFBTSxxQkFBcUIsQ0FBQztBQUNyRCxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUNqRSxPQUFPLEVBQUUsS0FBSyxnQkFBZ0IsRUFBYSxNQUFNLG9CQUFvQixDQUFDO0FBR3RFLE9BQU8sS0FBSyxFQUFFLGtCQUFrQixFQUFFLE1BQU0sd0RBQXdELENBQUM7QUFHakc7Ozs7Ozs7Ozs7OztHQVlHO0FBQ0gsd0JBQXNCLDZCQUE2QixDQUNqRCxjQUFjLEVBQUUsZ0JBQWdCLEVBQ2hDLEtBQUssRUFBRSxNQUFNLEVBQ2IsR0FBRyxFQUFFLE1BQU0sRUFDWCxTQUFTLEVBQUUsU0FBUyxFQUNwQixZQUFZLEVBQUUsa0JBQWtCLEVBQ2hDLGVBQWUsRUFBRSxTQUFTLEVBQzFCLEtBQUssRUFBRSxNQUFNLGlCQW9CZCJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load_and_store_new_tagging_indexes.d.ts","sourceRoot":"","sources":["../../../../src/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,KAAK,gBAAgB,EAAa,MAAM,oBAAoB,CAAC;AAGtE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wDAAwD,CAAC;AAGjG;;;;;;;;;;;;GAYG;AACH,wBAAsB,6BAA6B,CACjD,cAAc,EAAE,gBAAgB,EAChC,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,MAAM,EACX,SAAS,EAAE,SAAS,EACpB,YAAY,EAAE,kBAAkB,EAChC,eAAe,EAAE,SAAS,EAC1B,KAAK,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"load_and_store_new_tagging_indexes.d.ts","sourceRoot":"","sources":["../../../../src/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,KAAK,gBAAgB,EAAa,MAAM,oBAAoB,CAAC;AAGtE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wDAAwD,CAAC;AAGjG;;;;;;;;;;;;GAYG;AACH,wBAAsB,6BAA6B,CACjD,cAAc,EAAE,gBAAgB,EAChC,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,MAAM,EACX,SAAS,EAAE,SAAS,EACpB,YAAY,EAAE,kBAAkB,EAChC,eAAe,EAAE,SAAS,EAC1B,KAAK,EAAE,MAAM,iBAoBd"}
|
|
@@ -23,7 +23,11 @@ import { getAllPrivateLogsByTags } from '../../get_all_logs_by_tags.js';
|
|
|
23
23
|
})));
|
|
24
24
|
const txsForTags = await getTxsContainingTags(siloedTagsForWindow, aztecNode, anchorBlockHash);
|
|
25
25
|
const txIndexesMap = getTxIndexesMap(txsForTags, start, siloedTagsForWindow.length);
|
|
26
|
-
// Now we iterate over the map, construct the tagging index ranges and store them in the db.
|
|
26
|
+
// Now we iterate over the map, construct the tagging index ranges and store them in the db. A tx already tracked
|
|
27
|
+
// in the store is merged rather than range-checked: if this PXE sent the tx and it partially reverted, the chain
|
|
28
|
+
// only shows the surviving sub-range of the prove-time entry (the finalized receipt step of the sync owns
|
|
29
|
+
// resolving that difference), and a tx from another PXE may straddle a sync window boundary, in which case the
|
|
30
|
+
// entry is widened so the next index choice covers the full onchain range.
|
|
27
31
|
for (const [txHashStr, indexes] of txIndexesMap.entries()){
|
|
28
32
|
const txHash = TxHash.fromString(txHashStr);
|
|
29
33
|
const ranges = [
|
|
@@ -33,7 +37,7 @@ import { getAllPrivateLogsByTags } from '../../get_all_logs_by_tags.js';
|
|
|
33
37
|
highestIndex: Math.max(...indexes)
|
|
34
38
|
}
|
|
35
39
|
];
|
|
36
|
-
await taggingStore.
|
|
40
|
+
await taggingStore.mergePendingIndexes(ranges, txHash, jobId);
|
|
37
41
|
}
|
|
38
42
|
}
|
|
39
43
|
// Returns txs that used the given tags. A tag might have been used in multiple txs and for this reason we return
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type AppTaggingSecret, type PrivateLogsQuery, SiloedTag } from '@aztec/stdlib/logs';
|
|
2
|
+
/** Computes the siloed tag */
|
|
3
|
+
export declare function computeSiloedTagForIndex(secret: AppTaggingSecret, index: number): Promise<SiloedTag>;
|
|
4
|
+
/** Extracts the bare-tag set from a query */
|
|
5
|
+
export declare function extractTags(query: PrivateLogsQuery): SiloedTag[];
|
|
6
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGFnX3F1ZXJ5X3Rlc3RfdXRpbHMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy90YWdnaW5nL3Rlc3RpbmcvdGFnX3F1ZXJ5X3Rlc3RfdXRpbHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLEtBQUssZ0JBQWdCLEVBQUUsS0FBSyxnQkFBZ0IsRUFBRSxTQUFTLEVBQWlCLE1BQU0sb0JBQW9CLENBQUM7QUFFNUcsOEJBQThCO0FBQzlCLHdCQUFnQix3QkFBd0IsQ0FBQyxNQUFNLEVBQUUsZ0JBQWdCLEVBQUUsS0FBSyxFQUFFLE1BQU0sR0FBRyxPQUFPLENBQUMsU0FBUyxDQUFDLENBRXBHO0FBRUQsNkNBQTZDO0FBQzdDLHdCQUFnQixXQUFXLENBQUMsS0FBSyxFQUFFLGdCQUFnQixHQUFHLFNBQVMsRUFBRSxDQUVoRSJ9
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tag_query_test_utils.d.ts","sourceRoot":"","sources":["../../../src/tagging/testing/tag_query_test_utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,gBAAgB,EAAE,KAAK,gBAAgB,EAAE,SAAS,EAAiB,MAAM,oBAAoB,CAAC;AAE5G,8BAA8B;AAC9B,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAEpG;AAED,6CAA6C;AAC7C,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,GAAG,SAAS,EAAE,CAEhE"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { SiloedTag } from '@aztec/stdlib/logs';
|
|
2
|
+
/** Computes the siloed tag */ export function computeSiloedTagForIndex(secret, index) {
|
|
3
|
+
return SiloedTag.compute({
|
|
4
|
+
extendedSecret: secret,
|
|
5
|
+
index
|
|
6
|
+
});
|
|
7
|
+
}
|
|
8
|
+
/** Extracts the bare-tag set from a query */ export function extractTags(query) {
|
|
9
|
+
return query.tags.map((entry)=>entry instanceof SiloedTag ? entry : entry.tag);
|
|
10
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/pxe",
|
|
3
|
-
"version": "0.0.1-commit.
|
|
3
|
+
"version": "0.0.1-commit.be03c316",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"typedocOptions": {
|
|
6
6
|
"entryPoints": [
|
|
@@ -71,20 +71,20 @@
|
|
|
71
71
|
]
|
|
72
72
|
},
|
|
73
73
|
"dependencies": {
|
|
74
|
-
"@aztec/bb-prover": "0.0.1-commit.
|
|
75
|
-
"@aztec/bb.js": "0.0.1-commit.
|
|
76
|
-
"@aztec/builder": "0.0.1-commit.
|
|
77
|
-
"@aztec/constants": "0.0.1-commit.
|
|
78
|
-
"@aztec/ethereum": "0.0.1-commit.
|
|
79
|
-
"@aztec/foundation": "0.0.1-commit.
|
|
80
|
-
"@aztec/key-store": "0.0.1-commit.
|
|
81
|
-
"@aztec/kv-store": "0.0.1-commit.
|
|
82
|
-
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.
|
|
83
|
-
"@aztec/noir-types": "0.0.1-commit.
|
|
84
|
-
"@aztec/protocol-contracts": "0.0.1-commit.
|
|
85
|
-
"@aztec/simulator": "0.0.1-commit.
|
|
86
|
-
"@aztec/standard-contracts": "0.0.1-commit.
|
|
87
|
-
"@aztec/stdlib": "0.0.1-commit.
|
|
74
|
+
"@aztec/bb-prover": "0.0.1-commit.be03c316",
|
|
75
|
+
"@aztec/bb.js": "0.0.1-commit.be03c316",
|
|
76
|
+
"@aztec/builder": "0.0.1-commit.be03c316",
|
|
77
|
+
"@aztec/constants": "0.0.1-commit.be03c316",
|
|
78
|
+
"@aztec/ethereum": "0.0.1-commit.be03c316",
|
|
79
|
+
"@aztec/foundation": "0.0.1-commit.be03c316",
|
|
80
|
+
"@aztec/key-store": "0.0.1-commit.be03c316",
|
|
81
|
+
"@aztec/kv-store": "0.0.1-commit.be03c316",
|
|
82
|
+
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.be03c316",
|
|
83
|
+
"@aztec/noir-types": "0.0.1-commit.be03c316",
|
|
84
|
+
"@aztec/protocol-contracts": "0.0.1-commit.be03c316",
|
|
85
|
+
"@aztec/simulator": "0.0.1-commit.be03c316",
|
|
86
|
+
"@aztec/standard-contracts": "0.0.1-commit.be03c316",
|
|
87
|
+
"@aztec/stdlib": "0.0.1-commit.be03c316",
|
|
88
88
|
"koa": "^2.16.1",
|
|
89
89
|
"koa-router": "^13.1.1",
|
|
90
90
|
"lodash.omit": "^4.5.0",
|
|
@@ -93,8 +93,8 @@
|
|
|
93
93
|
"viem": "npm:@aztec/viem@2.38.2"
|
|
94
94
|
},
|
|
95
95
|
"devDependencies": {
|
|
96
|
-
"@aztec/noir-test-contracts.js": "0.0.1-commit.
|
|
97
|
-
"@aztec/world-state": "0.0.1-commit.
|
|
96
|
+
"@aztec/noir-test-contracts.js": "0.0.1-commit.be03c316",
|
|
97
|
+
"@aztec/world-state": "0.0.1-commit.be03c316",
|
|
98
98
|
"@jest/globals": "^30.0.0",
|
|
99
99
|
"@types/jest": "^30.0.0",
|
|
100
100
|
"@types/lodash.omit": "^4.5.7",
|
|
@@ -3,40 +3,24 @@ import { keccak256String } from '@aztec/foundation/crypto/keccak';
|
|
|
3
3
|
import { dirname, join } from 'path';
|
|
4
4
|
import { fileURLToPath } from 'url';
|
|
5
5
|
|
|
6
|
+
import { ORACLE_REGISTRY } from '../contract_function_simulator/index.js';
|
|
6
7
|
import { ORACLE_INTERFACE_HASH, ORACLE_VERSION_MAJOR } from '../oracle_version.js';
|
|
7
|
-
import {
|
|
8
|
+
import { getOracleRegistrySignature, readNumericGlobal } from './oracle_version_helpers.js';
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* Verifies that the Oracle interface matches the expected interface hash.
|
|
11
12
|
*
|
|
12
13
|
* The Oracle interface needs to be versioned to ensure compatibility between Aztec.nr and PXE. This function computes
|
|
13
|
-
* a hash of
|
|
14
|
-
*
|
|
15
|
-
*
|
|
14
|
+
* a hash of `ORACLE_REGISTRY` (where each oracle's parameter names, parameter types, and return type
|
|
15
|
+
* live) and compares it against a known hash. If they don't match, it means the interface has changed and the oracle
|
|
16
|
+
* version needs to be bumped:
|
|
17
|
+
* - If the change is backward-breaking (e.g. removing/renaming an oracle, or changing its params/return), bump
|
|
18
|
+
* ORACLE_VERSION_MAJOR.
|
|
16
19
|
* - If the change is an oracle addition (non-breaking), bump ORACLE_VERSION_MINOR.
|
|
17
20
|
*/
|
|
18
21
|
function assertOracleInterfaceMatches(): void {
|
|
19
|
-
const excludedProps = [
|
|
20
|
-
'handler',
|
|
21
|
-
'constructor',
|
|
22
|
-
'toACIRCallback',
|
|
23
|
-
'handlerAsMisc',
|
|
24
|
-
'handlerAsUtility',
|
|
25
|
-
'handlerAsPrivate',
|
|
26
|
-
];
|
|
27
|
-
|
|
28
|
-
// Get the path to Oracle.ts source file
|
|
29
|
-
// The script runs from dest/bin/ after compilation, so we need to go up to the package root
|
|
30
|
-
// then into src/ to find the source file
|
|
31
|
-
const currentDir = dirname(fileURLToPath(import.meta.url));
|
|
32
|
-
// Go up from dest/bin/ or src/bin/ to the package root (pxe/), then into src/
|
|
33
|
-
const packageRoot = dirname(dirname(currentDir)); // Go up from bin/ to pxe/
|
|
34
|
-
const oracleSourcePath = join(packageRoot, 'src/contract_function_simulator/oracle/oracle.ts');
|
|
35
|
-
|
|
36
|
-
const oracleInterfaceSignature = getOracleInterfaceSignature(oracleSourcePath, ['Oracle'], excludedProps);
|
|
37
|
-
|
|
38
22
|
// We use keccak256 here just because we already have it in the dependencies.
|
|
39
|
-
const oracleInterfaceHash = keccak256String(
|
|
23
|
+
const oracleInterfaceHash = keccak256String(getOracleRegistrySignature(ORACLE_REGISTRY));
|
|
40
24
|
if (oracleInterfaceHash !== ORACLE_INTERFACE_HASH) {
|
|
41
25
|
throw new Error(
|
|
42
26
|
`The Oracle interface has changed. Update ORACLE_INTERFACE_HASH to ${oracleInterfaceHash} in pxe/src/oracle_version.ts and bump the oracle version (ORACLE_VERSION_MAJOR for breaking changes, ORACLE_VERSION_MINOR for oracle additions).`,
|
package/src/bin/index.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { getOracleRegistrySignature, readNumericGlobal } from './oracle_version_helpers.js';
|
|
@@ -1,63 +1,34 @@
|
|
|
1
|
-
/* eslint-disable import-x/no-named-as-default-member */
|
|
2
1
|
import { readFileSync } from 'fs';
|
|
3
|
-
|
|
2
|
+
|
|
3
|
+
import type { OracleRegistryEntry } from '../contract_function_simulator/index.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* Extracts
|
|
6
|
+
* Extracts a deterministic signature string from an oracle registry (e.g. PXE's `ORACLE_REGISTRY`).
|
|
7
7
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
8
|
+
* Reads the registry where each oracle's wire ABI lives: the ordered parameter names with their `TypeMapping` labels
|
|
9
|
+
* and the return type. The resulting hash is sensitive to parameter, type, and return changes, not just oracle
|
|
10
|
+
* additions and removals.
|
|
10
11
|
*
|
|
11
|
-
* @
|
|
12
|
-
*
|
|
13
|
-
*
|
|
12
|
+
* @example
|
|
13
|
+
* // Given a registry like:
|
|
14
|
+
* // export const ORACLE_REGISTRY = {
|
|
15
|
+
* // aztec_utl_foo: makeEntry({ params: [{ name: 'a', type: U32 }], returnType: BOOL }),
|
|
16
|
+
* // aztec_prv_bar: makeEntry(),
|
|
17
|
+
* // } satisfies Record<string, OracleRegistryEntry>;
|
|
18
|
+
* //
|
|
19
|
+
* // Returns (sorted, newline-joined):
|
|
20
|
+
* // "aztec_prv_bar(): void\naztec_utl_foo(a: u32): bool"
|
|
14
21
|
*/
|
|
15
|
-
export function
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
function visit(node: ts.Node) {
|
|
22
|
-
const isTarget =
|
|
23
|
-
(ts.isClassDeclaration(node) || ts.isInterfaceDeclaration(node)) && targets.includes(node.name?.text ?? '');
|
|
24
|
-
|
|
25
|
-
if (isTarget) {
|
|
26
|
-
node.members.forEach(member => {
|
|
27
|
-
if (
|
|
28
|
-
(ts.isMethodDeclaration(member) || ts.isMethodSignature(member)) &&
|
|
29
|
-
member.name &&
|
|
30
|
-
ts.isIdentifier(member.name)
|
|
31
|
-
) {
|
|
32
|
-
const methodName = member.name.text;
|
|
33
|
-
|
|
34
|
-
if (excludedMembers.includes(methodName)) {
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
const paramSignatures: string[] = [];
|
|
39
|
-
member.parameters.forEach(param => {
|
|
40
|
-
const paramName = extractParameterName(param, sourceFile);
|
|
41
|
-
const paramType = extractTypeString(param.type, sourceFile);
|
|
42
|
-
paramSignatures.push(`${paramName}: ${paramType}`);
|
|
43
|
-
});
|
|
22
|
+
export function getOracleRegistrySignature(registry: Record<string, OracleRegistryEntry>): string {
|
|
23
|
+
const oracleSignatures = Object.entries(registry).map(([name, entry]) => {
|
|
24
|
+
const paramSignatures = entry.params.map(p => `${p.name}: ${p.type.label}`);
|
|
25
|
+
const returnType = entry.returnType === undefined ? 'void' : entry.returnType.label;
|
|
26
|
+
return `${name}(${paramSignatures.join(', ')}): ${returnType}`;
|
|
27
|
+
});
|
|
44
28
|
|
|
45
|
-
|
|
29
|
+
oracleSignatures.sort();
|
|
46
30
|
|
|
47
|
-
|
|
48
|
-
methodSignatures.push(signature);
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
ts.forEachChild(node, visit);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
visit(sourceFile);
|
|
57
|
-
|
|
58
|
-
methodSignatures.sort();
|
|
59
|
-
|
|
60
|
-
return methodSignatures.join('');
|
|
31
|
+
return oracleSignatures.join('\n');
|
|
61
32
|
}
|
|
62
33
|
|
|
63
34
|
/**
|
|
@@ -81,41 +52,3 @@ export function readNumericGlobal(sourcePath: string, name: string): number {
|
|
|
81
52
|
}
|
|
82
53
|
return Number(match[1]);
|
|
83
54
|
}
|
|
84
|
-
|
|
85
|
-
function extractParameterName(param: ts.ParameterDeclaration, sourceFile: ts.SourceFile): string {
|
|
86
|
-
const name = param.name;
|
|
87
|
-
|
|
88
|
-
if (ts.isIdentifier(name)) {
|
|
89
|
-
return name.text;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
if (ts.isArrayBindingPattern(name)) {
|
|
93
|
-
if (name.elements.length > 0) {
|
|
94
|
-
const element = name.elements[0];
|
|
95
|
-
if (ts.isBindingElement(element)) {
|
|
96
|
-
const elementName = element.name;
|
|
97
|
-
if (ts.isIdentifier(elementName)) {
|
|
98
|
-
return elementName.text;
|
|
99
|
-
}
|
|
100
|
-
if (ts.isArrayBindingPattern(elementName) || ts.isObjectBindingPattern(elementName)) {
|
|
101
|
-
return elementName.getText(sourceFile);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
return name.getText(sourceFile);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
if (ts.isObjectBindingPattern(name)) {
|
|
109
|
-
return name.getText(sourceFile);
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
return (name as ts.Node).getText(sourceFile);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
function extractTypeString(typeNode: ts.TypeNode | undefined, sourceFile: ts.SourceFile): string {
|
|
116
|
-
if (!typeNode) {
|
|
117
|
-
return 'void';
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
return typeNode.getText(sourceFile).replace(/\s+/g, ' ').trim();
|
|
121
|
-
}
|