Inside the PuppyRaffle::withdrawFees function, the require checks if balance is equal to totalFees. However, various scenarios, which might not necessarily arise from malicious intent, can cause this check to consistently fail. Also, the fact that players can enter the raffle right after a winner selection makes it very difficult to time the right moment for the fees withdrawal and/or any amounts/dust amounts remaining.
Potential issues could arise from:
Any remaining dust amounts due to the rouding of the division :
Accidental or intentional transfers of funds directly to the contract.
Players entering the raffle all the time as there is no pause period after winner selection that prevent entering the raffle.
These scenarios can cause a DOS where the function PuppyRaffle::withdrawFees is completely inoperable.
Fees are completely stuck with no way to recover. High impact for the protocol, as there will be no revenue.
To execute this test : forge test --mt testWithrawFeesRevertsAfterAdding1Wei -vvvv
Manual review
The require is not needed, as only the fees will be sent.
Add an onlyOwner modifier to the function PuppyRaffle::withdrawFees
Add a an onlyOwner function to retrieve any leftover amounts. But in order to not withdraw the player's amount, there needs to be a brief pause after a winner is selected. Consider adding this requirement in the function PuppyRaffle::enterRaffle
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.