The rebalanceVaultsAssets function in CreditDelegationBranch contains incorrect comparisons and absolute value calculations for vault debts. When a vault is in credit, its debt is negative, but the condition incorrectly reverts even when the vaults are in a valid state. Additionally, the absolute value is applied to the wrong variable, leading to incorrect calculations in the rebalancing logic.
Wrong Comparison in Vault Debt Check
The checks enforces:
The credit vault’s debt should be positive
The debt vault’s debt should be negative
Due to the incorrect condition, the function incorrectly reverts when vaults are actually in the correct state.
Vault in debt have more asset than deposited USDC. So inDebt vault will have more unsettled realized debt than zero. And inCredit vault will have less asset than USDC. Due to this check, when vaults are in correct state, the function will revert
The function incorrectly reverts in cases where the vaults are already in the correct state.
Rebalancing cannot proceed, which could prevent proper debt settlement and affect protocol stability.
Manual code review
Change:
This ensures that:
The credit vault has a negative unsettled debt.
The debt vault has a positive unsettled debt.
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.