Uniswap / Uniswap/interface

Crash report: `Error: Invariant failed` - input overflows uint256 max

Open
#2,103 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug good first issue p2
Dominant language
TypeScript
Stars
5.5k
Forks
5.4k
PR merge metrics
No merged PRs in 30d

Description

URL

https://app.uniswap.org/#/swap?use=V2

swap state

{
  "INPUT": {
    "currencyId": "ETH"
  },
  "OUTPUT": {
    "currencyId": "0x7Fc66500c84A76Ad7e9c93437bFc5Ac33E2DDaE9"
  },
  "independentField": "INPUT",
  "typedValue": "99999999999999999999999999999999999999999999999999999999999",
  "recipient": null
}

Error

Error: Invariant failed

Stacktrace

Error: Invariant failed
    at t.default (https://app.uniswap.org/static/js/4.bc934aa1.chunk.js:2:87112)
    at new t (https://app.uniswap.org/static/js/4.bc934aa1.chunk.js:2:71291)
    at Function.t.fromFractionalAmount (https://app.uniswap.org/static/js/4.bc934aa1.chunk.js:2:71484)
    at t.n.quote (https://app.uniswap.org/static/js/4.bc934aa1.chunk.js:2:74519)
    at B (https://app.uniswap.org/static/js/4.bc934aa1.chunk.js:2:76615)
    at new e (https://app.uniswap.org/static/js/4.bc934aa1.chunk.js:2:245388)
    at Function.e.bestTradeExactIn (https://app.uniswap.org/static/js/4.bc934aa1.chunk.js:2:246786)
    at https://app.uniswap.org/static/js/main.0bec473b.chunk.js:1:169258
    at Object.Ao [as useMemo] (https://app.uniswap.org/static/js/4.bc934aa1.chunk.js:2:1564133)
    at t.useMemo (https://app.uniswap.org/static/js/4.bc934aa1.chunk.js:2:1483605)

Device data

{
  "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36",
  "browser": {
    "name": "Chrome",
    "version": "91.0.4472.124",
    "major": "91"
  },
  "engine": {
    "name": "Blink",
    "version": "91.0.4472.124"
  },
  "os": {
    "name": "Windows",
    "version": "10"
  },
  "device": {},
  "cpu": {
    "architecture": "amd64"
  }
}

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 crash at the provided Uniswap swap URL using the shown oversized ETH input and inspect the stack trace from fromFractionalAmount through quote and bestTradeExactIn. Trace those minified entry points back to the TypeScript source; done means an input exceeding uint256 no longer crashes the swap interface.

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.