Skip to content

Commit f111118

Browse files
committed
Check IP validity in serve_axon validation first
1 parent 1238e03 commit f111118

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

pallets/subtensor/src/subnets/serving.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -169,19 +169,19 @@ impl<T: Config> Pallet<T> {
169169
// We check the callers (hotkey) signature.
170170
let hotkey_id = ensure_signed(origin)?;
171171

172-
// Ensure the hotkey is registered somewhere.
173-
ensure!(
174-
Self::is_hotkey_registered_on_any_network(&hotkey_id),
175-
Error::<T>::HotKeyNotRegisteredInNetwork
176-
);
177-
178172
// Check the ip signature validity.
179173
ensure!(Self::is_valid_ip_type(ip_type), Error::<T>::InvalidIpType);
180174
ensure!(
181175
Self::is_valid_ip_address(ip_type, ip),
182176
Error::<T>::InvalidIpAddress
183177
);
184178

179+
// Ensure the hotkey is registered somewhere.
180+
ensure!(
181+
Self::is_hotkey_registered_on_any_network(&hotkey_id),
182+
Error::<T>::HotKeyNotRegisteredInNetwork
183+
);
184+
185185
// We get the previous axon info assoicated with this ( netuid, uid )
186186
let mut prev_prometheus = Self::get_prometheus_info(netuid, &hotkey_id);
187187
let current_block: u64 = Self::get_current_block_as_u64();

0 commit comments

Comments
 (0)