Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eth.getBlock fails with "Number can only safely store up to 53 bits" #3512

Closed
MaxXor opened this issue May 11, 2020 · 4 comments
Closed

eth.getBlock fails with "Number can only safely store up to 53 bits" #3512

MaxXor opened this issue May 11, 2020 · 4 comments

Comments

@MaxXor
Copy link

MaxXor commented May 11, 2020

Expected behavior

Get the block.

Actual behavior

Error "Number can only safely store up to 53 bits"

Example code

        this.web3.eth.getBlock(number, function(error, result) {
            if (error) {
                console.log(error);
                return;
            }
            console.log(result.timestamp);
        });

Ethereum Studio example: https://studio.ethereum.org/5eb924ed26b4730012351a47?openFile=app/app.js Lines (133-145)

Steps to reproduce the behavior

  1. Load the Ethereum Studio example
  2. Deploy the contract
  3. See the error in console log

Environment

Javascript with web3.js version 1.2.7

@cgewecke
Copy link
Collaborator

@MaxXor

Are you using the Quorum blockchain or another EVM based fork? If so, the solution is to use a Web3.js extension library like jpmorganchase/quorum.js.

(Possible duplicate of #3442)

@MaxXor
Copy link
Author

MaxXor commented May 11, 2020

Thanks for the reply, I don't use Quorum. I've linked a small example in Ethereum Studio, it's only slightly modified version of the hello-world app there, but demonstrates the problem.

I've seen similar issues here (such as #1960 or #1905), but they were closed already. The one you linked mentions timestamps specifically but the error happens already before the console.log(result.timestamp); inside the getBlock function.

@MaxXor MaxXor closed this as completed May 11, 2020
@MaxXor MaxXor reopened this May 11, 2020
@cgewecke
Copy link
Collaborator

cgewecke commented May 11, 2020

@MaxXor From what I can see superblocks/ethereum-studio is using a custom client. It might be worthwhile to open this issue over there. We run a large set of tests here against

  • ganache development client
  • geth development client
  • ethereum mainnet

They all work.

Closing since this looks like an issue downstream from here...please just ping if you discover otherwise.

@dvcrn
Copy link

dvcrn commented Feb 24, 2021

For future googlers, in my case this was caused by using number type for gas when parsing from hex. Changing this to String fixed the issue for me: https://github.com/dvcrn/web3.js/commit/b868c5fece70fba6d34b577ef59f3fa3159390ad

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants