Open c4-submissions opened 1 year ago
raymondfam marked the issue as low quality report
raymondfam marked the issue as duplicate of #73
MiloTruck marked the issue as selected for report
The warden has demonstrated how the configured values for GovernorSettings
are 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 the Vault721
contract will be unaccessible.
Since this only impacts setter functions and does not affect the protocol's core functionality, I believe medium severity is appropriate.
MiloTruck marked the issue as satisfactory
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.
Lines of code
https://github.com/open-dollar/od-contracts/blob/f4f0246bb26277249c1d5afe6201d4d9096e52e6/src/contracts/gov/ODGovernor.sol#L41 https://github.com/open-dollar/od-contracts/blob/v1.5.5-audit/src/contracts/gov/ODGovernor.sol#L31-L41
Vulnerability details
Impact
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
andvotingPeriod
that are set in the ODGovernor.sol this way.In the constructor above the GovernorSettings constructor is used to set the votingDelay and votingPeriod.
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.
blocktime
onarbitrum
is0.26 seconds
.15
voting period above implies that users have just 15 * 0.26 =3.9 seconds
to 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:
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.
Tools Used
Openzeppelin Governance docs, OZ's smart contract wizard. https://docs.openzeppelin.com/contracts/4.x/governance#governor
Recommended Mitigation Steps
OZ's wizard example: https://wizard.openzeppelin.com/#governor
Assessed type
Governance