@@ -1088,8 +1088,8 @@ fn test_do_swap_coldkey_success() {
10881088 assert_eq ! ( TotalColdkeyStake :: <Test >:: get( old_coldkey) , stake_amount) ;
10891089 assert_eq ! ( Stake :: <Test >:: get( hotkey, old_coldkey) , stake_amount) ;
10901090
1091- assert_eq ! ( Owned :: <Test >:: get( old_coldkey) , vec![ hotkey] ) ;
1092- assert ! ( !Owned :: <Test >:: contains_key( new_coldkey) ) ;
1091+ assert_eq ! ( OwnedHotkeys :: <Test >:: get( old_coldkey) , vec![ hotkey] ) ;
1092+ assert ! ( !OwnedHotkeys :: <Test >:: contains_key( new_coldkey) ) ;
10931093
10941094 // Get coldkey free balance before swap
10951095 let balance = SubtensorModule :: get_coldkey_balance ( & old_coldkey) ;
@@ -1108,8 +1108,8 @@ fn test_do_swap_coldkey_success() {
11081108 assert ! ( !TotalColdkeyStake :: <Test >:: contains_key( old_coldkey) ) ;
11091109 assert_eq ! ( Stake :: <Test >:: get( hotkey, new_coldkey) , stake_amount) ;
11101110 assert ! ( !Stake :: <Test >:: contains_key( hotkey, old_coldkey) ) ;
1111- assert_eq ! ( Owned :: <Test >:: get( new_coldkey) , vec![ hotkey] ) ;
1112- assert ! ( !Owned :: <Test >:: contains_key( old_coldkey) ) ;
1111+ assert_eq ! ( OwnedHotkeys :: <Test >:: get( new_coldkey) , vec![ hotkey] ) ;
1112+ assert ! ( !OwnedHotkeys :: <Test >:: contains_key( old_coldkey) ) ;
11131113
11141114 // Verify balance transfer
11151115 assert_eq ! (
@@ -1168,34 +1168,6 @@ fn test_do_swap_coldkey_same_keys() {
11681168 } ) ;
11691169}
11701170
1171- #[ test]
1172- fn test_do_swap_coldkey_new_key_already_associated ( ) {
1173- new_test_ext ( 1 ) . execute_with ( || {
1174- let old_coldkey = U256 :: from ( 1 ) ;
1175- let new_coldkey = U256 :: from ( 2 ) ;
1176- let hotkey1 = U256 :: from ( 3 ) ;
1177- let hotkey2 = U256 :: from ( 4 ) ;
1178- let netuid = 1u16 ;
1179- let swap_cost = SubtensorModule :: get_coldkey_swap_cost ( ) ;
1180-
1181- // Setup initial state
1182- add_network ( netuid, 13 , 0 ) ;
1183- register_ok_neuron ( netuid, hotkey1, old_coldkey, 0 ) ;
1184- register_ok_neuron ( netuid, hotkey2, new_coldkey, 0 ) ;
1185- SubtensorModule :: add_balance_to_coldkey_account ( & old_coldkey, swap_cost) ;
1186-
1187- // Attempt the swap
1188- assert_err ! (
1189- SubtensorModule :: do_swap_coldkey(
1190- <<Test as Config >:: RuntimeOrigin >:: signed( old_coldkey) ,
1191- & old_coldkey,
1192- & new_coldkey
1193- ) ,
1194- Error :: <Test >:: ColdKeyAlreadyAssociated
1195- ) ;
1196- } ) ;
1197- }
1198-
11991171#[ test]
12001172fn test_swap_total_coldkey_stake ( ) {
12011173 new_test_ext ( 1 ) . execute_with ( || {
@@ -1235,8 +1207,8 @@ fn test_swap_stake_for_coldkey() {
12351207 Stake :: < Test > :: insert ( hotkey1, old_coldkey, stake_amount1) ;
12361208 Stake :: < Test > :: insert ( hotkey2, old_coldkey, stake_amount2) ;
12371209
1238- // Populate Owned map
1239- Owned :: < Test > :: insert ( old_coldkey, vec ! [ hotkey1, hotkey2] ) ;
1210+ // Populate OwnedHotkeys map
1211+ OwnedHotkeys :: < Test > :: insert ( old_coldkey, vec ! [ hotkey1, hotkey2] ) ;
12401212
12411213 // Perform the swap
12421214 SubtensorModule :: swap_stake_for_coldkey ( & old_coldkey, & new_coldkey, & mut weight) ;
@@ -1266,8 +1238,8 @@ fn test_swap_owner_for_coldkey() {
12661238 Owner :: < Test > :: insert ( hotkey1, old_coldkey) ;
12671239 Owner :: < Test > :: insert ( hotkey2, old_coldkey) ;
12681240
1269- // Initialize Owned map
1270- Owned :: < Test > :: insert ( old_coldkey, vec ! [ hotkey1, hotkey2] ) ;
1241+ // Initialize OwnedHotkeys map
1242+ OwnedHotkeys :: < Test > :: insert ( old_coldkey, vec ! [ hotkey1, hotkey2] ) ;
12711243
12721244 // Perform the swap
12731245 SubtensorModule :: swap_owner_for_coldkey ( & old_coldkey, & new_coldkey, & mut weight) ;
@@ -1297,8 +1269,8 @@ fn test_swap_total_hotkey_coldkey_stakes_this_interval_for_coldkey() {
12971269 TotalHotkeyColdkeyStakesThisInterval :: < Test > :: insert ( hotkey1, old_coldkey, stake1) ;
12981270 TotalHotkeyColdkeyStakesThisInterval :: < Test > :: insert ( hotkey2, old_coldkey, stake2) ;
12991271
1300- // Populate Owned map
1301- Owned :: < Test > :: insert ( old_coldkey, vec ! [ hotkey1, hotkey2] ) ;
1272+ // Populate OwnedHotkeys map
1273+ OwnedHotkeys :: < Test > :: insert ( old_coldkey, vec ! [ hotkey1, hotkey2] ) ;
13021274
13031275 // Perform the swap
13041276 SubtensorModule :: swap_total_hotkey_coldkey_stakes_this_interval_for_coldkey (
@@ -1380,8 +1352,8 @@ fn test_do_swap_coldkey_with_subnet_ownership() {
13801352 SubtensorModule :: add_balance_to_coldkey_account ( & old_coldkey, stake_amount + swap_cost) ;
13811353 SubnetOwner :: < Test > :: insert ( netuid, old_coldkey) ;
13821354
1383- // Populate Owned map
1384- Owned :: < Test > :: insert ( old_coldkey, vec ! [ hotkey] ) ;
1355+ // Populate OwnedHotkeys map
1356+ OwnedHotkeys :: < Test > :: insert ( old_coldkey, vec ! [ hotkey] ) ;
13851357
13861358 // Perform the swap
13871359 assert_ok ! ( SubtensorModule :: do_swap_coldkey(
@@ -1395,39 +1367,6 @@ fn test_do_swap_coldkey_with_subnet_ownership() {
13951367 } ) ;
13961368}
13971369
1398- #[ test]
1399- fn test_do_swap_coldkey_tx_rate_limit ( ) {
1400- new_test_ext ( 1 ) . execute_with ( || {
1401- let old_coldkey = U256 :: from ( 1 ) ;
1402- let new_coldkey = U256 :: from ( 2 ) ;
1403- let swap_cost = SubtensorModule :: get_coldkey_swap_cost ( ) ;
1404-
1405- // Set non-zero tx rate limit
1406- SubtensorModule :: set_tx_rate_limit ( 1 ) ;
1407-
1408- // Setup initial state
1409- SubtensorModule :: add_balance_to_coldkey_account ( & old_coldkey, swap_cost * 2 ) ;
1410- SubtensorModule :: add_balance_to_coldkey_account ( & new_coldkey, swap_cost * 2 ) ;
1411-
1412- // Perform first swap
1413- assert_ok ! ( SubtensorModule :: do_swap_coldkey(
1414- <<Test as Config >:: RuntimeOrigin >:: signed( old_coldkey) ,
1415- & old_coldkey,
1416- & new_coldkey
1417- ) ) ;
1418-
1419- // Attempt second swap immediately
1420- assert_err ! (
1421- SubtensorModule :: do_swap_coldkey(
1422- <<Test as Config >:: RuntimeOrigin >:: signed( new_coldkey) ,
1423- & new_coldkey,
1424- & old_coldkey
1425- ) ,
1426- Error :: <Test >:: ColdKeySwapTxRateLimitExceeded
1427- ) ;
1428- } ) ;
1429- }
1430-
14311370#[ test]
14321371fn test_coldkey_has_associated_hotkeys ( ) {
14331372 new_test_ext ( 1 ) . execute_with ( || {
0 commit comments