Skip to content

Commit 06013f8

Browse files
author
Samuel Dare
committed
chore: remove childkey take removal
1 parent 531417a commit 06013f8

File tree

3 files changed

+2
-60
lines changed

3 files changed

+2
-60
lines changed

pallets/admin-utils/tests/mock.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,8 @@ parameter_types! {
7979
pub const InitialFoundationDistribution: u64 = 0;
8080
pub const InitialDefaultDelegateTake: u16 = 11_796; // 18% honest number.
8181
pub const InitialMinDelegateTake: u16 = 5_898; // 9%;
82-
pub const InitialDefaultChildKeyTake: u16 = 11_796; // 18% honest number.
83-
pub const InitialMinChildKeyTake: u16 = 5_898; // 9%;
84-
pub const InitialMinTake: u16 = 5_898; // 9%;
82+
pub const InitialDefaultChildKeyTake: u16 = 0; // Allow 0 %
83+
pub const InitialMinChildKeyTake: u16 = 0; // Allow 0 %
8584
pub const InitialWeightsVersionKey: u16 = 0;
8685
pub const InitialServingRateLimit: u64 = 0; // No limit.
8786
pub const InitialTxRateLimit: u64 = 0; // Disable rate limit for testing

pallets/subtensor/src/staking/set_children.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -130,11 +130,6 @@ impl<T: Config> Pallet<T> {
130130
// --- 7.1. Insert my new children + proportion list into the map.
131131
ChildKeys::<T>::insert(hotkey.clone(), netuid, children.clone());
132132

133-
if children.is_empty() {
134-
// If there are no children, remove the ChildkeyTake value
135-
ChildkeyTake::<T>::remove(hotkey.clone(), netuid);
136-
}
137-
138133
// --- 7.2. Update the parents list for my new children.
139134
for (proportion, new_child_i) in children.clone().iter() {
140135
// --- 8.2.1. Get the child's parents on this network.

pallets/subtensor/tests/children.rs

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1622,55 +1622,3 @@ fn test_get_parents_chain() {
16221622
);
16231623
});
16241624
}
1625-
1626-
// SKIP_WASM_BUILD=1 RUST_LOG=info cargo test --test children -- test_childkey_take_removal_on_empty_children --exact --nocapture
1627-
#[test]
1628-
fn test_childkey_take_removal_on_empty_children() {
1629-
new_test_ext(1).execute_with(|| {
1630-
let coldkey = U256::from(1);
1631-
let hotkey = U256::from(2);
1632-
let child = U256::from(3);
1633-
let netuid: u16 = 1;
1634-
let proportion: u64 = 1000;
1635-
1636-
// Add network and register hotkey
1637-
add_network(netuid, 13, 0);
1638-
register_ok_neuron(netuid, hotkey, coldkey, 0);
1639-
1640-
// Set a child and childkey take
1641-
assert_ok!(SubtensorModule::do_set_children(
1642-
RuntimeOrigin::signed(coldkey),
1643-
hotkey,
1644-
netuid,
1645-
vec![(proportion, child)]
1646-
));
1647-
1648-
let take: u16 = u16::MAX / 10; // 10% take
1649-
assert_ok!(SubtensorModule::set_childkey_take(
1650-
RuntimeOrigin::signed(coldkey),
1651-
hotkey,
1652-
netuid,
1653-
take
1654-
));
1655-
1656-
// Verify childkey take is set
1657-
assert_eq!(SubtensorModule::get_childkey_take(&hotkey, netuid), take);
1658-
1659-
// Remove all children
1660-
assert_ok!(SubtensorModule::do_set_children(
1661-
RuntimeOrigin::signed(coldkey),
1662-
hotkey,
1663-
netuid,
1664-
vec![]
1665-
));
1666-
1667-
// Verify children are removed
1668-
let children = SubtensorModule::get_children(&hotkey, netuid);
1669-
assert!(children.is_empty());
1670-
1671-
// Verify childkey take is removed
1672-
assert_eq!(SubtensorModule::get_childkey_take(&hotkey, netuid), 0);
1673-
// Verify childkey take storage is empty
1674-
assert_eq!(ChildkeyTake::<Test>::get(hotkey, netuid), 0);
1675-
});
1676-
}

0 commit comments

Comments
 (0)