The check totalPercentage != (10000 - COMMISSION_FEE) can fail due to integer division precision errors when evenly distributing funds between multiple winners. This will block the distribution.
In _distribute() it is assumed that the caller should always pass the percentages array which totals to 9500 as of this version. But it restricts organizers biased to winners when there are same value proportion made by several users of protocol. The protocol misses such cases where it leads to unfair reward distributions.
Alice sets a contest
3 Supporter provided same value
Alice wanted to allot prizes evenly among them.
But the protocol forces to totalPercentages == 9500
Alice can't divide 9500 among 3 as it gives each 3166.66 shares which is not possible.
Protocol should allow to distribute either excess/less of expectedTotal % winners.length (9500 % 3)
As it is strictly checking for 10000-COMMISSION_FEE alice should be biased or can never distribute.
Reported as high as
High likelihood: This issue occurs reliably whenever multiple winners are specified with calculated even percentage splits. This is a very common way that organizers will want to distribute funds
High Impact: Faulty percentage check results in a complete failure of the distribution
Manual Code Review, VSCode
Allow a small tolerance threshold in the totalPercentage check to account for division rounding errors.
Explicitly calculate and allow the mathematical remainder that arises from precision loss.
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.