The _distribute function in Distributor.sol loops over multiple arrays of arbitrary length and calls external contracts in a loop. There are a lot of different reasons why this can exceed the block gas limit and therefore lead to a temporary DoS / freezed funds. To fix this DoS and rescue the funds, an inconvenient process is required, which is highly prone to mistakes and could therefore lead to permanent loss of funds.
When an organizer wants to send funds to the winners of a contest, a proxy must be deployed and the distribute function must be called:
The distribute function loops over multiple arrays of arbitrary length and calls external contracts:
There are multiple reasons why this function call could exceed the block gas limit, like for example the following ones, or a combination of them:
There are a lot of winners in the array
The token used is an ERC777 token and one or many of the winners are smart contract wallets with a receive function that wastes a lot of gas
The token uses a transfer function which wastes a lot of gas
If this call exceeds the block gas limit, it is not possible for anyone to distribute, the funds which are stucked inside the contract, to the supporters in the right way. The most efficient way to rescue and distribute the funds in the right way would be to distribute them all to the organizer, or owner instead and transfer them manually to the winner. But this approach would mean that the organizer, or owner, needs to transfer funds manually to hundreds or thousands of users. This is very inconvenient, the organizer must be trusted a lot and a mistake during that process could lead to permanent loss of funds.
Temporary DoS / freezed funds that can only be rescued with a very inconvenient and time-consuming way. This process can lead to a permanent loss of funds, if any mistakes are made accidentally or intentionally.
Manual Review, Foundry, VSCode
Use a deposit / withdraw mechanism to distribute the funds, or enable the possibility to call the distribute function multiple times and distribute less than 100% on these calls.
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.