Hey guys I have a few questions about delegatecall.

The setup: I have 2 contracts A and B.

  • A has 2 uint state variables

  • B has 4 uint state variables

  • To ensure storage layout compatibility, B inherits A.

Questions: If A delegatecalls B and updates B's 3rd or 4th state variable:

  • Is there a risk that the update will affect/overwrite the wrong memory slot (the inheritance should prevent A's state variable from being overwritten)?
  • When the updated state is written to disk, will it persist correctly?

  • Should i worry about different client implementations (Geth, Parity, ganache...)

  • Can you put the source code with the inheritance relationship? As long as they are compatible they don't have inherit from each other. – Ismael Jan 7 at 18:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.