File tree Expand file tree Collapse file tree 2 files changed +36
-1
lines changed
Expand file tree Collapse file tree 2 files changed +36
-1
lines changed Original file line number Diff line number Diff line change @@ -315,7 +315,7 @@ impl<T: Config> Pallet<T> {
315315 // Possibly there is no neuron slots at all.
316316 ensure ! (
317317 Self :: get_max_allowed_uids( netuid) != 0 ,
318- Error :: <T >:: NetworkDoesNotExist
318+ Error :: <T >:: NoNeuronIdAvailable
319319 ) ;
320320
321321 if current_subnetwork_n < Self :: get_max_allowed_uids ( netuid) {
Original file line number Diff line number Diff line change @@ -154,6 +154,41 @@ fn test_registration_ok() {
154154 } ) ;
155155}
156156
157+ #[ test]
158+ fn test_registration_without_neuron_slot ( ) {
159+ new_test_ext ( 1 ) . execute_with ( || {
160+ let block_number: u64 = 0 ;
161+ let netuid: u16 = 1 ;
162+ let tempo: u16 = 13 ;
163+ let hotkey_account_id: U256 = U256 :: from ( 1 ) ;
164+ let coldkey_account_id = U256 :: from ( 667 ) ; // Neighbour of the beast, har har
165+ let ( nonce, work) : ( u64 , Vec < u8 > ) = SubtensorModule :: create_work_for_block_number (
166+ netuid,
167+ block_number,
168+ 129123813 ,
169+ & hotkey_account_id,
170+ ) ;
171+
172+ //add network
173+ add_network ( netuid, tempo, 0 ) ;
174+ SubtensorModule :: set_max_allowed_uids ( netuid, 0 ) ;
175+
176+ // Subscribe and check extrinsic output
177+ assert_noop ! (
178+ SubtensorModule :: register(
179+ <<Test as Config >:: RuntimeOrigin >:: signed( hotkey_account_id) ,
180+ netuid,
181+ block_number,
182+ nonce,
183+ work,
184+ hotkey_account_id,
185+ coldkey_account_id
186+ ) ,
187+ Error :: <Test >:: NoNeuronIdAvailable
188+ ) ;
189+ } ) ;
190+ }
191+
157192#[ test]
158193fn test_registration_under_limit ( ) {
159194 new_test_ext ( 1 ) . execute_with ( || {
You can’t perform that action at this time.
0 commit comments