Skip to content

Commit 974e0e0

Browse files
authored
Merge pull request #2114 from opentensor/Remove-Duplicate-Setter-snownerhotkey
Remove Duplicate HyperParameter setter
2 parents 4a01966 + bf4ed6a commit 974e0e0

File tree

2 files changed

+43
-47
lines changed

2 files changed

+43
-47
lines changed

pallets/admin-utils/src/lib.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1655,11 +1655,7 @@ pub mod pallet {
16551655
netuid: NetUid,
16561656
hotkey: <T as frame_system::Config>::AccountId,
16571657
) -> DispatchResult {
1658-
pallet_subtensor::Pallet::<T>::ensure_subnet_owner(origin.clone(), netuid)?;
1659-
pallet_subtensor::Pallet::<T>::set_subnet_owner_hotkey(netuid, &hotkey);
1660-
1661-
log::debug!("SubnetOwnerHotkeySet( netuid: {netuid:?}, hotkey: {hotkey:?} )");
1662-
Ok(())
1658+
pallet_subtensor::Pallet::<T>::do_set_sn_owner_hotkey(origin, netuid, &hotkey)
16631659
}
16641660

16651661
///

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

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1712,48 +1712,48 @@ fn test_sets_a_lower_value_clears_small_nominations() {
17121712
});
17131713
}
17141714

1715-
#[test]
1716-
fn test_sudo_set_subnet_owner_hotkey() {
1717-
new_test_ext().execute_with(|| {
1718-
let netuid = NetUid::from(1);
1719-
1720-
let coldkey: U256 = U256::from(1);
1721-
let hotkey: U256 = U256::from(2);
1722-
let new_hotkey: U256 = U256::from(3);
1723-
1724-
let coldkey_origin = <<Test as Config>::RuntimeOrigin>::signed(coldkey);
1725-
let root = RuntimeOrigin::root();
1726-
let random_account = RuntimeOrigin::signed(U256::from(123456));
1727-
1728-
pallet_subtensor::SubnetOwner::<Test>::insert(netuid, coldkey);
1729-
pallet_subtensor::SubnetOwnerHotkey::<Test>::insert(netuid, hotkey);
1730-
assert_eq!(
1731-
pallet_subtensor::SubnetOwnerHotkey::<Test>::get(netuid),
1732-
hotkey
1733-
);
1734-
1735-
assert_ok!(AdminUtils::sudo_set_subnet_owner_hotkey(
1736-
coldkey_origin,
1737-
netuid,
1738-
new_hotkey
1739-
));
1740-
1741-
assert_eq!(
1742-
pallet_subtensor::SubnetOwnerHotkey::<Test>::get(netuid),
1743-
new_hotkey
1744-
);
1745-
1746-
assert_noop!(
1747-
AdminUtils::sudo_set_subnet_owner_hotkey(random_account, netuid, new_hotkey),
1748-
DispatchError::BadOrigin
1749-
);
1750-
1751-
assert_noop!(
1752-
AdminUtils::sudo_set_subnet_owner_hotkey(root, netuid, new_hotkey),
1753-
DispatchError::BadOrigin
1754-
);
1755-
});
1756-
}
1715+
// #[test]
1716+
// fn test_sudo_set_subnet_owner_hotkey() {
1717+
// new_test_ext().execute_with(|| {
1718+
// let netuid = NetUid::from(1);
1719+
1720+
// let coldkey: U256 = U256::from(1);
1721+
// let hotkey: U256 = U256::from(2);
1722+
// let new_hotkey: U256 = U256::from(3);
1723+
1724+
// let coldkey_origin = <<Test as Config>::RuntimeOrigin>::signed(coldkey);
1725+
// let root = RuntimeOrigin::root();
1726+
// let random_account = RuntimeOrigin::signed(U256::from(123456));
1727+
1728+
// pallet_subtensor::SubnetOwner::<Test>::insert(netuid, coldkey);
1729+
// pallet_subtensor::SubnetOwnerHotkey::<Test>::insert(netuid, hotkey);
1730+
// assert_eq!(
1731+
// pallet_subtensor::SubnetOwnerHotkey::<Test>::get(netuid),
1732+
// hotkey
1733+
// );
1734+
1735+
// assert_ok!(AdminUtils::sudo_set_subnet_owner_hotkey(
1736+
// coldkey_origin,
1737+
// netuid,
1738+
// new_hotkey
1739+
// ));
1740+
1741+
// assert_eq!(
1742+
// pallet_subtensor::SubnetOwnerHotkey::<Test>::get(netuid),
1743+
// new_hotkey
1744+
// );
1745+
1746+
// assert_noop!(
1747+
// AdminUtils::sudo_set_subnet_owner_hotkey(random_account, netuid, new_hotkey),
1748+
// DispatchError::BadOrigin
1749+
// );
1750+
1751+
// assert_noop!(
1752+
// AdminUtils::sudo_set_subnet_owner_hotkey(root, netuid, new_hotkey),
1753+
// DispatchError::BadOrigin
1754+
// );
1755+
// });
1756+
// }
17571757

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

0 commit comments

Comments
 (0)