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: Try to lessen Linea finalizer RPC burden #1740

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
14 changes: 9 additions & 5 deletions src/finalizer/utils/linea/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,15 @@ export function makeGetMessagesWithStatusByTxHash(
};
});

// The Linea SDK MessageServiceContract constructs its own Provider without our retry logic so we retry each call
// twice with a 1 second delay between in case of intermittent RPC failures.
const messageStatus = await Promise.all(
messages.map((message) => retryAsync(() => dstClaimingService.getMessageStatus(message.messageHash), 2, 1))
);
// The Linea SDK MessageServiceContract constructs its own Provider without our caching, rate-limiting or retry
// logic. In particular, it scrapes logs over 0 -> latest and can heavily load the RPC provider. Query message
// up to twice, with a 1 second delay between, in case of intermittent RPC failures.
const messageStatus: OnChainMessageStatus[] = [];
for (const message of messages) {
const status = await retryAsync(() => dstClaimingService.getMessageStatus(message.messageHash), 2, 1);
messageStatus.push(status);
}

return messages.map((message, index) => ({
...message,
status: messageStatus[index],
Expand Down