Skip to content

Commit f30b87a

Browse files
author
Andrei Zavgorodnii
committed
Merge branch 'refs/heads/main' into feat/flashloans
2 parents c091f65 + f7bb92f commit f30b87a

File tree

9 files changed

+292
-50
lines changed

9 files changed

+292
-50
lines changed

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@
4646
"@cosmjs/cosmwasm-stargate": "^0.32.4",
4747
"@cosmjs/stargate": "0.32.4",
4848
"@cosmjs/tendermint-rpc": "^0.32.4",
49-
"@neutron-org/neutronjs": "https://github.com/neutron-org/neutronjs.git#7f45328320b53b4fa2b572bc25bb96bf80260181",
50-
"@neutron-org/neutronjsplus": "https://github.com/neutron-org/neutronjsplus.git#39dd19b17165ef206b40018ff437054210c2bdbc",
49+
"@neutron-org/neutronjs": "https://github.com/neutron-org/neutronjs.git#8ca4875e81fc7cdfffab513bb410ca7cff09db78",
50+
"@neutron-org/neutronjsplus": "https://github.com/neutron-org/neutronjsplus.git#131eade8a4f26c17af90fa1b6fdb016b2581e56c",
5151
"@types/lodash": "^4.14.182",
5252
"axios": "1.6.0",
5353
"commander": "^10.0.0",
@@ -91,4 +91,4 @@
9191
"engines": {
9292
"node": ">=20.0"
9393
}
94-
}
94+
}

setup/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ build-neutron:
88
cd $(APP_DIR)/neutron && $(MAKE) build-docker-image
99

1010
build-hermes:
11-
@docker build -f dockerbuilds/Dockerfile.hermes -t hermes:1.10.1 .
11+
@docker build -f dockerbuilds/Dockerfile.hermes -t hermes:1.10.4 .
1212

1313
build-relayer:
1414
cd $(APP_DIR)/neutron-query-relayer/ && make build-docker

setup/docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ services:
3636
- neutron-testing
3737

3838
hermes:
39-
image: hermes:1.10.1
39+
image: hermes:1.10.4
4040
depends_on:
4141
- "neutron-node"
4242
- "gaia-node"

setup/dockerbuilds/Dockerfile.hermes

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
FROM ubuntu:23.04
1+
FROM ubuntu:24.04
22
COPY ./hermes/ /app/network/hermes/
33
WORKDIR /app
44
RUN apt-get update && apt-get install -y wget && \
55
PLATFORM=`uname -a | awk '{print $(NF-1)}'` && \
6-
VERSION=v1.10.1 && \
6+
VERSION=v1.10.4 && \
77
TARNAME="hermes-${VERSION}-${PLATFORM}-unknown-linux-gnu.tar.gz" && \
88
wget "https://github.com/informalsystems/hermes/releases/download/${VERSION}/${TARNAME}" && \
99
tar -xf "$TARNAME" && \

src/testcases/parallel/grpc_queries.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ describe('Neutron / Grpc Queries', () => {
226226
const res = await neutronClient.queryContractSmart(contractAddress, {
227227
tokenfactory_params: {},
228228
});
229-
expect(res.params.denom_creation_gas_consume).toBe('0');
229+
expect(res.params.denom_creation_gas_consume).toBe(null);
230230
});
231231

