BriVault

First Flight #52
Beginner FriendlySolidity
100 EXP
View results
Submission Details
Impact: low
Likelihood: low
Invalid

Return value from `_getWinnerShares::BriVault` is not used anywhere in the contract

Root + Impact : _getWinnerShares::BriVault is returning uint256 but the return value is not used in the contract anywhere, wasting gas fee.

Description

  • In the function _getWinnerShares::BriVault ,the return value is not used anywhere this function is being called and is an internal function, so it's a waste of gas fee.

contract BriVault is ERC4626, Ownable {
...
@> function _getWinnerShares() internal returns (uint256) {
for (uint256 i = 0; i < usersAddress.length; ++i) {
address user = usersAddress[i];
totalWinnerShares += userSharesToCountry[user][winnerCountryId];
}
@> return totalWinnerShares;
}
...
}

Risk

Likelihood: Low

Impact: Low

Recommended Mitigation

  • Remove the return value and the returns(uint256) from the main function signature.

contract BriVault is ERC4626, Ownable {
...
- function _getWinnerShares() internal returns (uint256) {
+ function _getWinnerShares() internal{
for (uint256 i = 0; i < usersAddress.length; ++i) {
address user = usersAddress[i];
totalWinnerShares += userSharesToCountry[user][winnerCountryId];
}
- return totalWinnerShares;
}
...
}
Updates

Appeal created

bube Lead Judge 19 days ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
Assigned finding tags:

Gas optimizations

Gas optimizations are invalid according to the CodeHawks documentation.

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.

Give us feedback!