From 604ef2ae66ea7d72545b02fca3d2aea1f21af476 Mon Sep 17 00:00:00 2001 From: Ivan Shumkov Date: Thu, 3 Oct 2024 12:06:38 +0300 Subject: [PATCH 1/4] test: enable withdrawals in test suite --- .../test/e2e/withdrawals.spec.js | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/packages/platform-test-suite/test/e2e/withdrawals.spec.js b/packages/platform-test-suite/test/e2e/withdrawals.spec.js index ecbac9b8de..6347ffe06f 100644 --- a/packages/platform-test-suite/test/e2e/withdrawals.spec.js +++ b/packages/platform-test-suite/test/e2e/withdrawals.spec.js @@ -8,11 +8,11 @@ const waitForSTPropagated = require('../../lib/waitForSTPropagated'); // TODO: temporary disabled due to flakiness. These tests aren't important for now, since we are // going to release v1.0.0 with withdrawals disabled. -describe.skip('Withdrawals', function withdrawalsTest() { +describe('Withdrawals', function withdrawalsTest() { this.bail(true); let client; - let identity; + let identity;`` before(async function createClients() { // TODO: temporarily disabled on browser because of header stream is not syncing @@ -57,7 +57,9 @@ describe.skip('Withdrawals', function withdrawalsTest() { await client.platform.identities.withdrawCredits( identity, BigInt(amountToWithdraw), - withdrawTo.address, + { + toAddress: withdrawTo.address, + }, ); // Re-fetch identity to obtain latest core chain lock height @@ -125,7 +127,9 @@ describe.skip('Withdrawals', function withdrawalsTest() { const { height: withdrawalHeight } = await client.platform.identities.withdrawCredits( identity, BigInt(amountToWithdraw), - withdrawTo.address, + { + toAddress: withdrawTo.address, + }, ); let withdrawalBroadcasted = false; @@ -173,7 +177,9 @@ describe.skip('Withdrawals', function withdrawalsTest() { await expect(client.platform.identities.withdrawCredits( identity, BigInt(amountToWithdraw), - withdrawTo.address, + { + toAddress: withdrawTo.address, + }, )).to.be.rejectedWith(`Withdrawal amount "${amountToWithdraw}" is bigger that identity balance "${identityBalanceBefore}"`); }); @@ -186,8 +192,8 @@ describe.skip('Withdrawals', function withdrawalsTest() { await expect(client.platform.identities.withdrawCredits( identity, BigInt(amountToWithdraw), - withdrawTo.address, { + toAddress: withdrawTo.address, signingKeyIndex: 1, }, )).to.be.rejectedWith('Error conversion not implemented: Invalid public key security level HIGH. The state transition requires one of CRITICAL'); @@ -227,7 +233,9 @@ describe.skip('Withdrawals', function withdrawalsTest() { await client.platform.identities.withdrawCredits( identity, BigInt(1000000), - withdrawTo.address, + { + toAddress: withdrawTo.address, + }, ); await waitForSTPropagated(); From 8e7a9e8c5fb7a9d9951249babf897c2bc19aa83c Mon Sep 17 00:00:00 2001 From: Ivan Shumkov Date: Sat, 5 Oct 2024 20:29:32 +0300 Subject: [PATCH 2/4] fix: signingKeyIndex option is ignored --- .../SDK/Client/Platform/methods/identities/creditWithdrawal.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/js-dash-sdk/src/SDK/Client/Platform/methods/identities/creditWithdrawal.ts b/packages/js-dash-sdk/src/SDK/Client/Platform/methods/identities/creditWithdrawal.ts index 4be23a4a67..359c569b4b 100644 --- a/packages/js-dash-sdk/src/SDK/Client/Platform/methods/identities/creditWithdrawal.ts +++ b/packages/js-dash-sdk/src/SDK/Client/Platform/methods/identities/creditWithdrawal.ts @@ -49,8 +49,8 @@ export async function creditWithdrawal( // eslint-disable-next-line no-param-reassign options = { - ...options, signingKeyIndex: 3, + ...options, }; const { dpp } = this; From 03ad26f04f83216f80e588b2fe7376e6459dab50 Mon Sep 17 00:00:00 2001 From: Ivan Shumkov Date: Sat, 5 Oct 2024 20:29:46 +0300 Subject: [PATCH 3/4] test: increase identity balance --- packages/platform-test-suite/test/e2e/withdrawals.spec.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/platform-test-suite/test/e2e/withdrawals.spec.js b/packages/platform-test-suite/test/e2e/withdrawals.spec.js index 6347ffe06f..1d900138e1 100644 --- a/packages/platform-test-suite/test/e2e/withdrawals.spec.js +++ b/packages/platform-test-suite/test/e2e/withdrawals.spec.js @@ -12,7 +12,7 @@ describe('Withdrawals', function withdrawalsTest() { this.bail(true); let client; - let identity;`` + let identity; before(async function createClients() { // TODO: temporarily disabled on browser because of header stream is not syncing @@ -38,7 +38,7 @@ describe('Withdrawals', function withdrawalsTest() { }); describe('Any Identity', () => { - const INITIAL_BALANCE = 1000000; + const INITIAL_BALANCE = 2000000; before(async () => { identity = await client.platform.identities.register(INITIAL_BALANCE); From d964ee9b1e4275516371b33f2c29f62ba70f3db3 Mon Sep 17 00:00:00 2001 From: Ivan Shumkov Date: Sat, 5 Oct 2024 20:58:44 +0300 Subject: [PATCH 4/4] test: fix assert --- packages/platform-test-suite/test/e2e/withdrawals.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/platform-test-suite/test/e2e/withdrawals.spec.js b/packages/platform-test-suite/test/e2e/withdrawals.spec.js index 1d900138e1..9c5dbee62b 100644 --- a/packages/platform-test-suite/test/e2e/withdrawals.spec.js +++ b/packages/platform-test-suite/test/e2e/withdrawals.spec.js @@ -196,7 +196,7 @@ describe('Withdrawals', function withdrawalsTest() { toAddress: withdrawTo.address, signingKeyIndex: 1, }, - )).to.be.rejectedWith('Error conversion not implemented: Invalid public key security level HIGH. The state transition requires one of CRITICAL'); + )).to.be.rejectedWith('Error conversion not implemented: Invalid public key security level HIGH. The state transition requires one of MASTER'); }); // TODO: Figure out how to overcome client-side validation and implement