From 93644925bebcf5091704cf23f1bd0008bb1b37a7 Mon Sep 17 00:00:00 2001 From: Keith Date: Fri, 2 Aug 2024 15:43:45 +0900 Subject: [PATCH 1/9] Replace SubtensorInterface with tight pallet coupling --- pallets/admin-utils/src/lib.rs | 302 +++++++++++++-------------------- runtime/src/lib.rs | 279 ------------------------------ 2 files changed, 114 insertions(+), 467 deletions(-) diff --git a/pallets/admin-utils/src/lib.rs b/pallets/admin-utils/src/lib.rs index 9a8744dc6..60209de7d 100644 --- a/pallets/admin-utils/src/lib.rs +++ b/pallets/admin-utils/src/lib.rs @@ -4,7 +4,6 @@ pub use pallet::*; pub mod weights; pub use weights::WeightInfo; -use sp_runtime::DispatchError; use sp_runtime::{traits::Member, RuntimeAppPublic}; mod benchmarking; @@ -26,7 +25,7 @@ pub mod pallet { /// Configure the pallet by specifying the parameters and types on which it depends. #[pallet::config] - pub trait Config: frame_system::Config { + pub trait Config: frame_system::Config + pallet_subtensor::pallet::Config { /// Because this pallet emits events, it depends on the runtime's definition of an event. type RuntimeEvent: From> + IsType<::RuntimeEvent>; @@ -48,13 +47,6 @@ pub mod pallet { /// Unit of assets type Balance: Balance; - - /// Implementation of the subtensor interface - type Subtensor: crate::SubtensorInterface< - Self::AccountId, - Self::Balance, - Self::RuntimeOrigin, - >; } #[pallet::event] @@ -100,7 +92,7 @@ pub mod pallet { #[pallet::weight(T::WeightInfo::sudo_set_default_take())] pub fn sudo_set_default_take(origin: OriginFor, default_take: u16) -> DispatchResult { ensure_root(origin)?; - T::Subtensor::set_max_delegate_take(default_take); + pallet_subtensor::Pallet::::set_max_delegate_take(default_take); log::info!("DefaultTakeSet( default_take: {:?} ) ", default_take); Ok(()) } @@ -112,7 +104,7 @@ pub mod pallet { #[pallet::weight((0, DispatchClass::Operational, Pays::No))] pub fn sudo_set_tx_rate_limit(origin: OriginFor, tx_rate_limit: u64) -> DispatchResult { ensure_root(origin)?; - T::Subtensor::set_tx_rate_limit(tx_rate_limit); + pallet_subtensor::Pallet::::set_tx_rate_limit(tx_rate_limit); log::info!("TxRateLimitSet( tx_rate_limit: {:?} ) ", tx_rate_limit); Ok(()) } @@ -127,9 +119,9 @@ pub mod pallet { netuid: u16, serving_rate_limit: u64, ) -> DispatchResult { - T::Subtensor::ensure_subnet_owner_or_root(origin, netuid)?; + pallet_subtensor::Pallet::::ensure_subnet_owner_or_root(origin, netuid)?; - T::Subtensor::set_serving_rate_limit(netuid, serving_rate_limit); + pallet_subtensor::Pallet::::set_serving_rate_limit(netuid, serving_rate_limit); log::info!( "ServingRateLimitSet( serving_rate_limit: {:?} ) ", serving_rate_limit @@ -147,13 +139,13 @@ pub mod pallet { netuid: u16, min_difficulty: u64, ) -> DispatchResult { - T::Subtensor::ensure_subnet_owner_or_root(origin, netuid)?; + pallet_subtensor::Pallet::::ensure_subnet_owner_or_root(origin, netuid)?; ensure!( - T::Subtensor::if_subnet_exist(netuid), + pallet_subtensor::Pallet::::if_subnet_exist(netuid), Error::::SubnetDoesNotExist ); - T::Subtensor::set_min_difficulty(netuid, min_difficulty); + pallet_subtensor::Pallet::::set_min_difficulty(netuid, min_difficulty); log::info!( "MinDifficultySet( netuid: {:?} min_difficulty: {:?} ) ", netuid, @@ -172,13 +164,13 @@ pub mod pallet { netuid: u16, max_difficulty: u64, ) -> DispatchResult { - T::Subtensor::ensure_subnet_owner_or_root(origin, netuid)?; + pallet_subtensor::Pallet::::ensure_subnet_owner_or_root(origin, netuid)?; ensure!( - T::Subtensor::if_subnet_exist(netuid), + pallet_subtensor::Pallet::::if_subnet_exist(netuid), Error::::SubnetDoesNotExist ); - T::Subtensor::set_max_difficulty(netuid, max_difficulty); + pallet_subtensor::Pallet::::set_max_difficulty(netuid, max_difficulty); log::info!( "MaxDifficultySet( netuid: {:?} max_difficulty: {:?} ) ", netuid, @@ -197,13 +189,13 @@ pub mod pallet { netuid: u16, weights_version_key: u64, ) -> DispatchResult { - T::Subtensor::ensure_subnet_owner_or_root(origin, netuid)?; + pallet_subtensor::Pallet::::ensure_subnet_owner_or_root(origin, netuid)?; ensure!( - T::Subtensor::if_subnet_exist(netuid), + pallet_subtensor::Pallet::::if_subnet_exist(netuid), Error::::SubnetDoesNotExist ); - T::Subtensor::set_weights_version_key(netuid, weights_version_key); + pallet_subtensor::Pallet::::set_weights_version_key(netuid, weights_version_key); log::info!( "WeightsVersionKeySet( netuid: {:?} weights_version_key: {:?} ) ", netuid, @@ -222,13 +214,16 @@ pub mod pallet { netuid: u16, weights_set_rate_limit: u64, ) -> DispatchResult { - T::Subtensor::ensure_subnet_owner_or_root(origin, netuid)?; + pallet_subtensor::Pallet::::ensure_subnet_owner_or_root(origin, netuid)?; ensure!( - T::Subtensor::if_subnet_exist(netuid), + pallet_subtensor::Pallet::::if_subnet_exist(netuid), Error::::SubnetDoesNotExist ); - T::Subtensor::set_weights_set_rate_limit(netuid, weights_set_rate_limit); + pallet_subtensor::Pallet::::set_weights_set_rate_limit( + netuid, + weights_set_rate_limit, + ); log::info!( "WeightsSetRateLimitSet( netuid: {:?} weights_set_rate_limit: {:?} ) ", netuid, @@ -250,10 +245,10 @@ pub mod pallet { ensure_root(origin)?; ensure!( - T::Subtensor::if_subnet_exist(netuid), + pallet_subtensor::Pallet::::if_subnet_exist(netuid), Error::::SubnetDoesNotExist ); - T::Subtensor::set_adjustment_interval(netuid, adjustment_interval); + pallet_subtensor::Pallet::::set_adjustment_interval(netuid, adjustment_interval); log::info!( "AdjustmentIntervalSet( netuid: {:?} adjustment_interval: {:?} ) ", netuid, @@ -278,13 +273,13 @@ pub mod pallet { netuid: u16, adjustment_alpha: u64, ) -> DispatchResult { - T::Subtensor::ensure_subnet_owner_or_root(origin, netuid)?; + pallet_subtensor::Pallet::::ensure_subnet_owner_or_root(origin, netuid)?; ensure!( - T::Subtensor::if_subnet_exist(netuid), + pallet_subtensor::Pallet::::if_subnet_exist(netuid), Error::::SubnetDoesNotExist ); - T::Subtensor::set_adjustment_alpha(netuid, adjustment_alpha); + pallet_subtensor::Pallet::::set_adjustment_alpha(netuid, adjustment_alpha); log::info!( "AdjustmentAlphaSet( adjustment_alpha: {:?} ) ", adjustment_alpha @@ -302,13 +297,13 @@ pub mod pallet { netuid: u16, max_weight_limit: u16, ) -> DispatchResult { - T::Subtensor::ensure_subnet_owner_or_root(origin, netuid)?; + pallet_subtensor::Pallet::::ensure_subnet_owner_or_root(origin, netuid)?; ensure!( - T::Subtensor::if_subnet_exist(netuid), + pallet_subtensor::Pallet::::if_subnet_exist(netuid), Error::::SubnetDoesNotExist ); - T::Subtensor::set_max_weight_limit(netuid, max_weight_limit); + pallet_subtensor::Pallet::::set_max_weight_limit(netuid, max_weight_limit); log::info!( "MaxWeightLimitSet( netuid: {:?} max_weight_limit: {:?} ) ", netuid, @@ -327,13 +322,13 @@ pub mod pallet { netuid: u16, immunity_period: u16, ) -> DispatchResult { - T::Subtensor::ensure_subnet_owner_or_root(origin, netuid)?; + pallet_subtensor::Pallet::::ensure_subnet_owner_or_root(origin, netuid)?; ensure!( - T::Subtensor::if_subnet_exist(netuid), + pallet_subtensor::Pallet::::if_subnet_exist(netuid), Error::::SubnetDoesNotExist ); - T::Subtensor::set_immunity_period(netuid, immunity_period); + pallet_subtensor::Pallet::::set_immunity_period(netuid, immunity_period); log::info!( "ImmunityPeriodSet( netuid: {:?} immunity_period: {:?} ) ", netuid, @@ -352,13 +347,13 @@ pub mod pallet { netuid: u16, min_allowed_weights: u16, ) -> DispatchResult { - T::Subtensor::ensure_subnet_owner_or_root(origin, netuid)?; + pallet_subtensor::Pallet::::ensure_subnet_owner_or_root(origin, netuid)?; ensure!( - T::Subtensor::if_subnet_exist(netuid), + pallet_subtensor::Pallet::::if_subnet_exist(netuid), Error::::SubnetDoesNotExist ); - T::Subtensor::set_min_allowed_weights(netuid, min_allowed_weights); + pallet_subtensor::Pallet::::set_min_allowed_weights(netuid, min_allowed_weights); log::info!( "MinAllowedWeightSet( netuid: {:?} min_allowed_weights: {:?} ) ", netuid, @@ -379,14 +374,14 @@ pub mod pallet { ) -> DispatchResult { ensure_root(origin)?; ensure!( - T::Subtensor::if_subnet_exist(netuid), + pallet_subtensor::Pallet::::if_subnet_exist(netuid), Error::::SubnetDoesNotExist ); ensure!( - T::Subtensor::get_subnetwork_n(netuid) < max_allowed_uids, + pallet_subtensor::Pallet::::get_subnetwork_n(netuid) < max_allowed_uids, Error::::MaxAllowedUIdsLessThanCurrentUIds ); - T::Subtensor::set_max_allowed_uids(netuid, max_allowed_uids); + pallet_subtensor::Pallet::::set_max_allowed_uids(netuid, max_allowed_uids); log::info!( "MaxAllowedUidsSet( netuid: {:?} max_allowed_uids: {:?} ) ", netuid, @@ -401,13 +396,13 @@ pub mod pallet { #[pallet::call_index(16)] #[pallet::weight(T::WeightInfo::sudo_set_kappa())] pub fn sudo_set_kappa(origin: OriginFor, netuid: u16, kappa: u16) -> DispatchResult { - T::Subtensor::ensure_subnet_owner_or_root(origin, netuid)?; + pallet_subtensor::Pallet::::ensure_subnet_owner_or_root(origin, netuid)?; ensure!( - T::Subtensor::if_subnet_exist(netuid), + pallet_subtensor::Pallet::::if_subnet_exist(netuid), Error::::SubnetDoesNotExist ); - T::Subtensor::set_kappa(netuid, kappa); + pallet_subtensor::Pallet::::set_kappa(netuid, kappa); log::info!("KappaSet( netuid: {:?} kappa: {:?} ) ", netuid, kappa); Ok(()) } @@ -418,13 +413,13 @@ pub mod pallet { #[pallet::call_index(17)] #[pallet::weight(T::WeightInfo::sudo_set_rho())] pub fn sudo_set_rho(origin: OriginFor, netuid: u16, rho: u16) -> DispatchResult { - T::Subtensor::ensure_subnet_owner_or_root(origin, netuid)?; + pallet_subtensor::Pallet::::ensure_subnet_owner_or_root(origin, netuid)?; ensure!( - T::Subtensor::if_subnet_exist(netuid), + pallet_subtensor::Pallet::::if_subnet_exist(netuid), Error::::SubnetDoesNotExist ); - T::Subtensor::set_rho(netuid, rho); + pallet_subtensor::Pallet::::set_rho(netuid, rho); log::info!("RhoSet( netuid: {:?} rho: {:?} ) ", netuid, rho); Ok(()) } @@ -439,13 +434,13 @@ pub mod pallet { netuid: u16, activity_cutoff: u16, ) -> DispatchResult { - T::Subtensor::ensure_subnet_owner_or_root(origin, netuid)?; + pallet_subtensor::Pallet::::ensure_subnet_owner_or_root(origin, netuid)?; ensure!( - T::Subtensor::if_subnet_exist(netuid), + pallet_subtensor::Pallet::::if_subnet_exist(netuid), Error::::SubnetDoesNotExist ); - T::Subtensor::set_activity_cutoff(netuid, activity_cutoff); + pallet_subtensor::Pallet::::set_activity_cutoff(netuid, activity_cutoff); log::info!( "ActivityCutoffSet( netuid: {:?} activity_cutoff: {:?} ) ", netuid, @@ -470,9 +465,12 @@ pub mod pallet { netuid: u16, registration_allowed: bool, ) -> DispatchResult { - T::Subtensor::ensure_subnet_owner_or_root(origin, netuid)?; + pallet_subtensor::Pallet::::ensure_subnet_owner_or_root(origin, netuid)?; - T::Subtensor::set_network_registration_allowed(netuid, registration_allowed); + pallet_subtensor::Pallet::::set_network_registration_allowed( + netuid, + registration_allowed, + ); log::info!( "NetworkRegistrationAllowed( registration_allowed: {:?} ) ", registration_allowed @@ -495,9 +493,12 @@ pub mod pallet { netuid: u16, registration_allowed: bool, ) -> DispatchResult { - T::Subtensor::ensure_subnet_owner_or_root(origin, netuid)?; + pallet_subtensor::Pallet::::ensure_subnet_owner_or_root(origin, netuid)?; - T::Subtensor::set_network_pow_registration_allowed(netuid, registration_allowed); + pallet_subtensor::Pallet::::set_network_pow_registration_allowed( + netuid, + registration_allowed, + ); log::info!( "NetworkPowRegistrationAllowed( registration_allowed: {:?} ) ", registration_allowed @@ -518,10 +519,10 @@ pub mod pallet { ensure_root(origin)?; ensure!( - T::Subtensor::if_subnet_exist(netuid), + pallet_subtensor::Pallet::::if_subnet_exist(netuid), Error::::SubnetDoesNotExist ); - T::Subtensor::set_target_registrations_per_interval( + pallet_subtensor::Pallet::::set_target_registrations_per_interval( netuid, target_registrations_per_interval, ); @@ -543,13 +544,13 @@ pub mod pallet { netuid: u16, min_burn: u64, ) -> DispatchResult { - T::Subtensor::ensure_subnet_owner_or_root(origin, netuid)?; + pallet_subtensor::Pallet::::ensure_subnet_owner_or_root(origin, netuid)?; ensure!( - T::Subtensor::if_subnet_exist(netuid), + pallet_subtensor::Pallet::::if_subnet_exist(netuid), Error::::SubnetDoesNotExist ); - T::Subtensor::set_min_burn(netuid, min_burn); + pallet_subtensor::Pallet::::set_min_burn(netuid, min_burn); log::info!( "MinBurnSet( netuid: {:?} min_burn: {:?} ) ", netuid, @@ -568,13 +569,13 @@ pub mod pallet { netuid: u16, max_burn: u64, ) -> DispatchResult { - T::Subtensor::ensure_subnet_owner_or_root(origin, netuid)?; + pallet_subtensor::Pallet::::ensure_subnet_owner_or_root(origin, netuid)?; ensure!( - T::Subtensor::if_subnet_exist(netuid), + pallet_subtensor::Pallet::::if_subnet_exist(netuid), Error::::SubnetDoesNotExist ); - T::Subtensor::set_max_burn(netuid, max_burn); + pallet_subtensor::Pallet::::set_max_burn(netuid, max_burn); log::info!( "MaxBurnSet( netuid: {:?} max_burn: {:?} ) ", netuid, @@ -593,12 +594,12 @@ pub mod pallet { netuid: u16, difficulty: u64, ) -> DispatchResult { - T::Subtensor::ensure_subnet_owner_or_root(origin, netuid)?; + pallet_subtensor::Pallet::::ensure_subnet_owner_or_root(origin, netuid)?; ensure!( - T::Subtensor::if_subnet_exist(netuid), + pallet_subtensor::Pallet::::if_subnet_exist(netuid), Error::::SubnetDoesNotExist ); - T::Subtensor::set_difficulty(netuid, difficulty); + pallet_subtensor::Pallet::::set_difficulty(netuid, difficulty); log::info!( "DifficultySet( netuid: {:?} difficulty: {:?} ) ", netuid, @@ -619,15 +620,19 @@ pub mod pallet { ) -> DispatchResult { ensure_root(origin)?; ensure!( - T::Subtensor::if_subnet_exist(netuid), + pallet_subtensor::Pallet::::if_subnet_exist(netuid), Error::::SubnetDoesNotExist ); ensure!( - max_allowed_validators <= T::Subtensor::get_max_allowed_uids(netuid), + max_allowed_validators + <= pallet_subtensor::Pallet::::get_max_allowed_uids(netuid), Error::::MaxValidatorsLargerThanMaxUIds ); - T::Subtensor::set_max_allowed_validators(netuid, max_allowed_validators); + pallet_subtensor::Pallet::::set_max_allowed_validators( + netuid, + max_allowed_validators, + ); log::info!( "MaxAllowedValidatorsSet( netuid: {:?} max_allowed_validators: {:?} ) ", netuid, @@ -646,13 +651,13 @@ pub mod pallet { netuid: u16, bonds_moving_average: u64, ) -> DispatchResult { - T::Subtensor::ensure_subnet_owner_or_root(origin, netuid)?; + pallet_subtensor::Pallet::::ensure_subnet_owner_or_root(origin, netuid)?; ensure!( - T::Subtensor::if_subnet_exist(netuid), + pallet_subtensor::Pallet::::if_subnet_exist(netuid), Error::::SubnetDoesNotExist ); - T::Subtensor::set_bonds_moving_average(netuid, bonds_moving_average); + pallet_subtensor::Pallet::::set_bonds_moving_average(netuid, bonds_moving_average); log::info!( "BondsMovingAverageSet( netuid: {:?} bonds_moving_average: {:?} ) ", netuid, @@ -674,10 +679,13 @@ pub mod pallet { ensure_root(origin)?; ensure!( - T::Subtensor::if_subnet_exist(netuid), + pallet_subtensor::Pallet::::if_subnet_exist(netuid), Error::::SubnetDoesNotExist ); - T::Subtensor::set_max_registrations_per_block(netuid, max_registrations_per_block); + pallet_subtensor::Pallet::::set_max_registrations_per_block( + netuid, + max_registrations_per_block, + ); log::info!( "MaxRegistrationsPerBlock( netuid: {:?} max_registrations_per_block: {:?} ) ", netuid, @@ -701,7 +709,7 @@ pub mod pallet { subnet_owner_cut: u16, ) -> DispatchResult { ensure_root(origin)?; - T::Subtensor::set_subnet_owner_cut(subnet_owner_cut); + pallet_subtensor::Pallet::::set_subnet_owner_cut(subnet_owner_cut); log::info!( "SubnetOwnerCut( subnet_owner_cut: {:?} ) ", subnet_owner_cut @@ -724,7 +732,7 @@ pub mod pallet { rate_limit: u64, ) -> DispatchResult { ensure_root(origin)?; - T::Subtensor::set_network_rate_limit(rate_limit); + pallet_subtensor::Pallet::::set_network_rate_limit(rate_limit); log::info!("NetworkRateLimit( rate_limit: {:?} ) ", rate_limit); Ok(()) } @@ -737,10 +745,10 @@ pub mod pallet { pub fn sudo_set_tempo(origin: OriginFor, netuid: u16, tempo: u16) -> DispatchResult { ensure_root(origin)?; ensure!( - T::Subtensor::if_subnet_exist(netuid), + pallet_subtensor::Pallet::::if_subnet_exist(netuid), Error::::SubnetDoesNotExist ); - T::Subtensor::set_tempo(netuid, tempo); + pallet_subtensor::Pallet::::set_tempo(netuid, tempo); log::info!("TempoSet( netuid: {:?} tempo: {:?} ) ", netuid, tempo); Ok(()) } @@ -756,7 +764,7 @@ pub mod pallet { ) -> DispatchResult { ensure_root(origin)?; - T::Subtensor::set_total_issuance(total_issuance); + pallet_subtensor::Pallet::::set_total_issuance(total_issuance); Ok(()) } @@ -777,7 +785,7 @@ pub mod pallet { ) -> DispatchResult { ensure_root(origin)?; - T::Subtensor::set_network_immunity_period(immunity_period); + pallet_subtensor::Pallet::::set_network_immunity_period(immunity_period); log::info!("NetworkImmunityPeriod( period: {:?} ) ", immunity_period); @@ -800,7 +808,7 @@ pub mod pallet { ) -> DispatchResult { ensure_root(origin)?; - T::Subtensor::set_network_min_lock(lock_cost); + pallet_subtensor::Pallet::::set_network_min_lock(lock_cost); log::info!("NetworkMinLockCost( lock_cost: {:?} ) ", lock_cost); @@ -819,7 +827,7 @@ pub mod pallet { ))] pub fn sudo_set_subnet_limit(origin: OriginFor, max_subnets: u16) -> DispatchResult { ensure_root(origin)?; - T::Subtensor::set_subnet_limit(max_subnets); + pallet_subtensor::Pallet::::set_max_subnets(max_subnets); log::info!("SubnetLimit( max_subnets: {:?} ) ", max_subnets); @@ -842,7 +850,7 @@ pub mod pallet { ) -> DispatchResult { ensure_root(origin)?; - T::Subtensor::set_lock_reduction_interval(interval); + pallet_subtensor::Pallet::::set_lock_reduction_interval(interval); log::info!("NetworkLockReductionInterval( interval: {:?} ) ", interval); @@ -861,10 +869,10 @@ pub mod pallet { ) -> DispatchResult { ensure_root(origin)?; ensure!( - T::Subtensor::if_subnet_exist(netuid), + pallet_subtensor::Pallet::::if_subnet_exist(netuid), Error::::SubnetDoesNotExist ); - T::Subtensor::set_rao_recycled(netuid, rao_recycled); + pallet_subtensor::Pallet::::set_rao_recycled(netuid, rao_recycled); Ok(()) } @@ -875,7 +883,7 @@ pub mod pallet { #[pallet::weight((0, DispatchClass::Operational, Pays::No))] pub fn sudo_set_weights_min_stake(origin: OriginFor, min_stake: u64) -> DispatchResult { ensure_root(origin)?; - T::Subtensor::set_weights_min_stake(min_stake); + pallet_subtensor::Pallet::::set_weights_min_stake(min_stake); Ok(()) } @@ -890,12 +898,12 @@ pub mod pallet { min_stake: u64, ) -> DispatchResult { ensure_root(origin)?; - let prev_min_stake = T::Subtensor::get_nominator_min_required_stake(); + let prev_min_stake = pallet_subtensor::Pallet::::get_nominator_min_required_stake(); log::trace!("Setting minimum stake to: {}", min_stake); - T::Subtensor::set_nominator_min_required_stake(min_stake); + pallet_subtensor::Pallet::::set_nominator_min_required_stake(min_stake); if min_stake > prev_min_stake { log::trace!("Clearing small nominations"); - T::Subtensor::clear_small_nominations(); + pallet_subtensor::Pallet::::clear_small_nominations(); log::trace!("Small nominations cleared"); } Ok(()) @@ -911,7 +919,7 @@ pub mod pallet { tx_rate_limit: u64, ) -> DispatchResult { ensure_root(origin)?; - T::Subtensor::set_tx_delegate_take_rate_limit(tx_rate_limit); + pallet_subtensor::Pallet::::set_tx_delegate_take_rate_limit(tx_rate_limit); log::info!( "TxRateLimitDelegateTakeSet( tx_delegate_take_rate_limit: {:?} ) ", tx_rate_limit @@ -926,7 +934,7 @@ pub mod pallet { #[pallet::weight((0, DispatchClass::Operational, Pays::No))] pub fn sudo_set_min_delegate_take(origin: OriginFor, take: u16) -> DispatchResult { ensure_root(origin)?; - T::Subtensor::set_min_delegate_take(take); + pallet_subtensor::Pallet::::set_min_delegate_take(take); log::info!("TxMinDelegateTakeSet( tx_min_delegate_take: {:?} ) ", take); Ok(()) } @@ -941,7 +949,9 @@ pub mod pallet { target_stakes_per_interval: u64, ) -> DispatchResult { ensure_root(origin)?; - T::Subtensor::set_target_stakes_per_interval(target_stakes_per_interval); + pallet_subtensor::Pallet::::set_target_stakes_per_interval( + target_stakes_per_interval, + ); log::info!( "TxTargetStakesPerIntervalSet( set_target_stakes_per_interval: {:?} ) ", target_stakes_per_interval @@ -959,14 +969,14 @@ pub mod pallet { netuid: u16, interval: u64, ) -> DispatchResult { - T::Subtensor::ensure_subnet_owner_or_root(origin, netuid)?; + pallet_subtensor::Pallet::::ensure_subnet_owner_or_root(origin, netuid)?; ensure!( - T::Subtensor::if_subnet_exist(netuid), + pallet_subtensor::Pallet::::if_subnet_exist(netuid), Error::::SubnetDoesNotExist ); - T::Subtensor::set_commit_reveal_weights_interval(netuid, interval); + pallet_subtensor::Pallet::::set_commit_reveal_weights_interval(netuid, interval); log::info!( "SetWeightCommitInterval( netuid: {:?}, interval: {:?} ) ", netuid, @@ -985,14 +995,14 @@ pub mod pallet { netuid: u16, enabled: bool, ) -> DispatchResult { - T::Subtensor::ensure_subnet_owner_or_root(origin, netuid)?; + pallet_subtensor::Pallet::::ensure_subnet_owner_or_root(origin, netuid)?; ensure!( - T::Subtensor::if_subnet_exist(netuid), + pallet_subtensor::Pallet::::if_subnet_exist(netuid), Error::::SubnetDoesNotExist ); - T::Subtensor::set_commit_reveal_weights_enabled(netuid, enabled); + pallet_subtensor::Pallet::::set_commit_reveal_weights_enabled(netuid, enabled); log::info!("ToggleSetWeightsCommitReveal( netuid: {:?} ) ", netuid); Ok(()) } @@ -1013,8 +1023,8 @@ pub mod pallet { netuid: u16, enabled: bool, ) -> DispatchResult { - T::Subtensor::ensure_subnet_owner_or_root(origin, netuid)?; - T::Subtensor::set_liquid_alpha_enabled(netuid, enabled); + pallet_subtensor::Pallet::::ensure_subnet_owner_or_root(origin, netuid)?; + pallet_subtensor::Pallet::::set_liquid_alpha_enabled(netuid, enabled); log::info!( "LiquidAlphaEnableToggled( netuid: {:?}, Enabled: {:?} ) ", netuid, @@ -1032,8 +1042,10 @@ pub mod pallet { alpha_low: u16, alpha_high: u16, ) -> DispatchResult { - T::Subtensor::ensure_subnet_owner_or_root(origin.clone(), netuid)?; - T::Subtensor::do_set_alpha_values(origin, netuid, alpha_low, alpha_high) + pallet_subtensor::Pallet::::ensure_subnet_owner_or_root(origin.clone(), netuid)?; + pallet_subtensor::Pallet::::do_set_alpha_values( + origin, netuid, alpha_low, alpha_high, + ) } } } @@ -1052,89 +1064,3 @@ pub trait AuraInterface { impl AuraInterface for () { fn change_authorities(_: BoundedVec) {} } - -/////////////////////////////////////////// - -pub trait SubtensorInterface { - fn set_min_delegate_take(take: u16); - fn set_max_delegate_take(take: u16); - fn set_tx_rate_limit(rate_limit: u64); - fn set_tx_delegate_take_rate_limit(rate_limit: u64); - - fn set_serving_rate_limit(netuid: u16, rate_limit: u64); - - fn set_max_burn(netuid: u16, max_burn: u64); - fn set_min_burn(netuid: u16, min_burn: u64); - fn set_burn(netuid: u16, burn: u64); - - fn set_max_difficulty(netuid: u16, max_diff: u64); - fn set_min_difficulty(netuid: u16, min_diff: u64); - fn set_difficulty(netuid: u16, diff: u64); - - fn set_weights_rate_limit(netuid: u16, rate_limit: u64); - - fn set_weights_version_key(netuid: u16, version: u64); - - fn set_bonds_moving_average(netuid: u16, moving_average: u64); - - fn set_max_allowed_validators(netuid: u16, max_validators: u16); - - fn get_root_netuid() -> u16; - fn if_subnet_exist(netuid: u16) -> bool; - fn create_account_if_non_existent(coldkey: &AccountId, hotkey: &AccountId); - fn coldkey_owns_hotkey(coldkey: &AccountId, hotkey: &AccountId) -> bool; - fn increase_stake_on_coldkey_hotkey_account( - coldkey: &AccountId, - hotkey: &AccountId, - increment: u64, - ); - fn add_balance_to_coldkey_account(coldkey: &AccountId, amount: Balance); - fn get_current_block_as_u64() -> u64; - fn get_subnetwork_n(netuid: u16) -> u16; - fn get_max_allowed_uids(netuid: u16) -> u16; - fn append_neuron(netuid: u16, new_hotkey: &AccountId, block_number: u64); - fn get_neuron_to_prune(netuid: u16) -> u16; - fn replace_neuron(netuid: u16, uid_to_replace: u16, new_hotkey: &AccountId, block_number: u64); - fn set_total_issuance(total_issuance: u64); - fn set_network_immunity_period(net_immunity_period: u64); - fn set_network_min_lock(net_min_lock: u64); - fn set_rao_recycled(netuid: u16, rao_recycled: u64); - fn set_subnet_limit(limit: u16); - fn is_hotkey_registered_on_network(netuid: u16, hotkey: &AccountId) -> bool; - fn set_lock_reduction_interval(interval: u64); - fn set_tempo(netuid: u16, tempo: u16); - fn set_subnet_owner_cut(subnet_owner_cut: u16); - fn set_network_rate_limit(limit: u64); - fn set_max_registrations_per_block(netuid: u16, max_registrations_per_block: u16); - fn set_adjustment_alpha(netuid: u16, adjustment_alpha: u64); - fn set_target_registrations_per_interval(netuid: u16, target_registrations_per_interval: u16); - fn set_network_pow_registration_allowed(netuid: u16, registration_allowed: bool); - fn set_network_registration_allowed(netuid: u16, registration_allowed: bool); - fn set_activity_cutoff(netuid: u16, activity_cutoff: u16); - fn ensure_subnet_owner_or_root(o: RuntimeOrigin, netuid: u16) -> Result<(), DispatchError>; - fn set_rho(netuid: u16, rho: u16); - fn set_kappa(netuid: u16, kappa: u16); - fn set_max_allowed_uids(netuid: u16, max_allowed: u16); - fn set_min_allowed_weights(netuid: u16, min_allowed_weights: u16); - fn set_immunity_period(netuid: u16, immunity_period: u16); - fn set_max_weight_limit(netuid: u16, max_weight_limit: u16); - fn set_scaling_law_power(netuid: u16, scaling_law_power: u16); - fn set_validator_prune_len(netuid: u16, validator_prune_len: u64); - fn set_adjustment_interval(netuid: u16, adjustment_interval: u16); - fn set_weights_set_rate_limit(netuid: u16, weights_set_rate_limit: u64); - fn init_new_network(netuid: u16, tempo: u16); - fn set_weights_min_stake(min_stake: u64); - fn get_nominator_min_required_stake() -> u64; - fn set_nominator_min_required_stake(min_stake: u64); - fn clear_small_nominations(); - fn set_target_stakes_per_interval(target_stakes_per_interval: u64); - fn set_commit_reveal_weights_interval(netuid: u16, interval: u64); - fn set_commit_reveal_weights_enabled(netuid: u16, enabled: bool); - fn set_liquid_alpha_enabled(netuid: u16, enabled: bool); - fn do_set_alpha_values( - origin: RuntimeOrigin, - netuid: u16, - alpha_low: u16, - alpha_high: u16, - ) -> Result<(), DispatchError>; -} diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index a4abd124f..d302652d4 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -948,291 +948,12 @@ impl pallet_admin_utils::AuraInterface> for AuraPalletIntrf } } -pub struct SubtensorInterface; - -impl - pallet_admin_utils::SubtensorInterface< - AccountId, - as frame_support::traits::Currency>::Balance, - RuntimeOrigin, - > for SubtensorInterface -{ - fn set_max_delegate_take(max_take: u16) { - SubtensorModule::set_max_delegate_take(max_take); - } - - fn set_min_delegate_take(max_take: u16) { - SubtensorModule::set_min_delegate_take(max_take); - } - - fn set_tx_rate_limit(rate_limit: u64) { - SubtensorModule::set_tx_rate_limit(rate_limit); - } - - fn set_tx_delegate_take_rate_limit(rate_limit: u64) { - SubtensorModule::set_tx_delegate_take_rate_limit(rate_limit); - } - - fn set_serving_rate_limit(netuid: u16, rate_limit: u64) { - SubtensorModule::set_serving_rate_limit(netuid, rate_limit); - } - - fn set_max_burn(netuid: u16, max_burn: u64) { - SubtensorModule::set_max_burn(netuid, max_burn); - } - - fn set_min_burn(netuid: u16, min_burn: u64) { - SubtensorModule::set_min_burn(netuid, min_burn); - } - - fn set_burn(netuid: u16, burn: u64) { - SubtensorModule::set_burn(netuid, burn); - } - - fn set_max_difficulty(netuid: u16, max_diff: u64) { - SubtensorModule::set_max_difficulty(netuid, max_diff); - } - - fn set_min_difficulty(netuid: u16, min_diff: u64) { - SubtensorModule::set_min_difficulty(netuid, min_diff); - } - - fn set_difficulty(netuid: u16, diff: u64) { - SubtensorModule::set_difficulty(netuid, diff); - } - - fn set_weights_rate_limit(netuid: u16, rate_limit: u64) { - SubtensorModule::set_weights_set_rate_limit(netuid, rate_limit); - } - - fn set_weights_version_key(netuid: u16, version: u64) { - SubtensorModule::set_weights_version_key(netuid, version); - } - - fn set_bonds_moving_average(netuid: u16, moving_average: u64) { - SubtensorModule::set_bonds_moving_average(netuid, moving_average); - } - - fn set_max_allowed_validators(netuid: u16, max_validators: u16) { - SubtensorModule::set_max_allowed_validators(netuid, max_validators); - } - - fn get_root_netuid() -> u16 { - SubtensorModule::get_root_netuid() - } - - fn if_subnet_exist(netuid: u16) -> bool { - SubtensorModule::if_subnet_exist(netuid) - } - - fn create_account_if_non_existent(coldkey: &AccountId, hotkey: &AccountId) { - SubtensorModule::create_account_if_non_existent(coldkey, hotkey) - } - - fn coldkey_owns_hotkey(coldkey: &AccountId, hotkey: &AccountId) -> bool { - SubtensorModule::coldkey_owns_hotkey(coldkey, hotkey) - } - - fn increase_stake_on_coldkey_hotkey_account( - coldkey: &AccountId, - hotkey: &AccountId, - increment: u64, - ) { - SubtensorModule::increase_stake_on_coldkey_hotkey_account(coldkey, hotkey, increment); - } - - fn add_balance_to_coldkey_account(coldkey: &AccountId, amount: Balance) { - SubtensorModule::add_balance_to_coldkey_account(coldkey, amount); - } - - fn get_current_block_as_u64() -> u64 { - SubtensorModule::get_current_block_as_u64() - } - - fn get_subnetwork_n(netuid: u16) -> u16 { - SubtensorModule::get_subnetwork_n(netuid) - } - - fn get_max_allowed_uids(netuid: u16) -> u16 { - SubtensorModule::get_max_allowed_uids(netuid) - } - - fn append_neuron(netuid: u16, new_hotkey: &AccountId, block_number: u64) { - SubtensorModule::append_neuron(netuid, new_hotkey, block_number) - } - - fn get_neuron_to_prune(netuid: u16) -> u16 { - SubtensorModule::get_neuron_to_prune(netuid) - } - - fn replace_neuron(netuid: u16, uid_to_replace: u16, new_hotkey: &AccountId, block_number: u64) { - SubtensorModule::replace_neuron(netuid, uid_to_replace, new_hotkey, block_number); - } - - fn set_total_issuance(total_issuance: u64) { - SubtensorModule::set_total_issuance(total_issuance); - } - - fn set_network_immunity_period(net_immunity_period: u64) { - SubtensorModule::set_network_immunity_period(net_immunity_period); - } - - fn set_network_min_lock(net_min_lock: u64) { - SubtensorModule::set_network_min_lock(net_min_lock); - } - - fn set_subnet_limit(limit: u16) { - SubtensorModule::set_max_subnets(limit); - } - - fn set_lock_reduction_interval(interval: u64) { - SubtensorModule::set_lock_reduction_interval(interval); - } - - fn set_tempo(netuid: u16, tempo: u16) { - SubtensorModule::set_tempo(netuid, tempo); - } - - fn set_subnet_owner_cut(subnet_owner_cut: u16) { - SubtensorModule::set_subnet_owner_cut(subnet_owner_cut); - } - - fn set_network_rate_limit(limit: u64) { - SubtensorModule::set_network_rate_limit(limit); - } - - fn set_max_registrations_per_block(netuid: u16, max_registrations_per_block: u16) { - SubtensorModule::set_max_registrations_per_block(netuid, max_registrations_per_block); - } - - fn set_adjustment_alpha(netuid: u16, adjustment_alpha: u64) { - SubtensorModule::set_adjustment_alpha(netuid, adjustment_alpha); - } - - fn set_target_registrations_per_interval(netuid: u16, target_registrations_per_interval: u16) { - SubtensorModule::set_target_registrations_per_interval( - netuid, - target_registrations_per_interval, - ); - } - - fn set_network_pow_registration_allowed(netuid: u16, registration_allowed: bool) { - SubtensorModule::set_network_pow_registration_allowed(netuid, registration_allowed); - } - - fn set_network_registration_allowed(netuid: u16, registration_allowed: bool) { - SubtensorModule::set_network_registration_allowed(netuid, registration_allowed); - } - - fn set_activity_cutoff(netuid: u16, activity_cutoff: u16) { - SubtensorModule::set_activity_cutoff(netuid, activity_cutoff); - } - - fn ensure_subnet_owner_or_root(o: RuntimeOrigin, netuid: u16) -> Result<(), DispatchError> { - SubtensorModule::ensure_subnet_owner_or_root(o, netuid) - } - - fn set_rho(netuid: u16, rho: u16) { - SubtensorModule::set_rho(netuid, rho); - } - - fn set_kappa(netuid: u16, kappa: u16) { - SubtensorModule::set_kappa(netuid, kappa); - } - - fn set_max_allowed_uids(netuid: u16, max_allowed: u16) { - SubtensorModule::set_max_allowed_uids(netuid, max_allowed); - } - - fn set_min_allowed_weights(netuid: u16, min_allowed_weights: u16) { - SubtensorModule::set_min_allowed_weights(netuid, min_allowed_weights); - } - - fn set_immunity_period(netuid: u16, immunity_period: u16) { - SubtensorModule::set_immunity_period(netuid, immunity_period); - } - - fn set_max_weight_limit(netuid: u16, max_weight_limit: u16) { - SubtensorModule::set_max_weight_limit(netuid, max_weight_limit); - } - - fn set_scaling_law_power(netuid: u16, scaling_law_power: u16) { - SubtensorModule::set_scaling_law_power(netuid, scaling_law_power); - } - - fn set_validator_prune_len(netuid: u16, validator_prune_len: u64) { - SubtensorModule::set_validator_prune_len(netuid, validator_prune_len); - } - - fn set_adjustment_interval(netuid: u16, adjustment_interval: u16) { - SubtensorModule::set_adjustment_interval(netuid, adjustment_interval); - } - - fn set_weights_set_rate_limit(netuid: u16, weights_set_rate_limit: u64) { - SubtensorModule::set_weights_set_rate_limit(netuid, weights_set_rate_limit); - } - - fn set_rao_recycled(netuid: u16, rao_recycled: u64) { - SubtensorModule::set_rao_recycled(netuid, rao_recycled); - } - - fn is_hotkey_registered_on_network(netuid: u16, hotkey: &AccountId) -> bool { - SubtensorModule::is_hotkey_registered_on_network(netuid, hotkey) - } - - fn init_new_network(netuid: u16, tempo: u16) { - SubtensorModule::init_new_network(netuid, tempo); - } - - fn set_weights_min_stake(min_stake: u64) { - SubtensorModule::set_weights_min_stake(min_stake); - } - - fn clear_small_nominations() { - SubtensorModule::clear_small_nominations(); - } - - fn set_nominator_min_required_stake(min_stake: u64) { - SubtensorModule::set_nominator_min_required_stake(min_stake); - } - - fn get_nominator_min_required_stake() -> u64 { - SubtensorModule::get_nominator_min_required_stake() - } - - fn set_target_stakes_per_interval(target_stakes_per_interval: u64) { - SubtensorModule::set_target_stakes_per_interval(target_stakes_per_interval) - } - - fn set_commit_reveal_weights_interval(netuid: u16, interval: u64) { - SubtensorModule::set_commit_reveal_weights_interval(netuid, interval); - } - - fn set_commit_reveal_weights_enabled(netuid: u16, enabled: bool) { - SubtensorModule::set_commit_reveal_weights_enabled(netuid, enabled); - } - - fn set_liquid_alpha_enabled(netuid: u16, enabled: bool) { - SubtensorModule::set_liquid_alpha_enabled(netuid, enabled); - } - - fn do_set_alpha_values( - origin: RuntimeOrigin, - netuid: u16, - alpha_low: u16, - alpha_high: u16, - ) -> Result<(), DispatchError> { - SubtensorModule::do_set_alpha_values(origin, netuid, alpha_low, alpha_high) - } -} - impl pallet_admin_utils::Config for Runtime { type RuntimeEvent = RuntimeEvent; type AuthorityId = AuraId; type MaxAuthorities = ConstU32<32>; type Aura = AuraPalletIntrf; type Balance = Balance; - type Subtensor = SubtensorInterface; type WeightInfo = pallet_admin_utils::weights::SubstrateWeight; } From b0202f4a2fd1ae8bac71214a374eff9f5adc0bb2 Mon Sep 17 00:00:00 2001 From: Keith Date: Fri, 2 Aug 2024 15:53:58 +0900 Subject: [PATCH 2/9] Remove SubtensorInterface in tests --- pallets/admin-utils/tests/mock.rs | 274 +----------------------------- 1 file changed, 1 insertion(+), 273 deletions(-) diff --git a/pallets/admin-utils/tests/mock.rs b/pallets/admin-utils/tests/mock.rs index dbf88bdfa..3b6ec0ccd 100644 --- a/pallets/admin-utils/tests/mock.rs +++ b/pallets/admin-utils/tests/mock.rs @@ -12,7 +12,7 @@ use sp_core::U256; use sp_core::{ConstU64, H256}; use sp_runtime::{ traits::{BlakeTwo256, ConstU32, IdentityLookup}, - BuildStorage, DispatchError, + BuildStorage, }; type Block = frame_system::mocking::MockBlock; @@ -216,284 +216,12 @@ impl pallet_balances::Config for Test { type RuntimeHoldReason = (); } -pub struct SubtensorIntrf; - -impl pallet_admin_utils::SubtensorInterface for SubtensorIntrf { - fn set_max_delegate_take(default_take: u16) { - SubtensorModule::set_max_delegate_take(default_take); - } - - fn set_min_delegate_take(default_take: u16) { - SubtensorModule::set_min_delegate_take(default_take); - } - - fn set_tx_rate_limit(rate_limit: u64) { - SubtensorModule::set_tx_rate_limit(rate_limit); - } - - fn set_tx_delegate_take_rate_limit(rate_limit: u64) { - SubtensorModule::set_tx_delegate_take_rate_limit(rate_limit); - } - - fn set_serving_rate_limit(netuid: u16, rate_limit: u64) { - SubtensorModule::set_serving_rate_limit(netuid, rate_limit); - } - - fn set_max_burn(netuid: u16, max_burn: u64) { - SubtensorModule::set_max_burn(netuid, max_burn); - } - - fn set_min_burn(netuid: u16, min_burn: u64) { - SubtensorModule::set_min_burn(netuid, min_burn); - } - - fn set_burn(netuid: u16, burn: u64) { - SubtensorModule::set_burn(netuid, burn); - } - - fn set_max_difficulty(netuid: u16, max_diff: u64) { - SubtensorModule::set_max_difficulty(netuid, max_diff); - } - - fn set_min_difficulty(netuid: u16, min_diff: u64) { - SubtensorModule::set_min_difficulty(netuid, min_diff); - } - - fn set_difficulty(netuid: u16, diff: u64) { - SubtensorModule::set_difficulty(netuid, diff); - } - - fn set_weights_rate_limit(netuid: u16, rate_limit: u64) { - SubtensorModule::set_weights_set_rate_limit(netuid, rate_limit); - } - - fn set_weights_version_key(netuid: u16, version: u64) { - SubtensorModule::set_weights_version_key(netuid, version); - } - - fn set_bonds_moving_average(netuid: u16, moving_average: u64) { - SubtensorModule::set_bonds_moving_average(netuid, moving_average); - } - - fn set_max_allowed_validators(netuid: u16, max_validators: u16) { - SubtensorModule::set_max_allowed_validators(netuid, max_validators); - } - - fn get_root_netuid() -> u16 { - SubtensorModule::get_root_netuid() - } - - fn if_subnet_exist(netuid: u16) -> bool { - SubtensorModule::if_subnet_exist(netuid) - } - - fn create_account_if_non_existent(coldkey: &AccountId, hotkey: &AccountId) { - SubtensorModule::create_account_if_non_existent(coldkey, hotkey) - } - - fn coldkey_owns_hotkey(coldkey: &AccountId, hotkey: &AccountId) -> bool { - SubtensorModule::coldkey_owns_hotkey(coldkey, hotkey) - } - - fn increase_stake_on_coldkey_hotkey_account( - coldkey: &AccountId, - hotkey: &AccountId, - increment: u64, - ) { - SubtensorModule::increase_stake_on_coldkey_hotkey_account(coldkey, hotkey, increment); - } - - fn add_balance_to_coldkey_account(coldkey: &AccountId, amount: Balance) { - SubtensorModule::add_balance_to_coldkey_account(coldkey, amount); - } - - fn get_current_block_as_u64() -> u64 { - SubtensorModule::get_current_block_as_u64() - } - - fn get_subnetwork_n(netuid: u16) -> u16 { - SubtensorModule::get_subnetwork_n(netuid) - } - - fn get_max_allowed_uids(netuid: u16) -> u16 { - SubtensorModule::get_max_allowed_uids(netuid) - } - - fn append_neuron(netuid: u16, new_hotkey: &AccountId, block_number: u64) { - SubtensorModule::append_neuron(netuid, new_hotkey, block_number) - } - - fn get_neuron_to_prune(netuid: u16) -> u16 { - SubtensorModule::get_neuron_to_prune(netuid) - } - - fn replace_neuron(netuid: u16, uid_to_replace: u16, new_hotkey: &AccountId, block_number: u64) { - SubtensorModule::replace_neuron(netuid, uid_to_replace, new_hotkey, block_number); - } - - fn set_total_issuance(total_issuance: u64) { - SubtensorModule::set_total_issuance(total_issuance); - } - - fn set_network_immunity_period(net_immunity_period: u64) { - SubtensorModule::set_network_immunity_period(net_immunity_period); - } - - fn set_network_min_lock(net_min_lock: u64) { - SubtensorModule::set_network_min_lock(net_min_lock); - } - - fn set_subnet_limit(limit: u16) { - SubtensorModule::set_max_subnets(limit); - } - - fn set_lock_reduction_interval(interval: u64) { - SubtensorModule::set_lock_reduction_interval(interval); - } - - fn set_tempo(netuid: u16, tempo: u16) { - SubtensorModule::set_tempo(netuid, tempo); - } - - fn set_subnet_owner_cut(subnet_owner_cut: u16) { - SubtensorModule::set_subnet_owner_cut(subnet_owner_cut); - } - - fn set_network_rate_limit(limit: u64) { - SubtensorModule::set_network_rate_limit(limit); - } - - fn set_max_registrations_per_block(netuid: u16, max_registrations_per_block: u16) { - SubtensorModule::set_max_registrations_per_block(netuid, max_registrations_per_block); - } - - fn set_adjustment_alpha(netuid: u16, adjustment_alpha: u64) { - SubtensorModule::set_adjustment_alpha(netuid, adjustment_alpha); - } - - fn set_target_registrations_per_interval(netuid: u16, target_registrations_per_interval: u16) { - SubtensorModule::set_target_registrations_per_interval( - netuid, - target_registrations_per_interval, - ); - } - - fn set_network_pow_registration_allowed(netuid: u16, registration_allowed: bool) { - SubtensorModule::set_network_pow_registration_allowed(netuid, registration_allowed); - } - - fn set_network_registration_allowed(netuid: u16, registration_allowed: bool) { - SubtensorModule::set_network_pow_registration_allowed(netuid, registration_allowed); - } - - fn set_activity_cutoff(netuid: u16, activity_cutoff: u16) { - SubtensorModule::set_activity_cutoff(netuid, activity_cutoff); - } - - fn ensure_subnet_owner_or_root(o: RuntimeOrigin, netuid: u16) -> Result<(), DispatchError> { - SubtensorModule::ensure_subnet_owner_or_root(o, netuid) - } - - fn set_rho(netuid: u16, rho: u16) { - SubtensorModule::set_rho(netuid, rho); - } - - fn set_kappa(netuid: u16, kappa: u16) { - SubtensorModule::set_kappa(netuid, kappa); - } - - fn set_max_allowed_uids(netuid: u16, max_allowed: u16) { - SubtensorModule::set_max_allowed_uids(netuid, max_allowed); - } - - fn set_min_allowed_weights(netuid: u16, min_allowed_weights: u16) { - SubtensorModule::set_min_allowed_weights(netuid, min_allowed_weights); - } - - fn set_immunity_period(netuid: u16, immunity_period: u16) { - SubtensorModule::set_immunity_period(netuid, immunity_period); - } - - fn set_max_weight_limit(netuid: u16, max_weight_limit: u16) { - SubtensorModule::set_max_weight_limit(netuid, max_weight_limit); - } - - fn set_scaling_law_power(netuid: u16, scaling_law_power: u16) { - SubtensorModule::set_scaling_law_power(netuid, scaling_law_power); - } - - fn set_validator_prune_len(netuid: u16, validator_prune_len: u64) { - SubtensorModule::set_validator_prune_len(netuid, validator_prune_len); - } - - fn set_adjustment_interval(netuid: u16, adjustment_interval: u16) { - SubtensorModule::set_adjustment_interval(netuid, adjustment_interval); - } - - fn set_weights_set_rate_limit(netuid: u16, weights_set_rate_limit: u64) { - SubtensorModule::set_weights_set_rate_limit(netuid, weights_set_rate_limit); - } - - fn set_rao_recycled(netuid: u16, rao_recycled: u64) { - SubtensorModule::set_rao_recycled(netuid, rao_recycled); - } - - fn is_hotkey_registered_on_network(netuid: u16, hotkey: &AccountId) -> bool { - SubtensorModule::is_hotkey_registered_on_network(netuid, hotkey) - } - - fn init_new_network(netuid: u16, tempo: u16) { - SubtensorModule::init_new_network(netuid, tempo); - } - - fn set_weights_min_stake(min_stake: u64) { - SubtensorModule::set_weights_min_stake(min_stake); - } - - fn set_nominator_min_required_stake(min_stake: u64) { - SubtensorModule::set_nominator_min_required_stake(min_stake); - } - - fn get_nominator_min_required_stake() -> u64 { - SubtensorModule::get_nominator_min_required_stake() - } - - fn clear_small_nominations() { - SubtensorModule::clear_small_nominations(); - } - - fn set_target_stakes_per_interval(target_stakes_per_interval: u64) { - SubtensorModule::set_target_stakes_per_interval(target_stakes_per_interval); - } - - fn set_commit_reveal_weights_interval(netuid: u16, interval: u64) { - SubtensorModule::set_commit_reveal_weights_interval(netuid, interval); - } - - fn set_commit_reveal_weights_enabled(netuid: u16, enabled: bool) { - SubtensorModule::set_commit_reveal_weights_enabled(netuid, enabled); - } - - fn set_liquid_alpha_enabled(netuid: u16, enabled: bool) { - SubtensorModule::set_liquid_alpha_enabled(netuid, enabled); - } - fn do_set_alpha_values( - origin: RuntimeOrigin, - netuid: u16, - alpha_low: u16, - alpha_high: u16, - ) -> Result<(), DispatchError> { - SubtensorModule::do_set_alpha_values(origin, netuid, alpha_low, alpha_high) - } -} - impl pallet_admin_utils::Config for Test { type RuntimeEvent = RuntimeEvent; type AuthorityId = AuraId; type MaxAuthorities = ConstU32<32>; type Aura = (); type Balance = Balance; - type Subtensor = SubtensorIntrf; type WeightInfo = (); } From 83d680d1e3785c8e9a2f3ad34e46950ea46cffb7 Mon Sep 17 00:00:00 2001 From: Keith Date: Fri, 2 Aug 2024 15:55:22 +0900 Subject: [PATCH 3/9] Remove unused import --- runtime/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index d302652d4..66cea80d4 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -15,7 +15,7 @@ use codec::{Decode, Encode, MaxEncodedLen}; use frame_support::{ dispatch::DispatchResultWithPostInfo, genesis_builder_helper::{build_config, create_default_config}, - pallet_prelude::{DispatchError, Get}, + pallet_prelude::Get, traits::{fungible::HoldConsideration, Contains, LinearStoragePrice}, }; use frame_system::{EnsureNever, EnsureRoot, EnsureRootWithSuccess, RawOrigin}; From 063cf574cca294b8f67c7c9ee84b915879d20599 Mon Sep 17 00:00:00 2001 From: Keith Date: Fri, 2 Aug 2024 16:05:00 +0900 Subject: [PATCH 4/9] Fix clippy --- pallets/collective/src/lib.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/pallets/collective/src/lib.rs b/pallets/collective/src/lib.rs index 96040f99c..66c55036d 100644 --- a/pallets/collective/src/lib.rs +++ b/pallets/collective/src/lib.rs @@ -951,6 +951,7 @@ impl, I: 'static> Pallet { /// /// If not `approved`: /// - one event deposited. + /// /// Two removals, one mutation. /// Computation and i/o `O(P)` where: /// - `P` is number of active proposals From 5181bef8424c1ce31a2c0a30f0e14b64a4c69eec Mon Sep 17 00:00:00 2001 From: Keith Date: Fri, 2 Aug 2024 17:41:27 +0900 Subject: [PATCH 5/9] Remove references to T::Subtensor in benchmarks --- pallets/admin-utils/src/benchmarking.rs | 48 ++++++++++++------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/pallets/admin-utils/src/benchmarking.rs b/pallets/admin-utils/src/benchmarking.rs index 0158311f7..59f16f6c4 100644 --- a/pallets/admin-utils/src/benchmarking.rs +++ b/pallets/admin-utils/src/benchmarking.rs @@ -47,7 +47,7 @@ mod benchmarks { #[benchmark] fn sudo_set_max_difficulty() { - T::Subtensor::init_new_network(1u16 /*netuid*/, 1u16 /*tempo*/); + pallet_subtensor::Pallet::::init_new_network(1u16 /*netuid*/, 1u16 /*tempo*/); #[extrinsic_call] _(RawOrigin::Root, 1u16/*netuid*/, 10000u64/*max_difficulty*/)/*sudo_set_max_difficulty*/; @@ -55,7 +55,7 @@ mod benchmarks { #[benchmark] fn sudo_set_min_difficulty() { - T::Subtensor::init_new_network(1u16 /*netuid*/, 1u16 /*tempo*/); + pallet_subtensor::Pallet::::init_new_network(1u16 /*netuid*/, 1u16 /*tempo*/); #[extrinsic_call] _(RawOrigin::Root, 1u16/*netuid*/, 1000u64/*min_difficulty*/)/*sudo_set_min_difficulty*/; @@ -63,7 +63,7 @@ mod benchmarks { #[benchmark] fn sudo_set_weights_set_rate_limit() { - T::Subtensor::init_new_network(1u16 /*netuid*/, 1u16 /*tempo*/); + pallet_subtensor::Pallet::::init_new_network(1u16 /*netuid*/, 1u16 /*tempo*/); #[extrinsic_call] _(RawOrigin::Root, 1u16/*netuid*/, 3u64/*rate_limit*/)/*sudo_set_weights_set_rate_limit*/; @@ -71,7 +71,7 @@ mod benchmarks { #[benchmark] fn sudo_set_weights_version_key() { - T::Subtensor::init_new_network(1u16 /*netuid*/, 1u16 /*tempo*/); + pallet_subtensor::Pallet::::init_new_network(1u16 /*netuid*/, 1u16 /*tempo*/); #[extrinsic_call] _(RawOrigin::Root, 1u16/*netuid*/, 1u64/*version_key*/)/*sudo_set_weights_version_key*/; @@ -79,7 +79,7 @@ mod benchmarks { #[benchmark] fn sudo_set_bonds_moving_average() { - T::Subtensor::init_new_network(1u16 /*netuid*/, 1u16 /*tempo*/); + pallet_subtensor::Pallet::::init_new_network(1u16 /*netuid*/, 1u16 /*tempo*/); #[extrinsic_call] _(RawOrigin::Root, 1u16/*netuid*/, 100u64/*bonds_moving_average*/)/*sudo_set_bonds_moving_average*/; @@ -87,7 +87,7 @@ mod benchmarks { #[benchmark] fn sudo_set_max_allowed_validators() { - T::Subtensor::init_new_network(1u16 /*netuid*/, 1u16 /*tempo*/); + pallet_subtensor::Pallet::::init_new_network(1u16 /*netuid*/, 1u16 /*tempo*/); #[extrinsic_call] _(RawOrigin::Root, 1u16/*netuid*/, 10u16/*max_allowed_validators*/)/*sudo_set_max_allowed_validators*/; @@ -95,7 +95,7 @@ mod benchmarks { #[benchmark] fn sudo_set_difficulty() { - T::Subtensor::init_new_network(1u16 /*netuid*/, 1u16 /*tempo*/); + pallet_subtensor::Pallet::::init_new_network(1u16 /*netuid*/, 1u16 /*tempo*/); #[extrinsic_call] _(RawOrigin::Root, 1u16/*netuid*/, 1200000u64/*difficulty*/)/*sudo_set_difficulty*/; @@ -103,7 +103,7 @@ mod benchmarks { #[benchmark] fn sudo_set_adjustment_interval() { - T::Subtensor::init_new_network(1u16 /*netuid*/, 1u16 /*tempo*/); + pallet_subtensor::Pallet::::init_new_network(1u16 /*netuid*/, 1u16 /*tempo*/); #[extrinsic_call] _(RawOrigin::Root, 1u16/*netuid*/, 12u16/*adjustment_interval*/)/*sudo_set_adjustment_interval*/; @@ -111,7 +111,7 @@ mod benchmarks { #[benchmark] fn sudo_set_target_registrations_per_interval() { - T::Subtensor::init_new_network(1u16 /*netuid*/, 1u16 /*tempo*/); + pallet_subtensor::Pallet::::init_new_network(1u16 /*netuid*/, 1u16 /*tempo*/); #[extrinsic_call] _(RawOrigin::Root, 1u16/*netuid*/, 300u16/*target_registrations*/)/*sudo_set_target_registrations_per_interval*/; @@ -119,7 +119,7 @@ mod benchmarks { #[benchmark] fn sudo_set_activity_cutoff() { - T::Subtensor::init_new_network(1u16 /*netuid*/, 1u16 /*tempo*/); + pallet_subtensor::Pallet::::init_new_network(1u16 /*netuid*/, 1u16 /*tempo*/); #[extrinsic_call] _(RawOrigin::Root, 1u16/*netuid*/, 300u16/*activity_cutoff*/)/*sudo_set_activity_cutoff*/; @@ -127,7 +127,7 @@ mod benchmarks { #[benchmark] fn sudo_set_rho() { - T::Subtensor::init_new_network(1u16 /*netuid*/, 1u16 /*tempo*/); + pallet_subtensor::Pallet::::init_new_network(1u16 /*netuid*/, 1u16 /*tempo*/); #[extrinsic_call] _(RawOrigin::Root, 1u16/*netuid*/, 300u16/*rho*/)/*sudo_set_rho*/; @@ -135,7 +135,7 @@ mod benchmarks { #[benchmark] fn sudo_set_kappa() { - T::Subtensor::init_new_network(1u16 /*netuid*/, 1u16 /*sudo_tempo*/); + pallet_subtensor::Pallet::::init_new_network(1u16 /*netuid*/, 1u16 /*sudo_tempo*/); #[extrinsic_call] _(RawOrigin::Root, 1u16/*netuid*/, 3u16/*kappa*/)/*set_kappa*/; @@ -143,7 +143,7 @@ mod benchmarks { #[benchmark] fn sudo_set_max_allowed_uids() { - T::Subtensor::init_new_network(1u16 /*netuid*/, 1u16 /*tempo*/); + pallet_subtensor::Pallet::::init_new_network(1u16 /*netuid*/, 1u16 /*tempo*/); #[extrinsic_call] _(RawOrigin::Root, 1u16/*netuid*/, 4097u16/*max_allowed_uids*/)/*sudo_set_max_allowed_uids*/; @@ -151,7 +151,7 @@ mod benchmarks { #[benchmark] fn sudo_set_min_allowed_weights() { - T::Subtensor::init_new_network(1u16 /*netuid*/, 1u16 /*tempo*/); + pallet_subtensor::Pallet::::init_new_network(1u16 /*netuid*/, 1u16 /*tempo*/); #[extrinsic_call] _(RawOrigin::Root, 1u16/*netuid*/, 10u16/*max_allowed_uids*/)/*sudo_set_min_allowed_weights*/; @@ -159,7 +159,7 @@ mod benchmarks { #[benchmark] fn sudo_set_immunity_period() { - T::Subtensor::init_new_network(1u16 /*netuid*/, 1u16 /*tempo*/); + pallet_subtensor::Pallet::::init_new_network(1u16 /*netuid*/, 1u16 /*tempo*/); #[extrinsic_call] _(RawOrigin::Root, 1u16/*netuid*/, 100u16/*immunity_period*/)/*sudo_set_immunity_period*/; @@ -167,7 +167,7 @@ mod benchmarks { #[benchmark] fn sudo_set_max_weight_limit() { - T::Subtensor::init_new_network(1u16 /*netuid*/, 1u16 /*tempo*/); + pallet_subtensor::Pallet::::init_new_network(1u16 /*netuid*/, 1u16 /*tempo*/); #[extrinsic_call] _(RawOrigin::Root, 1u16/*netuid*/, 100u16/*max_weight_limit*/)/*sudo_set_max_weight_limit*/; @@ -175,7 +175,7 @@ mod benchmarks { #[benchmark] fn sudo_set_max_registrations_per_block() { - T::Subtensor::init_new_network(1u16 /*netuid*/, 1u16 /*tempo*/); + pallet_subtensor::Pallet::::init_new_network(1u16 /*netuid*/, 1u16 /*tempo*/); #[extrinsic_call] _(RawOrigin::Root, 1u16/*netuid*/, 100u16/*max_registrations*/)/*sudo_set_max_registrations_per_block*/; @@ -183,7 +183,7 @@ mod benchmarks { #[benchmark] fn sudo_set_max_burn() { - T::Subtensor::init_new_network(1u16 /*netuid*/, 1u16 /*tempo*/); + pallet_subtensor::Pallet::::init_new_network(1u16 /*netuid*/, 1u16 /*tempo*/); #[extrinsic_call] _(RawOrigin::Root, 1u16/*netuid*/, 10u64/*max_burn*/)/*sudo_set_max_burn*/; @@ -191,7 +191,7 @@ mod benchmarks { #[benchmark] fn sudo_set_min_burn() { - T::Subtensor::init_new_network(1u16 /*netuid*/, 1u16 /*tempo*/); + pallet_subtensor::Pallet::::init_new_network(1u16 /*netuid*/, 1u16 /*tempo*/); #[extrinsic_call] _(RawOrigin::Root, 1u16/*netuid*/, 10u64/*min_burn*/)/*sudo_set_min_burn*/; @@ -199,7 +199,7 @@ mod benchmarks { #[benchmark] fn sudo_set_network_registration_allowed() { - T::Subtensor::init_new_network(1u16 /*netuid*/, 1u16 /*tempo*/); + pallet_subtensor::Pallet::::init_new_network(1u16 /*netuid*/, 1u16 /*tempo*/); #[extrinsic_call] _(RawOrigin::Root, 1u16/*netuid*/, true/*registration_allowed*/)/*sudo_set_network_registration_allowed*/; @@ -212,13 +212,13 @@ mod benchmarks { let tempo: u16 = 15; let modality: u16 = 0; - T::Subtensor::init_new_network(netuid, tempo); + pallet_subtensor::Pallet::::init_new_network(netuid, tempo); }: sudo_set_tempo(RawOrigin::>::Root, netuid, tempo) */ #[benchmark] fn sudo_set_tempo() { - T::Subtensor::init_new_network(1u16 /*netuid*/, 1u16 /*tempo*/); + pallet_subtensor::Pallet::::init_new_network(1u16 /*netuid*/, 1u16 /*tempo*/); #[extrinsic_call] _(RawOrigin::Root, 1u16/*netuid*/, 1u16/*tempo*/)/*sudo_set_tempo*/; @@ -226,7 +226,7 @@ mod benchmarks { #[benchmark] fn sudo_set_commit_reveal_weights_interval() { - T::Subtensor::init_new_network(1u16 /*netuid*/, 1u16 /*sudo_tempo*/); + pallet_subtensor::Pallet::::init_new_network(1u16 /*netuid*/, 1u16 /*sudo_tempo*/); #[extrinsic_call] _(RawOrigin::Root, 1u16/*netuid*/, 3u64/*interval*/)/*set_commit_reveal_weights_interval()*/; @@ -234,7 +234,7 @@ mod benchmarks { #[benchmark] fn sudo_set_commit_reveal_weights_enabled() { - T::Subtensor::init_new_network(1u16 /*netuid*/, 1u16 /*sudo_tempo*/); + pallet_subtensor::Pallet::::init_new_network(1u16 /*netuid*/, 1u16 /*sudo_tempo*/); #[extrinsic_call] _(RawOrigin::Root, 1u16/*netuid*/, true/*enabled*/)/*set_commit_reveal_weights_enabled*/; From 7a935f9853a87b095cc84b009c45677f2d682a19 Mon Sep 17 00:00:00 2001 From: Keith Date: Fri, 2 Aug 2024 22:28:44 +0900 Subject: [PATCH 6/9] cargo fmt --- pallets/admin-utils/src/benchmarking.rs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/pallets/admin-utils/src/benchmarking.rs b/pallets/admin-utils/src/benchmarking.rs index 59f16f6c4..f12836af9 100644 --- a/pallets/admin-utils/src/benchmarking.rs +++ b/pallets/admin-utils/src/benchmarking.rs @@ -135,7 +135,10 @@ mod benchmarks { #[benchmark] fn sudo_set_kappa() { - pallet_subtensor::Pallet::::init_new_network(1u16 /*netuid*/, 1u16 /*sudo_tempo*/); + pallet_subtensor::Pallet::::init_new_network( + 1u16, /*netuid*/ + 1u16, /*sudo_tempo*/ + ); #[extrinsic_call] _(RawOrigin::Root, 1u16/*netuid*/, 3u16/*kappa*/)/*set_kappa*/; @@ -226,7 +229,10 @@ mod benchmarks { #[benchmark] fn sudo_set_commit_reveal_weights_interval() { - pallet_subtensor::Pallet::::init_new_network(1u16 /*netuid*/, 1u16 /*sudo_tempo*/); + pallet_subtensor::Pallet::::init_new_network( + 1u16, /*netuid*/ + 1u16, /*sudo_tempo*/ + ); #[extrinsic_call] _(RawOrigin::Root, 1u16/*netuid*/, 3u64/*interval*/)/*set_commit_reveal_weights_interval()*/; @@ -234,7 +240,10 @@ mod benchmarks { #[benchmark] fn sudo_set_commit_reveal_weights_enabled() { - pallet_subtensor::Pallet::::init_new_network(1u16 /*netuid*/, 1u16 /*sudo_tempo*/); + pallet_subtensor::Pallet::::init_new_network( + 1u16, /*netuid*/ + 1u16, /*sudo_tempo*/ + ); #[extrinsic_call] _(RawOrigin::Root, 1u16/*netuid*/, true/*enabled*/)/*set_commit_reveal_weights_enabled*/; From d719cf6508589256e900f7eafb9b87d95cca50e5 Mon Sep 17 00:00:00 2001 From: Samuel Dare Date: Sun, 4 Aug 2024 12:46:34 +0400 Subject: [PATCH 7/9] chore: fmt --- pallets/admin-utils/src/lib.rs | 2 +- runtime/src/lib.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pallets/admin-utils/src/lib.rs b/pallets/admin-utils/src/lib.rs index c29323e4c..c9dddad19 100644 --- a/pallets/admin-utils/src/lib.rs +++ b/pallets/admin-utils/src/lib.rs @@ -1128,7 +1128,7 @@ pub mod pallet { Ok(()) } - } + } } impl sp_runtime::BoundToRuntimeAppPublic for Pallet { diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index b08ddf539..3ba2ac180 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -16,7 +16,7 @@ use frame_support::traits::Imbalance; use frame_support::{ dispatch::DispatchResultWithPostInfo, genesis_builder_helper::{build_config, create_default_config}, - pallet_prelude::{DispatchError, Get}, + pallet_prelude::Get, traits::{fungible::HoldConsideration, Contains, LinearStoragePrice, OnUnbalanced}, }; use frame_system::{EnsureNever, EnsureRoot, EnsureRootWithSuccess, RawOrigin}; @@ -141,7 +141,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { // `spec_version`, and `authoring_version` are the same between Wasm and native. // This value is set to 100 to notify Polkadot-JS App (https://polkadot.js.org/apps) to use // the compatible custom types. - spec_version: 192, + spec_version: 193, impl_version: 1, apis: RUNTIME_API_VERSIONS, transaction_version: 1, From 9cbc5a21469213bd4cd66223b57a2d3e518ab801 Mon Sep 17 00:00:00 2001 From: Keith Date: Mon, 19 Aug 2024 09:55:49 -0400 Subject: [PATCH 8/9] Fix merge conflict --- pallets/admin-utils/src/benchmarking.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pallets/admin-utils/src/benchmarking.rs b/pallets/admin-utils/src/benchmarking.rs index 46b42fbc9..3f221fd30 100644 --- a/pallets/admin-utils/src/benchmarking.rs +++ b/pallets/admin-utils/src/benchmarking.rs @@ -251,7 +251,7 @@ mod benchmarks { #[benchmark] fn sudo_set_hotkey_emission_tempo() { - T::Subtensor::init_new_network(1u16 /*netuid*/, 1u16 /*sudo_tempo*/); + pallet_subtensor::Pallet::::init_new_network(1u16 /*netuid*/, 1u16 /*sudo_tempo*/); #[extrinsic_call] _(RawOrigin::Root, 1u64/*emission_tempo*/)/*set_hotkey_emission_tempo*/; @@ -259,7 +259,7 @@ mod benchmarks { #[benchmark] fn sudo_set_network_max_stake() { - T::Subtensor::init_new_network(1u16 /*netuid*/, 1u16 /*tempo*/); + pallet_subtensor::Pallet::::init_new_network(1u16 /*netuid*/, 1u16 /*tempo*/); #[extrinsic_call] _(RawOrigin::Root, 1u16/*netuid*/, 1_000_000_000_000_000u64/*max_stake*/)/*sudo_set_network_max_stake*/; From bb66f09f38a3fb4d0a06906c53b833cb3057f392 Mon Sep 17 00:00:00 2001 From: Keith Date: Mon, 19 Aug 2024 10:01:03 -0400 Subject: [PATCH 9/9] cargo fmt --- pallets/admin-utils/src/benchmarking.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pallets/admin-utils/src/benchmarking.rs b/pallets/admin-utils/src/benchmarking.rs index 3f221fd30..7515525f0 100644 --- a/pallets/admin-utils/src/benchmarking.rs +++ b/pallets/admin-utils/src/benchmarking.rs @@ -251,7 +251,10 @@ mod benchmarks { #[benchmark] fn sudo_set_hotkey_emission_tempo() { - pallet_subtensor::Pallet::::init_new_network(1u16 /*netuid*/, 1u16 /*sudo_tempo*/); + pallet_subtensor::Pallet::::init_new_network( + 1u16, /*netuid*/ + 1u16, /*sudo_tempo*/ + ); #[extrinsic_call] _(RawOrigin::Root, 1u64/*emission_tempo*/)/*set_hotkey_emission_tempo*/;