The _getVestingRate()
function will return an incorrect value if block.timestamp == _stakeInfo.fullyVestedAt
. When the current time matches fullyVestedAt
, the function should return 1e18
instead of computing the vesting rate.
The staking contract uses the _getVestingRate()
function to determine the staking rate based on the current time. It also supports the time at which a user's staking will be fully vested, storing this value in the staking struct. The fullyVestedAt
value is derived from block.timestamp + vestingPeriod
. However, since the vestingPeriod
can be changed, it is possible for the state variable vestingPeriod
and stakeInfo.fullyVestedAt
to have different values. This discrepancy can cause issues and remains a valid concern.
Add following test case to TempleGoldStaking.t.sol
contract :
run with the command : forge test --mt test_getReward_tgldStaking_exact_at_Vested_time
.
The user will receive fewer reward tokens than expected at the fully vested time if the vestingPeriod
differs from the value stored in the user's staking record.
Manual Review
change the following condition in _getVestingRate
:
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.