Skip to content

Commit 2fec8d7

Browse files
committed
remove duplicate sudo_set_subnet_owner_hotkey
1 parent 6d3ab3a commit 2fec8d7

File tree

2 files changed

+67
-67
lines changed

2 files changed

+67
-67
lines changed

pallets/admin-utils/src/lib.rs

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1667,31 +1667,31 @@ pub mod pallet {
16671667
Ok(())
16681668
}
16691669

1670-
/// Change the SubnetOwnerHotkey for a given subnet.
1671-
///
1672-
/// # Arguments
1673-
/// * `origin` - The origin of the call, which must be the subnet owner.
1674-
/// * `netuid` - The unique identifier for the subnet.
1675-
/// * `hotkey` - The new hotkey for the subnet owner.
1676-
///
1677-
/// # Errors
1678-
/// * `BadOrigin` - If the caller is not the subnet owner or root account.
1679-
///
1680-
/// # Weight
1681-
/// Weight is handled by the `#[pallet::weight]` attribute.
1682-
#[pallet::call_index(64)]
1683-
#[pallet::weight((0, DispatchClass::Operational, Pays::No))]
1684-
pub fn sudo_set_subnet_owner_hotkey(
1685-
origin: OriginFor<T>,
1686-
netuid: NetUid,
1687-
hotkey: <T as frame_system::Config>::AccountId,
1688-
) -> DispatchResult {
1689-
pallet_subtensor::Pallet::<T>::ensure_subnet_owner(origin.clone(), netuid)?;
1690-
pallet_subtensor::Pallet::<T>::set_subnet_owner_hotkey(netuid, &hotkey);
1691-
1692-
log::debug!("SubnetOwnerHotkeySet( netuid: {netuid:?}, hotkey: {hotkey:?} )");
1693-
Ok(())
1694-
}
1670+
// /// Change the SubnetOwnerHotkey for a given subnet.
1671+
// ///
1672+
// /// # Arguments
1673+
// /// * `origin` - The origin of the call, which must be the subnet owner.
1674+
// /// * `netuid` - The unique identifier for the subnet.
1675+
// /// * `hotkey` - The new hotkey for the subnet owner.
1676+
// ///
1677+
// /// # Errors
1678+
// /// * `BadOrigin` - If the caller is not the subnet owner or root account.
1679+
// ///
1680+
// /// # Weight
1681+
// /// Weight is handled by the `#[pallet::weight]` attribute.
1682+
// #[pallet::call_index(64)]
1683+
// #[pallet::weight((0, DispatchClass::Operational, Pays::No))]
1684+
// pub fn sudo_set_subnet_owner_hotkey(
1685+
// origin: OriginFor<T>,
1686+
// netuid: NetUid,
1687+
// hotkey: <T as frame_system::Config>::AccountId,
1688+
// ) -> DispatchResult {
1689+
// pallet_subtensor::Pallet::<T>::ensure_subnet_owner(origin.clone(), netuid)?;
1690+
// pallet_subtensor::Pallet::<T>::set_subnet_owner_hotkey(netuid, &hotkey);
1691+
1692+
// log::debug!("SubnetOwnerHotkeySet( netuid: {netuid:?}, hotkey: {hotkey:?} )");
1693+
// Ok(())
1694+
// }
16951695

16961696
///
16971697
///

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

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1745,48 +1745,48 @@ fn test_sets_a_lower_value_clears_small_nominations() {
17451745
});
17461746
}
17471747

1748-
#[test]
1749-
fn test_sudo_set_subnet_owner_hotkey() {
1750-
new_test_ext().execute_with(|| {
1751-
let netuid = NetUid::from(1);
1752-
1753-
let coldkey: U256 = U256::from(1);
1754-
let hotkey: U256 = U256::from(2);
1755-
let new_hotkey: U256 = U256::from(3);
1756-
1757-
let coldkey_origin = <<Test as Config>::RuntimeOrigin>::signed(coldkey);
1758-
let root = RuntimeOrigin::root();
1759-
let random_account = RuntimeOrigin::signed(U256::from(123456));
1760-
1761-
pallet_subtensor::SubnetOwner::<Test>::insert(netuid, coldkey);
1762-
pallet_subtensor::SubnetOwnerHotkey::<Test>::insert(netuid, hotkey);
1763-
assert_eq!(
1764-
pallet_subtensor::SubnetOwnerHotkey::<Test>::get(netuid),
1765-
hotkey
1766-
);
1767-
1768-
assert_ok!(AdminUtils::sudo_set_subnet_owner_hotkey(
1769-
coldkey_origin,
1770-
netuid,
1771-
new_hotkey
1772-
));
1773-
1774-
assert_eq!(
1775-
pallet_subtensor::SubnetOwnerHotkey::<Test>::get(netuid),
1776-
new_hotkey
1777-
);
1778-
1779-
assert_noop!(
1780-
AdminUtils::sudo_set_subnet_owner_hotkey(random_account, netuid, new_hotkey),
1781-
DispatchError::BadOrigin
1782-
);
1783-
1784-
assert_noop!(
1785-
AdminUtils::sudo_set_subnet_owner_hotkey(root, netuid, new_hotkey),
1786-
DispatchError::BadOrigin
1787-
);
1788-
});
1789-
}
1748+
// #[test]
1749+
// fn test_sudo_set_subnet_owner_hotkey() {
1750+
// new_test_ext().execute_with(|| {
1751+
// let netuid = NetUid::from(1);
1752+
1753+
// let coldkey: U256 = U256::from(1);
1754+
// let hotkey: U256 = U256::from(2);
1755+
// let new_hotkey: U256 = U256::from(3);
1756+
1757+
// let coldkey_origin = <<Test as Config>::RuntimeOrigin>::signed(coldkey);
1758+
// let root = RuntimeOrigin::root();
1759+
// let random_account = RuntimeOrigin::signed(U256::from(123456));
1760+
1761+
// pallet_subtensor::SubnetOwner::<Test>::insert(netuid, coldkey);
1762+
// pallet_subtensor::SubnetOwnerHotkey::<Test>::insert(netuid, hotkey);
1763+
// assert_eq!(
1764+
// pallet_subtensor::SubnetOwnerHotkey::<Test>::get(netuid),
1765+
// hotkey
1766+
// );
1767+
1768+
// assert_ok!(AdminUtils::sudo_set_subnet_owner_hotkey(
1769+
// coldkey_origin,
1770+
// netuid,
1771+
// new_hotkey
1772+
// ));
1773+
1774+
// assert_eq!(
1775+
// pallet_subtensor::SubnetOwnerHotkey::<Test>::get(netuid),
1776+
// new_hotkey
1777+
// );
1778+
1779+
// assert_noop!(
1780+
// AdminUtils::sudo_set_subnet_owner_hotkey(random_account, netuid, new_hotkey),
1781+
// DispatchError::BadOrigin
1782+
// );
1783+
1784+
// assert_noop!(
1785+
// AdminUtils::sudo_set_subnet_owner_hotkey(root, netuid, new_hotkey),
1786+
// DispatchError::BadOrigin
1787+
// );
1788+
// });
1789+
// }
17901790

17911791
// cargo test --package pallet-admin-utils --lib -- tests::test_sudo_set_ema_halving --exact --show-output
17921792
#[test]

0 commit comments

Comments
 (0)