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 is not a ProxyAdmin contract when deploying a transparent proxy #1083

Merged
merged 15 commits into from
Sep 23, 2024

Conversation

ericglau
Copy link
Member

@ericglau ericglau commented Sep 20, 2024

With OpenZeppelin Contracts v5, the initialOwner 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 when deploying a transparent proxy 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.

Hardhat equivalent of OpenZeppelin/openzeppelin-foundry-upgrades#76

Copy link

socket-security bot commented Sep 20, 2024

New and removed dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/sinon@19.0.2 None +2 5.84 MB cjohansen, fatso83, mantoni, ...1 more

🚮 Removed packages: npm/@openzeppelin/upgrades-core@1.37.1

View full report↗︎

@ericglau ericglau requested a review from a team September 20, 2024 19:45
@ericglau ericglau enabled auto-merge (squash) September 23, 2024 18:05
@ericglau ericglau merged commit ed565f4 into OpenZeppelin:master Sep 23, 2024
10 of 11 checks passed
@ericglau ericglau deleted the transparentowner branch September 23, 2024 18:13
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