-
Notifications
You must be signed in to change notification settings - Fork 247
Open
Labels
auditIssue comes as a result of an external auditIssue comes as a result of an external auditbugSomething isn't workingSomething isn't workingvaultsLido stVaults related changesLido stVaults related changes
Description
Summary
When using VaultHub.rebalanceShortfall
value for rebalancing an unhealthy vault (e.g. in VaultHub.forceRebalance
), the vault may still remain unhealthy due to rounding issues. Particularly in cases where the vault's reserveRatioBP
is equal to its forcedRebalanceThresholdBP
.
Expected Behavior
After calling VaultHub.forceRebalance(vault)
or VaultHub.rebalance(vault, rebalanceShortfall(vault)
for an unhealthy vault, it is expected that the vault will be healthy (i.e. isVaultHealthy(vault)
to return true).
Potential Impact
The vault will remain unhealthy, and will require additional rebalancing calls.
Steps to Reproduce
The example below was created by the Certora Prover, see this link for the full details.
- The vault's initial state:
totalValue = 1000 liabilityShares = 689 sharesValue = 801 (internalEth = 100001, internalShares = 86021. ratio=1.162518454795922) reserveRatioBP = forcedRebalanceThresholdBP = 2000
- Shortfall calculation: yield 5:
shortfall = 5 sharesByTotalValue = 860 liabilityShares - shortfall = 684 sharesByTotalValue - shortfall = 855 (liabilityShares - shortfall) / (sharesByTotalValue - shortfall) = 0.8 (80%)
- Call
rebalance(vault, 5)
:liabilityShares = 684 valueToRebalance = 6 totalValue = 994 (internalEth = 100007, internalShares = 86026. ratio = 1.1625206332969102)
- Is vault healthy returns false:
liability = 796 totalValue * (TOTAL_BASIS_POINTS - reserveRatioBP) / TOTAL_BASIS_POINTS = 795 (795.2) liability > 795
Note that even if we rebalanced by shortfall + 1
the vault remains unhealthy.
- Call
rebalance(vault, 6)
:liabilityShares = 683 valueToRebalance = 7 totalValue = 993 (internalEth = 100008, internalShares = 86027. ratio = 1.1625187441152196)
- Is vault healthy returns false:
liability = 795 (by both the current and previous ratio) totalValue * (TOTAL_BASIS_POINTS - reserveRatioBP) / TOTAL_BASIS_POINTS = 794 (794.4) liability > 794
Possible Solutions
No response
Guidelines
- I agree to follow Code of Conduct.
- I have read Lido Contribution Guide.
Metadata
Metadata
Assignees
Labels
auditIssue comes as a result of an external auditIssue comes as a result of an external auditbugSomething isn't workingSomething isn't workingvaultsLido stVaults related changesLido stVaults related changes
Type
Projects
Status
In progress