Skip to content

Commit 8b244eb

Browse files
committed
Merge branch 'devnet-ready' into feat/subsubnets
2 parents 07a2f70 + 032cd5e commit 8b244eb

File tree

8 files changed

+4
-453
lines changed

8 files changed

+4
-453
lines changed

common/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ pub enum ProxyType {
154154
Registration,
155155
Transfer,
156156
SmallTransfer,
157-
RootWeights,
157+
RootWeights, // deprecated
158158
ChildKeys,
159159
SudoUncheckedSetCode,
160160
SwapHotkey,

pallets/admin-utils/src/lib.rs

Lines changed: 0 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -957,21 +957,6 @@ pub mod pallet {
957957
Ok(())
958958
}
959959

960-
/// The extrinsic sets the subnet limit for the network.
961-
/// It is only callable by the root account.
962-
/// The extrinsic will call the Subtensor pallet to set the subnet limit.
963-
#[pallet::call_index(37)]
964-
#[pallet::weight((
965-
Weight::from_parts(14_000_000, 0)
966-
.saturating_add(<T as frame_system::Config>::DbWeight::get().writes(1)),
967-
DispatchClass::Operational,
968-
Pays::No
969-
))]
970-
pub fn sudo_set_subnet_limit(origin: OriginFor<T>, _max_subnets: u16) -> DispatchResult {
971-
ensure_root(origin)?;
972-
Ok(())
973-
}
974-
975960
/// The extrinsic sets the lock reduction interval for the network.
976961
/// It is only callable by the root account.
977962
/// The extrinsic will call the Subtensor pallet to set the lock reduction interval.
@@ -1076,26 +1061,6 @@ pub mod pallet {
10761061
Ok(())
10771062
}
10781063

1079-
// The extrinsic sets the target stake per interval.
1080-
// It is only callable by the root account.
1081-
// The extrinsic will call the Subtensor pallet to set target stake per interval.
1082-
// #[pallet::call_index(47)]
1083-
// #[pallet::weight((0, DispatchClass::Operational, Pays::No))]
1084-
// pub fn sudo_set_target_stakes_per_interval(
1085-
// origin: OriginFor<T>,
1086-
// target_stakes_per_interval: u64,
1087-
// ) -> DispatchResult {
1088-
// ensure_root(origin)?;
1089-
// pallet_subtensor::Pallet::<T>::set_target_stakes_per_interval(
1090-
// target_stakes_per_interval,
1091-
// );
1092-
// log::debug!(
1093-
// "TxTargetStakesPerIntervalSet( set_target_stakes_per_interval: {:?} ) ",
1094-
// target_stakes_per_interval
1095-
// ); (DEPRECATED)
1096-
// Ok(())
1097-
// } (DEPRECATED)
1098-
10991064
/// The extrinsic enabled/disables commit/reaveal for a given subnet.
11001065
/// It is only callable by the root account or subnet owner.
11011066
/// The extrinsic will call the Subtensor pallet to set the value.
@@ -1157,62 +1122,6 @@ pub mod pallet {
11571122
)
11581123
}
11591124

1160-
// DEPRECATED
1161-
// #[pallet::call_index(52)]
1162-
// #[pallet::weight((0, DispatchClass::Operational, Pays::No))]
1163-
// pub fn sudo_set_hotkey_emission_tempo(
1164-
// origin: OriginFor<T>,
1165-
// emission_tempo: u64,
1166-
// ) -> DispatchResult {
1167-
// ensure_root(origin)?;
1168-
// pallet_subtensor::Pallet::<T>::set_hotkey_emission_tempo(emission_tempo);
1169-
// log::debug!(
1170-
// "HotkeyEmissionTempoSet( emission_tempo: {:?} )",
1171-
// emission_tempo
1172-
// );
1173-
// Ok(())
1174-
// }
1175-
1176-
/// Sets the maximum stake allowed for a specific network.
1177-
///
1178-
/// This function allows the root account to set the maximum stake for a given network.
1179-
/// It updates the network's maximum stake value and logs the change.
1180-
///
1181-
/// # Arguments
1182-
///
1183-
/// * `origin` - The origin of the call, which must be the root account.
1184-
/// * `netuid` - The unique identifier of the network.
1185-
/// * `max_stake` - The new maximum stake value to set.
1186-
///
1187-
/// # Returns
1188-
///
1189-
/// Returns `Ok(())` if the operation is successful, or an error if it fails.
1190-
///
1191-
/// # Example
1192-
///
1193-
///
1194-
/// # Notes
1195-
///
1196-
/// - This function can only be called by the root account.
1197-
/// - The `netuid` should correspond to an existing network.
1198-
///
1199-
/// # TODO
1200-
///
1201-
// - Consider adding a check to ensure the `netuid` corresponds to an existing network.
1202-
// - Implement a mechanism to gradually adjust the max stake to prevent sudden changes.
1203-
// #[pallet::weight(<T as Config>::WeightInfo::sudo_set_network_max_stake())]
1204-
#[pallet::call_index(53)]
1205-
#[pallet::weight((0, DispatchClass::Operational, Pays::No))]
1206-
pub fn sudo_set_network_max_stake(
1207-
origin: OriginFor<T>,
1208-
_netuid: NetUid,
1209-
_max_stake: u64,
1210-
) -> DispatchResult {
1211-
// Ensure the call is made by the root account
1212-
ensure_root(origin)?;
1213-
Ok(())
1214-
}
1215-
12161125
/// Sets the duration of the coldkey swap schedule.
12171126
///
12181127
/// This extrinsic allows the root account to set the duration for the coldkey swap schedule.

