Skip to content

Commit 6035d47

Browse files
committed
pr cleanups
1 parent 810c140 commit 6035d47

File tree

7 files changed

+27
-37
lines changed

7 files changed

+27
-37
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@
4040
"test:staking-vault-with-rewards-on-pause": "PAUSE_REWARDS=1 vitest --run src/testcases/run_in_band/staking-vault.test.ts --bail 1",
4141
"lint": "eslint ./src",
4242
"fmt": "eslint ./src --fix",
43-
"build:neutronjs": "[ -d './node_modules/@neutron-org/neutronjs/build' ] || { yarn tsc -p ./node_modules/@neutron-org/neutronjs/tsconfig.json && cp -R ./node_modules/@neutron-org/neutronjs/build/* ./node_modules/@neutron-org/neutronjs/ ; }",
4443
"build:neutronjsplus": "[ -d './node_modules/@neutron-org/neutronjsplus/dist' ] || tsc -p ./node_modules/@neutron-org/neutronjsplus/tsconfig.json",
4544
"build:tsrelayer": "[ -d './node_modules/@confio/relayer/dist' ] || tsc -p ./tsconfig.relayer.json",
45+
"build:neutronjs": "[ -d './node_modules/@neutron-org/neutronjs/build' ] || { yarn tsc -p ./node_modules/@neutron-org/neutronjs/tsconfig.json && cp -R ./node_modules/@neutron-org/neutronjs/build/* ./node_modules/@neutron-org/neutronjs/ ; }",
4646
"postinstall": "yarn build:tsrelayer && yarn build:neutronjs && yarn build:neutronjsplus"
4747
},
4848
"author": "Neutron",

