From dc9577613f25012912bd4fe88f4531bacd6a1c9c Mon Sep 17 00:00:00 2001 From: benbierens Date: Fri, 21 Apr 2023 09:11:45 +0200 Subject: [PATCH] Debugging geth bootnode setup --- .../Marketplace/ContainerInfoExtractor.cs | 13 +++++++++---- .../Marketplace/GethContainerRecipe.cs | 18 ++++++++++++++---- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/DistTestCore/Marketplace/ContainerInfoExtractor.cs b/DistTestCore/Marketplace/ContainerInfoExtractor.cs index 09d8aef..60470b8 100644 --- a/DistTestCore/Marketplace/ContainerInfoExtractor.cs +++ b/DistTestCore/Marketplace/ContainerInfoExtractor.cs @@ -97,7 +97,8 @@ namespace DistTestCore.Marketplace public class PubKeyFinder : LogHandler, ILogHandler { - private const string openTag = "self=\"enode://"; + private const string openTag = "self=enode://"; + private const string openTagQuote = "self=\"enode://"; private string pubKey = string.Empty; public string GetPubKey() @@ -109,13 +110,17 @@ namespace DistTestCore.Marketplace { if (line.Contains(openTag)) { - ExtractPubKey(line); + ExtractPubKey(openTag, line); + } + else if (line.Contains(openTagQuote)) + { + ExtractPubKey(openTagQuote, line); } } - private void ExtractPubKey(string line) + private void ExtractPubKey(string tag, string line) { - var openIndex = line.IndexOf(openTag) + openTag.Length; + var openIndex = line.IndexOf(tag) + tag.Length; var closeIndex = line.IndexOf("@"); pubKey = line.Substring( diff --git a/DistTestCore/Marketplace/GethContainerRecipe.cs b/DistTestCore/Marketplace/GethContainerRecipe.cs index 5067cf7..f2c9d7c 100644 --- a/DistTestCore/Marketplace/GethContainerRecipe.cs +++ b/DistTestCore/Marketplace/GethContainerRecipe.cs @@ -28,11 +28,21 @@ namespace DistTestCore.Marketplace if (config.IsBootstrapNode) { - AddEnvVar("IS_BOOTSTRAP", "1"); - var exposedPort = AddExposedPort(tag: HttpPortTag); - return $"--http.port {exposedPort.Number} --discovery.port {discovery.Number} --nodiscover"; + return CreateBootstapArgs(discovery); } + return CreateCompanionArgs(discovery, config); + } + + private string CreateBootstapArgs(Port discovery) + { + AddEnvVar("IS_BOOTSTRAP", "1"); + var exposedPort = AddExposedPort(tag: HttpPortTag); + return $"--http.port {exposedPort.Number} --port {discovery.Number} --discovery.port {discovery.Number}"; + } + + private string CreateCompanionArgs(Port discovery, GethStartupConfig config) + { var port = AddInternalPort(); var authRpc = AddInternalPort(); var httpPort = AddInternalPort(tag: HttpPortTag); @@ -43,7 +53,7 @@ namespace DistTestCore.Marketplace var bootPort = config.BootstrapNode.DiscoveryPort.Number; var bootstrapArg = $"--bootnodes enode://{bootPubKey}@{bootIp}:{bootPort}"; - return $"--port {port.Number} --discovery.port {discovery.Number} --authrpc.port {authRpc.Number} --http.port {httpPort.Number} --ws --ws.addr 0.0.0.0 --ws.port {wsPort.Number} --nodiscover {bootstrapArg}"; + return $"--port {port.Number} --discovery.port {discovery.Number} --authrpc.port {authRpc.Number} --http.port {httpPort.Number} --ws --ws.addr 0.0.0.0 --ws.port {wsPort.Number} {bootstrapArg}"; } } }