Skip to content

Commit

Permalink
small fix (#385)
Browse files Browse the repository at this point in the history
  • Loading branch information
timbrinded authored Feb 22, 2024
1 parent b3283e4 commit e52b29b
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 27 deletions.
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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 .",
Expand Down
43 changes: 19 additions & 24 deletions packages/cli/src/lib/governanceProcedures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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();

Expand All @@ -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>,
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, {
Expand Down Expand Up @@ -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;
};

Expand Down
2 changes: 1 addition & 1 deletion packages/types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion packages/util/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit e52b29b

Please sign in to comment.