OpenZeppelin / openzeppelin-upgrades

Plugins for Hardhat and Foundry to deploy and manage upgradeable contracts on Ethereum.
MIT License
629 stars 270 forks source link

Validate proxy and proxyadmin owner before sending a transaction #84

Open spalladino opened 4 years ago

spalladino commented 4 years ago

If the current sender does not own the ProxyAdmin, they get a revert with an Ownable error:

Error: Returned error: VM Exception while processing transaction: revert Ownable: caller is not the owner -- Reason given: Ownable: caller is not the owner.

As a nice to have, we could prevent this by checking if the sender is the owner of the proxyadmin before sending the tx. And since we're at it, we can also check that the proxy to upgrade is indeed owned by the proxyadmin.

frangio commented 4 years ago

And since we're at it, we can also check that the proxy to upgrade is indeed owned by the proxyadmin.

I believe this is already being checked.

https://github.com/OpenZeppelin/openzeppelin-upgrades/blob/db8c1c06c5abfb3c4a207e9b435eeea975cbf948/packages/plugin-buidler/src/upgrade-proxy.ts#L53-L55