avoid json-rpc server import (#5649)
This commit is contained in:
parent
c36d2aa103
commit
9d155ebb35
|
@ -11,7 +11,7 @@ import
|
||||||
std/osproc,
|
std/osproc,
|
||||||
|
|
||||||
# Nimble packages
|
# Nimble packages
|
||||||
chronos, json_rpc/servers/httpserver, presto, bearssl/rand,
|
chronos, presto, bearssl/rand,
|
||||||
|
|
||||||
# Local modules
|
# Local modules
|
||||||
"."/[beacon_clock, beacon_chain_db, conf, light_client],
|
"."/[beacon_clock, beacon_chain_db, conf, light_client],
|
||||||
|
@ -30,7 +30,7 @@ import
|
||||||
./rpc/state_ttl_cache
|
./rpc/state_ttl_cache
|
||||||
|
|
||||||
export
|
export
|
||||||
osproc, chronos, httpserver, presto, action_tracker,
|
osproc, chronos, presto, action_tracker,
|
||||||
beacon_clock, beacon_chain_db, conf, light_client,
|
beacon_clock, beacon_chain_db, conf, light_client,
|
||||||
attestation_pool, sync_committee_msg_pool, validator_pool,
|
attestation_pool, sync_committee_msg_pool, validator_pool,
|
||||||
eth2_network, el_manager, request_manager, sync_manager,
|
eth2_network, el_manager, request_manager, sync_manager,
|
||||||
|
|
|
@ -1324,10 +1324,10 @@ func runAsService*(config: BeaconNodeConf): bool =
|
||||||
false
|
false
|
||||||
|
|
||||||
func web3SignerUrls*(conf: AnyConf): seq[Web3SignerUrl] =
|
func web3SignerUrls*(conf: AnyConf): seq[Web3SignerUrl] =
|
||||||
for url in conf.web3signers:
|
for url in conf.web3Signers:
|
||||||
result.add Web3SignerUrl(url: url)
|
result.add Web3SignerUrl(url: url)
|
||||||
|
|
||||||
for url in conf.verifyingWeb3signers:
|
for url in conf.verifyingWeb3Signers:
|
||||||
result.add Web3SignerUrl(url: url,
|
result.add Web3SignerUrl(url: url,
|
||||||
provenBlockProperties: conf.provenBlockProperties)
|
provenBlockProperties: conf.provenBlockProperties)
|
||||||
|
|
||||||
|
|
|
@ -92,12 +92,6 @@ when defined(windows):
|
||||||
lpHandlerProc: LPHANDLER_FUNCTION): SERVICE_STATUS_HANDLE{.
|
lpHandlerProc: LPHANDLER_FUNCTION): SERVICE_STATUS_HANDLE{.
|
||||||
stdcall, dynlib: "advapi32", importc: "RegisterServiceCtrlHandlerA".}
|
stdcall, dynlib: "advapi32", importc: "RegisterServiceCtrlHandlerA".}
|
||||||
|
|
||||||
type
|
|
||||||
RpcServer = RpcHttpServer
|
|
||||||
|
|
||||||
template init(T: type RpcHttpServer, ip: ValidIpAddress, port: Port): T =
|
|
||||||
newRpcHttpServer([initTAddress(ip, port)])
|
|
||||||
|
|
||||||
# https://github.com/ethereum/eth2.0-metrics/blob/master/metrics.md#interop-metrics
|
# https://github.com/ethereum/eth2.0-metrics/blob/master/metrics.md#interop-metrics
|
||||||
declareGauge beacon_slot, "Latest slot of the beacon chain state"
|
declareGauge beacon_slot, "Latest slot of the beacon chain state"
|
||||||
declareGauge beacon_current_epoch, "Current epoch"
|
declareGauge beacon_current_epoch, "Current epoch"
|
||||||
|
@ -517,7 +511,7 @@ proc init*(T: type BeaconNode,
|
||||||
rng: ref HmacDrbgContext,
|
rng: ref HmacDrbgContext,
|
||||||
config: BeaconNodeConf,
|
config: BeaconNodeConf,
|
||||||
metadata: Eth2NetworkMetadata): Future[BeaconNode]
|
metadata: Eth2NetworkMetadata): Future[BeaconNode]
|
||||||
{.async, raises: [CatchableError].} =
|
{.async.} =
|
||||||
var taskpool: TaskPoolPtr
|
var taskpool: TaskPoolPtr
|
||||||
|
|
||||||
template cfg: auto = metadata.cfg
|
template cfg: auto = metadata.cfg
|
||||||
|
|
|
@ -336,7 +336,6 @@ proc installBeaconApiHandlers*(router: var RestRouter, node: BeaconNode) =
|
||||||
): RestApiResponse =
|
): RestApiResponse =
|
||||||
node.withStateForBlockSlotId(bslot):
|
node.withStateForBlockSlotId(bslot):
|
||||||
let
|
let
|
||||||
validatorsCount = lenu64(getStateField(state, validators))
|
|
||||||
indices = node.getIndices(validatorIds, state).valueOr:
|
indices = node.getIndices(validatorIds, state).valueOr:
|
||||||
return RestApiResponse.jsonError(error)
|
return RestApiResponse.jsonError(error)
|
||||||
response =
|
response =
|
||||||
|
|
|
@ -127,7 +127,7 @@ proc doRequest(
|
||||||
peer: Peer,
|
peer: Peer,
|
||||||
key: tuple[startPeriod: SyncCommitteePeriod, count: uint64]
|
key: tuple[startPeriod: SyncCommitteePeriod, count: uint64]
|
||||||
): Future[LightClientUpdatesByRangeResponse] {.
|
): Future[LightClientUpdatesByRangeResponse] {.
|
||||||
async, raises: [IOError].} =
|
async.} =
|
||||||
let (startPeriod, count) = key
|
let (startPeriod, count) = key
|
||||||
doAssert count > 0 and count <= MAX_REQUEST_LIGHT_CLIENT_UPDATES
|
doAssert count > 0 and count <= MAX_REQUEST_LIGHT_CLIENT_UPDATES
|
||||||
let response = await peer.lightClientUpdatesByRange(startPeriod, count)
|
let response = await peer.lightClientUpdatesByRange(startPeriod, count)
|
||||||
|
@ -142,16 +142,14 @@ proc doRequest(
|
||||||
proc doRequest(
|
proc doRequest(
|
||||||
e: typedesc[FinalityUpdate],
|
e: typedesc[FinalityUpdate],
|
||||||
peer: Peer
|
peer: Peer
|
||||||
): Future[NetRes[ForkedLightClientFinalityUpdate]] {.
|
): Future[NetRes[ForkedLightClientFinalityUpdate]] =
|
||||||
raises: [IOError].} =
|
|
||||||
peer.lightClientFinalityUpdate()
|
peer.lightClientFinalityUpdate()
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.5/specs/altair/light-client/p2p-interface.md#getlightclientoptimisticupdate
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.5/specs/altair/light-client/p2p-interface.md#getlightclientoptimisticupdate
|
||||||
proc doRequest(
|
proc doRequest(
|
||||||
e: typedesc[OptimisticUpdate],
|
e: typedesc[OptimisticUpdate],
|
||||||
peer: Peer
|
peer: Peer
|
||||||
): Future[NetRes[ForkedLightClientOptimisticUpdate]] {.
|
): Future[NetRes[ForkedLightClientOptimisticUpdate]] =
|
||||||
raises: [IOError].} =
|
|
||||||
peer.lightClientOptimisticUpdate()
|
peer.lightClientOptimisticUpdate()
|
||||||
|
|
||||||
template valueVerifier[E](
|
template valueVerifier[E](
|
||||||
|
|
Loading…
Reference in New Issue