Add clientInfo to ENR for easier testnet debugging (#1513)

* Add clientInfo to ENR for easier testnet debugging

* Remove git rev from ENR client info

This allows for a shorter ENR which allows more ENRs to be packed
in the Nodes reply. And for glados, only the client name is used
anyhow.
This commit is contained in:
Kim De Mey 2023-09-20 12:19:40 +02:00 committed by GitHub
parent 7af9e3dc53
commit 53df21f000
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

View File

@ -147,6 +147,10 @@ proc run(config: PortalConf) {.raises: [CatchableError].} =
d = newProtocol(
netkey,
extIp, none(Port), extUdpPort,
# Note: The addition of default clientInfo to the ENR is a temporary
# measure to easily identify & debug the clients used in the testnet.
# Might make this into a, default off, cli option.
localEnrFields = {"c": enrClientInfoShort},
bootstrapRecords = bootstrapRecords,
bindIp = bindIp, bindPort = udpPort,
enrAutoUpdate = config.enrAutoUpdate,

View File

@ -9,6 +9,7 @@
import
std/strutils,
stew/byteutils,
metrics
const
@ -38,6 +39,9 @@ const
copyrightBanner* =
"Copyright (c) 2021-" & compileYear & " Status Research & Development GmbH"
# Short debugging identifier to be placed in the ENR
enrClientInfoShort* = toBytes("f")
func getNimGitHash*(): string =
const gitPrefix = "git hash: "
let tmp = splitLines(nimFullBanner)