Bera_Module::bera_kodiakv3_swap broken due to deadline parameter mismatch
bera_kodiakv3_swap passes a deadline field inside IKodiakV3.ExactInputParams, but the actual struct does not declare a deadline. The ABI mismatch causes every Kodiak V3 swap routed through the strategy to revert.
Description
Bera_Module::bera_kodiakv3_swap calls Kodiak's SwapRouter02::exactInput (similar to Uniswap V3) to execute a swap:
function bera_kodiakv3_swap(address token, uint amount, uint amountMin, bytes calldata path) externalonlyRole(EXECUTOR_ROLE) nonReentrant {validateToken(token);IERC20(token).approve(address(kodiakv3swap), amount);kodiakv3swap.exactInput(IKodiakV3.ExactInputParams({path: path,recipient: address(this),deadline: type(uint256).max,amountIn: amount,amountOutMinimum: amountMin}));}
The deadline field is included in the strategy's call but is not present in the actual SwapRouter02.ExactInputParams struct deployed on Berachain (Kodiak's V3 router omits deadline from the struct, unlike Uniswap V3 which includes it):
struct ExactInputParams {bytes path;address recipient;uint256 amountIn;uint256 amountOutMinimum;}
The ABI encoding therefore does not match, and every call to bera_kodiakv3_swap reverts.
The audit included a Foundry PoC (test_bera_kodiakv3_swap) that demonstrates the revert.
Impact
- Swaps executed through Kodiak V3 always revert.
- The strategy cannot use Kodiak V3 liquidity on Berachain at all.
Recommendation
Remove deadline from IKodiakV3.ExactInputParams. Add a separate uint256 deadline parameter to bera_kodiakv3_swap and enforce it with a require(block.timestamp <= deadline, "Expired") check before the swap call (related to the wider "Improper deadline handling" finding).
Resolution
D2: Fixed in 84dbcf9.
Cyfrin: Verified.