The current implementation of Vault::recalculateVaultsCreditCapacity
recalculates the credit capacity of an array of vaults based on their associated markets. However, a critical issue arises when a vault has no stakers but has a positive vaultTotalWethRewardChangeX18
. In such cases, the WETH rewards are lost because there are no stakers to distribute the rewards to.
recalculateVaultsCreditCapacity
is called for Vault A.
During the calculations, after iterating through all markets, vaultTotalWethRewardChangeX18
is found to be greater than 0.
Since there are no stakers in the vault, the following check skips the reward distribution:
The issue lies in the fact that even though wethRewards
are accounted for in the market engine's credit delegation (which tracks debts, USDC credit, and WETH rewards), the rewards are not distributed if there are no stakers. This results in the loss of rewards for the vault, as there is no mechanism to retain or redistribute them.
WETH rewards are permanently lost for the vault when there are no stakers to receive them. Funds will be stucked.
Manual code review.
To address this issue, consider the following solutions:
Distribute Rewards to Other Vaults:
If there are multiple vaults in the same market, distribute the unclaimed rewards proportionally among them.
Retain Rewards for Future Stakers:
Store the unclaimed rewards in the vault until at least one staker is present. Once a staker joins, distribute the accumulated rewards to them.
Implementing either of these solutions will ensure that rewards are not lost and are fairly distributed to eligible participants.
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.