Commit 710aba90 authored by Mark Tyneway's avatar Mark Tyneway Committed by GitHub

Merge pull request #4326 from ethereum-optimism/fix/migration-gaslimit

fix: migration gaslimit
parents 0043cbec ba8b94a6
---
'@eth-optimism/sdk': patch
---
Don't pass 0 gasLimit for migrated withdrawals
......@@ -64,6 +64,8 @@ func MigrateWithdrawal(withdrawal *LegacyWithdrawal, l1CrossDomainMessenger *com
}
versionedNonce := EncodeVersionedNonce(withdrawal.Nonce, common.Big1)
// Encode the call to `relayMessage` on the `CrossDomainMessenger`.
// The minGasLimit can safely be 0 here.
data, err := abi.Pack(
"relayMessage",
versionedNonce,
......@@ -77,12 +79,15 @@ func MigrateWithdrawal(withdrawal *LegacyWithdrawal, l1CrossDomainMessenger *com
return nil, fmt.Errorf("cannot abi encode relayMessage: %w", err)
}
// Set the outer gas limit. This cannot be zero
gasLimit := uint64(len(data)*16 + 200_000)
w := NewWithdrawal(
withdrawal.Nonce,
&predeploys.L2CrossDomainMessengerAddr,
l1CrossDomainMessenger,
value,
new(big.Int),
new(big.Int).SetUint64(gasLimit),
data,
)
return w, nil
......
......@@ -18,6 +18,7 @@ import {
sleep,
remove0x,
toHexString,
fromHexString,
toRpcHexString,
hashCrossDomainMessage,
encodeCrossDomainMessageV0,
......@@ -351,10 +352,12 @@ export class CrossChainMessenger {
}
}
const minGasLimit = fromHexString(resolved.message).length * 16 + 200_000
return {
...resolved,
value,
minGasLimit: BigNumber.from(0),
minGasLimit: BigNumber.from(minGasLimit),
messageNonce: encodeVersionedNonce(
BigNumber.from(1),
resolved.messageNonce
......
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