Changes to vesting period is not handled inside _getVestingRate
The vesting period end time of a stake is fixated at the time of staking itself while the vesting period of the contract can change after an ongoing draw
In case the vesting period is reduced, this allows for scenario's where the calculated vestingRate
of a stake can be greater than 1e18 ie. the ideal maximum value for vestingRate
leading to inflated returns for the staker initially and a potential timeframe where the reward claiming could revert due to underflow caused by the previosuly stored inflated userRewardPerTokenPaid
In case the vesting period is increased, there will be a sudden drop in the vestingRates
of the stakers whose vesting time has not ended and this will cause the reward claiming to revert until the vesting period fully finishes
Draw period == initial vesting period == 16weeks
User stakes at 15th week
For the stake, fullyVestedAt = 15week + 16weeks == 31 weeks
After draw ends, vesting period is reduced to 8 weeks
Now after 9 weeks the vesting rate of the stake will be,
(10 weeks/8 weeks) * 1e18 > 1e18
Apply the follwing diff and run forge test --mt testAudit_vesting_period_influence_inflated_reward
The function getVestingRate
is added to the TempleGoldStaking
contract in order to access the vesting rate publicly
Incorrect reward allocation in case of vesting period changes causing loss of rewards for deserving stakers
Manual Review
Limit the maximum to the 1e18 inside the _getVestingRate
function
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.