Exception "run out of gas"

tcimolitcimoli Cagliari - ItalyMember Posts: 35
edited May 2016 in Solidity
Here, in the development tutorial, it says:

"During contract execution, when a contract sends a message, that message call itself comes with a gas limit, and the sub-execution works the same way (namely, it can either run out of gas and revert or execute successfully and return a value). If sub-execution runs out of gas, the parent execution continues; thus, it is perfectly "safe" for a contract to call another contract if you set a gas limit on the sub-execution. If sub-execution has some gas remaining, then that gas is returned to the parent execution to continue using."

I tried to invoke a method on a SecondContract imposing a gas limit, like this:
secondContract.recursiveCall.gas(520000)();
but:

1) firstly how do I know if it has run out of gas, since no return code is provided?
2) and, secondly, it does nt work. Unfortunately, when it runs out of gas, the exception is forwarded up and the current execution is stopped.
So, is the tutorial wrong?
Post edited by tcimoli on

Comments

Sign In or Register to comment.