From cbf5be086c762a7dcafa81b95ced76d10cdcd14f Mon Sep 17 00:00:00 2001 From: open-junius Date: Tue, 9 Sep 2025 09:27:01 +0800 Subject: [PATCH 1/3] add recycle alpha helper function --- pallets/subtensor/src/coinbase/run_coinbase.rs | 2 +- pallets/subtensor/src/staking/helpers.rs | 2 +- pallets/subtensor/src/staking/recycle_alpha.rs | 4 +--- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/pallets/subtensor/src/coinbase/run_coinbase.rs b/pallets/subtensor/src/coinbase/run_coinbase.rs index 21fc9bd603..c76e6941e3 100644 --- a/pallets/subtensor/src/coinbase/run_coinbase.rs +++ b/pallets/subtensor/src/coinbase/run_coinbase.rs @@ -830,7 +830,7 @@ impl Pallet { parent_emission = parent_emission.saturating_sub(child_take); total_child_take = total_child_take.saturating_add(child_take); - Self::burn_subnet_alpha( + Self::recycle_subnet_alpha( netuid, AlphaCurrency::from(burn_take.saturating_to_num::()), ); diff --git a/pallets/subtensor/src/staking/helpers.rs b/pallets/subtensor/src/staking/helpers.rs index c89a762f91..7b1b644e85 100644 --- a/pallets/subtensor/src/staking/helpers.rs +++ b/pallets/subtensor/src/staking/helpers.rs @@ -322,7 +322,7 @@ impl Pallet { T::SwapInterface::is_user_liquidity_enabled(netuid) } - pub fn burn_subnet_alpha(netuid: NetUid, amount: AlphaCurrency) { + pub fn recycle_subnet_alpha(netuid: NetUid, amount: AlphaCurrency) { SubnetAlphaOut::::mutate(netuid, |total| { *total = total.saturating_sub(amount); }); diff --git a/pallets/subtensor/src/staking/recycle_alpha.rs b/pallets/subtensor/src/staking/recycle_alpha.rs index cbd5161a4c..ccdfdb8fde 100644 --- a/pallets/subtensor/src/staking/recycle_alpha.rs +++ b/pallets/subtensor/src/staking/recycle_alpha.rs @@ -59,9 +59,7 @@ impl Pallet { ); // Recycle means we should decrease the alpha issuance tracker. - SubnetAlphaOut::::mutate(netuid, |total| { - *total = total.saturating_sub(actual_alpha_decrease); - }); + Self::recycle_subnet_alpha(netuid, amount); Self::deposit_event(Event::AlphaRecycled( coldkey, From bf96a2bb3db9d1c8135c880f0d09d1528f8c9686 Mon Sep 17 00:00:00 2001 From: open-junius Date: Tue, 9 Sep 2025 09:45:32 +0800 Subject: [PATCH 2/3] commit Cargo.lock --- pallets/subtensor/src/staking/recycle_alpha.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pallets/subtensor/src/staking/recycle_alpha.rs b/pallets/subtensor/src/staking/recycle_alpha.rs index ccdfdb8fde..4c1bbd0b9f 100644 --- a/pallets/subtensor/src/staking/recycle_alpha.rs +++ b/pallets/subtensor/src/staking/recycle_alpha.rs @@ -1,6 +1,6 @@ use super::*; use crate::{Error, system::ensure_signed}; -use subtensor_runtime_common::{AlphaCurrency, Currency, NetUid}; +use subtensor_runtime_common::{AlphaCurrency, NetUid}; impl Pallet { /// Recycles alpha from a cold/hot key pair, reducing AlphaOut on a subnet From 8d9ff93c3e1da3b91b6b6d1865bd61de5a484a05 Mon Sep 17 00:00:00 2001 From: open-junius Date: Tue, 9 Sep 2025 09:47:45 +0800 Subject: [PATCH 3/3] bump version --- runtime/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index 6df7f5df66..40c76514d4 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -220,7 +220,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { // `spec_version`, and `authoring_version` are the same between Wasm and native. // This value is set to 100 to notify Polkadot-JS App (https://polkadot.js.org/apps) to use // the compatible custom types. - spec_version: 312, + spec_version: 313, impl_version: 1, apis: RUNTIME_API_VERSIONS, transaction_version: 1,