The governance contract enforces strict cancellation conditions that limit flexibility in proposal management. The cancel
function only allows a proposal to be canceled under two conditions:
The proposer cancels it before execution.
The proposer's voting power drops below the required threshold.
This design prevents proposals from being canceled after the voting period ends, even if they remain in the execution queue. Additionally, the reliance on the proposer's voting power as a condition for cancellation may not be the most effective mechanism.
The vulnerability exists in the cancel function:
}
The issue arises because the contract only allows proposal cancellations under the following conditions:
Proposer-Initiated Cancellation: Only the proposer can cancel the proposal, which prevents other governance participants from intervening when necessary.
Voting Power Drop: The contract automatically cancels proposals if the proposer's voting power falls below the required threshold, which may not always align with governance needs.
A key limitation is that proposals cannot be canceled after voting ends but before execution, leading to scenarios where unwanted proposals remain in the queue.
Lack of Emergency Proposal Management: If a proposal is deemed harmful or obsolete after voting, governance has no way to prevent its execution.
Potential Governance Exploits: Malicious actors could manipulate voting power mechanics to push harmful proposals forward.
Reduced Flexibility in Decision-Making: A proposal that was initially beneficial but later becomes irrelevant due to external factors cannot be removed from the queue.
Hardhat (for smart contract testing and Proof of Concept)
Foundry (for faster contract execution testing)
Ethers.js (for interacting with the governance contract in a simulated environment)
To demonstrate the issue, I simulate the following scenario:
A proposer creates a proposal.
The voting period ends, and the proposal moves to the execution queue.
The proposer attempts to cancel the proposal after voting ends.
The test confirms that an attempt to cancel the proposal after voting ends results in a revert, proving the inflexibility of the current cancellation mechanism.
Allow Cancellation Before Execution: Modify the cancel
function to permit cancellations even after voting ends, as long as the proposal has not been executed.
Introduce Governance-Based Cancellation: Allow a quorum-based decision where a percentage of token holders can vote to cancel a proposal.
Proposed Code Fix:
Modify the cancel
function to check for execution instead of voting period expiration.
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.