When using delegate call I was under the impression that storage slots declared in the proxy will be overwritten by the implementation.
Unstructured storage implementations declare bytes32 variables that indicate the storage position within the proxy to find owners, implementations etc.
Why aren't these bytes32 variables being overwritten when a transaction is delegated to the implementing contract? The examples of implementing contracts don't seem to take into account these variables already declared.
contract OwnedUpgradeabilityProxy is Proxy {
bytes32 private constant ownerPosition = keccak256("org.zeppelinos.proxy.owner");
bytes32 private constant implementationPosition = keccak256("org.zeppelinos.proxy.implementation");
function upgradeTo(address newImplementation) public onlyProxyOwner {
address currentImplementation = implementation();
setImplementation(newImplementation);
}
function implementation() public view returns (address impl) {
bytes32 position = implementationPosition;
assembly { impl := sload(position) }
}