Skip to content

Commit

Permalink
correct integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Chralt98 committed Apr 18, 2024
1 parent 9051bcf commit b0b5844
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
18 changes: 11 additions & 7 deletions integration-tests/tests/common-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand All @@ -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();
Expand Down Expand Up @@ -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);
}
7 changes: 4 additions & 3 deletions integration-tests/zombienet/produce-blocks.zndsl
Original file line number Diff line number Diff line change
@@ -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.
#
Expand All @@ -16,9 +20,6 @@
# You should have received a copy of the GNU General Public License
# along with Zeitgeist. If not, see <https://www.gnu.org/licenses/>.

Description: Produce blocks test
Network: ./produce-blocks.toml
Creds: config

# Tracing
# bob: trace with traceID 94c1501a78a0d83c498cc92deec264d9 contains ["answer-chunk-request", "answer-chunk-request"]
Expand Down

0 comments on commit b0b5844

Please sign in to comment.