fix mainnet bootstrap node comment parsing; fix nimbus guide grammar (#5486)

This commit is contained in:
tersec 2023-10-06 19:26:30 +00:00 committed by GitHub
parent 5f5e266c20
commit a4cf203849
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 7 deletions

View File

@ -8,11 +8,13 @@
{.push raises: [].} {.push raises: [].}
import import
std/[os, strutils],
chronicles, stew/shims/net, stew/results, chronicles, stew/shims/net, stew/results,
eth/p2p/discoveryv5/[enr, protocol, node], eth/p2p/discoveryv5/[enr, protocol, node],
".."/[conf, conf_light_client] ".."/[conf, conf_light_client]
from std/os import splitFile
from std/strutils import cmpIgnoreCase, split, startsWith, strip, toLowerAscii
export protocol export protocol
type type
@ -23,11 +25,8 @@ export
Eth2DiscoveryProtocol, open, start, close, closeWait, queryRandom, Eth2DiscoveryProtocol, open, start, close, closeWait, queryRandom,
updateRecord, results updateRecord, results
proc parseBootstrapAddress*(address: string): func parseBootstrapAddress*(address: string):
Result[enr.Record, cstring] = Result[enr.Record, cstring] =
logScope:
address = string(address)
let lowerCaseAddress = toLowerAscii(string address) let lowerCaseAddress = toLowerAscii(string address)
if lowerCaseAddress.startsWith("enr:"): if lowerCaseAddress.startsWith("enr:"):
var enrRec: enr.Record var enrRec: enr.Record
@ -54,7 +53,9 @@ proc addBootstrapNode*(bootstrapAddr: string,
if bootstrapAddr.len == 0 or bootstrapAddr[0] == '#': if bootstrapAddr.len == 0 or bootstrapAddr[0] == '#':
return 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: if enrRes.isOk:
bootstrapEnrs.add enrRes.value bootstrapEnrs.add enrRes.value
else: else:

View File

@ -58,7 +58,7 @@ Examples:
- `http://127.0.0.1:5054/#roles=all` - `http://127.0.0.1:5054/#roles=all`
- `http://127.0.0.1:5055/` also means `all` roles. - `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 ## Advanced topologies