From 5ffd03f399e1c220af046630a9d0435970d020e6 Mon Sep 17 00:00:00 2001 From: Aleksandr Pismenskiy Date: Fri, 13 Sep 2024 14:19:10 +0300 Subject: [PATCH 1/8] add ICQ test for new update period behaviour --- .../run_in_band/interchain_kv_query.test.ts | 34 +++++++++++++++++-- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/src/testcases/run_in_band/interchain_kv_query.test.ts b/src/testcases/run_in_band/interchain_kv_query.test.ts index 4aacc6ae..7ea95bb7 100644 --- a/src/testcases/run_in_band/interchain_kv_query.test.ts +++ b/src/testcases/run_in_band/interchain_kv_query.test.ts @@ -69,6 +69,7 @@ describe('Neutron / Interchain KV Query', () => { 4: 3, 5: 4, 6: 11, + 7: 50, }; let testState: LocalState; let neutronClient: SigningNeutronClient; @@ -351,6 +352,19 @@ describe('Neutron / Interchain KV Query', () => { testState.wallets.cosmos.val1.address, ); }); + + test('register icq #7: balance', async () => { + const height = (await neutronClient.getHeight()) + updatePeriods[7] + + await registerBalancesQuery( + neutronClient, + contractAddress, + connectionId, + height, + [COSMOS_DENOM], + testState.wallets.cosmos.val1.address, + ); + }); }); }); @@ -462,8 +476,22 @@ describe('Neutron / Interchain KV Query', () => { ); }); - test("registered icq #7 doesn't exist", async () => { + test('get registered icq #7: balance', async () => { const queryId = 7; + const queryResult = await getRegisteredQuery( + neutronClient, + contractAddress, + queryId, + ); + + expect(queryResult.registered_query.last_submitted_result_local_height).greaterThan(0); + expect(queryResult.registered_query.last_submitted_result_local_height).lessThan( + queryResult.registered_query.update_period, + ); + }); + + test("registered icq #8 doesn't exist", async () => { + const queryId = 8; await expect( getRegisteredQuery(neutronClient, contractAddress, queryId), ).rejects.toThrow(); @@ -831,7 +859,7 @@ describe('Neutron / Interchain KV Query', () => { async (response) => response.registered_query.last_submitted_result_local_height > 0 && response.registered_query.last_submitted_result_local_height + 5 < - (await neutronClient.getHeight()), + (await neutronClient.getHeight()), 20, ); @@ -858,7 +886,7 @@ describe('Neutron / Interchain KV Query', () => { return ( balances[0].denom === beforeBalances[0].denom && parseInt(balances[0].amount || '0') > - parseInt(beforeBalances[0].amount || '0') + parseInt(beforeBalances[0].amount || '0') ); }, From 78b4c2a8e365fdf2d4eca7be68fd2026fe370318 Mon Sep 17 00:00:00 2001 From: Aleksandr Pismenskiy Date: Fri, 13 Sep 2024 14:26:10 +0300 Subject: [PATCH 2/8] fix linter errors --- .../run_in_band/interchain_kv_query.test.ts | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/testcases/run_in_band/interchain_kv_query.test.ts b/src/testcases/run_in_band/interchain_kv_query.test.ts index 7ea95bb7..cd451066 100644 --- a/src/testcases/run_in_band/interchain_kv_query.test.ts +++ b/src/testcases/run_in_band/interchain_kv_query.test.ts @@ -354,7 +354,7 @@ describe('Neutron / Interchain KV Query', () => { }); test('register icq #7: balance', async () => { - const height = (await neutronClient.getHeight()) + updatePeriods[7] + const height = (await neutronClient.getHeight()) + updatePeriods[7]; await registerBalancesQuery( neutronClient, @@ -484,10 +484,12 @@ describe('Neutron / Interchain KV Query', () => { queryId, ); - expect(queryResult.registered_query.last_submitted_result_local_height).greaterThan(0); - expect(queryResult.registered_query.last_submitted_result_local_height).lessThan( - queryResult.registered_query.update_period, - ); + expect( + queryResult.registered_query.last_submitted_result_local_height, + ).greaterThan(0); + expect( + queryResult.registered_query.last_submitted_result_local_height, + ).lessThan(queryResult.registered_query.update_period); }); test("registered icq #8 doesn't exist", async () => { @@ -859,7 +861,7 @@ describe('Neutron / Interchain KV Query', () => { async (response) => response.registered_query.last_submitted_result_local_height > 0 && response.registered_query.last_submitted_result_local_height + 5 < - (await neutronClient.getHeight()), + (await neutronClient.getHeight()), 20, ); @@ -886,7 +888,7 @@ describe('Neutron / Interchain KV Query', () => { return ( balances[0].denom === beforeBalances[0].denom && parseInt(balances[0].amount || '0') > - parseInt(beforeBalances[0].amount || '0') + parseInt(beforeBalances[0].amount || '0') ); }, From 7fd0963371089506324d3136db1e86ec812e3645 Mon Sep 17 00:00:00 2001 From: Aleksandr Pismenskiy Date: Tue, 17 Sep 2024 13:47:14 +0300 Subject: [PATCH 3/8] increase update period --- src/testcases/run_in_band/interchain_kv_query.test.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/testcases/run_in_band/interchain_kv_query.test.ts b/src/testcases/run_in_band/interchain_kv_query.test.ts index cd451066..612e73e8 100644 --- a/src/testcases/run_in_band/interchain_kv_query.test.ts +++ b/src/testcases/run_in_band/interchain_kv_query.test.ts @@ -69,7 +69,7 @@ describe('Neutron / Interchain KV Query', () => { 4: 3, 5: 4, 6: 11, - 7: 50, + 7: 1_000_000, }; let testState: LocalState; let neutronClient: SigningNeutronClient; @@ -354,13 +354,13 @@ describe('Neutron / Interchain KV Query', () => { }); test('register icq #7: balance', async () => { - const height = (await neutronClient.getHeight()) + updatePeriods[7]; + const updatePeriod = (await neutronClient.getHeight()) + updatePeriods[7]; await registerBalancesQuery( neutronClient, contractAddress, connectionId, - height, + updatePeriod, [COSMOS_DENOM], testState.wallets.cosmos.val1.address, ); From 48bbf4b4933ac3319fa6b61fdcbee24d0c0d0779 Mon Sep 17 00:00:00 2001 From: Aleksandr Pismenskiy Date: Tue, 17 Sep 2024 13:52:20 +0300 Subject: [PATCH 4/8] fix linter error --- src/testcases/run_in_band/interchain_kv_query.test.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/testcases/run_in_band/interchain_kv_query.test.ts b/src/testcases/run_in_band/interchain_kv_query.test.ts index 612e73e8..0176e9fb 100644 --- a/src/testcases/run_in_band/interchain_kv_query.test.ts +++ b/src/testcases/run_in_band/interchain_kv_query.test.ts @@ -354,7 +354,8 @@ describe('Neutron / Interchain KV Query', () => { }); test('register icq #7: balance', async () => { - const updatePeriod = (await neutronClient.getHeight()) + updatePeriods[7]; + const updatePeriod = + (await neutronClient.getHeight()) + updatePeriods[7]; await registerBalancesQuery( neutronClient, From 5f03b3459e0eb96f9872e3e8f724e0f4ad0fe084 Mon Sep 17 00:00:00 2001 From: Aleksandr Pismenskiy Date: Tue, 17 Sep 2024 23:09:25 +0300 Subject: [PATCH 5/8] fix tests --- src/testcases/run_in_band/interchain_kv_query.test.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/testcases/run_in_band/interchain_kv_query.test.ts b/src/testcases/run_in_band/interchain_kv_query.test.ts index 0176e9fb..ca5d894f 100644 --- a/src/testcases/run_in_band/interchain_kv_query.test.ts +++ b/src/testcases/run_in_band/interchain_kv_query.test.ts @@ -69,7 +69,6 @@ describe('Neutron / Interchain KV Query', () => { 4: 3, 5: 4, 6: 11, - 7: 1_000_000, }; let testState: LocalState; let neutronClient: SigningNeutronClient; @@ -355,7 +354,7 @@ describe('Neutron / Interchain KV Query', () => { test('register icq #7: balance', async () => { const updatePeriod = - (await neutronClient.getHeight()) + updatePeriods[7]; + (await neutronClient.getHeight()) + 1_000_000; await registerBalancesQuery( neutronClient, From 10d3fa417e2edc1e43eba844f8f7f6fa4acd76d0 Mon Sep 17 00:00:00 2001 From: Aleksandr Pismenskiy Date: Tue, 17 Sep 2024 23:11:55 +0300 Subject: [PATCH 6/8] fix linter errors --- src/testcases/run_in_band/interchain_kv_query.test.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/testcases/run_in_band/interchain_kv_query.test.ts b/src/testcases/run_in_band/interchain_kv_query.test.ts index ca5d894f..88850b95 100644 --- a/src/testcases/run_in_band/interchain_kv_query.test.ts +++ b/src/testcases/run_in_band/interchain_kv_query.test.ts @@ -353,8 +353,7 @@ describe('Neutron / Interchain KV Query', () => { }); test('register icq #7: balance', async () => { - const updatePeriod = - (await neutronClient.getHeight()) + 1_000_000; + const updatePeriod = (await neutronClient.getHeight()) + 1_000_000; await registerBalancesQuery( neutronClient, From 76a34b95c029591c3db9dfdc4156235509270548 Mon Sep 17 00:00:00 2001 From: Aleksandr Pismenskiy Date: Thu, 19 Sep 2024 15:29:08 +0300 Subject: [PATCH 7/8] fix test --- src/testcases/run_in_band/interchain_kv_query.test.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/testcases/run_in_band/interchain_kv_query.test.ts b/src/testcases/run_in_band/interchain_kv_query.test.ts index 88850b95..8b4d10be 100644 --- a/src/testcases/run_in_band/interchain_kv_query.test.ts +++ b/src/testcases/run_in_band/interchain_kv_query.test.ts @@ -353,13 +353,11 @@ describe('Neutron / Interchain KV Query', () => { }); test('register icq #7: balance', async () => { - const updatePeriod = (await neutronClient.getHeight()) + 1_000_000; - await registerBalancesQuery( neutronClient, contractAddress, connectionId, - updatePeriod, + 1_000_000, [COSMOS_DENOM], testState.wallets.cosmos.val1.address, ); @@ -860,7 +858,7 @@ describe('Neutron / Interchain KV Query', () => { async (response) => response.registered_query.last_submitted_result_local_height > 0 && response.registered_query.last_submitted_result_local_height + 5 < - (await neutronClient.getHeight()), + (await neutronClient.getHeight()), 20, ); @@ -887,7 +885,7 @@ describe('Neutron / Interchain KV Query', () => { return ( balances[0].denom === beforeBalances[0].denom && parseInt(balances[0].amount || '0') > - parseInt(beforeBalances[0].amount || '0') + parseInt(beforeBalances[0].amount || '0') ); }, From 859b98b9070615fe0185ad8023dad7b0af3d719a Mon Sep 17 00:00:00 2001 From: Aleksandr Pismenskiy Date: Thu, 19 Sep 2024 15:30:21 +0300 Subject: [PATCH 8/8] fix linter --- src/testcases/run_in_band/interchain_kv_query.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/testcases/run_in_band/interchain_kv_query.test.ts b/src/testcases/run_in_band/interchain_kv_query.test.ts index 8b4d10be..dee876a9 100644 --- a/src/testcases/run_in_band/interchain_kv_query.test.ts +++ b/src/testcases/run_in_band/interchain_kv_query.test.ts @@ -858,7 +858,7 @@ describe('Neutron / Interchain KV Query', () => { async (response) => response.registered_query.last_submitted_result_local_height > 0 && response.registered_query.last_submitted_result_local_height + 5 < - (await neutronClient.getHeight()), + (await neutronClient.getHeight()), 20, ); @@ -885,7 +885,7 @@ describe('Neutron / Interchain KV Query', () => { return ( balances[0].denom === beforeBalances[0].denom && parseInt(balances[0].amount || '0') > - parseInt(beforeBalances[0].amount || '0') + parseInt(beforeBalances[0].amount || '0') ); },