11#![ allow( clippy:: indexing_slicing) ]
2- use crate :: mock:: * ;
2+ use super :: mock:: * ;
33use frame_support:: { assert_err, assert_noop, assert_ok} ;
4- mod mock ;
5- use pallet_subtensor :: { utils:: rate_limiting:: TransactionType , * } ;
4+
5+ use crate :: { utils:: rate_limiting:: TransactionType , * } ;
66use sp_core:: U256 ;
77
88// 1: Successful setting of a single child
@@ -3461,7 +3461,7 @@ fn test_childkey_take_drain() {
34613461 SubtensorModule :: set_weights_set_rate_limit ( netuid, 0 ) ;
34623462 SubtensorModule :: set_max_allowed_validators ( netuid, 2 ) ;
34633463 step_block ( subnet_tempo) ;
3464- pallet_subtensor :: SubnetOwnerCut :: < Test > :: set ( 0 ) ;
3464+ crate :: SubnetOwnerCut :: < Test > :: set ( 0 ) ;
34653465
34663466 // Set 20% childkey take
34673467 let max_take: u16 = 0xFFFF / 5 ;
@@ -3509,15 +3509,15 @@ fn test_childkey_take_drain() {
35093509 vec![ ( proportion, child) ]
35103510 ) ) ;
35113511 // Make all stakes viable
3512- pallet_subtensor :: StakeDeltaSinceLastEmissionDrain :: < Test > :: set ( parent, coldkey, -1 ) ;
3513- pallet_subtensor :: StakeDeltaSinceLastEmissionDrain :: < Test > :: set ( child, nominator, -1 ) ;
3512+ crate :: StakeDeltaSinceLastEmissionDrain :: < Test > :: set ( parent, coldkey, -1 ) ;
3513+ crate :: StakeDeltaSinceLastEmissionDrain :: < Test > :: set ( child, nominator, -1 ) ;
35143514
35153515 // Setup YUMA so that it creates emissions:
35163516 // Parent and child both set weights
35173517 // Parent and child register on root and
35183518 // Set root weights
3519- pallet_subtensor :: Weights :: < Test > :: insert ( netuid, 0 , vec ! [ ( 0 , 0xFFFF ) , ( 1 , 0xFFFF ) ] ) ;
3520- pallet_subtensor :: Weights :: < Test > :: insert ( netuid, 1 , vec ! [ ( 0 , 0xFFFF ) , ( 1 , 0xFFFF ) ] ) ;
3519+ crate :: Weights :: < Test > :: insert ( netuid, 0 , vec ! [ ( 0 , 0xFFFF ) , ( 1 , 0xFFFF ) ] ) ;
3520+ crate :: Weights :: < Test > :: insert ( netuid, 1 , vec ! [ ( 0 , 0xFFFF ) , ( 1 , 0xFFFF ) ] ) ;
35213521 assert_ok ! ( SubtensorModule :: do_root_register(
35223522 RuntimeOrigin :: signed( coldkey) ,
35233523 parent,
@@ -3526,17 +3526,17 @@ fn test_childkey_take_drain() {
35263526 RuntimeOrigin :: signed( coldkey) ,
35273527 child,
35283528 ) ) ;
3529- pallet_subtensor :: Weights :: < Test > :: insert ( root_id, 0 , vec ! [ ( 0 , 0xFFFF ) , ( 1 , 0xFFFF ) ] ) ;
3530- pallet_subtensor :: Weights :: < Test > :: insert ( root_id, 1 , vec ! [ ( 0 , 0xFFFF ) , ( 1 , 0xFFFF ) ] ) ;
3529+ crate :: Weights :: < Test > :: insert ( root_id, 0 , vec ! [ ( 0 , 0xFFFF ) , ( 1 , 0xFFFF ) ] ) ;
3530+ crate :: Weights :: < Test > :: insert ( root_id, 1 , vec ! [ ( 0 , 0xFFFF ) , ( 1 , 0xFFFF ) ] ) ;
35313531
35323532 // Run run_coinbase until PendingHotkeyEmission are populated
3533- while pallet_subtensor :: PendingdHotkeyEmission :: < Test > :: get ( child) == 0 {
3533+ while crate :: PendingdHotkeyEmission :: < Test > :: get ( child) == 0 {
35343534 step_block ( 1 ) ;
35353535 }
35363536
35373537 // Prevent further subnet epochs
3538- pallet_subtensor :: Tempo :: < Test > :: set ( netuid, u16:: MAX ) ;
3539- pallet_subtensor :: Tempo :: < Test > :: set ( root_id, u16:: MAX ) ;
3538+ crate :: Tempo :: < Test > :: set ( netuid, u16:: MAX ) ;
3539+ crate :: Tempo :: < Test > :: set ( root_id, u16:: MAX ) ;
35403540
35413541 // Run run_coinbase until PendingHotkeyEmission is drained for both child and parent
35423542 step_block ( ( hotkey_tempo * 2 ) as u16 ) ;
@@ -3545,9 +3545,9 @@ fn test_childkey_take_drain() {
35453545 // - Child stake increased by its child key take only (20% * 50% = 10% of total emission)
35463546 // - Parent stake increased by 40% of total emission
35473547 // - Nominator stake increased by 50% of total emission
3548- let child_emission = pallet_subtensor :: Stake :: < Test > :: get ( child, coldkey) ;
3549- let parent_emission = pallet_subtensor :: Stake :: < Test > :: get ( parent, coldkey) - stake;
3550- let nominator_emission = pallet_subtensor :: Stake :: < Test > :: get ( child, nominator) - stake;
3548+ let child_emission = crate :: Stake :: < Test > :: get ( child, coldkey) ;
3549+ let parent_emission = crate :: Stake :: < Test > :: get ( parent, coldkey) - stake;
3550+ let nominator_emission = crate :: Stake :: < Test > :: get ( child, nominator) - stake;
35513551 let total_emission = child_emission + parent_emission + nominator_emission;
35523552
35533553 assert ! ( is_within_tolerance(
@@ -3600,7 +3600,7 @@ fn test_childkey_take_drain_validator_take() {
36003600 SubtensorModule :: set_weights_set_rate_limit ( netuid, 0 ) ;
36013601 SubtensorModule :: set_max_allowed_validators ( netuid, 2 ) ;
36023602 step_block ( subnet_tempo) ;
3603- pallet_subtensor :: SubnetOwnerCut :: < Test > :: set ( 0 ) ;
3603+ crate :: SubnetOwnerCut :: < Test > :: set ( 0 ) ;
36043604
36053605 // Set 20% childkey take
36063606 let max_take: u16 = 0xFFFF / 5 ;
@@ -3648,15 +3648,15 @@ fn test_childkey_take_drain_validator_take() {
36483648 vec![ ( proportion, child) ]
36493649 ) ) ;
36503650 // Make all stakes viable
3651- pallet_subtensor :: StakeDeltaSinceLastEmissionDrain :: < Test > :: set ( parent, coldkey, -1 ) ;
3652- pallet_subtensor :: StakeDeltaSinceLastEmissionDrain :: < Test > :: set ( child, nominator, -1 ) ;
3651+ crate :: StakeDeltaSinceLastEmissionDrain :: < Test > :: set ( parent, coldkey, -1 ) ;
3652+ crate :: StakeDeltaSinceLastEmissionDrain :: < Test > :: set ( child, nominator, -1 ) ;
36533653
36543654 // Setup YUMA so that it creates emissions:
36553655 // Parent and child both set weights
36563656 // Parent and child register on root and
36573657 // Set root weights
3658- pallet_subtensor :: Weights :: < Test > :: insert ( netuid, 0 , vec ! [ ( 0 , 0xFFFF ) , ( 1 , 0xFFFF ) ] ) ;
3659- pallet_subtensor :: Weights :: < Test > :: insert ( netuid, 1 , vec ! [ ( 0 , 0xFFFF ) , ( 1 , 0xFFFF ) ] ) ;
3658+ crate :: Weights :: < Test > :: insert ( netuid, 0 , vec ! [ ( 0 , 0xFFFF ) , ( 1 , 0xFFFF ) ] ) ;
3659+ crate :: Weights :: < Test > :: insert ( netuid, 1 , vec ! [ ( 0 , 0xFFFF ) , ( 1 , 0xFFFF ) ] ) ;
36603660 assert_ok ! ( SubtensorModule :: do_root_register(
36613661 RuntimeOrigin :: signed( coldkey) ,
36623662 parent,
@@ -3665,17 +3665,17 @@ fn test_childkey_take_drain_validator_take() {
36653665 RuntimeOrigin :: signed( coldkey) ,
36663666 child,
36673667 ) ) ;
3668- pallet_subtensor :: Weights :: < Test > :: insert ( root_id, 0 , vec ! [ ( 0 , 0xFFFF ) , ( 1 , 0xFFFF ) ] ) ;
3669- pallet_subtensor :: Weights :: < Test > :: insert ( root_id, 1 , vec ! [ ( 0 , 0xFFFF ) , ( 1 , 0xFFFF ) ] ) ;
3668+ crate :: Weights :: < Test > :: insert ( root_id, 0 , vec ! [ ( 0 , 0xFFFF ) , ( 1 , 0xFFFF ) ] ) ;
3669+ crate :: Weights :: < Test > :: insert ( root_id, 1 , vec ! [ ( 0 , 0xFFFF ) , ( 1 , 0xFFFF ) ] ) ;
36703670
36713671 // Run run_coinbase until PendingHotkeyEmission are populated
3672- while pallet_subtensor :: PendingdHotkeyEmission :: < Test > :: get ( child) == 0 {
3672+ while crate :: PendingdHotkeyEmission :: < Test > :: get ( child) == 0 {
36733673 step_block ( 1 ) ;
36743674 }
36753675
36763676 // Prevent further subnet epochs
3677- pallet_subtensor :: Tempo :: < Test > :: set ( netuid, u16:: MAX ) ;
3678- pallet_subtensor :: Tempo :: < Test > :: set ( root_id, u16:: MAX ) ;
3677+ crate :: Tempo :: < Test > :: set ( netuid, u16:: MAX ) ;
3678+ crate :: Tempo :: < Test > :: set ( root_id, u16:: MAX ) ;
36793679
36803680 // Run run_coinbase until PendingHotkeyEmission is drained for both child and parent
36813681 step_block ( ( hotkey_tempo * 2 ) as u16 ) ;
@@ -3684,9 +3684,9 @@ fn test_childkey_take_drain_validator_take() {
36843684 // - Child stake increased by its child key take (20% * 50% = 10% of total emission) plus childkey's delegate take (10%)
36853685 // - Parent stake increased by 40% of total emission
36863686 // - Nominator stake increased by 40% of total emission
3687- let child_emission = pallet_subtensor :: Stake :: < Test > :: get ( child, coldkey) ;
3688- let parent_emission = pallet_subtensor :: Stake :: < Test > :: get ( parent, coldkey) - stake;
3689- let nominator_emission = pallet_subtensor :: Stake :: < Test > :: get ( child, nominator) - stake;
3687+ let child_emission = crate :: Stake :: < Test > :: get ( child, coldkey) ;
3688+ let parent_emission = crate :: Stake :: < Test > :: get ( parent, coldkey) - stake;
3689+ let nominator_emission = crate :: Stake :: < Test > :: get ( child, nominator) - stake;
36903690 let total_emission = child_emission + parent_emission + nominator_emission;
36913691
36923692 assert ! ( is_within_tolerance( child_emission, total_emission / 5 , 500 ) ) ;
0 commit comments