src/global_setup.ts

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -94,21 +94,23 @@ async function fundWallets(
9494

9595
let outputs: Output[] = [];
9696

97-
// Process mnemonics sequentially with small delays to avoid overwhelming the system
98-
const LOG_INTERVAL = 100;
99-
const maxRetries = 3; // Used for all retry logic in this function
97+
// due to some unexpected errors during setup, there is retry logic on exceptions
98+
// related issue: https://github.com/nodejs/undici/issues/3492
99+
const maxRetries = 3;
100100

101101
for (let i = 0; i < mnemonics.length; i++) {
102-
const mnemonic = mnemonics[i];
103-
const directwallet = await DirectSecp256k1HdWallet.fromMnemonic(mnemonic, {
104-
prefix: prefix,
105-
});
106-
107102
// Get accounts with retry logic
108103
let accounts = null;
109104
let retries = 0;
110105
while (retries < maxRetries && !accounts) {
106+
const mnemonic = mnemonics[i];
111107
try {
108+
const directwallet = await DirectSecp256k1HdWallet.fromMnemonic(
109+
mnemonic,
110+
{
111+
prefix: prefix,
112+
},
113+
);
112114
accounts = await directwallet.getAccounts();
113115
} catch (error) {
114116
retries++;
@@ -133,12 +135,6 @@ async function fundWallets(
133135
coins: [{ denom: denom, amount: poorAmount }],
134136
};
135137
outputs.push(output);
136-
137-
// Log progress and add small delay every 100 wallets to let system breathe
138-
if ((i + 1) % LOG_INTERVAL === 0) {
139-
// Small delay to prevent connection pool exhaustion
140-
await waitSeconds(0.5);
141-
}
142138
}
143139

144140
if (prefix === NEUTRON_PREFIX) {
@@ -178,7 +174,7 @@ async function fundWallets(
178174
`Connection attempt ${connectRetries}/${maxRetries} failed, retrying...`,
179175
);
180176
if (connectRetries < maxRetries) {
181-
await waitSeconds(2);
177+
await waitSeconds(1);
182178
} else {
183179
throw error;
184180
}
@@ -199,7 +195,7 @@ async function fundWallets(
199195
];
200196
const value: MsgMultiSend = {
201197
inputs,
202-
outputs: outputs,
198+
outputs,
203199
};
204200
const msg: any = {
205201
typeUrl: MsgMultiSend.typeUrl,
@@ -223,7 +219,7 @@ async function fundWallets(
223219
`Broadcast attempt ${broadcastRetries}/${maxRetries} failed, retrying...`,
224220
);
225221
if (broadcastRetries < maxRetries) {
226-
await waitSeconds(2);
222+
await waitSeconds(1);
227223
} else {
228224
throw error;
229225
}

src/helpers/constants.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,11 @@ export const CONTRACTS = {
8080

8181
export const NEUTRON_PREFIX = process.env.NEUTRON_ADDRESS_PREFIX || 'neutron';
8282
export const COSMOS_PREFIX = process.env.COSMOS_ADDRESS_PREFIX || 'cosmos';
83-
export const NEUTRON_RPC = process.env.NODE1_RPC || 'http://127.0.0.1:26657';
84-
export const GAIA_RPC = process.env.NODE2_RPC || 'http://127.0.0.1:16657';
85-
export const NEUTRON_REST = process.env.NODE1_URL || 'http://127.0.0.1:1317';
86-
export const GAIA_REST = process.env.NODE2_URL || 'http://127.0.0.1:1316';
87-
export const IBC_WEB_HOST = process.env.ICQ_WEB_HOST || 'http://127.0.0.1:9999';
83+
export const NEUTRON_RPC = process.env.NODE1_RPC || 'http://localhost:26657';
84+
export const GAIA_RPC = process.env.NODE2_RPC || 'http://localhost:16657';
85+
export const NEUTRON_REST = process.env.NODE1_URL || 'http://localhost:1317';
86+
export const GAIA_REST = process.env.NODE2_URL || 'http://localhost:1316';
87+
export const IBC_WEB_HOST = process.env.ICQ_WEB_HOST || 'http://localhost:9999';
8888
export const GAIA_CONNECTION = 'connection-0';
8989
export const WALLETS_SIGN_METHOD = process.env.WALLETS_SIGN_METHOD || 'random';
9090

src/helpers/neutron_test_client.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,9 @@ export class NeutronTestClient extends CosmWasmClient {
161161
const resTx = await this.client.getTx(res.transactionHash);
162162

163163
if (resTx === null) {
164-
return Promise.reject('no transaction found');
164+
return Promise.reject(
165+
'no transaction found with hash=' + res.transactionHash,
166+
);
165167
}
166168

167169
return resTx;

src/testcases/parallel/grpc_queries.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,14 +156,14 @@ describe('Neutron / Grpc Queries', () => {
156156
expect(res.account.address).toBe(neutronWallet.address);
157157
});
158158

159-
test.skip('transfer denom trace should work', async () => {
159+
test('transfer denom should work', async () => {
160160
const res = await neutronClient.queryContractSmart(contractAddress, {
161-
transfer_denom_trace: {
161+
transfer_denom: {
162162
hash: 'ibc/27394FB092D2ECCD56123C74F36E4C1F926001CEADA9CA97EA622B25F41E5EB2',
163163
},
164164
});
165-
expect(res.denom_trace.path).toBe('transfer/channel-0');
166-
expect(res.denom_trace.base_denom).toBe(COSMOS_DENOM);
165+
expect(res.denom.trace).toBe('transfer/channel-0');
166+
expect(res.denom.base).toBe(COSMOS_DENOM);
167167
});
168168

169169
test('transfer escrow address should work', async () => {

src/testcases/run_in_band/interchaintx.test.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1319,11 +1319,7 @@ describe('Neutron / Interchain TXs', () => {
13191319
const channel = (await ibcQuerier.channels({})).channels.find(
13201320
(c) => c.ordering === Order.ORDER_UNORDERED,
13211321
);
1322-
if (!channel) {
1323-
expect(channel).not.toBeEmpty();
1324-
} else {
1325-
expect(channel.state).toEqual(State.STATE_OPEN);
1326-
}
1322+
expect(channel.state).toEqual(State.STATE_OPEN);
13271323
});
13281324

13291325
test('delegate after the timeout on unordered channel should work as channel should still be open', async () => {

tsconfig.relayer.json

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)