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

feat: whitelist tf hooks #314

Merged
merged 26 commits into from
Jul 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
84383a4
add tokenfactory params tests
jcompagni10 Jun 20, 2024
d6dbf48
fix tests
jcompagni10 Jun 21, 2024
924835f
lint
jcompagni10 Jun 21, 2024
0ea9681
disable setBeforeSendHook tests
jcompagni10 Jun 21, 2024
1a129e5
lint
jcompagni10 Jun 21, 2024
df4229c
Merge branch 'feat/whitelist-tf-hooks-core-changes' into feat/whiteli…
jcompagni10 Jun 21, 2024
82cafb0
lint
jcompagni10 Jun 21, 2024
84b8f5b
fix incorrect params in TF test
jcompagni10 Jun 21, 2024
e128aa2
update neutron jsplus dep
jcompagni10 Jun 25, 2024
f2022e8
lint
jcompagni10 Jun 25, 2024
2205329
whitelist denom hooks for tf tests
jcompagni10 Jun 29, 2024
16e0502
misc cleanup
jcompagni10 Jun 29, 2024
02686cc
add wait for timelock proposal
jcompagni10 Jun 29, 2024
af21a6a
lint
jcompagni10 Jun 29, 2024
48b0fa2
change tf proposal title and description
jcompagni10 Jul 1, 2024
6b33cec
add test for set non-whitelisted hook failure
jcompagni10 Jul 1, 2024
153302e
specify neutronjsplus dep with hash
jcompagni10 Jul 2, 2024
7ed5175
cleanup test for failing whitelist and change subdao voting period
jcompagni10 Jul 2, 2024
b2be1b5
fix whitelist proposal
jcompagni10 Jul 2, 2024
ca9a9ea
lint
jcompagni10 Jul 2, 2024
ace269e
remove temp fee_collector_address
jcompagni10 Jul 2, 2024
2b5fc0c
attempt to fix njs problem
quasisamurai Jul 3, 2024
2ab1175
another attempt to fix dependency
quasisamurai Jul 3, 2024
bd5a28b
run tokenfactory tests in_band
jcompagni10 Jul 3, 2024
0645791
fix tests
pr0n00gler Jul 4, 2024
8e7c707
upd neutronjplus commit
pr0n00gler Jul 4, 2024
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
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"scripts": {
"test": "yarn test:parallel && yarn test:run_in_band",
"test:parallel": "jest -b src/testcases/parallel",
"test:run_in_band": "yarn test:tge:auction && yarn test:tge:credits && yarn test:interchaintx && yarn test:interchain_kv_query && yarn test:interchain_tx_query_plain && yarn test:tokenomics && yarn test:reserve && yarn test:ibc_hooks && yarn test:float && yarn test:parameters && yarn test:dex_stargate && yarn test:dex_bindings && yarn test:slinky && yarn test:chain_manager && yarn test:feemarket && yarn test:globalfee",
"test:run_in_band": "yarn test:tge:auction && yarn test:tge:credits && yarn test:interchaintx && yarn test:interchain_kv_query && yarn test:interchain_tx_query_plain && yarn test:tokenomics && yarn test:reserve && yarn test:ibc_hooks && yarn test:float && yarn test:parameters && yarn test:dex_stargate && yarn test:dex_bindings && yarn test:slinky && yarn test:chain_manager && yarn test:feemarket && yarn test:globalfee && yarn test:tokenfactory",
"test:simple": "jest -b src/testcases/parallel/simple",
"test:slinky": "jest -b src/testcases/run_in_band/slinky",
"test:stargate_queries": "jest -b src/testcases/parallel/stargate_queries",
Expand All @@ -24,7 +24,7 @@
"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:tokenfactory": "jest -b src/testcases/run_in_band/tokenfactory",
"test:overrule": "jest -b src/testcases/parallel/overrule",
"test:tge:vesting_lp_vault": "jest -b src/testcases/parallel/tge.vesting_lp_vault",
"test:tge:credits_vault": "jest -b src/testcases/parallel/tge.credits_vault",
Expand All @@ -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": "0.4.1",
"@neutron-org/neutronjsplus": "https://github.com/neutron-org/neutronjsplus.git#40c2c30434e63ab989e42408a94034589d5985d8",
"@types/lodash": "^4.14.182",
"@types/long": "^5.0.0",
"axios": "^0.27.2",
Expand Down Expand Up @@ -93,4 +93,4 @@
"engines": {
"node": ">=16.0 <17"
}
}
}
83 changes: 76 additions & 7 deletions src/testcases/run_in_band/chain_manager.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ import {
import { Wallet } from '@neutron-org/neutronjsplus/dist/types';
import cosmosclient from '@cosmos-client/core';
import { waitSeconds } from '@neutron-org/neutronjsplus/dist/wait';
import { updateCronParamsProposal } from '@neutron-org/neutronjsplus/dist/proposal';
import {
updateCronParamsProposal,
updateTokenfactoryParamsProposal,
} from '@neutron-org/neutronjsplus/dist/proposal';

import config from '../../config.json';

Expand Down Expand Up @@ -128,7 +131,7 @@ describe('Neutron / Chain Manager', () => {
});
});

