@aztec/pxe 5.0.0-rc.2 → 5.0.1
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/block_synchronizer/block_synchronizer.d.ts +5 -3
- package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -1
- package/dest/block_synchronizer/block_synchronizer.js +7 -1
- package/dest/contract/contract_class_service.d.ts +31 -0
- package/dest/contract/contract_class_service.d.ts.map +1 -0
- package/dest/contract/contract_class_service.js +68 -0
- package/dest/{contract_sync → contract}/contract_sync_service.d.ts +7 -6
- package/dest/contract/contract_sync_service.d.ts.map +1 -0
- package/dest/{contract_sync → contract}/contract_sync_service.js +10 -30
- package/dest/contract/helpers.d.ts +7 -0
- package/dest/contract/helpers.d.ts.map +1 -0
- package/dest/contract/helpers.js +20 -0
- package/dest/contract_function_simulator/anchored_contract_data.d.ts +36 -0
- package/dest/contract_function_simulator/anchored_contract_data.d.ts.map +1 -0
- package/dest/contract_function_simulator/anchored_contract_data.js +54 -0
- package/dest/contract_function_simulator/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 +9 -3
- package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.js +31 -14
- 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 +4 -2
- package/dest/contract_function_simulator/index.d.ts.map +1 -1
- package/dest/contract_function_simulator/index.js +2 -1
- package/dest/contract_function_simulator/noir-structs/fact.d.ts +5 -5
- package/dest/contract_function_simulator/noir-structs/fact.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/fact.js +2 -2
- package/dest/contract_function_simulator/noir-structs/fact_collection.d.ts +3 -3
- package/dest/contract_function_simulator/noir-structs/fact_collection.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/fact_collection.js +3 -1
- package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts +7 -1
- package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts.map +1 -1
- 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 +2 -2
- 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 -1
- package/dest/contract_function_simulator/noir-structs/resolved_tagging_strategy.d.ts +8 -1
- package/dest/contract_function_simulator/noir-structs/resolved_tagging_strategy.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/resolved_tagging_strategy.js +17 -0
- package/dest/contract_function_simulator/oracle/acir_callback.d.ts +7 -2
- package/dest/contract_function_simulator/oracle/acir_callback.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/acir_callback.js +55 -11
- 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/oracle_registry.d.ts +11 -7
- package/dest/contract_function_simulator/oracle/oracle_registry.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/oracle_registry.js +50 -10
- package/dest/contract_function_simulator/oracle/oracle_type_mappings.d.ts +48 -9
- package/dest/contract_function_simulator/oracle/oracle_type_mappings.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/oracle_type_mappings.js +51 -30
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +10 -2
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.js +73 -32
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +23 -16
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +105 -60
- 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 +11 -5
- 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 +11 -5
- 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 +28 -0
- package/dest/entrypoints/server/index.d.ts +6 -2
- package/dest/entrypoints/server/index.d.ts.map +1 -1
- package/dest/entrypoints/server/index.js +4 -1
- 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 +8 -2
- package/dest/error_enriching.d.ts +5 -3
- package/dest/error_enriching.d.ts.map +1 -1
- package/dest/error_enriching.js +12 -10
- package/dest/hooks/execution_hooks.d.ts +15 -4
- package/dest/hooks/execution_hooks.d.ts.map +1 -1
- package/dest/hooks/index.d.ts +3 -2
- 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 +10 -1
- package/dest/hooks/resolve_tagging_secret_strategy.d.ts.map +1 -1
- package/dest/hooks/resolve_tagging_secret_strategy.js +3 -3
- package/dest/logs/log_service.d.ts +5 -3
- package/dest/logs/log_service.d.ts.map +1 -1
- package/dest/logs/log_service.js +38 -17
- package/dest/notes/note_service.d.ts +1 -1
- package/dest/notes/note_service.js +1 -1
- package/dest/oracle_version.d.ts +2 -2
- package/dest/oracle_version.js +2 -2
- 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/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 +17 -36
- 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 +81 -46
- package/dest/pxe.d.ts.map +1 -1
- package/dest/pxe.js +138 -104
- 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 +31 -7
- 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 +63 -74
- package/dest/storage/fact_store/fact_service.d.ts +6 -4
- package/dest/storage/fact_store/fact_service.d.ts.map +1 -1
- package/dest/storage/fact_store/fact_service.js +19 -4
- package/dest/storage/fact_store/fact_store.d.ts +1 -1
- package/dest/storage/fact_store/fact_store.js +1 -1
- package/dest/storage/fact_store/index.d.ts +2 -1
- package/dest/storage/fact_store/index.d.ts.map +1 -1
- package/dest/storage/fact_store/index.js +1 -0
- package/dest/storage/fact_store/origin_state.d.ts +57 -0
- package/dest/storage/fact_store/origin_state.d.ts.map +1 -0
- package/dest/storage/fact_store/origin_state.js +53 -0
- package/dest/storage/metadata.d.ts +2 -2
- package/dest/storage/metadata.d.ts.map +1 -1
- package/dest/storage/metadata.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/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 +17 -6
- package/dest/storage/tagging_store/tagging_secret_sources_store.d.ts.map +1 -1
- package/dest/storage/tagging_store/tagging_secret_sources_store.js +24 -11
- package/dest/tagging/constants.d.ts +2 -2
- package/dest/tagging/constants.d.ts.map +1 -1
- package/dest/tagging/constants.js +18 -9
- 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/package.json +17 -17
- package/src/block_synchronizer/block_synchronizer.ts +9 -1
- package/src/contract/contract_class_service.ts +83 -0
- package/src/{contract_sync → contract}/contract_sync_service.ts +18 -37
- package/src/contract/helpers.ts +35 -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 +56 -14
- package/src/contract_function_simulator/execution_note_cache.ts +7 -28
- package/src/contract_function_simulator/index.ts +7 -1
- package/src/contract_function_simulator/noir-structs/fact.ts +4 -4
- package/src/contract_function_simulator/noir-structs/fact_collection.ts +9 -4
- package/src/contract_function_simulator/noir-structs/log_retrieval_response.ts +6 -0
- package/src/contract_function_simulator/noir-structs/pending_tagged_log.ts +12 -0
- package/src/contract_function_simulator/noir-structs/provided_secret.ts +1 -1
- package/src/contract_function_simulator/noir-structs/resolved_tagging_strategy.ts +21 -0
- package/src/contract_function_simulator/oracle/acir_callback.ts +58 -12
- package/src/contract_function_simulator/oracle/legacy_oracle_registry.ts +147 -0
- package/src/contract_function_simulator/oracle/oracle_registry.ts +37 -7
- package/src/contract_function_simulator/oracle/oracle_type_mappings.ts +49 -32
- package/src/contract_function_simulator/oracle/private_execution_oracle.ts +92 -41
- package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +149 -71
- 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 +16 -4
- package/src/entrypoints/client/lazy/index.ts +1 -0
- package/src/entrypoints/client/lazy/utils.ts +16 -4
- package/src/entrypoints/client/store.ts +38 -0
- package/src/entrypoints/server/index.ts +6 -1
- package/src/entrypoints/server/store.ts +47 -0
- package/src/entrypoints/server/utils.ts +21 -7
- package/src/error_enriching.ts +26 -10
- package/src/hooks/execution_hooks.ts +14 -3
- package/src/hooks/index.ts +2 -0
- package/src/hooks/resolve_custom_request.ts +24 -0
- package/src/hooks/resolve_tagging_secret_strategy.ts +14 -0
- package/src/logs/log_service.ts +35 -11
- package/src/notes/note_service.ts +1 -1
- package/src/oracle_version.ts +2 -2
- package/src/private_kernel/hints/private_kernel_reset_private_inputs_builder.ts +11 -1
- package/src/private_kernel/private_kernel_execution_prover.ts +22 -52
- package/src/private_kernel/private_kernel_oracle.ts +23 -4
- package/src/pxe.ts +212 -143
- 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__/KeyStore.json +12 -12
- 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 +3 -3
- package/src/storage/backwards_compatibility_tests/__snapshots__/opened_stores.json +1 -1
- package/src/storage/backwards_compatibility_tests/schema_tests.ts +38 -4
- package/src/storage/contract_store/contract_store.ts +85 -92
- package/src/storage/fact_store/fact_service.ts +29 -5
- package/src/storage/fact_store/fact_store.ts +1 -1
- package/src/storage/fact_store/index.ts +10 -0
- package/src/storage/fact_store/origin_state.ts +75 -0
- package/src/storage/metadata.ts +1 -1
- package/src/storage/store_identity.ts +72 -0
- package/src/storage/tagging_store/sender_tagging_store.ts +62 -15
- package/src/storage/tagging_store/tagging_secret_sources_store.ts +36 -15
- package/src/tagging/constants.ts +19 -9
- 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/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.map +0 -1
- package/dest/contract_sync/helpers.d.ts +0 -28
- package/dest/contract_sync/helpers.d.ts.map +0 -1
- package/dest/contract_sync/helpers.js +0 -48
- package/src/contract_function_simulator/proxied_contract_data_source.ts +0 -60
- package/src/contract_sync/helpers.ts +0 -79
|
@@ -20,18 +20,13 @@ import { type FunctionCall, FunctionSelector } from '@aztec/stdlib/abi';
|
|
|
20
20
|
import type { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
21
21
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
22
22
|
import { BlockHash, type L2TipsProvider } from '@aztec/stdlib/block';
|
|
23
|
-
import type { CompleteAddress,
|
|
23
|
+
import type { CompleteAddress, ContractInstancePreimageWithAddress, PartialAddress } from '@aztec/stdlib/contract';
|
|
24
24
|
import { siloNullifier } from '@aztec/stdlib/hash';
|
|
25
25
|
import type { AztecNode } from '@aztec/stdlib/interfaces/server';
|
|
26
26
|
import type { KeyValidationRequest } from '@aztec/stdlib/kernel';
|
|
27
27
|
import { PublicKeys, computeAddressSecret, hashPublicKey } from '@aztec/stdlib/keys';
|
|
28
|
-
import {
|
|
29
|
-
|
|
30
|
-
FlatPublicLogs,
|
|
31
|
-
type PendingTaggedLog,
|
|
32
|
-
deriveAppSiloedSharedSecret,
|
|
33
|
-
} from '@aztec/stdlib/logs';
|
|
34
|
-
import { getNonNullifiedL1ToL2MessageWitness } from '@aztec/stdlib/messaging';
|
|
28
|
+
import { AppTaggingSecret, FlatPublicLogs, appSiloEcdhSharedSecret } from '@aztec/stdlib/logs';
|
|
29
|
+
import { type UnsiloedMessageNullifier, getL1ToL2MessageWitness } from '@aztec/stdlib/messaging';
|
|
35
30
|
import type { NoteStatus } from '@aztec/stdlib/note';
|
|
36
31
|
import { MerkleTreeId, type NullifierMembershipWitness, PublicDataWitness } from '@aztec/stdlib/trees';
|
|
37
32
|
import {
|
|
@@ -40,11 +35,12 @@ import {
|
|
|
40
35
|
type Capsule,
|
|
41
36
|
type IndexedTxEffect,
|
|
42
37
|
type OffchainEffect,
|
|
38
|
+
type TxEffect,
|
|
43
39
|
type TxHash,
|
|
44
40
|
} from '@aztec/stdlib/tx';
|
|
45
41
|
|
|
42
|
+
import type { ContractSyncService } from '../../contract/contract_sync_service.js';
|
|
46
43
|
import { createContractLogger, logContractMessage, stripAztecnrLogPrefix } from '../../contract_logging.js';
|
|
47
|
-
import type { ContractSyncService } from '../../contract_sync/contract_sync_service.js';
|
|
48
44
|
import { EventService } from '../../events/event_service.js';
|
|
49
45
|
import type { UtilityCallAuthorizationRequest } from '../../hooks/authorize_utility_call.js';
|
|
50
46
|
import type { ExecutionHooks } from '../../hooks/index.js';
|
|
@@ -53,14 +49,16 @@ import { TxResolverService } from '../../messages/tx_resolver_service.js';
|
|
|
53
49
|
import { NoteService } from '../../notes/note_service.js';
|
|
54
50
|
import { ORACLE_VERSION_MAJOR } from '../../oracle_version.js';
|
|
55
51
|
import type { AddressStore } from '../../storage/address_store/address_store.js';
|
|
52
|
+
import { assertAllowedScope } from '../../storage/allowed_scopes.js';
|
|
56
53
|
import type { CapsuleService } from '../../storage/capsule_store/capsule_service.js';
|
|
57
|
-
import
|
|
58
|
-
import { FactCollectionKey, FactCollectionTypeKey } from '../../storage/fact_store/index.js';
|
|
54
|
+
import { FactCollectionKey, FactCollectionTypeKey, anchoredTipBlockNumbers } from '../../storage/fact_store/index.js';
|
|
59
55
|
import type { FactService, OriginBlock } from '../../storage/fact_store/index.js';
|
|
60
56
|
import type { NoteStore } from '../../storage/note_store/note_store.js';
|
|
61
57
|
import type { PrivateEventStore } from '../../storage/private_event_store/private_event_store.js';
|
|
62
58
|
import type { RecipientTaggingStore } from '../../storage/tagging_store/recipient_tagging_store.js';
|
|
63
59
|
import type { TaggingSecretSourcesStore } from '../../storage/tagging_store/tagging_secret_sources_store.js';
|
|
60
|
+
import type { AnchoredContractData } from '../anchored_contract_data.js';
|
|
61
|
+
import { AztecNodeReadCache } from '../aztec_node_read_cache.js';
|
|
64
62
|
import { EphemeralArrayService } from '../ephemeral_array_service.js';
|
|
65
63
|
import { BoundedVec } from '../noir-structs/bounded_vec.js';
|
|
66
64
|
import type { EmbeddedCurvePoint } from '../noir-structs/embedded_curve_point.js';
|
|
@@ -72,6 +70,7 @@ import type { LogRetrievalResponse } from '../noir-structs/log_retrieval_respons
|
|
|
72
70
|
import type { NoteData } from '../noir-structs/note_data.js';
|
|
73
71
|
import type { NoteValidationRequest } from '../noir-structs/note_validation_request.js';
|
|
74
72
|
import { Option } from '../noir-structs/option.js';
|
|
73
|
+
import type { PendingTaggedLog } from '../noir-structs/pending_tagged_log.js';
|
|
75
74
|
import type { ProvidedSecret } from '../noir-structs/provided_secret.js';
|
|
76
75
|
import type { ResolvedTx } from '../noir-structs/resolved_tx.js';
|
|
77
76
|
import type { TxEffectData } from '../noir-structs/tx_effect_data.js';
|
|
@@ -88,7 +87,7 @@ export type UtilityExecutionOracleArgs = {
|
|
|
88
87
|
authWitnesses: AuthWitness[];
|
|
89
88
|
capsules: Capsule[]; // TODO(#12425): Rename to transientCapsules
|
|
90
89
|
anchorBlockHeader: BlockHeader;
|
|
91
|
-
|
|
90
|
+
anchoredContractData: AnchoredContractData;
|
|
92
91
|
noteStore: NoteStore;
|
|
93
92
|
keyStore: KeyStore;
|
|
94
93
|
addressStore: AddressStore;
|
|
@@ -123,6 +122,7 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
|
|
|
123
122
|
private offchainEffects: OffchainEffect[] = [];
|
|
124
123
|
private readonly ephemeralArrayService = new EphemeralArrayService();
|
|
125
124
|
protected readonly transientArrayService: TransientArrayService;
|
|
125
|
+
private readonly aztecNodeReadCache: AztecNodeReadCache;
|
|
126
126
|
|
|
127
127
|
// We store oracle version to be able to show a nice error message when an oracle handler is missing.
|
|
128
128
|
private contractOracleVersion: { major: number; minor: number } | undefined;
|
|
@@ -131,7 +131,7 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
|
|
|
131
131
|
protected readonly authWitnesses: AuthWitness[];
|
|
132
132
|
protected readonly capsules: Capsule[];
|
|
133
133
|
protected readonly anchorBlockHeader: BlockHeader;
|
|
134
|
-
protected readonly
|
|
134
|
+
protected readonly anchoredContractData: AnchoredContractData;
|
|
135
135
|
protected readonly noteStore: NoteStore;
|
|
136
136
|
protected readonly keyStore: KeyStore;
|
|
137
137
|
protected readonly addressStore: AddressStore;
|
|
@@ -156,7 +156,7 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
|
|
|
156
156
|
this.authWitnesses = args.authWitnesses;
|
|
157
157
|
this.capsules = args.capsules;
|
|
158
158
|
this.anchorBlockHeader = args.anchorBlockHeader;
|
|
159
|
-
this.
|
|
159
|
+
this.anchoredContractData = args.anchoredContractData;
|
|
160
160
|
this.noteStore = args.noteStore;
|
|
161
161
|
this.keyStore = args.keyStore;
|
|
162
162
|
this.addressStore = args.addressStore;
|
|
@@ -176,6 +176,7 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
|
|
|
176
176
|
this.hooks = args.hooks;
|
|
177
177
|
this.utilityExecutor = args.utilityExecutor;
|
|
178
178
|
this.transientArrayService = args.transientArrayService;
|
|
179
|
+
this.aztecNodeReadCache = new AztecNodeReadCache(args.aztecNode);
|
|
179
180
|
}
|
|
180
181
|
|
|
181
182
|
public assertCompatibleOracleVersion(major: number, minor: number): void {
|
|
@@ -269,11 +270,27 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
|
|
|
269
270
|
// hash at all. If the block hash did not exist by the reference block hash, then the node will not return the
|
|
270
271
|
// membership witness as there is none.
|
|
271
272
|
const witness = await this.#queryWithBlockHashNotAfterAnchor(referenceBlockHash, () =>
|
|
272
|
-
this.
|
|
273
|
+
this.aztecNodeReadCache.getBlockHashMembershipWitness(referenceBlockHash, blockHash),
|
|
273
274
|
);
|
|
274
275
|
return witness ? Option.some(witness) : Option.none();
|
|
275
276
|
}
|
|
276
277
|
|
|
278
|
+
/** Returns whether each block hash is present in the archive tree at the referenced block. */
|
|
279
|
+
public async areBlockHashesInArchive(
|
|
280
|
+
referenceBlockHash: BlockHash,
|
|
281
|
+
blockHashes: EphemeralArray<BlockHash>,
|
|
282
|
+
): Promise<EphemeralArray<boolean>> {
|
|
283
|
+
const hashes = blockHashes.readAll(this.ephemeralArrayService);
|
|
284
|
+
const memberships = await this.#queryWithBlockHashNotAfterAnchor(referenceBlockHash, () =>
|
|
285
|
+
Promise.all(
|
|
286
|
+
hashes.map(blockHash =>
|
|
287
|
+
this.aztecNodeReadCache.getBlockHashMembershipWitness(referenceBlockHash, blockHash).then(Boolean),
|
|
288
|
+
),
|
|
289
|
+
),
|
|
290
|
+
);
|
|
291
|
+
return EphemeralArray.fromValues(this.ephemeralArrayService, memberships);
|
|
292
|
+
}
|
|
293
|
+
|
|
277
294
|
/**
|
|
278
295
|
* Returns a nullifier membership witness for a given nullifier at a given block.
|
|
279
296
|
* @param blockHash - The block hash at which to get the index.
|
|
@@ -322,7 +339,7 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
|
|
|
322
339
|
*/
|
|
323
340
|
public async getPublicDataWitness(blockHash: BlockHash, leafSlot: Fr): Promise<PublicDataWitness> {
|
|
324
341
|
const witness = await this.#queryWithBlockHashNotAfterAnchor(blockHash, () =>
|
|
325
|
-
this.
|
|
342
|
+
this.aztecNodeReadCache.getPublicDataWitness(blockHash, leafSlot),
|
|
326
343
|
);
|
|
327
344
|
if (!witness) {
|
|
328
345
|
throw new Error(`Public data witness not found for slot ${leafSlot} at block hash ${blockHash.toString()}.`);
|
|
@@ -384,8 +401,8 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
|
|
|
384
401
|
* @param address - Address.
|
|
385
402
|
* @returns A contract instance.
|
|
386
403
|
*/
|
|
387
|
-
public async getContractInstance(address: AztecAddress): Promise<
|
|
388
|
-
const instance = await this.
|
|
404
|
+
public async getContractInstance(address: AztecAddress): Promise<ContractInstancePreimageWithAddress> {
|
|
405
|
+
const instance = await this.anchoredContractData.getContractInstance(address);
|
|
389
406
|
if (!instance) {
|
|
390
407
|
throw new Error(`No contract instance found for address ${address.toString()}`);
|
|
391
408
|
}
|
|
@@ -482,19 +499,17 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
|
|
|
482
499
|
}
|
|
483
500
|
|
|
484
501
|
/**
|
|
485
|
-
* Returns the membership witness of an
|
|
486
|
-
* @param contractAddress - Address of a contract by which the message was emitted.
|
|
502
|
+
* Returns the membership witness of an L1 to L2 message.
|
|
487
503
|
* @param messageHash - Hash of the message.
|
|
488
|
-
* @param
|
|
489
|
-
*
|
|
504
|
+
* @param nullifier - When present, the unsiloed nullifier of the message and the address to silo it with. The witness
|
|
505
|
+
* is only returned if the siloed nullifier is absent from the nullifier tree, i.e. the message has not been consumed.
|
|
490
506
|
* @returns The l1 to l2 membership witness (index of message in the tree and sibling path).
|
|
491
507
|
*/
|
|
492
|
-
public async
|
|
493
|
-
const [messageIndex, siblingPath] = await
|
|
508
|
+
public async getL1ToL2MembershipWitnessV2(messageHash: Fr, nullifier: Option<UnsiloedMessageNullifier>) {
|
|
509
|
+
const [messageIndex, siblingPath] = await getL1ToL2MessageWitness(
|
|
494
510
|
this.aztecNode,
|
|
495
|
-
contractAddress,
|
|
496
511
|
messageHash,
|
|
497
|
-
|
|
512
|
+
nullifier.value,
|
|
498
513
|
await this.anchorBlockHeader.hash(),
|
|
499
514
|
);
|
|
500
515
|
|
|
@@ -515,16 +530,16 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
|
|
|
515
530
|
numberOfElements: number,
|
|
516
531
|
) {
|
|
517
532
|
return this.#queryWithBlockHashNotAfterAnchor(blockHash, async () => {
|
|
518
|
-
const
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
slots.map(storageSlot => this.aztecNode.getPublicStorageAt(blockHash, contractAddress, storageSlot)),
|
|
533
|
+
const values = await this.aztecNodeReadCache.getPublicStorageRange(
|
|
534
|
+
blockHash,
|
|
535
|
+
contractAddress,
|
|
536
|
+
startStorageSlot,
|
|
537
|
+
numberOfElements,
|
|
524
538
|
);
|
|
525
539
|
|
|
526
540
|
this.logger.debug(
|
|
527
|
-
`Oracle storage read:
|
|
541
|
+
`Oracle storage read: start=${startStorageSlot.toString()} count=${numberOfElements} ` +
|
|
542
|
+
`address=${contractAddress.toString()} values=[${values.join(', ')}]`,
|
|
528
543
|
);
|
|
529
544
|
|
|
530
545
|
return values;
|
|
@@ -540,7 +555,7 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
|
|
|
540
555
|
// to re-use jobId as instanceId here as executions of different PXE jobs are isolated.
|
|
541
556
|
this.contractLogger = await createContractLogger(
|
|
542
557
|
this.contractAddress,
|
|
543
|
-
addr => this.
|
|
558
|
+
addr => this.anchoredContractData.getDebugContractName(addr),
|
|
544
559
|
'user',
|
|
545
560
|
{ instanceId: this.jobId },
|
|
546
561
|
);
|
|
@@ -557,7 +572,7 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
|
|
|
557
572
|
// to re-use jobId as instanceId here as executions of different PXE jobs are isolated.
|
|
558
573
|
this.aztecnrLogger = await createContractLogger(
|
|
559
574
|
this.contractAddress,
|
|
560
|
-
addr => this.
|
|
575
|
+
addr => this.anchoredContractData.getDebugContractName(addr),
|
|
561
576
|
'aztecnr',
|
|
562
577
|
{ instanceId: this.jobId },
|
|
563
578
|
);
|
|
@@ -577,7 +592,7 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
|
|
|
577
592
|
}
|
|
578
593
|
|
|
579
594
|
/** Fetches pending tagged logs into a freshly allocated ephemeral array and returns it. */
|
|
580
|
-
public async
|
|
595
|
+
public async getPendingTaggedLogsV2(
|
|
581
596
|
scope: AztecAddress,
|
|
582
597
|
providedSecrets: EphemeralArray<ProvidedSecret>,
|
|
583
598
|
): Promise<EphemeralArray<PendingTaggedLog>> {
|
|
@@ -599,6 +614,7 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
|
|
|
599
614
|
this.recipientTaggingStore,
|
|
600
615
|
this.taggingSecretSourcesStore,
|
|
601
616
|
this.addressStore,
|
|
617
|
+
this.scopes,
|
|
602
618
|
this.jobId,
|
|
603
619
|
this.logger.getBindings(),
|
|
604
620
|
);
|
|
@@ -635,7 +651,7 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
|
|
|
635
651
|
]);
|
|
636
652
|
}
|
|
637
653
|
|
|
638
|
-
public async
|
|
654
|
+
public async getLogsByTagV2(
|
|
639
655
|
requests: EphemeralArray<LogRetrievalRequest>,
|
|
640
656
|
): Promise<EphemeralArray<EphemeralArray<LogRetrievalResponse>>> {
|
|
641
657
|
const logRetrievalRequests = requests.readAll(this.ephemeralArrayService);
|
|
@@ -670,21 +686,25 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
|
|
|
670
686
|
throw new Error('Invalid tx hash passed into aztec_utl_getTxEffect oracle handler');
|
|
671
687
|
}
|
|
672
688
|
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
689
|
+
return await this.#getTxEffectOption(txHash);
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
/** Fetches transaction effects for all hashes, preserving request order. */
|
|
693
|
+
public async getTxEffects(txHashes: EphemeralArray<TxHash>): Promise<EphemeralArray<Option<TxEffectData>>> {
|
|
694
|
+
const hashes = txHashes.readAll(this.ephemeralArrayService);
|
|
695
|
+
const invalidHash = hashes.find(txHash => txHash.hash.isZero());
|
|
696
|
+
if (invalidHash) {
|
|
697
|
+
throw new Error('Invalid tx hash passed into aztec_utl_getTxEffects oracle handler');
|
|
676
698
|
}
|
|
677
699
|
|
|
678
|
-
const
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
})),
|
|
687
|
-
});
|
|
700
|
+
const uniqueTxHashes = uniqueBy(hashes, h => h.toString());
|
|
701
|
+
const options = await Promise.all(uniqueTxHashes.map(txHash => this.#getTxEffectOption(txHash)));
|
|
702
|
+
const optionsByHash = new Map(uniqueTxHashes.map((txHash, i) => [txHash.toString(), options[i]]));
|
|
703
|
+
|
|
704
|
+
return EphemeralArray.fromValues(
|
|
705
|
+
this.ephemeralArrayService,
|
|
706
|
+
hashes.map(txHash => optionsByHash.get(txHash.toString())!),
|
|
707
|
+
);
|
|
688
708
|
}
|
|
689
709
|
|
|
690
710
|
public setCapsule(contractAddress: AztecAddress, slot: Fr, capsule: Fr[], scope: AztecAddress): void {
|
|
@@ -777,8 +797,10 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
|
|
|
777
797
|
factCollectionId: Fr,
|
|
778
798
|
): Promise<Option<FactCollection>> {
|
|
779
799
|
this.#assertOwnContract(contractAddress);
|
|
800
|
+
const tips = anchoredTipBlockNumbers(await this.l2TipsStore.getL2Tips(), this.anchorBlockHeader.getBlockNumber());
|
|
780
801
|
const collection = await this.factService.getFactCollection(
|
|
781
802
|
new FactCollectionKey(contractAddress, scope, factCollectionTypeId, factCollectionId),
|
|
803
|
+
tips,
|
|
782
804
|
this.jobId,
|
|
783
805
|
);
|
|
784
806
|
return collection
|
|
@@ -802,8 +824,10 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
|
|
|
802
824
|
factCollectionTypeId: Fr,
|
|
803
825
|
): Promise<EphemeralArray<FactCollection>> {
|
|
804
826
|
this.#assertOwnContract(contractAddress);
|
|
827
|
+
const tips = anchoredTipBlockNumbers(await this.l2TipsStore.getL2Tips(), this.anchorBlockHeader.getBlockNumber());
|
|
805
828
|
const collections = await this.factService.getFactCollectionsByType(
|
|
806
829
|
new FactCollectionTypeKey(contractAddress, scope, factCollectionTypeId),
|
|
830
|
+
tips,
|
|
807
831
|
this.jobId,
|
|
808
832
|
);
|
|
809
833
|
return EphemeralArray.fromValues(
|
|
@@ -853,7 +877,9 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
|
|
|
853
877
|
* @param address - The recipient address.
|
|
854
878
|
* @param ephPks - Ephemeral array containing the serialized Points.
|
|
855
879
|
* @param contractAddress - The contract address for app-siloing (validated against execution context).
|
|
856
|
-
* @returns A new ephemeral array containing the computed shared secrets
|
|
880
|
+
* @returns A new ephemeral array containing the computed shared secrets, or an empty array when the PXE does not
|
|
881
|
+
* hold the keys for `address`.
|
|
882
|
+
* @throws If `address` is not in the execution's allowed scopes.
|
|
857
883
|
*/
|
|
858
884
|
public async getSharedSecrets(
|
|
859
885
|
address: AztecAddress,
|
|
@@ -865,14 +891,29 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
|
|
|
865
891
|
`getSharedSecrets called with contract address ${contractAddress}, expected ${this.contractAddress}`,
|
|
866
892
|
);
|
|
867
893
|
}
|
|
868
|
-
|
|
894
|
+
|
|
895
|
+
assertAllowedScope(address, this.scopes);
|
|
896
|
+
|
|
897
|
+
// An address can be in scope without the PXE holding its keys (e.g. syncing a registered but non-owned account),
|
|
898
|
+
// in which case no secrets can be derived and we return an empty array rather than failing.
|
|
899
|
+
const recipientCompleteAddress = await this.addressStore.getCompleteAddress(address);
|
|
900
|
+
if (!recipientCompleteAddress) {
|
|
901
|
+
this.logger.warn(
|
|
902
|
+
`Computing shared secrets for address ${address} whose keys are not held - returning no secrets`,
|
|
903
|
+
{
|
|
904
|
+
address,
|
|
905
|
+
contractAddress: this.contractAddress,
|
|
906
|
+
},
|
|
907
|
+
);
|
|
908
|
+
return EphemeralArray.fromValues<Fr>(this.ephemeralArrayService, []);
|
|
909
|
+
}
|
|
869
910
|
const ivpkMHash = await hashPublicKey(recipientCompleteAddress.publicKeys.ivpkM);
|
|
870
911
|
const ivskM = await this.keyStore.getMasterSecretKey(ivpkMHash);
|
|
871
912
|
const addressSecret = await computeAddressSecret(await recipientCompleteAddress.getPreaddress(), ivskM);
|
|
872
913
|
|
|
873
914
|
const ephPkPoints = ephPks.readAll(this.ephemeralArrayService);
|
|
874
915
|
const secrets = await Promise.all(
|
|
875
|
-
ephPkPoints.map(({ x, y }) =>
|
|
916
|
+
ephPkPoints.map(({ x, y }) => appSiloEcdhSharedSecret(addressSecret, new Point(x, y), this.contractAddress)),
|
|
876
917
|
);
|
|
877
918
|
|
|
878
919
|
return EphemeralArray.fromValues(this.ephemeralArrayService, secrets);
|
|
@@ -945,23 +986,35 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
|
|
|
945
986
|
functionSelector: FunctionSelector,
|
|
946
987
|
args: Fr[],
|
|
947
988
|
): Promise<Fr[]> {
|
|
948
|
-
const targetArtifact = await this.
|
|
989
|
+
const targetArtifact = await this.anchoredContractData.getFunctionArtifactWithDebugMetadata(
|
|
949
990
|
targetContractAddress,
|
|
950
991
|
functionSelector,
|
|
951
992
|
);
|
|
993
|
+
if (!targetArtifact) {
|
|
994
|
+
throw new Error(
|
|
995
|
+
`Cannot call ${targetContractAddress}:${functionSelector}: the contract is not registered. ` +
|
|
996
|
+
`Register it via wallet.registerContract(...).`,
|
|
997
|
+
);
|
|
998
|
+
}
|
|
952
999
|
|
|
953
1000
|
if (!targetContractAddress.equals(this.contractAddress)) {
|
|
954
1001
|
// Standard handshake registry reads are authorized by default; every other cross-contract call needs the hook.
|
|
955
1002
|
if (!(await isStandardHandshakeRegistryUtilityRead(targetContractAddress, functionSelector))) {
|
|
956
|
-
const [
|
|
957
|
-
this.
|
|
958
|
-
this.
|
|
1003
|
+
const [callerClassId, targetClassId] = await Promise.all([
|
|
1004
|
+
this.anchoredContractData.getCurrentClassId(this.contractAddress),
|
|
1005
|
+
this.anchoredContractData.getCurrentClassId(targetContractAddress),
|
|
959
1006
|
]);
|
|
1007
|
+
if (!callerClassId || !targetClassId) {
|
|
1008
|
+
throw new Error(
|
|
1009
|
+
`Cannot authorize utility call from ${this.contractAddress} to ${targetContractAddress}: ` +
|
|
1010
|
+
`${!callerClassId ? this.contractAddress : targetContractAddress} is not registered.`,
|
|
1011
|
+
);
|
|
1012
|
+
}
|
|
960
1013
|
const request: UtilityCallAuthorizationRequest = {
|
|
961
1014
|
caller: this.contractAddress,
|
|
962
|
-
callerClassId
|
|
1015
|
+
callerClassId,
|
|
963
1016
|
target: targetContractAddress,
|
|
964
|
-
targetClassId
|
|
1017
|
+
targetClassId,
|
|
965
1018
|
functionSelector,
|
|
966
1019
|
functionName: targetArtifact.name,
|
|
967
1020
|
args,
|
|
@@ -1006,7 +1059,7 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
|
|
|
1006
1059
|
authWitnesses: this.authWitnesses,
|
|
1007
1060
|
capsules: this.capsules,
|
|
1008
1061
|
anchorBlockHeader: this.anchorBlockHeader,
|
|
1009
|
-
|
|
1062
|
+
anchoredContractData: this.anchoredContractData,
|
|
1010
1063
|
noteStore: this.noteStore,
|
|
1011
1064
|
keyStore: this.keyStore,
|
|
1012
1065
|
addressStore: this.addressStore,
|
|
@@ -1056,9 +1109,7 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
|
|
|
1056
1109
|
*/
|
|
1057
1110
|
async #fetchTxEffects(txHashes: TxHash[]): Promise<Map<string, IndexedTxEffect>> {
|
|
1058
1111
|
const uniqueTxHashes = uniqueBy(txHashes, h => h.toString());
|
|
1059
|
-
const fetched = await Promise.all(
|
|
1060
|
-
uniqueTxHashes.map(h => this.aztecNode.getTxReceipt(h, { includeTxEffect: true })),
|
|
1061
|
-
);
|
|
1112
|
+
const fetched = await Promise.all(uniqueTxHashes.map(h => this.aztecNodeReadCache.getTxReceiptWithEffect(h)));
|
|
1062
1113
|
return new Map(
|
|
1063
1114
|
uniqueTxHashes
|
|
1064
1115
|
.map((h, i): [string, IndexedTxEffect | undefined] => {
|
|
@@ -1081,6 +1132,26 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
|
|
|
1081
1132
|
);
|
|
1082
1133
|
}
|
|
1083
1134
|
|
|
1135
|
+
async #getTxEffectOption(txHash: TxHash): Promise<Option<TxEffectData>> {
|
|
1136
|
+
const receipt = await this.aztecNodeReadCache.getTxReceiptWithEffect(txHash);
|
|
1137
|
+
if (!receipt.isMined() || !receipt.txEffect || receipt.blockNumber > this.anchorBlockHeader.getBlockNumber()) {
|
|
1138
|
+
return Option.none();
|
|
1139
|
+
}
|
|
1140
|
+
return Option.some(this.#toTxEffectData(receipt.txEffect));
|
|
1141
|
+
}
|
|
1142
|
+
|
|
1143
|
+
#toTxEffectData(txEffect: TxEffect): TxEffectData {
|
|
1144
|
+
return {
|
|
1145
|
+
...txEffect,
|
|
1146
|
+
publicLogs: FlatPublicLogs.fromLogs(txEffect.publicLogs),
|
|
1147
|
+
contractClassLogs: txEffect.contractClassLogs.map(log => ({
|
|
1148
|
+
contractAddress: log.contractAddress,
|
|
1149
|
+
fields: log.fields.toFields(),
|
|
1150
|
+
emittedLength: log.emittedLength,
|
|
1151
|
+
})),
|
|
1152
|
+
};
|
|
1153
|
+
}
|
|
1154
|
+
|
|
1084
1155
|
/** Runs a query concurrently with a validation that the block hash is not ahead of the anchor block. */
|
|
1085
1156
|
async #queryWithBlockHashNotAfterAnchor<T>(blockHash: BlockHash, query: () => Promise<T>): Promise<T> {
|
|
1086
1157
|
// Most contracts query state at the "current" block, which is the anchor. Skip the validation when we can.
|
|
@@ -1092,7 +1163,7 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
|
|
|
1092
1163
|
const [response] = await Promise.all([
|
|
1093
1164
|
query(),
|
|
1094
1165
|
(async () => {
|
|
1095
|
-
const block = await this.
|
|
1166
|
+
const block = await this.aztecNodeReadCache.getBlock(blockHash);
|
|
1096
1167
|
const header = block?.header;
|
|
1097
1168
|
if (!header) {
|
|
1098
1169
|
throw new Error(`Could not find block header for block hash ${blockHash}`);
|
|
@@ -1119,8 +1190,14 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
|
|
|
1119
1190
|
}
|
|
1120
1191
|
}
|
|
1121
1192
|
|
|
1122
|
-
|
|
1123
|
-
|
|
1193
|
+
// Registry reads that any contract may issue without an `authorizeUtilityCall` hook. The constrained-delivery
|
|
1194
|
+
// library calls these implicitly for the app, and they are safe to default-authorize: `get_app_siloed_secrets`
|
|
1195
|
+
// siloes every returned secret to `msg_sender`, and `get_non_interactive_handshakes` only exposes ephemeral public
|
|
1196
|
+
// keys, from which the shared secret cannot be derived without the recipient's secret keys.
|
|
1197
|
+
const STANDARD_HANDSHAKE_REGISTRY_DEFAULT_AUTHORIZED_READ_SIGNATURES = [
|
|
1198
|
+
'get_non_interactive_handshakes((Field),u32)',
|
|
1199
|
+
'get_app_siloed_secrets((Field),(Field))',
|
|
1200
|
+
];
|
|
1124
1201
|
|
|
1125
1202
|
async function doesSelectorHaveSignature(functionSelector: FunctionSelector, signature: string): Promise<boolean> {
|
|
1126
1203
|
return functionSelector.equals(await FunctionSelector.fromSignature(signature));
|
|
@@ -1140,9 +1217,10 @@ async function isStandardHandshakeRegistryUtilityRead(
|
|
|
1140
1217
|
return false;
|
|
1141
1218
|
}
|
|
1142
1219
|
|
|
1143
|
-
const
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1220
|
+
const matches = await Promise.all(
|
|
1221
|
+
STANDARD_HANDSHAKE_REGISTRY_DEFAULT_AUTHORIZED_READ_SIGNATURES.map(signature =>
|
|
1222
|
+
doesSelectorHaveSignature(functionSelector, signature),
|
|
1223
|
+
),
|
|
1224
|
+
);
|
|
1225
|
+
return matches.some(Boolean);
|
|
1148
1226
|
}
|
|
@@ -5,8 +5,8 @@ import type { NoteDao } from '@aztec/stdlib/note';
|
|
|
5
5
|
import type { ContractOverrides } from '@aztec/stdlib/tx';
|
|
6
6
|
|
|
7
7
|
import type { BlockSynchronizer } from '../block_synchronizer/block_synchronizer.js';
|
|
8
|
+
import type { ContractSyncService } from '../contract/contract_sync_service.js';
|
|
8
9
|
import type { ContractFunctionSimulator } from '../contract_function_simulator/contract_function_simulator.js';
|
|
9
|
-
import type { ContractSyncService } from '../contract_sync/contract_sync_service.js';
|
|
10
10
|
import type { NotesFilter } from '../notes_filter.js';
|
|
11
11
|
import type { AnchorBlockStore } from '../storage/index.js';
|
|
12
12
|
import type { NoteStore } from '../storage/note_store/note_store.js';
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { BBBundlePrivateKernelProver } from '@aztec/bb-prover/client/bundle';
|
|
2
2
|
import { createLogger } from '@aztec/foundation/log';
|
|
3
|
-
import { createStore } from '@aztec/kv-store/indexeddb';
|
|
4
3
|
import { BundledProtocolContractsProvider } from '@aztec/protocol-contracts/providers/bundle';
|
|
5
4
|
import { WASMSimulator } from '@aztec/simulator/client';
|
|
6
5
|
import { getStandardAuthRegistry } from '@aztec/standard-contracts/auth-registry';
|
|
@@ -12,6 +11,7 @@ import type { PXEConfig } from '../../../config/index.js';
|
|
|
12
11
|
import { PXE } from '../../../pxe.js';
|
|
13
12
|
import { PXE_DATA_SCHEMA_VERSION } from '../../../storage/metadata.js';
|
|
14
13
|
import { type PXECreationOptions, isPrivateKernelProver } from '../../pxe_creation_options.js';
|
|
14
|
+
import { openBrowserStore } from '../store.js';
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* Create and start an PXE instance with the given AztecNode.
|
|
@@ -31,16 +31,28 @@ export async function createPXE(
|
|
|
31
31
|
const actor = options.loggerActorLabel;
|
|
32
32
|
const loggers = options.loggers ?? {};
|
|
33
33
|
|
|
34
|
-
const l1ContractAddresses = await aztecNode.
|
|
34
|
+
const { l1ChainId, l1ContractAddresses, rollupVersion } = await aztecNode.getNodeInfo();
|
|
35
35
|
const configWithContracts = {
|
|
36
36
|
...config,
|
|
37
37
|
...l1ContractAddresses,
|
|
38
|
+
l1ChainId,
|
|
39
|
+
rollupVersion,
|
|
38
40
|
} as PXEConfig;
|
|
39
41
|
|
|
40
|
-
const storeLogger = loggers.store ?? createLogger('pxe:data
|
|
42
|
+
const storeLogger = loggers.store ?? createLogger('pxe:data', { actor });
|
|
41
43
|
|
|
42
44
|
const store =
|
|
43
|
-
options.store ??
|
|
45
|
+
options.store ??
|
|
46
|
+
(await openBrowserStore(
|
|
47
|
+
'pxe_data',
|
|
48
|
+
PXE_DATA_SCHEMA_VERSION,
|
|
49
|
+
{
|
|
50
|
+
l1ChainId,
|
|
51
|
+
rollupAddress: l1ContractAddresses.rollupAddress,
|
|
52
|
+
dataStoreMapSizeKb: configWithContracts.dataStoreMapSizeKb,
|
|
53
|
+
},
|
|
54
|
+
storeLogger,
|
|
55
|
+
));
|
|
44
56
|
|
|
45
57
|
const simulator = options.simulator ?? new WASMSimulator();
|
|
46
58
|
const proverLogger = loggers.prover ?? createLogger('pxe:bb:wasm:bundle', { actor });
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { BBLazyPrivateKernelProver } from '@aztec/bb-prover/client/lazy';
|
|
2
2
|
import { createLogger } from '@aztec/foundation/log';
|
|
3
|
-
import { createStore } from '@aztec/kv-store/indexeddb';
|
|
4
3
|
import { LazyProtocolContractsProvider } from '@aztec/protocol-contracts/providers/lazy';
|
|
5
4
|
import { WASMSimulator } from '@aztec/simulator/client';
|
|
6
5
|
import { getStandardAuthRegistry } from '@aztec/standard-contracts/auth-registry/lazy';
|
|
@@ -12,6 +11,7 @@ import type { PXEConfig } from '../../../config/index.js';
|
|
|
12
11
|
import { PXE } from '../../../pxe.js';
|
|
13
12
|
import { PXE_DATA_SCHEMA_VERSION } from '../../../storage/metadata.js';
|
|
14
13
|
import { type PXECreationOptions, isPrivateKernelProver } from '../../pxe_creation_options.js';
|
|
14
|
+
import { openBrowserStore } from '../store.js';
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* Create and start an PXE instance with the given AztecNode.
|
|
@@ -29,18 +29,30 @@ export async function createPXE(
|
|
|
29
29
|
) {
|
|
30
30
|
const actor = options.loggerActorLabel;
|
|
31
31
|
|
|
32
|
-
const l1ContractAddresses = await aztecNode.
|
|
32
|
+
const { l1ChainId, l1ContractAddresses, rollupVersion } = await aztecNode.getNodeInfo();
|
|
33
33
|
const configWithContracts = {
|
|
34
34
|
...config,
|
|
35
35
|
...l1ContractAddresses,
|
|
36
|
+
l1ChainId,
|
|
37
|
+
rollupVersion,
|
|
36
38
|
} as PXEConfig;
|
|
37
39
|
|
|
38
40
|
const loggers = options.loggers ?? {};
|
|
39
41
|
|
|
40
|
-
const storeLogger = loggers.store ?? createLogger('pxe:data
|
|
42
|
+
const storeLogger = loggers.store ?? createLogger('pxe:data', { actor });
|
|
41
43
|
|
|
42
44
|
const store =
|
|
43
|
-
options.store ??
|
|
45
|
+
options.store ??
|
|
46
|
+
(await openBrowserStore(
|
|
47
|
+
'pxe_data',
|
|
48
|
+
PXE_DATA_SCHEMA_VERSION,
|
|
49
|
+
{
|
|
50
|
+
l1ChainId,
|
|
51
|
+
rollupAddress: l1ContractAddresses.rollupAddress,
|
|
52
|
+
dataStoreMapSizeKb: configWithContracts.dataStoreMapSizeKb,
|
|
53
|
+
},
|
|
54
|
+
storeLogger,
|
|
55
|
+
));
|
|
44
56
|
|
|
45
57
|
const simulator = options.simulator ?? new WASMSimulator();
|
|
46
58
|
const proverLogger = loggers.prover ?? createLogger('pxe:bb:wasm:bundle', { actor });
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
2
|
+
import { type Logger, createLogger } from '@aztec/foundation/log';
|
|
3
|
+
import { AztecSQLiteOPFSStore, storePoolDirectory } from '@aztec/kv-store/sqlite-opfs';
|
|
4
|
+
|
|
5
|
+
import { assertStoreIdentity, effectiveStoreName } from '../../storage/store_identity.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Opens the persistent browser (sqlite-opfs) store selected by `name` and identity `(config.l1ChainId,
|
|
9
|
+
* config.rollupAddress, schemaVersion)` triple. A store exists per identity: reopening with the same identity returns
|
|
10
|
+
* the same data, a different identity selects a different (possibly fresh) store.
|
|
11
|
+
*/
|
|
12
|
+
export async function openBrowserStore(
|
|
13
|
+
name: string,
|
|
14
|
+
schemaVersion: number,
|
|
15
|
+
config: { l1ChainId: number; rollupAddress: EthAddress; dataStoreMapSizeKb?: number },
|
|
16
|
+
log: Logger = createLogger('pxe:data'),
|
|
17
|
+
): Promise<AztecSQLiteOPFSStore> {
|
|
18
|
+
const identity = { l1ChainId: config.l1ChainId, rollupAddress: config.rollupAddress, schemaVersion };
|
|
19
|
+
const storeName = effectiveStoreName(name, identity);
|
|
20
|
+
log.info(`Creating ${storeName} SQLite-OPFS data store`, {
|
|
21
|
+
storeName,
|
|
22
|
+
dataStoreMapSizeKb: config.dataStoreMapSizeKb,
|
|
23
|
+
});
|
|
24
|
+
const store = await AztecSQLiteOPFSStore.open(
|
|
25
|
+
createLogger('kv-store:sqlite-opfs'),
|
|
26
|
+
storeName,
|
|
27
|
+
false,
|
|
28
|
+
storePoolDirectory(storeName),
|
|
29
|
+
);
|
|
30
|
+
try {
|
|
31
|
+
await assertStoreIdentity(store, storeName, identity);
|
|
32
|
+
} catch (err) {
|
|
33
|
+
// The store handle owns a worker and OPFS locks; release them before surfacing the refusal.
|
|
34
|
+
await store.close().catch(() => {});
|
|
35
|
+
throw err;
|
|
36
|
+
}
|
|
37
|
+
return store;
|
|
38
|
+
}
|
|
@@ -1,11 +1,16 @@
|
|
|
1
|
+
export { type AccountPrivacyKeys, type AccountPrivacySecretKeys } from '@aztec/key-store';
|
|
2
|
+
|
|
1
3
|
export * from '../../notes_filter.js';
|
|
2
4
|
export * from '../../pxe.js';
|
|
3
5
|
export * from '../../config/index.js';
|
|
4
6
|
export * from '../../error_enriching.js';
|
|
5
7
|
export * from '../../storage/index.js';
|
|
6
8
|
export * from './utils.js';
|
|
9
|
+
export * from './store.js';
|
|
7
10
|
export { NoteService } from '../../notes/note_service.js';
|
|
8
11
|
export { ORACLE_VERSION_MAJOR, ORACLE_VERSION_MINOR } from '../../oracle_version.js';
|
|
9
12
|
export { type PXECreationOptions } from '../pxe_creation_options.js';
|
|
10
13
|
export { JobCoordinator } from '../../job_coordinator/job_coordinator.js';
|
|
11
|
-
export { ContractSyncService } from '../../
|
|
14
|
+
export { ContractSyncService } from '../../contract/contract_sync_service.js';
|
|
15
|
+
export { ContractClassService } from '../../contract/contract_class_service.js';
|
|
16
|
+
export { AnchoredContractData } from '../../contract_function_simulator/anchored_contract_data.js';
|