Context
Flash loans combined with liquidations are complex attack vectors and legitimate use cases. Integrated testing ensures both paths work correctly.
Current Limitation/Problem
Flash loans and liquidations are only tested in isolation. Their interaction may reveal unexpected behavior.
Expected Outcome
Integration tests that verify flash loan + liquidation combos work correctly and without exploitable interleaving.
Acceptance Criteria
- Test: flash loan → borrow → liquidate → repay flash loan (profitable)
- Test: flash loan → manipulate price → liquidate → repay (circuit breaker stops)
- Test: multiple flash loans in same transaction cascade
- Test: flash loan liquidation when position is at boundary health factor
- Test: liquidation with flash-loaned funds across multiple positions
- Verify: protocol fee is correctly collected in flash-loan liquidations
- Verify: liquidation cannot be griefed via flash loan sandwich
- Gas benchmark: flash loan liquidation vs standard liquidation
- Edge cases: partial liquidation with flash loan, empty flash loan
Technical Scope
- Files: tests/integration/flash-loan-liquidation/
- Contracts: flash-loan, liquidation-engine, lending-pool
- Test scenarios: profitable, unprofitable, boundary conditions
Context
Flash loans combined with liquidations are complex attack vectors and legitimate use cases. Integrated testing ensures both paths work correctly.
Current Limitation/Problem
Flash loans and liquidations are only tested in isolation. Their interaction may reveal unexpected behavior.
Expected Outcome
Integration tests that verify flash loan + liquidation combos work correctly and without exploitable interleaving.
Acceptance Criteria
Technical Scope