Skip to content

Commit 22bbb5c

Browse files
committed
Apply rao changes initially
1 parent d261f67 commit 22bbb5c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+16917
-12726
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ fp-rpc = { workspace = true }
103103
fc-mapping-sync = { workspace = true }
104104
fp-consensus = { workspace = true }
105105
thiserror = { workspace = true }
106+
num-traits = { version = "0.2", features = ["std"] }
106107

107108
# Local Dependencies
108109
node-subtensor-runtime = { path = "../runtime" }

pallets/admin-utils/src/benchmarking.rs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -264,17 +264,6 @@ mod benchmarks {
264264
_(RawOrigin::Root, 1u16/*netuid*/, true/*enabled*/)/*set_commit_reveal_weights_enabled*/;
265265
}
266266

267-
#[benchmark]
268-
fn sudo_set_hotkey_emission_tempo() {
269-
pallet_subtensor::Pallet::<T>::init_new_network(
270-
1u16, /*netuid*/
271-
1u16, /*sudo_tempo*/
272-
);
273-
274-
#[extrinsic_call]
275-
_(RawOrigin::Root, 1u64/*emission_tempo*/)/*set_hotkey_emission_tempo*/;
276-
}
277-
278267
#[benchmark]
279268
fn sudo_set_network_max_stake() {
280269
pallet_subtensor::Pallet::<T>::init_new_network(1u16 /*netuid*/, 1u16 /*tempo*/);

pallets/admin-utils/src/lib.rs

Lines changed: 31 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -961,22 +961,22 @@ pub mod pallet {
961961
/// The extrinsic sets the target stake per interval.
962962
/// It is only callable by the root account.
963963
/// The extrinsic will call the Subtensor pallet to set target stake per interval.
964-
#[pallet::call_index(47)]
965-
#[pallet::weight((0, DispatchClass::Operational, Pays::No))]
966-
pub fn sudo_set_target_stakes_per_interval(
967-
origin: OriginFor<T>,
968-
target_stakes_per_interval: u64,
969-
) -> DispatchResult {
970-
ensure_root(origin)?;
971-
pallet_subtensor::Pallet::<T>::set_target_stakes_per_interval(
972-
target_stakes_per_interval,
973-
);
974-
log::debug!(
975-
"TxTargetStakesPerIntervalSet( set_target_stakes_per_interval: {:?} ) ",
976-
target_stakes_per_interval
977-
);
978-
Ok(())
979-
}
964+
// #[pallet::call_index(47)]
965+
// #[pallet::weight((0, DispatchClass::Operational, Pays::No))]
966+
// pub fn sudo_set_target_stakes_per_interval(
967+
// origin: OriginFor<T>,
968+
// target_stakes_per_interval: u64,
969+
// ) -> DispatchResult {
970+
// ensure_root(origin)?;
971+
// pallet_subtensor::Pallet::<T>::set_target_stakes_per_interval(
972+
// target_stakes_per_interval,
973+
// );
974+
// log::debug!(
975+
// "TxTargetStakesPerIntervalSet( set_target_stakes_per_interval: {:?} ) ",
976+
// target_stakes_per_interval
977+
// ); (DEPRECATED)
978+
// Ok(())
979+
// } (DEPRECATED)
980980

981981
/// The extrinsic enabled/disables commit/reaveal for a given subnet.
982982
/// It is only callable by the root account or subnet owner.
@@ -1041,35 +1041,21 @@ pub mod pallet {
10411041
)
10421042
}
10431043

1044-
/// Sets the hotkey emission tempo.
1045-
///
1046-
/// This extrinsic allows the root account to set the hotkey emission tempo, which determines
1047-
/// the number of blocks before a hotkey drains accumulated emissions through to nominator staking accounts.
1048-
///
1049-
/// # Arguments
1050-
/// * `origin` - The origin of the call, which must be the root account.
1051-
/// * `emission_tempo` - The new emission tempo value to set.
1052-
///
1053-
/// # Emits
1054-
/// * `Event::HotkeyEmissionTempoSet` - When the hotkey emission tempo is successfully set.
1055-
///
1056-
/// # Errors
1057-
/// * `DispatchError::BadOrigin` - If the origin is not the root account.
1058-
// #[pallet::weight(<T as Config>::WeightInfo::sudo_set_hotkey_emission_tempo())]
1059-
#[pallet::call_index(52)]
1060-
#[pallet::weight((0, DispatchClass::Operational, Pays::No))]
1061-
pub fn sudo_set_hotkey_emission_tempo(
1062-
origin: OriginFor<T>,
1063-
emission_tempo: u64,
1064-
) -> DispatchResult {
1065-
ensure_root(origin)?;
1066-
pallet_subtensor::Pallet::<T>::set_hotkey_emission_tempo(emission_tempo);
1067-
log::debug!(
1068-
"HotkeyEmissionTempoSet( emission_tempo: {:?} )",
1069-
emission_tempo
1070-
);
1071-
Ok(())
1072-
}
1044+
// DEPRECATED
1045+
// #[pallet::call_index(52)]
1046+
// #[pallet::weight((0, DispatchClass::Operational, Pays::No))]
1047+
// pub fn sudo_set_hotkey_emission_tempo(
1048+
// origin: OriginFor<T>,
1049+
// emission_tempo: u64,
1050+
// ) -> DispatchResult {
1051+
// ensure_root(origin)?;
1052+
// pallet_subtensor::Pallet::<T>::set_hotkey_emission_tempo(emission_tempo);
1053+
// log::debug!(
1054+
// "HotkeyEmissionTempoSet( emission_tempo: {:?} )",
1055+
// emission_tempo
1056+
// );
1057+
// Ok(())
1058+
// }
10731059

10741060
/// Sets the maximum stake allowed for a specific network.
10751061
///

pallets/admin-utils/src/tests/mock.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,15 +124,15 @@ parameter_types! {
124124
pub const InitialNetworkLockReductionInterval: u64 = 2; // 2 blocks.
125125
pub const InitialSubnetLimit: u16 = 10; // Max 10 subnets.
126126
pub const InitialNetworkRateLimit: u64 = 0;
127-
pub const InitialTargetStakesPerInterval: u16 = 1;
128127
pub const InitialKeySwapCost: u64 = 1_000_000_000;
129128
pub const InitialAlphaHigh: u16 = 58982; // Represents 0.9 as per the production default
130129
pub const InitialAlphaLow: u16 = 45875; // Represents 0.7 as per the production default
131130
pub const InitialLiquidAlphaOn: bool = false; // Default value for LiquidAlphaOn
132-
pub const InitialHotkeyEmissionTempo: u64 = 1;
131+
// pub const InitialHotkeyEmissionTempo: u64 = 1; // (DEPRECATED)
133132
pub const InitialNetworkMaxStake: u64 = u64::MAX; // Maximum possible value for u64, this make the make stake infinity
134133
pub const InitialColdkeySwapScheduleDuration: u64 = 5 * 24 * 60 * 60 / 12; // 5 days
135134
pub const InitialDissolveNetworkScheduleDuration: u64 = 5 * 24 * 60 * 60 / 12; // 5 days
135+
pub const InitialTaoWeight: u64 = u64::MAX/10; // 10% global weight.
136136
}
137137

138138
impl pallet_subtensor::Config for Test {
@@ -188,16 +188,16 @@ impl pallet_subtensor::Config for Test {
188188
type InitialNetworkLockReductionInterval = InitialNetworkLockReductionInterval;
189189
type InitialSubnetLimit = InitialSubnetLimit;
190190
type InitialNetworkRateLimit = InitialNetworkRateLimit;
191-
type InitialTargetStakesPerInterval = InitialTargetStakesPerInterval;
192191
type KeySwapCost = InitialKeySwapCost;
193192
type AlphaHigh = InitialAlphaHigh;
194193
type AlphaLow = InitialAlphaLow;
195194
type LiquidAlphaOn = InitialLiquidAlphaOn;
196-
type InitialHotkeyEmissionTempo = InitialHotkeyEmissionTempo;
195+
// type InitialHotkeyEmissionTempo = InitialHotkeyEmissionTempo; // (DEPRECATED)
197196
type InitialNetworkMaxStake = InitialNetworkMaxStake;
198197
type Preimages = ();
199198
type InitialColdkeySwapScheduleDuration = InitialColdkeySwapScheduleDuration;
200199
type InitialDissolveNetworkScheduleDuration = InitialDissolveNetworkScheduleDuration;
200+
type InitialTaoWeight = InitialTaoWeight;
201201
}
202202

203203
#[derive_impl(frame_system::config_preludes::TestDefaultConfig)]

0 commit comments

Comments
 (0)