pallets/commitments/src/lib.rs

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -325,21 +325,6 @@ pub mod pallet {
325325
Ok(())
326326
}
327327

328-
/// *DEPRECATED* Sudo-set the commitment rate limit
329-
#[pallet::call_index(1)]
330-
#[pallet::weight((
331-
Weight::from_parts(3_596_000, 0)
332-
.saturating_add(T::DbWeight::get().reads(0_u64))
333-
.saturating_add(T::DbWeight::get().writes(1_u64)),
334-
DispatchClass::Operational,
335-
Pays::No
336-
))]
337-
pub fn set_rate_limit(origin: OriginFor<T>, _rate_limit_blocks: u32) -> DispatchResult {
338-
ensure_root(origin)?;
339-
// RateLimit::<T>::set(rate_limit_blocks.into());
340-
Ok(())
341-
}
342-
343328
/// Sudo-set MaxSpace
344329
#[pallet::call_index(2)]
345330
#[pallet::weight((

pallets/subtensor/src/benchmarks.rs

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -98,33 +98,6 @@ mod pallet_benchmarks {
9898
);
9999
}
100100

101-
#[benchmark]
102-
fn become_delegate() {
103-
let netuid = NetUid::from(1);
104-
let tempo: u16 = 1;
105-
106-
Subtensor::<T>::init_new_network(netuid, tempo);
107-
SubtokenEnabled::<T>::insert(netuid, true);
108-
Subtensor::<T>::set_burn(netuid, 1.into());
109-
Subtensor::<T>::set_max_allowed_uids(netuid, 4096);
110-
Subtensor::<T>::set_network_registration_allowed(netuid, true);
111-
112-
let seed: u32 = 1;
113-
let coldkey: T::AccountId = account("Test", 0, seed);
114-
let hotkey: T::AccountId = account("Alice", 0, seed);
115-
let amount_to_be_staked: u64 = 1_000_000_000;
116-
117-
Subtensor::<T>::add_balance_to_coldkey_account(&coldkey, amount_to_be_staked);
118-
assert_ok!(Subtensor::<T>::do_burned_registration(
119-
RawOrigin::Signed(coldkey.clone()).into(),
120-
netuid,
121-
hotkey.clone()
122-
));
123-
124-
#[extrinsic_call]
125-
_(RawOrigin::Signed(coldkey.clone()), hotkey.clone());
126-
}
127-
128101
#[benchmark]
129102
fn add_stake() {
130103
let netuid = NetUid::from(1);
@@ -1280,27 +1253,6 @@ mod pallet_benchmarks {
12801253
);
12811254
}
12821255

