Skip to content

Multiply Emission by Root Proportion #1646

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: devnet-ready
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion pallets/subtensor/src/coinbase/run_coinbase.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ impl<T: Config> Pallet<T> {
.saturating_mul(moving_price_i)
.checked_div(total_moving_prices)
.unwrap_or(asfloat!(0.0));
log::debug!("tao_in_i: {:?}", tao_in_i);
log::debug!("tao_in_i (before root proportion): {:?}", tao_in_i);
tao_in_i = Self::adjust_inbound_tao_for_root_proportion(*netuid_i, tao_in_i);
log::debug!("tao_in_i (post-root-proportion): {:?}", tao_in_i);
// Get alpha_emission total
let alpha_emission_i: U96F32 = asfloat!(
Self::get_block_emission_for_issuance(Self::get_alpha_issuance(*netuid_i))
Expand Down Expand Up @@ -972,4 +974,13 @@ impl<T: Config> Pallet<T> {

Ok(())
}

pub fn adjust_inbound_tao_for_root_proportion(netuid: u16, inbound_tao: U96F32) -> U96F32 {
let root_tao: U96F32 = asfloat!(SubnetTAO::<T>::get(0));
let root_stake: U96F32 = root_tao.saturating_mul(Self::get_tao_weight());
let netuid_tao: U96F32 = asfloat!(SubnetTAO::<T>::get(netuid));
let total_stake: U96F32 = root_stake.saturating_add(netuid_tao);
let root_proportion: U96F32 = root_stake.checked_div(total_stake).unwrap_or(asfloat!(1.0));
inbound_tao.saturating_mul(root_proportion)
}
}
Loading