1

I have been building a smart contract that has worked without issues until yesterday. I was running test and in the middle of tests I started getting the below error message. I reverted back to a previous version of my code which worked before, and am sill getting this error. I am very confused on what has changed / where to find the error. I have had the 53 bit issue with asserts before, but have checked that they are correct. It seems that now I'm not able to deploy the smart contract at all.

Has anyone else faced this issue?

Error: Number can only safely store up to 53 bits
    at assert (/usr/local/lib/node_modules/truffle/build/webpack:/node_modules/bn.js/lib/bn.js:6:1)
    at BN.toNumber (/usr/local/lib/node_modules/truffle/build/webpack:/node_modules/bn.js/lib/bn.js:506:1)
    at Object.hexToNumber (/usr/local/lib/node_modules/truffle/build/webpack:/node_modules/web3-utils/lib/utils.js:208:1)
    at Method.outputBlockFormatter (/usr/local/lib/node_modules/truffle/build/webpack:/node_modules/web3-core-helpers/lib/formatters.js:258:1)
    at Method.web3.eth.getBlock.method.outputFormatter (/usr/local/lib/node_modules/truffle/build/webpack:/packages/interface-adapter/dist/shim/overloads/ethereum.js:38:1)
    at Method.formatOutput (/usr/local/lib/node_modules/truffle/build/webpack:/node_modules/web3-eth/node_modules/web3-core-method/lib/index.js:147:1)
    at sendTxCallback (/usr/local/lib/node_modules/truffle/build/webpack:/node_modules/web3-eth/node_modules/web3-core-method/lib/index.js:523:1)
    at /usr/local/lib/node_modules/truffle/build/webpack:/node_modules/web3/node_modules/web3-core-requestmanager/lib/index.js:308:1
    at /usr/local/lib/node_modules/truffle/build/webpack:/packages/provider/wrapper.js:107:1
    at XMLHttpRequest.request.onreadystatechange (/usr/local/lib/node_modules/truffle/build/webpack:/node_modules/web3/node_modules/web3-providers-http/lib/index.js:98:1)
    at XMLHttpRequestEventTarget.dispatchEvent (/usr/local/lib/node_modules/truffle/build/webpack:/node_modules/xhr2-cookies/dist/xml-http-request-event-target.js:34:1)
    at XMLHttpRequest.exports.modules.996763.XMLHttpRequest._setReadyState (/usr/local/lib/node_modules/truffle/build/webpack:/node_modules/xhr2-cookies/dist/xml-http-request.js:208:1)
    at XMLHttpRequest.exports.modules.996763.XMLHttpRequest._onHttpResponseEnd (/usr/local/lib/node_modules/truffle/build/webpack:/node_modules/xhr2-cookies/dist/xml-http-request.js:318:1)
    at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/truffle/build/webpack:/node_modules/xhr2-cookies/dist/xml-http-request.js:289:47)
    at IncomingMessage.emit (events.js:327:22)
    at endReadableNT (internal/streams/readable.js:1327:12)
    at processTicksAndRejections (internal/process/task_queues.js:80:21)
Truffle v5.4.1 (core: 5.4.1)
Node v14.16.0
2
  • Please see the answer here ethereum.stackexchange.com/a/83781/620 Jul 20 at 9:15
  • Thank you! I saw this earlier, and tried to see if I have this issue anywhere. However, it does not seem like it (and it was working before). I'm wondering whether this is an issue with Truffle - I tried to create a new project and implement a very basic contract, but I get the same error despite not using any numbers at all.
    – lepocode
    Jul 20 at 9:23
1

Ok, so I managed to fix the issue (if someone else is struggling).

I tried downgrading truffle several times, but faced other error messages with my contract. I realised I had used truffle install with -g flag and created global truffle package. Once I delete the global package and reinstalled the v5.4.1 locally and everything started working again.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.