The protocol allows users to deposit assets into the vault. After depositing, they can call joinEvent to select a team to represent in the event. If their team wins, they can withdraw assets from the vault and receive an amount proportional to their shares compared to other teammates.
However, a user can deposit funds without ever calling joinEvent. If this occurs, they will not have the opportunity to be part of a winning team and will effectively have no chance of earning a return on their stake. This issue becomes more problematic as the eventStartDate approaches, since a user can deposit assets shortly before the event starts and lose the opportunity to join once it begins.
The core issue lies in the separation of deposit and joinEvent, which allows users to stake assets without ensuring they are assigned to a team.
Likelihood:
This will occur whenever a user deposits assets but does not subsequently call joinEvent to select a team. It is more likely to happen when block.timestamp is close to eventStartDate, because once the event starts, users are prevented from joining a team.
Impact:
A user who deposits assets without joining a team will have staked funds with no chance of a return. Their assets will be distributed to players on the winning team and will become inaccessible after the event starts.
Add this test to the test suite in test/briVault.t.sol.
“This test will show that a user can deposit but, once the event starts, cannot join a team or cancel participation. It also confirms that the user has not been assigned a country, meaning they have no chance to win.
There are a few ways to mitigate this issue.
One approach is to add a function allowing users who have not joined a team to reclaim their deposits before the event ends.
This allows users to recover their deposited funds if they are not on a team, though they would still lose the participation fee. However, this only works before the event ends.
A better solution would be to combine the logic of deposit and joinEvent, ensuring users cannot deposit without selecting a team.
Note that this solution would require updated logic to handle users who deposit multiple times and users who want to switch teams before the event starts.
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.