# DEX transaction deadline silently ineffective: secondsToWait is always a string, every deadline encodes as year 7646

**URL:** <https://ghostforum.org/t/dex-transaction-deadline-silently-ineffective-secondstowait-is-always-a-string-every-deadline-encodes-as-year-7646/169>\
**Category:** Remediation in Progress\
**Tags:** ghost-dao-interface\
**Created:** [October 7, 2026, 3:17am UTC](https://ghostforum.org/t/dex-transaction-deadline-silently-ineffective-secondstowait-is-always-a-string-every-deadline-encodes-as-year-7646/169 "2026-10-07T03:17:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rusdiwireng](https://ghostforum.org/letter_avatar_proxy/v4/letter/r/9de0a6/32.png) [@Rusdiwireng](https://ghostforum.org/u/Rusdiwireng)\
**Post date:** [October 7, 2026, 3:17am UTC](https://ghostforum.org/t/dex-transaction-deadline-silently-ineffective-secondstowait-is-always-a-string-every-deadline-encodes-as-year-7646/169/1 "2026-10-07T03:17:05Z")

</div>

**Component:** `ghost-dao-interface` @ `a911859`, `src/containers/Dex/SwapContainer.jsx:164`, `src/containers/Dex/PoolContainer.jsx:168`, `src/containers/Dex/Dex.jsx:62`, `src/hooks/uniswapv2/UniswapV2Router.js`.

**Description:** The deadline is computed as `Math.floor(Date.now() / 1000) + secondsToWait`, but `secondsToWait` is always a string. It is initialized from `useState(() => getStorageValue(chainId, address, "dex-deadline", "60"))` where the default is the string `"60"`, it is bound to a text input (`Dex.jsx:301`), and the localStorage hook round-trips through `JSON.stringify`/`JSON.parse`, which preserves stringiness. In JavaScript, `number + string` concatenates: `1791197110 + "60"` yields the string `"179119711060"`. This string flows unconverted into the viem call args (`UniswapV2Router.js` places `deadline` directly in `args` for `swapExactETHForTokens`, `swapExactTokensForETH`, `swapExactTokensForTokens`, and the add-liquidity paths). viem ABI-encodes a decimal string literally as uint256, so the on-chain deadline becomes 179119711060, approximately the year 7646. Meanwhile the UI displays `~{prettifySecondsInDays(secondsToWait)}` (`SwapContainer.jsx:272`), i.e. “~1 minute”. The user-facing safety control is broken on 100 percent of DEX transactions while the interface states the opposite.

**Impact:** A transaction delayed in the mempool (congestion, low gas price, builder holding) can execute at any future time instead of expiring after about a minute. Per-transaction loss is still bounded by the user’s slippage setting; no funds are stolen outright. A core MEV/stale-execution protection is silently absent.

**Reproduction:** Read `SwapContainer.jsx:160-196` and `Dex.jsx:62,301`; in node, evaluate `Math.floor(Date.now()/1000) + "60"` and observe a 12-digit string; pass that string as the `deadline` arg through viem 2.31 (the repo’s pinned version) ABI encoding and observe uint256 179119711060.

**Severity: Medium.** Reason: a user-facing safety control is broken on every DEX transaction and the UI misstates it. Not High because execution still respects `amountBMin`/`amountAMin` slippage bounds and there is no direct theft path.

**Recommendation:** Coerce with `Number(secondsToWait)` at the computation site and validate the input (reject non-numeric, zero, and negative values) in the settings UI.

**Verification:** VERIFIED (code read plus local node/viem reproduction).

---

<div class="post-metadata">

**Author:** ![VoidDragon](https://ghostforum.org/user_avatar/ghostforum.org/voiddragon/32/16_2.png) [@VoidDragon](https://ghostforum.org/u/VoidDragon)\
**Post date:** [November 11, 2026, 6:40pm UTC](https://ghostforum.org/t/dex-transaction-deadline-silently-ineffective-secondstowait-is-always-a-string-every-deadline-encodes-as-year-7646/169/2 "2026-11-11T18:40:28Z")

</div>

Can you confirm that issue does not exist anymore on the development branch [here for swap](https://git.ghostchain.io/ghostchain/ghost-dao-interface/src/commit/b65ab1987322aef26a6f87831f8849b85afa1b84/src/containers/Dex/SwapContainer.jsx#L163) and [here for add liquidity](https://git.ghostchain.io/ghostchain/ghost-dao-interface/src/commit/b65ab1987322aef26a6f87831f8849b85afa1b84/src/containers/Dex/PoolContainer.jsx#L170)?

---

<div class="post-metadata">

**Author:** ![Rusdiwireng](https://ghostforum.org/letter_avatar_proxy/v4/letter/r/9de0a6/32.png) [@Rusdiwireng](https://ghostforum.org/u/Rusdiwireng)\
**Post date:** [November 14, 2026, 2:05am UTC](https://ghostforum.org/t/dex-transaction-deadline-silently-ineffective-secondstowait-is-always-a-string-every-deadline-encodes-as-year-7646/169/3 "2026-11-14T02:05:27Z")

</div>

Confirmed. Checked commit b65ab198 on the development branch: SwapContainer.jsx (swapTokens) now parses secondsToWait with parseInt(…, 10), falls back to 0 when NaN or ≤ 0, and computes deadline = floor(Date.now()/1000) + safeSecondsToWait. Same fix in PoolContainer.jsx (addLiquidityInner). The string-concat year-7646 shape no longer exists on this branch. Will re-verify once it reaches production.
