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: add retry and check using new sdk method for finalization #194

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

dutterbutter
Copy link

Initial work to resolve #193

Comment on lines +125 to +130

// Check if the batch has been processed before attempting finalization
const l1BatchNumber = finalizeWithdrawalParams.value?.l1BatchNumber;
if (l1BatchNumber && !(await isBatchProcessed(l1BatchNumber))) {
throw new Error("Batch not yet processed. Please wait and try again later.");
}
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not seem necessary as it doesnt seem to be the root of the issue. Wallet.isWithdrawalFinalized() is used already and provides that check for withdrawal finalization

Comment on lines +180 to +191
const isBatchProcessed = async (batchNumber: any) => {
const providerStore = useZkSyncProviderStore();
try {
const totalBatchesExecuted = await providerStore.requestProvider().getTotalBatchesExecuted();

return batchNumber <= BigNumber.from(totalBatchesExecuted).toNumber();
} catch (error) {
// eslint-disable-next-line no-console
console.error("Error fetching total batches executed:", error);
return false;
}
};
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment as above

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Intermittent Finalization Failure
1 participant