Skip to content
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

Add check to ensure initialOwner for deployTransparentProxy is not a ProxyAdmin #76

Merged
merged 14 commits into from
Sep 20, 2024

Conversation

ericglau
Copy link
Member

With OpenZeppelin Contracts v5, the initialOwner parameter when deploying a transparent proxy must not be a predeployed ProxyAdmin contract. The transparent proxy deploys its own ProxyAdmin using this initialOwner as the owner, therefore the initialOwner must be an EOA or a contract that is able to call functions on a ProxyAdmin.

This PR adds the following check: if the initialOwner is a contract that has an owner() getter which returns something that looks like an address, it might be a ProxyAdmin contract. In this case, throw an error.

It may have false positives if the initialOwner is some other contract (such as a smart account) which has an owner. If this false positive occurs and the user is sure that the initialOwner is a contract that can invoke functions on a ProxyAdmin but is not a ProxyAdmin itself, this check can be skipped with the unsafeSkipProxyAdminCheck option.

@ericglau ericglau requested a review from a team September 18, 2024 18:25
@ericglau ericglau merged commit b3b285b into OpenZeppelin:main Sep 20, 2024
3 checks passed
@ericglau ericglau deleted the transparentowner branch September 20, 2024 14:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants