From 5a021a4bfea157541ca441f6fc90b0ee37f12ef7 Mon Sep 17 00:00:00 2001 From: benbierens Date: Mon, 23 Oct 2023 13:36:20 +0200 Subject: [PATCH] Capture only first Geth account. --- ProjectPlugins/GethPlugin/GethDeployment.cs | 6 ++--- ProjectPlugins/GethPlugin/GethNode.cs | 4 +--- ProjectPlugins/GethPlugin/GethStarter.cs | 4 ++-- Tools/CodexNetDeployer/Configuration.cs | 22 ++++++++----------- .../CodexNetDeployer/deploy-public-testnet.sh | 1 + 5 files changed, 16 insertions(+), 21 deletions(-) diff --git a/ProjectPlugins/GethPlugin/GethDeployment.cs b/ProjectPlugins/GethPlugin/GethDeployment.cs index b8d9644..36cc1ab 100644 --- a/ProjectPlugins/GethPlugin/GethDeployment.cs +++ b/ProjectPlugins/GethPlugin/GethDeployment.cs @@ -5,13 +5,13 @@ namespace GethPlugin { public class GethDeployment : IHasContainer { - public GethDeployment(RunningContainer container, Port discoveryPort, Port httpPort, Port wsPort, AllGethAccounts allAccounts, string pubKey) + public GethDeployment(RunningContainer container, Port discoveryPort, Port httpPort, Port wsPort, GethAccount account, string pubKey) { Container = container; DiscoveryPort = discoveryPort; HttpPort = httpPort; WsPort = wsPort; - AllAccounts = allAccounts; + Account = account; PubKey = pubKey; } @@ -19,7 +19,7 @@ namespace GethPlugin public Port DiscoveryPort { get; } public Port HttpPort { get; } public Port WsPort { get; } - public AllGethAccounts AllAccounts { get; } + public GethAccount Account { get; } public string PubKey { get; } } } diff --git a/ProjectPlugins/GethPlugin/GethNode.cs b/ProjectPlugins/GethPlugin/GethNode.cs index 8b6a8d8..b08a1e0 100644 --- a/ProjectPlugins/GethPlugin/GethNode.cs +++ b/ProjectPlugins/GethPlugin/GethNode.cs @@ -29,11 +29,9 @@ namespace GethPlugin { this.log = log; StartResult = startResult; - Account = startResult.AllAccounts.Accounts.First(); } public GethDeployment StartResult { get; } - public GethAccount Account { get; } public RunningContainer Container => StartResult.Container; public Ether GetEthBalance() @@ -74,7 +72,7 @@ namespace GethPlugin private NethereumInteraction StartInteraction() { var address = StartResult.Container.GetAddress(GethContainerRecipe.HttpPortTag); - var account = Account; + var account = StartResult.Account; var creator = new NethereumInteractionCreator(log, address.Host, address.Port, account.PrivateKey); return creator.CreateWorkflow(); diff --git a/ProjectPlugins/GethPlugin/GethStarter.cs b/ProjectPlugins/GethPlugin/GethStarter.cs index 23767d2..dc8287c 100644 --- a/ProjectPlugins/GethPlugin/GethStarter.cs +++ b/ProjectPlugins/GethPlugin/GethStarter.cs @@ -26,7 +26,7 @@ namespace GethPlugin var container = containers.Containers[0]; var extractor = new GethContainerInfoExtractor(tools.GetLog(), workflow, container); - var accounts = extractor.ExtractAccounts(); + var account = extractor.ExtractAccounts().Accounts.First(); var pubKey = extractor.ExtractPubKey(); var discoveryPort = container.Recipe.GetPortByTag(GethContainerRecipe.DiscoveryPortTag); @@ -38,7 +38,7 @@ namespace GethPlugin Log($"Geth node started."); - return new GethDeployment(container, discoveryPort, httpPort, wsPort, accounts, pubKey); + return new GethDeployment(container, discoveryPort, httpPort, wsPort, account, pubKey); } public IGethNode WrapGethContainer(GethDeployment startResult) diff --git a/Tools/CodexNetDeployer/Configuration.cs b/Tools/CodexNetDeployer/Configuration.cs index 4da2673..d6907de 100644 --- a/Tools/CodexNetDeployer/Configuration.cs +++ b/Tools/CodexNetDeployer/Configuration.cs @@ -109,9 +109,6 @@ namespace CodexNetDeployer StringIsSet(nameof(KubeConfigFile), KubeConfigFile, errors); StringIsSet(nameof(TestsTypePodLabel), TestsTypePodLabel, errors); - ForEachProperty( - onInt: (n, v) => IntIsOverZero(n, v, errors)); - if (NumberOfValidators > NumberOfCodexNodes) { errors.Add($"{nameof(NumberOfValidators)} ({NumberOfValidators}) may not be greater than {nameof(NumberOfCodexNodes)} ({NumberOfCodexNodes})."); @@ -121,6 +118,15 @@ namespace CodexNetDeployer errors.Add("StorageSell cannot be greater than or equal to StorageQuota."); } + if (ShouldMakeStorageAvailable) + { + IntIsOverZero(nameof(StorageSell), StorageSell, errors); + IntIsOverZero(nameof(InitialTestTokens), InitialTestTokens, errors); + IntIsOverZero(nameof(MinPrice), MinPrice, errors); + IntIsOverZero(nameof(MaxCollateral), MaxCollateral, errors); + IntIsOverZero(nameof(MaxDuration), MaxDuration, errors); + } + if (IsPublicTestNet) { if (string.IsNullOrEmpty(PublicIP)) errors.Add("Public IP required when deploying public testnet."); @@ -132,16 +138,6 @@ namespace CodexNetDeployer return errors; } - private void ForEachProperty(Action onInt) - { - var properties = GetType().GetProperties(); - foreach (var p in properties) - { - if (p.PropertyType == typeof(int?)) onInt(p.Name, (int?)p.GetValue(this)!); - if (p.PropertyType == typeof(int)) onInt(p.Name, (int)p.GetValue(this)!); - } - } - private static void IntIsOverZero(string variable, int? value, List errors) { if (value == null || value.Value < 1) diff --git a/Tools/CodexNetDeployer/deploy-public-testnet.sh b/Tools/CodexNetDeployer/deploy-public-testnet.sh index 53fb267..4e649a8 100644 --- a/Tools/CodexNetDeployer/deploy-public-testnet.sh +++ b/Tools/CodexNetDeployer/deploy-public-testnet.sh @@ -6,6 +6,7 @@ dotnet run \ --nodes=3 \ --validators=1 \ --log-level=Trace \ + --storage-quota=2048 \ --make-storage-available=0 \ --block-ttl=180 \ --block-mi=120 \