1283-
#[benchmark]
1284-
fn set_tao_weights() {
1285-
let netuid = NetUid::from(1);
1286-
let hotkey: T::AccountId = account("A", 0, 6);
1287-
let dests = vec![0u16];
1288-
let weights = vec![0u16];
1289-
let version: u64 = 1;
1290-
1291-
Subtensor::<T>::init_new_network(netuid, 1);
1292-
1293-
#[extrinsic_call]
1294-
_(
1295-
RawOrigin::None,
1296-
netuid,
1297-
hotkey.clone(),
1298-
dests.clone(),
1299-
weights.clone(),
1300-
version,
1301-
);
1302-
}
1303-
13041256
#[benchmark]
13051257
fn swap_hotkey() {
13061258
let coldkey: T::AccountId = whitelisted_caller();

pallets/subtensor/src/macros/dispatches.rs

Lines changed: 2 additions & 172 deletions
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,8 @@ mod dispatches {
197197
/// - On failure for each failed item in the batch.
198198
///
199199
#[pallet::call_index(80)]
200-
#[pallet::weight((Weight::from_parts(100_500_000, 0)
201-
.saturating_add(T::DbWeight::get().reads(15_u64))
200+
#[pallet::weight((Weight::from_parts(95_460_000, 0)
201+
.saturating_add(T::DbWeight::get().reads(14_u64))
202202
.saturating_add(T::DbWeight::get().writes(2_u64)), DispatchClass::Normal, Pays::No))]
203203
pub fn batch_set_weights(
204204
origin: OriginFor<T>,
@@ -557,118 +557,6 @@ mod dispatches {
557557
)
558558
}
559559

560-
/// # Args:
561-
/// * `origin`: (<T as frame_system::Config>Origin):
562-
/// - The caller, a hotkey who wishes to set their weights.
563-
///
564-
/// * `netuid` (u16):
565-
/// - The network uid we are setting these weights on.
566-
///
567-
/// * `hotkey` (T::AccountId):
568-
/// - The hotkey associated with the operation and the calling coldkey.
569-
///
570-
/// * `dests` (Vec<u16>):
571-
/// - The edge endpoint for the weight, i.e. j for w_ij.
572-
///
573-
/// * 'weights' (Vec<u16>):
574-
/// - The u16 integer encoded weights. Interpreted as rational
575-
/// values in the range [0,1]. They must sum to in32::MAX.
576-
///
577-
/// * 'version_key' ( u64 ):
578-
/// - The network version key to check if the validator is up to date.
579-
///
580-
/// # Event:
581-
///
582-
/// * WeightsSet;
583-
/// - On successfully setting the weights on chain.
584-
///
585-
/// # Raises:
586-
///
587-
/// * NonAssociatedColdKey;
588-
/// - Attempting to set weights on a non-associated cold key.
589-
///
590-
/// * 'SubNetworkDoesNotExist':
591-
/// - Attempting to set weights on a non-existent network.
592-
///
593-
/// * 'NotRootSubnet':
594-
/// - Attempting to set weights on a subnet that is not the root network.
595-
///
596-
/// * 'WeightVecNotEqualSize':
597-
/// - Attempting to set weights with uids not of same length.
598-
///
599-
/// * 'UidVecContainInvalidOne':
600-
/// - Attempting to set weights with invalid uids.
601-
///
602-
/// * 'NotRegistered':
603-
/// - Attempting to set weights from a non registered account.
604-
///
605-
/// * 'WeightVecLengthIsLow':
606-
/// - Attempting to set weights with fewer weights than min.
607-
///
608-
/// * 'IncorrectWeightVersionKey':
609-
/// - Attempting to set weights with the incorrect network version key.
610-
///
611-
/// * 'SettingWeightsTooFast':
612-
/// - Attempting to set weights too fast.
613-
///
614-
/// * 'WeightVecLengthIsLow':
615-
/// - Attempting to set weights with fewer weights than min.
616-
///
617-
/// * 'MaxWeightExceeded':
618-
/// - Attempting to set weights with max value exceeding limit.
619-
///
620-
#[pallet::call_index(8)]
621-
#[pallet::weight((Weight::from_parts(3_176_000, 0)
622-
.saturating_add(T::DbWeight::get().reads(0_u64))
623-
.saturating_add(T::DbWeight::get().writes(0_u64)), DispatchClass::Normal, Pays::No))]
624-
pub fn set_tao_weights(
625-
_origin: OriginFor<T>,
626-
_netuid: NetUid,
627-
_hotkey: T::AccountId,
628-
_dests: Vec<u16>,
629-
_weights: Vec<u16>,
630-
_version_key: u64,
631-
) -> DispatchResult {
632-
// DEPRECATED
633-
// Self::do_set_root_weights(origin, netuid, hotkey, dests, weights, version_key)
634-
// Self::do_set_tao_weights(origin, netuid, hotkey, dests, weights, version_key)
635-
Ok(())
636-
}
637-
638-
/// --- Sets the key as a delegate.
639-
///
640-
/// # Args:
641-
/// * 'origin': (<T as frame_system::Config>Origin):
642-
/// - The signature of the caller's coldkey.
643-
///
644-
/// * 'hotkey' (T::AccountId):
645-
/// - The hotkey we are delegating (must be owned by the coldkey.)
646-
///
647-
/// * 'take' (u64):
648-
/// - The stake proportion that this hotkey takes from delegations.
649-
///
650-
/// # Event:
651-
/// * DelegateAdded;
652-
/// - On successfully setting a hotkey as a delegate.
653-
///
654-
/// # Raises:
655-
/// * 'NotRegistered':
656-
/// - The hotkey we are delegating is not registered on the network.
657-
///
658-
/// * 'NonAssociatedColdKey':
659-
/// - The hotkey we are delegating is not owned by the calling coldket.
660-
///
661-
#[pallet::call_index(1)]
662-
#[pallet::weight((Weight::from_parts(3_406_000, 0)
663-
.saturating_add(T::DbWeight::get().reads(0))
664-
.saturating_add(T::DbWeight::get().writes(0)), DispatchClass::Normal, Pays::Yes))]
665-
pub fn become_delegate(_origin: OriginFor<T>, _hotkey: T::AccountId) -> DispatchResult {
666-
// DEPRECATED
667-
// Self::do_become_delegate(origin, hotkey, Self::get_default_delegate_take())
668-
669-
Ok(())
670-
}
671-
672560
/// --- Allows delegates to decrease its take value.
673561
///
674562
/// # Args:
@@ -1591,64 +1479,6 @@ mod dispatches {
15911479
Ok(().into())
15921480
}
15931481

