-
Notifications
You must be signed in to change notification settings - Fork 55
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
base: main
Are you sure you want to change the base?
Conversation
|
||
// 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."); | ||
} |
There was a problem hiding this comment.
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
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; | ||
} | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment as above
Initial work to resolve #193