Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
39bc8e6
restore e2e.yml
l0r1s Mar 11, 2026
384aaad
Merge pull request #2493 from opentensor/restore-e2e-yml
sam0x17 Mar 11, 2026
7eb6f9b
Merge pull request #2485 from opentensor/upgrade-1
sam0x17 Mar 11, 2026
b654842
disable mev shield temporarily
l0r1s Feb 27, 2026
5f4e626
Merge pull request #2502 from opentensor/disable-mev-shield-main
sam0x17 Mar 17, 2026
65fc7c5
10x fees on testnet
gztensor Mar 17, 2026
50146e8
Revert 10x fees on testnet in favor of PR
gztensor Mar 17, 2026
35131d2
10x fees on testnet
gztensor Mar 17, 2026
0cd1f46
Spec bump
gztensor Mar 17, 2026
aff9f5a
fix typing after adding scheduler bound to subtensor pallet
l0r1s Mar 17, 2026
eaf347b
clean up scheduled coldkey swap tasks
l0r1s Mar 17, 2026
14d4523
allow to clear announcement after the reannouncement delay
l0r1s Mar 17, 2026
2a82b4b
fix migration weight accounting
l0r1s Mar 18, 2026
d99b178
add clear_coldkey_swap_announcement to dispatch guard
l0r1s Mar 18, 2026
7ac448d
use correct delay when ensuring we can clear the announcement
l0r1s Mar 18, 2026
436173f
fixed tests
l0r1s Mar 18, 2026
7a92cf2
fix benchmark
l0r1s Mar 18, 2026
de944d1
trigger CI
l0r1s Mar 18, 2026
be7b428
Merge pull request #2504 from opentensor/feat/10x-fees-testnet
sam0x17 Mar 18, 2026
e466050
fix weights
l0r1s Mar 18, 2026
4f0d48a
fix clippy
l0r1s Mar 18, 2026
b59e668
Merge pull request #2506 from opentensor/clear-scheduled-ck-swap
l0r1s Mar 18, 2026
bc9d46d
Merge branch 'main' into main-into-testnet-18-03-2026
l0r1s Mar 18, 2026
008cda2
fix renaming issues
l0r1s Mar 18, 2026
a6a92d1
Merge pull request #2512 from opentensor/main-into-testnet-18-03-2026
sam0x17 Mar 19, 2026
89ac174
Merge branch 'testnet' into testnet-into-devnet-ready-19-03-2026
l0r1s Mar 19, 2026
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
4 changes: 4 additions & 0 deletions .github/e2e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
name: E2E Tests

on:
workflow_dispatch:
2 changes: 1 addition & 1 deletion pallets/subtensor/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ rand_chacha.workspace = true
pallet-crowdloan.workspace = true
pallet-subtensor-proxy.workspace = true
pallet-shield.workspace = true
pallet-scheduler.workspace = true

[dev-dependencies]
pallet-balances = { workspace = true, features = ["std"] }
pallet-scheduler.workspace = true
pallet-subtensor-proxy.workspace = true
pallet-aura.workspace = true
subtensor-runtime-common.workspace = true
Expand Down
18 changes: 17 additions & 1 deletion pallets/subtensor/src/benchmarks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,21 @@ mod pallet_benchmarks {
_(RawOrigin::Signed(coldkey));
}

#[benchmark]
fn clear_coldkey_swap_announcement() {
let coldkey: T::AccountId = account("coldkey", 0, 0);
let new_coldkey: T::AccountId = account("new_coldkey", 0, 0);
let new_coldkey_hash: T::Hash = <T as frame_system::Config>::Hashing::hash_of(&new_coldkey);
let now = frame_system::Pallet::<T>::block_number();
let delay = ColdkeySwapReannouncementDelay::<T>::get();

ColdkeySwapAnnouncements::<T>::insert(&coldkey, (now, new_coldkey_hash));
frame_system::Pallet::<T>::set_block_number(now + delay);

#[extrinsic_call]
_(RawOrigin::Signed(coldkey));
}

