code-423n4 / 2021-12-yetifinance-findings

0 stars 0 forks source link

Returning the named returns is redundant #275

Closed code423n4 closed 2 years ago

code423n4 commented 2 years ago

Handle

WatchPug

Vulnerability details

https://github.com/code-423n4/2021-12-yetifinance/blob/5f5bf61209b722ba568623d8446111b1ea5cb61c/packages/contracts/contracts/ActivePool.sol#L132-L142

function getVC() external view override returns (uint totalVC) {
    for (uint i = 0; i < poolColl.tokens.length; i++) {
        address collateral = poolColl.tokens[i];
        uint amount = poolColl.amounts[i];

        uint collateralVC = whitelist.getValueVC(collateral, amount);

        totalVC = totalVC.add(collateralVC);
    }
    return totalVC;
}

At L141, returning outstanding is redundant as named returns will be automatically handled.

Other examples include:

https://github.com/code-423n4/2021-12-yetifinance/blob/5f5bf61209b722ba568623d8446111b1ea5cb61c/packages/contracts/contracts/TroveManagerLiquidations.sol#L435-L435

return singleLiquidation;
kingyetifinance commented 2 years ago

@LilYeti : Probably severity 0, duplicate #24

alcueca commented 2 years ago

Duplicate of issue by the same warden