Users call joinEvent to select a country, allocating their shares to that country via userSharesToCountry[msg.sender][countryId] and updating userToCountry[msg.sender] to the chosen team.
After the winner is set, withdraw allows users who picked the winner to redeem shares for assets, checking userToCountry[msg.sender] against the winner and using balanceOf(msg.sender) for payout calculation.
The issue is that the eligibility check uses userToCountry[msg.sender] (only the last joined country), while share allocation in _getWinnerShares and payouts use cumulative userSharesToCountry across all joins, leading to mismatches if users join multiple times or change countries.
This causes users to be incorrectly denied withdrawals (check fails but shares exist) or receive incorrect payouts (old allocations counted but check passes/fails wrongly).
Likelihood:High
Users call joinEvent multiple times with different countries before the event starts.
No clearing of previous allocations in userSharesToCountry.
Impact:High
Users denied legitimate withdrawals if last country mismatches winner, despite shares in winning pool.
Incorrect payouts where old allocations are counted, potentially overpaying or underpaying winners.
Add testInconsistentEligibility function to briVaultTest.t.sol
Run forge test --mt testInconsistentEligibility
Prevent overwrites: accumulate shares per country
Optional: Enforce single country choice
Or allow multiple but track properly
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.