From 9a16c3dfb0c51c9e77be42aaa9512696c2745434 Mon Sep 17 00:00:00 2001 From: Greg Zaitsev Date: Mon, 8 Dec 2025 16:15:49 -0500 Subject: [PATCH 1/2] Fix: Do not hold tao fees when dissolving LP --- pallets/swap/src/pallet/impls.rs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/pallets/swap/src/pallet/impls.rs b/pallets/swap/src/pallet/impls.rs index 74f6d410d5..d92afda1c3 100644 --- a/pallets/swap/src/pallet/impls.rs +++ b/pallets/swap/src/pallet/impls.rs @@ -880,10 +880,12 @@ impl Pallet { // ---------------- USER: refund τ and convert α → stake ---------------- // 1) Refund τ principal directly. - if rm.tao > TaoCurrency::ZERO { - T::BalanceOps::increase_balance(&owner, rm.tao); - user_refunded_tao = user_refunded_tao.saturating_add(rm.tao); - T::TaoReserve::decrease_provided(netuid, rm.tao); + let tao_total_from_pool: TaoCurrency = rm.tao.saturating_add(rm.fee_tao); + if tao_total_from_pool > TaoCurrency::ZERO { + T::BalanceOps::increase_balance(&owner, tao_total_from_pool); + user_refunded_tao = + user_refunded_tao.saturating_add(tao_total_from_pool); + T::TaoReserve::decrease_provided(netuid, tao_total_from_pool); } // 2) Stake ALL withdrawn α (principal + fees) to the best permitted validator. @@ -967,17 +969,17 @@ impl Pallet { Ok(rm) => { let alpha_total_from_pool: AlphaCurrency = rm.alpha.saturating_add(rm.fee_alpha); - let tao = rm.tao; + let tao_total_from_pool: TaoCurrency = rm.tao.saturating_add(rm.fee_tao); - if tao > TaoCurrency::ZERO { - burned_tao = burned_tao.saturating_add(tao); + if tao_total_from_pool > TaoCurrency::ZERO { + burned_tao = burned_tao.saturating_add(tao_total_from_pool); } if alpha_total_from_pool > AlphaCurrency::ZERO { burned_alpha = burned_alpha.saturating_add(alpha_total_from_pool); } log::debug!( - "clear_protocol_liquidity: burned protocol pos: netuid={netuid:?}, pos_id={pos_id:?}, τ={tao:?}, α_total={alpha_total_from_pool:?}" + "clear_protocol_liquidity: burned protocol pos: netuid={netuid:?}, pos_id={pos_id:?}, τ={tao_total_from_pool:?}, α_total={alpha_total_from_pool:?}" ); } Err(e) => { From a8d17454a423672435e85f4b042382bb50e6df83 Mon Sep 17 00:00:00 2001 From: Greg Zaitsev Date: Mon, 8 Dec 2025 16:35:55 -0500 Subject: [PATCH 2/2] spec bump --- 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 e5c733d7ed..11d3487f33 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: 350, + spec_version: 351, impl_version: 1, apis: RUNTIME_API_VERSIONS, transaction_version: 1,