Open ProphetDaniel opened 6 years ago
@ProphetDaniel thanks for the report! It's odd, since proxies should not interfere with Ownable. Could you share the actual code of your contracts?
@spalladino You can check running tests on the unstructured_storage
branch: https://github.com/CCEG-Blockchain-UN-Lab/upgradeable-proxy-plus/tree/unstructured_storage
@ProphetDaniel the issue you're having is caused by using openzeppelin-solidity Ownable
, instead of the one from openzeppelin-zos. The former sets the owner
state variable in the constructor, while the latter has a separate initializer method to set it, which you should be using.
What's happenning is the following:
owner
of the contract as that addressowner
state variable in its own storage which was never initialized so it is the zero addressTo fix this, make sure your contracts inherit from the openzeppelin-zos Ownable implementation, and explicitly call initialize
in your proxy with the address that should be the owner. This doc has more info on the initializer vs constructor differences.
Let me know if this works!
Also, and if you don't mind me asking: why are you using the Proxy contracts directly, instead of via the ZeppelinOS CLI? Do you have any particular use case that doesn't fit?
If you try to call a method from the proxy with unstructured upgradeability pattern as follows:
It gives you an error:
But if you call directly without the proxy it works:
Or if you edit the contract and remove onlyOwner from the metod then still call by proxy it also works.