From be92d6c4c560faf6c12150d017909e79a3f601b6 Mon Sep 17 00:00:00 2001 From: timbrinded <79199034+timbrinded@users.noreply.github.com> Date: Mon, 22 Jan 2024 19:20:09 +0000 Subject: [PATCH] upgrade fix --- .changeset/silly-impalas-suffer.md | 5 +++++ packages/cli/src/lib/upgradeProcedures.ts | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 .changeset/silly-impalas-suffer.md diff --git a/.changeset/silly-impalas-suffer.md b/.changeset/silly-impalas-suffer.md new file mode 100644 index 00000000..d1ff34bc --- /dev/null +++ b/.changeset/silly-impalas-suffer.md @@ -0,0 +1,5 @@ +--- +"@moonwall/cli": patch +--- + +Fix upgrades diff --git a/packages/cli/src/lib/upgradeProcedures.ts b/packages/cli/src/lib/upgradeProcedures.ts index 4f74da9e..58cac288 100644 --- a/packages/cli/src/lib/upgradeProcedures.ts +++ b/packages/cli/src/lib/upgradeProcedures.ts @@ -75,7 +75,7 @@ export async function upgradeRuntime(api: ApiPromise, preferences: UpgradePrefer log("Using governance..."); // TODO: remove support for old style after all chains upgraded to 2400+ const proposal = - parseInt(((api.consts.system.version as any).specVersion as u32).toString()) >= 2400 + api.consts.system.version.specVersion.toNumber() >= 2400 ? (api.tx.parachainSystem as any).authorizeUpgrade(blake2AsHex(code), false) : (api.tx.parachainSystem as any).authorizeUpgrade(blake2AsHex(code)); const encodedProposal = proposal.method.toHex(); @@ -123,7 +123,7 @@ export async function upgradeRuntime(api: ApiPromise, preferences: UpgradePrefer ref[1].unwrap().asOngoing.proposal.asLookup.hash.toHex() == encodedHash ) .map((ref) => - parseInt(api.registry.createType("u32", ref[0].toU8a().slice(-4)).toString()) + api.registry.createType("u32", ref[0].toU8a().slice(-4)).toNumber() )?.[0] : referendum .filter( @@ -132,7 +132,7 @@ export async function upgradeRuntime(api: ApiPromise, preferences: UpgradePrefer (ref[1].unwrap().asOngoing as any).proposalHash.toHex() == encodedHash ) .map((ref) => - parseInt(api.registry.createType("u32", ref[0].toU8a().slice(-4)).toString()) + api.registry.createType("u32", ref[0].toU8a().slice(-4)).toNumber() )?.[0]; if (referendaIndex !== null && referendaIndex !== undefined) {