Due to extremely short votingDelay and votingPeriod , governance is practically impossible
The governance contract was deployed with a voting delay of 1 block and a voting period of 15 blocks, which on Arbitrum (average block time 0.26 seconds) gives users only about 4 seconds to vote. This makes it practically impossible for enough token holders to participate and reach quorum, effectively disabling governance.
Submitted by Kaysoft, also found by spark, immeas, Arz, tnquanghuy0512, perseus, btk, holydevoti0n, fibonacci, T1MOH, and hals
It is practically impossible for enough users to vote within a voting period of 4 seconds from the voting start time.
Proof of Concept
The problem lies in the votingDelay and votingPeriod that are set in the ODGovernor.sol this way.
contract ODGovernor is
Governor,
GovernorSettings,
GovernorCompatibilityBravo,
GovernorVotes,
GovernorVotesQuorumFraction,
GovernorTimelockControl
{
...
constructor(
address _token,
TimelockController _timelock
)
Governor('ODGovernor')//@audit larger voting delay gives users the time to unstake tokens if necessary.
GovernorSettings(1, 15, 0)//@audit voting period 15blocks too small and no function to update. quorum will never be reached.
GovernorVotes(IVotes(_token))
GovernorVotesQuorumFraction(3)
GovernorTimelockControl(_timelock)
{}//@audit votingPeriod: how long does a proposal remain open to votes.
...
}
In the constructor above the GovernorSettings constructor is used to set the votingDelay and votingPeriod.
GovernorSettings(initialVotingDelay, initialVotingPeriod, initialProposalThreshold) measured in blocks
GovernorSettings(1, 15, 0)
The voting delay and voting period are measured in blocks. Since this project is built `specifically for Arbitrum, we will consider Arbitrum particularly to set this values.
- The average
blocktimeonarbitrumis0.26 seconds. - so setting 1 voting delay in the code above implies that there is just 0.26 seconds delay from proposal to voting start time.
- And setting
15voting period above implies that users have just 15 * 0.26 =3.9 secondsto cast their vote.
It will be more practical to set atleast 1 day voting delay and atleast 1 week voting period as set in OZ governance examples. To convert these times to blocks on Arbitrum based on 0.26 secs avg blocktime: 1 day = 86400 / 0.26 = ~332, 308 blocks per day So 1 week will be 332, 308 * 7 = 2,326,156 blocks per week.
So it will be more practical for GovernorSettings parameters to be set this way:
//votingDelay = 1day and votingPeriod = 1week.
GovernorSettings(332308, 2326156, 0); //particulary for Arbitrum based on block numbers.
Calculation reference from OZ docs: https://docs.openzeppelin.com/contracts/4.x/governance#governor
In the inherited OZ’s Governor.sol, the voting delay and voting period are used to set each proposal’s voting start time and deadline in the propose function this way.
function propose(
address[] memory targets,
uint256[] memory values,
bytes[] memory calldatas,
string memory description
) public virtual override returns (uint256) {
...
ProposalCore storage proposal = _proposals[proposalId];
require(proposal.voteStart.isUnset(), "Governor: proposal already exists");
uint64 snapshot = block.number.toUint64() + votingDelay().toUint64();//@audit voting delay.
uint64 deadline = snapshot + votingPeriod().toUint64();
proposal.voteStart.setDeadline(snapshot);
proposal.voteEnd.setDeadline(deadline);
...
}
Tools Used
Openzeppelin Governance docs, OZ’s smart contract wizard.
https://docs.openzeppelin.com/contracts/4.x/governance#governor
Recommended Mitigation Steps
- Short term: Use Oz’s examples but do your calculations based on Arbitrum block time:
GovernorSettings(332308, 2326156, 0); //particulary for Arbitrum based on block numbers.
OZ’s wizard example: https://wizard.openzeppelin.com/#governor
- Long term: Use latest Oz’s from 4.9 and above that have time based voting instead of block number. read here: https://docs.openzeppelin.com/contracts/4.x/governance#disclaimer
The warden has demonstrated how the configured values for
GovernorSettingsare far too small for any effective governance to take place, since users only have ~4 seconds to cast votes. Therefore, all governor-related functionality in theVault721contract will be unaccessible.Since this only impacts setter functions and does not affect the protocol’s core functionality, I believe medium severity is appropriate.
pi0neerpat (OpenDollar) commented:
The governance settings currently set are for testing, not production; however, finding is valid as this was not explicitly stated before the audit. Additionally, recommendation for both short and long-term solutions is appreciated.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
The GovernorSettings constructor was given a voting delay of 1 block and a voting period of 15 blocks, values that are far too small for the chain's block time.
Impact
Governance becomes practically unusable because proposals cannot gather enough votes within the short window, so all governor-related functionality in the Vault721 contract is inaccessible.
What the attacker needed
None
The fix
The settings should be changed to realistic values, such as a voting delay of about one day and a voting period of about one week, calculated in blocks for Arbitrum, or by upgrading to a version of OpenZeppelin that supports time-based voting.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
In many blockchain projects, token holders vote on proposals to change the system. The time window for voting is set in 'blocks' (units of blockchain time). Here, the window was set to only 15 blocks, which on this chain lasts about 4 seconds—far too short for people to notice and cast a vote. As a result, proposals could never get enough votes to pass.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.