Precision loss will cause users to receive a portion less of the amount to be distributed to them as reward.
Solidity truncates decimal points to zero, hence the reward rate will be subjected to precision issues
We prevent RewardRate from being 0 but this doesn't take away the precision issues in the contract.
FOR RWA Guage the period is 1 month , while for RAAC gauge it is 1 week, the higher the duration the higher the amount lost due to this truncation.
E.g distribute 1 WBTC and 7000 USDC in 7days
Reward Rate= 1*1e8 / 7 days = 165.3439153
solidity will return = 165
165 * 7 days = 99792000.
1e8 - 99792000 = 208000.
208000 convert to USDC = 199.68
7000 USD
Reward Rate= 7000*1e6 / 7 days = 11574.07407
solidity will return = 11574
11574 * 7 days = 6999955200.
7000000000 - 6999955200 = 44800.
For low decimal ERC20 compliant tokens a huge loss will be observed per distribution this loses id over 190 USD for a token like WBTC.
Already we will scale during the reward pertoke stored calculation, why not scale in the Reward rate calculation instead to catch all precision loss issues.
Manual Review
Store the rewardRate scaled by 1e18, so loss of precision will be lower by magnitude of 1e18.
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.