-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
Context
Current Gap: Tests cover successful rebalancing, need failure scenarios.
Missing Test Coverage:
-
Insufficient TopUpSource Funds
- Position undercollateralized
- Rebalance requires 100 MOET
- topUpSource only has 50 MOET
- Rebalance fails or partial execution
- Position remains undercollateralized
-
Malicious TopUpSource
- topUpSource always reverts on withdrawal
- Prevents rebalancing
- Enables liquidation that could have been avoided
- Attack vector for forcing liquidations
-
DrawDownSink Rejection
- Position overcollateralized
- Rebalance pushes surplus to drawDownSink
- drawDownSink rejects deposit (e.g., full capacity)
- Rebalance fails, position remains overcollateralized
-
Rebalance Gas Limits
- Complex rebalance operation
- Multiple swaps through connectors
- Gas cost exceeds block limit
- Transaction fails, position not rebalanced
-
Circular Dependencies
- Position A topUpSource = Position B
- Position B topUpSource = Position A
- Both positions need rebalancing
- Circular dependency deadlock
-
Concurrent Rebalances
- Position A and Position B both trigger rebalance
- Both attempt to pull from same liquidity source
- First succeeds, second fails
- Handling of failed rebalance
Recommended Tests:
Test: Rebalance needs 100 MOET, topUpSource has 50, fails gracefully
Test: topUpSource always reverts, rebalance fails, position can be liquidated
Test: drawDownSink rejects deposit, rebalance fails
Test: Rebalance operation exceeds gas limit
Test: Position A and B have circular topUpSource dependency
Test: Two positions trigger rebalance, share same source, first succeeds
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels