diff --git a/yarn-project/archiver/src/archiver/data_retrieval.ts b/yarn-project/archiver/src/archiver/data_retrieval.ts index 52e5c5181e3..67d391cc336 100644 --- a/yarn-project/archiver/src/archiver/data_retrieval.ts +++ b/yarn-project/archiver/src/archiver/data_retrieval.ts @@ -136,6 +136,9 @@ export async function retrieveNewPendingL1ToL2Messages( searchStartBlock, searchEndBlock, ); + if (newL1ToL2MessageLogs.length === 0) { + break; + } const newL1ToL2Messages = processPendingL1ToL2MessageAddedLogs(newL1ToL2MessageLogs); retrievedNewL1ToL2Messages.push(...newL1ToL2Messages); // handles the case when there are no new messages: @@ -171,6 +174,9 @@ export async function retrieveNewCancelledL1ToL2Messages( searchStartBlock, searchEndBlock, ); + if (newL1ToL2MessageCancelledLogs.length === 0) { + break; + } const newCancelledL1ToL2Messages = processCancelledL1ToL2MessagesLogs(newL1ToL2MessageCancelledLogs); retrievedNewCancelledL1ToL2Messages.push(...newCancelledL1ToL2Messages); // handles the case when there are no new messages: diff --git a/yarn-project/end-to-end/src/integration_archiver_l1_to_l2.test.ts b/yarn-project/end-to-end/src/integration_archiver_l1_to_l2.test.ts index 85b72245269..94bfe22844e 100644 --- a/yarn-project/end-to-end/src/integration_archiver_l1_to_l2.test.ts +++ b/yarn-project/end-to-end/src/integration_archiver_l1_to_l2.test.ts @@ -34,6 +34,7 @@ describe('archiver integration with l1 to l2 messages', () => { let deployL1ContractsValues: DeployL1Contracts | undefined; let accounts: CompleteAddress[]; ({ teardown, wallet, deployL1ContractsValues, accounts, config, logger } = await setup(2)); + config.archiverPollingIntervalMS = 100; archiver = await Archiver.createAndSync(config); const walletClient = deployL1ContractsValues.walletClient;