Commit 59c9a79f authored by mergify[bot]'s avatar mergify[bot] Committed by GitHub

Merge pull request #4053 from ethereum-optimism/sc/sdk-flakes-3

fix(sdk): final flake hotfix
parents 49685f81 3b0aff69
...@@ -248,21 +248,21 @@ task('deposit-erc20', 'Deposits WETH9 onto L2.') ...@@ -248,21 +248,21 @@ task('deposit-erc20', 'Deposits WETH9 onto L2.')
await depositTx.wait() await depositTx.wait()
console.log(`ERC20 deposited - ${depositTx.hash}`) console.log(`ERC20 deposited - ${depositTx.hash}`)
// Deposit might get reorged, wait 10s and also log for reorgs. // Deposit might get reorged, wait 30s and also log for reorgs.
let prevBlockHash: string = '' let prevBlockHash: string = ''
for (let i = 0; i < 10; i++) { for (let i = 0; i < 30; i++) {
const messageReceipt = await messenger.waitForMessageReceipt(depositTx) const messageReceipt = await messenger.waitForMessageReceipt(depositTx)
if (messageReceipt.receiptStatus !== 1) { if (messageReceipt.receiptStatus !== 1) {
throw new Error('deposit failed') throw new Error('deposit failed')
} }
if ( if (messageReceipt.transactionReceipt.blockHash !== prevBlockHash) {
i > 0 &&
messageReceipt.transactionReceipt.blockHash !== prevBlockHash
) {
console.log( console.log(
`Block number changed from ${prevBlockHash} to ${messageReceipt.transactionReceipt.blockHash}` `Block hash changed from ${prevBlockHash} to ${messageReceipt.transactionReceipt.blockHash}`
) )
// Wait for stability, we want at least 30 seconds after any reorg
i = 0
} }
prevBlockHash = messageReceipt.transactionReceipt.blockHash prevBlockHash = messageReceipt.transactionReceipt.blockHash
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment