From 748c609fe7ab8de35ff2aedc0da1c51a18d90b91 Mon Sep 17 00:00:00 2001 From: Max Andreev Date: Mon, 22 May 2023 22:28:28 +0200 Subject: [PATCH] Build/941056 tests up (#938) Use XCM V2 --- tests/src/xcm/xcmQuartz.test.ts | 22 ++++++++++++++++------ tests/src/xcm/xcmUnique.test.ts | 25 +++++++++++++++++-------- 2 files changed, 33 insertions(+), 14 deletions(-) diff --git a/tests/src/xcm/xcmQuartz.test.ts b/tests/src/xcm/xcmQuartz.test.ts index 6f99fd4676..2670cbef2c 100644 --- a/tests/src/xcm/xcmQuartz.test.ts +++ b/tests/src/xcm/xcmQuartz.test.ts @@ -803,6 +803,7 @@ describeXCM('[XCM] Integration test: Quartz rejects non-native tokens', () => { let quartzParachainMultilocation: any; let quartzAccountMultilocation: any; let quartzCombinedMultilocation: any; + let quartzCombinedMultilocationKarura: any; // TODO remove it when Karura goes V2 let messageSent: any; @@ -847,6 +848,15 @@ describeXCM('[XCM] Integration test: Quartz rejects non-native tokens', () => { }, }; + quartzCombinedMultilocationKarura = { + V1: { + parents: 1, + interior: { + X2: [quartzParachainJunction, quartzAccountJunction], + }, + }, + }; + // Set the default version to wrap the first message to other chains. await helper.getSudo().xcm.setSafeXcmVersion(alice, SAFE_XCM_VERSION); }); @@ -869,7 +879,7 @@ describeXCM('[XCM] Integration test: Quartz rejects non-native tokens', () => { const id = { Token: 'KAR', }; - const destination = quartzCombinedMultilocation; + const destination = quartzCombinedMultilocationKarura; await helper.xTokens.transfer(alice, id, testAmount, destination, 'Unlimited'); messageSent = await helper.wait.expectEvent(maxWaitBlocks, Event.XcmpQueue.XcmpMessageSent); @@ -1433,7 +1443,7 @@ describeXCM('[XCM] Integration test: Exchanging tokens with Shiden', () => { itSub('Should connect to Shiden and send QTZ back', async ({helper}) => { await usingShidenPlaygrounds(shidenUrl, async (helper) => { const destination = { - V1: { + V2: { parents: 1, interior: { X1: { @@ -1444,7 +1454,7 @@ describeXCM('[XCM] Integration test: Exchanging tokens with Shiden', () => { }; const beneficiary = { - V1: { + V2: { parents: 0, interior: { X1: { @@ -1458,7 +1468,7 @@ describeXCM('[XCM] Integration test: Exchanging tokens with Shiden', () => { }; const assets = { - V1: [ + V2: [ { id: { Concrete: { @@ -1515,7 +1525,7 @@ describeXCM('[XCM] Integration test: Exchanging tokens with Shiden', () => { const [targetAccount] = await helper.arrange.createAccounts([targetAccountBalance], alice); const quartzMultilocation = { - V1: { + V2: { parents: 1, interior: { X1: {Parachain: QUARTZ_CHAIN}, @@ -1580,7 +1590,7 @@ describeXCM('[XCM] Integration test: Exchanging tokens with Shiden', () => { const [targetAccount] = await helper.arrange.createAccounts([0n], alice); const quartzMultilocation = { - V1: { + V2: { parents: 1, interior: { X1: { diff --git a/tests/src/xcm/xcmUnique.test.ts b/tests/src/xcm/xcmUnique.test.ts index c8c8321fec..6dc1f7e030 100644 --- a/tests/src/xcm/xcmUnique.test.ts +++ b/tests/src/xcm/xcmUnique.test.ts @@ -805,6 +805,7 @@ describeXCM('[XCM] Integration test: Unique rejects non-native tokens', () => { let uniqueParachainMultilocation: any; let uniqueAccountMultilocation: any; let uniqueCombinedMultilocation: any; + let uniqueCombinedMultilocationAcala: any; // TODO remove when Acala goes V2 let messageSent: any; @@ -823,7 +824,7 @@ describeXCM('[XCM] Integration test: Unique rejects non-native tokens', () => { }; uniqueParachainMultilocation = { - V1: { + V2: { parents: 1, interior: { X1: uniqueParachainJunction, @@ -849,6 +850,15 @@ describeXCM('[XCM] Integration test: Unique rejects non-native tokens', () => { }, }; + uniqueCombinedMultilocationAcala = { + V1: { + parents: 1, + interior: { + X2: [uniqueParachainJunction, uniqueAccountJunction], + }, + }, + }; + // Set the default version to wrap the first message to other chains. await helper.getSudo().xcm.setSafeXcmVersion(alice, SAFE_XCM_VERSION); }); @@ -871,7 +881,7 @@ describeXCM('[XCM] Integration test: Unique rejects non-native tokens', () => { const id = { Token: 'ACA', }; - const destination = uniqueCombinedMultilocation; + const destination = uniqueCombinedMultilocationAcala; await helper.xTokens.transfer(alice, id, testAmount, destination, 'Unlimited'); messageSent = await helper.wait.expectEvent(maxWaitBlocks, Event.XcmpQueue.XcmpMessageSent); @@ -1436,7 +1446,7 @@ describeXCM('[XCM] Integration test: Exchanging tokens with Astar', () => { itSub('Should connect to Astar and send UNQ back', async ({helper}) => { await usingAstarPlaygrounds(astarUrl, async (helper) => { const destination = { - V1: { + V2: { parents: 1, interior: { X1: { @@ -1447,7 +1457,7 @@ describeXCM('[XCM] Integration test: Exchanging tokens with Astar', () => { }; const beneficiary = { - V1: { + V2: { parents: 0, interior: { X1: { @@ -1461,7 +1471,7 @@ describeXCM('[XCM] Integration test: Exchanging tokens with Astar', () => { }; const assets = { - V1: [ + V2: [ { id: { Concrete: { @@ -1517,7 +1527,7 @@ describeXCM('[XCM] Integration test: Exchanging tokens with Astar', () => { const [targetAccount] = await helper.arrange.createAccounts([targetAccountBalance], alice); const uniqueMultilocation = { - V1: { + V2: { parents: 1, interior: { X1: {Parachain: UNIQUE_CHAIN}, @@ -1582,7 +1592,7 @@ describeXCM('[XCM] Integration test: Exchanging tokens with Astar', () => { const [targetAccount] = await helper.arrange.createAccounts([0n], alice); const uniqueMultilocation = { - V1: { + V2: { parents: 1, interior: { X1: { @@ -1652,5 +1662,4 @@ describeXCM('[XCM] Integration test: Exchanging tokens with Astar', () => { accountBalance = await helper.balance.getSubstrate(targetAccount.address); expect(accountBalance).to.be.equal(0n); }); - });