Submitted by TresDelinquentes
There is a check inside _processContribution, which checks if (votingPower == 0) and reverts if true.
Now lets see how we can force it to revert. If maxTotalContributions == minTotalContributions and exchangeRateBps < 1e4, we can force a rounding down to 0, when totalContributions = maxTotalContribtuions - 1.
Lets take a look at an example. Note that this is allowed:
minTotalContributions = 10e18
maxTotalContributions = 10e18
exchangeRateBps = 0.5e4
So amount = 1.
Calculating this we get: (1 * 0.5e4) / 1e4 = 0.5 which rounds down to 0.
We will always force a revert here, no matter what original amount is sent, since we refund the excess.
Keep in mind that minTotalContributions, maxTotalContributions and exchangeRateBps cannot be changed after creation of the crowdfund. Users will be able to call refund only after the crowdfund is Lost.
The DoS will last as long as the duration of the crowdfund. If duration = 14 days, then the users will recover their funds after 14 days.
Note that if emergencyDisabled = true, the DAO wont be able to retrieve their funds through emergencyExecute and the users will have to wait until the crowdfund is lost.
Paste the following inside test/crowdfund/InitialETHCrowdfund.t.sol in contract InitialETHCrowdfundTest and run forge test --mt test_dosOnFinalizationWhenReachingTheMaxTotalContributions -vvvv:
Foundry
Enforce the constraint to be more strict:
DoS
gzeon (judge) commented:
0xble (Party) acknowledged
For this audit, 22 reports were submitted by wardens detailing low risk and non-critical issues. The report highlighted below by 3docSec received the top score from the judge.
The following wardens also submitted reports: Emmanuel, TresDelinquentes, Madalad, lsaudit, 0xMosh, Bauchibred, adriro, sin1st3r__, joaovwfreire, J4X, 0xadrii, Walter, osmanozdemir1, ZanyBonzy, Ch_301, Shaheen, Topmark, Pechenite, 0xmystery, chainsnake, and adeolu.
