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 ...@@ -64,6 +64,8 @@ func MigrateWithdrawal(withdrawal *LegacyWithdrawal, l1CrossDomainMessenger *com
} }
versionedNonce := EncodeVersionedNonce(withdrawal.Nonce, common.Big1) 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( data, err := abi.Pack(
"relayMessage", "relayMessage",
versionedNonce, versionedNonce,
...@@ -77,12 +79,15 @@ func MigrateWithdrawal(withdrawal *LegacyWithdrawal, l1CrossDomainMessenger *com ...@@ -77,12 +79,15 @@ func MigrateWithdrawal(withdrawal *LegacyWithdrawal, l1CrossDomainMessenger *com
return nil, fmt.Errorf("cannot abi encode relayMessage: %w", err) 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( w := NewWithdrawal(
withdrawal.Nonce, withdrawal.Nonce,
&predeploys.L2CrossDomainMessengerAddr, &predeploys.L2CrossDomainMessengerAddr,
l1CrossDomainMessenger, l1CrossDomainMessenger,
value, value,
new(big.Int), new(big.Int).SetUint64(gasLimit),
data, data,
) )
return w, nil return w, nil
......
...@@ -18,6 +18,7 @@ import { ...@@ -18,6 +18,7 @@ import {
sleep, sleep,
remove0x, remove0x,
toHexString, toHexString,
fromHexString,
toRpcHexString, toRpcHexString,
hashCrossDomainMessage, hashCrossDomainMessage,
encodeCrossDomainMessageV0, encodeCrossDomainMessageV0,
...@@ -351,10 +352,12 @@ export class CrossChainMessenger { ...@@ -351,10 +352,12 @@ export class CrossChainMessenger {
} }
} }
const minGasLimit = fromHexString(resolved.message).length * 16 + 200_000
return { return {
...resolved, ...resolved,
value, value,
minGasLimit: BigNumber.from(0), minGasLimit: BigNumber.from(minGasLimit),
messageNonce: encodeVersionedNonce( messageNonce: encodeVersionedNonce(
BigNumber.from(1), BigNumber.from(1),
resolved.messageNonce 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