1

Reading the yellow paper http://yellowpaper.io/ documentation for CALL.

µ'_s[0] ≡ x where x = 0 if the code execution for this operation failed due to an exceptional halting, Z(σ, µ, I) = > or if µs[2] > σ[Ia]b (not enough funds) or Ie = 1024 (call depth limit reached); x = 1 otherwise.

Would all of these cases cause an exception and halt execution, therefore preventing CALL from returning?

It's like dropping a nuclear bomb with a greeting card attached... useless because the greeting card is gone on impact.

2

Would all of these cases cause an exception and halt execution, therefore preventing CALL from returning?

It stops the code being CALLed from continuing, but it returns control to the caller with a zero return value (indicating failure).

You can try it out in Remix:

pragma solidity ^0.4.19;

contract Fail {
    function fail() public {
        revert();
    }
}

contract TestCall {
    Fail f = new Fail();

    // This will revert.
    function test1() public {
        f.fail();
    }

    // This transaction will succed, but the CALL returns 0.
    function test2() public {
        f.call(bytes4(keccak256("fail()")));
    }
}

Oh, and I think you phrased your question backwards, but the answer to "Under what circumstance does CALL return nonzero?" is "When the CALL succeeds."

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.