Suppose we have a contact like this:
contract x {
function y() external
{
// do some magic!
if (some_condition) {
another_contract_address.call(abi.encodeWithSignature("another_contract_func()"));
}
}
}
which does something in a function y
and then dynamically calls another method of another contract as its last sentence under specific conditions. As far as I know, all the remaining gas of the caller contract will be used for executing the callee function. Regarding the fact that this dynamic call is the last expression in y
, what will happen if this dynamic call exhausts all the remaining gas? Does the transaction finish successfully (due to the fact that the RETURN
opcode uses 0 gas) or it will be failed with an out of gas error?