# Adding liquidity can be `DoS`ed due to calculation mismatches

Rounding mismatch between router's floor-based mint amount calc and vault/module's ceil-based deposit calc makes addLiquidity revert, DoSing deposits.

- Payout: Contest reward
- Severity: high
- Program: Arrakis
- Credited: KupiaSec
- Disclosed: 2024-03-02
- Write-up quality: 6/10
- Original: https://github.com/sherlock-audit/2024-03-arrakis-judging/issues/54
- Library page: https://bugbountylibrary.com/r/sherlock%3A2024-03-arrakis%3AH-5
- Tags: domain:web3 impact:dos kind:contest platform:sherlock sev:high tech:evm tech:solidity technique:source-review vuln:dos vuln:precision-loss

**Target:** ArrakisPublicVaultRouter / ArrakisMetaVaultPublic / ValantisHOTModulePublic deposit flow
**Root cause:** Router._getMintAmounts rounds down the required token amounts, while ArrakisMetaVaultPublic.mint proportion and ValantisHOTModulePublic.deposit amount calculations round up, so the module pulls more tokens than the router received/approved.
**Steps:**
1. Set pool reserves = 1e18+1 each, vault totalSupply = 1e18+1.
2. Call ArrakisPublicVaultRouter.addLiquidity with amount0Max=amount1Max=1e18.
3. Router._getMintAmounts returns (shares=1e18-1, amount0=1e18-1, amount1=1e18-1); router pulls 1e18-1 of each token from user.
4. Router calls ArrakisMetaVaultPublic.mint(1e18-1, Bob) which recomputes proportion and calls ValantisHOTModulePublic.deposit(router, 1e18-1).
5. Module recomputes amount0=amount1=1e18 and safeTransferFrom pulls 1e18 each from router, but router only holds 1e18-1, so transfer reverts.
**How found:** Code reading of the deposit call chain: noticed router computes mint amounts with floor rounding while vault/module recompute with ceil rounding, then constructed a reserve/totalSupply state where the two diverge by 1 wei.
**Insight:** When a router pre-computes amounts and a downstream vault/module recomputes them independently, check that both use the same rounding direction; a 1-wei divergence in ceil-vs-floor is enough to make the pull exceed the approved/held balance and brick deposits.
