Skip to content

Commit 765808d

Browse files
committed
Extend test_set_child_keys_empty_vector_clears_storage to parent keys
1 parent 41d2207 commit 765808d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

pallets/subtensor/src/tests/children.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4183,9 +4183,11 @@ fn test_set_child_keys_empty_vector_clears_storage() {
41834183

41844184
// Initialize ChildKeys for `parent` with a non-empty vector
41854185
ChildKeys::<Test>::insert(parent, netuid, vec![(u64::MAX, child)]);
4186+
ParentKeys::<Test>::insert(child, netuid, vec![(u64::MAX, parent)]);
41864187

41874188
// Sanity: entry exists right now because we explicitly inserted it
41884189
assert!(ChildKeys::<Test>::contains_key(parent, netuid));
4190+
assert!(ParentKeys::<Test>::contains_key(child, netuid));
41894191

41904192
// Set children to empty
41914193
let empty_children: Vec<(u64, U256)> = Vec::new();
@@ -4194,8 +4196,10 @@ fn test_set_child_keys_empty_vector_clears_storage() {
41944196
// When the child vector is empty, we should NOT keep an empty vec in storage.
41954197
// The key must be fully removed (no entry), not just zero-length value.
41964198
assert!(!ChildKeys::<Test>::contains_key(parent, netuid));
4199+
assert!(!ParentKeys::<Test>::contains_key(child, netuid));
41974200

41984201
// `get` returns empty due to ValueQuery default, but presence is false.
41994202
assert!(ChildKeys::<Test>::get(parent, netuid).is_empty());
4203+
assert!(ParentKeys::<Test>::get(child, netuid).is_empty());
42004204
});
42014205
}

0 commit comments

Comments
 (0)