1212)
1313
1414
15- @pytest .mark .parametrize ("local_chain" , [False ], indirect = True )
15+ @pytest .mark .parametrize ("local_chain" , [True ], indirect = True )
1616@pytest .mark .asyncio
1717async def test_commit_and_reveal_weights_cr3 (local_chain , subtensor , alice_wallet ):
1818 """
@@ -29,6 +29,7 @@ async def test_commit_and_reveal_weights_cr3(local_chain, subtensor, alice_walle
2929 Raises:
3030 AssertionError: If any of the checks or verifications fail
3131 """
32+ BLOCK_TIME = 0.25 # 12 for non-fast-block, 0.25 for fast block
3233 netuid = 2
3334 logging .console .info ("Testing test_commit_and_reveal_weights" )
3435
@@ -71,9 +72,8 @@ async def test_commit_and_reveal_weights_cr3(local_chain, subtensor, alice_walle
7172 assert subtensor .weights_rate_limit (netuid = netuid ) == 0
7273 logging .console .info ("sudo_set_weights_set_rate_limit executed: set to 0" )
7374
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
7777 assert (
7878 sudo_set_admin_utils (
7979 local_chain ,
@@ -101,8 +101,8 @@ async def test_commit_and_reveal_weights_cr3(local_chain, subtensor, alice_walle
101101 f"Checking if window is too low with Current block: { current_block } , next tempo: { upcoming_tempo } "
102102 )
103103
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 )
106106
107107 # Lower than this might mean weights will get revealed before we can check them
108108 if upcoming_tempo - current_block < 3 :
@@ -127,6 +127,7 @@ async def test_commit_and_reveal_weights_cr3(local_chain, subtensor, alice_walle
127127 weights = weight_vals ,
128128 wait_for_inclusion = True ,
129129 wait_for_finalization = True ,
130+ block_time = BLOCK_TIME ,
130131 )
131132
132133 # Assert committing was a success
@@ -148,7 +149,7 @@ async def test_commit_and_reveal_weights_cr3(local_chain, subtensor, alice_walle
148149
149150 # Ensure the expected drand round is well in the future
150151 assert (
151- expected_reveal_round > latest_drand_round
152+ expected_reveal_round >= latest_drand_round
152153 ), "Revealed drand pulse is older than the drand pulse right after setting weights"
153154
154155 # Fetch current commits pending on the chain
0 commit comments