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

0 stars 0 forks source link

Gas: Explicit overflow checks even though solidity 0.8 is used (1) #74

Open code423n4 opened 3 years ago

code423n4 commented 3 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 addReserves can be removed:

/* Revert on overflow */
// @audit this overflow check already happened implicitly
require(totalReservesNew >= totalReserves, "add reserves unexpected overflow");
totalReserves = totalReservesNew;
GalloDaSballo commented 3 years ago

Agree with finding