Beginner FriendlyFoundryGameFi
100 EXP
View results
Submission Details
Severity: low
Invalid

Duplicate TokenIDs in Voting Count:

Summary

The _tokenIds array collects every token ID that receives a vote. However, it does not check for duplicates, meaning the same token ID can be pushed multiple times if it receives multiple votes.

Vulnerability Details

the array _tokenIds is meant to store all tokenIds that were voted but there is no check that a tokenId is already voted for.

Impact

This can lead to gas issues as the array increases every time someone votes ( instead of everytime someone votes a token not voted before).

Tools Used

Visual inspection

Recommendations

add a mapping that is updated like below :
mapping(uint256 => bool) private _listedForVoting;

and inside voteForMartenitsa() add :

if (!_listedForVoting[tokenId]) {
_tokenIds.push(tokenId);
_listedForVoting[tokenId] = true;
}

Updates

Lead Judging Commences

bube Lead Judge over 1 year ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
Assigned finding tags:

Unbounded arrays

Support

FAQs

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