Ganache-cli: VM Exception while processing transaction: revert

Created on 24 Nov 2017  ·  22Comments  ·  Source: trufflesuite/ganache-cli

Anyone plz help me, I'm believing that I'm crazy with this Byzantium update. I just have stucked around revert(), require()... with some fking bugs since a month. Plzzz, Can anyone take me out of this problems. Massive thanks.

Expected Behavior



I try to call this function from a smartcontract:

    function recoverBalance(address _owner)
        public
        payable
    {
        require(msg.value > 0);
        require(!existedPoL(_owner));

        address _receiver = msg.sender;
        getPoL[_owner].receiver = _receiver;
        getPoL[_owner].initialBlockNumber = block.number;
        RecoverBalance(_owner, _receiver, true);
    }

And it should be run without error.

Current Behavior



TestRPC logs are like that:
Transaction: 0xeffb64af2b7e8b3b08d61d013b25a516496db17eb559bfb2e45e5489f2432446
Gas usage: 23274
Block Number: 28
Block Time: Fri Nov 24 2017 16:50:51 GMT+0700 (ICT)
Runtime Error: revert

Possible Solution



Not yet

Your Environment

Most helpful comment

@sontuphan I can't reproduce this. See sontuphan/Proof-of-Loss#1. I added a test to try and reproduce this, and the test passes. If you want me to investigate further, please modify that test to reproduce the problem and repoen this issue.

Note that I ran this test on node 8.9.3 with a fresh install of truffle & ganache-cli. I also tested on Ganache 1.0.2 for good measure. If you're running a version of truffle older than v4.0.4 or ganache-cli older than v6.0.3, I recommend updating.

All 22 comments

Any news about this? I am getting the same error.

I believe that truffle team doesn't give f**k about this. Poor man.

I got the same error. This is due to the testprc's gas limit is not enough to process your transaction.

@Mani7TAM you are correct - this error appears when you don't add the "gas" parameter to "send" method. Too bad that it is not documented anywhere...

So the correct method call should be: contract.methods.mymethod.send({from: account, gas: })

I have exactly the same problem, but it is not about gas. It just reverts transaction without any error.

However after restarting ganache-cli and cleaning up db (I use persistent database) - I was able to send transactions through.

@vsdigitall thanks for your contribution, appreciate it.

@sontuphan I have just noticed that in my case it was not ganache-cli problem, moreover it was expected behaviour. I was transferring funds to smart contract like to normal eth-wallet. However I should call a payable smart contract function instead.

It is possible that in your case you have to check argumetns you provide to smart contract function. Make sure you have set all the following args during tx sign:

{
  to: "0xaddress",
  nonce: "0x tx count",
  gasLimit: 1e10 in my case,  // (ganache-cli -l 10000000000)
  gasPrice: 1, // (ganache-cli -g 1)
  data: "0xSIGNATURE" + padLeft(address, 64, "0"),
  chainId: 1 // (ganache-cli  -i 1)
}

I use the following command line for testing:

ganache-cli --db c:\\_Job\\chain --port 3000 --host 127.0.0.1 -g 1 -l 9007199254740991 -v 9 -i 1 -s

@vsdigitall Ah, may be you met a different problem from me. In my situation, my code worked perfectly on rinkeby but not testrpc. It seems that testrpc does not work well with Byzantium update. It's ok, anyway thanks for your help 👍 . I think I should close this bug without a clear solution.

I have the same problem

How do you solve this problem because i was not having it previews week ?

please check i have created issue related with it because i don't know is it comming from "truffle-contract" or "truffle" or "genache-cli" or "genache-desktop-app"

https://github.com/trufflesuite/truffle/issues/748

this error appears when you don't add the "gas" parameter to "send" method. Too bad that it is not documented anywhere...

@JanezStupar this parameter is documented in at least two places. We don't include it in our docs because our goal is to represent the RPC standard which is already documented by the Ethereum foundation.

