Add a version to fluffy and add web3_clientVersion JSON-RPC (#1531)
This commit is contained in:
parent
fdad9cfd00
commit
fb81937708
|
@ -19,7 +19,8 @@ import
|
|||
beacon_chain/spec/datatypes/altair,
|
||||
beacon_chain/gossip_processing/light_client_processor,
|
||||
./conf, ./network_metadata, ./common/common_utils,
|
||||
./rpc/[rpc_eth_api, rpc_discovery_api, rpc_portal_api, rpc_portal_debug_api],
|
||||
./rpc/[rpc_web3_api, rpc_eth_api, rpc_discovery_api, rpc_portal_api,
|
||||
rpc_portal_debug_api],
|
||||
./network/state/[state_network, state_content],
|
||||
./network/history/[history_network, history_content],
|
||||
./network/beacon_light_client/[
|
||||
|
@ -246,6 +247,7 @@ proc run(config: PortalConf) {.raises: [CatchableError].} =
|
|||
let ta = initTAddress(config.rpcAddress, config.rpcPort)
|
||||
var rpcHttpServerWithProxy = RpcProxy.new([ta], config.proxyUri)
|
||||
rpcHttpServerWithProxy.installDiscoveryApiHandlers(d)
|
||||
rpcHttpServerWithProxy.installWeb3ApiHandlers()
|
||||
if stateNetwork.isSome():
|
||||
rpcHttpServerWithProxy.installPortalApiHandlers(
|
||||
stateNetwork.get().portalProtocol, "state")
|
||||
|
|
|
@ -15,3 +15,4 @@ import
|
|||
export rpcclient, rpc_types, hexstrings, errors
|
||||
|
||||
createRpcSigs(RpcClient, currentSourcePath.parentDir / "rpc_calls" / "rpc_eth_calls.nim")
|
||||
createRpcSigs(RpcClient, currentSourcePath.parentDir / "rpc_calls" / "rpc_web3_calls.nim")
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
proc web3_clientVersion(): string
|
|
@ -0,0 +1,20 @@
|
|||
# Nimbus fluffy
|
||||
# Copyright (c) 2023 Status Research & Development GmbH
|
||||
# Licensed and distributed under either of
|
||||
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
|
||||
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
|
||||
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
||||
|
||||
{.push raises: [].}
|
||||
|
||||
import
|
||||
json_rpc/[rpcproxy, rpcserver],
|
||||
../version
|
||||
|
||||
export rpcserver
|
||||
|
||||
proc installWeb3ApiHandlers*(rpcServer: RpcServer|RpcProxy)
|
||||
{.raises: [CatchableError].} =
|
||||
|
||||
rpcServer.rpc("web3_clientVersion") do() -> string:
|
||||
return clientVersion
|
|
@ -0,0 +1,32 @@
|
|||
# Nimbus fluffy
|
||||
# Copyright (c) 2023 Status Research & Development GmbH
|
||||
# Licensed and distributed under either of
|
||||
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
|
||||
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
|
||||
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
||||
|
||||
{.push raises: [].}
|
||||
|
||||
import strutils
|
||||
|
||||
const
|
||||
versionMajor* = 0
|
||||
versionMinor* = 1
|
||||
versionBuild* = 0
|
||||
|
||||
gitRevision* = strip(staticExec("git rev-parse --short HEAD"))[0..5]
|
||||
|
||||
versionAsStr* =
|
||||
$versionMajor & "." & $versionMinor & "." & $versionBuild
|
||||
|
||||
fullVersionStr* = "v" & versionAsStr & "-" & gitRevision
|
||||
|
||||
clientName* = "fluffy"
|
||||
|
||||
nimVersion* = staticExec("nim --version | grep -oP '[0-9]+\\.[0-9]+\\.[0-9]+'")
|
||||
|
||||
# The web3_clientVersion
|
||||
clientVersion* = clientName & "/" &
|
||||
fullVersionStr & "/" &
|
||||
hostOS & "-" & hostCPU & "/" &
|
||||
"Nim" & nimVersion
|
Loading…
Reference in New Issue