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?

Ari Fordsham
  • 121
  • 4

1 Answers1

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.

Bigbrotha
  • 771
  • 3
  • 7