-
Notifications
You must be signed in to change notification settings - Fork 11.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
About proxyAdmin for TransparentUpgradeableProxy.sol #5149
Comments
Hi @idyllsss, We had a long discussion around this and concluded that both contracts are tightly coupled since the ProxyAdmin can't do other than upgrade its corresponding proxy and the proxy doesn't allow the admin to interact in any other way. The case where a Let me know if that works! |
@ernestognw Hey, also just stumbled over this. For us the usecase is slightly different. With the new method of having a forced ProxyAdmin per |
Got it. So the Although this is the default behavior, I'd recommend overriding the // SPDX-License-Identifier: MIT
pragma solidity ^0.8.22;
import {TransparentUpgradeableProxy} from "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol";
import {ERC1967Utils} from "../ERC1967/ERC1967Utils.sol";
contract TransparentUpgradeableProxyCustomAdmin is TransparentUpgradeableProxy {
function _proxyAdmin() internal view override returns (address) {
return ERC1967Utils.getAdmin();
}
} This should be enough customization to enable changing the admin. You may need another mechanism to change the admin (e.g. I suggest using ERC1967Utils.changeAdmin), just consider that exposing another function in the proxy may compromise its transparency by introducing a small chance of collision. Of course you can use an alternative method to store the admin. |
🧐 Motivation
My concern is whether it is reasonable to forcibly generate a new
ProxyAdmin
in the constructor ofTransparentUpgradeableProxy.sol
:📝 Details
https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/proxy/transparent/TransparentUpgradeableProxy.sol
If I want to use a
TimelockController
as theProxyAdmin
, it becomes very difficult. The contract's extensibility seems to be reduced.The text was updated successfully, but these errors were encountered: