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
The DiamondDao contract implements a voting system for proposals using an EnumerableSet to track voters and a mapping to store vote records. While the current implementation implicitly prevents double-voting by overwriting previous votes, it lacks
explicit checks and clear feedback mechanisms to handle attempted double-voting scenarios.
Recommendation:
Implement an explicit check for existing votes:
function_submitVote(addressvoter,uint256proposalId,Vote_vote,stringmemoryreason)private{_requireState(proposalId,ProposalState.Active);require(!_proposalVoters[proposalId].contains(voter),"Alreadyvoted");require(_proposalVoters[proposalId].add(voter),"Failed to recordvoter");votes[proposalId][voter]=VoteRecord({timestamp: uint64(block.timestamp),vote: _vote,reason: reason});}
Consider adding a separate function for vote changes if that's an intended feature:
The text was updated successfully, but these errors were encountered:
softstackio
changed the title
[L-04] Implicit double-voting prevention in DAO voting system
[L-03] Implicit double-voting prevention in DAO voting system
Dec 10, 2024
Severity: Low
Likelihood: Medium
Description:
The DiamondDao contract implements a voting system for proposals using an EnumerableSet to track voters and a mapping to store vote records. While the current implementation implicitly prevents double-voting by overwriting previous votes, it lacks
explicit checks and clear feedback mechanisms to handle attempted double-voting scenarios.
Recommendation:
The text was updated successfully, but these errors were encountered: