Skip to content

Latest commit

 

History

History
28 lines (22 loc) · 1.11 KB

Insufficient use of `SafeMath`.md

File metadata and controls

28 lines (22 loc) · 1.11 KB

CurveMath.calculateTrade is used to compute the output amount for a trade.

However, although SafeMath is used throughout the codebase to prevent underflows/overflows, it is not used in this calculation.

Although we could not prove that the lack of SafeMath would cause an arithmetic issue in practice, all such calculations would benefit from the use of SafeMath.

Recommendation:

Review all critical arithmetic to ensure that it accounts for underflows, overflows, and the loss of precision.

Consider using SafeMath and the safe functions of ABDKMath64x64 where possible to prevent underflows and overflows.


Slide Screenshot

149.jpg


Slide Text

  • ToB Audit DFX Finance Finding 11
  • Data Validation
  • Missing SafeMath Inconsistent Use
  • Consistently Use SafeMath

References


Tags