BriVault::cancelParticipation does not clear user state, leaving stale data used in winner calculationsWhen a user cancels their participation before the tournament starts, all associated data should be deleted or updated to reflect that they are no longer participating. This prevents them from being considered in the calculation of totalWinnerShares or other metrics.
The cancelParticipation() function only burns the shares and returns the funds, but does not clean up the user's related state. The address remains in usersAddress. When _getWinnerShares() is called, these “ghost” entries are still counted, inflating totalWinnerShares and reducing the actual amount received by winners.
Likelihood: High
This always occurs since the function does not remove their data from mappings or the usersAddress array.
Their old records continue to be used in _getWinnerShares(), inevitably affecting the denominator calculation when the owner sets the winner.
Impact: High
totalWinnerShares is inflated by participants who no longer have any active deposit, so winners receive less than they should.
Surplus funds remain locked in the contract, reducing actual rewards and affecting the vault’s economic integrity.
user1 deposits, joins the winner, and cancels before the event starts; the contract does not clean up usersAddress or userSharesToCountry.
Later, when the winner is set, totalWinnerShares includes s1 (from user1) even though they cancelled.
withdraw() for user2 pays less than it should because the denominator is inflated; part of the funds remain locked.
Remove the user's address from the usersAddress array when they cancel participation, to ensure they are not counted in _getWinnerShares() after funds are refunded.
It is also recommended to clean up associated data (userToCountry and userSharesToCountry) for consistency, although the main issue is presence in usersAddress.
CancelParticipation burns shares but leaves the address inside usersAddress and keeps userSharesToCountry populated.
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.