@aztec/pxe 5.0.0-rc.2 → 5.0.0
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 +10 -7
- package/dest/contract_function_simulator/oracle/oracle_registry.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/oracle_registry.js +41 -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 +20 -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 +68 -47
- 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/utils.js +2 -2
- package/dest/entrypoints/client/lazy/utils.js +2 -2
- package/dest/entrypoints/server/index.d.ts +5 -2
- package/dest/entrypoints/server/index.d.ts.map +1 -1
- package/dest/entrypoints/server/index.js +3 -1
- 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 +3 -2
- package/dest/logs/log_service.d.ts.map +1 -1
- package/dest/logs/log_service.js +33 -16
- 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 +135 -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/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/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 +32 -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 +104 -59
- package/src/debug/pxe_debug_utils.ts +1 -1
- package/src/entrypoints/client/bundle/utils.ts +2 -2
- package/src/entrypoints/client/lazy/utils.ts +2 -2
- package/src/entrypoints/server/index.ts +5 -1
- 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 +31 -11
- 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 +209 -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/tagging_store/tagging_secret_sources_store.ts +36 -15
- package/src/tagging/constants.ts +19 -9
- 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
|
@@ -8,8 +8,8 @@ import { STANDARD_HANDSHAKE_REGISTRY_ADDRESS } from '@aztec/standard-contracts/h
|
|
|
8
8
|
import { FunctionSelector } from '@aztec/stdlib/abi';
|
|
9
9
|
import { siloNullifier } from '@aztec/stdlib/hash';
|
|
10
10
|
import { computeAddressSecret, hashPublicKey } from '@aztec/stdlib/keys';
|
|
11
|
-
import { AppTaggingSecret, FlatPublicLogs,
|
|
12
|
-
import {
|
|
11
|
+
import { AppTaggingSecret, FlatPublicLogs, appSiloEcdhSharedSecret } from '@aztec/stdlib/logs';
|
|
12
|
+
import { getL1ToL2MessageWitness } from '@aztec/stdlib/messaging';
|
|
13
13
|
import { MerkleTreeId } from '@aztec/stdlib/trees';
|
|
14
14
|
import { CallContext } from '@aztec/stdlib/tx';
|
|
15
15
|
import { createContractLogger, logContractMessage, stripAztecnrLogPrefix } from '../../contract_logging.js';
|
|
@@ -17,7 +17,8 @@ import { EventService } from '../../events/event_service.js';
|
|
|
17
17
|
import { LogService } from '../../logs/log_service.js';
|
|
18
18
|
import { NoteService } from '../../notes/note_service.js';
|
|
19
19
|
import { ORACLE_VERSION_MAJOR } from '../../oracle_version.js';
|
|
20
|
-
import { FactCollectionKey, FactCollectionTypeKey } from '../../storage/fact_store/index.js';
|
|
20
|
+
import { FactCollectionKey, FactCollectionTypeKey, anchoredTipBlockNumbers } from '../../storage/fact_store/index.js';
|
|
21
|
+
import { AztecNodeReadCache } from '../aztec_node_read_cache.js';
|
|
21
22
|
import { EphemeralArrayService } from '../ephemeral_array_service.js';
|
|
22
23
|
import { BoundedVec } from '../noir-structs/bounded_vec.js';
|
|
23
24
|
import { EphemeralArray } from '../noir-structs/ephemeral_array.js';
|
|
@@ -35,13 +36,14 @@ import { buildACIRCallback } from './acir_callback.js';
|
|
|
35
36
|
offchainEffects = [];
|
|
36
37
|
ephemeralArrayService = new EphemeralArrayService();
|
|
37
38
|
transientArrayService;
|
|
39
|
+
aztecNodeReadCache;
|
|
38
40
|
// We store oracle version to be able to show a nice error message when an oracle handler is missing.
|
|
39
41
|
contractOracleVersion;
|
|
40
42
|
callContext;
|
|
41
43
|
authWitnesses;
|
|
42
44
|
capsules;
|
|
43
45
|
anchorBlockHeader;
|
|
44
|
-
|
|
46
|
+
anchoredContractData;
|
|
45
47
|
noteStore;
|
|
46
48
|
keyStore;
|
|
47
49
|
addressStore;
|
|
@@ -65,7 +67,7 @@ import { buildACIRCallback } from './acir_callback.js';
|
|
|
65
67
|
this.authWitnesses = args.authWitnesses;
|
|
66
68
|
this.capsules = args.capsules;
|
|
67
69
|
this.anchorBlockHeader = args.anchorBlockHeader;
|
|
68
|
-
this.
|
|
70
|
+
this.anchoredContractData = args.anchoredContractData;
|
|
69
71
|
this.noteStore = args.noteStore;
|
|
70
72
|
this.keyStore = args.keyStore;
|
|
71
73
|
this.addressStore = args.addressStore;
|
|
@@ -85,6 +87,7 @@ import { buildACIRCallback } from './acir_callback.js';
|
|
|
85
87
|
this.hooks = args.hooks;
|
|
86
88
|
this.utilityExecutor = args.utilityExecutor;
|
|
87
89
|
this.transientArrayService = args.transientArrayService;
|
|
90
|
+
this.aztecNodeReadCache = new AztecNodeReadCache(args.aztecNode);
|
|
88
91
|
}
|
|
89
92
|
assertCompatibleOracleVersion(major, minor) {
|
|
90
93
|
if (major !== ORACLE_VERSION_MAJOR) {
|
|
@@ -156,9 +159,14 @@ import { buildACIRCallback } from './acir_callback.js';
|
|
|
156
159
|
// Note that we validate that the reference block hash is at or before the anchor block - we don't test the block
|
|
157
160
|
// hash at all. If the block hash did not exist by the reference block hash, then the node will not return the
|
|
158
161
|
// membership witness as there is none.
|
|
159
|
-
const witness = await this.#queryWithBlockHashNotAfterAnchor(referenceBlockHash, ()=>this.
|
|
162
|
+
const witness = await this.#queryWithBlockHashNotAfterAnchor(referenceBlockHash, ()=>this.aztecNodeReadCache.getBlockHashMembershipWitness(referenceBlockHash, blockHash));
|
|
160
163
|
return witness ? Option.some(witness) : Option.none();
|
|
161
164
|
}
|
|
165
|
+
/** Returns whether each block hash is present in the archive tree at the referenced block. */ async areBlockHashesInArchive(referenceBlockHash, blockHashes) {
|
|
166
|
+
const hashes = blockHashes.readAll(this.ephemeralArrayService);
|
|
167
|
+
const memberships = await this.#queryWithBlockHashNotAfterAnchor(referenceBlockHash, ()=>Promise.all(hashes.map((blockHash)=>this.aztecNodeReadCache.getBlockHashMembershipWitness(referenceBlockHash, blockHash).then(Boolean))));
|
|
168
|
+
return EphemeralArray.fromValues(this.ephemeralArrayService, memberships);
|
|
169
|
+
}
|
|
162
170
|
/**
|
|
163
171
|
* Returns a nullifier membership witness for a given nullifier at a given block.
|
|
164
172
|
* @param blockHash - The block hash at which to get the index.
|
|
@@ -192,7 +200,7 @@ import { buildACIRCallback } from './acir_callback.js';
|
|
|
192
200
|
* @param leafSlot - The slot of the public data tree to get the witness for.
|
|
193
201
|
* @returns - The witness
|
|
194
202
|
*/ async getPublicDataWitness(blockHash, leafSlot) {
|
|
195
|
-
const witness = await this.#queryWithBlockHashNotAfterAnchor(blockHash, ()=>this.
|
|
203
|
+
const witness = await this.#queryWithBlockHashNotAfterAnchor(blockHash, ()=>this.aztecNodeReadCache.getPublicDataWitness(blockHash, leafSlot));
|
|
196
204
|
if (!witness) {
|
|
197
205
|
throw new Error(`Public data witness not found for slot ${leafSlot} at block hash ${blockHash.toString()}.`);
|
|
198
206
|
}
|
|
@@ -244,7 +252,7 @@ import { buildACIRCallback } from './acir_callback.js';
|
|
|
244
252
|
* @param address - Address.
|
|
245
253
|
* @returns A contract instance.
|
|
246
254
|
*/ async getContractInstance(address) {
|
|
247
|
-
const instance = await this.
|
|
255
|
+
const instance = await this.anchoredContractData.getContractInstance(address);
|
|
248
256
|
if (!instance) {
|
|
249
257
|
throw new Error(`No contract instance found for address ${address.toString()}`);
|
|
250
258
|
}
|
|
@@ -327,14 +335,13 @@ import { buildACIRCallback } from './acir_callback.js';
|
|
|
327
335
|
return leafIndex?.data !== undefined;
|
|
328
336
|
}
|
|
329
337
|
/**
|
|
330
|
-
* Returns the membership witness of an
|
|
331
|
-
* @param contractAddress - Address of a contract by which the message was emitted.
|
|
338
|
+
* Returns the membership witness of an L1 to L2 message.
|
|
332
339
|
* @param messageHash - Hash of the message.
|
|
333
|
-
* @param
|
|
334
|
-
*
|
|
340
|
+
* @param nullifier - When present, the unsiloed nullifier of the message and the address to silo it with. The witness
|
|
341
|
+
* is only returned if the siloed nullifier is absent from the nullifier tree, i.e. the message has not been consumed.
|
|
335
342
|
* @returns The l1 to l2 membership witness (index of message in the tree and sibling path).
|
|
336
|
-
*/ async
|
|
337
|
-
const [messageIndex, siblingPath] = await
|
|
343
|
+
*/ async getL1ToL2MembershipWitnessV2(messageHash, nullifier) {
|
|
344
|
+
const [messageIndex, siblingPath] = await getL1ToL2MessageWitness(this.aztecNode, messageHash, nullifier.value, await this.anchorBlockHeader.hash());
|
|
338
345
|
return {
|
|
339
346
|
index: messageIndex,
|
|
340
347
|
siblingPath
|
|
@@ -348,9 +355,8 @@ import { buildACIRCallback } from './acir_callback.js';
|
|
|
348
355
|
* @param numberOfElements - Number of elements to read from the starting storage slot.
|
|
349
356
|
*/ getFromPublicStorage(blockHash, contractAddress, startStorageSlot, numberOfElements) {
|
|
350
357
|
return this.#queryWithBlockHashNotAfterAnchor(blockHash, async ()=>{
|
|
351
|
-
const
|
|
352
|
-
|
|
353
|
-
this.logger.debug(`Oracle storage read: slots=[${slots.map((slot)=>slot.toString()).join(', ')}] address=${contractAddress.toString()} values=[${values.join(', ')}]`);
|
|
358
|
+
const values = await this.aztecNodeReadCache.getPublicStorageRange(blockHash, contractAddress, startStorageSlot, numberOfElements);
|
|
359
|
+
this.logger.debug(`Oracle storage read: start=${startStorageSlot.toString()} count=${numberOfElements} ` + `address=${contractAddress.toString()} values=[${values.join(', ')}]`);
|
|
354
360
|
return values;
|
|
355
361
|
});
|
|
356
362
|
}
|
|
@@ -360,7 +366,7 @@ import { buildACIRCallback } from './acir_callback.js';
|
|
|
360
366
|
if (!this.contractLogger) {
|
|
361
367
|
// Purpose of instanceId is to distinguish logs from different instances of the same component. It makes sense
|
|
362
368
|
// to re-use jobId as instanceId here as executions of different PXE jobs are isolated.
|
|
363
|
-
this.contractLogger = await createContractLogger(this.contractAddress, (addr)=>this.
|
|
369
|
+
this.contractLogger = await createContractLogger(this.contractAddress, (addr)=>this.anchoredContractData.getDebugContractName(addr), 'user', {
|
|
364
370
|
instanceId: this.jobId
|
|
365
371
|
});
|
|
366
372
|
}
|
|
@@ -372,7 +378,7 @@ import { buildACIRCallback } from './acir_callback.js';
|
|
|
372
378
|
if (!this.aztecnrLogger) {
|
|
373
379
|
// Purpose of instanceId is to distinguish logs from different instances of the same component. It makes sense
|
|
374
380
|
// to re-use jobId as instanceId here as executions of different PXE jobs are isolated.
|
|
375
|
-
this.aztecnrLogger = await createContractLogger(this.contractAddress, (addr)=>this.
|
|
381
|
+
this.aztecnrLogger = await createContractLogger(this.contractAddress, (addr)=>this.anchoredContractData.getDebugContractName(addr), 'aztecnr', {
|
|
376
382
|
instanceId: this.jobId
|
|
377
383
|
});
|
|
378
384
|
}
|
|
@@ -386,7 +392,7 @@ import { buildACIRCallback } from './acir_callback.js';
|
|
|
386
392
|
const logger = kind == 'aztecnr' ? await this.#getAztecnrLogger() : await this.#getContractLogger();
|
|
387
393
|
logContractMessage(logger, LogLevels[level], strippedMessage, fields);
|
|
388
394
|
}
|
|
389
|
-
/** Fetches pending tagged logs into a freshly allocated ephemeral array and returns it. */ async
|
|
395
|
+
/** Fetches pending tagged logs into a freshly allocated ephemeral array and returns it. */ async getPendingTaggedLogsV2(scope, providedSecrets) {
|
|
390
396
|
const secrets = providedSecrets.readAll(this.ephemeralArrayService).map((ps)=>new AppTaggingSecret(ps.secret, this.contractAddress, ps.mode));
|
|
391
397
|
const logService = this.#createLogService();
|
|
392
398
|
const logs = await logService.fetchTaggedLogs(this.contractAddress, scope, secrets);
|
|
@@ -410,7 +416,7 @@ import { buildACIRCallback } from './acir_callback.js';
|
|
|
410
416
|
eventService.validateAndStoreEvents(eventValidationRequests, scope, txEffects)
|
|
411
417
|
]);
|
|
412
418
|
}
|
|
413
|
-
async
|
|
419
|
+
async getLogsByTagV2(requests) {
|
|
414
420
|
const logRetrievalRequests = requests.readAll(this.ephemeralArrayService);
|
|
415
421
|
const logService = this.#createLogService();
|
|
416
422
|
const logRetrievalResponses = await logService.fetchLogsByTag(this.contractAddress, logRetrievalRequests);
|
|
@@ -431,9 +437,7 @@ import { buildACIRCallback } from './acir_callback.js';
|
|
|
431
437
|
if (txHash.hash.isZero()) {
|
|
432
438
|
throw new Error('Invalid tx hash passed into aztec_utl_getTxEffect oracle handler');
|
|
433
439
|
}
|
|
434
|
-
const receipt = await this.
|
|
435
|
-
includeTxEffect: true
|
|
436
|
-
});
|
|
440
|
+
const receipt = await this.aztecNodeReadCache.getTxReceiptWithEffect(txHash);
|
|
437
441
|
if (!receipt.isMined() || !receipt.txEffect || receipt.blockNumber > this.anchorBlockHeader.getBlockNumber()) {
|
|
438
442
|
return Option.none();
|
|
439
443
|
}
|
|
@@ -491,12 +495,14 @@ import { buildACIRCallback } from './acir_callback.js';
|
|
|
491
495
|
* Returns a fact collection.
|
|
492
496
|
*/ async getFactCollection(contractAddress, scope, factCollectionTypeId, factCollectionId) {
|
|
493
497
|
this.#assertOwnContract(contractAddress);
|
|
494
|
-
const
|
|
498
|
+
const tips = anchoredTipBlockNumbers(await this.l2TipsStore.getL2Tips(), this.anchorBlockHeader.getBlockNumber());
|
|
499
|
+
const collection = await this.factService.getFactCollection(new FactCollectionKey(contractAddress, scope, factCollectionTypeId, factCollectionId), tips, this.jobId);
|
|
495
500
|
return collection ? Option.some(toNoirFactCollection(this.ephemeralArrayService, contractAddress, scope, factCollectionTypeId, factCollectionId, collection.facts)) : Option.none(emptyFactCollection(this.ephemeralArrayService));
|
|
496
501
|
}
|
|
497
502
|
/** Returns every fact collection of `factCollectionTypeId`. */ async getFactCollectionsByType(contractAddress, scope, factCollectionTypeId) {
|
|
498
503
|
this.#assertOwnContract(contractAddress);
|
|
499
|
-
const
|
|
504
|
+
const tips = anchoredTipBlockNumbers(await this.l2TipsStore.getL2Tips(), this.anchorBlockHeader.getBlockNumber());
|
|
505
|
+
const collections = await this.factService.getFactCollectionsByType(new FactCollectionTypeKey(contractAddress, scope, factCollectionTypeId), tips, this.jobId);
|
|
500
506
|
return EphemeralArray.fromValues(this.ephemeralArrayService, collections.map((collection)=>toNoirFactCollection(this.ephemeralArrayService, collection.key.contractAddress, collection.key.scope, collection.key.factCollectionTypeId, collection.key.factCollectionId, collection.facts)));
|
|
501
507
|
}
|
|
502
508
|
/**
|
|
@@ -531,17 +537,25 @@ import { buildACIRCallback } from './acir_callback.js';
|
|
|
531
537
|
* @param address - The recipient address.
|
|
532
538
|
* @param ephPks - Ephemeral array containing the serialized Points.
|
|
533
539
|
* @param contractAddress - The contract address for app-siloing (validated against execution context).
|
|
534
|
-
* @returns A new ephemeral array containing the computed shared secrets
|
|
540
|
+
* @returns A new ephemeral array containing the computed shared secrets, or an empty array when the PXE does not
|
|
541
|
+
* hold the keys for `address`, signaling that no secrets can be derived for it.
|
|
535
542
|
*/ async getSharedSecrets(address, ephPks, contractAddress) {
|
|
536
543
|
if (!contractAddress.equals(this.contractAddress)) {
|
|
537
544
|
throw new Error(`getSharedSecrets called with contract address ${contractAddress}, expected ${this.contractAddress}`);
|
|
538
545
|
}
|
|
539
|
-
const recipientCompleteAddress = await this.
|
|
546
|
+
const recipientCompleteAddress = await this.addressStore.getCompleteAddress(address);
|
|
547
|
+
if (!recipientCompleteAddress) {
|
|
548
|
+
this.logger.warn(`Computing shared secrets for address ${address} whose keys are not held - returning no secrets`, {
|
|
549
|
+
address,
|
|
550
|
+
contractAddress: this.contractAddress
|
|
551
|
+
});
|
|
552
|
+
return EphemeralArray.fromValues(this.ephemeralArrayService, []);
|
|
553
|
+
}
|
|
540
554
|
const ivpkMHash = await hashPublicKey(recipientCompleteAddress.publicKeys.ivpkM);
|
|
541
555
|
const ivskM = await this.keyStore.getMasterSecretKey(ivpkMHash);
|
|
542
556
|
const addressSecret = await computeAddressSecret(await recipientCompleteAddress.getPreaddress(), ivskM);
|
|
543
557
|
const ephPkPoints = ephPks.readAll(this.ephemeralArrayService);
|
|
544
|
-
const secrets = await Promise.all(ephPkPoints.map(({ x, y })=>
|
|
558
|
+
const secrets = await Promise.all(ephPkPoints.map(({ x, y })=>appSiloEcdhSharedSecret(addressSecret, new Point(x, y), this.contractAddress)));
|
|
545
559
|
return EphemeralArray.fromValues(this.ephemeralArrayService, secrets);
|
|
546
560
|
}
|
|
547
561
|
pushEphemeral(slot, elements) {
|
|
@@ -594,19 +608,25 @@ import { buildACIRCallback } from './acir_callback.js';
|
|
|
594
608
|
return Promise.resolve();
|
|
595
609
|
}
|
|
596
610
|
/** Executes another utility function from within this one and returns its serialized return values. */ async callUtilityFunction(targetContractAddress, functionSelector, args) {
|
|
597
|
-
const targetArtifact = await this.
|
|
611
|
+
const targetArtifact = await this.anchoredContractData.getFunctionArtifactWithDebugMetadata(targetContractAddress, functionSelector);
|
|
612
|
+
if (!targetArtifact) {
|
|
613
|
+
throw new Error(`Cannot call ${targetContractAddress}:${functionSelector}: the contract is not registered. ` + `Register it via wallet.registerContract(...).`);
|
|
614
|
+
}
|
|
598
615
|
if (!targetContractAddress.equals(this.contractAddress)) {
|
|
599
616
|
// Standard handshake registry reads are authorized by default; every other cross-contract call needs the hook.
|
|
600
617
|
if (!await isStandardHandshakeRegistryUtilityRead(targetContractAddress, functionSelector)) {
|
|
601
|
-
const [
|
|
602
|
-
this.
|
|
603
|
-
this.
|
|
618
|
+
const [callerClassId, targetClassId] = await Promise.all([
|
|
619
|
+
this.anchoredContractData.getCurrentClassId(this.contractAddress),
|
|
620
|
+
this.anchoredContractData.getCurrentClassId(targetContractAddress)
|
|
604
621
|
]);
|
|
622
|
+
if (!callerClassId || !targetClassId) {
|
|
623
|
+
throw new Error(`Cannot authorize utility call from ${this.contractAddress} to ${targetContractAddress}: ` + `${!callerClassId ? this.contractAddress : targetContractAddress} is not registered.`);
|
|
624
|
+
}
|
|
605
625
|
const request = {
|
|
606
626
|
caller: this.contractAddress,
|
|
607
|
-
callerClassId
|
|
627
|
+
callerClassId,
|
|
608
628
|
target: targetContractAddress,
|
|
609
|
-
targetClassId
|
|
629
|
+
targetClassId,
|
|
610
630
|
functionSelector,
|
|
611
631
|
functionName: targetArtifact.name,
|
|
612
632
|
args,
|
|
@@ -634,7 +654,7 @@ import { buildACIRCallback } from './acir_callback.js';
|
|
|
634
654
|
authWitnesses: this.authWitnesses,
|
|
635
655
|
capsules: this.capsules,
|
|
636
656
|
anchorBlockHeader: this.anchorBlockHeader,
|
|
637
|
-
|
|
657
|
+
anchoredContractData: this.anchoredContractData,
|
|
638
658
|
noteStore: this.noteStore,
|
|
639
659
|
keyStore: this.keyStore,
|
|
640
660
|
addressStore: this.addressStore,
|
|
@@ -676,9 +696,7 @@ import { buildACIRCallback } from './acir_callback.js';
|
|
|
676
696
|
* once. Returns a map keyed by `TxHash.toString()`; hashes for which the node has no tx effect are omitted.
|
|
677
697
|
*/ async #fetchTxEffects(txHashes) {
|
|
678
698
|
const uniqueTxHashes = uniqueBy(txHashes, (h)=>h.toString());
|
|
679
|
-
const fetched = await Promise.all(uniqueTxHashes.map((h)=>this.
|
|
680
|
-
includeTxEffect: true
|
|
681
|
-
})));
|
|
699
|
+
const fetched = await Promise.all(uniqueTxHashes.map((h)=>this.aztecNodeReadCache.getTxReceiptWithEffect(h)));
|
|
682
700
|
return new Map(uniqueTxHashes.map((h, i)=>{
|
|
683
701
|
const receipt = fetched[i];
|
|
684
702
|
if (!receipt.isMined() || !receipt.txEffect) {
|
|
@@ -708,7 +726,7 @@ import { buildACIRCallback } from './acir_callback.js';
|
|
|
708
726
|
const [response] = await Promise.all([
|
|
709
727
|
query(),
|
|
710
728
|
(async ()=>{
|
|
711
|
-
const block = await this.
|
|
729
|
+
const block = await this.aztecNodeReadCache.getBlock(blockHash);
|
|
712
730
|
const header = block?.header;
|
|
713
731
|
if (!header) {
|
|
714
732
|
throw new Error(`Could not find block header for block hash ${blockHash}`);
|
|
@@ -727,8 +745,14 @@ import { buildACIRCallback } from './acir_callback.js';
|
|
|
727
745
|
return this.callContext.contractAddress;
|
|
728
746
|
}
|
|
729
747
|
}
|
|
730
|
-
|
|
731
|
-
|
|
748
|
+
// Registry reads that any contract may issue without an `authorizeUtilityCall` hook. The constrained-delivery
|
|
749
|
+
// library calls these implicitly for the app, and they are safe to default-authorize: `get_app_siloed_secrets`
|
|
750
|
+
// siloes every returned secret to `msg_sender`, and `get_non_interactive_handshakes` only exposes ephemeral public
|
|
751
|
+
// keys, from which the shared secret cannot be derived without the recipient's secret keys.
|
|
752
|
+
const STANDARD_HANDSHAKE_REGISTRY_DEFAULT_AUTHORIZED_READ_SIGNATURES = [
|
|
753
|
+
'get_non_interactive_handshakes((Field),u32)',
|
|
754
|
+
'get_app_siloed_secrets((Field),(Field))'
|
|
755
|
+
];
|
|
732
756
|
async function doesSelectorHaveSignature(functionSelector, signature) {
|
|
733
757
|
return functionSelector.equals(await FunctionSelector.fromSignature(signature));
|
|
734
758
|
}
|
|
@@ -741,9 +765,6 @@ async function doesSelectorHaveSignature(functionSelector, signature) {
|
|
|
741
765
|
if (!targetContractAddress.equals(STANDARD_HANDSHAKE_REGISTRY_ADDRESS)) {
|
|
742
766
|
return false;
|
|
743
767
|
}
|
|
744
|
-
const
|
|
745
|
-
|
|
746
|
-
doesSelectorHaveSignature(functionSelector, STANDARD_HANDSHAKE_REGISTRY_GET_APP_SILOED_SECRET_SIGNATURE)
|
|
747
|
-
]);
|
|
748
|
-
return isGetHandshakes || isGetAppSiloedSecret;
|
|
768
|
+
const matches = await Promise.all(STANDARD_HANDSHAKE_REGISTRY_DEFAULT_AUTHORIZED_READ_SIGNATURES.map((signature)=>doesSelectorHaveSignature(functionSelector, signature)));
|
|
769
|
+
return matches.some(Boolean);
|
|
749
770
|
}
|
|
@@ -4,8 +4,8 @@ import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
|
4
4
|
import type { NoteDao } from '@aztec/stdlib/note';
|
|
5
5
|
import type { ContractOverrides } from '@aztec/stdlib/tx';
|
|
6
6
|
import type { BlockSynchronizer } from '../block_synchronizer/block_synchronizer.js';
|
|
7
|
+
import type { ContractSyncService } from '../contract/contract_sync_service.js';
|
|
7
8
|
import type { ContractFunctionSimulator } from '../contract_function_simulator/contract_function_simulator.js';
|
|
8
|
-
import type { ContractSyncService } from '../contract_sync/contract_sync_service.js';
|
|
9
9
|
import type { NotesFilter } from '../notes_filter.js';
|
|
10
10
|
import type { AnchorBlockStore } from '../storage/index.js';
|
|
11
11
|
import type { NoteStore } from '../storage/note_store/note_store.js';
|
|
@@ -37,4 +37,4 @@ export declare class PXEDebugUtils {
|
|
|
37
37
|
*/
|
|
38
38
|
getNotes(filter: NotesFilter): Promise<NoteDao[]>;
|
|
39
39
|
}
|
|
40
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
40
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHhlX2RlYnVnX3V0aWxzLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvZGVidWcvcHhlX2RlYnVnX3V0aWxzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLFlBQVksRUFBRSxNQUFNLG1CQUFtQixDQUFDO0FBQ3RELE9BQU8sS0FBSyxFQUFFLFdBQVcsRUFBRSxNQUFNLDRCQUE0QixDQUFDO0FBQzlELE9BQU8sS0FBSyxFQUFFLFlBQVksRUFBRSxNQUFNLDZCQUE2QixDQUFDO0FBQ2hFLE9BQU8sS0FBSyxFQUFFLE9BQU8sRUFBRSxNQUFNLG9CQUFvQixDQUFDO0FBQ2xELE9BQU8sS0FBSyxFQUFFLGlCQUFpQixFQUFFLE1BQU0sa0JBQWtCLENBQUM7QUFFMUQsT0FBTyxLQUFLLEVBQUUsaUJBQWlCLEVBQUUsTUFBTSw2Q0FBNkMsQ0FBQztBQUNyRixPQUFPLEtBQUssRUFBRSxtQkFBbUIsRUFBRSxNQUFNLHNDQUFzQyxDQUFDO0FBQ2hGLE9BQU8sS0FBSyxFQUFFLHlCQUF5QixFQUFFLE1BQU0sK0RBQStELENBQUM7QUFDL0csT0FBTyxLQUFLLEVBQUUsV0FBVyxFQUFFLE1BQU0sb0JBQW9CLENBQUM7QUFDdEQsT0FBTyxLQUFLLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSxxQkFBcUIsQ0FBQztBQUM1RCxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsTUFBTSxxQ0FBcUMsQ0FBQztBQUVyRTs7O0dBR0c7QUFDSCxxQkFBYSxhQUFhOztJQVl0QixPQUFPLENBQUMsbUJBQW1CO0lBQzNCLE9BQU8sQ0FBQyxTQUFTO0lBQ2pCLE9BQU8sQ0FBQyxzQkFBc0I7SUFDOUIsT0FBTyxDQUFDLGdCQUFnQjtJQUoxQixZQUNVLG1CQUFtQixFQUFFLG1CQUFtQixFQUN4QyxTQUFTLEVBQUUsU0FBUyxFQUNwQixzQkFBc0IsRUFBRSxpQkFBaUIsRUFDekMsZ0JBQWdCLEVBQUUsZ0JBQWdCLEVBQ3hDO0lBRUosc0VBQXNFO0lBQy9ELGFBQWEsQ0FDbEIsYUFBYSxFQUFFLENBQUMsQ0FBQyxFQUFFLEdBQUcsRUFBRSxDQUFDLEtBQUssRUFBRSxNQUFNLEtBQUssT0FBTyxDQUFDLENBQUMsQ0FBQyxLQUFLLE9BQU8sQ0FBQyxDQUFDLENBQUMsRUFDcEUsaUJBQWlCLEVBQUUsQ0FBQyxTQUFTLENBQUMsRUFBRTtRQUFFLFNBQVMsQ0FBQyxFQUFFLGlCQUFpQixDQUFBO0tBQUUsS0FBSyx5QkFBeUIsRUFDL0YsY0FBYyxFQUFFLENBQ2QseUJBQXlCLEVBQUUseUJBQXlCLEVBQ3BELElBQUksRUFBRSxZQUFZLEVBQ2xCLGFBQWEsRUFBRSxXQUFXLEVBQUUsR0FBRyxTQUFTLEVBQ3hDLE1BQU0sRUFBRSxZQUFZLEVBQUUsRUFDdEIsS0FBSyxFQUFFLE1BQU0sS0FDVixPQUFPLENBQUMsR0FBRyxDQUFDLFFBS2xCO0lBRUQ7Ozs7Ozs7Ozs7T0FVRztJQUNJLFFBQVEsQ0FBQyxNQUFNLEVBQUUsV0FBVyxHQUFHLE9BQU8sQ0FBQyxPQUFPLEVBQUUsQ0FBQyxDQW9CdkQ7Q0FDRiJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pxe_debug_utils.d.ts","sourceRoot":"","sources":["../../src/debug/pxe_debug_utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAE1D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6CAA6C,CAAC;AACrF,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"pxe_debug_utils.d.ts","sourceRoot":"","sources":["../../src/debug/pxe_debug_utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAE1D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6CAA6C,CAAC;AACrF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAChF,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,+DAA+D,CAAC;AAC/G,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qCAAqC,CAAC;AAErE;;;GAGG;AACH,qBAAa,aAAa;;IAYtB,OAAO,CAAC,mBAAmB;IAC3B,OAAO,CAAC,SAAS;IACjB,OAAO,CAAC,sBAAsB;IAC9B,OAAO,CAAC,gBAAgB;IAJ1B,YACU,mBAAmB,EAAE,mBAAmB,EACxC,SAAS,EAAE,SAAS,EACpB,sBAAsB,EAAE,iBAAiB,EACzC,gBAAgB,EAAE,gBAAgB,EACxC;IAEJ,sEAAsE;IAC/D,aAAa,CAClB,aAAa,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,EACpE,iBAAiB,EAAE,CAAC,SAAS,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,iBAAiB,CAAA;KAAE,KAAK,yBAAyB,EAC/F,cAAc,EAAE,CACd,yBAAyB,EAAE,yBAAyB,EACpD,IAAI,EAAE,YAAY,EAClB,aAAa,EAAE,WAAW,EAAE,GAAG,SAAS,EACxC,MAAM,EAAE,YAAY,EAAE,EACtB,KAAK,EAAE,MAAM,KACV,OAAO,CAAC,GAAG,CAAC,QAKlB;IAED;;;;;;;;;;OAUG;IACI,QAAQ,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,CAoBvD;CACF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
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/
|
|
3
|
+
import { createStore } from '@aztec/kv-store/sqlite-opfs';
|
|
4
4
|
import { BundledProtocolContractsProvider } from '@aztec/protocol-contracts/providers/bundle';
|
|
5
5
|
import { WASMSimulator } from '@aztec/simulator/client';
|
|
6
6
|
import { getStandardAuthRegistry } from '@aztec/standard-contracts/auth-registry';
|
|
@@ -28,7 +28,7 @@ import { isPrivateKernelProver } from '../../pxe_creation_options.js';
|
|
|
28
28
|
...config,
|
|
29
29
|
...l1ContractAddresses
|
|
30
30
|
};
|
|
31
|
-
const storeLogger = loggers.store ?? createLogger('pxe:data
|
|
31
|
+
const storeLogger = loggers.store ?? createLogger('pxe:data', {
|
|
32
32
|
actor
|
|
33
33
|
});
|
|
34
34
|
const store = options.store ?? await createStore('pxe_data', configWithContracts, PXE_DATA_SCHEMA_VERSION, storeLogger);
|
|
@@ -1,6 +1,6 @@
|
|
|
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/
|
|
3
|
+
import { createStore } from '@aztec/kv-store/sqlite-opfs';
|
|
4
4
|
import { LazyProtocolContractsProvider } from '@aztec/protocol-contracts/providers/lazy';
|
|
5
5
|
import { WASMSimulator } from '@aztec/simulator/client';
|
|
6
6
|
import { getStandardAuthRegistry } from '@aztec/standard-contracts/auth-registry/lazy';
|
|
@@ -27,7 +27,7 @@ import { isPrivateKernelProver } from '../../pxe_creation_options.js';
|
|
|
27
27
|
...l1ContractAddresses
|
|
28
28
|
};
|
|
29
29
|
const loggers = options.loggers ?? {};
|
|
30
|
-
const storeLogger = loggers.store ?? createLogger('pxe:data
|
|
30
|
+
const storeLogger = loggers.store ?? createLogger('pxe:data', {
|
|
31
31
|
actor
|
|
32
32
|
});
|
|
33
33
|
const store = options.store ?? await createStore('pxe_data', configWithContracts, PXE_DATA_SCHEMA_VERSION, storeLogger);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export { type AccountPrivacyKeys, type AccountPrivacySecretKeys } from '@aztec/key-store';
|
|
1
2
|
export * from '../../notes_filter.js';
|
|
2
3
|
export * from '../../pxe.js';
|
|
3
4
|
export * from '../../config/index.js';
|
|
@@ -8,5 +9,7 @@ export { NoteService } from '../../notes/note_service.js';
|
|
|
8
9
|
export { ORACLE_VERSION_MAJOR, ORACLE_VERSION_MINOR } from '../../oracle_version.js';
|
|
9
10
|
export { type PXECreationOptions } from '../pxe_creation_options.js';
|
|
10
11
|
export { JobCoordinator } from '../../job_coordinator/job_coordinator.js';
|
|
11
|
-
export { ContractSyncService } from '../../
|
|
12
|
-
|
|
12
|
+
export { ContractSyncService } from '../../contract/contract_sync_service.js';
|
|
13
|
+
export { ContractClassService } from '../../contract/contract_class_service.js';
|
|
14
|
+
export { AnchoredContractData } from '../../contract_function_simulator/anchored_contract_data.js';
|
|
15
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9lbnRyeXBvaW50cy9zZXJ2ZXIvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLEtBQUssa0JBQWtCLEVBQUUsS0FBSyx3QkFBd0IsRUFBRSxNQUFNLGtCQUFrQixDQUFDO0FBRTFGLGNBQWMsdUJBQXVCLENBQUM7QUFDdEMsY0FBYyxjQUFjLENBQUM7QUFDN0IsY0FBYyx1QkFBdUIsQ0FBQztBQUN0QyxjQUFjLDBCQUEwQixDQUFDO0FBQ3pDLGNBQWMsd0JBQXdCLENBQUM7QUFDdkMsY0FBYyxZQUFZLENBQUM7QUFDM0IsT0FBTyxFQUFFLFdBQVcsRUFBRSxNQUFNLDZCQUE2QixDQUFDO0FBQzFELE9BQU8sRUFBRSxvQkFBb0IsRUFBRSxvQkFBb0IsRUFBRSxNQUFNLHlCQUF5QixDQUFDO0FBQ3JGLE9BQU8sRUFBRSxLQUFLLGtCQUFrQixFQUFFLE1BQU0sNEJBQTRCLENBQUM7QUFDckUsT0FBTyxFQUFFLGNBQWMsRUFBRSxNQUFNLDBDQUEwQyxDQUFDO0FBQzFFLE9BQU8sRUFBRSxtQkFBbUIsRUFBRSxNQUFNLHlDQUF5QyxDQUFDO0FBQzlFLE9BQU8sRUFBRSxvQkFBb0IsRUFBRSxNQUFNLDBDQUEwQyxDQUFDO0FBQ2hGLE9BQU8sRUFBRSxvQkFBb0IsRUFBRSxNQUFNLDZEQUE2RCxDQUFDIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/entrypoints/server/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,cAAc,CAAC;AAC7B,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AACrF,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAC;AAC1E,OAAO,EAAE,mBAAmB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/entrypoints/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,kBAAkB,EAAE,KAAK,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAE1F,cAAc,uBAAuB,CAAC;AACtC,cAAc,cAAc,CAAC;AAC7B,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AACrF,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAC;AAC1E,OAAO,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAC;AAC9E,OAAO,EAAE,oBAAoB,EAAE,MAAM,0CAA0C,CAAC;AAChF,OAAO,EAAE,oBAAoB,EAAE,MAAM,6DAA6D,CAAC"}
|
|
@@ -7,4 +7,6 @@ export * from './utils.js';
|
|
|
7
7
|
export { NoteService } from '../../notes/note_service.js';
|
|
8
8
|
export { ORACLE_VERSION_MAJOR, ORACLE_VERSION_MINOR } from '../../oracle_version.js';
|
|
9
9
|
export { JobCoordinator } from '../../job_coordinator/job_coordinator.js';
|
|
10
|
-
export { ContractSyncService } from '../../
|
|
10
|
+
export { ContractSyncService } from '../../contract/contract_sync_service.js';
|
|
11
|
+
export { ContractClassService } from '../../contract/contract_class_service.js';
|
|
12
|
+
export { AnchoredContractData } from '../../contract_function_simulator/anchored_contract_data.js';
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import type { Logger } from '@aztec/foundation/log';
|
|
2
2
|
import { type SimulationError } from '@aztec/stdlib/errors';
|
|
3
|
+
import type { BlockHeader } from '@aztec/stdlib/tx';
|
|
4
|
+
import type { ContractClassService } from './contract/contract_class_service.js';
|
|
3
5
|
import type { ContractStore } from './storage/contract_store/contract_store.js';
|
|
4
6
|
/**
|
|
5
7
|
* Adds contract and function names to a simulation error, if they
|
|
6
8
|
* can be found in the PXE database
|
|
7
9
|
* @param err - The error to enrich.
|
|
8
10
|
*/
|
|
9
|
-
export declare function enrichSimulationError(err: SimulationError, contractStore: ContractStore, logger: Logger): Promise<void>;
|
|
10
|
-
export declare function enrichPublicSimulationError(err: SimulationError, contractStore: ContractStore, logger: Logger): Promise<void>;
|
|
11
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
11
|
+
export declare function enrichSimulationError(err: SimulationError, contractStore: ContractStore, contractClassService: ContractClassService, anchorHeader: BlockHeader, logger: Logger): Promise<void>;
|
|
12
|
+
export declare function enrichPublicSimulationError(err: SimulationError, contractStore: ContractStore, contractClassService: ContractClassService, anchorHeader: BlockHeader, logger: Logger): Promise<void>;
|
|
13
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXJyb3JfZW5yaWNoaW5nLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvZXJyb3JfZW5yaWNoaW5nLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLE1BQU0sRUFBRSxNQUFNLHVCQUF1QixDQUFDO0FBSXBELE9BQU8sRUFBRSxLQUFLLGVBQWUsRUFBNkIsTUFBTSxzQkFBc0IsQ0FBQztBQUN2RixPQUFPLEtBQUssRUFBRSxXQUFXLEVBQUUsTUFBTSxrQkFBa0IsQ0FBQztBQUVwRCxPQUFPLEtBQUssRUFBRSxvQkFBb0IsRUFBRSxNQUFNLHNDQUFzQyxDQUFDO0FBQ2pGLE9BQU8sS0FBSyxFQUFFLGFBQWEsRUFBRSxNQUFNLDRDQUE0QyxDQUFDO0FBRWhGOzs7O0dBSUc7QUFDSCx3QkFBc0IscUJBQXFCLENBQ3pDLEdBQUcsRUFBRSxlQUFlLEVBQ3BCLGFBQWEsRUFBRSxhQUFhLEVBQzVCLG9CQUFvQixFQUFFLG9CQUFvQixFQUMxQyxZQUFZLEVBQUUsV0FBVyxFQUN6QixNQUFNLEVBQUUsTUFBTSxpQkFxRGY7QUFFRCx3QkFBc0IsMkJBQTJCLENBQy9DLEdBQUcsRUFBRSxlQUFlLEVBQ3BCLGFBQWEsRUFBRSxhQUFhLEVBQzVCLG9CQUFvQixFQUFFLG9CQUFvQixFQUMxQyxZQUFZLEVBQUUsV0FBVyxFQUN6QixNQUFNLEVBQUUsTUFBTSxpQkEwQ2YifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error_enriching.d.ts","sourceRoot":"","sources":["../src/error_enriching.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAIpD,OAAO,EAAE,KAAK,eAAe,EAA6B,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"error_enriching.d.ts","sourceRoot":"","sources":["../src/error_enriching.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAIpD,OAAO,EAAE,KAAK,eAAe,EAA6B,MAAM,sBAAsB,CAAC;AACvF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AACjF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4CAA4C,CAAC;AAEhF;;;;GAIG;AACH,wBAAsB,qBAAqB,CACzC,GAAG,EAAE,eAAe,EACpB,aAAa,EAAE,aAAa,EAC5B,oBAAoB,EAAE,oBAAoB,EAC1C,YAAY,EAAE,WAAW,EACzB,MAAM,EAAE,MAAM,iBAqDf;AAED,wBAAsB,2BAA2B,CAC/C,GAAG,EAAE,eAAe,EACpB,aAAa,EAAE,aAAa,EAC5B,oBAAoB,EAAE,oBAAoB,EAC1C,YAAY,EAAE,WAAW,EACzB,MAAM,EAAE,MAAM,iBA0Cf"}
|
package/dest/error_enriching.js
CHANGED
|
@@ -6,7 +6,7 @@ import { isNoirCallStackUnresolved } from '@aztec/stdlib/errors';
|
|
|
6
6
|
* Adds contract and function names to a simulation error, if they
|
|
7
7
|
* can be found in the PXE database
|
|
8
8
|
* @param err - The error to enrich.
|
|
9
|
-
*/ export async function enrichSimulationError(err, contractStore, logger) {
|
|
9
|
+
*/ export async function enrichSimulationError(err, contractStore, contractClassService, anchorHeader, logger) {
|
|
10
10
|
// Maps contract addresses to the set of function selectors that were in error.
|
|
11
11
|
// Map and Set do reference equality for their keys instead of value equality, so we store the string
|
|
12
12
|
// representation to get e.g. different contract address objects with the same address value to match.
|
|
@@ -24,12 +24,13 @@ import { isNoirCallStackUnresolved } from '@aztec/stdlib/errors';
|
|
|
24
24
|
...mentionedFunctions.entries()
|
|
25
25
|
].map(async ([contractAddress, fnSelectors])=>{
|
|
26
26
|
const parsedContractAddress = AztecAddress.fromStringUnsafe(contractAddress);
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
const classId = await contractClassService.getCurrentClassId(parsedContractAddress, anchorHeader);
|
|
28
|
+
const artifact = classId && await contractStore.getContractArtifact(classId);
|
|
29
|
+
if (artifact) {
|
|
30
|
+
err.enrichWithContractName(parsedContractAddress, artifact.name);
|
|
30
31
|
// Map from function selector to function name. It uses a stringified key for the same reason as mentionedFunctions.
|
|
31
32
|
const selectorToNameMap = new Map();
|
|
32
|
-
await Promise.all(
|
|
33
|
+
await Promise.all(artifact.functions.map(async (fn)=>{
|
|
33
34
|
const selector = await FunctionSelector.fromNameAndParameters(fn);
|
|
34
35
|
selectorToNameMap.set(selector.toString(), fn.name);
|
|
35
36
|
}));
|
|
@@ -37,7 +38,7 @@ import { isNoirCallStackUnresolved } from '@aztec/stdlib/errors';
|
|
|
37
38
|
if (selectorToNameMap.has(fnSelector.toString())) {
|
|
38
39
|
err.enrichWithFunctionName(parsedContractAddress, fnSelector, selectorToNameMap.get(fnSelector.toString()));
|
|
39
40
|
} else {
|
|
40
|
-
logger.warn(`Could not find function artifact in contract ${
|
|
41
|
+
logger.warn(`Could not find function artifact in contract ${artifact.name} for function '${fnSelector}' when enriching error callstack`);
|
|
41
42
|
}
|
|
42
43
|
}
|
|
43
44
|
} else {
|
|
@@ -45,13 +46,14 @@ import { isNoirCallStackUnresolved } from '@aztec/stdlib/errors';
|
|
|
45
46
|
}
|
|
46
47
|
}));
|
|
47
48
|
}
|
|
48
|
-
export async function enrichPublicSimulationError(err, contractStore, logger) {
|
|
49
|
+
export async function enrichPublicSimulationError(err, contractStore, contractClassService, anchorHeader, logger) {
|
|
49
50
|
const callStack = err.getCallStack();
|
|
50
51
|
const originalFailingFunction = callStack[callStack.length - 1];
|
|
51
52
|
if (!originalFailingFunction) {
|
|
52
53
|
throw new Error(`Original failing function not found when enriching public simulation, missing callstack`);
|
|
53
54
|
}
|
|
54
|
-
const
|
|
55
|
+
const classId = await contractClassService.getCurrentClassId(originalFailingFunction.contractAddress, anchorHeader);
|
|
56
|
+
const artifact = classId && await contractStore.getPublicFunctionArtifact(classId);
|
|
55
57
|
if (!artifact) {
|
|
56
58
|
throw new Error(`Artifact not found when enriching public simulation error. Contract address: ${originalFailingFunction.contractAddress}.`);
|
|
57
59
|
}
|
|
@@ -59,7 +61,7 @@ export async function enrichPublicSimulationError(err, contractStore, logger) {
|
|
|
59
61
|
if (assertionMessage) {
|
|
60
62
|
err.setOriginalMessage(err.getOriginalMessage() + `${assertionMessage}`);
|
|
61
63
|
}
|
|
62
|
-
const debugInfo = await contractStore.getPublicFunctionDebugMetadata(
|
|
64
|
+
const debugInfo = await contractStore.getPublicFunctionDebugMetadata(classId);
|
|
63
65
|
const noirCallStack = err.getNoirCallStack();
|
|
64
66
|
if (debugInfo) {
|
|
65
67
|
if (isNoirCallStackUnresolved(noirCallStack)) {
|
|
@@ -72,6 +74,6 @@ export async function enrichPublicSimulationError(err, contractStore, logger) {
|
|
|
72
74
|
logger.warn(`Could not resolve noir call stack for ${originalFailingFunction.contractAddress.toString()}:${originalFailingFunction.functionName?.toString() ?? ''}: ${err}`);
|
|
73
75
|
}
|
|
74
76
|
}
|
|
75
|
-
await enrichSimulationError(err, contractStore, logger);
|
|
77
|
+
await enrichSimulationError(err, contractStore, contractClassService, anchorHeader, logger);
|
|
76
78
|
}
|
|
77
79
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { AuthorizeUtilityCall } from './authorize_utility_call.js';
|
|
2
|
+
import type { ResolveCustomRequest } from './resolve_custom_request.js';
|
|
2
3
|
import type { ResolveTaggingSecretStrategy } from './resolve_tagging_secret_strategy.js';
|
|
3
4
|
/**
|
|
4
5
|
* Hooks that PXE invokes during client-side simulation to gate or steer operations that the protocol
|
|
@@ -27,8 +28,12 @@ import type { ResolveTaggingSecretStrategy } from './resolve_tagging_secret_stra
|
|
|
27
28
|
* ? { authorized: true }
|
|
28
29
|
* : { authorized: false, reason: 'Unknown target' };
|
|
29
30
|
* },
|
|
30
|
-
* //
|
|
31
|
-
*
|
|
31
|
+
* // Apply per-recipient policy: reach a known contact via their address keys (no onchain trace) and use a
|
|
32
|
+
* // non-interactive handshake for everyone else.
|
|
33
|
+
* resolveTaggingSecretStrategy: async ({ recipient }) =>
|
|
34
|
+
* knownContacts.has(recipient.toString())
|
|
35
|
+
* ? { type: 'address-derived' }
|
|
36
|
+
* : { type: 'non-interactive-handshake' },
|
|
32
37
|
* },
|
|
33
38
|
* });
|
|
34
39
|
* ```
|
|
@@ -38,14 +43,20 @@ export interface ExecutionHooks {
|
|
|
38
43
|
authorizeUtilityCall?: AuthorizeUtilityCall;
|
|
39
44
|
/**
|
|
40
45
|
* Resolves a message's tagging secret when none is already established for the sender/recipient pair, letting the
|
|
41
|
-
* wallet apply per-recipient policy. PXE applies a
|
|
46
|
+
* wallet apply per-recipient policy. PXE applies a default when absent.
|
|
42
47
|
* See {@link ResolveTaggingSecretStrategy} for the request shape and defaults.
|
|
43
48
|
*/
|
|
44
49
|
resolveTaggingSecretStrategy?: ResolveTaggingSecretStrategy;
|
|
50
|
+
/**
|
|
51
|
+
* Resolves a custom, caller-defined request a circuit cannot serve from local state. Any contract can issue one, so
|
|
52
|
+
* an implementor should verify both the request `kind` and the issuing contract (its address and class ID) before
|
|
53
|
+
* fulfilling it. Rejected when absent; see {@link ResolveCustomRequest}.
|
|
54
|
+
*/
|
|
55
|
+
resolveCustomRequest?: ResolveCustomRequest;
|
|
45
56
|
}
|
|
46
57
|
/**
|
|
47
58
|
* Builds an {@link ExecutionHooks} from individually-constructed hook callbacks. Returns `undefined`
|
|
48
59
|
* when every field is absent, so callers can unconditionally pass the result as `hooks`.
|
|
49
60
|
*/
|
|
50
61
|
export declare function composeHooks(hooks: ExecutionHooks): ExecutionHooks | undefined;
|
|
51
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
62
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXhlY3V0aW9uX2hvb2tzLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvaG9va3MvZXhlY3V0aW9uX2hvb2tzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLG9CQUFvQixFQUFFLE1BQU0sNkJBQTZCLENBQUM7QUFDeEUsT0FBTyxLQUFLLEVBQUUsb0JBQW9CLEVBQUUsTUFBTSw2QkFBNkIsQ0FBQztBQUN4RSxPQUFPLEtBQUssRUFBRSw0QkFBNEIsRUFBRSxNQUFNLHNDQUFzQyxDQUFDO0FBRXpGOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7R0FvQ0c7QUFDSCxNQUFNLFdBQVcsY0FBYztJQUM3QixtR0FBbUc7SUFDbkcsb0JBQW9CLENBQUMsRUFBRSxvQkFBb0IsQ0FBQztJQUM1Qzs7OztPQUlHO0lBQ0gsNEJBQTRCLENBQUMsRUFBRSw0QkFBNEIsQ0FBQztJQUM1RDs7OztPQUlHO0lBQ0gsb0JBQW9CLENBQUMsRUFBRSxvQkFBb0IsQ0FBQztDQUM3QztBQUVEOzs7R0FHRztBQUNILHdCQUFnQixZQUFZLENBQUMsS0FBSyxFQUFFLGNBQWMsR0FBRyxjQUFjLEdBQUcsU0FBUyxDQUs5RSJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execution_hooks.d.ts","sourceRoot":"","sources":["../../src/hooks/execution_hooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,sCAAsC,CAAC;AAEzF
|
|
1
|
+
{"version":3,"file":"execution_hooks.d.ts","sourceRoot":"","sources":["../../src/hooks/execution_hooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,sCAAsC,CAAC;AAEzF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,MAAM,WAAW,cAAc;IAC7B,mGAAmG;IACnG,oBAAoB,CAAC,EAAE,oBAAoB,CAAC;IAC5C;;;;OAIG;IACH,4BAA4B,CAAC,EAAE,4BAA4B,CAAC;IAC5D;;;;OAIG;IACH,oBAAoB,CAAC,EAAE,oBAAoB,CAAC;CAC7C;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,cAAc,GAAG,cAAc,GAAG,SAAS,CAK9E"}
|
package/dest/hooks/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export type { AuthorizeUtilityCall, UtilityCallAuthorizationRequest, UtilityCallAuthorizationResponse, } from './authorize_utility_call.js';
|
|
2
2
|
export { type ExecutionHooks, composeHooks } from './execution_hooks.js';
|
|
3
|
-
export { type
|
|
4
|
-
|
|
3
|
+
export { type CustomRequest, type ResolveCustomRequest } from './resolve_custom_request.js';
|
|
4
|
+
export { DEFAULT_TAGGING_SECRET_STRATEGY, type ResolveTaggingSecretStrategy, type TaggingSecretStrategy, type TaggingSecretStrategyRequest, } from './resolve_tagging_secret_strategy.js';
|
|
5
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ob29rcy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxZQUFZLEVBQ1Ysb0JBQW9CLEVBQ3BCLCtCQUErQixFQUMvQixnQ0FBZ0MsR0FDakMsTUFBTSw2QkFBNkIsQ0FBQztBQUNyQyxPQUFPLEVBQUUsS0FBSyxjQUFjLEVBQUUsWUFBWSxFQUFFLE1BQU0sc0JBQXNCLENBQUM7QUFDekUsT0FBTyxFQUFFLEtBQUssYUFBYSxFQUFFLEtBQUssb0JBQW9CLEVBQUUsTUFBTSw2QkFBNkIsQ0FBQztBQUM1RixPQUFPLEVBQ0wsK0JBQStCLEVBQy9CLEtBQUssNEJBQTRCLEVBQ2pDLEtBQUsscUJBQXFCLEVBQzFCLEtBQUssNEJBQTRCLEdBQ2xDLE1BQU0sc0NBQXNDLENBQUMifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,oBAAoB,EACpB,+BAA+B,EAC/B,gCAAgC,GACjC,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,KAAK,cAAc,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzE,OAAO,EACL,KAAK,4BAA4B,EACjC,KAAK,qBAAqB,EAC1B,KAAK,4BAA4B,GAClC,MAAM,sCAAsC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,oBAAoB,EACpB,+BAA+B,EAC/B,gCAAgC,GACjC,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,KAAK,cAAc,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzE,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAC5F,OAAO,EACL,+BAA+B,EAC/B,KAAK,4BAA4B,EACjC,KAAK,qBAAqB,EAC1B,KAAK,4BAA4B,GAClC,MAAM,sCAAsC,CAAC"}
|
package/dest/hooks/index.js
CHANGED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
|
+
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
3
|
+
/**
|
|
4
|
+
* A custom, caller-defined request resolved via the {@link ResolveCustomRequest} hook. It carries no fixed meaning:
|
|
5
|
+
* `kind` selects the request type so one hook can serve many such types, and `payload` holds the opaque,
|
|
6
|
+
* request-specific arguments. The resolver answers by whatever means it needs (local state, a third party,
|
|
7
|
+
* offchain data).
|
|
8
|
+
*/
|
|
9
|
+
export type CustomRequest = {
|
|
10
|
+
/** The address of the contract issuing the request. */
|
|
11
|
+
contractAddress: AztecAddress;
|
|
12
|
+
/** The issuing contract's class ID, so resolvers can apply class-level (not just per-address) policy. */
|
|
13
|
+
contractClassId: Fr;
|
|
14
|
+
/** Discriminates the request type, letting one hook serve many such types. */
|
|
15
|
+
kind: Fr;
|
|
16
|
+
/** Opaque, request-specific arguments. */
|
|
17
|
+
payload: Fr[];
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Hook resolving a {@link CustomRequest}. The resolver produces the response however it needs to.
|
|
21
|
+
*/
|
|
22
|
+
export type ResolveCustomRequest = (request: CustomRequest) => Promise<Fr[]>;
|
|
23
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmVzb2x2ZV9jdXN0b21fcmVxdWVzdC5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2hvb2tzL3Jlc29sdmVfY3VzdG9tX3JlcXVlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLEVBQUUsRUFBRSxFQUFFLE1BQU0sZ0NBQWdDLENBQUM7QUFDekQsT0FBTyxLQUFLLEVBQUUsWUFBWSxFQUFFLE1BQU0sNkJBQTZCLENBQUM7QUFFaEU7Ozs7O0dBS0c7QUFDSCxNQUFNLE1BQU0sYUFBYSxHQUFHO0lBQzFCLHVEQUF1RDtJQUN2RCxlQUFlLEVBQUUsWUFBWSxDQUFDO0lBQzlCLHlHQUF5RztJQUN6RyxlQUFlLEVBQUUsRUFBRSxDQUFDO0lBQ3BCLDhFQUE4RTtJQUM5RSxJQUFJLEVBQUUsRUFBRSxDQUFDO0lBQ1QsMENBQTBDO0lBQzFDLE9BQU8sRUFBRSxFQUFFLEVBQUUsQ0FBQztDQUNmLENBQUM7QUFFRjs7R0FFRztBQUNILE1BQU0sTUFBTSxvQkFBb0IsR0FBRyxDQUFDLE9BQU8sRUFBRSxhQUFhLEtBQUssT0FBTyxDQUFDLEVBQUUsRUFBRSxDQUFDLENBQUMifQ==
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve_custom_request.d.ts","sourceRoot":"","sources":["../../src/hooks/resolve_custom_request.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACzD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAEhE;;;;;GAKG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,uDAAuD;IACvD,eAAe,EAAE,YAAY,CAAC;IAC9B,yGAAyG;IACzG,eAAe,EAAE,EAAE,CAAC;IACpB,8EAA8E;IAC9E,IAAI,EAAE,EAAE,CAAC;IACT,0CAA0C;IAC1C,OAAO,EAAE,EAAE,EAAE,CAAC;CACf,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,OAAO,EAAE,aAAa,KAAK,OAAO,CAAC,EAAE,EAAE,CAAC,CAAC"}
|