Skip to content

Commit

Permalink
Check IP validity in serve_axon validation first
Browse files Browse the repository at this point in the history
  • Loading branch information
gztensor committed Feb 14, 2025
1 parent 1238e03 commit f111118
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions pallets/subtensor/src/subnets/serving.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,19 +169,19 @@ impl<T: Config> Pallet<T> {
// We check the callers (hotkey) signature.
let hotkey_id = ensure_signed(origin)?;

// Ensure the hotkey is registered somewhere.
ensure!(
Self::is_hotkey_registered_on_any_network(&hotkey_id),
Error::<T>::HotKeyNotRegisteredInNetwork
);

// Check the ip signature validity.
ensure!(Self::is_valid_ip_type(ip_type), Error::<T>::InvalidIpType);
ensure!(
Self::is_valid_ip_address(ip_type, ip),
Error::<T>::InvalidIpAddress
);

// Ensure the hotkey is registered somewhere.
ensure!(
Self::is_hotkey_registered_on_any_network(&hotkey_id),
Error::<T>::HotKeyNotRegisteredInNetwork
);

// We get the previous axon info assoicated with this ( netuid, uid )
let mut prev_prometheus = Self::get_prometheus_info(netuid, &hotkey_id);
let current_block: u64 = Self::get_current_block_as_u64();
Expand Down

0 comments on commit f111118

Please sign in to comment.