diff --git a/src/helpers/dao.ts b/src/helpers/dao.ts index 04a4d06e..f7e835d0 100644 --- a/src/helpers/dao.ts +++ b/src/helpers/dao.ts @@ -949,7 +949,15 @@ export class DaoMember { ): Promise { await this.voteYes(proposalId, customModule); await this.executeProposal(proposalId, customModule); - return await this.dao.getTimelockedProposal(proposalId, customModule); + return await getWithAttempts( + this.dao.chain.blockWaiter, + async () => + await this.dao.getTimelockedProposal(proposalId, customModule), + async (response) => { + return response.id && +response.id > 0; + }, + 5, + ); } async executeTimelockedProposal( @@ -1442,7 +1450,7 @@ export const deploySubdao = async ( mainDaoCoreAddress: string, overrulePreProposeAddress: string, securityDaoAddr: string, - closeProposalOnExecutionFailure: boolean, + closeProposalOnExecutionFailure = true, ): Promise => { const coreCodeId = await cm.storeWasm(NeutronContract.SUBDAO_CORE); const cw4VotingCodeId = await cm.storeWasm(NeutronContract.CW4_VOTING); diff --git a/src/helpers/types.ts b/src/helpers/types.ts index 17ded19d..f568c6a4 100644 --- a/src/helpers/types.ts +++ b/src/helpers/types.ts @@ -284,9 +284,4 @@ export type ContractAdminResponse = { }; }; -export type ProposalFailedExecutionErrorResponse = { - errors: { - height: number; - error: string; - }[]; -}; +export type ProposalFailedExecutionErrorResponse = string; diff --git a/src/testcases/parallel/overrule.test.ts b/src/testcases/parallel/overrule.test.ts index f8da0e86..b8458e75 100644 --- a/src/testcases/parallel/overrule.test.ts +++ b/src/testcases/parallel/overrule.test.ts @@ -56,6 +56,7 @@ describe('Neutron / Subdao', () => { daoContracts.core.address, daoContracts.proposals.overrule?.pre_propose?.address || '', neutronAccount1.wallet.address.toString(), + false, // do not close proposal on failure since otherwise we wont get an error exception from submsgs ); subdaoMember1 = new DaoMember(neutronAccount1, subDao); diff --git a/src/testcases/parallel/subdao.test.ts b/src/testcases/parallel/subdao.test.ts index 2812d400..a1326d26 100644 --- a/src/testcases/parallel/subdao.test.ts +++ b/src/testcases/parallel/subdao.test.ts @@ -138,10 +138,8 @@ describe('Neutron / Subdao', () => { expect(timelockedProp.status).toEqual('execution_failed'); expect(timelockedProp.msgs).toHaveLength(1); - const res = await subDao.getTimelockedProposalErrors(proposalId); - expect(res.errors.length).toEqual(1); - expect(res.errors[0].error).toEqual('codespace: sdk, code: 5'); // 'insufficient funds' error - expect(res.errors[0].height).toBeGreaterThan(0); + const error = await subDao.getTimelockedProposalErrors(proposalId); + expect(error).toEqual('codespace: sdk, code: 5'); // 'insufficient funds' error }); test('execute timelocked(ExecutionFailed): WrongStatus error', async () => { @@ -194,7 +192,6 @@ describe('Neutron / Subdao', () => { }); test('execute timelocked 2: execution failed', async () => { - // from here await neutronAccount1.msgSend(subDao.contracts.core.address, '100000'); // fund the subdao treasury const balance2 = await neutronAccount2.queryDenomBalance(NEUTRON_DENOM); @@ -207,9 +204,8 @@ describe('Neutron / Subdao', () => { expect(timelockedProp.status).toEqual('execution_failed'); expect(timelockedProp.msgs).toHaveLength(1); - const res = await subDao.getTimelockedProposalErrors(proposalId2); - expect(res.errors.length).toEqual(1); - expect(res.errors[0].error).toEqual('codespace: undefined, code: 1'); + const error = await subDao.getTimelockedProposalErrors(proposalId2); + expect(error).toEqual('codespace: undefined, code: 1'); // check that goodMessage failed as well const balance2After = await neutronAccount2.queryDenomBalance( @@ -292,9 +288,9 @@ describe('Neutron / Subdao', () => { expect(timelockedProp.status).toEqual('timelocked'); expect(timelockedProp.msgs).toHaveLength(1); - const res = await subDao.getTimelockedProposalErrors(proposalId3); - // do not have errors because we did not have reply - expect(res.errors.length).toEqual(0); + const error = await subDao.getTimelockedProposalErrors(proposalId3); + // do not have an error because we did not have reply + expect(error).toEqual(null); await neutronAccount1.msgSend(subDao.contracts.core.address, '300000');