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

1 stars 0 forks source link

Remove unused variables #131

Closed code423n4 closed 2 years ago

code423n4 commented 2 years ago

Handle

throttle

Vulnerability details

Impact

Gas savings

Proof of Concept

Remove unused return variables https://github.com/code-423n4/2022-01-yield/blob/main/contracts/Cvx3CrvOracle.sol#L76 https://github.com/code-423n4/2022-01-yield/blob/main/contracts/Cvx3CrvOracle.sol#L97

Tools Used

Manual review

Recommended Mitigation Steps

Remove unused variables

devtooligan commented 2 years ago

This is intentional to be consistent with all other Yield oracles

Screen Shot 2022-01-31 at 7 30 55 AM

https://github.com/code-423n4/2022-01-yield#intentional-deviations-from-commonly-cited-best-practices

alcueca commented 2 years ago

It's not about removing the variables per se, but the fact that they are named (and therefore allocated, using gas), and then we redeclare return variables by returning the result of _peek directly.

Duplicated of #60, suggested to be confirmed as a code clarity issue.