@@ -1184,6 +1184,14 @@ fn test_swap_stake_for_coldkey() {
11841184 Stake :: < Test > :: insert ( hotkey1, old_coldkey, stake_amount1) ;
11851185 Stake :: < Test > :: insert ( hotkey2, old_coldkey, stake_amount2) ;
11861186
1187+ // Initialize TotalHotkeyStake
1188+ TotalHotkeyStake :: < Test > :: insert ( hotkey1, stake_amount1) ;
1189+ TotalHotkeyStake :: < Test > :: insert ( hotkey2, stake_amount2) ;
1190+
1191+ // Initialize TotalStake and TotalIssuance
1192+ TotalStake :: < Test > :: put ( stake_amount1 + stake_amount2) ;
1193+ TotalIssuance :: < Test > :: put ( stake_amount1 + stake_amount2) ;
1194+
11871195 // Populate OwnedHotkeys map
11881196 OwnedHotkeys :: < Test > :: insert ( old_coldkey, vec ! [ hotkey1, hotkey2] ) ;
11891197
@@ -1195,10 +1203,15 @@ fn test_swap_stake_for_coldkey() {
11951203 assert_eq ! ( Stake :: <Test >:: get( hotkey2, new_coldkey) , stake_amount2) ;
11961204 assert ! ( !Stake :: <Test >:: contains_key( hotkey1, old_coldkey) ) ;
11971205 assert ! ( !Stake :: <Test >:: contains_key( hotkey2, old_coldkey) ) ;
1206+
1207+ // Verify TotalHotkeyStake remains unchanged
11981208 assert_eq ! ( TotalHotkeyStake :: <Test >:: get( hotkey1) , stake_amount1) ;
11991209 assert_eq ! ( TotalHotkeyStake :: <Test >:: get( hotkey2) , stake_amount2) ;
1210+
1211+ // Verify TotalStake and TotalIssuance remain unchanged
12001212 assert_eq ! ( TotalStake :: <Test >:: get( ) , stake_amount1 + stake_amount2) ;
12011213 assert_eq ! ( TotalIssuance :: <Test >:: get( ) , stake_amount1 + stake_amount2) ;
1214+
12021215 // Verify weight update
12031216 let expected_weight = <Test as frame_system:: Config >:: DbWeight :: get ( ) . reads_writes ( 3 , 4 ) ;
12041217 assert_eq ! ( weight, expected_weight) ;
0 commit comments