3

const result = await myContract.methods.myMethod(1).call();

brings the error from above. There is a simmilar questions here but since I use call gas shouldn't matter. I'm using "web3": "1.0.0-beta.35", (Beta.36 doesn't work for me at all.)

1

Are you using Quorum? If you are, this is probably because you are using RAFT consensus algorithm, you have to amend web3 or change to IBFT

0

That is Javascript integer limitation (Number.MAX_SAFE_INTEGER).

In order to work-around it, pass a String or as BigNumber instead.

For example:

const result = await myContract.methods.myMethod("1000000000000000000000").call();
const result = await myContract.methods.myMethod(new BigNumber(2).pow(54)).call();
  • In this case, await myContract.methods.myMethod("1").call(); – smarx Sep 20 '18 at 17:26
  • @smarx: Yes, of course, but I don't see how this case (or any other case for that matter) could yield the error at the title. I guess he's doing something with the returned value which eventually causes this error (something which he hasn't posted here). – goodvibration Sep 20 '18 at 17:27
  • So you believe your answer is incorrect? – smarx Sep 20 '18 at 17:30
  • I don't do anything with the answer. I also tried with a sting or BigNumber but without success. As a workaround I'm using truffle-contract now which works fine. – MarcS82 Sep 20 '18 at 17:49
  • @smarx: No, I believe that the question is missing some info. Either that, or there's a serious bug in "web3": "1.0.0-beta.35", which I sincerely doubt (though I've been using 34 for quite some time, so I'm possibly wrong on that one). – goodvibration Sep 20 '18 at 19:58
0

This will also happen if you set gasPrice to be some very large value when sending transaction like: 15e64.

0

In many blogs I've found it was a Truffle version problem. Truffle v5 would make problems of this type. They suggest to downgrade to truffle@4.1.15.

This has not been so for me. I have continue to use truffle v5. I've resolved by checking my gas limit when I sent a transaction. gasLimit: web3.utils.toHex( gas_limit ),//The maximum gas provided for this transaction (gas limit)

Node: v8.11.4 Truffle: 5.0.12 Web3: 1.0.0-beta.52 Truffle-contract: 4.0.11 Truffle-interface-adapter@0.1.2 │ └── web3@1.0.0-beta.37 └── web3@1.0.0-beta.37 Ganache-cli: v6.4.3 (ganache-core: 2.5.5) Ethereumjs-tx: 1.3.4

New contributor
Francesco Miliani is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

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.