@@ -46,8 +46,8 @@ import {
4646 SiloedTag ,
4747 Tag ,
4848 WINDOW_HALF_SIZE ,
49- getIndexedTaggingSecretsForTheWindow ,
5049 getInitialIndexesMap ,
50+ getPreTagsForTheWindow ,
5151} from '../tagging/index.js' ;
5252import { EventValidationRequest } from './noir-structs/event_validation_request.js' ;
5353import { LogRetrievalRequest } from './noir-structs/log_retrieval_request.js' ;
@@ -289,15 +289,19 @@ export class PXEOracleInterface implements ExecutionDataProvider {
289289 }
290290
291291 /**
292- * Returns the indexed tagging secrets for a given recipient and all the senders in the address book
292+ * Returns the last used tagging indexes along with the directional app tagging secrets for a given recipient and all
293+ * the senders in the address book.
293294 * This method should be exposed as an oracle call to allow aztec.nr to perform the orchestration
294295 * of the syncTaggedLogs and processTaggedLogs methods. However, it is not possible to do so at the moment,
295296 * so we're keeping it private for now.
296297 * @param contractAddress - The contract address to silo the secret for
297298 * @param recipient - The address receiving the notes
298- * @returns A list of indexed tagging secrets. If the corresponding secret was never used, the index is undefined.
299+ * @returns A list of directional app tagging secrets along with the last used tagging indexes. If the corresponding
300+ * secret was never used, the index is undefined.
301+ * TODO(benesjan): The naming here is broken as the function name does not reflect the return type. Fix when associating
302+ * indexes with tx hash.
299303 */
300- async #getLastUsedIndexedTaggingSecretsForSenders (
304+ async #getLastUsedTaggingIndexesForSenders (
301305 contractAddress : AztecAddress ,
302306 recipient : AztecAddress ,
303307 ) : Promise < { secret : DirectionalAppTaggingSecret ; index : number | undefined } [ ] > {
@@ -425,7 +429,7 @@ export class PXEOracleInterface implements ExecutionDataProvider {
425429 const contractName = await this . contractDataProvider . getDebugContractName ( contractAddress ) ;
426430 for ( const recipient of recipients ) {
427431 // Get all the secrets for the recipient and sender pairs (#9365)
428- const indexedSecrets = await this . #getLastUsedIndexedTaggingSecretsForSenders ( contractAddress , recipient ) ;
432+ const indexedSecrets = await this . #getLastUsedTaggingIndexesForSenders ( contractAddress , recipient ) ;
429433
430434 // We fetch logs for a window of indexes in a range:
431435 // <latest_log_index - WINDOW_HALF_SIZE, latest_log_index + WINDOW_HALF_SIZE>.
@@ -459,10 +463,10 @@ export class PXEOracleInterface implements ExecutionDataProvider {
459463 const initialIndexesMap = getInitialIndexesMap ( indexedSecrets ) ;
460464
461465 while ( secretsAndWindows . length > 0 ) {
462- const secretsForTheWholeWindow = getIndexedTaggingSecretsForTheWindow ( secretsAndWindows ) ;
466+ const preTagsForTheWholeWindow = getPreTagsForTheWindow ( secretsAndWindows ) ;
463467 const tagsForTheWholeWindow = await Promise . all (
464- secretsForTheWholeWindow . map ( async indexedSecret => {
465- return SiloedTag . compute ( await Tag . compute ( indexedSecret ) , contractAddress ) ;
468+ preTagsForTheWholeWindow . map ( async preTag => {
469+ return SiloedTag . compute ( await Tag . compute ( preTag ) , contractAddress ) ;
466470 } ) ,
467471 ) ;
468472
@@ -495,25 +499,25 @@ export class PXEOracleInterface implements ExecutionDataProvider {
495499 filteredLogsByBlockNumber ,
496500 ) ;
497501
498- // We retrieve the indexed tagging secret corresponding to the log as I need that to evaluate whether
502+ // We retrieve the pre tag corresponding to the log as I need that to evaluate whether
499503 // a new largest index have been found.
500- const secretCorrespondingToLog = secretsForTheWholeWindow [ logIndex ] ;
501- const initialIndex = initialIndexesMap [ secretCorrespondingToLog . secret . toString ( ) ] ;
504+ const preTagCorrespondingToLog = preTagsForTheWholeWindow [ logIndex ] ;
505+ const initialIndex = initialIndexesMap [ preTagCorrespondingToLog . secret . toString ( ) ] ;
502506
503507 if (
504- secretCorrespondingToLog . index >= initialIndex &&
505- ( newLargestIndexMapForIteration [ secretCorrespondingToLog . secret . toString ( ) ] === undefined ||
506- secretCorrespondingToLog . index >=
507- newLargestIndexMapForIteration [ secretCorrespondingToLog . secret . toString ( ) ] )
508+ preTagCorrespondingToLog . index >= initialIndex &&
509+ ( newLargestIndexMapForIteration [ preTagCorrespondingToLog . secret . toString ( ) ] === undefined ||
510+ preTagCorrespondingToLog . index >=
511+ newLargestIndexMapForIteration [ preTagCorrespondingToLog . secret . toString ( ) ] )
508512 ) {
509513 // We have found a new largest index so we store it for later processing (storing it in the db + fetching
510514 // the difference of the window sets of current and the next iteration)
511- newLargestIndexMapForIteration [ secretCorrespondingToLog . secret . toString ( ) ] =
512- secretCorrespondingToLog . index + 1 ;
515+ newLargestIndexMapForIteration [ preTagCorrespondingToLog . secret . toString ( ) ] =
516+ preTagCorrespondingToLog . index + 1 ;
513517
514518 this . log . debug (
515519 `Incrementing index to ${
516- secretCorrespondingToLog . index + 1
520+ preTagCorrespondingToLog . index + 1
517521 } at contract ${ contractName } (${ contractAddress } )`,
518522 ) ;
519523 }
0 commit comments