In the Governance
contract, any proposer who meets the required proposal threshold is allowed to submit a proposal using the Governance::propose
function. While this function operates correctly, there is a design flaw concerning the proposer's ability to cast their own vote on their proposal.
Although it is acceptable for a proposer to vote on their own proposal, the current implementation forces them to wait until the votingDelay
period elapses before they can cast their vote. This approach is inefficient because it requires the proposer to execute a separate transaction to cast their vote, despite already being authorized to vote on their own proposal.
Ideally, the process should be streamlined so that a proposer can include their vote as part of the initial proposal submission, thereby reducing the overall number of transactions and saving on gas costs. This inefficient design not only delays the voting process but also imposes additional gas expenses on proposers, which could be avoided with a more optimized, single-transaction approach.
Governance::propose:
In the current implementation of the Governance contract, when a proposer submits a proposal, their vote is not automatically cast as part of the proposal creation process. Instead, the contract requires the proposer to wait until the designated votingDelay
period has elapsed before they can cast their vote. This design choice necessitates a second, separate transaction for the proposer to register their vote, even though they are already eligible to vote on their own proposal.
This approach introduces several inefficiencies. First, it delays the commencement of the voting process, potentially affecting the timely evaluation of proposals. More importantly, it forces the proposer to incur additional gas costs by performing an extra transaction solely to record their vote. From a user experience standpoint, it is suboptimal because the proposer's vote could be included in the initial proposal submission, thereby reducing the overall number of transactions and associated fees.
In a more streamlined design, the system would automatically register the proposer's vote at the moment the proposal is created. This single-transaction approach would not only lower the gas expenses for the proposer but also simplify the process by eliminating an unnecessary step. Ultimately, incorporating the vote into the proposal creation process would enhance the efficiency and cost-effectiveness of the governance mechanism, fostering a more user-friendly environment for protocol participation.
To demonstrate this vulnerability, the following Proof of Concept (PoC) is provided. The PoC is written using the Foundry tool.
Step 1: Create a Foundry project and place all the contracts in the src
directory.
Step 2: Create a test
directory and a mocks
folder within the src
directory (or use an existing mocks folder).
Step 3: Create all necessary mock contracts, if required.
Step 4: Create a test file (with any name) in the test
directory.
Step 5: Add the following test PoC in the test file, after the setUp
-> private helper function.
Step 6: To run the test, execute the following commands in your terminal:
Step 7: Review the output. The expected output should indicate that proposer has to perform two transaction to create proposal and cast vote.
As demonstrated, the test confirms that proposers has to perform two transactions first to create Proposal and second to Cast vote.
Increased Gas Expenditure:
Proposers are forced to perform an additional transaction to cast their vote after the proposal is created. This extra transaction results in higher gas costs, which can be significant, especially during periods of high network congestion.
Delayed Voting Process:
Since the proposer must wait for the votingDelay
period to elapse before casting their vote, it is not bad for proposers to wait to cast their vote for their own proposals as a common sense a proposer shall always vote for their own proposal not against it.
Delay should be applied on other voters.
Reduced User Experience Efficiency:
The necessity for a separate vote-casting transaction complicates the user experience. Proposers expect a streamlined process where their vote is automatically registered with their proposal, and having to submit a second transaction adds unnecessary complexity.
Potential Governance Integrity Issues:
In situations where rapid voting is critical, the delay and additional transaction might lead to missed voting opportunities or skewed voting results. This can ultimately undermine the fairness and effectiveness of the governance process, affecting the protocol's credibility and stakeholder confidence.
Manual Review
Foundry
Integrate Proposer Vote into Proposal Creation:
Modify the Governance::propose
function so that the proposer's vote is automatically recorded as part of the proposal creation process. This integration would eliminate the need for a subsequent vote-casting transaction, reducing gas costs and improving efficiency.
Enhance User Documentation:
Update the protocol's documentation and user interfaces to reflect the new process. Clear communication will help ensure that proposers understand that their vote will now be automatically included upon proposal submission.
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.