@@ -1035,6 +1035,87 @@ pub mod pallet {
10351035 T :: Subtensor :: ensure_subnet_owner_or_root ( origin. clone ( ) , netuid) ?;
10361036 T :: Subtensor :: do_set_alpha_values ( origin, netuid, alpha_low, alpha_high)
10371037 }
1038+
1039+ /// Sets the hotkey emission tempo.
1040+ ///
1041+ /// This extrinsic allows the root account to set the hotkey emission tempo, which determines
1042+ /// the number of blocks before a hotkey drains accumulated emissions through to nominator staking accounts.
1043+ ///
1044+ /// # Arguments
1045+ /// * `origin` - The origin of the call, which must be the root account.
1046+ /// * `emission_tempo` - The new emission tempo value to set.
1047+ ///
1048+ /// # Emits
1049+ /// * `Event::HotkeyEmissionTempoSet` - When the hotkey emission tempo is successfully set.
1050+ ///
1051+ /// # Errors
1052+ /// * `DispatchError::BadOrigin` - If the origin is not the root account.
1053+ // #[pallet::weight(T::WeightInfo::sudo_set_hotkey_emission_tempo())]
1054+ #[ pallet:: call_index( 52 ) ]
1055+ #[ pallet:: weight( ( 0 , DispatchClass :: Operational , Pays :: No ) ) ]
1056+ pub fn sudo_set_hotkey_emission_tempo (
1057+ origin : OriginFor < T > ,
1058+ emission_tempo : u64 ,
1059+ ) -> DispatchResult {
1060+ ensure_root ( origin) ?;
1061+ T :: Subtensor :: set_hotkey_emission_tempo ( emission_tempo) ;
1062+ log:: info!(
1063+ "HotkeyEmissionTempoSet( emission_tempo: {:?} )" ,
1064+ emission_tempo
1065+ ) ;
1066+ Ok ( ( ) )
1067+ }
1068+
1069+ /// Sets the maximum stake allowed for a specific network.
1070+ ///
1071+ /// This function allows the root account to set the maximum stake for a given network.
1072+ /// It updates the network's maximum stake value and logs the change.
1073+ ///
1074+ /// # Arguments
1075+ ///
1076+ /// * `origin` - The origin of the call, which must be the root account.
1077+ /// * `netuid` - The unique identifier of the network.
1078+ /// * `max_stake` - The new maximum stake value to set.
1079+ ///
1080+ /// # Returns
1081+ ///
1082+ /// Returns `Ok(())` if the operation is successful, or an error if it fails.
1083+ ///
1084+ /// # Example
1085+ ///
1086+ ///
1087+ /// # Notes
1088+ ///
1089+ /// - This function can only be called by the root account.
1090+ /// - The `netuid` should correspond to an existing network.
1091+ ///
1092+ /// # TODO
1093+ ///
1094+ // - Consider adding a check to ensure the `netuid` corresponds to an existing network.
1095+ // - Implement a mechanism to gradually adjust the max stake to prevent sudden changes.
1096+ // #[pallet::weight(T::WeightInfo::sudo_set_network_max_stake())]
1097+ #[ pallet:: call_index( 53 ) ]
1098+ #[ pallet:: weight( ( 0 , DispatchClass :: Operational , Pays :: No ) ) ]
1099+ pub fn sudo_set_network_max_stake (
1100+ origin : OriginFor < T > ,
1101+ netuid : u16 ,
1102+ max_stake : u64 ,
1103+ ) -> DispatchResult {
1104+ // Ensure the call is made by the root account
1105+ ensure_root ( origin) ?;
1106+
1107+ // Set the new maximum stake for the specified network
1108+ T :: Subtensor :: set_network_max_stake ( netuid, max_stake) ;
1109+
1110+ // Log the change
1111+ log:: trace!(
1112+ "NetworkMaxStakeSet( netuid: {:?}, max_stake: {:?} )" ,
1113+ netuid,
1114+ max_stake
1115+ ) ;
1116+
1117+ Ok ( ( ) )
1118+ }
10381119 }
10391120}
10401121
@@ -1137,4 +1218,6 @@ pub trait SubtensorInterface<AccountId, Balance, RuntimeOrigin> {
11371218 alpha_low : u16 ,
11381219 alpha_high : u16 ,
11391220 ) -> Result < ( ) , DispatchError > ;
1221+ fn set_hotkey_emission_tempo ( emission_tempo : u64 ) ;
1222+ fn set_network_max_stake ( netuid : u16 , max_stake : u64 ) ;
11401223}
0 commit comments