Skip to content

Commit cc44b64

Browse files
committed
remove epoch run
1 parent 0604c60 commit cc44b64

File tree

1 file changed

+11
-32
lines changed

1 file changed

+11
-32
lines changed

pallets/subtensor/src/tests/children.rs

Lines changed: 11 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -3426,38 +3426,6 @@ fn test_parent_child_chain_emission() {
34263426

34273427
let hardcoded_emission: I96F32 = I96F32::from_num(1_000_000); // 1 million (adjust as needed)
34283428

3429-
let hotkey_emission: Vec<(U256, u64, u64)> =
3430-
SubtensorModule::epoch(netuid, hardcoded_emission.saturating_to_num::<u64>());
3431-
log::info!("hotkey_emission: {:?}", hotkey_emission);
3432-
let total_emission: I96F32 = hotkey_emission
3433-
.iter()
3434-
.map(|(_, _, emission)| I96F32::from_num(*emission))
3435-
.sum();
3436-
3437-
// Verify emissions match expected from CHK arrangements
3438-
let em_eps: I96F32 = I96F32::from_num(1e-4); // 4 decimal places
3439-
// A's pending emission:
3440-
assert!(
3441-
((I96F32::from_num(hotkey_emission[0].2) / total_emission) -
3442-
I96F32::from_num(2_f64 / 3_f64 * 1_f64 / 2_f64)).abs() // 2/3 * 1/2 = 1/3; 50% -> B
3443-
<= em_eps,
3444-
"A should have pending emission of 1/3 of total emission"
3445-
);
3446-
// B's pending emission:
3447-
assert!(
3448-
((I96F32::from_num(hotkey_emission[1].2) / total_emission) -
3449-
(I96F32::from_num(2_f64 / 9_f64 * 1_f64 / 2_f64 + 2_f64 / 3_f64 * 1_f64 / 2_f64))).abs() // 2/9 * 1/2 + 2/3 * 1/2; 50% -> C + 50% from A
3450-
<= em_eps,
3451-
"B should have pending emission of 4/9 of total emission"
3452-
);
3453-
// C's pending emission:
3454-
assert!(
3455-
((I96F32::from_num(hotkey_emission[2].2) / total_emission) -
3456-
(I96F32::from_num(1_f64 / 9_f64 + 1_f64 / 2_f64 * 2_f64 / 9_f64))).abs() // 1/9 + 2/9 * 1/2; 50% from B
3457-
<= em_eps,
3458-
"C should have pending emission of 1/9 of total emission"
3459-
);
3460-
34613429
// Set pending emission to 0
34623430
PendingEmission::<Test>::insert(netuid, 0);
34633431

@@ -3521,6 +3489,17 @@ fn test_parent_child_chain_emission() {
35213489
rel_stake_inc_c
35223490
);
35233491

3492+
let hotkeys = [hotkey_a, hotkey_b, hotkey_c];
3493+
let mut total_stake_now = 0;
3494+
for (hotkey, netuid,stake) in TotalHotkeyAlpha::<Test>::iter() {
3495+
if hotkeys.contains(&hotkey) {
3496+
total_stake_now += stake;
3497+
} else {
3498+
log::info!("hotkey: {:?}, netuid: {:?}, stake: {:?}", hotkey, netuid, stake);
3499+
}
3500+
}
3501+
log::info!("total_stake_now: {:?}, total_stake_new: {:?}", total_stake_now, total_stake_new);
3502+
35243503
let eps: I96F32 = I96F32::from_num(10_000);
35253504
assert!(
35263505
(total_stake_new - (total_stake_old + hardcoded_emission)).abs() <= eps,

0 commit comments

Comments
 (0)