In the Governance contract, when a proposal is cancelled, the contract only updates its state with a canceled
flag, without invalidating the proposal data. As a result, the castVote
function does not check if a proposal has been cancelled, allowing users to vote on proposals that should no longer be active.
Affected Functions:
cancel(uint256 proposalId):
castVote(uint256 proposalId, bool support):
Issue:
The cancel
function only sets the canceled
flag for a proposal but does not fully invalidate the proposal, leaving it eligible for further actions like voting. The castVote
function does not verify whether the proposal has been cancelled, meaning users can still vote on proposals that should no longer be active.
Inconsistent Governance State:
Votes can be cast on proposals that have already been cancelled, leading to misleading vote counts and confusion in the governance process.
Loss of Trust in Governance:
If users realize that cancelled proposals can still receive votes, they may lose confidence in the system's ability to enforce proper governance rules.
Manual Code Review
Ensure Proposal Cancellation is Enforced in Voting:
Modify the castVote
function to check if a proposal has been cancelled before allowing any votes to be cast. For example:
Invalidate Cancelled Proposals Completely:
Consider modifying how cancelled proposals are stored or marked to prevent any further interaction with them, including voting.
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.