From f4abc2646bef30bd2dbb50d26a311034301518c2 Mon Sep 17 00:00:00 2001 From: swelf Date: Fri, 18 Oct 2024 03:34:33 +0300 Subject: [PATCH 1/5] added consumer params proposal --- src/dao.ts | 22 +++++++++++++++++++ src/proposal.ts | 57 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 79 insertions(+) diff --git a/src/dao.ts b/src/dao.ts index 2211463..f0a4ae3 100644 --- a/src/dao.ts +++ b/src/dao.ts @@ -36,6 +36,7 @@ import { updateAdminProposal, updateConsensusParamsProposal, upgradeProposal, + ConsumerParams, } from './proposal'; import { Contract, @@ -1419,6 +1420,27 @@ export class DaoMember { ); } + async submitUpdateParamsConsumerProposal( + chainManagerAddress: string, + title: string, + description: string, + message: ConsumerParams, + amount: string, + fee = { + gas: '4000000', + amount: [{ denom: this.denom, amount: '10000' }], + }, + ): Promise { + return await this.submitSingleChoiceProposal( + title, + description, + [chainManagerWrapper(chainManagerAddress, message)], + amount, + 'single', + fee, + ); + } + async submitUpdateParamsConsensusProposal( chainManagerAddress: string, title: string, diff --git a/src/proposal.ts b/src/proposal.ts index 8cbfeb0..5cf72b7 100644 --- a/src/proposal.ts +++ b/src/proposal.ts @@ -220,6 +220,47 @@ export type ConsensusParams = { }; }; +export type ConsumerParams = { + enabled: boolean; + /// ///////////////////// + /// Distribution Params + /// Number of blocks between ibc-token-transfers from the consumer chain to + /// the provider chain. Note that at this transmission event a fraction of + /// the accumulated tokens are divided and sent consumer redistribution + /// address. + blocks_per_distribution_transmission: number; + /// Channel, and provider-chain receiving address to send distribution token + /// transfers over. These parameters is auto-set during the consumer <-> + /// provider handshake procedure. + distribution_transmission_channel: string; + provider_fee_pool_addr_str: string; + /// Sent CCV related IBC packets will timeout after this duration + ccv_timeout_period: string; // Duration + /// Sent transfer related IBC packets will timeout after this duration + transfer_timeout_period: string; // Duration + /// The fraction of tokens allocated to the consumer redistribution address + /// during distribution events. The fraction is a string representing a + /// decimal number. For example "0.75" would represent 75%. + consumer_redistribution_fraction: string; + /// The number of historical info entries to persist in store. + /// This param is a part of the cosmos sdk staking module. In the case of + /// a ccv enabled consumer chain, the ccv module acts as the staking module. + historical_entries: number; + /// Unbonding period for the consumer, + /// which should be smaller than that of the provider in general. + unbonding_period: string; // Duration + /// !!! DEPRECATED !!! soft_opt_out_threshold is deprecated. see docs/docs/adrs/adr-015-partial-set-security.md + soft_opt_out_threshold: string; + /// Reward denoms. These are the denominations which are allowed to be sent to + /// the provider as rewards. + reward_denoms: Array; + /// Provider-originated reward denoms. These are denoms coming from the + /// provider which are allowed to be used as rewards. e.g. "uatom" + provider_reward_denoms: Array; + /// The period after which a consumer can retry sending a throttled packet. + retry_delay_period: string; // Duration +}; + export type DecCoin = { denom: string; amount: string; @@ -753,6 +794,22 @@ export const updateDynamicFeesParamsProposal = ( }, }); +export const updateConsumerParamsProposal = (params: ConsumerParams): any => ({ + custom: { + submit_admin_proposal: { + admin_proposal: { + proposal_execute_message: { + message: JSON.stringify({ + '@type': '"/interchain_security.ccv.consumer.v1.MsgUpdateParams"', + authority: ADMIN_MODULE_ADDRESS, + params, + }), + }, + }, + }, + }, +}); + export interface AddSchedule { name: string; period: number; From 27317fc2658f2e5056ba900b01db7d749508d647 Mon Sep 17 00:00:00 2001 From: swelf Date: Fri, 18 Oct 2024 18:20:44 +0300 Subject: [PATCH 2/5] update ccv msg --- src/proposal.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/proposal.ts b/src/proposal.ts index 5cf72b7..de0ef09 100644 --- a/src/proposal.ts +++ b/src/proposal.ts @@ -800,7 +800,7 @@ export const updateConsumerParamsProposal = (params: ConsumerParams): any => ({ admin_proposal: { proposal_execute_message: { message: JSON.stringify({ - '@type': '"/interchain_security.ccv.consumer.v1.MsgUpdateParams"', + '@type': '/interchain_security.ccv.consumer.v1.MsgUpdateParams', authority: ADMIN_MODULE_ADDRESS, params, }), From 6bb6dd30a21527c1d232d0152383fdcb5580e933 Mon Sep 17 00:00:00 2001 From: swelf Date: Wed, 13 Nov 2024 00:25:56 +0300 Subject: [PATCH 3/5] fixed cron proposal --- src/dao.ts | 7 ++++++- src/proposal.ts | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/dao.ts b/src/dao.ts index f0a4ae3..b8dcce5 100644 --- a/src/dao.ts +++ b/src/dao.ts @@ -1752,7 +1752,12 @@ export class DaoMember { const message = chainManagerWrapper( chainManagerAddress, bindings - ? addScheduleBindings(info.name, info.period, info.msgs) + ? addScheduleBindings( + info.name, + info.period, + info.msgs, + info.execution_stage, + ) : addCronScheduleProposal(info), ); return await this.submitSingleChoiceProposal( diff --git a/src/proposal.ts b/src/proposal.ts index de0ef09..6b35df1 100644 --- a/src/proposal.ts +++ b/src/proposal.ts @@ -739,12 +739,14 @@ export const addScheduleBindings = ( name: string, period: number, msgs: MsgExecuteContract[], + executionStage: string, ): any => ({ custom: { add_schedule: { name, period, msgs, + execution_stage: executionStage, }, }, }); From d272b96c6831f09b165689fcb965b1881e65f01d Mon Sep 17 00:00:00 2001 From: swelf Date: Mon, 25 Nov 2024 21:39:31 +0300 Subject: [PATCH 4/5] removed ConsumerParams type in favor of generated neutronjs/ConsumerParams --- package.json | 2 +- src/dao.ts | 3 +- src/proposal.ts | 81 +++++++++++++++++++++++++------------------------ yarn.lock | 4 +-- 4 files changed, 46 insertions(+), 44 deletions(-) diff --git a/package.json b/package.json index 983c949..bcaa52f 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ "@cosmjs/cosmwasm-stargate": "^0.32.4", "@cosmjs/proto-signing": "^0.32.4", "@cosmjs/stargate": "0.32.4", - "@neutron-org/neutronjs": "https://github.com/neutron-org/neutronjs.git#7f45328320b53b4fa2b572bc25bb96bf80260181", + "@neutron-org/neutronjs": "https://github.com/neutron-org/neutronjs.git#95a719604fecba39de5540b6ac99ded3e7aacfaa", "axios": "1.6.0", "bip39": "^3.1.0", "long": "^5.2.1", diff --git a/src/dao.ts b/src/dao.ts index b8dcce5..4b31f8d 100644 --- a/src/dao.ts +++ b/src/dao.ts @@ -36,7 +36,6 @@ import { updateAdminProposal, updateConsensusParamsProposal, upgradeProposal, - ConsumerParams, } from './proposal'; import { Contract, @@ -64,6 +63,8 @@ import { VotingVaultsModule, } from './dao_types'; +import { ConsumerParams } from '@neutron-org/neutronjs/interchain_security/ccv/v1/shared_consumer'; + export const getVotingModule = async ( client: CosmWasmClient, daoAddress: string, diff --git a/src/proposal.ts b/src/proposal.ts index 6b35df1..ccd6b26 100644 --- a/src/proposal.ts +++ b/src/proposal.ts @@ -1,6 +1,7 @@ import { Coin } from '@cosmjs/proto-signing'; import { ADMIN_MODULE_ADDRESS } from './constants'; import { MsgExecuteContract } from '@neutron-org/neutronjs/neutron/cron/schedule'; +import { ConsumerParams } from '@neutron-org/neutronjs/interchain_security/ccv/v1/shared_consumer'; export type ParamChangeProposalInfo = { title: string; @@ -220,46 +221,46 @@ export type ConsensusParams = { }; }; -export type ConsumerParams = { - enabled: boolean; - /// ///////////////////// - /// Distribution Params - /// Number of blocks between ibc-token-transfers from the consumer chain to - /// the provider chain. Note that at this transmission event a fraction of - /// the accumulated tokens are divided and sent consumer redistribution - /// address. - blocks_per_distribution_transmission: number; - /// Channel, and provider-chain receiving address to send distribution token - /// transfers over. These parameters is auto-set during the consumer <-> - /// provider handshake procedure. - distribution_transmission_channel: string; - provider_fee_pool_addr_str: string; - /// Sent CCV related IBC packets will timeout after this duration - ccv_timeout_period: string; // Duration - /// Sent transfer related IBC packets will timeout after this duration - transfer_timeout_period: string; // Duration - /// The fraction of tokens allocated to the consumer redistribution address - /// during distribution events. The fraction is a string representing a - /// decimal number. For example "0.75" would represent 75%. - consumer_redistribution_fraction: string; - /// The number of historical info entries to persist in store. - /// This param is a part of the cosmos sdk staking module. In the case of - /// a ccv enabled consumer chain, the ccv module acts as the staking module. - historical_entries: number; - /// Unbonding period for the consumer, - /// which should be smaller than that of the provider in general. - unbonding_period: string; // Duration - /// !!! DEPRECATED !!! soft_opt_out_threshold is deprecated. see docs/docs/adrs/adr-015-partial-set-security.md - soft_opt_out_threshold: string; - /// Reward denoms. These are the denominations which are allowed to be sent to - /// the provider as rewards. - reward_denoms: Array; - /// Provider-originated reward denoms. These are denoms coming from the - /// provider which are allowed to be used as rewards. e.g. "uatom" - provider_reward_denoms: Array; - /// The period after which a consumer can retry sending a throttled packet. - retry_delay_period: string; // Duration -}; +// export type ConsumerParams = { +// enabled: boolean; +// /// ///////////////////// +// /// Distribution Params +// /// Number of blocks between ibc-token-transfers from the consumer chain to +// /// the provider chain. Note that at this transmission event a fraction of +// /// the accumulated tokens are divided and sent consumer redistribution +// /// address. +// blocks_per_distribution_transmission: number; +// /// Channel, and provider-chain receiving address to send distribution token +// /// transfers over. These parameters is auto-set during the consumer <-> +// /// provider handshake procedure. +// distribution_transmission_channel: string; +// provider_fee_pool_addr_str: string; +// /// Sent CCV related IBC packets will timeout after this duration +// ccv_timeout_period: string; // Duration +// /// Sent transfer related IBC packets will timeout after this duration +// transfer_timeout_period: string; // Duration +// /// The fraction of tokens allocated to the consumer redistribution address +// /// during distribution events. The fraction is a string representing a +// /// decimal number. For example "0.75" would represent 75%. +// consumer_redistribution_fraction: string; +// /// The number of historical info entries to persist in store. +// /// This param is a part of the cosmos sdk staking module. In the case of +// /// a ccv enabled consumer chain, the ccv module acts as the staking module. +// historical_entries: number; +// /// Unbonding period for the consumer, +// /// which should be smaller than that of the provider in general. +// unbonding_period: string; // Duration +// /// !!! DEPRECATED !!! soft_opt_out_threshold is deprecated. see docs/docs/adrs/adr-015-partial-set-security.md +// soft_opt_out_threshold: string; +// /// Reward denoms. These are the denominations which are allowed to be sent to +// /// the provider as rewards. +// reward_denoms: Array; +// /// Provider-originated reward denoms. These are denoms coming from the +// /// provider which are allowed to be used as rewards. e.g. "uatom" +// provider_reward_denoms: Array; +// /// The period after which a consumer can retry sending a throttled packet. +// retry_delay_period: string; // Duration +// }; export type DecCoin = { denom: string; diff --git a/yarn.lock b/yarn.lock index 144c6b7..768f9e6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1184,9 +1184,9 @@ "@jridgewell/resolve-uri" "^3.1.0" "@jridgewell/sourcemap-codec" "^1.4.14" -"@neutron-org/neutronjs@https://github.com/neutron-org/neutronjs.git#7f45328320b53b4fa2b572bc25bb96bf80260181": +"@neutron-org/neutronjs@https://github.com/neutron-org/neutronjs.git#95a719604fecba39de5540b6ac99ded3e7aacfaa": version "4.2.0" - resolved "https://github.com/neutron-org/neutronjs.git#7f45328320b53b4fa2b572bc25bb96bf80260181" + resolved "https://github.com/neutron-org/neutronjs.git#95a719604fecba39de5540b6ac99ded3e7aacfaa" "@noble/curves@1.4.2", "@noble/curves@~1.4.0": version "1.4.2" From 14dc348bea4955821565ae030bbce81b0557717f Mon Sep 17 00:00:00 2001 From: swelf Date: Tue, 26 Nov 2024 11:14:20 +0300 Subject: [PATCH 5/5] removed commented code --- src/proposal.ts | 41 ----------------------------------------- 1 file changed, 41 deletions(-) diff --git a/src/proposal.ts b/src/proposal.ts index ccd6b26..25ffaa6 100644 --- a/src/proposal.ts +++ b/src/proposal.ts @@ -221,47 +221,6 @@ export type ConsensusParams = { }; }; -// export type ConsumerParams = { -// enabled: boolean; -// /// ///////////////////// -// /// Distribution Params -// /// Number of blocks between ibc-token-transfers from the consumer chain to -// /// the provider chain. Note that at this transmission event a fraction of -// /// the accumulated tokens are divided and sent consumer redistribution -// /// address. -// blocks_per_distribution_transmission: number; -// /// Channel, and provider-chain receiving address to send distribution token -// /// transfers over. These parameters is auto-set during the consumer <-> -// /// provider handshake procedure. -// distribution_transmission_channel: string; -// provider_fee_pool_addr_str: string; -// /// Sent CCV related IBC packets will timeout after this duration -// ccv_timeout_period: string; // Duration -// /// Sent transfer related IBC packets will timeout after this duration -// transfer_timeout_period: string; // Duration -// /// The fraction of tokens allocated to the consumer redistribution address -// /// during distribution events. The fraction is a string representing a -// /// decimal number. For example "0.75" would represent 75%. -// consumer_redistribution_fraction: string; -// /// The number of historical info entries to persist in store. -// /// This param is a part of the cosmos sdk staking module. In the case of -// /// a ccv enabled consumer chain, the ccv module acts as the staking module. -// historical_entries: number; -// /// Unbonding period for the consumer, -// /// which should be smaller than that of the provider in general. -// unbonding_period: string; // Duration -// /// !!! DEPRECATED !!! soft_opt_out_threshold is deprecated. see docs/docs/adrs/adr-015-partial-set-security.md -// soft_opt_out_threshold: string; -// /// Reward denoms. These are the denominations which are allowed to be sent to -// /// the provider as rewards. -// reward_denoms: Array; -// /// Provider-originated reward denoms. These are denoms coming from the -// /// provider which are allowed to be used as rewards. e.g. "uatom" -// provider_reward_denoms: Array; -// /// The period after which a consumer can retry sending a throttled packet. -// retry_delay_period: string; // Duration -// }; - export type DecCoin = { denom: string; amount: string;