This repository has been archived by the owner on May 26, 2023. It is now read-only.
lemonmon - contract with only IOptimismMintableERC20
interface is not compatible with StandardBridge
#220
Labels
Has Duplicates
A valid issue with 1+ other issues describing the same vulnerability
Medium
A valid Medium severity issue
Reward
A payout will be made for this issue
lemonmon
informational
contract with only
IOptimismMintableERC20
interface is not compatible withStandardBridge
Summary
If a custom contract implements only the
IOptimismMintableERC20
, but no theILegacyMintableERC20
, the contract is not compatible with theStandardBridge
, as the bridge uses thel1Token
function from the legacy interfaceVulnerability Detail
The comment in the
IOptimismMintableERC20
suggests that one can make a custom implementation ofOptimismMintableERC20
using the interfaceIOptimismMintableERC20
.https://github.com/sherlock-audit/2023-01-optimism/blob/main/optimism/packages/contracts-bedrock/contracts/universal/IOptimismMintableERC20.sol#L8-L10
Also, the
StandardBridge
, which uses theOptimismMintableERC20
has_isOptimismMintableERC20
function, which checks whether the given token address is implementingOptimismMintableERC20
. The function will be true if either ofILegacyMintableERC20
orIOptimismMintableERC20
is implemented. it means that if a token implements only one of the interfaces, it will return true.https://github.com/sherlock-audit/2023-01-optimism/blob/main/optimism/packages/contracts-bedrock/contracts/universal/StandardBridge.sol#L446-L450
However, if the given token passes the
_isOptimismMintableERC20
, the legacy functionl1Token
will be called on the token. If the token does not implement the legacy interface, the call will fail.https://github.com/sherlock-audit/2023-01-optimism/blob/main/optimism/packages/contracts-bedrock/contracts/L2/L2StandardBridge.sol#L170
Therefore, the token which only implements
IOptimismMintableERC20
, but not theILegacyMintableERC20
, is not compatible withStandardBridge
.Impact
Any custom contract without
l1Token
function will not be compatible withStandardBridge
Code Snippet
https://github.com/sherlock-audit/2023-01-optimism/blob/main/optimism/packages/contracts-bedrock/contracts/universal/IOptimismMintableERC20.sol#L8-L10
https://github.com/sherlock-audit/2023-01-optimism/blob/main/optimism/packages/contracts-bedrock/contracts/universal/StandardBridge.sol#L446-L450
https://github.com/sherlock-audit/2023-01-optimism/blob/main/optimism/packages/contracts-bedrock/contracts/L2/L2StandardBridge.sol#L170
Tool used
Manual Review
Recommendation
It is unclear it is intended behavior.
If the
_isOptimismMintableERC20
function returns true only when the both of interfaces are implemented, the token with only theIOptimismMintableERC20
will be treated as if they are not the optimism mintable function, without failing.The text was updated successfully, but these errors were encountered: