@@ -321,32 +321,35 @@ export class PXEOracleInterface implements ExecutionDataProvider {
321321 // Determine recipients: use scopes if provided, otherwise get all accounts
322322 const recipients = scopes && scopes . length > 0 ? scopes : await this . keyStore . getAccounts ( ) ;
323323
324- // Process each recipient
325- for ( const recipient of recipients ) {
326- // Get all secrets for this recipient (one per sender)
327- const secrets = await this . #getSecretsForSenders( contractAddress , recipient ) ;
328-
329- // Load logs for all sender-recipient pairs in parallel
330- const logArrays = await Promise . all (
331- secrets . map ( secret =>
332- loadPrivateLogsForSenderRecipientPair (
333- secret ,
334- contractAddress ,
335- this . aztecNode ,
336- this . newRecipientTaggingDataProvider ,
337- anchorBlockNumber ,
324+ // For each recipient, fetch secrets, load logs, and store them.
325+ // We run these per-recipient tasks in parallel so that logs are loaded for all recipients concurrently.
326+ await Promise . all (
327+ recipients . map ( async recipient => {
328+ // Get all secrets for this recipient (one per sender)
329+ const secrets = await this . #getSecretsForSenders( contractAddress , recipient ) ;
330+
331+ // Load logs for all sender-recipient pairs in parallel
332+ const logArrays = await Promise . all (
333+ secrets . map ( secret =>
334+ loadPrivateLogsForSenderRecipientPair (
335+ secret ,
336+ contractAddress ,
337+ this . aztecNode ,
338+ this . newRecipientTaggingDataProvider ,
339+ anchorBlockNumber ,
340+ ) ,
338341 ) ,
339- ) ,
340- ) ;
342+ ) ;
341343
342- // Flatten all logs from all secrets
343- const allLogs = logArrays . flat ( ) ;
344+ // Flatten all logs from all secrets
345+ const allLogs = logArrays . flat ( ) ;
344346
345- // Store the logs for this recipient
346- if ( allLogs . length > 0 ) {
347- await this . #storePendingTaggedLogs( contractAddress , pendingTaggedLogArrayBaseSlot , recipient , allLogs ) ;
348- }
349- }
347+ // Store the logs for this recipient
348+ if ( allLogs . length > 0 ) {
349+ await this . #storePendingTaggedLogs( contractAddress , pendingTaggedLogArrayBaseSlot , recipient , allLogs ) ;
350+ }
351+ } ) ,
352+ ) ;
350353 }
351354
352355 async #storePendingTaggedLogs(
0 commit comments