sherlock-audit / 2024-08-tokamak-network-judging

1 stars 0 forks source link

ChainPatrol - contract with only `IOptimismMintableERC20` interface is not compatible with `StandardBridge` #54

Open sherlock-admin4 opened 3 weeks ago

sherlock-admin4 commented 3 weeks ago

ChainPatrol

Medium

contract with only IOptimismMintableERC20 interface is not compatible with StandardBridge

Summary

If a custom contract implements only the IOptimismMintableERC20 interface and not the ILegacyMintableERC20, the contract will be incompatible with the StandardBridge because the bridge relies on the l1Token function, which is defined in the legacy interface.

Vulnerability Detail

https://github.com/sherlock-audit/2024-08-tokamak-network/blob/main/tokamak-thanos/packages/tokamak/contracts-bedrock/src/L2/L2StandardBridge.sol#L293

Impact

Any custom contract without l1Token function will not be compatible with StandardBridge

Code Snippet

https://github.com/sherlock-audit/2024-08-tokamak-network/blob/main/tokamak-thanos/packages/tokamak/contracts-bedrock/src/universal/IOptimismMintableERC20.sol#L7-L10

https://github.com/sherlock-audit/2024-08-tokamak-network/blob/main/tokamak-thanos/packages/tokamak/contracts-bedrock/src/universal/StandardBridge.sol#L466

https://github.com/sherlock-audit/2024-08-tokamak-network/blob/main/tokamak-thanos/packages/tokamak/contracts-bedrock/src/L2/L2StandardBridge.sol#L293

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 the IOptimismMintableERC20 will be treated as if they are not the optimism mintable function, without failing.