Skip to content

Commit 81667e1

Browse files
committed
fix tests
1 parent dd3688e commit 81667e1

File tree

1 file changed

+16
-12
lines changed
  • pallets/admin-utils/src/tests

1 file changed

+16
-12
lines changed

pallets/admin-utils/src/tests/mod.rs

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2058,7 +2058,7 @@ fn test_freeze_window_blocks_root_and_owner() {
20582058
let owner: U256 = U256::from(9);
20592059
SubnetOwner::<Test>::insert(netuid, owner);
20602060
assert_noop!(
2061-
AdminUtils::sudo_set_kappa(
2061+
AdminUtils::sudo_set_commit_reveal_weights_interval(
20622062
<<Test as Config>::RuntimeOrigin>::signed(owner),
20632063
netuid,
20642064
77
@@ -2145,14 +2145,14 @@ fn test_owner_hyperparam_update_rate_limit_enforced() {
21452145
));
21462146

21472147
// First update succeeds
2148-
assert_ok!(AdminUtils::sudo_set_kappa(
2148+
assert_ok!(AdminUtils::sudo_set_commit_reveal_weights_interval(
21492149
<<Test as Config>::RuntimeOrigin>::signed(owner),
21502150
netuid,
21512151
11
21522152
));
21532153
// Immediate second update fails due to TxRateLimitExceeded
21542154
assert_noop!(
2155-
AdminUtils::sudo_set_kappa(
2155+
AdminUtils::sudo_set_commit_reveal_weights_interval(
21562156
<<Test as Config>::RuntimeOrigin>::signed(owner),
21572157
netuid,
21582158
12
@@ -2163,7 +2163,7 @@ fn test_owner_hyperparam_update_rate_limit_enforced() {
21632163
// Advance less than limit still fails
21642164
run_to_block(SubtensorModule::get_current_block_as_u64() + 1);
21652165
assert_noop!(
2166-
AdminUtils::sudo_set_kappa(
2166+
AdminUtils::sudo_set_commit_reveal_weights_interval(
21672167
<<Test as Config>::RuntimeOrigin>::signed(owner),
21682168
netuid,
21692169
13
@@ -2173,7 +2173,7 @@ fn test_owner_hyperparam_update_rate_limit_enforced() {
21732173

21742174
// Advance one more block to pass the limit; should succeed
21752175
run_to_block(SubtensorModule::get_current_block_as_u64() + 1);
2176-
assert_ok!(AdminUtils::sudo_set_kappa(
2176+
assert_ok!(AdminUtils::sudo_set_commit_reveal_weights_interval(
21772177
<<Test as Config>::RuntimeOrigin>::signed(owner),
21782178
netuid,
21792179
14
@@ -2200,21 +2200,25 @@ fn test_hyperparam_rate_limit_enforced_by_tempo() {
22002200
));
22012201

22022202
// First owner update should succeed
2203-
assert_ok!(AdminUtils::sudo_set_kappa(
2203+
assert_ok!(AdminUtils::sudo_set_commit_reveal_weights_interval(
22042204
<<Test as Config>::RuntimeOrigin>::signed(owner),
22052205
netuid,
22062206
1
22072207
));
22082208

22092209
// Immediate second update should fail due to tempo-based RL
22102210
assert_noop!(
2211-
AdminUtils::sudo_set_kappa(<<Test as Config>::RuntimeOrigin>::signed(owner), netuid, 2),
2211+
AdminUtils::sudo_set_commit_reveal_weights_interval(
2212+
<<Test as Config>::RuntimeOrigin>::signed(owner),
2213+
netuid,
2214+
2
2215+
),
22122216
SubtensorError::<Test>::TxRateLimitExceeded
22132217
);
22142218

22152219
// Advance 2 blocks (2 tempos with tempo=1) then succeed
22162220
run_to_block(SubtensorModule::get_current_block_as_u64() + 2);
2217-
assert_ok!(AdminUtils::sudo_set_kappa(
2221+
assert_ok!(AdminUtils::sudo_set_commit_reveal_weights_interval(
22182222
<<Test as Config>::RuntimeOrigin>::signed(owner),
22192223
netuid,
22202224
3
@@ -2244,15 +2248,15 @@ fn test_owner_hyperparam_rate_limit_independent_per_param() {
22442248
));
22452249

22462250
// First update to kappa should succeed
2247-
assert_ok!(AdminUtils::sudo_set_kappa(
2251+
assert_ok!(AdminUtils::sudo_set_commit_reveal_weights_interval(
22482252
<<Test as Config>::RuntimeOrigin>::signed(owner),
22492253
netuid,
22502254
10
22512255
));
22522256

22532257
// Immediate second update to the SAME param (kappa) should be blocked by RL
22542258
assert_noop!(
2255-
AdminUtils::sudo_set_kappa(
2259+
AdminUtils::sudo_set_commit_reveal_weights_interval(
22562260
<<Test as Config>::RuntimeOrigin>::signed(owner),
22572261
netuid,
22582262
11
@@ -2269,7 +2273,7 @@ fn test_owner_hyperparam_rate_limit_independent_per_param() {
22692273

22702274
// kappa should still be blocked until its own RL window passes
22712275
assert_noop!(
2272-
AdminUtils::sudo_set_kappa(
2276+
AdminUtils::sudo_set_commit_reveal_weights_interval(
22732277
<<Test as Config>::RuntimeOrigin>::signed(owner),
22742278
netuid,
22752279
12
@@ -2287,7 +2291,7 @@ fn test_owner_hyperparam_rate_limit_independent_per_param() {
22872291
run_to_block(SubtensorModule::get_current_block_as_u64() + 2);
22882292

22892293
// Now both hyperparameters can be updated again
2290-
assert_ok!(AdminUtils::sudo_set_kappa(
2294+
assert_ok!(AdminUtils::sudo_set_commit_reveal_weights_interval(
22912295
<<Test as Config>::RuntimeOrigin>::signed(owner),
22922296
netuid,
22932297
13

0 commit comments

Comments
 (0)