Hey all - quick technical question. Seems like using openzeppelin-upgrades
still won't allow you to change variable names, even though it can correctly identify them. Theoretically, this means that the storage under the hood would work, even though OZ disallows it.
My question is: If these are the only errors shown, is it safe to move ahead with the upgrade?
For more context, I use this ProxyBeaconFactory implementation, and unfortunately didn't use deployBeaconProxy
, deployBeacon
, etc, so I can't really use the OZ-upgrades package (unless there's a way to post-hoc create the necessary JSON...?).
I'm trying to now upgrade that Beacon, and I use a pattern more or less like the following:
export const deployUpgrade = async (
hre: HardhatRuntimeEnvironment,
contractName: string,
upgradedContractName: string
) => {
cpOzDeployment(hre, contractName);
const chainId = hre.network.config.chainId as number;
const contract = accessors.getInstance(chainId, contractName);
const Contract = await hre.ethers.getContractFactory(upgradedContractName);
await hre.upgrades.upgradeProxy(contract.address, Contract);
// Want the abi to be accurate
await makeUpgradeableDeployment(hre, contract.address, contractName);
console.log(`Upgraded the UUPS for ${contractName}.`);
};
To ensure this won't break anything, I essentially did a quick test:
// Make a test beacon
const beacon = await hre.upgrades.deployBeacon(await hre.ethers.getContractFactory(contractV1))
// Upgrade
hre.upgrades.upgradeBeacon(beacon.address, await hre.ethers.getContractFactory(contractV2)
And was returned New storage layout is incompatible
, with every error being a:
Renamed `X` to `_X`
When looking at the docs, it seems as though unsafeAllowRenames
is a valid Common Option
, yet it doesn't seem to be used in any of those interfaces.
Thoughts?