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
std/[
options,
strformat,
strutils,
times,
os,
@ -31,17 +32,6 @@ import
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
# e.g.: Copyright (c) 2018-2021 Status Research & Development GmbH
@ -50,16 +40,16 @@ let
" Status Research & Development GmbH"
# 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
NimbusBuild* = "$#\p$#" % [
NimbusIdent,
ClientId,
NimbusCopyright,
]
NimbusHeader* = "$#\p\p$#" % [
NimbusHeader* = "$#\p\pNim version $#" % [
NimbusBuild,
version.NimVersion
NimVersion
]
func defaultDataDir*(): string =
@ -357,8 +347,8 @@ type
agentString* {.
desc: "Node agent string which is used as identifier in network"
defaultValue: NimbusIdent
defaultValueDesc: $NimbusIdent
defaultValue: ClientId
defaultValueDesc: $ClientId
name: "agent-string" .}: string
beaconChunkSize* {.

View File

@ -7,8 +7,8 @@
# those terms.
import
std/[strutils, os, sequtils],
stew/byteutils
std/[strformat, strutils, os, sequtils],
stew/byteutils, ./compile_info
const
sourcePath = currentSourcePath.rsplit({DirSep, AltSep}, 1)[0]
@ -59,6 +59,6 @@ const
GitRevisionBytes* = hexToByteArray[4](GitRevision)
NimVersion* = "Nim version " & $NimMajor & "." & $NimMinor & "." & $NimPatch
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
test "web3_clientVersion":
let res = await client.web3_clientVersion()
check res == NimbusIdent
check res == ClientId
test "web3_sha3":
let data = @(NimbusName.toOpenArrayByte(0, NimbusName.len-1))