@poperechnyi1 and @Stradivario posts saying "I have the same problem" on already closed issues isn't very helpful to you or me. I'm not saying this because I want you to go away; quite the contrary! I'm thrilled to have you in our community. It's just that when you do this, you're not adding any new, actionable information. As the person responsible for fixing things, seeing this makes me feel a bit like this guy:

All long help threads should have a sticky globally-editable post at the top saying 'DEAR PEOPLE FROM THE FUTURE: Here's what we've figured out so far ...'

Given that this issue is closed now, I think you have two choices:

If you're new to ethereum development and still learning the ropes, it's quite likely that you're missing some nuance of the RPC interfance. I strongly recommend reading through the Ethereum Foundation's RPC API page, and asking for support over in the truffle gitter channel. As I write this, there are 2,720 people in that channel, many of whom are happy to help you step past common gotchas and pitfalls.

Otherwise, if you've been down that road and you're sure that you're not missing some nuance, I encourage you to raise a new issue. When doing this, please make sure to remember that I need enough information to reproduce the problem that you're having. If it helps, assume that I'm a complete noob when you write your issue, and spell it out to me in no uncertain terms. This is the best way to get me to fix your problem quickly.

Hope this helps.

It seems that testrpc does not work well with Byzantium update.

@sontuphan after reading through this issue more carefully, I think you closed it prematurely. I have seen very few issues with testrpc/ganache pertaining to the Byzantium update, but that doesn't mean that you haven't found one here. I'll have a look at this issue today.

@sontuphan some tips straight off - use solidity modifiers for isValidPoL and existedPoL

@sontuphan I can't reproduce this. See sontuphan/Proof-of-Loss#1. I added a test to try and reproduce this, and the test passes. If you want me to investigate further, please modify that test to reproduce the problem and repoen this issue.

Note that I ran this test on node 8.9.3 with a fresh install of truffle & ganache-cli. I also tested on Ganache 1.0.2 for good measure. If you're running a version of truffle older than v4.0.4 or ganache-cli older than v6.0.3, I recommend updating.

@benjamincburns really helpful, let me check again.

No problem, and sorry it took me so long to get back to you.

@benjamincburns hey man hope you can check if this is the same situation because more than 48 hours i cannot make it work... i created test repository where i am facing this bug.
https://github.com/trufflesuite/truffle/issues/748

Getting this error too. Would love to see it resolve.

In my case, It’s about your smartcontract, not ganache-cli. So please
review carefully your smartcontract again. If it’s still there, let me know
and I am willing to see your repo to investigate.

Vào Th 7, 27 thg 1, 2018 lúc 03:00 propercoil notifications@github.com đã
viết:

Getting this error too. Would love to see it resolve.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/trufflesuite/ganache-cli/issues/433#issuecomment-360889413,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AXRZKonURDYMUPZ80n8o3oC585UtatXSks5tOi7JgaJpZM4Qpmt6
.

I do not resolve this problem.

27 янв. 2018 г. 3:30 ДП пользователь "Phan Sơn Tự" notifications@github.com
написал:

In my case, It’s about your smartcontract, not ganache-cli. So please
review carefully your smartcontract again. If it’s still there, let me know
and I am willing to see your repo to investigate.

Vào Th 7, 27 thg 1, 2018 lúc 03:00 propercoil notifications@github.com
đã
viết:

Getting this error too. Would love to see it resolve.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
360889413>,
or mute the thread
AXRZKonURDYMUPZ80n8o3oC585UtatXSks5tOi7JgaJpZM4Qpmt6>
.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/trufflesuite/ganache-cli/issues/433#issuecomment-360948634,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AJBt1vjiG2COp5I9S7Y42Az6asNrudyoks5tOnwlgaJpZM4Qpmt6
.

I'm afraid that I need to lock this issue, as the original issue submitted by @sontuphan has been resolved. There are lots and lots of possible reasons why contract calls revert, and there's no possible way that I can sort them all out here.

If you're finding this issue via search and wishing you could leave a comment, I recommend first asking for help on gitter. After asking on gitter, if you're confident that you're experiencing a bug in Ganache, please raise a new issue.

Was this page helpful?
0 / 5 - 0 ratings