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

0 stars 0 forks source link

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

Closed code423n4 closed 2 years ago

code423n4 commented 2 years ago

Handle

certora

Vulnerability details

Impact

An unneccessery declare of varriable in function generateNewTokenId(uint256 points) internal view returns (uint256 tokenId_) , cause to gas waste for user.

Proof of Concept

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

Tools Used

vscode

Recommended Mitigation Steps

remove decleration of the varriable uint256 tokenId_

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.