fix: (TychoRouter) Revert if empty swaps

- This is for security purposes. Max uncovered a vulnerability where funds could be stolen if we don't ether the while loop (i.e. if we have empty swaps).
This commit is contained in:
TAMARA LIPOWSKI
2025-02-10 23:49:01 -05:00
parent 12b6ba0743
commit 37efe52c10
2 changed files with 12 additions and 0 deletions

View File

@@ -672,6 +672,13 @@ contract TychoRouterTest is TychoRouterTestSetup {
assertGe(finalBalance, expAmountOut);
}
function testEmptySwapsRevert() public {
uint256 amountIn = 10 ** 18;
bytes memory swaps = "";
vm.expectRevert(TychoRouter__EmptySwaps.selector);
tychoRouter.exposedSwap(amountIn, 2, swaps);
}
function testSingleSwapIntegration() public {
// Test created with calldata from our router encoder, replacing the executor
// address with the USV2 executor address.