1

ZeppelinOS has adopted the unstructured storage proxy pattern to upgrade contracts.

In the blog post that introduces this pattern, they say:

"The only thing you will have to care about is that further versions of your contract have to follow the storage structure of the previous ones."

What does it mean to follow the structure? And why is it that we have to follow the structure?

3

This is because Solidity sets up the variables in storage sequentially. So if you move the references of storage variables in the upgraded one, they'll be referring to the wrong slot in storage. Here's an example:

contract StorageOriginal {
    uint public first = 10;
    uint public second = 20;
}

and

contract StorageNew {
    uint public second;
    uint public first;
}

So if you upgrade from StorageOrignal to StorageNew, second will read 10 and first will read 20.

Your Answer

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

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