Skip to content

Commit

Permalink
Merge pull request #50 from neutron-org/feat/icq-params-gov-gated
Browse files Browse the repository at this point in the history
feat: icq MaxKvQueryKeysCount and MaxTransactionsFilters gov gated #NTRN-364
  • Loading branch information
pr0n00gler authored Sep 2, 2024
2 parents 6c4fb9d + 1e4527e commit 0eb1d6b
Show file tree
Hide file tree
Showing 4 changed files with 434 additions and 371 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@neutron-org/neutronjsplus",
"version": "0.4.0-rc21",
"version": "0.5.0",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"license": "Apache-2.0",
Expand Down
40 changes: 38 additions & 2 deletions src/dao.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
chainManagerWrapper,
clearAdminProposal,
clientUpdateProposal,
ConsensusParams,
paramChangeProposal,
ParamChangeProposalInfo,
ParamsContractmanagerInfo,
Expand All @@ -28,6 +29,7 @@ import {
SendProposalInfo,
unpinCodesProposal,
updateAdminProposal,
updateConsensusParamsProposal,
upgradeProposal,
} from './proposal';
import {
Expand Down Expand Up @@ -1380,20 +1382,54 @@ export class DaoMember {
);
}

async submitUpdateParamsConsensusProposal(
chainManagerAddress: string,
title: string,
description: string,
params: ConsensusParams,
amount: string,
): Promise<number> {
const wrappedMessage = chainManagerWrapper(
chainManagerAddress,
updateConsensusParamsProposal(params),
);
return await this.submitSingleChoiceProposal(
title,
description,
[wrappedMessage],
amount,
);
}

/**
* submitUpdateParamsInterchainqueriesProposal creates proposal which changes params of interchaintxs module.
*/
async submitUpdateParamsInterchainqueriesProposal(
chainManagerAddress: string,
title: string,
description: string,
message: ParamsInterchainqueriesInfo,
params: ParamsInterchainqueriesInfo,
amount: string,
): Promise<number> {
const message = chainManagerWrapper(chainManagerAddress, {
custom: {
submit_admin_proposal: {
admin_proposal: {
proposal_execute_message: {
message: JSON.stringify({
'@type': '/neutron.interchainqueries.MsgUpdateParams',
authority: ADMIN_MODULE_ADDRESS,
params,
}),
},
},
},
},
});
return await this.submitSingleChoiceProposal(
title,
description,
[chainManagerWrapper(chainManagerAddress, message)],
[message],
amount,
);
}
Expand Down
40 changes: 39 additions & 1 deletion src/proposal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ export type ParamsInterchaintxsInfo = {

export type ParamsInterchainqueriesInfo = {
query_submit_timeout: number;
query_deposit: null;
query_deposit: Coin[];
tx_query_removal_limit: number;
max_kv_query_keys_count: number;
max_transactions_filters: number;
};

export type WhitelistedHook = {
Expand Down Expand Up @@ -195,6 +197,24 @@ export type DynamicFeesParams = {
ntrn_prices: Array<DecCoin>;
};

export type ConsensusParams = {
block: {
max_gas: number;
max_bytes: number;
};
evidence: {
max_age_num_blocks: number;
max_age_duration: string; // Duration
max_bytes: number;
};
validator: {
pub_key_types: string[];
};
abci?: {
vote_extensions_enable_height: number;
};
};

export type DecCoin = {
denom: string;
amount: string;
Expand Down Expand Up @@ -727,3 +747,21 @@ export const updateDynamicFeesParamsProposal = (
},
},
});

export const updateConsensusParamsProposal = (
params: ConsensusParams,
): any => ({
custom: {
submit_admin_proposal: {
admin_proposal: {
proposal_execute_message: {
message: JSON.stringify({
'@type': '/cosmos.consensus.v1.MsgUpdateParams',
authority: ADMIN_MODULE_ADDRESS,
...params,
}),
},
},
},
},
});
Loading

0 comments on commit 0eb1d6b

Please sign in to comment.