@@ -706,7 +706,7 @@ mod dispatches {
706706 ///
707707 #[ pallet:: call_index( 2 ) ]
708708 #[ pallet:: weight( ( Weight :: from_parts( 340_800_000 , 0 )
709- . saturating_add( T :: DbWeight :: get( ) . reads( 26 ) )
709+ . saturating_add( T :: DbWeight :: get( ) . reads( 24_u64 ) )
710710 . saturating_add( T :: DbWeight :: get( ) . writes( 15 ) ) , DispatchClass :: Normal , Pays :: Yes ) ) ]
711711 pub fn add_stake (
712712 origin : OriginFor < T > ,
@@ -1671,7 +1671,7 @@ mod dispatches {
16711671 /// - Thrown if key has hit transaction rate limit
16721672 #[ pallet:: call_index( 84 ) ]
16731673 #[ pallet:: weight( ( Weight :: from_parts( 358_500_000 , 0 )
1674- . saturating_add( T :: DbWeight :: get( ) . reads( 38_u64 ) )
1674+ . saturating_add( T :: DbWeight :: get( ) . reads( 36_u64 ) )
16751675 . saturating_add( T :: DbWeight :: get( ) . writes( 21_u64 ) ) , DispatchClass :: Operational , Pays :: Yes ) ) ]
16761676 pub fn unstake_all_alpha ( origin : OriginFor < T > , hotkey : T :: AccountId ) -> DispatchResult {
16771677 Self :: do_unstake_all_alpha ( origin, hotkey)
@@ -1785,7 +1785,7 @@ mod dispatches {
17851785 #[ pallet:: call_index( 87 ) ]
17861786 #[ pallet:: weight( (
17871787 Weight :: from_parts( 351_300_000 , 0 )
1788- . saturating_add( T :: DbWeight :: get( ) . reads( 37_u64 ) )
1788+ . saturating_add( T :: DbWeight :: get( ) . reads( 35_u64 ) )
17891789 . saturating_add( T :: DbWeight :: get( ) . writes( 22_u64 ) ) ,
17901790 DispatchClass :: Normal ,
17911791 Pays :: Yes
@@ -1850,7 +1850,7 @@ mod dispatches {
18501850 ///
18511851 #[ pallet:: call_index( 88 ) ]
18521852 #[ pallet:: weight( ( Weight :: from_parts( 402_900_000 , 0 )
1853- . saturating_add( T :: DbWeight :: get( ) . reads( 26 ) )
1853+ . saturating_add( T :: DbWeight :: get( ) . reads( 24_u64 ) )
18541854 . saturating_add( T :: DbWeight :: get( ) . writes( 15 ) ) , DispatchClass :: Normal , Pays :: Yes ) ) ]
18551855 pub fn add_stake_limit (
18561856 origin : OriginFor < T > ,
@@ -1914,7 +1914,7 @@ mod dispatches {
19141914 ///
19151915 #[ pallet:: call_index( 89 ) ]
19161916 #[ pallet:: weight( ( Weight :: from_parts( 377_400_000 , 0 )
1917- . saturating_add( T :: DbWeight :: get( ) . reads( 30_u64 ) )
1917+ . saturating_add( T :: DbWeight :: get( ) . reads( 28_u64 ) )
19181918 . saturating_add( T :: DbWeight :: get( ) . writes( 14 ) ) , DispatchClass :: Normal , Pays :: Yes ) ) ]
19191919 pub fn remove_stake_limit (
19201920 origin : OriginFor < T > ,
@@ -1958,7 +1958,7 @@ mod dispatches {
19581958 #[ pallet:: call_index( 90 ) ]
19591959 #[ pallet:: weight( (
19601960 Weight :: from_parts( 411_500_000 , 0 )
1961- . saturating_add( T :: DbWeight :: get( ) . reads( 37_u64 ) )
1961+ . saturating_add( T :: DbWeight :: get( ) . reads( 35_u64 ) )
19621962 . saturating_add( T :: DbWeight :: get( ) . writes( 22_u64 ) ) ,
19631963 DispatchClass :: Normal ,
19641964 Pays :: Yes
@@ -2136,7 +2136,7 @@ mod dispatches {
21362136 /// Without limit_price it remove all the stake similar to `remove_stake` extrinsic
21372137 #[ pallet:: call_index( 103 ) ]
21382138 #[ pallet:: weight( ( Weight :: from_parts( 395_300_000 , 10142 )
2139- . saturating_add( T :: DbWeight :: get( ) . reads( 30_u64 ) )
2139+ . saturating_add( T :: DbWeight :: get( ) . reads( 28_u64 ) )
21402140 . saturating_add( T :: DbWeight :: get( ) . writes( 14_u64 ) ) , DispatchClass :: Normal , Pays :: Yes ) ) ]
21412141 pub fn remove_stake_full_limit (
21422142 origin : T :: RuntimeOrigin ,
@@ -2313,9 +2313,20 @@ mod dispatches {
23132313 current_hotkey != hotkey,
23142314 Error :: <T >:: SameAutoStakeHotkeyAlreadySet
23152315 ) ;
2316+
2317+ // Remove the coldkey from the old hotkey (if present)
2318+ AutoStakeDestinationColdkeys :: < T > :: mutate ( current_hotkey. clone ( ) , netuid, |v| {
2319+ v. retain ( |c| c != & coldkey) ;
2320+ } ) ;
23162321 }
23172322
2323+ // Add the coldkey to the new hotkey (if not already present)
23182324 AutoStakeDestination :: < T > :: insert ( coldkey. clone ( ) , netuid, hotkey. clone ( ) ) ;
2325+ AutoStakeDestinationColdkeys :: < T > :: mutate ( hotkey. clone ( ) , netuid, |v| {
2326+ if !v. contains ( & coldkey) {
2327+ v. push ( coldkey. clone ( ) ) ;
2328+ }
2329+ } ) ;
23192330
23202331 Self :: deposit_event ( Event :: AutoStakeDestinationSet {
23212332 coldkey,
0 commit comments