Inside the getVaultAccumulatedValues
function, wethRewardChangeX18
is not scaled by the vaultCreditShareX18
leading to incorrect rewards distribution in case market has several connected vaults.
The function getVaultAccumulatedValues calculates changes in debt, USDC credit, and WETH rewards for a vault. However, it does not correctly scale the WETH rewards by the vault's share of the total credit. This means that the vaults receive incorrect amounts of WETH rewards, which are not proportional to their credit share. This leads to an unfair distribution of rewards and may result in a scenario where there are not enough funds to back users' claims.
Consider the following scenario:
Total delegated credit: 1000 USD
Vault A's delegated credit: 200 USD (20% of total)
WETH rewards to be distributed: 10 WETH
The current implementation gives 10 weth to all vaults including Vault A. Ideally, Vault A should receive 2 WETH due to the ratio of it's delagated credit.
Unfair rewards distribution to vaults. The latest changes in rewards are entitled to all the vaults not taking into the account their share in a particular market.
Manual review
Protocol seems to be aware of the issue as the code mentions it with a TODO. Need to scale the wethRewardChangeX18 with vaultCreditShareX18.
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.