#[benchmark]
fn reset_coldkey_swap() {
let coldkey: T::AccountId = account("old_coldkey", 0, 0);
Expand Down Expand Up @@ -586,7 +601,8 @@ mod pallet_benchmarks {
let block_number: u64 = Subtensor::<T>::get_current_block_as_u64();
let (nonce, work) =
Subtensor::<T>::create_work_for_block_number(netuid, block_number, 3, &hotkey);
let origin = T::RuntimeOrigin::from(RawOrigin::Signed(hotkey.clone()));
let origin =
<T as frame_system::Config>::RuntimeOrigin::from(RawOrigin::Signed(hotkey.clone()));
assert_ok!(Subtensor::<T>::register(
origin.clone(),
netuid,
Expand Down
2 changes: 1 addition & 1 deletion pallets/subtensor/src/coinbase/reveal_commits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ impl<T: Config> Pallet<T> {
// Apply weights
// ------------------------------------------------------------------
if let Err(e) = Self::do_set_mechanism_weights(
T::RuntimeOrigin::signed(who.clone()),
OriginFor::<T>::signed(who.clone()),
netuid,
MechId::from(mecid),
uids,
Expand Down
2 changes: 1 addition & 1 deletion pallets/subtensor/src/coinbase/root.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ impl<T: Config> Pallet<T> {
/// # Returns:
/// * 'DispatchResult': A result type indicating success or failure of the registration.
///
pub fn do_root_register(origin: T::RuntimeOrigin, hotkey: T::AccountId) -> DispatchResult {
pub fn do_root_register(origin: OriginFor<T>, hotkey: T::AccountId) -> DispatchResult {
// --- 0. Get the unique identifier (UID) for the root network.
let current_block_number: u64 = Self::get_current_block_as_u64();
ensure!(
Expand Down
2 changes: 1 addition & 1 deletion pallets/subtensor/src/epoch/run_epoch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1508,7 +1508,7 @@ impl<T: Config> Pallet<T> {
}

pub fn do_set_alpha_values(
origin: T::RuntimeOrigin,
origin: OriginFor<T>,
netuid: NetUid,
alpha_low: u16,
alpha_high: u16,
Expand Down
1 change: 1 addition & 0 deletions pallets/subtensor/src/guards/check_coldkey_swap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ where
Call::announce_coldkey_swap { .. }
| Call::swap_coldkey_announced { .. }
| Call::dispute_coldkey_swap { .. }
| Call::clear_coldkey_swap_announcement { .. }
)
);

Expand Down
2 changes: 2 additions & 0 deletions pallets/subtensor/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ pub(crate) mod tests;
// apparently this is stabilized since rust 1.36
extern crate alloc;

pub type OriginFor<T> = <T as frame_system::Config>::RuntimeOrigin;

pub const MAX_CRV3_COMMIT_SIZE_BYTES: u32 = 5000;

pub const ALPHA_MAP_BATCH_SIZE: usize = 30;
Expand Down
9 changes: 6 additions & 3 deletions pallets/subtensor/src/macros/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,21 @@ mod config {
/// Configure the pallet by specifying the parameters and types on which it depends.
#[pallet::config]
pub trait Config:
frame_system::Config + pallet_drand::Config + pallet_crowdloan::Config
frame_system::Config
+ pallet_drand::Config
+ pallet_crowdloan::Config
+ pallet_scheduler::Config
{
/// call type
type RuntimeCall: Parameter
+ Dispatchable<RuntimeOrigin = Self::RuntimeOrigin>
+ Dispatchable<RuntimeOrigin = OriginFor<Self>>
+ From<Call<Self>>
+ IsType<<Self as frame_system::Config>::RuntimeCall>
+ From<frame_system::Call<Self>>;

/// A sudo-able call.
type SudoRuntimeCall: Parameter
+ UnfilteredDispatchable<RuntimeOrigin = Self::RuntimeOrigin>
+ UnfilteredDispatchable<RuntimeOrigin = OriginFor<Self>>
+ GetDispatchInfo;

/// Currency type that will be used to place deposits on neurons
Expand Down
80 changes: 51 additions & 29 deletions pallets/subtensor/src/macros/dispatches.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ mod dispatches {
.saturating_add(T::DbWeight::get().reads(10_u64))
.saturating_add(T::DbWeight::get().writes(2)), DispatchClass::Normal, Pays::No))]
pub fn commit_weights(
origin: T::RuntimeOrigin,
origin: OriginFor<T>,
netuid: NetUid,
commit_hash: H256,
) -> DispatchResult {
Expand Down Expand Up @@ -275,7 +275,7 @@ mod dispatches {
.saturating_add(T::DbWeight::get().reads(7))
.saturating_add(T::DbWeight::get().writes(2)), DispatchClass::Normal, Pays::No))]
pub fn commit_mechanism_weights(
origin: T::RuntimeOrigin,
origin: OriginFor<T>,
netuid: NetUid,
mecid: MechId,
commit_hash: H256,
Expand Down Expand Up @@ -359,7 +359,7 @@ mod dispatches {
.saturating_add(T::DbWeight::get().reads(17_u64))
.saturating_add(T::DbWeight::get().writes(2)), DispatchClass::Normal, Pays::No))]
pub fn reveal_weights(
origin: T::RuntimeOrigin,
origin: OriginFor<T>,
netuid: NetUid,
uids: Vec<u16>,
values: Vec<u16>,
Expand Down Expand Up @@ -414,7 +414,7 @@ mod dispatches {
.saturating_add(T::DbWeight::get().reads(16))
.saturating_add(T::DbWeight::get().writes(2)), DispatchClass::Normal, Pays::No))]
pub fn reveal_mechanism_weights(
origin: T::RuntimeOrigin,
origin: OriginFor<T>,
netuid: NetUid,
mecid: MechId,
uids: Vec<u16>,
Expand Down Expand Up @@ -512,7 +512,7 @@ mod dispatches {
.saturating_add(T::DbWeight::get().reads(7_u64))
.saturating_add(T::DbWeight::get().writes(2)), DispatchClass::Normal, Pays::No))]
pub fn commit_crv3_mechanism_weights(
origin: T::RuntimeOrigin,
origin: OriginFor<T>,
netuid: NetUid,
mecid: MechId,
commit: BoundedVec<u8, ConstU32<MAX_CRV3_COMMIT_SIZE_BYTES>>,
Expand Down Expand Up @@ -572,7 +572,7 @@ mod dispatches {
.saturating_add(T::DbWeight::get().reads(17_u64))
.saturating_add(T::DbWeight::get().writes(2_u64)), DispatchClass::Normal, Pays::No))]
pub fn batch_reveal_weights(
origin: T::RuntimeOrigin,
origin: OriginFor<T>,
netuid: NetUid,
uids_list: Vec<Vec<u16>>,
values_list: Vec<Vec<u16>>,
Expand Down Expand Up @@ -1339,7 +1339,7 @@ mod dispatches {
.saturating_add(T::DbWeight::get().reads(6))
.saturating_add(T::DbWeight::get().writes(31)), DispatchClass::Normal, Pays::Yes))]
pub fn set_children(
origin: T::RuntimeOrigin,
origin: OriginFor<T>,
hotkey: T::AccountId,
netuid: NetUid,
children: Vec<(u64, T::AccountId)>,
Expand Down Expand Up @@ -1558,7 +1558,7 @@ mod dispatches {
.saturating_add(T::DbWeight::get().reads(19_u64))
.saturating_add(T::DbWeight::get().writes(7_u64)), DispatchClass::Normal, Pays::Yes))]
pub fn move_stake(
origin: T::RuntimeOrigin,
origin: OriginFor<T>,
origin_hotkey: T::AccountId,
destination_hotkey: T::AccountId,
origin_netuid: NetUid,
Expand Down Expand Up @@ -1601,7 +1601,7 @@ mod dispatches {
.saturating_add(T::DbWeight::get().reads(16_u64))
.saturating_add(T::DbWeight::get().writes(6_u64)), DispatchClass::Normal, Pays::Yes))]
pub fn transfer_stake(
origin: T::RuntimeOrigin,
origin: OriginFor<T>,
destination_coldkey: T::AccountId,
hotkey: T::AccountId,
origin_netuid: NetUid,
Expand Down Expand Up @@ -1646,7 +1646,7 @@ mod dispatches {
Pays::Yes
))]
pub fn swap_stake(
origin: T::RuntimeOrigin,
origin: OriginFor<T>,
hotkey: T::AccountId,
origin_netuid: NetUid,
destination_netuid: NetUid,
Expand Down Expand Up @@ -1820,7 +1820,7 @@ mod dispatches {
Pays::Yes
))]
pub fn swap_stake_limit(
origin: T::RuntimeOrigin,
origin: OriginFor<T>,
hotkey: T::AccountId,
origin_netuid: NetUid,
destination_netuid: NetUid,
Expand Down Expand Up @@ -1853,10 +1853,7 @@ mod dispatches {
DispatchClass::Normal,
Pays::Yes
))]
pub fn try_associate_hotkey(
origin: T::RuntimeOrigin,
hotkey: T::AccountId,
) -> DispatchResult {
pub fn try_associate_hotkey(origin: OriginFor<T>, hotkey: T::AccountId) -> DispatchResult {
let coldkey = ensure_signed(origin)?;

let _ = Self::do_try_associate_hotkey(&coldkey, &hotkey);
Expand All @@ -1878,7 +1875,7 @@ mod dispatches {
DispatchClass::Normal,
Pays::Yes
))]
pub fn start_call(origin: T::RuntimeOrigin, netuid: NetUid) -> DispatchResult {
pub fn start_call(origin: OriginFor<T>, netuid: NetUid) -> DispatchResult {
Self::do_start_call(origin, netuid)?;
Ok(())
}
Expand Down Expand Up @@ -1915,7 +1912,7 @@ mod dispatches {
Pays::No
))]
pub fn associate_evm_key(
origin: T::RuntimeOrigin,
origin: OriginFor<T>,
netuid: NetUid,
evm_key: H160,
block_number: u64,
Expand All @@ -1941,7 +1938,7 @@ mod dispatches {
Pays::Yes
))]
pub fn recycle_alpha(
origin: T::RuntimeOrigin,
origin: OriginFor<T>,
hotkey: T::AccountId,
amount: AlphaBalance,
netuid: NetUid,
Expand All @@ -1966,7 +1963,7 @@ mod dispatches {
Pays::Yes
))]
pub fn burn_alpha(
origin: T::RuntimeOrigin,
origin: OriginFor<T>,
hotkey: T::AccountId,
amount: AlphaBalance,
netuid: NetUid,
Expand Down Expand Up @@ -1995,7 +1992,7 @@ mod dispatches {
.saturating_add(T::DbWeight::get().reads(30_u64))
.saturating_add(T::DbWeight::get().writes(13_u64)), DispatchClass::Normal, Pays::Yes))]
pub fn remove_stake_full_limit(
origin: T::RuntimeOrigin,
origin: OriginFor<T>,
hotkey: T::AccountId,
netuid: NetUid,
limit_price: Option<TaoBalance>,
Expand All @@ -2022,7 +2019,7 @@ mod dispatches {
#[pallet::call_index(110)]
#[pallet::weight(SubnetLeasingWeightInfo::<T>::do_register_leased_network(T::MaxContributors::get()))]
pub fn register_leased_network(
origin: T::RuntimeOrigin,
origin: OriginFor<T>,
emissions_share: Percent,
end_block: Option<BlockNumberFor<T>>,
) -> DispatchResultWithPostInfo {
Expand All @@ -2048,7 +2045,7 @@ mod dispatches {
#[pallet::call_index(111)]
#[pallet::weight(SubnetLeasingWeightInfo::<T>::do_terminate_lease(T::MaxContributors::get()))]
pub fn terminate_lease(
origin: T::RuntimeOrigin,
origin: OriginFor<T>,
lease_id: LeaseId,
hotkey: T::AccountId,
) -> DispatchResultWithPostInfo {
Expand Down Expand Up @@ -2121,7 +2118,7 @@ mod dispatches {
.saturating_add(T::DbWeight::get().reads(10_u64))
.saturating_add(T::DbWeight::get().writes(2)), DispatchClass::Normal, Pays::No))]
pub fn commit_timelocked_weights(
origin: T::RuntimeOrigin,
origin: OriginFor<T>,
netuid: NetUid,
commit: BoundedVec<u8, ConstU32<MAX_CRV3_COMMIT_SIZE_BYTES>>,
reveal_round: u64,
Expand Down Expand Up @@ -2152,7 +2149,7 @@ mod dispatches {
.saturating_add(T::DbWeight::get().reads(4_u64))
.saturating_add(T::DbWeight::get().writes(2_u64)), DispatchClass::Normal, Pays::Yes))]
pub fn set_coldkey_auto_stake_hotkey(
origin: T::RuntimeOrigin,
origin: OriginFor<T>,
netuid: NetUid,
hotkey: T::AccountId,
) -> DispatchResult {
Expand Down Expand Up @@ -2226,7 +2223,7 @@ mod dispatches {
.saturating_add(T::DbWeight::get().reads(9_u64))
.saturating_add(T::DbWeight::get().writes(2)), DispatchClass::Normal, Pays::No))]
pub fn commit_timelocked_mechanism_weights(
origin: T::RuntimeOrigin,
origin: OriginFor<T>,
netuid: NetUid,
mecid: MechId,
commit: BoundedVec<u8, ConstU32<MAX_CRV3_COMMIT_SIZE_BYTES>>,
Expand Down Expand Up @@ -2326,7 +2323,7 @@ mod dispatches {

/// --- Sets root claim number (sudo extrinsic). Zero disables auto-claim.
#[pallet::call_index(123)]
#[pallet::weight(Weight::from_parts(4_000_000, 0)
#[pallet::weight(Weight::from_parts(2_283_000, 0)
.saturating_add(T::DbWeight::get().reads(0_u64))
.saturating_add(T::DbWeight::get().writes(1_u64)))]
pub fn sudo_set_num_root_claims(origin: OriginFor<T>, new_value: u64) -> DispatchResult {
Expand Down Expand Up @@ -2397,8 +2394,8 @@ mod dispatches {

if let Some((when, _)) = ColdkeySwapAnnouncements::<T>::get(who.clone()) {
let reannouncement_delay = ColdkeySwapReannouncementDelay::<T>::get();
let new_when = when.saturating_add(reannouncement_delay);
ensure!(now >= new_when, Error::<T>::ColdkeySwapReannouncedTooEarly);
let min_when = when.saturating_add(reannouncement_delay);
ensure!(now >= min_when, Error::<T>::ColdkeySwapReannouncedTooEarly);
} else {
// Only charge the swap cost on the first announcement
let swap_cost = Self::get_key_swap_cost();
Expand Down Expand Up @@ -2596,13 +2593,38 @@ mod dispatches {
Pays::Yes
))]
pub fn add_stake_burn(
origin: T::RuntimeOrigin,
origin: OriginFor<T>,
hotkey: T::AccountId,
netuid: NetUid,
amount: TaoBalance,
limit: Option<TaoBalance>,
) -> DispatchResult {
Self::do_add_stake_burn(origin, hotkey, netuid, amount, limit)
}

/// Clears a coldkey swap announcement after the reannouncement delay if
/// it has not been disputed.
///
/// The `ColdkeySwapCleared` event is emitted on successful clear.
#[pallet::call_index(133)]
#[pallet::weight(Weight::from_parts(17_890_000, 0)
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1)))]
pub fn clear_coldkey_swap_announcement(origin: OriginFor<T>) -> DispatchResult {
let who = ensure_signed(origin)?;
let now = <frame_system::Pallet<T>>::block_number();

let Some((when, _)) = ColdkeySwapAnnouncements::<T>::get(who.clone()) else {
return Err(Error::<T>::ColdkeySwapAnnouncementNotFound.into());
};
let delay = ColdkeySwapReannouncementDelay::<T>::get();
let min_when = when.saturating_add(delay);
ensure!(now >= min_when, Error::<T>::ColdkeySwapClearTooEarly);

ColdkeySwapAnnouncements::<T>::remove(&who);

Self::deposit_event(Event::ColdkeySwapCleared { who });
Ok(())
}
}
}
2 changes: 2 additions & 0 deletions pallets/subtensor/src/macros/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -284,5 +284,7 @@ mod errors {
ColdkeySwapAnnounced,
/// A coldkey swap for this account is under dispute.
ColdkeySwapDisputed,
/// Coldkey swap clear too early.
ColdkeySwapClearTooEarly,
}
}
Loading
Loading