11import { EntryStatus , distance } from '@chainsafe/discv5'
22import { ENR } from '@chainsafe/enr'
3- import { bigIntToHex , bytesToHex , hexToBytes , PrefixedHexString , short } from '@ethereumjs/util'
3+ import {
4+ type PrefixedHexString ,
5+ bigIntToHex ,
6+ bytesToHex ,
7+ hexToBytes ,
8+ short ,
9+ } from '@ethereumjs/util'
410import {
511 ContentLookup ,
612 FoundContent ,
@@ -16,11 +22,11 @@ import { content_params } from '../schema/index.js'
1622import { callWithStackTrace , isValidId } from '../util.js'
1723import { middleware , validators } from '../validators.js'
1824
25+ import { BitArray } from '@chainsafe/ssz'
1926import { RunStatusCode } from '@lodestar/light-client'
2027import type { Debugger } from 'debug'
2128import type { BeaconNetwork , HistoryNetwork , PortalNetwork , StateNetwork } from 'portalnetwork'
2229import type { GetEnrResult } from '../schema/types.js'
23- import { BitArray } from '@chainsafe/ssz'
2430
2531const methods = [
2632 // state
@@ -771,7 +777,9 @@ export class portal {
771777 const [ contentKey ] = params
772778 this . logger . extend ( 'beaconLocalContent' ) ( `Received request for ${ contentKey } ` )
773779
774- const content = await this . _beacon . findContentLocally ( hexToBytes ( contentKey as PrefixedHexString ) )
780+ const content = await this . _beacon . findContentLocally (
781+ hexToBytes ( contentKey as PrefixedHexString ) ,
782+ )
775783 this . logger . extend ( 'beaconLocalContent' ) (
776784 `request returned ${ content !== undefined ? content . length : 'null' } bytes` ,
777785 )
@@ -892,7 +900,10 @@ export class portal {
892900 this . logger . extend ( 'findContent' ) (
893901 `received request to send request to ${ shortId ( nodeId ) } for contentKey ${ contentKey } ` ,
894902 )
895- const res = await this . _history . sendFindContent ( ENR . decodeTxt ( enr ) , hexToBytes ( contentKey as PrefixedHexString ) )
903+ const res = await this . _history . sendFindContent (
904+ ENR . decodeTxt ( enr ) ,
905+ hexToBytes ( contentKey as PrefixedHexString ) ,
906+ )
896907 if ( res === undefined ) {
897908 this . logger . extend ( 'findContent' ) ( 'request returned undefined' )
898909 return undefined
@@ -924,7 +935,10 @@ export class portal {
924935 this . logger . extend ( 'findContent' ) (
925936 `received request to send request to ${ shortId ( nodeId ) } for contentKey ${ contentKey } ` ,
926937 )
927- const res = await this . _state . sendFindContent ( ENR . decodeTxt ( enr ) , hexToBytes ( contentKey as PrefixedHexString ) )
938+ const res = await this . _state . sendFindContent (
939+ ENR . decodeTxt ( enr ) ,
940+ hexToBytes ( contentKey as PrefixedHexString ) ,
941+ )
928942 if ( res === undefined ) {
929943 this . logger . extend ( 'findContent' ) ( 'request returned type: ENRS' )
930944 return { enrs : [ ] }
@@ -957,7 +971,10 @@ export class portal {
957971 }
958972 }
959973
960- const res = await this . _beacon . sendFindContent ( ENR . decodeTxt ( enr ) , hexToBytes ( contentKey as PrefixedHexString ) )
974+ const res = await this . _beacon . sendFindContent (
975+ ENR . decodeTxt ( enr ) ,
976+ hexToBytes ( contentKey as PrefixedHexString ) ,
977+ )
961978
962979 if ( res === undefined ) {
963980 this . logger . extend ( 'findContent' ) ( 'request returned type: ENRS' )
@@ -1067,7 +1084,11 @@ export class portal {
10671084 async historyTraceGetContent ( params : [ string ] ) {
10681085 const [ contentKey ] = params
10691086 this . logger . extend ( 'historyTraceGetContent' ) ( `request received for ${ contentKey } ` )
1070- const lookup = new ContentLookup ( this . _history , hexToBytes ( contentKey as PrefixedHexString ) , true )
1087+ const lookup = new ContentLookup (
1088+ this . _history ,
1089+ hexToBytes ( contentKey as PrefixedHexString ) ,
1090+ true ,
1091+ )
10711092 const res = await lookup . startLookup ( )
10721093 this . logger . extend ( 'historyTraceGetContent' ) ( `request returned ${ JSON . stringify ( res ) } ` )
10731094 if ( ! res ) {
@@ -1096,7 +1117,11 @@ export class portal {
10961117 async beaconTraceGetContent ( params : [ string ] ) {
10971118 const [ contentKey ] = params
10981119 this . logger . extend ( 'beaconTraceGetContent' ) ( `request received for ${ contentKey } ` )
1099- const lookup = new ContentLookup ( this . _history , hexToBytes ( contentKey as PrefixedHexString ) , true )
1120+ const lookup = new ContentLookup (
1121+ this . _history ,
1122+ hexToBytes ( contentKey as PrefixedHexString ) ,
1123+ true ,
1124+ )
11001125 const res = await lookup . startLookup ( )
11011126 this . logger . extend ( 'beaconTraceGetContent' ) ( `request returned ${ JSON . stringify ( res ) } ` )
11021127 if ( ! res ) {
@@ -1125,7 +1150,11 @@ export class portal {
11251150 async stateTraceGetContent ( params : [ string ] ) {
11261151 const [ contentKey ] = params
11271152 this . logger . extend ( 'stateTraceGetContent' ) ( `request received for ${ contentKey } ` )
1128- const lookup = new ContentLookup ( this . _history , hexToBytes ( contentKey as PrefixedHexString ) , true )
1153+ const lookup = new ContentLookup (
1154+ this . _history ,
1155+ hexToBytes ( contentKey as PrefixedHexString ) ,
1156+ true ,
1157+ )
11291158 const res = await lookup . startLookup ( )
11301159 this . logger . extend ( 'stateTraceGetContent' ) ( `request returned ${ JSON . stringify ( res ) } ` )
11311160 if ( ! res ) {
@@ -1197,13 +1226,19 @@ export class portal {
11971226 async historyGossip ( params : [ string , string ] ) {
11981227 const [ contentKey , content ] = params
11991228 this . logger ( `historyGossip request received for ${ contentKey } ` )
1200- const res = await this . _history . gossipContent ( hexToBytes ( contentKey as PrefixedHexString ) , hexToBytes ( content as PrefixedHexString ) )
1229+ const res = await this . _history . gossipContent (
1230+ hexToBytes ( contentKey as PrefixedHexString ) ,
1231+ hexToBytes ( content as PrefixedHexString ) ,
1232+ )
12011233 return res
12021234 }
12031235 async stateGossip ( params : [ string , string ] ) {
12041236 const [ contentKey , content ] = params
12051237 this . logger ( `stateGossip request received for ${ contentKey } ` )
1206- const res = await this . _state . gossipContent ( hexToBytes ( contentKey as PrefixedHexString ) , hexToBytes ( content as PrefixedHexString ) )
1238+ const res = await this . _state . gossipContent (
1239+ hexToBytes ( contentKey as PrefixedHexString ) ,
1240+ hexToBytes ( content as PrefixedHexString ) ,
1241+ )
12071242 return res
12081243 }
12091244
0 commit comments