1
1
import pytest
2
+ from async_substrate_interface .errors import SubstrateRequestException
2
3
3
4
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
5
6
6
7
logging .set_trace ()
7
8
8
9
9
- def test_commitment (subtensor , alice_wallet ):
10
+ def test_commitment (local_chain , subtensor , alice_wallet ):
10
11
with pytest .raises (SubstrateRequestException , match = "AccountNotAllowedCommit" ):
11
12
subtensor .set_commitment (
12
13
alice_wallet ,
@@ -37,14 +38,27 @@ def test_commitment(subtensor, alice_wallet):
37
38
data = "Hello World!" ,
38
39
)
39
40
41
+ status , error = sudo_set_admin_utils (
42
+ local_chain ,
43
+ alice_wallet ,
44
+ call_module = "Commitments" ,
45
+ call_function = "set_max_space" ,
46
+ call_params = {
47
+ "netuid" : 1 ,
48
+ "new_limit" : len ("Hello World!" ),
49
+ },
50
+ )
51
+
52
+ assert status is True , error
53
+
40
54
with pytest .raises (
41
55
SubstrateRequestException ,
42
- match = "CommitmentSetRateLimitExceeded " ,
56
+ match = "SpaceLimitExceeded " ,
43
57
):
44
58
subtensor .set_commitment (
45
59
alice_wallet ,
46
60
netuid = 1 ,
47
- data = "Hello World!" ,
61
+ data = "Hello World!1 " ,
48
62
)
49
63
50
64
assert "Hello World!" == subtensor .get_commitment (
@@ -59,7 +73,7 @@ def test_commitment(subtensor, alice_wallet):
59
73
60
74
61
75
@pytest .mark .asyncio
62
- async def test_commitment_async (async_subtensor , alice_wallet ):
76
+ async def test_commitment_async (local_chain , async_subtensor , alice_wallet ):
63
77
async with async_subtensor as sub :
64
78
with pytest .raises (SubstrateRequestException , match = "AccountNotAllowedCommit" ):
65
79
await sub .set_commitment (
@@ -91,14 +105,27 @@ async def test_commitment_async(async_subtensor, alice_wallet):
91
105
data = "Hello World!" ,
92
106
)
93
107
108
+ status , error = sudo_set_admin_utils (
109
+ local_chain ,
110
+ alice_wallet ,
111
+ call_module = "Commitments" ,
112
+ call_function = "set_max_space" ,
113
+ call_params = {
114
+ "netuid" : 1 ,
115
+ "new_limit" : len ("Hello World!" ),
116
+ },
117
+ )
118
+
119
+ assert status is True , error
120
+
94
121
with pytest .raises (
95
122
SubstrateRequestException ,
96
- match = "CommitmentSetRateLimitExceeded " ,
123
+ match = "SpaceLimitExceeded " ,
97
124
):
98
125
await sub .set_commitment (
99
126
alice_wallet ,
100
127
netuid = 1 ,
101
- data = "Hello World!" ,
128
+ data = "Hello World!1 " ,
102
129
)
103
130
104
131
assert "Hello World!" == await sub .get_commitment (
0 commit comments