code-423n4 / 2021-09-yaxis-findings

0 stars 0 forks source link

Removing the explicit return in favor of the used named return will save some gas #61

Closed code423n4 closed 2 years ago

code423n4 commented 3 years ago

Handle

0xRajeev

Vulnerability details

Impact


The named return variable _outputAmount makes explicit return statements redundant and would likely save a bit of gas.

Proof of Concept

https://github.com/code-423n4/2021-09-yaxis/blob/cf7d9448e70b5c1163a1773adb4709d9d6ad6c99/contracts/v3/converters/StablesConverter.sol#L119

https://github.com/code-423n4/2021-09-yaxis/blob/cf7d9448e70b5c1163a1773adb4709d9d6ad6c99/contracts/v3/converters/StablesConverter.sol#L131

https://github.com/code-423n4/2021-09-yaxis/blob/cf7d9448e70b5c1163a1773adb4709d9d6ad6c99/contracts/v3/converters/StablesConverter.sol#L146

https://github.com/code-423n4/2021-09-yaxis/blob/cf7d9448e70b5c1163a1773adb4709d9d6ad6c99/contracts/v3/converters/StablesConverter.sol#L158

Tools Used

Manual Analysis

Recommended Mitigation Steps

Remove explicit return statements or remove the named return variable.

Haz077 commented 2 years ago

Explicit return statements don't cost more gas in the mentioned function, removing them will not affect the gas cost.

GalloDaSballo commented 2 years ago

Disputed by sponsor, and me