Skip to content

Commit d6790a3

Browse files
committed
Use passes_rate_limit_on_subnet for setting children
1 parent ce0dfa7 commit d6790a3

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

pallets/subtensor/src/staking/set_children.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,10 @@ impl<T: Config> Pallet<T> {
6060

6161
// Ensure the hotkey passes the rate limit.
6262
ensure!(
63-
Self::passes_rate_limit_globally(
63+
Self::passes_rate_limit_on_subnet(
64+
&TransactionType::SetChildren, // Set children.
6465
&hotkey, // Specific to a hotkey.
6566
netuid, // Specific to a subnet.
66-
&TransactionType::SetChildren, // Set children.
6767
),
6868
Error::<T>::TxRateLimitExceeded
6969
);

pallets/subtensor/src/utils/rate_limiting.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,8 @@ impl<T: Config> Pallet<T> {
5858
}
5959

6060
/// Check if a transaction should be rate limited globally
61-
pub fn passes_rate_limit_globally(
62-
hotkey: &T::AccountId,
63-
netuid: u16,
64-
tx_type: &TransactionType,
65-
) -> bool {
61+
pub fn passes_rate_limit_globally(tx_type: &TransactionType, hotkey: &T::AccountId) -> bool {
62+
let netuid: u16 = u16::MAX;
6663
let block: u64 = Self::get_current_block_as_u64();
6764
let limit: u64 = Self::get_rate_limit(tx_type);
6865
let last_block: u64 = Self::get_last_transaction_block(hotkey, netuid, tx_type);

0 commit comments

Comments
 (0)