From 64d271c809d294895d3e9c89d69e4dc344533264 Mon Sep 17 00:00:00 2001 From: Ben Date: Wed, 4 Jun 2025 12:56:26 +0200 Subject: [PATCH] merge finished --- .../CodexContractsPlugin/ChainMonitor/ChainState.cs | 2 +- .../Marketplace/Customizations.cs | 3 ++- .../Utils/MarketplaceAutoBootstrapDistTest.cs | 11 +++++++++-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/ProjectPlugins/CodexContractsPlugin/ChainMonitor/ChainState.cs b/ProjectPlugins/CodexContractsPlugin/ChainMonitor/ChainState.cs index 5dfa0114..1f260c7d 100644 --- a/ProjectPlugins/CodexContractsPlugin/ChainMonitor/ChainState.cs +++ b/ProjectPlugins/CodexContractsPlugin/ChainMonitor/ChainState.cs @@ -47,7 +47,7 @@ namespace CodexContractsPlugin.ChainMonitor handler = changeHandler; this.doProofPeriodMonitoring = doProofPeriodMonitoring; TotalSpan = new TimeRange(startUtc, startUtc); - PeriodMonitor = new PeriodMonitor(contracts); + PeriodMonitor = new PeriodMonitor(log, contracts); } public TimeRange TotalSpan { get; private set; } diff --git a/ProjectPlugins/CodexContractsPlugin/Marketplace/Customizations.cs b/ProjectPlugins/CodexContractsPlugin/Marketplace/Customizations.cs index fea7ad87..1ac64325 100644 --- a/ProjectPlugins/CodexContractsPlugin/Marketplace/Customizations.cs +++ b/ProjectPlugins/CodexContractsPlugin/Marketplace/Customizations.cs @@ -96,7 +96,8 @@ namespace CodexContractsPlugin.Marketplace public partial class MarketplaceConfig : IMarketplaceConfigInput { - + public int MaxNumberOfSlashes => this.Collateral.MaxNumberOfSlashes; + public TimeSpan PeriodDuration => TimeSpan.FromSeconds(this.Proofs.Period); } } #pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. diff --git a/Tests/CodexReleaseTests/Utils/MarketplaceAutoBootstrapDistTest.cs b/Tests/CodexReleaseTests/Utils/MarketplaceAutoBootstrapDistTest.cs index 26c47600..5c429fee 100644 --- a/Tests/CodexReleaseTests/Utils/MarketplaceAutoBootstrapDistTest.cs +++ b/Tests/CodexReleaseTests/Utils/MarketplaceAutoBootstrapDistTest.cs @@ -53,11 +53,15 @@ namespace CodexReleaseTests.Utils protected abstract ByteSize HostAvailabilitySize { get; } protected abstract TimeSpan HostAvailabilityMaxDuration { get; } protected virtual bool MonitorChainState { get; } = true; + protected TimeSpan HostBlockTTL { get; } = TimeSpan.FromMinutes(1.0); public ICodexNodeGroup StartHosts() { var hosts = StartCodex(NumberOfHosts, s => s .WithName("host") + .WithBlockTTL(HostBlockTTL) + .WithBlockMaintenanceNumber(1000) + .WithBlockMaintenanceInterval(HostBlockTTL / 2) .EnableMarketplace(GetGeth(), GetContracts(), m => m .WithInitial(StartingBalanceEth.Eth(), StartingBalanceTST.Tst()) .AsStorageNode() @@ -70,7 +74,7 @@ namespace CodexReleaseTests.Utils AssertTstBalance(host, StartingBalanceTST.Tst(), nameof(StartHosts)); AssertEthBalance(host, StartingBalanceEth.Eth(), nameof(StartHosts)); - host.Marketplace.MakeStorageAvailable(new StorageAvailability( + host.Marketplace.MakeStorageAvailable(new CreateStorageAvailability( totalSpace: HostAvailabilitySize, maxDuration: HostAvailabilityMaxDuration, minPricePerBytePerSecond: 1.TstWei(), @@ -84,6 +88,9 @@ namespace CodexReleaseTests.Utils { var host = StartCodex(s => s .WithName("singlehost") + .WithBlockTTL(HostBlockTTL) + .WithBlockMaintenanceNumber(1000) + .WithBlockMaintenanceInterval(HostBlockTTL / 2) .EnableMarketplace(GetGeth(), GetContracts(), m => m .WithInitial(StartingBalanceEth.Eth(), StartingBalanceTST.Tst()) .AsStorageNode() @@ -94,7 +101,7 @@ namespace CodexReleaseTests.Utils AssertTstBalance(host, StartingBalanceTST.Tst(), nameof(StartOneHost)); AssertEthBalance(host, StartingBalanceEth.Eth(), nameof(StartOneHost)); - host.Marketplace.MakeStorageAvailable(new StorageAvailability( + host.Marketplace.MakeStorageAvailable(new CreateStorageAvailability( totalSpace: HostAvailabilitySize, maxDuration: HostAvailabilityMaxDuration, minPricePerBytePerSecond: 1.TstWei(),