Skip to content

Commit

Permalink
init tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Szegoo committed May 4, 2024
1 parent fab2cc8 commit 16e45eb
Show file tree
Hide file tree
Showing 3 changed files with 106 additions and 0 deletions.
63 changes: 63 additions & 0 deletions e2e_tests/region-transfer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
const { ApiPromise, WsProvider, Keyring } = require("@polkadot/api");
const { submitExtrinsic, setupRelayAsset } = require("./common");

async function run(nodeName, networkInfo, _jsArgs) {
const { wsUri: regionXUri } = networkInfo.nodesByName[nodeName];
const { wsUri: rococoUri } = networkInfo.nodesByName["rococo-validator01"];
const { wsUri: coretimeUri } = networkInfo.nodesByName["coretime-collator01"];

const rococoApi = await ApiPromise.create({
provider: new WsProvider(rococoUri),
});
const regionXApi = await ApiPromise.create({provider: new WsProvider(regionXUri)});

// account to submit tx
const keyring = new zombie.Keyring({ type: "sr25519" });
const alice = keyring.addFromUri("//Alice");

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

await setupRelayAsset(regionXApi, alice);

const receiverKeypair = new Keyring();
receiverKeypair.addFromAddress(alice.address);

const feeAssetItem = 0;
const weightLimit = "Unlimited";
const reserveTransfer = rococoApi.tx.xcmPallet.limitedReserveTransferAssets(
{ V3: { parents: 0, interior: { X1: { Parachain: 2000 } } } }, //dest
{
V3: {
parents: 0,
interior: {
X1: {
AccountId32: {
chain: "Any",
id: receiverKeypair.pairs[0].publicKey,
},
},
},
},
}, //beneficiary
{
V3: [
{
id: {
Concrete: { parents: 0, interior: "Here" },
},
fun: {
Fungible: 10n ** 9n,
},
},
],
}, //asset
feeAssetItem,
weightLimit,
);
await submitExtrinsic(alice, reserveTransfer, {});
}

module.exports = { run };
33 changes: 33 additions & 0 deletions zombienet_tests/0006-region-transfer.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
[settings]
timeout = 1000

[relaychain]
chain = "rococo-local"
command = "polkadot"

[[relaychain.nodes]]
name = "rococo-validator01"
validator = true

[[relaychain.nodes]]
name = "rococo-validator02"
validator = true

[[parachains]]
id = 1005
chain = "coretime-rococo-local"
addToGenesis = true

[parachains.collator]
name = "coretime-collator01"
command = "polkadot-parachain"
args = [ "-lruntime=debug,parachain=trace" ]

[[parachains]]
id = 2000
addToGenesis = false

[parachains.collator]
name = "regionx-collator01"
command = "regionx-node"
args = [ "-lruntime=debug,parachain=trace" ]
10 changes: 10 additions & 0 deletions zombienet_tests/0006-region-transfer.zndsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Description: Native currency fee payment
Network: ./0006-region-transfer.toml
Creds: config

rococo-validator01: is up
rococo-validator02: is up

rococo-validator01: parachain 2000 is registered within 225 seconds

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

0 comments on commit 16e45eb

Please sign in to comment.