Use common format for clientid (#2810)

This commit is contained in:
Jacek Sieka 2024-11-01 15:29:38 +01:00 committed by GitHub
parent 8be105ceaa
commit 20edc0dcf5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 12 additions and 22 deletions

View File

@ -11,6 +11,7 @@
import import
std/[ std/[
options, options,
strformat,
strutils, strutils,
times, times,
os, os,
@ -31,17 +32,6 @@ import
export net, defs export net, defs
const
# TODO: fix this agent-string format to match other
# eth clients format
NimbusIdent* = "$# v$# [$#: $#, $#, $#]" % [
NimbusName,
NimbusVersion,
hostOS,
hostCPU,
VmName,
GitRevision
]
let let
# e.g.: Copyright (c) 2018-2021 Status Research & Development GmbH # e.g.: Copyright (c) 2018-2021 Status Research & Development GmbH
@ -50,16 +40,16 @@ let
" Status Research & Development GmbH" " Status Research & Development GmbH"
# e.g.: # e.g.:
# Nimbus v0.1.0 [windows: amd64, rocksdb, evmc, dda8914f] # nimbus/v0.1.0-abcdef/os-cpu/nim-a.b.c/emvc
# Copyright (c) 2018-2021 Status Research & Development GmbH # Copyright (c) 2018-2021 Status Research & Development GmbH
NimbusBuild* = "$#\p$#" % [ NimbusBuild* = "$#\p$#" % [
NimbusIdent, ClientId,
NimbusCopyright, NimbusCopyright,
] ]
NimbusHeader* = "$#\p\p$#" % [ NimbusHeader* = "$#\p\pNim version $#" % [
NimbusBuild, NimbusBuild,
version.NimVersion NimVersion
] ]
func defaultDataDir*(): string = func defaultDataDir*(): string =
@ -357,8 +347,8 @@ type
agentString* {. agentString* {.
desc: "Node agent string which is used as identifier in network" desc: "Node agent string which is used as identifier in network"
defaultValue: NimbusIdent defaultValue: ClientId
defaultValueDesc: $NimbusIdent defaultValueDesc: $ClientId
name: "agent-string" .}: string name: "agent-string" .}: string
beaconChunkSize* {. beaconChunkSize* {.

View File

@ -7,8 +7,8 @@
# those terms. # those terms.
import import
std/[strutils, os, sequtils], std/[strformat, strutils, os, sequtils],
stew/byteutils stew/byteutils, ./compile_info
const const
sourcePath = currentSourcePath.rsplit({DirSep, AltSep}, 1)[0] sourcePath = currentSourcePath.rsplit({DirSep, AltSep}, 1)[0]
@ -59,6 +59,6 @@ const
GitRevisionBytes* = hexToByteArray[4](GitRevision) GitRevisionBytes* = hexToByteArray[4](GitRevision)
NimVersion* = "Nim version " & $NimMajor & "." & $NimMinor & "." & $NimPatch
FullVersionStr* = "v" & NimbusVersion & "-" & GitRevision FullVersionStr* = "v" & NimbusVersion & "-" & GitRevision
ClientId* = &"{NimbusName}/{FullVersionStr}/{hostOS}-{hostCPU}/Nim-{NimVersion}/{VmName}"

View File

@ -252,7 +252,7 @@ proc rpcMain*() =
# TODO: add more tests here # TODO: add more tests here
test "web3_clientVersion": test "web3_clientVersion":
let res = await client.web3_clientVersion() let res = await client.web3_clientVersion()
check res == NimbusIdent check res == ClientId
test "web3_sha3": test "web3_sha3":
let data = @(NimbusName.toOpenArrayByte(0, NimbusName.len-1)) let data = @(NimbusName.toOpenArrayByte(0, NimbusName.len-1))