Skip to content

Commit

Permalink
migration: cap withdrawal gaslimit to 25mil
Browse files Browse the repository at this point in the history
  • Loading branch information
tynes committed Mar 9, 2023
1 parent 66cafc0 commit 7af32bd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions op-chain-ops/crossdomain/migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,11 @@ func MigrateWithdrawal(withdrawal *LegacyWithdrawal, l1CrossDomainMessenger *com

// Set the outer gas limit. This cannot be zero
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(
versionedNonce,
Expand Down
6 changes: 5 additions & 1 deletion packages/sdk/src/cross-chain-messenger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -351,8 +351,12 @@ export class CrossChainMessenger {
}
}

// Compute the gas limit and cap at 25 million
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 {
...resolved,
Expand Down

0 comments on commit 7af32bd

Please sign in to comment.