@@ -84,7 +84,7 @@ pub mod pallet {
84
84
85
85
/// Tracks version for migrations. Should be monotonic with respect to the
86
86
/// order of migrations. (i.e. always increasing)
87
- const STORAGE_VERSION : StorageVersion = StorageVersion :: new ( 6 ) ;
87
+ const STORAGE_VERSION : StorageVersion = StorageVersion :: new ( 7 ) ;
88
88
89
89
/// Minimum balance required to perform a coldkey swap
90
90
pub const MIN_BALANCE_TO_PERFORM_COLDKEY_SWAP : u64 = 100_000_000 ; // 0.1 TAO in RAO
@@ -247,7 +247,7 @@ pub mod pallet {
247
247
type InitialTargetStakesPerInterval : Get < u64 > ;
248
248
/// Cost of swapping a hotkey.
249
249
#[ pallet:: constant]
250
- type HotkeySwapCost : Get < u64 > ;
250
+ type KeySwapCost : Get < u64 > ;
251
251
/// The upper bound for the alpha parameter. Used for Liquid Alpha.
252
252
#[ pallet:: constant]
253
253
type AlphaHigh : Get < u16 > ;
@@ -1140,6 +1140,9 @@ pub mod pallet {
1140
1140
DefaultBonds < T > ,
1141
1141
> ;
1142
1142
1143
+ #[ pallet:: storage] // --- Storage for migration run status
1144
+ pub type HasMigrationRun < T : Config > = StorageMap < _ , Identity , Vec < u8 > , bool , ValueQuery > ;
1145
+
1143
1146
/// ==================
1144
1147
/// ==== Genesis =====
1145
1148
/// ==================
@@ -1419,7 +1422,9 @@ pub mod pallet {
1419
1422
// Populate OwnedHotkeys map for coldkey swap. Doesn't update storage vesion.
1420
1423
. saturating_add ( migration:: migrate_populate_owned :: < T > ( ) )
1421
1424
// 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 > ( ) ) ;
1423
1428
1424
1429
weight
1425
1430
}
@@ -2038,6 +2043,15 @@ pub mod pallet {
2038
2043
Self :: do_root_register ( origin, hotkey)
2039
2044
}
2040
2045
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
+
2041
2055
/// User register a new subnetwork via burning token
2042
2056
#[ pallet:: call_index( 7 ) ]
2043
2057
#[ pallet:: weight( ( Weight :: from_parts( 177_000_000 , 0 )
@@ -2052,17 +2066,17 @@ pub mod pallet {
2052
2066
}
2053
2067
2054
2068
/// 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
+ /// }
2066
2080
2067
2081
/// The extrinsic for user to change the coldkey associated with their account.
2068
2082
///
@@ -2089,7 +2103,6 @@ pub mod pallet {
2089
2103
) -> DispatchResultWithPostInfo {
2090
2104
Self :: do_swap_coldkey ( origin, & new_coldkey)
2091
2105
}
2092
-
2093
2106
/// Unstakes all tokens associated with a hotkey and transfers them to a new coldkey.
2094
2107
///
2095
2108
/// # Arguments
@@ -2105,6 +2118,7 @@ pub mod pallet {
2105
2118
/// # Weight
2106
2119
///
2107
2120
/// Weight is calculated based on the number of database reads and writes.
2121
+ #[ cfg( test) ]
2108
2122
#[ pallet:: call_index( 72 ) ]
2109
2123
#[ pallet:: weight( ( Weight :: from_parts( 21_000_000 , 0 )
2110
2124
. saturating_add( T :: DbWeight :: get( ) . reads( 3 ) )
@@ -2244,6 +2258,17 @@ pub mod pallet {
2244
2258
pub fn dissolve_network ( origin : OriginFor < T > , netuid : u16 ) -> DispatchResult {
2245
2259
Self :: user_remove_network ( origin, netuid)
2246
2260
}
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
+ }
2247
2272
}
2248
2273
2249
2274
// ---- Subtensor helper functions.
0 commit comments