You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 12, 2025. It is now read-only.
The function startNewVotingPeriod increments _currentVotingPeriodId and starts a new voting period without checking if the previous voting period has ended. This could lead to overlapping voting periods, where a new voting period starts before the previous one has concluded.
function startNewVotingPeriod() public onlyOwner {
_currentVotingPeriodId++;
VotingPeriod storage period = _startTimes[_currentVotingPeriodId];
period.startTime =block.timestamp;
period.endTime =block.timestamp+ _periodDuration;
emitVotingPeriodStarted();
}
Impact
this bug can lead to manipulation of voting results, allowing a single tokenId to cast more votes than intended. This can significantly distort the voting outcomes, potentially leading to unfair distribution of rewards, compromised integrity of the voting process, and financial loss for honest participants.
0xSmartContract
added
Medium
A Medium severity issue.
Duplicate
A valid issue that is a duplicate of an issue with `Has Duplicates` label
High
A High severity issue.
and removed
Excluded
Excluded by the judge without consulting the protocol or the senior
Medium
A Medium severity issue.
labels
Jul 27, 2024
sherlock-admin4
changed the title
Perfect Taupe Dolphin - Overlapping Voting Periods
pwning_dev - Overlapping Voting Periods
Jul 29, 2024
pwning_dev
High
Overlapping Voting Periods
Summary
@pwning_dev
Vulnerability Detail
The function
startNewVotingPeriod increments
_currentVotingPeriodId
and starts a new voting period without checking if the previous voting period has ended. This could lead to overlapping voting periods, where a new voting period starts before the previous one has concluded.Impact
this bug can lead to manipulation of voting results, allowing a single
tokenId
to cast more votes than intended. This can significantly distort the voting outcomes, potentially leading to unfair distribution of rewards, compromised integrity of the voting process, and financial loss for honest participants.Code Snippet
https://github.com/sherlock-audit/2024-06-magicsea/blob/main/magicsea-staking/src/Voter.sol#L107C1-L116C1
Tool used
Manual Review
Recommendation
Add a check to ensure the previous voting period has ended before starting a new one.
Immediately mark the tokenId as having voted before proceeding with any other state changes or external calls.
The text was updated successfully, but these errors were encountered: