mirror of
https://github.com/selfxyz/self.git
synced 2026-01-10 23:27:56 -05:00
fix: upgrade script now correctly handles pre-defined versions in registry
When upgrading to a version that already exists in registry.json (like 2.12.0), the script now uses that version's initializerVersion instead of incrementing from the latest version. This fixes the reinitializer validation for the governance upgrade.
This commit is contained in:
@@ -34,6 +34,7 @@ import {
|
||||
createGitTag,
|
||||
gitCommit,
|
||||
getLatestVersionInfo,
|
||||
getVersionInfo,
|
||||
getGovernanceConfig,
|
||||
validateReinitializerVersion,
|
||||
} from "./utils";
|
||||
@@ -310,8 +311,14 @@ task("upgrade", "Deploy new implementation and create Safe proposal for upgrade"
|
||||
// ========================================================================
|
||||
log.step("Checking reinitializer version...");
|
||||
|
||||
// Check if target version already exists in registry
|
||||
const targetVersionInfo = getVersionInfo(contractId, newVersion);
|
||||
const latestVersionInfo = getLatestVersionInfo(contractId);
|
||||
const expectedInitializerVersion = (latestVersionInfo?.info.initializerVersion || 0) + 1;
|
||||
|
||||
// If target version exists, use its initializerVersion; otherwise increment latest
|
||||
const expectedInitializerVersion = targetVersionInfo
|
||||
? targetVersionInfo.initializerVersion
|
||||
: (latestVersionInfo?.info.initializerVersion || 0) + 1;
|
||||
|
||||
if (contractFilePath) {
|
||||
const reinitValidation = validateReinitializerVersion(contractFilePath, expectedInitializerVersion);
|
||||
|
||||
Reference in New Issue
Block a user