@@ -3426,38 +3426,6 @@ fn test_parent_child_chain_emission() {
3426
3426
3427
3427
let hardcoded_emission: I96F32 = I96F32 :: from_num ( 1_000_000 ) ; // 1 million (adjust as needed)
3428
3428
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
-
3461
3429
// Set pending emission to 0
3462
3430
PendingEmission :: < Test > :: insert ( netuid, 0 ) ;
3463
3431
@@ -3521,6 +3489,17 @@ fn test_parent_child_chain_emission() {
3521
3489
rel_stake_inc_c
3522
3490
) ;
3523
3491
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
+
3524
3503
let eps: I96F32 = I96F32 :: from_num ( 10_000 ) ;
3525
3504
assert ! (
3526
3505
( total_stake_new - ( total_stake_old + hardcoded_emission) ) . abs( ) <= eps,
0 commit comments