Closed code423n4 closed 1 year ago
https://github.com/code-423n4/2022-12-Stealth-Project/blob/main/maverick-v1/contracts/libraries/BinMath.sol#L115-L118
Because ratio first divides and then multiplies again, there is a significant loss of precision;
ratio
maverick-v1/contracts/libraries/BinMath.sol: 114 if (tick & 0x40000 != 0) ratio = (ratio * 0x2216e584f630389b2052b8db590e) >> 128; 115: if (_tick > 0) ratio = type(uint256).max / ratio; 116: uint256 result = (ratio * PRBMathUD60x18.SCALE) >> 128; 117: 118: return result; 119 }
Manual code review
Multiply first before dividing to keep the precision.
This issue is not well explained and doesn't make sense.
kirk-baird marked the issue as unsatisfactory: Invalid
Lines of code
https://github.com/code-423n4/2022-12-Stealth-Project/blob/main/maverick-v1/contracts/libraries/BinMath.sol#L115-L118
Vulnerability details
Impact
Because
ratio
first divides and then multiplies again, there is a significant loss of precision;Tools Used
Manual code review
Recommended Mitigation Steps
Multiply first before dividing to keep the precision.