@@ -30,17 +30,22 @@ async def test_commit_and_reveal_weights_cr3(local_chain, subtensor, alice_walle
30
30
Raises:
31
31
AssertionError: If any of the checks or verifications fail
32
32
"""
33
- BLOCK_TIME = 0.25 # 12 for non-fast-block, 0.25 for fast block
34
- netuid = 2
33
+ BLOCK_TIME = (
34
+ 0.25 if subtensor .is_fast_blocks () else 12.0
35
+ ) # 12 for non-fast-block, 0.25 for fast block
36
+ netuid = subtensor .get_total_subnets () # 2
37
+
35
38
logging .console .info ("Testing test_commit_and_reveal_weights" )
36
39
37
40
# Register root as Alice
38
41
assert subtensor .register_subnet (alice_wallet ), "Unable to register the subnet"
39
42
40
43
# Verify subnet 2 created successfully
41
- assert subtensor .subnet_exists (netuid ), "Subnet wasn't created successfully"
44
+ assert subtensor .subnet_exists (netuid ), (
45
+ f"Subnet { netuid } wasn't created successfully"
46
+ )
42
47
43
- logging .console .info ( "Subnet 2 is registered" )
48
+ logging .console .success ( f "Subnet { netuid } is registered" )
44
49
45
50
# Enable commit_reveal on the subnet
46
51
assert sudo_set_hyperparameter_bool (
@@ -74,7 +79,7 @@ async def test_commit_and_reveal_weights_cr3(local_chain, subtensor, alice_walle
74
79
logging .console .info ("sudo_set_weights_set_rate_limit executed: set to 0" )
75
80
76
81
# Change the tempo of the subnet
77
- tempo_set = 50
82
+ tempo_set = 50 if subtensor . is_fast_blocks () else 10
78
83
assert (
79
84
sudo_set_admin_utils (
80
85
local_chain ,
@@ -103,7 +108,7 @@ async def test_commit_and_reveal_weights_cr3(local_chain, subtensor, alice_walle
103
108
)
104
109
105
110
# Wait for 2 tempos to pass as CR3 only reveals weights after 2 tempos + 1
106
- subtensor .wait_for_block (( tempo_set * 2 ) + 1 )
111
+ subtensor .wait_for_block (tempo_set * 2 + 1 )
107
112
108
113
# Lower than this might mean weights will get revealed before we can check them
109
114
if upcoming_tempo - current_block < 3 :
@@ -117,7 +122,7 @@ async def test_commit_and_reveal_weights_cr3(local_chain, subtensor, alice_walle
117
122
latest_drand_round = subtensor .last_drand_round ()
118
123
upcoming_tempo = next_tempo (current_block , tempo )
119
124
logging .console .info (
120
- f"Post first wait_interval (to ensure window isnt too low): { current_block } , next tempo: { upcoming_tempo } , drand: { latest_drand_round } "
125
+ f"Post first wait_interval (to ensure window isn't too low): { current_block } , next tempo: { upcoming_tempo } , drand: { latest_drand_round } "
121
126
)
122
127
123
128
# Commit weights
@@ -171,6 +176,7 @@ async def test_commit_and_reveal_weights_cr3(local_chain, subtensor, alice_walle
171
176
subtensor ,
172
177
netuid = netuid ,
173
178
reporting_interval = 1 ,
179
+ sleep = BLOCK_TIME ,
174
180
)
175
181
176
182
# Fetch the latest drand pulse
0 commit comments