0

I'm reading the yellow paper, but there are several aspects of how the EVM execution model is initialized for each message call transaction that aren't really clear. Where does the message call data go? Does it become the initial stack contents or memory contents? Whichever it becomes, is the other just initialized to zero?

Also, does the program counter always initialize to zero? I don't see anywhere in the transaction structure that allows you to initialize it to something else. I guess this would mean that one contract is like one function in a "traditional" procedural programming sense, but with a wei balance and dedicated storage attached.

1 Answer 1

1

The initial EVM state is described in section 9.4 of the Yellow Paper (although it's not explained there, as with so many things in the YP).

enter image description here

So, the program counter, the memory and the stack are all zero/empty at call invocation.

Message data (I_d) exists separately - it doesn't "go" anywhere unless a contract explicitly copies it into memory (using CALLDATALOAD to move some of it to the stack or CALLDATACOPY to move some of it to 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.