A transaction's cost increases with the size of the winners' array. If it grows significantly large (e.g., > 500), the transaction might become prohibitively expensive or even fail due to an "out of gas" error.
Transferring tokens is gas-intensive, with each transfer costing approximately 21000 gas.
As the winners' array grows, the cost multiplies, making the transaction expensive and potentially causing failures.
deployProxyAndDistribute
Current gas prices around 60 Gwei, for context:
Winners[] length | Gas | Price (USD) |
---|---|---|
500 | 3,520,745 | $348,553.755 |
2000 | 14,592,880 | $1,444.70 |
3000 | 22,715,339 | $2,248.82 |
At around 500, the gas cost becomes too expensive. Also, for Ethereum for example, the target block size is 15M. So more than 2000 in size will almost always lead to an out of gas error.
There is also the risk that the caller will not be able to provide enough gas for the transaction to run properly.
Organizers/Owners might need to pay high gas fees.
"Out of gas" errors can halt the reward distribution process.
Prizes might not be distributed if winners are removed to reduce array length.
Failed transactions still charge organizers despite not completing.
Manual review and Foundry testing
Implement a pull-based mechanism where winners claim their rewards.
Limit the array of winners which might hinder the number of participants.
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.