This repository has been archived by the owner on Jan 12, 2025. It is now read-only.
PeterSR - Start new voting period could be called during active period #407
Labels
Non-Reward
This issue will not receive a payout
PeterSR
Medium
Start new voting period could be called during active period
Summary
In the current implementation, there is a missing check for ensuring that a new voting period cannot be started while an existing voting period is still ongoing. This can lead to inconsistencies in the voting process.
Vulnerability Detail
The vulnerability arises from the absence of a check in the
Voter::startNewVotingPeriod
function to verify whether the current voting period has ended before starting a new one. Without this check, a new voting period can be started even if the previous one has not concluded, leading to potential inconsistencies in the voting process.https://github.com/sherlock-audit/2024-06-magicsea/blob/main/magicsea-staking/src/Voter.sol#L107-L115
Proof of Concept
Add this test to
Voter.t.sol
:Impact
Inability to Use Votes: Users may be unable to cast their votes correctly if the voting periods overlap or are not properly managed.
Loss of Rewards: Bribers may not allocate rewards for votes that are cast during overlapping or improperly managed voting periods. This can lead to users missing out on rewards they would have otherwise earned.
Code Snippet
Tool used
Manual Review
Recommendation
Add this line of code in the
Voter::startNewVotingPeriod
function:The text was updated successfully, but these errors were encountered: