Skip to content

Commit bf319da

Browse files
committed
not sure how to expose AdminUtils to submod tests
1 parent 7e5ccd5 commit bf319da

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

pallets/subtensor/src/tests/staking2.rs

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -623,3 +623,39 @@ fn test_try_associate_hotkey() {
623623
assert_eq!(SubtensorModule::get_owned_hotkeys(&coldkey2).len(), 0);
624624
});
625625
}
626+
627+
628+
629+
#[test]
630+
fn sets_a_lower_value_clears_small_nominations() {
631+
new_test_ext(1).execute_with(|| {
632+
let subnet_owner_hotkey: U256 = U256::from(1);
633+
let subnet_owner_coldkey: U256 = U256::from(1 + 456);
634+
let other_coldkey: U256 = U256::from(2 + 456);
635+
let other_hotkey: U256 = U256::from(3);
636+
let staker_coldkey: U256 = U256::from(4);
637+
638+
// Create network
639+
let netuid = add_dynamic_network(&subnet_owner_hotkey, &subnet_owner_coldkey);
640+
641+
// Register a neuron
642+
register_ok_neuron(netuid, other_hotkey, other_coldkey, 0);
643+
644+
// Stake to the hotkey as staker_coldkey
645+
SubtensorModule::increase_stake_for_hotkey_and_coldkey_on_subnet(&other_hotkey, &other_coldkey, netuid, 1000);
646+
647+
648+
assert_ok!(AdminUtils::sudo_set_nominator_min_required_stake(
649+
RuntimeOrigin::root(),
650+
10u64
651+
));
652+
assert_eq!(SubtensorModule::get_nominator_min_required_stake(), 10u64);
653+
654+
655+
assert_ok!(AdminUtils::sudo_set_nominator_min_required_stake(
656+
RuntimeOrigin::root(),
657+
5u64
658+
));
659+
assert_eq!(SubtensorModule::get_nominator_min_required_stake(), 5u64);
660+
});
661+
}

0 commit comments

Comments
 (0)