code-423n4 / 2022-01-yield-findings

1 stars 0 forks source link

Named return issue #30

Closed code423n4 closed 2 years ago

code423n4 commented 2 years ago

Handle

robee

Vulnerability details

Users can mistakenly think that the return value is the named return, but it is actually the actualreturn statement that comes after. To know that the user needs to read the code and is confusing. Furthermore, removing either the actual return or the named return will save gas.

    Cvx3CrvOracle.sol, peek
    ConvexStakingWrapper.sol, earned
    Cvx3CrvOracle.sol, get
alcueca commented 2 years ago

In all these cases there is no mismatch between the named return and the actual return value. Maybe we can get a small gas optimization by assigning values to the named returns instead of calling return, though.

The issue in itself is wrong (there is no mismatch), but there is value in hinting towards an inconsistency that leads to a gas saving. I suggest this is downgraded to G.

alcueca commented 2 years ago

Duplicate of #60, which describes it better.

GalloDaSballo commented 2 years ago

Because of the low effort submission, am marking invalid