@@ -1299,7 +1299,7 @@ pub mod pallet {
12991299 /// Returns the transaction priority for setting weights.
13001300 pub fn get_priority_set_weights ( hotkey : & T :: AccountId , netuid : u16 ) -> u64 {
13011301 if let Ok ( uid) = Self :: get_uid_for_net_and_hotkey ( netuid, hotkey) {
1302- let _stake = Self :: get_total_stake_for_hotkey ( hotkey) ;
1302+ let _stake = Self :: get_stake_for_hotkey_on_subnet ( hotkey, netuid ) ;
13031303 let current_block_number: u64 = Self :: get_current_block_as_u64 ( ) ;
13041304 let default_priority: u64 =
13051305 current_block_number. saturating_sub ( Self :: get_last_update_for_uid ( netuid, uid) ) ;
@@ -1309,9 +1309,9 @@ pub mod pallet {
13091309 }
13101310
13111311 /// Is the caller allowed to set weights
1312- pub fn check_weights_min_stake ( hotkey : & T :: AccountId ) -> bool {
1312+ pub fn check_weights_min_stake ( hotkey : & T :: AccountId , netuid : u16 ) -> bool {
13131313 // Blacklist weights transactions for low stake peers.
1314- Self :: get_total_stake_for_hotkey ( hotkey) >= Self :: get_weights_min_stake ( )
1314+ Self :: get_stake_for_hotkey_on_subnet ( hotkey, netuid ) >= Self :: get_weights_min_stake ( )
13151315 }
13161316
13171317 /// Helper function to check if register is allowed
@@ -1404,8 +1404,8 @@ where
14041404 Pallet :: < T > :: get_priority_set_weights ( who, netuid)
14051405 }
14061406
1407- pub fn check_weights_min_stake ( who : & T :: AccountId ) -> bool {
1408- Pallet :: < T > :: check_weights_min_stake ( who)
1407+ pub fn check_weights_min_stake ( who : & T :: AccountId , netuid : u16 ) -> bool {
1408+ Pallet :: < T > :: check_weights_min_stake ( who, netuid )
14091409 }
14101410}
14111411
@@ -1443,7 +1443,7 @@ where
14431443 ) -> TransactionValidity {
14441444 match call. is_sub_type ( ) {
14451445 Some ( Call :: commit_weights { netuid, .. } ) => {
1446- if Self :: check_weights_min_stake ( who) {
1446+ if Self :: check_weights_min_stake ( who, * netuid ) {
14471447 let priority: u64 = Self :: get_priority_set_weights ( who, * netuid) ;
14481448 Ok ( ValidTransaction {
14491449 priority,
@@ -1455,7 +1455,7 @@ where
14551455 }
14561456 }
14571457 Some ( Call :: reveal_weights { netuid, .. } ) => {
1458- if Self :: check_weights_min_stake ( who) {
1458+ if Self :: check_weights_min_stake ( who, * netuid ) {
14591459 let priority: u64 = Self :: get_priority_set_weights ( who, * netuid) ;
14601460 Ok ( ValidTransaction {
14611461 priority,
@@ -1467,7 +1467,7 @@ where
14671467 }
14681468 }
14691469 Some ( Call :: batch_reveal_weights { netuid, .. } ) => {
1470- if Self :: check_weights_min_stake ( who) {
1470+ if Self :: check_weights_min_stake ( who, * netuid ) {
14711471 let priority: u64 = Self :: get_priority_set_weights ( who, * netuid) ;
14721472 Ok ( ValidTransaction {
14731473 priority,
@@ -1479,7 +1479,7 @@ where
14791479 }
14801480 }
14811481 Some ( Call :: set_weights { netuid, .. } ) => {
1482- if Self :: check_weights_min_stake ( who) {
1482+ if Self :: check_weights_min_stake ( who, * netuid ) {
14831483 let priority: u64 = Self :: get_priority_set_weights ( who, * netuid) ;
14841484 Ok ( ValidTransaction {
14851485 priority,
@@ -1491,7 +1491,7 @@ where
14911491 }
14921492 }
14931493 Some ( Call :: set_root_weights { netuid, hotkey, .. } ) => {
1494- if Self :: check_weights_min_stake ( hotkey) {
1494+ if Self :: check_weights_min_stake ( hotkey, * netuid ) {
14951495 let priority: u64 = Self :: get_priority_set_weights ( hotkey, * netuid) ;
14961496 Ok ( ValidTransaction {
14971497 priority,
0 commit comments