Submitted by hyh
If deposits and withdraws are done frequently enough, the reward update operation they invoke will deal mostly with the case when there is nothing to add yet, i.e. reward.remaining match the reward token balance.
If reward token doesnt allow for zero value transfers, the reward update function will fail on an empty incremental reward transfer, which is now done unconditionally, reverting the caller deposit/withdrawal functionality
When ConvexStakingWrapper isnt paused, every deposit and withdraw update current rewards via _checkpoint function before proceeding:
ConvexStakingWrapper.sol#L233
ConvexStakingWrapper.sol#L260
_checkpoint calls _calcRewardIntegral for each of the reward tokens of the pid:
ConvexStakingWrapper.sol#L220
_calcRewardIntegral updates the incremental reward for the token, running the logic even if reward is zero, which is frequently the case:
ConvexStakingWrapper.sol#L182
If the reward token doesnt allow zero value transfers, this transfer will fail, reverting the corresponding deposit or withdraw.
Consider checking the reward before doing transfer (and the related computations as an efficiency measure):
Now:
To be:
ryuheimat (Concur) confirmed
Alex the Entreprenerd (judge) commented:
