In the Governance contract, when a proposal is cancelled, the contract merely updates the proposal’s state by setting a canceled flag, without removing or invalidating the proposal data. As a result, the castVote function does not check whether a proposal is cancelled, allowing users to cast votes on proposals that have been cancelled.
Affected Functions:
cancel(uint256 proposalId):
castVote(uint256 proposalId, bool support):
Issue:
The cancel function only sets proposal.canceled to true but does not remove the proposal data or enforce cancellation in other functions. The castVote function does not check if a proposal has been cancelled (i.e., if proposal.canceled == true) before allowing a vote. Consequently, users can cast votes on proposals that have been cancelled.
Inconsistent Governance State:
Votes may be cast on proposals that are no longer active or intended to be considered, leading to skewed or misleading vote counts.
Manipulation Risk:
Malicious actors might exploit this by reviving cancelled proposals through casting votes, undermining the integrity of the governance process.
Loss of Trust:
Stakeholders may lose confidence in the governance mechanism if cancelled proposals continue to affect vote tallies.
Manual Code Review
Enforce Proposal Cancellation in Voting:
Update the castVote function to check if a proposal has been cancelled before allowing a vote. For example:
Invalidate Cancelled Proposals:
Consider modifying the proposal storage or state management such that cancelled proposals are removed or marked in a way that prevents any further interactions, 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.