Chainlink Keepers have a gas limit of 5 million per upkeep [Doc]. FeeConversionKeeper::performUpkeep calls convertAccumulatedFeesToWeth, which calls _handleWethRewardDistribution. At the end of _handleWethRewardDistribution, it calls Vault.recalculateVaultsCreditCapacity. If too many vaults are connected to a market, _handleWethRewardDistribution updates all their states. This can cause an out-of-gas error, leading to failed upkeep and unprocessed rewards.
Vault.recalculateVaultsCreditCapacity(market.getConnectedVaultsIds()) updates all connected vaults. If the number of vaults is large, the update cost exceeds the 5M gas limit. In worst case like when _performMultiDexSwap is triggered for asset conversion, the gas limit will be hit. If the transaction fails, the fees remain unconverted, causing liquidity inefficiencies. If a market has too many vault connected to it, chainlink keeper can never update the reward distribution. As a result stakers and protocol will lose fees and rewards
Paste the following code in test/integration/external/chainlink/keepers/fee-conversion/performUpkeep/performUpkeep.t.sol and run: forge test --mt testFuzz_GivenCallPerformUpkeepFunctionGasReport -vv
The gas cost for this is 3.6 million. If connected vault increase, keeper won't be able to call performUpkeep successfully. Or if the recalculateVaultsCreditCapacity has to update all the states in each vault due to changes in all markets, it will hit the gas limit and fail
Rewards are not distributed if performUpkeep git gas limit
Markets with too many vaults cannot efficiently update rewards
Users and protocols lose expected earnings due to gas constraints.
Create seperate offchain keeper which will call convertAccumulatedFeesToWeth periodcally. it can spend as much as gas needed, solving the problem when too much gas is needed for upkeep
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.