From 424caf12f8f3e8c23f01fcc5a5eceb78354d133f Mon Sep 17 00:00:00 2001 From: quasisamurai Date: Wed, 19 Jun 2024 09:55:30 -0300 Subject: [PATCH 1/5] add new vars --- setup/docker-compose.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/setup/docker-compose.yml b/setup/docker-compose.yml index b6d02891..4865621d 100644 --- a/setup/docker-compose.yml +++ b/setup/docker-compose.yml @@ -62,6 +62,9 @@ services: - RELAYER_NEUTRON_CHAIN_SIGN_KEY_NAME=demowallet3 - RELAYER_NEUTRON_CHAIN_GAS_PRICES=0.5untrn - RELAYER_NEUTRON_CHAIN_GAS_ADJUSTMENT=1.4 + - RELAYER_NEUTRON_CHAIN_DENOM=untrn + RELAYER_NEUTRON_CHAIN_MAX_GAS_PRICE=1000 + RELAYER_NEUTRON_CHAIN_GAS_PRICE_MULTIPLIER=1.1 - RELAYER_NEUTRON_CHAIN_CONNECTION_ID=connection-0 - RELAYER_NEUTRON_CHAIN_DEBUG=true - RELAYER_NEUTRON_CHAIN_ACCOUNT_PREFIX=neutron From 7df688feeb22d0e93751573a7a52b33a5ec130b8 Mon Sep 17 00:00:00 2001 From: quasisamurai Date: Wed, 19 Jun 2024 12:25:45 -0300 Subject: [PATCH 2/5] fix env typos --- setup/docker-compose.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup/docker-compose.yml b/setup/docker-compose.yml index 4865621d..1fdcd7df 100644 --- a/setup/docker-compose.yml +++ b/setup/docker-compose.yml @@ -63,8 +63,8 @@ services: - RELAYER_NEUTRON_CHAIN_GAS_PRICES=0.5untrn - RELAYER_NEUTRON_CHAIN_GAS_ADJUSTMENT=1.4 - RELAYER_NEUTRON_CHAIN_DENOM=untrn - RELAYER_NEUTRON_CHAIN_MAX_GAS_PRICE=1000 - RELAYER_NEUTRON_CHAIN_GAS_PRICE_MULTIPLIER=1.1 + - RELAYER_NEUTRON_CHAIN_MAX_GAS_PRICE=1000 + - RELAYER_NEUTRON_CHAIN_GAS_PRICE_MULTIPLIER=1.1 - RELAYER_NEUTRON_CHAIN_CONNECTION_ID=connection-0 - RELAYER_NEUTRON_CHAIN_DEBUG=true - RELAYER_NEUTRON_CHAIN_ACCOUNT_PREFIX=neutron From bd044eba9db1ac1c2e519b2285fa0067866ada95 Mon Sep 17 00:00:00 2001 From: Julian Compagni Portis Date: Fri, 21 Jun 2024 12:23:50 -0400 Subject: [PATCH 3/5] fix incorrect params in TF test --- src/testcases/run_in_band/parameters.test.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/testcases/run_in_band/parameters.test.ts b/src/testcases/run_in_band/parameters.test.ts index ab4af04d..8d895542 100644 --- a/src/testcases/run_in_band/parameters.test.ts +++ b/src/testcases/run_in_band/parameters.test.ts @@ -129,7 +129,7 @@ describe('Neutron / Parameters', () => { 'Tokenfactory params proposal', updateTokenfacoryParamsProposal({ fee_collector_address: await neutronChain.getNeutronDAOCore(), - denom_creation_fee: null, + denom_creation_fee: [{ denom: 'untrn', amount: '1' }], denom_creation_gas_consume: 100000, }), '1000', @@ -156,13 +156,18 @@ describe('Neutron / Parameters', () => { test('check if params changed after proposal execution', async () => { const paramsAfter = await neutronChain.queryTokenfactoryParams(); - expect(paramsAfter.params.denom_creation_fee).toEqual( + expect(paramsAfter.params.denom_creation_fee).not.toEqual( paramsBefore.params.denom_creation_fee, ); expect(paramsAfter.params.denom_creation_gas_consume).not.toEqual( paramsBefore.params.denom_creation_gas_consume, ); - expect(paramsAfter.params.denom_creation_fee).toHaveLength(0); + expect(paramsAfter.params.denom_creation_fee).toEqual([ + { + denom: 'untrn', + amount: '1', + }, + ]); expect(paramsAfter.params.denom_creation_gas_consume).toEqual('100000'); }); }); From ab6ae4d67401ed2947efa6c0a27b4af08cfdc55a Mon Sep 17 00:00:00 2001 From: nhpd Date: Mon, 1 Jul 2024 15:19:51 +0400 Subject: [PATCH 4/5] fix: add test that empty metadata_JSON does not break contract serialization --- src/testcases/run_in_band/slinky.test.ts | 30 ++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/testcases/run_in_band/slinky.test.ts b/src/testcases/run_in_band/slinky.test.ts index a9bf3ed2..4de70912 100644 --- a/src/testcases/run_in_band/slinky.test.ts +++ b/src/testcases/run_in_band/slinky.test.ts @@ -94,6 +94,26 @@ describe('Neutron / Slinky', () => { }, ], }, + { + ticker: { + currency_pair: { + Base: 'USDT', + Quote: 'USD', + }, + decimals: 6, + min_provider_count: 1, + enabled: false, + metadata_JSON: '', + }, + provider_configs: [ + { + name: 'kraken_api', + off_chain_ticker: 'USDTUSD', + invert: false, + metadata_JSON: '', + }, + ], + }, ], ); }); @@ -220,6 +240,16 @@ describe('Neutron / Slinky', () => { expect(res.market).toBeDefined(); }); + test('query market with empty metadata_JSON', async () => { + const res = await neutronChain.queryContract( + contractAddress, + { + market: { currency_pair: { Base: 'USDT', Quote: 'USD' } }, + }, + ); + expect(res.market).toBeDefined(); + }); + test('query market map', async () => { const res = await neutronChain.queryContract( contractAddress, From d8260ed884a1bb39f2b7bd2315542cdf5503b478 Mon Sep 17 00:00:00 2001 From: nhpd Date: Tue, 2 Jul 2024 19:52:53 +0400 Subject: [PATCH 5/5] also test for last_updated query before marketmap created --- src/testcases/run_in_band/slinky.test.ts | 85 ++++++++++++++---------- 1 file changed, 49 insertions(+), 36 deletions(-) diff --git a/src/testcases/run_in_band/slinky.test.ts b/src/testcases/run_in_band/slinky.test.ts index 4de70912..e85433ee 100644 --- a/src/testcases/run_in_band/slinky.test.ts +++ b/src/testcases/run_in_band/slinky.test.ts @@ -35,6 +35,9 @@ describe('Neutron / Slinky', () => { let proposalId: number; + let oracleContract: string; + let marketmapContract: string; + beforeAll(async () => { testState = new TestStateLocalCosmosTestNet(config); await testState.init(); @@ -66,6 +69,44 @@ describe('Neutron / Slinky', () => { }); }); + describe('prepare: deploy contract', () => { + test('setup oracle contract', async () => { + const codeId = await neutronAccount.storeWasm(NeutronContract.ORACLE); + expect(codeId).toBeGreaterThan(0); + + const res = await neutronAccount.instantiateContract( + codeId, + '{}', + 'oracle', + ); + oracleContract = res[0]._contract_address; + }); + + test('setup marketmap contract', async () => { + const codeId = await neutronAccount.storeWasm(NeutronContract.MARKETMAP); + expect(codeId).toBeGreaterThan(0); + + const res = await neutronAccount.instantiateContract( + codeId, + '{}', + 'marketmap', + ); + marketmapContract = res[0]._contract_address; + }); + }); + + describe('before create market map', () => { + test('query last should return null', async () => { + const res = await neutronChain.queryContract( + marketmapContract, + { + last_updated: {}, + }, + ); + expect(res.last_updated).toBe(null); + }); + }); + describe('submit proposal', () => { test('create proposal', async () => { const chainManagerAddress = (await neutronChain.getChainAdmins())[0]; @@ -157,23 +198,9 @@ describe('Neutron / Slinky', () => { }); describe('wasmbindings oracle', () => { - let contractAddress: string; - - test('setup contract', async () => { - const codeId = await neutronAccount.storeWasm(NeutronContract.ORACLE); - expect(codeId).toBeGreaterThan(0); - - const res = await neutronAccount.instantiateContract( - codeId, - '{}', - 'oracle', - ); - contractAddress = res[0]._contract_address; - }); - test('query prices', async () => { const res = await neutronChain.queryContract( - contractAddress, + oracleContract, { get_prices: { currency_pair_ids: ['TIA/USD'], @@ -186,7 +213,7 @@ describe('Neutron / Slinky', () => { test('query price', async () => { const res = await neutronChain.queryContract( - contractAddress, + oracleContract, { get_price: { currency_pair: { Base: 'TIA', Quote: 'USD' } }, }, @@ -196,7 +223,7 @@ describe('Neutron / Slinky', () => { test('query currencies', async () => { const res = await neutronChain.queryContract( - contractAddress, + oracleContract, { get_all_currency_pairs: {}, }, @@ -206,23 +233,9 @@ describe('Neutron / Slinky', () => { }); }); describe('wasmbindings marketmap', () => { - let contractAddress: string; - - test('setup contract', async () => { - const codeId = await neutronAccount.storeWasm(NeutronContract.MARKETMAP); - expect(codeId).toBeGreaterThan(0); - - const res = await neutronAccount.instantiateContract( - codeId, - '{}', - 'marketmap', - ); - contractAddress = res[0]._contract_address; - }); - test('query last', async () => { const res = await neutronChain.queryContract( - contractAddress, + marketmapContract, { last_updated: {}, }, @@ -232,7 +245,7 @@ describe('Neutron / Slinky', () => { test('query market', async () => { const res = await neutronChain.queryContract( - contractAddress, + marketmapContract, { market: { currency_pair: { Base: 'TIA', Quote: 'USD' } }, }, @@ -242,7 +255,7 @@ describe('Neutron / Slinky', () => { test('query market with empty metadata_JSON', async () => { const res = await neutronChain.queryContract( - contractAddress, + marketmapContract, { market: { currency_pair: { Base: 'USDT', Quote: 'USD' } }, }, @@ -252,7 +265,7 @@ describe('Neutron / Slinky', () => { test('query market map', async () => { const res = await neutronChain.queryContract( - contractAddress, + marketmapContract, { market_map: {}, }, @@ -265,7 +278,7 @@ describe('Neutron / Slinky', () => { test('query params', async () => { const res = await neutronChain.queryContract( - contractAddress, + marketmapContract, { params: {}, },