fix: a swap deadline past the year 275760 leaves the whole swap undecoded #437

Closed
opened 2026-10-04 21:22:44 +02:00 by clawbot · 1 comment
Collaborator

Found while working on #350. Pre-existing.

decode() in src/shared/uniswap.js renders the Deadline line with new Date(Number(deadline) * 1000).toISOString(). A JavaScript date reaches only to the year 275760, so a deadline above 8640000000000 seconds (for example the uint256 maximum) makes toISOString() throw. The blanket catch { return null } in decode() swallows it, and the approval screen shows the swap as an undecoded contract call with nothing saying why: the same silent failure #350 removes for token scales.

Definition of done

  • A deadline a date cannot hold is stated on the Deadline line instead of leaving the whole swap undecoded.
  • Test: a swap whose deadline is the uint256 maximum decodes; it fails against current next.
  • README.md and TODO.md updated in the same commit where they describe the line.
  • make check green.

Model: opus-5-5

Found while working on https://git.eeqj.de/sneak/AutistMask/issues/350. Pre-existing. `decode()` in `src/shared/uniswap.js` renders the `Deadline` line with `new Date(Number(deadline) * 1000).toISOString()`. A JavaScript date reaches only to the year 275760, so a `deadline` above 8640000000000 seconds (for example the `uint256` maximum) makes `toISOString()` throw. The blanket `catch { return null }` in `decode()` swallows it, and the approval screen shows the swap as an undecoded contract call with nothing saying why: the same silent failure https://git.eeqj.de/sneak/AutistMask/issues/350 removes for token scales. ## Definition of done - [ ] A deadline a date cannot hold is stated on the `Deadline` line instead of leaving the whole swap undecoded. - [ ] Test: a swap whose deadline is the `uint256` maximum decodes; it fails against current `next`. - [ ] `README.md` and `TODO.md` updated in the same commit where they describe the line. - [ ] `make check` green. Model: opus-5-5
Author
Collaborator

#441: a deadline later than 275760-09-13 00:00:00 UTC no longer leaves the swap undecoded; its Deadline line reads After 275760-09-13 00:00:00 (no deadline in practice). Only the swap line had this throw.

Model: opus-5-5

https://git.eeqj.de/sneak/AutistMask/pulls/441: a deadline later than 275760-09-13 00:00:00 UTC no longer leaves the swap undecoded; its `Deadline` line reads `After 275760-09-13 00:00:00 (no deadline in practice)`. Only the swap line had this throw. Model: opus-5-5
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/AutistMask#437