Skip to content

Commit

Permalink
Fix test_add_stake_ok_neuron_does_not_belong_to_coldkey
Browse files Browse the repository at this point in the history
  • Loading branch information
gztensor committed Jan 7, 2025
1 parent d57d2f3 commit 3d3c82d
Showing 1 changed file with 14 additions and 25 deletions.
39 changes: 14 additions & 25 deletions pallets/subtensor/src/tests/staking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,34 +169,23 @@ fn test_add_stake_not_registered_key_pair() {
}

#[test]
fn test_add_stake_err_neuron_does_not_belong_to_coldkey() {
fn test_add_stake_ok_neuron_does_not_belong_to_coldkey() {
new_test_ext(1).execute_with(|| {
assert!(false);

// let coldkey_id = U256::from(544);
// let hotkey_id = U256::from(54544);
// let other_cold_key = U256::from(99498);
// let netuid: u16 = 1;
// let tempo: u16 = 13;
// let start_nonce: u64 = 0;

// //add network
// add_network(netuid, tempo, 0);
let coldkey_id = U256::from(544);
let hotkey_id = U256::from(54544);
let other_cold_key = U256::from(99498);
let netuid: u16 = add_dynamic_network(&hotkey_id, &coldkey_id);

// register_ok_neuron(netuid, hotkey_id, coldkey_id, start_nonce);
// // Give it some $$$ in his coldkey balance
// SubtensorModule::add_balance_to_coldkey_account(&other_cold_key, 100000);
// Give it some $$$ in his coldkey balance
SubtensorModule::add_balance_to_coldkey_account(&other_cold_key, 100000);

// // Perform the request which is signed by a different cold key
// let result = SubtensorModule::add_stake(
// <<Test as Config>::RuntimeOrigin>::signed(other_cold_key),
// hotkey_id,
// 1000,
// );
// assert_eq!(
// result,
// Err(Error::<Test>::HotKeyNotDelegateAndSignerNotOwnHotKey.into())
// );
// Perform the request which is signed by a different cold key
assert_ok!(SubtensorModule::add_stake(
<<Test as Config>::RuntimeOrigin>::signed(other_cold_key),
hotkey_id,
netuid,
1000,
));
});
}

Expand Down

0 comments on commit 3d3c82d

Please sign in to comment.