Skip to content

Commit

Permalink
Merge pull request #733 from opentensor/fix/childkey-rate-limits
Browse files Browse the repository at this point in the history
Fix rate limit for setting children
  • Loading branch information
distributedstatemachine authored Aug 16, 2024
2 parents 8f9e841 + d6790a3 commit cb35762
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion pallets/subtensor/src/staking/set_children.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,23 @@ impl<T: Config> Pallet<T> {

// Ensure the hotkey passes the rate limit.
ensure!(
Self::passes_rate_limit_globally(
Self::passes_rate_limit_on_subnet(
&TransactionType::SetChildren, // Set children.
&hotkey, // Specific to a hotkey.
netuid, // Specific to a subnet.
),
Error::<T>::TxRateLimitExceeded
);

// Set last transaction block
let current_block = Self::get_current_block_as_u64();
Self::set_last_transaction_block(
&hotkey,
netuid,
&TransactionType::SetChildren,
current_block
);

// --- 2. Check that this delegation is not on the root network. Child hotkeys are not valid on root.
ensure!(
netuid != Self::get_root_netuid(),
Expand Down

0 comments on commit cb35762

Please sign in to comment.