From a4cf20384921d2f9e6a58bb7a2ace53d745e4fc0 Mon Sep 17 00:00:00 2001 From: tersec Date: Fri, 6 Oct 2023 19:26:30 +0000 Subject: [PATCH] fix mainnet bootstrap node comment parsing; fix nimbus guide grammar (#5486) --- beacon_chain/networking/eth2_discovery.nim | 13 +++++++------ .../the_nimbus_book/src/validator-client-options.md | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/beacon_chain/networking/eth2_discovery.nim b/beacon_chain/networking/eth2_discovery.nim index a1f69c81f..040cdb64e 100644 --- a/beacon_chain/networking/eth2_discovery.nim +++ b/beacon_chain/networking/eth2_discovery.nim @@ -8,11 +8,13 @@ {.push raises: [].} import - std/[os, strutils], chronicles, stew/shims/net, stew/results, eth/p2p/discoveryv5/[enr, protocol, node], ".."/[conf, conf_light_client] +from std/os import splitFile +from std/strutils import cmpIgnoreCase, split, startsWith, strip, toLowerAscii + export protocol type @@ -23,11 +25,8 @@ export Eth2DiscoveryProtocol, open, start, close, closeWait, queryRandom, updateRecord, results -proc parseBootstrapAddress*(address: string): +func parseBootstrapAddress*(address: string): Result[enr.Record, cstring] = - logScope: - address = string(address) - let lowerCaseAddress = toLowerAscii(string address) if lowerCaseAddress.startsWith("enr:"): var enrRec: enr.Record @@ -54,7 +53,9 @@ proc addBootstrapNode*(bootstrapAddr: string, if bootstrapAddr.len == 0 or bootstrapAddr[0] == '#': return - let enrRes = parseBootstrapAddress(bootstrapAddr) + # Ignore comments in + # https://github.com/eth-clients/eth2-networks/blob/063f826a03676c33c95a66306916f18b690d35eb/shared/mainnet/bootstrap_nodes.txt + let enrRes = parseBootstrapAddress(bootstrapAddr.split(" # ")[0]) if enrRes.isOk: bootstrapEnrs.add enrRes.value else: diff --git a/docs/the_nimbus_book/src/validator-client-options.md b/docs/the_nimbus_book/src/validator-client-options.md index 01f486898..4c78677a5 100644 --- a/docs/the_nimbus_book/src/validator-client-options.md +++ b/docs/the_nimbus_book/src/validator-client-options.md @@ -58,7 +58,7 @@ Examples: - `http://127.0.0.1:5054/#roles=all` - `http://127.0.0.1:5055/` also means `all` roles. -Before usage all the roles are got stripped from BN URLs. +Before usage, all the roles are stripped from beacon node URLs. ## Advanced topologies