@@ -241,7 +241,7 @@ mod dispatches {
241241 . saturating_add( T :: DbWeight :: get( ) . reads( 10_u64 ) )
242242 . saturating_add( T :: DbWeight :: get( ) . writes( 2 ) ) , DispatchClass :: Normal , Pays :: No ) ) ]
243243 pub fn commit_weights (
244- origin : T :: RuntimeOrigin ,
244+ origin : OriginFor < T > ,
245245 netuid : NetUid ,
246246 commit_hash : H256 ,
247247 ) -> DispatchResult {
@@ -275,7 +275,7 @@ mod dispatches {
275275 . saturating_add( T :: DbWeight :: get( ) . reads( 7 ) )
276276 . saturating_add( T :: DbWeight :: get( ) . writes( 2 ) ) , DispatchClass :: Normal , Pays :: No ) ) ]
277277 pub fn commit_mechanism_weights (
278- origin : T :: RuntimeOrigin ,
278+ origin : OriginFor < T > ,
279279 netuid : NetUid ,
280280 mecid : MechId ,
281281 commit_hash : H256 ,
@@ -359,7 +359,7 @@ mod dispatches {
359359 . saturating_add( T :: DbWeight :: get( ) . reads( 17_u64 ) )
360360 . saturating_add( T :: DbWeight :: get( ) . writes( 2 ) ) , DispatchClass :: Normal , Pays :: No ) ) ]
361361 pub fn reveal_weights (
362- origin : T :: RuntimeOrigin ,
362+ origin : OriginFor < T > ,
363363 netuid : NetUid ,
364364 uids : Vec < u16 > ,
365365 values : Vec < u16 > ,
@@ -414,7 +414,7 @@ mod dispatches {
414414 . saturating_add( T :: DbWeight :: get( ) . reads( 16 ) )
415415 . saturating_add( T :: DbWeight :: get( ) . writes( 2 ) ) , DispatchClass :: Normal , Pays :: No ) ) ]
416416 pub fn reveal_mechanism_weights (
417- origin : T :: RuntimeOrigin ,
417+ origin : OriginFor < T > ,
418418 netuid : NetUid ,
419419 mecid : MechId ,
420420 uids : Vec < u16 > ,
@@ -512,7 +512,7 @@ mod dispatches {
512512 . saturating_add( T :: DbWeight :: get( ) . reads( 7_u64 ) )
513513 . saturating_add( T :: DbWeight :: get( ) . writes( 2 ) ) , DispatchClass :: Normal , Pays :: No ) ) ]
514514 pub fn commit_crv3_mechanism_weights (
515- origin : T :: RuntimeOrigin ,
515+ origin : OriginFor < T > ,
516516 netuid : NetUid ,
517517 mecid : MechId ,
518518 commit : BoundedVec < u8 , ConstU32 < MAX_CRV3_COMMIT_SIZE_BYTES > > ,
@@ -572,7 +572,7 @@ mod dispatches {
572572 . saturating_add( T :: DbWeight :: get( ) . reads( 17_u64 ) )
573573 . saturating_add( T :: DbWeight :: get( ) . writes( 2_u64 ) ) , DispatchClass :: Normal , Pays :: No ) ) ]
574574 pub fn batch_reveal_weights (
575- origin : T :: RuntimeOrigin ,
575+ origin : OriginFor < T > ,
576576 netuid : NetUid ,
577577 uids_list : Vec < Vec < u16 > > ,
578578 values_list : Vec < Vec < u16 > > ,
@@ -1339,7 +1339,7 @@ mod dispatches {
13391339 . saturating_add( T :: DbWeight :: get( ) . reads( 6 ) )
13401340 . saturating_add( T :: DbWeight :: get( ) . writes( 31 ) ) , DispatchClass :: Normal , Pays :: Yes ) ) ]
13411341 pub fn set_children (
1342- origin : T :: RuntimeOrigin ,
1342+ origin : OriginFor < T > ,
13431343 hotkey : T :: AccountId ,
13441344 netuid : NetUid ,
13451345 children : Vec < ( u64 , T :: AccountId ) > ,
@@ -1558,7 +1558,7 @@ mod dispatches {
15581558 . saturating_add( T :: DbWeight :: get( ) . reads( 19_u64 ) )
15591559 . saturating_add( T :: DbWeight :: get( ) . writes( 7_u64 ) ) , DispatchClass :: Normal , Pays :: Yes ) ) ]
15601560 pub fn move_stake (
1561- origin : T :: RuntimeOrigin ,
1561+ origin : OriginFor < T > ,
15621562 origin_hotkey : T :: AccountId ,
15631563 destination_hotkey : T :: AccountId ,
15641564 origin_netuid : NetUid ,
@@ -1601,7 +1601,7 @@ mod dispatches {
16011601 . saturating_add( T :: DbWeight :: get( ) . reads( 16_u64 ) )
16021602 . saturating_add( T :: DbWeight :: get( ) . writes( 6_u64 ) ) , DispatchClass :: Normal , Pays :: Yes ) ) ]
16031603 pub fn transfer_stake (
1604- origin : T :: RuntimeOrigin ,
1604+ origin : OriginFor < T > ,
16051605 destination_coldkey : T :: AccountId ,
16061606 hotkey : T :: AccountId ,
16071607 origin_netuid : NetUid ,
@@ -1646,7 +1646,7 @@ mod dispatches {
16461646 Pays :: Yes
16471647 ) ) ]
16481648 pub fn swap_stake (
1649- origin : T :: RuntimeOrigin ,
1649+ origin : OriginFor < T > ,
16501650 hotkey : T :: AccountId ,
16511651 origin_netuid : NetUid ,
16521652 destination_netuid : NetUid ,
@@ -1820,7 +1820,7 @@ mod dispatches {
18201820 Pays :: Yes
18211821 ) ) ]
18221822 pub fn swap_stake_limit (
1823- origin : T :: RuntimeOrigin ,
1823+ origin : OriginFor < T > ,
18241824 hotkey : T :: AccountId ,
18251825 origin_netuid : NetUid ,
18261826 destination_netuid : NetUid ,
@@ -1853,10 +1853,7 @@ mod dispatches {
18531853 DispatchClass :: Normal ,
18541854 Pays :: Yes
18551855 ) ) ]
1856- pub fn try_associate_hotkey (
1857- origin : T :: RuntimeOrigin ,
1858- hotkey : T :: AccountId ,
1859- ) -> DispatchResult {
1856+ pub fn try_associate_hotkey ( origin : OriginFor < T > , hotkey : T :: AccountId ) -> DispatchResult {
18601857 let coldkey = ensure_signed ( origin) ?;
18611858
18621859 let _ = Self :: do_try_associate_hotkey ( & coldkey, & hotkey) ;
@@ -1878,7 +1875,7 @@ mod dispatches {
18781875 DispatchClass :: Normal ,
18791876 Pays :: Yes
18801877 ) ) ]
1881- pub fn start_call ( origin : T :: RuntimeOrigin , netuid : NetUid ) -> DispatchResult {
1878+ pub fn start_call ( origin : OriginFor < T > , netuid : NetUid ) -> DispatchResult {
18821879 Self :: do_start_call ( origin, netuid) ?;
18831880 Ok ( ( ) )
18841881 }
@@ -1915,7 +1912,7 @@ mod dispatches {
19151912 Pays :: No
19161913 ) ) ]
19171914 pub fn associate_evm_key (
1918- origin : T :: RuntimeOrigin ,
1915+ origin : OriginFor < T > ,
19191916 netuid : NetUid ,
19201917 evm_key : H160 ,
19211918 block_number : u64 ,
@@ -1941,7 +1938,7 @@ mod dispatches {
19411938 Pays :: Yes
19421939 ) ) ]
19431940 pub fn recycle_alpha (
1944- origin : T :: RuntimeOrigin ,
1941+ origin : OriginFor < T > ,
19451942 hotkey : T :: AccountId ,
19461943 amount : AlphaBalance ,
19471944 netuid : NetUid ,
@@ -1966,7 +1963,7 @@ mod dispatches {
19661963 Pays :: Yes
19671964 ) ) ]
19681965 pub fn burn_alpha (
1969- origin : T :: RuntimeOrigin ,
1966+ origin : OriginFor < T > ,
19701967 hotkey : T :: AccountId ,
19711968 amount : AlphaBalance ,
19721969 netuid : NetUid ,
@@ -1995,7 +1992,7 @@ mod dispatches {
19951992 . saturating_add( T :: DbWeight :: get( ) . reads( 30_u64 ) )
19961993 . saturating_add( T :: DbWeight :: get( ) . writes( 13_u64 ) ) , DispatchClass :: Normal , Pays :: Yes ) ) ]
19971994 pub fn remove_stake_full_limit (
1998- origin : T :: RuntimeOrigin ,
1995+ origin : OriginFor < T > ,
19991996 hotkey : T :: AccountId ,
20001997 netuid : NetUid ,
20011998 limit_price : Option < TaoBalance > ,
@@ -2022,7 +2019,7 @@ mod dispatches {
20222019 #[ pallet:: call_index( 110 ) ]
20232020 #[ pallet:: weight( SubnetLeasingWeightInfo :: <T >:: do_register_leased_network( T :: MaxContributors :: get( ) ) ) ]
20242021 pub fn register_leased_network (
2025- origin : T :: RuntimeOrigin ,
2022+ origin : OriginFor < T > ,
20262023 emissions_share : Percent ,
20272024 end_block : Option < BlockNumberFor < T > > ,
20282025 ) -> DispatchResultWithPostInfo {
@@ -2048,7 +2045,7 @@ mod dispatches {
20482045 #[ pallet:: call_index( 111 ) ]
20492046 #[ pallet:: weight( SubnetLeasingWeightInfo :: <T >:: do_terminate_lease( T :: MaxContributors :: get( ) ) ) ]
20502047 pub fn terminate_lease (
2051- origin : T :: RuntimeOrigin ,
2048+ origin : OriginFor < T > ,
20522049 lease_id : LeaseId ,
20532050 hotkey : T :: AccountId ,
20542051 ) -> DispatchResultWithPostInfo {
@@ -2121,7 +2118,7 @@ mod dispatches {
21212118 . saturating_add( T :: DbWeight :: get( ) . reads( 10_u64 ) )
21222119 . saturating_add( T :: DbWeight :: get( ) . writes( 2 ) ) , DispatchClass :: Normal , Pays :: No ) ) ]
21232120 pub fn commit_timelocked_weights (
2124- origin : T :: RuntimeOrigin ,
2121+ origin : OriginFor < T > ,
21252122 netuid : NetUid ,
21262123 commit : BoundedVec < u8 , ConstU32 < MAX_CRV3_COMMIT_SIZE_BYTES > > ,
21272124 reveal_round : u64 ,
@@ -2152,7 +2149,7 @@ mod dispatches {
21522149 . saturating_add( T :: DbWeight :: get( ) . reads( 4_u64 ) )
21532150 . saturating_add( T :: DbWeight :: get( ) . writes( 2_u64 ) ) , DispatchClass :: Normal , Pays :: Yes ) ) ]
21542151 pub fn set_coldkey_auto_stake_hotkey (
2155- origin : T :: RuntimeOrigin ,
2152+ origin : OriginFor < T > ,
21562153 netuid : NetUid ,
21572154 hotkey : T :: AccountId ,
21582155 ) -> DispatchResult {
@@ -2226,7 +2223,7 @@ mod dispatches {
22262223 . saturating_add( T :: DbWeight :: get( ) . reads( 9_u64 ) )
22272224 . saturating_add( T :: DbWeight :: get( ) . writes( 2 ) ) , DispatchClass :: Normal , Pays :: No ) ) ]
22282225 pub fn commit_timelocked_mechanism_weights (
2229- origin : T :: RuntimeOrigin ,
2226+ origin : OriginFor < T > ,
22302227 netuid : NetUid ,
22312228 mecid : MechId ,
22322229 commit : BoundedVec < u8 , ConstU32 < MAX_CRV3_COMMIT_SIZE_BYTES > > ,
@@ -2326,7 +2323,7 @@ mod dispatches {
23262323
23272324 /// --- Sets root claim number (sudo extrinsic). Zero disables auto-claim.
23282325 #[ pallet:: call_index( 123 ) ]
2329- #[ pallet:: weight( Weight :: from_parts( 4_000_000 , 0 )
2326+ #[ pallet:: weight( Weight :: from_parts( 2_283_000 , 0 )
23302327 . saturating_add( T :: DbWeight :: get( ) . reads( 0_u64 ) )
23312328 . saturating_add( T :: DbWeight :: get( ) . writes( 1_u64 ) ) ) ]
23322329 pub fn sudo_set_num_root_claims ( origin : OriginFor < T > , new_value : u64 ) -> DispatchResult {
@@ -2397,8 +2394,8 @@ mod dispatches {
23972394
23982395 if let Some ( ( when, _) ) = ColdkeySwapAnnouncements :: < T > :: get ( who. clone ( ) ) {
23992396 let reannouncement_delay = ColdkeySwapReannouncementDelay :: < T > :: get ( ) ;
2400- let new_when = when. saturating_add ( reannouncement_delay) ;
2401- ensure ! ( now >= new_when , Error :: <T >:: ColdkeySwapReannouncedTooEarly ) ;
2397+ let min_when = when. saturating_add ( reannouncement_delay) ;
2398+ ensure ! ( now >= min_when , Error :: <T >:: ColdkeySwapReannouncedTooEarly ) ;
24022399 } else {
24032400 // Only charge the swap cost on the first announcement
24042401 let swap_cost = Self :: get_key_swap_cost ( ) ;
@@ -2596,13 +2593,38 @@ mod dispatches {
25962593 Pays :: Yes
25972594 ) ) ]
25982595 pub fn add_stake_burn (
2599- origin : T :: RuntimeOrigin ,
2596+ origin : OriginFor < T > ,
26002597 hotkey : T :: AccountId ,
26012598 netuid : NetUid ,
26022599 amount : TaoBalance ,
26032600 limit : Option < TaoBalance > ,
26042601 ) -> DispatchResult {
26052602 Self :: do_add_stake_burn ( origin, hotkey, netuid, amount, limit)
26062603 }
2604+
2605+ /// Clears a coldkey swap announcement after the reannouncement delay if
2606+ /// it has not been disputed.
2607+ ///
2608+ /// The `ColdkeySwapCleared` event is emitted on successful clear.
2609+ #[ pallet:: call_index( 133 ) ]
2610+ #[ pallet:: weight( Weight :: from_parts( 17_890_000 , 0 )
2611+ . saturating_add( T :: DbWeight :: get( ) . reads( 2 ) )
2612+ . saturating_add( T :: DbWeight :: get( ) . writes( 1 ) ) ) ]
2613+ pub fn clear_coldkey_swap_announcement ( origin : OriginFor < T > ) -> DispatchResult {
2614+ let who = ensure_signed ( origin) ?;
2615+ let now = <frame_system:: Pallet < T > >:: block_number ( ) ;
2616+
2617+ let Some ( ( when, _) ) = ColdkeySwapAnnouncements :: < T > :: get ( who. clone ( ) ) else {
2618+ return Err ( Error :: < T > :: ColdkeySwapAnnouncementNotFound . into ( ) ) ;
2619+ } ;
2620+ let delay = ColdkeySwapReannouncementDelay :: < T > :: get ( ) ;
2621+ let min_when = when. saturating_add ( delay) ;
2622+ ensure ! ( now >= min_when, Error :: <T >:: ColdkeySwapClearTooEarly ) ;
2623+
2624+ ColdkeySwapAnnouncements :: < T > :: remove ( & who) ;
2625+
2626+ Self :: deposit_event ( Event :: ColdkeySwapCleared { who } ) ;
2627+ Ok ( ( ) )
2628+ }
26072629 }
26082630}
0 commit comments