Skip to content

Commit

Permalink
remove wasm override from moonbeam chopsticks; reserve transfer Moonb…
Browse files Browse the repository at this point in the history
…eam -> LAOS
  • Loading branch information
luispdm committed Jan 9, 2025
1 parent 4c20363 commit f8f7f35
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 31 deletions.
1 change: 0 additions & 1 deletion e2e-tests/chopsticks-configs/moonbeam.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ endpoint: wss://wss.api.moonbeam.network
mock-signature-host: true
db: ./db.sqlite
runtime-log-level: 5
wasm-override: ./moonbeam_runtime.wasm # TODO remove me

import-storage:
System:
Expand Down
49 changes: 20 additions & 29 deletions e2e-tests/tests/xcm/test-reserve-transfer-laos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ describeWithExistingNodeXcm("Reserve transfer LAOS <-> Moonbeam", function () {
});

step("Reserve transfer from Moonbeam to LAOS", async function () {
const beneficiary = this.chains.assetHub.createType("XcmVersionedLocation", {
const beneficiary = this.chains.moonbeam.createType("XcmVersionedLocation", {
V4: {
parents: "0",
interior: {
Expand All @@ -129,8 +129,8 @@ describeWithExistingNodeXcm("Reserve transfer LAOS <-> Moonbeam", function () {
},
});

const amount = ONE_LAOS.muln(1);
const assets = this.chains.assetHub.createType("XcmVersionedAssets", {
const amount = ONE_LAOS;
const assets = this.chains.moonbeam.createType("XcmVersionedAssets", {
V4: [
{
id: siblingParachainLocation(LAOS_PARA_ID),
Expand All @@ -143,28 +143,22 @@ describeWithExistingNodeXcm("Reserve transfer LAOS <-> Moonbeam", function () {
const fee_asset_item = "0";
const weight_limit = "Unlimited";

const charlieBalanceBefore = hexToBn(
(
await this.chains.assetHub.query.foreignAssets.account(
this.assetHubItems.laosAsset,
this.substratePairs.charlie.address
)
).toJSON()?.["balance"] ?? 0
);
const beneficiaryBalanceBefore = (
await this.chains.laos.query.system.account(this.ethereumPairs.baltathar.address)
).data.free;
const moonbeamSABalanceBefore = (await this.chains.laos.query.system.account(this.laosItems.moonbeamSA)).data
.free;

const call = this.chains.assetHub.tx.polkadotXcm.limitedTeleportAssets(
this.assetHubItems.laosLocation,
const call = this.chains.moonbeam.tx.polkadotXcm.transferAssets(
this.moonbeamItems.laosLocation,
beneficiary,
assets,
fee_asset_item,
weight_limit
);

const laosBestBlockBeforeSending = await getFinalizedBlockNumber(this.chains.laos);
await sendTxAndWaitForFinalization(this.chains.assetHub, call, this.substratePairs.baltathar);
await sendTxAndWaitForFinalization(this.chains.moonbeam, call, this.ethereumPairs.baltathar);
// Check that $LAOS has been sent back to Laos
const event = await checkEventAfterXcm(
this.chains.laos,
Expand All @@ -178,25 +172,22 @@ describeWithExistingNodeXcm("Reserve transfer LAOS <-> Moonbeam", function () {
);

expect(event).to.not.be.null;
const [receiver, realAmountReceived] = event.event.data;
expect(receiver.toString()).to.equal(this.ethereumPairs.baltathar.address);
const charlieBalance = hexToBn(
(
await this.chains.assetHub.query.foreignAssets.account(
this.assetHubItems.laosAsset,
this.substratePairs.charlie.address
)
).toJSON()["balance"]
);
expect(
charlieBalanceBefore.sub(amount).eq(charlieBalance),
"Charlie's balance should decrease by the amount teleported"
);
const [_, realAmountReceived] = event.event.data;

const beneficiaryBalance = (await this.chains.laos.query.system.account(this.ethereumPairs.baltathar.address))
.data.free;
expect(
beneficiaryBalanceBefore.add(new BN(realAmountReceived.toString())).eq(beneficiaryBalance),
"Alith's balance should increase by the amount received in the teleport"
"Baltathar's balance should increase by the amount received in the reserve transfer"
);

// check that moonbeam SA balance has been reduced
const realMoonbeamSABalance = (await this.chains.laos.query.system.account(this.laosItems.moonbeamSA)).data
.free;
const supposedMoonbeamSABalance = moonbeamSABalanceBefore.add(amount);
expect(
supposedMoonbeamSABalance.eq(realMoonbeamSABalance),
"Moonbeam's SA balance has not decreased by the amount of the reserve transfer"
);
});
});
2 changes: 1 addition & 1 deletion e2e-tests/tests/xcm/test-teleport-laos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ describeWithExistingNodeXcm("Teleport Asset Hub <-> LAOS", function () {
},
});

const amount = ONE_LAOS.muln(1);
const amount = ONE_LAOS;
const assets = this.chains.assetHub.createType("XcmVersionedAssets", {
V4: [
{
Expand Down

0 comments on commit f8f7f35

Please sign in to comment.