Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests fix: add ugly rescueeer address check #154

Merged
merged 2 commits into from
May 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"scripts": {
"test": "yarn test:parallel && yarn test:run_in_band",
"test:parallel": "jest -b src/testcases/parallel",
"test:dao_assert": "jest -b src/testcases/parallel/dao_assert",
"test:run_in_band": "yarn test:tge:auction && yarn test:tge:airdrop && yarn test:tge:credits && yarn test:interchaintx && yarn test:interchain_kv_query && yarn test:interchain_tx_query_plain && yarn test:subdao && yarn test:reserve && yarn test:overrule && yarn test:ibc_hooks",
"test:simple": "jest -b src/testcases/parallel/simple",
"test:interchaintx": "jest -b src/testcases/run_in_band/interchaintx",
Expand Down Expand Up @@ -83,4 +84,4 @@
"engines": {
"node": ">=11.0 <17"
}
}
}
8 changes: 8 additions & 0 deletions src/helpers/dao.ts
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,14 @@ export const getDaoContracts = async (
};
};

export const getDaoAdmin = async (
cm: CosmosWrapper,
daoAddress: string,
): Promise<string> => {
const daoInfo = await cm.getContractInfo(daoAddress);
return daoInfo['contract_info']['admin'];
};

export const getSubDaoContracts = async (
cm: CosmosWrapper,
daoAddress: string,
Expand Down
24 changes: 14 additions & 10 deletions src/testcases/parallel/dao_assert.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
DaoContracts,
VotingVaultsModule,
getTreasuryContract,
getDaoAdmin,
} from '../../helpers/dao';
import { getContractsHashes } from '../../helpers/env';
import { NeutronContract } from '../../helpers/types';
Expand All @@ -22,6 +23,7 @@ describe('DAO / Check', () => {
let votingModuleAddress: string;
let votingVaultsNtrnAddress: string;
let treasuryContract: string;
let rescueeerAddress: string;

beforeAll(async () => {
testState = new TestStateLocalCosmosTestNet();
Expand All @@ -47,6 +49,8 @@ describe('DAO / Check', () => {
votingVaultsNtrnAddress = (daoContracts.voting as VotingVaultsModule).vaults
.neutron.address;
treasuryContract = await getTreasuryContract(neutronChain);
// since we consider rescueeer as a dao admin, we simply get its address w this ugly way
rescueeerAddress = await getDaoAdmin(neutronChain, daoCoreAddress);
});

describe('Checking the association of proposal & preproposal modules with the Dao', () => {
Expand Down Expand Up @@ -140,16 +144,16 @@ describe('DAO / Check', () => {
await verifyAdmin(
neutronChain,
votingVaultsNtrnAddress,
daoContracts.core.address,
rescueeerAddress,
);
await verifyLabel(neutronChain, daoContracts, votingVaultsNtrnAddress);
});

test('Dao is the admin of himself', async () => {
test('Dao is not the admin of himself, should be rescueeer', async () => {
await verifyAdmin(
neutronChain,
daoContracts.core.address,
daoContracts.core.address,
rescueeerAddress,
);
await verifyLabel(neutronChain, daoContracts, daoContracts.core.address);
});
Expand Down Expand Up @@ -231,17 +235,17 @@ describe('DAO / Check', () => {
describe('Test subdaos', () => {
test('Check subdaos contracts admins and labels', async () => {
for (const subdaoIndex in daoContracts.subdaos) {
const sudao = daoContracts.subdaos[subdaoIndex];
const subdao = daoContracts.subdaos[subdaoIndex];
await verifyAdmin(neutronChain, subdao.core.address, rescueeerAddress);
const contractsList = [
sudao.core.address,
sudao.proposals.single.address,
sudao.proposals.single.pre_propose.address,
sudao.voting.address,
subdao.proposals.single.address,
subdao.proposals.single.pre_propose.address,
subdao.voting.address,
// (sudao.voting as VotingCw4Module).cw4group.address, // todo fix this
];
if (sudao.proposals.single.pre_propose.timelock.address) {
if (subdao.proposals.single.pre_propose.timelock.address) {
contractsList.push(
sudao.proposals.single.pre_propose.timelock.address,
subdao.proposals.single.pre_propose.timelock.address,
);
}
for (const contractAddress of contractsList) {
Expand Down