Skip to content

Commit 9f11505

Browse files
author
Roman
committed
fix
1 parent 448ba63 commit 9f11505

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

tests/e2e_tests/test_commit_reveal_v3.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,17 @@ async def test_commit_and_reveal_weights_cr3(local_chain, subtensor, alice_walle
3333
BLOCK_TIME = (
3434
0.25 if subtensor.is_fast_blocks() else 12.0
3535
) # 12 for non-fast-block, 0.25 for fast block
36-
netuid = 2
36+
netuid = subtensor.get_total_subnets() # 2
37+
3738
logging.console.info("Testing test_commit_and_reveal_weights")
3839

3940
# Register root as Alice
4041
assert subtensor.register_subnet(alice_wallet), "Unable to register the subnet"
4142

4243
# Verify subnet 2 created successfully
43-
assert subtensor.subnet_exists(netuid), "Subnet wasn't created successfully"
44+
assert subtensor.subnet_exists(netuid), f"Subnet {netuid} wasn't created successfully"
4445

45-
logging.console.info("Subnet 2 is registered")
46+
logging.console.success(f"Subnet {netuid} is registered")
4647

4748
# Enable commit_reveal on the subnet
4849
assert sudo_set_hyperparameter_bool(
@@ -105,7 +106,7 @@ async def test_commit_and_reveal_weights_cr3(local_chain, subtensor, alice_walle
105106
)
106107

107108
# Wait for 2 tempos to pass as CR3 only reveals weights after 2 tempos + 1
108-
subtensor.wait_for_block(subtensor.block + (tempo_set * 2) + 1)
109+
subtensor.wait_for_block(tempo_set * 2 + 1)
109110

110111
# Lower than this might mean weights will get revealed before we can check them
111112
if upcoming_tempo - current_block < 3:

tests/e2e_tests/test_reveal_commitments.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@ async def test_set_reveal_commitment(local_chain, subtensor, alice_wallet, bob_w
8181
# Sometimes the chain doesn't update the repository right away and the commit doesn't appear in the expected
8282
# `last_drand_round`. In this case need to wait a bit.
8383
print(f"Waiting for reveal round {target_reveal_round}")
84-
while subtensor.last_drand_round() <= target_reveal_round + 1:
84+
chain_offset = 1 if subtensor.is_fast_blocks() else 24
85+
while subtensor.last_drand_round() <= target_reveal_round + chain_offset:
8586
# wait one drand period (3 sec)
8687
print(f"Current last reveled drand round {subtensor.last_drand_round()}")
8788
time.sleep(3)

0 commit comments

Comments
 (0)