2

Section 8 of the yellow paper says as follows:

In the case of executing a message call, several parameters are required: sender (s), transaction originator (o), recipient (r), the account whose code is to be executed (c, usually the same as recipient)...

Under what conditions would r and c differ? In other words, when would code be executed from an account other than the recipient?

EDIT:

I have seen in the Bytecode spec (Appendix H) that there is a DELEGATECODE instruction that explicitly does this, i.e. calls code from account a against account b. In what contexts is this useful?

1 Answer 1

3

Unless I misunderstood that section, this would be in the case in a delegate call where contract A executes bytecode of contract B but uses contract A's context. This can have many applications but one of the most interesting ones is in proxy "Upgradable" contract where the proxy maintains storage for contract state while the implementation logic is handled by another contract. This makes it possible to upgrade a contract by keeping the proxy with its current state but changing the implementation contract to another with different bytecode.

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.