2025-02-raac-main/contracts/core/collectors/FeeCollector.sol
Finding: Precision Loss Due to Integer Division Order
Issue Summary
The division operation in:
is performed before subsequent multiplications. In Solidity, integer division truncates results, leading to precision loss, especially when feeAmount
or totalFees
are small.
Potential Vulnerability
Precision Loss:
If feeAmount
is small relative to totalFees
, the division truncates decimals before multiplication, reducing accuracy.
This could result in incorrect fee distribution, leading to unexpected token allocations or financial discrepancies.
Impact: Medium
Inaccurate fee calculations may shortchange or over-allocate certain shares.
Small amounts may be rounded to zero, causing unintentional fund loss.
Likelihood: Medium
The issue is likely if feeAmount
is relatively small.
The error compounds over multiple transactions, causing cumulative miscalculations.
Proof of Concept (PoC)
Consider feeAmount = 10
and totalFees = 30
:
Instead, performing multiplication first:
preserves precision, as the intermediate values remain larger.
Recommended Fix
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.