Skip to content

Commit

Permalink
works :)) but messy
Browse files Browse the repository at this point in the history
  • Loading branch information
Szegoo committed May 7, 2024
1 parent 7c35a49 commit e8c6d92
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
11 changes: 9 additions & 2 deletions e2e_tests/region-transfer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ import { ApiPromise, WsProvider, Keyring } from "@polkadot/api";
import { CONFIG, INITIAL_PRICE, UNIT, CORE_COUNT } from "../consts";
import { submitExtrinsic, sleep, transferRelayAssetToRegionX, setupRelayAsset } from "../common";
import { KeyringPair } from "@polkadot/keyring/types";
import { getEncodedRegionId, Id, RegionId, voidMask } from "coretime-utils";
import { getEncodedRegionId, Id, RegionId } from "coretime-utils";
import assert from 'node:assert';

const PARA_SOVEREIGN_ACCOUNT = "5Eg2fntJ27qsari4FGrGhrMqKFDRnkNSR6UshkZYBGXmSuC8";

async function run(_nodeName: any, networkInfo: any, _jsArgs: any) {
const { wsUri: regionXUri } = networkInfo.nodesByName["regionx-collator01"];
const { wsUri: coretimeUri } = networkInfo.nodesByName["coretime-collator01"];
Expand All @@ -19,7 +21,9 @@ async function run(_nodeName: any, networkInfo: any, _jsArgs: any) {
const alice = keyring.addFromUri("//Alice");

const setCoretimeXcmVersion = coretimeApi.tx.polkadotXcm.forceDefaultXcmVersion([3]);
const setRelayXcmVersion = rococoApi.tx.xcmPallet.forceDefaultXcmVersion([3]);
await submitExtrinsic(alice, coretimeApi.tx.sudo.sudo(setCoretimeXcmVersion), {});
await submitExtrinsic(alice, rococoApi.tx.sudo.sudo(setRelayXcmVersion), {});

await openHrmpChannel(alice, rococoApi, 1005, 2000);
await openHrmpChannel(alice, rococoApi, 2000, 1005);
Expand All @@ -29,6 +33,8 @@ async function run(_nodeName: any, networkInfo: any, _jsArgs: any) {
await configureBroker(coretimeApi, alice);
await startSales(coretimeApi, alice);

await sleep(2000);

const setBalanceCall = coretimeApi.tx.balances.forceSetBalance(alice.address, 1000 * UNIT);
await submitExtrinsic(alice, coretimeApi.tx.sudo.sudo(setBalanceCall), {});

Expand Down Expand Up @@ -78,7 +84,8 @@ async function run(_nodeName: any, networkInfo: any, _jsArgs: any) {
await submitExtrinsic(alice, reserveTransferToRegionX, {});

await transferRelayAssetToRegionX((10n**12n).toString(), rococoApi, alice);
await sleep(5000);
const fundSovereignAccount = coretimeApi.tx.balances.forceSetBalance(PARA_SOVEREIGN_ACCOUNT, 1000 * UNIT);
await submitExtrinsic(alice, coretimeApi.tx.sudo.sudo(fundSovereignAccount), {});

const regions = (await regionXApi.query.regions.regions.entries());
assert.equal(regions.length, 1);
Expand Down
2 changes: 1 addition & 1 deletion zombienet_tests/0006-region-transfer.zndsl
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ rococo-validator02: is up

rococo-validator01: parachain 2000 is registered within 225 seconds

regionx-collator01: js-script ../e2e_tests/build/region-transfer/index.js return is 0 within 400 seconds
regionx-collator01: js-script ../e2e_tests/build/region-transfer/index.js return is 0 within 600 seconds

sleep 1000 seconds

0 comments on commit e8c6d92

Please sign in to comment.