Skip to content

Commit fe103e6

Browse files
committed
Revert bad rename for SubnetNotExists error
1 parent 0f75c1b commit fe103e6

File tree

14 files changed

+23
-47
lines changed

14 files changed

+23
-47
lines changed

pallets/admin-utils/src/tests/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2638,7 +2638,7 @@ fn test_trim_to_max_allowed_uids() {
26382638
NetUid::from(42),
26392639
new_max_n
26402640
),
2641-
pallet_subtensor::Error::<Test>::MechanismDoesNotExist
2641+
pallet_subtensor::Error::<Test>::SubnetNotExists
26422642
);
26432643

26442644
// New max n less than lower bound

pallets/subtensor/src/coinbase/root.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ impl<T: Config> Pallet<T> {
369369
// 1. --- The network exists?
370370
ensure!(
371371
Self::if_subnet_exist(netuid) && netuid != NetUid::ROOT,
372-
Error::<T>::MechanismDoesNotExist
372+
Error::<T>::SubnetNotExists
373373
);
374374

375375
// 2. --- Perform the cleanup before removing the network.

pallets/subtensor/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1985,7 +1985,7 @@ pub enum CustomTransactionError {
19851985
ColdkeyInSwapSchedule,
19861986
StakeAmountTooLow,
19871987
BalanceTooLow,
1988-
SubnetDoesntExist,
1988+
SubnetNotExists,
19891989
HotkeyAccountDoesntExist,
19901990
NotEnoughStakeToWithdraw,
19911991
RateLimitExceeded,
@@ -2010,7 +2010,7 @@ impl From<CustomTransactionError> for u8 {
20102010
CustomTransactionError::ColdkeyInSwapSchedule => 0,
20112011
CustomTransactionError::StakeAmountTooLow => 1,
20122012
CustomTransactionError::BalanceTooLow => 2,
2013-
CustomTransactionError::SubnetDoesntExist => 3,
2013+
CustomTransactionError::SubnetNotExists => 3,
20142014
CustomTransactionError::HotkeyAccountDoesntExist => 4,
20152015
CustomTransactionError::NotEnoughStakeToWithdraw => 5,
20162016
CustomTransactionError::RateLimitExceeded => 6,

pallets/subtensor/src/staking/recycle_alpha.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,7 @@ impl<T: Config> Pallet<T> {
2323
) -> DispatchResult {
2424
let coldkey: T::AccountId = ensure_signed(origin)?;
2525

26-
ensure!(
27-
Self::if_subnet_exist(netuid),
28-
Error::<T>::MechanismDoesNotExist
29-
);
26+
ensure!(Self::if_subnet_exist(netuid), Error::<T>::SubnetNotExists);
3027

3128
ensure!(
3229
!netuid.is_root(),
@@ -91,10 +88,7 @@ impl<T: Config> Pallet<T> {
9188
) -> DispatchResult {
9289
let coldkey = ensure_signed(origin)?;
9390

94-
ensure!(
95-
Self::if_subnet_exist(netuid),
96-
Error::<T>::MechanismDoesNotExist
97-
);
91+
ensure!(Self::if_subnet_exist(netuid), Error::<T>::SubnetNotExists);
9892

9993
ensure!(
10094
!netuid.is_root(),

pallets/subtensor/src/staking/remove_stake.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -443,10 +443,7 @@ impl<T: Config> Pallet<T> {
443443

444444
pub fn destroy_alpha_in_out_stakes(netuid: NetUid) -> DispatchResult {
445445
// 1) Ensure the subnet exists.
446-
ensure!(
447-
Self::if_subnet_exist(netuid),
448-
Error::<T>::MechanismDoesNotExist
449-
);
446+
ensure!(Self::if_subnet_exist(netuid), Error::<T>::SubnetNotExists);
450447

451448
// 2) Owner / lock cost.
452449
let owner_coldkey: T::AccountId = SubnetOwner::<T>::get(netuid);

pallets/subtensor/src/staking/set_children.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,7 @@ impl<T: Config> Pallet<T> {
6262
);
6363

6464
// Check that the network we are trying to create the child on exists.
65-
ensure!(
66-
Self::if_subnet_exist(netuid),
67-
Error::<T>::MechanismDoesNotExist
68-
);
65+
ensure!(Self::if_subnet_exist(netuid), Error::<T>::SubnetNotExists);
6966

7067
// Check that the coldkey owns the hotkey.
7168
ensure!(

pallets/subtensor/src/subnets/registration.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,7 @@ impl<T: Config> Pallet<T> {
7878
!netuid.is_root(),
7979
Error::<T>::RegistrationNotPermittedOnRootSubnet
8080
);
81-
ensure!(
82-
Self::if_subnet_exist(netuid),
83-
Error::<T>::MechanismDoesNotExist
84-
);
81+
ensure!(Self::if_subnet_exist(netuid), Error::<T>::SubnetNotExists);
8582

8683
// --- 3. Ensure the passed network allows registrations.
8784
ensure!(
@@ -236,10 +233,7 @@ impl<T: Config> Pallet<T> {
236233
!netuid.is_root(),
237234
Error::<T>::RegistrationNotPermittedOnRootSubnet
238235
);
239-
ensure!(
240-
Self::if_subnet_exist(netuid),
241-
Error::<T>::MechanismDoesNotExist
242-
);
236+
ensure!(Self::if_subnet_exist(netuid), Error::<T>::SubnetNotExists);
243237

244238
// --- 3. Ensure the passed network allows registrations.
245239
ensure!(

pallets/subtensor/src/subnets/subnet.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -343,18 +343,15 @@ impl<T: Config> Pallet<T> {
343343
///
344344
/// # Raises
345345
///
346-
/// * `Error::<T>::MechanismDoesNotExist`: If the subnet does not exist.
346+
/// * `Error::<T>::SubnetNotExists`: If the subnet does not exist.
347347
/// * `DispatchError::BadOrigin`: If the caller is not the subnet owner.
348348
/// * `Error::<T>::FirstEmissionBlockNumberAlreadySet`: If the last emission block number has already been set.
349349
///
350350
/// # Returns
351351
///
352352
/// * `DispatchResult`: A result indicating the success or failure of the operation.
353353
pub fn do_start_call(origin: T::RuntimeOrigin, netuid: NetUid) -> DispatchResult {
354-
ensure!(
355-
Self::if_subnet_exist(netuid),
356-
Error::<T>::MechanismDoesNotExist
357-
);
354+
ensure!(Self::if_subnet_exist(netuid), Error::<T>::SubnetNotExists);
358355
Self::ensure_subnet_owner(origin, netuid)?;
359356
ensure!(
360357
FirstEmissionBlockNumber::<T>::get(netuid).is_none(),

pallets/subtensor/src/subnets/uids.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,7 @@ impl<T: Config> Pallet<T> {
133133

134134
pub fn trim_to_max_allowed_uids(netuid: NetUid, max_n: u16) -> DispatchResult {
135135
// Reasonable limits
136-
ensure!(
137-
Self::if_subnet_exist(netuid),
138-
Error::<T>::MechanismDoesNotExist
139-
);
136+
ensure!(Self::if_subnet_exist(netuid), Error::<T>::SubnetNotExists);
140137
ensure!(
141138
max_n >= MinAllowedUids::<T>::get(netuid),
142139
Error::<T>::InvalidValue

pallets/subtensor/src/tests/children.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ fn test_do_set_child_singular_network_does_not_exist() {
6262
netuid,
6363
vec![(proportion, child)]
6464
),
65-
Error::<Test>::MechanismDoesNotExist
65+
Error::<Test>::SubnetNotExists
6666
);
6767
});
6868
}
@@ -328,7 +328,7 @@ fn test_add_singular_child() {
328328
netuid,
329329
vec![(u64::MAX, child)]
330330
),
331-
Err(Error::<Test>::MechanismDoesNotExist.into())
331+
Err(Error::<Test>::SubnetNotExists.into())
332332
);
333333
add_network(netuid, 1, 0);
334334
step_rate_limit(&TransactionType::SetChildren, netuid);
@@ -472,7 +472,7 @@ fn test_do_set_empty_children_network_does_not_exist() {
472472
netuid,
473473
vec![]
474474
),
475-
Error::<Test>::MechanismDoesNotExist
475+
Error::<Test>::SubnetNotExists
476476
);
477477
});
478478
}
@@ -601,7 +601,7 @@ fn test_do_schedule_children_multiple_network_does_not_exist() {
601601
netuid,
602602
vec![(proportion, child1)]
603603
),
604-
Error::<Test>::MechanismDoesNotExist
604+
Error::<Test>::SubnetNotExists
605605
);
606606
});
607607
}
@@ -1200,7 +1200,7 @@ fn test_do_revoke_children_multiple_network_does_not_exist() {
12001200
netuid,
12011201
vec![(u64::MAX / 2, child1), (u64::MAX / 2, child2)]
12021202
),
1203-
Error::<Test>::MechanismDoesNotExist
1203+
Error::<Test>::SubnetNotExists
12041204
);
12051205
});
12061206
}

0 commit comments

Comments
 (0)