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

0 stars 0 forks source link

gas optimization in function _generateNewTokenId(uint256 points_) internal view returns (uint256 tokenId_) { #112

Closed code423n4 closed 2 years ago

code423n4 commented 2 years ago

Handle

certora

Vulnerability details

Impact

An unneccessery creation of varriable uint256 points_ in function getPoints(uint256 amount, uint256 duration) internal view returns (uint256 points) cause a waste of gas.

Proof of Concept

https://github.com/XDeFi-tech/xdefi-distribution/blob/master/contracts/XDEFIDistribution.sol#L245

Tools Used

vscode

Recommended Mitigation Steps

remove the declearion of varriable uint256 points_

deluca-mike commented 2 years ago

This is invalid as this does not waste any gas, and was done to conform to function prototype standards/style to always have named outputs. The return variable already exists, it costs nothing to give it a name.