From b0b5844c80a2892603ae8a658c2cb993895614ef Mon Sep 17 00:00:00 2001 From: Chralt98 Date: Thu, 18 Apr 2024 14:13:16 +0200 Subject: [PATCH] correct integration tests --- integration-tests/tests/common-tests.ts | 18 +++++++++++------- .../zombienet/produce-blocks.zndsl | 7 ++++--- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/integration-tests/tests/common-tests.ts b/integration-tests/tests/common-tests.ts index a7025b19e..6c3a4ed64 100644 --- a/integration-tests/tests/common-tests.ts +++ b/integration-tests/tests/common-tests.ts @@ -121,6 +121,9 @@ export async function canSendXcmTransfer( destWeightLimit ); + const { partialFee, weight } = await xcmTransfer.paymentInfo(alice.address); + const transferFee: bigint = partialFee.toBigInt(); + await xcmTransfer.signAndSend(alice, { nonce: -1 }); await context.createBlock({ @@ -129,8 +132,6 @@ export async function canSendXcmTransfer( allowFailures: false, }); - const { partialFee, weight } = await xcmTransfer.paymentInfo(alice.address); - const transferFee: bigint = partialFee.toBigInt(); const senderBalanceAfter = ( (await senderParaApi.query.system.account(alice.address)) as AccountInfo ).data.free.toBigInt(); @@ -181,15 +182,18 @@ export async function canSendXcmTransfer( receiverBalanceAfter > receiverBalanceBefore, "Balance did not increase" ).toBeTruthy(); - const xcmFee: bigint = - receiverBalanceBefore + amount - transferFee - receiverBalanceAfter; - // between 0.02 ZTG and 0.10 ZTG XCM fee - const approxXcmFeeLow = 200000000; + const xcmFee: bigint = receiverBalanceBefore + amount - receiverBalanceAfter; + console.log( + `receiverBalanceBefore: ${receiverBalanceBefore}; amount: ${amount}; transferFee: ${transferFee}; receiverBalanceAfter: ${receiverBalanceAfter}; xcmFee: ${xcmFee}` + ); + console.log(`xcmFee: ${xcmFee}`); + // between 0.01 ZTG and 0.10 ZTG XCM fee + const approxXcmFeeLow = 100000000; const approxXcmFeeHigh = 1000000000; expect(xcmFee).toBeGreaterThanOrEqual(approxXcmFeeLow); expect(xcmFee).toBeLessThanOrEqual(approxXcmFeeHigh); expect( receiverBalanceAfter - receiverBalanceBefore, "Unexpected xcm transfer balance diff" - ).toBe(amount - transferFee - xcmFee); + ).toBe(amount - xcmFee); } diff --git a/integration-tests/zombienet/produce-blocks.zndsl b/integration-tests/zombienet/produce-blocks.zndsl index 72f7db0ba..0ec69547a 100644 --- a/integration-tests/zombienet/produce-blocks.zndsl +++ b/integration-tests/zombienet/produce-blocks.zndsl @@ -1,3 +1,7 @@ +Description: Produce blocks test +Network: ./produce-blocks.toml +Creds: config + # Copyright (C) Parity Technologies (UK) Ltd. # Copyright 2022-2024 Forecasting Technologies LTD. # @@ -16,9 +20,6 @@ # You should have received a copy of the GNU General Public License # along with Zeitgeist. If not, see . -Description: Produce blocks test -Network: ./produce-blocks.toml -Creds: config # Tracing # bob: trace with traceID 94c1501a78a0d83c498cc92deec264d9 contains ["answer-chunk-request", "answer-chunk-request"]