Skip to content

Commit 2d333cf

Browse files
committed
Fix tests
1 parent efbb92b commit 2d333cf

File tree

8 files changed

+363
-446
lines changed

8 files changed

+363
-446
lines changed

pallets/subtensor/src/epoch/run_epoch.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ impl<T: Config> Pallet<T> {
390390
.iter()
391391
.map(|updated| updated.saturating_add(activity_cutoff) < current_block)
392392
.collect();
393-
log::trace!("Inactive: {:?}", inactive.clone());
393+
log::debug!("Inactive: {:?}", inactive.clone());
394394

395395
// Logical negation of inactive.
396396
let active: Vec<bool> = inactive.iter().map(|&b| !b).collect();
@@ -406,14 +406,14 @@ impl<T: Config> Pallet<T> {
406406
let hotkeys: Vec<(u16, T::AccountId)> =
407407
<Keys<T> as IterableStorageDoubleMap<u16, u16, T::AccountId>>::iter_prefix(netuid)
408408
.collect();
409-
log::trace!("hotkeys: {:?}", &hotkeys);
409+
log::debug!("hotkeys: {:?}", &hotkeys);
410410

411411
// Access network stake as normalized vector.
412412
let (mut total_stake, _alpha_stake, _tao_stake): (Vec<I64F64>, Vec<I64F64>, Vec<I64F64>) =
413413
Self::get_stake_weights_for_network(netuid);
414414
inplace_normalize_64(&mut total_stake);
415415
let stake: Vec<I32F32> = vec_fixed64_to_fixed32(total_stake);
416-
log::trace!("Normalised Stake: {:?}", &stake);
416+
log::debug!("Normalised Stake: {:?}", &stake);
417417

418418
// =======================
419419
// == Validator permits ==
@@ -448,7 +448,7 @@ impl<T: Config> Pallet<T> {
448448

449449
// Normalize active stake.
450450
inplace_normalize(&mut active_stake);
451-
log::trace!("Active Stake:\n{:?}\n", &active_stake);
451+
log::debug!("Active Stake:\n{:?}\n", &active_stake);
452452

453453
// =============
454454
// == Weights ==

pallets/subtensor/src/staking/helpers.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,12 @@ impl<T: Config> Pallet<T> {
6363
.iter()
6464
.map(|hotkey| {
6565
let mut total_stake: u64 = 0;
66-
for (netuid, alpha) in Alpha::<T>::iter_prefix((hotkey, coldkey)) {
66+
for (netuid, _) in Alpha::<T>::iter_prefix((hotkey, coldkey)) {
67+
let alpha_stake =
68+
Self::get_stake_for_hotkey_and_coldkey_on_subnet(hotkey, coldkey, netuid);
6769
let tao_price: I96F32 = Self::get_alpha_price(netuid);
6870
total_stake = total_stake.saturating_add(
69-
I96F32::saturating_from_num(alpha)
71+
I96F32::saturating_from_num(alpha_stake)
7072
.saturating_mul(tao_price)
7173
.saturating_to_num::<u64>(),
7274
);

pallets/subtensor/src/staking/stake_utils.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ impl<T: Config> Pallet<T> {
167167
}
168168
})
169169
.collect();
170-
log::trace!("alpha_stake: {:?}", alpha_stake);
170+
log::debug!("alpha_stake: {:?}", alpha_stake);
171171

172172
// Step 3: Calculate the global tao stake vector.
173173
// Initialize a vector to store global tao stakes for each neuron.
@@ -322,7 +322,7 @@ impl<T: Config> Pallet<T> {
322322
// Step 1: Retrieve the initial total stake (alpha) for the hotkey on the specified subnet.
323323
let initial_alpha: I96F32 =
324324
I96F32::saturating_from_num(Self::get_stake_for_hotkey_on_subnet(hotkey, netuid));
325-
log::trace!(
325+
log::debug!(
326326
"Initial alpha for hotkey {:?} on subnet {}: {:?}",
327327
hotkey,
328328
netuid,
@@ -339,13 +339,13 @@ impl<T: Config> Pallet<T> {
339339
// Step 2: Retrieve the lists of parents and children for the hotkey on the subnet.
340340
let parents: Vec<(u64, T::AccountId)> = Self::get_parents(hotkey, netuid);
341341
let children: Vec<(u64, T::AccountId)> = Self::get_children(hotkey, netuid);
342-
log::trace!(
342+
log::debug!(
343343
"Parents for hotkey {:?} on subnet {}: {:?}",
344344
hotkey,
345345
netuid,
346346
parents
347347
);
348-
log::trace!(
348+
log::debug!(
349349
"Children for hotkey {:?} on subnet {}: {:?}",
350350
hotkey,
351351
netuid,
@@ -370,7 +370,7 @@ impl<T: Config> Pallet<T> {
370370
// Add this child's allocation to the total alpha allocated to children.
371371
alpha_to_children = alpha_to_children.saturating_add(alpha_proportion_to_child);
372372
}
373-
log::trace!("Total alpha allocated to children: {:?}", alpha_to_children);
373+
log::debug!("Total alpha allocated to children: {:?}", alpha_to_children);
374374

375375
// Step 4: Calculate the total alpha inherited from parents.
376376
for (proportion, parent) in parents {
@@ -403,7 +403,7 @@ impl<T: Config> Pallet<T> {
403403
// Add this parent's contribution to the total alpha inherited from parents.
404404
alpha_from_parents = alpha_from_parents.saturating_add(alpha_proportion_from_parent);
405405
}
406-
log::trace!(
406+
log::debug!(
407407
"Total alpha inherited from parents: {:?}",
408408
alpha_from_parents
409409
);

0 commit comments

Comments
 (0)