In solc 0.4.22 onward, it is possible to provide a string message containing details about the error that will be passed back to the caller (in require
, assert
and revert
statements).
Does the gas usage of these statements depend on the length of the provided string?
I assume that the answer is no, since it would otherwise imply that this information is saved on the blockchain, and AFAIK, reverted transactions are not saved on the blockchain.
If I am correct, then it means that it's the Ethereum node itself which somehow knows how to return this message back to the caller.
Am I correct, and if yes, how exactly is the Ethereum node able to do that? To my understanding, it would need to get the revert
opcode (in the case of require
and revert
) or the invalid
opcode (in case of assert
) returned from the transaction, and determine exactly where they occurred within the code.
Also, if this is indeed the case, then it means that the deployed bytecode should contain the message, meaning that the gas cost of the contract-deployment itself depends on the length of this message. Is that correct?
Thank you!