Submitted by smiling_heretic
Gauge.sol#L195
Gauge.sol#L489-L490
Gauge.sol#L499-L500
this line in gauge.earned function looks like the intention here is to incentivize users to keep their escrow.balanceOfNft voted for this gauge.
However, its enough to vote just before claiming rewards (even in the same transaction) and voter.reset just after receiving rewards to pass this if and get rewards for full period since last interaction with the gauge.
See original submission for test file.
Note, that Bob kept his votes for this gauge for full 6-day period but Alice just voted before claiming rewards. In logs, we can see that they both received the same (non-zero) amount of VELO tokens.
Alice can reset her votes in the same transaction after claiming rewards, if she decides to do so.
Foundry
A partial solution would be to create a new checkpoint each time users voted status changes (setVoteStatus is called) instead of overwriting the voted in last one.
However, even then, users can just assign very small weight to this gauge, and lock very little VELO, so I dont think this if statement helps with anything. I think, its better to rethink how to incentivize users to vote for specific gauges.
pooltypes (Velodrome) acknowledged and commented:
Alex the Entreprenerd (judge) increased severity to High and commented:
