diff --git a/pallets/subtensor/src/staking/stake_utils.rs b/pallets/subtensor/src/staking/stake_utils.rs index 1cbd0d2b7..402f999db 100644 --- a/pallets/subtensor/src/staking/stake_utils.rs +++ b/pallets/subtensor/src/staking/stake_utils.rs @@ -707,6 +707,8 @@ impl Pallet { let protocol_tao_after = Self::get_protocol_tao(netuid); // This should decrease as we are removing TAO from the protocol. let protocol_tao_delta: TaoCurrency = protocol_tao.saturating_sub(protocol_tao_after); + // Use max to overstate the TAO flow from the protocol. + let tao_flow = protocol_tao_delta.max(swap_result.amount_paid_out.into()); // Refund the unused alpha (in case if limit price is hit) let refund = actual_alpha_decrease.saturating_sub( @@ -734,7 +736,7 @@ impl Pallet { // } // Record TAO outflow - Self::record_tao_outflow(netuid, protocol_tao_delta); + Self::record_tao_outflow(netuid, tao_flow); LastColdkeyHotkeyStakeBlock::::insert(coldkey, hotkey, Self::get_current_block_as_u64()); @@ -784,6 +786,8 @@ impl Pallet { // This should increase as we are adding TAO to the protocol. let protocol_tao_delta: TaoCurrency = protocol_tao_after.saturating_sub(protocol_tao); + // Use min to understate the TAO flow into the protocol. + let tao_flow = protocol_tao_delta.min(tao); ensure!( !swap_result.amount_paid_out.is_zero(), @@ -820,7 +824,7 @@ impl Pallet { } // Record TAO inflow - Self::record_tao_inflow(netuid, protocol_tao_delta); + Self::record_tao_inflow(netuid, tao_flow); LastColdkeyHotkeyStakeBlock::::insert(coldkey, hotkey, Self::get_current_block_as_u64()); diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index f6843c50e..9ece1dd02 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: 346, + spec_version: 347, impl_version: 1, apis: RUNTIME_API_VERSIONS, transaction_version: 1,