From ef5d36f7ebc6c899b34cc60393cabe4cd00803dd Mon Sep 17 00:00:00 2001 From: tb-team-dev-2 Date: Mon, 24 Mar 2025 23:49:12 +0000 Subject: [PATCH 1/2] feat: add actual_fee to StakeAdded and StakeRemoved events --- pallets/subtensor/src/macros/events.rs | 4 ++-- pallets/subtensor/src/staking/stake_utils.rs | 12 ++++++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/pallets/subtensor/src/macros/events.rs b/pallets/subtensor/src/macros/events.rs index 834aa901fa..2bccf8b8ac 100644 --- a/pallets/subtensor/src/macros/events.rs +++ b/pallets/subtensor/src/macros/events.rs @@ -14,9 +14,9 @@ mod events { /// a network is removed. NetworkRemoved(u16), /// stake has been transferred from the a coldkey account onto the hotkey staking account. - StakeAdded(T::AccountId, T::AccountId, u64, u64, u16), + StakeAdded(T::AccountId, T::AccountId, u64, u64, u16, u64), /// stake has been removed from the hotkey staking account onto the coldkey account. - StakeRemoved(T::AccountId, T::AccountId, u64, u64, u16), + StakeRemoved(T::AccountId, T::AccountId, u64, u64, u16, u64), /// stake has been moved from origin (hotkey, subnet ID) to destination (hotkey, subnet ID) of this amount (in TAO). StakeMoved(T::AccountId, T::AccountId, u16, T::AccountId, u16, u64), /// a caller successfully sets their weights on a subnetwork. diff --git a/pallets/subtensor/src/staking/stake_utils.rs b/pallets/subtensor/src/staking/stake_utils.rs index 894a5a9132..de99ffa106 100644 --- a/pallets/subtensor/src/staking/stake_utils.rs +++ b/pallets/subtensor/src/staking/stake_utils.rs @@ -794,14 +794,16 @@ impl Pallet { tao_unstaked, actual_alpha_decrease, netuid, + actual_fee )); log::debug!( - "StakeRemoved( coldkey: {:?}, hotkey:{:?}, tao: {:?}, alpha:{:?}, netuid: {:?} )", + "StakeRemoved( coldkey: {:?}, hotkey:{:?}, tao: {:?}, alpha:{:?}, netuid: {:?}, fee: {:?} )", coldkey.clone(), hotkey.clone(), tao_unstaked, actual_alpha_decrease, - netuid + netuid, + actual_fee ); // Step 6: Return the amount of TAO unstaked. @@ -857,14 +859,16 @@ impl Pallet { tao_staked, actual_alpha, netuid, + actual_fee )); log::debug!( - "StakeAdded( coldkey: {:?}, hotkey:{:?}, tao: {:?}, alpha:{:?}, netuid: {:?} )", + "StakeAdded( coldkey: {:?}, hotkey:{:?}, tao: {:?}, alpha:{:?}, netuid: {:?}, fee: {:?} )", coldkey.clone(), hotkey.clone(), tao_staked, actual_alpha, - netuid + netuid, + actual_fee ); // Step 7: Return the amount of alpha staked From 9d9893a9e7d3bb122d1e16aef7a5e7217df8a769 Mon Sep 17 00:00:00 2001 From: tb-team-dev-2 Date: Mon, 24 Mar 2025 23:54:47 +0000 Subject: [PATCH 2/2] feat: add actual_fee to StakeAdded and StakeRemoved events pt 2 --- pallets/subtensor/src/staking/stake_utils.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pallets/subtensor/src/staking/stake_utils.rs b/pallets/subtensor/src/staking/stake_utils.rs index de99ffa106..105e230247 100644 --- a/pallets/subtensor/src/staking/stake_utils.rs +++ b/pallets/subtensor/src/staking/stake_utils.rs @@ -794,7 +794,7 @@ impl Pallet { tao_unstaked, actual_alpha_decrease, netuid, - actual_fee + actual_fee, )); log::debug!( "StakeRemoved( coldkey: {:?}, hotkey:{:?}, tao: {:?}, alpha:{:?}, netuid: {:?}, fee: {:?} )", @@ -859,7 +859,7 @@ impl Pallet { tao_staked, actual_alpha, netuid, - actual_fee + actual_fee, )); log::debug!( "StakeAdded( coldkey: {:?}, hotkey:{:?}, tao: {:?}, alpha:{:?}, netuid: {:?}, fee: {:?} )",