openzeppelin-contracts icon indicating copy to clipboard operation
openzeppelin-contracts copied to clipboard

Contract ... is not upgrade safe

Open Zohar97 opened this issue 1 year ago • 3 comments

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

Zohar97 avatar Sep 16 '24 05:09 Zohar97

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.

Amxx avatar Sep 16 '24 14:09 Amxx

@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 avatar Sep 18 '24 12:09 vmaark

@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

Zohar97 avatar Sep 19 '24 04:09 Zohar97

closing as it's out of scope. reference: https://github.com/matter-labs/zksync-cli/issues/173

cairoeth avatar Oct 27 '24 11:10 cairoeth