This contract includes two functions, briVault::deposit and briVault::joinEvent. The functionality of these two is clearly understood with just their names.
One thing to note here is, no user is actually obliged to join the event after they make a deposit. It's under his own free will whether to join the event or not. Maybe he just wants to hold shares, or is hoping for some yield generation, as there's an indication of it in the protocol description, and protocolFlow.txt — talking about DeFi integrations.
But this proves to be risky for any user. Despite his free will of not being a participant, his assets still get involved in the winning accounting, i.e. given to the winners of the tournament.
It's like, "I deposited my tokens to hold shares — I never bet — but my money was given to strangers".
The sole reason it happens is due to the fact that _setFinalizedVaultBalance considers all assets in the vault, and not just the ones that were gambled.
Likelihood: High/Medium
There's no obligation that joinEvent MUST be called.
Anyone can forget, or simply doesn't want to join for some reason.
Impact: Medium
Users who forget or choose not to join still fund the prize pool
Winners get inflated payouts (free money from non-bettors)
Shares of non-joiners become worthless
Violates "betting" model — turns vault into forced donation
Add the test_NonJoiner_SubsidizeWinners test in briVault.t.sol:
Run it using:
Logs:
Rather than simply considering IERC20(asset()).balanceOf(address(this)); as finalizedVaultAsset, the protocol can keep track of only those assets that have been part of the event.
There's a state variable that's been introduced in this contract, called stakedAmount, but never used. I assume that it was intended to be helpful in such a scenario.
Alternatively, if this feels too much, then the protocol could combine both deposit and joinEvent such that it becomes mandatory for anyone to participate in the event after he deposits — if that's what the protocol wants.
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.