Summary
The helper _validParams() sets minSwapOut: 0. This means every test that uses _validParams() accepts a zero slippage floor. The two swap-output protection mechanisms in executeOperation are:
amountOutMinimum: p.minSwapOut — passed to PancakeSwap router; reverts if output is below floor
require(finalBal >= totalOwed, "swap output below repayment") — defensive check
Neither mechanism is exercised by any test in this PR. There is no test that:
- Sets a non-zero
minSwapOut and verifies the revert path when the router returns below that floor
- Verifies the
"swap output below repayment" guard fires when post-swap balance is insufficient
Location
contracts/test/CharonLiquidator.t.sol — _validParams() internal helper
Risk
Sandwich attacks and oracle manipulation attacks against the swap step are the primary MEV vectors for this liquidation bot. The slippage floor is the on-chain defense. An unexercised slippage guard may be misconfigured (floor set by the Rust bot to 0 or near-0) without any test surfacing the problem.
Fix
Add two tests (can be mocked):
- Stub router that returns
minSwapOut - 1 tokens; assert revert from router.
- Stub router that returns enough to partially cover but not meet
totalOwed; assert "swap output below repayment" revert.
Refs #38
Summary
The helper
_validParams()setsminSwapOut: 0. This means every test that uses_validParams()accepts a zero slippage floor. The two swap-output protection mechanisms inexecuteOperationare:amountOutMinimum: p.minSwapOut— passed to PancakeSwap router; reverts if output is below floorrequire(finalBal >= totalOwed, "swap output below repayment")— defensive checkNeither mechanism is exercised by any test in this PR. There is no test that:
minSwapOutand verifies the revert path when the router returns below that floor"swap output below repayment"guard fires when post-swap balance is insufficientLocation
contracts/test/CharonLiquidator.t.sol—_validParams()internal helperRisk
Sandwich attacks and oracle manipulation attacks against the swap step are the primary MEV vectors for this liquidation bot. The slippage floor is the on-chain defense. An unexercised slippage guard may be misconfigured (floor set by the Rust bot to 0 or near-0) without any test surfacing the problem.
Fix
Add two tests (can be mocked):
minSwapOut - 1tokens; assert revert from router.totalOwed; assert"swap output below repayment"revert.Refs #38