Uniswap / Uniswap/interface

Crash report: `Error: Invariant failed`

Open
#4,658 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
5.5k
Forks
5.4k
PR merge metrics
No merged PRs in 30d

Description

URL

https://app.uniswap.org/#/swap

swap state

{
  "INPUT": {
    "currencyId": "0x6B175474E89094C44Da98b954EedeAC495271d0F"
  },
  "OUTPUT": {
    "currencyId": "0x0A913beaD80F321E7Ac35285Ee10d9d922659cB7"
  },
  "independentField": "OUTPUT",
  "typedValue": "9000",
  "recipient": null
}

Error

Error: Invariant failed

Stacktrace

Error: Invariant failed
    at i (https://app.uniswap.org/static/js/5.4d880ec5.chunk.js:2:225461)
    at new e (https://app.uniswap.org/static/js/5.4d880ec5.chunk.js:2:3837754)
    at e.createUncheckedTrade (https://app.uniswap.org/static/js/5.4d880ec5.chunk.js:2:3839618)
    at e.encodeSwaps (https://app.uniswap.org/static/js/5.4d880ec5.chunk.js:2:3853557)
    at e.swapCallParameters (https://app.uniswap.org/static/js/5.4d880ec5.chunk.js:2:3855196)
    at https://app.uniswap.org/static/js/main.f274f7ba.chunk.js:1:261931
    at Object.Qo [as useMemo] (https://app.uniswap.org/static/js/5.4d880ec5.chunk.js:2:3671796)
    at t.useMemo (https://app.uniswap.org/static/js/5.4d880ec5.chunk.js:2:3496852)
    at https://app.uniswap.org/static/js/main.f274f7ba.chunk.js:1:261825
    at ys (https://app.uniswap.org/static/js/main.f274f7ba.chunk.js:1:262478)

Device data

{
  "ua": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36",
  "browser": {
    "name": "Chrome",
    "version": "105.0.0.0",
    "major": "105"
  },
  "engine": {
    "name": "Blink",
    "version": "105.0.0.0"
  },
  "os": {
    "name": "Mac OS",
    "version": "10.15.7"
  },
  "device": {},
  "cpu": {}
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the swap at the reported URL with the supplied state, then trace the minified stack through createUncheckedTrade, encodeSwaps, and swapCallParameters in the referenced JavaScript chunks. Done means identifying why this state reaches the invariant failure and ensuring the same swap no longer crashes.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
blockchain, frontend, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.