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

`MartenitsaToken::producers` array is not cleared in `MartenitsaEvent::stopEvent` function which may lead to incorrect conclusions when fetching data from this array.

Summary

MartenitsaToken::producers array is not cleared when stopping event which may not be desired behavior.

Vulnerability Details

Mapping MartenitsaToken::isProducer is cleared when stopping event but MartenitsaToken::producers array is not, which is mismatch in logic.

function stopEvent() external onlyOwner {
require(block.timestamp >= eventEndTime, "Event is not ended");
for (uint256 i = 0; i < participants.length; i++) {
isProducer[participants[i]] = false;
}
@> // @audit - `producers` array is not cleared
}

Impact

When fetching MartenitsaToken::producers array from contract, caller expects that it will return all current producers but that is not the case because array is not cleared after stopping event.

Tools Used

Manual review

Recommendations

Delete producers array at end of MartenitsaEvent::stopEvent function.

function stopEvent() external onlyOwner {
require(block.timestamp >= eventEndTime, "Event is not ended");
for (uint256 i = 0; i < participants.length; i++) {
isProducer[participants[i]] = false;
}
+ delete producers;
}
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.