deposit() Break Stake Tracking and Refund LogicThe deposit logic contains two interrelated issues that break internal accounting consistency between deposited assets and minted vault shares:
msg.sender, stake recorded for receiverShares (BTT tokens) are minted to msg.sender, but the deposit record (stakedAsset) is written under receiver.
Functions such as joinEvent() and cancelParticipation() check stakedAsset[msg.sender] to validate deposits and calculate refunds, meaning:
If receiver != msg.sender, the recorded user cannot cancel or join because they hold no shares.
The depositor (msg.sender) cannot cancel either, because stakedAsset[msg.sender] is unset.
If receiver calls cancelParticipation(), they can withdraw funds without burning any shares, leaving unbacked shares in circulation.
stakedAsset valueA second deposit replaces the previous amount instead of accumulating. When the user later cancels participation
As a result, the contract refunds only the most recent deposit amount while burning all user shares — effectively burning funds from the participant’s balance and leaving tokens stranded inside the vault.
Likelihood:
Triggered under normal user interactions (multiple deposits, mismatched receiver, or front-end misconfiguration).
Impact:
Causes accounting desynchronization between recorded stakes and shares, leading to incorrect refunds, lost deposits, and unbacked shares in the system.
Alice deposits 100 tokens (receiver = Alice) → stakedAsset[Alice] = 100.
Alice deposits another 200 tokens (receiver = Alice) → stakedAsset[Alice] = 200 (overwrites old).
Alice now holds shares representing 300 tokens total, but stakedAsset[Alice] = 200.
When she calls cancelParticipation(), it refunds only 200 tokens while burning all 300 tokens worth of shares.
100 tokens remain stuck in the vault, unclaimable.
If instead Bob deposits with receiver = Alice, Alice will later be able to withdraw her full refund (using stakedAsset[Alice]) without burning any shares, leaving unbacked BTT shares in supply.
Paste the following test into briVault.t.sol:
Ensure consistent ownership — Mint shares and record stake for the same address:
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.