Description: The contract allows the users to participate in voting for martenitsa tokens listed on the marketplace (only producers can add their MartenitsaTokens for voting). After the voting period ends, the owner can announce the winner based on the number of votes, and the winner receives a HealthToken as a reward. However, In MartenitsaVoting::announceWinner the function is not resetting the voteCounts mapping counts because of that the previous voting counts remains always saved in the voteCounts mapping. for example, the next time when the voting for martenitsa tokens starts the previous user chasy who is in [0] number had 10 votes and he won. After that the next vote for martenitsa tokens is listed on the marketplace and the user jack who is in [0] number has
receives only 2 votes and user titi who is in [1] number receives 10 votes but Jack wins who has only 2 votes but the previous voteCounts mapping has already saved 10 votes and now jack have total 12 votes that's the reason he wins.
Impact: In the MartenitsaVoting contract previous users' vote count is not updating because this voteCounts mapping is no longer usable and the contract just becomes trash.
Proof Of Concept: Paste this test to your test folder and run the test.
Recommendation: Delete all the participant's votes from the voteCounts mapping so that next time the vote count starts from the start not from the midpoint.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.