From 6a5cde2b9183fa4e9ddd393af364e88860f20ff5 Mon Sep 17 00:00:00 2001 From: benbierens Date: Thu, 29 Jun 2023 11:05:58 +0200 Subject: [PATCH] Separate config option for storage space to sell. --- CodexNetDeployer/CodexNodeStarter.cs | 2 +- CodexNetDeployer/Configuration.cs | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CodexNetDeployer/CodexNodeStarter.cs b/CodexNetDeployer/CodexNodeStarter.cs index 898afb6..f6faafa 100644 --- a/CodexNetDeployer/CodexNodeStarter.cs +++ b/CodexNetDeployer/CodexNodeStarter.cs @@ -52,7 +52,7 @@ namespace CodexNetDeployer Console.Write("Tokens minted\t"); var response = marketAccess.MakeStorageAvailable( - totalSpace: (config.StorageQuota!.Value - 1).MB(), + totalSpace: config.StorageSell!.Value.MB(), minPriceForTotalSpace: config.MinPrice.TestTokens(), maxCollateral: config.MaxCollateral.TestTokens(), maxDuration: TimeSpan.FromSeconds(config.MaxDuration)); diff --git a/CodexNetDeployer/Configuration.cs b/CodexNetDeployer/Configuration.cs index d58e233..3d79b0e 100644 --- a/CodexNetDeployer/Configuration.cs +++ b/CodexNetDeployer/Configuration.cs @@ -28,9 +28,12 @@ namespace CodexNetDeployer [Uniform("validators", "v", "VALIDATORS", true, "Number of Codex nodes that will be validating.")] public int? NumberOfValidators { get; set; } - [Uniform("storage-quota", "s", "STORAGEQUOTA", true, "Storage quota in megabytes used by each Codex node.")] + [Uniform("storage-quota", "sq", "STORAGEQUOTA", true, "Storage quota in megabytes used by each Codex node.")] public int? StorageQuota { get; set; } + [Uniform("storage-sell", "ss", "STORAGESELL", true, "Number of megabytes of storage quota to make available for selling.")] + public int? StorageSell { get; set; } + [Uniform("log-level", "l", "LOGLEVEL", true, "Log level used by each Codex node. [Trace, Debug*, Info, Warn, Error]")] public CodexLogLevel CodexLogLevel { get; set; } = CodexLogLevel.Debug; @@ -60,6 +63,10 @@ namespace CodexNetDeployer { errors.Add($"{nameof(NumberOfValidators)} ({NumberOfValidators}) may not be greater than {nameof(NumberOfCodexNodes)} ({NumberOfCodexNodes})."); } + if (StorageSell.HasValue && StorageQuota.HasValue && StorageSell.Value >= StorageQuota.Value) + { + errors.Add("StorageSell cannot be greater than or equal to StorageQuota."); + } return errors; }