Skip to content
This repository was archived by the owner on Mar 5, 2025. It is now read-only.

getTransactionReceipt: Number can only safely store up to 53 bits #5153

Closed
1 task done
WizardsOrb opened this issue Jun 21, 2022 · 2 comments · Fixed by #5157
Closed
1 task done

getTransactionReceipt: Number can only safely store up to 53 bits #5153

WizardsOrb opened this issue Jun 21, 2022 · 2 comments · Fixed by #5157
Assignees
Labels
1.x 1.0 related issues Bug Addressing a bug

Comments

@WizardsOrb
Copy link

WizardsOrb commented Jun 21, 2022

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

.../node_modules/number-to-bn/node_modules/bn.js/lib/bn.js:6
    if (!val) throw new Error(msg || 'Assertion failed');
                    ^
Error: Number can only safely store up to 53 bits

Expected Behavior

Steps to Reproduce

// chain ETC (61)

web3.eth.getTransactionReceipt('0x84e8b73c5f9e5f1fdd6e3482022f3c65ceb92d95c4ea92075c04d1a22f6b3152').then(console.log)

gasPrice is 10mio GWEI.

representing effectiveGasPrice as string would solve the problem (currently typeof number)

https://blockscout.com/etc/mainnet/tx/0x84e8b73c5f9e5f1fdd6e3482022f3c65ceb92d95c4ea92075c04d1a22f6b3152

Web3.js Version

1.7.3

Environment

  • Operating System: OSX 12.4 (21F79)
  • Browser:
  • Node.js Version: 16
  • NPM Version:

Anything Else?

thanks.

@WizardsOrb WizardsOrb added the Bug Addressing a bug label Jun 21, 2022
@nikoulai
Copy link
Contributor

Hi @WizardsOrb , thanks for the issue.

We are into it.

@nikoulai nikoulai added the 1.x 1.0 related issues label Jun 22, 2022
@nikoulai nikoulai self-assigned this Jun 22, 2022
@nikoulai nikoulai linked a pull request Jun 22, 2022 that will close this issue
13 tasks
@jdevcs jdevcs mentioned this issue Jul 15, 2022
@mishabunte
Copy link

mishabunte commented Nov 30, 2022

@nikoulai error appears again on web3@1.8.1 when I am trying to get receipt for a specific transaction on goerli network, i suppose it's because of this transaction huge fee at 6,764.3 eth

https://goerli.etherscan.io/tx/0x2e9c7587a80d33e801ad76b62e3c27f1f263955e02f870e6c01b3ad4b0b4aa3d

Solution:

> vi +207 ./node_modules/web3-utils/lib/utils.js
207     //return toBN(value).toNumber();                                            
208     return toBN(value).toString();             

log

> var goerli = new Web3('ws://localhost:40002');
undefined
> t = '0x2e9c7587a80d33e801ad76b62e3c27f1f263955e02f870e6c01b3ad4b0b4aa3d'
'0x2e9c7587a80d33e801ad76b62e3c27f1f263955e02f870e6c01b3ad4b0b4aa3d'
> await goerli.eth.getTransactionReceipt(t)
Uncaught Error: Number can only safely store up to 53 bits
    at assert (./node_modules/number-to-bn/node_modules/bn.js/lib/bn.js:6:21)
    at BN.toNumber (./node_modules/number-to-bn/node_modules/bn.js/lib/bn.js:506:7)
    at Object.hexToNumber (./node_modules/web3-utils/lib/utils.js:207:24)
    at Method.outputTransactionReceiptFormatter [as outputFormatter] (./node_modules/web3-core-helpers/lib/formatters.js:246:47)
    at Method.formatOutput (./node_modules/web3-core-method/lib/index.js:148:54)
    at sendTxCallback (./node_modules/web3-core-method/lib/index.js:536:33)
    at Object.callback (./node_modules/web3-core-requestmanager/lib/index.js:305:9)
    at ./node_modules/web3-providers-ws/lib/index.js:114:45
    at Array.forEach (<anonymous>)
    at WebsocketProvider._onMessage (./node_modules/web3-providers-ws/lib/index.js:102:69)
    at W3CWebSocket._dispatchEvent [as dispatchEvent] (./node_modules/yaeti/lib/EventTarget.js:115:12)
    at W3CWebSocket.onMessage (./node_modules/websocket/lib/W3CWebSocket.js:234:14)
> 

npm list | grep web3 └── web3@1.8.1

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
1.x 1.0 related issues Bug Addressing a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants