The function iterates over the entire usersAddress array to calculate totalWinnerShares.
Since usersAddress grows with every call to joinEvent(), the loop executes once per registered user.
There is no upper bound or pagination mechanism, meaning that if a large number of users join the event (or spam entries before the event starts), the setWinner() transaction that triggers this loop can exceed the gas limit and revert indefinitely.
As a result, the contract owner may become unable to finalize the event, leaving user funds locked in the vault.
Likelihood:
Attainable under normal use if the event becomes popular or if attackers intentionally flood registrations.
Impact:
Prevents the setWinner() function (and therefore all subsequent withdraw() calls) from executing, effectively freezing the entire vault permanently.
Paste the following test to briVault.t.sol:
Use an iterative or claim-based model instead of a full on-chain aggregation:
Maintain running totals incrementally during joinEvent() rather than recomputing in a loop.
The _getWinnerShares() function is intended to iterate through all users and sum their shares for the winning country, returning the total.
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.