Timeline for is there any advantage of using inline assembly call over address.call?
Current License: CC BY-SA 4.0
9 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Mar 4, 2020 at 5:10 | vote | accept | tsknakamura | ||
| Mar 3, 2020 at 15:49 | history | edited | sea212 | CC BY-SA 4.0 | Described possibility to specify gas in non-assembly call |
| Mar 3, 2020 at 12:46 | comment | added | goodvibration | @sea212: Feel free to edit the answer and add your findings/insights. | |
| Mar 3, 2020 at 12:40 | comment | added | sea212 | I checked the solidity docs for Solidity 0.4.15 (which they used when they created the contract) and to my astonishment, it was indeed not possible to return the output data at that time. Nevertheless it was possible to configure the supplied gas by appending .gas(gas), e.g. address.call.value(value).gas(gas)(data). Quote: call returns a boolean indicating whether the invoked function terminated (true) or caused an EVM exception (false). It is not possible to access the actual data returned (for this we would need to know the encoding and size in advance). | |
| Mar 3, 2020 at 12:32 | comment | added | goodvibration | @sea212: Of course, but the point of the question was to ask about any possible advantage in using assembly call over Solidity address.call.value, which is what I was trying to answer here. Also, please note that the contract in question was implemented in Solidity 0.4, so any extension of address.call.value in later versions is not really relevant in this context (i.e., should not be considered as part of the answer IMO). | |
| Mar 3, 2020 at 12:21 | comment | added | sea212 | They are equivalent, except that you pass ether to a payable function. address.call.value(val)(data) is the Solidity <0.6.0 version of Solidity >=0.6.0 address.call{value: val}(data). In both cases they use the high level call I posted in the first comment and therefore in both cases they return a bool indicating the success of the execution and bytes containing the return data. You can test this in remix. What would be the point of a general call that does not offer the possibility to inspect the results? | |
| Mar 3, 2020 at 11:54 | comment | added | goodvibration | @sea212: The question is about address.call.value, not address.call. | |
| Mar 3, 2020 at 11:47 | comment | added | sea212 | You can also obtain the output with the high-level call: <address>.call(bytes memory) returns (bool, bytes memory): issue low-level CALL with the given payload, returns success condition and return data, forwards all available gas, adjustable | |
| Mar 3, 2020 at 11:16 | history | answered | goodvibration | CC BY-SA 4.0 |