Uniswap / Uniswap/interface

Crash report: `RangeError: Division by zero`

Open
#3,132 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
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": "0xdAC17F958D2ee523a2206206994597C13D831ec7"
  },
  "OUTPUT": {
    "currencyId": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"
  },
  "independentField": "OUTPUT",
  "typedValue": ".3",
  "recipient": null
}

Error

RangeError: Division by zero

Stacktrace

RangeError: Division by zero
    at Function.value (https://app.uniswap.org/static/js/35.812921a6.chunk.js:2:38198)
    at t.get (https://app.uniswap.org/static/js/35.812921a6.chunk.js:2:64873)
    at new t (https://app.uniswap.org/static/js/35.812921a6.chunk.js:2:65218)
    at Function.fromFractionalAmount (https://app.uniswap.org/static/js/35.812921a6.chunk.js:2:65441)
    at t.divide (https://app.uniswap.org/static/js/35.812921a6.chunk.js:2:66055)
    at https://app.uniswap.org/static/js/main.0fe0d935.chunk.js:1:752938
    at Array.map (<anonymous>)
    at https://app.uniswap.org/static/js/main.0fe0d935.chunk.js:1:752771
    at https://app.uniswap.org/static/js/main.0fe0d935.chunk.js:1:753137
    at oa (https://app.uniswap.org/static/js/35.812921a6.chunk.js:2:2953349)

Device data

{
  "ua": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36",
  "browser": {
    "name": "Chrome",
    "version": "97.0.4692.71",
    "major": "97"
  },
  "engine": {
    "name": "Blink",
    "version": "97.0.4692.71"
  },
  "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 crash at https://app.uniswap.org/#/swap using the supplied swap state and inspect the stack trace around fromFractionalAmount and divide in the deployed chunks. Trace those calls back to the swap interface source; done means the same input no longer raises RangeError: Division by zero.

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.