Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Don't repeatedly scan for missing messages #2886

Merged
merged 2 commits into from
Oct 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions yarn-project/archiver/src/archiver/data_retrieval.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down