deposit Function Fails to Ensure Protocol Fee CollectionWhen users call the deposit function to add funds, the protocol is expected to charge a percentage-based fee.
However, due to flaws in the fee calculation logic, integer division truncation (floor division) may occur, allowing users to deposit funds successfully without paying any fees.
Occurs only when minimumAmount and participationFeeBsp are sufficiently small.
Under these minimal parameter conditions, users could deposit dust amounts multiple times, gaining an unfair advantage over users who pay fees as required.
Add the following function to test/BriVaultTest.t.sol and run forge test --mt test__deposit_withZeroFee -vv:
Console output:
A straightforward fix is to set a minimum fee threshold, ensuring the collected fee never falls below this value:
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.