quorum()
needs sanity check
#471
Labels
2 (Med Risk)
Assets not at direct risk, but function/availability of the protocol could be impacted or leak value
bug
Something isn't working
duplicate
This issue or pull request already exists
Lines of code
https://github.com/code-423n4/2022-09-nouns-builder/blob/7e9fddbbacdd7d7812e912a369cfd862ee67dc03/src/governance/governor/Governor.sol#L475
Vulnerability details
Impact
When NFT
totalSupply
is low, thequorum()
might be more sensitive to rounding errors. Sometimes the error could be large, or even return 0 result. The vote results based on thesequorum()
will deviate from the intention of governance.Proof of Concept
Any new bidder can call
createBid()
to place a bid:In test file,
quorumThresholdBps
is set to 2_000, then:totalSupply
of NFT is less than 5,quorum()
will return 0.totalSupply
of NFT is 9,quorum()
will return 1.Seems the error is too big for small
totalSupply
andquorumThresholdBps
.Tools Used
Manual analysis.
Recommended Mitigation Steps
totalSupply
, do additional checks forquorum()
results, maybe round up.quorumThresholdBps
ininitialize()
andupdateProposalThresholdBps()
.The text was updated successfully, but these errors were encountered: