@@ -150,81 +150,6 @@ def test_do_commit_reveal_v3_failure_due_to_error(mocker, subtensor):
150150 assert result == (False , "Formatted error" )
151151
152152
153- def test_commit_reveal_v3_extrinsic_success_with_torch (mocker , subtensor , hyperparams ):
154- """Test successful commit-reveal with torch tensors."""
155- # Preps
156- fake_wallet = mocker .Mock (autospec = subtensor_module .Wallet )
157- fake_netuid = 1
158- fake_uids = torch .tensor ([1 , 2 , 3 ], dtype = torch .int64 )
159- fake_weights = torch .tensor ([0.1 , 0.2 , 0.7 ], dtype = torch .float32 )
160- fake_commit_for_reveal = b"mock_commit_for_reveal"
161- fake_reveal_round = 1
162-
163- # Mocks
164- mocker .patch .object (commit_reveal , "use_torch" , return_value = True )
165-
166- mocked_uids = mocker .Mock ()
167- mocked_weights = mocker .Mock ()
168- mocked_convert_weights_and_uids_for_emit = mocker .patch .object (
169- commit_reveal ,
170- "convert_weights_and_uids_for_emit" ,
171- return_value = (mocked_uids , mocked_weights ),
172- )
173- mocked_get_subnet_reveal_period_epochs = mocker .patch .object (
174- subtensor , "get_subnet_reveal_period_epochs"
175- )
176- mocked_get_encrypted_commit = mocker .patch .object (
177- commit_reveal ,
178- "get_encrypted_commit" ,
179- return_value = (fake_commit_for_reveal , fake_reveal_round ),
180- )
181- mock_do_commit_reveal_v3 = mocker .patch .object (
182- commit_reveal , "_do_commit_reveal_v3" , return_value = (True , "Success" )
183- )
184- mock_block = mocker .patch .object (subtensor , "get_current_block" , return_value = 1 )
185- mock_hyperparams = mocker .patch .object (
186- subtensor ,
187- "get_subnet_hyperparameters" ,
188- return_value = hyperparams ,
189- )
190-
191- # Call
192- success , message = commit_reveal .commit_reveal_v3_extrinsic (
193- subtensor = subtensor ,
194- wallet = fake_wallet ,
195- netuid = fake_netuid ,
196- uids = fake_uids ,
197- weights = fake_weights ,
198- wait_for_inclusion = True ,
199- wait_for_finalization = True ,
200- )
201-
202- # Asserts
203- assert success is True
204- assert message == "reveal_round:1"
205- mocked_convert_weights_and_uids_for_emit .assert_called_once_with (
206- fake_uids , fake_weights
207- )
208- mocked_get_encrypted_commit .assert_called_once_with (
209- uids = mocked_uids ,
210- weights = mocked_weights ,
211- subnet_reveal_period_epochs = mock_hyperparams .return_value .commit_reveal_weights_interval ,
212- version_key = commit_reveal .version_as_int ,
213- tempo = mock_hyperparams .return_value .tempo ,
214- netuid = fake_netuid ,
215- current_block = mock_block .return_value ,
216- )
217- mock_do_commit_reveal_v3 .assert_called_once_with (
218- self = subtensor ,
219- wallet = fake_wallet ,
220- netuid = fake_netuid ,
221- commit = fake_commit_for_reveal ,
222- reveal_round = fake_reveal_round ,
223- wait_for_inclusion = True ,
224- wait_for_finalization = True ,
225- )
226-
227-
228153def test_commit_reveal_v3_extrinsic_success_with_numpy (mocker , subtensor , hyperparams ):
229154 """Test successful commit-reveal with numpy arrays."""
230155 # Preps
@@ -233,7 +158,6 @@ def test_commit_reveal_v3_extrinsic_success_with_numpy(mocker, subtensor, hyperp
233158 fake_uids = np .array ([1 , 2 , 3 ], dtype = np .int64 )
234159 fake_weights = np .array ([0.1 , 0.2 , 0.7 ], dtype = np .float32 )
235160
236- mocker .patch .object (commit_reveal , "use_torch" , return_value = False )
237161 mock_convert = mocker .patch .object (
238162 commit_reveal ,
239163 "convert_weights_and_uids_for_emit" ,
@@ -282,7 +206,6 @@ def test_commit_reveal_v3_extrinsic_response_false(mocker, subtensor, hyperparam
282206 fake_reveal_round = 1
283207
284208 # Mocks
285- mocker .patch .object (commit_reveal , "use_torch" , return_value = True )
286209 mocker .patch .object (
287210 commit_reveal ,
288211 "convert_weights_and_uids_for_emit" ,
0 commit comments