@@ -231,6 +231,64 @@ fn test_do_move_nonexistent_origin_hotkey() {
231
231
} ) ;
232
232
}
233
233
234
+ // // SKIP_WASM_BUILD=1 RUST_LOG=debug cargo test --test move -- test_do_move_nonexistent_destination_hotkey --exact --nocapture
235
+ // #[test]
236
+ // fn test_do_move_nonexistent_destination_hotkey() {
237
+ // new_test_ext(1).execute_with(|| {
238
+ // let subnet_owner_coldkey = U256::from(1001);
239
+ // let subnet_owner_hotkey = U256::from(1002);
240
+ // let netuid = add_dynamic_network(&subnet_owner_hotkey, &subnet_owner_coldkey);
241
+ // let coldkey = U256::from(1);
242
+ // let origin_hotkey = U256::from(99); // Assuming this hotkey doesn't exist
243
+ // let nonexistent_destination_hotkey = U256::from(3);
244
+
245
+ // // Set up initial stake
246
+ // SubtensorModule::stake_into_subnet(
247
+ // &origin_hotkey,
248
+ // &coldkey,
249
+ // origin_netuid,
250
+ // stake_amount,
251
+ // fee,
252
+ // );
253
+ // let alpha = SubtensorModule::get_stake_for_hotkey_and_coldkey_on_subnet(
254
+ // &origin_hotkey,
255
+ // &coldkey,
256
+ // origin_netuid,
257
+ // );
258
+
259
+ // // Attempt to move stake from a non-existent origin hotkey
260
+ // assert_noop!(
261
+ // SubtensorModule::do_move_stake(
262
+ // RuntimeOrigin::signed(coldkey),
263
+ // origin_hotkey,
264
+ // nonexistent_destination_hotkey,
265
+ // netuid,
266
+ // netuid,
267
+ // alpha
268
+ // ),
269
+ // Error::<Test>::HotKeyAccountNotExists
270
+ // );
271
+
272
+ // // Check that no stake was moved
273
+ // assert_eq!(
274
+ // SubtensorModule::get_stake_for_hotkey_and_coldkey_on_subnet(
275
+ // &origin_hotkey,
276
+ // &coldkey,
277
+ // netuid
278
+ // ),
279
+ // alpha
280
+ // );
281
+ // assert_eq!(
282
+ // SubtensorModule::get_stake_for_hotkey_and_coldkey_on_subnet(
283
+ // &nonexistent_destination_hotkey,
284
+ // &coldkey,
285
+ // netuid
286
+ // ),
287
+ // 0
288
+ // );
289
+ // });
290
+ // }
291
+
234
292
// 6. test_do_move_nonexistent_destination_hotkey
235
293
// Description: Attempt to move stake to a non-existent destination hotkey, which should fail
236
294
// SKIP_WASM_BUILD=1 RUST_LOG=debug cargo test --test move -- test_do_move_nonexistent_destination_hotkey --exact --nocapture
@@ -245,7 +303,9 @@ fn test_do_move_nonexistent_destination_hotkey() {
245
303
let fee = 0 ;
246
304
247
305
// Set up initial stake
248
- SubtensorModule :: stake_into_subnet ( & origin_hotkey, & coldkey, netuid, stake_amount, fee) ;
306
+ SubtensorModule :: create_account_if_non_existent ( & coldkey, & origin_hotkey) ;
307
+ let alpha =
308
+ SubtensorModule :: stake_into_subnet ( & origin_hotkey, & coldkey, netuid, stake_amount, fee) ;
249
309
250
310
// Attempt to move stake from a non-existent origin hotkey
251
311
add_network ( netuid, 1 , 0 ) ;
@@ -256,12 +316,12 @@ fn test_do_move_nonexistent_destination_hotkey() {
256
316
nonexistent_destination_hotkey,
257
317
netuid,
258
318
netuid,
259
- 1234
319
+ alpha
260
320
) ,
261
321
Error :: <Test >:: HotKeyAccountNotExists
262
322
) ;
263
323
264
- // Check that the stake was moved successfully
324
+ // Check that the stake was not moved
265
325
assert_eq ! (
266
326
SubtensorModule :: get_stake_for_hotkey_and_coldkey_on_subnet(
267
327
& origin_hotkey,
0 commit comments