Likelihood: Medium — an attacker can cheaply flood the array with early entries, or the array simply grows as a popular raffle fills. No special privileges are needed.
Impact: Medium — each new entry costs more than the last; past a certain size a single enterRaffle call exceeds the block gas limit (~30M) and can no longer be executed, locking out all further participation.
This test enters two batches of 100 players and measures the gas of each
enterRaffle call. The second batch — entering when 100 players are already in
the array — costs far more than the first, confirming the cost grows with the
number of existing players.
Measured gas:
first batch: 23,990,822
second batch: 88,937,355 (~3.7x the first, and above the ~30M block gas limit)
The second batch alone exceeds Ethereum's block gas limit, meaning that in
production this entry could not be mined at all.
Remove the O(n^2) duplicate check. Track entrants with a
mapping(address => bool) (or a per-raffle id) so duplicate detection is O(1)
per entry. Alternatively, allow duplicates — a user can already enter from
multiple wallets, so the check adds little protection at an unbounded gas cost.
The contest is live. Earn rewards by submitting a finding.
Submissions are being reviewed by our AI judge. Results will be available in a few minutes.
View all submissionsThe contest is complete and the rewards are being distributed.