1594-
/// Schedule the dissolution of a network at a specified block number.
1595-
///
1596-
/// # Arguments
1597-
///
1598-
/// * `origin` - The origin of the call, must be signed by the sender.
1599-
/// * `netuid` - The u16 network identifier to be dissolved.
1600-
///
1601-
/// # Returns
1602-
///
1603-
/// Returns a `DispatchResultWithPostInfo` indicating success or failure of the operation.
1604-
///
1605-
/// # Weight
1606-
///
1607-
/// Weight is calculated based on the number of database reads and writes.
1608-
1609-
#[pallet::call_index(74)]
1610-
#[pallet::weight((Weight::from_parts(119_000_000, 0)
1611-
.saturating_add(T::DbWeight::get().reads(6))
1612-
.saturating_add(T::DbWeight::get().writes(31)), DispatchClass::Normal, Pays::Yes))]
1613-
pub fn schedule_dissolve_network(
1614-
_origin: OriginFor<T>,
1615-
_netuid: NetUid,
1616-
) -> DispatchResultWithPostInfo {
1617-
Err(Error::<T>::CallDisabled.into())
1618-
1619-
// let who = ensure_signed(origin)?;
1620-
1621-
// let current_block: BlockNumberFor<T> = <frame_system::Pallet<T>>::block_number();
1622-
// let duration: BlockNumberFor<T> = DissolveNetworkScheduleDuration::<T>::get();
1623-
// let when: BlockNumberFor<T> = current_block.saturating_add(duration);
1624-
1625-
// let call = Call::<T>::dissolve_network {
1626-
// coldkey: who.clone(),
1627-
// netuid,
1628-
// };
1629-
1630-
// let bound_call = T::Preimages::bound(LocalCallOf::<T>::from(call.clone()))
1631-
// .map_err(|_| Error::<T>::FailedToSchedule)?;
1632-
1633-
// T::Scheduler::schedule(
1634-
// DispatchTime::At(when),
1635-
// None,
1636-
// 63,
1637-
// frame_system::RawOrigin::Root.into(),
1638-
// bound_call,
1639-
// )
1640-
// .map_err(|_| Error::<T>::FailedToSchedule)?;
1641-
1642-
// // Emit the SwapScheduled event
1643-
// Self::deposit_event(Event::DissolveNetworkScheduled {
1644-
// account: who.clone(),
1645-
// netuid,
1646-
// execution_block: when,
1647-
// });
1648-
1649-
// Ok(().into())
1650-
}
1651-
16521482
/// ---- Set prometheus information for the neuron.
16531483
/// # Args:
16541484
/// * 'origin': (<T as frame_system::Config>Origin):

0 commit comments

Comments
 (0)