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

Use proxies from OpenZeppelin Contracts 4.8.3 #795

Merged
merged 8 commits into from
May 12, 2023

Conversation

ericglau
Copy link
Member

@ericglau ericglau commented May 11, 2023

Closes #774
Closes #773
Closes #772
Closes #771

Updates proxies in order to use updated TransparentUpgradeableProxy from OpenZeppelin Contracts 4.8.3.

Note: Using this version of the plugin to verify a proxy that was deployed by a previous version of the plugin will fail. See #674 for details. Users who are affected should downgrade the plugins to the previous version, run the verify task, then upgrade the plugins back to the latest version.

@socket-security
Copy link

socket-security bot commented May 11, 2023

New dependency changes detected. Learn more about Socket for GitHub ↗︎


👍 No new dependency issues detected in pull request

Bot Commands

To ignore an alert, reply with a comment starting with @SocketSecurity ignore followed by a space separated list of package-name@version specifiers. e.g. @SocketSecurity ignore foo@1.0.0 bar@* or ignore all packages with @SocketSecurity ignore-all

Pull request alert summary
Issue Status
Install scripts ✅ 0 issues
Native code ✅ 0 issues
Bin script shell injection ✅ 0 issues
Unresolved require ✅ 0 issues
Invalid package.json ✅ 0 issues
HTTP dependency ✅ 0 issues
Git dependency ✅ 0 issues
Potential typo squat ✅ 0 issues
Known Malware ✅ 0 issues
Telemetry ✅ 0 issues
Protestware/Troll package ✅ 0 issues

📊 Modified Dependency Overview:

⬆️ Updated Package Version Diff Added Capability Access +/- Transitive Count Publisher
@openzeppelin/contracts@4.8.3 4.1.0...4.8.3 None +0/-0 frangio
@openzeppelin/contracts-upgradeable@4.8.3 4.1.0...4.8.3 None +0/-0 frangio

@ericglau ericglau requested a review from frangio May 11, 2023 15:16
packages/core/CHANGELOG.md Outdated Show resolved Hide resolved
packages/plugin-hardhat/CHANGELOG.md Outdated Show resolved Hide resolved
packages/plugin-truffle/CHANGELOG.md Outdated Show resolved Hide resolved
const TransparentUpgradeableProxyFactory = await getTransparentUpgradeableProxyFactory(hre, signer);
const proxy = TransparentUpgradeableProxyFactory.attach(proxyAddress);
// No admin contract: use ITransparentUpgradeableProxyFactory to get proxiable interface
const ITransparentUpgradeableProxyFactory = await getITransparentUpgradeableProxyFactory(hre, signer);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason for this change?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I remember now, and I understand why this was done.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commenting for completeness:

The upgradeProxy function in the plugins invokes the upgradeToAndCall or upgradeTo function on the proxy, regardless of whether it is a UUPS or Transparent proxy. It did this by using TransparentUpgradeableProxy's contract factory to encode those functions, which depends on the ABI. (Note this also works for UUPS proxies because those function signatures are the same between UUPS and Transparent).

In OpenZeppelin Contracts 4.8.3, the upgradeToAndCall and upgradeTo functions are not part of TransparentUpgradeableProxy's ABI, but are in the interface ITransparentUpgradeableProxy's ABI. Therefore, we use ITransparentUpgradeableProxy's contract factory to encode those functions instead.

ericglau and others added 3 commits May 11, 2023 22:16
Co-authored-by: Francisco <fg@frang.io>
Co-authored-by: Francisco <fg@frang.io>
Co-authored-by: Francisco <fg@frang.io>
@ericglau ericglau requested a review from frangio May 12, 2023 02:27
@ericglau ericglau changed the title Use proxies from Contracts 4.8.3 Use proxies from OpenZeppelin Contracts 4.8.3 May 12, 2023
Copy link
Contributor

@frangio frangio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ericglau ericglau merged commit a4840ea into OpenZeppelin:master May 12, 2023
@ericglau ericglau deleted the transparent branch May 12, 2023 02:32
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