From 2e975adca9f40155b209b4a7938a92eb6a8334c6 Mon Sep 17 00:00:00 2001 From: YourUsername Date: Sat, 10 Aug 2024 10:34:12 +0000 Subject: [PATCH 1/2] feat: updating subnet parameter extrinsics --- pallets/governance/src/lib.rs | 21 +++++++++++++-------- pallets/subspace/src/lib.rs | 4 ++-- tests/src/governance.rs | 8 +++++++- tests/src/subspace/subnet.rs | 4 ++-- 4 files changed, 24 insertions(+), 13 deletions(-) diff --git a/pallets/governance/src/lib.rs b/pallets/governance/src/lib.rs index 3320f3e3f..f905f99b2 100644 --- a/pallets/governance/src/lib.rs +++ b/pallets/governance/src/lib.rs @@ -219,11 +219,12 @@ pub mod pallet { #[pallet::weight((::WeightInfo::add_subnet_params_proposal(), DispatchClass::Normal, Pays::No))] pub fn add_subnet_params_proposal( origin: OriginFor, - subnet_id: u16, + netuid: u16, data: Vec, founder: T::AccountId, - name: BoundedVec>, founder_share: u16, + name: BoundedVec>, + metadata: Option>>, immunity_period: u16, incentive_ratio: u16, max_allowed_uids: u16, @@ -235,16 +236,19 @@ pub mod pallet { maximum_set_weight_calls_per_epoch: u16, vote_mode: VoteMode, bonds_ma: u64, + min_burn: u64, + max_burn: u64, target_registrations_interval: u16, target_registrations_per_interval: u16, max_registrations_per_interval: u16, adjustment_alpha: u64, min_validator_stake: u64, ) -> DispatchResult { - let mut params = pallet_subspace::Pallet::subnet_params(subnet_id); + let mut params = pallet_subspace::Pallet::subnet_params(netuid); params.founder = founder; - params.name = name; params.founder_share = founder_share; + params.name = name; + params.metadata = metadata; params.immunity_period = immunity_period; params.incentive_ratio = incentive_ratio; params.max_allowed_uids = max_allowed_uids; @@ -256,13 +260,14 @@ pub mod pallet { params.maximum_set_weight_calls_per_epoch = maximum_set_weight_calls_per_epoch; params.governance_config.vote_mode = vote_mode; params.bonds_ma = bonds_ma; + params.min_burn = min_burn; + params.max_burn = max_burn; params.target_registrations_interval = target_registrations_interval; params.target_registrations_per_interval = target_registrations_per_interval; params.max_registrations_per_interval = max_registrations_per_interval; params.adjustment_alpha = adjustment_alpha; params.min_validator_stake = min_validator_stake; - - Self::do_add_subnet_params_proposal(origin, subnet_id, data, params) + Self::do_add_subnet_params_proposal(origin, netuid, data, params) } #[pallet::call_index(2)] @@ -275,10 +280,10 @@ pub mod pallet { #[pallet::weight((::WeightInfo::add_subnet_custom_proposal(), DispatchClass::Normal, Pays::No))] pub fn add_subnet_custom_proposal( origin: OriginFor, - subnet_id: u16, + netuid: u16, data: Vec, ) -> DispatchResult { - Self::do_add_subnet_custom_proposal(origin, subnet_id, data) + Self::do_add_subnet_custom_proposal(origin, netuid, data) } #[pallet::call_index(4)] diff --git a/pallets/subspace/src/lib.rs b/pallets/subspace/src/lib.rs index 76211ee4e..d881904bd 100644 --- a/pallets/subspace/src/lib.rs +++ b/pallets/subspace/src/lib.rs @@ -996,14 +996,14 @@ pub mod pallet { netuid: u16, founder: T::AccountId, founder_share: u16, + name: BoundedVec>, + metadata: Option>>, immunity_period: u16, incentive_ratio: u16, max_allowed_uids: u16, max_allowed_weights: u16, min_allowed_weights: u16, max_weight_age: u64, - name: BoundedVec>, - metadata: Option>>, tempo: u16, trust_ratio: u16, maximum_set_weight_calls_per_epoch: u16, diff --git a/tests/src/governance.rs b/tests/src/governance.rs index 8d48df961..5d62e1d43 100644 --- a/tests/src/governance.rs +++ b/tests/src/governance.rs @@ -320,10 +320,13 @@ fn subnet_params_proposal_accepted() { min_allowed_weights, max_weight_age, name, + metadata, tempo, trust_ratio, maximum_set_weight_calls_per_epoch, bonds_ma, + min_burn, + max_burn, target_registrations_interval, target_registrations_per_interval, max_registrations_per_interval, @@ -340,8 +343,9 @@ fn subnet_params_proposal_accepted() { 0, vec![b'0'; 64], founder, - name, founder_share, + name, + metadata, immunity_period, incentive_ratio, max_allowed_uids, @@ -353,6 +357,8 @@ fn subnet_params_proposal_accepted() { maximum_set_weight_calls_per_epoch, governance_config.vote_mode, bonds_ma, + min_burn, + max_burn, target_registrations_interval, target_registrations_per_interval, max_registrations_per_interval, diff --git a/tests/src/subspace/subnet.rs b/tests/src/subspace/subnet.rs index e10b433a0..d3b1c183a 100644 --- a/tests/src/subspace/subnet.rs +++ b/tests/src/subspace/subnet.rs @@ -237,14 +237,14 @@ fn update_subnet_verifies_names_uniquiness_integrity() { netuid, params.founder, params.founder_share, + params.name, + params.metadata, params.immunity_period, params.incentive_ratio, params.max_allowed_uids, params.max_allowed_weights, params.min_allowed_weights, params.max_weight_age, - params.name, - params.metadata, params.tempo, params.trust_ratio, params.maximum_set_weight_calls_per_epoch, From 281a02405b6fc13a4276e3d470e62826c08d0315 Mon Sep 17 00:00:00 2001 From: YourUsername Date: Sat, 10 Aug 2024 13:57:10 +0000 Subject: [PATCH 2/2] update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 11450b1b5..7a6be0380 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ Storages: - `TargetRegistrationsPerInterval` storage map removed: Integrated into ModuleBurnConfig. - `AdjustmentAlpha` storage map removed: Integrated into ModuleBurnConfig. - `MaxRegistrationsPerInterval` storage map removed: Integrated into ModuleBurnConfig. +- `DelegationFee` storage map is now bounded to a key and is global (does not take the netuid parameter) Extrinsics: