Skip to content

Commit

Permalink
upgrade fix
Browse files Browse the repository at this point in the history
  • Loading branch information
timbrinded committed Jan 22, 2024
1 parent 6362bbd commit be92d6c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/silly-impalas-suffer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@moonwall/cli": patch
---

Fix upgrades
6 changes: 3 additions & 3 deletions packages/cli/src/lib/upgradeProcedures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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(
Expand All @@ -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) {
Expand Down

0 comments on commit be92d6c

Please sign in to comment.