Open code423n4 opened 2 years ago
Indeed, this is the case, however it would be good if actual gas usage was checked by the report.
i++ gas used: 95
++i gas used: 87
It uses 8 gas less, so it's a very small difference, also it is only relevant for one single function TempusAMM.getSwapAmountToEndWithEqualShares
, so the impact is extremely low.
Handle
pants
Vulnerability details
These functions use prefix increaments (
x++
) instead of postfix increaments (++x
):TempusAMM.getSwapAmountToEndWithEqualShares()
ComptrollerMock.enterMarkets()
ComptrollerMock.exitMarket()
Impact
Prefix increaments are cheaper than postfix increaments.
Tool Used
Manual code review.
Recommended Mitigation Steps
Change all prefix increaments to postfix increaments where it doesn't affects the functionality.