The current implementation of gas calculation for cross-chain messaging in Optimism allows for potential abuse. Users could send messages with minimal value transfer but cause the protocol to use a disproportionately large amount of gas.
Vulnerability Detail
The baseGas function calculates the gas required for message relay, including several overhead factors. A user can manipulate this by sending a message with a small value but a large _minGasLimit, causing the protocol to reserve more gas than necessary.
Let's consider a scenario where a user sends a minimal value transaction but with a large _minGasLimit:
OMEN
High
Gas Abuse in Cross-Chain Messaging
Summary
The current implementation of gas calculation for cross-chain messaging in Optimism allows for potential abuse. Users could send messages with minimal value transfer but cause the protocol to use a disproportionately large amount of gas.
Vulnerability Detail
The baseGas function calculates the gas required for message relay, including several overhead factors. A user can manipulate this by sending a message with a small value but a large _minGasLimit, causing the protocol to reserve more gas than necessary.
Let's consider a scenario where a user sends a minimal value transaction but with a large _minGasLimit:
Assumptions:
Calculation:
3.Analysis:
Impact
Impact
Code Snippet
https://github.com/sherlock-audit/2024-08-tokamak-network/blob/main/tokamak-thanos/packages/tokamak/contracts-bedrock/src/universal/CrossDomainMessenger.sol#L169-L196
Tool used
Manual Review
Recommendation
charge fee for gas price