-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
Unreachable code warning for internal function called by an abstract contract #15426
Comments
The error you're seeing is due to the combination of overriding the _authorizeUpgrade function and the UUPSUpgradeable contract setup. UUPSUpgradeable: The _authorizeUpgrade function is required in the UUPS proxy pattern, and it controls which addresses are authorized to upgrade the contract. How to fix it: Here are a few options to resolve the issue: Option 1: Allow upgrades only for the owner function _authorizeUpgrade(address newImplementation) internal override onlyOwner { If you're sure you want to keep the upgrade path blocked, then there's nothing wrong with your code as-is. If this was unintended and you want to perform upgrades, use option 1. |
Description
During compilation of a UUPSUpgradeable contract we receive the following 'Unreachable code' warning:
The unreachable function is a private function that is called within an abstract contract so it doesn't apply to the bug where a pure internal function is called by an abstract contract.
Environment
Steps to Reproduce
Create a simple upgradable contract that is
UUPSUpgradeable
and try to compile it.Use the following version of Openzeppelin packages
The following warning should be produced
The text was updated successfully, but these errors were encountered: