Description:
The Pot::closePot function contains a loop that iterates over all claimants and processes their rewards distribution. Within this loop, there is a call to transfer funds to each claimant. Performing external calls inside a loop can be risky for several reasons:
Gas Limit Exceeded: If the number of claimants is large, the gas required to process all transfers could exceed the block gas limit, causing the transaction to fail.
Denial of Service: A malicious claimant could purposely cause the transfer to revert (e.g., by rejecting the transfer), which would revert the entire transaction, preventing other claimants from receiving their funds.
Impact:
The presence of a call inside the loop could lead to failed transactions, especially in scenarios with a large number of claimants. This could result in the pot remaining unclosed, funds being locked up, and claimants being unable to claim their cut.
Proof of Concept:
In a scenario where there are thousands of claimants, this function could exceed the gas limit and fail the transaction thus not sending any claimant cut to the thousands of claimants
Recommended Mitigation:
Use of Pull Payments: Instead of sending funds directly within the loop, consider implementing a pull payment mechanism where claimants can withdraw their rewards themselves. This approach minimizes the risks associated with external calls inside loops.
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.