1

Here : http://solidity.readthedocs.io/en/v0.4.21/units-and-global-variables.html , It states

It might be that you run into Out-of-Gas for sha256, ripemd160 or ecrecover on a private blockchain. The reason for this is that those are implemented as so-called precompiled contracts and these contracts only really exist after they received the first message (although their contract code is hardcoded). Messages to non-existing contracts are more expensive and thus the execution runs into an Out-of-Gas error. A workaround for this problem is to first send e.g. 1 Wei to each of the contracts before you use them in your actual contracts. This is not an issue on the official or test net.

It is getting out of gas on Ropsten as well, I am calling a function which involves ecrecover in it and it is not being executed.

Although, the same function worked fine in truffle testing. Running the same function on Remix, get

Gas estimation errored with the following message (see below). The transaction execution will likely fail. Do you want to force sending? Error: gas required exceeds allowance or always failing transaction

Etherscan Tx : https://ropsten.etherscan.io/tx/0x229a4e16f4464809181a24a16e1db2acb82b11ac160c26a1aa5e692495fb4d4a

How can i get this function run using Ropsten?

4
  • 1
    The issue you indicate only applies to private blockchains and not to ropsten. There's a bug in solidity that cause the wrong computation of the gas for precompiled contracts. But from you transaction it is unclear the ecrecover is tha cause.
    – Ismael
    Mar 29, 2018 at 4:59
  • Other functions of contract are working fine, on truffle, i have tested the same contracts. Only the functions, involving ecrecover are not working using metamask.
    – Aniket
    Mar 29, 2018 at 15:05
  • @A.K. please include your contract code or verify it on Etherscan. Mar 31, 2018 at 19:06
  • Please include your code, otherwise its pretty much impossible to debug.
    – hextet
    Apr 3, 2018 at 3:52

1 Answer 1

1

I got it worked. Issue was with prefix in signature i.e. \x19Ethereum Signed Message:\n32. More detail of issue can be found here : https://github.com/OpenZeppelin/zeppelin-solidity/issues/644

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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