From 1d910962fd658b1c693e64feb6976132a6a3641b Mon Sep 17 00:00:00 2001 From: Andrei Zavgorodnii Date: Thu, 8 Feb 2024 12:29:07 +0200 Subject: [PATCH 01/15] feat: privileged subdaos --- src/testcases/parallel/dao_assert.test.ts | 2 +- src/testcases/parallel/governance.test.ts | 42 ++++++++++++++++++- src/testcases/parallel/subdao.test.ts | 21 ++++++---- src/testcases/run_in_band/globalfee.test.ts | 2 +- .../run_in_band/interchain_kv_query.test.ts | 4 +- src/testcases/run_in_band/parameters.test.ts | 2 +- src/testcases/run_in_band/reserve.test.ts | 4 +- src/testcases/run_in_band/tge.auction.test.ts | 2 +- 8 files changed, 63 insertions(+), 16 deletions(-) diff --git a/src/testcases/parallel/dao_assert.test.ts b/src/testcases/parallel/dao_assert.test.ts index 91376dd7..93db9930 100644 --- a/src/testcases/parallel/dao_assert.test.ts +++ b/src/testcases/parallel/dao_assert.test.ts @@ -38,7 +38,7 @@ describe('DAO / Check', () => { testState.blockWaiter1, NEUTRON_DENOM, ); - const daoCoreAddress = (await neutronChain.getChainAdmins())[0]; //add assert for some addresses + const daoCoreAddress = await neutronChain.getNeutronDAOCore(); //add assert for some addresses daoContracts = await getDaoContracts(neutronChain, daoCoreAddress); proposalSingleAddress = daoContracts.proposals.single.address; preProposalSingleAddress = diff --git a/src/testcases/parallel/governance.test.ts b/src/testcases/parallel/governance.test.ts index eba7a3fc..b3c2e043 100644 --- a/src/testcases/parallel/governance.test.ts +++ b/src/testcases/parallel/governance.test.ts @@ -41,7 +41,7 @@ describe('Neutron / Governance', () => { neutronChain, testState.wallets.qaNeutron.genQaWal1, ); - const daoCoreAddress = (await neutronChain.getChainAdmins())[0]; + const daoCoreAddress = await neutronChain.getNeutronDAOCore(); const daoContracts = await getDaoContracts(neutronChain, daoCoreAddress); mainDao = new Dao(neutronChain, daoContracts); daoMember1 = new DaoMember(neutronAccount, mainDao); @@ -151,7 +151,9 @@ describe('Neutron / Governance', () => { describe('create several proposals', () => { test('create proposal #1, will pass', async () => { + const chainManagerAddress = (await neutronChain.getChainAdmins())[0]; await daoMember1.submitParameterChangeProposal( + chainManagerAddress, 'Proposal #1', 'Param change proposal. This one will pass', 'icahost', @@ -162,7 +164,9 @@ describe('Neutron / Governance', () => { }); test('create proposal #2, will be rejected', async () => { + const chainManagerAddress = (await neutronChain.getChainAdmins())[0]; await daoMember1.submitParameterChangeProposal( + chainManagerAddress, 'Proposal #2', 'Param change proposal. This one will not pass', 'icahost', @@ -188,7 +192,9 @@ describe('Neutron / Governance', () => { }); test('create proposal #4, will pass', async () => { + const chainManagerAddress = (await neutronChain.getChainAdmins())[0]; await daoMember1.submitSoftwareUpgradeProposal( + chainManagerAddress, 'Proposal #4', 'Software upgrade proposal. Will pass', 'Plan #1', @@ -199,7 +205,9 @@ describe('Neutron / Governance', () => { }); test('create proposal #5, will pass', async () => { + const chainManagerAddress = (await neutronChain.getChainAdmins())[0]; await daoMember1.submitCancelSoftwareUpgradeProposal( + chainManagerAddress, 'Proposal #5', 'Software upgrade proposal. Will pass', '1000', @@ -207,7 +215,9 @@ describe('Neutron / Governance', () => { }); test('create proposal #6, will pass', async () => { + const chainManagerAddress = (await neutronChain.getChainAdmins())[0]; await daoMember1.submitClientUpdateProposal( + chainManagerAddress, 'Proposal #6', 'UpdateClient proposal. Will pass', '07-tendermint-2', @@ -217,7 +227,9 @@ describe('Neutron / Governance', () => { }); test('create proposal #7, will pass', async () => { + const chainManagerAddress = (await neutronChain.getChainAdmins())[0]; await daoMember1.submitPinCodesProposal( + chainManagerAddress, 'Proposal #7', 'Pin codes proposal. Will pass', [1, 2], @@ -226,7 +238,9 @@ describe('Neutron / Governance', () => { }); test('create proposal #8, will pass', async () => { + const chainManagerAddress = (await neutronChain.getChainAdmins())[0]; await daoMember1.submitUnpinCodesProposal( + chainManagerAddress, 'Proposal #8', 'Unpin codes proposal. Will pass', [1, 2], @@ -235,7 +249,9 @@ describe('Neutron / Governance', () => { }); test('create proposal #9, will pass', async () => { + const chainManagerAddress = (await neutronChain.getChainAdmins())[0]; await daoMember1.submitUpdateAdminProposal( + chainManagerAddress, 'Proposal #9', 'Update admin proposal. Will pass', ADMIN_MODULE_ADDRESS, @@ -246,7 +262,9 @@ describe('Neutron / Governance', () => { }); test('create proposal #10, will pass', async () => { + const chainManagerAddress = (await neutronChain.getChainAdmins())[0]; await daoMember1.submitClearAdminProposal( + chainManagerAddress, 'Proposal #10', 'Clear admin proposal. Will pass', ADMIN_MODULE_ADDRESS, @@ -257,7 +275,9 @@ describe('Neutron / Governance', () => { // add schedule with valid message format test('create proposal #11, will pass', async () => { + const chainManagerAddress = (await neutronChain.getChainAdmins())[0]; await daoMember1.submitAddSchedule( + chainManagerAddress, 'Proposal #11', '', '1000', @@ -274,7 +294,9 @@ describe('Neutron / Governance', () => { // remove schedule test('create proposal #12, will pass', async () => { + const chainManagerAddress = (await neutronChain.getChainAdmins())[0]; await daoMember1.submitRemoveSchedule( + chainManagerAddress, 'Proposal #12', '', '1000', @@ -284,7 +306,9 @@ describe('Neutron / Governance', () => { // add schedule with 3 messages, first returns error, second in incorrect format, third is valid test('create proposal #13, will pass', async () => { + const chainManagerAddress = (await neutronChain.getChainAdmins())[0]; await daoMember1.submitAddSchedule( + chainManagerAddress, 'Proposal #13', '', '1000', @@ -309,7 +333,9 @@ describe('Neutron / Governance', () => { // add schedule with 3 messages, first is valid, second returns error test('create proposal #14, will pass', async () => { + const chainManagerAddress = (await neutronChain.getChainAdmins())[0]; await daoMember1.submitAddSchedule( + chainManagerAddress, 'Proposal #14', '', '1000', @@ -332,7 +358,9 @@ describe('Neutron / Governance', () => { for (let i = 0; i < 40; i++) await neutronAccount.storeWasm(NeutronContract.RESERVE); const codeids = Array.from({ length: 40 }, (_, i) => i + 1); + const chainManagerAddress = (await neutronChain.getChainAdmins())[0]; await daoMember1.submitPinCodesProposal( + chainManagerAddress, 'Proposal #15', 'Pin codes proposal. Will pass', codeids, @@ -341,7 +369,9 @@ describe('Neutron / Governance', () => { }); test('create proposal #16, will pass', async () => { + const chainManagerAddress = (await neutronChain.getChainAdmins())[0]; await daoMember1.submitParameterChangeProposal( + chainManagerAddress, 'Proposal #16', 'Param change proposal. This one will not pass', 'icahost', @@ -363,7 +393,9 @@ describe('Neutron / Governance', () => { }); test('create proposal #18, will pass', async () => { + const chainManagerAddress = (await neutronChain.getChainAdmins())[0]; await daoMember1.submitPinCodesCustomAuthorityProposal( + chainManagerAddress, 'Proposal #18', 'Pin codes proposal with wrong authority. This one will pass & fail on execution', [1, 2], @@ -373,7 +405,9 @@ describe('Neutron / Governance', () => { }); test('create proposal #19, will pass', async () => { + const chainManagerAddress = (await neutronChain.getChainAdmins())[0]; await daoMember1.submitBankSendProposal( + chainManagerAddress, 'Proposal #19', 'Submit bank send proposal. This one will pass & fail on execution due type is not whitelisted', '1000', @@ -381,7 +415,9 @@ describe('Neutron / Governance', () => { }); test('create multi-choice proposal #1, will be picked choice 1', async () => { + const chainManagerAddress = (await neutronChain.getChainAdmins())[0]; await daoMember1.submitMultiChoiceParameterChangeProposal( + chainManagerAddress, [ { title: 'title', @@ -405,7 +441,9 @@ describe('Neutron / Governance', () => { }); test('create proposal #20, will pass', async () => { + const chainManagerAddress = (await neutronChain.getChainAdmins())[0]; await daoMember1.submitUpdateParamsInterchaintxsProposal( + chainManagerAddress, 'Proposal #20', 'Update interchaintxs params', updateInterchaintxsParamsProposal({ @@ -416,7 +454,9 @@ describe('Neutron / Governance', () => { }); test('create multi-choice proposal #2, will be rejected', async () => { + const chainManagerAddress = (await neutronChain.getChainAdmins())[0]; await daoMember1.submitMultiChoiceParameterChangeProposal( + chainManagerAddress, [ { title: 'title', diff --git a/src/testcases/parallel/subdao.test.ts b/src/testcases/parallel/subdao.test.ts index b22be54a..4b5dec2d 100644 --- a/src/testcases/parallel/subdao.test.ts +++ b/src/testcases/parallel/subdao.test.ts @@ -156,14 +156,18 @@ describe('Neutron / Subdao', () => { let proposalId2: number; test('proposal timelock 2 with two messages, one of them fails', async () => { + const chainManagerAddress = (await neutronChain.getChainAdmins())[0]; // pack two messages in one proposal - const failMessage = paramChangeProposal({ - title: 'paramchange', - description: 'paramchange', - subspace: 'icahost', - key: 'HostEnabled', - value: '123123123', // expected boolean, provided number - }); + const failMessage = paramChangeProposal( + { + title: 'paramchange', + description: 'paramchange', + subspace: 'icahost', + key: 'HostEnabled', + value: '123123123', // expected boolean, provided number + }, + chainManagerAddress, + ); const goodMessage = sendProposal({ to: neutronAccount2.wallet.address.toString(), denom: NEUTRON_DENOM, @@ -546,12 +550,15 @@ describe('Neutron / Subdao', () => { let proposalId: number; test('Non-timelock schedule proposal: Succeed creation', async () => { + const chainManagerAddress = (await neutronChain.getChainAdmins())[0]; proposalId = await subdaoMember1.submitRemoveSchedule( + chainManagerAddress, 'Proposal #12', '', '1000', 'proposal11', 'single_nt_pause', + false, ); await subdaoMember1.voteYes(proposalId, 'single_nt_pause'); diff --git a/src/testcases/run_in_band/globalfee.test.ts b/src/testcases/run_in_band/globalfee.test.ts index 9b024413..657968ba 100644 --- a/src/testcases/run_in_band/globalfee.test.ts +++ b/src/testcases/run_in_band/globalfee.test.ts @@ -34,7 +34,7 @@ describe('Neutron / Global Fee', () => { neutronChain, testState.wallets.qaNeutron.genQaWal1, ); - const daoCoreAddress = (await neutronChain.getChainAdmins())[0]; + const daoCoreAddress = await neutronChain.getNeutronDAOCore(); const daoContracts = await getDaoContracts(neutronChain, daoCoreAddress); daoMain = new Dao(neutronChain, daoContracts); daoMember = new DaoMember(neutronAccount, daoMain); 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 ff4ecd78..29a45985 100644 --- a/src/testcases/run_in_band/interchain_kv_query.test.ts +++ b/src/testcases/run_in_band/interchain_kv_query.test.ts @@ -148,7 +148,7 @@ const acceptInterchainqueriesParamsChangeProposal = async ( key: string, value: string, ) => { - const daoCoreAddress = (await cm.chain.getChainAdmins())[0]; + const daoCoreAddress = await cm.chain.getNeutronDAOCore(); const daoContracts = await getDaoContracts(cm.chain, daoCoreAddress); const dao = new Dao(cm.chain, daoContracts); const daoMember = new DaoMember(cm, dao); @@ -265,7 +265,7 @@ describe('Neutron / Interchain KV Query', () => { ); gaiaAccount = new WalletWrapper(gaiaChain, testState.wallets.cosmos.demo2); - const daoCoreAddress = (await neutronChain.getChainAdmins())[0]; + const daoCoreAddress = await neutronChain.getNeutronDAOCore(); const daoContracts = await getDaoContracts(neutronChain, daoCoreAddress); const dao = new Dao(neutronChain, daoContracts); const daoMember = new DaoMember(neutronAccount, dao); diff --git a/src/testcases/run_in_band/parameters.test.ts b/src/testcases/run_in_band/parameters.test.ts index 2981f19f..e28a9897 100644 --- a/src/testcases/run_in_band/parameters.test.ts +++ b/src/testcases/run_in_band/parameters.test.ts @@ -42,7 +42,7 @@ describe('Neutron / Parameters', () => { neutronChain, testState.wallets.qaNeutron.genQaWal1, ); - const daoCoreAddress = (await neutronChain.getChainAdmins())[0]; + const daoCoreAddress = await neutronChain.getNeutronDAOCore(); const daoContracts = await getDaoContracts(neutronChain, daoCoreAddress); dao = new Dao(neutronChain, daoContracts); daoMember1 = new DaoMember(neutronAccount, dao); diff --git a/src/testcases/run_in_band/reserve.test.ts b/src/testcases/run_in_band/reserve.test.ts index 43e8f88a..47ccb18e 100644 --- a/src/testcases/run_in_band/reserve.test.ts +++ b/src/testcases/run_in_band/reserve.test.ts @@ -66,7 +66,7 @@ describe('Neutron / Treasury', () => { mainDaoAddr.toString(), securityDaoAddr.toString(), ); - treasury = (await neutronChain.getChainAdmins())[0]; + treasury = await neutronChain.getNeutronDAOCore(); }); describe('some corner cases', () => { @@ -409,7 +409,7 @@ describe('Neutron / Treasury', () => { mainDaoAddr.toString(), securityDaoAddr.toString(), ); - treasury = (await neutronChain.getChainAdmins())[0]; + treasury = await neutronChain.getNeutronDAOCore(); reserve = await setupReserve(neutronAccount1, { mainDaoAddress: mainDaoAddr.toString(), securityDaoAddress: securityDaoAddr.toString(), diff --git a/src/testcases/run_in_band/tge.auction.test.ts b/src/testcases/run_in_band/tge.auction.test.ts index e52ed2cb..bc5f06fa 100644 --- a/src/testcases/run_in_band/tge.auction.test.ts +++ b/src/testcases/run_in_band/tge.auction.test.ts @@ -177,7 +177,7 @@ describe('Neutron / TGE / Auction', () => { testState.wallets.qaNeutronFive.genQaWal1, ); - const daoCoreAddress = (await neutronChain.getChainAdmins())[0]; + const daoCoreAddress = await neutronChain.getNeutronDAOCore(); const daoContracts = await getDaoContracts(neutronChain, daoCoreAddress); daoMain = new Dao(neutronChain, daoContracts); daoMember1 = new DaoMember(cmInstantiator, daoMain); From f659c56ceef7aca8bd7e42667ae7719241516774 Mon Sep 17 00:00:00 2001 From: Andrei Zavgorodnii Date: Mon, 12 Feb 2024 22:26:49 +0200 Subject: [PATCH 02/15] switched neutronjsplus to 0.4.0-rc --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 377d05eb..070b6d88 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,7 @@ "@cosmos-client/core": "^0.47.4", "@cosmos-client/cosmwasm": "^0.40.3", "@cosmos-client/ibc": "^1.2.1", - "@neutron-org/neutronjsplus": "0.3.0", + "@neutron-org/neutronjsplus": "0.4.0-rc", "@types/lodash": "^4.14.182", "@types/long": "^4.0.2", "axios": "^0.27.2", diff --git a/yarn.lock b/yarn.lock index 0e522fbf..4ef1c501 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1564,10 +1564,10 @@ resolved "https://registry.yarnpkg.com/@ledgerhq/logs/-/logs-5.50.0.tgz#29c6419e8379d496ab6d0426eadf3c4d100cd186" integrity sha512-swKHYCOZUGyVt4ge0u8a7AwNcA//h4nx5wIi0sruGye1IJ5Cva0GyK9L2/WdX+kWVTKp92ZiEo1df31lrWGPgA== -"@neutron-org/neutronjsplus@0.3.0": - version "0.3.0" - resolved "https://registry.yarnpkg.com/@neutron-org/neutronjsplus/-/neutronjsplus-0.3.0.tgz#cb133953cfdd8ff9c3e3f89b6a8bf3ab192424c3" - integrity sha512-gLI1hk1SOQaJnK/JDWfcDH4ERXNWdftUhpUHdoWWaMY5VbnYM2Sf1vM8tUnLBoNkJE2iTxYSDxkriU5jTYzYww== +"@neutron-org/neutronjsplus@0.4.0-rc": + version "0.4.0-rc" + resolved "https://registry.yarnpkg.com/@neutron-org/neutronjsplus/-/neutronjsplus-0.4.0-rc.tgz#b45b4696013fb0b15edff97f0e895d4d5a314933" + integrity sha512-XA+hXbPTuwdU7br9wD/niTtdYUXbsGKWT1vMH/hhhcLw5ZdbZZ+2iM8pd9r9RY3QLKIn3rLeln5EFiFFqlniIg== dependencies: "@bufbuild/protobuf" "^1.4.2" "@cosmos-client/core" "^0.47.4" From d2b813df7d0580280ef9a0ffe90c180237969a34 Mon Sep 17 00:00:00 2001 From: Andrei Zavgorodnii Date: Tue, 13 Feb 2024 11:18:48 +0200 Subject: [PATCH 03/15] half-fixed run in band tests --- src/testcases/run_in_band/globalfee.test.ts | 2 ++ .../run_in_band/interchain_kv_query.test.ts | 18 +++++++++++------- src/testcases/run_in_band/parameters.test.ts | 2 ++ 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/testcases/run_in_band/globalfee.test.ts b/src/testcases/run_in_band/globalfee.test.ts index 657968ba..99c98990 100644 --- a/src/testcases/run_in_band/globalfee.test.ts +++ b/src/testcases/run_in_band/globalfee.test.ts @@ -66,7 +66,9 @@ describe('Neutron / Global Fee', () => { kind: string, value: string, ) => { + const chainManagerAddress = (await neutronChain.getChainAdmins())[0]; const proposalId = await daoMember.submitParameterChangeProposal( + chainManagerAddress, 'Change Proposal - ' + kind + ' #' + counter, 'Param change proposal. It will change the bypass min fee msg types of the global fee module to use MsgSend.', 'globalfee', 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 29a45985..afca576f 100644 --- a/src/testcases/run_in_band/interchain_kv_query.test.ts +++ b/src/testcases/run_in_band/interchain_kv_query.test.ts @@ -152,13 +152,17 @@ const acceptInterchainqueriesParamsChangeProposal = async ( const daoContracts = await getDaoContracts(cm.chain, daoCoreAddress); const dao = new Dao(cm.chain, daoContracts); const daoMember = new DaoMember(cm, dao); - const message = paramChangeProposal({ - title, - description, - subspace: 'interchainqueries', - key, - value, - }); + const chainManagerAddress = (await cm.chain.getChainAdmins())[0]; + const message = paramChangeProposal( + { + title, + description, + subspace: 'interchainqueries', + key, + value, + }, + chainManagerAddress, + ); await dao.makeSingleChoiceProposalPass( [daoMember], title, diff --git a/src/testcases/run_in_band/parameters.test.ts b/src/testcases/run_in_band/parameters.test.ts index e28a9897..89b32779 100644 --- a/src/testcases/run_in_band/parameters.test.ts +++ b/src/testcases/run_in_band/parameters.test.ts @@ -337,7 +337,9 @@ describe('Neutron / Parameters', () => { describe('Interchaintxs params proposal', () => { test('create proposal', async () => { + const chainManagerAddress = (await neutronChain.getChainAdmins())[0]; await daoMember1.submitUpdateParamsInterchaintxsProposal( + chainManagerAddress, 'Proposal #7', 'Update interchaintxs params', updateInterchaintxsParamsProposal({ From b468f1ea734f90a5b4d310d607d056148d71f453 Mon Sep 17 00:00:00 2001 From: Andrei Zavgorodnii Date: Tue, 13 Feb 2024 15:05:38 +0200 Subject: [PATCH 04/15] fixed parameters.ts --- src/testcases/run_in_band/parameters.test.ts | 21 ++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/testcases/run_in_band/parameters.test.ts b/src/testcases/run_in_band/parameters.test.ts index 89b32779..333af79f 100644 --- a/src/testcases/run_in_band/parameters.test.ts +++ b/src/testcases/run_in_band/parameters.test.ts @@ -44,6 +44,15 @@ describe('Neutron / Parameters', () => { ); const daoCoreAddress = await neutronChain.getNeutronDAOCore(); const daoContracts = await getDaoContracts(neutronChain, daoCoreAddress); + const chainManagerAddress = (await neutronChain.getChainAdmins())[0]; + + console.log( + '>>>>>> daoCoreAddress', + daoCoreAddress, + '>>>>>> chainManagerAddress', + chainManagerAddress, + ); + dao = new Dao(neutronChain, daoContracts); daoMember1 = new DaoMember(neutronAccount, dao); }); @@ -71,7 +80,9 @@ describe('Neutron / Parameters', () => { describe('Interchain queries params proposal', () => { test('create proposal', async () => { + const chainManagerAddress = (await neutronChain.getChainAdmins())[0]; await daoMember1.submitUpdateParamsInterchainqueriesProposal( + chainManagerAddress, 'Proposal #1', 'Param change proposal. This one will pass', updateInterchainqueriesParamsProposal({ @@ -118,7 +129,9 @@ describe('Neutron / Parameters', () => { describe('Tokenfactory params proposal', () => { test('create proposal', async () => { + const chainManagerAddress = (await neutronChain.getChainAdmins())[0]; await daoMember1.submitUpdateParamsTokenfactoryProposal( + chainManagerAddress, 'Proposal #2', 'Tokenfactory params proposal', updateTokenfacoryParamsProposal({ @@ -163,7 +176,9 @@ describe('Neutron / Parameters', () => { describe('Feeburner params proposal', () => { test('create proposal', async () => { + const chainManagerAddress = (await neutronChain.getChainAdmins())[0]; await daoMember1.submitUpdateParamsFeeburnerProposal( + chainManagerAddress, 'Proposal #3', 'Feeburner params proposal', updateFeeburnerParamsProposal({ @@ -204,7 +219,9 @@ describe('Neutron / Parameters', () => { describe('Feerefunder params proposal', () => { test('create proposal', async () => { + const chainManagerAddress = (await neutronChain.getChainAdmins())[0]; await daoMember1.submitUpdateParamsFeerefunderProposal( + chainManagerAddress, 'Proposal #4', 'Feerefunder update params proposal', updateFeerefunderParamsProposal({ @@ -256,7 +273,9 @@ describe('Neutron / Parameters', () => { describe('Cron params proposal', () => { test('create proposal', async () => { + const chainManagerAddress = (await neutronChain.getChainAdmins())[0]; await daoMember1.submitUpdateParamsCronProposal( + chainManagerAddress, 'Proposal #5', 'Cron update params proposal. Will pass', updateCronParamsProposal({ @@ -298,7 +317,9 @@ describe('Neutron / Parameters', () => { describe('Contractanager params proposal', () => { test('create proposal', async () => { + const chainManagerAddress = (await neutronChain.getChainAdmins())[0]; await daoMember1.submitUpdateParamsContractmanagerProposal( + chainManagerAddress, 'Proposal #6', 'Contractanager params proposal', updateContractmanagerParamsProposal({ From 06ceef09434edcece40da58ec3994d800972271f Mon Sep 17 00:00:00 2001 From: Andrei Zavgorodnii Date: Tue, 13 Feb 2024 15:29:34 +0200 Subject: [PATCH 05/15] switched neutronjsplus to 0.4.0-rc2 --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 070b6d88..39c57ba5 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,7 @@ "@cosmos-client/core": "^0.47.4", "@cosmos-client/cosmwasm": "^0.40.3", "@cosmos-client/ibc": "^1.2.1", - "@neutron-org/neutronjsplus": "0.4.0-rc", + "@neutron-org/neutronjsplus": "0.4.0-rc2", "@types/lodash": "^4.14.182", "@types/long": "^4.0.2", "axios": "^0.27.2", diff --git a/yarn.lock b/yarn.lock index 4ef1c501..6e449c80 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1564,10 +1564,10 @@ resolved "https://registry.yarnpkg.com/@ledgerhq/logs/-/logs-5.50.0.tgz#29c6419e8379d496ab6d0426eadf3c4d100cd186" integrity sha512-swKHYCOZUGyVt4ge0u8a7AwNcA//h4nx5wIi0sruGye1IJ5Cva0GyK9L2/WdX+kWVTKp92ZiEo1df31lrWGPgA== -"@neutron-org/neutronjsplus@0.4.0-rc": - version "0.4.0-rc" - resolved "https://registry.yarnpkg.com/@neutron-org/neutronjsplus/-/neutronjsplus-0.4.0-rc.tgz#b45b4696013fb0b15edff97f0e895d4d5a314933" - integrity sha512-XA+hXbPTuwdU7br9wD/niTtdYUXbsGKWT1vMH/hhhcLw5ZdbZZ+2iM8pd9r9RY3QLKIn3rLeln5EFiFFqlniIg== +"@neutron-org/neutronjsplus@0.4.0-rc2": + version "0.4.0-rc2" + resolved "https://registry.yarnpkg.com/@neutron-org/neutronjsplus/-/neutronjsplus-0.4.0-rc2.tgz#e138182a434427be832225abcf2b0461a7641b0a" + integrity sha512-KIuEAkAVSKyyZCrEixtN608QBoRGwiGNtNM94IGR+jEscMTJ8U/QtutX/qP6xgQQAgkFuw6+tuyO9ICq1nt6ZA== dependencies: "@bufbuild/protobuf" "^1.4.2" "@cosmos-client/core" "^0.47.4" From f9248a15dc5f5eb7808bf3e8a335a5411e4a639b Mon Sep 17 00:00:00 2001 From: Andrei Zavgorodnii Date: Wed, 14 Feb 2024 14:19:11 +0200 Subject: [PATCH 06/15] sketched chain_manager tests --- package.json | 1 + .../run_in_band/chain_manager.test.ts | 129 ++++++++++++++++++ src/testcases/run_in_band/parameters.test.ts | 8 -- 3 files changed, 130 insertions(+), 8 deletions(-) create mode 100644 src/testcases/run_in_band/chain_manager.test.ts diff --git a/package.json b/package.json index 39c57ba5..168b7055 100644 --- a/package.json +++ b/package.json @@ -24,6 +24,7 @@ "test:globalfee": "jest -b src/testcases/run_in_band/globalfee", "test:ibc_hooks": "jest -b src/testcases/run_in_band/ibc_hooks", "test:parameters": "jest -b src/testcases/run_in_band/parameters", + "test:chain_manager": "jest -b src/testcases/run_in_band/chain_manager", "test:tokenfactory": "jest -b src/testcases/parallel/tokenfactory", "test:overrule": "jest -b src/testcases/parallel/overrule", "test:tge:vesting_lp_vault": "jest -b src/testcases/parallel/tge.vesting_lp_vault", diff --git a/src/testcases/run_in_band/chain_manager.test.ts b/src/testcases/run_in_band/chain_manager.test.ts new file mode 100644 index 00000000..2a8f9cc4 --- /dev/null +++ b/src/testcases/run_in_band/chain_manager.test.ts @@ -0,0 +1,129 @@ +import '@neutron-org/neutronjsplus'; +import { + WalletWrapper, + CosmosWrapper, + NEUTRON_DENOM, +} from '@neutron-org/neutronjsplus/dist/cosmos'; +import { TestStateLocalCosmosTestNet } from '@neutron-org/neutronjsplus'; +import { getWithAttempts } from '@neutron-org/neutronjsplus/dist/wait'; +import { + Dao, + DaoMember, + getDaoContracts, +} from '@neutron-org/neutronjsplus/dist/dao'; +import { updateCronParamsProposal } from '@neutron-org/neutronjsplus/dist/proposal'; + +import config from '../../config.json'; + +describe('Neutron / Chain Manager', () => { + let testState: TestStateLocalCosmosTestNet; + let neutronChain: CosmosWrapper; + let neutronAccount: WalletWrapper; + let daoMember1: DaoMember; + let dao: Dao; + + beforeAll(async () => { + testState = new TestStateLocalCosmosTestNet(config); + await testState.init(); + neutronChain = new CosmosWrapper( + testState.sdk1, + testState.blockWaiter1, + NEUTRON_DENOM, + ); + neutronAccount = new WalletWrapper( + neutronChain, + testState.wallets.qaNeutron.genQaWal1, + ); + const daoCoreAddress = await neutronChain.getNeutronDAOCore(); + const daoContracts = await getDaoContracts(neutronChain, daoCoreAddress); + + dao = new Dao(neutronChain, daoContracts); + daoMember1 = new DaoMember(neutronAccount, dao); + }); + + describe('prepare: bond funds', () => { + test('bond form wallet 1', async () => { + await daoMember1.bondFunds('10000'); + await getWithAttempts( + neutronChain.blockWaiter, + async () => + await dao.queryVotingPower(daoMember1.user.wallet.address.toString()), + async (response) => response.power == 10000, + 20, + ); + }); + test('check voting power', async () => { + await getWithAttempts( + neutronChain.blockWaiter, + async () => await dao.queryTotalVotingPower(), + async (response) => response.power == 11000, + 20, + ); + }); + }); + + describe('prepare: bond funds', () => { + test('bond form wallet 1', async () => { + await daoMember1.bondFunds('10000'); + await getWithAttempts( + neutronChain.blockWaiter, + async () => + await dao.queryVotingPower(daoMember1.user.wallet.address.toString()), + async (response) => response.power == 10000, + 20, + ); + }); + test('check voting power', async () => { + await getWithAttempts( + neutronChain.blockWaiter, + async () => await dao.queryTotalVotingPower(), + async (response) => response.power == 11000, + 20, + ); + }); + }); + + describe('Cron params proposal', () => { + test('create proposal', async () => { + const chainManagerAddress = (await neutronChain.getChainAdmins())[0]; + await daoMember1.submitUpdateParamsCronProposal( + chainManagerAddress, + 'Proposal #1', + 'Cron update params proposal. Will pass', + updateCronParamsProposal({ + security_address: dao.contracts.voting.address, + limit: 10, + }), + '1000', + ); + }); + + describe('vote for proposal', () => { + const proposalId = 5; + test('vote YES from wallet 1', async () => { + await daoMember1.voteYes(proposalId); + }); + }); + + describe('execute proposal', () => { + const proposalId = 1; + let paramsBefore: { params: any }; + test('check if proposal is passed', async () => { + await dao.checkPassedProposal(proposalId); + }); + test('execute passed proposal', async () => { + paramsBefore = await neutronChain.queryCronParams(); + await daoMember1.executeProposalWithAttempts(proposalId); + }); + test('check if params changed after proposal execution', async () => { + const paramsAfter = await neutronChain.queryCronParams(); + expect(paramsAfter.params.security_address).not.toEqual( + paramsBefore.params.security_address, + ); + expect(paramsAfter.params.security_address).toEqual( + dao.contracts.voting.address, + ); + }); + }); + }); +}); diff --git a/src/testcases/run_in_band/parameters.test.ts b/src/testcases/run_in_band/parameters.test.ts index 333af79f..be3d8402 100644 --- a/src/testcases/run_in_band/parameters.test.ts +++ b/src/testcases/run_in_band/parameters.test.ts @@ -44,14 +44,6 @@ describe('Neutron / Parameters', () => { ); const daoCoreAddress = await neutronChain.getNeutronDAOCore(); const daoContracts = await getDaoContracts(neutronChain, daoCoreAddress); - const chainManagerAddress = (await neutronChain.getChainAdmins())[0]; - - console.log( - '>>>>>> daoCoreAddress', - daoCoreAddress, - '>>>>>> chainManagerAddress', - chainManagerAddress, - ); dao = new Dao(neutronChain, daoContracts); daoMember1 = new DaoMember(neutronAccount, dao); From c6a6a4749dc9fdb75b1bd125397748acd8416f8c Mon Sep 17 00:00:00 2001 From: Andrei Zavgorodnii Date: Wed, 14 Feb 2024 14:49:37 +0200 Subject: [PATCH 07/15] wip --- .../run_in_band/chain_manager.test.ts | 165 ++++++++---------- 1 file changed, 74 insertions(+), 91 deletions(-) diff --git a/src/testcases/run_in_band/chain_manager.test.ts b/src/testcases/run_in_band/chain_manager.test.ts index 2a8f9cc4..1c7d9fb1 100644 --- a/src/testcases/run_in_band/chain_manager.test.ts +++ b/src/testcases/run_in_band/chain_manager.test.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-non-null-assertion */ import '@neutron-org/neutronjsplus'; import { WalletWrapper, @@ -5,125 +6,107 @@ import { NEUTRON_DENOM, } from '@neutron-org/neutronjsplus/dist/cosmos'; import { TestStateLocalCosmosTestNet } from '@neutron-org/neutronjsplus'; -import { getWithAttempts } from '@neutron-org/neutronjsplus/dist/wait'; import { Dao, DaoMember, - getDaoContracts, + deployNeutronDao, + setupSubDaoTimelockSet, } from '@neutron-org/neutronjsplus/dist/dao'; -import { updateCronParamsProposal } from '@neutron-org/neutronjsplus/dist/proposal'; +import { Wallet } from '@neutron-org/neutronjsplus/dist/types'; +import cosmosclient from '@cosmos-client/core'; +import { waitSeconds } from '@neutron-org/neutronjsplus/dist/wait'; +import { + paramChangeProposal, + sendProposal, +} from '@neutron-org/neutronjsplus/dist/proposal'; import config from '../../config.json'; -describe('Neutron / Chain Manager', () => { +describe('Neutron / Subdao', () => { let testState: TestStateLocalCosmosTestNet; let neutronChain: CosmosWrapper; - let neutronAccount: WalletWrapper; - let daoMember1: DaoMember; - let dao: Dao; + let neutronAccount1: WalletWrapper; + let neutronAccount2: WalletWrapper; + let subdaoMember1: DaoMember; + let mainDaoMember: DaoMember; + let demo1Wallet: Wallet; + let securityDaoWallet: Wallet; + let demo2Wallet: Wallet; + let securityDaoAddr: cosmosclient.AccAddress | cosmosclient.ValAddress; + let subDao: Dao; + let mainDao: Dao; beforeAll(async () => { testState = new TestStateLocalCosmosTestNet(config); await testState.init(); + demo1Wallet = testState.wallets.qaNeutron.genQaWal1; + securityDaoWallet = testState.wallets.qaNeutronThree.genQaWal1; + demo2Wallet = testState.wallets.qaNeutronFour.genQaWal1; + securityDaoAddr = securityDaoWallet.address; neutronChain = new CosmosWrapper( testState.sdk1, testState.blockWaiter1, NEUTRON_DENOM, ); - neutronAccount = new WalletWrapper( - neutronChain, - testState.wallets.qaNeutron.genQaWal1, + neutronAccount1 = new WalletWrapper(neutronChain, demo1Wallet); + neutronAccount2 = new WalletWrapper(neutronChain, demo2Wallet); + + const daoContracts = await deployNeutronDao(neutronAccount1); + mainDao = new Dao(neutronChain, daoContracts); + mainDaoMember = new DaoMember(neutronAccount1, mainDao); + await mainDaoMember.bondFunds('10000'); + + subDao = await setupSubDaoTimelockSet( + neutronAccount1, + mainDao.contracts.core.address, + securityDaoAddr.toString(), + true, ); - const daoCoreAddress = await neutronChain.getNeutronDAOCore(); - const daoContracts = await getDaoContracts(neutronChain, daoCoreAddress); - dao = new Dao(neutronChain, daoContracts); - daoMember1 = new DaoMember(neutronAccount, dao); - }); + subdaoMember1 = new DaoMember(neutronAccount1, subDao); - describe('prepare: bond funds', () => { - test('bond form wallet 1', async () => { - await daoMember1.bondFunds('10000'); - await getWithAttempts( - neutronChain.blockWaiter, - async () => - await dao.queryVotingPower(daoMember1.user.wallet.address.toString()), - async (response) => response.power == 10000, - 20, - ); - }); - test('check voting power', async () => { - await getWithAttempts( - neutronChain.blockWaiter, - async () => await dao.queryTotalVotingPower(), - async (response) => response.power == 11000, - 20, - ); - }); - }); + const subDaosList = await mainDao.getSubDaoList(); + expect(subDaosList).toContain(subDao.contracts.core.address); - describe('prepare: bond funds', () => { - test('bond form wallet 1', async () => { - await daoMember1.bondFunds('10000'); - await getWithAttempts( - neutronChain.blockWaiter, - async () => - await dao.queryVotingPower(daoMember1.user.wallet.address.toString()), - async (response) => response.power == 10000, - 20, - ); - }); - test('check voting power', async () => { - await getWithAttempts( - neutronChain.blockWaiter, - async () => await dao.queryTotalVotingPower(), - async (response) => response.power == 11000, - 20, - ); - }); + const votingPower = await subdaoMember1.queryVotingPower(); + expect(votingPower.power).toEqual('1'); }); - describe('Cron params proposal', () => { - test('create proposal', async () => { - const chainManagerAddress = (await neutronChain.getChainAdmins())[0]; - await daoMember1.submitUpdateParamsCronProposal( - chainManagerAddress, - 'Proposal #1', - 'Cron update params proposal. Will pass', - updateCronParamsProposal({ - security_address: dao.contracts.voting.address, - limit: 10, - }), - '1000', + describe('Timelock: Succeed execution', () => { + let proposalId: number; + beforeAll(async () => { + const coinsForDemo2 = 2000; + proposalId = await subdaoMember1.submitSendProposal('send', 'send', [ + { + recipient: neutronAccount2.wallet.address.toString(), + amount: coinsForDemo2, + denom: NEUTRON_DENOM, + }, + ]); + + const timelockedProp = await subdaoMember1.supportAndExecuteProposal( + proposalId, ); - }); - describe('vote for proposal', () => { - const proposalId = 5; - test('vote YES from wallet 1', async () => { - await daoMember1.voteYes(proposalId); - }); + expect(timelockedProp.id).toEqual(proposalId); + expect(timelockedProp.status).toEqual('timelocked'); + expect(timelockedProp.msgs).toHaveLength(1); }); - describe('execute proposal', () => { - const proposalId = 1; - let paramsBefore: { params: any }; - test('check if proposal is passed', async () => { - await dao.checkPassedProposal(proposalId); - }); - test('execute passed proposal', async () => { - paramsBefore = await neutronChain.queryCronParams(); - await daoMember1.executeProposalWithAttempts(proposalId); - }); - test('check if params changed after proposal execution', async () => { - const paramsAfter = await neutronChain.queryCronParams(); - expect(paramsAfter.params.security_address).not.toEqual( - paramsBefore.params.security_address, - ); - expect(paramsAfter.params.security_address).toEqual( - dao.contracts.voting.address, - ); - }); + test('execute timelocked: success', async () => { + await neutronAccount1.msgSend(subDao.contracts.core.address, '20000'); // fund the subdao treasury + const balance2 = await neutronAccount2.queryDenomBalance(NEUTRON_DENOM); + await waitSeconds(20); + await subdaoMember1.executeTimelockedProposal(proposalId); + const balance2After = await neutronAccount2.queryDenomBalance( + NEUTRON_DENOM, + ); + expect(balance2After).toEqual(balance2 + 2000); + + const timelockedProp = await subDao.getTimelockedProposal(proposalId); + expect(timelockedProp.id).toEqual(proposalId); + expect(timelockedProp.status).toEqual('executed'); + expect(timelockedProp.msgs).toHaveLength(1); }); }); }); From 3e9d5a2a75e0a55e87caf4b5ed198c480797ca44 Mon Sep 17 00:00:00 2001 From: Andrei Zavgorodnii Date: Wed, 14 Feb 2024 23:53:46 +0200 Subject: [PATCH 08/15] wip --- .../run_in_band/chain_manager.test.ts | 252 +++++++++++++++--- 1 file changed, 217 insertions(+), 35 deletions(-) diff --git a/src/testcases/run_in_band/chain_manager.test.ts b/src/testcases/run_in_band/chain_manager.test.ts index 1c7d9fb1..e60ca1a8 100644 --- a/src/testcases/run_in_band/chain_manager.test.ts +++ b/src/testcases/run_in_band/chain_manager.test.ts @@ -9,7 +9,7 @@ import { TestStateLocalCosmosTestNet } from '@neutron-org/neutronjsplus'; import { Dao, DaoMember, - deployNeutronDao, + getDaoContracts, setupSubDaoTimelockSet, } from '@neutron-org/neutronjsplus/dist/dao'; import { Wallet } from '@neutron-org/neutronjsplus/dist/types'; @@ -17,7 +17,8 @@ import cosmosclient from '@cosmos-client/core'; import { waitSeconds } from '@neutron-org/neutronjsplus/dist/wait'; import { paramChangeProposal, - sendProposal, + AddChainManagerStrategy, + updateCronParamsProposal, } from '@neutron-org/neutronjsplus/dist/proposal'; import config from '../../config.json'; @@ -26,12 +27,10 @@ describe('Neutron / Subdao', () => { let testState: TestStateLocalCosmosTestNet; let neutronChain: CosmosWrapper; let neutronAccount1: WalletWrapper; - let neutronAccount2: WalletWrapper; let subdaoMember1: DaoMember; let mainDaoMember: DaoMember; let demo1Wallet: Wallet; let securityDaoWallet: Wallet; - let demo2Wallet: Wallet; let securityDaoAddr: cosmosclient.AccAddress | cosmosclient.ValAddress; let subDao: Dao; let mainDao: Dao; @@ -41,7 +40,6 @@ describe('Neutron / Subdao', () => { await testState.init(); demo1Wallet = testState.wallets.qaNeutron.genQaWal1; securityDaoWallet = testState.wallets.qaNeutronThree.genQaWal1; - demo2Wallet = testState.wallets.qaNeutronFour.genQaWal1; securityDaoAddr = securityDaoWallet.address; neutronChain = new CosmosWrapper( testState.sdk1, @@ -49,9 +47,10 @@ describe('Neutron / Subdao', () => { NEUTRON_DENOM, ); neutronAccount1 = new WalletWrapper(neutronChain, demo1Wallet); - neutronAccount2 = new WalletWrapper(neutronChain, demo2Wallet); - const daoContracts = await deployNeutronDao(neutronAccount1); + const daoCoreAddress = await neutronChain.getNeutronDAOCore(); + const daoContracts = await getDaoContracts(neutronChain, daoCoreAddress); + mainDao = new Dao(neutronChain, daoContracts); mainDaoMember = new DaoMember(neutronAccount1, mainDao); await mainDaoMember.bondFunds('10000'); @@ -72,41 +71,224 @@ describe('Neutron / Subdao', () => { expect(votingPower.power).toEqual('1'); }); - describe('Timelock: Succeed execution', () => { - let proposalId: number; - beforeAll(async () => { - const coinsForDemo2 = 2000; - proposalId = await subdaoMember1.submitSendProposal('send', 'send', [ + // describe('Add an ALLOW_ONLY strategy', () => { + // test('create proposal', async () => { + // const chainManagerAddress = (await neutronChain.getChainAdmins())[0]; + // await mainDaoMember.submitAddChainManagerStrategyProposal( + // chainManagerAddress, + // 'Proposal #2', + // 'Add strategy proposal. It will pass', + // { + // add_strategy: { + // strategy: { + // address: subDao.contracts.core.address, + // permissions: [ + // { + // UpdateParamsPermission: { + // CronUpdateParamsPermission: { + // security_address: true, + // limit: true, + // }, + // }, + // }, + // ], + // }, + // }, + // }, + // '1000', + // ); + // }); + // describe('vote for proposal', () => { + // const proposalId = 2; + // test('vote YES from wallet 1', async () => { + // await mainDaoMember.voteYes(proposalId); + // }); + // }); + // + // describe('execute proposal', () => { + // const proposalId = 2; + // test('check if proposal is passed', async () => { + // await mainDao.checkPassedProposal(proposalId); + // }); + // test('execute passed proposal', async () => { + // await mainDaoMember.executeProposalWithAttempts(proposalId); + // }); + // }); + // }); + + describe('Add an ALLOW_ONLY strategy 2', () => { + test('create proposal', async () => { + const chainManagerAddress = (await neutronChain.getChainAdmins())[0]; + await mainDaoMember.submitAddChainManagerStrategyProposal( + chainManagerAddress, + 'Proposal #2', + 'Add strategy proposal. It will pass', { - recipient: neutronAccount2.wallet.address.toString(), - amount: coinsForDemo2, - denom: NEUTRON_DENOM, + add_strategy: { + strategy: { + address: subdaoMember1.user.wallet.address, + permissions: [ + { + UpdateParamsPermission: { + CronUpdateParamsPermission: { + security_address: true, + limit: true, + }, + }, + }, + ], + }, + }, }, - ]); - - const timelockedProp = await subdaoMember1.supportAndExecuteProposal( - proposalId, + '1000', ); + }); + describe('vote for proposal', () => { + const proposalId = 2; + test('vote YES from wallet 1', async () => { + await mainDaoMember.voteYes(proposalId); + }); + }); - expect(timelockedProp.id).toEqual(proposalId); - expect(timelockedProp.status).toEqual('timelocked'); - expect(timelockedProp.msgs).toHaveLength(1); + describe('execute proposal', () => { + const proposalId = 2; + test('check if proposal is passed', async () => { + await mainDao.checkPassedProposal(proposalId); + }); + test('execute passed proposal', async () => { + await mainDaoMember.executeProposalWithAttempts(proposalId); + }); }); + }); - test('execute timelocked: success', async () => { - await neutronAccount1.msgSend(subDao.contracts.core.address, '20000'); // fund the subdao treasury - const balance2 = await neutronAccount2.queryDenomBalance(NEUTRON_DENOM); - await waitSeconds(20); - await subdaoMember1.executeTimelockedProposal(proposalId); - const balance2After = await neutronAccount2.queryDenomBalance( - NEUTRON_DENOM, - ); - expect(balance2After).toEqual(balance2 + 2000); + // describe('Change the overrule proposal voting period', () => { + // let proposalId: number; + // test('create proposal', async () => { + // const currentOverruleProposalConfig = await neutronChain.queryContract( + // mainDao.contracts.proposals['overrule'].address, + // { + // config: {}, + // }, + // ); + // currentOverruleProposalConfig['max_voting_period']['time'] = 5; + // proposalId = await mainDaoMember.submitSingleChoiceProposal( + // 'Proposal', + // 'Update the max voting period. It will pass', + // [ + // { + // wasm: { + // execute: { + // contract_addr: mainDao.contracts.proposals['overrule'].address, + // msg: Buffer.from( + // JSON.stringify({ + // update_config: { + // threshold: currentOverruleProposalConfig['threshold'], + // max_voting_period: + // currentOverruleProposalConfig['max_voting_period'], + // allow_revoting: + // currentOverruleProposalConfig['allow_revoting'], + // dao: currentOverruleProposalConfig['dao'], + // close_proposal_on_execution_failure: + // currentOverruleProposalConfig[ + // 'close_proposal_on_execution_failure' + // ], + // }, + // }), + // ).toString('base64'), + // funds: [], + // }, + // }, + // }, + // ], + // '1000', + // ); + // }); + // describe('vote for proposal', () => { + // test('vote YES from wallet 1', async () => { + // await mainDaoMember.voteYes(proposalId); + // }); + // }); + // + // describe('execute proposal', () => { + // test('check if proposal is passed', async () => { + // await mainDao.checkPassedProposal(proposalId); + // }); + // test('execute passed proposal', async () => { + // await mainDaoMember.executeProposalWithAttempts(proposalId); + // }); + // }); + // }); + // + // describe('ALLOW_ONLY: change CRON parameters', () => { + // let proposalId: number; + // beforeAll(async () => { + // const chainManagerAddress = (await neutronChain.getChainAdmins())[0]; + // proposalId = await subdaoMember1.submitUpdateParamsCronProposal( + // chainManagerAddress, + // 'Proposal #1', + // 'Cron update params proposal. Will pass', + // updateCronParamsProposal({ + // security_address: mainDao.contracts.voting.address, + // limit: 42, + // }), + // '1000', + // ); + // + // const timelockedProp = await subdaoMember1.supportAndExecuteProposal( + // proposalId, + // ); + // + // expect(timelockedProp.id).toEqual(proposalId); + // expect(timelockedProp.status).toEqual('timelocked'); + // expect(timelockedProp.msgs).toHaveLength(1); + // }); + // + // test('execute timelocked: success', async () => { + // const chainManagerAddress = (await neutronChain.getChainAdmins())[0]; + // const strategies = await neutronChain.queryContract(chainManagerAddress, { + // strategies: {}, + // }); + // console.log('>>>>>>>>>>>>>>>>>>>>>>>>>>>>> strategies', strategies); + // console.log('>>>>>>>>>>>>>>>>>>>>>>>>>>>>> strategies[1][\'permissions\'][0]', strategies[1]['permissions'][0]); + // + // console.log('>>>>>>>>>>>>>>>>>>>>>>>>>>>>> chainManagerAddress', chainManagerAddress); + // console.log('>>>>>>>>>>>>>>>>>>>>>>>>>>>>> mainDao.contracts.core.address', mainDao.contracts.core.address); + // console.log('>>>>>>>>>>>>>>>>>>>>>>>>>>>>> subDao.contracts.core.address', subDao.contracts.core.address); + // + // const resp = await neutronChain.queryContract( + // subDao.contracts.proposals['single'].pre_propose.timelock.address, + // { proposal: { proposal_id: proposalId } }, + // ); + // console.log('>>>>>>>>>>>>>>>>>>>>>>>>>>>>> resp[\'msgs\'][\'wasm\']', resp['msgs'][0]['wasm']); + // + // await waitSeconds(10); + // + // await subdaoMember1.executeTimelockedProposal(proposalId); + // + // const timelockedProp = await subDao.getTimelockedProposal(proposalId); + // expect(timelockedProp.id).toEqual(proposalId); + // expect(timelockedProp.status).toEqual('executed'); + // expect(timelockedProp.msgs).toHaveLength(1); + // }); + // }); - const timelockedProp = await subDao.getTimelockedProposal(proposalId); - expect(timelockedProp.id).toEqual(proposalId); - expect(timelockedProp.status).toEqual('executed'); - expect(timelockedProp.msgs).toHaveLength(1); + describe('ALLOW_ONLY: change CRON parameters', () => { + test('execute messages', async () => { + const chainManagerAddress = (await neutronChain.getChainAdmins())[0]; + const res = await subdaoMember1.user.executeContract( + chainManagerAddress, + JSON.stringify({ + execute_messages: { + messages: [ + updateCronParamsProposal({ + security_address: mainDao.contracts.voting.address, + limit: 42, + }), + ], + }, + }), + ); + expect(res.code).toEqual(0); }); }); }); From 0867882d46c0cd73af34675c2667e5650c58cb77 Mon Sep 17 00:00:00 2001 From: Andrei Zavgorodnii Date: Thu, 15 Feb 2024 14:36:58 +0200 Subject: [PATCH 09/15] added a test for updating cron module params --- .../run_in_band/chain_manager.test.ts | 256 ++++++------------ 1 file changed, 86 insertions(+), 170 deletions(-) diff --git a/src/testcases/run_in_band/chain_manager.test.ts b/src/testcases/run_in_band/chain_manager.test.ts index e60ca1a8..60eca396 100644 --- a/src/testcases/run_in_band/chain_manager.test.ts +++ b/src/testcases/run_in_band/chain_manager.test.ts @@ -17,7 +17,6 @@ import cosmosclient from '@cosmos-client/core'; import { waitSeconds } from '@neutron-org/neutronjsplus/dist/wait'; import { paramChangeProposal, - AddChainManagerStrategy, updateCronParamsProposal, } from '@neutron-org/neutronjsplus/dist/proposal'; @@ -71,52 +70,7 @@ describe('Neutron / Subdao', () => { expect(votingPower.power).toEqual('1'); }); - // describe('Add an ALLOW_ONLY strategy', () => { - // test('create proposal', async () => { - // const chainManagerAddress = (await neutronChain.getChainAdmins())[0]; - // await mainDaoMember.submitAddChainManagerStrategyProposal( - // chainManagerAddress, - // 'Proposal #2', - // 'Add strategy proposal. It will pass', - // { - // add_strategy: { - // strategy: { - // address: subDao.contracts.core.address, - // permissions: [ - // { - // UpdateParamsPermission: { - // CronUpdateParamsPermission: { - // security_address: true, - // limit: true, - // }, - // }, - // }, - // ], - // }, - // }, - // }, - // '1000', - // ); - // }); - // describe('vote for proposal', () => { - // const proposalId = 2; - // test('vote YES from wallet 1', async () => { - // await mainDaoMember.voteYes(proposalId); - // }); - // }); - // - // describe('execute proposal', () => { - // const proposalId = 2; - // test('check if proposal is passed', async () => { - // await mainDao.checkPassedProposal(proposalId); - // }); - // test('execute passed proposal', async () => { - // await mainDaoMember.executeProposalWithAttempts(proposalId); - // }); - // }); - // }); - - describe('Add an ALLOW_ONLY strategy 2', () => { + describe('Add an ALLOW_ONLY strategy', () => { test('create proposal', async () => { const chainManagerAddress = (await neutronChain.getChainAdmins())[0]; await mainDaoMember.submitAddChainManagerStrategyProposal( @@ -126,7 +80,7 @@ describe('Neutron / Subdao', () => { { add_strategy: { strategy: { - address: subdaoMember1.user.wallet.address, + address: subDao.contracts.core.address, permissions: [ { UpdateParamsPermission: { @@ -161,134 +115,96 @@ describe('Neutron / Subdao', () => { }); }); - // describe('Change the overrule proposal voting period', () => { - // let proposalId: number; - // test('create proposal', async () => { - // const currentOverruleProposalConfig = await neutronChain.queryContract( - // mainDao.contracts.proposals['overrule'].address, - // { - // config: {}, - // }, - // ); - // currentOverruleProposalConfig['max_voting_period']['time'] = 5; - // proposalId = await mainDaoMember.submitSingleChoiceProposal( - // 'Proposal', - // 'Update the max voting period. It will pass', - // [ - // { - // wasm: { - // execute: { - // contract_addr: mainDao.contracts.proposals['overrule'].address, - // msg: Buffer.from( - // JSON.stringify({ - // update_config: { - // threshold: currentOverruleProposalConfig['threshold'], - // max_voting_period: - // currentOverruleProposalConfig['max_voting_period'], - // allow_revoting: - // currentOverruleProposalConfig['allow_revoting'], - // dao: currentOverruleProposalConfig['dao'], - // close_proposal_on_execution_failure: - // currentOverruleProposalConfig[ - // 'close_proposal_on_execution_failure' - // ], - // }, - // }), - // ).toString('base64'), - // funds: [], - // }, - // }, - // }, - // ], - // '1000', - // ); - // }); - // describe('vote for proposal', () => { - // test('vote YES from wallet 1', async () => { - // await mainDaoMember.voteYes(proposalId); - // }); - // }); - // - // describe('execute proposal', () => { - // test('check if proposal is passed', async () => { - // await mainDao.checkPassedProposal(proposalId); - // }); - // test('execute passed proposal', async () => { - // await mainDaoMember.executeProposalWithAttempts(proposalId); - // }); - // }); - // }); - // - // describe('ALLOW_ONLY: change CRON parameters', () => { - // let proposalId: number; - // beforeAll(async () => { - // const chainManagerAddress = (await neutronChain.getChainAdmins())[0]; - // proposalId = await subdaoMember1.submitUpdateParamsCronProposal( - // chainManagerAddress, - // 'Proposal #1', - // 'Cron update params proposal. Will pass', - // updateCronParamsProposal({ - // security_address: mainDao.contracts.voting.address, - // limit: 42, - // }), - // '1000', - // ); - // - // const timelockedProp = await subdaoMember1.supportAndExecuteProposal( - // proposalId, - // ); - // - // expect(timelockedProp.id).toEqual(proposalId); - // expect(timelockedProp.status).toEqual('timelocked'); - // expect(timelockedProp.msgs).toHaveLength(1); - // }); - // - // test('execute timelocked: success', async () => { - // const chainManagerAddress = (await neutronChain.getChainAdmins())[0]; - // const strategies = await neutronChain.queryContract(chainManagerAddress, { - // strategies: {}, - // }); - // console.log('>>>>>>>>>>>>>>>>>>>>>>>>>>>>> strategies', strategies); - // console.log('>>>>>>>>>>>>>>>>>>>>>>>>>>>>> strategies[1][\'permissions\'][0]', strategies[1]['permissions'][0]); - // - // console.log('>>>>>>>>>>>>>>>>>>>>>>>>>>>>> chainManagerAddress', chainManagerAddress); - // console.log('>>>>>>>>>>>>>>>>>>>>>>>>>>>>> mainDao.contracts.core.address', mainDao.contracts.core.address); - // console.log('>>>>>>>>>>>>>>>>>>>>>>>>>>>>> subDao.contracts.core.address', subDao.contracts.core.address); - // - // const resp = await neutronChain.queryContract( - // subDao.contracts.proposals['single'].pre_propose.timelock.address, - // { proposal: { proposal_id: proposalId } }, - // ); - // console.log('>>>>>>>>>>>>>>>>>>>>>>>>>>>>> resp[\'msgs\'][\'wasm\']', resp['msgs'][0]['wasm']); - // - // await waitSeconds(10); - // - // await subdaoMember1.executeTimelockedProposal(proposalId); - // - // const timelockedProp = await subDao.getTimelockedProposal(proposalId); - // expect(timelockedProp.id).toEqual(proposalId); - // expect(timelockedProp.status).toEqual('executed'); - // expect(timelockedProp.msgs).toHaveLength(1); - // }); - // }); + describe('Change the overrule proposal voting period', () => { + let proposalId: number; + test('create proposal', async () => { + const currentOverruleProposalConfig = await neutronChain.queryContract( + mainDao.contracts.proposals['overrule'].address, + { + config: {}, + }, + ); + currentOverruleProposalConfig['max_voting_period']['time'] = 5; + proposalId = await mainDaoMember.submitSingleChoiceProposal( + 'Proposal', + 'Update the max voting period. It will pass', + [ + { + wasm: { + execute: { + contract_addr: mainDao.contracts.proposals['overrule'].address, + msg: Buffer.from( + JSON.stringify({ + update_config: { + threshold: currentOverruleProposalConfig['threshold'], + max_voting_period: + currentOverruleProposalConfig['max_voting_period'], + allow_revoting: + currentOverruleProposalConfig['allow_revoting'], + dao: currentOverruleProposalConfig['dao'], + close_proposal_on_execution_failure: + currentOverruleProposalConfig[ + 'close_proposal_on_execution_failure' + ], + }, + }), + ).toString('base64'), + funds: [], + }, + }, + }, + ], + '1000', + ); + }); + describe('vote for proposal', () => { + test('vote YES from wallet 1', async () => { + await mainDaoMember.voteYes(proposalId); + }); + }); + + describe('execute proposal', () => { + test('check if proposal is passed', async () => { + await mainDao.checkPassedProposal(proposalId); + }); + test('execute passed proposal', async () => { + await mainDaoMember.executeProposalWithAttempts(proposalId); + }); + }); + }); describe('ALLOW_ONLY: change CRON parameters', () => { - test('execute messages', async () => { + let proposalId: number; + beforeAll(async () => { const chainManagerAddress = (await neutronChain.getChainAdmins())[0]; - const res = await subdaoMember1.user.executeContract( + proposalId = await subdaoMember1.submitUpdateParamsCronProposal( chainManagerAddress, - JSON.stringify({ - execute_messages: { - messages: [ - updateCronParamsProposal({ - security_address: mainDao.contracts.voting.address, - limit: 42, - }), - ], - }, + 'Proposal #1', + 'Cron update params proposal. Will pass', + updateCronParamsProposal({ + security_address: mainDao.contracts.voting.address, + limit: 42, }), + '1000', + ); + + const timelockedProp = await subdaoMember1.supportAndExecuteProposal( + proposalId, ); - expect(res.code).toEqual(0); + + expect(timelockedProp.id).toEqual(proposalId); + expect(timelockedProp.status).toEqual('timelocked'); + expect(timelockedProp.msgs).toHaveLength(1); + }); + + test('execute timelocked: success', async () => { + await waitSeconds(10); + + await subdaoMember1.executeTimelockedProposal(proposalId); + const timelockedProp = await subDao.getTimelockedProposal(proposalId); + expect(timelockedProp.id).toEqual(proposalId); + expect(timelockedProp.status).toEqual('executed'); + expect(timelockedProp.msgs).toHaveLength(1); }); }); }); From d94a8aabd036f0c9c06bc9397b9c0526876e51e6 Mon Sep 17 00:00:00 2001 From: Andrei Zavgorodnii Date: Thu, 15 Feb 2024 17:42:08 +0200 Subject: [PATCH 10/15] tests for legacy parameter changes work, also bumped neutronjsplus --- package.json | 2 +- .../run_in_band/chain_manager.test.ts | 149 ++++++++++++------ 2 files changed, 101 insertions(+), 50 deletions(-) diff --git a/package.json b/package.json index 168b7055..4158a509 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,7 @@ "@cosmos-client/core": "^0.47.4", "@cosmos-client/cosmwasm": "^0.40.3", "@cosmos-client/ibc": "^1.2.1", - "@neutron-org/neutronjsplus": "0.4.0-rc2", + "@neutron-org/neutronjsplus": "0.4.0-rc3", "@types/lodash": "^4.14.182", "@types/long": "^4.0.2", "axios": "^0.27.2", diff --git a/src/testcases/run_in_band/chain_manager.test.ts b/src/testcases/run_in_band/chain_manager.test.ts index 60eca396..fd283509 100644 --- a/src/testcases/run_in_band/chain_manager.test.ts +++ b/src/testcases/run_in_band/chain_manager.test.ts @@ -15,10 +15,7 @@ import { import { Wallet } from '@neutron-org/neutronjsplus/dist/types'; import cosmosclient from '@cosmos-client/core'; import { waitSeconds } from '@neutron-org/neutronjsplus/dist/wait'; -import { - paramChangeProposal, - updateCronParamsProposal, -} from '@neutron-org/neutronjsplus/dist/proposal'; +import { updateCronParamsProposal } from '@neutron-org/neutronjsplus/dist/proposal'; import config from '../../config.json'; @@ -70,51 +67,9 @@ describe('Neutron / Subdao', () => { expect(votingPower.power).toEqual('1'); }); - describe('Add an ALLOW_ONLY strategy', () => { - test('create proposal', async () => { - const chainManagerAddress = (await neutronChain.getChainAdmins())[0]; - await mainDaoMember.submitAddChainManagerStrategyProposal( - chainManagerAddress, - 'Proposal #2', - 'Add strategy proposal. It will pass', - { - add_strategy: { - strategy: { - address: subDao.contracts.core.address, - permissions: [ - { - UpdateParamsPermission: { - CronUpdateParamsPermission: { - security_address: true, - limit: true, - }, - }, - }, - ], - }, - }, - }, - '1000', - ); - }); - describe('vote for proposal', () => { - const proposalId = 2; - test('vote YES from wallet 1', async () => { - await mainDaoMember.voteYes(proposalId); - }); - }); - - describe('execute proposal', () => { - const proposalId = 2; - test('check if proposal is passed', async () => { - await mainDao.checkPassedProposal(proposalId); - }); - test('execute passed proposal', async () => { - await mainDaoMember.executeProposalWithAttempts(proposalId); - }); - }); - }); - + // We need to do this because the real main dao has a super long voting period. + // In the subdao tests, a new set of dao contracts was deployed with a smaller + // period, but feels like an overkill here. describe('Change the overrule proposal voting period', () => { let proposalId: number; test('create proposal', async () => { @@ -173,6 +128,60 @@ describe('Neutron / Subdao', () => { }); }); + describe('Add an ALLOW_ONLY strategy (Cron module parameter updates, legacy param changes)', () => { + let proposalId: number; + test('create proposal', async () => { + const chainManagerAddress = (await neutronChain.getChainAdmins())[0]; + proposalId = await mainDaoMember.submitAddChainManagerStrategyProposal( + chainManagerAddress, + 'Proposal #2', + 'Add strategy proposal. It will pass', + { + add_strategy: { + strategy: { + address: subDao.contracts.core.address, + permissions: [ + { + ParamChangePermission: { + params: [ + { + subspace: 'globalfee', + key: 'MaxTotalBypassMinFeeMsgGasUsage', + }, + ], + }, + }, + { + UpdateParamsPermission: { + CronUpdateParamsPermission: { + security_address: true, + limit: true, + }, + }, + }, + ], + }, + }, + }, + '1000', + ); + }); + describe('vote for proposal', () => { + test('vote YES from wallet 1', async () => { + await mainDaoMember.voteYes(proposalId); + }); + }); + + describe('execute proposal', () => { + test('check if proposal is passed', async () => { + await mainDao.checkPassedProposal(proposalId); + }); + test('execute passed proposal', async () => { + await mainDaoMember.executeProposalWithAttempts(proposalId); + }); + }); + }); + describe('ALLOW_ONLY: change CRON parameters', () => { let proposalId: number; beforeAll(async () => { @@ -205,6 +214,48 @@ describe('Neutron / Subdao', () => { expect(timelockedProp.id).toEqual(proposalId); expect(timelockedProp.status).toEqual('executed'); expect(timelockedProp.msgs).toHaveLength(1); + + const cronParams = await neutronChain.queryCronParams(); + expect(cronParams.params.limit).toEqual('42'); + }); + }); + + describe('ALLOW_ONLY: change legacy (global fee) parameters', () => { + let proposalId: number; + beforeAll(async () => { + const chainManagerAddress = (await neutronChain.getChainAdmins())[0]; + proposalId = await subdaoMember1.submitParameterChangeProposal( + chainManagerAddress, + 'Proposal #2', + 'Globalfee param update proposal. Will pass', + 'globalfee', + 'MaxTotalBypassMinFeeMsgGasUsage', + '"42000"', + '1000', + ); + + const timelockedProp = await subdaoMember1.supportAndExecuteProposal( + proposalId, + ); + + expect(timelockedProp.id).toEqual(proposalId); + expect(timelockedProp.status).toEqual('timelocked'); + expect(timelockedProp.msgs).toHaveLength(1); + }); + + test('execute timelocked: success', async () => { + await waitSeconds(10); + + await subdaoMember1.executeTimelockedProposal(proposalId); + const timelockedProp = await subDao.getTimelockedProposal(proposalId); + expect(timelockedProp.id).toEqual(proposalId); + expect(timelockedProp.status).toEqual('executed'); + expect(timelockedProp.msgs).toHaveLength(1); + + const globalFeeParams = await neutronChain.queryGlobalfeeParams(); + expect(globalFeeParams.max_total_bypass_min_fee_msg_gas_usage).toEqual( + '42000', + ); }); }); }); From 0f43ec177c4388547c04d41e98ddf866681fd5f8 Mon Sep 17 00:00:00 2001 From: Andrei Zavgorodnii Date: Thu, 15 Feb 2024 21:52:45 +0200 Subject: [PATCH 11/15] unlinked neutronjsplus --- yarn.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/yarn.lock b/yarn.lock index 6e449c80..4d39eb7c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1564,10 +1564,10 @@ resolved "https://registry.yarnpkg.com/@ledgerhq/logs/-/logs-5.50.0.tgz#29c6419e8379d496ab6d0426eadf3c4d100cd186" integrity sha512-swKHYCOZUGyVt4ge0u8a7AwNcA//h4nx5wIi0sruGye1IJ5Cva0GyK9L2/WdX+kWVTKp92ZiEo1df31lrWGPgA== -"@neutron-org/neutronjsplus@0.4.0-rc2": - version "0.4.0-rc2" - resolved "https://registry.yarnpkg.com/@neutron-org/neutronjsplus/-/neutronjsplus-0.4.0-rc2.tgz#e138182a434427be832225abcf2b0461a7641b0a" - integrity sha512-KIuEAkAVSKyyZCrEixtN608QBoRGwiGNtNM94IGR+jEscMTJ8U/QtutX/qP6xgQQAgkFuw6+tuyO9ICq1nt6ZA== +"@neutron-org/neutronjsplus@0.4.0-rc3": + version "0.4.0-rc3" + resolved "https://registry.yarnpkg.com/@neutron-org/neutronjsplus/-/neutronjsplus-0.4.0-rc3.tgz#ff1336388c6fe91195e5f2712809776312c75fab" + integrity sha512-awDmNqRtue1/TIHxfRlcp9FzzDYQGqymjjC2DEa/MYKdna3lCyKvxDpMNM0FCBo+MJCojYEjf593SENFqHDoXQ== dependencies: "@bufbuild/protobuf" "^1.4.2" "@cosmos-client/core" "^0.47.4" From 01864d972f2f5109ea16e37fc04bc62b90f00849 Mon Sep 17 00:00:00 2001 From: Andrei Zavgorodnii Date: Mon, 26 Feb 2024 22:40:53 +0200 Subject: [PATCH 12/15] post-review fixes --- package.json | 2 +- src/testcases/run_in_band/chain_manager.test.ts | 4 ++-- yarn.lock | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 4158a509..a72e4986 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,7 @@ "@cosmos-client/core": "^0.47.4", "@cosmos-client/cosmwasm": "^0.40.3", "@cosmos-client/ibc": "^1.2.1", - "@neutron-org/neutronjsplus": "0.4.0-rc3", + "@neutron-org/neutronjsplus": "0.4.0-rc4", "@types/lodash": "^4.14.182", "@types/long": "^4.0.2", "axios": "^0.27.2", diff --git a/src/testcases/run_in_band/chain_manager.test.ts b/src/testcases/run_in_band/chain_manager.test.ts index fd283509..044a2dcb 100644 --- a/src/testcases/run_in_band/chain_manager.test.ts +++ b/src/testcases/run_in_band/chain_manager.test.ts @@ -138,9 +138,9 @@ describe('Neutron / Subdao', () => { 'Add strategy proposal. It will pass', { add_strategy: { + address: subDao.contracts.core.address, strategy: { - address: subDao.contracts.core.address, - permissions: [ + AllowOnly: [ { ParamChangePermission: { params: [ diff --git a/yarn.lock b/yarn.lock index 4d39eb7c..b21698ee 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1564,10 +1564,10 @@ resolved "https://registry.yarnpkg.com/@ledgerhq/logs/-/logs-5.50.0.tgz#29c6419e8379d496ab6d0426eadf3c4d100cd186" integrity sha512-swKHYCOZUGyVt4ge0u8a7AwNcA//h4nx5wIi0sruGye1IJ5Cva0GyK9L2/WdX+kWVTKp92ZiEo1df31lrWGPgA== -"@neutron-org/neutronjsplus@0.4.0-rc3": - version "0.4.0-rc3" - resolved "https://registry.yarnpkg.com/@neutron-org/neutronjsplus/-/neutronjsplus-0.4.0-rc3.tgz#ff1336388c6fe91195e5f2712809776312c75fab" - integrity sha512-awDmNqRtue1/TIHxfRlcp9FzzDYQGqymjjC2DEa/MYKdna3lCyKvxDpMNM0FCBo+MJCojYEjf593SENFqHDoXQ== +"@neutron-org/neutronjsplus@0.4.0-rc4": + version "0.4.0-rc4" + resolved "https://registry.yarnpkg.com/@neutron-org/neutronjsplus/-/neutronjsplus-0.4.0-rc4.tgz#79faf94ad7cd36d6a475c12f39fd2fcd9256f22b" + integrity sha512-WREaD47Fc5JyZ55W8SNrbou+j6Pxj7Vj5eMF3AcwpXndim5RVJfNyQlHUBSq5kzNf7AAIpyfr67lnS+K1/LLWw== dependencies: "@bufbuild/protobuf" "^1.4.2" "@cosmos-client/core" "^0.47.4" From 1da3a9213d4ef2a8244350e6473bbd27c2459f02 Mon Sep 17 00:00:00 2001 From: pr0n00gler Date: Tue, 7 May 2024 12:14:13 +0300 Subject: [PATCH 13/15] fix treasury address in pob test --- src/testcases/run_in_band/pob.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/testcases/run_in_band/pob.test.ts b/src/testcases/run_in_band/pob.test.ts index c83f6be1..bd461537 100644 --- a/src/testcases/run_in_band/pob.test.ts +++ b/src/testcases/run_in_band/pob.test.ts @@ -38,7 +38,7 @@ describe('Neutron / IBC hooks', () => { ); n1 = new WalletWrapper(neutronChain, testState.wallets.qaNeutron.genQaWal1); - TreasuryAddress = (await neutronChain.getChainAdmins())[0]; + TreasuryAddress = await neutronChain.getNeutronDAOCore(); }); describe('POB', () => { From 48f794e0bf01ffa1a3b47855bf5634be32b6bbba Mon Sep 17 00:00:00 2001 From: Mike Mozhaev Date: Mon, 13 May 2024 18:21:28 +0300 Subject: [PATCH 14/15] Update chain_manager.test.ts --- src/testcases/run_in_band/chain_manager.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/testcases/run_in_band/chain_manager.test.ts b/src/testcases/run_in_band/chain_manager.test.ts index 044a2dcb..16fcbcbd 100644 --- a/src/testcases/run_in_band/chain_manager.test.ts +++ b/src/testcases/run_in_band/chain_manager.test.ts @@ -19,7 +19,7 @@ import { updateCronParamsProposal } from '@neutron-org/neutronjsplus/dist/propos import config from '../../config.json'; -describe('Neutron / Subdao', () => { +describe('Neutron / Chain Manager', () => { let testState: TestStateLocalCosmosTestNet; let neutronChain: CosmosWrapper; let neutronAccount1: WalletWrapper; From 1a5e767ac9769a67c360e76f72e3d37788d76651 Mon Sep 17 00:00:00 2001 From: pr0n00gler Date: Mon, 13 May 2024 18:27:16 +0300 Subject: [PATCH 15/15] update neutronjsplus --- package.json | 6 ++---- yarn.lock | 44 +++++++++++++++----------------------------- 2 files changed, 17 insertions(+), 33 deletions(-) diff --git a/package.json b/package.json index febdcabc..5a873c1f 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,7 @@ "@cosmos-client/core": "^0.47.4", "@cosmos-client/cosmwasm": "^0.40.3", "@cosmos-client/ibc": "^1.2.1", - "@neutron-org/neutronjsplus": "https://github.com/neutron-org/neutronjsplus.git#053608f0df346df7d2057488b4f1534f94f59f74", + "@neutron-org/neutronjsplus": "https://github.com/neutron-org/neutronjsplus.git#35a66ac1e24b1224a57f335eddf7ba250f784a13", "@types/lodash": "^4.14.182", "@types/long": "^5.0.0", "axios": "^0.27.2", @@ -86,9 +86,7 @@ "eslint --max-warnings=0", "jest --bail --findRelatedTests" ], - "./**/*.{ts,tsx,js,jsx,md,json}": [ - "prettier --write" - ] + "./**/*.{ts,tsx,js,jsx,md,json}": ["prettier --write"] }, "engines": { "node": ">=16.0 <17" diff --git a/yarn.lock b/yarn.lock index 1362b9bc..c44a6ac9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1568,9 +1568,9 @@ resolved "https://registry.yarnpkg.com/@ledgerhq/logs/-/logs-5.50.0.tgz#29c6419e8379d496ab6d0426eadf3c4d100cd186" integrity sha512-swKHYCOZUGyVt4ge0u8a7AwNcA//h4nx5wIi0sruGye1IJ5Cva0GyK9L2/WdX+kWVTKp92ZiEo1df31lrWGPgA== -"@neutron-org/neutronjsplus@https://github.com/neutron-org/neutronjsplus.git#053608f0df346df7d2057488b4f1534f94f59f74": - version "0.4.0-rc3" - resolved "https://github.com/neutron-org/neutronjsplus.git#053608f0df346df7d2057488b4f1534f94f59f74" +"@neutron-org/neutronjsplus@https://github.com/neutron-org/neutronjsplus.git#35a66ac1e24b1224a57f335eddf7ba250f784a13": + version "0.4.0" + resolved "https://github.com/neutron-org/neutronjsplus.git#35a66ac1e24b1224a57f335eddf7ba250f784a13" dependencies: "@bufbuild/protobuf" "^1.4.2" "@cosmos-client/core" "^0.47.4" @@ -1847,9 +1847,9 @@ integrity sha512-/pyBZWSLD2n0dcHE3hq8s8ZvcETHtEuF+3E7XVt0Ig2nvsVQXdghHVcEkIWjy9A0wKfTn97a/PSDYohKIlnP/w== "@types/node@*", "@types/node@>=13.7.0": - version "20.12.10" - resolved "https://registry.yarnpkg.com/@types/node/-/node-20.12.10.tgz#8f0c3f12b0f075eee1fe20c1afb417e9765bef76" - integrity sha512-Eem5pH9pmWBHoGAT8Dr5fdc5rYA+4NAovdM4EktRPVAAiJhmWWfQrA0cFhAbOsQdSfIHjAud6YdkbL69+zSKjw== + version "20.12.11" + resolved "https://registry.yarnpkg.com/@types/node/-/node-20.12.11.tgz#c4ef00d3507000d17690643278a60dc55a9dc9be" + integrity sha512-vDg9PZ/zi+Nqp6boSOT7plNuthRugEKixDv5sFTIpkE89MmNtEArAShI4mxuX2+UrLEe9pxC1vm2cjm9YlWbJw== dependencies: undici-types "~5.26.4" @@ -2423,9 +2423,9 @@ camelcase@^6.2.0: integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA== caniuse-lite@^1.0.30001587: - version "1.0.30001616" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001616.tgz#4342712750d35f71ebba9fcac65e2cf8870013c3" - integrity sha512-RHVYKov7IcdNjVHJFNY/78RdG4oGVjbayxv8u5IO74Wv7Hlq4PnJE6mo/OjFijjVFNy5ijnCt6H3IIo4t+wfEw== + version "1.0.30001617" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001617.tgz#809bc25f3f5027ceb33142a7d6c40759d7a901eb" + integrity sha512-mLyjzNI9I+Pix8zwcrpxEbGlfqOkF9kM3ptzmKNw5tizSyYwMe+nGLTqMK9cO+0E+Bh6TsBxNAaHWEM8xwSsmA== chalk@^2.3.0, chalk@^2.4.2: version "2.4.2" @@ -2812,9 +2812,9 @@ ee-first@1.1.1: integrity sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow== electron-to-chromium@^1.4.668: - version "1.4.757" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.757.tgz#45f7c9341b538f8c4b9ca8af9692e0ed1a776a44" - integrity sha512-jftDaCknYSSt/+KKeXzH3LX5E2CvRLm75P3Hj+J/dv3CL0qUYcOt13d5FN1NiL5IJbbhzHrb3BomeG2tkSlZmw== + version "1.4.763" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.763.tgz#64f2041ed496fd6fc710b9be806fe91da9334f91" + integrity sha512-k4J8NrtJ9QrvHLRo8Q18OncqBCB7tIUyqxRcJnlonQ0ioHKYB988GcDFF3ZePmnb8eHEopDs/wPHR/iGAFgoUQ== elliptic@^6.4.0, elliptic@^6.5.3, elliptic@^6.5.4: version "6.5.5" @@ -4205,13 +4205,6 @@ lru-cache@^5.1.1: dependencies: yallist "^3.0.2" -lru-cache@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-6.0.0.tgz#6d6fe6570ebd96aaf90fcad1dafa3b2566db3a94" - integrity sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA== - dependencies: - yallist "^4.0.0" - make-dir@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-4.0.0.tgz#c3c2307a771277cd9638305f915c29ae741b614e" @@ -4899,11 +4892,9 @@ semver@^6.3.0, semver@^6.3.1: integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA== semver@^7.3.2, semver@^7.3.5, semver@^7.3.7, semver@^7.5.3, semver@^7.5.4: - version "7.6.0" - resolved "https://registry.yarnpkg.com/semver/-/semver-7.6.0.tgz#1a46a4db4bffcccd97b743b5005c8325f23d4e2d" - integrity sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg== - dependencies: - lru-cache "^6.0.0" + version "7.6.2" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.6.2.tgz#1e3b34759f896e8f14d6134732ce798aeb0c6e13" + integrity sha512-FNAIBWCx9qcRhoHcgcJ0gvU7SN1lYU2ZXuSfl04bSC5OpvDHFyJCjdNHomPXxjQlCBU67YW64PzY7/VIEH7F2w== send@0.18.0: version "0.18.0" @@ -5551,11 +5542,6 @@ yallist@^3.0.2: resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.1.1.tgz#dbb7daf9bfd8bac9ab45ebf602b8cbad0d5d08fd" integrity sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g== -yallist@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72" - integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A== - yaml@^1.10.2: version "1.10.2" resolved "https://registry.yarnpkg.com/yaml/-/yaml-1.10.2.tgz#2301c5ffbf12b467de8da2333a459e29e7920e4b"