@aztec/pxe 0.0.1-commit.f295ac2 → 0.0.1-commit.f2ce05ee
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dest/bin/check_oracle_version.js +1 -1
- package/dest/block_synchronizer/block_synchronizer.d.ts +9 -5
- package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -1
- package/dest/block_synchronizer/block_synchronizer.js +62 -16
- package/dest/config/index.d.ts +3 -1
- package/dest/config/index.d.ts.map +1 -1
- package/dest/config/index.js +17 -0
- package/dest/contract_function_simulator/contract_function_simulator.d.ts +5 -5
- package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.js +12 -15
- package/dest/contract_function_simulator/index.d.ts +2 -2
- package/dest/contract_function_simulator/index.d.ts.map +1 -1
- package/dest/contract_function_simulator/index.js +1 -1
- package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts +1 -1
- package/dest/contract_function_simulator/noir-structs/event_validation_request.js +1 -1
- package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +1 -1
- package/dest/contract_function_simulator/noir-structs/note_validation_request.js +1 -1
- package/dest/contract_function_simulator/oracle/interfaces.d.ts +15 -12
- package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts +4 -4
- package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/note_packing_utils.js +4 -4
- package/dest/contract_function_simulator/oracle/oracle.d.ts +7 -5
- package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/oracle.js +56 -34
- package/dest/contract_function_simulator/oracle/private_execution.d.ts +2 -22
- package/dest/contract_function_simulator/oracle/private_execution.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution.js +0 -37
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +12 -3
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.js +20 -9
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +38 -24
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +84 -65
- package/dest/contract_sync/contract_sync_service.d.ts +41 -0
- package/dest/contract_sync/contract_sync_service.d.ts.map +1 -0
- package/dest/contract_sync/contract_sync_service.js +82 -0
- package/dest/contract_sync/helpers.d.ts +28 -0
- package/dest/contract_sync/helpers.d.ts.map +1 -0
- package/dest/contract_sync/helpers.js +55 -0
- package/dest/debug/pxe_debug_utils.d.ts +22 -9
- package/dest/debug/pxe_debug_utils.d.ts.map +1 -1
- package/dest/debug/pxe_debug_utils.js +28 -17
- 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 +12 -6
- package/dest/entrypoints/client/lazy/utils.d.ts +2 -2
- package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/utils.js +13 -7
- package/dest/entrypoints/pxe_creation_options.d.ts +3 -2
- package/dest/entrypoints/pxe_creation_options.d.ts.map +1 -1
- package/dest/entrypoints/server/index.d.ts +2 -1
- package/dest/entrypoints/server/index.d.ts.map +1 -1
- package/dest/entrypoints/server/index.js +1 -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 +19 -8
- package/dest/events/event_service.d.ts +5 -6
- package/dest/events/event_service.d.ts.map +1 -1
- package/dest/events/event_service.js +6 -7
- package/dest/job_coordinator/job_coordinator.d.ts +3 -2
- package/dest/job_coordinator/job_coordinator.d.ts.map +1 -1
- package/dest/job_coordinator/job_coordinator.js +3 -2
- package/dest/logs/log_service.d.ts +6 -5
- package/dest/logs/log_service.d.ts.map +1 -1
- package/dest/logs/log_service.js +20 -19
- package/dest/notes/note_service.d.ts +6 -6
- package/dest/notes/note_service.d.ts.map +1 -1
- package/dest/notes/note_service.js +14 -14
- package/dest/oracle_version.d.ts +3 -3
- package/dest/oracle_version.d.ts.map +1 -1
- package/dest/oracle_version.js +4 -3
- package/dest/private_kernel/private_kernel_execution_prover.d.ts +3 -2
- package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_execution_prover.js +2 -2
- package/dest/private_kernel/private_kernel_oracle.d.ts +3 -3
- package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -1
- package/dest/pxe.d.ts +13 -2
- package/dest/pxe.d.ts.map +1 -1
- package/dest/pxe.js +45 -20
- package/dest/storage/address_store/address_store.d.ts +1 -1
- package/dest/storage/address_store/address_store.d.ts.map +1 -1
- package/dest/storage/address_store/address_store.js +12 -11
- package/dest/storage/anchor_block_store/anchor_block_store.d.ts +9 -1
- package/dest/storage/anchor_block_store/anchor_block_store.d.ts.map +1 -1
- package/dest/storage/anchor_block_store/anchor_block_store.js +8 -1
- package/dest/storage/capsule_store/capsule_store.js +6 -8
- package/dest/storage/contract_store/contract_store.d.ts +1 -2
- package/dest/storage/contract_store/contract_store.d.ts.map +1 -1
- package/dest/storage/contract_store/contract_store.js +27 -30
- package/dest/storage/metadata.d.ts +1 -1
- package/dest/storage/metadata.js +1 -1
- package/dest/storage/note_store/note_store.d.ts +48 -50
- package/dest/storage/note_store/note_store.d.ts.map +1 -1
- package/dest/storage/note_store/note_store.js +279 -252
- package/dest/storage/note_store/stored_note.d.ts +16 -0
- package/dest/storage/note_store/stored_note.d.ts.map +1 -0
- package/dest/storage/note_store/stored_note.js +43 -0
- package/dest/storage/private_event_store/private_event_store.d.ts +17 -4
- package/dest/storage/private_event_store/private_event_store.d.ts.map +1 -1
- package/dest/storage/private_event_store/private_event_store.js +198 -147
- package/dest/storage/private_event_store/stored_private_event.d.ts +23 -0
- package/dest/storage/private_event_store/stored_private_event.d.ts.map +1 -0
- package/dest/storage/private_event_store/stored_private_event.js +56 -0
- package/dest/storage/tagging_store/recipient_tagging_store.d.ts +1 -1
- package/dest/storage/tagging_store/recipient_tagging_store.d.ts.map +1 -1
- package/dest/storage/tagging_store/recipient_tagging_store.js +31 -19
- package/dest/storage/tagging_store/sender_address_book_store.d.ts +1 -1
- package/dest/storage/tagging_store/sender_address_book_store.d.ts.map +1 -1
- package/dest/storage/tagging_store/sender_address_book_store.js +20 -14
- package/dest/storage/tagging_store/sender_tagging_store.d.ts +1 -1
- package/dest/storage/tagging_store/sender_tagging_store.d.ts.map +1 -1
- package/dest/storage/tagging_store/sender_tagging_store.js +183 -113
- package/dest/tagging/get_all_logs_by_tags.d.ts +24 -0
- package/dest/tagging/get_all_logs_by_tags.d.ts.map +1 -0
- package/dest/tagging/get_all_logs_by_tags.js +46 -0
- package/dest/tagging/index.d.ts +2 -1
- package/dest/tagging/index.d.ts.map +1 -1
- package/dest/tagging/index.js +1 -0
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts +3 -2
- 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 +2 -2
- package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts +3 -2
- 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 +5 -2
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts +3 -2
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts.map +1 -1
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.js +2 -2
- package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts +1 -1
- 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 +5 -8
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts +3 -2
- 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 +7 -4
- package/package.json +25 -16
- package/src/bin/check_oracle_version.ts +1 -0
- package/src/block_synchronizer/block_synchronizer.ts +76 -33
- package/src/config/index.ts +14 -0
- package/src/contract_function_simulator/contract_function_simulator.ts +12 -17
- package/src/contract_function_simulator/index.ts +1 -1
- package/src/contract_function_simulator/noir-structs/event_validation_request.ts +1 -1
- package/src/contract_function_simulator/noir-structs/note_validation_request.ts +1 -1
- package/src/contract_function_simulator/oracle/interfaces.ts +20 -11
- package/src/contract_function_simulator/oracle/note_packing_utils.ts +4 -4
- package/src/contract_function_simulator/oracle/oracle.ts +62 -32
- package/src/contract_function_simulator/oracle/private_execution.ts +1 -60
- package/src/contract_function_simulator/oracle/private_execution_oracle.ts +34 -11
- package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +107 -74
- package/src/contract_sync/contract_sync_service.ts +129 -0
- package/src/contract_sync/helpers.ts +93 -0
- package/src/debug/pxe_debug_utils.ts +60 -17
- package/src/entrypoints/client/bundle/utils.ts +7 -14
- package/src/entrypoints/client/lazy/utils.ts +8 -14
- package/src/entrypoints/pxe_creation_options.ts +2 -1
- package/src/entrypoints/server/index.ts +1 -0
- package/src/entrypoints/server/utils.ts +15 -19
- package/src/events/event_service.ts +5 -7
- package/src/job_coordinator/job_coordinator.ts +4 -3
- package/src/logs/log_service.ts +31 -15
- package/src/notes/note_service.ts +21 -20
- package/src/oracle_version.ts +4 -3
- package/src/private_kernel/private_kernel_execution_prover.ts +6 -3
- package/src/private_kernel/private_kernel_oracle.ts +2 -2
- package/src/pxe.ts +84 -19
- package/src/storage/address_store/address_store.ts +15 -15
- package/src/storage/anchor_block_store/anchor_block_store.ts +8 -0
- package/src/storage/capsule_store/capsule_store.ts +8 -8
- package/src/storage/contract_store/contract_store.ts +26 -35
- package/src/storage/metadata.ts +1 -1
- package/src/storage/note_store/note_store.ts +318 -318
- package/src/storage/note_store/stored_note.ts +48 -0
- package/src/storage/private_event_store/private_event_store.ts +250 -190
- package/src/storage/private_event_store/stored_private_event.ts +73 -0
- package/src/storage/tagging_store/recipient_tagging_store.ts +31 -21
- package/src/storage/tagging_store/sender_address_book_store.ts +20 -14
- package/src/storage/tagging_store/sender_tagging_store.ts +210 -126
- package/src/tagging/get_all_logs_by_tags.ts +68 -0
- package/src/tagging/index.ts +1 -0
- package/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts +11 -1
- package/src/tagging/recipient_sync/utils/load_logs_for_range.ts +7 -1
- package/src/tagging/sender_sync/sync_sender_tagging_indexes.ts +3 -1
- package/src/tagging/sender_sync/utils/get_status_change_of_pending.ts +5 -17
- package/src/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.ts +12 -3
- package/dest/tree_membership/tree_membership_service.d.ts +0 -50
- package/dest/tree_membership/tree_membership_service.d.ts.map +0 -1
- package/dest/tree_membership/tree_membership_service.js +0 -75
- package/src/tree_membership/tree_membership_service.ts +0 -97
|
@@ -13,7 +13,7 @@ import { CallContext, CountedContractClassLog, NoteAndSlot } from '@aztec/stdlib
|
|
|
13
13
|
import { NoteService } from '../../notes/note_service.js';
|
|
14
14
|
import { syncSenderTaggingIndexes } from '../../tagging/index.js';
|
|
15
15
|
import { pickNotes } from '../pick_notes.js';
|
|
16
|
-
import { executePrivateFunction
|
|
16
|
+
import { executePrivateFunction } from './private_execution.js';
|
|
17
17
|
import { UtilityExecutionOracle } from './utility_execution_oracle.js';
|
|
18
18
|
/**
|
|
19
19
|
* The execution oracle for the private part of a transaction.
|
|
@@ -27,6 +27,7 @@ import { UtilityExecutionOracle } from './utility_execution_oracle.js';
|
|
|
27
27
|
noteCache;
|
|
28
28
|
taggingIndexCache;
|
|
29
29
|
senderTaggingStore;
|
|
30
|
+
contractSyncService;
|
|
30
31
|
totalPublicCalldataCount;
|
|
31
32
|
sideEffectCounter;
|
|
32
33
|
senderForTags;
|
|
@@ -44,8 +45,8 @@ import { UtilityExecutionOracle } from './utility_execution_oracle.js';
|
|
|
44
45
|
contractClassLogs;
|
|
45
46
|
offchainEffects;
|
|
46
47
|
nestedExecutionResults;
|
|
47
|
-
constructor(argsHash, txContext, callContext, /** Header of a block whose state is used during private execution (not the block the transaction is included in). */ anchorBlockHeader, /** Needed to trigger contract synchronization before nested calls */ utilityExecutor, /** List of transient auth witnesses to be used during this simulation */ authWitnesses, capsules, executionCache, noteCache, taggingIndexCache, contractStore, noteStore, keyStore, addressStore, aztecNode,
|
|
48
|
-
super(callContext.contractAddress, authWitnesses, capsules, anchorBlockHeader, contractStore, noteStore, keyStore, addressStore, aztecNode,
|
|
48
|
+
constructor(argsHash, txContext, callContext, /** Header of a block whose state is used during private execution (not the block the transaction is included in). */ anchorBlockHeader, /** Needed to trigger contract synchronization before nested calls */ utilityExecutor, /** List of transient auth witnesses to be used during this simulation */ authWitnesses, capsules, executionCache, noteCache, taggingIndexCache, contractStore, noteStore, keyStore, addressStore, aztecNode, senderTaggingStore, recipientTaggingStore, senderAddressBookStore, capsuleStore, privateEventStore, contractSyncService, jobId, totalPublicCalldataCount = 0, sideEffectCounter = 0, log = createLogger('simulator:client_execution_context'), scopes, senderForTags, simulator){
|
|
49
|
+
super(callContext.contractAddress, authWitnesses, capsules, anchorBlockHeader, contractStore, noteStore, keyStore, addressStore, aztecNode, recipientTaggingStore, senderAddressBookStore, capsuleStore, privateEventStore, jobId, log, scopes), this.argsHash = argsHash, this.txContext = txContext, this.callContext = callContext, this.anchorBlockHeader = anchorBlockHeader, this.utilityExecutor = utilityExecutor, this.executionCache = executionCache, this.noteCache = noteCache, this.taggingIndexCache = taggingIndexCache, this.senderTaggingStore = senderTaggingStore, this.contractSyncService = contractSyncService, this.totalPublicCalldataCount = totalPublicCalldataCount, this.sideEffectCounter = sideEffectCounter, this.senderForTags = senderForTags, this.simulator = simulator, this.isPrivate = true, this.newNotes = [], this.noteHashNullifierCounterMap = new Map(), this.contractClassLogs = [], this.offchainEffects = [], this.nestedExecutionResults = [];
|
|
49
50
|
}
|
|
50
51
|
getPrivateContextInputs() {
|
|
51
52
|
return new PrivateContextInputs(this.callContext, this.anchorBlockHeader, this.txContext, this.sideEffectCounter);
|
|
@@ -142,7 +143,7 @@ import { UtilityExecutionOracle } from './utility_execution_oracle.js';
|
|
|
142
143
|
});
|
|
143
144
|
}
|
|
144
145
|
async #calculateDirectionalAppTaggingSecret(contractAddress, sender, recipient) {
|
|
145
|
-
const senderCompleteAddress = await this.
|
|
146
|
+
const senderCompleteAddress = await this.getCompleteAddressOrFail(sender);
|
|
146
147
|
const senderIvsk = await this.keyStore.getMasterIncomingViewingSecretKey(sender);
|
|
147
148
|
return DirectionalAppTaggingSecret.compute(senderCompleteAddress, senderIvsk, recipient, contractAddress, recipient);
|
|
148
149
|
}
|
|
@@ -155,7 +156,7 @@ import { UtilityExecutionOracle } from './utility_execution_oracle.js';
|
|
|
155
156
|
// This is a tagging secret we've not yet used in this tx, so first sync our store to make sure its indices
|
|
156
157
|
// are up to date. We do this here because this store is not synced as part of the global sync because
|
|
157
158
|
// that'd be wasteful as most tagging secrets are not used in each tx.
|
|
158
|
-
await syncSenderTaggingIndexes(secret, this.contractAddress, this.aztecNode, this.senderTaggingStore, this.jobId);
|
|
159
|
+
await syncSenderTaggingIndexes(secret, this.contractAddress, this.aztecNode, this.senderTaggingStore, await this.anchorBlockHeader.hash(), this.jobId);
|
|
159
160
|
const lastUsedIndex = await this.senderTaggingStore.getLastUsedIndex(secret, this.jobId);
|
|
160
161
|
// If lastUsedIndex is undefined, we've never used this secret, so start from 0
|
|
161
162
|
// Otherwise, the next index to use is one past the last used index
|
|
@@ -214,7 +215,7 @@ import { UtilityExecutionOracle } from './utility_execution_oracle.js';
|
|
|
214
215
|
// Nullified pending notes are already removed from the list.
|
|
215
216
|
const pendingNotes = this.noteCache.getNotes(this.callContext.contractAddress, owner, storageSlot);
|
|
216
217
|
const pendingNullifiers = this.noteCache.getNullifiers(this.callContext.contractAddress);
|
|
217
|
-
const noteService = new NoteService(this.noteStore, this.aztecNode, this.
|
|
218
|
+
const noteService = new NoteService(this.noteStore, this.aztecNode, this.anchorBlockHeader, this.jobId);
|
|
218
219
|
const dbNotes = await noteService.getNotes(this.callContext.contractAddress, owner, storageSlot, status, this.scopes);
|
|
219
220
|
const dbNotesFiltered = dbNotes.filter((n)=>!pendingNullifiers.has(n.siloedNullifier.value));
|
|
220
221
|
const notes = pickNotes([
|
|
@@ -304,6 +305,17 @@ import { UtilityExecutionOracle } from './utility_execution_oracle.js';
|
|
|
304
305
|
return this.noteCache.nullifierCreated(this.callContext.contractAddress, innerNullifier);
|
|
305
306
|
}
|
|
306
307
|
/**
|
|
308
|
+
* Check if a nullifier has been emitted in the same transaction, i.e. if privateNotifyCreatedNullifier has been
|
|
309
|
+
* called for this inner nullifier from the contract with the specified address.
|
|
310
|
+
* @param innerNullifier - The inner nullifier to check.
|
|
311
|
+
* @param contractAddress - Address of the contract that emitted the nullifier.
|
|
312
|
+
* @returns A boolean indicating whether the nullifier is pending or not.
|
|
313
|
+
*/ async privateIsNullifierPending(innerNullifier, contractAddress) {
|
|
314
|
+
const siloedNullifier = await siloNullifier(contractAddress, innerNullifier);
|
|
315
|
+
const isNullifierPending = this.noteCache.getNullifiers(contractAddress).has(siloedNullifier.toBigInt());
|
|
316
|
+
return Promise.resolve(isNullifierPending);
|
|
317
|
+
}
|
|
318
|
+
/**
|
|
307
319
|
* Emit a contract class log.
|
|
308
320
|
* This fn exists because we only carry a poseidon hash through the kernels, and need to
|
|
309
321
|
* keep the preimage in ts for later.
|
|
@@ -336,12 +348,11 @@ import { UtilityExecutionOracle } from './utility_execution_oracle.js';
|
|
|
336
348
|
const simulatorSetupTimer = new Timer();
|
|
337
349
|
this.log.debug(`Calling private function ${targetContractAddress}:${functionSelector} from ${this.callContext.contractAddress}`);
|
|
338
350
|
isStaticCall = isStaticCall || this.callContext.isStaticCall;
|
|
339
|
-
await
|
|
340
|
-
await this.contractStore.syncPrivateState(targetContractAddress, functionSelector, this.utilityExecutor);
|
|
351
|
+
await this.contractSyncService.ensureContractSynced(targetContractAddress, functionSelector, this.utilityExecutor, this.anchorBlockHeader, this.jobId);
|
|
341
352
|
const targetArtifact = await this.contractStore.getFunctionArtifactWithDebugMetadata(targetContractAddress, functionSelector);
|
|
342
353
|
const derivedTxContext = this.txContext.clone();
|
|
343
354
|
const derivedCallContext = await this.deriveCallContext(targetContractAddress, targetArtifact, isStaticCall);
|
|
344
|
-
const privateExecutionOracle = new PrivateExecutionOracle(argsHash, derivedTxContext, derivedCallContext, this.anchorBlockHeader, this.utilityExecutor, this.authWitnesses, this.capsules, this.executionCache, this.noteCache, this.taggingIndexCache, this.contractStore, this.noteStore, this.keyStore, this.addressStore, this.aztecNode, this.
|
|
355
|
+
const privateExecutionOracle = new PrivateExecutionOracle(argsHash, derivedTxContext, derivedCallContext, this.anchorBlockHeader, this.utilityExecutor, this.authWitnesses, this.capsules, this.executionCache, this.noteCache, this.taggingIndexCache, this.contractStore, this.noteStore, this.keyStore, this.addressStore, this.aztecNode, this.senderTaggingStore, this.recipientTaggingStore, this.senderAddressBookStore, this.capsuleStore, this.privateEventStore, this.contractSyncService, this.jobId, this.totalPublicCalldataCount, sideEffectCounter, this.log, this.scopes, this.senderForTags, this.simulator);
|
|
345
356
|
const setupTime = simulatorSetupTimer.ms();
|
|
346
357
|
const childExecutionResult = await executePrivateFunction(this.simulator, privateExecutionOracle, targetArtifact, targetContractAddress, functionSelector);
|
|
347
358
|
if (isStaticCall) {
|
|
@@ -1,18 +1,20 @@
|
|
|
1
|
+
import type { ARCHIVE_HEIGHT, NOTE_HASH_TREE_HEIGHT } from '@aztec/constants';
|
|
1
2
|
import type { BlockNumber } from '@aztec/foundation/branded-types';
|
|
2
3
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
4
|
import { Point } from '@aztec/foundation/curves/grumpkin';
|
|
5
|
+
import { type Logger } from '@aztec/foundation/log';
|
|
6
|
+
import type { MembershipWitness } from '@aztec/foundation/trees';
|
|
4
7
|
import type { KeyStore } from '@aztec/key-store';
|
|
5
8
|
import type { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
6
9
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
7
|
-
import {
|
|
10
|
+
import { BlockHash } from '@aztec/stdlib/block';
|
|
8
11
|
import type { CompleteAddress, ContractInstance } from '@aztec/stdlib/contract';
|
|
9
12
|
import type { AztecNode } from '@aztec/stdlib/interfaces/server';
|
|
10
13
|
import type { KeyValidationRequest } from '@aztec/stdlib/kernel';
|
|
11
14
|
import type { NoteStatus } from '@aztec/stdlib/note';
|
|
12
|
-
import {
|
|
15
|
+
import { type NullifierMembershipWitness, PublicDataWitness } from '@aztec/stdlib/trees';
|
|
13
16
|
import type { BlockHeader, Capsule } from '@aztec/stdlib/tx';
|
|
14
17
|
import type { AddressStore } from '../../storage/address_store/address_store.js';
|
|
15
|
-
import type { AnchorBlockStore } from '../../storage/anchor_block_store/anchor_block_store.js';
|
|
16
18
|
import type { CapsuleStore } from '../../storage/capsule_store/capsule_store.js';
|
|
17
19
|
import type { ContractStore } from '../../storage/contract_store/contract_store.js';
|
|
18
20
|
import type { NoteStore } from '../../storage/note_store/note_store.js';
|
|
@@ -26,6 +28,7 @@ import { MessageLoadOracleInputs } from './message_load_oracle_inputs.js';
|
|
|
26
28
|
* The oracle for an execution of utility contract functions.
|
|
27
29
|
*/
|
|
28
30
|
export declare class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOracle {
|
|
31
|
+
#private;
|
|
29
32
|
protected readonly contractAddress: AztecAddress;
|
|
30
33
|
/** List of transient auth witnesses to be used during this simulation */
|
|
31
34
|
protected readonly authWitnesses: AuthWitness[];
|
|
@@ -36,20 +39,19 @@ export declare class UtilityExecutionOracle implements IMiscOracle, IUtilityExec
|
|
|
36
39
|
protected readonly keyStore: KeyStore;
|
|
37
40
|
protected readonly addressStore: AddressStore;
|
|
38
41
|
protected readonly aztecNode: AztecNode;
|
|
39
|
-
protected readonly anchorBlockStore: AnchorBlockStore;
|
|
40
42
|
protected readonly recipientTaggingStore: RecipientTaggingStore;
|
|
41
43
|
protected readonly senderAddressBookStore: SenderAddressBookStore;
|
|
42
44
|
protected readonly capsuleStore: CapsuleStore;
|
|
43
45
|
protected readonly privateEventStore: PrivateEventStore;
|
|
44
46
|
protected readonly jobId: string;
|
|
45
|
-
protected log:
|
|
47
|
+
protected log: Logger;
|
|
46
48
|
protected readonly scopes?: AztecAddress[] | undefined;
|
|
47
49
|
isMisc: true;
|
|
48
50
|
isUtility: true;
|
|
49
|
-
private
|
|
51
|
+
private contractLogger;
|
|
50
52
|
constructor(contractAddress: AztecAddress,
|
|
51
53
|
/** List of transient auth witnesses to be used during this simulation */
|
|
52
|
-
authWitnesses: AuthWitness[], capsules: Capsule[], anchorBlockHeader: BlockHeader, contractStore: ContractStore, noteStore: NoteStore, keyStore: KeyStore, addressStore: AddressStore, aztecNode: AztecNode,
|
|
54
|
+
authWitnesses: AuthWitness[], capsules: Capsule[], anchorBlockHeader: BlockHeader, contractStore: ContractStore, noteStore: NoteStore, keyStore: KeyStore, addressStore: AddressStore, aztecNode: AztecNode, recipientTaggingStore: RecipientTaggingStore, senderAddressBookStore: SenderAddressBookStore, capsuleStore: CapsuleStore, privateEventStore: PrivateEventStore, jobId: string, log?: Logger, scopes?: AztecAddress[] | undefined);
|
|
53
55
|
utilityAssertCompatibleOracleVersion(version: number): void;
|
|
54
56
|
utilityGetRandomField(): Fr;
|
|
55
57
|
utilityGetUtilityContext(): UtilityContext;
|
|
@@ -58,23 +60,36 @@ export declare class UtilityExecutionOracle implements IMiscOracle, IUtilityExec
|
|
|
58
60
|
* @param pkMHash - The master public key hash.
|
|
59
61
|
* @returns A Promise that resolves to nullifier keys.
|
|
60
62
|
* @throws If the keys are not registered in the key store.
|
|
63
|
+
* @throws If scopes are defined and the account is not in the scopes.
|
|
61
64
|
*/
|
|
62
65
|
utilityGetKeyValidationRequest(pkMHash: Fr): Promise<KeyValidationRequest>;
|
|
63
66
|
/**
|
|
64
|
-
* Fetches the index and sibling path of a leaf at a given block from
|
|
65
|
-
* @param
|
|
66
|
-
*
|
|
67
|
-
* @param
|
|
68
|
-
* @returns The index and sibling path
|
|
67
|
+
* Fetches the index and sibling path of a leaf at a given block from the note hash tree.
|
|
68
|
+
* @param anchorBlockHash - The hash of a block that contains the note hash tree root in which to find the membership
|
|
69
|
+
* witness.
|
|
70
|
+
* @param noteHash - The note hash to find in the note hash tree.
|
|
71
|
+
* @returns The membership witness containing the leaf index and sibling path
|
|
69
72
|
*/
|
|
70
|
-
|
|
73
|
+
utilityGetNoteHashMembershipWitness(anchorBlockHash: BlockHash, noteHash: Fr): Promise<MembershipWitness<typeof NOTE_HASH_TREE_HEIGHT> | undefined>;
|
|
74
|
+
/**
|
|
75
|
+
* Fetches the index and sibling path of a block hash in the archive tree.
|
|
76
|
+
*
|
|
77
|
+
* Block hashes are the leaves of the archive tree. Each time a new block is added to the chain,
|
|
78
|
+
* its block hash is appended as a new leaf to the archive tree.
|
|
79
|
+
*
|
|
80
|
+
* @param anchorBlockHash - The hash of a block that contains the archive tree root in which to find the membership
|
|
81
|
+
* witness.
|
|
82
|
+
* @param blockHash - The block hash to find in the archive tree.
|
|
83
|
+
* @returns The membership witness containing the leaf index and sibling path
|
|
84
|
+
*/
|
|
85
|
+
utilityGetBlockHashMembershipWitness(anchorBlockHash: BlockHash, blockHash: BlockHash): Promise<MembershipWitness<typeof ARCHIVE_HEIGHT> | undefined>;
|
|
71
86
|
/**
|
|
72
87
|
* Returns a nullifier membership witness for a given nullifier at a given block.
|
|
73
88
|
* @param blockHash - The block hash at which to get the index.
|
|
74
89
|
* @param nullifier - Nullifier we try to find witness for.
|
|
75
90
|
* @returns The nullifier membership witness (if found).
|
|
76
91
|
*/
|
|
77
|
-
utilityGetNullifierMembershipWitness(blockHash:
|
|
92
|
+
utilityGetNullifierMembershipWitness(blockHash: BlockHash, nullifier: Fr): Promise<NullifierMembershipWitness | undefined>;
|
|
78
93
|
/**
|
|
79
94
|
* Returns a low nullifier membership witness for a given nullifier at a given block.
|
|
80
95
|
* @param blockHash - The block hash at which to get the index.
|
|
@@ -84,14 +99,14 @@ export declare class UtilityExecutionOracle implements IMiscOracle, IUtilityExec
|
|
|
84
99
|
* list structure" of leaves and proving that a lower nullifier is pointing to a bigger next value than the nullifier
|
|
85
100
|
* we are trying to prove non-inclusion for.
|
|
86
101
|
*/
|
|
87
|
-
utilityGetLowNullifierMembershipWitness(blockHash:
|
|
102
|
+
utilityGetLowNullifierMembershipWitness(blockHash: BlockHash, nullifier: Fr): Promise<NullifierMembershipWitness | undefined>;
|
|
88
103
|
/**
|
|
89
104
|
* Returns a public data tree witness for a given leaf slot at a given block.
|
|
90
105
|
* @param blockHash - The block hash at which to get the index.
|
|
91
106
|
* @param leafSlot - The slot of the public data tree to get the witness for.
|
|
92
107
|
* @returns - The witness
|
|
93
108
|
*/
|
|
94
|
-
utilityGetPublicDataWitness(blockHash:
|
|
109
|
+
utilityGetPublicDataWitness(blockHash: BlockHash, leafSlot: Fr): Promise<PublicDataWitness | undefined>;
|
|
95
110
|
/**
|
|
96
111
|
* Fetches a block header of a given block.
|
|
97
112
|
* @param blockNumber - The number of a block of which to get the block header.
|
|
@@ -101,11 +116,10 @@ export declare class UtilityExecutionOracle implements IMiscOracle, IUtilityExec
|
|
|
101
116
|
/**
|
|
102
117
|
* Retrieve the complete address associated to a given address.
|
|
103
118
|
* @param account - The account address.
|
|
104
|
-
* @returns A complete address associated with the input address.
|
|
105
|
-
* @throws An error if the account is not registered in the database.
|
|
119
|
+
* @returns A complete address associated with the input address, or `undefined` if not registered.
|
|
106
120
|
*/
|
|
107
|
-
|
|
108
|
-
protected
|
|
121
|
+
utilityTryGetPublicKeysAndPartialAddress(account: AztecAddress): Promise<CompleteAddress | undefined>;
|
|
122
|
+
protected getCompleteAddressOrFail(account: AztecAddress): Promise<CompleteAddress>;
|
|
109
123
|
/**
|
|
110
124
|
* Returns a contract instance associated with an address or throws if not found.
|
|
111
125
|
* @param address - Address.
|
|
@@ -165,8 +179,8 @@ export declare class UtilityExecutionOracle implements IMiscOracle, IUtilityExec
|
|
|
165
179
|
* @param startStorageSlot - The starting storage slot.
|
|
166
180
|
* @param numberOfElements - Number of elements to read from the starting storage slot.
|
|
167
181
|
*/
|
|
168
|
-
utilityStorageRead(blockHash:
|
|
169
|
-
utilityDebugLog(level: number, message: string, fields: Fr[]): void
|
|
182
|
+
utilityStorageRead(blockHash: BlockHash, contractAddress: AztecAddress, startStorageSlot: Fr, numberOfElements: number): Promise<Fr[]>;
|
|
183
|
+
utilityDebugLog(level: number, message: string, fields: Fr[]): Promise<void>;
|
|
170
184
|
utilityFetchTaggedLogs(pendingTaggedLogArrayBaseSlot: Fr): Promise<void>;
|
|
171
185
|
/**
|
|
172
186
|
* Validates all note and event validation requests enqueued via `enqueue_note_for_validation` and
|
|
@@ -178,7 +192,7 @@ export declare class UtilityExecutionOracle implements IMiscOracle, IUtilityExec
|
|
|
178
192
|
* @param noteValidationRequestsArrayBaseSlot - The base slot of capsule array containing note validation requests.
|
|
179
193
|
* @param eventValidationRequestsArrayBaseSlot - The base slot of capsule array containing event validation requests.
|
|
180
194
|
*/
|
|
181
|
-
|
|
195
|
+
utilityValidateAndStoreEnqueuedNotesAndEvents(contractAddress: AztecAddress, noteValidationRequestsArrayBaseSlot: Fr, eventValidationRequestsArrayBaseSlot: Fr): Promise<void>;
|
|
182
196
|
utilityBulkRetrieveLogs(contractAddress: AztecAddress, logRetrievalRequestsArrayBaseSlot: Fr, logRetrievalResponsesArrayBaseSlot: Fr): Promise<void>;
|
|
183
197
|
utilityStoreCapsule(contractAddress: AztecAddress, slot: Fr, capsule: Fr[]): Promise<void>;
|
|
184
198
|
utilityLoadCapsule(contractAddress: AztecAddress, slot: Fr): Promise<Fr[] | null>;
|
|
@@ -194,4 +208,4 @@ export declare class UtilityExecutionOracle implements IMiscOracle, IUtilityExec
|
|
|
194
208
|
utilityGetSharedSecret(address: AztecAddress, ephPk: Point): Promise<Point>;
|
|
195
209
|
protected getSharedSecret(address: AztecAddress, ephPk: Point): Promise<Point>;
|
|
196
210
|
}
|
|
197
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
211
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXRpbGl0eV9leGVjdXRpb25fb3JhY2xlLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvY29udHJhY3RfZnVuY3Rpb25fc2ltdWxhdG9yL29yYWNsZS91dGlsaXR5X2V4ZWN1dGlvbl9vcmFjbGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLEVBQUUsY0FBYyxFQUFFLHFCQUFxQixFQUFFLE1BQU0sa0JBQWtCLENBQUM7QUFDOUUsT0FBTyxLQUFLLEVBQUUsV0FBVyxFQUFFLE1BQU0saUNBQWlDLENBQUM7QUFFbkUsT0FBTyxFQUFFLEVBQUUsRUFBRSxNQUFNLGdDQUFnQyxDQUFDO0FBQ3BELE9BQU8sRUFBRSxLQUFLLEVBQUUsTUFBTSxtQ0FBbUMsQ0FBQztBQUMxRCxPQUFPLEVBQWEsS0FBSyxNQUFNLEVBQXVDLE1BQU0sdUJBQXVCLENBQUM7QUFDcEcsT0FBTyxLQUFLLEVBQUUsaUJBQWlCLEVBQUUsTUFBTSx5QkFBeUIsQ0FBQztBQUNqRSxPQUFPLEtBQUssRUFBRSxRQUFRLEVBQUUsTUFBTSxrQkFBa0IsQ0FBQztBQUNqRCxPQUFPLEtBQUssRUFBRSxXQUFXLEVBQUUsTUFBTSw0QkFBNEIsQ0FBQztBQUM5RCxPQUFPLEVBQUUsWUFBWSxFQUFFLE1BQU0sNkJBQTZCLENBQUM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DQU9sRjtJQUVNLGtCQUFrQixDQUN2QixlQUFlLEVBQUUsWUFBWSxFQUM3QixPQUFPLEVBQUUsRUFBRSxFQUNYLE9BQU8sRUFBRSxFQUFFLEVBQ1gsVUFBVSxFQUFFLE1BQU0sR0FDakIsT0FBTyxDQUFDLElBQUksQ0FBQyxDQU1mO0lBR00sb0JBQW9CLENBQUMsVUFBVSxFQUFFLE1BQU0sRUFBRSxFQUFFLEVBQUUsTUFBTSxFQUFFLE1BQU0sRUFBRSxNQUFNLEdBQUcsT0FBTyxDQUFDLE1BQU0sQ0FBQyxDQUczRjtJQUVEOzs7OztPQUtHO0lBQ0ksc0JBQXNCLENBQUMsT0FBTyxFQUFFLFlBQVksRUFBRSxLQUFLLEVBQUUsS0FBSyxHQUFHLE9BQU8sQ0FBQyxLQUFLLENBQUMsQ0FFakY7SUFFRCxVQUFnQixlQUFlLENBQUMsT0FBTyxFQUFFLFlBQVksRUFBRSxLQUFLLEVBQUUsS0FBSyxHQUFHLE9BQU8sQ0FBQyxLQUFLLENBQUMsQ0FRbkY7Q0FDRiJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utility_execution_oracle.d.ts","sourceRoot":"","sources":["../../../src/contract_function_simulator/oracle/utility_execution_oracle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAEnE,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,MAAM,mCAAmC,CAAC;
|
|
1
|
+
{"version":3,"file":"utility_execution_oracle.d.ts","sourceRoot":"","sources":["../../../src/contract_function_simulator/oracle/utility_execution_oracle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAC9E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAEnE,OAAO,EAAE,EAAE,EAAE,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sB,CAAC,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,CAEjF;IAED,UAAgB,eAAe,CAAC,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,CAQnF;CACF"}
|
|
@@ -4,11 +4,12 @@ import { LogLevels, applyStringFormatting, createLogger } from '@aztec/foundatio
|
|
|
4
4
|
import { siloNullifier } from '@aztec/stdlib/hash';
|
|
5
5
|
import { computeAddressSecret } from '@aztec/stdlib/keys';
|
|
6
6
|
import { deriveEcdhSharedSecret } from '@aztec/stdlib/logs';
|
|
7
|
+
import { getNonNullifiedL1ToL2MessageWitness } from '@aztec/stdlib/messaging';
|
|
8
|
+
import { MerkleTreeId } from '@aztec/stdlib/trees';
|
|
7
9
|
import { EventService } from '../../events/event_service.js';
|
|
8
10
|
import { LogService } from '../../logs/log_service.js';
|
|
9
11
|
import { NoteService } from '../../notes/note_service.js';
|
|
10
12
|
import { ORACLE_VERSION } from '../../oracle_version.js';
|
|
11
|
-
import { TreeMembershipService } from '../../tree_membership/tree_membership_service.js';
|
|
12
13
|
import { EventValidationRequest } from '../noir-structs/event_validation_request.js';
|
|
13
14
|
import { LogRetrievalRequest } from '../noir-structs/log_retrieval_request.js';
|
|
14
15
|
import { LogRetrievalResponse } from '../noir-structs/log_retrieval_response.js';
|
|
@@ -28,7 +29,6 @@ import { MessageLoadOracleInputs } from './message_load_oracle_inputs.js';
|
|
|
28
29
|
keyStore;
|
|
29
30
|
addressStore;
|
|
30
31
|
aztecNode;
|
|
31
|
-
anchorBlockStore;
|
|
32
32
|
recipientTaggingStore;
|
|
33
33
|
senderAddressBookStore;
|
|
34
34
|
capsuleStore;
|
|
@@ -38,8 +38,8 @@ import { MessageLoadOracleInputs } from './message_load_oracle_inputs.js';
|
|
|
38
38
|
scopes;
|
|
39
39
|
isMisc;
|
|
40
40
|
isUtility;
|
|
41
|
-
|
|
42
|
-
constructor(contractAddress, /** List of transient auth witnesses to be used during this simulation */ authWitnesses, capsules, anchorBlockHeader, contractStore, noteStore, keyStore, addressStore, aztecNode,
|
|
41
|
+
contractLogger;
|
|
42
|
+
constructor(contractAddress, /** List of transient auth witnesses to be used during this simulation */ authWitnesses, capsules, anchorBlockHeader, contractStore, noteStore, keyStore, addressStore, aztecNode, recipientTaggingStore, senderAddressBookStore, capsuleStore, privateEventStore, jobId, log = createLogger('simulator:client_view_context'), scopes){
|
|
43
43
|
this.contractAddress = contractAddress;
|
|
44
44
|
this.authWitnesses = authWitnesses;
|
|
45
45
|
this.capsules = capsules;
|
|
@@ -49,7 +49,6 @@ import { MessageLoadOracleInputs } from './message_load_oracle_inputs.js';
|
|
|
49
49
|
this.keyStore = keyStore;
|
|
50
50
|
this.addressStore = addressStore;
|
|
51
51
|
this.aztecNode = aztecNode;
|
|
52
|
-
this.anchorBlockStore = anchorBlockStore;
|
|
53
52
|
this.recipientTaggingStore = recipientTaggingStore;
|
|
54
53
|
this.senderAddressBookStore = senderAddressBookStore;
|
|
55
54
|
this.capsuleStore = capsuleStore;
|
|
@@ -59,7 +58,6 @@ import { MessageLoadOracleInputs } from './message_load_oracle_inputs.js';
|
|
|
59
58
|
this.scopes = scopes;
|
|
60
59
|
this.isMisc = true;
|
|
61
60
|
this.isUtility = true;
|
|
62
|
-
this.aztecNrDebugLog = createLogger('aztec-nr:debug_log');
|
|
63
61
|
}
|
|
64
62
|
utilityAssertCompatibleOracleVersion(version) {
|
|
65
63
|
if (version !== ORACLE_VERSION) {
|
|
@@ -77,26 +75,46 @@ import { MessageLoadOracleInputs } from './message_load_oracle_inputs.js';
|
|
|
77
75
|
* @param pkMHash - The master public key hash.
|
|
78
76
|
* @returns A Promise that resolves to nullifier keys.
|
|
79
77
|
* @throws If the keys are not registered in the key store.
|
|
80
|
-
|
|
78
|
+
* @throws If scopes are defined and the account is not in the scopes.
|
|
79
|
+
*/ async utilityGetKeyValidationRequest(pkMHash) {
|
|
80
|
+
// If scopes are defined, check that the key belongs to an account in the scopes
|
|
81
|
+
if (this.scopes && this.scopes.length > 0) {
|
|
82
|
+
const [, account] = await this.keyStore.getKeyPrefixAndAccount(pkMHash);
|
|
83
|
+
if (!this.scopes.some((scope)=>scope.equals(account))) {
|
|
84
|
+
throw new Error(`Key validation request denied: account ${account.toString()} is not in the allowed scopes.`);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
81
87
|
return this.keyStore.getKeyValidationRequest(pkMHash, this.contractAddress);
|
|
82
88
|
}
|
|
83
89
|
/**
|
|
84
|
-
* Fetches the index and sibling path of a leaf at a given block from
|
|
85
|
-
* @param
|
|
86
|
-
*
|
|
87
|
-
* @param
|
|
88
|
-
* @returns The index and sibling path
|
|
89
|
-
*/
|
|
90
|
-
|
|
91
|
-
|
|
90
|
+
* Fetches the index and sibling path of a leaf at a given block from the note hash tree.
|
|
91
|
+
* @param anchorBlockHash - The hash of a block that contains the note hash tree root in which to find the membership
|
|
92
|
+
* witness.
|
|
93
|
+
* @param noteHash - The note hash to find in the note hash tree.
|
|
94
|
+
* @returns The membership witness containing the leaf index and sibling path
|
|
95
|
+
*/ utilityGetNoteHashMembershipWitness(anchorBlockHash, noteHash) {
|
|
96
|
+
return this.aztecNode.getNoteHashMembershipWitness(anchorBlockHash, noteHash);
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Fetches the index and sibling path of a block hash in the archive tree.
|
|
100
|
+
*
|
|
101
|
+
* Block hashes are the leaves of the archive tree. Each time a new block is added to the chain,
|
|
102
|
+
* its block hash is appended as a new leaf to the archive tree.
|
|
103
|
+
*
|
|
104
|
+
* @param anchorBlockHash - The hash of a block that contains the archive tree root in which to find the membership
|
|
105
|
+
* witness.
|
|
106
|
+
* @param blockHash - The block hash to find in the archive tree.
|
|
107
|
+
* @returns The membership witness containing the leaf index and sibling path
|
|
108
|
+
*/ utilityGetBlockHashMembershipWitness(anchorBlockHash, blockHash) {
|
|
109
|
+
return this.aztecNode.getBlockHashMembershipWitness(anchorBlockHash, blockHash);
|
|
92
110
|
}
|
|
93
111
|
/**
|
|
94
112
|
* Returns a nullifier membership witness for a given nullifier at a given block.
|
|
95
113
|
* @param blockHash - The block hash at which to get the index.
|
|
96
114
|
* @param nullifier - Nullifier we try to find witness for.
|
|
97
115
|
* @returns The nullifier membership witness (if found).
|
|
98
|
-
*/
|
|
99
|
-
return
|
|
116
|
+
*/ utilityGetNullifierMembershipWitness(blockHash, nullifier) {
|
|
117
|
+
return this.aztecNode.getNullifierMembershipWitness(blockHash, nullifier);
|
|
100
118
|
}
|
|
101
119
|
/**
|
|
102
120
|
* Returns a low nullifier membership witness for a given nullifier at a given block.
|
|
@@ -106,25 +124,23 @@ import { MessageLoadOracleInputs } from './message_load_oracle_inputs.js';
|
|
|
106
124
|
* @remarks Low nullifier witness can be used to perform a nullifier non-inclusion proof by leveraging the "linked
|
|
107
125
|
* list structure" of leaves and proving that a lower nullifier is pointing to a bigger next value than the nullifier
|
|
108
126
|
* we are trying to prove non-inclusion for.
|
|
109
|
-
*/
|
|
110
|
-
|
|
111
|
-
return await treeMembershipService.getLowNullifierMembershipWitness(blockHash, nullifier);
|
|
127
|
+
*/ utilityGetLowNullifierMembershipWitness(blockHash, nullifier) {
|
|
128
|
+
return this.aztecNode.getLowNullifierMembershipWitness(blockHash, nullifier);
|
|
112
129
|
}
|
|
113
130
|
/**
|
|
114
131
|
* Returns a public data tree witness for a given leaf slot at a given block.
|
|
115
132
|
* @param blockHash - The block hash at which to get the index.
|
|
116
133
|
* @param leafSlot - The slot of the public data tree to get the witness for.
|
|
117
134
|
* @returns - The witness
|
|
118
|
-
*/
|
|
119
|
-
|
|
120
|
-
return await treeMembershipService.getPublicDataWitness(blockHash, leafSlot);
|
|
135
|
+
*/ utilityGetPublicDataWitness(blockHash, leafSlot) {
|
|
136
|
+
return this.aztecNode.getPublicDataWitness(blockHash, leafSlot);
|
|
121
137
|
}
|
|
122
138
|
/**
|
|
123
139
|
* Fetches a block header of a given block.
|
|
124
140
|
* @param blockNumber - The number of a block of which to get the block header.
|
|
125
141
|
* @returns Block extracted from a block with block number `blockNumber`.
|
|
126
142
|
*/ async utilityGetBlockHeader(blockNumber) {
|
|
127
|
-
const anchorBlockNumber =
|
|
143
|
+
const anchorBlockNumber = this.anchorBlockHeader.getBlockNumber();
|
|
128
144
|
if (blockNumber > anchorBlockNumber) {
|
|
129
145
|
throw new Error(`Block number ${blockNumber} is higher than current block ${anchorBlockNumber}`);
|
|
130
146
|
}
|
|
@@ -134,12 +150,11 @@ import { MessageLoadOracleInputs } from './message_load_oracle_inputs.js';
|
|
|
134
150
|
/**
|
|
135
151
|
* Retrieve the complete address associated to a given address.
|
|
136
152
|
* @param account - The account address.
|
|
137
|
-
* @returns A complete address associated with the input address.
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
return this.getCompleteAddress(account);
|
|
153
|
+
* @returns A complete address associated with the input address, or `undefined` if not registered.
|
|
154
|
+
*/ utilityTryGetPublicKeysAndPartialAddress(account) {
|
|
155
|
+
return this.addressStore.getCompleteAddress(account);
|
|
141
156
|
}
|
|
142
|
-
async
|
|
157
|
+
async getCompleteAddressOrFail(account) {
|
|
143
158
|
const completeAddress = await this.addressStore.getCompleteAddress(account);
|
|
144
159
|
if (!completeAddress) {
|
|
145
160
|
throw new Error(`No public key registered for address ${account}.
|
|
@@ -191,7 +206,7 @@ import { MessageLoadOracleInputs } from './message_load_oracle_inputs.js';
|
|
|
191
206
|
* @param status - The status of notes to fetch.
|
|
192
207
|
* @returns Array of note data.
|
|
193
208
|
*/ async utilityGetNotes(owner, storageSlot, numSelects, selectByIndexes, selectByOffsets, selectByLengths, selectValues, selectComparators, sortByIndexes, sortByOffsets, sortByLengths, sortOrder, limit, offset, status) {
|
|
194
|
-
const noteService = new NoteService(this.noteStore, this.aztecNode, this.
|
|
209
|
+
const noteService = new NoteService(this.noteStore, this.aztecNode, this.anchorBlockHeader, this.jobId);
|
|
195
210
|
const dbNotes = await noteService.getNotes(this.contractAddress, owner, storageSlot, status, this.scopes);
|
|
196
211
|
return pickNotes(dbNotes, {
|
|
197
212
|
selects: selectByIndexes.slice(0, numSelects).map((index, i)=>({
|
|
@@ -220,10 +235,14 @@ import { MessageLoadOracleInputs } from './message_load_oracle_inputs.js';
|
|
|
220
235
|
* @param innerNullifier - The inner nullifier.
|
|
221
236
|
* @returns A boolean indicating whether the nullifier exists in the tree or not.
|
|
222
237
|
*/ async utilityCheckNullifierExists(innerNullifier) {
|
|
223
|
-
const nullifier = await
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
238
|
+
const [nullifier, anchorBlockHash] = await Promise.all([
|
|
239
|
+
siloNullifier(this.contractAddress, innerNullifier),
|
|
240
|
+
this.anchorBlockHeader.hash()
|
|
241
|
+
]);
|
|
242
|
+
const [leafIndex] = await this.aztecNode.findLeavesIndexes(anchorBlockHash, MerkleTreeId.NULLIFIER_TREE, [
|
|
243
|
+
nullifier
|
|
244
|
+
]);
|
|
245
|
+
return leafIndex?.data !== undefined;
|
|
227
246
|
}
|
|
228
247
|
/**
|
|
229
248
|
* Fetches a message from the executionStore, given its key.
|
|
@@ -233,9 +252,7 @@ import { MessageLoadOracleInputs } from './message_load_oracle_inputs.js';
|
|
|
233
252
|
* @dev Contract address and secret are only used to compute the nullifier to get non-nullified messages
|
|
234
253
|
* @returns The l1 to l2 membership witness (index of message in the tree and sibling path).
|
|
235
254
|
*/ async utilityGetL1ToL2MembershipWitness(contractAddress, messageHash, secret) {
|
|
236
|
-
const
|
|
237
|
-
const [messageIndex, siblingPath] = await treeMembershipService.getL1ToL2MembershipWitness(contractAddress, messageHash, secret);
|
|
238
|
-
// Assuming messageIndex is what you intended to use for the index in MessageLoadOracleInputs
|
|
255
|
+
const [messageIndex, siblingPath] = await getNonNullifiedL1ToL2MessageWitness(this.aztecNode, contractAddress, messageHash, secret);
|
|
239
256
|
return new MessageLoadOracleInputs(messageIndex, siblingPath);
|
|
240
257
|
}
|
|
241
258
|
/**
|
|
@@ -245,35 +262,37 @@ import { MessageLoadOracleInputs } from './message_load_oracle_inputs.js';
|
|
|
245
262
|
* @param startStorageSlot - The starting storage slot.
|
|
246
263
|
* @param numberOfElements - Number of elements to read from the starting storage slot.
|
|
247
264
|
*/ async utilityStorageRead(blockHash, contractAddress, startStorageSlot, numberOfElements) {
|
|
248
|
-
const
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
for(let i = 0n; i < numberOfElements; i++){
|
|
252
|
-
const storageSlot = new Fr(startStorageSlot.value + i);
|
|
253
|
-
const value = await this.aztecNode.getPublicStorageAt(blockHash, contractAddress, storageSlot);
|
|
254
|
-
this.log.debug(`Oracle storage read: slot=${storageSlot.toString()} address-${contractAddress.toString()} value=${value}`);
|
|
255
|
-
values.push(value);
|
|
256
|
-
}
|
|
265
|
+
const slots = Array(numberOfElements).fill(0).map((_, i)=>new Fr(startStorageSlot.value + BigInt(i)));
|
|
266
|
+
const values = await Promise.all(slots.map((storageSlot)=>this.aztecNode.getPublicStorageAt(blockHash, contractAddress, storageSlot)));
|
|
267
|
+
this.log.debug(`Oracle storage read: slots=[${slots.map((slot)=>slot.toString()).join(', ')}] address=${contractAddress.toString()} values=[${values.join(', ')}]`);
|
|
257
268
|
return values;
|
|
258
269
|
}
|
|
259
|
-
|
|
270
|
+
/**
|
|
271
|
+
* Returns a per-contract logger whose output is prefixed with `contract_log::<name>(<addrAbbrev>)`.
|
|
272
|
+
*/ async #getContractLogger() {
|
|
273
|
+
if (!this.contractLogger) {
|
|
274
|
+
const addrAbbrev = this.contractAddress.toString().slice(0, 10);
|
|
275
|
+
const name = await this.contractStore.getDebugContractName(this.contractAddress);
|
|
276
|
+
const module = name ? `contract_log::${name}(${addrAbbrev})` : `contract_log::${addrAbbrev}`;
|
|
277
|
+
// Purpose of instanceId is to distinguish logs from different instances of the same component. It makes sense
|
|
278
|
+
// to re-use jobId as instanceId here as executions of different PXE jobs are isolated.
|
|
279
|
+
this.contractLogger = createLogger(module, {
|
|
280
|
+
instanceId: this.jobId
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
return this.contractLogger;
|
|
284
|
+
}
|
|
285
|
+
async utilityDebugLog(level, message, fields) {
|
|
260
286
|
if (!LogLevels[level]) {
|
|
261
287
|
throw new Error(`Invalid debug log level: ${level}`);
|
|
262
288
|
}
|
|
263
289
|
const levelName = LogLevels[level];
|
|
264
|
-
this
|
|
290
|
+
const logger = await this.#getContractLogger();
|
|
291
|
+
logger[levelName](`${applyStringFormatting(message, fields)}`);
|
|
265
292
|
}
|
|
266
293
|
async utilityFetchTaggedLogs(pendingTaggedLogArrayBaseSlot) {
|
|
267
|
-
const logService = new LogService(this.aztecNode, this.
|
|
268
|
-
|
|
269
|
-
// It is acceptable to run the following operations in parallel for several reasons:
|
|
270
|
-
// 1. syncTaggedLogs does not write to the note store — it only stores the pending tagged logs in a capsule array,
|
|
271
|
-
// which is then processed in Noir after this handler returns.
|
|
272
|
-
// 2. Even if syncTaggedLogs did write to the note store, it would not cause inconsistent state.
|
|
273
|
-
await Promise.all([
|
|
274
|
-
logService.syncTaggedLogs(this.contractAddress, pendingTaggedLogArrayBaseSlot, this.scopes),
|
|
275
|
-
noteService.syncNoteNullifiers(this.contractAddress)
|
|
276
|
-
]);
|
|
294
|
+
const logService = new LogService(this.aztecNode, this.anchorBlockHeader, this.keyStore, this.capsuleStore, this.recipientTaggingStore, this.senderAddressBookStore, this.addressStore, this.jobId, this.log.getBindings());
|
|
295
|
+
await logService.fetchTaggedLogs(this.contractAddress, pendingTaggedLogArrayBaseSlot, this.scopes);
|
|
277
296
|
}
|
|
278
297
|
/**
|
|
279
298
|
* Validates all note and event validation requests enqueued via `enqueue_note_for_validation` and
|
|
@@ -284,7 +303,7 @@ import { MessageLoadOracleInputs } from './message_load_oracle_inputs.js';
|
|
|
284
303
|
* @param contractAddress - The address of the contract that the logs are tagged for.
|
|
285
304
|
* @param noteValidationRequestsArrayBaseSlot - The base slot of capsule array containing note validation requests.
|
|
286
305
|
* @param eventValidationRequestsArrayBaseSlot - The base slot of capsule array containing event validation requests.
|
|
287
|
-
*/ async
|
|
306
|
+
*/ async utilityValidateAndStoreEnqueuedNotesAndEvents(contractAddress, noteValidationRequestsArrayBaseSlot, eventValidationRequestsArrayBaseSlot) {
|
|
288
307
|
// TODO(#10727): allow other contracts to store notes
|
|
289
308
|
if (!this.contractAddress.equals(contractAddress)) {
|
|
290
309
|
throw new Error(`Got a note validation request from ${contractAddress}, expected ${this.contractAddress}`);
|
|
@@ -293,10 +312,10 @@ import { MessageLoadOracleInputs } from './message_load_oracle_inputs.js';
|
|
|
293
312
|
// faster as we don't need to wait for the network round-trip.
|
|
294
313
|
const noteValidationRequests = (await this.capsuleStore.readCapsuleArray(contractAddress, noteValidationRequestsArrayBaseSlot, this.jobId)).map(NoteValidationRequest.fromFields);
|
|
295
314
|
const eventValidationRequests = (await this.capsuleStore.readCapsuleArray(contractAddress, eventValidationRequestsArrayBaseSlot, this.jobId)).map(EventValidationRequest.fromFields);
|
|
296
|
-
const noteService = new NoteService(this.noteStore, this.aztecNode, this.
|
|
297
|
-
const noteStorePromises = noteValidationRequests.map((request)=>noteService.
|
|
298
|
-
const eventService = new EventService(this.
|
|
299
|
-
const eventStorePromises = eventValidationRequests.map((request)=>eventService.
|
|
315
|
+
const noteService = new NoteService(this.noteStore, this.aztecNode, this.anchorBlockHeader, this.jobId);
|
|
316
|
+
const noteStorePromises = noteValidationRequests.map((request)=>noteService.validateAndStoreNote(request.contractAddress, request.owner, request.storageSlot, request.randomness, request.noteNonce, request.content, request.noteHash, request.nullifier, request.txHash, request.recipient));
|
|
317
|
+
const eventService = new EventService(this.anchorBlockHeader, this.aztecNode, this.privateEventStore, this.jobId);
|
|
318
|
+
const eventStorePromises = eventValidationRequests.map((request)=>eventService.validateAndStoreEvent(request.contractAddress, request.eventTypeId, request.randomness, request.serializedEvent, request.eventCommitment, request.txHash, request.recipient));
|
|
300
319
|
await Promise.all([
|
|
301
320
|
...noteStorePromises,
|
|
302
321
|
...eventStorePromises
|
|
@@ -313,7 +332,7 @@ import { MessageLoadOracleInputs } from './message_load_oracle_inputs.js';
|
|
|
313
332
|
// We read all log retrieval requests and process them all concurrently. This makes the process much faster as we
|
|
314
333
|
// don't need to wait for the network round-trip.
|
|
315
334
|
const logRetrievalRequests = (await this.capsuleStore.readCapsuleArray(contractAddress, logRetrievalRequestsArrayBaseSlot, this.jobId)).map(LogRetrievalRequest.fromFields);
|
|
316
|
-
const logService = new LogService(this.aztecNode, this.
|
|
335
|
+
const logService = new LogService(this.aztecNode, this.anchorBlockHeader, this.keyStore, this.capsuleStore, this.recipientTaggingStore, this.senderAddressBookStore, this.addressStore, this.jobId, this.log.getBindings());
|
|
317
336
|
const maybeLogRetrievalResponses = await logService.bulkRetrieveLogs(logRetrievalRequests);
|
|
318
337
|
// Requests are cleared once we're done.
|
|
319
338
|
await this.capsuleStore.setCapsuleArray(contractAddress, logRetrievalRequestsArrayBaseSlot, [], this.jobId);
|
|
@@ -366,7 +385,7 @@ import { MessageLoadOracleInputs } from './message_load_oracle_inputs.js';
|
|
|
366
385
|
}
|
|
367
386
|
async getSharedSecret(address, ephPk) {
|
|
368
387
|
// TODO(#12656): return an app-siloed secret
|
|
369
|
-
const recipientCompleteAddress = await this.
|
|
388
|
+
const recipientCompleteAddress = await this.getCompleteAddressOrFail(address);
|
|
370
389
|
const ivskM = await this.keyStore.getMasterSecretKey(recipientCompleteAddress.publicKeys.masterIncomingViewingPublicKey);
|
|
371
390
|
const addressSecret = await computeAddressSecret(await recipientCompleteAddress.getPreaddress(), ivskM);
|
|
372
391
|
return deriveEcdhSharedSecret(addressSecret, ephPk);
|