code-423n4 / 2021-10-union-findings

0 stars 0 forks source link

Gas: Explicit overflow checks even though solidity 0.8 is used (2) #75

Open code423n4 opened 2 years ago

code423n4 commented 2 years ago

Handle

cmichel

Vulnerability details

The UToken contract uses solidity version 0.8 which already comes with implicit overflow checks. The explicit overflow checks in removeReserves can be removed:

// We checked reduceAmount <= totalReserves above, so this should never revert.
// @audit this overflow check already happened implicitly
require(totalReservesNew <= totalReserves, "reduce reserves unexpected underflow");
GalloDaSballo commented 2 years ago

Agree with finding