232232
test('tokenfactory denom authority metadata should work', async () => {

src/testcases/run_in_band/chain_manager.test.ts

Lines changed: 251 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ import {
1313
updateTokenfactoryParamsProposal,
1414
AddSchedule,
1515
RemoveSchedule,
16+
updateGlobalFeeParamsProposal,
17+
updateConsumerParamsProposal,
1618
} from '@neutron-org/neutronjsplus/dist/proposal';
1719
import { LocalState } from '../../helpers/local_state';
1820
import { RunnerTestSuite, inject } from 'vitest';
@@ -23,6 +25,9 @@ import { QueryClientImpl as AdminQueryClient } from '@neutron-org/neutronjs/cosm
2325
import { QueryClientImpl as TokenfactoryQueryClient } from '@neutron-org/neutronjs/osmosis/tokenfactory/v1beta1/query.rpc.Query';
2426
import { QueryClientImpl as UpgradeQueryClient } from '@neutron-org/neutronjs/cosmos/upgrade/v1beta1/query.rpc.Query';
2527
import { QueryClientImpl as DexQueryClient } from '@neutron-org/neutronjs/neutron/dex/query.rpc.Query';
28+
import { QueryClientImpl as DynamicfeesQueryClient } from '@neutron-org/neutronjs/neutron/dynamicfees/v1/query.rpc.Query';
29+
import { QueryClientImpl as GlobalfeeQueryClient } from '@neutron-org/neutronjs/gaia/globalfee/v1beta1/query.rpc.Query';
30+
import { QueryClientImpl as CCVQueryClient } from '@neutron-org/neutronjs/interchain_security/ccv/consumer/v1/query.rpc.Query';
2631
import { SigningNeutronClient } from '../../helpers/signing_neutron_client';
2732
import config from '../../config.json';
2833
import { Wallet } from '../../helpers/wallet';
@@ -39,6 +44,9 @@ describe('Neutron / Chain Manager', () => {
3944
let cronQuerier: CronQueryClient;
4045
let tokenfactoryQuerier: TokenfactoryQueryClient;
4146
let dexQuerier: DexQueryClient;
47+
let dynamicfeesQuerier: DynamicfeesQueryClient;
48+
let globalfeeQuerier: GlobalfeeQueryClient;
49+
let ccvQuerier: CCVQueryClient;
4250
let upgradeQuerier: UpgradeQueryClient;
4351
let chainManagerAddress: string;
4452

@@ -97,6 +105,9 @@ describe('Neutron / Chain Manager', () => {
97105
cronQuerier = new CronQueryClient(neutronRpcClient);
98106
dexQuerier = new DexQueryClient(neutronRpcClient);
99107
upgradeQuerier = new UpgradeQueryClient(neutronRpcClient);
108+
dynamicfeesQuerier = new DynamicfeesQueryClient(neutronRpcClient);
109+
globalfeeQuerier = new GlobalfeeQueryClient(neutronRpcClient);
110+
ccvQuerier = new CCVQueryClient(neutronRpcClient);
100111
});
101112

102113
// We need to do this because the real main dao has a super long voting period.
@@ -205,6 +216,34 @@ describe('Neutron / Chain Manager', () => {
205216
good_til_purge_allowance: true,
206217
},
207218
},
219+
{
220+
update_ccv_params_permission: {
221+
blocks_per_distribution_transmission: true,
222+
distribution_transmission_channel: true,
223+
provider_fee_pool_addr_str: true,
224+
ccv_timeout_period: true,
225+
transfer_timeout_period: true,
226+
consumer_redistribution_fraction: true,
227+
historical_entries: true,
228+
unbonding_period: true,
229+
soft_opt_out_threshold: true,
230+
reward_denoms: true,
231+
provider_reward_denoms: true,
232+
retry_delay_period: true,
233+
},
234+
},
235+
{
236+
update_globalfee_params_permission: {
237+
minimum_gas_prices: true,
238+
bypass_min_fee_msg_types: true,
239+
max_total_bypass_min_fee_msg_gas_usage: true,
240+
},
241+
},
242+
{
243+
update_dynamicfees_params_permission: {
244+
ntrn_prices: true,
245+
},
246+
},
208247
],
209248
},
210249
},
@@ -252,6 +291,7 @@ describe('Neutron / Chain Manager', () => {
252291
});
253292

254293
test('execute timelocked: success', async () => {
294+
const cronParamsBefore = await cronQuerier.params();
255295
await waitSeconds(10);
256296

257297
await subdaoMember1.executeTimelockedProposal(proposalId);
@@ -262,6 +302,12 @@ describe('Neutron / Chain Manager', () => {
262302

263303
const cronParams = await cronQuerier.params();
264304
expect(cronParams.params.limit).toEqual(42n);
305+
// check that every params field before proposal execution differs from the field after proposal execution
306+
expect(
307+
Object.keys(cronParamsBefore).every(
308+
(key) => cronParamsBefore[key] !== cronParams[key],
309+
),
310+
).toBeTrue();
265311
});
266312
});
267313

@@ -290,13 +336,13 @@ describe('Neutron / Chain Manager', () => {
290336
const timelockedProp = await subdaoMember1.supportAndExecuteProposal(
291337
proposalId,
292338
);
293-
294339
expect(timelockedProp.id).toEqual(proposalId);
295340
expect(timelockedProp.status).toEqual('timelocked');
296341
expect(timelockedProp.msgs).toHaveLength(1);
297342
});
298343

299344
test('execute timelocked: success', async () => {
345+
const tokenfactoryParamsBefore = await tokenfactoryQuerier.params();
300346
await waitSeconds(10);
301347

302348
await subdaoMember1.executeTimelockedProposal(proposalId);
@@ -319,13 +365,21 @@ describe('Neutron / Chain Manager', () => {
319365
denomCreator: 'neutron1m9l358xunhhwds0568za49mzhvuxx9ux8xafx2',
320366
},
321367
]);
368+
// check that every params field before proposal execution differs from the field after proposal execution
369+
expect(
370+
Object.keys(tokenfactoryParamsBefore).every(
371+
(key) => tokenfactoryParamsBefore[key] !== tokenfactoryParams[key],
372+
),
373+
).toBeTrue();
322374
});
323375
});
324376

