@@ -145,7 +145,6 @@ impl NeuronPrecompile {
145
145
handle. context ( ) . caller ,
146
146
) ;
147
147
148
- // Dispatch the register_network call
149
148
try_dispatch_runtime_call ( handle, call, RawOrigin :: Signed ( account_id) )
150
149
}
151
150
@@ -167,7 +166,6 @@ impl NeuronPrecompile {
167
166
handle. context ( ) . caller ,
168
167
) ;
169
168
170
- // Dispatch the register_network call
171
169
try_dispatch_runtime_call ( handle, call, RawOrigin :: Signed ( account_id) )
172
170
}
173
171
@@ -191,7 +189,6 @@ impl NeuronPrecompile {
191
189
handle. context ( ) . caller ,
192
190
) ;
193
191
194
- // Dispatch the register_network call
195
192
try_dispatch_runtime_call ( handle, call, RawOrigin :: Signed ( account_id) )
196
193
}
197
194
@@ -504,9 +501,8 @@ impl NeuronPrecompile {
504
501
exit_status : ExitError :: InvalidRange ,
505
502
} ) ;
506
503
}
507
- let mut netuid_vec = [ 0u8 ; 2 ] ;
508
- netuid_vec. copy_from_slice ( get_slice ( data, 30 , 32 ) ?) ;
509
- let netuid = u16:: from_be_bytes ( netuid_vec) ;
504
+
505
+ let netuid = parse_netuid ( data, 30 ) ?;
510
506
511
507
let mut version_vec = [ 0u8 ; 4 ] ;
512
508
version_vec. copy_from_slice ( get_slice ( data, 60 , 64 ) ?) ;
@@ -584,7 +580,12 @@ impl NeuronPrecompile {
584
580
len_vec. copy_from_slice ( get_slice ( data, len_position + 30 , len_position + 32 ) ?) ;
585
581
let vec_len = u16:: from_be_bytes ( len_vec) as usize ;
586
582
587
- let vec_result = get_slice ( data, len_position + 32 , len_position + 32 + vec_len) ?. to_vec ( ) ;
583
+ let vec_result = get_slice (
584
+ data,
585
+ len_position + 32 ,
586
+ len_position. saturating_add ( 32 ) . saturating_add ( vec_len) ,
587
+ ) ?
588
+ . to_vec ( ) ;
588
589
589
590
Ok ( (
590
591
netuid,
@@ -607,9 +608,8 @@ impl NeuronPrecompile {
607
608
exit_status : ExitError :: InvalidRange ,
608
609
} ) ;
609
610
}
610
- let mut netuid_vec = [ 0u8 ; 2 ] ;
611
- netuid_vec. copy_from_slice ( get_slice ( data, 30 , 32 ) ?) ;
612
- let netuid = u16:: from_be_bytes ( netuid_vec) ;
611
+
612
+ let netuid = parse_netuid ( data, 30 ) ?;
613
613
614
614
let mut version_vec = [ 0u8 ; 4 ] ;
615
615
version_vec. copy_from_slice ( get_slice ( data, 60 , 64 ) ?) ;
0 commit comments