From e52b29bee66b66071b3afd7e48a2c47669996a7f Mon Sep 17 00:00:00 2001 From: Tim B <79199034+timbrinded@users.noreply.github.com> Date: Thu, 22 Feb 2024 09:19:40 +0000 Subject: [PATCH] small fix (#385) --- packages/cli/package.json | 2 +- packages/cli/src/lib/governanceProcedures.ts | 43 +++++++++----------- packages/types/package.json | 2 +- packages/util/package.json | 2 +- 4 files changed, 22 insertions(+), 27 deletions(-) diff --git a/packages/cli/package.json b/packages/cli/package.json index de0f5ed8..66cb2a7b 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -47,7 +47,7 @@ ], "scripts": { "clean": "rm -rf dist && rm -rf node_modules", - "build": "pnpm exec rm -rf dist && tsup src --format esm --no-splitting && pnpm generate-types", + "build": "pnpm exec rm -rf dist && tsup src --format esm --no-splitting --sourcemap && pnpm generate-types", "lint": "pnpm biome lint ./src", "lint:fix": "pnpm biome lint ./src --apply", "fmt": "biome format .", diff --git a/packages/cli/src/lib/governanceProcedures.ts b/packages/cli/src/lib/governanceProcedures.ts index 1218fa11..23bce5ff 100644 --- a/packages/cli/src/lib/governanceProcedures.ts +++ b/packages/cli/src/lib/governanceProcedures.ts @@ -29,7 +29,7 @@ export const TECHNICAL_COMMITTEE_THRESHOLD = Math.ceil( ); export const OPEN_TECHNICAL_COMMITTEE_MEMBERS: KeyringPair[] = [alith, baltathar]; export const OPEN_TECHNICAL_COMMITTEE_THRESHOLD = Math.ceil( - (TECHNICAL_COMMITTEE_MEMBERS.length * 2) / 3 + (OPEN_TECHNICAL_COMMITTEE_MEMBERS.length * 2) / 3 ); // TODO: Refactor to support both instant sealing and parachain environment @@ -137,7 +137,9 @@ export const whiteListedTrack = async < console.log(`🏛️ Referendum submitted with proposal id: ${proposalId}`); await context.createBlock(context.pjsApi.tx.referenda.placeDecisionDeposit(proposalId)); - await execOpenTechCommitteeProposal(context, proposalHash); + + const whitelistCall = context.pjsApi.tx.whitelist.whitelistCall(proposalHash); + await execOpenTechCommitteeProposal(context, whitelistCall); await maximizeConvictionVotingOf(context, [ethan], proposalId); await context.createBlock(); @@ -147,16 +149,18 @@ export const whiteListedTrack = async < }; // Creates a OpenTechCommitteeProposal and attempts to execute it -export const execOpenTechCommitteeProposal = async ( +export const execOpenTechCommitteeProposal = async < + Call extends SubmittableExtrinsic, + ApiType extends ApiTypes, +>( context: DevModeContext, - polkadotCallHash: string, + call: Call | string, voters: KeyringPair[] = OPEN_TECHNICAL_COMMITTEE_MEMBERS, threshold: number = OPEN_TECHNICAL_COMMITTEE_THRESHOLD ) => { - const whitelistCall = context.pjsApi.tx.whitelist.whitelistCall(polkadotCallHash).method.toHex(); const openTechCommitteeProposal = context.pjsApi.tx.openTechCommitteeCollective.propose( threshold, - whitelistCall, + call, 100 ); const { result: result2 } = await context.createBlock(openTechCommitteeProposal, { @@ -197,27 +201,18 @@ export const execOpenTechCommitteeProposal = async ( // Close proposal const result = await context.createBlock( - [ - context.pjsApi.tx.openTechCommitteeCollective.close( - openTechProposal, - openTechProposalIndex, - { - refTime: 2_000_000_000, - proofSize: 100_000, - }, - 100 - ), - ], + context.pjsApi.tx.openTechCommitteeCollective.close( + openTechProposal, + openTechProposalIndex, + { + refTime: 2_000_000_000, + proofSize: 100_000, + }, + 100 + ), { signer: voters[0] } ); - const isWhitelisted = (await context.pjsApi.query.whitelist.whitelistedCall(polkadotCallHash)) - .isSome; - - if (!isWhitelisted) { - throw new Error("Whitelisted procedure failed"); - } - return result; }; diff --git a/packages/types/package.json b/packages/types/package.json index eb253bea..92e29293 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -42,7 +42,7 @@ ], "scripts": { "clean": "rm -rf dist && rm -rf node_modules", - "build": "rm -rf dist && tsup src --format esm --no-splitting && pnpm generate-types", + "build": "rm -rf dist && tsup src --format esm --no-splitting --sourcemap && pnpm generate-types", "generate-types": "tsc && pnpm schema", "watch": "tsup src --format esm --watch", "lint": "pnpm biome lint ./src", diff --git a/packages/util/package.json b/packages/util/package.json index 9285c2fb..9bfbdef1 100644 --- a/packages/util/package.json +++ b/packages/util/package.json @@ -42,7 +42,7 @@ ], "scripts": { "clean": "rm -rf dist && rm -rf node_modules", - "build": "pnpm exec rm -rf dist && tsup src --format esm --no-splitting && pnpm generate-types", + "build": "pnpm exec rm -rf dist && tsup src --format esm --no-splitting --sourcemap && pnpm generate-types", "generate-types": "tsc", "lint": "pnpm biome lint ./src", "lint:fix": "pnpm biome lint ./src --apply",