Submitted by WatchPug
In the current implementation of withdraw(), it calls _sendRewardsForNft() at L243 which calls updatePool() at L129 which calls getUpdatedAccTokenPerShare() at L319.
getUpdatedAccTokenPerShare() will loop over rewardRateLog to calculate an up to date value of accTokenPerShare.
LiquidityFarming.sol#L270-L285
This wont be a problem in the usual cases, however, if there is a baseToken that:
Then by the time one of the liquidityProviders come to withdraw(), the tx may revert due to out-of-gas.
As the rewardRateLog is now accumulated to a large size that causes the loop costs more gas than the block gas limit.
There is a really easy fix for this, it will also make the code simpler:
Consider removing rewardRateLog and change setRewardPerSecond() to:
ankurdubey521 (Biconomy) acknowledged
pauliax (judge) decreased severity to Medium and commented:
