Uniswap / Uniswap/interface

Crash report: `Error: Invariant failed`

Open
#4,934 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?inputCurrency=0x0fc6c0465c9739d4a42daca22eb3b2cb0eb9937a&outputCurrency=0x1bbf25e71ec48b84d773809b4ba55b6f4be946fb

swap state

{
  "INPUT": {
    "currencyId": "ETH"
  },
  "OUTPUT": {
    "currencyId": "0x1BBf25e71EC48B84d773809B4bA55B6F4bE946Fb"
  },
  "independentField": "OUTPUT",
  "typedValue": "2989",
  "recipient": null
}

Error

Error: Invariant failed

Stacktrace

Error: Invariant failed
    at i (https://app.uniswap.org/static/js/9.b5edc1bf.chunk.js:2:240503)
    at new e (https://app.uniswap.org/static/js/9.b5edc1bf.chunk.js:2:4070131)
    at e.createUncheckedTrade (https://app.uniswap.org/static/js/9.b5edc1bf.chunk.js:2:4071995)
    at e.encodeSwaps (https://app.uniswap.org/static/js/9.b5edc1bf.chunk.js:2:4085934)
    at e.swapCallParameters (https://app.uniswap.org/static/js/9.b5edc1bf.chunk.js:2:4087573)
    at https://app.uniswap.org/static/js/main.3e62ed90.chunk.js:1:291749
    at Object.Qa [as useMemo] (https://app.uniswap.org/static/js/9.b5edc1bf.chunk.js:2:3694024)
    at t.useMemo (https://app.uniswap.org/static/js/9.b5edc1bf.chunk.js:2:3519066)
    at https://app.uniswap.org/static/js/main.3e62ed90.chunk.js:1:291643
    at Xc (https://app.uniswap.org/static/js/main.3e62ed90.chunk.js:1:292296)

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

Reproduce the swap at the supplied URL using the recorded swap state, then trace the stack from static/js/main.3e62ed90.chunk.js into static/js/9.b5edc1bf.chunk.js. Start at createUncheckedTrade, encodeSwaps, and swapCallParameters; done means the reported swap no longer crashes with an invariant failure and the regression is covered by the relevant test.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.