Skip to content

Commit 6bddb56

Browse files
committed
no alpha out thing
1 parent a837632 commit 6bddb56

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

pallets/subtensor/src/coinbase/run_coinbase.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,7 @@ impl<T: Config> Pallet<T> {
8383
);
8484
if let Ok(buy_swap_result_ok) = buy_swap_result {
8585
let bought_alpha = AlphaCurrency::from(buy_swap_result_ok.amount_paid_out);
86-
SubnetAlphaOut::<T>::mutate(*netuid_i, |total| {
87-
*total = total.saturating_sub(bought_alpha);
88-
});
86+
Self::recycle_subnet_alpha(*netuid_i, bought_alpha);
8987
}
9088
is_subsidized.insert(*netuid_i, true);
9189
} else {
@@ -110,6 +108,7 @@ impl<T: Config> Pallet<T> {
110108
alpha_in.insert(*netuid_i, alpha_in_i);
111109
alpha_out.insert(*netuid_i, alpha_out_i);
112110
}
111+
log::debug!("is_subsidized: {is_subsidized:?}");
113112
log::debug!("tao_in: {tao_in:?}");
114113
log::debug!("alpha_in: {alpha_in:?}");
115114
log::debug!("alpha_out: {alpha_out:?}");
@@ -235,9 +234,6 @@ impl<T: Config> Pallet<T> {
235234
if Self::should_run_epoch(netuid, current_block)
236235
&& Self::is_epoch_input_state_consistent(netuid)
237236
{
238-
let alpha_out_i: AlphaCurrency =
239-
tou64!(*alpha_out.get(&netuid).unwrap_or(&asfloat!(0.0))).into();
240-
241237
// Restart counters.
242238
BlocksSinceLastStep::<T>::insert(netuid, 0);
243239
LastMechansimStepBlock::<T>::insert(netuid, current_block);
@@ -259,7 +255,7 @@ impl<T: Config> Pallet<T> {
259255
netuid,
260256
pending_alpha,
261257
pending_root_alpha,
262-
alpha_out_i,
258+
pending_alpha.saturating_add(pending_root_alpha),
263259
owner_cut,
264260
);
265261
} else {
@@ -497,6 +493,7 @@ impl<T: Config> Pallet<T> {
497493
let destination = maybe_dest.clone().unwrap_or(hotkey.clone());
498494

499495
if let Some(dest) = maybe_dest {
496+
log::debug!("incentives: auto staking {incentive:?} to {dest:?}");
500497
Self::deposit_event(Event::<T>::AutoStakeAdded {
501498
netuid,
502499
destination: dest,
@@ -505,6 +502,9 @@ impl<T: Config> Pallet<T> {
505502
incentive,
506503
});
507504
}
505+
log::debug!(
506+
"incentives: increasing stake for {hotkey:?} to {incentive:?} with owner {owner:?}"
507+
);
508508
Self::increase_stake_for_hotkey_and_coldkey_on_subnet(
509509
&destination,
510510
&owner,
@@ -619,7 +619,7 @@ impl<T: Config> Pallet<T> {
619619
netuid: NetUid,
620620
pending_alpha: AlphaCurrency,
621621
pending_root_alpha: AlphaCurrency,
622-
alpha_out: AlphaCurrency, // total alpha out for the subnet
622+
total_alpha: AlphaCurrency,
623623
owner_cut: AlphaCurrency,
624624
) {
625625
log::debug!(
@@ -630,7 +630,7 @@ impl<T: Config> Pallet<T> {
630630

631631
// Run the epoch.
632632
let hotkey_emission: Vec<(T::AccountId, AlphaCurrency, AlphaCurrency)> =
633-
Self::epoch_with_mechanisms(netuid, alpha_out);
633+
Self::epoch_with_mechanisms(netuid, total_alpha);
634634
log::debug!("hotkey_emission: {hotkey_emission:?}");
635635

636636
// Compute the pending validator alpha.
@@ -646,7 +646,7 @@ impl<T: Config> Pallet<T> {
646646
log::debug!("incentive_sum: {incentive_sum:?}");
647647

648648
let pending_validator_alpha = if !incentive_sum.is_zero() {
649-
alpha_out
649+
total_alpha
650650
.saturating_div(2.into())
651651
.saturating_sub(pending_root_alpha)
652652
} else {

0 commit comments

Comments
 (0)