avoid json-rpc server import (#5649)

This commit is contained in:
Jacek Sieka 2023-12-05 22:08:18 +01:00 committed by GitHub
parent c36d2aa103
commit 9d155ebb35
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 8 additions and 17 deletions

View File

@ -11,7 +11,7 @@ import
std/osproc,
# Nimble packages
chronos, json_rpc/servers/httpserver, presto, bearssl/rand,
chronos, presto, bearssl/rand,
# Local modules
"."/[beacon_clock, beacon_chain_db, conf, light_client],
@ -30,7 +30,7 @@ import
./rpc/state_ttl_cache
export
osproc, chronos, httpserver, presto, action_tracker,
osproc, chronos, presto, action_tracker,
beacon_clock, beacon_chain_db, conf, light_client,
attestation_pool, sync_committee_msg_pool, validator_pool,
eth2_network, el_manager, request_manager, sync_manager,

View File

@ -1324,10 +1324,10 @@ func runAsService*(config: BeaconNodeConf): bool =
false
func web3SignerUrls*(conf: AnyConf): seq[Web3SignerUrl] =
for url in conf.web3signers:
for url in conf.web3Signers:
result.add Web3SignerUrl(url: url)
for url in conf.verifyingWeb3signers:
for url in conf.verifyingWeb3Signers:
result.add Web3SignerUrl(url: url,
provenBlockProperties: conf.provenBlockProperties)

View File

@ -92,12 +92,6 @@ when defined(windows):
lpHandlerProc: LPHANDLER_FUNCTION): SERVICE_STATUS_HANDLE{.
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
declareGauge beacon_slot, "Latest slot of the beacon chain state"
declareGauge beacon_current_epoch, "Current epoch"
@ -517,7 +511,7 @@ proc init*(T: type BeaconNode,
rng: ref HmacDrbgContext,
config: BeaconNodeConf,
metadata: Eth2NetworkMetadata): Future[BeaconNode]
{.async, raises: [CatchableError].} =
{.async.} =
var taskpool: TaskPoolPtr
template cfg: auto = metadata.cfg

View File

@ -336,7 +336,6 @@ proc installBeaconApiHandlers*(router: var RestRouter, node: BeaconNode) =
): RestApiResponse =
node.withStateForBlockSlotId(bslot):
let
validatorsCount = lenu64(getStateField(state, validators))
indices = node.getIndices(validatorIds, state).valueOr:
return RestApiResponse.jsonError(error)
response =

View File

@ -127,7 +127,7 @@ proc doRequest(
peer: Peer,
key: tuple[startPeriod: SyncCommitteePeriod, count: uint64]
): Future[LightClientUpdatesByRangeResponse] {.
async, raises: [IOError].} =
async.} =
let (startPeriod, count) = key
doAssert count > 0 and count <= MAX_REQUEST_LIGHT_CLIENT_UPDATES
let response = await peer.lightClientUpdatesByRange(startPeriod, count)
@ -142,16 +142,14 @@ proc doRequest(
proc doRequest(
e: typedesc[FinalityUpdate],
peer: Peer
): Future[NetRes[ForkedLightClientFinalityUpdate]] {.
raises: [IOError].} =
): Future[NetRes[ForkedLightClientFinalityUpdate]] =
peer.lightClientFinalityUpdate()
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.5/specs/altair/light-client/p2p-interface.md#getlightclientoptimisticupdate
proc doRequest(
e: typedesc[OptimisticUpdate],
peer: Peer
): Future[NetRes[ForkedLightClientOptimisticUpdate]] {.
raises: [IOError].} =
): Future[NetRes[ForkedLightClientOptimisticUpdate]] =
peer.lightClientOptimisticUpdate()
template valueVerifier[E](