Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 11 additions & 22 deletions pallets/admin-utils/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1532,28 +1532,17 @@ pub mod pallet {
Ok(())
}

/// Change the SubnetOwnerHotkey for a given subnet.
///
/// # Arguments
/// * `origin` - The origin of the call, which must be the subnet owner.
/// * `netuid` - The unique identifier for the subnet.
/// * `hotkey` - The new hotkey for the subnet owner.
///
/// # Errors
/// * `BadOrigin` - If the caller is not the subnet owner or root account.
///
/// # Weight
/// Weight is handled by the `#[pallet::weight]` attribute.
#[pallet::call_index(64)]
#[pallet::weight(Weight::from_parts(3_918_000, 0) // TODO: add benchmarks
.saturating_add(T::DbWeight::get().writes(1_u64)))]
pub fn sudo_set_subnet_owner_hotkey(
origin: OriginFor<T>,
netuid: NetUid,
hotkey: <T as frame_system::Config>::AccountId,
) -> DispatchResult {
pallet_subtensor::Pallet::<T>::do_set_sn_owner_hotkey(origin, netuid, &hotkey)
}
// Deprecated for sudo_set_sn_owner_hotkey
Comment thread
JohnReedV marked this conversation as resolved.
// #[pallet::call_index(64)]
// #[pallet::weight(Weight::from_parts(3_918_000, 0) // TODO: add benchmarks
// .saturating_add(T::DbWeight::get().writes(1_u64)))]
// pub fn sudo_set_subnet_owner_hotkey(
// origin: OriginFor<T>,
// netuid: NetUid,
// hotkey: <T as frame_system::Config>::AccountId,
// ) -> DispatchResult {
// pallet_subtensor::Pallet::<T>::do_set_sn_owner_hotkey(origin, netuid, &hotkey)
// }
Comment thread
JohnReedV marked this conversation as resolved.
Comment thread
JohnReedV marked this conversation as resolved.
Comment on lines +1535 to +1545

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we just remove the comment maybe?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left it so we don't re-use the call index.


Comment thread
JohnReedV marked this conversation as resolved.
///
///
Expand Down
1 change: 0 additions & 1 deletion runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,6 @@ subtensor_macros::define_proxy_filters! {
SubtensorModule::update_symbol,
} except {
AdminUtils::sudo_set_sn_owner_hotkey,
AdminUtils::sudo_set_subnet_owner_hotkey,
}

NonCritical => deny {
Expand Down
13 changes: 0 additions & 13 deletions runtime/tests/ghsa_repro.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,6 @@ fn set_sn_owner_hotkey_c67() -> RuntimeCall {
hotkey: acct(),
})
}
fn set_subnet_owner_hotkey_c64() -> RuntimeCall {
RuntimeCall::AdminUtils(pallet_admin_utils::Call::sudo_set_subnet_owner_hotkey {
netuid: Default::default(),
hotkey: acct(),
})
}

/// GHSA-2026-001 — NonTransfer and NonFungible proxies (the two "cannot move my funds"
/// types) ALLOW the new coldkey-swap lifecycle, so a restricted delegate can take over
Expand Down Expand Up @@ -149,17 +143,10 @@ fn ghsa_2026_002_nonfungible_allows_swap_hotkey_v2_gap() {
}

/// GHSA-2026-003 — the Owner proxy excepts sudo_set_sn_owner_hotkey (call 67) but the
Comment thread
JohnReedV marked this conversation as resolved.
/// duplicate alias sudo_set_subnet_owner_hotkey (call 64) is allowed by the AdminUtils::*
/// wildcard, bypassing the carve-out.
#[test]
fn ghsa_2026_003_owner_proxy_set_owner_hotkey_alias_bypass() {
assert!(
!ProxyType::Owner.filter(&set_sn_owner_hotkey_c67()),
"precondition: Owner correctly excepts sudo_set_sn_owner_hotkey (call 67)"
);
assert!(
!ProxyType::Owner.filter(&set_subnet_owner_hotkey_c64()),
"regression (GHSA-2026-003 fixed): Owner must DENY the alias sudo_set_subnet_owner_hotkey (call 64), \
which calls the same do_set_sn_owner_hotkey backend"
);
}
Loading