Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

backpropagate / main => testnet (ignore CI errors) #1046

Merged
merged 12 commits into from
Dec 2, 2024
Prev Previous commit
Next Next commit
fix rate limit issue in related tests
  • Loading branch information
camfairchild committed Nov 28, 2024
commit 4887d9bd1aa99d398d2cf4fd8da060df35562506
22 changes: 22 additions & 0 deletions pallets/subtensor/tests/children.rs
Original file line number Diff line number Diff line change
@@ -172,6 +172,8 @@ fn test_do_set_child_singular_old_children_cleanup() {
vec![(proportion, old_child)]
));

step_rate_limit(&TransactionType::SetChildren, netuid);

// Set new child
assert_ok!(SubtensorModule::do_set_children(
RuntimeOrigin::signed(coldkey),
@@ -260,6 +262,8 @@ fn test_do_set_child_singular_proportion_edge_cases() {
let children = SubtensorModule::get_children(&hotkey, netuid);
assert_eq!(children, vec![(min_proportion, child)]);

step_rate_limit(&TransactionType::SetChildren, netuid);

// Set child with maximum proportion
let max_proportion: u64 = u64::MAX;
assert_ok!(SubtensorModule::do_set_children(
@@ -306,6 +310,8 @@ fn test_do_set_child_singular_multiple_children() {
vec![(proportion1, child1)]
));

step_rate_limit(&TransactionType::SetChildren, netuid);

// Set second child
assert_ok!(SubtensorModule::do_set_children(
RuntimeOrigin::signed(coldkey),
@@ -467,6 +473,8 @@ fn test_do_revoke_child_singular_success() {
let children = SubtensorModule::get_children(&hotkey, netuid);
assert_eq!(children, vec![(proportion, child)]);

step_rate_limit(&TransactionType::SetChildren, netuid);

// Revoke child
assert_ok!(SubtensorModule::do_set_children(
RuntimeOrigin::signed(coldkey),
@@ -764,6 +772,8 @@ fn test_do_set_children_multiple_old_children_cleanup() {
vec![(proportion, old_child)]
));

step_rate_limit(&TransactionType::SetChildren, netuid);

// Set new children
assert_ok!(SubtensorModule::do_set_children(
RuntimeOrigin::signed(coldkey),
@@ -854,6 +864,8 @@ fn test_do_set_children_multiple_overwrite_existing() {
vec![(proportion, child1), (proportion, child2)]
));

step_rate_limit(&TransactionType::SetChildren, netuid);

// Overwrite with new children
assert_ok!(SubtensorModule::do_set_children(
RuntimeOrigin::signed(coldkey),
@@ -1199,6 +1211,8 @@ fn test_do_revoke_children_multiple_success() {
vec![(proportion1, child1), (proportion2, child2)]
));

step_rate_limit(&TransactionType::SetChildren, netuid);

// Revoke multiple children
assert_ok!(SubtensorModule::do_set_children(
RuntimeOrigin::signed(coldkey),
@@ -1313,6 +1327,8 @@ fn test_do_revoke_children_multiple_partial_revocation() {
]
));

step_rate_limit(&TransactionType::SetChildren, netuid);

// Revoke only child3
assert_ok!(SubtensorModule::do_set_children(
RuntimeOrigin::signed(coldkey),
@@ -1364,6 +1380,8 @@ fn test_do_revoke_children_multiple_non_existent_children() {
vec![(proportion, child1)]
));

step_rate_limit(&TransactionType::SetChildren, netuid);

// Attempt to revoke existing and non-existent children
assert_ok!(SubtensorModule::do_set_children(
RuntimeOrigin::signed(coldkey),
@@ -1450,6 +1468,8 @@ fn test_do_revoke_children_multiple_complex_scenario() {
]
));

step_rate_limit(&TransactionType::SetChildren, netuid);

// Revoke child2
assert_ok!(SubtensorModule::do_set_children(
RuntimeOrigin::signed(coldkey),
@@ -1466,6 +1486,8 @@ fn test_do_revoke_children_multiple_complex_scenario() {
let parents2 = SubtensorModule::get_parents(&child2, netuid);
assert!(parents2.is_empty());

step_rate_limit(&TransactionType::SetChildren, netuid);

// Revoke remaining children
assert_ok!(SubtensorModule::do_set_children(
RuntimeOrigin::signed(coldkey),