@@ -84,7 +84,7 @@ pub mod pallet {
8484
8585 /// Tracks version for migrations. Should be monotonic with respect to the
8686 /// order of migrations. (i.e. always increasing)
87- const STORAGE_VERSION : StorageVersion = StorageVersion :: new ( 6 ) ;
87+ const STORAGE_VERSION : StorageVersion = StorageVersion :: new ( 7 ) ;
8888
8989 /// Minimum balance required to perform a coldkey swap
9090 pub const MIN_BALANCE_TO_PERFORM_COLDKEY_SWAP : u64 = 100_000_000 ; // 0.1 TAO in RAO
@@ -247,7 +247,7 @@ pub mod pallet {
247247 type InitialTargetStakesPerInterval : Get < u64 > ;
248248 /// Cost of swapping a hotkey.
249249 #[ pallet:: constant]
250- type HotkeySwapCost : Get < u64 > ;
250+ type KeySwapCost : Get < u64 > ;
251251 /// The upper bound for the alpha parameter. Used for Liquid Alpha.
252252 #[ pallet:: constant]
253253 type AlphaHigh : Get < u16 > ;
@@ -1140,6 +1140,9 @@ pub mod pallet {
11401140 DefaultBonds < T > ,
11411141 > ;
11421142
1143+ #[ pallet:: storage] // --- Storage for migration run status
1144+ pub type HasMigrationRun < T : Config > = StorageMap < _ , Identity , Vec < u8 > , bool , ValueQuery > ;
1145+
11431146 /// ==================
11441147 /// ==== Genesis =====
11451148 /// ==================
@@ -1419,7 +1422,9 @@ pub mod pallet {
14191422 // Populate OwnedHotkeys map for coldkey swap. Doesn't update storage vesion.
14201423 . saturating_add ( migration:: migrate_populate_owned :: < T > ( ) )
14211424 // Populate StakingHotkeys map for coldkey swap. Doesn't update storage vesion.
1422- . saturating_add ( migration:: migrate_populate_staking_hotkeys :: < T > ( ) ) ;
1425+ . saturating_add ( migration:: migrate_populate_staking_hotkeys :: < T > ( ) )
1426+ // Fix total coldkey stake.
1427+ . saturating_add ( migration:: migrate_fix_total_coldkey_stake :: < T > ( ) ) ;
14231428
14241429 weight
14251430 }
@@ -2038,6 +2043,15 @@ pub mod pallet {
20382043 Self :: do_root_register ( origin, hotkey)
20392044 }
20402045
2046+ /// Attempt to adjust the senate membership to include a hotkey
2047+ #[ pallet:: call_index( 63 ) ]
2048+ #[ pallet:: weight( ( Weight :: from_parts( 0 , 0 )
2049+ . saturating_add( T :: DbWeight :: get( ) . reads( 0 ) )
2050+ . saturating_add( T :: DbWeight :: get( ) . writes( 0 ) ) , DispatchClass :: Normal , Pays :: Yes ) ) ]
2051+ pub fn adjust_senate ( origin : OriginFor < T > , hotkey : T :: AccountId ) -> DispatchResult {
2052+ Self :: do_adjust_senate ( origin, hotkey)
2053+ }
2054+
20412055 /// User register a new subnetwork via burning token
20422056 #[ pallet:: call_index( 7 ) ]
20432057 #[ pallet:: weight( ( Weight :: from_parts( 177_000_000 , 0 )
@@ -2052,17 +2066,17 @@ pub mod pallet {
20522066 }
20532067
20542068 /// The extrinsic for user to change its hotkey
2055- #[ pallet:: call_index( 70 ) ]
2056- #[ pallet:: weight( ( Weight :: from_parts( 1_940_000_000 , 0 )
2057- . saturating_add( T :: DbWeight :: get( ) . reads( 272 ) )
2058- . saturating_add( T :: DbWeight :: get( ) . writes( 527 ) ) , DispatchClass :: Operational , Pays :: No ) ) ]
2059- pub fn swap_hotkey (
2060- origin : OriginFor < T > ,
2061- hotkey : T :: AccountId ,
2062- new_hotkey : T :: AccountId ,
2063- ) -> DispatchResultWithPostInfo {
2064- Self :: do_swap_hotkey ( origin, & hotkey, & new_hotkey)
2065- }
2069+ /// #[pallet::call_index(70)]
2070+ /// #[pallet::weight((Weight::from_parts(1_940_000_000, 0)
2071+ /// .saturating_add(T::DbWeight::get().reads(272))
2072+ /// .saturating_add(T::DbWeight::get().writes(527)), DispatchClass::Operational, Pays::No))]
2073+ /// pub fn swap_hotkey(
2074+ /// origin: OriginFor<T>,
2075+ /// hotkey: T::AccountId,
2076+ /// new_hotkey: T::AccountId,
2077+ /// ) -> DispatchResultWithPostInfo {
2078+ /// Self::do_swap_hotkey(origin, &hotkey, &new_hotkey)
2079+ /// }
20662080
20672081 /// The extrinsic for user to change the coldkey associated with their account.
20682082 ///
@@ -2089,7 +2103,6 @@ pub mod pallet {
20892103 ) -> DispatchResultWithPostInfo {
20902104 Self :: do_swap_coldkey ( origin, & new_coldkey)
20912105 }
2092-
20932106 /// Unstakes all tokens associated with a hotkey and transfers them to a new coldkey.
20942107 ///
20952108 /// # Arguments
@@ -2105,6 +2118,7 @@ pub mod pallet {
21052118 /// # Weight
21062119 ///
21072120 /// Weight is calculated based on the number of database reads and writes.
2121+ #[ cfg( test) ]
21082122 #[ pallet:: call_index( 72 ) ]
21092123 #[ pallet:: weight( ( Weight :: from_parts( 21_000_000 , 0 )
21102124 . saturating_add( T :: DbWeight :: get( ) . reads( 3 ) )
@@ -2244,6 +2258,17 @@ pub mod pallet {
22442258 pub fn dissolve_network ( origin : OriginFor < T > , netuid : u16 ) -> DispatchResult {
22452259 Self :: user_remove_network ( origin, netuid)
22462260 }
2261+
2262+ /// Sets values for liquid alpha
2263+ #[ pallet:: call_index( 64 ) ]
2264+ #[ pallet:: weight( ( 0 , DispatchClass :: Operational , Pays :: No ) ) ]
2265+ pub fn sudo_hotfix_swap_coldkey_delegates (
2266+ _origin : OriginFor < T > ,
2267+ _old_coldkey : T :: AccountId ,
2268+ _new_coldkey : T :: AccountId ,
2269+ ) -> DispatchResult {
2270+ Ok ( ( ) )
2271+ }
22472272 }
22482273
22492274 // ---- Subtensor helper functions.
0 commit comments