@@ -44,7 +44,8 @@ mod registration;
44
44
mod root;
45
45
mod serving;
46
46
mod staking;
47
- mod swap;
47
+ mod swap_coldkey;
48
+ mod swap_hotkey;
48
49
mod uids;
49
50
mod utils;
50
51
mod weights;
@@ -272,7 +273,7 @@ pub mod pallet {
272
273
}
273
274
274
275
#[ pallet:: storage]
275
- pub ( super ) type SenateRequiredStakePercentage < T > =
276
+ pub type SenateRequiredStakePercentage < T > =
276
277
StorageValue < _ , u64 , ValueQuery , DefaultSenateRequiredStakePercentage < T > > ;
277
278
278
279
/// ============================
@@ -367,7 +368,7 @@ pub mod pallet {
367
368
pub type TotalColdkeyStake < T : Config > =
368
369
StorageMap < _ , Identity , T :: AccountId , u64 , ValueQuery , DefaultAccountTake < T > > ;
369
370
#[ pallet:: storage]
370
- /// MAP (hot, cold) --> stake | Returns a tuple (u64: stakes, u64: block_number)
371
+ /// MAP (hot, cold) --> u64, u64) | Returns a tuple (u64: stakes, u64: block_number)
371
372
pub type TotalHotkeyColdkeyStakesThisInterval < T : Config > = StorageDoubleMap <
372
373
_ ,
373
374
Identity ,
@@ -725,7 +726,7 @@ pub mod pallet {
725
726
#[ pallet:: storage] // --- MAP ( netuid ) --> last_mechanism_step_block
726
727
pub type LastMechansimStepBlock < T > =
727
728
StorageMap < _ , Identity , u16 , u64 , ValueQuery , DefaultLastMechanismStepBlock < T > > ;
728
- #[ pallet:: storage] // --- MAP ( netuid ) --> subnet_owner
729
+ #[ pallet:: storage] // --- MAP ( netuid ) --> (cold) subnet_owner
729
730
pub type SubnetOwner < T : Config > =
730
731
StorageMap < _ , Identity , u16 , T :: AccountId , ValueQuery , DefaultSubnetOwner < T > > ;
731
732
#[ pallet:: storage] // --- MAP ( netuid ) --> subnet_locked
@@ -796,15 +797,15 @@ pub mod pallet {
796
797
}
797
798
798
799
#[ pallet:: storage] // --- ITEM ( tx_rate_limit )
799
- pub ( super ) type TxRateLimit < T > = StorageValue < _ , u64 , ValueQuery , DefaultTxRateLimit < T > > ;
800
+ pub type TxRateLimit < T > = StorageValue < _ , u64 , ValueQuery , DefaultTxRateLimit < T > > ;
800
801
#[ pallet:: storage] // --- ITEM ( tx_rate_limit )
801
- pub ( super ) type TxDelegateTakeRateLimit < T > =
802
+ pub type TxDelegateTakeRateLimit < T > =
802
803
StorageValue < _ , u64 , ValueQuery , DefaultTxDelegateTakeRateLimit < T > > ;
803
- #[ pallet:: storage] // --- MAP ( key ) --> last_block
804
+ #[ pallet:: storage] // --- MAP ( hotkey ) --> last_block
804
805
pub type LastTxBlock < T : Config > =
805
806
StorageMap < _ , Identity , T :: AccountId , u64 , ValueQuery , DefaultLastTxBlock < T > > ;
806
- #[ pallet:: storage] // --- MAP ( key ) --> last_block
807
- pub ( super ) type LastTxBlockDelegateTake < T : Config > =
807
+ #[ pallet:: storage] // --- MAP ( hotkey ) --> last_block
808
+ pub type LastTxBlockDelegateTake < T : Config > =
808
809
StorageMap < _ , Identity , T :: AccountId , u64 , ValueQuery , DefaultLastTxBlock < T > > ;
809
810
810
811
/// Default value for serving rate limit.
@@ -1084,41 +1085,39 @@ pub mod pallet {
1084
1085
StorageMap < _ , Identity , u16 , Vec < ( T :: AccountId , u64 , u64 ) > , OptionQuery > ;
1085
1086
1086
1087
#[ pallet:: storage] // --- DMAP ( netuid ) --> active
1087
- pub ( super ) type Active < T : Config > =
1088
+ pub type Active < T : Config > =
1088
1089
StorageMap < _ , Identity , u16 , Vec < bool > , ValueQuery , EmptyBoolVec < T > > ;
1089
1090
#[ pallet:: storage] // --- DMAP ( netuid ) --> rank
1090
- pub ( super ) type Rank < T : Config > =
1091
- StorageMap < _ , Identity , u16 , Vec < u16 > , ValueQuery , EmptyU16Vec < T > > ;
1091
+ pub type Rank < T : Config > = StorageMap < _ , Identity , u16 , Vec < u16 > , ValueQuery , EmptyU16Vec < T > > ;
1092
1092
#[ pallet:: storage] // --- DMAP ( netuid ) --> trust
1093
- pub ( super ) type Trust < T : Config > =
1094
- StorageMap < _ , Identity , u16 , Vec < u16 > , ValueQuery , EmptyU16Vec < T > > ;
1093
+ pub type Trust < T : Config > = StorageMap < _ , Identity , u16 , Vec < u16 > , ValueQuery , EmptyU16Vec < T > > ;
1095
1094
#[ pallet:: storage] // --- DMAP ( netuid ) --> consensus
1096
- pub ( super ) type Consensus < T : Config > =
1095
+ pub type Consensus < T : Config > =
1097
1096
StorageMap < _ , Identity , u16 , Vec < u16 > , ValueQuery , EmptyU16Vec < T > > ;
1098
1097
#[ pallet:: storage] // --- DMAP ( netuid ) --> incentive
1099
- pub ( super ) type Incentive < T : Config > =
1098
+ pub type Incentive < T : Config > =
1100
1099
StorageMap < _ , Identity , u16 , Vec < u16 > , ValueQuery , EmptyU16Vec < T > > ;
1101
1100
#[ pallet:: storage] // --- DMAP ( netuid ) --> dividends
1102
- pub ( super ) type Dividends < T : Config > =
1101
+ pub type Dividends < T : Config > =
1103
1102
StorageMap < _ , Identity , u16 , Vec < u16 > , ValueQuery , EmptyU16Vec < T > > ;
1104
1103
#[ pallet:: storage] // --- DMAP ( netuid ) --> emission
1105
- pub ( super ) type Emission < T : Config > =
1104
+ pub type Emission < T : Config > =
1106
1105
StorageMap < _ , Identity , u16 , Vec < u64 > , ValueQuery , EmptyU64Vec < T > > ;
1107
1106
#[ pallet:: storage] // --- DMAP ( netuid ) --> last_update
1108
- pub ( super ) type LastUpdate < T : Config > =
1107
+ pub type LastUpdate < T : Config > =
1109
1108
StorageMap < _ , Identity , u16 , Vec < u64 > , ValueQuery , EmptyU64Vec < T > > ;
1110
1109
#[ pallet:: storage] // --- DMAP ( netuid ) --> validator_trust
1111
- pub ( super ) type ValidatorTrust < T : Config > =
1110
+ pub type ValidatorTrust < T : Config > =
1112
1111
StorageMap < _ , Identity , u16 , Vec < u16 > , ValueQuery , EmptyU16Vec < T > > ;
1113
1112
#[ pallet:: storage] // --- DMAP ( netuid ) --> pruning_scores
1114
- pub ( super ) type PruningScores < T : Config > =
1113
+ pub type PruningScores < T : Config > =
1115
1114
StorageMap < _ , Identity , u16 , Vec < u16 > , ValueQuery , EmptyU16Vec < T > > ;
1116
1115
#[ pallet:: storage] // --- DMAP ( netuid ) --> validator_permit
1117
- pub ( super ) type ValidatorPermit < T : Config > =
1116
+ pub type ValidatorPermit < T : Config > =
1118
1117
StorageMap < _ , Identity , u16 , Vec < bool > , ValueQuery , EmptyBoolVec < T > > ;
1119
1118
1120
1119
#[ pallet:: storage] // --- DMAP ( netuid, uid ) --> weights
1121
- pub ( super ) type Weights < T : Config > = StorageDoubleMap <
1120
+ pub type Weights < T : Config > = StorageDoubleMap <
1122
1121
_ ,
1123
1122
Identity ,
1124
1123
u16 ,
@@ -1129,7 +1128,7 @@ pub mod pallet {
1129
1128
DefaultWeights < T > ,
1130
1129
> ;
1131
1130
#[ pallet:: storage] // --- DMAP ( netuid, uid ) --> bonds
1132
- pub ( super ) type Bonds < T : Config > = StorageDoubleMap <
1131
+ pub type Bonds < T : Config > = StorageDoubleMap <
1133
1132
_ ,
1134
1133
Identity ,
1135
1134
u16 ,
@@ -2066,17 +2065,17 @@ pub mod pallet {
2066
2065
}
2067
2066
2068
2067
/// The extrinsic for user to change its hotkey
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
- /// }
2068
+ #[ pallet:: call_index( 70 ) ]
2069
+ #[ pallet:: weight( ( Weight :: from_parts( 1_940_000_000 , 0 )
2070
+ . saturating_add( T :: DbWeight :: get( ) . reads( 272 ) )
2071
+ . saturating_add( T :: DbWeight :: get( ) . writes( 527 ) ) , DispatchClass :: Operational , Pays :: No ) ) ]
2072
+ pub fn swap_hotkey (
2073
+ origin : OriginFor < T > ,
2074
+ hotkey : T :: AccountId ,
2075
+ new_hotkey : T :: AccountId ,
2076
+ ) -> DispatchResultWithPostInfo {
2077
+ Self :: do_swap_hotkey ( origin, & hotkey, & new_hotkey)
2078
+ }
2080
2079
2081
2080
/// The extrinsic for user to change the coldkey associated with their account.
2082
2081
///
0 commit comments