The cancelParticipation function is intended to allow users to withdraw their stake before the event begins. While the function successfully refunds the user's staked assets and burns their corresponding vault shares, it fails to completely revert all state changes associated with their participation.
Specifically, when a user joins an event, their address is added to the usersAddress array, and their shares are recorded in the userSharesToCountry mapping. The cancelParticipation function does not remove the user from usersAddress or clear their data from userSharesToCountry.
As a result, the user becomes a "ghost participant"—their funds have been returned, but the contract still considers them part of the event's share accounting.
Likelihood:
Whenever there is a player who cancel participation by calling cancelParticipation
Impact:
This incomplete state reversal has a critical financial impact on the final payout for legitimate winners.
The _getWinnerShares function calculates the total shares of all winning participants by iterating through the usersAddress array. Because this array still contains the addresses of users who have cancelled, their "ghost" shares are incorrectly included in the totalWinnerShares calculation.
This inflates the totalWinnerShares value, which is used as the denominator in the withdraw function to determine each winner's portion of the prize pool:
assetToWithdraw = (user_shares * total_assets) / totalWinnerShares
Because the denominator is artificially high, the assetToWithdraw for every legitimate winner is significantly lower than it should be. This directly results in a loss of funds for the winners, and the remaining assets that should have been distributed are permanently locked in the vault.
Copy and paste to test/BriVault.t.sol
Exclude players who cancelled participation when calculating the winner's share
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.