Skip to content

Commit

Permalink
Merge branch 'main' into feat/whitelist-escrow-address-ibc-query
Browse files Browse the repository at this point in the history
  • Loading branch information
joldie777 committed Sep 18, 2024
2 parents 9350444 + 599607e commit afc271f
Show file tree
Hide file tree
Showing 3 changed files with 380 additions and 294 deletions.
4 changes: 4 additions & 0 deletions src/testcases/parallel/governance.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@ describe('Neutron / Governance', () => {
],
execution_stage: 'EXECUTION_STAGE_BEGIN_BLOCKER',
},
true, // just to check that bindings are ok
);
});

Expand All @@ -334,6 +335,9 @@ describe('Neutron / Governance', () => {
'',
'1000',
{ name: 'proposal11' },
'single',
true,
true,
);
});

Expand Down
91 changes: 91 additions & 0 deletions src/testcases/run_in_band/chain_manager.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,12 @@ describe('Neutron / Chain Manager', () => {
limit: true,
},
},
{
cron_permission: {
add_schedule: true,
remove_schedule: true,
},
},
{
update_tokenfactory_params_permission: {
denom_creation_fee: true,
Expand Down Expand Up @@ -356,4 +362,89 @@ describe('Neutron / Chain Manager', () => {
expect(dexParams.params.goodTilPurgeAllowance).toEqual(50000n);
});
});

describe('ALLOW_ONLY: CRON add schedule / remove schedule', () => {
let proposalId: number;
const scheduleName = 'schedule1';

test('create addSchedule proposal', async () => {
proposalId = await subdaoMember1.submitAddSchedule(
chainManagerAddress,
'Add schedule',
'cron add schedule proposal. Will pass',
'1000',
{
name: 'schedule1',
period: 100,
msgs: [
{
contract: 'whatever',
msg: JSON.stringify({}),
},
],
execution_stage: 0,
},
);

const timelockedProp = await subdaoMember1.supportAndExecuteProposal(
proposalId,
);

expect(timelockedProp.id).toEqual(proposalId);
expect(timelockedProp.status).toEqual('timelocked');
expect(timelockedProp.msgs).toHaveLength(1);
});

test('execute timelocked addSchedule: 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 res = await cronQuerier.schedule({ name: scheduleName });
expect(res.schedule.name).toEqual(scheduleName);
expect(res.schedule.msgs.length).toEqual(1);
expect(res.schedule.period).toEqual(100n);
});

test('create removeSchedule proposal', async () => {
proposalId = await subdaoMember1.submitRemoveSchedule(
chainManagerAddress,
'Add schedule',
'cron add schedule proposal. Will pass',
'1000',
{ name: 'schedule1' },
);

const timelockedProp = await subdaoMember1.supportAndExecuteProposal(
proposalId,
);

expect(timelockedProp.id).toEqual(proposalId);
expect(timelockedProp.status).toEqual('timelocked');
expect(timelockedProp.msgs).toHaveLength(1);
});

test('execute timelocked removeSchedule: 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);

let exceptionThrown = false;
try {
await cronQuerier.schedule({ name: scheduleName });
} catch (error) {
expect(error.message).toMatch(/schedule not found: key not found/);
exceptionThrown = true;
}
expect(exceptionThrown).toBeTruthy();
});
});
});
Loading

0 comments on commit afc271f

Please sign in to comment.