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

Contract ... is not upgrade safe #5203

Open
Zohar97 opened this issue Sep 16, 2024 · 3 comments
Open

Contract ... is not upgrade safe #5203

Zohar97 opened this issue Sep 16, 2024 · 3 comments

Comments

@Zohar97
Copy link

Zohar97 commented Sep 16, 2024

I'm using zksync-cli to create project and compile proxy contract which inherist UUPSUpgradeable and got this error:
Variable __self is assigned an initial value
Move the assignment to the initializer

Checking on UUPS lib, i see address private immutable __self = address(this);
By checking OZ docs, i got "It is still ok to define constant state variables, because the compiler does not reserve a storage slot for these variables, and every occurrence is replaced by the respective constant expression. So the following still works with OpenZeppelin Upgrades:" but in this way, this __self variable is immutable, and it got warning from zksync deployment.

What should i do?
openzeppelin-contracts-upgradeable: 5.0.2

@Amxx
Copy link
Collaborator

Amxx commented Sep 16, 2024

Hello @Zohar97

This looks like a false positive from the zksync-cli. It looks like their system does not understand the use of an immutalbe variable that is shared by all proxy instances here.

@vmaark
Copy link

vmaark commented Sep 18, 2024

@Zohar97 I ran into the same issue, it was caused by importing Deployer from @matterlabs/hardhat-zksync instead of @matterlabs/hardhat-zksync-deploy in my deploy script.

@Zohar97
Copy link
Author

Zohar97 commented Sep 19, 2024

@Zohar97 I ran into the same issue, it was caused by importing Deployer from @matterlabs/hardhat-zksync instead of @matterlabs/hardhat-zksync-deploy in my deploy script.

@vmaark i have try to import Deployer from @matterlabs/hardhat-zksync-deploy but got same issue

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

No branches or pull requests

3 participants