Skip to content

Commit 78afd48

Browse files
Merge branch 'staging' of github.com:opentensor/bittensor into tests/zyzniewski/async_e2e
2 parents b565a14 + 26d2d05 commit 78afd48

File tree

5 files changed

+43
-15
lines changed

5 files changed

+43
-15
lines changed

tests/e2e_tests/test_commitment.py

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
import pytest
2+
from async_substrate_interface.errors import SubstrateRequestException
23

34
from bittensor import logging
4-
from async_substrate_interface.errors import SubstrateRequestException
5+
from tests.e2e_tests.utils.chain_interactions import sudo_set_admin_utils
56

67
logging.set_trace()
78

89

910
@pytest.mark.asyncio
10-
async def test_commitment(subtensor, alice_wallet):
11+
async def test_commitment(local_chain, subtensor, alice_wallet):
1112
with pytest.raises(SubstrateRequestException, match="AccountNotAllowedCommit"):
1213
await subtensor.set_commitment(
1314
alice_wallet,
@@ -38,14 +39,27 @@ async def test_commitment(subtensor, alice_wallet):
3839
data="Hello World!",
3940
)
4041

42+
status, error = sudo_set_admin_utils(
43+
local_chain,
44+
alice_wallet,
45+
call_module="Commitments",
46+
call_function="set_max_space",
47+
call_params={
48+
"netuid": 1,
49+
"new_limit": len("Hello World!"),
50+
},
51+
)
52+
53+
assert status is True, error
54+
4155
with pytest.raises(
4256
SubstrateRequestException,
43-
match="CommitmentSetRateLimitExceeded",
57+
match="SpaceLimitExceeded",
4458
):
4559
await subtensor.set_commitment(
4660
alice_wallet,
4761
netuid=1,
48-
data="Hello World!",
62+
data="Hello World!1",
4963
)
5064

5165
assert "Hello World!" == await subtensor.get_commitment(

tests/e2e_tests/test_incentive.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,14 @@
33
import pytest
44

55
from tests.e2e_tests.utils.chain_interactions import (
6+
root_set_subtensor_hyperparameter_values,
67
sudo_set_admin_utils,
78
wait_epoch,
89
wait_interval,
910
)
1011

12+
DURATION_OF_START_CALL = 10
13+
1114

1215
@pytest.mark.asyncio
1316
async def test_incentive(local_chain, subtensor, templates, alice_wallet, bob_wallet):
@@ -53,7 +56,7 @@ async def test_incentive(local_chain, subtensor, templates, alice_wallet, bob_wa
5356

5457
assert alice_neuron.validator_permit is True
5558
assert alice_neuron.dividends == 0
56-
assert alice_neuron.stake.tao > 0
59+
assert alice_neuron.stake.tao == 0
5760
assert alice_neuron.validator_trust == 0
5861
assert alice_neuron.incentive == 0
5962
assert alice_neuron.consensus == 0
@@ -66,6 +69,20 @@ async def test_incentive(local_chain, subtensor, templates, alice_wallet, bob_wa
6669
assert bob_neuron.rank == 0
6770
assert bob_neuron.trust == 0
6871

72+
subtensor.wait_for_block(DURATION_OF_START_CALL)
73+
74+
# Subnet "Start Call" https://github.com/opentensor/bits/pull/13
75+
status, error = await root_set_subtensor_hyperparameter_values(
76+
local_chain,
77+
alice_wallet,
78+
call_function="start_call",
79+
call_params={
80+
"netuid": netuid,
81+
},
82+
)
83+
84+
assert status is True, error
85+
6986
# update weights_set_rate_limit for fast-blocks
7087
tempo = await subtensor.tempo(netuid)
7188
status, error = sudo_set_admin_utils(

tests/e2e_tests/test_metagraph.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -207,12 +207,12 @@ async def test_metagraph_info(subtensor, alice_wallet):
207207
blocks_since_last_step=1,
208208
subnet_emission=Balance(0),
209209
alpha_in=Balance.from_tao(10),
210-
alpha_out=Balance.from_tao(2),
210+
alpha_out=Balance.from_tao(1),
211211
tao_in=Balance.from_tao(10),
212-
alpha_out_emission=Balance.from_tao(1),
212+
alpha_out_emission=Balance(0),
213213
alpha_in_emission=Balance(0),
214214
tao_in_emission=Balance(0),
215-
pending_alpha_emission=Balance.from_tao(0.820004577),
215+
pending_alpha_emission=Balance(0),
216216
pending_root_emission=Balance(0),
217217
subnet_volume=Balance(0),
218218
moving_price=Balance(0),

tests/e2e_tests/test_staking.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ async def test_single_operation(subtensor, alice_wallet, bob_wallet):
4242
alice_wallet,
4343
bob_wallet.hotkey.ss58_address,
4444
netuid=1,
45-
amount=Balance.from_tao(10_000),
45+
amount=Balance.from_tao(1),
4646
wait_for_inclusion=True,
4747
wait_for_finalization=True,
4848
)

tests/e2e_tests/utils/chain_interactions.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ def sudo_set_admin_utils(
190190
wallet: "Wallet",
191191
call_function: str,
192192
call_params: dict,
193+
call_module: str = "AdminUtils",
193194
) -> tuple[bool, Optional[dict]]:
194195
"""
195196
Wraps the call in sudo to set hyperparameter values using AdminUtils.
@@ -204,7 +205,7 @@ def sudo_set_admin_utils(
204205
tuple[bool, Optional[dict]]: (success status, error details).
205206
"""
206207
inner_call = substrate.compose_call(
207-
call_module="AdminUtils",
208+
call_module=call_module,
208209
call_function=call_function,
209210
call_params=call_params,
210211
)
@@ -231,7 +232,6 @@ def root_set_subtensor_hyperparameter_values(
231232
wallet: "Wallet",
232233
call_function: str,
233234
call_params: dict,
234-
return_error_message: bool = False,
235235
) -> tuple[bool, str]:
236236
"""
237237
Sets liquid alpha values using AdminUtils. Mimics setting hyperparams
@@ -249,10 +249,7 @@ def root_set_subtensor_hyperparameter_values(
249249
wait_for_finalization=True,
250250
)
251251

252-
if return_error_message:
253-
return response.is_success, response.error_message
254-
255-
return response.is_success, ""
252+
return response.is_success, response.error_message
256253

257254

258255
async def set_identity(

0 commit comments

Comments
 (0)