Commit 7af32bda authored by Mark Tyneway's avatar Mark Tyneway

migration: cap withdrawal gaslimit to 25mil

parent 66cafc00
...@@ -95,6 +95,11 @@ func MigrateWithdrawal(withdrawal *LegacyWithdrawal, l1CrossDomainMessenger *com ...@@ -95,6 +95,11 @@ func MigrateWithdrawal(withdrawal *LegacyWithdrawal, l1CrossDomainMessenger *com
// Set the outer gas limit. This cannot be zero // Set the outer gas limit. This cannot be zero
gasLimit := dataCost + 200_000 gasLimit := dataCost + 200_000
// Cap the gas limit to be 25 million to prevent creating withdrawals
// that go over the block gas limit.
if gasLimit > 25_000_000 {
gasLimit = 25_000_000
}
w := NewWithdrawal( w := NewWithdrawal(
versionedNonce, versionedNonce,
......
...@@ -351,8 +351,12 @@ export class CrossChainMessenger { ...@@ -351,8 +351,12 @@ export class CrossChainMessenger {
} }
} }
// Compute the gas limit and cap at 25 million
const dataCost = calldataCost(resolved.message) const dataCost = calldataCost(resolved.message)
const minGasLimit = dataCost.add(200_000) let minGasLimit = dataCost.add(200_000)
if (minGasLimit.gt(25_000_000)) {
minGasLimit = BigNumber.from(25_000_000)
}
return { return {
...resolved, ...resolved,
......
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