Skip to content

Commit da96dad

Browse files
authored
Merge pull request #2927 from opentensor/fix/roman/afpha-low-and-high-limits-are-changed
New logic for alpha low and high (0.025 <= alpha_low <= alpha_high <= 1)
2 parents 2bcb947 + 13a81ef commit da96dad

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

tests/e2e_tests/test_liquid_alpha.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def liquid_alpha_call_params(netuid: int, alpha_values: str):
1717

1818
def test_liquid_alpha(local_chain, subtensor, alice_wallet):
1919
"""
20-
Test the liquid alpha mechanism
20+
Test the liquid alpha mechanism. By June 17 2025 the limits are `0.025 <= alpha_low <= alpha_high <= 1`
2121
2222
Steps:
2323
1. Register a subnet through Alice
@@ -79,7 +79,7 @@ def test_liquid_alpha(local_chain, subtensor, alice_wallet):
7979
).liquid_alpha_enabled, "Failed to enable liquid alpha"
8080

8181
# Attempt to set alpha high & low after enabling the hyperparameter
82-
alpha_values = "87, 54099"
82+
alpha_values = "26001, 54099"
8383
call_params = liquid_alpha_call_params(netuid, alpha_values)
8484
assert sudo_set_hyperparameter_values(
8585
local_chain,
@@ -90,16 +90,15 @@ def test_liquid_alpha(local_chain, subtensor, alice_wallet):
9090
assert subtensor.get_subnet_hyperparameters(netuid).alpha_high == 54099, (
9191
"Failed to set alpha high"
9292
)
93-
assert subtensor.get_subnet_hyperparameters(netuid).alpha_low == 87, (
93+
assert subtensor.get_subnet_hyperparameters(netuid).alpha_low == 26001, (
9494
"Failed to set alpha low"
9595
)
9696

9797
# Testing alpha high upper and lower bounds
9898

9999
# 1. Test setting Alpha_high too low
100-
alpha_high_too_low = (
101-
u16_max * 4 // 5
102-
) - 1 # One less than the minimum acceptable value
100+
alpha_high_too_low = 87
101+
103102
call_params = liquid_alpha_call_params(netuid, f"6553, {alpha_high_too_low}")
104103
result, error_message = sudo_set_hyperparameter_values(
105104
local_chain,
@@ -142,9 +141,7 @@ def test_liquid_alpha(local_chain, subtensor, alice_wallet):
142141
assert error_message["name"] == "AlphaLowOutOfRange"
143142

144143
# 2. Test setting Alpha_low too high
145-
alpha_low_too_high = (
146-
u16_max * 4 // 5
147-
) + 1 # One more than the maximum acceptable value
144+
alpha_low_too_high = 53084
148145
call_params = liquid_alpha_call_params(netuid, f"{alpha_low_too_high}, 53083")
149146
result, error_message = sudo_set_hyperparameter_values(
150147
local_chain,

0 commit comments

Comments
 (0)