describe('Add an ALLOW_ONLY strategy (Cron module parameter updates, legacy param changes)', () => {
describe('Add an ALLOW_ONLY strategy (Cron module parameter updates, Tokenfactory module parameter updates, legacy param changes)', () => {
let proposalId: number;
test('create proposal', async () => {
const chainManagerAddress = (await neutronChain.getChainAdmins())[0];
Expand All @@ -152,11 +155,17 @@ describe('Neutron / Chain Manager', () => {
},
},
{
update_params_permission: {
cron_update_params_permission: {
security_address: true,
limit: true,
},
update_cron_params_permission: {
security_address: true,
limit: true,
},
},
{
update_tokenfactory_params_permission: {
denom_creation_fee: true,
denom_creation_gas_consume: true,
fee_collector_address: true,
whitelisted_hooks: true,
},
},
],
Expand Down Expand Up @@ -219,4 +228,64 @@ describe('Neutron / Chain Manager', () => {
expect(cronParams.params.limit).toEqual('42');
});
});

describe('ALLOW_ONLY: change TOKENFACTORY parameters', () => {
let proposalId: number;
beforeAll(async () => {
const chainManagerAddress = (await neutronChain.getChainAdmins())[0];
proposalId = await subdaoMember1.submitUpdateParamsTokenfactoryProposal(
chainManagerAddress,
'Proposal #2',
'Cron update params proposal. Will pass',
updateTokenfactoryParamsProposal({
denom_creation_fee: [{ denom: 'untrn', amount: '1' }],
denom_creation_gas_consume: 20,
fee_collector_address:
'neutron1m9l358xunhhwds0568za49mzhvuxx9ux8xafx2',
whitelisted_hooks: [
{
code_id: 1,
denom_creator: 'neutron1m9l358xunhhwds0568za49mzhvuxx9ux8xafx2',
},
],
}),
'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 tokenfactoryParams = await neutronChain.queryTokenfactoryParams();
expect(tokenfactoryParams.params.denom_creation_fee).toEqual([
{ denom: 'untrn', amount: '1' },
]);
expect(tokenfactoryParams.params.denom_creation_gas_consume).toEqual(
'20',
);
expect(tokenfactoryParams.params.fee_collector_address).toEqual(
'neutron1m9l358xunhhwds0568za49mzhvuxx9ux8xafx2',
);
expect(tokenfactoryParams.params.whitelisted_hooks).toEqual([
{
code_id: '1',
denom_creator: 'neutron1m9l358xunhhwds0568za49mzhvuxx9ux8xafx2',
},
]);
});
});
});
16 changes: 11 additions & 5 deletions src/testcases/run_in_band/parameters.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
updateFeerefunderParamsProposal,
updateInterchainqueriesParamsProposal,
updateInterchaintxsParamsProposal,
updateTokenfacoryParamsProposal,
updateTokenfactoryParamsProposal,
updateTransferParamsProposal,
} from '@neutron-org/neutronjsplus/dist/proposal';

Expand Down Expand Up @@ -127,10 +127,11 @@ describe('Neutron / Parameters', () => {
chainManagerAddress,
'Proposal #2',
'Tokenfactory params proposal',
updateTokenfacoryParamsProposal({
updateTokenfactoryParamsProposal({
fee_collector_address: await neutronChain.getNeutronDAOCore(),
denom_creation_fee: null,
denom_creation_fee: [{ denom: 'untrn', amount: '1' }],
denom_creation_gas_consume: 100000,
whitelisted_hooks: [],
}),
'1000',
);
Expand All @@ -156,13 +157,18 @@ describe('Neutron / Parameters', () => {
test('check if params changed after proposal execution', async () => {
const paramsAfter = await neutronChain.queryTokenfactoryParams();

expect(paramsAfter.params.denom_creation_fee).toEqual(
expect(paramsAfter.params.denom_creation_fee).not.toEqual(
paramsBefore.params.denom_creation_fee,
);
expect(paramsAfter.params.denom_creation_gas_consume).not.toEqual(
paramsBefore.params.denom_creation_gas_consume,
);
expect(paramsAfter.params.denom_creation_fee).toHaveLength(0);
expect(paramsAfter.params.denom_creation_fee).toEqual([
{
denom: 'untrn',
amount: '1',
},
]);
expect(paramsAfter.params.denom_creation_gas_consume).toEqual('100000');
});
});
Expand Down
Loading
Loading