Users have the ability to stake some staking tokens in the Gauge contracts to be eligible for rewards. The problem is that late stakers are rewarded the same as early stakers leaving no incentive for locking tokens for an extended period of time. Users will just stake at the end of the period to claim the maximum amount of rewards.
Users can stake tokens through the stake function in BaseGauge
to be eligible for rewards. The problem is that late stakers and early stakers can earn the same amount of rewards. If we look in the earned function, it only uses the current reward per token amount. It does not keep a snapshot of when the staker staked within the period. They can come in and stake when reward per token is at its maximum amount at the end of the period and instantly be eligible for all rewards.
No incentive for staking longer durations
The following demonstrates one staker staking at the beginning of the period and another right at the end. They both end up earning the same amount of rewards.
Add the following test to BaseGauge.test.js
and run npx hardhat test test/unit/core/governance/gauges/BaseGauge.test.js
Receive the following output
Manual Review
Create snapshots for stakers and reward based on staking duration
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.