-
Notifications
You must be signed in to change notification settings - Fork 271
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
'incorrect-initializer-order' warning fires spuriously for nested initializers #1121
Comments
Thanks for reporting, we will investigate this further.
For example:
|
Thank you @ericglau for the prompt and helpful suggestion! Have successfully used your suggestion to silence the warnings for now. |
I get
when I try to upgrade from v1 to v2 of the smart contract. This error happens when
is executed. |
@vladimir-trifonov Can you please open a separate issue, and include what your |
What we observed
Since updating @openzeppelin/upgrades-core from 1.33.1 to 1.41.0, we have encountered a barrage of spurious warnings in the
npx hardhat test
logs.This warning is repeated in our test logs at least 20 times. See the Github CI logs for the 'Run smart contract tests and generate coverage report' job.
Conceptual description of issue
When we looked into issue, it seems that @openzeppelin/upgrades-core will only recognise parent initializers declared in the top-level initializer as expected parent contract initializers.
A discrepancy occurs when @openzeppelin/upgrades-core will recognise all parent initializers as found parent contract initializers.
The discrepancy in scope between expected and found causes this error to fire spuriously in cases where a nested initializer is present (and not declared in the top-level initializer).
Code example
Top-level contract
Inherited/Parent contract
In this case RateLimiter is outside of the scope of the expected initializers, but is in scope of the found initializers. This triggers a spurious warning in our opinion.
Fixes explored
Putting
/// @custom:oz-upgrades-unsafe-allow incorrect-initializer-order
on top of each 'offending' initializer does silence the warnings. But we disagree with needing to modify the source code to silence spurious warnings, since modifying source code incurs a financial cost for re-audits of production code.The text was updated successfully, but these errors were encountered: