Skip to content

Commit

Permalink
Merge branch 'main' of github.com:moonsong-labs/moonbeam-tools
Browse files Browse the repository at this point in the history
  • Loading branch information
crystalin committed May 14, 2024
2 parents 930ace9 + a4629c0 commit 9892332
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 16 deletions.
5 changes: 2 additions & 3 deletions src/libs/helpers/state-manipulator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,8 @@ await processState(stateFile, stateFile.replace(/.json$/, ".mod.json"), [
relayChain: `rococo-local`,
}),

// Make the Council & Technical committee governed by Alith
new CollectiveManipulator("TechCommitteeCollective", [ALITH_ADDRESS]),
new CollectiveManipulator("CouncilCollective", [ALITH_ADDRESS]),
// Make the Open Technical committee governed by Alith
new CollectiveManipulator("OpenTechCommitteeCollective", [ALITH_ADDRESS]),

// Reset the validation data
new ValidationManipulator(),
Expand Down
6 changes: 2 additions & 4 deletions src/libs/helpers/state-manipulator/state-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,7 @@ export async function neutralizeExportedState(
name: `Fork Network`,
relayChain: `rococo-local`,
}),
new CollectiveManipulator("TechCommitteeCollective", [ALITH_ADDRESS]),
new CollectiveManipulator("CouncilCollective", [ALITH_ADDRESS]),
new CollectiveManipulator("OpenTechCommitteeCollective", [ALITH_ADDRESS]),
new ValidationManipulator(),
new XCMPManipulator(),
new BalancesManipulator([
Expand Down Expand Up @@ -259,8 +258,7 @@ export async function insertParachainCodeIntoRelay(inFile: string, outFile: stri
name: `Fork Network`,
relayChain: `rococo-local`,
}),
new CollectiveManipulator("TechCommitteeCollective", [ALITH_ADDRESS]),
new CollectiveManipulator("CouncilCollective", [ALITH_ADDRESS]),
new CollectiveManipulator("OpenTechCommitteeCollective", [ALITH_ADDRESS]),
new ValidationManipulator(),
new XCMPManipulator(),
new BalancesManipulator([{ account: ALITH_ADDRESS, amount: 10_000n * 10n ** 18n }]),
Expand Down
8 changes: 4 additions & 4 deletions src/tools/fast-execute-chopstick-proposal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@ const main = async () => {
const callHash = ongoingData.proposal.isLookup
? ongoingData.proposal.asLookup.toHex()
: ongoingData.proposal.isInline
? blake2AsHex(ongoingData.proposal.asInline.toHex())
: ongoingData.proposal.asLegacy.toHex();
? blake2AsHex(ongoingData.proposal.asInline.toHex())
: ongoingData.proposal.asLegacy.toHex();

const proposalBlockTarget = (await api.rpc.chain.getHeader()).number.toNumber();
const fastProposalData = {
Expand Down Expand Up @@ -219,8 +219,8 @@ const main = async () => {
call.isLookup
? call.asLookup.toHex() == callHash
: call.isInline
? blake2AsHex(call.asInline.toHex()) == callHash
: call.asLegacy.toHex() == callHash
? blake2AsHex(call.asInline.toHex()) == callHash
: call.asLegacy.toHex() == callHash,
);

console.log(
Expand Down
3 changes: 2 additions & 1 deletion src/utils/monitoring.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,8 @@ export const getAccountIdentity = async (
identityCache[account] = {
lastUpdate: Date.now(),
identity: identity && ("info" in identity ? identity : identity[0]),
superOf: superOfIdentity && ("info" in superOfIdentity ? superOfIdentity : superOfIdentity[0]),
superOf:
superOfIdentity && ("info" in superOfIdentity ? superOfIdentity : superOfIdentity[0]),
};
}

Expand Down
7 changes: 5 additions & 2 deletions src/utils/referenda.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,10 @@ function parseImage(
}

async function getImageProposal(api: ApiPromise | ApiDecoration<"promise">, hash: string) {
const optStatus = "requestStatusFor" in api.query.preimage ? await api.query.preimage["requestStatusFor"](hash) : await api.query.preimage.statusFor(hash);
const optStatus =
"requestStatusFor" in api.query.preimage
? await api.query.preimage["requestStatusFor"](hash)
: await api.query.preimage.statusFor(hash);
const status = optStatus.unwrapOr(null) as PalletPreimageRequestStatus;
if (!status) {
return null;
Expand Down Expand Up @@ -338,7 +341,7 @@ export async function getReferendumByGroups(
}
const { apiAt, ongoing } = await getReferendumOnGoing(api, id, info);
// Old proposal had the hash directly
const proposalHash = getPreimageHash(ongoing.proposal || (ongoing as any).proposalHash);
const proposalHash = getPreimageHash(ongoing.proposal || (ongoing as any).proposalHash);
return {
id,
ongoing,
Expand Down
3 changes: 1 addition & 2 deletions test/state-manipulation.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ describe("State Manipulation", () => {
),
new CollatorManipulator(CHARLETH_ADDRESS, CHARLETH_SESSION_ADDRESS),
new HRMPManipulator(),
new CollectiveManipulator("TechCommitteeCollective", [CHARLETH_ADDRESS, HEATH_ADDRESS]),
new CollectiveManipulator("CouncilCollective", [JUDITH_ADDRESS]),
new CollectiveManipulator("OpenTechCommitteeCollective", [CHARLETH_ADDRESS, HEATH_ADDRESS]),
new ValidationManipulator(),
new XCMPManipulator(),
new SpecManipulator({
Expand Down

0 comments on commit 9892332

Please sign in to comment.