1

When reading the data returned by CALLing another contract, RETURNDATASIZE and RETURNDATACOPY opcodes are used. They allow moving the data from an otherwise unreachable context to the memory, so it can be consumed.

The CALL opcode accepts parameters retOffset and retSize. According to https://www.evm.codes/ they are dealing with the same problem:

retOffset: byte offset in the memory in bytes, where to store the return data of the sub context.

retSize: byte size to copy (size of the return data).

What are these parameters used for?

Why nobody seems to be using them? It seems that everybody just passes two 0s and then uses RETURNDATASIZE and RETURNDATACOPY to get the return data.

Are RETURNDATASIZE and RETURNDATACOPY a newer, more flexible approach? retSize seems difficult to work with dynamically sized data. Can retOffset and retSize still be used?

1 Answer 1

0

As I was writing the question I've stumbled upon https://eips.ethereum.org/EIPS/eip-211.

The retOffset and retSize approach is still working. It accepts the memory area into which the return data will be copied. If the area is too small, the data is truncated.

Nobody uses this approach anymore, because it's too inflexible. People just pass two 0s to accept 0 bytes of return data to be copied into the memory.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.