From b8202d207e5859d51070cabcd6038a815362428d Mon Sep 17 00:00:00 2001 From: Eshel Date: Wed, 14 Jun 2023 13:12:17 +0300 Subject: [PATCH 1/2] seems that txsQuery doesn't work for a SecretNetworkClient that has aminoWallet in it, this is a temporary fix --- test/ibc.test.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/ibc.test.ts b/test/ibc.test.ts index 876051d3..878b9d18 100644 --- a/test/ibc.test.ts +++ b/test/ibc.test.ts @@ -420,7 +420,11 @@ describe("ibcResponses", () => { } expect(tx.code).toBe(TxResultCode.Success); - const txs = await secretjs.query.txsQuery( + const readonly = new SecretNetworkClient({ + chainId: "secretdev-1", + url: "http://localhost:1317", + }); + const txs = await readonly.query.txsQuery( `tx.hash='${tx.transactionHash}'`, ); From 8588a12f1d3359b64c126bbef5d0a5ba009bc1ff Mon Sep 17 00:00:00 2001 From: Eshel Date: Thu, 15 Jun 2023 17:58:40 +0300 Subject: [PATCH 2/2] more direct potential solution to undeterministic behaviour --- test/ibc.test.ts | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/test/ibc.test.ts b/test/ibc.test.ts index 878b9d18..68e47114 100644 --- a/test/ibc.test.ts +++ b/test/ibc.test.ts @@ -30,7 +30,7 @@ import { createIbcChannel, createIbcConnection, loopRelayer, - passParameterChangeProposal, + passParameterChangeProposal, sleep, turnIbcSwitchOff, turnIbcSwitchOn, waitForChainToStart, @@ -420,13 +420,17 @@ describe("ibcResponses", () => { } expect(tx.code).toBe(TxResultCode.Success); - const readonly = new SecretNetworkClient({ - chainId: "secretdev-1", - url: "http://localhost:1317", - }); - const txs = await readonly.query.txsQuery( - `tx.hash='${tx.transactionHash}'`, - ); + let txs: TxResponse[] = []; + let tries = 4; + while (txs?.length === 0 && tries > 0) { + // since this is immediately after tx broadcast, + // give some time for it to register in the node + await sleep(150); + txs = await secretjs.query.txsQuery( + `tx.hash='${tx.transactionHash}'`, + ); + tries--; + } expect(txs.length).toBe(1); expect(txs[0].ibcResponses.length).toBe(0);