Skip to content

Commit d508fb7

Browse files
committed
feat: searching for nullifiers and tags concurrently (#19735)
Closes https://linear.app/aztec-labs/issue/F-159/search-for-nullifiers-and-tags-concurrently Roundtrips before optimization: ``` ║ Configuration: ecdsar1+private_fpc ║ ║ Total Round Trips: 195 ║ ║ Payment Method: private_fpc ║ ║ ║ ║ Per Round Trip: ║ ║ RT 1: [getNodeInfo] ║ ║ ... ║ RT 36: [getL2Tips, getBlockHeader, getL2Tips, getBlockHeader] ║ ║ RT 37: [getPrivateLogsByTags, getPrivateLogsByTags] ║ ║ RT 38: [findLeavesIndexes] ║ ║ ... ``` (RT 36 and 37 correspond solely to `syncTaggedLogs`, RT 38 to `syncNoteNullifiers`) after optimization: ``` ║ Configuration: ecdsar1+private_fpc ║ ║ Total Round Trips: 189 ║ ║ Payment Method: private_fpc ║ ║ ║ ║ Per Round Trip: ║ ║ RT 1: [getNodeInfo] ║ ║ ... ║ RT 36: [findLeavesIndexes, getL2Tips, getBlockHeader, getL2Tips, getBlockHeader] ║ ║ RT 37: [getPrivateLogsByTags, getPrivateLogsByTags] ║ ``` We can see that RT 38 got merged with RT 36 and for the full run we saved 6 round trips 🎉🎉🎉🚀🚀🚀
1 parent 4133a5b commit d508fb7

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

yarn-project/pxe/src/contract_function_simulator/oracle/utility_execution_oracle.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -350,10 +350,16 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
350350
this.jobId,
351351
);
352352

353-
await logService.syncTaggedLogs(this.contractAddress, pendingTaggedLogArrayBaseSlot, this.scopes);
354-
355353
const noteService = new NoteService(this.noteStore, this.aztecNode, this.anchorBlockStore);
356-
await noteService.syncNoteNullifiers(this.contractAddress);
354+
355+
// It is acceptable to run the following operations in parallel for several reasons:
356+
// 1. syncTaggedLogs does not write to the note store — it only stores the pending tagged logs in a capsule array,
357+
// which is then processed in Noir after this handler returns.
358+
// 2. Even if syncTaggedLogs did write to the note store, it would not cause inconsistent state.
359+
await Promise.all([
360+
logService.syncTaggedLogs(this.contractAddress, pendingTaggedLogArrayBaseSlot, this.scopes),
361+
noteService.syncNoteNullifiers(this.contractAddress),
362+
]);
357363
}
358364

359365
/**

0 commit comments

Comments
 (0)