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

1 stars 0 forks source link

Redundant Explicit Returns #122

Closed code423n4 closed 2 years ago

code423n4 commented 2 years ago

Handle

ye0lde

Vulnerability details

Impact

Using the existing named returns more efficiently can reduce gas usage and improve code clarity.

Proof of Concept

These functions have named return variables and don't need explicit return statements at the end.

I suggest deleting the following explicit returns: https://github.com/code-423n4/2022-01-elasticswap/blob/d107a198c0d10fbe254d69ffe5be3e40894ff078/elasticswap/src/libraries/MathLib.sol#L282 https://github.com/code-423n4/2022-01-elasticswap/blob/d107a198c0d10fbe254d69ffe5be3e40894ff078/elasticswap/src/libraries/MathLib.sol#L362

Tools Used

Visual Studio Code, Remix

Recommended Mitigation Steps

See POC

0xean commented 2 years ago

dupe of #151