Note: At the judges request here, this downgraded issue from the same warden has been included in this report for completeness.
The RouterSwapParams struct and the _routerSwap function currently do not include any parameters or logic to enforce a deadline for swap completion. This means there is no built-in mechanism to prevent a swap from occurring if the market conditions change unfavourably after the swap was initiated but before it was executed.
See here:
Swaps are executed without considering the time sensitivity of the operation, which is critical in a highly volatile market environment. The absence of a deadline parameter means that once initiated, a swap could theoretically be executed at any point in the future, regardless of how market conditions may have changed. Also note that whereas the slippage logic is already present to protect from returning less than the accepted minimum users could still get affected, take a look at this scenario:
A swap is placed, amountOutMin is 100XYZ tokens, as at the price of 1XYZ = $1, swap stays for long in the mempool (during this period the price of 1XYZ drops to $0.8), so now swap gets finalized, user received 100XYZ tokens, but in reality theyve lost 20% of their acceptable minimum value in dollars.
The lack of a deadline mechanism in the RouterSwapParams structure can lead to unfavourable outcomes for users, since having a deadline lets the caller specify a deadline parameter that enforces a time limit by which the transaction must be executed. Without a deadline parameter, the transaction may sit in the mempool and be executed at a much later time potentially resulting in a worse price for the user.
Introduce a deadline parameter to the RouterSwapParams struct and apply it to swaps.
