Skip to content

Commit 4887d9b

Browse files
committed
fix rate limit issue in related tests
1 parent a29ec97 commit 4887d9b

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

pallets/subtensor/tests/children.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,8 @@ fn test_do_set_child_singular_old_children_cleanup() {
172172
vec![(proportion, old_child)]
173173
));
174174

175+
step_rate_limit(&TransactionType::SetChildren, netuid);
176+
175177
// Set new child
176178
assert_ok!(SubtensorModule::do_set_children(
177179
RuntimeOrigin::signed(coldkey),
@@ -260,6 +262,8 @@ fn test_do_set_child_singular_proportion_edge_cases() {
260262
let children = SubtensorModule::get_children(&hotkey, netuid);
261263
assert_eq!(children, vec![(min_proportion, child)]);
262264

265+
step_rate_limit(&TransactionType::SetChildren, netuid);
266+
263267
// Set child with maximum proportion
264268
let max_proportion: u64 = u64::MAX;
265269
assert_ok!(SubtensorModule::do_set_children(
@@ -306,6 +310,8 @@ fn test_do_set_child_singular_multiple_children() {
306310
vec![(proportion1, child1)]
307311
));
308312

313+
step_rate_limit(&TransactionType::SetChildren, netuid);
314+
309315
// Set second child
310316
assert_ok!(SubtensorModule::do_set_children(
311317
RuntimeOrigin::signed(coldkey),
@@ -467,6 +473,8 @@ fn test_do_revoke_child_singular_success() {
467473
let children = SubtensorModule::get_children(&hotkey, netuid);
468474
assert_eq!(children, vec![(proportion, child)]);
469475

476+
step_rate_limit(&TransactionType::SetChildren, netuid);
477+
470478
// Revoke child
471479
assert_ok!(SubtensorModule::do_set_children(
472480
RuntimeOrigin::signed(coldkey),
@@ -764,6 +772,8 @@ fn test_do_set_children_multiple_old_children_cleanup() {
764772
vec![(proportion, old_child)]
765773
));
766774

775+
step_rate_limit(&TransactionType::SetChildren, netuid);
776+
767777
// Set new children
768778
assert_ok!(SubtensorModule::do_set_children(
769779
RuntimeOrigin::signed(coldkey),
@@ -854,6 +864,8 @@ fn test_do_set_children_multiple_overwrite_existing() {
854864
vec![(proportion, child1), (proportion, child2)]
855865
));
856866

867+
step_rate_limit(&TransactionType::SetChildren, netuid);
868+
857869
// Overwrite with new children
858870
assert_ok!(SubtensorModule::do_set_children(
859871
RuntimeOrigin::signed(coldkey),
@@ -1199,6 +1211,8 @@ fn test_do_revoke_children_multiple_success() {
11991211
vec![(proportion1, child1), (proportion2, child2)]
12001212
));
12011213

1214+
step_rate_limit(&TransactionType::SetChildren, netuid);
1215+
12021216
// Revoke multiple children
12031217
assert_ok!(SubtensorModule::do_set_children(
12041218
RuntimeOrigin::signed(coldkey),
@@ -1313,6 +1327,8 @@ fn test_do_revoke_children_multiple_partial_revocation() {
13131327
]
13141328
));
13151329

1330+
step_rate_limit(&TransactionType::SetChildren, netuid);
1331+
13161332
// Revoke only child3
13171333
assert_ok!(SubtensorModule::do_set_children(
13181334
RuntimeOrigin::signed(coldkey),
@@ -1364,6 +1380,8 @@ fn test_do_revoke_children_multiple_non_existent_children() {
13641380
vec![(proportion, child1)]
13651381
));
13661382

1383+
step_rate_limit(&TransactionType::SetChildren, netuid);
1384+
13671385
// Attempt to revoke existing and non-existent children
13681386
assert_ok!(SubtensorModule::do_set_children(
13691387
RuntimeOrigin::signed(coldkey),
@@ -1450,6 +1468,8 @@ fn test_do_revoke_children_multiple_complex_scenario() {
14501468
]
14511469
));
14521470

1471+
step_rate_limit(&TransactionType::SetChildren, netuid);
1472+
14531473
// Revoke child2
14541474
assert_ok!(SubtensorModule::do_set_children(
14551475
RuntimeOrigin::signed(coldkey),
@@ -1466,6 +1486,8 @@ fn test_do_revoke_children_multiple_complex_scenario() {
14661486
let parents2 = SubtensorModule::get_parents(&child2, netuid);
14671487
assert!(parents2.is_empty());
14681488

1489+
step_rate_limit(&TransactionType::SetChildren, netuid);
1490+
14691491
// Revoke remaining children
14701492
assert_ok!(SubtensorModule::do_set_children(
14711493
RuntimeOrigin::signed(coldkey),

0 commit comments

Comments
 (0)