Skip to content

Ethereum Solidity ABI Decoder Error: "value exceeds width (20 bits)" #4446

@mohamed0807

Description

@mohamed0807

Ethers Version

6.8. 0

Search Terms

No response

Describe the Problem

'm working on a project involving Ethereum contract interactions and am facing an issue with decoding data from a transaction. I have this hexadecimal data

Code Snippet

let data = "0xa9059cbb00000000000000000000004161c0b5a78975cf799b054e27d2f3e8be1fc893bf00000000000000000000000000000000000000000000000000000000001e8480"
const decodedValues = abiCoder.decode(types.map(ParamType.from), data);

Contract ABI

No response

Errors

DECODED Result(2) [
  value exceeds width (20 bits) (operation="toBeHex", fault="overflow", value=76450787359836037641860180984291677772229208647895581217323133373013917165758, code=NUMERIC_FAULT, version=6.8.0)
      at makeError (/path/to/node_modules/ethers/lib.commonjs/utils/errors.js:126:21)
      at assert (/path/to/node_modules/ethers/lib.commonjs/utils/errors.js:149:15)
      at toBeHex (/path/to/node_modules/ethers/lib.commonjs/utils/maths.js:178:32)
      at AddressCoder.decode (/path/to/node_modules/ethers/lib.commonjs/abi/coders/address.js:29:66)
      at /path/to/node_modules/ethers/lib.commonjs/abi/coders/array.js:86:31
      at Array.forEach (<anonymous>)
      at unpack (/path/to/node_modules/ethers/lib.commonjs/abi/coders/array.js:65:12)
      at TupleCoder.decode (/path/to/node_modules/ethers/lib.commonjs/abi/coders/tuple.js:63:38)
      at AbiCoder.decode (/path/to/node_modules/ethers/lib.commonjs/abi/abi-coder.js:182:22)
      at decode (/path/to/trx.js:99:34) {
    code: 'NUMERIC_FAULT',
    operation: 'toBeHex',
    fault: 'overflow',
    value: 76450787359836037641860180984291677772229208647895581217323133373013917165758n,
    shortMessage: 'value exceeds width (20 bits)',
    baseType: 'address',
    type: 'address'
  },
  14376087425099726544138662156556021388263377962693529595350340835567210594304n
]

Environment

No response

Environment (Other)

No response

Metadata

Metadata

Assignees

Labels

investigateUnder investigation and may be a bug.v6Issues regarding v6

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions