diff --git a/pallets/subtensor/src/coinbase/run_coinbase.rs b/pallets/subtensor/src/coinbase/run_coinbase.rs index dcdab8072e..73fc928e90 100644 --- a/pallets/subtensor/src/coinbase/run_coinbase.rs +++ b/pallets/subtensor/src/coinbase/run_coinbase.rs @@ -39,13 +39,14 @@ impl Pallet { log::debug!("Subnets to emit to: {subnets_to_emit_to:?}"); // --- 2. Get sum of tao reserves ( in a later version we will switch to prices. ) - let mut total_moving_prices = U96F32::saturating_from_num(0.0); + let mut acc_total_moving_prices = U96F32::saturating_from_num(0.0); // Only get price EMA for subnets that we emit to. for netuid_i in subnets_to_emit_to.iter() { // Get and update the moving price of each subnet adding the total together. - total_moving_prices = - total_moving_prices.saturating_add(Self::get_moving_alpha_price(*netuid_i)); + acc_total_moving_prices = + acc_total_moving_prices.saturating_add(Self::get_moving_alpha_price(*netuid_i)); } + let total_moving_prices = acc_total_moving_prices; log::debug!("total_moving_prices: {total_moving_prices:?}"); // --- 3. Get subnet terms (tao_in, alpha_in, and alpha_out) @@ -183,21 +184,22 @@ impl Pallet { }); } + // Get total TAO on root. + let root_tao: U96F32 = asfloat!(SubnetTAO::::get(NetUid::ROOT)); + log::debug!("root_tao: {root_tao:?}"); + // Get tao_weight + let tao_weight: U96F32 = root_tao.saturating_mul(Self::get_tao_weight()); + log::debug!("tao_weight: {tao_weight:?}"); + // --- 6. Seperate out root dividends in alpha and sell them into tao. // Then accumulate those dividends for later. for netuid_i in subnets_to_emit_to.iter() { // Get remaining alpha out. let alpha_out_i: U96F32 = *alpha_out.get(netuid_i).unwrap_or(&asfloat!(0.0)); log::debug!("alpha_out_i: {alpha_out_i:?}"); - // Get total TAO on root. - let root_tao: U96F32 = asfloat!(SubnetTAO::::get(NetUid::ROOT)); - log::debug!("root_tao: {root_tao:?}"); // Get total ALPHA on subnet. let alpha_issuance: U96F32 = asfloat!(Self::get_alpha_issuance(*netuid_i)); log::debug!("alpha_issuance: {alpha_issuance:?}"); - // Get tao_weight - let tao_weight: U96F32 = root_tao.saturating_mul(Self::get_tao_weight()); - log::debug!("tao_weight: {tao_weight:?}"); // Get root proportional dividends. let root_proportion: U96F32 = tao_weight .checked_div(tao_weight.saturating_add(alpha_issuance)) @@ -239,14 +241,14 @@ impl Pallet { }); } - // --- 7 Update moving prices after using them in the emission calculation. + // --- 7. Update moving prices after using them in the emission calculation. // Only update price EMA for subnets that we emit to. for netuid_i in subnets_to_emit_to.iter() { // Update moving prices after using them above. Self::update_moving_price(*netuid_i); } - // --- 7. Drain pending emission through the subnet based on tempo. + // --- 8. Drain pending emission through the subnet based on tempo. // Run the epoch for *all* subnets, even if we don't emit anything. for &netuid in subnets.iter() { // Reveal matured weights. diff --git a/pallets/subtensor/src/subnets/registration.rs b/pallets/subtensor/src/subnets/registration.rs index bfde68601d..c8f6b04cb6 100644 --- a/pallets/subtensor/src/subnets/registration.rs +++ b/pallets/subtensor/src/subnets/registration.rs @@ -369,7 +369,7 @@ impl Pallet { // --- 5. Add Balance via faucet. let balance_to_add: u64 = 1_000_000_000_000; - Self::coinbase(100_000_000_000.into()); // We are creating tokens here from the coinbase. + Self::increase_issuance(100_000_000_000.into()); // We are creating tokens here from the coinbase. Self::add_balance_to_coldkey_account(&coldkey, balance_to_add); diff --git a/pallets/subtensor/src/utils/misc.rs b/pallets/subtensor/src/utils/misc.rs index 9fd6d27de7..f64962f094 100644 --- a/pallets/subtensor/src/utils/misc.rs +++ b/pallets/subtensor/src/utils/misc.rs @@ -273,7 +273,7 @@ impl Pallet { pub fn burn_tokens(amount: TaoCurrency) { TotalIssuance::::put(TotalIssuance::::get().saturating_sub(amount)); } - pub fn coinbase(amount: TaoCurrency) { + pub fn increase_issuance(amount: TaoCurrency) { TotalIssuance::::put(TotalIssuance::::get().saturating_add(amount)); } diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index 60687d3a30..00cc24b411 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: 306, + spec_version: 307, impl_version: 1, apis: RUNTIME_API_VERSIONS, transaction_version: 1,