Skip to content

Commit

Permalink
fixed the doubleContext bug with 'test' cmd
Browse files Browse the repository at this point in the history
  • Loading branch information
timbrinded committed Nov 16, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 0937884 commit d5f3a76
Showing 10 changed files with 12 additions and 12 deletions.
3 changes: 2 additions & 1 deletion packages/cli/src/index.ts
Original file line number Diff line number Diff line change
@@ -6,7 +6,8 @@ export * from "./lib/binariesHelpers";
export * from "./lib/configReader";
export * from "./lib/contextHelpers";
export * from "./lib/contractFunctions";
export * from "./lib/globalContext";
// export * from "./lib/globalContext";
export * from "./lib/globalContextEffect";
export * from "./lib/governanceProcedures";
export * from "./lib/rpcFunctions";
export * from "./lib/runnerContext";
2 changes: 1 addition & 1 deletion packages/cli/src/internal/foundations/chopsticksHelpers.ts
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@ import { FrameSystemEventRecord } from "@polkadot/types/lookup";
import chalk from "chalk";
import { setTimeout } from "timers/promises";
import { assert } from "vitest";
import { MoonwallContext } from "../../lib/globalContext";
import { MoonwallContext } from "../../lib/globalContextEffect";

export async function getWsFromConfig(providerName?: string): Promise<WsProvider> {
if (providerName) {
2 changes: 1 addition & 1 deletion packages/cli/src/internal/foundations/devModeHelpers.ts
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@ import { setTimeout } from "timers/promises";
import { assert } from "vitest";
import { importAsyncConfig, isEthereumDevConfig } from "../../lib/configReader";
import { extractError } from "../../lib/contextHelpers";
import { MoonwallContext } from "../../lib/globalContext";
import { MoonwallContext } from "../../lib/globalContextEffect";
const debug = Debug("DevTest");

export async function getDevProviderPath() {
5 changes: 2 additions & 3 deletions packages/cli/src/lib/globalContextEffect.ts
Original file line number Diff line number Diff line change
@@ -32,6 +32,7 @@ import {
} from "../internal/providerFactories";
import {
importAsyncConfig,
importJsonConfig,
isEthereumDevConfig,
isEthereumZombieConfig,
isOptionSet,
@@ -437,9 +438,7 @@ export class MoonwallContext {

public static getContext(config?: MoonwallConfig, force: boolean = false): MoonwallContext {
if (!MoonwallContext.instance || force) {
if (!config) {
throw new Error("❌ Config must be provided on Global Context instantiation");
}
const config = importJsonConfig();
MoonwallContext.instance = new MoonwallContext(config);

debugSetup(`🟢 Moonwall context "${config.label}" created`);
2 changes: 1 addition & 1 deletion packages/cli/src/lib/handlers/chopsticksHandler.ts
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@ import {
createChopsticksBlock,
sendSetStorageRequest,
} from "../../internal/foundations/chopsticksHelpers";
import { MoonwallContext } from "../globalContext";
import { MoonwallContext } from "../globalContextEffect";
import { upgradeRuntimeChopsticks } from "../upgradeProcedures";

export const chopsticksHandler: FoundationHandler<"chopsticks"> = ({
2 changes: 1 addition & 1 deletion packages/cli/src/lib/handlers/readOnlyHandler.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ApiPromise } from "@polkadot/api";
import { FoundationHandler } from "@moonwall/types";
import { MoonwallContext } from "../globalContext";
import { MoonwallContext } from "../globalContextEffect";

export const readOnlyHandler: FoundationHandler<"read_only"> = ({
testCases,
2 changes: 1 addition & 1 deletion packages/cli/src/lib/handlers/zombieHandler.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { FoundationHandler, UpgradePreferences } from "@moonwall/types";
import { ApiPromise } from "@polkadot/api";
import { upgradeRuntime } from "../upgradeProcedures";
import { MoonwallContext } from "../globalContext";
import { MoonwallContext } from "../globalContextEffect";
import { alith } from "@moonwall/util";
import { sendIpcMessage } from "../../internal/foundations/zombieHelpers";

2 changes: 1 addition & 1 deletion test/configs/moonbeamChopsticks.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
endpoint: wss://wss.api.moonbeam.network
mock-signature-host: true
port: 12000
port: 10000
db: ./tmp/db_mb.sqlite

import-storage:
2 changes: 1 addition & 1 deletion test/moonwall.config.json
Original file line number Diff line number Diff line change
@@ -226,7 +226,7 @@
"name": "mb",
"type": "parachain",
"buildBlockMode": "manual",
"configPath": "./configs/moonriverChopsticks.yml"
"configPath": "./configs/moonbeamChopsticks.yml"
}
]
},
2 changes: 1 addition & 1 deletion test/suites/chopsticks/test-chopsticks-basic.ts
Original file line number Diff line number Diff line change
@@ -25,7 +25,7 @@ describeSuite({
const currentBlockHeight = (await api.rpc.chain.getHeader()).number.toNumber();
log(`You are now connected to ${chainName} at height #${currentBlockHeight}`);
expect(currentBlockHeight).toBeGreaterThan(0);
expect(["dancebox", "moonriver"].includes(chainName)).toBe(true);
expect(["dancebox", "moonriver", "moonbeam"].includes(chainName)).toBe(true);
log(JSON.stringify(await api.rpc.state.getStorage(":code")).slice(0, 20));
log(`This chain is an Ethereum chain: ${context.isEthereumChain}`);
log(`Alith Address is: ${context.keyring.alice.address}`);

0 comments on commit d5f3a76

Please sign in to comment.