DittoETH

Ditto
DeFiFoundryOracle
55,000 USDC
View results
Submission Details
Severity: low
Invalid

Dubious Typecast in BridgeRouterFacet.sol

Summary

The function IBridge(bridge).deposit(msg.sender, amount) at line 53 in BridgeRouterFacet.sol involves a typecast where the returned uint256 value is cast to uint88, potentially leading to data loss.

Vulnerability Details

The typecast operation (uint88 zethAmount = uint88(IBridge(bridge).deposit(msg.sender, amount));) may result in data loss if the returned value exceeds the representational capacity of a uint88.

Impact

The potential data loss could lead to inaccuracies or unexpected behavior in the handling of values.

Recommendations

  • Avoid Unnecessary Typecasts: Consider avoiding typecasts unless absolutely necessary, especially when dealing with return values that may exceed the target type's capacity.

  • Adjust Return Type: If the function is expected to return values that fit into a uint88, consider changing the function's return type to uint88 to eliminate the need for casting.

  • Use Larger Variable Type: If the larger return type is necessary, use a variable type that can safely accommodate the expected range of values.

  • Define Clear Constants: If typecasting is deemed necessary, use clear constants to define the maximum and minimum values that can be safely cast, preventing unexpected behavior.

Updates

Lead Judging Commences

0xnevi Lead Judge
about 2 years ago
0xnevi Lead Judge about 2 years ago
Submission Judgement Published
Invalidated
Reason: Other

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.