Skip to content

Commit 8a2578e

Browse files
committed
fix chk tests for new exemption
1 parent 0e2eccb commit 8a2578e

File tree

1 file changed

+48
-44
lines changed

1 file changed

+48
-44
lines changed

pallets/subtensor/src/tests/coinbase.rs

Lines changed: 48 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -934,47 +934,48 @@ fn test_get_root_children_drain() {
934934
// Set TAO weight to 1.
935935
SubtensorModule::set_tao_weight(u64::MAX); // Set TAO weight to 1.
936936
// Create keys.
937-
let cold = U256::from(0);
938-
let alice = U256::from(1);
939-
let bob = U256::from(2);
937+
let cold_alice = U256::from(0);
938+
let cold_bob = U256::from(1);
939+
let alice = U256::from(2);
940+
let bob = U256::from(3);
940941
// Register Alice and Bob to the root network and alpha subnet.
941-
register_ok_neuron(alpha, alice, cold, 0);
942-
register_ok_neuron(alpha, bob, cold, 0);
942+
register_ok_neuron(alpha, alice, cold_alice, 0);
943+
register_ok_neuron(alpha, bob, cold_bob, 0);
943944
assert_ok!(SubtensorModule::root_register(
944-
RuntimeOrigin::signed(cold).clone(),
945+
RuntimeOrigin::signed(cold_alice).clone(),
945946
alice,
946947
));
947948
assert_ok!(SubtensorModule::root_register(
948-
RuntimeOrigin::signed(cold).clone(),
949+
RuntimeOrigin::signed(cold_bob).clone(),
949950
bob,
950951
));
951952
// Add stake for Alice and Bob on root.
952953
let alice_root_stake: u64 = 1_000_000_000;
953954
SubtensorModule::increase_stake_for_hotkey_and_coldkey_on_subnet(
954955
&alice,
955-
&cold,
956+
&cold_alice,
956957
root,
957958
alice_root_stake,
958959
);
959960
let bob_root_stake: u64 = 1_000_000_000;
960961
SubtensorModule::increase_stake_for_hotkey_and_coldkey_on_subnet(
961962
&bob,
962-
&cold,
963+
&cold_bob,
963964
root,
964965
alice_root_stake,
965966
);
966967
// Add stake for Alice and Bob on netuid.
967968
let alice_alpha_stake: u64 = 1_000_000_000;
968969
SubtensorModule::increase_stake_for_hotkey_and_coldkey_on_subnet(
969970
&alice,
970-
&cold,
971+
&cold_alice,
971972
alpha,
972973
alice_alpha_stake,
973974
);
974975
let bob_alpha_stake: u64 = 1_000_000_000;
975976
SubtensorModule::increase_stake_for_hotkey_and_coldkey_on_subnet(
976977
&bob,
977-
&cold,
978+
&cold_bob,
978979
alpha,
979980
bob_alpha_stake,
980981
);
@@ -1056,47 +1057,48 @@ fn test_get_root_children_drain_half_proportion() {
10561057
// Set TAO weight to 1.
10571058
SubtensorModule::set_tao_weight(u64::MAX); // Set TAO weight to 1.
10581059
// Create keys.
1059-
let cold = U256::from(0);
1060-
let alice = U256::from(1);
1061-
let bob = U256::from(2);
1060+
let cold_alice = U256::from(0);
1061+
let cold_bob = U256::from(1);
1062+
let alice = U256::from(2);
1063+
let bob = U256::from(3);
10621064
// Register Alice and Bob to the root network and alpha subnet.
1063-
register_ok_neuron(alpha, alice, cold, 0);
1064-
register_ok_neuron(alpha, bob, cold, 0);
1065+
register_ok_neuron(alpha, alice, cold_alice, 0);
1066+
register_ok_neuron(alpha, bob, cold_bob, 0);
10651067
assert_ok!(SubtensorModule::root_register(
1066-
RuntimeOrigin::signed(cold).clone(),
1068+
RuntimeOrigin::signed(cold_alice).clone(),
10671069
alice,
10681070
));
10691071
assert_ok!(SubtensorModule::root_register(
1070-
RuntimeOrigin::signed(cold).clone(),
1072+
RuntimeOrigin::signed(cold_bob).clone(),
10711073
bob,
10721074
));
10731075
// Add stake for Alice and Bob on root.
10741076
let alice_root_stake: u64 = 1_000_000_000;
10751077
SubtensorModule::increase_stake_for_hotkey_and_coldkey_on_subnet(
10761078
&alice,
1077-
&cold,
1079+
&cold_alice,
10781080
root,
10791081
alice_root_stake,
10801082
);
10811083
let bob_root_stake: u64 = 1_000_000_000;
10821084
SubtensorModule::increase_stake_for_hotkey_and_coldkey_on_subnet(
10831085
&bob,
1084-
&cold,
1086+
&cold_bob,
10851087
root,
10861088
alice_root_stake,
10871089
);
10881090
// Add stake for Alice and Bob on netuid.
10891091
let alice_alpha_stake: u64 = 1_000_000_000;
10901092
SubtensorModule::increase_stake_for_hotkey_and_coldkey_on_subnet(
10911093
&alice,
1092-
&cold,
1094+
&cold_alice,
10931095
alpha,
10941096
alice_alpha_stake,
10951097
);
10961098
let bob_alpha_stake: u64 = 1_000_000_000;
10971099
SubtensorModule::increase_stake_for_hotkey_and_coldkey_on_subnet(
10981100
&bob,
1099-
&cold,
1101+
&cold_bob,
11001102
alpha,
11011103
bob_alpha_stake,
11021104
);
@@ -1138,47 +1140,48 @@ fn test_get_root_children_drain_with_take() {
11381140
// Set TAO weight to 1.
11391141
SubtensorModule::set_tao_weight(u64::MAX); // Set TAO weight to 1.
11401142
// Create keys.
1141-
let cold = U256::from(0);
1142-
let alice = U256::from(1);
1143-
let bob = U256::from(2);
1143+
let cold_alice = U256::from(0);
1144+
let cold_bob = U256::from(1);
1145+
let alice = U256::from(2);
1146+
let bob = U256::from(3);
11441147
// Register Alice and Bob to the root network and alpha subnet.
1145-
register_ok_neuron(alpha, alice, cold, 0);
1146-
register_ok_neuron(alpha, bob, cold, 0);
1148+
register_ok_neuron(alpha, alice, cold_alice, 0);
1149+
register_ok_neuron(alpha, bob, cold_bob, 0);
11471150
assert_ok!(SubtensorModule::root_register(
1148-
RuntimeOrigin::signed(cold).clone(),
1151+
RuntimeOrigin::signed(cold_alice).clone(),
11491152
alice,
11501153
));
11511154
assert_ok!(SubtensorModule::root_register(
1152-
RuntimeOrigin::signed(cold).clone(),
1155+
RuntimeOrigin::signed(cold_bob).clone(),
11531156
bob,
11541157
));
11551158
// Add stake for Alice and Bob on root.
11561159
let alice_root_stake: u64 = 1_000_000_000;
11571160
SubtensorModule::increase_stake_for_hotkey_and_coldkey_on_subnet(
11581161
&alice,
1159-
&cold,
1162+
&cold_alice,
11601163
root,
11611164
alice_root_stake,
11621165
);
11631166
let bob_root_stake: u64 = 1_000_000_000;
11641167
SubtensorModule::increase_stake_for_hotkey_and_coldkey_on_subnet(
11651168
&bob,
1166-
&cold,
1169+
&cold_bob,
11671170
root,
11681171
alice_root_stake,
11691172
);
11701173
// Add stake for Alice and Bob on netuid.
11711174
let alice_alpha_stake: u64 = 1_000_000_000;
11721175
SubtensorModule::increase_stake_for_hotkey_and_coldkey_on_subnet(
11731176
&alice,
1174-
&cold,
1177+
&cold_alice,
11751178
alpha,
11761179
alice_alpha_stake,
11771180
);
11781181
let bob_alpha_stake: u64 = 1_000_000_000;
11791182
SubtensorModule::increase_stake_for_hotkey_and_coldkey_on_subnet(
11801183
&bob,
1181-
&cold,
1184+
&cold_bob,
11821185
alpha,
11831186
bob_alpha_stake,
11841187
);
@@ -1215,47 +1218,48 @@ fn test_get_root_children_drain_with_half_take() {
12151218
// Set TAO weight to 1.
12161219
SubtensorModule::set_tao_weight(u64::MAX); // Set TAO weight to 1.
12171220
// Create keys.
1218-
let cold = U256::from(0);
1219-
let alice = U256::from(1);
1220-
let bob = U256::from(2);
1221+
let cold_alice = U256::from(0);
1222+
let cold_bob = U256::from(1);
1223+
let alice = U256::from(2);
1224+
let bob = U256::from(3);
12211225
// Register Alice and Bob to the root network and alpha subnet.
1222-
register_ok_neuron(alpha, alice, cold, 0);
1223-
register_ok_neuron(alpha, bob, cold, 0);
1226+
register_ok_neuron(alpha, alice, cold_alice, 0);
1227+
register_ok_neuron(alpha, bob, cold_bob, 0);
12241228
assert_ok!(SubtensorModule::root_register(
1225-
RuntimeOrigin::signed(cold).clone(),
1229+
RuntimeOrigin::signed(cold_alice).clone(),
12261230
alice,
12271231
));
12281232
assert_ok!(SubtensorModule::root_register(
1229-
RuntimeOrigin::signed(cold).clone(),
1233+
RuntimeOrigin::signed(cold_bob).clone(),
12301234
bob,
12311235
));
12321236
// Add stake for Alice and Bob on root.
12331237
let alice_root_stake: u64 = 1_000_000_000;
12341238
SubtensorModule::increase_stake_for_hotkey_and_coldkey_on_subnet(
12351239
&alice,
1236-
&cold,
1240+
&cold_alice,
12371241
root,
12381242
alice_root_stake,
12391243
);
12401244
let bob_root_stake: u64 = 1_000_000_000;
12411245
SubtensorModule::increase_stake_for_hotkey_and_coldkey_on_subnet(
12421246
&bob,
1243-
&cold,
1247+
&cold_bob,
12441248
root,
12451249
alice_root_stake,
12461250
);
12471251
// Add stake for Alice and Bob on netuid.
12481252
let alice_alpha_stake: u64 = 1_000_000_000;
12491253
SubtensorModule::increase_stake_for_hotkey_and_coldkey_on_subnet(
12501254
&alice,
1251-
&cold,
1255+
&cold_alice,
12521256
alpha,
12531257
alice_alpha_stake,
12541258
);
12551259
let bob_alpha_stake: u64 = 1_000_000_000;
12561260
SubtensorModule::increase_stake_for_hotkey_and_coldkey_on_subnet(
12571261
&bob,
1258-
&cold,
1262+
&cold_bob,
12591263
alpha,
12601264
bob_alpha_stake,
12611265
);

0 commit comments

Comments
 (0)