|
| 1 | +# Rebalance Boundary Behavior Analysis |
| 2 | + |
| 3 | +## Context |
| 4 | + |
| 5 | +When the yield token (FUSDEV) price drops, the FYV AutoBalancer detects a deficit (yield value < baseline) and sells collateral (FLOW) to buy more yield tokens. This test validates the boundary behavior at the 0.95 lower threshold. |
| 6 | + |
| 7 | +## Observed Behavior |
| 8 | + |
| 9 | +When the YT price drops significantly (e.g., to P=0.10): |
| 10 | + |
| 11 | +1. **FYV AutoBalancer deficit recovery**: The AB sells FLOW collateral → PYUSD0 → FUSDEV to cover the deficit. The collateral withdrawal is capped by the position's `availableBalance(pullFromTopUpSource: false)`, which limits withdrawal to what maintains H ≥ minHealth (1.1). This pulls the position down to exactly H ≈ 1.1. |
| 12 | + |
| 13 | +2. **FlowALP position does NOT rebalance**: After the AB pull, H lands at ~1.10000000003 (due to integer rounding). The position's rebalance check `minHealth <= health` evaluates to `1.1 <= 1.10000000003 → true` → position considers itself "in bounds" and does NOT rebalance to restore H=1.3. |
| 14 | + |
| 15 | +3. **State freezes**: No further deficit recovery is possible because: |
| 16 | + - The AB has no collateral room to pull (position is at minHealth) |
| 17 | + - The position doesn't rebalance (H rounds to "in bounds") |
| 18 | + - The yield deficit remains permanently unresolved |
| 19 | + |
| 20 | +## Systemic Risk |
| 21 | + |
| 22 | +This creates a tendency to leave positions **chronically at minimum health** (H ≈ 1.1): |
| 23 | + |
| 24 | +- **Thin liquidation buffer**: H=1.1 has only a 10% buffer above liquidation (H=1.0). A modest collateral price drop (~9%) would push into liquidation territory. |
| 25 | + |
| 26 | +- **Value destruction during deficit recovery**: The AB buys yield tokens that are deeply underwater. At P=0.10, each FLOW of collateral buys FUSDEV worth only 0.10 PYUSD0 — a 90% loss. This collateral is effectively wasted since the position rebalance would immediately sell those yield tokens back to repay debt if it fired. |
| 27 | + |
| 28 | +- **No self-healing**: Without an external `force=true` rebalance call, the position stays frozen at minHealth indefinitely. The scheduled rebalancer uses `force=false` and won't trigger. |
| 29 | + |
| 30 | +## Root Cause |
| 31 | + |
| 32 | +The FYV AutoBalancer and FlowALP position rebalancer work against each other: |
| 33 | + |
| 34 | +| Step | Actor | Action | Effect | |
| 35 | +|------|-------|--------|--------| |
| 36 | +| 1 | FYV AB | Sells collateral → buys yield | C decreases, U increases, H drops to 1.1 | |
| 37 | +| 2 | ALP Position | Should sell yield → repay debt | Would restore H to 1.3, freeing room | |
| 38 | +| - | ALP Position | **Does NOT fire** | H=1.10000000003 ≥ minHealth (1.1) → "in bounds" | |
| 39 | + |
| 40 | +If the position DID rebalance, it would sell yield → repay debt → H restores to 1.3 → frees collateral room → AB could continue deficit recovery. This would converge in 2-3 rounds. But the rounding prevents step 2 from ever firing. |
| 41 | + |
| 42 | +## Potential Solutions |
| 43 | + |
| 44 | +1. **`pullFromTopUpSource: true` on the AB's PositionSource**: The AB pull would atomically sell yield → repay debt → free collateral → withdraw, all in one step. Single-round convergence with no wasteful collateral-to-yield roundtrip. |
| 45 | + |
| 46 | +2. **Health epsilon on lower bound**: Add `minHealth + epsilon <= health` check so the position rebalances when H is "effectively at" minHealth. This enables multi-round convergence but still involves the wasteful collateral→yield→debt roundtrip. |
| 47 | + |
| 48 | +3. **Skip AB deficit when yield is deeply underwater**: If yield value / baseline < some threshold (e.g., 0.5), the AB could skip deficit recovery entirely and let the position deleverage directly. Avoids buying deeply depreciating assets. |
| 49 | + |
| 50 | +4. **Direct deleverage path**: Instead of selling collateral→yield, the AB could signal the position to reduce leverage (sell yield → repay debt) without touching collateral. The net effect is the same as what the position rebalance does, but without the collateral roundtrip. |
| 51 | + |
| 52 | +## Current Test Behavior |
| 53 | + |
| 54 | +The boundary test shows: |
| 55 | +- P=0.96: no rebalance (ratio > 0.95) ✓ |
| 56 | +- P=0.95: AB deficit fires, pulls collateral (H: 1.30 → 1.26) ✓ |
| 57 | +- P=0.94: no change — baseline updated after P=0.95, new ratio > 0.95 ✓ |
| 58 | +- P=0.10: AB pulls collateral to H≈1.1, then **frozen** — position doesn't rebalance, deficit unresolved |
| 59 | + |
| 60 | +The scenario2 DOWN phase shows the same freezing: after the first partial deficit at P=2.0 pulls to H≈1.1, all subsequent yield price drops produce no further state changes. |
0 commit comments