12
12
)
13
13
14
14
15
- @pytest .mark .parametrize ("local_chain" , [False ], indirect = True )
15
+ @pytest .mark .parametrize ("local_chain" , [True ], indirect = True )
16
16
@pytest .mark .asyncio
17
17
async def test_commit_and_reveal_weights_cr3 (local_chain , subtensor , alice_wallet ):
18
18
"""
@@ -29,6 +29,7 @@ async def test_commit_and_reveal_weights_cr3(local_chain, subtensor, alice_walle
29
29
Raises:
30
30
AssertionError: If any of the checks or verifications fail
31
31
"""
32
+ BLOCK_TIME = 0.25 # 12 for non-fast-block, 0.25 for fast block
32
33
netuid = 2
33
34
logging .console .info ("Testing test_commit_and_reveal_weights" )
34
35
@@ -71,9 +72,8 @@ async def test_commit_and_reveal_weights_cr3(local_chain, subtensor, alice_walle
71
72
assert subtensor .weights_rate_limit (netuid = netuid ) == 0
72
73
logging .console .info ("sudo_set_weights_set_rate_limit executed: set to 0" )
73
74
74
- # Change the tempo of the subnet from default 360
75
- # Since this is in normal blocks, this is necessary
76
- tempo_set = 10
75
+ # Change the tempo of the subnet
76
+ tempo_set = 50
77
77
assert (
78
78
sudo_set_admin_utils (
79
79
local_chain ,
@@ -101,8 +101,8 @@ async def test_commit_and_reveal_weights_cr3(local_chain, subtensor, alice_walle
101
101
f"Checking if window is too low with Current block: { current_block } , next tempo: { upcoming_tempo } "
102
102
)
103
103
104
- # Wait for 2 tempos to pass as CR3 only reveals weights after 2 tempos
105
- subtensor .wait_for_block (20 )
104
+ # Wait for 2 tempos to pass as CR3 only reveals weights after 2 tempos + 1
105
+ subtensor .wait_for_block (( tempo_set * 2 ) + 1 )
106
106
107
107
# Lower than this might mean weights will get revealed before we can check them
108
108
if upcoming_tempo - current_block < 3 :
@@ -127,6 +127,7 @@ async def test_commit_and_reveal_weights_cr3(local_chain, subtensor, alice_walle
127
127
weights = weight_vals ,
128
128
wait_for_inclusion = True ,
129
129
wait_for_finalization = True ,
130
+ block_time = BLOCK_TIME ,
130
131
)
131
132
132
133
# Assert committing was a success
@@ -148,7 +149,7 @@ async def test_commit_and_reveal_weights_cr3(local_chain, subtensor, alice_walle
148
149
149
150
# Ensure the expected drand round is well in the future
150
151
assert (
151
- expected_reveal_round > latest_drand_round
152
+ expected_reveal_round >= latest_drand_round
152
153
), "Revealed drand pulse is older than the drand pulse right after setting weights"
153
154
154
155
# Fetch current commits pending on the chain
0 commit comments