325377
describe('ALLOW_ONLY: change DEX parameters', () => {
326378
let proposalId: number;
327379
const newParams = {
328-
fee_tiers: [1, 2, 99],
380+
// types mixed on purpose, to check contract parser.
381+
// Numeric types in neutron-std can be deserialized from both number and string
382+
fee_tiers: ['1', '2', 99],
329383
paused: true,
330384
max_jits_per_block: 11,
331385
good_til_purge_allowance: 50000,
@@ -349,6 +403,7 @@ describe('Neutron / Chain Manager', () => {
349403
});
350404

351405
test('execute timelocked: success', async () => {
406+
const dexParamsBefore = await dexQuerier.params();
352407
await waitSeconds(10);
353408

354409
await subdaoMember1.executeTimelockedProposal(proposalId);
@@ -362,6 +417,200 @@ describe('Neutron / Chain Manager', () => {
362417
expect(dexParams.params.paused).toEqual(true);
363418
expect(dexParams.params.maxJitsPerBlock).toEqual(11n);
364419
expect(dexParams.params.goodTilPurgeAllowance).toEqual(50000n);
420+
// check that every params field before proposal execution differs from the field after proposal execution
421+
expect(
422+
Object.keys(dexParamsBefore).every(
423+
(key) => dexParamsBefore[key] !== dexParams[key],
424+
),
425+
).toBeTrue();
426+
});
427+
});
428+
429+
describe('ALLOW_ONLY: change Dynamicfees parameters', () => {
430+
let proposalId: number;
431+
beforeAll(async () => {
432+
proposalId = await subdaoMember1.submitDynamicfeesChangeParamsProposal(
433+
chainManagerAddress,
434+
'Proposal #2',
435+
'Dynamicfees update params proposal. Will pass',
436+
'1000',
437+
{
438+
ntrn_prices: [{ denom: 'newdenom', amount: '0.5' }],
439+
},
440+
);
441+
442+
const timelockedProp = await subdaoMember1.supportAndExecuteProposal(
443+
proposalId,
444+
);
445+
446+
expect(timelockedProp.id).toEqual(proposalId);
447+
expect(timelockedProp.status).toEqual('timelocked');
448+
expect(timelockedProp.msgs).toHaveLength(1);
449+
});
450+
451+
test('execute timelocked: success', async () => {
452+
const dynamicfeesParamsBefore = await dynamicfeesQuerier.params();
453+
await waitSeconds(10);
454+
455+
await subdaoMember1.executeTimelockedProposal(proposalId);
456+
const timelockedProp = await subDao.getTimelockedProposal(proposalId);
457+
expect(timelockedProp.id).toEqual(proposalId);
458+
expect(timelockedProp.status).toEqual('executed');
459+
expect(timelockedProp.msgs).toHaveLength(1);
460+
461+
const dynamicfeesParams = await dynamicfeesQuerier.params();
462+
expect(dynamicfeesParams.params.ntrnPrices).toEqual([
463+
{ denom: 'newdenom', amount: '0.5' },
464+
]);
465+
// check that every params field before proposal execution differs from the field after proposal execution
466+
expect(
467+
Object.keys(dynamicfeesParamsBefore).every(
468+
(key) => dynamicfeesParamsBefore[key] !== dynamicfeesParams[key],
469+
),
470+
).toBeTrue();
471+
});
472+
});
473+
474+
describe('ALLOW_ONLY: change Globalfee parameters', () => {
475+
let proposalId: number;
476+
beforeAll(async () => {
477+
proposalId = await subdaoMember1.submitUpdateParamsGlobalfeeProposal(
478+
chainManagerAddress,
479+
'Proposal #3',
480+
'Globalfee update params proposal. Will pass',
481+
updateGlobalFeeParamsProposal({
482+
minimum_gas_prices: [{ denom: 'untrn', amount: '0.00111' }],
483+
bypass_min_fee_msg_types: ['/gaia.globalfee.v1beta1.MsgUpdateParams'],
484+
max_total_bypass_min_fee_msg_gas_usage: '12345',
485+
}),
486+
'1000',
487+
);
488+
489+
const timelockedProp = await subdaoMember1.supportAndExecuteProposal(
490+
proposalId,
491+
);
492+
493+
expect(timelockedProp.id).toEqual(proposalId);
494+
expect(timelockedProp.status).toEqual('timelocked');
495+
expect(timelockedProp.msgs).toHaveLength(1);
496+
});
497+
498+
test('execute timelocked: success', async () => {
499+
const globalfeeParamsBefore = await globalfeeQuerier.params();
500+
await waitSeconds(10);
501+
502+
await subdaoMember1.executeTimelockedProposal(proposalId);
503+
const timelockedProp = await subDao.getTimelockedProposal(proposalId);
504+
expect(timelockedProp.id).toEqual(proposalId);
505+
expect(timelockedProp.status).toEqual('executed');
506+
expect(timelockedProp.msgs).toHaveLength(1);
507+
508+
const globalfeeParams = await globalfeeQuerier.params();
509+
expect(globalfeeParams.params.minimumGasPrices).toEqual([
510+
{ denom: 'untrn', amount: '0.00111' },
511+
]);
512+
expect(globalfeeParams.params.bypassMinFeeMsgTypes).toEqual([
513+
'/gaia.globalfee.v1beta1.MsgUpdateParams',
514+
]);
515+
expect(globalfeeParams.params.maxTotalBypassMinFeeMsgGasUsage).toEqual(
516+
12345n,
517+
);
518+
// check that every params field before proposal execution differs from the field after proposal execution
519+
expect(
520+
Object.keys(globalfeeParamsBefore).every(
521+
(key) => globalfeeParamsBefore[key] !== globalfeeParams[key],
522+
),
523+
).toBeTrue();
524+
});
525+
});
526+
527+
describe('ALLOW_ONLY: change ccv consumer parameters', () => {
528+
let proposalId: number;
529+
beforeAll(async () => {
530+
proposalId = await subdaoMember1.submitUpdateParamsConsumerProposal(
531+
chainManagerAddress,
532+
'Proposal #4',
533+
'Consumer update params proposal. Will pass',
534+
updateConsumerParamsProposal({
535+
enabled: true,
536+
blocks_per_distribution_transmission: 321,
537+
distribution_transmission_channel: 'channel-23',
538+
provider_fee_pool_addr_str: chainManagerAddress,
539+
ccv_timeout_period: '32s',
540+
transfer_timeout_period: '23s',
541+
consumer_redistribution_fraction: '0.33',
542+
historical_entries: 123,
543+
unbonding_period: '43s',
544+
soft_opt_out_threshold: '0.55',
545+
reward_denoms: ['tia'],
546+
provider_reward_denoms: ['tia'],
547+
retry_delay_period: '43s',
548+
}),
549+
'1000',
550+
);
551+
552+
const timelockedProp = await subdaoMember1.supportAndExecuteProposal(
553+
proposalId,
554+
);
555+
556+
expect(timelockedProp.id).toEqual(proposalId);
557+
expect(timelockedProp.status).toEqual('timelocked');
558+
expect(timelockedProp.msgs).toHaveLength(1);
559+
});
560+
561+
test('execute timelocked: success', async () => {
562+
const ccvParamsBefore = await ccvQuerier.queryParams();
563+
await waitSeconds(10);
564+
565+
await subdaoMember1.executeTimelockedProposal(proposalId);
566+
console.log(
567+
'subdao',
568+
subdaoMember1.dao.contracts.proposals['single'].pre_propose.timelock
569+
.address,
570+
);
571+
const timelockedProp = await subDao.getTimelockedProposal(proposalId);
572+
expect(timelockedProp.id).toEqual(proposalId);
573+
expect(timelockedProp.status).toEqual('executed');
574+
expect(timelockedProp.msgs).toHaveLength(1);
575+
576+
const ccvParams = await ccvQuerier.queryParams();
577+
expect(ccvParams.params.enabled).toEqual(true);
578+
expect(ccvParams.params.blocksPerDistributionTransmission).toEqual(321n);
579+
expect(ccvParams.params.distributionTransmissionChannel).toEqual(
580+
'channel-23',
581+
);
582+
expect(ccvParams.params.providerFeePoolAddrStr).toEqual(
583+
chainManagerAddress,
584+
);
585+
expect(ccvParams.params.ccvTimeoutPeriod).toEqual({
586+
nanos: 0,
587+
seconds: 32n,
588+
});
589+
expect(ccvParams.params.transferTimeoutPeriod).toEqual({
590+
nanos: 0,
591+
seconds: 23n,
592+
});
593+
expect(ccvParams.params.consumerRedistributionFraction).toEqual('0.33');
594+
expect(ccvParams.params.historicalEntries).toEqual(123n);
595+
expect(ccvParams.params.unbondingPeriod).toEqual({
596+
nanos: 0,
597+
seconds: 43n,
598+
});
599+
expect(ccvParams.params.softOptOutThreshold).toEqual('0.55');
600+
expect(ccvParams.params.rewardDenoms).toEqual(['tia']);
601+
expect(ccvParams.params.providerRewardDenoms).toEqual(['tia']);
602+
expect(ccvParams.params.retryDelayPeriod).toEqual({
603+
nanos: 0,
604+
seconds: 43n,
605+
});
606+
// field 'enabled' is readonly, and should not be changed, always equals true
607+
delete ccvParamsBefore['enabled'];
608+
// check that every params field before proposal execution differs from the field after proposal execution
609+
expect(
610+
Object.keys(ccvParamsBefore).every(
611+
(key) => ccvParamsBefore[key] !== ccvParams[key],
612+
),
613+
).toBeTrue();
365614
});
366615
});
367616

0 commit comments

Comments
 (0)