Capture only first Geth account.

This commit is contained in:
benbierens 2023-10-23 13:36:20 +02:00
parent a68e849768
commit 5a021a4bfe
No known key found for this signature in database
GPG Key ID: FE44815D96D0A1AA
5 changed files with 16 additions and 21 deletions

View File

@ -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; }
}
}

View File

@ -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();

View File

@ -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)

View File

@ -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<string, int?> 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<string> errors)
{
if (value == null || value.Value < 1)

View File

@ -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 \