File tree Expand file tree Collapse file tree 3 files changed +392
-6
lines changed Expand file tree Collapse file tree 3 files changed +392
-6
lines changed Original file line number Diff line number Diff line change @@ -228,9 +228,13 @@ impl MetagraphPrecompile {
228
228
let validator_permit =
229
229
pallet_subtensor:: Pallet :: < Runtime > :: get_validator_permit_for_uid ( netuid, uid) ;
230
230
231
- // let result_u256 = U256::from(validator_status);
232
- // let mut result = [0_u8; 32];
233
- // U256::to_big_endian(&result_u256, &mut result);
231
+ let result_u256 = if validator_permit {
232
+ U256 :: from ( 1 )
233
+ } else {
234
+ U256 :: from ( 0 )
235
+ } ;
236
+ let mut result = [ 0_u8 ; 32 ] ;
237
+ U256 :: to_big_endian ( & result_u256, & mut result) ;
234
238
235
239
Ok ( PrecompileOutput {
236
240
exit_status : ExitSucceed :: Returned ,
@@ -258,9 +262,9 @@ impl MetagraphPrecompile {
258
262
let netuid = Self :: parse_netuid ( data) ?;
259
263
let uid = Self :: parse_uid ( & data[ 32 ..] ) ?;
260
264
261
- let rank = pallet_subtensor:: Pallet :: < Runtime > :: get_rank_for_uid ( netuid, uid) ;
265
+ let active = pallet_subtensor:: Pallet :: < Runtime > :: get_active_for_uid ( netuid, uid) ;
262
266
263
- let result_u256 = U256 :: from ( rank ) ;
267
+ let result_u256 = if active { U256 :: from ( 1 ) } else { U256 :: from ( 0 ) } ;
264
268
let mut result = [ 0_u8 ; 32 ] ;
265
269
U256 :: to_big_endian ( & result_u256, & mut result) ;
266
270
You can’t perform that action at this time.
0 commit comments