Refs #53
File: contracts/test/CharonLiquidatorFork.t.sol, _params() function
Code:
return CharonLiquidator.LiquidationParams({
...
minSwapOut: 0
});
Problem:
All 5 market happy-path tests pass minSwapOut=0. This disables slippage protection entirely. The happy-path test does not validate that:
- A realistic minSwapOut (e.g., repayAmount * 99% / 100%) is honoured.
- The swap route is viable at the expected fee tier.
- The profit calculation holds when slippage is constrained.
The slippage-specific tests (test_fork_slippage_tooTight_reverts, test_fork_underRepayment_reverts) cover extreme cases but the normal operating regime — minSwapOut set to a reasonable floor — is untested.
PRD clause / invariant: CLAUDE.md: 'Off-chain gates (health factor, price freshness, profitability, gas ceiling, flash-loan liquidity) must all run before simulation.' The on-chain slippage guard is part of the profit protection layer. A happy path that bypasses it gives false confidence.
Impact:
Any regression that zeros out minSwapOut in the production Rust path (OpportunityQueue -> TxBuilder) would be invisible to the fork test suite.
Fix:
In _params(), compute a realistic minSwapOut:
minSwapOut: (m.repayAmount * 99) / 100
Add an assertion that the owner balance increase exceeds minSwapOut to verify the slippage floor was respected end-to-end.
Refs #53
File: contracts/test/CharonLiquidatorFork.t.sol, _params() function
Code:
return CharonLiquidator.LiquidationParams({
...
minSwapOut: 0
});
Problem:
All 5 market happy-path tests pass minSwapOut=0. This disables slippage protection entirely. The happy-path test does not validate that:
The slippage-specific tests (test_fork_slippage_tooTight_reverts, test_fork_underRepayment_reverts) cover extreme cases but the normal operating regime — minSwapOut set to a reasonable floor — is untested.
PRD clause / invariant: CLAUDE.md: 'Off-chain gates (health factor, price freshness, profitability, gas ceiling, flash-loan liquidity) must all run before simulation.' The on-chain slippage guard is part of the profit protection layer. A happy path that bypasses it gives false confidence.
Impact:
Any regression that zeros out minSwapOut in the production Rust path (OpportunityQueue -> TxBuilder) would be invisible to the fork test suite.
Fix:
In _params(), compute a realistic minSwapOut:
minSwapOut: (m.repayAmount * 99) / 100
Add an assertion that the owner balance increase exceeds minSwapOut to verify the slippage floor was respected end-to-end.