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

Fix revert when getting upgrade interface version with OpenZeppelin Contracts v4 #65

Merged
merged 6 commits into from
Aug 14, 2024

Conversation

ericglau
Copy link
Member

@ericglau ericglau commented Aug 13, 2024

When upgrading a proxy, we need to determine the upgrade interface version of the UUPS implementation or proxy admin. This is done by calling the UPGRADE_INTERFACE_VERSION() getter, which exists in OpenZeppelin Contracts v5, but does not exist in v4 and a revert is expected in that case.

We previously did this with a low-level call and checked whether the call was successful. However, even though we handle the error case for v4 (in which case we return an empty string), Foundry detects this revert and fails the simulation prior to broadcasting.

We can avoid this revert detection by converting this to use try/catch staticcall instead.

Fixes #64

@ericglau ericglau requested a review from a team August 13, 2024 20:10
@frangio
Copy link

frangio commented Aug 13, 2024

Isn't this a Foundry bug?

@ericglau
Copy link
Member Author

Opened an issue in foundry-rs/foundry#8662. We can determine how to proceed with this PR based on that.

@ericglau ericglau requested a review from frangio August 14, 2024 18:12
Copy link

@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.

Looks good though I would add the test above.

@ericglau ericglau merged commit 1f6690a into OpenZeppelin:main Aug 14, 2024
3 checks passed
@ericglau ericglau deleted the 64 branch August 14, 2024 20:56
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.

ProxyAdmin::UPGRADE_INTERFACE_VERSION() not present for LegacyUpgrades
2 participants