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

After the end of special events participants are not removed from the `producers` array .

Summary

Once the special event is finished the participants are not removed from the array producers.

Vulnerability Details

The producer role of participants is removed only by changing the bool in the isProducer mapping despite they were also added with that role in the array producers.

function _addProducer(address _producer) internal {
isProducer[_producer] = true;
producers.push(_producer);
}
function stopEvent() external onlyOwner {
require(block.timestamp >= eventEndTime, "Event is not ended");
for (uint256 i = 0; i < participants.length; i++) {
isProducer[participants[i]] = false;
}
}

Impact

The function getAllProducers gives a wrong result including all the participants to special events until that moment.

Tools Used

Manual review

Recommendations

After the end of each special event remove all the participants from the producers array with one of the following methods.

  • Remove array elements by shifting them from right to left.

  • Remove an array element by copying the last element into a place that have to be removed

Updates

Lead Judging Commences

bube Lead Judge over 1 year ago
Submission Judgement Published
Validated
Assigned finding tags:

Producers array not updated

Support

FAQs

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