@@ -2490,3 +2490,73 @@ fn test_anneal_global_weight() {
2490
2490
) ;
2491
2491
} ) ;
2492
2492
}
2493
+
2494
+ // https://github.com/opentensor/subtensor/issues/925
2495
+ // RUST_LOG=warn cargo test -p pallet-subtensor --test staking -- test_stake_weight_should_not_be_affected_by_zero_stakes --exact --nocapture
2496
+ #[ test]
2497
+ fn test_stake_weight_should_not_be_affected_by_zero_stakes ( ) {
2498
+ new_test_ext ( 1 ) . execute_with ( || {
2499
+ let registrar = AccountId :: from ( 42 ) ;
2500
+ Balances :: force_set_balance ( RuntimeOrigin :: root ( ) , registrar, 10_000_000_000_000 ) . unwrap ( ) ;
2501
+
2502
+ // the root subnet
2503
+ SubtensorModule :: register_network_with_identity (
2504
+ RuntimeOrigin :: signed ( registrar) ,
2505
+ registrar,
2506
+ 1 ,
2507
+ None ,
2508
+ )
2509
+ . unwrap ( ) ;
2510
+
2511
+ // our test subnet with id 1
2512
+ SubtensorModule :: register_network_with_identity (
2513
+ RuntimeOrigin :: signed ( registrar) ,
2514
+ registrar,
2515
+ 1 ,
2516
+ None ,
2517
+ )
2518
+ . unwrap ( ) ;
2519
+
2520
+
2521
+ // SubtensorModule::add_stake(
2522
+ // RuntimeOrigin::signed(registrar),
2523
+ // registrar,
2524
+ // 1,
2525
+ // 1000_000_000_000,
2526
+ // )
2527
+ // .unwrap();
2528
+
2529
+ // step_epochs(1, 1);
2530
+
2531
+
2532
+ let neuron_1 = AccountId :: from ( 123 ) ;
2533
+ Balances :: force_set_balance ( RuntimeOrigin :: root ( ) , neuron_1, 10_000_000_000_000 ) . unwrap ( ) ;
2534
+
2535
+ SubtensorModule :: burned_register ( RuntimeOrigin :: signed ( neuron_1) , 1 , neuron_1) . unwrap ( ) ;
2536
+ SubtensorModule :: add_stake (
2537
+ RuntimeOrigin :: signed ( neuron_1) ,
2538
+ neuron_1,
2539
+ 1 ,
2540
+ 1000_000_000_000 ,
2541
+ )
2542
+ . unwrap ( ) ;
2543
+
2544
+ // step_epochs(1, 1);
2545
+
2546
+ let neuron_2 = AccountId :: from ( 321 ) ;
2547
+ Balances :: force_set_balance ( RuntimeOrigin :: root ( ) , neuron_2, 10_000_000_000_000 ) . unwrap ( ) ;
2548
+
2549
+ SubtensorModule :: burned_register ( RuntimeOrigin :: signed ( neuron_2) , 1 , neuron_2) . unwrap ( ) ;
2550
+ SubtensorModule :: add_stake (
2551
+ RuntimeOrigin :: signed ( neuron_2) ,
2552
+ neuron_2,
2553
+ 1 ,
2554
+ 1000_000_000_000 ,
2555
+ )
2556
+ . unwrap ( ) ;
2557
+ SubtensorModule :: epoch ( 1 , 10_000_000_000_000 ) ;
2558
+ // step_epochs(1, 1);
2559
+
2560
+ dbg ! ( SubtensorModule :: get_neurons( 1 ) ) ;
2561
+ } ) ;
2562
+ }
0 commit comments