@aztec/pxe 0.0.1-commit.0c875d939 → 0.0.1-commit.10bd49492
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/config/index.d.ts +2 -2
- package/dest/config/index.d.ts.map +1 -1
- package/dest/config/index.js +1 -1
- package/dest/config/package_info.js +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.d.ts +4 -1
- package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.js +16 -12
- package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts +7 -7
- package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts.map +1 -1
- package/dest/contract_function_simulator/execution_tagging_index_cache.js +19 -11
- package/dest/contract_function_simulator/index.d.ts +2 -1
- package/dest/contract_function_simulator/index.d.ts.map +1 -1
- package/dest/contract_function_simulator/index.js +1 -0
- package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts +2 -3
- package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/event_validation_request.js +5 -4
- package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts +1 -1
- package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/log_retrieval_response.js +1 -3
- package/dest/contract_function_simulator/noir-structs/message_tx_context.d.ts +16 -0
- package/dest/contract_function_simulator/noir-structs/message_tx_context.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/message_tx_context.js +57 -0
- package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +2 -4
- package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/note_validation_request.js +3 -5
- package/dest/contract_function_simulator/oracle/interfaces.d.ts +49 -45
- package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/legacy_oracle_mappings.d.ts +9 -0
- package/dest/contract_function_simulator/oracle/legacy_oracle_mappings.d.ts.map +1 -0
- package/dest/contract_function_simulator/oracle/legacy_oracle_mappings.js +52 -0
- package/dest/contract_function_simulator/oracle/oracle.d.ts +44 -44
- package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/oracle.js +141 -93
- package/dest/contract_function_simulator/oracle/private_execution.js +3 -3
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +23 -37
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.js +41 -67
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +40 -34
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +83 -50
- package/dest/contract_logging.d.ts +22 -0
- package/dest/contract_logging.d.ts.map +1 -0
- package/dest/contract_logging.js +23 -0
- package/dest/debug/pxe_debug_utils.d.ts +2 -2
- package/dest/debug/pxe_debug_utils.d.ts.map +1 -1
- package/dest/debug/pxe_debug_utils.js +4 -4
- 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/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/logs/log_service.d.ts +1 -1
- package/dest/logs/log_service.d.ts.map +1 -1
- package/dest/logs/log_service.js +4 -4
- package/dest/messages/message_context_service.d.ts +17 -0
- package/dest/messages/message_context_service.d.ts.map +1 -0
- package/dest/messages/message_context_service.js +36 -0
- package/dest/oracle_version.d.ts +2 -2
- package/dest/oracle_version.js +3 -3
- package/dest/private_kernel/hints/compute_tx_expiration_timestamp.d.ts +4 -0
- package/dest/private_kernel/hints/compute_tx_expiration_timestamp.d.ts.map +1 -0
- package/dest/private_kernel/hints/{compute_tx_include_by_timestamp.js → compute_tx_expiration_timestamp.js} +12 -12
- package/dest/private_kernel/hints/index.d.ts +1 -1
- package/dest/private_kernel/hints/index.js +1 -1
- package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts +4 -3
- 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 +129 -68
- package/dest/private_kernel/hints/test_utils.d.ts +122 -0
- package/dest/private_kernel/hints/test_utils.d.ts.map +1 -0
- package/dest/private_kernel/hints/test_utils.js +203 -0
- 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 +19 -11
- package/dest/private_kernel/private_kernel_oracle.d.ts +6 -2
- package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_oracle.js +7 -3
- package/dest/pxe.d.ts +9 -7
- package/dest/pxe.d.ts.map +1 -1
- package/dest/pxe.js +49 -36
- package/dest/storage/contract_store/contract_store.d.ts +42 -15
- package/dest/storage/contract_store/contract_store.d.ts.map +1 -1
- package/dest/storage/contract_store/contract_store.js +140 -64
- package/dest/storage/metadata.d.ts +1 -1
- package/dest/storage/metadata.js +1 -1
- package/dest/storage/tagging_store/recipient_tagging_store.d.ts +6 -6
- package/dest/storage/tagging_store/recipient_tagging_store.d.ts.map +1 -1
- package/dest/storage/tagging_store/sender_tagging_store.d.ts +29 -28
- package/dest/storage/tagging_store/sender_tagging_store.d.ts.map +1 -1
- package/dest/storage/tagging_store/sender_tagging_store.js +141 -115
- package/dest/tagging/get_all_logs_by_tags.d.ts +1 -1
- package/dest/tagging/get_all_logs_by_tags.d.ts.map +1 -1
- package/dest/tagging/get_all_logs_by_tags.js +17 -3
- package/dest/tagging/index.d.ts +3 -3
- package/dest/tagging/index.d.ts.map +1 -1
- package/dest/tagging/index.js +1 -1
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts +4 -5
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts.map +1 -1
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.js +7 -7
- package/dest/tagging/recipient_sync/utils/find_highest_indexes.js +2 -2
- package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts +6 -7
- package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts.map +1 -1
- package/dest/tagging/recipient_sync/utils/load_logs_for_range.js +12 -11
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts +4 -8
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts.map +1 -1
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.js +13 -7
- package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts +4 -3
- package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts.map +1 -1
- package/dest/tagging/sender_sync/utils/get_status_change_of_pending.js +20 -10
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts +5 -7
- 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 +36 -24
- package/package.json +16 -16
- package/src/config/index.ts +1 -1
- package/src/config/package_info.ts +1 -1
- package/src/contract_function_simulator/contract_function_simulator.ts +25 -21
- package/src/contract_function_simulator/execution_tagging_index_cache.ts +19 -14
- package/src/contract_function_simulator/index.ts +1 -0
- package/src/contract_function_simulator/noir-structs/event_validation_request.ts +8 -5
- package/src/contract_function_simulator/noir-structs/log_retrieval_response.ts +1 -4
- package/src/contract_function_simulator/noir-structs/message_tx_context.ts +55 -0
- package/src/contract_function_simulator/noir-structs/note_validation_request.ts +3 -6
- package/src/contract_function_simulator/oracle/interfaces.ts +53 -54
- package/src/contract_function_simulator/oracle/legacy_oracle_mappings.ts +77 -0
- package/src/contract_function_simulator/oracle/oracle.ts +154 -137
- package/src/contract_function_simulator/oracle/private_execution.ts +3 -3
- package/src/contract_function_simulator/oracle/private_execution_oracle.ts +46 -83
- package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +117 -59
- package/src/contract_logging.ts +39 -0
- package/src/debug/pxe_debug_utils.ts +4 -4
- package/src/entrypoints/client/bundle/index.ts +1 -0
- package/src/entrypoints/client/lazy/index.ts +1 -0
- package/src/logs/log_service.ts +10 -5
- package/src/messages/message_context_service.ts +45 -0
- package/src/oracle_version.ts +3 -3
- package/src/private_kernel/hints/{compute_tx_include_by_timestamp.ts → compute_tx_expiration_timestamp.ts} +13 -13
- package/src/private_kernel/hints/index.ts +1 -1
- package/src/private_kernel/hints/private_kernel_reset_private_inputs_builder.ts +164 -117
- package/src/private_kernel/hints/test_utils.ts +325 -0
- package/src/private_kernel/private_kernel_execution_prover.ts +19 -12
- package/src/private_kernel/private_kernel_oracle.ts +7 -7
- package/src/pxe.ts +53 -40
- package/src/storage/contract_store/contract_store.ts +170 -71
- package/src/storage/metadata.ts +1 -1
- package/src/storage/tagging_store/recipient_tagging_store.ts +9 -5
- package/src/storage/tagging_store/sender_tagging_store.ts +185 -138
- package/src/tagging/get_all_logs_by_tags.ts +28 -4
- package/src/tagging/index.ts +2 -2
- package/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts +7 -10
- package/src/tagging/recipient_sync/utils/find_highest_indexes.ts +2 -2
- package/src/tagging/recipient_sync/utils/load_logs_for_range.ts +10 -15
- package/src/tagging/sender_sync/sync_sender_tagging_indexes.ts +23 -10
- package/src/tagging/sender_sync/utils/get_status_change_of_pending.ts +26 -11
- package/src/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.ts +27 -26
- package/dest/private_kernel/hints/compute_tx_include_by_timestamp.d.ts +0 -4
- package/dest/private_kernel/hints/compute_tx_include_by_timestamp.d.ts.map +0 -1
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
15
15
|
import { siloNullifier } from '@aztec/stdlib/hash';
|
|
16
16
|
import { PrivateContextInputs } from '@aztec/stdlib/kernel';
|
|
17
|
-
import { type ContractClassLog,
|
|
17
|
+
import { type ContractClassLog, ExtendedDirectionalAppTaggingSecret, type TaggingIndexRange } from '@aztec/stdlib/logs';
|
|
18
18
|
import { Tag } from '@aztec/stdlib/logs';
|
|
19
19
|
import { Note, type NoteStatus } from '@aztec/stdlib/note';
|
|
20
20
|
import {
|
|
@@ -166,10 +166,10 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
166
166
|
}
|
|
167
167
|
|
|
168
168
|
/**
|
|
169
|
-
* Returns the
|
|
169
|
+
* Returns the tagging index ranges that were used in this execution (and that need to be stored in the db).
|
|
170
170
|
*/
|
|
171
|
-
public
|
|
172
|
-
return this.taggingIndexCache.
|
|
171
|
+
public getUsedTaggingIndexRanges(): TaggingIndexRange[] {
|
|
172
|
+
return this.taggingIndexCache.getUsedTaggingIndexRanges();
|
|
173
173
|
}
|
|
174
174
|
|
|
175
175
|
/**
|
|
@@ -189,7 +189,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
189
189
|
* The value persists through nested calls, meaning all calls down the stack will use the same
|
|
190
190
|
* 'senderForTags' value (unless it is replaced).
|
|
191
191
|
*/
|
|
192
|
-
public
|
|
192
|
+
public getSenderForTags(): Promise<AztecAddress | undefined> {
|
|
193
193
|
return Promise.resolve(this.senderForTags);
|
|
194
194
|
}
|
|
195
195
|
|
|
@@ -204,7 +204,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
204
204
|
* through nested calls, meaning all calls down the stack will use the same 'senderForTags'
|
|
205
205
|
* value (unless it is replaced by another call to this setter).
|
|
206
206
|
*/
|
|
207
|
-
public
|
|
207
|
+
public setSenderForTags(senderForTags: AztecAddress): Promise<void> {
|
|
208
208
|
this.senderForTags = senderForTags;
|
|
209
209
|
return Promise.resolve();
|
|
210
210
|
}
|
|
@@ -215,26 +215,30 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
215
215
|
* @param recipient - The address receiving the log
|
|
216
216
|
* @returns An app tag to be used in a log.
|
|
217
217
|
*/
|
|
218
|
-
public async
|
|
219
|
-
const
|
|
218
|
+
public async getNextAppTagAsSender(sender: AztecAddress, recipient: AztecAddress): Promise<Tag> {
|
|
219
|
+
const extendedSecret = await this.#calculateExtendedDirectionalAppTaggingSecret(
|
|
220
|
+
this.contractAddress,
|
|
221
|
+
sender,
|
|
222
|
+
recipient,
|
|
223
|
+
);
|
|
220
224
|
|
|
221
|
-
const index = await this.#getIndexToUseForSecret(
|
|
222
|
-
this.
|
|
225
|
+
const index = await this.#getIndexToUseForSecret(extendedSecret);
|
|
226
|
+
this.logger.debug(
|
|
223
227
|
`Incrementing tagging index for sender: ${sender}, recipient: ${recipient}, contract: ${this.contractAddress} to ${index}`,
|
|
224
228
|
);
|
|
225
|
-
this.taggingIndexCache.setLastUsedIndex(
|
|
229
|
+
this.taggingIndexCache.setLastUsedIndex(extendedSecret, index);
|
|
226
230
|
|
|
227
|
-
return Tag.compute({
|
|
231
|
+
return Tag.compute({ extendedSecret, index });
|
|
228
232
|
}
|
|
229
233
|
|
|
230
|
-
async #
|
|
234
|
+
async #calculateExtendedDirectionalAppTaggingSecret(
|
|
231
235
|
contractAddress: AztecAddress,
|
|
232
236
|
sender: AztecAddress,
|
|
233
237
|
recipient: AztecAddress,
|
|
234
238
|
) {
|
|
235
239
|
const senderCompleteAddress = await this.getCompleteAddressOrFail(sender);
|
|
236
240
|
const senderIvsk = await this.keyStore.getMasterIncomingViewingSecretKey(sender);
|
|
237
|
-
return
|
|
241
|
+
return ExtendedDirectionalAppTaggingSecret.compute(
|
|
238
242
|
senderCompleteAddress,
|
|
239
243
|
senderIvsk,
|
|
240
244
|
recipient,
|
|
@@ -243,7 +247,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
243
247
|
);
|
|
244
248
|
}
|
|
245
249
|
|
|
246
|
-
async #getIndexToUseForSecret(secret:
|
|
250
|
+
async #getIndexToUseForSecret(secret: ExtendedDirectionalAppTaggingSecret): Promise<number> {
|
|
247
251
|
// If we have the tagging index in the cache, we use it. If not we obtain it from the execution data provider.
|
|
248
252
|
const lastUsedIndexInTx = this.taggingIndexCache.getLastUsedIndex(secret);
|
|
249
253
|
|
|
@@ -255,7 +259,6 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
255
259
|
// that'd be wasteful as most tagging secrets are not used in each tx.
|
|
256
260
|
await syncSenderTaggingIndexes(
|
|
257
261
|
secret,
|
|
258
|
-
this.contractAddress,
|
|
259
262
|
this.aztecNode,
|
|
260
263
|
this.senderTaggingStore,
|
|
261
264
|
await this.anchorBlockHeader.hash(),
|
|
@@ -274,7 +277,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
274
277
|
* @param values - Values to store.
|
|
275
278
|
* @returns The hash of the values.
|
|
276
279
|
*/
|
|
277
|
-
public
|
|
280
|
+
public storeInExecutionCache(values: Fr[], hash: Fr) {
|
|
278
281
|
return this.executionCache.store(values, hash);
|
|
279
282
|
}
|
|
280
283
|
|
|
@@ -283,7 +286,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
283
286
|
* @param hash - Hash of the values.
|
|
284
287
|
* @returns The values.
|
|
285
288
|
*/
|
|
286
|
-
public
|
|
289
|
+
public loadFromExecutionCache(hash: Fr): Promise<Fr[]> {
|
|
287
290
|
const preimage = this.executionCache.getPreimage(hash);
|
|
288
291
|
if (!preimage) {
|
|
289
292
|
throw new Error(`Preimage for hash ${hash.toString()} not found in cache`);
|
|
@@ -291,12 +294,12 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
291
294
|
return Promise.resolve(preimage);
|
|
292
295
|
}
|
|
293
296
|
|
|
294
|
-
override async
|
|
297
|
+
override async checkNullifierExists(innerNullifier: Fr): Promise<boolean> {
|
|
295
298
|
// This oracle must be overridden because while utility execution can only meaningfully check if a nullifier exists
|
|
296
299
|
// in the synched block, during private execution there's also the possibility of it being pending, i.e. created
|
|
297
300
|
// in the current transaction.
|
|
298
301
|
|
|
299
|
-
this.
|
|
302
|
+
this.logger.debug(`Checking existence of inner nullifier ${innerNullifier}`, {
|
|
300
303
|
contractAddress: this.contractAddress,
|
|
301
304
|
});
|
|
302
305
|
|
|
@@ -304,7 +307,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
304
307
|
|
|
305
308
|
return (
|
|
306
309
|
this.noteCache.getNullifiers(this.contractAddress).has(nullifier) ||
|
|
307
|
-
(await super.
|
|
310
|
+
(await super.checkNullifierExists(innerNullifier))
|
|
308
311
|
);
|
|
309
312
|
}
|
|
310
313
|
|
|
@@ -329,7 +332,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
329
332
|
* @param status - The status of notes to fetch.
|
|
330
333
|
* @returns Array of note data.
|
|
331
334
|
*/
|
|
332
|
-
public override async
|
|
335
|
+
public override async getNotes(
|
|
333
336
|
owner: AztecAddress | undefined,
|
|
334
337
|
storageSlot: Fr,
|
|
335
338
|
numSelects: number,
|
|
@@ -375,7 +378,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
375
378
|
offset,
|
|
376
379
|
});
|
|
377
380
|
|
|
378
|
-
this.
|
|
381
|
+
this.logger.debug(
|
|
379
382
|
`Returning ${notes.length} notes for ${this.callContext.contractAddress} at ${storageSlot}: ${notes
|
|
380
383
|
.map(n => `${n.noteNonce.toString()}:[${n.note.items.map(i => i.toString()).join(',')}]`)
|
|
381
384
|
.join(', ')}`,
|
|
@@ -395,7 +398,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
395
398
|
* @param noteHash - A hash of the new note.
|
|
396
399
|
* @returns
|
|
397
400
|
*/
|
|
398
|
-
public
|
|
401
|
+
public notifyCreatedNote(
|
|
399
402
|
owner: AztecAddress,
|
|
400
403
|
storageSlot: Fr,
|
|
401
404
|
randomness: Fr,
|
|
@@ -404,7 +407,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
404
407
|
noteHash: Fr,
|
|
405
408
|
counter: number,
|
|
406
409
|
) {
|
|
407
|
-
this.
|
|
410
|
+
this.logger.debug(`Notified of new note with inner hash ${noteHash}`, {
|
|
408
411
|
contractAddress: this.callContext.contractAddress,
|
|
409
412
|
storageSlot,
|
|
410
413
|
randomness,
|
|
@@ -436,7 +439,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
436
439
|
* @param innerNullifier - The pending nullifier to add in the list (not yet siloed by contract address).
|
|
437
440
|
* @param noteHash - A hash of the new note.
|
|
438
441
|
*/
|
|
439
|
-
public async
|
|
442
|
+
public async notifyNullifiedNote(innerNullifier: Fr, noteHash: Fr, counter: number) {
|
|
440
443
|
const nullifiedNoteHashCounter = await this.noteCache.nullifyNote(
|
|
441
444
|
this.callContext.contractAddress,
|
|
442
445
|
innerNullifier,
|
|
@@ -453,19 +456,19 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
453
456
|
* @param innerNullifier - The pending nullifier to add in the list (not yet siloed by contract address).
|
|
454
457
|
* @param noteHash - A hash of the new note.
|
|
455
458
|
*/
|
|
456
|
-
public
|
|
457
|
-
this.
|
|
459
|
+
public notifyCreatedNullifier(innerNullifier: Fr) {
|
|
460
|
+
this.logger.debug(`Notified of new inner nullifier ${innerNullifier}`, { contractAddress: this.contractAddress });
|
|
458
461
|
return this.noteCache.nullifierCreated(this.callContext.contractAddress, innerNullifier);
|
|
459
462
|
}
|
|
460
463
|
|
|
461
464
|
/**
|
|
462
|
-
* Check if a nullifier has been emitted in the same transaction, i.e. if
|
|
465
|
+
* Check if a nullifier has been emitted in the same transaction, i.e. if notifyCreatedNullifier has been
|
|
463
466
|
* called for this inner nullifier from the contract with the specified address.
|
|
464
467
|
* @param innerNullifier - The inner nullifier to check.
|
|
465
468
|
* @param contractAddress - Address of the contract that emitted the nullifier.
|
|
466
469
|
* @returns A boolean indicating whether the nullifier is pending or not.
|
|
467
470
|
*/
|
|
468
|
-
public async
|
|
471
|
+
public async isNullifierPending(innerNullifier: Fr, contractAddress: AztecAddress): Promise<boolean> {
|
|
469
472
|
const siloedNullifier = await siloNullifier(contractAddress, innerNullifier);
|
|
470
473
|
const isNullifierPending = this.noteCache.getNullifiers(contractAddress).has(siloedNullifier.toBigInt());
|
|
471
474
|
return Promise.resolve(isNullifierPending);
|
|
@@ -478,10 +481,10 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
478
481
|
* @param log - The contract class log to be emitted.
|
|
479
482
|
* @param counter - The contract class log's counter.
|
|
480
483
|
*/
|
|
481
|
-
public
|
|
484
|
+
public notifyCreatedContractClassLog(log: ContractClassLog, counter: number) {
|
|
482
485
|
this.contractClassLogs.push(new CountedContractClassLog(log, counter));
|
|
483
486
|
const text = log.toBuffer().toString('hex');
|
|
484
|
-
this.
|
|
487
|
+
this.logger.verbose(
|
|
485
488
|
`Emitted log from ContractClassRegistry: "${text.length > 100 ? text.slice(0, 100) + '...' : text}"`,
|
|
486
489
|
);
|
|
487
490
|
}
|
|
@@ -507,7 +510,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
507
510
|
* @param isStaticCall - Whether the call is a static call.
|
|
508
511
|
* @returns The execution result.
|
|
509
512
|
*/
|
|
510
|
-
async
|
|
513
|
+
async callPrivateFunction(
|
|
511
514
|
targetContractAddress: AztecAddress,
|
|
512
515
|
functionSelector: FunctionSelector,
|
|
513
516
|
argsHash: Fr,
|
|
@@ -521,28 +524,19 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
521
524
|
}
|
|
522
525
|
|
|
523
526
|
const simulatorSetupTimer = new Timer();
|
|
524
|
-
this.
|
|
527
|
+
this.logger.debug(
|
|
525
528
|
`Calling private function ${targetContractAddress}:${functionSelector} from ${this.callContext.contractAddress}`,
|
|
526
529
|
);
|
|
527
530
|
|
|
528
531
|
isStaticCall = isStaticCall || this.callContext.isStaticCall;
|
|
529
532
|
|
|
530
|
-
// When scopes are set and the target contract is a registered account (has keys in the keyStore),
|
|
531
|
-
// expand scopes to include it so nested private calls can sync and read the contract's own notes.
|
|
532
|
-
// We only expand for registered accounts because the log service needs the recipient's keys to derive
|
|
533
|
-
// tagging secrets, which are only available for registered accounts.
|
|
534
|
-
const expandedScopes =
|
|
535
|
-
this.scopes !== 'ALL_SCOPES' && (await this.keyStore.hasAccount(targetContractAddress))
|
|
536
|
-
? [...this.scopes, targetContractAddress]
|
|
537
|
-
: this.scopes;
|
|
538
|
-
|
|
539
533
|
await this.contractSyncService.ensureContractSynced(
|
|
540
534
|
targetContractAddress,
|
|
541
535
|
functionSelector,
|
|
542
536
|
this.utilityExecutor,
|
|
543
537
|
this.anchorBlockHeader,
|
|
544
538
|
this.jobId,
|
|
545
|
-
|
|
539
|
+
this.scopes,
|
|
546
540
|
);
|
|
547
541
|
|
|
548
542
|
const targetArtifact = await this.contractStore.getFunctionArtifactWithDebugMetadata(
|
|
@@ -575,12 +569,13 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
575
569
|
senderAddressBookStore: this.senderAddressBookStore,
|
|
576
570
|
capsuleStore: this.capsuleStore,
|
|
577
571
|
privateEventStore: this.privateEventStore,
|
|
572
|
+
messageContextService: this.messageContextService,
|
|
578
573
|
contractSyncService: this.contractSyncService,
|
|
579
574
|
jobId: this.jobId,
|
|
580
575
|
totalPublicCalldataCount: this.totalPublicCalldataCount,
|
|
581
576
|
sideEffectCounter,
|
|
582
|
-
log: this.
|
|
583
|
-
scopes:
|
|
577
|
+
log: this.logger,
|
|
578
|
+
scopes: this.scopes,
|
|
584
579
|
senderForTags: this.senderForTags,
|
|
585
580
|
simulator: this.simulator!,
|
|
586
581
|
});
|
|
@@ -614,7 +609,8 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
614
609
|
};
|
|
615
610
|
}
|
|
616
611
|
|
|
617
|
-
|
|
612
|
+
/** Validates the calldata preimage exists in the cache and checks cumulative calldata size is within limits. */
|
|
613
|
+
public validatePublicCalldata(calldataHash: Fr) {
|
|
618
614
|
const calldata = this.executionCache.getPreimage(calldataHash);
|
|
619
615
|
if (!calldata) {
|
|
620
616
|
throw new Error('Calldata for public call not found in cache');
|
|
@@ -624,47 +620,14 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
624
620
|
if (this.totalPublicCalldataCount > MAX_FR_CALLDATA_TO_ALL_ENQUEUED_CALLS) {
|
|
625
621
|
throw new Error(`Too many total args to all enqueued public calls! (> ${MAX_FR_CALLDATA_TO_ALL_ENQUEUED_CALLS})`);
|
|
626
622
|
}
|
|
627
|
-
}
|
|
628
|
-
|
|
629
|
-
/**
|
|
630
|
-
* Verify relevant information when a public function is enqueued.
|
|
631
|
-
* @param targetContractAddress - The address of the contract to call.
|
|
632
|
-
* @param calldataHash - The hash of the function selector and arguments.
|
|
633
|
-
* @param sideEffectCounter - The side effect counter at the start of the call.
|
|
634
|
-
* @param isStaticCall - Whether the call is a static call.
|
|
635
|
-
*/
|
|
636
|
-
public privateNotifyEnqueuedPublicFunctionCall(
|
|
637
|
-
_targetContractAddress: AztecAddress,
|
|
638
|
-
calldataHash: Fr,
|
|
639
|
-
_sideEffectCounter: number,
|
|
640
|
-
_isStaticCall: boolean,
|
|
641
|
-
) {
|
|
642
|
-
this.#onNewPublicFunctionCall(calldataHash);
|
|
643
|
-
return Promise.resolve();
|
|
644
|
-
}
|
|
645
|
-
|
|
646
|
-
/**
|
|
647
|
-
* Verify relevant information when a public teardown function is set.
|
|
648
|
-
* @param targetContractAddress - The address of the contract to call.
|
|
649
|
-
* @param argsHash - The arguments hash to pass to the function.
|
|
650
|
-
* @param sideEffectCounter - The side effect counter at the start of the call.
|
|
651
|
-
* @param isStaticCall - Whether the call is a static call.
|
|
652
|
-
*/
|
|
653
|
-
public privateNotifySetPublicTeardownFunctionCall(
|
|
654
|
-
_targetContractAddress: AztecAddress,
|
|
655
|
-
calldataHash: Fr,
|
|
656
|
-
_sideEffectCounter: number,
|
|
657
|
-
_isStaticCall: boolean,
|
|
658
|
-
) {
|
|
659
|
-
this.#onNewPublicFunctionCall(calldataHash);
|
|
660
623
|
return Promise.resolve();
|
|
661
624
|
}
|
|
662
625
|
|
|
663
|
-
public
|
|
626
|
+
public notifyRevertiblePhaseStart(minRevertibleSideEffectCounter: number): Promise<void> {
|
|
664
627
|
return this.noteCache.setMinRevertibleSideEffectCounter(minRevertibleSideEffectCounter);
|
|
665
628
|
}
|
|
666
629
|
|
|
667
|
-
public
|
|
630
|
+
public inRevertiblePhase(sideEffectCounter: number): Promise<boolean> {
|
|
668
631
|
return Promise.resolve(this.noteCache.isSideEffectCounterRevertible(sideEffectCounter));
|
|
669
632
|
}
|
|
670
633
|
|
|
@@ -692,7 +655,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
692
655
|
return this.contractStore.getDebugFunctionName(this.contractAddress, this.callContext.functionSelector);
|
|
693
656
|
}
|
|
694
657
|
|
|
695
|
-
public
|
|
658
|
+
public emitOffchainEffect(data: Fr[]): Promise<void> {
|
|
696
659
|
this.offchainEffects.push({ data });
|
|
697
660
|
return Promise.resolve();
|
|
698
661
|
}
|